@solidxai/core-ui 0.1.5-beta.3 → 0.1.5-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/core/chatter/SolidChatter.d.ts.map +1 -1
- package/dist/components/core/chatter/SolidChatter.js +5 -2
- package/dist/components/core/chatter/SolidChatter.js.map +1 -1
- package/dist/components/core/chatter/SolidChatter.tsx +5 -2
- package/dist/components/core/chatter/SolidChatterAuditMessage.d.ts +5 -2
- package/dist/components/core/chatter/SolidChatterAuditMessage.d.ts.map +1 -1
- package/dist/components/core/chatter/SolidChatterAuditMessage.js +19 -1
- package/dist/components/core/chatter/SolidChatterAuditMessage.js.map +1 -1
- package/dist/components/core/chatter/SolidChatterAuditMessage.tsx +29 -5
- package/dist/components/core/common/SolidCreateButton.js +3 -3
- package/dist/components/core/common/SolidCreateButton.js.map +1 -1
- package/dist/components/core/common/SolidCreateButton.tsx +3 -3
- package/dist/components/core/common/SolidGlobalSearchElement.d.ts.map +1 -1
- package/dist/components/core/common/SolidGlobalSearchElement.js.map +1 -1
- package/dist/components/core/common/SolidGlobalSearchElement.tsx +1 -0
- package/dist/components/core/dashboard/DashboardFilter.d.ts +13 -0
- package/dist/components/core/dashboard/DashboardFilter.d.ts.map +1 -0
- package/dist/components/core/dashboard/DashboardFilter.js +305 -0
- package/dist/components/core/dashboard/DashboardFilter.js.map +1 -0
- package/dist/components/core/dashboard/DashboardFilter.tsx +356 -0
- package/dist/components/core/dashboard/SolidDashboard.d.ts.map +1 -1
- package/dist/components/core/dashboard/SolidDashboard.js +9 -4
- package/dist/components/core/dashboard/SolidDashboard.js.map +1 -1
- package/dist/components/core/dashboard/SolidDashboard.tsx +32 -2
- package/dist/components/core/kanban/SolidKanbanView.js +2 -2
- package/dist/components/core/kanban/SolidKanbanView.js.map +1 -1
- package/dist/components/core/kanban/SolidKanbanView.tsx +2 -2
- package/dist/components/core/list/SolidListView.d.ts.map +1 -1
- package/dist/components/core/list/SolidListView.js +10 -10
- package/dist/components/core/list/SolidListView.js.map +1 -1
- package/dist/components/core/list/SolidListView.tsx +5 -6
- package/dist/components/core/tree/SolidTreeView.d.ts.map +1 -1
- package/dist/components/core/tree/SolidTreeView.js +277 -43
- package/dist/components/core/tree/SolidTreeView.js.map +1 -1
- package/dist/components/core/tree/SolidTreeView.tsx +436 -4
- package/dist/helpers/routePaths.d.ts +1 -1
- package/dist/helpers/routePaths.d.ts.map +1 -1
- package/dist/helpers/routePaths.js +2 -2
- package/dist/helpers/routePaths.js.map +1 -1
- package/dist/helpers/routePaths.ts +2 -2
- package/dist/resources/globals.css +8 -0
- package/package.json +1 -1
|
@@ -49,7 +49,7 @@ import { ERROR_MESSAGES } from "../../../constants/error-messages";
|
|
|
49
49
|
import { SolidAiMainWrapper } from "../solid-ai/SolidAiMainWrapper";
|
|
50
50
|
import { showNavbar, toggleNavbar } from "../../../redux/features/navbarSlice";
|
|
51
51
|
import { useLazyGetMcpUrlQuery, useLazyGetSolidSettingsQuery } from "../../../redux/api/solidSettingsApi";
|
|
52
|
-
import {
|
|
52
|
+
import { normalizeSolidListTreeKanbanActionPath } from "../../../helpers/routePaths";
|
|
53
53
|
// import { ERROR_MESSAGES } from "../../../constants/error-messages";
|
|
54
54
|
|
|
55
55
|
const getRandomInt = (min: number, max: number) => {
|
|
@@ -244,7 +244,7 @@ export const SolidListView = forwardRef<SolidListViewHandle, SolidListViewParams
|
|
|
244
244
|
const [showArchived, setShowArchived] = useState(false);
|
|
245
245
|
|
|
246
246
|
const [queryDataLoaded, setQueryDataLoaded] = useState(false);
|
|
247
|
-
const [filterPredicates, setFilterPredicates] = useState(null);
|
|
247
|
+
const [filterPredicates, setFilterPredicates] = useState<any>(null);
|
|
248
248
|
const [showSaveFilterPopup, setShowSaveFilterPopup] = useState<boolean>(false);
|
|
249
249
|
|
|
250
250
|
const [triggerCheckIfPermissionExists] = useLazyCheckIfPermissionExistsQuery();
|
|
@@ -260,7 +260,7 @@ export const SolidListView = forwardRef<SolidListViewHandle, SolidListViewParams
|
|
|
260
260
|
}, [])
|
|
261
261
|
|
|
262
262
|
const editBaseUrl = useMemo(
|
|
263
|
-
() =>
|
|
263
|
+
() => normalizeSolidListTreeKanbanActionPath(pathname, editButtonUrl || "form"),
|
|
264
264
|
[editButtonUrl, pathname]
|
|
265
265
|
);
|
|
266
266
|
|
|
@@ -657,10 +657,9 @@ export const SolidListView = forwardRef<SolidListViewHandle, SolidListViewParams
|
|
|
657
657
|
: [{ field: "id", order: -1 }];
|
|
658
658
|
|
|
659
659
|
setMultiSortMeta(parsedMultiSortMeta);
|
|
660
|
-
const {
|
|
660
|
+
const { populate, populateMedia } = initialFilterMethod();
|
|
661
661
|
setToPopulate(populate);
|
|
662
662
|
setToPopulateMedia(populateMedia);
|
|
663
|
-
|
|
664
663
|
} else {
|
|
665
664
|
const { multiSortMeta, rows, populate, populateMedia } = initialFilterMethod();
|
|
666
665
|
setRows(rows);
|
|
@@ -671,7 +670,7 @@ export const SolidListView = forwardRef<SolidListViewHandle, SolidListViewParams
|
|
|
671
670
|
}
|
|
672
671
|
//below line was added to handle state stale issue when we converted boilerplate to vite
|
|
673
672
|
//since now we dont need it becuase our component is remounted on every router change
|
|
674
|
-
setFilters(params.customFilter || { $and: [] })
|
|
673
|
+
//setFilters(params.customFilter || { $and: [] })
|
|
675
674
|
//setFilterPredicates(null);
|
|
676
675
|
setSelectedRecords([]);
|
|
677
676
|
setSelectedRecoverRecords([]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolidTreeView.d.ts","sourceRoot":"","sources":["../../../../src/components/core/tree/SolidTreeView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SolidTreeView.d.ts","sourceRoot":"","sources":["../../../../src/components/core/tree/SolidTreeView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AA4Cf,KAAK,mBAAmB,GAAG;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,GAAG,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,YAAY,CAAC,EAAE,GAAG,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,WAAW,EAAE,CAAC,MAAM,EAAE;QACpB,uBAAuB,CAAC,EAAE,GAAG,CAAC;QAC9B,gBAAgB,CAAC,EAAE,GAAG,CAAC;QACvB,sBAAsB,CAAC,EAAE,GAAG,CAAC;QAC7B,2BAA2B,CAAC,EAAE,GAAG,CAAC;KACnC,KAAK,IAAI,CAAC;IACX,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7D,OAAO,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;IACpE,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1C,QAAQ,EAAE,MAAM;QACd,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;QACtB,YAAY,EAAE,OAAO,CAAC;QACtB,OAAO,EAAE,GAAG,CAAC;QACb,gBAAgB,EAAE,GAAG,CAAC;QACtB,QAAQ,EAAE,GAAG,EAAE,CAAC;QAChB,YAAY,EAAE,MAAM,CAAC;QACrB,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;CACH,CAAC;AAsCF,eAAO,MAAM,aAAa,iGAu5DxB,CAAC"}
|
|
@@ -85,52 +85,63 @@ import { getFilterObjectFromLocalStorage, setFilterObjectToLocalStorage } from "
|
|
|
85
85
|
import { HomePageModuleSvg } from "../../Svg/HomePageModuleSvg";
|
|
86
86
|
import { getExtensionFunction } from "../../../helpers/registry";
|
|
87
87
|
import { Tooltip } from "primereact/tooltip";
|
|
88
|
+
import { useRouter } from "../../../hooks/useRouter";
|
|
89
|
+
import { normalizeSolidListTreeKanbanActionPath } from "../../../helpers/routePaths";
|
|
90
|
+
import { usePathname } from "../../../hooks/usePathname";
|
|
91
|
+
import { useHandleListCustomButtonClick } from "../../../components/common/useHandleListCustomButtonClick";
|
|
92
|
+
import { OverlayPanel } from "primereact/overlaypanel";
|
|
93
|
+
import { SolidListViewRowButtonContextMenu } from "../list/SolidListViewRowButtonContextMenu";
|
|
88
94
|
var DEFAULT_PAGE_SIZE = 25;
|
|
89
95
|
// ─── Component ────────────────────────────────────────────────────────────────
|
|
90
96
|
export var SolidTreeView = forwardRef(function (params, ref) {
|
|
91
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
97
|
+
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, _18, _19;
|
|
92
98
|
var toast = useRef(null);
|
|
93
99
|
var dispatch = useDispatch();
|
|
94
100
|
var visibleNavbar = useSelector(function (state) { var _a; return (_a = state.navbarState) === null || _a === void 0 ? void 0 : _a.visibleNavbar; });
|
|
95
101
|
var searchParams = useSearchParams();
|
|
96
102
|
var session = useSession();
|
|
103
|
+
var router = useRouter();
|
|
97
104
|
var user = (_a = session === null || session === void 0 ? void 0 : session.data) === null || _a === void 0 ? void 0 : _a.user;
|
|
105
|
+
var pathname = usePathname();
|
|
98
106
|
var solidGlobalSearchElementRef = useRef(null);
|
|
99
|
-
var
|
|
100
|
-
var
|
|
101
|
-
var
|
|
102
|
-
var
|
|
103
|
-
var
|
|
104
|
-
var
|
|
105
|
-
var
|
|
106
|
-
var
|
|
107
|
-
var
|
|
108
|
-
var
|
|
109
|
-
var
|
|
110
|
-
var
|
|
111
|
-
var
|
|
112
|
-
var
|
|
113
|
-
var
|
|
114
|
-
var
|
|
115
|
-
var
|
|
116
|
-
var
|
|
117
|
-
var
|
|
118
|
-
var
|
|
119
|
-
var
|
|
120
|
-
var
|
|
107
|
+
var _20 = useState(false), showSaveFilterPopup = _20[0], setShowSaveFilterPopup = _20[1];
|
|
108
|
+
var _21 = useState(false), showGlobalSearchElement = _21[0], setShowGlobalSearchElement = _21[1];
|
|
109
|
+
var _22 = useState([]), toPopulate = _22[0], setToPopulate = _22[1];
|
|
110
|
+
var _23 = useState([]), toPopulateMedia = _23[0], setToPopulateMedia = _23[1];
|
|
111
|
+
var _24 = useState([]), actionsAllowed = _24[0], setActionsAllowed = _24[1];
|
|
112
|
+
var _25 = useState({}), createActionQueryParams = _25[0], setCreateActionQueryParams = _25[1];
|
|
113
|
+
var _26 = useState({}), editActionQueryParams = _26[0], setEditActionQueryParams = _26[1];
|
|
114
|
+
var _27 = useState([]), selectedRecords = _27[0], setSelectedRecords = _27[1];
|
|
115
|
+
var _28 = useState([]), selectedRecoverRecords = _28[0], setSelectedRecoverRecords = _28[1];
|
|
116
|
+
var _29 = useState([]), groupingRules = _29[0], setGroupingRules = _29[1];
|
|
117
|
+
var _30 = useState([]), aggregationRules = _30[0], setAggregationRules = _30[1];
|
|
118
|
+
var _31 = useState([]), treeNodes = _31[0], setTreeNodes = _31[1];
|
|
119
|
+
var _32 = useState({}), selectedNodeKeys = _32[0], setSelectedNodeKeys = _32[1];
|
|
120
|
+
var _33 = useState({}), expandedKeys = _33[0], setExpandedKeys = _33[1];
|
|
121
|
+
var _34 = useState(false), treeLoading = _34[0], setTreeLoading = _34[1];
|
|
122
|
+
var _35 = useState(""), sortField = _35[0], setSortField = _35[1];
|
|
123
|
+
var _36 = useState(0), sortOrder = _36[0], setSortOrder = _36[1];
|
|
124
|
+
var _37 = useState([10, 25, 50]), pageSizeOptions = _37[0], setPageSizeOptions = _37[1];
|
|
125
|
+
var _38 = useState(25), globalLimit = _38[0], setGlobalLimit = _38[1];
|
|
126
|
+
var _39 = useState(false), isDeleteRecordsDialogVisible = _39[0], setDeleteRecordsDialogVisible = _39[1];
|
|
127
|
+
var _40 = useState(false), isRecoverDialogVisible = _40[0], setRecoverDialogVisible = _40[1];
|
|
128
|
+
var _41 = useState(false), showArchived = _41[0], setShowArchived = _41[1];
|
|
129
|
+
var _42 = useState(), createButtonUrl = _42[0], setCreateButtonUrl = _42[1];
|
|
130
|
+
var _43 = useState(), editButtonUrl = _43[0], setEditButtonUrl = _43[1];
|
|
131
|
+
var _44 = useState(false), isDraftPublishWorkflowEnabled = _44[0], setIsDraftPublishWorkflowEnabled = _44[1];
|
|
121
132
|
var sizeOptions = [
|
|
122
133
|
{ label: "Compact", value: "small", image: CompactImage },
|
|
123
134
|
{ label: "Cozy", value: "normal", image: CozyImage },
|
|
124
135
|
{ label: "Comfortable", value: "large", image: ComfortableImage },
|
|
125
136
|
];
|
|
126
|
-
var
|
|
127
|
-
var
|
|
137
|
+
var _45 = useState(sizeOptions[1].value), size = _45[0], setSize = _45[1];
|
|
138
|
+
var _46 = useState([]), viewModes = _46[0], setViewModes = _46[1];
|
|
128
139
|
// ── Pagination state ──────────────────────────────────────────────────────
|
|
129
140
|
/**
|
|
130
141
|
* Key: "root" for top-level group list; node.key (string) for any other node.
|
|
131
142
|
* Value: { offset, limit, total }
|
|
132
143
|
*/
|
|
133
|
-
var
|
|
144
|
+
var _47 = useState({}), paginationMap = _47[0], setPaginationMap = _47[1];
|
|
134
145
|
var getPagination = function (key) { var _a; return (_a = paginationMap[key]) !== null && _a !== void 0 ? _a : { offset: 0, limit: globalLimit, total: 0 }; };
|
|
135
146
|
var setPagination = function (key, entry) {
|
|
136
147
|
return setPaginationMap(function (prev) {
|
|
@@ -154,8 +165,8 @@ export var SolidTreeView = forwardRef(function (params, ref) {
|
|
|
154
165
|
var entityApi = createSolidEntityApi(params.modelName);
|
|
155
166
|
var useCreateSolidEntityMutation = entityApi.useCreateSolidEntityMutation, useDeleteMultipleSolidEntitiesMutation = entityApi.useDeleteMultipleSolidEntitiesMutation, useDeleteSolidEntityMutation = entityApi.useDeleteSolidEntityMutation, useGetSolidEntitiesQuery = entityApi.useGetSolidEntitiesQuery, useGetSolidEntityByIdQuery = entityApi.useGetSolidEntityByIdQuery, useLazyGetSolidEntitiesQuery = entityApi.useLazyGetSolidEntitiesQuery, useLazyGetSolidEntityByIdQuery = entityApi.useLazyGetSolidEntityByIdQuery, usePrefetch = entityApi.usePrefetch, useUpdateSolidEntityMutation = entityApi.useUpdateSolidEntityMutation, useRecoverSolidEntityByIdQuery = entityApi.useRecoverSolidEntityByIdQuery, useLazyRecoverSolidEntityByIdQuery = entityApi.useLazyRecoverSolidEntityByIdQuery, useRecoverSolidEntityMutation = entityApi.useRecoverSolidEntityMutation;
|
|
156
167
|
var triggerGetSolidEntities = useLazyGetSolidEntitiesQuery()[0];
|
|
157
|
-
var
|
|
158
|
-
var
|
|
168
|
+
var _48 = useLazyRecoverSolidEntityByIdQuery(), triggerRecoverSolidEntitiesById = _48[0], _49 = _48[1], recoverByIdData = _49.data, recoverByIdIsLoading = _49.isLoading, recoverByIdError = _49.error, recoverByIdIsError = _49.isError, recoverByIdIsSuccess = _49.isSuccess;
|
|
169
|
+
var _50 = useRecoverSolidEntityMutation(), triggerRecoverSolidEntities = _50[0], _51 = _50[1], recoverByData = _51.data, recoverByIsLoading = _51.isLoading, recoverError = _51.error, recoverIsError = _51.isError, recoverByIsSuccess = _51.isSuccess;
|
|
159
170
|
var treeViewMetaDataQs = qs.stringify({
|
|
160
171
|
modelName: params.modelName,
|
|
161
172
|
moduleName: params.moduleName,
|
|
@@ -205,7 +216,42 @@ export var SolidTreeView = forwardRef(function (params, ref) {
|
|
|
205
216
|
}); };
|
|
206
217
|
fetchPermissions();
|
|
207
218
|
}, [params.modelName]);
|
|
208
|
-
|
|
219
|
+
// set layout and actions for create and edit buttons and view modes
|
|
220
|
+
useEffect(function () {
|
|
221
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
222
|
+
if (solidTreeViewLayout) {
|
|
223
|
+
var listLayoutAttrs = solidTreeViewLayout.attrs;
|
|
224
|
+
var createActionUrl = (listLayoutAttrs === null || listLayoutAttrs === void 0 ? void 0 : listLayoutAttrs.createAction) && ((_a = listLayoutAttrs === null || listLayoutAttrs === void 0 ? void 0 : listLayoutAttrs.createAction) === null || _a === void 0 ? void 0 : _a.type) === "custom" ? (_b = listLayoutAttrs === null || listLayoutAttrs === void 0 ? void 0 : listLayoutAttrs.createAction) === null || _b === void 0 ? void 0 : _b.customComponent : "form/new";
|
|
225
|
+
var editActionUrl = (listLayoutAttrs === null || listLayoutAttrs === void 0 ? void 0 : listLayoutAttrs.editAction) && ((_c = listLayoutAttrs === null || listLayoutAttrs === void 0 ? void 0 : listLayoutAttrs.editAction) === null || _c === void 0 ? void 0 : _c.type) === "custom" ? (_d = listLayoutAttrs === null || listLayoutAttrs === void 0 ? void 0 : listLayoutAttrs.editAction) === null || _d === void 0 ? void 0 : _d.customComponent : "form";
|
|
226
|
+
if (listLayoutAttrs === null || listLayoutAttrs === void 0 ? void 0 : listLayoutAttrs.createAction) {
|
|
227
|
+
setCreateActionQueryParams({
|
|
228
|
+
actionName: listLayoutAttrs.createAction.name,
|
|
229
|
+
actionType: listLayoutAttrs.createAction.type,
|
|
230
|
+
actionContext: listLayoutAttrs.createAction.context,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
if (listLayoutAttrs === null || listLayoutAttrs === void 0 ? void 0 : listLayoutAttrs.editAction) {
|
|
234
|
+
setEditActionQueryParams({
|
|
235
|
+
actionName: listLayoutAttrs.editAction.name,
|
|
236
|
+
actionType: listLayoutAttrs.editAction.type,
|
|
237
|
+
actionContext: listLayoutAttrs.editAction.context,
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
// const viewModes = listLayoutAttrs?.allowedViews && listLayoutAttrs?.allowedViews.length > 0 && listLayoutAttrs?.allowedViews.map((view: any) => { return { label: capitalize(view), value: view }; });
|
|
241
|
+
setViewModes((_e = solidTreeViewMetaData === null || solidTreeViewMetaData === void 0 ? void 0 : solidTreeViewMetaData.data) === null || _e === void 0 ? void 0 : _e.viewModes);
|
|
242
|
+
if (createActionUrl) {
|
|
243
|
+
setCreateButtonUrl(createActionUrl);
|
|
244
|
+
}
|
|
245
|
+
if (editActionUrl) {
|
|
246
|
+
setEditButtonUrl(editActionUrl);
|
|
247
|
+
}
|
|
248
|
+
setIsDraftPublishWorkflowEnabled(((_h = (_g = (_f = solidTreeViewMetaData === null || solidTreeViewMetaData === void 0 ? void 0 : solidTreeViewMetaData.data) === null || _f === void 0 ? void 0 : _f.solidView) === null || _g === void 0 ? void 0 : _g.model) === null || _h === void 0 ? void 0 : _h.draftPublishWorkflow) === true);
|
|
249
|
+
}
|
|
250
|
+
}, [solidTreeViewLayout]);
|
|
251
|
+
var editBaseUrl = useMemo(function () { return normalizeSolidListTreeKanbanActionPath(pathname, editButtonUrl || "form"); }, [editButtonUrl, pathname]);
|
|
252
|
+
var _52 = useDeleteSolidEntityMutation(), deleteSolidSingleEntiry = _52[0], isDeleteSolidSingleEntitySuccess = _52[1].isSuccess;
|
|
253
|
+
// Delete mutation
|
|
254
|
+
var _53 = useDeleteMultipleSolidEntitiesMutation(), deleteManySolidEntities = _53[0], _54 = _53[1], isSolidEntitiesDeleted = _54.isLoading, isDeleteSolidEntitiesSucess = _54.isSuccess, isSolidEntitiesDeleteError = _54.isError, SolidEntitiesDeleteError = _54.error, DeletedSolidEntities = _54.data;
|
|
209
255
|
var treeViewTitle = (_e = (_d = solidTreeViewMetaData === null || solidTreeViewMetaData === void 0 ? void 0 : solidTreeViewMetaData.data) === null || _d === void 0 ? void 0 : _d.solidView) === null || _e === void 0 ? void 0 : _e.displayName;
|
|
210
256
|
var toggleBothSidebars = function () {
|
|
211
257
|
if (visibleNavbar) {
|
|
@@ -215,8 +261,8 @@ export var SolidTreeView = forwardRef(function (params, ref) {
|
|
|
215
261
|
dispatch(showNavbar());
|
|
216
262
|
}
|
|
217
263
|
};
|
|
218
|
-
var
|
|
219
|
-
var
|
|
264
|
+
var _55 = useState(null), filters = _55[0], setFilters = _55[1];
|
|
265
|
+
var _56 = useState(null), filterPredicates = _56[0], setFilterPredicates = _56[1];
|
|
220
266
|
var latestFiltersRef = useRef(filters);
|
|
221
267
|
var latestFilterPredicatesRef = useRef(filterPredicates);
|
|
222
268
|
var activeGroupingRules = useMemo(function () { return (groupingRules || []).filter(function (rule) { return !!(rule === null || rule === void 0 ? void 0 : rule.fieldName); }); }, [groupingRules]);
|
|
@@ -474,13 +520,13 @@ export var SolidTreeView = forwardRef(function (params, ref) {
|
|
|
474
520
|
return responseKey === sortField || "".concat(rule.fieldName, "_").concat(rule.operator) === sortField;
|
|
475
521
|
});
|
|
476
522
|
if (isAggregate) {
|
|
477
|
-
var _a = sortField.includes(":") ? sortField.split(":") : sortField.split("_"), field = _a[0],
|
|
523
|
+
var _a = sortField.includes(":") ? sortField.split(":") : sortField.split("_"), field = _a[0], op_1 = _a[1];
|
|
478
524
|
// For leaf level: only field:DIR
|
|
479
525
|
if (ruleIndex >= activeGroupingRules.length) {
|
|
480
526
|
return "".concat(field, ":").concat(dir);
|
|
481
527
|
}
|
|
482
528
|
// For group levels: field:operator:DIR
|
|
483
|
-
return "".concat(field, ":").concat(
|
|
529
|
+
return "".concat(field, ":").concat(op_1, ":").concat(dir);
|
|
484
530
|
}
|
|
485
531
|
// 3. Sorting by a leaf column (regular record field)
|
|
486
532
|
return "".concat(sortField, ":").concat(dir);
|
|
@@ -1084,8 +1130,7 @@ export var SolidTreeView = forwardRef(function (params, ref) {
|
|
|
1084
1130
|
var currentPage = Math.floor(offset / globalLimit) + 1;
|
|
1085
1131
|
var rootHasPrev = hasPrev("root");
|
|
1086
1132
|
var rootHasNext = hasNext("root");
|
|
1087
|
-
if (!rootHasPrev && !rootHasNext)
|
|
1088
|
-
return null;
|
|
1133
|
+
// if (!rootHasPrev && !rootHasNext) return null;
|
|
1089
1134
|
return (_jsxs("div", { style: { width: "100%", display: "flex", alignItems: "center", justifyContent: "space-between", borderTop: "1px solid var(--surface-border)" }, children: [_jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem", padding: "0.5rem 0.75rem" }, children: [_jsx("span", { className: "text-sm text-color-secondary", children: "Items per page" }), _jsx(Dropdown, { value: globalLimit, options: pageSizeOptions, onChange: function (e) {
|
|
1090
1135
|
setGlobalLimit(e.value);
|
|
1091
1136
|
}, className: "solid-page-size-dropdown", style: { height: '2rem', display: 'flex', alignItems: 'center' } })] }), _jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem", padding: "0.5rem 0.75rem" }, children: [_jsxs("span", { className: "text-sm text-color-secondary", children: [offset + 1, "\u2013", Math.min(offset + globalLimit, total), " of ", total] }), _jsx(Button, { type: "button", icon: "pi pi-angle-left", size: "small", outlined: true, severity: "secondary", disabled: !rootHasPrev || treeLoading, onClick: function () { return handleRootPageChange("prev"); }, style: { padding: 0, border: "none", width: "2rem" }, className: "small-button" }), _jsx(Button, { type: "button", icon: "pi pi-angle-right", iconPos: "right", size: "small", outlined: true, severity: "secondary", disabled: !rootHasNext || treeLoading, onClick: function () { return handleRootPageChange("next"); }, style: { padding: 0, border: "none", width: "2rem" }, className: "small-button" })] })] }));
|
|
@@ -1118,16 +1163,171 @@ export var SolidTreeView = forwardRef(function (params, ref) {
|
|
|
1118
1163
|
loading: treeLoading,
|
|
1119
1164
|
}); },
|
|
1120
1165
|
}); }, [filters, filterPredicates, params.customFilter, treeLoading, treeNodes, paginationMap]);
|
|
1166
|
+
var handleCustomButtonClick = useHandleListCustomButtonClick();
|
|
1167
|
+
var _57 = useState(), selectedSolidViewData = _57[0], setSelectedSolidViewData = _57[1];
|
|
1168
|
+
var selectedDataRef = useRef();
|
|
1169
|
+
var op = useRef(null);
|
|
1170
|
+
var _58 = useState(false), deleteEntity = _58[0], setDeleteEntity = _58[1];
|
|
1171
|
+
var hasEditInContextMenu = actionsAllowed.includes("".concat(permissionExpression(params.modelName, 'update'))) &&
|
|
1172
|
+
((_f = solidTreeViewLayout === null || solidTreeViewLayout === void 0 ? void 0 : solidTreeViewLayout.attrs) === null || _f === void 0 ? void 0 : _f.edit) !== false &&
|
|
1173
|
+
((_g = solidTreeViewLayout === null || solidTreeViewLayout === void 0 ? void 0 : solidTreeViewLayout.attrs) === null || _g === void 0 ? void 0 : _g.showDefaultEditButton) !== false &&
|
|
1174
|
+
((_h = solidTreeViewLayout === null || solidTreeViewLayout === void 0 ? void 0 : solidTreeViewLayout.attrs) === null || _h === void 0 ? void 0 : _h.showRowEditInContextMenu) !== false &&
|
|
1175
|
+
!(isDraftPublishWorkflowEnabled && ((_j = selectedDataRef.current) === null || _j === void 0 ? void 0 : _j.publishedAt));
|
|
1176
|
+
var hasDeleteInContextMenu = actionsAllowed.includes("".concat(permissionExpression(params.modelName, 'delete'))) &&
|
|
1177
|
+
((_k = solidTreeViewLayout === null || solidTreeViewLayout === void 0 ? void 0 : solidTreeViewLayout.attrs) === null || _k === void 0 ? void 0 : _k.delete) !== false &&
|
|
1178
|
+
((_l = solidTreeViewLayout === null || solidTreeViewLayout === void 0 ? void 0 : solidTreeViewLayout.attrs) === null || _l === void 0 ? void 0 : _l.showRowDeleteInContextMenu) !== false &&
|
|
1179
|
+
!(isDraftPublishWorkflowEnabled && ((_m = selectedDataRef.current) === null || _m === void 0 ? void 0 : _m.publishedAt));
|
|
1180
|
+
var hasCustomContextMenuButtons = (_p = (_o = solidTreeViewLayout === null || solidTreeViewLayout === void 0 ? void 0 : solidTreeViewLayout.attrs) === null || _o === void 0 ? void 0 : _o.rowButtons) === null || _p === void 0 ? void 0 : _p.some(function (rb) { var _a; return ((_a = rb === null || rb === void 0 ? void 0 : rb.attrs) === null || _a === void 0 ? void 0 : _a.actionInContextMenu) === true; });
|
|
1181
|
+
var hasAnyContextMenuActions = hasEditInContextMenu || hasDeleteInContextMenu || hasCustomContextMenuButtons;
|
|
1182
|
+
var detailsBodyTemplate = function (solidViewData) {
|
|
1183
|
+
return (_jsx("div", { children: _jsx(Button, { type: "button", text: true, size: "small", className: "", onClick: function (e) {
|
|
1184
|
+
var _a;
|
|
1185
|
+
e.stopPropagation();
|
|
1186
|
+
selectedDataRef.current = solidViewData;
|
|
1187
|
+
setSelectedSolidViewData(solidViewData);
|
|
1188
|
+
(_a = op.current) === null || _a === void 0 ? void 0 : _a.toggle(e);
|
|
1189
|
+
}, children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "3", height: "10", viewBox: "0 0 4 16", fill: "none", children: _jsx("path", { d: "M4 14C4 14.55 3.80417 15.0208 3.4125 15.4125C3.02083 15.8042 2.55 16 2 16C1.45 16 0.979167 15.8042 0.5875 15.4125C0.195833 15.0208 0 14.55 0 14C0 13.45 0.195833 12.9792 0.5875 12.5875C0.979167 12.1958 1.45 12 2 12C2.55 12 3.02083 12.1958 3.4125 12.5875C3.80417 12.9792 4 13.45 4 14ZM4 8C4 8.55 3.80417 9.02083 3.4125 9.4125C3.02083 9.80417 2.55 10 2 10C1.45 10 0.979167 9.80417 0.5875 9.4125C0.195833 9.02083 0 8.55 0 8C0 7.45 0.195833 6.97917 0.5875 6.5875C0.979167 6.19583 1.45 6 2 6C2.55 6 3.02083 6.19583 3.4125 6.5875C3.80417 6.97917 4 7.45 4 8ZM4 2C4 2.55 3.80417 3.02083 3.4125 3.4125C3.02083 3.80417 2.55 4 2 4C1.45 4 0.979167 3.80417 0.5875 3.4125C0.195833 3.02083 0 2.55 0 2C0 1.45 0.195833 0.979166 0.5875 0.5875C0.979167 0.195833 1.45 0 2 0C2.55 0 3.02083 0.195833 3.4125 0.5875C3.80417 0.979166 4 1.45 4 2Z", fill: "#666666" }) }) }) }));
|
|
1190
|
+
};
|
|
1191
|
+
var handleDeleteEntity = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1192
|
+
var response, error_3;
|
|
1193
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1194
|
+
return __generator(this, function (_g) {
|
|
1195
|
+
switch (_g.label) {
|
|
1196
|
+
case 0:
|
|
1197
|
+
_g.trys.push([0, 2, , 3]);
|
|
1198
|
+
if (!(selectedSolidViewData === null || selectedSolidViewData === void 0 ? void 0 : selectedSolidViewData.id)) {
|
|
1199
|
+
throw new Error(ERROR_MESSAGES.NO_ENTITY_SELECTED);
|
|
1200
|
+
}
|
|
1201
|
+
return [4 /*yield*/, deleteSolidSingleEntiry(selectedSolidViewData.id)];
|
|
1202
|
+
case 1:
|
|
1203
|
+
response = _g.sent();
|
|
1204
|
+
if (((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.statusCode) === 200) {
|
|
1205
|
+
setDeleteEntity(false);
|
|
1206
|
+
(_b = toast.current) === null || _b === void 0 ? void 0 : _b.show({
|
|
1207
|
+
severity: "success",
|
|
1208
|
+
summary: ERROR_MESSAGES.DELETED,
|
|
1209
|
+
detail: ERROR_MESSAGES.ENTITY_DELETE,
|
|
1210
|
+
life: 3000,
|
|
1211
|
+
});
|
|
1212
|
+
}
|
|
1213
|
+
else {
|
|
1214
|
+
(_c = toast.current) === null || _c === void 0 ? void 0 : _c.show({
|
|
1215
|
+
severity: "error",
|
|
1216
|
+
summary: ERROR_MESSAGES.DELETE_FAIELD,
|
|
1217
|
+
detail: (_e = (_d = response === null || response === void 0 ? void 0 : response.error) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.error,
|
|
1218
|
+
sticky: true, // stays until user closes
|
|
1219
|
+
});
|
|
1220
|
+
}
|
|
1221
|
+
return [3 /*break*/, 3];
|
|
1222
|
+
case 2:
|
|
1223
|
+
error_3 = _g.sent();
|
|
1224
|
+
(_f = toast.current) === null || _f === void 0 ? void 0 : _f.show({
|
|
1225
|
+
severity: "error",
|
|
1226
|
+
summary: ERROR_MESSAGES.DELETE_FAIELD,
|
|
1227
|
+
detail: ERROR_MESSAGES.SOMETHING_WRONG,
|
|
1228
|
+
sticky: true, // stays until user closes
|
|
1229
|
+
});
|
|
1230
|
+
return [3 /*break*/, 3];
|
|
1231
|
+
case 3: return [2 /*return*/];
|
|
1232
|
+
}
|
|
1233
|
+
});
|
|
1234
|
+
}); };
|
|
1235
|
+
var renderRowActions = function (rowData) {
|
|
1236
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1237
|
+
return (_jsxs("div", { className: "flex align-items-center justify-content-end gap-1", children: [((_a = solidTreeViewLayout === null || solidTreeViewLayout === void 0 ? void 0 : solidTreeViewLayout.attrs) === null || _a === void 0 ? void 0 : _a.rowButtons) &&
|
|
1238
|
+
((_b = solidTreeViewLayout === null || solidTreeViewLayout === void 0 ? void 0 : solidTreeViewLayout.attrs) === null || _b === void 0 ? void 0 : _b.rowButtons.filter(function (rb) {
|
|
1239
|
+
var _a, _b;
|
|
1240
|
+
var roles = ((_a = rb === null || rb === void 0 ? void 0 : rb.attrs) === null || _a === void 0 ? void 0 : _a.roles) || [];
|
|
1241
|
+
var isInContextMenu = rb.attrs.actionInContextMenu === true;
|
|
1242
|
+
var isAllowed = roles.length === 0 || hasAnyRole(user === null || user === void 0 ? void 0 : user.roles, roles);
|
|
1243
|
+
var isVisible = ((_b = rb === null || rb === void 0 ? void 0 : rb.attrs) === null || _b === void 0 ? void 0 : _b.visible) !== false;
|
|
1244
|
+
return !isInContextMenu && isAllowed && isVisible;
|
|
1245
|
+
}).map(function (button, index) {
|
|
1246
|
+
var _a, _b, _c, _d;
|
|
1247
|
+
return (_jsx(Button, { type: "button", icon: (_b = (_a = button === null || button === void 0 ? void 0 : button.attrs) === null || _a === void 0 ? void 0 : _a.icon) !== null && _b !== void 0 ? _b : "pi pi-pencil", className: "gap-2 ".concat((_d = (_c = button === null || button === void 0 ? void 0 : button.attrs) === null || _c === void 0 ? void 0 : _c.className) !== null && _d !== void 0 ? _d : ""), label: button.attrs.showLabel !== false
|
|
1248
|
+
? button.attrs.label
|
|
1249
|
+
: "", size: "small", iconPos: "left", onClick: function () {
|
|
1250
|
+
var event = {
|
|
1251
|
+
params: params,
|
|
1252
|
+
rowData: rowData,
|
|
1253
|
+
solidListViewMetaData: solidTreeViewMetaData === null || solidTreeViewMetaData === void 0 ? void 0 : solidTreeViewMetaData.data,
|
|
1254
|
+
};
|
|
1255
|
+
handleCustomButtonClick(button.attrs, event);
|
|
1256
|
+
} }, index));
|
|
1257
|
+
})), actionsAllowed.includes("".concat(permissionExpression(params.modelName, "update"))) &&
|
|
1258
|
+
((_c = solidTreeViewLayout === null || solidTreeViewLayout === void 0 ? void 0 : solidTreeViewLayout.attrs) === null || _c === void 0 ? void 0 : _c.edit) !== false &&
|
|
1259
|
+
((_d = solidTreeViewLayout === null || solidTreeViewLayout === void 0 ? void 0 : solidTreeViewLayout.attrs) === null || _d === void 0 ? void 0 : _d.showRowEditInContextMenu) === false && (_jsx(Button, { text: true, severity: "secondary", size: "small", icon: "pi pi-pencil", onClick: function () {
|
|
1260
|
+
// if (params.embeded == true) {
|
|
1261
|
+
// params.handleEditClickForEmbeddedView(rowData?.id);
|
|
1262
|
+
// } else {
|
|
1263
|
+
try {
|
|
1264
|
+
sessionStorage.setItem("fromView", "list");
|
|
1265
|
+
sessionStorage.setItem("fromViewUrl", window.location.pathname + window.location.search);
|
|
1266
|
+
}
|
|
1267
|
+
catch (e) { }
|
|
1268
|
+
router.push("".concat(editBaseUrl, "/").concat(rowData === null || rowData === void 0 ? void 0 : rowData.id, "?viewMode=edit&").concat(new URLSearchParams(editActionQueryParams).toString()));
|
|
1269
|
+
// }
|
|
1270
|
+
} })), actionsAllowed.includes("".concat(permissionExpression(params.modelName, "delete"))) &&
|
|
1271
|
+
((_e = solidTreeViewLayout === null || solidTreeViewLayout === void 0 ? void 0 : solidTreeViewLayout.attrs) === null || _e === void 0 ? void 0 : _e.delete) !== false &&
|
|
1272
|
+
(params.embeded ||
|
|
1273
|
+
(((_f = solidTreeViewLayout === null || solidTreeViewLayout === void 0 ? void 0 : solidTreeViewLayout.attrs) === null || _f === void 0 ? void 0 : _f.showRowDeleteInContextMenu) !==
|
|
1274
|
+
undefined &&
|
|
1275
|
+
((_g = solidTreeViewLayout === null || solidTreeViewLayout === void 0 ? void 0 : solidTreeViewLayout.attrs) === null || _g === void 0 ? void 0 : _g.showRowDeleteInContextMenu) !==
|
|
1276
|
+
true)) && (_jsx(Button, { text: true, size: "small", severity: "danger", icon: "pi pi-trash", onClick: function () {
|
|
1277
|
+
// if (
|
|
1278
|
+
// params?.embededFieldRelationType === "many-to-many"
|
|
1279
|
+
// ) {
|
|
1280
|
+
// params?.handleDeleteClick(rowData.id);
|
|
1281
|
+
// } else {
|
|
1282
|
+
setSelectedSolidViewData(rowData);
|
|
1283
|
+
setDeleteEntity(true);
|
|
1284
|
+
// }
|
|
1285
|
+
} })), hasAnyContextMenuActions && detailsBodyTemplate(rowData)] }));
|
|
1286
|
+
};
|
|
1121
1287
|
// ─── Render ───────────────────────────────────────────────────────────────
|
|
1122
|
-
return (_jsxs("div", { className: "page-parent-wrapper", children: [_jsx(Toast, { ref: toast }), _jsxs("div", { className: "page-header flex-column lg:flex-row", children: [_jsxs("div", { className: "flex justify-content-between w-full", children: [_jsxs("div", { className: "flex align-items-center solid-header-buttons-wrapper", children: [params.embeded !== true && (_jsx("div", { className: "apps-icon block md:hidden cursor-pointer", onClick: toggleBothSidebars, children: _jsx("i", { className: "pi pi-th-large" }) })), _jsx("p", { className: "m-0 view-title solid-text-wrapper", children: treeViewTitle }), ((
|
|
1123
|
-
((
|
|
1124
|
-
((
|
|
1288
|
+
return (_jsxs("div", { className: "page-parent-wrapper", children: [_jsx(Toast, { ref: toast }), _jsxs("div", { className: "page-header flex-column lg:flex-row", children: [_jsxs("div", { className: "flex justify-content-between w-full", children: [_jsxs("div", { className: "flex align-items-center solid-header-buttons-wrapper", children: [params.embeded !== true && (_jsx("div", { className: "apps-icon block md:hidden cursor-pointer", onClick: toggleBothSidebars, children: _jsx("i", { className: "pi pi-th-large" }) })), _jsx("p", { className: "m-0 view-title solid-text-wrapper", children: treeViewTitle }), ((_s = (_r = (_q = solidTreeViewMetaData === null || solidTreeViewMetaData === void 0 ? void 0 : solidTreeViewMetaData.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.enableGlobalSearch) === true && (_jsx("div", { className: "hidden lg:flex", children: _jsx(SolidGlobalSearchElement, { viewType: "tree", showSaveFilterPopup: showSaveFilterPopup, setShowSaveFilterPopup: setShowSaveFilterPopup, ref: solidGlobalSearchElementRef, viewData: solidTreeViewMetaData, handleApplyCustomFilter: handleApplyCustomFilter }) }))] }), _jsxs("div", { className: "flex align-items-center solid-header-buttons-wrapper", children: [((_v = (_u = (_t = solidTreeViewMetaData === null || solidTreeViewMetaData === void 0 ? void 0 : solidTreeViewMetaData.data) === null || _t === void 0 ? void 0 : _t.solidView) === null || _u === void 0 ? void 0 : _u.layout) === null || _v === void 0 ? void 0 : _v.attrs.enableGlobalSearch) === true && (_jsx("div", { className: "flex lg:hidden", children: _jsx(Button, { type: "button", size: "small", icon: "pi pi-search", severity: "secondary", outlined: true, className: "solid-icon-button", onClick: function () { return setShowGlobalSearchElement(!showGlobalSearchElement); } }) })), actionsAllowed.includes("".concat(permissionExpression(params.modelName, "create"))) &&
|
|
1289
|
+
((_y = (_x = (_w = solidTreeViewMetaData === null || solidTreeViewMetaData === void 0 ? void 0 : solidTreeViewMetaData.data) === null || _w === void 0 ? void 0 : _w.solidView) === null || _x === void 0 ? void 0 : _x.layout) === null || _y === void 0 ? void 0 : _y.attrs.create) !== false && (_jsx(SolidCreateButton, { createButtonUrl: createButtonUrl, createActionQueryParams: createActionQueryParams, responsiveIconOnly: true })), actionsAllowed.includes("".concat(permissionExpression(params.modelName, "delete"))) &&
|
|
1290
|
+
((_1 = (_0 = (_z = solidTreeViewMetaData === null || solidTreeViewMetaData === void 0 ? void 0 : solidTreeViewMetaData.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.delete) !== false &&
|
|
1125
1291
|
selectedRecords.length > 0 && (_jsx(Button, { type: "button", label: "Delete", size: "small", onClick: function () { return setDeleteRecordsDialogVisible(true); }, className: "small-button", severity: "danger" })), _jsx(Button, { type: "button", size: "small", icon: "pi pi-refresh", severity: "secondary", className: "solid-icon-button", outlined: true, onClick: function () { void loadRootGroups(getPagination("root").offset); } }), showArchived && (_jsx(Button, { type: "button", icon: "pi pi-refresh", label: "Recover", size: "small", severity: "secondary", className: "hidden lg:flex solid-icon-button ", onClick: function () { return setRecoverDialogVisible(true); } })), params.embeded === false &&
|
|
1126
|
-
((
|
|
1292
|
+
((_2 = solidTreeViewLayout === null || solidTreeViewLayout === void 0 ? void 0 : solidTreeViewLayout.attrs) === null || _2 === void 0 ? void 0 : _2.configureView) !== false && (_jsx(SolidListViewConfigure, { listViewMetaData: solidTreeViewMetaData, solidListViewLayout: solidTreeViewLayout, setShowArchived: setShowArchived, showArchived: showArchived, viewData: solidTreeViewMetaData, sizeOptions: sizeOptions, setSize: setSize, size: size, viewModes: viewModes, params: params, actionsAllowed: actionsAllowed, selectedRecords: selectedRecords, setDialogVisible: setDeleteRecordsDialogVisible, setShowSaveFilterPopup: setShowSaveFilterPopup, filters: filters, handleFetchUpdatedRecords: handleFetchUpdatedRecords, setRecoverDialogVisible: setRecoverDialogVisible }))] })] }), ((_5 = (_4 = (_3 = solidTreeViewMetaData === null || solidTreeViewMetaData === void 0 ? void 0 : solidTreeViewMetaData.data) === null || _3 === void 0 ? void 0 : _3.solidView) === null || _4 === void 0 ? void 0 : _4.layout) === null || _5 === void 0 ? void 0 : _5.attrs.enableGlobalSearch) === true &&
|
|
1127
1293
|
showGlobalSearchElement && (_jsx("div", { className: "flex lg:hidden", children: _jsx(SolidGlobalSearchElement, { viewType: "tree", showSaveFilterPopup: showSaveFilterPopup, setShowSaveFilterPopup: setShowSaveFilterPopup, ref: solidGlobalSearchElementRef, viewData: solidTreeViewMetaData, handleApplyCustomFilter: handleApplyCustomFilter }) }))] }), _jsx("style", { children: "\n \n " }), _jsx("div", { className: "solid-datatable-wrapper solid-treetable-wrapper flex-1 min-h-0 overflow-auto", children: activeGroupingRules.length === 0 ? (_jsxs("div", { className: "flex flex-column align-items-center justify-content-center h-full p-6 text-center", children: [_jsx("div", { className: "mb-4", style: { opacity: 0.1 }, children: _jsx(HomePageModuleSvg, {}) }), _jsx("h3", { className: "m-0 mb-2", style: { color: "var(--solid-dark-title)", fontWeight: 700, fontSize: '1.5rem' }, children: "Tree View" }), _jsxs("p", { className: "m-0 text-sl", style: { maxWidth: '35rem', lineHeight: '1.5', color: 'var(--text-color)' }, children: ["To visualize your data in a hierarchical structure, please apply a ", _jsx("strong", { children: "Grouping Rule" }), " from the Global Search bar above."] })] })) : (_jsxs(TreeTable, { value: treeNodes, lazy: true, loading: treeLoading, expandedKeys: expandedKeys, onToggle: function (event) { return setExpandedKeys(event.value); }, onExpand: handleNodeExpand, scrollable: true, tableStyle: { minWidth: "max-content" }, tableClassName: "solid-data-table", resizableColumns: true, columnResizeMode: "expand", selectionMode: "checkbox", selectionKeys: selectedNodeKeys, sortField: sortField, sortOrder: sortOrder, removableSort: true, onSort: function (e) {
|
|
1128
1294
|
setSortField(e.sortField);
|
|
1129
1295
|
setSortOrder(e.sortOrder);
|
|
1296
|
+
}, onRowClick: function (e) {
|
|
1297
|
+
var _a, _b;
|
|
1298
|
+
var target = e.originalEvent.target;
|
|
1299
|
+
if (target.closest(".p-checkbox"))
|
|
1300
|
+
return;
|
|
1301
|
+
if (target.closest(".p-c"))
|
|
1302
|
+
return;
|
|
1303
|
+
if (e.node.leaf !== true)
|
|
1304
|
+
return;
|
|
1305
|
+
var rowData = e.node.data;
|
|
1306
|
+
if (((_a = solidTreeViewLayout === null || solidTreeViewLayout === void 0 ? void 0 : solidTreeViewLayout.attrs) === null || _a === void 0 ? void 0 : _a.disableRowClick) === true)
|
|
1307
|
+
return;
|
|
1308
|
+
var hasFindPermission = actionsAllowed.includes(permissionExpression(params.modelName, 'findOne'));
|
|
1309
|
+
var hasUpdatePermission = actionsAllowed.includes(permissionExpression(params.modelName, 'update')) &&
|
|
1310
|
+
((_b = solidTreeViewLayout === null || solidTreeViewLayout === void 0 ? void 0 : solidTreeViewLayout.attrs) === null || _b === void 0 ? void 0 : _b.edit) !== false;
|
|
1311
|
+
if (!(hasFindPermission || hasUpdatePermission))
|
|
1312
|
+
return;
|
|
1313
|
+
// if (params.embeded === true) {
|
|
1314
|
+
// params.handleEditClickForEmbeddedView(rowData?.id);
|
|
1315
|
+
// } else {
|
|
1316
|
+
if (typeof window !== "undefined") {
|
|
1317
|
+
// store a simple marker for the caller
|
|
1318
|
+
// also store the full current URL so Back can restore exact state (including action params)
|
|
1319
|
+
try {
|
|
1320
|
+
sessionStorage.setItem("fromView", "list");
|
|
1321
|
+
sessionStorage.setItem("fromViewUrl", window.location.pathname + window.location.search);
|
|
1322
|
+
}
|
|
1323
|
+
catch (e) {
|
|
1324
|
+
// ignore storage errors
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
router.push("".concat(editBaseUrl, "/").concat(rowData === null || rowData === void 0 ? void 0 : rowData.id, "?viewMode=view&").concat(new URLSearchParams(editActionQueryParams).toString()));
|
|
1328
|
+
// }
|
|
1130
1329
|
}, onSelectionChange: function (e) {
|
|
1330
|
+
e.originalEvent.stopPropagation();
|
|
1131
1331
|
var incoming = e.value;
|
|
1132
1332
|
setSelectedNodeKeys(function (prev) {
|
|
1133
1333
|
var next = {};
|
|
@@ -1144,8 +1344,11 @@ export var SolidTreeView = forwardRef(function (params, ref) {
|
|
|
1144
1344
|
var _a, _b, _c, _d;
|
|
1145
1345
|
var rowData = node === null || node === void 0 ? void 0 : node.data;
|
|
1146
1346
|
var nodeMeta = rowData === null || rowData === void 0 ? void 0 : rowData.__treeMeta;
|
|
1147
|
-
|
|
1148
|
-
|
|
1347
|
+
// ---------------- NORMAL ROW ----------------
|
|
1348
|
+
if ((nodeMeta === null || nodeMeta === void 0 ? void 0 : nodeMeta.nodeType) !== "group") {
|
|
1349
|
+
return renderRowActions(rowData);
|
|
1350
|
+
}
|
|
1351
|
+
// ---------------- GROUP ROW ----------------
|
|
1149
1352
|
var nodeKey = String(node.key);
|
|
1150
1353
|
var isExpanded = expandedKeys[nodeKey];
|
|
1151
1354
|
var childrenLoaded = isExpanded && node.children && node.children.length > 0;
|
|
@@ -1171,9 +1374,40 @@ export var SolidTreeView = forwardRef(function (params, ref) {
|
|
|
1171
1374
|
return (_c = (_b = fieldMeta === null || fieldMeta === void 0 ? void 0 : fieldMeta.displayName) !== null && _b !== void 0 ? _b : fieldMeta === null || fieldMeta === void 0 ? void 0 : fieldMeta.name) !== null && _c !== void 0 ? _c : fieldName;
|
|
1172
1375
|
})();
|
|
1173
1376
|
return (_jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.2rem", justifyContent: "flex-end" }, onClick: function (e) { return e.stopPropagation(); }, children: [_jsx(Button, { type: "button", icon: "pi pi-angle-left", size: "small", rounded: true, outlined: true, disabled: !canPrev || treeLoading, style: { padding: 0, border: "none", width: "2rem" }, className: "small-button", onClick: function () { return handleNodePageChange(nodeKey, "prev"); } }), _jsx(Button, { type: "button", icon: "pi pi-angle-right", size: "small", rounded: true, outlined: true, disabled: !canNext || treeLoading, style: { padding: 0, border: "none", width: "2rem" }, className: "small-button", onClick: function () { return handleNodePageChange(nodeKey, "next"); } })] }));
|
|
1174
|
-
} }, "tree-last-frozen-column")] })) }), _jsx(RootPaginationBar, {}), _jsxs(Dialog, {
|
|
1377
|
+
} }, "tree-last-frozen-column")] })) }), _jsx(RootPaginationBar, {}), _jsxs(Dialog, { header: "Delete ".concat(((_8 = (_7 = (_6 = solidTreeViewMetaData === null || solidTreeViewMetaData === void 0 ? void 0 : solidTreeViewMetaData.data) === null || _6 === void 0 ? void 0 : _6.solidView) === null || _7 === void 0 ? void 0 : _7.model) === null || _8 === void 0 ? void 0 : _8.displayName)
|
|
1378
|
+
? (_11 = (_10 = (_9 = solidTreeViewMetaData === null || solidTreeViewMetaData === void 0 ? void 0 : solidTreeViewMetaData.data) === null || _9 === void 0 ? void 0 : _9.solidView) === null || _10 === void 0 ? void 0 : _10.model) === null || _11 === void 0 ? void 0 : _11.displayName
|
|
1379
|
+
: params === null || params === void 0 ? void 0 : params.modelName), headerClassName: "py-2", contentClassName: "px-0 pb-0", visible: deleteEntity, style: { width: "20vw" }, onHide: function () {
|
|
1380
|
+
if (!deleteEntity)
|
|
1381
|
+
return;
|
|
1382
|
+
setDeleteEntity(false);
|
|
1383
|
+
}, className: "solid-confirm-dialog", children: [_jsx(Divider, { className: "m-0" }), _jsxs("div", { className: "p-4", children: [_jsx("p", { className: "m-0 solid-primary-title", style: { fontSize: 16 }, children: "Are you sure you want to delete this ".concat(((_14 = (_13 = (_12 = solidTreeViewMetaData === null || solidTreeViewMetaData === void 0 ? void 0 : solidTreeViewMetaData.data) === null || _12 === void 0 ? void 0 : _12.solidView) === null || _13 === void 0 ? void 0 : _13.model) === null || _14 === void 0 ? void 0 : _14.displayName)
|
|
1384
|
+
? (_17 = (_16 = (_15 = solidTreeViewMetaData === null || solidTreeViewMetaData === void 0 ? void 0 : solidTreeViewMetaData.data) === null || _15 === void 0 ? void 0 : _15.solidView) === null || _16 === void 0 ? void 0 : _16.model) === null || _17 === void 0 ? void 0 : _17.displayName
|
|
1385
|
+
: params === null || params === void 0 ? void 0 : params.modelName, "?") }), _jsxs("div", { className: "flex align-items-center gap-2 mt-3", children: [_jsx(Button, { label: "Delete", severity: "danger", size: "small", onClick: handleDeleteEntity }), _jsx(Button, { label: "Cancel", size: "small", onClick: function () { return setDeleteEntity(false); }, outlined: true, className: 'bg-primary-reverse' })] })] })] }), _jsxs(Dialog, { visible: isDeleteRecordsDialogVisible, header: "Confirm Delete", onHide: function () { return setDeleteRecordsDialogVisible(false); }, headerClassName: "py-2", contentClassName: "px-0 pb-0",
|
|
1175
1386
|
// style={{ width: '20vw' }}
|
|
1176
|
-
breakpoints: { '1199px': '30rem', '550px': '85vw' }, children: [_jsx(Divider, { className: "m-0" }), _jsxs("div", { className: "p-4", children: [_jsx("p", { className: "m-0 solid-primary-title", style: { fontSize: 16 }, children: "Are you sure you want to delete the selected records?" }), _jsxs("div", { className: "flex align-items-center gap-2 mt-3", children: [_jsx(Button, { label: "Delete", severity: "danger", size: "small", autoFocus: true, onClick: deleteBulk }), _jsx(Button, { label: "Cancel", size: "small", onClick: onDeleteClose, outlined: true, className: 'bg-primary-reverse' })] })] })] }), _jsx(Dialog, { visible: isRecoverDialogVisible, header: "Confirm Recover", modal: true, className: "solid-confirm-dialog", footer: function () { return (_jsxs("div", { className: "flex justify-content-center", children: [_jsx(Button, { label: "Yes", icon: "pi pi-check", severity: "danger", autoFocus: true, onClick: recoverAll }), _jsx(Button, { label: "No", icon: "pi pi-times", onClick: function () { return setRecoverDialogVisible(false); } })] })); }, onHide: function () { return setRecoverDialogVisible(false); }, children: _jsx("p", { children: "Are you sure you want to recover all records?" }) })
|
|
1387
|
+
breakpoints: { '1199px': '30rem', '550px': '85vw' }, children: [_jsx(Divider, { className: "m-0" }), _jsxs("div", { className: "p-4", children: [_jsx("p", { className: "m-0 solid-primary-title", style: { fontSize: 16 }, children: "Are you sure you want to delete the selected records?" }), _jsxs("div", { className: "flex align-items-center gap-2 mt-3", children: [_jsx(Button, { label: "Delete", severity: "danger", size: "small", autoFocus: true, onClick: deleteBulk }), _jsx(Button, { label: "Cancel", size: "small", onClick: onDeleteClose, outlined: true, className: 'bg-primary-reverse' })] })] })] }), _jsx(Dialog, { visible: isRecoverDialogVisible, header: "Confirm Recover", modal: true, className: "solid-confirm-dialog", footer: function () { return (_jsxs("div", { className: "flex justify-content-center", children: [_jsx(Button, { label: "Yes", icon: "pi pi-check", severity: "danger", autoFocus: true, onClick: recoverAll }), _jsx(Button, { label: "No", icon: "pi pi-times", onClick: function () { return setRecoverDialogVisible(false); } })] })); }, onHide: function () { return setRecoverDialogVisible(false); }, children: _jsx("p", { children: "Are you sure you want to recover all records?" }) }), _jsx(OverlayPanel, { ref: op, className: "solid-custom-overlay", style: { top: 10, minWidth: 120 }, children: _jsxs("div", { className: "flex flex-column gap-1 p-1", children: [hasEditInContextMenu && (_jsx(Button, { type: "button", className: "w-full text-left gap-1", label: "Edit", size: "small", iconPos: "left", icon: "pi pi-pencil", onClick: function () {
|
|
1388
|
+
var _a;
|
|
1389
|
+
// if (params.embeded == true) {
|
|
1390
|
+
// params.handleEditClickForEmbeddedView(
|
|
1391
|
+
// selectedDataRef.current?.id
|
|
1392
|
+
// );
|
|
1393
|
+
// } else {
|
|
1394
|
+
try {
|
|
1395
|
+
sessionStorage.setItem("fromView", "list");
|
|
1396
|
+
sessionStorage.setItem("fromViewUrl", window.location.pathname + window.location.search);
|
|
1397
|
+
}
|
|
1398
|
+
catch (e) { }
|
|
1399
|
+
router.push("".concat(editBaseUrl, "/").concat((_a = selectedDataRef.current) === null || _a === void 0 ? void 0 : _a.id, "?viewMode=edit&").concat(new URLSearchParams(editActionQueryParams).toString()));
|
|
1400
|
+
// }
|
|
1401
|
+
} })), hasDeleteInContextMenu && !params.embeded && (_jsx(Button, { text: true, type: "button", className: "w-full text-left gap-1", label: "Delete", size: "small", iconPos: "left", severity: "danger", icon: "pi pi-trash", onClick: function () { return setDeleteEntity(true); } })), hasCustomContextMenuButtons && ((_19 = (_18 = solidTreeViewLayout === null || solidTreeViewLayout === void 0 ? void 0 : solidTreeViewLayout.attrs) === null || _18 === void 0 ? void 0 : _18.rowButtons) === null || _19 === void 0 ? void 0 : _19.filter(function (rb) {
|
|
1402
|
+
var _a, _b;
|
|
1403
|
+
return ((_a = rb === null || rb === void 0 ? void 0 : rb.attrs) === null || _a === void 0 ? void 0 : _a.actionInContextMenu) === true &&
|
|
1404
|
+
((_b = rb === null || rb === void 0 ? void 0 : rb.attrs) === null || _b === void 0 ? void 0 : _b.visible) !== false;
|
|
1405
|
+
}).map(function (button, index) {
|
|
1406
|
+
var _a;
|
|
1407
|
+
return (_jsx(SolidListViewRowButtonContextMenu, { button: button, params: params, getSelectedSolidViewData: function () { return selectedDataRef.current; },
|
|
1408
|
+
// selectedSolidViewData={selectedSolidViewData}
|
|
1409
|
+
solidListViewMetaData: solidTreeViewMetaData, handleCustomButtonClick: handleCustomButtonClick }, "".concat(index, "-").concat(((_a = selectedDataRef === null || selectedDataRef === void 0 ? void 0 : selectedDataRef.current) === null || _a === void 0 ? void 0 : _a.id) || '')));
|
|
1410
|
+
}))] }) })] }));
|
|
1177
1411
|
});
|
|
1178
1412
|
SolidTreeView.displayName = "SolidTreeView";
|
|
1179
1413
|
//# sourceMappingURL=SolidTreeView.js.map
|