sccoreui 6.4.85 → 6.4.87

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.
@@ -36,9 +36,9 @@ function Search({ searchPlaceHolder }) {
36
36
  }, [deboucedValue]);
37
37
  return (0, utilComponents_1.skeletonLoding)() ? ((0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, { height: "40px", width: "336px" })) : ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `p-input-icon-left ${inputValue.length > 0 ? "p-input-icon-right" : ""}` }, { children: [(0, jsx_runtime_1.jsx)("span", Object.assign({ className: "p-input-prefix zoom_animate" }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { color: "#667085", icon: "search-lg", size: 18, disabled: isDisabled }) })), inputValue.length > 0 && ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: "p-input-suffix cursor-pointer zoom_animate", onClick: () => {
38
38
  var _a, _b;
39
+ (_a = gridApi === null || gridApi === void 0 ? void 0 : gridApi.current.api) === null || _a === void 0 ? void 0 : _a.hideOverlay();
39
40
  if (rowModelType === constants_1.ROWMODELTYPE.CLIENT_SIDE && quickSearch) {
40
- (_a = gridApi === null || gridApi === void 0 ? void 0 : gridApi.current.api) === null || _a === void 0 ? void 0 : _a.setGridOption("quickFilterText", "");
41
- (_b = gridApi === null || gridApi === void 0 ? void 0 : gridApi.current.api) === null || _b === void 0 ? void 0 : _b.hideOverlay();
41
+ (_b = gridApi === null || gridApi === void 0 ? void 0 : gridApi.current.api) === null || _b === void 0 ? void 0 : _b.setGridOption("quickFilterText", "");
42
42
  }
43
43
  else {
44
44
  setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { searchedText: "" }));
@@ -137,8 +137,8 @@ const TableFilter = () => {
137
137
  const createViewFromFilters = () => {
138
138
  const newFilters = conditionsArray.map((condition) => {
139
139
  // Convert value type to string when data comes in object or array form
140
- if (typeof condition.value !== "string")
141
- condition.value = JSON.stringify(condition.value);
140
+ // if (typeof condition.value !== "string")
141
+ // condition.value = JSON.stringify(condition.value);
142
142
  return Object.assign(Object.assign({}, condition), { isActive: true, logicalOperator: conditionType.id });
143
143
  });
144
144
  const viewDetails = {
@@ -9,10 +9,12 @@ const helper_1 = require("../helper");
9
9
  const utilComponents_1 = require("../utilComponents");
10
10
  const FeatureSkeleton_1 = tslib_1.__importDefault(require("../../skeletons/FeatureSkeleton"));
11
11
  function RefreshGrid() {
12
- const { removeFeaturesAndRefresh, conditionsToDisplay } = (0, react_1.useContext)(context_provider_1.FeatureContext);
12
+ const { removeFeaturesAndRefresh, conditionsToDisplay, gridApi } = (0, react_1.useContext)(context_provider_1.FeatureContext);
13
13
  const isDisabled = (0, helper_1.isComponentDisable)(conditionsToDisplay.displayRefresh);
14
14
  const refreshHandler = () => {
15
+ var _a;
15
16
  if (!isDisabled) {
17
+ (_a = gridApi === null || gridApi === void 0 ? void 0 : gridApi.current.api) === null || _a === void 0 ? void 0 : _a.hideOverlay();
16
18
  removeFeaturesAndRefresh();
17
19
  }
18
20
  };
@@ -10,8 +10,7 @@ const utilComponents_1 = require("../utilComponents");
10
10
  const FeatureSkeleton_1 = tslib_1.__importDefault(require("../../skeletons/FeatureSkeleton"));
11
11
  function RemoveItems(props) {
12
12
  var _a;
13
- const { featureDetails, conditionsToDisplay } = (0, react_1.useContext)(context_provider_1.FeatureContext);
14
- console.log(featureDetails, "remove-feature-details");
13
+ const { featureDetails, conditionsToDisplay, serverSideSelectRow, gridApi } = (0, react_1.useContext)(context_provider_1.FeatureContext);
15
14
  const { removeCallBack } = props;
16
15
  const isDisabled = (0, helper_1.isComponentDisable)(conditionsToDisplay.displayRemoveItems);
17
16
  const removeItemsCallBack = () => {
@@ -22,6 +21,26 @@ function RemoveItems(props) {
22
21
  removeCallBack(currentFeature);
23
22
  }
24
23
  };
25
- return (0, utilComponents_1.skeletonLoding)() ? ((0, jsx_runtime_1.jsx)(FeatureSkeleton_1.default, {})) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (((_a = featureDetails === null || featureDetails === void 0 ? void 0 : featureDetails.checkBoxSelection) === null || _a === void 0 ? void 0 : _a.allBoxChecked) || featureDetails.checkBoxSelection.includedRecords.length > 1) ? (0, jsx_runtime_1.jsx)("div", Object.assign({ className: `rounded_btn sc_icon_hover icon-40x40 ${isDisabled && "disabled"}`, onClick: removeItemsCallBack, title: "Remove" }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "minus-circle", color: "text-red-800", size: 18 }) })) : "" }));
24
+ const checkShowRemoveIcon = (0, react_1.useMemo)(() => {
25
+ var _a, _b, _c, _d;
26
+ const model = (_b = (_a = gridApi === null || gridApi === void 0 ? void 0 : gridApi.current) === null || _a === void 0 ? void 0 : _a.api) === null || _b === void 0 ? void 0 : _b.getModel();
27
+ const selectedNodes = [];
28
+ if (model) {
29
+ const rowCount = model.getRowCount();
30
+ for (let i = 0; i < rowCount; i++) {
31
+ const rowNode = model.getRow(i);
32
+ if (((_c = rowNode === null || rowNode === void 0 ? void 0 : rowNode.data) === null || _c === void 0 ? void 0 : _c.isSelected) === true) {
33
+ selectedNodes.push(rowNode.data);
34
+ if (selectedNodes.length > 1) {
35
+ break;
36
+ }
37
+ // ✅ This break is valid
38
+ }
39
+ }
40
+ }
41
+ return (((_d = featureDetails === null || featureDetails === void 0 ? void 0 : featureDetails.checkBoxSelection) === null || _d === void 0 ? void 0 : _d.allBoxChecked) ||
42
+ featureDetails.checkBoxSelection.includedRecords.length > 1 || selectedNodes.length > 1);
43
+ }, [serverSideSelectRow, featureDetails === null || featureDetails === void 0 ? void 0 : featureDetails.checkBoxSelection]);
44
+ return (0, utilComponents_1.skeletonLoding)() ? ((0, jsx_runtime_1.jsx)(FeatureSkeleton_1.default, {})) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (serverSideSelectRow ? checkShowRemoveIcon : (((_a = featureDetails === null || featureDetails === void 0 ? void 0 : featureDetails.checkBoxSelection) === null || _a === void 0 ? void 0 : _a.allBoxChecked) || featureDetails.checkBoxSelection.includedRecords.length > 1)) ? (0, jsx_runtime_1.jsx)("div", Object.assign({ className: `rounded_btn sc_icon_hover icon-40x40 ${isDisabled && "disabled"}`, onClick: removeItemsCallBack, title: "Remove" }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "minus-circle", color: "text-red-800", size: 18 }) })) : "" }));
26
45
  }
27
46
  exports.default = RemoveItems;
@@ -7,7 +7,7 @@ const helper_1 = require("./helper");
7
7
  const hooks_1 = require("primereact/hooks");
8
8
  exports.FeatureContext = (0, react_1.createContext)(null);
9
9
  function MyProvider({ children, value }) {
10
- const { featureDetails, setFeatureDetails, gridData, callGrid, totalRecords, initialFeature, defaultFilters, createView, enableViewCreate, filterModelText, sortModelText, recordDetailModelText, sidePanelText, sortOptions, filterConditions, clearFilters, setGridData, gridApi, updateColumnsForGrid, enableManageColumnsCallback, columnToRender, selectedGroup, setSelectedGroup, initialCheckBoxData, intialColumns, setIntialColumns, rowModelType, quickSearch, enableAdvancedFilter, conditionsToDisplay, gridViewFun, gridViewData, setGridViewData, gridView } = value;
10
+ const { featureDetails, setFeatureDetails, gridData, callGrid, totalRecords, initialFeature, defaultFilters, createView, enableViewCreate, filterModelText, sortModelText, recordDetailModelText, sidePanelText, sortOptions, filterConditions, clearFilters, setGridData, gridApi, updateColumnsForGrid, enableManageColumnsCallback, columnToRender, selectedGroup, setSelectedGroup, initialCheckBoxData, intialColumns, setIntialColumns, rowModelType, quickSearch, enableAdvancedFilter, conditionsToDisplay, gridViewFun, gridViewData, setGridViewData, gridView, serverSideSelectRow } = value;
11
11
  // States for sort
12
12
  const [columnData] = (0, react_1.useState)(gridData === null || gridData === void 0 ? void 0 : gridData.columnData);
13
13
  const [inputValue, deboucedValue, setInputValue] = (0, hooks_1.useDebounce)("", 500);
@@ -116,7 +116,7 @@ function MyProvider({ children, value }) {
116
116
  gridViewData,
117
117
  setGridViewData,
118
118
  gridView,
119
- inputValue, deboucedValue, setInputValue
119
+ inputValue, deboucedValue, setInputValue, serverSideSelectRow
120
120
  } }, { children: children })));
121
121
  }
122
122
  exports.default = MyProvider;
@@ -11,6 +11,7 @@ exports.initialCheckBoxData = {
11
11
  isIndeterminate: false,
12
12
  includedRecords: [],
13
13
  excludedRecords: [],
14
+ rowId: null,
14
15
  headerCheckBoxStatus: constants_1.GRID_CHECKBOX_STATUS.NEUTRAL,
15
16
  };
16
17
  const isComponentDisable = (state) => {
@@ -275,7 +276,7 @@ const updateRecords = (rowData, featureDetails, gridData) => {
275
276
  }
276
277
  // Otherwise, update the excluded records and indeterminate state
277
278
  else {
278
- return Object.assign(Object.assign({}, featureDetails === null || featureDetails === void 0 ? void 0 : featureDetails.checkBoxSelection), { excludedRecords: newExcludedRecords, includedRecords: newIncludedRecords, isIndeterminate: (newExcludedRecords === null || newExcludedRecords === void 0 ? void 0 : newExcludedRecords.length) > 0 });
279
+ return Object.assign(Object.assign({}, featureDetails === null || featureDetails === void 0 ? void 0 : featureDetails.checkBoxSelection), { excludedRecords: newExcludedRecords, includedRecords: newIncludedRecords, rowId: rowData.id, isIndeterminate: (newExcludedRecords === null || newExcludedRecords === void 0 ? void 0 : newExcludedRecords.length) > 0 });
279
280
  }
280
281
  }
281
282
  // When not all checkboxes are checked
@@ -313,6 +314,7 @@ const updateRecords = (rowData, featureDetails, gridData) => {
313
314
  includedRecords: [],
314
315
  isIndeterminate: false,
315
316
  allBoxChecked: true,
317
+ rowId: rowData.id,
316
318
  headerCheckBoxStatus: constants_1.GRID_CHECKBOX_STATUS.CHECKED,
317
319
  };
318
320
  }
@@ -322,7 +324,7 @@ const updateRecords = (rowData, featureDetails, gridData) => {
322
324
  }
323
325
  // Otherwise, update the included records
324
326
  else {
325
- return Object.assign(Object.assign({}, featureDetails === null || featureDetails === void 0 ? void 0 : featureDetails.checkBoxSelection), { headerCheckBoxStatus: headerCheckBoxStatus === constants_1.GRID_CHECKBOX_STATUS.UNCHECKED ? constants_1.GRID_CHECKBOX_STATUS.NEUTRAL : headerCheckBoxStatus, includedRecords: newIncludedRecords, excludedRecords: newExcludedRecords });
327
+ return Object.assign(Object.assign({}, featureDetails === null || featureDetails === void 0 ? void 0 : featureDetails.checkBoxSelection), { headerCheckBoxStatus: headerCheckBoxStatus === constants_1.GRID_CHECKBOX_STATUS.UNCHECKED ? constants_1.GRID_CHECKBOX_STATUS.NEUTRAL : headerCheckBoxStatus, includedRecords: newIncludedRecords, rowId: rowData.id, excludedRecords: newExcludedRecords });
326
328
  }
327
329
  }
328
330
  };
@@ -13,6 +13,7 @@ const loading_component_1 = tslib_1.__importDefault(require("./loading-component
13
13
  const context_provider_1 = tslib_1.__importDefault(require("./context-provider"));
14
14
  const group_checkbox_1 = tslib_1.__importDefault(require("./group-checkbox"));
15
15
  const utilComponents_1 = require("./utilComponents");
16
+ const svg_component_1 = tslib_1.__importDefault(require("../../directives/svg-component"));
16
17
  function ParentForGrid(props) {
17
18
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
18
19
  const { gridProps = {}, gridViewTemplate, selectColumns = () => { }, enableCheckboxForGroupHeader = false, serverSideSelectRow } = props;
@@ -39,6 +40,7 @@ function ParentForGrid(props) {
39
40
  isIndeterminate: false,
40
41
  includedRecords: [],
41
42
  excludedRecords: [],
43
+ rowId: null,
42
44
  headerCheckBoxStatus: constants_1.GRID_CHECKBOX_STATUS.NEUTRAL,
43
45
  });
44
46
  const initialFeature = {
@@ -79,7 +81,7 @@ function ParentForGrid(props) {
79
81
  };
80
82
  }, []);
81
83
  const emptyIncludedRecords = (objectData) => {
82
- const obj = Object.assign(Object.assign({}, objectData), { checkBoxSelection: Object.assign(Object.assign({}, objectData.checkBoxSelection), { includedRecords: [], kl: "kl" }) });
84
+ const obj = Object.assign(Object.assign({}, objectData), { checkBoxSelection: Object.assign(Object.assign({}, objectData.checkBoxSelection), { rowId: null, includedRecords: [], kl: "kl" }) });
83
85
  setFeatureDetails(obj);
84
86
  };
85
87
  const serverSideRowLeveSelection = (object) => {
@@ -93,9 +95,15 @@ function ParentForGrid(props) {
93
95
  const { firstGroupIds, secondGroupIds } = (0, helper_1.getGroupIds)(gridRef);
94
96
  const { allBoxChecked } = featureDetails.checkBoxSelection;
95
97
  const currentStatus = !allBoxChecked;
96
- const checkboxData = Object.assign(Object.assign({}, featureDetails.checkBoxSelection), { allBoxChecked: currentStatus, isIndeterminate: false, includedRecords: [], excludedRecords: [], headerCheckBoxStatus: currentStatus
98
+ const checkboxData = Object.assign(Object.assign({}, featureDetails.checkBoxSelection), { allBoxChecked: currentStatus, isIndeterminate: false, includedRecords: [], excludedRecords: [], rowId: "grid-header-checkbox", headerCheckBoxStatus: currentStatus
97
99
  ? constants_1.GRID_CHECKBOX_STATUS.CHECKED
98
100
  : constants_1.GRID_CHECKBOX_STATUS.UNCHECKED });
101
+ const updatedRows = [];
102
+ gridRef.current.api.forEachNode((node) => {
103
+ node.data.isSelected = currentStatus;
104
+ updatedRows.push(Object.assign({}, node.data));
105
+ });
106
+ gridRef.current.api.applyTransaction({ update: updatedRows });
99
107
  if (currentStatus) {
100
108
  // stroring all first and secodn group ids
101
109
  setSelectedGroup([...firstGroupIds, ...secondGroupIds]);
@@ -110,12 +118,12 @@ function ParentForGrid(props) {
110
118
  // JSX for rendering checkbox in header
111
119
  const headerCheckBoxRenderer = (headerDisplayName, HeaderComponent) => {
112
120
  var _a, _b, _c, _d, _e, _f, _g, _h;
113
- return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: `flex align-items-center justify-content-between ${((_a = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _a === void 0 ? void 0 : _a.displayCheckboxOnRight)
121
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: `flex align-items-center header-checkbox-class justify-content-between ${((_a = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _a === void 0 ? void 0 : _a.displayCheckboxOnRight)
114
122
  ? "w-full pd-r-2"
115
- : ""}` }, { children: ((_b = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _b === void 0 ? void 0 : _b.displayCheckboxOnRight) ? ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `flex align-items-center justify-content-between w-full ` }, { children: [HeaderComponent ? ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: " mr-auto" }, { children: [" ", (0, jsx_runtime_1.jsx)(HeaderComponent, {}), " "] }))) : ((0, jsx_runtime_1.jsx)("span", { children: headerDisplayName })), (0, jsx_runtime_1.jsx)(grid_checkbox_1.default, { id: "grid-header-checkbox", checked: featureDetails.checkBoxSelection.allBoxChecked, onChange: () => handleHeaderCheckbox(), isIndeterminate: featureDetails.checkBoxSelection.isIndeterminate &&
123
+ : ""}` }, { children: ((_b = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _b === void 0 ? void 0 : _b.displayCheckboxOnRight) ? ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `flex align-items-center justify-content-between w-full ` }, { children: [HeaderComponent ? ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: " mr-auto" }, { children: [" ", (0, jsx_runtime_1.jsx)(HeaderComponent, {}), " "] }))) : ((0, jsx_runtime_1.jsx)("span", { children: headerDisplayName })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "ml-1 animate-spin save-loader hidden header-check-box-loader" }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "loading-02", size: 16 }) })), (0, jsx_runtime_1.jsx)(grid_checkbox_1.default, { id: "grid-header-checkbox", checked: featureDetails.checkBoxSelection.allBoxChecked, onChange: () => handleHeaderCheckbox(), isIndeterminate: featureDetails.checkBoxSelection.isIndeterminate &&
116
124
  (((_d = (_c = featureDetails.checkBoxSelection) === null || _c === void 0 ? void 0 : _c.excludedRecords) === null || _d === void 0 ? void 0 : _d.length) > 0
117
125
  ? true
118
- : false), shouldRenderOnRight: (_e = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _e === void 0 ? void 0 : _e.displayCheckboxOnRight })] }))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(grid_checkbox_1.default, { id: "grid-header-checkbox", checked: featureDetails.checkBoxSelection.allBoxChecked, onChange: () => handleHeaderCheckbox(), isIndeterminate: featureDetails.checkBoxSelection.isIndeterminate &&
126
+ : false), shouldRenderOnRight: (_e = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _e === void 0 ? void 0 : _e.displayCheckboxOnRight })] }))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "ml-1 animate-spin save-loader hidden header-check-box-loader" }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "loading-02", size: 16 }) })), (0, jsx_runtime_1.jsx)(grid_checkbox_1.default, { id: "grid-header-checkbox", checked: featureDetails.checkBoxSelection.allBoxChecked, onChange: () => handleHeaderCheckbox(), isIndeterminate: featureDetails.checkBoxSelection.isIndeterminate &&
119
127
  (((_g = (_f = featureDetails.checkBoxSelection) === null || _f === void 0 ? void 0 : _f.excludedRecords) === null || _g === void 0 ? void 0 : _g.length) > 0
120
128
  ? true
121
129
  : false), shouldRenderOnRight: (_h = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _h === void 0 ? void 0 : _h.displayCheckboxOnRight }), HeaderComponent ? ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "px-3" }, { children: [" ", (0, jsx_runtime_1.jsx)(HeaderComponent, {}), " "] }))) : ((0, jsx_runtime_1.jsx)("span", { children: headerDisplayName }))] })) })));
@@ -126,7 +134,7 @@ function ParentForGrid(props) {
126
134
  const { data } = params;
127
135
  // const { allBoxChecked, excludedRecords, includedRecords } = featureDetails.checkBoxSelection;
128
136
  const isChecked = (0, helper_1.getCheckedStatus)(data, featureDetails, constants_1.GRID_CHECKBOX_STATUS);
129
- return ((0, jsx_runtime_1.jsx)(grid_checkbox_1.default, { id: "grid-checkbox", checked: isChecked, disabled: ((_a = params === null || params === void 0 ? void 0 : params.data) === null || _a === void 0 ? void 0 : _a.tagged) || false, onChange: (e) => (0, helper_1.handleCheckboxClick)(e, params, featureDetails, gridData, setFeatureDetails, groupingColumns, setSelectedGroup, selectColumns, serverSideRowLeveSelection), isIndeterminate: false, shouldRenderOnRight: (_b = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _b === void 0 ? void 0 : _b.displayCheckboxOnRight }));
137
+ return ((0, jsx_runtime_1.jsxs)("span", Object.assign({ className: "row-check-box flex align-items-center" }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ id: `check-box-loader-${params.data.id}`, className: "ml-1 hidden animate-spin save-loader check-box-loader" }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "loading-02", size: 16 }) })), (0, jsx_runtime_1.jsx)(grid_checkbox_1.default, { id: `grid-checkbox-${params.data.id}`, checked: isChecked, disabled: ((_a = params === null || params === void 0 ? void 0 : params.data) === null || _a === void 0 ? void 0 : _a.tagged) || false, onChange: (e) => (0, helper_1.handleCheckboxClick)(e, params, featureDetails, gridData, setFeatureDetails, groupingColumns, setSelectedGroup, selectColumns, serverSideRowLeveSelection), isIndeterminate: false, shouldRenderOnRight: (_b = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _b === void 0 ? void 0 : _b.displayCheckboxOnRight })] })));
130
138
  };
131
139
  // Callback to products for getting data
132
140
  const getData = (startRow, endRow, currentFeatures, params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
@@ -453,6 +461,6 @@ function ParentForGrid(props) {
453
461
  gridViewFun,
454
462
  gridViewData,
455
463
  setGridViewData,
456
- gridView, enableAdvancedFilter: props === null || props === void 0 ? void 0 : props.enableAdvancedFilter }, ((props === null || props === void 0 ? void 0 : props.rowData) && { rowData: props === null || props === void 0 ? void 0 : props.rowData })), { conditionsToDisplay: props === null || props === void 0 ? void 0 : props.conditionsToDisplay }) }, { children: ((_q = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _q === void 0 ? void 0 : _q.displayFeaturesHeader) && ((0, jsx_runtime_1.jsx)(advanced_feature_1.default, { props: props })) })), gridView ? (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: gridViewTemplate(gridViewData) }) : (0, jsx_runtime_1.jsx)(AgGrid_1.default, { style: gridStyle, gridOptions: gridOptions, onGridReady: (props === null || props === void 0 ? void 0 : props.rowData) ? undefined : onGridReady, gridRef: gridRef })] }) })) }) }));
464
+ gridView, enableAdvancedFilter: props === null || props === void 0 ? void 0 : props.enableAdvancedFilter }, ((props === null || props === void 0 ? void 0 : props.rowData) && { rowData: props === null || props === void 0 ? void 0 : props.rowData })), { conditionsToDisplay: props === null || props === void 0 ? void 0 : props.conditionsToDisplay, serverSideSelectRow: props.serverSideSelectRow }) }, { children: ((_q = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _q === void 0 ? void 0 : _q.displayFeaturesHeader) && ((0, jsx_runtime_1.jsx)(advanced_feature_1.default, { props: props })) })), gridView ? (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: gridViewTemplate(gridViewData) }) : (0, jsx_runtime_1.jsx)(AgGrid_1.default, { style: gridStyle, gridOptions: gridOptions, onGridReady: (props === null || props === void 0 ? void 0 : props.rowData) ? undefined : onGridReady, gridRef: gridRef })] }) })) }) }));
457
465
  }
458
466
  exports.default = ParentForGrid;
@@ -65,16 +65,20 @@ const InputTextAreaField = (props) => {
65
65
  const DropDownField = (props) => {
66
66
  const { errors, touched, name, length, label, onFocus,
67
67
  // onChange,
68
- placeholder, panelClassName, showClear, options, optional, customSelectedTemplate, customFieldsTemplate, optionLabel, optionDisabled, className, validate, disabled, filter, panelStyle, isLoading, isRequired = false, value, filterPlaceholder, emptyMessage, emptyFilterMessage, } = props;
68
+ placeholder, panelClassName, showClear, options, optional, customSelectedTemplate, customFieldsTemplate, optionLabel, optionDisabled, className, validate, disabled, filter, panelStyle, isLoading, isRequired = false, value, filterPlaceholder, emptyMessage, emptyFilterMessage, unselect = false } = props;
69
+ const errorData = (0, formik_1.getIn)(errors, name);
70
+ const touchedData = (0, formik_1.getIn)(touched, name);
69
71
  return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "flex flex-column" }, { children: !isLoading ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [optional && ((0, jsx_runtime_1.jsxs)("label", Object.assign({ className: "font-medium text-base mb-1 w-full flex justify-content-between text_ellipsis", htmlFor: name }, { children: [label, (0, jsx_runtime_1.jsx)("span", Object.assign({ className: "text-base font-medium font-italic text-gray-600" }, { children: "Optional" }))] }))), !optional && (
70
72
  // <label className="font-medium text-base mb-1" htmlFor={name}>
71
73
  // {label}
72
74
  // </label>
73
- (0, jsx_runtime_1.jsx)(FieldLabel_1.default, { value: value, label: label, error: errors === null || errors === void 0 ? void 0 : errors[name], touched: touched === null || touched === void 0 ? void 0 : touched[name], isRequired: isRequired })), (0, jsx_runtime_1.jsx)(formik_1.Field, Object.assign({ type: "text", name: name, validate: validate }, { children: ({ field }) => ((0, jsx_runtime_1.jsx)(dropdown_1.Dropdown, Object.assign({ onFocus: () => {
75
+ (0, jsx_runtime_1.jsx)(FieldLabel_1.default, { value: value, label: label, error: errorData, touched: touchedData, isRequired: isRequired })), (0, jsx_runtime_1.jsx)(formik_1.Field, Object.assign({ type: "text", name: name, validate: validate }, { children: ({ field }) => ((0, jsx_runtime_1.jsx)(dropdown_1.Dropdown, Object.assign({ onFocus: () => {
74
76
  onFocus && onFocus();
75
- }, panelClassName: panelClassName, showClear: showClear, panelStyle: panelStyle || "", filter: filter || false, disabled: disabled, placeholder: placeholder }, field, {
77
+ }, panelClassName: panelClassName, showClear: showClear, panelStyle: panelStyle || "", filter: filter || false, disabled: disabled, placeholder: placeholder }, field, { onChange: (e) => {
78
+ !unselect && field.onChange(e);
79
+ },
76
80
  // onChange={(e: any) => onChange && onChange(e)}
77
- options: options, itemTemplate: customFieldsTemplate, valueTemplate: customSelectedTemplate, optionDisabled: optionDisabled, optionLabel: optionLabel, className: ` ${errors[name] && touched[name] ? "p-invalid" : ""} ${length === "full" ? "full_form_field" : "form_field"} ${className}`, id: name, filterPlaceholder: filterPlaceholder ? filterPlaceholder : "Search", emptyMessage: emptyMessage ? emptyMessage : "No Data Found", emptyFilterMessage: emptyFilterMessage ? emptyFilterMessage : "No Results Found" }))) })), (errors === null || errors === void 0 ? void 0 : errors[name]) && (touched === null || touched === void 0 ? void 0 : touched[name]) ? ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "errorField flex align-items-center text-sm" }, { children: (0, jsx_runtime_1.jsx)("span", { children: errors === null || errors === void 0 ? void 0 : errors[name] }) }))) : ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "errorField flex align-items-center text-sm" }, { children: (0, jsx_runtime_1.jsx)("span", { children: "\u00A0" }) })))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex flex-column gap-1" }, { children: [(0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, { height: "16px", className: "w-5rem" }), (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, { height: "40px" })] })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "errorField flex align-items-center text-sm" }, { children: (0, jsx_runtime_1.jsx)("span", { children: "\u00A0" }) }))] })) })));
81
+ options: options, itemTemplate: customFieldsTemplate, valueTemplate: customSelectedTemplate, optionDisabled: optionDisabled, optionLabel: optionLabel, className: ` ${errorData && touchedData ? "p-invalid" : ""} ${length === "full" ? "full_form_field" : "form_field"} ${className}`, id: name, filterPlaceholder: filterPlaceholder ? filterPlaceholder : "Search", emptyMessage: emptyMessage ? emptyMessage : "No Data Found", emptyFilterMessage: emptyFilterMessage ? emptyFilterMessage : "No Results Found" }))) })), errorData && touchedData ? ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "errorField flex align-items-center text-sm" }, { children: (0, jsx_runtime_1.jsx)("span", { children: errorData }) }))) : ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "errorField flex align-items-center text-sm" }, { children: (0, jsx_runtime_1.jsx)("span", { children: "\u00A0" }) })))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex flex-column gap-1" }, { children: [(0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, { height: "16px", className: "w-5rem" }), (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, { height: "40px" })] })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "errorField flex align-items-center text-sm" }, { children: (0, jsx_runtime_1.jsx)("span", { children: "\u00A0" }) }))] })) })));
78
82
  };
79
83
  const MultiSelectField = (props) => {
80
84
  const { errors, touched, name, length, label, placeholder, options, optional, customFieldsTemplate, optionLabel, optionDisabled, className, validate, disabled, isLoading, filter, isRequired = false, value, } = props;
@@ -52,7 +52,7 @@ const ListBoxDropdown = (props) => {
52
52
  var _a, _b;
53
53
  const target = e.target;
54
54
  // Prevent hiding if scroll is within dropdown or trigger button
55
- if (target.closest(".p-menu, .list_box_btn"))
55
+ if (target === null || target === void 0 ? void 0 : target.closest(".p-menu, .list_box_btn"))
56
56
  return;
57
57
  (_b = (_a = optionsMenuRef === null || optionsMenuRef === void 0 ? void 0 : optionsMenuRef.current) === null || _a === void 0 ? void 0 : _a.hide) === null || _b === void 0 ? void 0 : _b.call(_a, e);
58
58
  };
@@ -47,13 +47,18 @@ function RowVirtualizerDynamic(props) {
47
47
  fetchMoreData(Object.assign(Object.assign({}, initialFetch), { pageIndex: pageIndex.current }));
48
48
  }
49
49
  };
50
+ const lastSearchTerm = React.useRef('');
50
51
  const fetchMoreData = (props) => tslib_1.__awaiter(this, void 0, void 0, function* () {
51
52
  var _c;
52
53
  try {
53
54
  const object = yield fetchData(props);
54
55
  if (object) {
55
56
  loadingRef.current = false;
56
- if ((props === null || props === void 0 ? void 0 : props.searchTerm) && (props === null || props === void 0 ? void 0 : props.searchTerm) !== "") {
57
+ if (lastSearchTerm.current && !(props === null || props === void 0 ? void 0 : props.searchTerm)) {
58
+ // Search just cleared — reset data
59
+ setData(object.data);
60
+ }
61
+ else if ((props === null || props === void 0 ? void 0 : props.searchTerm) && (props === null || props === void 0 ? void 0 : props.searchTerm) !== "") {
57
62
  totalRecordsCount.current = (_c = object === null || object === void 0 ? void 0 : object.data) === null || _c === void 0 ? void 0 : _c.length;
58
63
  setData(object === null || object === void 0 ? void 0 : object.data);
59
64
  }
@@ -67,6 +72,7 @@ function RowVirtualizerDynamic(props) {
67
72
  setLoading(false);
68
73
  allCount.current = object === null || object === void 0 ? void 0 : object.totalRecords;
69
74
  pageIndex.current = pageIndex.current + 1;
75
+ lastSearchTerm.current = props === null || props === void 0 ? void 0 : props.searchTerm;
70
76
  }
71
77
  }
72
78
  catch (error) {
@@ -73,6 +73,7 @@ export interface CheckBoxSelection {
73
73
  includedRecords: any[];
74
74
  excludedRecords: any[];
75
75
  headerCheckBoxStatus: GRID_CHECKBOX_STATUS;
76
+ rowId: string | null | number | undefined;
76
77
  }
77
78
  export interface GridData {
78
79
  rowData: any[];
@@ -37,6 +37,7 @@ interface MyProviderProps {
37
37
  gridViewData: any;
38
38
  setGridViewData: any;
39
39
  gridView: boolean;
40
+ serverSideSelectRow: (data: any, emptyFun: (oject: any) => void) => void;
40
41
  };
41
42
  }
42
43
  declare function MyProvider({ children, value }: MyProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -163,8 +163,9 @@ export interface DropDownFieldProps {
163
163
  panelStyle?: any;
164
164
  isLoading?: boolean;
165
165
  showClear?: boolean;
166
- emptyMessage?: string;
166
+ emptyMessage?: any;
167
167
  panelClassName?: string;
168
+ unselect?: boolean;
168
169
  onFocus?: () => void;
169
170
  isRequired?: boolean;
170
171
  value?: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sccoreui",
3
- "version": "6.4.85",
3
+ "version": "6.4.87",
4
4
  "description": "ui-sccore",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",