sccoreui 6.4.1 → 6.4.2

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/App.js CHANGED
@@ -2,10 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const jsx_runtime_1 = require("react/jsx-runtime");
4
4
  require("./App.scss");
5
- // import FroalaTextEditor from "./components/froala-editor/FroalaEditor";
6
5
  // import Home from "./pages/home";
7
6
  const App = () => {
8
- // const [selectedCountries, setSelectedCountries] = useState(null);
9
7
  return (0, jsx_runtime_1.jsx)("div", { className: "m-6" });
10
8
  };
11
9
  exports.default = App;
@@ -62,7 +62,7 @@ const sortColumns = (columns) => {
62
62
  };
63
63
  exports.sortColumns = sortColumns;
64
64
  // Give checkbox checked status
65
- const getCheckedStatus = (row, featureDetails, GRID_CHECKBOX_STATUS, setFeatureDetails) => {
65
+ const getCheckedStatus = (row, featureDetails, GRID_CHECKBOX_STATUS) => {
66
66
  const { allBoxChecked, excludedRecords, includedRecords, headerCheckBoxStatus, } = featureDetails.checkBoxSelection;
67
67
  if (allBoxChecked) {
68
68
  return !excludedRecords.includes(row);
@@ -71,12 +71,19 @@ const getCheckedStatus = (row, featureDetails, GRID_CHECKBOX_STATUS, setFeatureD
71
71
  if (headerCheckBoxStatus === GRID_CHECKBOX_STATUS.NEUTRAL &&
72
72
  (row === null || row === void 0 ? void 0 : row.isSelected)) {
73
73
  if (!includedRecords.includes(row)) {
74
- includedRecords.push(row);
75
- setFeatureDetails((prev) => (Object.assign(Object.assign({}, prev), { checkBoxSelection: Object.assign(Object.assign({}, prev.checkBoxSelection), { includedRecords: [...includedRecords] }) })));
74
+ // includedRecords.push(row);
75
+ // setFeatureDetails((prev) => ({
76
+ // ...prev,
77
+ // checkBoxSelection: {
78
+ // ...prev.checkBoxSelection,
79
+ // includedRecords: [...includedRecords],
80
+ // },
81
+ // }));
82
+ return !(excludedRecords === null || excludedRecords === void 0 ? void 0 : excludedRecords.includes(row));
76
83
  }
77
84
  return true;
78
85
  }
79
- return includedRecords.includes(row);
86
+ return (excludedRecords === null || excludedRecords === void 0 ? void 0 : excludedRecords.includes(row)) ? false : includedRecords.includes(row);
80
87
  }
81
88
  };
82
89
  exports.getCheckedStatus = getCheckedStatus;
@@ -258,7 +265,10 @@ const updateRecords = (rowData, featureDetails, gridData) => {
258
265
  return false; // Exclude this item from the new array
259
266
  }
260
267
  })
261
- : [...includedRecords, rowData]; // Add rowData if it's not already included
268
+ : (rowData === null || rowData === void 0 ? void 0 : rowData.isSelected) ? [...includedRecords] : [...includedRecords, rowData]; // Add rowData if it's not already included
269
+ newExcludedRecords = (excludedRecords === null || excludedRecords === void 0 ? void 0 : excludedRecords.includes(rowData))
270
+ ? excludedRecords === null || excludedRecords === void 0 ? void 0 : excludedRecords.filter((item) => (item === null || item === void 0 ? void 0 : item.id) !== (rowData === null || rowData === void 0 ? void 0 : rowData.id))
271
+ : (rowData === null || rowData === void 0 ? void 0 : rowData.isSelected) ? [...excludedRecords, rowData] : excludedRecords;
262
272
  // Check if all records are included; reset if so
263
273
  if ((newIncludedRecords === null || newIncludedRecords === void 0 ? void 0 : newIncludedRecords.length) === ((_b = gridData === null || gridData === void 0 ? void 0 : gridData.rowData) === null || _b === void 0 ? void 0 : _b.length)) {
264
274
  return {
@@ -274,7 +284,7 @@ const updateRecords = (rowData, featureDetails, gridData) => {
274
284
  }
275
285
  // Otherwise, update the included records
276
286
  else {
277
- return Object.assign(Object.assign({}, featureDetails === null || featureDetails === void 0 ? void 0 : featureDetails.checkBoxSelection), { includedRecords: newIncludedRecords });
287
+ return Object.assign(Object.assign({}, featureDetails === null || featureDetails === void 0 ? void 0 : featureDetails.checkBoxSelection), { includedRecords: newIncludedRecords, excludedRecords: newExcludedRecords });
278
288
  }
279
289
  }
280
290
  };
@@ -110,12 +110,15 @@ function ParentForGrid(props) {
110
110
  ? true
111
111
  : 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 }))] })) })));
112
112
  };
113
+ const onRowClickSelection = (data) => {
114
+ (0, helper_1.handleCheckboxClick)({ checked: true }, data, featureDetails, gridData, setFeatureDetails, groupingColumns, setSelectedGroup, selectColumns);
115
+ };
113
116
  // JSX for rendering checkbox in cells
114
117
  const cellCheckBoxRenderer = (params) => {
115
118
  var _a, _b;
116
119
  const { data } = params;
117
120
  // const { allBoxChecked, excludedRecords, includedRecords } = featureDetails.checkBoxSelection;
118
- const isChecked = (0, helper_1.getCheckedStatus)(data, featureDetails, constants_1.GRID_CHECKBOX_STATUS, setFeatureDetails);
121
+ const isChecked = (0, helper_1.getCheckedStatus)(data, featureDetails, constants_1.GRID_CHECKBOX_STATUS);
119
122
  return ((0, jsx_runtime_1.jsx)(grid_checkbox_1.default, { 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), isIndeterminate: false, shouldRenderOnRight: (_b = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _b === void 0 ? void 0 : _b.displayCheckboxOnRight }));
120
123
  };
121
124
  // Callback to products for getting data
@@ -349,7 +352,7 @@ function ParentForGrid(props) {
349
352
  setGridViewData(Object.assign(Object.assign({}, gridViewData), { rowData: allData }));
350
353
  };
351
354
  // Options that grid should have
352
- const gridOptions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ columnDefs: (_f = gridData === null || gridData === void 0 ? void 0 : gridData.columnData) === null || _f === void 0 ? void 0 : _f.map((column) => {
355
+ const gridOptions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ columnDefs: (_f = gridData === null || gridData === void 0 ? void 0 : gridData.columnData) === null || _f === void 0 ? void 0 : _f.map((column) => {
353
356
  var _a, _b;
354
357
  if ((column === null || column === void 0 ? void 0 : column.enableChildCheckbox) && (column === null || column === void 0 ? void 0 : column.enableHeaderCheckbox)) {
355
358
  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: {
@@ -368,7 +371,7 @@ function ParentForGrid(props) {
368
371
  dataTypeDefinitions: props === null || props === void 0 ? void 0 : props.dataTypeDefinitions,
369
372
  })), { popupParent: popupParent }), ((props === null || props === void 0 ? void 0 : props.treeData) && { treeData: props === null || props === void 0 ? void 0 : props.treeData })), ((props === null || props === void 0 ? void 0 : props.groupDefaultExpanded) && {
370
373
  groupDefaultExpanded: props === null || props === void 0 ? void 0 : props.groupDefaultExpanded, // to enable tree data
371
- })), ((props === null || props === void 0 ? void 0 : props.onRowClicked) ? { onRowClicked: props === null || props === void 0 ? void 0 : props.onRowClicked } : {})), ((props === null || props === void 0 ? void 0 : props.quickSearch) ? { quickSearch: props.quickSearch } : {})), {
374
+ })), ((props === null || props === void 0 ? void 0 : props.onRowClicked) ? { onRowClicked: props === null || props === void 0 ? void 0 : props.onRowClicked } : {})), ((props === null || props === void 0 ? void 0 : props.onRowSelection) ? { onRowClicked: onRowClickSelection } : {})), ((props === null || props === void 0 ? void 0 : props.quickSearch) ? { quickSearch: props.quickSearch } : {})), {
372
375
  // ...(props?.getDataPath && { getDataPath: props?.getDataPath }), // for clint side tree data enable fetuare
373
376
  onGridPreDestroyed: onGridPreDestroyed }), ((props === null || props === void 0 ? void 0 : props.rowDragManaged) ? { rowDragManaged: props === null || props === void 0 ? void 0 : props.rowDragManaged } : {})), gridProps);
374
377
  // Fucntion to call the grid
@@ -12,7 +12,7 @@ function RowVirtualizerDynamic(props) {
12
12
  var _a, _b;
13
13
  const { optionTemplate, optionLabel, filterPlaceholder, matchKey = "id", values, multiple = false, onSelectionChange, fetchData, emptyMessage, emptyFilterMessage } = props;
14
14
  const parentRef = React.useRef(null);
15
- const loadingRef = React.useRef(false);
15
+ const loadingRef = React.useRef(true);
16
16
  const allCount = React.useRef(null);
17
17
  const totalRecordsCount = React.useRef(null);
18
18
  const initialFetch = {
@@ -53,6 +53,8 @@ function RowVirtualizerDynamic(props) {
53
53
  loadingRef.current = false;
54
54
  if ((props === null || props === void 0 ? void 0 : props.searchTerm) && (props === null || props === void 0 ? void 0 : props.searchTerm) !== "") {
55
55
  totalRecordsCount.current = (_c = object === null || object === void 0 ? void 0 : object.data) === null || _c === void 0 ? void 0 : _c.length;
56
+ allCount.current = object === null || object === void 0 ? void 0 : object.totalRecords;
57
+ pageIndex.current = 0;
56
58
  setData(object === null || object === void 0 ? void 0 : object.data);
57
59
  }
58
60
  else {
@@ -99,7 +101,7 @@ function RowVirtualizerDynamic(props) {
99
101
  };
100
102
  // Render Skeletons
101
103
  const renderSkeletons = () => {
102
- return Array.from({ length: 10 }).map((_, index) => ((0, jsx_runtime_1.jsx)("li", Object.assign({ className: "p-listbox-item cursor-pointer" }, { children: (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, { height: "30px", width: "100%" }) }), index)));
104
+ return Array.from({ length: 10 }).map((_, index) => ((0, jsx_runtime_1.jsx)("li", Object.assign({ className: "p-listbox-item cursor-pointer p-1" }, { children: (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, { height: "30px", width: "100%" }) }), index)));
103
105
  };
104
106
  return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "p-listbox" }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "p-listbox-header", "data-pc-section": "header" }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "p-listbox-filter-container", "data-pc-section": "filtercontainer" }, { children: (0, jsx_runtime_1.jsxs)("span", Object.assign({ className: "p-input-icon-right flex-order-1" }, { children: [inputValue === "" ? ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: "p-input-suffix cursor-pointer" }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "search-md", size: 12 }) }))) : ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: "p-input-suffix cursor-pointer", onClick: (e) => {
105
107
  e.stopPropagation();
@@ -112,7 +114,7 @@ function RowVirtualizerDynamic(props) {
112
114
  height: virtualizer.getTotalSize(),
113
115
  width: '100%',
114
116
  position: 'relative',
115
- }, className: `${data.length === 0 ? "flex-column flex justify-content-around align-items-center h-full w-full" : ""}` }, { children: loadingRef.current && (data === null || data === void 0 ? void 0 : data.length) === 0 ? ((0, jsx_runtime_1.jsx)("ul", Object.assign({ className: "p-listbox-list" }, { children: renderSkeletons() }))) : (data === null || data === void 0 ? void 0 : data.length) === 0 ? (debouncedValue && debouncedValue !== "" ? ((0, jsx_runtime_1.jsx)("span", { children: emptyFilterMessage })) : ((0, jsx_runtime_1.jsx)("span", { children: emptyMessage }))) : ((0, jsx_runtime_1.jsx)("ul", Object.assign({ className: "p-listbox-list", style: {
117
+ }, className: `${data.length === 0 ? "flex-column flex justify-content-around align-items-center h-full w-full" : ""}` }, { children: loadingRef.current && (data === null || data === void 0 ? void 0 : data.length) === 0 ? ((0, jsx_runtime_1.jsx)("ul", Object.assign({ className: "p-listbox-list w-full" }, { children: renderSkeletons() }))) : (data === null || data === void 0 ? void 0 : data.length) === 0 ? (debouncedValue && debouncedValue !== "" ? ((0, jsx_runtime_1.jsx)("span", { children: emptyFilterMessage })) : ((0, jsx_runtime_1.jsx)("span", { children: emptyMessage }))) : ((0, jsx_runtime_1.jsx)("ul", Object.assign({ className: "p-listbox-list w-full", style: {
116
118
  position: 'absolute',
117
119
  top: 0,
118
120
  left: 0,
@@ -5,7 +5,7 @@ export declare const isComponentDisable: (state?: string) => boolean;
5
5
  export declare const applyDefaultFilters: (defaultFilters: any) => any;
6
6
  export declare const parseIfNeeded: (value: any) => any;
7
7
  export declare const sortColumns: (columns: any) => any;
8
- export declare const getCheckedStatus: (row: any, featureDetails: any, GRID_CHECKBOX_STATUS: any, setFeatureDetails: any) => any;
8
+ export declare const getCheckedStatus: (row: any, featureDetails: any, GRID_CHECKBOX_STATUS: any) => any;
9
9
  export declare const updateCells: (updatedRowData: any, setUpdateRowData: any, api: any) => void;
10
10
  export declare const fillOperation: (params: any, api: any, editedRecords: any, setEditedRecords: any) => Promise<void>;
11
11
  export declare const autoGroupColumnDef: (isTreeEnable: boolean, headerName: string, groupField: string, GroupHeaderComponent: React.FC, headerCheckboxRenderer: React.FC, enableCheckboxForGroupHeader: boolean, displayGroupCount: boolean, rowGroupColumnWidth: number, ChildRendererForGroup?: React.FC, HeaderRendererForGroup?: React.FC) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sccoreui",
3
- "version": "6.4.01",
3
+ "version": "6.4.02",
4
4
  "description": "ui-sccore",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -94,4 +94,4 @@
94
94
  "last 1 safari version"
95
95
  ]
96
96
  }
97
- }
97
+ }