sccoreui 5.9.48 → 5.9.49

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.
@@ -14,7 +14,7 @@ function AdvancedFeatures({ props }) {
14
14
  const { featureDetails } = (0, react_1.useContext)(context_provider_1.FeatureContext);
15
15
  const conditionsToDisplay = props === null || props === void 0 ? void 0 : props.conditionsToDisplay;
16
16
  const { bulkActionComponent: BulkAction } = props;
17
- return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex align-items-center justify-content-between py-3 px-4" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex align-items-center gap-3" }, { children: [(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displaySearch) && ((0, jsx_runtime_1.jsx)(global_search_1.default, { searchPlaceHolder: props === null || props === void 0 ? void 0 : props.placeholder })), (conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayFilter) && (0, jsx_runtime_1.jsx)(table_filter_1.default, {})] })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex align-items-center gap-2" }, { children: [(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayRemoveItems) && (0, jsx_runtime_1.jsx)(remove_items_1.default, {}), (conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayBulkAction) &&
17
+ return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex align-items-center justify-content-between py-3 px-4" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex align-items-center gap-3" }, { children: [(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displaySearch) && ((0, jsx_runtime_1.jsx)(global_search_1.default, { searchPlaceHolder: props === null || props === void 0 ? void 0 : props.placeholder })), (conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayFilter) && (0, jsx_runtime_1.jsx)(table_filter_1.default, {})] })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex align-items-center" }, { children: [(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayRemoveItems) && (0, jsx_runtime_1.jsx)(remove_items_1.default, {}), (conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayBulkAction) &&
18
18
  (props === null || props === void 0 ? void 0 : props.bulkActionComponent) && ((0, jsx_runtime_1.jsx)(BulkAction, { checkBoxSelection: featureDetails.checkBoxSelection })), (conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayRefresh) && (0, jsx_runtime_1.jsx)(refresh_grid_1.default, {}), (conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displaySort) && (0, jsx_runtime_1.jsx)(custom_sort_1.default, {}), (0, jsx_runtime_1.jsx)(record_detail_1.default, {})] }))] })));
19
19
  }
20
20
  exports.default = AdvancedFeatures;
@@ -89,7 +89,7 @@ function Sort() {
89
89
  }, [sortValue, sortBy]);
90
90
  return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `cursor-pointer sc_icon_hover flex align-items-center border-round ${isOverlayOpened || featureDetails.sort.isSortable
91
91
  ? "bg-primary-50"
92
- : ""}` }, { children: [featureDetails.sort.isSortable && ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: "flex align-items-center text-primary-400 ml-2" }, { children: `Selected` }))), (0, jsx_runtime_1.jsx)(button_1.Button, { className: "icon-32x32 hover:bg-primary-50", text: true, onClick: (event) => onClickSort(event), icon: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "switch-vertical-02", size: 16, color: isOverlayOpened || featureDetails.sort.isSortable
92
+ : ""}` }, { children: [featureDetails.sort.isSortable && ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: "flex align-items-center text-primary-400 ml-3" }, { children: `Selected` }))), (0, jsx_runtime_1.jsx)(button_1.Button, { className: "icon-32x32 hover:bg-primary-50", text: true, onClick: (event) => onClickSort(event), icon: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "switch-vertical-02", size: 16, color: isOverlayOpened || featureDetails.sort.isSortable
93
93
  ? "text-gray-700"
94
94
  : "text-gray-700" }) })] })), (0, jsx_runtime_1.jsxs)(overlaypanel_1.OverlayPanel, Object.assign({ ref: showShort, onShow: () => setIsOverlayOpened(true), onHide: () => setIsOverlayOpened(false), className: "w-18rem mt-2 overlay_list_options" }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "p-4 text-lg font-semibold line-height-3 text-gray-900 border-bottom-1 border-gray-200" }, { children: "Column Sorting" })), (0, jsx_runtime_1.jsx)("ul", Object.assign({ className: "pl-0 m-1 max-h-10rem overflow-auto" }, { children: columnData === null || columnData === void 0 ? void 0 : columnData.map((eachColumn, index) => {
95
95
  if (eachColumn === null || eachColumn === void 0 ? void 0 : eachColumn.isSortable) {
@@ -99,6 +99,9 @@ const TableFilter = () => {
99
99
  };
100
100
  const createViewFromFilters = () => {
101
101
  const newFilters = conditionsArray.map((condition) => {
102
+ // Convert value type to string when data comes in object or array form
103
+ if (typeof condition.value !== "string")
104
+ condition.value = JSON.stringify(condition.value);
102
105
  return Object.assign(Object.assign({}, condition), { isActive: true, logicalOperator: conditionType.id });
103
106
  });
104
107
  const viewDetails = {
@@ -5,6 +5,6 @@ const react_1 = require("react");
5
5
  const context_provider_1 = require("../context-provider");
6
6
  function RecordDetail() {
7
7
  const { totalRecords } = (0, react_1.useContext)(context_provider_1.FeatureContext);
8
- return ((0, jsx_runtime_1.jsx)("div", { children: `Total ${totalRecords} records` }));
8
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "ml-2" }, { children: `Total ${totalRecords} records` })));
9
9
  }
10
10
  exports.default = RecordDetail;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FeatureContext = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
+ const helper_1 = require("./helper");
6
7
  exports.FeatureContext = (0, react_1.createContext)(null);
7
8
  function MyProvider({ children, value }) {
8
9
  const { featureDetails, setFeatureDetails, gridData, callGrid, totalRecords, initialFeature, defaultFilters, createView, enableViewCreate } = value;
@@ -37,8 +38,13 @@ function MyProvider({ children, value }) {
37
38
  callGrid(emptyFeatures);
38
39
  };
39
40
  (0, react_1.useEffect)(() => {
40
- if (defaultFilters.length)
41
- setGlobalFilters(defaultFilters);
41
+ if (defaultFilters.length) {
42
+ const filtersToAdd = defaultFilters.map((filter) => {
43
+ filter.value = (0, helper_1.parseIfNeeded)(filter.value);
44
+ return filter;
45
+ });
46
+ setGlobalFilters(filtersToAdd);
47
+ }
42
48
  }, [defaultFilters]);
43
49
  return ((0, jsx_runtime_1.jsx)(exports.FeatureContext.Provider, Object.assign({ value: {
44
50
  sortValue,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.applyDefaultFilters = void 0;
3
+ exports.parseIfNeeded = exports.applyDefaultFilters = void 0;
4
4
  const applyDefaultFilters = (defaultFilters) => {
5
5
  console.log(defaultFilters, 'deafult filters');
6
6
  const filters = defaultFilters === null || defaultFilters === void 0 ? void 0 : defaultFilters.map((item) => {
@@ -15,3 +15,21 @@ const applyDefaultFilters = (defaultFilters) => {
15
15
  return filters;
16
16
  };
17
17
  exports.applyDefaultFilters = applyDefaultFilters;
18
+ const isValidJsonString = (str) => {
19
+ try {
20
+ JSON.parse(str);
21
+ return true;
22
+ }
23
+ catch (error) {
24
+ return false;
25
+ }
26
+ };
27
+ const parseIfNeeded = (value) => {
28
+ if (isValidJsonString(value)) {
29
+ return JSON.parse(value);
30
+ }
31
+ else {
32
+ return value;
33
+ }
34
+ };
35
+ exports.parseIfNeeded = parseIfNeeded;
@@ -1 +1,2 @@
1
1
  export declare const applyDefaultFilters: (defaultFilters: any) => any;
2
+ export declare const parseIfNeeded: (value: any) => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sccoreui",
3
- "version": "5.9.48",
3
+ "version": "5.9.49",
4
4
  "description": "ui-sccore",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",