@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
|
@@ -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
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const normalizeSolidListTreeKanbanActionPath: (currentPath: string, actionUrl: string) => string;
|
|
2
2
|
export declare const normalizeSolidFormActionPath: (currentPath: string, actionUrl: string) => string;
|
|
3
3
|
//# sourceMappingURL=routePaths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routePaths.d.ts","sourceRoot":"","sources":["../../src/helpers/routePaths.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"routePaths.d.ts","sourceRoot":"","sources":["../../src/helpers/routePaths.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sCAAsC,gBAAiB,MAAM,aAAa,MAAM,WAW5F,CAAC;AAEF,eAAO,MAAM,4BAA4B,gBAAiB,MAAM,aAAa,MAAM,WAWlF,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export var
|
|
1
|
+
export var normalizeSolidListTreeKanbanActionPath = function (currentPath, actionUrl) {
|
|
2
2
|
if (!actionUrl)
|
|
3
3
|
return "";
|
|
4
4
|
if (actionUrl.startsWith("http") || actionUrl.startsWith("/")) {
|
|
5
5
|
return actionUrl;
|
|
6
6
|
}
|
|
7
|
-
var basePath = currentPath.replace(/\/(list|kanban)(\/)?$/, "");
|
|
7
|
+
var basePath = currentPath.replace(/\/(list|tree|kanban)(\/)?$/, "");
|
|
8
8
|
var normalizedBase = basePath.length > 0 ? basePath : "/";
|
|
9
9
|
var actionTrimmed = actionUrl.replace(/^\/+/, "");
|
|
10
10
|
return "".concat(normalizedBase.replace(/\/+$/, ""), "/").concat(actionTrimmed);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routePaths.js","sourceRoot":"","sources":["../../src/helpers/routePaths.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,
|
|
1
|
+
{"version":3,"file":"routePaths.js","sourceRoot":"","sources":["../../src/helpers/routePaths.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,sCAAsC,GAAG,UAAC,WAAmB,EAAE,SAAiB;IAC3F,IAAI,CAAC,SAAS;QAAE,OAAO,EAAE,CAAC;IAC1B,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAC7D,OAAO,SAAS,CAAC;KAClB;IAED,IAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,4BAA4B,EAAE,EAAE,CAAC,CAAC;IACvE,IAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC;IAC5D,IAAM,aAAa,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAEpD,OAAO,UAAG,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,cAAI,aAAa,CAAE,CAAC;AAClE,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,4BAA4B,GAAG,UAAC,WAAmB,EAAE,SAAiB;IACjF,IAAI,CAAC,SAAS;QAAE,OAAO,EAAE,CAAC;IAC1B,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAC7D,OAAO,SAAS,CAAC;KAClB;IAED,IAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,wBAAwB,EAAE,EAAE,CAAC,CAAC;IACnE,IAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC;IAC5D,IAAM,aAAa,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAEpD,OAAO,UAAG,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,cAAI,aAAa,CAAE,CAAC;AAClE,CAAC,CAAC","sourcesContent":["export const normalizeSolidListTreeKanbanActionPath = (currentPath: string, actionUrl: string) => {\n if (!actionUrl) return \"\";\n if (actionUrl.startsWith(\"http\") || actionUrl.startsWith(\"/\")) {\n return actionUrl;\n }\n\n const basePath = currentPath.replace(/\\/(list|tree|kanban)(\\/)?$/, \"\");\n const normalizedBase = basePath.length > 0 ? basePath : \"/\";\n const actionTrimmed = actionUrl.replace(/^\\/+/, \"\");\n\n return `${normalizedBase.replace(/\\/+$/, \"\")}/${actionTrimmed}`;\n};\n\nexport const normalizeSolidFormActionPath = (currentPath: string, actionUrl: string) => {\n if (!actionUrl) return \"\";\n if (actionUrl.startsWith(\"http\") || actionUrl.startsWith(\"/\")) {\n return actionUrl;\n }\n\n const basePath = currentPath.replace(/\\/form(\\/[^/]+)?(\\/)?$/, \"\");\n const normalizedBase = basePath.length > 0 ? basePath : \"/\";\n const actionTrimmed = actionUrl.replace(/^\\/+/, \"\");\n\n return `${normalizedBase.replace(/\\/+$/, \"\")}/${actionTrimmed}`;\n};\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const normalizeSolidListTreeKanbanActionPath = (currentPath: string, actionUrl: string) => {
|
|
2
2
|
if (!actionUrl) return "";
|
|
3
3
|
if (actionUrl.startsWith("http") || actionUrl.startsWith("/")) {
|
|
4
4
|
return actionUrl;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
const basePath = currentPath.replace(/\/(list|kanban)(\/)?$/, "");
|
|
7
|
+
const basePath = currentPath.replace(/\/(list|tree|kanban)(\/)?$/, "");
|
|
8
8
|
const normalizedBase = basePath.length > 0 ? basePath : "/";
|
|
9
9
|
const actionTrimmed = actionUrl.replace(/^\/+/, "");
|
|
10
10
|
|
|
@@ -3589,6 +3589,14 @@ flex-shrink: 0; */
|
|
|
3589
3589
|
padding: 0.25rem 0.25rem;
|
|
3590
3590
|
}
|
|
3591
3591
|
|
|
3592
|
+
.solid-treetable-wrapper .p-treetable .p-treetable-tbody>tr {
|
|
3593
|
+
cursor: pointer;
|
|
3594
|
+
}
|
|
3595
|
+
|
|
3596
|
+
.solid-treetable-wrapper .p-treetable .p-treetable-tbody>tr>td .p-treetable-toggler {
|
|
3597
|
+
height: 3rem;
|
|
3598
|
+
}
|
|
3599
|
+
|
|
3592
3600
|
.solid-treetable-wrapper .p-datatable .p-datatable-loading-overlay,
|
|
3593
3601
|
.solid-treetable-wrapper .p-treetable .p-treetable-loading-overlay {
|
|
3594
3602
|
background-color: rgba(0, 0, 0, 0.0);
|