@solidxai/core-ui 0.1.5-beta.0 → 0.1.5-beta.10
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/auth/AuthTabs.d.ts +14 -0
- package/dist/components/auth/AuthTabs.d.ts.map +1 -0
- package/dist/components/auth/AuthTabs.js +19 -0
- package/dist/components/auth/AuthTabs.js.map +1 -0
- package/dist/components/auth/AuthTabs.tsx +38 -0
- package/dist/components/common/AuthBanner.js.map +1 -1
- package/dist/components/common/SolidErrorStatePage.d.ts +12 -0
- package/dist/components/common/SolidErrorStatePage.d.ts.map +1 -0
- package/dist/components/common/SolidErrorStatePage.js +16 -0
- package/dist/components/common/SolidErrorStatePage.js.map +1 -0
- package/dist/components/common/SolidErrorStatePage.tsx +55 -0
- package/dist/components/core/chatter/SolidChatter.d.ts.map +1 -1
- package/dist/components/core/chatter/SolidChatter.js +6 -7
- package/dist/components/core/chatter/SolidChatter.js.map +1 -1
- package/dist/components/core/chatter/SolidChatter.tsx +6 -7
- 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/chatter/SolidChatterDateDivider.d.ts.map +1 -1
- package/dist/components/core/chatter/SolidChatterDateDivider.js +4 -1
- package/dist/components/core/chatter/SolidChatterDateDivider.js.map +1 -1
- package/dist/components/core/chatter/SolidChatterDateDivider.tsx +5 -1
- 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/PrimeDataTableWrapper.d.ts +3 -0
- package/dist/components/core/dashboard/PrimeDataTableWrapper.d.ts.map +1 -0
- package/dist/components/core/dashboard/PrimeDataTableWrapper.js +21 -0
- package/dist/components/core/dashboard/PrimeDataTableWrapper.js.map +1 -0
- package/dist/components/core/dashboard/PrimeDataTableWrapper.tsx +40 -0
- package/dist/components/core/dashboard/SolidDashboard.d.ts +0 -1
- package/dist/components/core/dashboard/SolidDashboard.d.ts.map +1 -1
- package/dist/components/core/dashboard/SolidDashboard.js +51 -22
- package/dist/components/core/dashboard/SolidDashboard.js.map +1 -1
- package/dist/components/core/dashboard/SolidDashboard.module.css +6 -2
- package/dist/components/core/dashboard/SolidDashboard.tsx +133 -56
- package/dist/components/core/dashboard/SolidDashboardBody.d.ts +13 -1
- package/dist/components/core/dashboard/SolidDashboardBody.d.ts.map +1 -1
- package/dist/components/core/dashboard/SolidDashboardBody.js +134 -48
- package/dist/components/core/dashboard/SolidDashboardBody.js.map +1 -1
- package/dist/components/core/dashboard/SolidDashboardBody.tsx +143 -91
- package/dist/components/core/dashboard/SolidQuestionRenderer.d.ts.map +1 -1
- package/dist/components/core/dashboard/SolidQuestionRenderer.js +1 -1
- package/dist/components/core/dashboard/SolidQuestionRenderer.js.map +1 -1
- package/dist/components/core/dashboard/SolidQuestionRenderer.tsx +12 -10
- package/dist/components/core/dashboard/chart-renderers/ChartJsRenderer.d.ts.map +1 -1
- package/dist/components/core/dashboard/chart-renderers/ChartJsRenderer.js +29 -2
- package/dist/components/core/dashboard/chart-renderers/ChartJsRenderer.js.map +1 -1
- package/dist/components/core/dashboard/chart-renderers/ChartJsRenderer.tsx +33 -3
- package/dist/components/core/extension/solid-core/dashboard/dashboardFormViewChangeHandler.d.ts +10 -0
- package/dist/components/core/extension/solid-core/dashboard/dashboardFormViewChangeHandler.d.ts.map +1 -0
- package/dist/components/core/extension/solid-core/dashboard/dashboardFormViewChangeHandler.js +16 -0
- package/dist/components/core/extension/solid-core/dashboard/dashboardFormViewChangeHandler.js.map +1 -0
- package/dist/components/core/extension/solid-core/dashboard/dashboardFormViewChangeHandler.ts +19 -0
- package/dist/components/core/extension/solid-core/dashboard/dashboardQuestionFieldChangeHandler.d.ts +8 -0
- package/dist/components/core/extension/solid-core/dashboard/dashboardQuestionFieldChangeHandler.d.ts.map +1 -0
- package/dist/components/core/extension/solid-core/dashboard/dashboardQuestionFieldChangeHandler.js +64 -0
- package/dist/components/core/extension/solid-core/dashboard/dashboardQuestionFieldChangeHandler.js.map +1 -0
- package/dist/components/core/extension/solid-core/dashboard/dashboardQuestionFieldChangeHandler.ts +30 -0
- package/dist/components/core/extension/solid-core/dashboard/dashboardQuestionOnFormLoadHandler.d.ts +8 -0
- package/dist/components/core/extension/solid-core/dashboard/dashboardQuestionOnFormLoadHandler.d.ts.map +1 -0
- package/dist/components/core/extension/solid-core/dashboard/dashboardQuestionOnFormLoadHandler.js +62 -0
- package/dist/components/core/extension/solid-core/dashboard/dashboardQuestionOnFormLoadHandler.js.map +1 -0
- package/dist/components/core/extension/solid-core/dashboard/dashboardQuestionOnFormLoadHandler.ts +29 -0
- package/dist/components/core/extension/solid-core/modelMetadata/list/DeleteModelRowAction.js +2 -2
- package/dist/components/core/extension/solid-core/modelMetadata/list/DeleteModelRowAction.js.map +1 -1
- package/dist/components/core/extension/solid-core/modelMetadata/list/DeleteModelRowAction.tsx +2 -2
- package/dist/components/core/form/SolidFormView.js +1 -1
- package/dist/components/core/form/SolidFormView.js.map +1 -1
- package/dist/components/core/form/SolidFormView.tsx +1 -1
- 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/PLAN.md +92 -0
- package/dist/components/core/list/SolidDataTable.d.ts +58 -0
- package/dist/components/core/list/SolidDataTable.d.ts.map +1 -0
- package/dist/components/core/list/SolidDataTable.js +141 -0
- package/dist/components/core/list/SolidDataTable.js.map +1 -0
- package/dist/components/core/list/SolidDataTable.tsx +314 -0
- package/dist/components/core/list/SolidDataTablePagination.d.ts +15 -0
- package/dist/components/core/list/SolidDataTablePagination.d.ts.map +1 -0
- package/dist/components/core/list/SolidDataTablePagination.js +22 -0
- package/dist/components/core/list/SolidDataTablePagination.js.map +1 -0
- package/dist/components/core/list/SolidDataTablePagination.tsx +71 -0
- package/dist/components/core/list/SolidListView.d.ts.map +1 -1
- package/dist/components/core/list/SolidListView.js +14 -11
- package/dist/components/core/list/SolidListView.js.map +1 -1
- package/dist/components/core/list/SolidListView.tsx +8 -7
- package/dist/components/core/list/columns/SolidDateColumn.d.ts +2 -0
- package/dist/components/core/list/columns/SolidDateColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidDateColumn.js +9 -1
- package/dist/components/core/list/columns/SolidDateColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidDateColumn.tsx +13 -1
- package/dist/components/core/list/columns/SolidDatetimeColumn.js +1 -1
- package/dist/components/core/list/columns/SolidDatetimeColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidDatetimeColumn.tsx +1 -1
- 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/components/layout/AdminTopHeader.d.ts +2 -0
- package/dist/components/layout/AdminTopHeader.d.ts.map +1 -0
- package/dist/components/layout/AdminTopHeader.js +68 -0
- package/dist/components/layout/AdminTopHeader.js.map +1 -0
- package/dist/components/layout/AdminTopHeader.tsx +135 -0
- package/dist/components/shad-cn-ui/SolidAutocomplete.d.ts +24 -0
- package/dist/components/shad-cn-ui/SolidAutocomplete.d.ts.map +1 -0
- package/dist/components/shad-cn-ui/SolidAutocomplete.js +224 -0
- package/dist/components/shad-cn-ui/SolidAutocomplete.js.map +1 -0
- package/dist/components/shad-cn-ui/SolidAutocomplete.tsx +339 -0
- package/dist/components/shad-cn-ui/SolidButton.d.ts +14 -0
- package/dist/components/shad-cn-ui/SolidButton.d.ts.map +1 -0
- package/dist/components/shad-cn-ui/SolidButton.js +36 -0
- package/dist/components/shad-cn-ui/SolidButton.js.map +1 -0
- package/dist/components/shad-cn-ui/SolidButton.tsx +54 -0
- package/dist/components/shad-cn-ui/SolidInput.d.ts +5 -0
- package/dist/components/shad-cn-ui/SolidInput.d.ts.map +1 -0
- package/dist/components/shad-cn-ui/SolidInput.js +35 -0
- package/dist/components/shad-cn-ui/SolidInput.js.map +1 -0
- package/dist/components/shad-cn-ui/SolidInput.tsx +12 -0
- package/dist/components/shad-cn-ui/SolidNumberInput.d.ts +10 -0
- package/dist/components/shad-cn-ui/SolidNumberInput.d.ts.map +1 -0
- package/dist/components/shad-cn-ui/SolidNumberInput.js +33 -0
- package/dist/components/shad-cn-ui/SolidNumberInput.js.map +1 -0
- package/dist/components/shad-cn-ui/SolidNumberInput.tsx +24 -0
- package/dist/components/shad-cn-ui/SolidSelect.d.ts +16 -0
- package/dist/components/shad-cn-ui/SolidSelect.d.ts.map +1 -0
- package/dist/components/shad-cn-ui/SolidSelect.js +26 -0
- package/dist/components/shad-cn-ui/SolidSelect.js.map +1 -0
- package/dist/components/shad-cn-ui/SolidSelect.tsx +65 -0
- package/dist/components/shad-cn-ui/SolidTabs.d.ts +18 -0
- package/dist/components/shad-cn-ui/SolidTabs.d.ts.map +1 -0
- package/dist/components/shad-cn-ui/SolidTabs.js +22 -0
- package/dist/components/shad-cn-ui/SolidTabs.js.map +1 -0
- package/dist/components/shad-cn-ui/SolidTabs.tsx +73 -0
- package/dist/components/shad-cn-ui/index.d.ts +7 -0
- package/dist/components/shad-cn-ui/index.d.ts.map +1 -0
- package/dist/components/shad-cn-ui/index.js +7 -0
- package/dist/components/shad-cn-ui/index.js.map +1 -0
- package/dist/components/shad-cn-ui/index.ts +6 -0
- package/dist/components/solid-ui/SolidButton.d.ts +14 -0
- package/dist/components/solid-ui/SolidButton.d.ts.map +1 -0
- package/dist/components/solid-ui/SolidButton.js +36 -0
- package/dist/components/solid-ui/SolidButton.js.map +1 -0
- package/dist/components/solid-ui/SolidButton.tsx +54 -0
- package/dist/components/solid-ui/SolidTabs.d.ts +18 -0
- package/dist/components/solid-ui/SolidTabs.d.ts.map +1 -0
- package/dist/components/solid-ui/SolidTabs.js +22 -0
- package/dist/components/solid-ui/SolidTabs.js.map +1 -0
- package/dist/components/solid-ui/SolidTabs.tsx +73 -0
- package/dist/components/solid-ui/index.d.ts +3 -0
- package/dist/components/solid-ui/index.d.ts.map +1 -0
- package/dist/components/solid-ui/index.js +3 -0
- package/dist/components/solid-ui/index.js.map +1 -0
- package/dist/components/solid-ui/index.ts +2 -0
- package/dist/constants/error-messages.d.ts +3 -0
- package/dist/constants/error-messages.d.ts.map +1 -1
- package/dist/constants/error-messages.js +3 -0
- package/dist/constants/error-messages.js.map +1 -1
- package/dist/constants/error-messages.ts +24 -20
- package/dist/helpers/registry.d.ts.map +1 -1
- package/dist/helpers/registry.js +10 -0
- package/dist/helpers/registry.js.map +1 -1
- package/dist/helpers/registry.ts +12 -0
- 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/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/index.ts +8 -0
- package/dist/redux/api/dashboardLayoutApi.d.ts +24 -0
- package/dist/redux/api/dashboardLayoutApi.d.ts.map +1 -0
- package/dist/redux/api/dashboardLayoutApi.js +34 -0
- package/dist/redux/api/dashboardLayoutApi.js.map +1 -0
- package/dist/redux/api/dashboardLayoutApi.ts +55 -0
- package/dist/redux/store/defaultStoreConfig.d.ts +4 -0
- package/dist/redux/store/defaultStoreConfig.d.ts.map +1 -1
- package/dist/redux/store/defaultStoreConfig.js +3 -2
- package/dist/redux/store/defaultStoreConfig.js.map +1 -1
- package/dist/redux/store/defaultStoreConfig.ts +4 -2
- package/dist/resources/globals.css +8 -0
- package/dist/resources/images/errors/error-astronaut-404.png +0 -0
- package/dist/resources/shadcn-base.css +3200 -0
- package/dist/routes/pages/admin/core/DashboardPage.d.ts.map +1 -1
- package/dist/routes/pages/admin/core/DashboardPage.js +3 -7
- package/dist/routes/pages/admin/core/DashboardPage.js.map +1 -1
- package/dist/routes/pages/admin/core/DashboardPage.tsx +2 -5
- package/dist/routes/pages/admin/core/FormPage.d.ts.map +1 -1
- package/dist/routes/pages/admin/core/FormPage.js +6 -1
- package/dist/routes/pages/admin/core/FormPage.js.map +1 -1
- package/dist/routes/pages/admin/core/FormPage.tsx +7 -1
- package/dist/routes/solidRoutes.js +1 -1
- package/dist/routes/solidRoutes.js.map +1 -1
- package/dist/routes/solidRoutes.tsx +1 -1
- package/package.json +13 -11
- package/dist/components/auth/SolidOTPVerify.d.ts +0 -3
- package/dist/components/auth/SolidOTPVerify.d.ts.map +0 -1
- package/dist/components/auth/SolidOTPVerify.js +0 -67
- package/dist/components/auth/SolidOTPVerify.js.map +0 -1
- package/dist/components/auth/SolidOTPVerify.tsx +0 -133
- package/dist/components/core/common/LoadDynamicJsxComponent.d.ts +0 -2
- package/dist/components/core/common/LoadDynamicJsxComponent.d.ts.map +0 -1
- package/dist/components/core/common/LoadDynamicJsxComponent.js +0 -50
- package/dist/components/core/common/LoadDynamicJsxComponent.js.map +0 -1
- package/dist/components/core/common/LoadDynamicJsxComponent.tsx +0 -70
- package/dist/nextAuth/authProviders.d.ts +0 -4
- package/dist/nextAuth/authProviders.d.ts.map +0 -1
- package/dist/nextAuth/authProviders.js +0 -198
- package/dist/nextAuth/authProviders.js.map +0 -1
- package/dist/nextAuth/authProviders.tsx +0 -232
- package/dist/nextAuth/handleLogout.d.ts +0 -2
- package/dist/nextAuth/handleLogout.d.ts.map +0 -1
- package/dist/nextAuth/handleLogout.js +0 -36
- package/dist/nextAuth/handleLogout.js.map +0 -1
- package/dist/nextAuth/handleLogout.tsx +0 -39
- package/dist/nextAuth/refreshAccessToken.d.ts +0 -2
- package/dist/nextAuth/refreshAccessToken.d.ts.map +0 -1
- package/dist/nextAuth/refreshAccessToken.js +0 -24
- package/dist/nextAuth/refreshAccessToken.js.map +0 -1
- package/dist/nextAuth/refreshAccessToken.tsx +0 -28
- package/dist/redux/features/settingsSlice.d.ts +0 -20
- package/dist/redux/features/settingsSlice.d.ts.map +0 -1
- package/dist/redux/features/settingsSlice.js +0 -39
- package/dist/redux/features/settingsSlice.js.map +0 -1
- package/dist/redux/features/settingsSlice.ts +0 -60
|
@@ -40,6 +40,12 @@ import { SolidBeforeTreeNodeLoad } from "../../../types";
|
|
|
40
40
|
import { getExtensionFunction } from "../../../helpers/registry";
|
|
41
41
|
import { SolidTreeLoad, SolidTreeUiEventResponse } from "../../../types/solid-core";
|
|
42
42
|
import { Tooltip } from "primereact/tooltip";
|
|
43
|
+
import { useRouter } from "../../../hooks/useRouter";
|
|
44
|
+
import { normalizeSolidListTreeKanbanActionPath } from "../../../helpers/routePaths";
|
|
45
|
+
import { usePathname } from "../../../hooks/usePathname";
|
|
46
|
+
import { useHandleListCustomButtonClick } from "../../../components/common/useHandleListCustomButtonClick";
|
|
47
|
+
import { OverlayPanel } from "primereact/overlaypanel";
|
|
48
|
+
import { SolidListViewRowButtonContextMenu } from "../list/SolidListViewRowButtonContextMenu";
|
|
43
49
|
|
|
44
50
|
// ─── Types ────────────────────────────────────────────────────────────────────
|
|
45
51
|
|
|
@@ -122,8 +128,10 @@ export const SolidTreeView = forwardRef<SolidTreeViewHandle, SolidTreeViewParams
|
|
|
122
128
|
const searchParams = useSearchParams();
|
|
123
129
|
|
|
124
130
|
const session = useSession();
|
|
131
|
+
const router = useRouter()
|
|
125
132
|
const user = session?.data?.user;
|
|
126
133
|
|
|
134
|
+
const pathname = usePathname();
|
|
127
135
|
const solidGlobalSearchElementRef = useRef<any>(null);
|
|
128
136
|
|
|
129
137
|
const [showSaveFilterPopup, setShowSaveFilterPopup] = useState<boolean>(false);
|
|
@@ -131,8 +139,9 @@ export const SolidTreeView = forwardRef<SolidTreeViewHandle, SolidTreeViewParams
|
|
|
131
139
|
const [toPopulate, setToPopulate] = useState<string[]>([]);
|
|
132
140
|
const [toPopulateMedia, setToPopulateMedia] = useState<string[]>([]);
|
|
133
141
|
const [actionsAllowed, setActionsAllowed] = useState<string[]>([]);
|
|
134
|
-
const [createButtonUrl, setCreateButtonUrl] = useState<string>();
|
|
135
142
|
const [createActionQueryParams, setCreateActionQueryParams] = useState<Record<string, string>>({});
|
|
143
|
+
const [editActionQueryParams, setEditActionQueryParams] = useState<Record<string, string>>({});
|
|
144
|
+
|
|
136
145
|
const [selectedRecords, setSelectedRecords] = useState<any[]>([]);
|
|
137
146
|
const [selectedRecoverRecords, setSelectedRecoverRecords] = useState<any[]>([]);
|
|
138
147
|
|
|
@@ -156,6 +165,14 @@ export const SolidTreeView = forwardRef<SolidTreeViewHandle, SolidTreeViewParams
|
|
|
156
165
|
const [showArchived, setShowArchived] = useState(false);
|
|
157
166
|
|
|
158
167
|
|
|
168
|
+
const [createButtonUrl, setCreateButtonUrl] = useState<string>();
|
|
169
|
+
const [editButtonUrl, setEditButtonUrl] = useState<string>();
|
|
170
|
+
const [isDraftPublishWorkflowEnabled, setIsDraftPublishWorkflowEnabled] = useState(false);
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
159
176
|
const sizeOptions = [
|
|
160
177
|
{ label: "Compact", value: "small", image: CompactImage },
|
|
161
178
|
{ label: "Cozy", value: "normal", image: CozyImage },
|
|
@@ -289,7 +306,66 @@ export const SolidTreeView = forwardRef<SolidTreeViewHandle, SolidTreeViewParams
|
|
|
289
306
|
fetchPermissions();
|
|
290
307
|
}, [params.modelName]);
|
|
291
308
|
|
|
292
|
-
|
|
309
|
+
|
|
310
|
+
// set layout and actions for create and edit buttons and view modes
|
|
311
|
+
useEffect(() => {
|
|
312
|
+
if (solidTreeViewLayout) {
|
|
313
|
+
const listLayoutAttrs = solidTreeViewLayout.attrs;
|
|
314
|
+
const createActionUrl = listLayoutAttrs?.createAction && listLayoutAttrs?.createAction?.type === "custom" ? listLayoutAttrs?.createAction?.customComponent : "form/new";
|
|
315
|
+
const editActionUrl = listLayoutAttrs?.editAction && listLayoutAttrs?.editAction?.type === "custom" ? listLayoutAttrs?.editAction?.customComponent : "form";
|
|
316
|
+
|
|
317
|
+
if (listLayoutAttrs?.createAction) {
|
|
318
|
+
setCreateActionQueryParams({
|
|
319
|
+
actionName: listLayoutAttrs.createAction.name,
|
|
320
|
+
actionType: listLayoutAttrs.createAction.type,
|
|
321
|
+
actionContext: listLayoutAttrs.createAction.context,
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
if (listLayoutAttrs?.editAction) {
|
|
325
|
+
setEditActionQueryParams({
|
|
326
|
+
actionName: listLayoutAttrs.editAction.name,
|
|
327
|
+
actionType: listLayoutAttrs.editAction.type,
|
|
328
|
+
actionContext: listLayoutAttrs.editAction.context,
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// const viewModes = listLayoutAttrs?.allowedViews && listLayoutAttrs?.allowedViews.length > 0 && listLayoutAttrs?.allowedViews.map((view: any) => { return { label: capitalize(view), value: view }; });
|
|
333
|
+
setViewModes(solidTreeViewMetaData?.data?.viewModes);
|
|
334
|
+
if (createActionUrl) {
|
|
335
|
+
setCreateButtonUrl(createActionUrl);
|
|
336
|
+
}
|
|
337
|
+
if (editActionUrl) {
|
|
338
|
+
setEditButtonUrl(editActionUrl);
|
|
339
|
+
}
|
|
340
|
+
setIsDraftPublishWorkflowEnabled(solidTreeViewMetaData?.data?.solidView?.model?.draftPublishWorkflow === true);
|
|
341
|
+
}
|
|
342
|
+
}, [solidTreeViewLayout]);
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
const editBaseUrl = useMemo(
|
|
347
|
+
() => normalizeSolidListTreeKanbanActionPath(pathname, editButtonUrl || "form"),
|
|
348
|
+
[editButtonUrl, pathname]
|
|
349
|
+
);
|
|
350
|
+
|
|
351
|
+
const [
|
|
352
|
+
deleteSolidSingleEntiry,
|
|
353
|
+
{ isSuccess: isDeleteSolidSingleEntitySuccess },
|
|
354
|
+
] = useDeleteSolidEntityMutation();
|
|
355
|
+
|
|
356
|
+
// Delete mutation
|
|
357
|
+
const [
|
|
358
|
+
deleteManySolidEntities,
|
|
359
|
+
{
|
|
360
|
+
isLoading: isSolidEntitiesDeleted,
|
|
361
|
+
isSuccess: isDeleteSolidEntitiesSucess,
|
|
362
|
+
isError: isSolidEntitiesDeleteError,
|
|
363
|
+
error: SolidEntitiesDeleteError,
|
|
364
|
+
data: DeletedSolidEntities,
|
|
365
|
+
},
|
|
366
|
+
] = useDeleteMultipleSolidEntitiesMutation();
|
|
367
|
+
|
|
368
|
+
|
|
293
369
|
|
|
294
370
|
const treeViewTitle = solidTreeViewMetaData?.data?.solidView?.displayName;
|
|
295
371
|
|
|
@@ -1228,7 +1304,7 @@ export const SolidTreeView = forwardRef<SolidTreeViewHandle, SolidTreeViewParams
|
|
|
1228
1304
|
const rootHasPrev = hasPrev("root");
|
|
1229
1305
|
const rootHasNext = hasNext("root");
|
|
1230
1306
|
|
|
1231
|
-
if (!rootHasPrev && !rootHasNext) return null;
|
|
1307
|
+
// if (!rootHasPrev && !rootHasNext) return null;
|
|
1232
1308
|
|
|
1233
1309
|
return (
|
|
1234
1310
|
<div style={{ width: "100%", display: "flex", alignItems: "center", justifyContent: "space-between", borderTop: "1px solid var(--surface-border)" }}>
|
|
@@ -1303,6 +1379,216 @@ export const SolidTreeView = forwardRef<SolidTreeViewHandle, SolidTreeViewParams
|
|
|
1303
1379
|
}),
|
|
1304
1380
|
}), [filters, filterPredicates, params.customFilter, treeLoading, treeNodes, paginationMap]);
|
|
1305
1381
|
|
|
1382
|
+
|
|
1383
|
+
const handleCustomButtonClick = useHandleListCustomButtonClick();
|
|
1384
|
+
|
|
1385
|
+
|
|
1386
|
+
|
|
1387
|
+
const [selectedSolidViewData, setSelectedSolidViewData] = useState<any>();
|
|
1388
|
+
const selectedDataRef = useRef<any>();
|
|
1389
|
+
const op = useRef<any>(null);
|
|
1390
|
+
const [deleteEntity, setDeleteEntity] = useState(false);
|
|
1391
|
+
|
|
1392
|
+
const hasEditInContextMenu = actionsAllowed.includes(`${permissionExpression(params.modelName, 'update')}`) &&
|
|
1393
|
+
solidTreeViewLayout?.attrs?.edit !== false &&
|
|
1394
|
+
solidTreeViewLayout?.attrs?.showDefaultEditButton !== false &&
|
|
1395
|
+
solidTreeViewLayout?.attrs?.showRowEditInContextMenu !== false &&
|
|
1396
|
+
!(isDraftPublishWorkflowEnabled && selectedDataRef.current?.publishedAt);
|
|
1397
|
+
|
|
1398
|
+
const hasDeleteInContextMenu = actionsAllowed.includes(`${permissionExpression(params.modelName, 'delete')}`) &&
|
|
1399
|
+
solidTreeViewLayout?.attrs?.delete !== false &&
|
|
1400
|
+
solidTreeViewLayout?.attrs?.showRowDeleteInContextMenu !== false &&
|
|
1401
|
+
!(isDraftPublishWorkflowEnabled && selectedDataRef.current?.publishedAt);
|
|
1402
|
+
|
|
1403
|
+
const hasCustomContextMenuButtons =
|
|
1404
|
+
solidTreeViewLayout?.attrs?.rowButtons?.some(
|
|
1405
|
+
(rb: any) => rb?.attrs?.actionInContextMenu === true
|
|
1406
|
+
);
|
|
1407
|
+
|
|
1408
|
+
const hasAnyContextMenuActions =
|
|
1409
|
+
hasEditInContextMenu || hasDeleteInContextMenu || hasCustomContextMenuButtons;
|
|
1410
|
+
|
|
1411
|
+
|
|
1412
|
+
const detailsBodyTemplate = (solidViewData: any) => {
|
|
1413
|
+
return (
|
|
1414
|
+
<div>
|
|
1415
|
+
<Button
|
|
1416
|
+
type="button"
|
|
1417
|
+
text
|
|
1418
|
+
size="small"
|
|
1419
|
+
className=""
|
|
1420
|
+
onClick={(e) =>
|
|
1421
|
+
// @ts-ignore
|
|
1422
|
+
{
|
|
1423
|
+
e.stopPropagation();
|
|
1424
|
+
selectedDataRef.current = solidViewData;
|
|
1425
|
+
setSelectedSolidViewData(solidViewData);
|
|
1426
|
+
op.current?.toggle(e)
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
>
|
|
1430
|
+
<svg
|
|
1431
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1432
|
+
width="3"
|
|
1433
|
+
height="10"
|
|
1434
|
+
viewBox="0 0 4 16"
|
|
1435
|
+
fill="none"
|
|
1436
|
+
>
|
|
1437
|
+
<path
|
|
1438
|
+
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"
|
|
1439
|
+
fill="#666666"
|
|
1440
|
+
/>
|
|
1441
|
+
</svg>
|
|
1442
|
+
</Button>
|
|
1443
|
+
</div>
|
|
1444
|
+
);
|
|
1445
|
+
};
|
|
1446
|
+
|
|
1447
|
+
|
|
1448
|
+
const handleDeleteEntity = async () => {
|
|
1449
|
+
try {
|
|
1450
|
+
if (!selectedSolidViewData?.id) {
|
|
1451
|
+
throw new Error(ERROR_MESSAGES.NO_ENTITY_SELECTED);
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
const response: any = await deleteSolidSingleEntiry(selectedSolidViewData.id);
|
|
1455
|
+
|
|
1456
|
+
if (response?.data?.statusCode === 200) {
|
|
1457
|
+
setDeleteEntity(false);
|
|
1458
|
+
toast.current?.show({
|
|
1459
|
+
severity: "success",
|
|
1460
|
+
summary: ERROR_MESSAGES.DELETED,
|
|
1461
|
+
detail: ERROR_MESSAGES.ENTITY_DELETE,
|
|
1462
|
+
life: 3000,
|
|
1463
|
+
});
|
|
1464
|
+
} else {
|
|
1465
|
+
toast.current?.show({
|
|
1466
|
+
severity: "error",
|
|
1467
|
+
summary: ERROR_MESSAGES.DELETE_FAIELD,
|
|
1468
|
+
detail: response?.error?.data?.error,
|
|
1469
|
+
sticky: true, // stays until user closes
|
|
1470
|
+
});
|
|
1471
|
+
}
|
|
1472
|
+
} catch (error: any) {
|
|
1473
|
+
toast.current?.show({
|
|
1474
|
+
severity: "error",
|
|
1475
|
+
summary: ERROR_MESSAGES.DELETE_FAIELD,
|
|
1476
|
+
detail: ERROR_MESSAGES.SOMETHING_WRONG,
|
|
1477
|
+
sticky: true, // stays until user closes
|
|
1478
|
+
|
|
1479
|
+
});
|
|
1480
|
+
}
|
|
1481
|
+
};
|
|
1482
|
+
|
|
1483
|
+
const renderRowActions = (rowData: any) => {
|
|
1484
|
+
return (
|
|
1485
|
+
<div className="flex align-items-center justify-content-end gap-1">
|
|
1486
|
+
|
|
1487
|
+
{/* ---------------- CUSTOM ROW BUTTONS ---------------- */}
|
|
1488
|
+
{solidTreeViewLayout?.attrs?.rowButtons &&
|
|
1489
|
+
solidTreeViewLayout?.attrs?.rowButtons
|
|
1490
|
+
.filter((rb: any) => {
|
|
1491
|
+
const roles = rb?.attrs?.roles || [];
|
|
1492
|
+
const isInContextMenu = rb.attrs.actionInContextMenu === true;
|
|
1493
|
+
|
|
1494
|
+
const isAllowed =
|
|
1495
|
+
roles.length === 0 || hasAnyRole(user?.roles, roles);
|
|
1496
|
+
|
|
1497
|
+
const isVisible = rb?.attrs?.visible !== false;
|
|
1498
|
+
|
|
1499
|
+
return !isInContextMenu && isAllowed && isVisible;
|
|
1500
|
+
})
|
|
1501
|
+
.map((button: any, index: number) => (
|
|
1502
|
+
<Button
|
|
1503
|
+
key={index}
|
|
1504
|
+
type="button"
|
|
1505
|
+
icon={button?.attrs?.icon ?? "pi pi-pencil"}
|
|
1506
|
+
className={`gap-2 ${button?.attrs?.className ?? ""}`}
|
|
1507
|
+
label={
|
|
1508
|
+
button.attrs.showLabel !== false
|
|
1509
|
+
? button.attrs.label
|
|
1510
|
+
: ""
|
|
1511
|
+
}
|
|
1512
|
+
size="small"
|
|
1513
|
+
iconPos="left"
|
|
1514
|
+
onClick={() => {
|
|
1515
|
+
const event = {
|
|
1516
|
+
params,
|
|
1517
|
+
rowData: rowData,
|
|
1518
|
+
solidListViewMetaData: solidTreeViewMetaData?.data,
|
|
1519
|
+
};
|
|
1520
|
+
handleCustomButtonClick(button.attrs, event);
|
|
1521
|
+
}}
|
|
1522
|
+
/>
|
|
1523
|
+
))}
|
|
1524
|
+
|
|
1525
|
+
{/* ---------------- EDIT BUTTON ---------------- */}
|
|
1526
|
+
{actionsAllowed.includes(
|
|
1527
|
+
`${permissionExpression(params.modelName, "update")}`
|
|
1528
|
+
) &&
|
|
1529
|
+
solidTreeViewLayout?.attrs?.edit !== false &&
|
|
1530
|
+
solidTreeViewLayout?.attrs?.showRowEditInContextMenu === false && (
|
|
1531
|
+
<Button
|
|
1532
|
+
text
|
|
1533
|
+
severity="secondary"
|
|
1534
|
+
size="small"
|
|
1535
|
+
icon="pi pi-pencil"
|
|
1536
|
+
onClick={() => {
|
|
1537
|
+
// if (params.embeded == true) {
|
|
1538
|
+
// params.handleEditClickForEmbeddedView(rowData?.id);
|
|
1539
|
+
// } else {
|
|
1540
|
+
try {
|
|
1541
|
+
sessionStorage.setItem("fromView", "list");
|
|
1542
|
+
sessionStorage.setItem(
|
|
1543
|
+
"fromViewUrl",
|
|
1544
|
+
window.location.pathname + window.location.search
|
|
1545
|
+
);
|
|
1546
|
+
} catch (e) { }
|
|
1547
|
+
|
|
1548
|
+
router.push(
|
|
1549
|
+
`${editBaseUrl}/${rowData?.id}?viewMode=edit&${new URLSearchParams(
|
|
1550
|
+
editActionQueryParams
|
|
1551
|
+
).toString()}`
|
|
1552
|
+
);
|
|
1553
|
+
// }
|
|
1554
|
+
}}
|
|
1555
|
+
/>
|
|
1556
|
+
)}
|
|
1557
|
+
|
|
1558
|
+
{/* ---------------- DELETE BUTTON ---------------- */}
|
|
1559
|
+
{actionsAllowed.includes(
|
|
1560
|
+
`${permissionExpression(params.modelName, "delete")}`
|
|
1561
|
+
) &&
|
|
1562
|
+
solidTreeViewLayout?.attrs?.delete !== false &&
|
|
1563
|
+
(params.embeded ||
|
|
1564
|
+
(solidTreeViewLayout?.attrs?.showRowDeleteInContextMenu !==
|
|
1565
|
+
undefined &&
|
|
1566
|
+
solidTreeViewLayout?.attrs?.showRowDeleteInContextMenu !==
|
|
1567
|
+
true)) && (
|
|
1568
|
+
<Button
|
|
1569
|
+
text
|
|
1570
|
+
size="small"
|
|
1571
|
+
severity="danger"
|
|
1572
|
+
icon="pi pi-trash"
|
|
1573
|
+
onClick={() => {
|
|
1574
|
+
// if (
|
|
1575
|
+
// params?.embededFieldRelationType === "many-to-many"
|
|
1576
|
+
// ) {
|
|
1577
|
+
// params?.handleDeleteClick(rowData.id);
|
|
1578
|
+
// } else {
|
|
1579
|
+
setSelectedSolidViewData(rowData);
|
|
1580
|
+
setDeleteEntity(true);
|
|
1581
|
+
// }
|
|
1582
|
+
}}
|
|
1583
|
+
/>
|
|
1584
|
+
)}
|
|
1585
|
+
|
|
1586
|
+
{/* ---------------- CONTEXT MENU ---------------- */}
|
|
1587
|
+
{hasAnyContextMenuActions && detailsBodyTemplate(rowData)}
|
|
1588
|
+
</div>
|
|
1589
|
+
);
|
|
1590
|
+
};
|
|
1591
|
+
|
|
1306
1592
|
// ─── Render ───────────────────────────────────────────────────────────────
|
|
1307
1593
|
|
|
1308
1594
|
return (
|
|
@@ -1474,7 +1760,45 @@ export const SolidTreeView = forwardRef<SolidTreeViewHandle, SolidTreeViewParams
|
|
|
1474
1760
|
setSortField(e.sortField);
|
|
1475
1761
|
setSortOrder(e.sortOrder as any);
|
|
1476
1762
|
}}
|
|
1763
|
+
onRowClick={(e) => {
|
|
1764
|
+
const target = e.originalEvent.target as HTMLElement;
|
|
1765
|
+
if (target.closest(".p-checkbox")) return;
|
|
1766
|
+
if (target.closest(".p-c")) return;
|
|
1767
|
+
|
|
1768
|
+
if (e.node.leaf !== true) return;
|
|
1769
|
+
const rowData = e.node.data;
|
|
1770
|
+
|
|
1771
|
+
if (solidTreeViewLayout?.attrs?.disableRowClick === true) return;
|
|
1772
|
+
|
|
1773
|
+
const hasFindPermission = actionsAllowed.includes(
|
|
1774
|
+
permissionExpression(params.modelName, 'findOne')
|
|
1775
|
+
);
|
|
1776
|
+
const hasUpdatePermission =
|
|
1777
|
+
actionsAllowed.includes(permissionExpression(params.modelName, 'update')) &&
|
|
1778
|
+
solidTreeViewLayout?.attrs?.edit !== false;
|
|
1779
|
+
|
|
1780
|
+
if (!(hasFindPermission || hasUpdatePermission)) return;
|
|
1781
|
+
|
|
1782
|
+
// if (params.embeded === true) {
|
|
1783
|
+
// params.handleEditClickForEmbeddedView(rowData?.id);
|
|
1784
|
+
// } else {
|
|
1785
|
+
if (typeof window !== "undefined") {
|
|
1786
|
+
// store a simple marker for the caller
|
|
1787
|
+
|
|
1788
|
+
// also store the full current URL so Back can restore exact state (including action params)
|
|
1789
|
+
try {
|
|
1790
|
+
sessionStorage.setItem("fromView", "list");
|
|
1791
|
+
sessionStorage.setItem("fromViewUrl", window.location.pathname + window.location.search);
|
|
1792
|
+
} catch (e) {
|
|
1793
|
+
// ignore storage errors
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
router.push(`${editBaseUrl}/${rowData?.id}?viewMode=view&${new URLSearchParams(editActionQueryParams).toString()}`);
|
|
1797
|
+
// }
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1477
1800
|
onSelectionChange={(e) => {
|
|
1801
|
+
e.originalEvent.stopPropagation();
|
|
1478
1802
|
const incoming = e.value as Record<string, any>;
|
|
1479
1803
|
|
|
1480
1804
|
setSelectedNodeKeys((prev: any) => {
|
|
@@ -1516,8 +1840,13 @@ export const SolidTreeView = forwardRef<SolidTreeViewHandle, SolidTreeViewParams
|
|
|
1516
1840
|
body={(node: any) => {
|
|
1517
1841
|
const rowData = node?.data as TreeRowData;
|
|
1518
1842
|
const nodeMeta = rowData?.__treeMeta;
|
|
1519
|
-
if (nodeMeta?.nodeType !== "group") return <span> </span>;
|
|
1520
1843
|
|
|
1844
|
+
// ---------------- NORMAL ROW ----------------
|
|
1845
|
+
if (nodeMeta?.nodeType !== "group") {
|
|
1846
|
+
return renderRowActions(rowData);
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
// ---------------- GROUP ROW ----------------
|
|
1521
1850
|
const nodeKey = String(node.key);
|
|
1522
1851
|
const isExpanded = expandedKeys[nodeKey];
|
|
1523
1852
|
const childrenLoaded = isExpanded && node.children && node.children.length > 0;
|
|
@@ -1585,6 +1914,40 @@ export const SolidTreeView = forwardRef<SolidTreeViewHandle, SolidTreeViewParams
|
|
|
1585
1914
|
{/* ── Root-level pagination bar ── */}
|
|
1586
1915
|
<RootPaginationBar />
|
|
1587
1916
|
|
|
1917
|
+
|
|
1918
|
+
|
|
1919
|
+
|
|
1920
|
+
<Dialog
|
|
1921
|
+
header={`Delete ${solidTreeViewMetaData?.data?.solidView?.model?.displayName
|
|
1922
|
+
? solidTreeViewMetaData?.data?.solidView?.model?.displayName
|
|
1923
|
+
: params?.modelName
|
|
1924
|
+
}`}
|
|
1925
|
+
headerClassName="py-2"
|
|
1926
|
+
contentClassName="px-0 pb-0"
|
|
1927
|
+
visible={deleteEntity}
|
|
1928
|
+
style={{ width: "20vw" }}
|
|
1929
|
+
onHide={() => {
|
|
1930
|
+
if (!deleteEntity) return;
|
|
1931
|
+
setDeleteEntity(false);
|
|
1932
|
+
}}
|
|
1933
|
+
className="solid-confirm-dialog"
|
|
1934
|
+
>
|
|
1935
|
+
<Divider className="m-0" />
|
|
1936
|
+
<div className="p-4">
|
|
1937
|
+
<p className="m-0 solid-primary-title" style={{ fontSize: 16 }}>
|
|
1938
|
+
{`Are you sure you want to delete this ${solidTreeViewMetaData?.data?.solidView?.model?.displayName
|
|
1939
|
+
? solidTreeViewMetaData?.data?.solidView?.model?.displayName
|
|
1940
|
+
: params?.modelName
|
|
1941
|
+
}?`}
|
|
1942
|
+
</p>
|
|
1943
|
+
{/* <p className="" style={{ color: 'var{--solid-grey-500}' }}>{selectedSolidViewData?.singularName}</p> */}
|
|
1944
|
+
<div className="flex align-items-center gap-2 mt-3">
|
|
1945
|
+
<Button label="Delete" severity="danger" size="small" onClick={handleDeleteEntity} />
|
|
1946
|
+
<Button label="Cancel" size="small" onClick={() => setDeleteEntity(false)} outlined className='bg-primary-reverse' />
|
|
1947
|
+
</div>
|
|
1948
|
+
</div>
|
|
1949
|
+
</Dialog>
|
|
1950
|
+
|
|
1588
1951
|
{/* ── Delete dialog ── */}
|
|
1589
1952
|
<Dialog
|
|
1590
1953
|
visible={isDeleteRecordsDialogVisible}
|
|
@@ -1630,6 +1993,75 @@ export const SolidTreeView = forwardRef<SolidTreeViewHandle, SolidTreeViewParams
|
|
|
1630
1993
|
<p>Are you sure you want to recover all records?</p>
|
|
1631
1994
|
</Dialog>
|
|
1632
1995
|
|
|
1996
|
+
<OverlayPanel
|
|
1997
|
+
ref={op}
|
|
1998
|
+
className="solid-custom-overlay"
|
|
1999
|
+
style={{ top: 10, minWidth: 120 }}
|
|
2000
|
+
>
|
|
2001
|
+
<div className="flex flex-column gap-1 p-1">
|
|
2002
|
+
{hasEditInContextMenu && (
|
|
2003
|
+
<Button
|
|
2004
|
+
type="button"
|
|
2005
|
+
className="w-full text-left gap-1"
|
|
2006
|
+
label="Edit"
|
|
2007
|
+
size="small"
|
|
2008
|
+
iconPos="left"
|
|
2009
|
+
icon={"pi pi-pencil"}
|
|
2010
|
+
onClick={() => {
|
|
2011
|
+
// if (params.embeded == true) {
|
|
2012
|
+
// params.handleEditClickForEmbeddedView(
|
|
2013
|
+
// selectedDataRef.current?.id
|
|
2014
|
+
// );
|
|
2015
|
+
// } else {
|
|
2016
|
+
try {
|
|
2017
|
+
sessionStorage.setItem("fromView", "list");
|
|
2018
|
+
sessionStorage.setItem("fromViewUrl", window.location.pathname + window.location.search);
|
|
2019
|
+
} catch (e) { }
|
|
2020
|
+
router.push(
|
|
2021
|
+
`${editBaseUrl}/${selectedDataRef.current?.id}?viewMode=edit&${new URLSearchParams(editActionQueryParams).toString()}`
|
|
2022
|
+
);
|
|
2023
|
+
// }
|
|
2024
|
+
}}
|
|
2025
|
+
/>
|
|
2026
|
+
)}
|
|
2027
|
+
|
|
2028
|
+
{hasDeleteInContextMenu && !params.embeded && (
|
|
2029
|
+
<Button
|
|
2030
|
+
text
|
|
2031
|
+
type="button"
|
|
2032
|
+
className="w-full text-left gap-1"
|
|
2033
|
+
label="Delete"
|
|
2034
|
+
size="small"
|
|
2035
|
+
iconPos="left"
|
|
2036
|
+
severity="danger"
|
|
2037
|
+
icon={"pi pi-trash"}
|
|
2038
|
+
onClick={() => setDeleteEntity(true)}
|
|
2039
|
+
/>
|
|
2040
|
+
)}
|
|
2041
|
+
{hasCustomContextMenuButtons && solidTreeViewLayout?.attrs?.rowButtons
|
|
2042
|
+
?.filter(
|
|
2043
|
+
(rb: any) =>
|
|
2044
|
+
rb?.attrs?.actionInContextMenu === true &&
|
|
2045
|
+
rb?.attrs?.visible !== false
|
|
2046
|
+
)
|
|
2047
|
+
.map((button: any, index: number) => (
|
|
2048
|
+
<SolidListViewRowButtonContextMenu
|
|
2049
|
+
key={`${index}-${selectedDataRef?.current?.id || ''}`}
|
|
2050
|
+
button={button}
|
|
2051
|
+
params={params}
|
|
2052
|
+
getSelectedSolidViewData={() => selectedDataRef.current}
|
|
2053
|
+
// selectedSolidViewData={selectedSolidViewData}
|
|
2054
|
+
solidListViewMetaData={
|
|
2055
|
+
solidTreeViewMetaData
|
|
2056
|
+
}
|
|
2057
|
+
handleCustomButtonClick={
|
|
2058
|
+
handleCustomButtonClick
|
|
2059
|
+
}
|
|
2060
|
+
/>
|
|
2061
|
+
))}
|
|
2062
|
+
</div>
|
|
2063
|
+
</OverlayPanel>
|
|
2064
|
+
|
|
1633
2065
|
</div>
|
|
1634
2066
|
);
|
|
1635
2067
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdminTopHeader.d.ts","sourceRoot":"","sources":["../../../src/components/layout/AdminTopHeader.tsx"],"names":[],"mappings":"AAcA,eAAO,MAAM,cAAc,+CAwH1B,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useContext, useMemo } from "react";
|
|
3
|
+
import { usePathname } from "../../hooks/usePathname";
|
|
4
|
+
import { useSearchParams } from "../../hooks/useSearchParams";
|
|
5
|
+
import { useRouter } from "../../hooks/useRouter";
|
|
6
|
+
import { useGetSolidActionByIdQuery } from "../../redux/api/solidActionApi";
|
|
7
|
+
import { LayoutContext } from "./context/layoutcontext";
|
|
8
|
+
var SIDEBAR_TOGGLE_EVENT = "solidx:sidebar-toggle";
|
|
9
|
+
var toLabel = function (value) {
|
|
10
|
+
return decodeURIComponent(value)
|
|
11
|
+
.replace(/[-_]/g, " ")
|
|
12
|
+
.replace(/\b\w/g, function (m) { return m.toUpperCase(); });
|
|
13
|
+
};
|
|
14
|
+
export var AdminTopHeader = function () {
|
|
15
|
+
var pathname = usePathname();
|
|
16
|
+
var searchParams = useSearchParams();
|
|
17
|
+
var router = useRouter();
|
|
18
|
+
var toggleThemeMode = useContext(LayoutContext).toggleThemeMode;
|
|
19
|
+
// We treat actionId as the source of truth for breadcrumb labels.
|
|
20
|
+
// If present, we resolve module/model/action via action-metadata API
|
|
21
|
+
// so breadcrumbs are consistent across list/form/tree/kanban pages.
|
|
22
|
+
var actionId = searchParams.get("actionId");
|
|
23
|
+
var actionResponse = useGetSolidActionByIdQuery(actionId, {
|
|
24
|
+
skip: !actionId,
|
|
25
|
+
}).data;
|
|
26
|
+
var crumbs = useMemo(function () {
|
|
27
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
28
|
+
// API response shapes vary by adapter layer, so normalize defensively.
|
|
29
|
+
var actionData = (_c = (_b = (_a = actionResponse === null || actionResponse === void 0 ? void 0 : actionResponse.data) === null || _a === void 0 ? void 0 : _a.data) !== null && _b !== void 0 ? _b : actionResponse === null || actionResponse === void 0 ? void 0 : actionResponse.data) !== null && _c !== void 0 ? _c : actionResponse;
|
|
30
|
+
var moduleFromApi = ((_d = actionData === null || actionData === void 0 ? void 0 : actionData.module) === null || _d === void 0 ? void 0 : _d.displayName) || ((_e = actionData === null || actionData === void 0 ? void 0 : actionData.module) === null || _e === void 0 ? void 0 : _e.name);
|
|
31
|
+
var modelFromApi = ((_f = actionData === null || actionData === void 0 ? void 0 : actionData.model) === null || _f === void 0 ? void 0 : _f.displayName) || ((_g = actionData === null || actionData === void 0 ? void 0 : actionData.model) === null || _g === void 0 ? void 0 : _g.name);
|
|
32
|
+
var actionFromApi = (actionData === null || actionData === void 0 ? void 0 : actionData.displayName) || (actionData === null || actionData === void 0 ? void 0 : actionData.name);
|
|
33
|
+
var actionDataId = (actionData === null || actionData === void 0 ? void 0 : actionData.id) != null ? String(actionData.id) : null;
|
|
34
|
+
var hasMatchingActionData = Boolean(actionId) && actionDataId === actionId;
|
|
35
|
+
// Priority 1: exact business breadcrumb contract requested:
|
|
36
|
+
// <module> > <model> > <action>.
|
|
37
|
+
// We only trust API crumbs when they belong to the current URL's actionId.
|
|
38
|
+
// This avoids stale list breadcrumbs bleeding into form routes that do not
|
|
39
|
+
// carry actionId in their query string.
|
|
40
|
+
if (hasMatchingActionData && (moduleFromApi || modelFromApi || actionFromApi)) {
|
|
41
|
+
return [moduleFromApi, modelFromApi, actionFromApi].filter(Boolean);
|
|
42
|
+
}
|
|
43
|
+
var segments = pathname.split("/").filter(Boolean);
|
|
44
|
+
// Priority 2: derive from route segments when API data is unavailable.
|
|
45
|
+
// This is intentionally ahead of query fallback so form pages don't
|
|
46
|
+
// inherit stale list query labels after list -> form navigation.
|
|
47
|
+
if (segments[0] === "admin" && segments[1] === "core") {
|
|
48
|
+
var moduleName = segments[2];
|
|
49
|
+
var modelName = segments[3];
|
|
50
|
+
var viewName = segments[4];
|
|
51
|
+
var next = [moduleName, modelName, viewName].filter(Boolean).map(function (item) { return toLabel(item); });
|
|
52
|
+
return next.length ? next : ["Admin"];
|
|
53
|
+
}
|
|
54
|
+
var menuItemName = searchParams.get("menuItemName");
|
|
55
|
+
var actionName = searchParams.get("actionName");
|
|
56
|
+
// Priority 3: legacy URL-query fallback for older links/pages.
|
|
57
|
+
if (menuItemName || actionName) {
|
|
58
|
+
return [menuItemName, actionName].filter(Boolean).map(function (item) { return toLabel(item); });
|
|
59
|
+
}
|
|
60
|
+
return ["Admin"];
|
|
61
|
+
}, [actionId, actionResponse, pathname, searchParams]);
|
|
62
|
+
var showBack = /\/admin\/core\/[^/]+\/[^/]+\/form\/[^/]+/.test(pathname);
|
|
63
|
+
var triggerSidebar = function () {
|
|
64
|
+
window.dispatchEvent(new CustomEvent(SIDEBAR_TOGGLE_EVENT));
|
|
65
|
+
};
|
|
66
|
+
return (_jsx("header", { className: "solid-admin-header", children: _jsxs("div", { className: "solid-admin-header-inner", children: [_jsx("button", { type: "button", className: "solid-admin-sidebar-trigger", onClick: triggerSidebar, "aria-label": "Toggle sidebar", children: _jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [_jsx("rect", { x: "1.5", y: "2", width: "13", height: "12", rx: "2", stroke: "currentColor" }), _jsx("path", { d: "M5.5 2V14", stroke: "currentColor" }), _jsx("rect", { x: "8", y: "5.25", width: "4.5", height: "5.5", rx: "0.9", stroke: "currentColor" })] }) }), _jsx("div", { className: "solid-admin-header-sep" }), _jsx("nav", { className: "solid-admin-breadcrumbs", "aria-label": "Breadcrumb", children: crumbs.map(function (crumb, index) { return (_jsxs("span", { className: "solid-admin-crumb", children: [index > 0 && _jsx("span", { className: "solid-admin-crumb-sep", children: "\u203A" }), _jsx("span", { children: crumb })] }, "".concat(crumb, "-").concat(index))); }) }), _jsxs("div", { className: "solid-admin-header-actions", children: [_jsxs("button", { type: "button", className: "solid-admin-theme-toggle", onClick: toggleThemeMode, "aria-label": "Toggle theme", title: "Toggle theme", children: [_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [_jsx("path", { d: "M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M12 3l0 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M12 9l4.65 -4.65", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M12 14.3l7.37 -7.37", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M12 19.6l8.85 -8.85", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] }), _jsx("span", { className: "solid-sr-only", children: "Toggle theme" })] }), showBack && (_jsx("button", { type: "button", className: "solid-admin-back-btn", onClick: function () { return router.back(); }, "aria-label": "Go back", children: "Back" }))] })] }) }));
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=AdminTopHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdminTopHeader.js","sourceRoot":"","sources":["../../../src/components/layout/AdminTopHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,IAAM,oBAAoB,GAAG,uBAAuB,CAAC;AAErD,IAAM,OAAO,GAAG,UAAC,KAAa;IAC5B,OAAA,kBAAkB,CAAC,KAAK,CAAC;SACtB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;SACrB,OAAO,CAAC,OAAO,EAAE,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,WAAW,EAAE,EAAf,CAAe,CAAC;AAF3C,CAE2C,CAAC;AAE9C,MAAM,CAAC,IAAM,cAAc,GAAG;IAC5B,IAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,IAAM,YAAY,GAAG,eAAe,EAAE,CAAC;IACvC,IAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC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ACX,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,sBAAsB,EAChC,OAAO,EAAE,cAAM,OAAA,MAAM,CAAC,IAAI,EAAE,EAAb,CAAa,gBACjB,SAAS,qBAGb,CACV,IACG,IACF,GACC,CACV,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { useContext, useMemo } from \"react\";\nimport { usePathname } from \"../../hooks/usePathname\";\nimport { useSearchParams } from \"../../hooks/useSearchParams\";\nimport { useRouter } from \"../../hooks/useRouter\";\nimport { useGetSolidActionByIdQuery } from \"../../redux/api/solidActionApi\";\nimport { LayoutContext } from \"./context/layoutcontext\";\n\nconst SIDEBAR_TOGGLE_EVENT = \"solidx:sidebar-toggle\";\n\nconst toLabel = (value: string) =>\n decodeURIComponent(value)\n .replace(/[-_]/g, \" \")\n .replace(/\\b\\w/g, (m) => m.toUpperCase());\n\nexport const AdminTopHeader = () => {\n const pathname = usePathname();\n const searchParams = useSearchParams();\n const router = useRouter();\n const { toggleThemeMode } = useContext(LayoutContext);\n\n // We treat actionId as the source of truth for breadcrumb labels.\n // If present, we resolve module/model/action via action-metadata API\n // so breadcrumbs are consistent across list/form/tree/kanban pages.\n const actionId = searchParams.get(\"actionId\");\n const { data: actionResponse } = useGetSolidActionByIdQuery(actionId as string, {\n skip: !actionId,\n });\n\n const crumbs = useMemo(() => {\n // API response shapes vary by adapter layer, so normalize defensively.\n const actionData = actionResponse?.data?.data ?? actionResponse?.data ?? actionResponse;\n const moduleFromApi = actionData?.module?.displayName || actionData?.module?.name;\n const modelFromApi = actionData?.model?.displayName || actionData?.model?.name;\n const actionFromApi = actionData?.displayName || actionData?.name;\n const actionDataId = actionData?.id != null ? String(actionData.id) : null;\n const hasMatchingActionData = Boolean(actionId) && actionDataId === actionId;\n\n // Priority 1: exact business breadcrumb contract requested:\n // <module> > <model> > <action>.\n // We only trust API crumbs when they belong to the current URL's actionId.\n // This avoids stale list breadcrumbs bleeding into form routes that do not\n // carry actionId in their query string.\n if (hasMatchingActionData && (moduleFromApi || modelFromApi || actionFromApi)) {\n return [moduleFromApi, modelFromApi, actionFromApi].filter(Boolean);\n }\n\n const segments = pathname.split(\"/\").filter(Boolean);\n // Priority 2: derive from route segments when API data is unavailable.\n // This is intentionally ahead of query fallback so form pages don't\n // inherit stale list query labels after list -> form navigation.\n if (segments[0] === \"admin\" && segments[1] === \"core\") {\n const moduleName = segments[2];\n const modelName = segments[3];\n const viewName = segments[4];\n const next = [moduleName, modelName, viewName].filter(Boolean).map((item) => toLabel(item!));\n return next.length ? next : [\"Admin\"];\n }\n\n const menuItemName = searchParams.get(\"menuItemName\");\n const actionName = searchParams.get(\"actionName\");\n\n // Priority 3: legacy URL-query fallback for older links/pages.\n if (menuItemName || actionName) {\n return [menuItemName, actionName].filter(Boolean).map((item) => toLabel(item!));\n }\n\n return [\"Admin\"];\n }, [actionId, actionResponse, pathname, searchParams]);\n\n const showBack = /\\/admin\\/core\\/[^/]+\\/[^/]+\\/form\\/[^/]+/.test(pathname);\n\n const triggerSidebar = () => {\n window.dispatchEvent(new CustomEvent(SIDEBAR_TOGGLE_EVENT));\n };\n\n return (\n <header className=\"solid-admin-header\">\n <div className=\"solid-admin-header-inner\">\n <button\n type=\"button\"\n className=\"solid-admin-sidebar-trigger\"\n onClick={triggerSidebar}\n aria-label=\"Toggle sidebar\"\n >\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\">\n <rect x=\"1.5\" y=\"2\" width=\"13\" height=\"12\" rx=\"2\" stroke=\"currentColor\" />\n <path d=\"M5.5 2V14\" stroke=\"currentColor\" />\n <rect x=\"8\" y=\"5.25\" width=\"4.5\" height=\"5.5\" rx=\"0.9\" stroke=\"currentColor\" />\n </svg>\n </button>\n\n <div className=\"solid-admin-header-sep\" />\n\n <nav className=\"solid-admin-breadcrumbs\" aria-label=\"Breadcrumb\">\n {crumbs.map((crumb, index) => (\n <span key={`${crumb}-${index}`} className=\"solid-admin-crumb\">\n {index > 0 && <span className=\"solid-admin-crumb-sep\">›</span>}\n <span>{crumb}</span>\n </span>\n ))}\n </nav>\n\n <div className=\"solid-admin-header-actions\">\n <button\n type=\"button\"\n className=\"solid-admin-theme-toggle\"\n onClick={toggleThemeMode}\n aria-label=\"Toggle theme\"\n title=\"Toggle theme\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n <path d=\"M12 3l0 18\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n <path d=\"M12 9l4.65 -4.65\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n <path d=\"M12 14.3l7.37 -7.37\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n <path d=\"M12 19.6l8.85 -8.85\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n <span className=\"solid-sr-only\">Toggle theme</span>\n </button>\n\n {showBack && (\n <button\n type=\"button\"\n className=\"solid-admin-back-btn\"\n onClick={() => router.back()}\n aria-label=\"Go back\"\n >\n Back\n </button>\n )}\n </div>\n </div>\n </header>\n );\n};\n"]}
|