@solidstarters/solid-core-ui 1.1.61 → 1.1.63

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.
Files changed (39) hide show
  1. package/dist/components/core/common/SolidGlobalSearchElement.d.ts +1 -0
  2. package/dist/components/core/common/SolidGlobalSearchElement.d.ts.map +1 -1
  3. package/dist/components/core/common/SolidGlobalSearchElement.js +292 -56
  4. package/dist/components/core/common/SolidGlobalSearchElement.js.map +1 -1
  5. package/dist/components/core/common/SolidSaveCustomFilterForm.d.ts +9 -0
  6. package/dist/components/core/common/SolidSaveCustomFilterForm.d.ts.map +1 -0
  7. package/dist/components/core/common/SolidSaveCustomFilterForm.js +37 -0
  8. package/dist/components/core/common/SolidSaveCustomFilterForm.js.map +1 -0
  9. package/dist/components/core/filter/fields/SolidBooleanField.js +1 -1
  10. package/dist/components/core/filter/fields/SolidBooleanField.js.map +1 -1
  11. package/dist/components/core/kanban/SolidKanbanView.d.ts.map +1 -1
  12. package/dist/components/core/kanban/SolidKanbanView.js +205 -167
  13. package/dist/components/core/kanban/SolidKanbanView.js.map +1 -1
  14. package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.d.ts.map +1 -1
  15. package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.js +6 -2
  16. package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.js.map +1 -1
  17. package/dist/components/core/model/CreateModel.js +3 -3
  18. package/dist/components/core/model/CreateModel.js.map +1 -1
  19. package/dist/components/core/model/FieldMetaDataForm.d.ts.map +1 -1
  20. package/dist/components/core/model/FieldMetaDataForm.js.map +1 -1
  21. package/dist/components/core/model/ModelMetaData.d.ts.map +1 -1
  22. package/dist/components/core/model/ModelMetaData.js +68 -15
  23. package/dist/components/core/model/ModelMetaData.js.map +1 -1
  24. package/dist/index.d.ts +1 -0
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +1 -0
  27. package/dist/index.js.map +1 -1
  28. package/dist/resources/globals.css +8 -0
  29. package/package.json +1 -1
  30. package/src/components/core/common/SolidGlobalSearchElement.tsx +425 -123
  31. package/src/components/core/common/SolidSaveCustomFilterForm.tsx +74 -0
  32. package/src/components/core/filter/fields/SolidBooleanField.tsx +1 -1
  33. package/src/components/core/kanban/SolidKanbanView.tsx +176 -158
  34. package/src/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.tsx +45 -2
  35. package/src/components/core/model/CreateModel.tsx +2 -2
  36. package/src/components/core/model/FieldMetaDataForm.tsx +0 -2
  37. package/src/components/core/model/ModelMetaData.tsx +204 -121
  38. package/src/index.ts +1 -0
  39. package/src/resources/globals.css +8 -0
@@ -0,0 +1,37 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { Button } from "primereact/button";
14
+ import { Checkbox } from "primereact/checkbox";
15
+ import { useState } from "react";
16
+ export var SolidSaveCustomFilterForm = function (_a) {
17
+ var currentSavedFilterData = _a.currentSavedFilterData, handleSaveFilter = _a.handleSaveFilter, closeDialog = _a.closeDialog;
18
+ var _b = useState({ name: currentSavedFilterData ? currentSavedFilterData.name : "", isPrivate: currentSavedFilterData ? currentSavedFilterData.isPrivate : false }), formValues = _b[0], setFormValues = _b[1];
19
+ var handleChange = function (e) {
20
+ var _a = e.target, name = _a.name, value = _a.value, type = _a.type, checked = _a.checked;
21
+ setFormValues(function (prev) {
22
+ var _a;
23
+ return (__assign(__assign({}, prev), (_a = {}, _a[name] = type === "checkbox" ? checked : value, _a)));
24
+ });
25
+ };
26
+ var handleSubmit = function (e) {
27
+ e.preventDefault();
28
+ var formData = {
29
+ id: currentSavedFilterData ? currentSavedFilterData.id : null,
30
+ name: formValues.name,
31
+ isPrivate: formValues.isPrivate === true ? true : "",
32
+ };
33
+ handleSaveFilter(formData);
34
+ };
35
+ return (_jsxs("form", { onSubmit: handleSubmit, children: [_jsxs("div", { className: "flex flex-column gap-2", children: [_jsx("label", { htmlFor: "name", children: "Name:" }), _jsx("input", { type: "text", id: "name", name: "name", placeholder: "Filter Title", className: "p-inputtext p-inputtext-sm p-component", value: formValues.name, onChange: handleChange, readOnly: currentSavedFilterData })] }), _jsxs("div", { className: "mt-3 flex align-items-center ", children: [_jsx(Checkbox, { inputId: "isPrivate", name: "isPrivate", checked: formValues.isPrivate, onChange: function (e) { return handleChange(e); } }), _jsx("label", { htmlFor: "isPrivate", className: "ml-2", children: "Is Private" })] }), _jsxs("div", { className: "mt-3 flex align-items-center gap-2", children: [_jsx(Button, { type: "submit", label: "Save", size: "small" }), _jsx(Button, { type: "button", label: "Cancel", size: "small", outlined: true, onClick: function () { return closeDialog(); } })] })] }));
36
+ };
37
+ //# sourceMappingURL=SolidSaveCustomFilterForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SolidSaveCustomFilterForm.js","sourceRoot":"","sources":["../../../../src/components/core/common/SolidSaveCustomFilterForm.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAQjC,MAAM,CAAC,IAAM,yBAAyB,GAA6C,UAAC,EAAyD;QAAvD,sBAAsB,4BAAA,EAAE,gBAAgB,sBAAA,EAAE,WAAW,iBAAA;IACjI,IAAA,KAA8B,QAAQ,CAAC,EAAE,IAAI,EAAE,sBAAsB,CAAC,CAAC,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,sBAAsB,CAAC,CAAC,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,EAAxL,UAAU,QAAA,EAAE,aAAa,QAA+J,CAAC;IAEhM,IAAM,YAAY,GAAG,UAAC,CAAsC;QAClD,IAAA,KAAiC,CAAC,CAAC,MAAM,EAAvC,IAAI,UAAA,EAAE,KAAK,WAAA,EAAE,IAAI,UAAA,EAAE,OAAO,aAAa,CAAC;QAChD,aAAa,CAAC,UAAC,IAAI;;YAAK,OAAA,uBACjB,IAAI,gBACN,IAAI,IAAG,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,OAC/C;QAHsB,CAGtB,CAAC,CAAC;IACR,CAAC,CAAC;IAEF,IAAM,YAAY,GAAG,UAAC,CAAkB;QACpC,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,IAAM,QAAQ,GAAG;YACb,EAAE,EAAE,sBAAsB,CAAC,CAAC,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI;YAC7D,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,SAAS,EAAE,UAAU,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;SACvD,CAAA;QACD,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC,CAAC;IAEF,OAAO,CACH,gBAAM,QAAQ,EAAE,YAAY,aACxB,eAAK,SAAS,EAAC,wBAAwB,aACnC,gBAAO,OAAO,EAAC,MAAM,sBAAc,EACnC,gBACI,IAAI,EAAC,MAAM,EACX,EAAE,EAAC,MAAM,EACT,IAAI,EAAC,MAAM,EACX,WAAW,EAAC,cAAc,EAC1B,SAAS,EAAC,wCAAwC,EAClD,KAAK,EAAE,UAAU,CAAC,IAAI,EACtB,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,sBAAsB,GAClC,IACA,EACN,eAAK,SAAS,EAAC,+BAA+B,aAC1C,KAAC,QAAQ,IACL,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,WAAW,EAChB,OAAO,EAAE,UAAU,CAAC,SAAS,EAC7B,QAAQ,EAAE,UAAC,CAAM,IAAK,OAAA,YAAY,CAAC,CAAC,CAAC,EAAf,CAAe,GAE9B,EACX,gBAAO,OAAO,EAAC,WAAW,EAAC,SAAS,EAAC,MAAM,2BAAmB,IAC5D,EACN,eAAK,SAAS,EAAC,oCAAoC,aAC/C,KAAC,MAAM,IACH,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,MAAM,EACZ,IAAI,EAAC,OAAO,GACd,EACF,KAAC,MAAM,IACH,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,QAAQ,EACd,IAAI,EAAC,OAAO,EACZ,QAAQ,QACR,OAAO,EAAE,cAAM,OAAA,WAAW,EAAE,EAAb,CAAa,GAC9B,IACA,IACH,CACV,CAAC;AACN,CAAC,CAAC"}
@@ -11,7 +11,7 @@ var SolidBooleanField = function (_a) {
11
11
  { label: 'false', value: false },
12
12
  ];
13
13
  var filterMatchModeOptions = [
14
- { label: 'Equals', value: "$eqi" },
14
+ { label: 'Equals', value: "$eq" },
15
15
  ];
16
16
  // const header = column.attrs.label ?? fieldMetadata.displayName;
17
17
  return (_jsxs("div", { className: 'flex align-items-start gap-3 w-full', children: [_jsx(Dropdown, { value: rule.matchMode, onChange: function (e) {
@@ -1 +1 @@
1
- {"version":3,"file":"SolidBooleanField.js","sourceRoot":"","sources":["../../../../../src/components/core/filter/fields/SolidBooleanField.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAG/C,IAAM,iBAAiB,GAAG,UAAC,EAAiE;QAA/D,aAAa,mBAAA,EAAE,QAAQ,cAAA,EAAE,KAAK,WAAA,EAAE,IAAI,UAAA;IAC7D,8CAA8C;IAC9C,IAAM,kBAAkB,GAAG,KAAK,CAAC;IACjC,IAAM,cAAc,GAAG,SAAS,CAAC;IAEjC,IAAM,cAAc,GAAG;QACnB,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE;QAC9B,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE;KACnC,CAAC;IACF,IAAM,sBAAsB,GAAG;QAC3B,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE;KACrC,CAAC;IAGF,kEAAkE;IAGlE,OAAO,CACH,eAAK,SAAS,EAAC,qCAAqC,aAChD,KAAC,QAAQ,IACL,KAAK,EAAE,IAAI,CAAC,SAAS,EACrB,QAAQ,EAAE,UAAC,CAAM;oBACb,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAA;gBAC3C,CAAC,EACD,OAAO,EAAE,sBAAsB,EAC/B,WAAW,EAAC,OAAO,EACnB,WAAW,EAAC,OAAO,EACnB,WAAW,EAAC,iBAAiB,EAC7B,SAAS,EAAC,uBAAuB,GACnC,EACF,cAAK,SAAS,EAAC,+BAA+B,YAC1C,KAAC,QAAQ,IACL,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,UAAC,CAAM;wBACb,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAA;oBACvC,CAAC,EACD,WAAW,EAAC,QAAQ,EACpB,SAAS,EAAC,iBAAiB,GAC7B,GACA,IACJ,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"SolidBooleanField.js","sourceRoot":"","sources":["../../../../../src/components/core/filter/fields/SolidBooleanField.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAG/C,IAAM,iBAAiB,GAAG,UAAC,EAAiE;QAA/D,aAAa,mBAAA,EAAE,QAAQ,cAAA,EAAE,KAAK,WAAA,EAAE,IAAI,UAAA;IAC7D,8CAA8C;IAC9C,IAAM,kBAAkB,GAAG,KAAK,CAAC;IACjC,IAAM,cAAc,GAAG,SAAS,CAAC;IAEjC,IAAM,cAAc,GAAG;QACnB,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE;QAC9B,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE;KACnC,CAAC;IACF,IAAM,sBAAsB,GAAG;QAC3B,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE;KACpC,CAAC;IAGF,kEAAkE;IAGlE,OAAO,CACH,eAAK,SAAS,EAAC,qCAAqC,aAChD,KAAC,QAAQ,IACL,KAAK,EAAE,IAAI,CAAC,SAAS,EACrB,QAAQ,EAAE,UAAC,CAAM;oBACb,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAA;gBAC3C,CAAC,EACD,OAAO,EAAE,sBAAsB,EAC/B,WAAW,EAAC,OAAO,EACnB,WAAW,EAAC,OAAO,EACnB,WAAW,EAAC,iBAAiB,EAC7B,SAAS,EAAC,uBAAuB,GACnC,EACF,cAAK,SAAS,EAAC,+BAA+B,YAC1C,KAAC,QAAQ,IACL,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,UAAC,CAAM;wBACb,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAA;oBACvC,CAAC,EACD,WAAW,EAAC,QAAQ,EACpB,SAAS,EAAC,iBAAiB,GAC7B,GACA,IACJ,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SolidKanbanView.d.ts","sourceRoot":"","sources":["../../../../src/components/core/kanban/SolidKanbanView.tsx"],"names":[],"mappings":"AA0BA,OAAO,uCAAuC,CAAC;AAC/C,OAAO,gDAAgD,CAAC;AAMxD,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAGF,eAAO,MAAM,eAAe,WAAY,qBAAqB,4CAsuB5D,CAAC"}
1
+ {"version":3,"file":"SolidKanbanView.d.ts","sourceRoot":"","sources":["../../../../src/components/core/kanban/SolidKanbanView.tsx"],"names":[],"mappings":"AA0BA,OAAO,uCAAuC,CAAC;AAC/C,OAAO,gDAAgD,CAAC;AAcxD,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAGF,eAAO,MAAM,eAAe,WAAY,qBAAqB,4CAgvB5D,CAAC"}
@@ -82,9 +82,12 @@ import "yet-another-react-lightbox/plugins/counter.css";
82
82
  import { useRouter, useSearchParams } from "next/navigation";
83
83
  import { SolidKanbanViewConfigure } from "./SolidKanbanViewConfigure";
84
84
  import { KanbanUserViewLayout } from "./KanbanUserViewLayout";
85
+ import { useSelector } from "react-redux";
86
+ import { queryObjectToQueryString, queryStringToQueryObject } from "../list/SolidListView";
85
87
  import { Toast } from "primereact/toast";
86
88
  export var SolidKanbanView = function (params) {
87
89
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
90
+ var user = useSelector(function (state) { return state.auth; }).user;
88
91
  var solidGlobalSearchElementRef = useRef();
89
92
  var searchParams = useSearchParams().toString(); // Converts the query params to a string
90
93
  var router = useRouter();
@@ -207,20 +210,20 @@ export var SolidKanbanView = function (params) {
207
210
  }
208
211
  }
209
212
  // setFilters(initialFilters);
210
- var rows = ((_d = (_c = (_b = (_a = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _a === void 0 ? void 0 : _a.solidView) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.attrs) === null || _d === void 0 ? void 0 : _d.recordsInSwimlane) ? (_h = (_g = (_f = (_e = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _e === void 0 ? void 0 : _e.solidView) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.attrs) === null || _h === void 0 ? void 0 : _h.recordsInSwimlane : 25;
213
+ var recordsInSwimlane = ((_d = (_c = (_b = (_a = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _a === void 0 ? void 0 : _a.solidView) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.attrs) === null || _d === void 0 ? void 0 : _d.recordsInSwimlane) ? (_h = (_g = (_f = (_e = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _e === void 0 ? void 0 : _e.solidView) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.attrs) === null || _h === void 0 ? void 0 : _h.recordsInSwimlane : 25;
211
214
  // setToPopulate(toPopulate);
212
215
  // setToPopulateMedia(toPopulateMedia);
213
- return { rows: rows, toPopulate: toPopulate, toPopulateMedia: toPopulateMedia };
216
+ setRecordsInSwimlane(recordsInSwimlane);
217
+ setToPopulate(toPopulate);
218
+ setToPopulateMedia(toPopulateMedia);
219
+ return { recordsInSwimlane: recordsInSwimlane, toPopulate: toPopulate, toPopulateMedia: toPopulateMedia };
214
220
  };
215
221
  // Initial Filter data
216
222
  useEffect(function () {
217
223
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
218
224
  if (solidKanbanViewMetaData) {
219
225
  setKanbanViewMetaData(solidKanbanViewMetaData);
220
- var _w = initialFilterMethod(), rows_1 = _w.rows, toPopulate_1 = _w.toPopulate, toPopulateMedia_1 = _w.toPopulateMedia;
221
- setRows(rows_1);
222
- setToPopulate(toPopulate_1);
223
- setToPopulateMedia(toPopulateMedia_1);
226
+ // initialFilterMethod();
224
227
  var viewModes_1 = ((_d = (_c = (_b = (_a = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _a === void 0 ? void 0 : _a.solidView) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.attrs) === null || _d === void 0 ? void 0 : _d.allowedViews) && ((_h = (_g = (_f = (_e = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _e === void 0 ? void 0 : _e.solidView) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.attrs) === null || _h === void 0 ? void 0 : _h.allowedViews.length) > 0 && ((_m = (_l = (_k = (_j = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _j === void 0 ? void 0 : _j.solidView) === null || _k === void 0 ? void 0 : _k.layout) === null || _l === void 0 ? void 0 : _l.attrs) === null || _m === void 0 ? void 0 : _m.allowedViews.map(function (view) { return { label: capitalize(view), value: view }; }));
225
228
  setViewModes(viewModes_1);
226
229
  if (((_r = (_q = (_p = (_o = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _o === void 0 ? void 0 : _o.solidView) === null || _p === void 0 ? void 0 : _p.layout) === null || _q === void 0 ? void 0 : _q.attrs) === null || _r === void 0 ? void 0 : _r.grouped) !== false) {
@@ -235,7 +238,7 @@ export var SolidKanbanView = function (params) {
235
238
  // All kanban view state.
236
239
  var _3 = useState([]), kanbanViewData = _3[0], setKanbanViewData = _3[1];
237
240
  var _4 = useState({}), kanbanLoadMoreData = _4[0], setKanbanLoadMoreData = _4[1];
238
- var _5 = useState(25), rows = _5[0], setRows = _5[1];
241
+ var _5 = useState(25), recordsInSwimlane = _5[0], setRecordsInSwimlane = _5[1];
239
242
  var _6 = useState([]), selectedRecords = _6[0], setSelectedRecords = _6[1];
240
243
  var _7 = useState(true), loading = _7[0], setLoading = _7[1];
241
244
  var _8 = useState(false), isDialogVisible = _8[0], setDialogVisible = _8[1];
@@ -243,6 +246,7 @@ export var SolidKanbanView = function (params) {
243
246
  var _10 = useState(), editButtonUrl = _10[0], setEditButtonUrl = _10[1];
244
247
  var _11 = useState(5), columnsCount = _11[0], setColumnsCount = _11[1];
245
248
  var _12 = useState(1), swimLaneCurrentPageNumber = _12[0], setSwimLaneCurrentPageNumber = _12[1];
249
+ var _13 = useState(false), queryDataLoaded = _13[0], setQueryDataLoaded = _13[1];
246
250
  var showToast = function (severity, summary, detail) {
247
251
  var _a;
248
252
  (_a = toast.current) === null || _a === void 0 ? void 0 : _a.show({
@@ -254,10 +258,10 @@ export var SolidKanbanView = function (params) {
254
258
  };
255
259
  // Get the kanban view data.
256
260
  // const [triggerGetSolidEntitiesForKanban, { data: solidEntityKanbanViewData, isLoading, error }] = useLazyGetSolidKanbanEntitiesQuery();
257
- var _13 = useLazyGetSolidEntitiesQuery(), triggerGetSolidEntities = _13[0], _14 = _13[1], solidEntityKanbanViewData = _14.data, isLoading = _14.isLoading, error = _14.error;
261
+ var _14 = useLazyGetSolidEntitiesQuery(), triggerGetSolidEntities = _14[0], _15 = _14[1], solidEntityKanbanViewData = _15.data, isLoading = _15.isLoading, error = _15.error;
258
262
  // Delete mutation
259
- var _15 = useDeleteMultipleSolidEntitiesMutation(), deleteManySolidEntities = _15[0], _16 = _15[1], isSolidEntitiesDeleted = _16.isLoading, isDeleteSolidEntitiesSucess = _16.isSuccess, isSolidEntitiesDeleteError = _16.isError, SolidEntitiesDeleteError = _16.error, DeletedSolidEntities = _16.data;
260
- var _17 = usePatchUpdateSolidEntityMutation(), patchKanbanView = _17[0], _18 = _17[1], isKanbanUpdateSuccessfull = _18.isSuccess, isKanbanUpdateError = _18.isError, kanbanUpdateError = _18.error;
263
+ var _16 = useDeleteMultipleSolidEntitiesMutation(), deleteManySolidEntities = _16[0], _17 = _16[1], isSolidEntitiesDeleted = _17.isLoading, isDeleteSolidEntitiesSucess = _17.isSuccess, isSolidEntitiesDeleteError = _17.isError, SolidEntitiesDeleteError = _17.error, DeletedSolidEntities = _17.data;
264
+ var _18 = usePatchUpdateSolidEntityMutation(), patchKanbanView = _18[0], _19 = _18[1], isKanbanUpdateSuccessfull = _19.isSuccess, isKanbanUpdateError = _19.isError, kanbanUpdateError = _19.error;
261
265
  // After data is fetched populate the kanban view state so as to be able to render the data.
262
266
  useEffect(function () {
263
267
  if (solidEntityKanbanViewData) {
@@ -276,94 +280,99 @@ export var SolidKanbanView = function (params) {
276
280
  setLoading(false);
277
281
  }
278
282
  }, [solidEntityKanbanViewData]);
279
- // Fetch data after toPopulate has been populated...
280
283
  useEffect(function () {
281
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17;
284
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
282
285
  if (solidKanbanViewMetaData) {
283
286
  var createActionUrl = ((_d = (_c = (_b = (_a = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _a === void 0 ? void 0 : _a.solidView) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.attrs) === null || _d === void 0 ? void 0 : _d.createAction) && ((_j = (_h = (_g = (_f = (_e = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _e === void 0 ? void 0 : _e.solidView) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.attrs) === null || _h === void 0 ? void 0 : _h.createAction) === null || _j === void 0 ? void 0 : _j.type) === "custom" ? (_p = (_o = (_m = (_l = (_k = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _k === void 0 ? void 0 : _k.solidView) === null || _l === void 0 ? void 0 : _l.layout) === null || _m === void 0 ? void 0 : _m.attrs) === null || _o === void 0 ? void 0 : _o.createAction) === null || _p === void 0 ? void 0 : _p.customComponent : "form/new";
284
287
  var editActionUrl = ((_t = (_s = (_r = (_q = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _q === void 0 ? void 0 : _q.solidView) === null || _r === void 0 ? void 0 : _r.layout) === null || _s === void 0 ? void 0 : _s.attrs) === null || _t === void 0 ? void 0 : _t.editAction) && ((_y = (_x = (_w = (_v = (_u = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _u === void 0 ? void 0 : _u.solidView) === null || _v === void 0 ? void 0 : _v.layout) === null || _w === void 0 ? void 0 : _w.attrs) === null || _x === void 0 ? void 0 : _x.editAction) === null || _y === void 0 ? void 0 : _y.type) === "custom" ? (_3 = (_2 = (_1 = (_0 = (_z = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _z === void 0 ? void 0 : _z.solidView) === null || _0 === void 0 ? void 0 : _0.layout) === null || _1 === void 0 ? void 0 : _1.attrs) === null || _2 === void 0 ? void 0 : _2.editAction) === null || _3 === void 0 ? void 0 : _3.customComponent : "form";
285
- if ((_7 = (_6 = (_5 = (_4 = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _4 === void 0 ? void 0 : _4.solidView) === null || _5 === void 0 ? void 0 : _5.layout) === null || _6 === void 0 ? void 0 : _6.attrs) === null || _7 === void 0 ? void 0 : _7.swimlanesCount) {
286
- setColumnsCount((_10 = (_9 = (_8 = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data.solidView) === null || _8 === void 0 ? void 0 : _8.layout) === null || _9 === void 0 ? void 0 : _9.attrs) === null || _10 === void 0 ? void 0 : _10.swimlanesCount);
287
- }
288
288
  if (createActionUrl) {
289
289
  setCreateButtonUrl(createActionUrl);
290
290
  }
291
291
  if (editActionUrl) {
292
292
  setEditButtonUrl(editActionUrl);
293
293
  }
294
- var columnsToLoadCount = ((_13 = (_12 = (_11 = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data.solidView) === null || _11 === void 0 ? void 0 : _11.layout) === null || _12 === void 0 ? void 0 : _12.attrs) === null || _13 === void 0 ? void 0 : _13.swimlanesCount) || 5;
294
+ }
295
+ }, [solidKanbanViewMetaData]);
296
+ // Fetch data after toPopulate has been populated...
297
+ useEffect(function () {
298
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
299
+ if (solidKanbanViewMetaData) {
300
+ var swimlanesCount = ((_c = (_b = (_a = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data.solidView) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.attrs) === null || _c === void 0 ? void 0 : _c.swimlanesCount) || 5;
295
301
  if (groupByFieldName && (toPopulate || toPopulateMedia)) {
296
- var queryData = {
297
- offset: 0,
298
- limit: columnsToLoadCount,
299
- fields: ["".concat(groupByFieldName), "count(".concat(groupByFieldName, ")")],
300
- groupBy: groupByFieldName,
301
- populateMedia: toPopulateMedia,
302
- populateGroup: true,
303
- groupFilter: {
304
- limit: ((_17 = (_16 = (_15 = (_14 = kanbanViewMetaData === null || kanbanViewMetaData === void 0 ? void 0 : kanbanViewMetaData.data) === null || _14 === void 0 ? void 0 : _14.solidView) === null || _15 === void 0 ? void 0 : _15.layout) === null || _16 === void 0 ? void 0 : _16.attrs) === null || _17 === void 0 ? void 0 : _17.recordsInSwimlane) || 10,
305
- offset: 0,
306
- filters: filters,
307
- populate: toPopulate,
308
- populateMedia: toPopulateMedia
309
- }
310
- // sort: [`id:desc`],
311
- };
312
- // fields=status&groupBy=status&fields=count(status)&populateGroup=true
313
- var queryString = qs.stringify(queryData, {
314
- encodeValuesOnly: true
315
- });
302
+ var queryObject = queryStringToQueryObject();
303
+ var queryString = "";
316
304
  if (searchParams) {
317
- queryString = searchParams;
318
- setFilterQueryString(searchParams);
305
+ // Get Object from Url
306
+ var queryObject_1 = qs.parse(searchParams, {
307
+ decoder: function (str) { return decodeURIComponent(str); },
308
+ allowDots: true,
309
+ });
310
+ var filters_1 = {
311
+ $and: []
312
+ };
313
+ if (queryObject_1.s_filter) {
314
+ filters_1.$and.push(queryObject_1.s_filter);
315
+ }
316
+ if (queryObject_1.c_filter) {
317
+ filters_1.$and.push(queryObject_1.c_filter);
318
+ }
319
+ var queryData = {
320
+ offset: 0,
321
+ limit: Number(queryObject_1.limit) + Number(queryObject_1.offset),
322
+ fields: queryObject_1.fields || ["".concat(groupByFieldName), "count(".concat(groupByFieldName, ")")],
323
+ groupBy: queryObject_1.groupBy || groupByFieldName,
324
+ populateMedia: queryObject_1.populateMedia || toPopulateMedia,
325
+ populateGroup: queryObject_1.populateGroup || true,
326
+ groupFilter: {
327
+ limit: Number(queryObject_1.groupFilter.limit) + Number(queryObject_1.groupFilter.offset) || ((_g = (_f = (_e = (_d = kanbanViewMetaData === null || kanbanViewMetaData === void 0 ? void 0 : kanbanViewMetaData.data) === null || _d === void 0 ? void 0 : _d.solidView) === null || _e === void 0 ? void 0 : _e.layout) === null || _f === void 0 ? void 0 : _f.attrs) === null || _g === void 0 ? void 0 : _g.recordsInSwimlane),
328
+ offset: 0,
329
+ filters: filters_1,
330
+ populate: queryObject_1.groupFilter.populate || toPopulate,
331
+ populateMedia: queryObject_1.groupFilter.populateMedia || toPopulateMedia
332
+ }
333
+ // sort: [`id:desc`],
334
+ };
335
+ setRecordsInSwimlane(queryData.limit);
336
+ setToPopulate(queryData.populate);
337
+ setToPopulateMedia(queryData.populateMedia);
338
+ setFilters(filters_1);
339
+ setQueryDataLoaded(true);
340
+ queryString = qs.stringify(queryData, {
341
+ encodeValuesOnly: true
342
+ });
319
343
  }
320
344
  else {
321
- setFilterQueryString(queryString);
345
+ var _m = initialFilterMethod(), recordsInSwimlane_1 = _m.recordsInSwimlane, toPopulate_1 = _m.toPopulate, toPopulateMedia_1 = _m.toPopulateMedia;
346
+ var queryData = {
347
+ offset: 0,
348
+ limit: swimlanesCount,
349
+ fields: ["".concat(groupByFieldName), "count(".concat(groupByFieldName, ")")],
350
+ groupBy: groupByFieldName,
351
+ populateMedia: toPopulateMedia_1,
352
+ populateGroup: true,
353
+ groupFilter: {
354
+ limit: ((_l = (_k = (_j = (_h = kanbanViewMetaData === null || kanbanViewMetaData === void 0 ? void 0 : kanbanViewMetaData.data) === null || _h === void 0 ? void 0 : _h.solidView) === null || _j === void 0 ? void 0 : _j.layout) === null || _k === void 0 ? void 0 : _k.attrs) === null || _l === void 0 ? void 0 : _l.recordsInSwimlane) || 10,
355
+ offset: 0,
356
+ filters: filters,
357
+ populate: toPopulate_1,
358
+ populateMedia: toPopulateMedia_1
359
+ }
360
+ // sort: [`id:desc`],
361
+ };
362
+ setRecordsInSwimlane(recordsInSwimlane_1);
363
+ setToPopulate(toPopulate_1);
364
+ setToPopulateMedia(toPopulateMedia_1);
365
+ // fields=status&groupBy=status&fields=count(status)&populateGroup=true
366
+ queryString = qs.stringify(queryData, {
367
+ encodeValuesOnly: true
368
+ });
369
+ setQueryDataLoaded(true);
322
370
  }
323
371
  triggerGetSolidEntities(queryString);
324
372
  setSelectedRecords([]);
325
373
  }
326
374
  }
327
- }, [isDeleteSolidEntitiesSucess, toPopulate, groupByFieldName, solidKanbanViewMetaData]);
328
- // clear Filter
329
- // const clearFilter = async () => {
330
- // if (solidKanbanViewMetaData) {
331
- // // initialFilterMethod()
332
- // }
333
- // setFilters(null);
334
- // if (solidKanbanViewMetaData) {
335
- //
336
- // const columnsToLoadCount = solidKanbanViewMetaData?.data.solidView?.layout?.attrs?.swimlanesCount || 5;
337
- // if (toPopulate || toPopulateMedia) {
338
- // const queryData = {
339
- // offset: 0,
340
- // limit: columnsToLoadCount,
341
- // fields: [`${groupByFieldName}`, `count(${groupByFieldName})`],
342
- // groupBy: groupByFieldName,
343
- // populate: toPopulate,
344
- // populateMedia: toPopulateMedia,
345
- // populateGroup: true,
346
- // groupFilter: {
347
- // limit: rows,
348
- // offset: 0,
349
- // }
350
- // // sort: [`id:desc`],
351
- // };
352
- // // fields=status&groupBy=status&fields=count(status)&populateGroup=true
353
- // const queryString = qs.stringify(queryData, {
354
- // encodeValuesOnly: true
355
- // });
356
- // const data: any = await triggerGetSolidEntities(queryString);
357
- // if (data && data?.data?.groupRecords.length > 0) {
358
- // const updatedData = [...data.data.groupRecords];
359
- // setKanbanViewData(updatedData);
360
- // }
361
- // setSelectedRecords([]);
362
- // }
363
- // }
364
- // // @ts-ignore
365
- // solidGlobalSearchElementRef.current.clearFilter()
366
- // };
375
+ }, [isDeleteSolidEntitiesSucess, groupByFieldName, solidKanbanViewMetaData]);
367
376
  // clickable link allowing one to open the detail / form view.
368
377
  var detailsBodyTemplate = function (solidViewData) {
369
378
  return (_jsx(Link, { href: "".concat(editButtonUrl, "/").concat(solidViewData.id), rel: "noopener noreferrer", className: "text-sm font-bold p-0", style: { color: "#12415D" }, children: _jsx("i", { className: "pi pi-pencil", style: { fontSize: "1rem" } }) }));
@@ -408,7 +417,6 @@ export var SolidKanbanView = function (params) {
408
417
  queryString = qs.stringify(queryData, {
409
418
  encodeValuesOnly: true
410
419
  });
411
- setFilterQueryString(queryString);
412
420
  return [4 /*yield*/, triggerGetSolidEntities(queryString)];
413
421
  case 2:
414
422
  data = _c.sent();
@@ -455,94 +463,102 @@ export var SolidKanbanView = function (params) {
455
463
  });
456
464
  }); };
457
465
  // Handle drag-and-drop functionality
458
- var onDragEnd = function (result) {
466
+ var onDragEnd = function (result) { return __awaiter(void 0, void 0, void 0, function () {
467
+ var source, destination, sourceGroupName, destinationGroupName, sourceGroupIndex, destinationGroupIndex, sourceGroup, destinationGroup, sourceRecords, destinationRecords, movedItem, updatedItem, formData, kanbanUpdateResponse, error_2;
459
468
  var _a;
460
- var source = result.source, destination = result.destination;
461
- if (!destination)
462
- return;
463
- var sourceGroupName = source.droppableId;
464
- var destinationGroupName = destination.droppableId;
465
- // Find the source and destination groups
466
- var sourceGroupIndex = kanbanViewData.findIndex(function (group) { return group.groupName === sourceGroupName; });
467
- var destinationGroupIndex = kanbanViewData.findIndex(function (group) { return group.groupName === destinationGroupName; });
468
- if (sourceGroupIndex === -1 || destinationGroupIndex === -1)
469
- return;
470
- // If dragging within the same group
471
- if (sourceGroupName === destinationGroupName) {
472
- setKanbanViewData(function (prevData) {
473
- return prevData.map(function (group) {
474
- if (group.groupName === sourceGroupName) {
475
- var updatedRecords = __spreadArray([], group.groupData.records, true);
476
- var movedItem_1 = updatedRecords.splice(source.index, 1)[0]; // Remove the item
477
- updatedRecords.splice(destination.index, 0, movedItem_1); // Insert at the new position
478
- return __assign(__assign({}, group), { groupData: __assign(__assign({}, group.groupData), { records: updatedRecords }) });
469
+ return __generator(this, function (_b) {
470
+ switch (_b.label) {
471
+ case 0:
472
+ source = result.source, destination = result.destination;
473
+ if (!destination)
474
+ return [2 /*return*/];
475
+ sourceGroupName = source.droppableId;
476
+ destinationGroupName = destination.droppableId;
477
+ sourceGroupIndex = kanbanViewData.findIndex(function (group) { return group.groupName === sourceGroupName; });
478
+ destinationGroupIndex = kanbanViewData.findIndex(function (group) { return group.groupName === destinationGroupName; });
479
+ if (sourceGroupIndex === -1 || destinationGroupIndex === -1)
480
+ return [2 /*return*/];
481
+ // If dragging within the same group
482
+ if (sourceGroupName === destinationGroupName) {
483
+ setKanbanViewData(function (prevData) {
484
+ return prevData.map(function (group) {
485
+ if (group.groupName === sourceGroupName) {
486
+ var updatedRecords = __spreadArray([], group.groupData.records, true);
487
+ var movedItem_1 = updatedRecords.splice(source.index, 1)[0]; // Remove the item
488
+ updatedRecords.splice(destination.index, 0, movedItem_1); // Insert at the new position
489
+ return __assign(__assign({}, group), { groupData: __assign(__assign({}, group.groupData), { records: updatedRecords }) });
490
+ }
491
+ return group;
492
+ });
493
+ });
494
+ return [2 /*return*/];
479
495
  }
480
- return group;
481
- });
482
- });
483
- return;
484
- }
485
- // Deep clone the source and destination groups
486
- var sourceGroup = JSON.parse(JSON.stringify(kanbanViewData[sourceGroupIndex]));
487
- var destinationGroup = JSON.parse(JSON.stringify(kanbanViewData[destinationGroupIndex]));
488
- // Clone the records for immutability
489
- var sourceRecords = __spreadArray([], sourceGroup.groupData.records, true);
490
- var destinationRecords = __spreadArray([], destinationGroup.groupData.records, true);
491
- // Remove the item from the source
492
- var movedItem = sourceRecords.splice(source.index, 1)[0];
493
- // Create a mutable copy of the moved item
494
- var updatedItem = __assign(__assign({}, movedItem), { status: destinationGroupName });
495
- // Add the updated item to the destination
496
- destinationRecords.splice(destination.index, 0, updatedItem);
497
- // Update the group data
498
- sourceGroup.groupData.records = sourceRecords;
499
- destinationGroup.groupData.records = destinationRecords;
500
- // Update the kanbanViewData state
501
- try {
502
- var formData = new FormData();
503
- formData.append(groupByFieldName, destinationGroupName);
504
- var kanbanUpdateResponse = yield patchKanbanView({ id: +movedItem.id, data: formData }).unwrap();
505
- if ((kanbanUpdateResponse === null || kanbanUpdateResponse === void 0 ? void 0 : kanbanUpdateResponse.statusCode) === 200) {
506
- showToast("success", "Success", "Kanban View Updated!");
507
- // Update the kanbanViewData state
508
- setKanbanViewData(function (prevData) {
509
- return prevData.map(function (group) {
510
- if (group.groupName === sourceGroupName) {
511
- return sourceGroup;
512
- }
513
- if (group.groupName === destinationGroupName) {
514
- return destinationGroup;
515
- }
516
- return group;
517
- });
518
- });
519
- }
520
- else {
521
- showToast("error", "Duplicate Key", kanbanUpdateResponse === null || kanbanUpdateResponse === void 0 ? void 0 : kanbanUpdateResponse.error);
496
+ sourceGroup = JSON.parse(JSON.stringify(kanbanViewData[sourceGroupIndex]));
497
+ destinationGroup = JSON.parse(JSON.stringify(kanbanViewData[destinationGroupIndex]));
498
+ sourceRecords = __spreadArray([], sourceGroup.groupData.records, true);
499
+ destinationRecords = __spreadArray([], destinationGroup.groupData.records, true);
500
+ movedItem = sourceRecords.splice(source.index, 1)[0];
501
+ updatedItem = __assign(__assign({}, movedItem), { status: destinationGroupName });
502
+ // Add the updated item to the destination
503
+ destinationRecords.splice(destination.index, 0, updatedItem);
504
+ // Update the group data
505
+ sourceGroup.groupData.records = sourceRecords;
506
+ destinationGroup.groupData.records = destinationRecords;
507
+ _b.label = 1;
508
+ case 1:
509
+ _b.trys.push([1, 3, , 4]);
510
+ formData = new FormData();
511
+ formData.append(groupByFieldName, destinationGroupName);
512
+ return [4 /*yield*/, patchKanbanView({ id: +movedItem.id, data: formData }).unwrap()];
513
+ case 2:
514
+ kanbanUpdateResponse = _b.sent();
515
+ if ((kanbanUpdateResponse === null || kanbanUpdateResponse === void 0 ? void 0 : kanbanUpdateResponse.statusCode) === 200) {
516
+ showToast("success", "Success", "Kanban View Updated!");
517
+ // Update the kanbanViewData state
518
+ setKanbanViewData(function (prevData) {
519
+ return prevData.map(function (group) {
520
+ if (group.groupName === sourceGroupName) {
521
+ return sourceGroup;
522
+ }
523
+ if (group.groupName === destinationGroupName) {
524
+ return destinationGroup;
525
+ }
526
+ return group;
527
+ });
528
+ });
529
+ }
530
+ else {
531
+ showToast("error", "Duplicate Key", kanbanUpdateResponse === null || kanbanUpdateResponse === void 0 ? void 0 : kanbanUpdateResponse.error);
532
+ }
533
+ return [3 /*break*/, 4];
534
+ case 3:
535
+ error_2 = _b.sent();
536
+ // 6. Handle 500 or network errors
537
+ console.error("API error:", error_2);
538
+ showToast("error", "Something went wrong", ((_a = error_2 === null || error_2 === void 0 ? void 0 : error_2.data) === null || _a === void 0 ? void 0 : _a.message) || "Something went wrong");
539
+ return [3 /*break*/, 4];
540
+ case 4: return [2 /*return*/];
522
541
  }
523
- }
524
- catch (error) {
525
- // 6. Handle 500 or network errors
526
- console.error("API error:", error);
527
- showToast("error", "Something went wrong", ((_a = error === null || error === void 0 ? void 0 : error.data) === null || _a === void 0 ? void 0 : _a.message) || "Something went wrong");
528
- }
529
- };
530
- var handleSwimLinPagination = function () { return __awaiter(void 0, void 0, void 0, function () {
531
- var columnsToLoadCount, queryData, queryString, data, updatedData;
542
+ });
543
+ }); };
544
+ // Handle SwimLane Pagination
545
+ var handleSwimLanePagination = function () { return __awaiter(void 0, void 0, void 0, function () {
546
+ var swimlanesCount, queryData, queryString, data, updatedData;
532
547
  var _a, _b, _c, _d;
533
548
  return __generator(this, function (_e) {
534
549
  switch (_e.label) {
535
550
  case 0:
536
551
  if (!solidKanbanViewMetaData) return [3 /*break*/, 2];
537
- columnsToLoadCount = ((_c = (_b = (_a = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data.solidView) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.attrs) === null || _c === void 0 ? void 0 : _c.swimlanesCount) || 5;
552
+ swimlanesCount = ((_c = (_b = (_a = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data.solidView) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.attrs) === null || _c === void 0 ? void 0 : _c.swimlanesCount) || 5;
538
553
  queryData = {
539
- offset: swimLaneCurrentPageNumber * columnsToLoadCount,
540
- limit: columnsToLoadCount,
554
+ offset: swimLaneCurrentPageNumber * swimlanesCount,
555
+ limit: swimlanesCount,
541
556
  fields: ["".concat(groupByFieldName), "count(".concat(groupByFieldName, ")")],
542
557
  groupBy: groupByFieldName,
558
+ populateMedia: toPopulateMedia,
543
559
  populateGroup: true,
544
560
  groupFilter: {
545
- limit: rows,
561
+ limit: recordsInSwimlane,
546
562
  offset: 0,
547
563
  filters: filters,
548
564
  populate: toPopulate,
@@ -553,7 +569,8 @@ export var SolidKanbanView = function (params) {
553
569
  queryString = qs.stringify(queryData, {
554
570
  encodeValuesOnly: true
555
571
  });
556
- setFilterQueryString(queryString);
572
+ //Push to Router
573
+ router.push("?".concat(queryString));
557
574
  return [4 /*yield*/, triggerGetSolidEntities(queryString)];
558
575
  case 1:
559
576
  data = _e.sent();
@@ -567,38 +584,59 @@ export var SolidKanbanView = function (params) {
567
584
  }
568
585
  });
569
586
  }); };
570
- var handleApplyCustomFilter = function (filters) { return __awaiter(void 0, void 0, void 0, function () {
571
- var columnsToLoadCount, queryData, queryString, data, updatedData;
587
+ // Handle the custom filter and Search Filter
588
+ var handleApplyCustomFilter = function (transformedFilter) { return __awaiter(void 0, void 0, void 0, function () {
589
+ var queryfilter_1, customFilter, updatedFilter, swimlanesCount, queryData, queryString, url, urlData, data, updatedData;
572
590
  var _a, _b, _c, _d;
573
591
  return __generator(this, function (_e) {
574
592
  switch (_e.label) {
575
593
  case 0:
576
- columnsToLoadCount = ((_c = (_b = (_a = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data.solidView) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.attrs) === null || _c === void 0 ? void 0 : _c.swimlanesCount) || 5;
577
- setFilters(filters);
594
+ if (!solidKanbanViewMetaData) return [3 /*break*/, 2];
595
+ queryfilter_1 = {
596
+ $and: []
597
+ };
598
+ if (transformedFilter.s_filter) {
599
+ queryfilter_1.$and.push(transformedFilter.s_filter);
600
+ }
601
+ if (transformedFilter.c_filter) {
602
+ queryfilter_1.$and.push(transformedFilter.c_filter);
603
+ }
604
+ customFilter = transformedFilter;
605
+ updatedFilter = __assign(__assign({}, (filters || {})), (queryfilter_1 || {}));
606
+ setFilters(function (prevFilters) { return (__assign(__assign({}, (prevFilters || {})), (queryfilter_1 || {}))); });
607
+ swimlanesCount = ((_c = (_b = (_a = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data.solidView) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.attrs) === null || _c === void 0 ? void 0 : _c.swimlanesCount) || 5;
578
608
  if (!toPopulate) return [3 /*break*/, 2];
579
609
  queryData = {
580
610
  offset: 0,
581
- limit: columnsToLoadCount,
611
+ limit: swimlanesCount,
582
612
  fields: ["".concat(groupByFieldName), "count(".concat(groupByFieldName, ")")],
583
613
  groupBy: groupByFieldName,
584
614
  populateGroup: true,
585
615
  groupFilter: {
586
- limit: rows,
616
+ limit: recordsInSwimlane,
587
617
  offset: 0,
588
- filters: filters,
618
+ filters: updatedFilter,
589
619
  populate: toPopulate,
590
620
  populateMedia: toPopulateMedia
591
621
  }
592
- // sort: [`id:desc`],
593
622
  };
594
623
  queryString = qs.stringify(queryData, {
595
624
  encodeValuesOnly: true
596
625
  });
597
- // triggerGetSolidEntities(queryString);
598
- setFilterQueryString(queryString);
626
+ // s_filter and c_filter format that needs to be passed to the router
627
+ // only present if handleCustomFilter is applied
628
+ if (customFilter) {
629
+ url = void 0;
630
+ urlData = queryData;
631
+ delete urlData.filters;
632
+ urlData.s_filter = customFilter.s_filter || {};
633
+ urlData.c_filter = customFilter.c_filter || {};
634
+ queryObjectToQueryString(urlData);
635
+ }
599
636
  return [4 /*yield*/, triggerGetSolidEntities(queryString)];
600
637
  case 1:
601
638
  data = _e.sent();
639
+ // Update the kanban view data with the new data based on filter
602
640
  if (data && ((_d = data === null || data === void 0 ? void 0 : data.data) === null || _d === void 0 ? void 0 : _d.groupRecords.length) > 0) {
603
641
  updatedData = __spreadArray([], data.data.groupRecords, true);
604
642
  setKanbanViewData(updatedData);
@@ -631,7 +669,7 @@ export var SolidKanbanView = function (params) {
631
669
  _jsx(SolidCreateButton, { url: createButtonUrl }), actionsAllowed.includes("".concat(deletePermission(params.modelName))) && ((_l = (_k = (_j = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _j === void 0 ? void 0 : _j.solidView) === null || _k === void 0 ? void 0 : _k.layout) === null || _l === void 0 ? void 0 : _l.attrs.delete) !== false && selectedRecords.length > 0 && _jsx(Button, { type: "button", label: "Delete", size: "small", onClick: function () { return setDialogVisible(true); }, className: "small-button", severity: "danger" }), _jsx(Button, { type: "button", size: "small", icon: "pi pi-refresh", severity: "secondary", outlined: true, onClick: function () {
632
670
  window.location.reload();
633
671
  } }), _jsx(SolidKanbanViewConfigure, { solidKanbanViewMetaData: solidKanbanViewMetaData, actionsAllowed: actionsAllowed, viewModes: viewModes, setLayoutDialogVisible: setLayoutDialogVisible })] })] }), _jsx("style", { children: ".p-datatable .p-datatable-loading-overlay {background-color: rgba(0, 0, 0, 0.0);}" }), solidKanbanViewMetaData && kanbanViewData &&
634
- _jsx(KanbanBoard, { groupedView: groupedView, kanbanViewData: kanbanViewData, solidKanbanViewMetaData: solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data, setKanbanViewData: setKanbanViewData, handleLoadMore: handleLoadMore, onDragEnd: onDragEnd, handleSwimLinPagination: handleSwimLinPagination, setLightboxUrls: setLightboxUrls, setOpenLightbox: setOpenLightbox, editButtonUrl: editButtonUrl }), _jsx(Dialog, { visible: isDialogVisible, header: "Confirm Delete", modal: true, footer: function () { return (_jsxs("div", { className: "flex justify-content-center", children: [_jsx(Button, { label: "Yes", icon: "pi pi-check", className: 'small-button', severity: "danger", autoFocus: true, onClick: deleteBulk }), _jsx(Button, { label: "No", icon: "pi pi-times", className: 'small-button', onClick: onDeleteClose })] })); }, onHide: function () { return setDialogVisible(false); }, children: _jsx("p", { children: "Are you sure you want to delete the selected records?" }) }), openLightbox &&
672
+ _jsx(KanbanBoard, { groupedView: groupedView, kanbanViewData: kanbanViewData, solidKanbanViewMetaData: solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data, setKanbanViewData: setKanbanViewData, handleLoadMore: handleLoadMore, onDragEnd: onDragEnd, handleSwimLanePagination: handleSwimLanePagination, setLightboxUrls: setLightboxUrls, setOpenLightbox: setOpenLightbox, editButtonUrl: editButtonUrl }), _jsx(Dialog, { visible: isDialogVisible, header: "Confirm Delete", modal: true, footer: function () { return (_jsxs("div", { className: "flex justify-content-center", children: [_jsx(Button, { label: "Yes", icon: "pi pi-check", className: 'small-button', severity: "danger", autoFocus: true, onClick: deleteBulk }), _jsx(Button, { label: "No", icon: "pi pi-times", className: 'small-button', onClick: onDeleteClose })] })); }, onHide: function () { return setDialogVisible(false); }, children: _jsx("p", { children: "Are you sure you want to delete the selected records?" }) }), openLightbox &&
635
673
  _jsx(Lightbox, { open: openLightbox, plugins: [Counter, Download], close: function () { return setOpenLightbox(false); }, slides: lightboxUrls }), _jsx(Dialog, { visible: isLayoutDialogVisible, header: "Change Kanban Layout", modal: true, onHide: function () { return setLayoutDialogVisible(false); }, contentStyle: {
636
674
  width: 800
637
675
  }, children: _jsx(KanbanUserViewLayout, { solidKanbanViewMetaData: solidKanbanViewMetaData, setLayoutDialogVisible: setLayoutDialogVisible }) })] }));