@terraware/web-components 5.2.6-rc.2 → 5.2.6
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/components/EditableTable/index.d.ts +3 -2
- package/components/EditableTable/index.d.ts.map +1 -1
- package/components/table/density.d.ts +1 -1
- package/index.d.ts +1 -3
- package/index.d.ts.map +1 -1
- package/index.js +0 -1
- package/license-report.html +1 -1
- package/package.json +1 -2
- package/strings/csv/en.csv +0 -37
- package/strings/csv/es.csv +0 -37
- package/strings/csv/fr.csv +0 -37
- package/strings/strings-en.d.ts +0 -37
- package/strings/strings-en.d.ts.map +1 -1
- package/strings/strings-en.js +1 -38
- package/strings/strings-es.d.ts +0 -37
- package/strings/strings-es.d.ts.map +1 -1
- package/strings/strings-es.js +1 -38
- package/strings/strings-fr.d.ts +0 -37
- package/strings/strings-fr.d.ts.map +1 -1
- package/strings/strings-fr.js +1 -38
- package/strings/strings-gx.d.ts +0 -37
- package/strings/strings-gx.d.ts.map +1 -1
- package/strings/strings-gx.js +1 -38
- package/components/EditableTableV2/ColumnDragging.d.ts +0 -19
- package/components/EditableTableV2/ColumnDragging.d.ts.map +0 -1
- package/components/EditableTableV2/ColumnDragging.js +0 -191
- package/components/EditableTableV2/EditableCellV2.d.ts +0 -10
- package/components/EditableTableV2/EditableCellV2.d.ts.map +0 -1
- package/components/EditableTableV2/EditableCellV2.js +0 -80
- package/components/EditableTableV2/index.d.ts +0 -44
- package/components/EditableTableV2/index.d.ts.map +0 -1
- package/components/EditableTableV2/index.js +0 -854
- package/components/EditableTableV2/types.d.ts +0 -78
- package/components/EditableTableV2/types.d.ts.map +0 -1
- package/components/EditableTableV2/types.js +0 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strings-gx.d.ts","sourceRoot":"","sources":["../../src/strings/strings-gx.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"strings-gx.d.ts","sourceRoot":"","sources":["../../src/strings/strings-gx.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDnB,CAAC"}
|
package/strings/strings-gx.js
CHANGED
|
@@ -48,43 +48,6 @@ const strings = {
|
|
|
48
48
|
UPLOAD_FILES: 'RmlsZXM VXBsb2Fk',
|
|
49
49
|
UPLOAD_FILES_DESCRIPTION: 'ZmlsZXMu ZHJvcA YW5k ZHJhZw b3I QnJvd3Nl',
|
|
50
50
|
VR: 'VlI',
|
|
51
|
-
ZOOM: 'Wm9vbQ'
|
|
52
|
-
TABLE_SAVE_ERROR: 'YWdhaW4u dHJ5 UGxlYXNl Y2hhbmdlcy4 c2F2ZQ dG8 VW5hYmxl',
|
|
53
|
-
TABLE_FILTER: 'RmlsdGVy',
|
|
54
|
-
TABLE_FILTER_BY: '{column} Ynk RmlsdGVy',
|
|
55
|
-
TABLE_MIN: 'TWluaW11bQ',
|
|
56
|
-
TABLE_MAX: 'TWF4aW11bQ',
|
|
57
|
-
TABLE_ALL: 'QWxs',
|
|
58
|
-
TABLE_SEARCH: 'U2VhcmNo',
|
|
59
|
-
TABLE_COLUMNS: 'Q29sdW1ucw',
|
|
60
|
-
TABLE_DRAG_COLUMN: 'Y29sdW1u RHJhZw',
|
|
61
|
-
TABLE_MOVE: 'TW92ZQ',
|
|
62
|
-
TABLE_MOVE_BACK: 'YmFja3dhcmQ Y29sdW1u TW92ZQ',
|
|
63
|
-
TABLE_MOVE_FORWARD: 'Zm9yd2FyZA Y29sdW1u TW92ZQ',
|
|
64
|
-
TABLE_PIN: 'Y29sdW1u UGlu',
|
|
65
|
-
TABLE_UNPIN: 'VW5waW5uZWQ',
|
|
66
|
-
TABLE_PIN_START: 'c3RhcnQ dG8 UGlu',
|
|
67
|
-
TABLE_PIN_END: 'ZW5k dG8 UGlu',
|
|
68
|
-
TABLE_NO_ROWS: 'ZGlzcGxheQ dG8 cmVjb3Jkcw Tm8',
|
|
69
|
-
TABLE_ROWS_PER_PAGE: 'cGFnZQ cGVy Um93cw',
|
|
70
|
-
TABLE_NEXT_PAGE: 'cGFnZQ TmV4dA',
|
|
71
|
-
TABLE_PREVIOUS_PAGE: 'cGFnZQ UHJldmlvdXM',
|
|
72
|
-
TABLE_FIRST_PAGE: 'cGFnZQ Rmlyc3Q',
|
|
73
|
-
TABLE_LAST_PAGE: 'cGFnZQ TGFzdA',
|
|
74
|
-
TABLE_HIDE_COLUMN: 'Y29sdW1u {column} SGlkZQ',
|
|
75
|
-
TABLE_SHOW_ALL_COLUMNS: 'Y29sdW1ucw YWxs U2hvdw',
|
|
76
|
-
TABLE_COLUMN_ACTIONS: 'YWN0aW9ucw Q29sdW1u',
|
|
77
|
-
TABLE_SORT_ASCENDING: 'YXNjZW5kaW5n {column} Ynk U29ydA',
|
|
78
|
-
TABLE_SORT_DESCENDING: 'ZGVzY2VuZGluZw {column} Ynk U29ydA',
|
|
79
|
-
TABLE_CLEAR_SORTING: 'c29ydGluZw Q2xlYXI',
|
|
80
|
-
TABLE_CLEAR_FILTER: 'ZmlsdGVy Q2xlYXI',
|
|
81
|
-
TABLE_FILTERED: 'RmlsdGVyZWQ',
|
|
82
|
-
TABLE_CLEAR_SEARCH: 'c2VhcmNo Q2xlYXI',
|
|
83
|
-
TABLE_HIDE_ALL: 'YWxs SGlkZQ',
|
|
84
|
-
TABLE_SHOW_ALL: 'YWxs U2hvdw',
|
|
85
|
-
TABLE_TOGGLE_SEARCH: 'c2VhcmNo U2hvdy9IaWRl',
|
|
86
|
-
TABLE_TOGGLE_FILTERS: 'ZmlsdGVycw U2hvdy9IaWRl',
|
|
87
|
-
TABLE_TOGGLE_DENSITY: 'ZGVuc2l0eQ VG9nZ2xl',
|
|
88
|
-
TABLE_TOGGLE_FULLSCREEN: 'c2NyZWVu ZnVsbA VG9nZ2xl'
|
|
51
|
+
ZOOM: 'Wm9vbQ'
|
|
89
52
|
};
|
|
90
53
|
export { strings };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DragEndEvent } from '@dnd-kit/core';
|
|
3
|
-
import { MenuItemProps, MenuProps, TableCellProps, TableContainerProps } from '@mui/material';
|
|
4
|
-
type DragContextProps = {
|
|
5
|
-
ids: string[];
|
|
6
|
-
onDragEnd: (event: DragEndEvent) => void;
|
|
7
|
-
};
|
|
8
|
-
export declare const ColumnDragMenu: ({ ids, onDragEnd, ...props }: DragContextProps & Omit<MenuProps, "onDragEnd">) => React.JSX.Element;
|
|
9
|
-
export declare const ColumnDragTableContainer: ({ ids, onDragEnd, ...props }: DragContextProps & Omit<TableContainerProps, "onDragEnd">) => React.JSX.Element;
|
|
10
|
-
export declare const ColumnDragHandle: () => React.ReactNode;
|
|
11
|
-
type ColumnDragProps = {
|
|
12
|
-
id: string;
|
|
13
|
-
label: string;
|
|
14
|
-
enabled: boolean;
|
|
15
|
-
};
|
|
16
|
-
export declare const DraggableColumnHeader: ({ id, label, enabled, ...props }: ColumnDragProps & TableCellProps) => React.JSX.Element;
|
|
17
|
-
export declare const DraggableColumnItem: ({ id, label, enabled, ...props }: ColumnDragProps & MenuItemProps) => React.JSX.Element;
|
|
18
|
-
export {};
|
|
19
|
-
//# sourceMappingURL=ColumnDragging.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnDragging.d.ts","sourceRoot":"","sources":["../../../src/components/EditableTableV2/ColumnDragging.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8E,MAAM,OAAO,CAAC;AAEnG,OAAO,EAGL,YAAY,EAOb,MAAM,eAAe,CAAC;AAGvB,OAAO,EAKL,aAAa,EACb,SAAS,EAET,cAAc,EAEd,mBAAmB,EAGpB,MAAM,eAAe,CAAC;AAIvB,KAAK,gBAAgB,GAAG;IAAE,GAAG,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAA;CAAE,CAAC;AAoDpF,eAAO,MAAM,cAAc,GAAI,8BAA8B,gBAAgB,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,sBAI3G,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,8BAItC,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC,sBAI3D,CAAC;AAGF,eAAO,MAAM,gBAAgB,uBAAsC,CAAC;AAEpE,KAAK,eAAe,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAsDF,eAAO,MAAM,qBAAqB,GAAI,kCAAkC,eAAe,GAAG,cAAc,sBAOvG,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,kCAAkC,eAAe,GAAG,aAAa,sBAWpG,CAAC"}
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useCallback, useContext, useRef, useState } from "react";
|
|
3
|
-
import { DndContext, DragOverlay, KeyboardSensor, PointerSensor, closestCenter, useSensor, useSensors } from "@dnd-kit/core";
|
|
4
|
-
import { SortableContext, sortableKeyboardCoordinates, useSortable } from "@dnd-kit/sortable";
|
|
5
|
-
import { DragHandle } from "@mui/icons-material";
|
|
6
|
-
import { Box, IconButton, Menu, MenuItem, TableCell, TableContainer, Tooltip, useTheme } from "@mui/material";
|
|
7
|
-
import { useStrings } from "../../strings/index.js";
|
|
8
|
-
const ColumnDragContext = ({ ids, onDragEnd, children })=>{
|
|
9
|
-
const [overlay, setOverlay] = useState(null);
|
|
10
|
-
const sensors = useSensors(useSensor(PointerSensor, {
|
|
11
|
-
activationConstraint: {
|
|
12
|
-
distance: 5
|
|
13
|
-
}
|
|
14
|
-
}), useSensor(KeyboardSensor, {
|
|
15
|
-
coordinateGetter: sortableKeyboardCoordinates
|
|
16
|
-
}));
|
|
17
|
-
return /*#__PURE__*/ jsxs(DndContext, {
|
|
18
|
-
sensors: sensors,
|
|
19
|
-
collisionDetection: closestCenter,
|
|
20
|
-
measuring: {
|
|
21
|
-
dragOverlay: {
|
|
22
|
-
measure: (node)=>overlay?.rect ?? node.getBoundingClientRect()
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
onDragStart: ({ active })=>{
|
|
26
|
-
const element = active.data.current?.getDragElement();
|
|
27
|
-
if (element) {
|
|
28
|
-
const { width, height, top, left, right, bottom } = element.getBoundingClientRect();
|
|
29
|
-
const rect = {
|
|
30
|
-
width,
|
|
31
|
-
height,
|
|
32
|
-
top,
|
|
33
|
-
left,
|
|
34
|
-
right,
|
|
35
|
-
bottom
|
|
36
|
-
};
|
|
37
|
-
const html = 'TH' === element.tagName ? `<table style="border-collapse:collapse;width:${rect.width}px"><thead><tr>${element.outerHTML}</tr></thead></table>` : `<ul style="margin:0;padding:0;list-style:none">${element.outerHTML}</ul>`;
|
|
38
|
-
setOverlay({
|
|
39
|
-
html,
|
|
40
|
-
rect
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
onDragCancel: ()=>setOverlay(null),
|
|
45
|
-
onDragEnd: (event)=>{
|
|
46
|
-
setOverlay(null);
|
|
47
|
-
onDragEnd(event);
|
|
48
|
-
},
|
|
49
|
-
children: [
|
|
50
|
-
/*#__PURE__*/ jsx(SortableContext, {
|
|
51
|
-
items: ids,
|
|
52
|
-
children: children
|
|
53
|
-
}),
|
|
54
|
-
/*#__PURE__*/ jsx(DragOverlay, {
|
|
55
|
-
dropAnimation: null,
|
|
56
|
-
zIndex: 1500,
|
|
57
|
-
children: overlay && /*#__PURE__*/ jsx(Box, {
|
|
58
|
-
"aria-hidden": true,
|
|
59
|
-
"data-testid": "column-drag-overlay",
|
|
60
|
-
sx: {
|
|
61
|
-
width: overlay.rect.width,
|
|
62
|
-
height: overlay.rect.height,
|
|
63
|
-
opacity: 0.65,
|
|
64
|
-
bgcolor: 'background.paper',
|
|
65
|
-
pointerEvents: 'none'
|
|
66
|
-
},
|
|
67
|
-
dangerouslySetInnerHTML: {
|
|
68
|
-
__html: overlay.html
|
|
69
|
-
}
|
|
70
|
-
})
|
|
71
|
-
})
|
|
72
|
-
]
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
const ColumnDragMenu = ({ ids, onDragEnd, ...props })=>/*#__PURE__*/ jsx(ColumnDragContext, {
|
|
76
|
-
ids: ids,
|
|
77
|
-
onDragEnd: onDragEnd,
|
|
78
|
-
children: /*#__PURE__*/ jsx(Menu, {
|
|
79
|
-
...props
|
|
80
|
-
})
|
|
81
|
-
});
|
|
82
|
-
const ColumnDragTableContainer = ({ ids, onDragEnd, ...props })=>/*#__PURE__*/ jsx(ColumnDragContext, {
|
|
83
|
-
ids: ids,
|
|
84
|
-
onDragEnd: onDragEnd,
|
|
85
|
-
children: /*#__PURE__*/ jsx(TableContainer, {
|
|
86
|
-
...props
|
|
87
|
-
})
|
|
88
|
-
});
|
|
89
|
-
const DragHandleContext = /*#__PURE__*/ createContext(null);
|
|
90
|
-
const ColumnDragHandle = ()=>useContext(DragHandleContext);
|
|
91
|
-
const useColumnDrag = ({ id, label, enabled }, activeOutlineWidth = 1)=>{
|
|
92
|
-
const strings = useStrings();
|
|
93
|
-
const theme = useTheme();
|
|
94
|
-
const element = useRef(null);
|
|
95
|
-
const { setNodeRef, setActivatorNodeRef, attributes, listeners, isDragging, isOver } = useSortable({
|
|
96
|
-
id,
|
|
97
|
-
disabled: !enabled,
|
|
98
|
-
data: {
|
|
99
|
-
getDragElement: ()=>element.current
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
const ref = useCallback((node)=>{
|
|
103
|
-
element.current = node;
|
|
104
|
-
setNodeRef(node);
|
|
105
|
-
}, [
|
|
106
|
-
setNodeRef
|
|
107
|
-
]);
|
|
108
|
-
const dragStyles = {
|
|
109
|
-
outline: isDragging ? `${activeOutlineWidth}px dashed ${theme.palette.grey[500]}` : isOver ? `2px dashed ${theme.palette.primary.main}` : void 0,
|
|
110
|
-
outlineOffset: '-2px'
|
|
111
|
-
};
|
|
112
|
-
const handle = enabled && /*#__PURE__*/ jsx(Tooltip, {
|
|
113
|
-
title: strings.TABLE_MOVE,
|
|
114
|
-
placement: "top",
|
|
115
|
-
children: /*#__PURE__*/ jsx(IconButton, {
|
|
116
|
-
size: "small",
|
|
117
|
-
disableRipple: true,
|
|
118
|
-
ref: setActivatorNodeRef,
|
|
119
|
-
...attributes,
|
|
120
|
-
...listeners,
|
|
121
|
-
"aria-label": `${strings.TABLE_DRAG_COLUMN}: ${label}`,
|
|
122
|
-
sx: {
|
|
123
|
-
touchAction: 'none',
|
|
124
|
-
cursor: 'grab',
|
|
125
|
-
'&:active': {
|
|
126
|
-
cursor: 'grabbing'
|
|
127
|
-
},
|
|
128
|
-
'&:hover': {
|
|
129
|
-
backgroundColor: 'transparent',
|
|
130
|
-
opacity: 1
|
|
131
|
-
},
|
|
132
|
-
m: '0 -0.1rem',
|
|
133
|
-
opacity: 0.5,
|
|
134
|
-
p: '2px',
|
|
135
|
-
transition: 'all 150ms ease-in-out'
|
|
136
|
-
},
|
|
137
|
-
onClick: (event)=>event.stopPropagation(),
|
|
138
|
-
children: /*#__PURE__*/ jsx(DragHandle, {})
|
|
139
|
-
})
|
|
140
|
-
});
|
|
141
|
-
return {
|
|
142
|
-
ref,
|
|
143
|
-
handle,
|
|
144
|
-
dragStyles,
|
|
145
|
-
isDragging
|
|
146
|
-
};
|
|
147
|
-
};
|
|
148
|
-
const DraggableColumnHeader = ({ id, label, enabled, ...props })=>{
|
|
149
|
-
const { ref, handle, dragStyles } = useColumnDrag({
|
|
150
|
-
id,
|
|
151
|
-
label,
|
|
152
|
-
enabled
|
|
153
|
-
});
|
|
154
|
-
return /*#__PURE__*/ jsx(DragHandleContext.Provider, {
|
|
155
|
-
value: handle,
|
|
156
|
-
children: /*#__PURE__*/ jsx(TableCell, {
|
|
157
|
-
...props,
|
|
158
|
-
ref: ref,
|
|
159
|
-
sx: [
|
|
160
|
-
...Array.isArray(props.sx) ? props.sx : [
|
|
161
|
-
props.sx
|
|
162
|
-
],
|
|
163
|
-
dragStyles
|
|
164
|
-
]
|
|
165
|
-
})
|
|
166
|
-
});
|
|
167
|
-
};
|
|
168
|
-
const DraggableColumnItem = ({ id, label, enabled, ...props })=>{
|
|
169
|
-
const { ref, handle, dragStyles, isDragging } = useColumnDrag({
|
|
170
|
-
id,
|
|
171
|
-
label,
|
|
172
|
-
enabled
|
|
173
|
-
}, 2);
|
|
174
|
-
return /*#__PURE__*/ jsx(DragHandleContext.Provider, {
|
|
175
|
-
value: handle,
|
|
176
|
-
children: /*#__PURE__*/ jsx(MenuItem, {
|
|
177
|
-
...props,
|
|
178
|
-
ref: ref,
|
|
179
|
-
sx: [
|
|
180
|
-
...Array.isArray(props.sx) ? props.sx : [
|
|
181
|
-
props.sx
|
|
182
|
-
],
|
|
183
|
-
dragStyles,
|
|
184
|
-
{
|
|
185
|
-
opacity: isDragging ? 0.5 : 1
|
|
186
|
-
}
|
|
187
|
-
]
|
|
188
|
-
})
|
|
189
|
-
});
|
|
190
|
-
};
|
|
191
|
-
export { ColumnDragHandle, ColumnDragMenu, ColumnDragTableContainer, DraggableColumnHeader, DraggableColumnItem };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { EditableTableCellV2, EditableTableColumnV2 } from './types';
|
|
3
|
-
type Props<TData extends object> = {
|
|
4
|
-
cell: EditableTableCellV2<TData>;
|
|
5
|
-
column: EditableTableColumnV2<TData>;
|
|
6
|
-
onClose: () => void;
|
|
7
|
-
};
|
|
8
|
-
declare const EditableCellV2: <TData extends object>({ cell, column, onClose }: Props<TData>) => React.JSX.Element;
|
|
9
|
-
export default EditableCellV2;
|
|
10
|
-
//# sourceMappingURL=EditableCellV2.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EditableCellV2.d.ts","sourceRoot":"","sources":["../../../src/components/EditableTableV2/EditableCellV2.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAKhD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErE,KAAK,KAAK,CAAC,KAAK,SAAS,MAAM,IAAI;IACjC,IAAI,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACjC,MAAM,EAAE,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACrC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,QAAA,MAAM,cAAc,GAAI,KAAK,SAAS,MAAM,EAAE,2BAA2B,KAAK,CAAC,KAAK,CAAC,sBAyEpF,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useRef, useState } from "react";
|
|
3
|
-
import { Alert, Box, MenuItem, TextField } from "@mui/material";
|
|
4
|
-
import { useStrings } from "../../strings/index.js";
|
|
5
|
-
const EditableCellV2 = ({ cell, column, onClose })=>{
|
|
6
|
-
const strings = useStrings();
|
|
7
|
-
const [value, setValue] = useState(()=>cell.getValue() ?? '');
|
|
8
|
-
const [isSaving, setIsSaving] = useState(false);
|
|
9
|
-
const [failed, setFailed] = useState(false);
|
|
10
|
-
const finished = useRef(false);
|
|
11
|
-
const config = column.editConfig;
|
|
12
|
-
const cancel = ()=>{
|
|
13
|
-
if (!isSaving) {
|
|
14
|
-
finished.current = true;
|
|
15
|
-
onClose();
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
const save = async (nextValue)=>{
|
|
19
|
-
if (finished.current) return;
|
|
20
|
-
finished.current = true;
|
|
21
|
-
setIsSaving(true);
|
|
22
|
-
setFailed(false);
|
|
23
|
-
try {
|
|
24
|
-
if (nextValue !== (cell.getValue() ?? '')) await config?.onSave?.(cell.row.original, nextValue, column.id);
|
|
25
|
-
onClose();
|
|
26
|
-
} catch {
|
|
27
|
-
finished.current = false;
|
|
28
|
-
setFailed(true);
|
|
29
|
-
} finally{
|
|
30
|
-
setIsSaving(false);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
return /*#__PURE__*/ jsxs(Box, {
|
|
34
|
-
onClick: (event)=>event.stopPropagation(),
|
|
35
|
-
onDoubleClick: (event)=>event.stopPropagation(),
|
|
36
|
-
children: [
|
|
37
|
-
config?.editVariant === 'custom' && config.customEditComponent ? /*#__PURE__*/ jsx(config.customEditComponent, {
|
|
38
|
-
...cell.getContext(),
|
|
39
|
-
save: save,
|
|
40
|
-
cancel: cancel,
|
|
41
|
-
isSaving: isSaving
|
|
42
|
-
}) : /*#__PURE__*/ jsx(TextField, {
|
|
43
|
-
autoFocus: true,
|
|
44
|
-
fullWidth: true,
|
|
45
|
-
size: "small",
|
|
46
|
-
select: config?.editVariant === 'select',
|
|
47
|
-
value: value,
|
|
48
|
-
disabled: isSaving,
|
|
49
|
-
error: failed,
|
|
50
|
-
slotProps: {
|
|
51
|
-
htmlInput: {
|
|
52
|
-
'aria-label': column.header
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
onChange: (event)=>setValue(event.target.value),
|
|
56
|
-
onBlur: ()=>void save(value),
|
|
57
|
-
onKeyDown: (event)=>{
|
|
58
|
-
event.stopPropagation();
|
|
59
|
-
if ('Enter' === event.key) {
|
|
60
|
-
event.preventDefault();
|
|
61
|
-
save(value);
|
|
62
|
-
} else if ('Escape' === event.key) {
|
|
63
|
-
event.preventDefault();
|
|
64
|
-
cancel();
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
children: config?.editVariant === 'select' && config.selectOptions?.map((option)=>/*#__PURE__*/ jsx(MenuItem, {
|
|
68
|
-
value: option.value,
|
|
69
|
-
children: option.label
|
|
70
|
-
}, option.value))
|
|
71
|
-
}),
|
|
72
|
-
failed && /*#__PURE__*/ jsx(Alert, {
|
|
73
|
-
severity: "error",
|
|
74
|
-
children: strings.TABLE_SAVE_ERROR
|
|
75
|
-
})
|
|
76
|
-
]
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
const EditableTableV2_EditableCellV2 = EditableCellV2;
|
|
80
|
-
export default EditableTableV2_EditableCellV2;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import { SxProps, TableContainerProps, Theme } from '@mui/material';
|
|
3
|
-
import { EditableTableColumnV2, EditableTableInstanceV2, EditableTableOptionsV2 } from './types';
|
|
4
|
-
export type { EditableTableCellV2, EditableTableCellContextV2, EditableTableColumnV2, EditableTableEditContextV2, EditableTableInstanceV2, EditableTableOptionsV2, } from './types';
|
|
5
|
-
export type EditableTablePropsV2<TData extends object> = {
|
|
6
|
-
clearAllFiltersLabel: string;
|
|
7
|
-
columns: EditableTableColumnV2<TData>[];
|
|
8
|
-
data: TData[];
|
|
9
|
-
enableClearAllFilters?: boolean;
|
|
10
|
-
enableEditing?: boolean;
|
|
11
|
-
enableColumnOrdering?: boolean;
|
|
12
|
-
enableColumnDragging?: boolean;
|
|
13
|
-
enableColumnActions?: boolean;
|
|
14
|
-
showColumnsButton?: boolean;
|
|
15
|
-
showGlobalFilterButton?: boolean;
|
|
16
|
-
showColumnFiltersButton?: boolean;
|
|
17
|
-
showDensityButton?: boolean;
|
|
18
|
-
showFullScreenButton?: boolean;
|
|
19
|
-
enableColumnPinning?: boolean;
|
|
20
|
-
enableHiding?: boolean;
|
|
21
|
-
enableSorting?: boolean;
|
|
22
|
-
enableGlobalFilter?: boolean;
|
|
23
|
-
enableColumnFilters?: boolean;
|
|
24
|
-
stickyFilters?: boolean;
|
|
25
|
-
storageKey?: string;
|
|
26
|
-
enablePagination?: boolean;
|
|
27
|
-
enableBottomToolbar?: boolean;
|
|
28
|
-
enableTopToolbar?: boolean;
|
|
29
|
-
initialSorting?: {
|
|
30
|
-
id: string;
|
|
31
|
-
desc: boolean;
|
|
32
|
-
}[];
|
|
33
|
-
onClearAllFilters?: () => void;
|
|
34
|
-
onRowClick?: (row: TData) => void;
|
|
35
|
-
renderToolbarInternalActions?: (props: {
|
|
36
|
-
table: EditableTableInstanceV2<TData>;
|
|
37
|
-
}) => ReactNode;
|
|
38
|
-
tableOptions?: EditableTableOptionsV2<TData>;
|
|
39
|
-
containerProps?: TableContainerProps;
|
|
40
|
-
sx?: SxProps<Theme>;
|
|
41
|
-
};
|
|
42
|
-
declare const EditableTableV2: <TData extends object>({ clearAllFiltersLabel, columns, data, enableClearAllFilters, enableEditing, enableColumnOrdering, enableColumnDragging, enableColumnActions, showColumnsButton, showGlobalFilterButton, showColumnFiltersButton, showDensityButton, showFullScreenButton, enableColumnPinning, enableHiding, enableSorting, enableGlobalFilter, enableColumnFilters, stickyFilters, storageKey, enablePagination, enableBottomToolbar, enableTopToolbar, initialSorting, onClearAllFilters, onRowClick, renderToolbarInternalActions, tableOptions, containerProps, sx, }: EditableTablePropsV2<TData>) => React.JSX.Element;
|
|
43
|
-
export default EditableTableV2;
|
|
44
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/EditableTableV2/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAgC,MAAM,OAAO,CAAC;AA0BvE,OAAO,EAYL,OAAO,EAIP,mBAAmB,EAMnB,KAAK,EAGN,MAAM,eAAe,CAAC;AAcvB,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,sBAAsB,EAAyB,MAAM,SAAS,CAAC;AAExH,YAAY,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,qBAAqB,EACrB,0BAA0B,EAC1B,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,oBAAoB,CAAC,KAAK,SAAS,MAAM,IAAI;IACvD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,OAAO,EAAE,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;IACxC,IAAI,EAAE,KAAK,EAAE,CAAC;IACd,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IACjD,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC;IAClC,4BAA4B,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,uBAAuB,CAAC,KAAK,CAAC,CAAA;KAAE,KAAK,SAAS,CAAC;IAC/F,YAAY,CAAC,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC7C,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACrB,CAAC;AA2JF,QAAA,MAAM,eAAe,GAAI,KAAK,SAAS,MAAM,EAAE,4hBA+B5C,oBAAoB,CAAC,KAAK,CAAC,sBAyqB7B,CAAC;AAEF,eAAe,eAAe,CAAC"}
|