Liferay.Loader.define("@liferay/object-web@1.0.145/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 t;const[{creationLanguageId:r,filterOperators:c,objectFields:s,objectView:u,workflowStatusJSONArray:d},f]=(0,l.useViewContext)(),{objectViewFilterColumns:y}=u,[p,b]=(0,n.useState)(""),[g,j]=(0,n.useState)(!1),[O,m]=(0,n.useState)(!1),{observer:w,onClose:L}=(0,a.useModal)({onClose:()=>{j(!1),m(!1)}});return n.default.createElement(n.default.Fragment,null,n.default.createElement(i.BuilderScreen,{creationLanguageId:r,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!==(t=y.map((e=>"createDate"===e.objectFieldName||"modifiedDate"===e.objectFieldName?_objectSpread(_objectSpread({},e),{},{disableEdit:!0}):e)))&&void 0!==t?t:[],onDeleteColumn:e=>{f({payload:{objectFieldName:e},type:l.TYPES.DELETE_OBJECT_VIEW_FILTER_COLUMN})},onEditing:j,onEditingObjectFieldName:b,onVisibleEditModal:m,openModal:()=>m(!0),secondColumnHeader:Liferay.Language.get("type"),thirdColumnHeader:Liferay.Language.get("value"),title:Liferay.Language.get("filters")}),O&&n.default.createElement(o.ModalAddFilter,{creationLanguageId:r,currentFilters:y,disableDateValues:!0,editingFilter:g,editingObjectFieldName:p,filterOperators:c,header:Liferay.Language.get("new-filter"),objectFields:g?s:s.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:w,onClose:L,onSave:(e,t,a,i,n,o)=>{f(g?{payload:{filterType:n,objectFieldName:e,valueList:o},type:l.TYPES.EDIT_OBJECT_VIEW_FILTER_COLUMN}:{payload:{creationLanguageId:r,filterType:n,objectFieldName:e,valueList:o},type:l.TYPES.ADD_OBJECT_VIEW_FILTER_COLUMN})},validate:({checkedItems:t,disableDateValues:r,selectedFilterBy:a,selectedFilterType:i,setErrors:n})=>{n({});const o={};return a||(o.selectedFilterBy=e),i||r||"status"===(null==a?void 0:a.name)&&"Picklist"===(null==a?void 0:a.businessType)||(o.selectedFilterType=e),!i||"status"!==(null==a?void 0:a.name)&&"Picklist"!==(null==a?void 0:a.businessType)&&"Relationship"!==(null==a?void 0:a.businessType)||t.length||(o.items=e),n(o),o},workflowStatusJSONArray:d}))};var a=r("@frontend-taglib-clay$clayui/modal"),i=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={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var n=a?Object.getOwnPropertyDescriptor(e,i):null;n&&(n.get||n.set)?Object.defineProperty(r,i,n):r[i]=e[i]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react")),o=r("../../ModalAddFilter"),l=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 a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}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}const e=Liferay.Language.get("required")}}));
//# sourceMappingURL=FilterScreen.js.map