sccoreui 6.4.98 → 6.5.0

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.
@@ -144,7 +144,7 @@ const TableFilter = () => {
144
144
  case Types_1.FilterDataType.COLORPICKER:
145
145
  case Types_1.FilterDataType.SELECT:
146
146
  case Types_1.FilterDataType.BOOLEAN:
147
- return Array.isArray(value) ? value.length > 0 : Boolean(value);
147
+ return Array.isArray(value) ? value.length > 0 : value !== undefined && value !== "" && value !== null;
148
148
  default:
149
149
  return true;
150
150
  }
@@ -388,6 +388,7 @@ const TableFilter = () => {
388
388
  ? values.conditions
389
389
  : conditionsArray;
390
390
  const isFormReady = isValid && allFieldsFilled && enableApply;
391
+ console.log(errors, "errors-data-check");
391
392
  return ((0, jsx_runtime_1.jsxs)(dialog_1.Dialog, Object.assign({ visible: isVisible, onHide: () => filterLogoToggle(), className: "modal_filter mt-5 -ml-2" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "p-4" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex justify-content-between text-lg font-semibold line-height-3 text-gray-900" }, { children: [(filterModelText === null || filterModelText === void 0 ? void 0 : filterModelText.header) ? filterModelText.header : "Filter", (0, jsx_runtime_1.jsx)(button_1.Button, { className: "p-0 h-auto px-1 bg-transparent hover:bg-gray-100", onClick: () => setIsVisible(false), icon: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "x-close", size: 15, color: "text-gray-600" }) })] })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "text-sm text-gray-600" }, { children: (filterModelText === null || filterModelText === void 0 ? void 0 : filterModelText.subHeader)
392
393
  ? filterModelText.subHeader
393
394
  : "Streamline Your Search With Filters" }))] })), (0, jsx_runtime_1.jsx)(divider_1.Divider, { className: "w-full p-0 m-0" }), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "p-2" }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "max-h-14rem overflow-y-auto overflow-x-hidden flex flex-column gap-1" }, { children: conditionsToRender.map((eachCondition, index) => {
@@ -405,7 +406,7 @@ const TableFilter = () => {
405
406
  : "Enter", value: viewName, onChange: (e) => {
406
407
  setViewName(e.target.value);
407
408
  setFieldValue("viewName", e.target.value);
408
- }, className: "text-lg font-normal text-gray-500 hover:text-gray-900 w-full pl-3 pr-60 mr-3" })] }))), (0, jsx_runtime_1.jsx)(button_1.Button, { className: "text-base font-semibold text-gray-600 p-1 focus:shadow-none text-white w-4rem", label: (filterModelText === null || filterModelText === void 0 ? void 0 : filterModelText.applyAction)
409
+ }, className: "text-lg font-normal text-gray-500 hover:text-gray-900 w-full pl-3 pr-60 mr-3" })] }))), (0, jsx_runtime_1.jsx)(button_1.Button, { type: "submit", className: "text-base font-semibold text-gray-600 p-1 focus:shadow-none text-white w-4rem", label: (filterModelText === null || filterModelText === void 0 ? void 0 : filterModelText.applyAction)
409
410
  ? filterModelText.applyAction
410
411
  : "Apply", onClick: () => handleSubmit() })] }))] }))] })));
411
412
  } }))] }));
@@ -13,7 +13,12 @@ function MyProvider({ children, value }) {
13
13
  // dynamicText
14
14
  } = value;
15
15
  // States for sort
16
- const [columnData] = (0, react_1.useState)(gridData === null || gridData === void 0 ? void 0 : gridData.columnData);
16
+ const [columnData, setColumnData] = (0, react_1.useState)(gridData === null || gridData === void 0 ? void 0 : gridData.columnData);
17
+ (0, react_1.useEffect)(() => {
18
+ if (gridData === null || gridData === void 0 ? void 0 : gridData.columnData) {
19
+ setColumnData(gridData.columnData);
20
+ }
21
+ }, [gridData === null || gridData === void 0 ? void 0 : gridData.columnData]);
17
22
  const [inputValue, deboucedValue, setInputValue] = (0, hooks_1.useDebounce)("", 500);
18
23
  const [sortValue, setSortValue] = (0, react_1.useState)({});
19
24
  const [sortBy, setSortBy] = (0, react_1.useState)({});
@@ -159,7 +159,7 @@ function ParentForGrid(props) {
159
159
  setIsDataLoading(true);
160
160
  try {
161
161
  const response = yield (props === null || props === void 0 ? void 0 : props.getRowData(startRow, endRow, currentFeatures, params));
162
- setGridData(Object.assign(Object.assign({}, gridData), { rowData: [] }));
162
+ setGridData(prev => (Object.assign(Object.assign({}, prev), { rowData: [] })));
163
163
  // To identify when to stop the callBack
164
164
  const actualEndRow = (response === null || response === void 0 ? void 0 : response.totalRecords) < constants_1.MAX_RECORDS_TO_LOAD
165
165
  ? response === null || response === void 0 ? void 0 : response.totalRecords
@@ -199,7 +199,7 @@ function ParentForGrid(props) {
199
199
  const result = gridViewData.rowData.length > 0 ? { rowData: gridViewData.rowData, totalRecords: gridViewData.rowData.length } : yield getData(0, 0, currentFeatures);
200
200
  if (((_m = result.rowData) === null || _m === void 0 ? void 0 : _m.length) > 0) {
201
201
  gridViewData.rowData.length > 0 && setGridViewData({ rowData: [], searchText: "" });
202
- setGridData(Object.assign(Object.assign({}, gridData), { rowData: result.rowData }));
202
+ setGridData(prev => (Object.assign(Object.assign({}, prev), { rowData: result.rowData })));
203
203
  gridRef.current && gridRef.current.api.hideOverlay();
204
204
  params && ((_o = params === null || params === void 0 ? void 0 : params.api) === null || _o === void 0 ? void 0 : _o.applyTransaction({ add: result.rowData }));
205
205
  }
@@ -219,7 +219,7 @@ function ParentForGrid(props) {
219
219
  const response = yield getData(startRow, endRow, currentFeatures, params);
220
220
  // simulating real server call with a 500ms delay
221
221
  if (((_q = response.rowData) === null || _q === void 0 ? void 0 : _q.length) > 0) {
222
- setGridData(Object.assign(Object.assign({}, gridData), { rowData: response.rowData }));
222
+ setGridData(prev => (Object.assign(Object.assign({}, prev), { rowData: response.rowData })));
223
223
  gridRef.current.api.hideOverlay();
224
224
  // supply rows for requested block to grid
225
225
  params && params.success({ rowData: response.rowData, rowCount: response.actualEndRow });
@@ -335,7 +335,7 @@ function ParentForGrid(props) {
335
335
  }
336
336
  if (props === null || props === void 0 ? void 0 : props.rowData) {
337
337
  setTotalRecords(props === null || props === void 0 ? void 0 : props.rowData.length);
338
- setGridData(Object.assign(Object.assign({}, gridData), { rowData: props.rowData }));
338
+ setGridData(prev => (Object.assign(Object.assign({}, prev), { rowData: props.rowData })));
339
339
  }
340
340
  if (props === null || props === void 0 ? void 0 : props.enableAdvancedFilter) {
341
341
  (_b = (_a = props === null || props === void 0 ? void 0 : props.getGridRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.api.setGridOption("advancedFilterParent", document.getElementById("advancedFilterParent"));
@@ -440,22 +440,47 @@ function ParentForGrid(props) {
440
440
  }
441
441
  }, [props.updateRowData]);
442
442
  (0, react_1.useEffect)(() => {
443
- var _a, _b;
443
+ var _a, _b, _c;
444
444
  const existingColumns = (gridRef === null || gridRef === void 0 ? void 0 : gridRef.current) && ((_a = gridRef === null || gridRef === void 0 ? void 0 : gridRef.current.api) === null || _a === void 0 ? void 0 : _a.getColumnDefs());
445
445
  if (!(props === null || props === void 0 ? void 0 : props.columnData) || !existingColumns)
446
446
  return;
447
447
  const columnFromProps = (0, helper_1.sortColumns)(props === null || props === void 0 ? void 0 : props.columnData);
448
- const updatedColumnDefs = existingColumns.map((colDef) => {
449
- columnFromProps.find((col) => {
450
- if (col.id === colDef.id) {
451
- colDef.hide = col.hide;
452
- colDef.seq = col === null || col === void 0 ? void 0 : col.seq;
448
+ // Check if column IDs match — if not, this is a full column replacement (e.g. skeleton → real columns)
449
+ const existingIds = new Set(existingColumns.map((col) => col.id));
450
+ const propsIds = new Set(columnFromProps.map((col) => col.id));
451
+ const isStructuralChange = columnFromProps.some((col) => !existingIds.has(col.id)) ||
452
+ existingColumns.some((col) => !propsIds.has(col.id));
453
+ if (isStructuralChange) {
454
+ // Full column replacement — rebuild columnDefs with checkbox/header handling
455
+ const newColumnDefs = columnFromProps.map((column) => {
456
+ var _a, _b;
457
+ if ((column === null || column === void 0 ? void 0 : column.enableChildCheckbox) && (column === null || column === void 0 ? void 0 : column.enableHeaderCheckbox)) {
458
+ return Object.assign(Object.assign({}, column), { headerComponent: (params) => headerCheckBoxRenderer(params === null || params === void 0 ? void 0 : params.displayName, (column === null || column === void 0 ? void 0 : column.headerComponent) && ""), cellRenderer: (params) => (0, utilComponents_1.dataCellRenderer)(params, column, props), cellRendererParams: {
459
+ initialRenderer: column === null || column === void 0 ? void 0 : column.body,
460
+ cellCheckBoxRenderer: cellCheckBoxRenderer,
461
+ }, headerName: (_a = column === null || column === void 0 ? void 0 : column.headerName) === null || _a === void 0 ? void 0 : _a.toUpperCase() });
462
+ }
463
+ else {
464
+ return Object.assign(Object.assign({}, column), { headerName: (_b = column === null || column === void 0 ? void 0 : column.headerName) === null || _b === void 0 ? void 0 : _b.toUpperCase() });
453
465
  }
454
466
  });
455
- return colDef;
456
- });
457
- const reOrderedColumns = updatedColumnDefs.sort((a, b) => a.seq - b.seq);
458
- (_b = gridRef.current.api) === null || _b === void 0 ? void 0 : _b.setGridOption("columnDefs", reOrderedColumns);
467
+ setGridData((prev) => (Object.assign(Object.assign({}, prev), { columnData: columnFromProps })));
468
+ (_b = gridRef.current.api) === null || _b === void 0 ? void 0 : _b.setGridOption("columnDefs", newColumnDefs);
469
+ }
470
+ else {
471
+ // Same structure — just update hide/seq
472
+ const updatedColumnDefs = existingColumns.map((colDef) => {
473
+ columnFromProps.find((col) => {
474
+ if (col.id === colDef.id) {
475
+ colDef.hide = col.hide;
476
+ colDef.seq = col === null || col === void 0 ? void 0 : col.seq;
477
+ }
478
+ });
479
+ return colDef;
480
+ });
481
+ const reOrderedColumns = updatedColumnDefs.sort((a, b) => a.seq - b.seq);
482
+ (_c = gridRef.current.api) === null || _c === void 0 ? void 0 : _c.setGridOption("columnDefs", reOrderedColumns);
483
+ }
459
484
  }, [props === null || props === void 0 ? void 0 : props.columnData]);
460
485
  (0, react_1.useEffect)(() => {
461
486
  if (props === null || props === void 0 ? void 0 : props.emptyCheckboxStatus) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sccoreui",
3
- "version": "6.4.98",
3
+ "version": "6.5.0",
4
4
  "description": "ui-sccore",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",