sccoreui 5.9.43 → 5.9.44

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.
@@ -80,7 +80,7 @@ const Condtions = (props) => {
80
80
  setEnbleApply(false); // Set enableApply to false when the input is invalid
81
81
  }
82
82
  };
83
- if ((condition === null || condition === void 0 ? void 0 : condition.code) === "9" || (condition === null || condition === void 0 ? void 0 : condition.code) === "20") {
83
+ if (condition === "9" || condition === "20") {
84
84
  return ((0, jsx_runtime_1.jsx)(inputtext_1.InputText, { disabled: !condition, className: "border-noround-left mb-2 w-12rem dropdown-focus-none", value: value.includes(",") ? value.replace(",", "-") : value, placeholder: "Enter", onChange: (event) => handleOnchangeEvent(event.target.value) })
85
85
  // <div className="flex">
86
86
  // <InputNumber
@@ -125,7 +125,7 @@ const Condtions = (props) => {
125
125
  let valueString = value.length === 2 ? value.map(convertDateToISO).join(",") : value;
126
126
  handleDynamicFieldState(valueString);
127
127
  };
128
- if ((condition === null || condition === void 0 ? void 0 : condition.code) === "9" || (condition === null || condition === void 0 ? void 0 : condition.code) === "20") {
128
+ if (condition === "9" || condition === "20") {
129
129
  return ((0, jsx_runtime_1.jsx)(calendar_1.Calendar, { readOnlyInput: true, showTime: true, disabled: !condition, selectionMode: "range", placeholder: "Select", className: "condtion-dropdown border-noround-left mb-2 filter-calendar", value: (value === null || value === void 0 ? void 0 : value.includes(",")) ? (_a = value === null || value === void 0 ? void 0 : value.split(",")) === null || _a === void 0 ? void 0 : _a.map((date) => date ? new Date(date) : null) : null, onChange: (event) => handleOnchangeEvent(event.value) }));
130
130
  }
131
131
  return ((0, jsx_runtime_1.jsx)(calendar_1.Calendar, { readOnlyInput: true, showTime: false, disabled: !condition, selectionMode: "single", placeholder: "Select", className: "condtion-dropdown border-noround-left mb-2 filter-calendar", value: value, onChange: (event) => handleDynamicFieldState(event.value) }));
@@ -11,6 +11,7 @@ const constants_1 = tslib_1.__importDefault(require("../../constants"));
11
11
  const Conditions_1 = tslib_1.__importDefault(require("./conditions/Conditions"));
12
12
  // import "./TableFilter.module.scss";
13
13
  const context_provider_1 = require("../../context-provider");
14
+ const inputtext_1 = require("primereact/inputtext");
14
15
  const TableFilter = () => {
15
16
  const { featureDetails, columnData, conditionType, conditionTypes, globalFilters, setConditionType, setGlobalFilters, setFeatureDetails, callGrid, setViewName, viewName, createView, enableViewCreate } = (0, react_1.useContext)(context_provider_1.FeatureContext);
16
17
  const columnId = "field";
@@ -36,7 +37,7 @@ const TableFilter = () => {
36
37
  const applyAdvancedFilter = (array) => {
37
38
  const allQueries = array.map((query) => {
38
39
  const column = { field: query.columnName.code };
39
- const operation = { code: query.condition.code };
40
+ const operation = { code: query.condition };
40
41
  let queryToAdd = {
41
42
  selectedColumn: column,
42
43
  selectedOperation: operation,
@@ -106,6 +107,9 @@ const TableFilter = () => {
106
107
  createView(viewDetails);
107
108
  showFilter.current.toggle(false);
108
109
  };
110
+ const filterLogoToggle = () => {
111
+ setIsOverlayOpened(false), setDisplayInput(false), setViewName("");
112
+ };
109
113
  (0, react_1.useEffect)(() => {
110
114
  if (conditionsArray.length === 0) {
111
115
  setConditionsArray([defaultCondtion]);
@@ -131,8 +135,8 @@ const TableFilter = () => {
131
135
  : "bg-white"}` }, { children: [(0, jsx_runtime_1.jsx)("span", Object.assign({ onClick: (e) => onClickFilter(e) }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "filter-lines", size: 20, color: isOverlayOpened ||
132
136
  (globalFilters === null || globalFilters === void 0 ? void 0 : globalFilters.filter((each) => each.isActive).length) >= 1
133
137
  ? "#243DC6"
134
- : "#667085" }) })), (globalFilters === null || globalFilters === void 0 ? void 0 : globalFilters.filter((each) => each.isActive).length) >= 1 && ((0, jsx_runtime_1.jsxs)("span", Object.assign({ className: "flex gap-2 align-items-center text-primary-400" }, { children: [`${globalFilters === null || globalFilters === void 0 ? void 0 : globalFilters.filter((each) => each.isActive).length} Selected`, (0, jsx_runtime_1.jsx)("span", Object.assign({ onClick: onresetFilter }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "x-close", size: 18, color: "#243DC6" }) }))] })))] })), (0, jsx_runtime_1.jsx)(overlaypanel_1.OverlayPanel, Object.assign({ ref: showFilter, onShow: () => setIsOverlayOpened(true), onHide: () => { setIsOverlayOpened(false), setDisplayInput(false); }, className: "table-filter-overlay" }, { children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "p-4" }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "text-lg font-semibold line-height-3 text-gray-900" }, { children: "Filters" })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "text-sm text-gray-600" }, { children: "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-4" }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "max-h-14rem\toverflow-auto" }, { children: conditionsArray.map((eachCondition, index) => {
138
+ : "#667085" }) })), (globalFilters === null || globalFilters === void 0 ? void 0 : globalFilters.filter((each) => each.isActive).length) >= 1 && ((0, jsx_runtime_1.jsxs)("span", Object.assign({ className: "flex gap-2 align-items-center text-primary-400" }, { children: [`${globalFilters === null || globalFilters === void 0 ? void 0 : globalFilters.filter((each) => each.isActive).length} Selected`, (0, jsx_runtime_1.jsx)("span", Object.assign({ onClick: onresetFilter }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "x-close", size: 18, color: "#243DC6" }) }))] })))] })), (0, jsx_runtime_1.jsx)(overlaypanel_1.OverlayPanel, Object.assign({ ref: showFilter, onShow: () => setIsOverlayOpened(true), onHide: filterLogoToggle, className: "table-filter-overlay" }, { children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "p-4" }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "text-lg font-semibold line-height-3 text-gray-900" }, { children: "Filters" })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "text-sm text-gray-600" }, { children: "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-4" }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "max-h-14rem\toverflow-auto" }, { children: conditionsArray.map((eachCondition, index) => {
135
139
  return ((0, jsx_runtime_1.jsx)("div", { children: renderCondtion(eachCondition, index) }, index));
136
- }) })) })), (0, jsx_runtime_1.jsx)(divider_1.Divider, { className: "w-full p-0 m-0" }), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "p-4 flex justify-content-between" }, { children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(button_1.Button, { text: true, className: "focus:shadow-none", label: "Reset Filter", onClick: onresetFilter }) }), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex align-items-center" }, { children: [!displayInput && enableViewCreate && ((0, jsx_runtime_1.jsx)(button_1.Button, { className: "text-base px-2 font-semibold text-primary-400 flex gap-2 p-1 focus:shadow-none mr-3", label: "Create View", onClick: () => setDisplayInput(true), disabled: !allFieldsFilled, text: true, iconPos: "left", icon: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "plus", color: "text-primary-400 mr-2" }) })), displayInput && (0, jsx_runtime_1.jsx)("input", { type: "text", onChange: (e) => setViewName(e.target.value) }), displayInput && (0, jsx_runtime_1.jsx)(button_1.Button, Object.assign({ onClick: createViewFromFilters, disabled: !viewName.length }, { children: "Add view" })), (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: "Apply", onClick: onApplyFilter, disabled: !allFieldsFilled })] }))] }))] }) }))] }));
140
+ }) })) })), (0, jsx_runtime_1.jsx)(divider_1.Divider, { className: "w-full p-0 m-0" }), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "p-4 flex justify-content-between" }, { children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(button_1.Button, { text: true, className: "focus:shadow-none", label: "Reset Filter", onClick: onresetFilter }) }), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex align-items-center" }, { children: [!displayInput && enableViewCreate && ((0, jsx_runtime_1.jsx)(button_1.Button, { className: "text-base px-2 font-semibold text-primary-400 flex gap-2 p-1 focus:shadow-none mr-3", label: "Create View", onClick: () => setDisplayInput(true), disabled: !allFieldsFilled, text: true, iconPos: "left", icon: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "plus", color: "text-primary-400 mr-2" }) })), displayInput && ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "p-input-icon-left p-input-icon-right w-full" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `p-input-suffix` }, { children: [displayInput && ((0, jsx_runtime_1.jsx)(button_1.Button, { onClick: createViewFromFilters, disabled: !viewName.length, className: "p-0 h-auto", text: true, icon: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "check" }) })), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: () => setViewName(""), className: "p-0 h-auto", disabled: !viewName.length, text: true, icon: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "x-close" }) })] })), (0, jsx_runtime_1.jsx)(inputtext_1.InputText, { placeholder: "Enter", value: viewName, onChange: (e) => setViewName(e.target.value), className: "text-lg font-normal text-gray-500 hover:text-gray-900 w-full px-3 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: "Apply", onClick: onApplyFilter, disabled: !allFieldsFilled })] }))] }))] }) }))] }));
137
141
  };
138
142
  exports.default = TableFilter;
@@ -39,7 +39,7 @@ function MyProvider({ children, value }) {
39
39
  (0, react_1.useEffect)(() => {
40
40
  if (defaultFilters.length)
41
41
  setGlobalFilters(defaultFilters);
42
- }, []);
42
+ }, [defaultFilters]);
43
43
  return ((0, jsx_runtime_1.jsx)(exports.FeatureContext.Provider, Object.assign({ value: {
44
44
  sortValue,
45
45
  setSortValue,
@@ -12,7 +12,6 @@ const constants_1 = require("./constants");
12
12
  const loading_component_1 = tslib_1.__importDefault(require("./loading-component"));
13
13
  const helper_1 = require("./helper");
14
14
  function ParentForGrid(props) {
15
- var _a;
16
15
  const [gridData, setGridData] = (0, react_1.useState)({
17
16
  rowData: [],
18
17
  columnData: props === null || props === void 0 ? void 0 : props.columnData,
@@ -22,7 +21,7 @@ function ParentForGrid(props) {
22
21
  const [totalRecords, setTotalRecords] = (0, react_1.useState)(0);
23
22
  const [gridReadyEvent, setGridReadyEvent] = (0, react_1.useState)();
24
23
  const [defaultSelectedRows, setDefaultSelectedRows] = (0, react_1.useState)([]);
25
- const [defaultFilters] = (0, react_1.useState)((_a = props === null || props === void 0 ? void 0 : props.defaultFilters) !== null && _a !== void 0 ? _a : []);
24
+ const [defaultFilters, setDefaultFilters] = (0, react_1.useState)((props === null || props === void 0 ? void 0 : props.defaultFilters) || []);
26
25
  const [emptyResponse] = (0, react_1.useState)({
27
26
  totalRecords: 0,
28
27
  rowData: [],
@@ -173,11 +172,11 @@ function ParentForGrid(props) {
173
172
  else if (props.rowModelType === constants_1.ROWMODELTYPE.INFINITE) {
174
173
  const dataSource = {
175
174
  getRows: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
176
- var _b;
175
+ var _a;
177
176
  const startRow = params.startRow;
178
177
  const endRow = params.endRow;
179
178
  const result = yield getData(startRow, endRow, currentFeatures);
180
- if (((_b = result === null || result === void 0 ? void 0 : result.rowData) === null || _b === void 0 ? void 0 : _b.length) > 0) {
179
+ if (((_a = result === null || result === void 0 ? void 0 : result.rowData) === null || _a === void 0 ? void 0 : _a.length) > 0) {
181
180
  gridRef.current.api.hideOverlay();
182
181
  params.successCallback(result === null || result === void 0 ? void 0 : result.rowData, result === null || result === void 0 ? void 0 : result.actualEndRow);
183
182
  }
@@ -232,8 +231,15 @@ function ParentForGrid(props) {
232
231
  }
233
232
  }, [featureDetails.searchedText]);
234
233
  (0, react_1.useEffect)(() => {
234
+ var _a;
235
235
  if (api && gridReadyEvent && (props === null || props === void 0 ? void 0 : props.shouldRefetch)) {
236
- callGrid(featureDetails);
236
+ let currentFeature = featureDetails;
237
+ if ((_a = props === null || props === void 0 ? void 0 : props.defaultFilters) === null || _a === void 0 ? void 0 : _a.length) {
238
+ currentFeature.filterQueries = (0, helper_1.applyDefaultFilters)(props === null || props === void 0 ? void 0 : props.defaultFilters);
239
+ setDefaultFilters(props.defaultFilters);
240
+ setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { filterQueries: (0, helper_1.applyDefaultFilters)(props === null || props === void 0 ? void 0 : props.defaultFilters) }));
241
+ }
242
+ callGrid(currentFeature);
237
243
  }
238
244
  }, [props === null || props === void 0 ? void 0 : props.shouldRefetch]);
239
245
  // Remove all checkbox selection if any feature added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sccoreui",
3
- "version": "5.9.43",
3
+ "version": "5.9.44",
4
4
  "description": "ui-sccore",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",