@uipath/apollo-wind 2.92.0 → 2.93.0
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/ui/data-table.cjs +493 -104
- package/dist/components/ui/data-table.d.ts +88 -5
- package/dist/components/ui/data-table.js +491 -105
- package/dist/components/ui/editable-cell.cjs +91 -27
- package/dist/components/ui/editable-cell.d.ts +14 -1
- package/dist/components/ui/editable-cell.js +91 -27
- package/dist/components/ui/index.cjs +24 -24
- package/dist/index.cjs +3 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/styles.css +22 -0
- package/package.json +1 -1
|
@@ -39,44 +39,102 @@ const external_calendar_cjs_namespaceObject = require("./calendar.cjs");
|
|
|
39
39
|
const external_locale_provider_cjs_namespaceObject = require("./locale-provider.cjs");
|
|
40
40
|
const external_popover_cjs_namespaceObject = require("./popover.cjs");
|
|
41
41
|
const external_select_cjs_namespaceObject = require("./select.cjs");
|
|
42
|
-
function
|
|
42
|
+
function isEmptyValue(value) {
|
|
43
|
+
return null == value || '' === value;
|
|
44
|
+
}
|
|
45
|
+
function toValidDate(value) {
|
|
46
|
+
if (isEmptyValue(value)) return;
|
|
47
|
+
const dateOnly = 'string' == typeof value ? /^(\d{4})-(\d{2})-(\d{2})$/.exec(value) : null;
|
|
48
|
+
const date = dateOnly ? new Date(Number(dateOnly[1]), Number(dateOnly[2]) - 1, Number(dateOnly[3])) : value instanceof Date ? value : new Date(value);
|
|
49
|
+
return Number.isNaN(date.getTime()) ? void 0 : date;
|
|
50
|
+
}
|
|
51
|
+
function EditableCell({ cell, onUpdate, editLabel, toggleLabel }) {
|
|
43
52
|
const initialValue = cell.getValue();
|
|
44
53
|
const meta = cell.column.columnDef.meta;
|
|
45
54
|
const type = meta?.type ?? 'text';
|
|
55
|
+
const dateLocale = (0, external_locale_provider_cjs_namespaceObject.useDateLocale)();
|
|
46
56
|
const [isEditing, setIsEditing] = external_react_namespaceObject.useState(false);
|
|
47
57
|
const [value, setValue] = external_react_namespaceObject.useState(initialValue);
|
|
58
|
+
const [numberDraft, setNumberDraft] = external_react_namespaceObject.useState('');
|
|
48
59
|
const inputRef = external_react_namespaceObject.useRef(null);
|
|
60
|
+
const displayRef = external_react_namespaceObject.useRef(null);
|
|
61
|
+
const restoreFocusRef = external_react_namespaceObject.useRef(false);
|
|
62
|
+
const finishedRef = external_react_namespaceObject.useRef(false);
|
|
49
63
|
external_react_namespaceObject.useEffect(()=>{
|
|
50
64
|
setValue(initialValue);
|
|
51
65
|
}, [
|
|
52
66
|
initialValue
|
|
53
67
|
]);
|
|
54
68
|
external_react_namespaceObject.useEffect(()=>{
|
|
55
|
-
if (isEditing
|
|
56
|
-
inputRef.current
|
|
57
|
-
|
|
69
|
+
if (isEditing) {
|
|
70
|
+
if (inputRef.current) {
|
|
71
|
+
inputRef.current.focus();
|
|
72
|
+
inputRef.current.select();
|
|
73
|
+
}
|
|
74
|
+
} else if (restoreFocusRef.current) {
|
|
75
|
+
restoreFocusRef.current = false;
|
|
76
|
+
displayRef.current?.focus();
|
|
58
77
|
}
|
|
59
78
|
}, [
|
|
60
79
|
isEditing
|
|
61
80
|
]);
|
|
62
|
-
const
|
|
63
|
-
|
|
81
|
+
const startEditing = external_react_namespaceObject.useCallback(()=>{
|
|
82
|
+
finishedRef.current = false;
|
|
83
|
+
if ('number' === type) setNumberDraft(isEmptyValue(value) ? '' : String(value));
|
|
84
|
+
setIsEditing(true);
|
|
85
|
+
}, [
|
|
86
|
+
type,
|
|
87
|
+
value
|
|
88
|
+
]);
|
|
89
|
+
const finishEditing = external_react_namespaceObject.useCallback((restoreFocus)=>{
|
|
90
|
+
finishedRef.current = true;
|
|
91
|
+
restoreFocusRef.current = restoreFocus;
|
|
64
92
|
setIsEditing(false);
|
|
93
|
+
}, []);
|
|
94
|
+
const handleSave = external_react_namespaceObject.useCallback((restoreFocus)=>{
|
|
95
|
+
if (finishedRef.current) return;
|
|
96
|
+
if ('number' === type) {
|
|
97
|
+
const trimmed = numberDraft.trim();
|
|
98
|
+
if ('' === trimmed) {
|
|
99
|
+
if (meta?.nullable && !isEmptyValue(initialValue)) {
|
|
100
|
+
setValue(null);
|
|
101
|
+
onUpdate(null);
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
let next = Number(trimmed);
|
|
105
|
+
if (Number.isFinite(next)) {
|
|
106
|
+
if (meta?.min !== void 0) next = Math.max(meta.min, next);
|
|
107
|
+
if (meta?.max !== void 0) next = Math.min(meta.max, next);
|
|
108
|
+
if (next !== initialValue) {
|
|
109
|
+
setValue(next);
|
|
110
|
+
onUpdate(next);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
} else if (value !== initialValue) onUpdate(value);
|
|
115
|
+
finishEditing(restoreFocus);
|
|
65
116
|
}, [
|
|
117
|
+
type,
|
|
118
|
+
numberDraft,
|
|
119
|
+
meta?.nullable,
|
|
120
|
+
meta?.min,
|
|
121
|
+
meta?.max,
|
|
66
122
|
value,
|
|
67
123
|
initialValue,
|
|
68
|
-
onUpdate
|
|
124
|
+
onUpdate,
|
|
125
|
+
finishEditing
|
|
69
126
|
]);
|
|
70
127
|
const handleCancel = external_react_namespaceObject.useCallback(()=>{
|
|
71
128
|
setValue(initialValue);
|
|
72
|
-
|
|
129
|
+
finishEditing(true);
|
|
73
130
|
}, [
|
|
74
|
-
initialValue
|
|
131
|
+
initialValue,
|
|
132
|
+
finishEditing
|
|
75
133
|
]);
|
|
76
134
|
const handleKeyDown = external_react_namespaceObject.useCallback((e)=>{
|
|
77
135
|
if ('Enter' === e.key) {
|
|
78
136
|
e.preventDefault();
|
|
79
|
-
handleSave();
|
|
137
|
+
handleSave(true);
|
|
80
138
|
} else if ('Escape' === e.key) {
|
|
81
139
|
e.preventDefault();
|
|
82
140
|
handleCancel();
|
|
@@ -94,18 +152,19 @@ function EditableCell({ cell, onUpdate }) {
|
|
|
94
152
|
setValue(checked);
|
|
95
153
|
onUpdate(checked);
|
|
96
154
|
},
|
|
97
|
-
"aria-label":
|
|
155
|
+
"aria-label": toggleLabel ?? 'Toggle'
|
|
98
156
|
})
|
|
99
157
|
});
|
|
100
158
|
const cellContent = isEditing ? renderEditMode() : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
159
|
+
ref: displayRef,
|
|
101
160
|
type: "button",
|
|
102
161
|
"data-slot": "editable-cell",
|
|
103
162
|
className: (0, index_cjs_namespaceObject.cn)('min-h-[32px] px-2 py-1.5 -mx-2 rounded cursor-pointer w-full text-left', 'hover:bg-muted/50 transition-colors', 'flex items-center bg-transparent border-0'),
|
|
104
|
-
onClick:
|
|
105
|
-
"aria-label": `Edit ${cell.column.id}`,
|
|
163
|
+
onClick: startEditing,
|
|
164
|
+
"aria-label": editLabel ?? `Edit ${cell.column.id}`,
|
|
106
165
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
107
|
-
className: (0, index_cjs_namespaceObject.cn)('truncate',
|
|
108
|
-
children: formatDisplayValue(value, type, meta?.options)
|
|
166
|
+
className: (0, index_cjs_namespaceObject.cn)('truncate', isEmptyValue(value) && 'text-muted-foreground'),
|
|
167
|
+
children: formatDisplayValue(value, type, meta?.options, dateLocale)
|
|
109
168
|
})
|
|
110
169
|
});
|
|
111
170
|
return cellContent;
|
|
@@ -117,11 +176,11 @@ function EditableCell({ cell, onUpdate }) {
|
|
|
117
176
|
onValueChange: (newValue)=>{
|
|
118
177
|
setValue(newValue);
|
|
119
178
|
onUpdate(newValue);
|
|
120
|
-
|
|
179
|
+
finishEditing(true);
|
|
121
180
|
},
|
|
122
181
|
open: true,
|
|
123
182
|
onOpenChange: (open)=>{
|
|
124
|
-
if (!open)
|
|
183
|
+
if (!open) finishEditing(true);
|
|
125
184
|
},
|
|
126
185
|
children: [
|
|
127
186
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_select_cjs_namespaceObject.SelectTrigger, {
|
|
@@ -140,21 +199,21 @@ function EditableCell({ cell, onUpdate }) {
|
|
|
140
199
|
});
|
|
141
200
|
case 'date':
|
|
142
201
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(DatePickerCell, {
|
|
143
|
-
value:
|
|
202
|
+
value: toValidDate(value),
|
|
144
203
|
onValueChange: (date)=>{
|
|
145
204
|
setValue(date);
|
|
146
205
|
onUpdate(date);
|
|
147
206
|
},
|
|
148
|
-
onClose: ()=>
|
|
207
|
+
onClose: ()=>finishEditing(true),
|
|
149
208
|
placeholder: meta?.placeholder ?? 'Pick date'
|
|
150
209
|
});
|
|
151
210
|
case 'number':
|
|
152
211
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_input_cjs_namespaceObject.Input, {
|
|
153
212
|
ref: inputRef,
|
|
154
213
|
type: "number",
|
|
155
|
-
value:
|
|
156
|
-
onChange: (e)=>
|
|
157
|
-
onBlur: handleSave,
|
|
214
|
+
value: numberDraft,
|
|
215
|
+
onChange: (e)=>setNumberDraft(e.target.value),
|
|
216
|
+
onBlur: ()=>handleSave(false),
|
|
158
217
|
onKeyDown: handleKeyDown,
|
|
159
218
|
min: meta?.min,
|
|
160
219
|
max: meta?.max,
|
|
@@ -167,7 +226,7 @@ function EditableCell({ cell, onUpdate }) {
|
|
|
167
226
|
type: "text",
|
|
168
227
|
value: String(value ?? ''),
|
|
169
228
|
onChange: (e)=>setValue(e.target.value),
|
|
170
|
-
onBlur: handleSave,
|
|
229
|
+
onBlur: ()=>handleSave(false),
|
|
171
230
|
onKeyDown: handleKeyDown,
|
|
172
231
|
placeholder: meta?.placeholder,
|
|
173
232
|
className: "h-8 -mx-2 w-full"
|
|
@@ -175,8 +234,8 @@ function EditableCell({ cell, onUpdate }) {
|
|
|
175
234
|
}
|
|
176
235
|
}
|
|
177
236
|
}
|
|
178
|
-
function formatDisplayValue(value, type, options) {
|
|
179
|
-
if (
|
|
237
|
+
function formatDisplayValue(value, type, options, locale) {
|
|
238
|
+
if (isEmptyValue(value)) return '—';
|
|
180
239
|
switch(type){
|
|
181
240
|
case 'select':
|
|
182
241
|
{
|
|
@@ -184,8 +243,12 @@ function formatDisplayValue(value, type, options) {
|
|
|
184
243
|
return option?.label ?? String(value);
|
|
185
244
|
}
|
|
186
245
|
case 'date':
|
|
187
|
-
|
|
188
|
-
|
|
246
|
+
{
|
|
247
|
+
const date = toValidDate(value);
|
|
248
|
+
return date ? (0, external_date_fns_namespaceObject.format)(date, 'PP', {
|
|
249
|
+
locale
|
|
250
|
+
}) : String(value);
|
|
251
|
+
}
|
|
189
252
|
case 'checkbox':
|
|
190
253
|
return value ? 'Yes' : 'No';
|
|
191
254
|
default:
|
|
@@ -233,6 +296,7 @@ function DatePickerCell({ value, onValueChange, onClose, placeholder }) {
|
|
|
233
296
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_calendar_cjs_namespaceObject.Calendar, {
|
|
234
297
|
mode: "single",
|
|
235
298
|
selected: value,
|
|
299
|
+
defaultMonth: value,
|
|
236
300
|
onSelect: (date)=>{
|
|
237
301
|
onValueChange(date);
|
|
238
302
|
setOpen(false);
|
|
@@ -8,14 +8,27 @@ export interface EditableCellMeta {
|
|
|
8
8
|
type?: EditableCellType;
|
|
9
9
|
options?: SelectOption[];
|
|
10
10
|
placeholder?: string;
|
|
11
|
+
/** Lower bound of a `number` cell. An out-of-range entry is clamped on commit. */
|
|
11
12
|
min?: number;
|
|
13
|
+
/** Upper bound of a `number` cell. An out-of-range entry is clamped on commit. */
|
|
12
14
|
max?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Lets a `number` cell be emptied, which commits `null`. Without it, clearing the
|
|
17
|
+
* field and committing leaves the previous value in place.
|
|
18
|
+
*/
|
|
19
|
+
nullable?: boolean;
|
|
20
|
+
/** Human-readable column name, used in accessible names and the DataTable column menu. */
|
|
21
|
+
label?: string;
|
|
13
22
|
}
|
|
14
23
|
interface EditableCellProps<TData, TValue> {
|
|
15
24
|
cell: CellContext<TData, TValue>;
|
|
16
25
|
onUpdate: (value: TValue) => void;
|
|
26
|
+
/** Accessible name of the button that starts editing. Default: `Edit <column id>`. */
|
|
27
|
+
editLabel?: string;
|
|
28
|
+
/** Accessible name of a `checkbox` cell. Default: `Toggle`. */
|
|
29
|
+
toggleLabel?: string;
|
|
17
30
|
}
|
|
18
|
-
export declare function EditableCell<TData, TValue>({ cell, onUpdate }: EditableCellProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare function EditableCell<TData, TValue>({ cell, onUpdate, editLabel, toggleLabel, }: EditableCellProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
19
32
|
export declare function createEditableColumn<TData>(accessorKey: keyof TData & string, header: string, meta?: EditableCellMeta): {
|
|
20
33
|
accessorKey: keyof TData & string;
|
|
21
34
|
header: string;
|
|
@@ -10,44 +10,102 @@ import { Calendar } from "./calendar.js";
|
|
|
10
10
|
import { useDateLocale } from "./locale-provider.js";
|
|
11
11
|
import { Popover, PopoverContent, PopoverTrigger } from "./popover.js";
|
|
12
12
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./select.js";
|
|
13
|
-
function
|
|
13
|
+
function isEmptyValue(value) {
|
|
14
|
+
return null == value || '' === value;
|
|
15
|
+
}
|
|
16
|
+
function toValidDate(value) {
|
|
17
|
+
if (isEmptyValue(value)) return;
|
|
18
|
+
const dateOnly = 'string' == typeof value ? /^(\d{4})-(\d{2})-(\d{2})$/.exec(value) : null;
|
|
19
|
+
const date = dateOnly ? new Date(Number(dateOnly[1]), Number(dateOnly[2]) - 1, Number(dateOnly[3])) : value instanceof Date ? value : new Date(value);
|
|
20
|
+
return Number.isNaN(date.getTime()) ? void 0 : date;
|
|
21
|
+
}
|
|
22
|
+
function EditableCell({ cell, onUpdate, editLabel, toggleLabel }) {
|
|
14
23
|
const initialValue = cell.getValue();
|
|
15
24
|
const meta = cell.column.columnDef.meta;
|
|
16
25
|
const type = meta?.type ?? 'text';
|
|
26
|
+
const dateLocale = useDateLocale();
|
|
17
27
|
const [isEditing, setIsEditing] = useState(false);
|
|
18
28
|
const [value, setValue] = useState(initialValue);
|
|
29
|
+
const [numberDraft, setNumberDraft] = useState('');
|
|
19
30
|
const inputRef = useRef(null);
|
|
31
|
+
const displayRef = useRef(null);
|
|
32
|
+
const restoreFocusRef = useRef(false);
|
|
33
|
+
const finishedRef = useRef(false);
|
|
20
34
|
useEffect(()=>{
|
|
21
35
|
setValue(initialValue);
|
|
22
36
|
}, [
|
|
23
37
|
initialValue
|
|
24
38
|
]);
|
|
25
39
|
useEffect(()=>{
|
|
26
|
-
if (isEditing
|
|
27
|
-
inputRef.current
|
|
28
|
-
|
|
40
|
+
if (isEditing) {
|
|
41
|
+
if (inputRef.current) {
|
|
42
|
+
inputRef.current.focus();
|
|
43
|
+
inputRef.current.select();
|
|
44
|
+
}
|
|
45
|
+
} else if (restoreFocusRef.current) {
|
|
46
|
+
restoreFocusRef.current = false;
|
|
47
|
+
displayRef.current?.focus();
|
|
29
48
|
}
|
|
30
49
|
}, [
|
|
31
50
|
isEditing
|
|
32
51
|
]);
|
|
33
|
-
const
|
|
34
|
-
|
|
52
|
+
const startEditing = useCallback(()=>{
|
|
53
|
+
finishedRef.current = false;
|
|
54
|
+
if ('number' === type) setNumberDraft(isEmptyValue(value) ? '' : String(value));
|
|
55
|
+
setIsEditing(true);
|
|
56
|
+
}, [
|
|
57
|
+
type,
|
|
58
|
+
value
|
|
59
|
+
]);
|
|
60
|
+
const finishEditing = useCallback((restoreFocus)=>{
|
|
61
|
+
finishedRef.current = true;
|
|
62
|
+
restoreFocusRef.current = restoreFocus;
|
|
35
63
|
setIsEditing(false);
|
|
64
|
+
}, []);
|
|
65
|
+
const handleSave = useCallback((restoreFocus)=>{
|
|
66
|
+
if (finishedRef.current) return;
|
|
67
|
+
if ('number' === type) {
|
|
68
|
+
const trimmed = numberDraft.trim();
|
|
69
|
+
if ('' === trimmed) {
|
|
70
|
+
if (meta?.nullable && !isEmptyValue(initialValue)) {
|
|
71
|
+
setValue(null);
|
|
72
|
+
onUpdate(null);
|
|
73
|
+
}
|
|
74
|
+
} else {
|
|
75
|
+
let next = Number(trimmed);
|
|
76
|
+
if (Number.isFinite(next)) {
|
|
77
|
+
if (meta?.min !== void 0) next = Math.max(meta.min, next);
|
|
78
|
+
if (meta?.max !== void 0) next = Math.min(meta.max, next);
|
|
79
|
+
if (next !== initialValue) {
|
|
80
|
+
setValue(next);
|
|
81
|
+
onUpdate(next);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
} else if (value !== initialValue) onUpdate(value);
|
|
86
|
+
finishEditing(restoreFocus);
|
|
36
87
|
}, [
|
|
88
|
+
type,
|
|
89
|
+
numberDraft,
|
|
90
|
+
meta?.nullable,
|
|
91
|
+
meta?.min,
|
|
92
|
+
meta?.max,
|
|
37
93
|
value,
|
|
38
94
|
initialValue,
|
|
39
|
-
onUpdate
|
|
95
|
+
onUpdate,
|
|
96
|
+
finishEditing
|
|
40
97
|
]);
|
|
41
98
|
const handleCancel = useCallback(()=>{
|
|
42
99
|
setValue(initialValue);
|
|
43
|
-
|
|
100
|
+
finishEditing(true);
|
|
44
101
|
}, [
|
|
45
|
-
initialValue
|
|
102
|
+
initialValue,
|
|
103
|
+
finishEditing
|
|
46
104
|
]);
|
|
47
105
|
const handleKeyDown = useCallback((e)=>{
|
|
48
106
|
if ('Enter' === e.key) {
|
|
49
107
|
e.preventDefault();
|
|
50
|
-
handleSave();
|
|
108
|
+
handleSave(true);
|
|
51
109
|
} else if ('Escape' === e.key) {
|
|
52
110
|
e.preventDefault();
|
|
53
111
|
handleCancel();
|
|
@@ -65,18 +123,19 @@ function EditableCell({ cell, onUpdate }) {
|
|
|
65
123
|
setValue(checked);
|
|
66
124
|
onUpdate(checked);
|
|
67
125
|
},
|
|
68
|
-
"aria-label":
|
|
126
|
+
"aria-label": toggleLabel ?? 'Toggle'
|
|
69
127
|
})
|
|
70
128
|
});
|
|
71
129
|
const cellContent = isEditing ? renderEditMode() : /*#__PURE__*/ jsx("button", {
|
|
130
|
+
ref: displayRef,
|
|
72
131
|
type: "button",
|
|
73
132
|
"data-slot": "editable-cell",
|
|
74
133
|
className: cn('min-h-[32px] px-2 py-1.5 -mx-2 rounded cursor-pointer w-full text-left', 'hover:bg-muted/50 transition-colors', 'flex items-center bg-transparent border-0'),
|
|
75
|
-
onClick:
|
|
76
|
-
"aria-label": `Edit ${cell.column.id}`,
|
|
134
|
+
onClick: startEditing,
|
|
135
|
+
"aria-label": editLabel ?? `Edit ${cell.column.id}`,
|
|
77
136
|
children: /*#__PURE__*/ jsx("span", {
|
|
78
|
-
className: cn('truncate',
|
|
79
|
-
children: formatDisplayValue(value, type, meta?.options)
|
|
137
|
+
className: cn('truncate', isEmptyValue(value) && 'text-muted-foreground'),
|
|
138
|
+
children: formatDisplayValue(value, type, meta?.options, dateLocale)
|
|
80
139
|
})
|
|
81
140
|
});
|
|
82
141
|
return cellContent;
|
|
@@ -88,11 +147,11 @@ function EditableCell({ cell, onUpdate }) {
|
|
|
88
147
|
onValueChange: (newValue)=>{
|
|
89
148
|
setValue(newValue);
|
|
90
149
|
onUpdate(newValue);
|
|
91
|
-
|
|
150
|
+
finishEditing(true);
|
|
92
151
|
},
|
|
93
152
|
open: true,
|
|
94
153
|
onOpenChange: (open)=>{
|
|
95
|
-
if (!open)
|
|
154
|
+
if (!open) finishEditing(true);
|
|
96
155
|
},
|
|
97
156
|
children: [
|
|
98
157
|
/*#__PURE__*/ jsx(SelectTrigger, {
|
|
@@ -111,21 +170,21 @@ function EditableCell({ cell, onUpdate }) {
|
|
|
111
170
|
});
|
|
112
171
|
case 'date':
|
|
113
172
|
return /*#__PURE__*/ jsx(DatePickerCell, {
|
|
114
|
-
value:
|
|
173
|
+
value: toValidDate(value),
|
|
115
174
|
onValueChange: (date)=>{
|
|
116
175
|
setValue(date);
|
|
117
176
|
onUpdate(date);
|
|
118
177
|
},
|
|
119
|
-
onClose: ()=>
|
|
178
|
+
onClose: ()=>finishEditing(true),
|
|
120
179
|
placeholder: meta?.placeholder ?? 'Pick date'
|
|
121
180
|
});
|
|
122
181
|
case 'number':
|
|
123
182
|
return /*#__PURE__*/ jsx(Input, {
|
|
124
183
|
ref: inputRef,
|
|
125
184
|
type: "number",
|
|
126
|
-
value:
|
|
127
|
-
onChange: (e)=>
|
|
128
|
-
onBlur: handleSave,
|
|
185
|
+
value: numberDraft,
|
|
186
|
+
onChange: (e)=>setNumberDraft(e.target.value),
|
|
187
|
+
onBlur: ()=>handleSave(false),
|
|
129
188
|
onKeyDown: handleKeyDown,
|
|
130
189
|
min: meta?.min,
|
|
131
190
|
max: meta?.max,
|
|
@@ -138,7 +197,7 @@ function EditableCell({ cell, onUpdate }) {
|
|
|
138
197
|
type: "text",
|
|
139
198
|
value: String(value ?? ''),
|
|
140
199
|
onChange: (e)=>setValue(e.target.value),
|
|
141
|
-
onBlur: handleSave,
|
|
200
|
+
onBlur: ()=>handleSave(false),
|
|
142
201
|
onKeyDown: handleKeyDown,
|
|
143
202
|
placeholder: meta?.placeholder,
|
|
144
203
|
className: "h-8 -mx-2 w-full"
|
|
@@ -146,8 +205,8 @@ function EditableCell({ cell, onUpdate }) {
|
|
|
146
205
|
}
|
|
147
206
|
}
|
|
148
207
|
}
|
|
149
|
-
function formatDisplayValue(value, type, options) {
|
|
150
|
-
if (
|
|
208
|
+
function formatDisplayValue(value, type, options, locale) {
|
|
209
|
+
if (isEmptyValue(value)) return '—';
|
|
151
210
|
switch(type){
|
|
152
211
|
case 'select':
|
|
153
212
|
{
|
|
@@ -155,8 +214,12 @@ function formatDisplayValue(value, type, options) {
|
|
|
155
214
|
return option?.label ?? String(value);
|
|
156
215
|
}
|
|
157
216
|
case 'date':
|
|
158
|
-
|
|
159
|
-
|
|
217
|
+
{
|
|
218
|
+
const date = toValidDate(value);
|
|
219
|
+
return date ? format(date, 'PP', {
|
|
220
|
+
locale
|
|
221
|
+
}) : String(value);
|
|
222
|
+
}
|
|
160
223
|
case 'checkbox':
|
|
161
224
|
return value ? 'Yes' : 'No';
|
|
162
225
|
default:
|
|
@@ -204,6 +267,7 @@ function DatePickerCell({ value, onValueChange, onClose, placeholder }) {
|
|
|
204
267
|
children: /*#__PURE__*/ jsx(Calendar, {
|
|
205
268
|
mode: "single",
|
|
206
269
|
selected: value,
|
|
270
|
+
defaultMonth: value,
|
|
207
271
|
onSelect: (date)=>{
|
|
208
272
|
onValueChange(date);
|
|
209
273
|
setOpen(false);
|
|
@@ -33,13 +33,13 @@ var __webpack_modules__ = {
|
|
|
33
33
|
"./button-group" (module) {
|
|
34
34
|
module.exports = require("./button-group.cjs");
|
|
35
35
|
},
|
|
36
|
-
"
|
|
36
|
+
"./button" (module) {
|
|
37
37
|
module.exports = require("./button.cjs");
|
|
38
38
|
},
|
|
39
39
|
"@/components/ui/calendar" (module) {
|
|
40
40
|
module.exports = require("./calendar.cjs");
|
|
41
41
|
},
|
|
42
|
-
"
|
|
42
|
+
"./card" (module) {
|
|
43
43
|
module.exports = require("./card.cjs");
|
|
44
44
|
},
|
|
45
45
|
"./chart" (module) {
|
|
@@ -57,16 +57,16 @@ var __webpack_modules__ = {
|
|
|
57
57
|
"./citation" (module) {
|
|
58
58
|
module.exports = require("./citation.cjs");
|
|
59
59
|
},
|
|
60
|
-
"
|
|
60
|
+
"./code-block" (module) {
|
|
61
61
|
module.exports = require("./code-block.cjs");
|
|
62
62
|
},
|
|
63
|
-
"
|
|
63
|
+
"@/components/ui/collapsible" (module) {
|
|
64
64
|
module.exports = require("./collapsible.cjs");
|
|
65
65
|
},
|
|
66
66
|
"./combobox" (module) {
|
|
67
67
|
module.exports = require("./combobox.cjs");
|
|
68
68
|
},
|
|
69
|
-
"
|
|
69
|
+
"@/components/ui/command" (module) {
|
|
70
70
|
module.exports = require("./command.cjs");
|
|
71
71
|
},
|
|
72
72
|
"./connection-picker" (module) {
|
|
@@ -93,7 +93,7 @@ var __webpack_modules__ = {
|
|
|
93
93
|
"./drawer" (module) {
|
|
94
94
|
module.exports = require("./drawer.cjs");
|
|
95
95
|
},
|
|
96
|
-
"
|
|
96
|
+
"@/components/ui/dropdown-menu" (module) {
|
|
97
97
|
module.exports = require("./dropdown-menu.cjs");
|
|
98
98
|
},
|
|
99
99
|
"./dropzone-overlay" (module) {
|
|
@@ -123,25 +123,25 @@ var __webpack_modules__ = {
|
|
|
123
123
|
"./form-field" (module) {
|
|
124
124
|
module.exports = require("./form-field.cjs");
|
|
125
125
|
},
|
|
126
|
-
"
|
|
126
|
+
"./hover-card" (module) {
|
|
127
127
|
module.exports = require("./hover-card.cjs");
|
|
128
128
|
},
|
|
129
|
-
"
|
|
129
|
+
"./info-tooltip" (module) {
|
|
130
130
|
module.exports = require("./info-tooltip.cjs");
|
|
131
131
|
},
|
|
132
132
|
"@/components/ui/input-group" (module) {
|
|
133
133
|
module.exports = require("./input-group.cjs");
|
|
134
134
|
},
|
|
135
|
-
"
|
|
135
|
+
"@/components/ui/input" (module) {
|
|
136
136
|
module.exports = require("./input.cjs");
|
|
137
137
|
},
|
|
138
138
|
"./json-tree-view" (module) {
|
|
139
139
|
module.exports = require("./json-tree-view/index.cjs");
|
|
140
140
|
},
|
|
141
|
-
"
|
|
141
|
+
"./label" (module) {
|
|
142
142
|
module.exports = require("./label.cjs");
|
|
143
143
|
},
|
|
144
|
-
"
|
|
144
|
+
"./layout" (module) {
|
|
145
145
|
module.exports = require("./layout/index.cjs");
|
|
146
146
|
},
|
|
147
147
|
"./live-region" (module) {
|
|
@@ -186,7 +186,7 @@ var __webpack_modules__ = {
|
|
|
186
186
|
"./password-input" (module) {
|
|
187
187
|
module.exports = require("./password-input.cjs");
|
|
188
188
|
},
|
|
189
|
-
"
|
|
189
|
+
"./popover" (module) {
|
|
190
190
|
module.exports = require("./popover.cjs");
|
|
191
191
|
},
|
|
192
192
|
"@/components/ui/portal-container" (module) {
|
|
@@ -447,7 +447,7 @@ var __webpack_exports__ = {};
|
|
|
447
447
|
"ReferenceChip"
|
|
448
448
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_bubble__rspack_import_9[__rspack_import_key];
|
|
449
449
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
450
|
-
var _button__rspack_import_10 = __webpack_require__("
|
|
450
|
+
var _button__rspack_import_10 = __webpack_require__("./button");
|
|
451
451
|
var __rspack_reexport = {};
|
|
452
452
|
for(const __rspack_import_key in _button__rspack_import_10)if ([
|
|
453
453
|
"getReferenceChipColors",
|
|
@@ -477,7 +477,7 @@ var __webpack_exports__ = {};
|
|
|
477
477
|
"ReferenceChip"
|
|
478
478
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_calendar__rspack_import_12[__rspack_import_key];
|
|
479
479
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
480
|
-
var _card__rspack_import_13 = __webpack_require__("
|
|
480
|
+
var _card__rspack_import_13 = __webpack_require__("./card");
|
|
481
481
|
var __rspack_reexport = {};
|
|
482
482
|
for(const __rspack_import_key in _card__rspack_import_13)if ([
|
|
483
483
|
"getReferenceChipColors",
|
|
@@ -537,7 +537,7 @@ var __webpack_exports__ = {};
|
|
|
537
537
|
"ReferenceChip"
|
|
538
538
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_citation__rspack_import_18[__rspack_import_key];
|
|
539
539
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
540
|
-
var _code_block__rspack_import_19 = __webpack_require__("
|
|
540
|
+
var _code_block__rspack_import_19 = __webpack_require__("./code-block");
|
|
541
541
|
var __rspack_reexport = {};
|
|
542
542
|
for(const __rspack_import_key in _code_block__rspack_import_19)if ([
|
|
543
543
|
"getReferenceChipColors",
|
|
@@ -547,7 +547,7 @@ var __webpack_exports__ = {};
|
|
|
547
547
|
"ReferenceChip"
|
|
548
548
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_code_block__rspack_import_19[__rspack_import_key];
|
|
549
549
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
550
|
-
var _collapsible__rspack_import_20 = __webpack_require__("
|
|
550
|
+
var _collapsible__rspack_import_20 = __webpack_require__("@/components/ui/collapsible");
|
|
551
551
|
var __rspack_reexport = {};
|
|
552
552
|
for(const __rspack_import_key in _collapsible__rspack_import_20)if ([
|
|
553
553
|
"getReferenceChipColors",
|
|
@@ -567,7 +567,7 @@ var __webpack_exports__ = {};
|
|
|
567
567
|
"ReferenceChip"
|
|
568
568
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_combobox__rspack_import_21[__rspack_import_key];
|
|
569
569
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
570
|
-
var _command__rspack_import_22 = __webpack_require__("
|
|
570
|
+
var _command__rspack_import_22 = __webpack_require__("@/components/ui/command");
|
|
571
571
|
var __rspack_reexport = {};
|
|
572
572
|
for(const __rspack_import_key in _command__rspack_import_22)if ([
|
|
573
573
|
"getReferenceChipColors",
|
|
@@ -657,7 +657,7 @@ var __webpack_exports__ = {};
|
|
|
657
657
|
"ReferenceChip"
|
|
658
658
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_drawer__rspack_import_30[__rspack_import_key];
|
|
659
659
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
660
|
-
var _dropdown_menu__rspack_import_31 = __webpack_require__("
|
|
660
|
+
var _dropdown_menu__rspack_import_31 = __webpack_require__("@/components/ui/dropdown-menu");
|
|
661
661
|
var __rspack_reexport = {};
|
|
662
662
|
for(const __rspack_import_key in _dropdown_menu__rspack_import_31)if ([
|
|
663
663
|
"getReferenceChipColors",
|
|
@@ -757,7 +757,7 @@ var __webpack_exports__ = {};
|
|
|
757
757
|
"ReferenceChip"
|
|
758
758
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_form_field__rspack_import_40[__rspack_import_key];
|
|
759
759
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
760
|
-
var _hover_card__rspack_import_41 = __webpack_require__("
|
|
760
|
+
var _hover_card__rspack_import_41 = __webpack_require__("./hover-card");
|
|
761
761
|
var __rspack_reexport = {};
|
|
762
762
|
for(const __rspack_import_key in _hover_card__rspack_import_41)if ([
|
|
763
763
|
"getReferenceChipColors",
|
|
@@ -767,7 +767,7 @@ var __webpack_exports__ = {};
|
|
|
767
767
|
"ReferenceChip"
|
|
768
768
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_hover_card__rspack_import_41[__rspack_import_key];
|
|
769
769
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
770
|
-
var _info_tooltip__rspack_import_42 = __webpack_require__("
|
|
770
|
+
var _info_tooltip__rspack_import_42 = __webpack_require__("./info-tooltip");
|
|
771
771
|
var __rspack_reexport = {};
|
|
772
772
|
for(const __rspack_import_key in _info_tooltip__rspack_import_42)if ([
|
|
773
773
|
"getReferenceChipColors",
|
|
@@ -777,7 +777,7 @@ var __webpack_exports__ = {};
|
|
|
777
777
|
"ReferenceChip"
|
|
778
778
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_info_tooltip__rspack_import_42[__rspack_import_key];
|
|
779
779
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
780
|
-
var _input__rspack_import_43 = __webpack_require__("
|
|
780
|
+
var _input__rspack_import_43 = __webpack_require__("@/components/ui/input");
|
|
781
781
|
var __rspack_reexport = {};
|
|
782
782
|
for(const __rspack_import_key in _input__rspack_import_43)if ([
|
|
783
783
|
"getReferenceChipColors",
|
|
@@ -807,7 +807,7 @@ var __webpack_exports__ = {};
|
|
|
807
807
|
"ReferenceChip"
|
|
808
808
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_json_tree_view__rspack_import_45[__rspack_import_key];
|
|
809
809
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
810
|
-
var _label__rspack_import_46 = __webpack_require__("
|
|
810
|
+
var _label__rspack_import_46 = __webpack_require__("./label");
|
|
811
811
|
var __rspack_reexport = {};
|
|
812
812
|
for(const __rspack_import_key in _label__rspack_import_46)if ([
|
|
813
813
|
"getReferenceChipColors",
|
|
@@ -817,7 +817,7 @@ var __webpack_exports__ = {};
|
|
|
817
817
|
"ReferenceChip"
|
|
818
818
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_label__rspack_import_46[__rspack_import_key];
|
|
819
819
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
820
|
-
var _layout__rspack_import_47 = __webpack_require__("
|
|
820
|
+
var _layout__rspack_import_47 = __webpack_require__("./layout");
|
|
821
821
|
var __rspack_reexport = {};
|
|
822
822
|
for(const __rspack_import_key in _layout__rspack_import_47)if ([
|
|
823
823
|
"getReferenceChipColors",
|
|
@@ -967,7 +967,7 @@ var __webpack_exports__ = {};
|
|
|
967
967
|
"ReferenceChip"
|
|
968
968
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_password_input__rspack_import_61[__rspack_import_key];
|
|
969
969
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
970
|
-
var _popover__rspack_import_62 = __webpack_require__("
|
|
970
|
+
var _popover__rspack_import_62 = __webpack_require__("./popover");
|
|
971
971
|
var __rspack_reexport = {};
|
|
972
972
|
for(const __rspack_import_key in _popover__rspack_import_62)if ([
|
|
973
973
|
"getReferenceChipColors",
|