sccoreui 6.4.93 → 6.4.95

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.
@@ -16,7 +16,7 @@ const FeatureSkeleton_1 = tslib_1.__importDefault(require("../../skeletons/Featu
16
16
  // import { ColumnDef } from "../Types";
17
17
  const ColumnGroup = (props) => {
18
18
  var _a, _b, _c, _d;
19
- const { dataFromProps } = props;
19
+ const { dataFromProps: _dataFromProps } = props;
20
20
  const columnGroupRef = (0, react_1.useRef)(null);
21
21
  const btnRef = (0, react_1.useRef)(null);
22
22
  const [searchText, setSearchedText] = (0, react_1.useState)("");
@@ -27,9 +27,8 @@ const ColumnGroup = (props) => {
27
27
  const [columns, setColumns] = (0, react_1.useState)([]);
28
28
  const [renderColumns, setRenderColumns] = (0, react_1.useState)([]);
29
29
  const [columnsSelectedForGroup, setColumnsSelectedForGroup] = (0, react_1.useState)([]);
30
- const [selectedCheckBoxesLength, setSelectedCheckBoxesLength] = (0, react_1.useState)(null);
30
+ const [_selectedCheckBoxesLength, setSelectedCheckBoxesLength] = (0, react_1.useState)(null);
31
31
  const isDisabled = (0, helper_1.isComponentDisable)(conditionsToDisplay.displayRowGroupingElement);
32
- console.log("intiallllllllll", intialColumns, selectedCheckBoxesLength);
33
32
  // const [featureDetails, setFeatureDetails] = useState<Features>({
34
33
  // searchedText: "",
35
34
  // filterQueries: [],
@@ -103,7 +102,6 @@ const ColumnGroup = (props) => {
103
102
  setSearchedText("");
104
103
  saveGrouping(e, sortedFilteredColumns);
105
104
  };
106
- console.log("columns innnnnnnn", dataFromProps);
107
105
  // Save Grouping
108
106
  const saveGrouping = (e, renderColumns) => {
109
107
  var _a, _b;
@@ -21,6 +21,7 @@ function HideColumn() {
21
21
  const [storeNodes, setStoreNodes] = (0, react_1.useState)();
22
22
  const [nodes, setNodes] = (0, react_1.useState)();
23
23
  const [hidePanelNodes, setHidePanelNodes] = (0, react_1.useState)([]);
24
+ const [hasChanges, setHasChanges] = (0, react_1.useState)(false);
24
25
  const isDisabled = (0, helper_1.isComponentDisable)(conditionsToDisplay.displaySidePanel);
25
26
  const addColumns = () => {
26
27
  var _a;
@@ -87,6 +88,7 @@ function HideColumn() {
87
88
  });
88
89
  // setNodes(updatedColumns)
89
90
  setStoreNodes(updatedColumns);
91
+ setHasChanges(true);
90
92
  };
91
93
  // Return columns needs to hide
92
94
  const updateColumns = () => {
@@ -106,6 +108,7 @@ function HideColumn() {
106
108
  setStoreNodes(updatedNodes);
107
109
  hideColumns(columnsToHide, updatedNodes);
108
110
  setVisibleRight(false);
111
+ setHasChanges(false);
109
112
  };
110
113
  // Hide columns from grid
111
114
  const hideColumns = (columnsToHide, updatedSeq) => {
@@ -137,7 +140,6 @@ function HideColumn() {
137
140
  changedColumns.push(Object.assign(Object.assign({}, colDef), { changeType: "visibility", previousHide: originalHideValue, currentHide: newHideValue }));
138
141
  }
139
142
  });
140
- console.log(changedColumns, "changedColumns - only visibility changes");
141
143
  // Only call updateColumnsForGrid if there are actually changed columns
142
144
  if (changedColumns.length > 0) {
143
145
  updateColumnsForGrid({
@@ -157,15 +159,10 @@ function HideColumn() {
157
159
  if (draggedIndex !== index.toString()) {
158
160
  const updatedColumns = [...storeNodes];
159
161
  const [draggedItem] = updatedColumns.splice(draggedIndex, 1);
160
- console.log(draggedItem, "dragged item", draggedIndex);
161
162
  updatedColumns.splice(index, 0, draggedItem);
162
- console.log(updatedColumns, draggedIndex, draggedItem, "data of dragging");
163
- for (let i = 0; i < updatedColumns.length; i++) {
164
- const currentColumn = updatedColumns[i];
165
- console.log(i, currentColumn, "columns in loop");
166
- }
167
163
  setNodes(updatedColumns);
168
164
  setStoreNodes(updatedColumns);
165
+ setHasChanges(true);
169
166
  }
170
167
  };
171
168
  // When drag is completed
@@ -183,7 +180,6 @@ function HideColumn() {
183
180
  }
184
181
  return node;
185
182
  });
186
- console.log(storeNodes, "store nodes in use effect");
187
183
  setNodes(fixNodes);
188
184
  setStoreNodes(fixNodes);
189
185
  }
@@ -191,10 +187,10 @@ function HideColumn() {
191
187
  const hidePanel = () => {
192
188
  setVisibleRight(false);
193
189
  setInputValue("");
190
+ setHasChanges(false);
194
191
  };
195
- return (0, utilComponents_1.skeletonLoding)() ? ((0, jsx_runtime_1.jsx)(FeatureSkeleton_1.default, {})) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ onClick: () => !isDisabled && setVisibleRight(true), className: `rounded_btn sc_icon_hover icon-40x40 ${isDisabled && "disabled"}`, title: "Manage Columns" }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "columns-02", color: "text-gray-500", size: 18 }) })), (0, jsx_runtime_1.jsxs)(sidebar_1.Sidebar, Object.assign({ className: "md:w-6 lg:w-4 overflow-hidden h-full ag_grid_sidebar", visible: visibleRight, position: "right", onHide: () => hidePanel() }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "bg-white" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex justify-content-between align-items-center px-4 py-3 border-bottom-1 border-gray-200" }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "text-gray-900 text-lg font-semibold line-height-3" }, { children: (sidePanelText === null || sidePanelText === void 0 ? void 0 : sidePanelText.header) || "Configure Columns" })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex align-items-center gap-3" }, { children: [(0, jsx_runtime_1.jsx)(button_1.Button, { className: "btn-text", label: (sidePanelText === null || sidePanelText === void 0 ? void 0 : sidePanelText.disacrd_button) || "Discard", onClick: () => hidePanel() }), (0, jsx_runtime_1.jsx)(button_1.Button, { className: "font-semibold", label: (sidePanelText === null || sidePanelText === void 0 ? void 0 : sidePanelText.update_button) || "Update", disabled: (storeNodes === null || storeNodes === void 0 ? void 0 : storeNodes.filter((node) => node.checked).length) > 15
196
- ? true
197
- : false, onClick: () => updateColumns() })] }))] })), enableManageColumnsCallback && ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "p-4 pb-0" }, { children: [(0, jsx_runtime_1.jsxs)("h3", Object.assign({ className: "flex align-items-center justify-content-between my-0" }, { children: [(sidePanelText === null || sidePanelText === void 0 ? void 0 : sidePanelText.apply_to_all_views) || "Apply to all views", (0, jsx_runtime_1.jsx)(inputswitch_1.InputSwitch, { checked: enableManageColumnsCallbackAPI, onChange: (e) => setEnableManageColumnsCallbackAPI(e.value) })] })), (0, jsx_runtime_1.jsx)("p", Object.assign({ className: "my-0 text-sm text-gray-600" }, { children: (sidePanelText === null || sidePanelText === void 0 ? void 0 : sidePanelText.apply_subHeading) ||
192
+ return (0, utilComponents_1.skeletonLoding)() ? ((0, jsx_runtime_1.jsx)(FeatureSkeleton_1.default, {})) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ onClick: () => !isDisabled && setVisibleRight(true), className: `rounded_btn sc_icon_hover icon-40x40 ${isDisabled && "disabled"}`, title: "Manage Columns" }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "columns-02", color: "text-gray-500", size: 18 }) })), (0, jsx_runtime_1.jsxs)(sidebar_1.Sidebar, Object.assign({ className: "md:w-6 lg:w-4 overflow-hidden h-full ag_grid_sidebar", visible: visibleRight, position: "right", onHide: () => hidePanel() }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "bg-white" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex justify-content-between align-items-center px-4 py-3 border-bottom-1 border-gray-200" }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "text-gray-900 text-lg font-semibold line-height-3" }, { children: (sidePanelText === null || sidePanelText === void 0 ? void 0 : sidePanelText.header) || "Configure Columns" })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex align-items-center gap-3" }, { children: [(0, jsx_runtime_1.jsx)(button_1.Button, { className: "btn-text", label: (sidePanelText === null || sidePanelText === void 0 ? void 0 : sidePanelText.disacrd_button) || "Discard", onClick: () => hidePanel() }), (0, jsx_runtime_1.jsx)(button_1.Button, { className: "font-semibold", label: (sidePanelText === null || sidePanelText === void 0 ? void 0 : sidePanelText.update_button) || "Update", disabled: !hasChanges ||
193
+ (storeNodes === null || storeNodes === void 0 ? void 0 : storeNodes.filter((node) => node.checked).length) > 15, onClick: () => updateColumns() })] }))] })), enableManageColumnsCallback && ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "p-4 pb-0" }, { children: [(0, jsx_runtime_1.jsxs)("h3", Object.assign({ className: "flex align-items-center justify-content-between my-0" }, { children: [(sidePanelText === null || sidePanelText === void 0 ? void 0 : sidePanelText.apply_to_all_views) || "Apply to all views", (0, jsx_runtime_1.jsx)(inputswitch_1.InputSwitch, { checked: enableManageColumnsCallbackAPI, onChange: (e) => setEnableManageColumnsCallbackAPI(e.value) })] })), (0, jsx_runtime_1.jsx)("p", Object.assign({ className: "my-0 text-sm text-gray-600" }, { children: (sidePanelText === null || sidePanelText === void 0 ? void 0 : sidePanelText.apply_subHeading) ||
198
194
  "Apply the chosen column selection to all available views" })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "mt-2" }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "p-input-icon-left p-input-icon-right w-full" }, { children: [(0, jsx_runtime_1.jsx)("span", Object.assign({ className: "p-input-prefix" }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "search-md" }) })), (inpValue === null || inpValue === void 0 ? void 0 : inpValue.length) > 0 && ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: "p-input-suffix cursor-pointer zoom_animate", onClick: clearSearch }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "x-close", size: 18 }) }))), (0, jsx_runtime_1.jsx)(inputtext_1.InputText, { id: "email", value: inpValue, onChange: (e) => {
199
195
  searchHandler(e.target.value);
200
196
  }, disabled: false, placeholder: (sidePanelText === null || sidePanelText === void 0 ? void 0 : sidePanelText.search_placeHolder) ||
@@ -202,10 +198,10 @@ function HideColumn() {
202
198
  position: "sticky",
203
199
  top: (sidePanelText === null || sidePanelText === void 0 ? void 0 : sidePanelText.selected_attributes) && "0px",
204
200
  } }, { children: [(sidePanelText === null || sidePanelText === void 0 ? void 0 : sidePanelText.selected_attributes) || "Selected Attributes", " ", (0, jsx_runtime_1.jsxs)("span", Object.assign({ className: "text-gray-500 text-lg font-normal ml-1" }, { children: [`(`, nodes === null || nodes === void 0 ? void 0 : nodes.filter((node) => node.selected).length, "/", nodes === null || nodes === void 0 ? void 0 : nodes.filter((node) => node.unSelected || node.selected).length, `)`] }))] })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "w-full" }, { children: (0, jsx_runtime_1.jsx)("ul", Object.assign({ className: "list-none p-0 mt-0" }, { children: (nodes === null || nodes === void 0 ? void 0 : nodes.length) > 0 ? (nodes === null || nodes === void 0 ? void 0 : nodes.map((listItem, idx) => (listItem === null || listItem === void 0 ? void 0 : listItem.visibleInPanel) &&
205
- (listItem === null || listItem === void 0 ? void 0 : listItem.selected) && ((0, jsx_runtime_1.jsxs)("li", Object.assign({ className: "flex align-items-center justify-content-between py-3 text-gray-600 text-base", draggable: true, onDragStart: handleDragStart(idx), onDrop: handleDrop(idx), onDragOver: handleDragOver }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex gap-3" }, { children: [(0, jsx_runtime_1.jsx)("img", { src: drag_and_drop_icon_png_1.default, alt: "Drag and drop", className: "cursor-move" }), (0, jsx_runtime_1.jsx)("span", Object.assign({ className: "max-w-24rem text_ellipsis" }, { children: listItem.headerName }))] })), (0, jsx_runtime_1.jsx)(inputswitch_1.InputSwitch, { checked: listItem === null || listItem === void 0 ? void 0 : listItem.checked, onChange: (e) => handleSwitchChange(listItem, e.value) })] }), idx)))) : ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "flex flex-column -mx-3" }, { children: (0, jsx_runtime_1.jsx)("h3", Object.assign({ className: "mt-0 mb-2 flex align-items-center justify-content-center py-8 bg-gray-50 p-8 border-round-md mt-2 text-gray-900 font-normal" }, { children: "No results found on the search criteria" })) })) })) })) })), (0, jsx_runtime_1.jsxs)("h3", Object.assign({ className: " mb-0 mt-0 py-2 border-bottom-1 border-gray-200 bg-white z-5", style: {
201
+ (listItem === null || listItem === void 0 ? void 0 : listItem.selected) && ((0, jsx_runtime_1.jsxs)("li", Object.assign({ className: "flex align-items-center justify-content-between py-3 text-gray-600 text-base", draggable: true, onDragStart: handleDragStart(idx), onDrop: handleDrop(idx), onDragOver: handleDragOver }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex gap-3 align-items-center", style: { minWidth: 0 } }, { children: [(0, jsx_runtime_1.jsx)("img", { src: drag_and_drop_icon_png_1.default, alt: "Drag and drop", className: "cursor-move flex-shrink-0" }), (0, jsx_runtime_1.jsx)("span", Object.assign({ className: "white-space-nowrap overflow-hidden text-overflow-ellipsis", style: { maxWidth: '200px' }, title: listItem.headerName }, { children: listItem.headerName }))] })), (0, jsx_runtime_1.jsx)(inputswitch_1.InputSwitch, { checked: listItem === null || listItem === void 0 ? void 0 : listItem.checked, onChange: (e) => handleSwitchChange(listItem, e.value) })] }), idx)))) : ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "flex flex-column -mx-3" }, { children: (0, jsx_runtime_1.jsx)("h3", Object.assign({ className: "mt-0 mb-2 flex align-items-center justify-content-center py-8 bg-gray-50 p-8 border-round-md mt-2 text-gray-900 font-normal" }, { children: "No results found on the search criteria" })) })) })) })) })), (0, jsx_runtime_1.jsxs)("h3", Object.assign({ className: " mb-0 mt-0 py-2 border-bottom-1 border-gray-200 bg-white z-5", style: {
206
202
  position: "sticky",
207
203
  top: (sidePanelText === null || sidePanelText === void 0 ? void 0 : sidePanelText.selected_attributes) && "35px",
208
204
  } }, { children: [(sidePanelText === null || sidePanelText === void 0 ? void 0 : sidePanelText.unselected_attributes) || "Unselected Attributes", (0, jsx_runtime_1.jsxs)("span", Object.assign({ className: "text-gray-500 text-lg font-normal ml-2" }, { children: [`(`, nodes === null || nodes === void 0 ? void 0 : nodes.filter((node) => node.unSelected).length, "/", nodes === null || nodes === void 0 ? void 0 : nodes.filter((node) => node.unSelected || node.selected).length, `)`] }))] })), (nodes === null || nodes === void 0 ? void 0 : nodes.length) > 0 ? ((0, jsx_runtime_1.jsx)("ul", Object.assign({ className: "list-none p-0 mt-2 ml-3" }, { children: nodes === null || nodes === void 0 ? void 0 : nodes.map((listItem) => (listItem === null || listItem === void 0 ? void 0 : listItem.visibleInPanel) &&
209
- (listItem === null || listItem === void 0 ? void 0 : listItem.unSelected) && ((0, jsx_runtime_1.jsxs)("li", Object.assign({ className: "flex align-items-center justify-content-between py-3 text-gray-600 text-base" }, { children: [(0, jsx_runtime_1.jsx)("span", { children: listItem.headerName }), (0, jsx_runtime_1.jsx)(inputswitch_1.InputSwitch, { checked: listItem.checked, onChange: (e) => handleSwitchChange(listItem, e.value) })] }), listItem.id))) }))) : ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "mt-0 mb-2 flex align-items-center justify-content-center py-8 bg-gray-50 p-8 border-round-md mt-4 text-gray-900 text-lg" }, { children: "No results found on the search criteria" })))] }))] }))] }));
205
+ (listItem === null || listItem === void 0 ? void 0 : listItem.unSelected) && ((0, jsx_runtime_1.jsxs)("li", Object.assign({ className: "flex align-items-center justify-content-between py-3 text-gray-600 text-base" }, { children: [(0, jsx_runtime_1.jsx)("span", Object.assign({ className: "white-space-nowrap overflow-hidden text-overflow-ellipsis", style: { maxWidth: '200px' }, title: listItem.headerName }, { children: listItem.headerName })), (0, jsx_runtime_1.jsx)(inputswitch_1.InputSwitch, { checked: listItem.checked, onChange: (e) => handleSwitchChange(listItem, e.value) })] }), listItem.id))) }))) : ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "mt-0 mb-2 flex align-items-center justify-content-center py-8 bg-gray-50 p-8 border-round-md mt-4 text-gray-900 text-lg" }, { children: "No results found on the search criteria" })))] }))] }))] }));
210
206
  }
211
207
  exports.default = HideColumn;
@@ -345,7 +345,7 @@ const TableFilter = () => {
345
345
  }
346
346
  }, [globalFilters]);
347
347
  /**
348
- * Sync conditionsArray when dialog opens
348
+ * Sync conditionsArray when dialog opens and show input if viewName exists
349
349
  */
350
350
  (0, react_1.useEffect)(() => {
351
351
  if (isVisible) {
@@ -355,6 +355,10 @@ const TableFilter = () => {
355
355
  else {
356
356
  setConditionsArray(globalFilters);
357
357
  }
358
+ // Show the view name input if viewName is already set
359
+ if (viewName) {
360
+ setDisplayInput(true);
361
+ }
358
362
  }
359
363
  }, [isVisible]);
360
364
  /**
@@ -9,14 +9,14 @@ const hooks_1 = require("primereact/hooks");
9
9
  const constants_1 = tslib_1.__importDefault(require("./constants"));
10
10
  exports.FeatureContext = (0, react_1.createContext)(null);
11
11
  function MyProvider({ children, value }) {
12
- const { featureDetails, setFeatureDetails, gridData, callGrid, totalRecords, initialFeature, defaultFilters, defaultSort, 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;
12
+ const { featureDetails, setFeatureDetails, gridData, callGrid, totalRecords, initialFeature, defaultFilters, defaultSort, 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, defaultViewName } = value;
13
13
  // States for sort
14
14
  const [columnData] = (0, react_1.useState)(gridData === null || gridData === void 0 ? void 0 : gridData.columnData);
15
15
  const [inputValue, deboucedValue, setInputValue] = (0, hooks_1.useDebounce)("", 500);
16
16
  const [sortValue, setSortValue] = (0, react_1.useState)({});
17
17
  const [sortBy, setSortBy] = (0, react_1.useState)({});
18
18
  const [isOverlayOpened, setIsOverlayOpened] = (0, react_1.useState)(false);
19
- const [viewName, setViewName] = (0, react_1.useState)("");
19
+ const [viewName, setViewName] = (0, react_1.useState)(defaultViewName || "");
20
20
  // States for filter
21
21
  const [queries, setQueries] = (0, react_1.useState)(() => {
22
22
  var _a;
@@ -100,6 +100,12 @@ function MyProvider({ children, value }) {
100
100
  }
101
101
  }
102
102
  }, [defaultSort, columnData, sortOptions]);
103
+ // Update viewName when defaultViewName changes
104
+ (0, react_1.useEffect)(() => {
105
+ if (defaultViewName) {
106
+ setViewName(defaultViewName);
107
+ }
108
+ }, [defaultViewName]);
103
109
  // Empty filters and call the grid
104
110
  (0, react_1.useEffect)(() => {
105
111
  // Only clear if clearFilters is explicitly true (not just truthy like [])
@@ -35,7 +35,6 @@ function ErrorBoundary({ children }) {
35
35
  };
36
36
  }, []);
37
37
  if (hasError) {
38
- console.log(hasError, "error occured");
39
38
  // Fallback UI for when an error occurs
40
39
  return (
41
40
  // <div role="alert" className="errorContainer bg-gray-200">
@@ -458,6 +458,6 @@ function ParentForGrid(props) {
458
458
  gridViewFun,
459
459
  gridViewData,
460
460
  setGridViewData,
461
- 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 })] }) })) }) }));
461
+ 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, defaultViewName: props === null || props === void 0 ? void 0 : props.defaultViewName }) }, { 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 })] }) })) }) }));
462
462
  }
463
463
  exports.default = ParentForGrid;
@@ -13,8 +13,7 @@ const dataCellRenderer = (cellRendererParams, column, props) => {
13
13
  };
14
14
  exports.dataCellRenderer = dataCellRenderer;
15
15
  //Get this compnent from products
16
- const GroupHeader = (params) => {
17
- console.log(params, "params");
16
+ const GroupHeader = (_params) => {
18
17
  return (0, jsx_runtime_1.jsx)("p", { children: "My Custom Group" });
19
18
  };
20
19
  exports.GroupHeader = GroupHeader;
@@ -13,6 +13,7 @@ const ExpressionRender_1 = tslib_1.__importDefault(require("./ExpressionRender")
13
13
  const FormulaComponent = (props) => {
14
14
  const priceConditioRef = (0, react_1.useRef)(null);
15
15
  const [fieldOptions, setFieldOptions] = (0, react_1.useState)(props === null || props === void 0 ? void 0 : props.fieldOptions);
16
+ const [isMenuVisible, setIsMenuVisible] = (0, react_1.useState)(false);
16
17
  const [conditionValue, setConditionValue] = (0, react_1.useState)((props === null || props === void 0 ? void 0 : props.conditionValue) ? props === null || props === void 0 ? void 0 : props.conditionValue : 1);
17
18
  (0, react_1.useEffect)(() => {
18
19
  setConditionValue(props.conditionValue);
@@ -28,9 +29,9 @@ const FormulaComponent = (props) => {
28
29
  ? props === null || props === void 0 ? void 0 : props.headerLabel
29
30
  : "Configure Value" })), (0, jsx_runtime_1.jsx)("span", { children: (props === null || props === void 0 ? void 0 : props.headerDescription)
30
31
  ? props === null || props === void 0 ? void 0 : props.headerDescription
31
- : "Select price attribute and perform calculation." })] })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "" }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "help-circle", size: 16 }) }))] }))), (0, jsx_runtime_1.jsx)(Tagify_1.default, { formulaOperators: props.formulaOperators, fieldOptions: fieldOptions, formulaValue: props === null || props === void 0 ? void 0 : props.formulaValue, priceConditioRef: priceConditioRef, onChange: (e) => {
32
+ : "Select price attribute and perform calculation." })] })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "" }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "help-circle", size: 16 }) }))] }))), isMenuVisible && ((0, jsx_runtime_1.jsx)(Tagify_1.default, { formulaOperators: props.formulaOperators, fieldOptions: fieldOptions, formulaValue: props === null || props === void 0 ? void 0 : props.formulaValue, priceConditioRef: priceConditioRef, onChange: (e) => {
32
33
  (props === null || props === void 0 ? void 0 : props.onSaveFormula) && (props === null || props === void 0 ? void 0 : props.onSaveFormula(e));
33
- } })] }), "formula__dev"));
34
+ } }))] }), "formula__dev"));
34
35
  },
35
36
  },
36
37
  ];
@@ -80,10 +81,6 @@ const FormulaComponent = (props) => {
80
81
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
81
82
  }
82
83
  }
83
- })() }), (0, jsx_runtime_1.jsx)(menu_1.Menu
84
- // onShow={onShowMenu}
85
- , {
86
- // onShow={onShowMenu}
87
- popup: true, popupAlignment: "left", className: `w-28rem p-0 ${props === null || props === void 0 ? void 0 : props.menuClassName}`, model: menuContent, ref: priceConditioRef, id: "condition_menu_popup" })] }), "asadssadsasdsdadasd"));
84
+ })() }), (0, jsx_runtime_1.jsx)(menu_1.Menu, { onShow: () => setIsMenuVisible(true), onHide: () => setIsMenuVisible(false), popup: true, popupAlignment: "left", className: `w-28rem p-0 ${props === null || props === void 0 ? void 0 : props.menuClassName}`, model: menuContent, ref: priceConditioRef, id: "condition_menu_popup" })] }), "asadssadsasdsdadasd"));
88
85
  };
89
86
  exports.default = FormulaComponent;
@@ -31,6 +31,9 @@ const TAGIFY_STYLES = `
31
31
  .tagify__tag.tagify--editable {
32
32
  pointer-events: none !important;
33
33
  }
34
+ .tagify__tag {
35
+ margin: 4px 0 !important;
36
+ }
34
37
  `;
35
38
  // Safe math expression evaluator (replaces eval)
36
39
  const safeEvaluate = (expression) => {
@@ -71,10 +74,18 @@ const safeEvaluate = (expression) => {
71
74
  const right = parseFactor();
72
75
  if (op === "*")
73
76
  left = left * right;
74
- else if (op === "/")
77
+ else if (op === "/") {
78
+ if (right === 0) {
79
+ throw new Error("Division by zero");
80
+ }
75
81
  left = left / right;
76
- else
82
+ }
83
+ else {
84
+ if (right === 0) {
85
+ throw new Error("Division by zero");
86
+ }
77
87
  left = left % right;
88
+ }
78
89
  }
79
90
  return left;
80
91
  };
@@ -198,22 +209,27 @@ const TagifyComponent = (props) => {
198
209
  if (/[\+\-\*\/\%][\*\/\%]/.test(validationValue)) {
199
210
  return { isValid: false, error: "Invalid operator sequence" };
200
211
  }
201
- // If we passed all validations, extract prices and evaluate
202
- const str = tagifyRef.current.value;
203
- let res = str.replace(tagPattern, (match) => {
204
- try {
205
- const tagData = JSON.parse(match.slice(2, -2));
206
- return tagData.price.toString();
207
- }
208
- catch (_a) {
209
- return "0"; // Use 0 as fallback for invalid tags
210
- }
211
- });
212
+ // If we passed all validations, only evaluate when there are no chips
213
+ const hasChips = chipTokens.length > 0;
214
+ if (hasChips) {
215
+ return { isValid: true, error: "" };
216
+ }
212
217
  // Clean the result string for evaluation
213
- res = res.replaceAll("​", "");
218
+ let res = validationValue.replaceAll("​", "");
214
219
  res = res.replaceAll(" ", "");
215
220
  // Safely evaluate the expression
216
- const result = safeEvaluate(res);
221
+ let result;
222
+ debugger;
223
+ console.log(res, "response -data check");
224
+ try {
225
+ result = safeEvaluate(res);
226
+ }
227
+ catch (err) {
228
+ if (err instanceof Error && err.message === "Division by zero") {
229
+ return { isValid: false, error: "Division by zero" };
230
+ }
231
+ return { isValid: false, error: "Invalid formula" };
232
+ }
217
233
  // Check if result is a valid number
218
234
  if (isNaN(result) || !isFinite(result)) {
219
235
  return { isValid: false, error: "Invalid formula result" };
@@ -250,7 +266,10 @@ const TagifyComponent = (props) => {
250
266
  }
251
267
  };
252
268
  (0, react_1.useEffect)(() => {
253
- var _a;
269
+ // Check if the input element exists before initializing
270
+ if (!tagifyRef.current) {
271
+ return undefined;
272
+ }
254
273
  // Add styles only once
255
274
  if (!styleRef.current) {
256
275
  const style = document.createElement("style");
@@ -258,63 +277,16 @@ const TagifyComponent = (props) => {
258
277
  document.head.appendChild(style);
259
278
  styleRef.current = style;
260
279
  }
261
- // Initialize tagify with new keyword and options
262
- const tagifyInstance = new tagify_1.default(tagifyRef.current, {
263
- tagTextProp: "value",
264
- placeholder: "Enter text or tags...",
265
- mode: "mix",
266
- skipInvalid: true,
267
- duplicates: true,
268
- enforceWhitelist: true,
269
- editTags: false,
270
- whitelist: [...((props === null || props === void 0 ? void 0 : props.fieldOptions) || [])],
271
- dropdown: {
272
- maxItems: 10,
273
- classname: "tags-look",
274
- enabled: 0,
275
- closeOnSelect: true,
276
- searchKeys: ["@"],
277
- highlightFirst: true,
278
- position: "text",
279
- mapValueTo: "value",
280
- includeSelectedTags: true,
281
- showTags: false,
282
- hideSelected: false, // Don't hide selected items from the dropdown
283
- },
284
- templates: {
285
- // Override the dropdownItem template to remove the selected checkmark
286
- dropdownItem: function (tagData) {
287
- // Create a custom template without checkmark
288
- return `<div ${this.getAttributes(tagData)}
289
- class='tagify__dropdown__item ${tagData.class ? tagData.class : ""}'
290
- tabindex="0"
291
- role="option">
292
- <span>${tagData.value}</span>
293
- </div>`;
294
- },
295
- },
296
- // Prevent double-click from triggering edit mode
297
- callbacks: {
298
- click: function (e) {
299
- // Prevent default double-click behavior
300
- e.preventDefault();
301
- return false;
302
- },
303
- },
304
- });
305
- // Store instance in ref for access in other functions
306
- tagifyInstanceRef.current = tagifyInstance;
307
- // Override the editTag method to prevent editing
308
- tagifyInstance.editTag = function () {
309
- return false;
310
- };
311
- // Handle any click or dblclick on tags to prevent editing
280
+ // Store reference to the input element
281
+ const inputElement = tagifyRef.current;
282
+ let tagifyInstance = null;
283
+ let tagifyInput = null;
284
+ // Handle double-click to prevent editing
312
285
  const handleDblClick = (e) => {
313
286
  e.preventDefault();
314
287
  e.stopPropagation();
315
288
  return false;
316
289
  };
317
- tagifyRef.current.addEventListener("dblclick", handleDblClick, true);
318
290
  // Filter invalid keystrokes based on context
319
291
  const handleKeyDown = (e) => {
320
292
  var _a;
@@ -322,7 +294,7 @@ const TagifyComponent = (props) => {
322
294
  "Backspace", "Delete", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown",
323
295
  "Home", "End", "Tab", "Enter", "Escape"
324
296
  ];
325
- const operators = /^[+\-*/%]$/;
297
+ const operatorsRegex = /^[+\-*/%]$/;
326
298
  const numbers = /^[0-9.]$/;
327
299
  const openParen = "(";
328
300
  const closeParen = ")";
@@ -364,7 +336,7 @@ const TagifyComponent = (props) => {
364
336
  return;
365
337
  }
366
338
  // Handle operators
367
- if (operators.test(e.key)) {
339
+ if (operatorsRegex.test(e.key)) {
368
340
  // Can't start with * / % (but can start with + or -)
369
341
  if (isEmpty && /^[*/%]$/.test(e.key)) {
370
342
  e.preventDefault();
@@ -443,24 +415,84 @@ const TagifyComponent = (props) => {
443
415
  // Block everything else (alphabets, special chars, etc.)
444
416
  e.preventDefault();
445
417
  };
446
- // Get the tagify input element (the contenteditable span)
447
- const tagifyInput = (_a = tagifyRef.current.parentElement) === null || _a === void 0 ? void 0 : _a.querySelector(".tagify__input");
448
- if (tagifyInput) {
449
- tagifyInput.addEventListener("keydown", handleKeyDown);
450
- }
451
- // On input change, just clear error display (no validation during typing)
452
- tagifyInstance.on("input", () => {
453
- clearErrorBorder();
454
- });
455
- tagifyInstance.on("change", () => {
456
- clearErrorBorder();
418
+ // Use requestAnimationFrame to ensure DOM is ready after Menu transition
419
+ const initTimeoutId = requestAnimationFrame(() => {
420
+ var _a;
421
+ if (!inputElement)
422
+ return;
423
+ // Initialize tagify with new keyword and options
424
+ tagifyInstance = new tagify_1.default(inputElement, {
425
+ tagTextProp: "value",
426
+ placeholder: "Enter text or tags...",
427
+ mode: "mix",
428
+ skipInvalid: true,
429
+ duplicates: true,
430
+ enforceWhitelist: true,
431
+ editTags: false,
432
+ whitelist: [...((props === null || props === void 0 ? void 0 : props.fieldOptions) || [])],
433
+ dropdown: {
434
+ maxItems: 10,
435
+ classname: "tags-look",
436
+ enabled: 0,
437
+ closeOnSelect: true,
438
+ searchKeys: ["@"],
439
+ highlightFirst: true,
440
+ position: "text",
441
+ mapValueTo: "value",
442
+ includeSelectedTags: true,
443
+ showTags: false,
444
+ hideSelected: false, // Don't hide selected items from the dropdown
445
+ },
446
+ templates: {
447
+ // Override the dropdownItem template to remove the selected checkmark
448
+ dropdownItem: function (tagData) {
449
+ // Create a custom template without checkmark
450
+ return `<div ${this.getAttributes(tagData)}
451
+ class='tagify__dropdown__item ${tagData.class ? tagData.class : ""}'
452
+ tabindex="0"
453
+ role="option">
454
+ <span>${tagData.value}</span>
455
+ </div>`;
456
+ },
457
+ },
458
+ // Prevent double-click from triggering edit mode
459
+ callbacks: {
460
+ click: function (e) {
461
+ // Prevent default double-click behavior
462
+ e.preventDefault();
463
+ return false;
464
+ },
465
+ },
466
+ });
467
+ // Store instance in ref for access in other functions
468
+ tagifyInstanceRef.current = tagifyInstance;
469
+ // Override the editTag method to prevent editing
470
+ tagifyInstance.editTag = function () {
471
+ return false;
472
+ };
473
+ inputElement.addEventListener("dblclick", handleDblClick, true);
474
+ // Get the tagify input element (the contenteditable span)
475
+ tagifyInput = ((_a = inputElement.parentElement) === null || _a === void 0 ? void 0 : _a.querySelector(".tagify__input")) || null;
476
+ if (tagifyInput) {
477
+ tagifyInput.addEventListener("keydown", handleKeyDown);
478
+ }
479
+ // On input change, just clear error display (no validation during typing)
480
+ tagifyInstance.on("input", () => {
481
+ clearErrorBorder();
482
+ });
483
+ tagifyInstance.on("change", () => {
484
+ clearErrorBorder();
485
+ });
457
486
  });
458
487
  // Clean up on unmount
459
488
  return () => {
460
- tagifyInstance.destroy();
489
+ cancelAnimationFrame(initTimeoutId);
490
+ if (tagifyInstance) {
491
+ tagifyInstance.destroy();
492
+ }
461
493
  tagifyInstanceRef.current = null;
462
- if (tagifyRef.current) {
463
- tagifyRef.current.removeEventListener("dblclick", handleDblClick, true);
494
+ if (inputElement) {
495
+ inputElement.removeEventListener("dblclick", handleDblClick, true);
464
496
  }
465
497
  if (tagifyInput) {
466
498
  tagifyInput.removeEventListener("keydown", handleKeyDown);
@@ -472,16 +504,13 @@ const TagifyComponent = (props) => {
472
504
  };
473
505
  }, []);
474
506
  // Function to get the cursor position and add operator symbol
475
- const addOperatorAtCursor = (operator) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
507
+ const addOperatorAtCursor = (operator) => {
476
508
  var _a;
477
509
  if (tagifyRef.current) {
478
510
  tagifyRef.current.value = ((_a = tagifyRef === null || tagifyRef === void 0 ? void 0 : tagifyRef.current) === null || _a === void 0 ? void 0 : _a.value) + operators[operator];
479
511
  }
480
- if (tagifyInstanceRef.current) {
481
- yield tagifyInstanceRef.current.on([{ value: operators[operator], type: "math" }]);
482
- }
483
512
  clearErrorBorder();
484
- });
513
+ };
485
514
  const handleSaveClick = (e) => {
486
515
  var _a, _b, _c;
487
516
  const { isValid, error } = validateFormula();
@@ -39,6 +39,7 @@ interface MyProviderProps {
39
39
  setGridViewData: any;
40
40
  gridView: boolean;
41
41
  serverSideSelectRow: (data: any, emptyFun: (oject: any) => void) => void;
42
+ defaultViewName?: string;
42
43
  };
43
44
  }
44
45
  declare function MyProvider({ children, value }: MyProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
1
  export declare const dataCellRenderer: (cellRendererParams: any, column: any, props: any) => import("react/jsx-runtime").JSX.Element;
2
- export declare const GroupHeader: (params: any) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const GroupHeader: (_params: any) => import("react/jsx-runtime").JSX.Element;
3
3
  export declare const GridHeaderComponent: (props: any) => any;
4
4
  export declare const skeletonLoding: () => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sccoreui",
3
- "version": "6.4.93",
3
+ "version": "6.4.95",
4
4
  "description": "ui-sccore",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",