@bfrs/agentic-components 0.8.7 → 0.8.8
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/data-display/DataTable/TableSaveView.d.ts +14 -1
- package/dist/components/data-display/DataTable/TableSaveView.js +164 -144
- package/dist/components/data-display/DataTable/TableSaveView.js.map +1 -1
- package/dist/components/data-display/DataTable/TableViewSelector.d.ts +15 -1
- package/dist/components/data-display/DataTable/TableViewSelector.js +304 -296
- package/dist/components/data-display/DataTable/TableViewSelector.js.map +1 -1
- package/dist/components/data-display/DataTable/index.d.ts +1 -0
- package/dist/components/data-display/DataTable/savedViewAnalytics.d.ts +109 -0
- package/dist/components/data-display/DataTable/savedViewAnalytics.js +140 -0
- package/dist/components/data-display/DataTable/savedViewAnalytics.js.map +1 -0
- package/dist/components/ui/index.d.ts +2 -0
- package/dist/components/ui/providers/BfrsAnalyticsProvider/BfrsAnalyticsProvider.d.ts +18 -0
- package/dist/components/ui/providers/BfrsAnalyticsProvider/BfrsAnalyticsProvider.js +12 -0
- package/dist/components/ui/providers/BfrsAnalyticsProvider/BfrsAnalyticsProvider.js.map +1 -0
- package/dist/components/ui/providers/BfrsAnalyticsProvider/analyticsContext.d.ts +78 -0
- package/dist/components/ui/providers/BfrsAnalyticsProvider/analyticsContext.js +41 -0
- package/dist/components/ui/providers/BfrsAnalyticsProvider/analyticsContext.js.map +1 -0
- package/dist/components/ui/providers/BfrsAnalyticsProvider/index.d.ts +4 -0
- package/dist/components/ui/providers/BfrsProvider/BfrsProvider.d.ts +25 -0
- package/dist/components/ui/providers/BfrsProvider/BfrsProvider.js +42 -41
- package/dist/components/ui/providers/BfrsProvider/BfrsProvider.js.map +1 -1
- package/dist/custom-elements.js +9120 -8932
- package/dist/custom-elements.js.map +1 -1
- package/dist/index.js +224 -213
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/lint/cli.cjs +6 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { TableColumnVisibilityColumn, ViewFilter, ViewType, SaveViewPayload, SaveViewResult } from './DataTable.types';
|
|
3
3
|
import { SaveViewApiConfig } from './saveViewApi';
|
|
4
|
+
import { SavedViewAnalyticsInput } from './savedViewAnalytics';
|
|
4
5
|
export type TableSaveViewProps = {
|
|
5
6
|
open?: boolean;
|
|
6
7
|
defaultOpen?: boolean;
|
|
@@ -53,5 +54,17 @@ export type TableSaveViewProps = {
|
|
|
53
54
|
preventClose?: boolean;
|
|
54
55
|
className?: string;
|
|
55
56
|
triggerClassName?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Registered ids for reporting this dialog's own moments.
|
|
59
|
+
*
|
|
60
|
+
* Supply it and the component reports the dialog opening and closing, the
|
|
61
|
+
* submission the moment the request is dispatched, a submission its own
|
|
62
|
+
* validation blocked, and the outcome. Omit it and nothing is reported.
|
|
63
|
+
*
|
|
64
|
+
* The submit and the block are observable ONLY here: with `screenName` the
|
|
65
|
+
* component dispatches through its own store, so `onSave` never fires, and a
|
|
66
|
+
* blocked submission produces no callback at all.
|
|
67
|
+
*/
|
|
68
|
+
analytics?: SavedViewAnalyticsInput;
|
|
56
69
|
};
|
|
57
|
-
export declare function TableSaveView({ open, defaultOpen, onOpenChange, onClose, trigger, triggerLabel, title, description, viewName, defaultViewName, onViewNameChange, viewNameLabel, viewNamePlaceholder, appliedLabel, appliedSettings, appliedSettingLabels, columns, visibleColumnIds, hiddenColumnCount, filtersCount, viewType, filters, priority, screenName, saveApi, cancelLabel, saveLabel, onCancel, onSave, onSaved, onError, loading, disabled, closeOnSave, closeOnOverlayClick, closeOnEscape, preventClose, className, triggerClassName }: TableSaveViewProps): import("react/jsx-runtime").JSX.Element;
|
|
70
|
+
export declare function TableSaveView({ open, defaultOpen, onOpenChange, onClose, trigger, triggerLabel, title, description, viewName, defaultViewName, onViewNameChange, viewNameLabel, viewNamePlaceholder, appliedLabel, appliedSettings, appliedSettingLabels, columns, visibleColumnIds, hiddenColumnCount, filtersCount, viewType, filters, priority, screenName, saveApi, cancelLabel, saveLabel, onCancel, onSave, onSaved, onError, loading, disabled, closeOnSave, closeOnOverlayClick, closeOnEscape, preventClose, className, triggerClassName, analytics }: TableSaveViewProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Root as
|
|
3
|
-
import { useId as
|
|
1
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Root as Ct, Trigger as Dt, Portal as Rt, Overlay as zt, Content as Ht, Title as Ft, Description as Wt } from "../../../node_modules/@radix-ui/react-dialog/dist/index.js";
|
|
3
|
+
import { useId as It, useState as V, useMemo as B, useEffect as Bt, useRef as Lt } from "react";
|
|
4
4
|
import r from "@emotion/styled";
|
|
5
|
-
import { kfOverlayIn as
|
|
6
|
-
import { Button as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
5
|
+
import { kfOverlayIn as Pt, kfModalContentIn as jt, twTransform as Ot, twRing as Z } from "../../../lib/emotionTw.js";
|
|
6
|
+
import { Button as L } from "../../primitives/Button/Button.js";
|
|
7
|
+
import { useSavedViewAnalytics as Mt } from "./savedViewAnalytics.js";
|
|
8
|
+
import { isReservedViewName as N, createTableViewSelectorStore as Gt } from "./viewStore.js";
|
|
9
|
+
import { BfrsPortalScope as _t } from "../../ui/providers/BfrsProvider/BfrsProvider.js";
|
|
10
|
+
const $t = /* @__PURE__ */ r(zt, {
|
|
10
11
|
label: "AgenticTableSaveView-overlay"
|
|
11
12
|
})({
|
|
12
13
|
position: "fixed",
|
|
@@ -16,9 +17,9 @@ const jt = /* @__PURE__ */ r(zt, {
|
|
|
16
17
|
left: 0,
|
|
17
18
|
zIndex: 50,
|
|
18
19
|
backgroundColor: "hsl(var(--bfrs-color-text-primary) / .45)",
|
|
19
|
-
...
|
|
20
|
+
...Pt,
|
|
20
21
|
animation: "bfrs-bfrs-overlay-in var(--bfrs-motion-fast) var(--bfrs-ease-out)"
|
|
21
|
-
}),
|
|
22
|
+
}), Et = /* @__PURE__ */ r(Ht, {
|
|
22
23
|
label: "AgenticTableSaveView-content"
|
|
23
24
|
})({
|
|
24
25
|
position: "fixed",
|
|
@@ -28,7 +29,7 @@ const jt = /* @__PURE__ */ r(zt, {
|
|
|
28
29
|
maxHeight: "calc(100dvh - 2rem)",
|
|
29
30
|
width: "calc(100% - 2rem)",
|
|
30
31
|
maxWidth: "420px",
|
|
31
|
-
...
|
|
32
|
+
...Ot({ "--tw-translate-x": "-50%", "--tw-translate-y": "-50%" }),
|
|
32
33
|
overflow: "auto",
|
|
33
34
|
borderRadius: "var(--bfrs-radius-lg)",
|
|
34
35
|
borderWidth: "1px",
|
|
@@ -44,17 +45,17 @@ const jt = /* @__PURE__ */ r(zt, {
|
|
|
44
45
|
boxShadow: "var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)",
|
|
45
46
|
outline: "2px solid transparent",
|
|
46
47
|
outlineOffset: "2px",
|
|
47
|
-
...
|
|
48
|
+
...jt,
|
|
48
49
|
animation: "bfrs-bfrs-modal-content-in var(--bfrs-motion-normal) var(--bfrs-ease-out)",
|
|
49
50
|
"@media (min-width:640px)": {
|
|
50
51
|
padding: "1.25rem"
|
|
51
52
|
}
|
|
52
|
-
}),
|
|
53
|
+
}), Kt = /* @__PURE__ */ r("form", {
|
|
53
54
|
label: "AgenticTableSaveView-form"
|
|
54
55
|
})({
|
|
55
56
|
display: "flex",
|
|
56
57
|
flexDirection: "column"
|
|
57
|
-
}),
|
|
58
|
+
}), Ut = /* @__PURE__ */ r(Ft, {
|
|
58
59
|
label: "AgenticTableSaveView-title"
|
|
59
60
|
})({
|
|
60
61
|
fontSize: "1.125rem",
|
|
@@ -62,7 +63,7 @@ const jt = /* @__PURE__ */ r(zt, {
|
|
|
62
63
|
lineHeight: "1.5rem",
|
|
63
64
|
"--tw-text-opacity": "1",
|
|
64
65
|
color: "hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))"
|
|
65
|
-
}),
|
|
66
|
+
}), qt = /* @__PURE__ */ r(Wt, {
|
|
66
67
|
label: "AgenticTableSaveView-description"
|
|
67
68
|
})({
|
|
68
69
|
marginTop: ".25rem",
|
|
@@ -70,11 +71,11 @@ const jt = /* @__PURE__ */ r(zt, {
|
|
|
70
71
|
lineHeight: "1.25rem",
|
|
71
72
|
"--tw-text-opacity": "1",
|
|
72
73
|
color: "hsl(var(--bfrs-color-text-muted) / var(--tw-text-opacity, 1))"
|
|
73
|
-
}),
|
|
74
|
+
}), Jt = /* @__PURE__ */ r("div", {
|
|
74
75
|
label: "AgenticTableSaveView-field"
|
|
75
76
|
})({
|
|
76
77
|
marginTop: "1.25rem"
|
|
77
|
-
}),
|
|
78
|
+
}), Qt = /* @__PURE__ */ r("label", {
|
|
78
79
|
label: "AgenticTableSaveView-label"
|
|
79
80
|
})({
|
|
80
81
|
display: "block",
|
|
@@ -83,7 +84,7 @@ const jt = /* @__PURE__ */ r(zt, {
|
|
|
83
84
|
lineHeight: "1.25rem",
|
|
84
85
|
"--tw-text-opacity": "1",
|
|
85
86
|
color: "hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))"
|
|
86
|
-
}),
|
|
87
|
+
}), Xt = /* @__PURE__ */ r("input", {
|
|
87
88
|
label: "AgenticTableSaveView-input"
|
|
88
89
|
})({
|
|
89
90
|
marginTop: ".375rem",
|
|
@@ -116,11 +117,11 @@ const jt = /* @__PURE__ */ r(zt, {
|
|
|
116
117
|
color: "hsl(var(--bfrs-color-text-muted) / var(--tw-text-opacity, 1))"
|
|
117
118
|
},
|
|
118
119
|
"&:focus": {
|
|
119
|
-
...
|
|
120
|
+
...Z("2px", "hsl(var(--bfrs-color-primary-soft) / var(--tw-ring-opacity, 1))"),
|
|
120
121
|
"--tw-ring-opacity": "1"
|
|
121
122
|
},
|
|
122
123
|
"&:focus-visible": {
|
|
123
|
-
...
|
|
124
|
+
...Z("2px", "hsl(var(--bfrs-color-primary-soft) / var(--tw-ring-opacity, 1))"),
|
|
124
125
|
"--tw-ring-opacity": "1"
|
|
125
126
|
},
|
|
126
127
|
// Disabled while the save is in flight. The value stays text-primary, which is
|
|
@@ -146,7 +147,7 @@ const jt = /* @__PURE__ */ r(zt, {
|
|
|
146
147
|
color: "hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))",
|
|
147
148
|
WebkitTextFillColor: "hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))"
|
|
148
149
|
}
|
|
149
|
-
}),
|
|
150
|
+
}), tt = /* @__PURE__ */ r("p", {
|
|
150
151
|
label: "AgenticTableSaveView-fieldError"
|
|
151
152
|
})({
|
|
152
153
|
marginTop: ".375rem",
|
|
@@ -154,11 +155,11 @@ const jt = /* @__PURE__ */ r(zt, {
|
|
|
154
155
|
lineHeight: "1rem",
|
|
155
156
|
"--tw-text-opacity": "1",
|
|
156
157
|
color: "hsl(var(--bfrs-color-danger) / var(--tw-text-opacity, 1))"
|
|
157
|
-
}),
|
|
158
|
+
}), Yt = /* @__PURE__ */ r("section", {
|
|
158
159
|
label: "AgenticTableSaveView-section"
|
|
159
160
|
})({
|
|
160
161
|
marginTop: "1.25rem"
|
|
161
|
-
}),
|
|
162
|
+
}), Zt = /* @__PURE__ */ r("div", {
|
|
162
163
|
label: "AgenticTableSaveView-sectionTitle"
|
|
163
164
|
})({
|
|
164
165
|
fontSize: "11px",
|
|
@@ -167,14 +168,14 @@ const jt = /* @__PURE__ */ r(zt, {
|
|
|
167
168
|
letterSpacing: ".12em",
|
|
168
169
|
"--tw-text-opacity": "1",
|
|
169
170
|
color: "hsl(var(--bfrs-color-text-muted) / var(--tw-text-opacity, 1))"
|
|
170
|
-
}),
|
|
171
|
+
}), Nt = /* @__PURE__ */ r("div", {
|
|
171
172
|
label: "AgenticTableSaveView-chips"
|
|
172
173
|
})({
|
|
173
174
|
marginTop: ".5rem",
|
|
174
175
|
display: "flex",
|
|
175
176
|
flexWrap: "wrap",
|
|
176
177
|
gap: ".5rem"
|
|
177
|
-
}),
|
|
178
|
+
}), et = /* @__PURE__ */ r("span", {
|
|
178
179
|
label: "AgenticTableSaveView-chip",
|
|
179
180
|
shouldForwardProp: (o) => o !== "ownerState"
|
|
180
181
|
})(({ ownerState: o }) => [
|
|
@@ -200,7 +201,7 @@ const jt = /* @__PURE__ */ r(zt, {
|
|
|
200
201
|
"--tw-text-opacity": "1",
|
|
201
202
|
color: "hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))"
|
|
202
203
|
}
|
|
203
|
-
]),
|
|
204
|
+
]), te = /* @__PURE__ */ r("div", {
|
|
204
205
|
label: "AgenticTableSaveView-footer"
|
|
205
206
|
})({
|
|
206
207
|
marginTop: "1.5rem",
|
|
@@ -210,7 +211,7 @@ const jt = /* @__PURE__ */ r(zt, {
|
|
|
210
211
|
"@media (min-width:640px)": {
|
|
211
212
|
gridTemplateColumns: "repeat(2,minmax(0,1fr))"
|
|
212
213
|
}
|
|
213
|
-
}),
|
|
214
|
+
}), ee = /* @__PURE__ */ r(L, {
|
|
214
215
|
label: "AgenticTableSaveView-cancelButton"
|
|
215
216
|
})({
|
|
216
217
|
"&&": {
|
|
@@ -235,7 +236,7 @@ const jt = /* @__PURE__ */ r(zt, {
|
|
|
235
236
|
backgroundColor: "hsl(var(--bfrs-color-surface-muted) / var(--tw-bg-opacity, 1))"
|
|
236
237
|
}
|
|
237
238
|
}
|
|
238
|
-
}),
|
|
239
|
+
}), re = /* @__PURE__ */ r(L, {
|
|
239
240
|
label: "AgenticTableSaveView-submitButton"
|
|
240
241
|
})({
|
|
241
242
|
"&&": {
|
|
@@ -276,163 +277,182 @@ const jt = /* @__PURE__ */ r(zt, {
|
|
|
276
277
|
color: "hsl(var(--bfrs-color-text-muted) / var(--tw-text-opacity, 1))"
|
|
277
278
|
}
|
|
278
279
|
}
|
|
279
|
-
}),
|
|
280
|
-
if (!o || !
|
|
281
|
-
const
|
|
282
|
-
return o.filter((
|
|
280
|
+
}), oe = (o) => !!o && typeof o.then == "function", ie = (o, g) => {
|
|
281
|
+
if (!o || !g) return 0;
|
|
282
|
+
const b = new Set(g);
|
|
283
|
+
return o.filter((v) => !b.has(v.id)).length;
|
|
283
284
|
};
|
|
284
|
-
function
|
|
285
|
+
function me({
|
|
285
286
|
open: o,
|
|
286
|
-
defaultOpen:
|
|
287
|
-
onOpenChange:
|
|
288
|
-
onClose:
|
|
289
|
-
trigger:
|
|
290
|
-
triggerLabel:
|
|
291
|
-
title:
|
|
292
|
-
description:
|
|
293
|
-
viewName:
|
|
294
|
-
defaultViewName:
|
|
295
|
-
onViewNameChange:
|
|
296
|
-
viewNameLabel:
|
|
297
|
-
viewNamePlaceholder:
|
|
298
|
-
appliedLabel:
|
|
299
|
-
appliedSettings:
|
|
300
|
-
appliedSettingLabels:
|
|
301
|
-
columns:
|
|
302
|
-
visibleColumnIds:
|
|
303
|
-
hiddenColumnCount:
|
|
304
|
-
filtersCount:
|
|
305
|
-
viewType:
|
|
306
|
-
filters:
|
|
307
|
-
priority:
|
|
308
|
-
screenName:
|
|
309
|
-
saveApi:
|
|
310
|
-
cancelLabel:
|
|
311
|
-
saveLabel:
|
|
312
|
-
onCancel:
|
|
313
|
-
onSave:
|
|
314
|
-
onSaved:
|
|
315
|
-
onError:
|
|
316
|
-
loading:
|
|
317
|
-
disabled:
|
|
318
|
-
closeOnSave:
|
|
319
|
-
closeOnOverlayClick:
|
|
320
|
-
closeOnEscape:
|
|
287
|
+
defaultOpen: g,
|
|
288
|
+
onOpenChange: b,
|
|
289
|
+
onClose: v,
|
|
290
|
+
trigger: P,
|
|
291
|
+
triggerLabel: rt = "Save",
|
|
292
|
+
title: ot = "Save this view",
|
|
293
|
+
description: j = "Give your custom view a name to save it for later",
|
|
294
|
+
viewName: y,
|
|
295
|
+
defaultViewName: k = "",
|
|
296
|
+
onViewNameChange: A,
|
|
297
|
+
viewNameLabel: it = "View Name",
|
|
298
|
+
viewNamePlaceholder: at = "e.g. High Priority Orders",
|
|
299
|
+
appliedLabel: C = "APPLIED FILTERS & SETTINGS",
|
|
300
|
+
appliedSettings: lt,
|
|
301
|
+
appliedSettingLabels: ct,
|
|
302
|
+
columns: O,
|
|
303
|
+
visibleColumnIds: M = [],
|
|
304
|
+
hiddenColumnCount: st,
|
|
305
|
+
filtersCount: D = 0,
|
|
306
|
+
viewType: nt,
|
|
307
|
+
filters: dt,
|
|
308
|
+
priority: pt = 0,
|
|
309
|
+
screenName: x,
|
|
310
|
+
saveApi: m,
|
|
311
|
+
cancelLabel: ft = "Cancel",
|
|
312
|
+
saveLabel: bt = "Save view",
|
|
313
|
+
onCancel: R,
|
|
314
|
+
onSave: G,
|
|
315
|
+
onSaved: d,
|
|
316
|
+
onError: p,
|
|
317
|
+
loading: vt,
|
|
318
|
+
disabled: _,
|
|
319
|
+
closeOnSave: $ = !0,
|
|
320
|
+
closeOnOverlayClick: mt = !0,
|
|
321
|
+
closeOnEscape: ut = !0,
|
|
321
322
|
preventClose: z = !1,
|
|
322
|
-
className:
|
|
323
|
-
triggerClassName:
|
|
323
|
+
className: wt,
|
|
324
|
+
triggerClassName: ht,
|
|
325
|
+
analytics: gt
|
|
324
326
|
}) {
|
|
325
|
-
const
|
|
326
|
-
() =>
|
|
327
|
-
[
|
|
328
|
-
),
|
|
329
|
-
() =>
|
|
330
|
-
[
|
|
331
|
-
),
|
|
327
|
+
const E = It(), [yt, xt] = V(g ?? !1), [St, K] = V(k), [Tt, U] = V(!1), [q, u] = V(null), w = o ?? yt, h = y ?? St, S = !!(vt || Tt), H = st ?? ie(O, M), F = N(h), J = _ || S || h.trim().length === 0 || F, W = B(
|
|
328
|
+
() => m ? { ...m, saveEndpoint: m.saveEndpoint ?? m.endpoint ?? "api/v1/saveview" } : void 0,
|
|
329
|
+
[m]
|
|
330
|
+
), I = B(
|
|
331
|
+
() => x ? Gt(x, W ? { saveApi: W } : void 0) : void 0,
|
|
332
|
+
[W, x]
|
|
333
|
+
), Vt = B(() => {
|
|
332
334
|
const t = [];
|
|
333
|
-
return
|
|
334
|
-
}, [
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
}, [
|
|
338
|
-
const
|
|
339
|
-
!t && z
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
},
|
|
343
|
-
A == null || A(),
|
|
335
|
+
return H > 0 && t.push(`Columns hidden (${H})`), D > 0 && t.push(`Filters applied (${D})`), t;
|
|
336
|
+
}, [H, D]), Q = ct ?? Vt, l = Mt(gt, x);
|
|
337
|
+
Bt(() => {
|
|
338
|
+
w && y === void 0 && K(k), w && u(null);
|
|
339
|
+
}, [w, k, y]);
|
|
340
|
+
const n = Lt(null), T = (t) => {
|
|
341
|
+
if (!t && z) return;
|
|
342
|
+
const f = w;
|
|
343
|
+
o === void 0 && xt(t), b == null || b(t), t || v == null || v(), t && !f ? l.saveOpened() : !t && f && l.saveDismissed(n.current ?? "close_icon"), n.current = null;
|
|
344
|
+
}, kt = (t) => {
|
|
345
|
+
y === void 0 && K(t), A == null || A(t), u(null);
|
|
346
|
+
}, At = () => {
|
|
347
|
+
R == null || R(), n.current = "cancel", T(!1);
|
|
344
348
|
};
|
|
345
|
-
return /* @__PURE__ */
|
|
346
|
-
|
|
347
|
-
/* @__PURE__ */ e(
|
|
348
|
-
/* @__PURE__ */ e(
|
|
349
|
+
return /* @__PURE__ */ s(Ct, { open: w, onOpenChange: T, children: [
|
|
350
|
+
P !== null && /* @__PURE__ */ e(Dt, { asChild: !0, children: P ?? /* @__PURE__ */ e(L, { size: "sm", className: ht, children: rt }) }),
|
|
351
|
+
/* @__PURE__ */ e(Rt, { children: /* @__PURE__ */ s(_t, { children: [
|
|
352
|
+
/* @__PURE__ */ e($t, {}),
|
|
349
353
|
/* @__PURE__ */ e(
|
|
350
|
-
|
|
354
|
+
Et,
|
|
351
355
|
{
|
|
352
|
-
className:
|
|
356
|
+
className: wt,
|
|
353
357
|
onPointerDownOutside: (t) => {
|
|
354
|
-
(!
|
|
358
|
+
if (!mt || z) {
|
|
359
|
+
t.preventDefault();
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
n.current = "outside";
|
|
355
363
|
},
|
|
356
364
|
onEscapeKeyDown: (t) => {
|
|
357
|
-
(!
|
|
365
|
+
if (!ut || z) {
|
|
366
|
+
t.preventDefault();
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
n.current = "esc";
|
|
358
370
|
},
|
|
359
|
-
children: /* @__PURE__ */
|
|
371
|
+
children: /* @__PURE__ */ s(Kt, { onSubmit: (t) => {
|
|
360
372
|
t.preventDefault();
|
|
361
|
-
const
|
|
362
|
-
if (!
|
|
363
|
-
const
|
|
364
|
-
view_type:
|
|
365
|
-
name:
|
|
366
|
-
columns: (
|
|
373
|
+
const f = h.trim();
|
|
374
|
+
if (!f || J || N(f)) return;
|
|
375
|
+
const X = {
|
|
376
|
+
view_type: nt ?? "orders",
|
|
377
|
+
name: f,
|
|
378
|
+
columns: (O ?? []).map((i, a) => ({
|
|
367
379
|
key: i.id,
|
|
368
380
|
order: a,
|
|
369
|
-
visible:
|
|
381
|
+
visible: M.includes(i.id)
|
|
370
382
|
})),
|
|
371
|
-
filters:
|
|
372
|
-
priority:
|
|
383
|
+
filters: dt ?? [],
|
|
384
|
+
priority: pt
|
|
373
385
|
};
|
|
374
|
-
|
|
375
|
-
const
|
|
376
|
-
|
|
386
|
+
u(null);
|
|
387
|
+
const Y = (i) => !!(i.alreadyExists && i.message);
|
|
388
|
+
l.saveSubmitted();
|
|
389
|
+
let c;
|
|
377
390
|
try {
|
|
378
|
-
|
|
391
|
+
c = G ? G(X) : I == null ? void 0 : I.save(X);
|
|
379
392
|
} catch (i) {
|
|
380
|
-
|
|
393
|
+
l.saveFailed(i), p == null || p(i);
|
|
381
394
|
return;
|
|
382
395
|
}
|
|
383
|
-
if (
|
|
384
|
-
|
|
396
|
+
if (oe(c)) {
|
|
397
|
+
U(!0);
|
|
385
398
|
let i = !1;
|
|
386
|
-
|
|
387
|
-
i = !0, a && typeof a == "object" && "view" in a
|
|
399
|
+
c.then((a) => {
|
|
400
|
+
if (i = !0, a && typeof a == "object" && "view" in a) {
|
|
401
|
+
if (Y(a)) {
|
|
402
|
+
i = !1, u(a.message ?? null), l.saveRejectedAsDuplicate();
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
d == null || d(a);
|
|
406
|
+
}
|
|
407
|
+
l.saveCompleted();
|
|
388
408
|
}).catch((a) => {
|
|
389
|
-
|
|
409
|
+
l.saveFailed(a), p == null || p(a);
|
|
390
410
|
}).finally(() => {
|
|
391
|
-
|
|
411
|
+
U(!1), $ && i && (n.current = "completed", T(!1));
|
|
392
412
|
});
|
|
393
413
|
return;
|
|
394
414
|
}
|
|
395
|
-
if (typeof
|
|
396
|
-
if (
|
|
397
|
-
|
|
415
|
+
if (typeof c == "object" && c !== null && "view" in c) {
|
|
416
|
+
if (Y(c)) {
|
|
417
|
+
u(c.message ?? null), l.saveRejectedAsDuplicate();
|
|
398
418
|
return;
|
|
399
419
|
}
|
|
400
|
-
|
|
420
|
+
d == null || d(c), l.saveCompleted();
|
|
401
421
|
}
|
|
402
|
-
|
|
422
|
+
$ && (n.current = "completed", T(!1));
|
|
403
423
|
}, children: [
|
|
404
|
-
/* @__PURE__ */
|
|
405
|
-
/* @__PURE__ */ e(
|
|
406
|
-
|
|
424
|
+
/* @__PURE__ */ s("header", { children: [
|
|
425
|
+
/* @__PURE__ */ e(Ut, { children: ot }),
|
|
426
|
+
j && /* @__PURE__ */ e(qt, { children: j })
|
|
407
427
|
] }),
|
|
408
|
-
/* @__PURE__ */
|
|
409
|
-
/* @__PURE__ */ e(
|
|
428
|
+
/* @__PURE__ */ s(Jt, { children: [
|
|
429
|
+
/* @__PURE__ */ e(Qt, { htmlFor: E, children: it }),
|
|
410
430
|
/* @__PURE__ */ e(
|
|
411
|
-
|
|
431
|
+
Xt,
|
|
412
432
|
{
|
|
413
|
-
id:
|
|
433
|
+
id: E,
|
|
414
434
|
autoFocus: !0,
|
|
415
|
-
value:
|
|
416
|
-
placeholder:
|
|
417
|
-
disabled:
|
|
418
|
-
onChange: (t) =>
|
|
419
|
-
"aria-invalid":
|
|
435
|
+
value: h,
|
|
436
|
+
placeholder: at,
|
|
437
|
+
disabled: _ || S,
|
|
438
|
+
onChange: (t) => kt(t.target.value),
|
|
439
|
+
"aria-invalid": F
|
|
420
440
|
}
|
|
421
441
|
),
|
|
422
|
-
|
|
442
|
+
F ? /* @__PURE__ */ s(tt, { children: [
|
|
423
443
|
"“",
|
|
424
|
-
|
|
444
|
+
h.trim(),
|
|
425
445
|
"” is reserved. Choose a different name."
|
|
426
446
|
] }) : null,
|
|
427
|
-
|
|
447
|
+
q ? /* @__PURE__ */ e(tt, { children: q }) : null
|
|
428
448
|
] }),
|
|
429
|
-
/* @__PURE__ */
|
|
430
|
-
/* @__PURE__ */ e(
|
|
431
|
-
/* @__PURE__ */ e(
|
|
449
|
+
/* @__PURE__ */ s(Yt, { "aria-label": typeof C == "string" ? C : "Applied filters and settings", children: [
|
|
450
|
+
/* @__PURE__ */ e(Zt, { children: C }),
|
|
451
|
+
/* @__PURE__ */ e(Nt, { children: lt ?? (Q.length > 0 ? Q.map((t) => /* @__PURE__ */ e(et, { ownerState: {}, children: t }, t)) : /* @__PURE__ */ e(et, { ownerState: { muted: !0 }, children: "No changes applied" })) })
|
|
432
452
|
] }),
|
|
433
|
-
/* @__PURE__ */
|
|
434
|
-
/* @__PURE__ */ e(
|
|
435
|
-
/* @__PURE__ */ e(
|
|
453
|
+
/* @__PURE__ */ s(te, { children: [
|
|
454
|
+
/* @__PURE__ */ e(ee, { type: "button", variant: "secondary", disabled: S, onClick: At, children: ft }),
|
|
455
|
+
/* @__PURE__ */ e(re, { type: "submit", loading: S, disabled: J, children: bt })
|
|
436
456
|
] })
|
|
437
457
|
] })
|
|
438
458
|
}
|
|
@@ -441,6 +461,6 @@ function se({
|
|
|
441
461
|
] });
|
|
442
462
|
}
|
|
443
463
|
export {
|
|
444
|
-
|
|
464
|
+
me as TableSaveView
|
|
445
465
|
};
|
|
446
466
|
//# sourceMappingURL=TableSaveView.js.map
|