Liferay.Loader.define("@liferay/object-web@1.0.181/js/components/ObjectView/FilterScreen/FilterScreen",["module","exports","require","@frontend-taglib-clay$clayui/modal","@liferay/object-js-components-web","liferay!frontend-js-react-web$react","../../ModalAddFilter","../objectViewContext"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.FilterScreen=function FilterScreen(){var e;const[{creationLanguageId:t,filterOperators:r,objectFields:c,objectView:s,workflowStatusJSONArray:u},d]=(0,o.useViewContext)(),{objectViewFilterColumns:f}=s,[y,p]=(0,n.useState)(""),[b,g]=(0,n.useState)(!1),[j,O]=(0,n.useState)(!1),{observer:m,onClose:w}=(0,i.useModal)({onClose:()=>{g(!1),O(!1)}});return n.default.createElement(n.default.Fragment,null,n.default.createElement(a.BuilderScreen,{creationLanguageId:t,emptyState:{buttonText:Liferay.Language.get("new-filter"),description:Liferay.Language.get("start-creating-a-filter-to-display-specific-data"),title:Liferay.Language.get("no-filter-was-created-yet")},filter:!0,firstColumnHeader:Liferay.Language.get("filter-by"),objectColumns:null!==(e=f.map((e=>"createDate"===e.objectFieldName||"modifiedDate"===e.objectFieldName?_objectSpread(_objectSpread({},e),{},{disableEdit:!0}):e)))&&void 0!==e?e:[],onDeleteColumn:e=>{d({payload:{objectFieldName:e},type:o.TYPES.DELETE_OBJECT_VIEW_FILTER_COLUMN})},onEditing:g,onEditingObjectFieldName:p,onVisibleEditModal:O,openModal:()=>O(!0),secondColumnHeader:Liferay.Language.get("type"),thirdColumnHeader:Liferay.Language.get("value"),title:Liferay.Language.get("filters")}),j&&n.default.createElement(l.ModalAddFilter,{creationLanguageId:t,currentFilters:f,disableDateValues:!0,editingFilter:b,editingObjectFieldName:y,filterOperators:r,header:Liferay.Language.get("new-filter"),objectFields:b?c:c.filter((e=>{if("Picklist"===e.businessType||"MultiselectPicklist"===e.businessType||"Relationship"===e.businessType||"createDate"===e.name||"modifiedDate"===e.name||"status"===e.name&&!e.hasFilter)return e})),observer:m,onClose:w,onSave:(e,r,i,a,n,l)=>{d(b?{payload:{filterType:n,objectFieldName:e,valueList:l},type:o.TYPES.EDIT_OBJECT_VIEW_FILTER_COLUMN}:{payload:{creationLanguageId:t,filterType:n,objectFieldName:e,valueList:l},type:o.TYPES.ADD_OBJECT_VIEW_FILTER_COLUMN})},validate:({checkedItems:e,disableDateValues:t,selectedFilterBy:r,selectedFilterType:i,setErrors:n})=>{n({});const l={};return r||(l.selectedFilterBy=a.REQUIRED_MSG),i||t||"status"===(null==r?void 0:r.name)&&"Picklist"===(null==r?void 0:r.businessType)||(l.selectedFilterType=a.REQUIRED_MSG),!i||"status"!==(null==r?void 0:r.name)&&"Picklist"!==(null==r?void 0:r.businessType)&&"Relationship"!==(null==r?void 0:r.businessType)||e.length||(l.items=a.REQUIRED_MSG),n(l),l},workflowStatusJSONArray:u}))};var i=r("@frontend-taglib-clay$clayui/modal"),a=r("@liferay/object-js-components-web"),n=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var n=i?Object.getOwnPropertyDescriptor(e,a):null;n&&(n.get||n.set)?Object.defineProperty(r,a,n):r[a]=e[a]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react")),l=r("../../ModalAddFilter"),o=r("../objectViewContext");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}}}));
//# sourceMappingURL=FilterScreen.js.map