@hybridcore/ui 1.5.64 → 1.5.66
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/instance-table/index.js +69 -57
- package/dist/constants/index.js +1 -0
- package/dist/main.d.ts +27 -3
- package/package.json +1 -1
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as o, Fragment as D, jsxs as Y } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as j } from "react";
|
|
3
|
-
import { DataGrid as
|
|
3
|
+
import { DataGrid as G, GridActionsCellItem as A } from "@mui/x-data-grid";
|
|
4
4
|
import { ButtonBase as B, Box as S } from "@mui/material";
|
|
5
5
|
import { DataGridActions as $ } from "./styled.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
const
|
|
9
|
-
template:
|
|
10
|
-
data:
|
|
11
|
-
selectedIds:
|
|
12
|
-
sortColumnsBy:
|
|
13
|
-
actions:
|
|
14
|
-
actionsWidth:
|
|
15
|
-
enableCheckboxSelection:
|
|
6
|
+
import i from "dayjs";
|
|
7
|
+
import E from "lodash";
|
|
8
|
+
const L = ({
|
|
9
|
+
template: n,
|
|
10
|
+
data: w,
|
|
11
|
+
selectedIds: M = [],
|
|
12
|
+
sortColumnsBy: N = "type",
|
|
13
|
+
actions: h,
|
|
14
|
+
actionsWidth: y = 50,
|
|
15
|
+
enableCheckboxSelection: R = !1,
|
|
16
16
|
fieldOptions: e,
|
|
17
|
-
onSelect:
|
|
18
|
-
onTitleClick:
|
|
17
|
+
onSelect: s,
|
|
18
|
+
onTitleClick: C
|
|
19
19
|
}) => {
|
|
20
|
-
const
|
|
21
|
-
var
|
|
20
|
+
const k = j(() => {
|
|
21
|
+
var l, c, d, g, v, b, x, I;
|
|
22
22
|
return [
|
|
23
|
-
...(
|
|
23
|
+
...(l = e == null ? void 0 : e.templateIcon) != null && l.hidden ? [] : [
|
|
24
24
|
{
|
|
25
25
|
field: "template",
|
|
26
26
|
headerName: "",
|
|
@@ -28,17 +28,17 @@ const K = ({
|
|
|
28
28
|
filterable: !1,
|
|
29
29
|
align: "center",
|
|
30
30
|
width: 30,
|
|
31
|
-
renderCell: (
|
|
31
|
+
renderCell: (c = e == null ? void 0 : e.templateIcon) != null && c.renderCell ? (d = e == null ? void 0 : e.templateIcon) == null ? void 0 : d.renderCell : () => n ? /* @__PURE__ */ o(
|
|
32
32
|
"img",
|
|
33
33
|
{
|
|
34
|
-
src:
|
|
34
|
+
src: n.icon,
|
|
35
35
|
height: 20,
|
|
36
36
|
style: { display: "inline", maxWidth: 20 }
|
|
37
37
|
}
|
|
38
|
-
) : /* @__PURE__ */
|
|
38
|
+
) : /* @__PURE__ */ o(D, {})
|
|
39
39
|
}
|
|
40
40
|
],
|
|
41
|
-
...(
|
|
41
|
+
...(g = e == null ? void 0 : e.title) != null && g.hidden ? [] : [
|
|
42
42
|
{
|
|
43
43
|
field: "title",
|
|
44
44
|
headerName: "Title",
|
|
@@ -46,21 +46,21 @@ const K = ({
|
|
|
46
46
|
sortable: !1,
|
|
47
47
|
filterable: !1,
|
|
48
48
|
valueGetter: (r) => r.row.title,
|
|
49
|
-
renderCell: (
|
|
50
|
-
const { row:
|
|
51
|
-
return
|
|
49
|
+
renderCell: (v = e == null ? void 0 : e.title) != null && v.renderCell ? (b = e == null ? void 0 : e.title) == null ? void 0 : b.renderCell : (r) => {
|
|
50
|
+
const { row: a, value: u } = r;
|
|
51
|
+
return C ? /* @__PURE__ */ o(
|
|
52
52
|
B,
|
|
53
53
|
{
|
|
54
|
-
onClick: () =>
|
|
54
|
+
onClick: () => C(a),
|
|
55
55
|
sx: { "&:hover": { textDecoration: "underline" } },
|
|
56
56
|
disableRipple: !0,
|
|
57
|
-
children:
|
|
57
|
+
children: u
|
|
58
58
|
}
|
|
59
|
-
) :
|
|
59
|
+
) : u;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
],
|
|
63
|
-
...(
|
|
63
|
+
...(x = e == null ? void 0 : e.description) != null && x.hidden ? [] : [
|
|
64
64
|
{
|
|
65
65
|
field: "description",
|
|
66
66
|
headerName: "Description",
|
|
@@ -71,78 +71,90 @@ const K = ({
|
|
|
71
71
|
renderCell: (I = e == null ? void 0 : e.description) == null ? void 0 : I.renderCell
|
|
72
72
|
}
|
|
73
73
|
],
|
|
74
|
-
...
|
|
75
|
-
...
|
|
74
|
+
...n ? [
|
|
75
|
+
...n.properties.filter(
|
|
76
76
|
(r) => (!e || !e[r.propertyId] || !e[r.propertyId].hidden) && r.visible && r.type !== "geometry" && r.type !== "coordinate"
|
|
77
77
|
).sort(
|
|
78
|
-
(r,
|
|
78
|
+
(r, a) => N === "type" ? r.type < a.type ? -1 : r.type > a.type ? 1 : 0 : r.name < a.name ? -1 : 1
|
|
79
79
|
).map((r) => {
|
|
80
|
-
var
|
|
81
|
-
const
|
|
80
|
+
var u;
|
|
81
|
+
const a = `variables.${r.type}.${r.propertyId}`;
|
|
82
82
|
return {
|
|
83
|
-
field:
|
|
83
|
+
field: a,
|
|
84
84
|
headerName: r.name,
|
|
85
85
|
sortable: !1,
|
|
86
86
|
filterable: !1,
|
|
87
87
|
width: 150,
|
|
88
|
-
valueFormatter: (
|
|
89
|
-
valueGetter: (
|
|
90
|
-
renderCell: e && ((
|
|
88
|
+
valueFormatter: (m) => m.value && r.type === "date" ? i(m.value).format("DD/MM/YYYY HH:mm") : m.value,
|
|
89
|
+
valueGetter: (m) => E.get(m.row, a),
|
|
90
|
+
renderCell: e && ((u = e[r.propertyId]) == null ? void 0 : u.renderCell)
|
|
91
91
|
};
|
|
92
92
|
})
|
|
93
93
|
] : []
|
|
94
94
|
];
|
|
95
|
-
}, [
|
|
96
|
-
|
|
97
|
-
}
|
|
95
|
+
}, [n]), F = (t) => {
|
|
96
|
+
s && s(t);
|
|
97
|
+
}, H = (t) => h ? h.map((l) => {
|
|
98
|
+
const { showInMenu: c, ...d } = l;
|
|
99
|
+
return /* @__PURE__ */ o(
|
|
100
|
+
A,
|
|
101
|
+
{
|
|
102
|
+
...d,
|
|
103
|
+
...c ? { showInMenu: c } : void 0,
|
|
104
|
+
onClick: () => {
|
|
105
|
+
l.onClick && l.onClick(t);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
}) : [];
|
|
98
110
|
return /* @__PURE__ */ Y(S, { position: "relative", children: [
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
|
|
111
|
+
/* @__PURE__ */ o(
|
|
112
|
+
G,
|
|
101
113
|
{
|
|
102
|
-
columns:
|
|
103
|
-
rows:
|
|
114
|
+
columns: k,
|
|
115
|
+
rows: w,
|
|
104
116
|
autoHeight: !0,
|
|
105
117
|
density: "compact",
|
|
106
118
|
sx: {
|
|
107
119
|
border: "none",
|
|
108
120
|
"& .MuiDataGrid-main": {
|
|
109
|
-
marginRight:
|
|
121
|
+
marginRight: h ? `${y}px` : 0
|
|
110
122
|
}
|
|
111
123
|
},
|
|
112
|
-
getRowId: (
|
|
124
|
+
getRowId: (t) => t.id,
|
|
113
125
|
hideFooterPagination: !0,
|
|
114
126
|
hideFooter: !0,
|
|
115
|
-
checkboxSelection:
|
|
116
|
-
rowSelectionModel:
|
|
117
|
-
onRowSelectionModelChange:
|
|
127
|
+
checkboxSelection: R,
|
|
128
|
+
rowSelectionModel: M,
|
|
129
|
+
onRowSelectionModelChange: F,
|
|
118
130
|
keepNonExistentRowsSelected: !0
|
|
119
131
|
}
|
|
120
132
|
),
|
|
121
|
-
|
|
122
|
-
|
|
133
|
+
h !== void 0 && /* @__PURE__ */ o($, { width: y, children: /* @__PURE__ */ o(
|
|
134
|
+
G,
|
|
123
135
|
{
|
|
124
136
|
columns: [
|
|
125
137
|
{
|
|
126
138
|
field: "actions",
|
|
127
139
|
type: "actions",
|
|
128
|
-
width:
|
|
140
|
+
width: y,
|
|
129
141
|
headerClassName: "pinned",
|
|
130
|
-
getActions:
|
|
142
|
+
getActions: H
|
|
131
143
|
}
|
|
132
144
|
],
|
|
133
|
-
rows:
|
|
145
|
+
rows: w,
|
|
134
146
|
autoHeight: !0,
|
|
135
147
|
density: "compact",
|
|
136
148
|
hideFooter: !0,
|
|
137
149
|
sx: { border: "none" },
|
|
138
150
|
slots: {
|
|
139
|
-
noRowsOverlay: () => /* @__PURE__ */
|
|
151
|
+
noRowsOverlay: () => /* @__PURE__ */ o(D, {})
|
|
140
152
|
},
|
|
141
|
-
getRowId: (
|
|
153
|
+
getRowId: (t) => t.id
|
|
142
154
|
}
|
|
143
155
|
) })
|
|
144
156
|
] });
|
|
145
157
|
};
|
|
146
158
|
export {
|
|
147
|
-
|
|
159
|
+
L as InstanceTable
|
|
148
160
|
};
|
package/dist/constants/index.js
CHANGED
package/dist/main.d.ts
CHANGED
|
@@ -14,8 +14,9 @@ import { Extent } from 'ol/extent';
|
|
|
14
14
|
import { FC } from 'react';
|
|
15
15
|
import { Feature } from 'ol';
|
|
16
16
|
import { Geometry } from 'ol/geom';
|
|
17
|
-
import { GridActionsCellItemProps } from '@mui/x-data-grid';
|
|
18
17
|
import { GridRenderCellParams } from '@mui/x-data-grid';
|
|
18
|
+
import { GridRowParams } from '@mui/x-data-grid';
|
|
19
|
+
import { IconButtonClasses } from '@mui/material';
|
|
19
20
|
import { IconButtonProps } from '@mui/material/IconButton';
|
|
20
21
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
21
22
|
import { LocalizationProvider } from '@mui/x-date-pickers';
|
|
@@ -424,7 +425,7 @@ declare interface InstanceHierarchyTableProps {
|
|
|
424
425
|
selectedIds?: number[];
|
|
425
426
|
enableCheckboxSelection?: boolean;
|
|
426
427
|
sortColumnsBy?: "name" | "type";
|
|
427
|
-
actions?:
|
|
428
|
+
actions?: InstanceTableActionType[];
|
|
428
429
|
actionsWidth?: number;
|
|
429
430
|
onSelect?(selectedIds: number[]): void;
|
|
430
431
|
onTitleClick?(instance: INSTANCE.GenericInstanceView): void;
|
|
@@ -432,6 +433,29 @@ declare interface InstanceHierarchyTableProps {
|
|
|
432
433
|
|
|
433
434
|
export declare const InstanceTable: FC<InstanceTableProps>;
|
|
434
435
|
|
|
436
|
+
export declare interface InstanceTableActionType {
|
|
437
|
+
label: string;
|
|
438
|
+
icon: React.ReactElement;
|
|
439
|
+
showInMenu?: boolean;
|
|
440
|
+
children?: React.ReactNode;
|
|
441
|
+
classes?: Partial<IconButtonClasses>;
|
|
442
|
+
color?:
|
|
443
|
+
| "inherit"
|
|
444
|
+
| "default"
|
|
445
|
+
| "warning"
|
|
446
|
+
| "error"
|
|
447
|
+
| "success"
|
|
448
|
+
| "info"
|
|
449
|
+
| "primary"
|
|
450
|
+
| "secondary";
|
|
451
|
+
disabled?: boolean;
|
|
452
|
+
disableFocusRipple?: boolean;
|
|
453
|
+
edge?: false | "end" | "start";
|
|
454
|
+
size?: "medium" | "large" | "small";
|
|
455
|
+
sx?: SxProps;
|
|
456
|
+
onClick?(params: GridRowParams<INSTANCE.GenericInstanceView>): void;
|
|
457
|
+
}
|
|
458
|
+
|
|
435
459
|
declare interface InstanceTableFieldOptions {
|
|
436
460
|
hidden?: boolean;
|
|
437
461
|
renderCell?(params: GridRenderCellParams<any>): React.ReactElement;
|
|
@@ -443,7 +467,7 @@ declare interface InstanceTableProps {
|
|
|
443
467
|
selectedIds?: number[];
|
|
444
468
|
enableCheckboxSelection?: boolean;
|
|
445
469
|
sortColumnsBy?: "name" | "type";
|
|
446
|
-
actions?:
|
|
470
|
+
actions?: InstanceTableActionType[];
|
|
447
471
|
actionsWidth?: number;
|
|
448
472
|
fieldOptions?: {
|
|
449
473
|
templateIcon?: InstanceTableFieldOptions;
|