aefis-core-ui 2.1.17 → 2.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.modern.js +56 -34
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -8086,30 +8086,35 @@ const FilterChips = ({
|
|
|
8086
8086
|
if (_filters.length === 0 && _sort.length === 0) return /*#__PURE__*/jsx("div", {
|
|
8087
8087
|
children: "No filters or sorting criteria selected"
|
|
8088
8088
|
});
|
|
8089
|
-
const Filters = useMemo(() =>
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
displayOptions: {
|
|
8101
|
-
hasIcon: filter.type !== "keyword"
|
|
8089
|
+
const Filters = useMemo(() => {
|
|
8090
|
+
return /*#__PURE__*/jsx(Box$1, {
|
|
8091
|
+
sx: {
|
|
8092
|
+
display: "flex"
|
|
8093
|
+
},
|
|
8094
|
+
children: _filters.map(filter => /*#__PURE__*/jsx(Grow, {
|
|
8095
|
+
in: true,
|
|
8096
|
+
children: /*#__PURE__*/jsx("div", {
|
|
8097
|
+
style: {
|
|
8098
|
+
margin: 2,
|
|
8099
|
+
display: "inline-flex"
|
|
8102
8100
|
},
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8101
|
+
children: /*#__PURE__*/jsx(BusinessObject, {
|
|
8102
|
+
variant: "chip",
|
|
8103
|
+
size: "small",
|
|
8104
|
+
displayOptions: {
|
|
8105
|
+
hasIcon: filter.type !== "keyword"
|
|
8106
|
+
},
|
|
8107
|
+
type: "businessObject",
|
|
8108
|
+
template: filter.template,
|
|
8109
|
+
data: filter.data,
|
|
8110
|
+
onDelete: () => {
|
|
8111
|
+
onFilterDelete(filter);
|
|
8112
|
+
}
|
|
8113
|
+
}, filter.data.id)
|
|
8114
|
+
})
|
|
8115
|
+
}, `filterPanelFilter-${filter.index}-${filter.id}`))
|
|
8116
|
+
});
|
|
8117
|
+
}, [_filters]);
|
|
8113
8118
|
const SortItems = useMemo(() => /*#__PURE__*/jsx(Fragment, {
|
|
8114
8119
|
children: _sort.map(sortItem => /*#__PURE__*/jsx(Grow, {
|
|
8115
8120
|
in: true,
|
|
@@ -8196,7 +8201,7 @@ const FilterSelection = ({
|
|
|
8196
8201
|
children: "Apply All Filters"
|
|
8197
8202
|
}), /*#__PURE__*/jsx(Button, {
|
|
8198
8203
|
name: "reset all filters",
|
|
8199
|
-
disabled: !(filters.length > 0),
|
|
8204
|
+
disabled: !(filters.length > 0 || sort.length > 0),
|
|
8200
8205
|
variant: "contained",
|
|
8201
8206
|
color: "grey",
|
|
8202
8207
|
onClick: onResetFilters,
|
|
@@ -8378,6 +8383,7 @@ const FilterPanel = props => {
|
|
|
8378
8383
|
const [menuPosition, setMenuPosition] = useState(null);
|
|
8379
8384
|
const [filters, setFilters] = useState([]);
|
|
8380
8385
|
const [sort, setSort] = useState(sortProp || []);
|
|
8386
|
+
const [panelSearch, setPanelSearch] = useState([]);
|
|
8381
8387
|
const [pickerFilters, setPickerFilters] = useState([]);
|
|
8382
8388
|
useEffect(() => {
|
|
8383
8389
|
const formattedFilters = formatFilters(filtersProp, configuration);
|
|
@@ -8409,6 +8415,7 @@ const FilterPanel = props => {
|
|
|
8409
8415
|
}
|
|
8410
8416
|
}, [filters, sort]);
|
|
8411
8417
|
const removeFilter = filter => {
|
|
8418
|
+
console.log("remove filter ", filter);
|
|
8412
8419
|
const newFilterArray = filters == null ? void 0 : filters.filter(i => i.index !== filter.index || filter.id !== i.id);
|
|
8413
8420
|
setFilters(newFilterArray);
|
|
8414
8421
|
if (!onApplyFilters) {
|
|
@@ -8529,6 +8536,8 @@ const FilterPanel = props => {
|
|
|
8529
8536
|
const handleResetFilters = () => {
|
|
8530
8537
|
setPickerFilters([]);
|
|
8531
8538
|
setFilters([]);
|
|
8539
|
+
setSort([]);
|
|
8540
|
+
setPanelSearch([]);
|
|
8532
8541
|
if (!onChange && onApplyFilters) {
|
|
8533
8542
|
onApplyFilters({}, []);
|
|
8534
8543
|
}
|
|
@@ -8537,6 +8546,8 @@ const FilterPanel = props => {
|
|
|
8537
8546
|
}
|
|
8538
8547
|
};
|
|
8539
8548
|
const handleSearchChange = keyword => {
|
|
8549
|
+
if (panelSearch.includes(keyword)) return;
|
|
8550
|
+
setPanelSearch([...panelSearch, keyword]);
|
|
8540
8551
|
addFilter({
|
|
8541
8552
|
index: -1,
|
|
8542
8553
|
type: "keyword",
|
|
@@ -10470,6 +10481,15 @@ const useIsError = status => {
|
|
|
10470
10481
|
}, [status]);
|
|
10471
10482
|
return isError;
|
|
10472
10483
|
};
|
|
10484
|
+
const initialFilterState = {
|
|
10485
|
+
filter: {},
|
|
10486
|
+
searchText: "",
|
|
10487
|
+
filterArray: [],
|
|
10488
|
+
filterCount: 0,
|
|
10489
|
+
sort: [],
|
|
10490
|
+
sortCount: 0,
|
|
10491
|
+
sortQueryParams: null
|
|
10492
|
+
};
|
|
10473
10493
|
const RichDataTable = /*#__PURE__*/forwardRef(function RichDatatable(props, ref) {
|
|
10474
10494
|
var _props$filterPanelCon, _props$rowActions, _props$dataTableProps, _props$dataTableProps2;
|
|
10475
10495
|
const didMount = useDidMount();
|
|
@@ -10495,15 +10515,8 @@ const RichDataTable = /*#__PURE__*/forwardRef(function RichDatatable(props, ref)
|
|
|
10495
10515
|
const [formatDrawerContent, setFormatDrawerContent] = useState(false);
|
|
10496
10516
|
const [enableTableRowAction, setEnableTableRowAction] = useState(false);
|
|
10497
10517
|
const [selectedRowCount, setSelectedRowCount] = useState(0);
|
|
10498
|
-
const [filterPanelState, setFilterPanelState] = useState(
|
|
10499
|
-
|
|
10500
|
-
searchText: "",
|
|
10501
|
-
filterArray: [],
|
|
10502
|
-
filterCount: 0,
|
|
10503
|
-
sort: [],
|
|
10504
|
-
sortCount: 0,
|
|
10505
|
-
sortQueryParams: null
|
|
10506
|
-
});
|
|
10518
|
+
const [filterPanelState, setFilterPanelState] = useState(initialFilterState);
|
|
10519
|
+
console.log("filterPanelState ", filterPanelState);
|
|
10507
10520
|
const {
|
|
10508
10521
|
info,
|
|
10509
10522
|
error
|
|
@@ -10626,6 +10639,15 @@ const RichDataTable = /*#__PURE__*/forwardRef(function RichDatatable(props, ref)
|
|
|
10626
10639
|
};
|
|
10627
10640
|
const handleFilterChange = (filters, newFilterArray) => {
|
|
10628
10641
|
props == null ? void 0 : props.onFilterChange == null ? void 0 : props.onFilterChange(filters);
|
|
10642
|
+
|
|
10643
|
+
// TODO: apply better approach by gathering handling of all search and
|
|
10644
|
+
// filter changes with onChange; also send operation type to onChange
|
|
10645
|
+
// events
|
|
10646
|
+
const isReset = newFilterArray.length === 0;
|
|
10647
|
+
if (isReset) {
|
|
10648
|
+
setFilterPanelState(() => _extends({}, initialFilterState));
|
|
10649
|
+
return;
|
|
10650
|
+
}
|
|
10629
10651
|
setFilterPanelState(prev => _extends({}, prev, {
|
|
10630
10652
|
filterCount: Object.keys(filters).length,
|
|
10631
10653
|
filter: filters,
|
|
@@ -10720,7 +10742,7 @@ const RichDataTable = /*#__PURE__*/forwardRef(function RichDatatable(props, ref)
|
|
|
10720
10742
|
exportOptions: props.exportOptions,
|
|
10721
10743
|
actions: props.actions && props.actions.length > 0 || props.addAction ? updateActions(props.actions, handleDrawerOpen, enableTableRowAction, selectedRowCount, Add) : undefined,
|
|
10722
10744
|
onFilterClick: isFilterPanelEnabled ? handleFilterClick : undefined,
|
|
10723
|
-
hasFilters: filterPanelState.filterCount > 0 || filterPanelState.sortCount > 0,
|
|
10745
|
+
hasFilters: filterPanelState.filterCount > 0 || filterPanelState.sortCount > 0 || filterPanelState.searchText,
|
|
10724
10746
|
disableFilterButton: isFetching
|
|
10725
10747
|
}, props.titleAndActionHeaderProps)), /*#__PURE__*/jsx(DataTable, _extends({}, props, {
|
|
10726
10748
|
tableRef: DataTableRef,
|