@declarion/react 0.92.0 → 0.94.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.
|
@@ -17,7 +17,7 @@ import { useQuery as S } from "@tanstack/react-query";
|
|
|
17
17
|
import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
18
18
|
import { Link as E, useNavigate as D, useSearchParams as O } from "react-router";
|
|
19
19
|
//#region src/components/pages/auth/SignIn.tsx
|
|
20
|
-
var k = "sso-failure", A = {
|
|
20
|
+
var k = "sso-failure", A = "password-failure", j = {
|
|
21
21
|
google: {
|
|
22
22
|
name: "Google",
|
|
23
23
|
icon: /* @__PURE__ */ w(v, { size: 14 })
|
|
@@ -39,41 +39,41 @@ var k = "sso-failure", A = {
|
|
|
39
39
|
icon: /* @__PURE__ */ w(o.shield, { size: 13 })
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
-
function
|
|
43
|
-
let _ = D(), [v] = O(), { login: y, isLoginPending:
|
|
42
|
+
function M() {
|
|
43
|
+
let _ = D(), [v] = O(), { login: y, isLoginPending: M, isAuthenticated: P } = m(), { data: F } = i(), I = c(), [L, R] = x(""), [z, B] = x(""), [V, H] = x(!0), U = e(v.get("next") || v.get("redirect")), W = v.get("sso_error"), G = c("errors"), { data: K, isPending: q } = S({
|
|
44
44
|
queryKey: ["check-setup"],
|
|
45
45
|
queryFn: t
|
|
46
|
-
}), { data:
|
|
46
|
+
}), { data: J } = S({
|
|
47
47
|
queryKey: ["identity-providers"],
|
|
48
48
|
queryFn: () => n(),
|
|
49
49
|
staleTime: 6e4
|
|
50
50
|
});
|
|
51
51
|
if (b(() => {
|
|
52
|
-
|
|
53
|
-
}, [
|
|
54
|
-
if (!
|
|
55
|
-
let e = p(
|
|
56
|
-
|
|
52
|
+
K?.needs_setup && _("/signup", { replace: !0 });
|
|
53
|
+
}, [K, _]), b(() => {
|
|
54
|
+
if (!P || (f.dismiss(A), f.dismiss(k), !F)) return;
|
|
55
|
+
let e = p(U, F);
|
|
56
|
+
N(U, e) && f.warning(I("auth.inaccessible_redirect", "You do not have access to that page. We opened your default page instead.")), _(e, { replace: !0 });
|
|
57
57
|
}, [
|
|
58
|
-
N,
|
|
59
|
-
_,
|
|
60
|
-
H,
|
|
61
58
|
P,
|
|
62
|
-
|
|
59
|
+
_,
|
|
60
|
+
U,
|
|
61
|
+
F,
|
|
62
|
+
I
|
|
63
63
|
]), b(() => {
|
|
64
|
-
|
|
65
|
-
}, [
|
|
66
|
-
function
|
|
64
|
+
W && f.error(G(W, "Sign-in failed."), void 0, { id: k });
|
|
65
|
+
}, [G, W]), q || K?.needs_setup) return /* @__PURE__ */ w(g, {});
|
|
66
|
+
function Y(e) {
|
|
67
67
|
e.preventDefault(), y({
|
|
68
|
-
email:
|
|
69
|
-
password:
|
|
70
|
-
remember:
|
|
68
|
+
email: L,
|
|
69
|
+
password: z,
|
|
70
|
+
remember: V
|
|
71
71
|
}, { onError: (e) => {
|
|
72
|
-
f.error(a(
|
|
72
|
+
f.error(a(G, e), void 0, { id: A });
|
|
73
73
|
} });
|
|
74
74
|
}
|
|
75
75
|
return /* @__PURE__ */ w(h, { children: /* @__PURE__ */ T("form", {
|
|
76
|
-
onSubmit:
|
|
76
|
+
onSubmit: Y,
|
|
77
77
|
children: [
|
|
78
78
|
/* @__PURE__ */ w("div", {
|
|
79
79
|
style: {
|
|
@@ -83,7 +83,7 @@ function j() {
|
|
|
83
83
|
letterSpacing: "0.1em",
|
|
84
84
|
textTransform: "uppercase"
|
|
85
85
|
},
|
|
86
|
-
children:
|
|
86
|
+
children: I("auth.signin.eyebrow", "Welcome back")
|
|
87
87
|
}),
|
|
88
88
|
/* @__PURE__ */ w("h2", {
|
|
89
89
|
style: {
|
|
@@ -92,7 +92,7 @@ function j() {
|
|
|
92
92
|
fontWeight: 600,
|
|
93
93
|
letterSpacing: "-0.018em"
|
|
94
94
|
},
|
|
95
|
-
children:
|
|
95
|
+
children: I("auth.signin.title", "Sign in")
|
|
96
96
|
}),
|
|
97
97
|
/* @__PURE__ */ w("p", {
|
|
98
98
|
style: {
|
|
@@ -100,17 +100,17 @@ function j() {
|
|
|
100
100
|
fontSize: 13,
|
|
101
101
|
color: "var(--text-3)"
|
|
102
102
|
},
|
|
103
|
-
children:
|
|
103
|
+
children: I("auth.signin.subtitle", "Use your corporate SSO or email & password.")
|
|
104
104
|
}),
|
|
105
|
-
|
|
105
|
+
J && J.length > 0 && /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("div", {
|
|
106
106
|
style: {
|
|
107
107
|
display: "flex",
|
|
108
108
|
flexDirection: "column",
|
|
109
109
|
gap: 6,
|
|
110
110
|
marginBottom: 12
|
|
111
111
|
},
|
|
112
|
-
children:
|
|
113
|
-
let t =
|
|
112
|
+
children: J.map((e) => {
|
|
113
|
+
let t = j[e.slug.toLowerCase()] ?? {
|
|
114
114
|
name: e.name,
|
|
115
115
|
icon: /* @__PURE__ */ w(o.shield, { size: 13 })
|
|
116
116
|
};
|
|
@@ -122,9 +122,9 @@ function j() {
|
|
|
122
122
|
},
|
|
123
123
|
icon: t.icon,
|
|
124
124
|
onClick: (t) => {
|
|
125
|
-
t.preventDefault(), window.location.href = r(e.slug, void 0,
|
|
125
|
+
t.preventDefault(), window.location.href = r(e.slug, void 0, U);
|
|
126
126
|
},
|
|
127
|
-
children:
|
|
127
|
+
children: I("auth.signin.sso_continue", "Continue with {provider}", { provider: t.name })
|
|
128
128
|
}, e.slug);
|
|
129
129
|
})
|
|
130
130
|
}), /* @__PURE__ */ T("div", {
|
|
@@ -147,7 +147,7 @@ function j() {
|
|
|
147
147
|
letterSpacing: "0.08em",
|
|
148
148
|
textTransform: "uppercase"
|
|
149
149
|
},
|
|
150
|
-
children:
|
|
150
|
+
children: I("auth.signin.sso_divider", "or with email")
|
|
151
151
|
}),
|
|
152
152
|
/* @__PURE__ */ w("span", { style: {
|
|
153
153
|
flex: 1,
|
|
@@ -163,11 +163,11 @@ function j() {
|
|
|
163
163
|
gap: 12
|
|
164
164
|
},
|
|
165
165
|
children: [
|
|
166
|
-
/* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w(l, { children:
|
|
167
|
-
value:
|
|
168
|
-
onChange:
|
|
166
|
+
/* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w(l, { children: I("auth.field.email", "Email") }), /* @__PURE__ */ w(d, {
|
|
167
|
+
value: L,
|
|
168
|
+
onChange: R,
|
|
169
169
|
prefix: /* @__PURE__ */ w(o.email, { size: 13 }),
|
|
170
|
-
placeholder:
|
|
170
|
+
placeholder: I("auth.field.email_placeholder", "you@company.com"),
|
|
171
171
|
autoFocus: !0,
|
|
172
172
|
required: !0
|
|
173
173
|
})] }),
|
|
@@ -177,7 +177,7 @@ function j() {
|
|
|
177
177
|
alignItems: "center"
|
|
178
178
|
},
|
|
179
179
|
children: [
|
|
180
|
-
/* @__PURE__ */ w(l, { children:
|
|
180
|
+
/* @__PURE__ */ w(l, { children: I("auth.field.password", "Password") }),
|
|
181
181
|
/* @__PURE__ */ w("div", { style: { flex: 1 } }),
|
|
182
182
|
/* @__PURE__ */ w(E, {
|
|
183
183
|
to: "/forgot",
|
|
@@ -187,13 +187,13 @@ function j() {
|
|
|
187
187
|
marginBottom: 4,
|
|
188
188
|
textDecoration: "none"
|
|
189
189
|
},
|
|
190
|
-
children:
|
|
190
|
+
children: I("auth.signin.forgot_link", "Forgot?")
|
|
191
191
|
})
|
|
192
192
|
]
|
|
193
193
|
}), /* @__PURE__ */ w(u, {
|
|
194
|
-
value:
|
|
195
|
-
onChange:
|
|
196
|
-
placeholder:
|
|
194
|
+
value: z,
|
|
195
|
+
onChange: B,
|
|
196
|
+
placeholder: I("auth.signin.password_placeholder", "Your password")
|
|
197
197
|
})] }),
|
|
198
198
|
/* @__PURE__ */ T("label", {
|
|
199
199
|
style: {
|
|
@@ -207,11 +207,11 @@ function j() {
|
|
|
207
207
|
/* @__PURE__ */ w("input", {
|
|
208
208
|
type: "checkbox",
|
|
209
209
|
name: "remember",
|
|
210
|
-
checked:
|
|
211
|
-
onChange: (e) =>
|
|
210
|
+
checked: V,
|
|
211
|
+
onChange: (e) => H(e.target.checked)
|
|
212
212
|
}),
|
|
213
213
|
" ",
|
|
214
|
-
|
|
214
|
+
I("auth.signin.remember", "Keep me signed in on this device")
|
|
215
215
|
]
|
|
216
216
|
}),
|
|
217
217
|
/* @__PURE__ */ w(s, {
|
|
@@ -222,10 +222,10 @@ function j() {
|
|
|
222
222
|
justifyContent: "center",
|
|
223
223
|
width: "100%"
|
|
224
224
|
},
|
|
225
|
-
disabled:
|
|
226
|
-
children:
|
|
225
|
+
disabled: M,
|
|
226
|
+
children: M ? I("auth.signin.submitting", "Signing in…") : I("auth.signin.submit", "Continue")
|
|
227
227
|
}),
|
|
228
|
-
|
|
228
|
+
K?.signup_enabled && /* @__PURE__ */ T("div", {
|
|
229
229
|
style: {
|
|
230
230
|
fontSize: 12,
|
|
231
231
|
color: "var(--text-3)",
|
|
@@ -233,7 +233,7 @@ function j() {
|
|
|
233
233
|
marginTop: 4
|
|
234
234
|
},
|
|
235
235
|
children: [
|
|
236
|
-
|
|
236
|
+
I("auth.signin.new_here", "New here?"),
|
|
237
237
|
" ",
|
|
238
238
|
/* @__PURE__ */ w(E, {
|
|
239
239
|
to: "/signup",
|
|
@@ -242,7 +242,7 @@ function j() {
|
|
|
242
242
|
fontWeight: 500,
|
|
243
243
|
textDecoration: "none"
|
|
244
244
|
},
|
|
245
|
-
children:
|
|
245
|
+
children: I("auth.signin.request_access", "Create an account")
|
|
246
246
|
})
|
|
247
247
|
]
|
|
248
248
|
})
|
|
@@ -251,10 +251,10 @@ function j() {
|
|
|
251
251
|
]
|
|
252
252
|
}) });
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function N(e, t) {
|
|
255
255
|
if (e === t) return !1;
|
|
256
256
|
let n = e.split(/[?#]/, 1)[0].replace(/\/+$/, "") || "/";
|
|
257
257
|
return n !== "/" && n !== "/admin";
|
|
258
258
|
}
|
|
259
259
|
//#endregion
|
|
260
|
-
export {
|
|
260
|
+
export { M as SignIn };
|
|
@@ -23,26 +23,26 @@ import { activeRoleLabel as C } from "../../../lib/role-label.js";
|
|
|
23
23
|
import { useBrandingChrome as w } from "../../../hooks/useBrandingChrome.js";
|
|
24
24
|
import { useCurrentScreen as T } from "../../../hooks/useCurrentScreen.js";
|
|
25
25
|
import { useObject as E } from "../../../hooks/useObject.js";
|
|
26
|
-
import { FileDraftScope as
|
|
27
|
-
import { singleFileFromValue as
|
|
28
|
-
import { getFileFieldValue as
|
|
29
|
-
import { buildFilesPayload as
|
|
30
|
-
import { EMPTY_CELL as
|
|
31
|
-
import { ChangePasswordDialog as
|
|
32
|
-
import { FieldRow as
|
|
33
|
-
import { AssociatedBlock as
|
|
34
|
-
import { DetailAuditStrip as
|
|
35
|
-
import { RecordHeader as
|
|
36
|
-
import { PageShell as
|
|
37
|
-
import { ErrorLine as
|
|
38
|
-
import { ParamsBlock as
|
|
39
|
-
import { Fragment as
|
|
40
|
-
import { Fragment as
|
|
26
|
+
import { FileDraftScope as ee, useFileDraftScope as D } from "../../file-widgets/draft-scope.js";
|
|
27
|
+
import { singleFileFromValue as O } from "../../file-widgets/value.js";
|
|
28
|
+
import { getFileFieldValue as k, renderSchemaField as A } from "../../file-widgets/host.js";
|
|
29
|
+
import { buildFilesPayload as j } from "../../file-widgets/payload.js";
|
|
30
|
+
import { EMPTY_CELL as te } from "../../fields/cells/factories/emptyCell.js";
|
|
31
|
+
import { ChangePasswordDialog as ne } from "../../shared/ChangePasswordDialog.js";
|
|
32
|
+
import { FieldRow as M, FieldsGrid as N } from "../../detail-layout/FieldRow.js";
|
|
33
|
+
import { AssociatedBlock as P } from "../../detail-layout/AssociatedBlock.js";
|
|
34
|
+
import { DetailAuditStrip as F } from "../../detail-layout/DetailAuditStrip.js";
|
|
35
|
+
import { RecordHeader as I } from "../../chrome/RecordHeader.js";
|
|
36
|
+
import { PageShell as re } from "../../chrome/PageShell.js";
|
|
37
|
+
import { ErrorLine as L } from "../../params/param-editors.js";
|
|
38
|
+
import { ParamsBlock as R } from "../../params/ParamsBlock.js";
|
|
39
|
+
import { Fragment as z, useId as B, useState as V } from "react";
|
|
40
|
+
import { Fragment as H, jsx as U, jsxs as W } from "react/jsx-runtime";
|
|
41
41
|
//#region src/components/pages/profile/Profile.impl.tsx
|
|
42
|
-
var
|
|
43
|
-
function
|
|
44
|
-
let r = S(), o = t((e) => e.user), s = t((e) => e.activeTenant), u = t((e) => e.refreshMe), { data: h } = n(), g = T(), _ = w("custom"), v = p(), b = E(a, o?.id),
|
|
45
|
-
entity:
|
|
42
|
+
var G = "avatar";
|
|
43
|
+
function K() {
|
|
44
|
+
let r = S(), o = t((e) => e.user), s = t((e) => e.activeTenant), u = t((e) => e.refreshMe), { data: h } = n(), g = T(), _ = w("custom"), v = p(), b = E(a, o?.id), D = b.data?.data, [O, k] = V(!1), [j, P] = V(!1), L = h?.entities[a], R = o?.display_name || o?.email || v("profile.user_fallback", "User"), z = (e) => v(o?.role_names?.[e]) || e, B = C(o, v), G = s?.env ? `${s.name} · ${s.env}` : s?.name ?? "—", K = (e) => L && A({
|
|
45
|
+
entity: L,
|
|
46
46
|
entityCode: "profile",
|
|
47
47
|
fieldName: e,
|
|
48
48
|
record: {
|
|
@@ -52,33 +52,33 @@ function X() {
|
|
|
52
52
|
mode: "display",
|
|
53
53
|
t: v
|
|
54
54
|
});
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
header: /* @__PURE__ */
|
|
55
|
+
return /* @__PURE__ */ W(H, { children: [
|
|
56
|
+
/* @__PURE__ */ W(re, {
|
|
57
|
+
header: /* @__PURE__ */ U("div", {
|
|
58
58
|
"data-testid": "profile-hero",
|
|
59
|
-
children: /* @__PURE__ */
|
|
60
|
-
icon:
|
|
61
|
-
name:
|
|
59
|
+
children: /* @__PURE__ */ U(I, {
|
|
60
|
+
icon: L?.display.icon ? /* @__PURE__ */ U(x, {
|
|
61
|
+
name: L.display.icon,
|
|
62
62
|
size: 16
|
|
63
63
|
}) : void 0,
|
|
64
|
-
title:
|
|
64
|
+
title: R,
|
|
65
65
|
mode: "display",
|
|
66
66
|
showTitle: _.isVisible("show_title"),
|
|
67
|
-
highlights: /* @__PURE__ */
|
|
67
|
+
highlights: /* @__PURE__ */ W("div", {
|
|
68
68
|
className: "flex flex-wrap gap-1",
|
|
69
69
|
children: [
|
|
70
|
-
/* @__PURE__ */
|
|
70
|
+
/* @__PURE__ */ U(d, {
|
|
71
71
|
tone: "violet",
|
|
72
72
|
size: "xs",
|
|
73
73
|
dot: !0,
|
|
74
|
-
children:
|
|
74
|
+
children: B
|
|
75
75
|
}),
|
|
76
|
-
/* @__PURE__ */
|
|
76
|
+
/* @__PURE__ */ U(d, {
|
|
77
77
|
tone: "slate",
|
|
78
78
|
size: "xs",
|
|
79
|
-
children:
|
|
79
|
+
children: G
|
|
80
80
|
}),
|
|
81
|
-
o?.is_active && /* @__PURE__ */
|
|
81
|
+
o?.is_active && /* @__PURE__ */ U(d, {
|
|
82
82
|
tone: "emerald",
|
|
83
83
|
size: "xs",
|
|
84
84
|
dot: !0,
|
|
@@ -86,86 +86,86 @@ function X() {
|
|
|
86
86
|
})
|
|
87
87
|
]
|
|
88
88
|
}),
|
|
89
|
-
right: _.isVisible("show_actions") && /* @__PURE__ */
|
|
90
|
-
icon: /* @__PURE__ */
|
|
91
|
-
onClick: () =>
|
|
89
|
+
right: _.isVisible("show_actions") && /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U(l, {
|
|
90
|
+
icon: /* @__PURE__ */ U(c.edit, { size: 13 }),
|
|
91
|
+
onClick: () => P(!0),
|
|
92
92
|
children: v("profile.edit", "Edit profile")
|
|
93
|
-
}), /* @__PURE__ */
|
|
94
|
-
icon: /* @__PURE__ */
|
|
93
|
+
}), /* @__PURE__ */ U(l, {
|
|
94
|
+
icon: /* @__PURE__ */ U(c.settings, { size: 13 }),
|
|
95
95
|
onClick: () => r("/preferences", { topLevel: !0 }),
|
|
96
96
|
children: v("profile.preferences", "Preferences")
|
|
97
97
|
})] })
|
|
98
98
|
})
|
|
99
99
|
}),
|
|
100
100
|
children: [
|
|
101
|
-
/* @__PURE__ */
|
|
101
|
+
/* @__PURE__ */ U(m, {
|
|
102
102
|
title: v("profile.personal.title", "Personal info"),
|
|
103
|
-
icon: /* @__PURE__ */
|
|
104
|
-
children: /* @__PURE__ */
|
|
103
|
+
icon: /* @__PURE__ */ U(c.users, { size: 14 }),
|
|
104
|
+
children: /* @__PURE__ */ U("div", {
|
|
105
105
|
"data-testid": "profile-personal-info-grid",
|
|
106
|
-
children: /* @__PURE__ */
|
|
107
|
-
o &&
|
|
106
|
+
children: /* @__PURE__ */ W(N, { children: [
|
|
107
|
+
o && L && D && /* @__PURE__ */ U(M, {
|
|
108
108
|
label: v("profile.avatar", "Avatar"),
|
|
109
|
-
children: /* @__PURE__ */
|
|
109
|
+
children: /* @__PURE__ */ U(ee, { children: /* @__PURE__ */ U(J, {
|
|
110
110
|
userId: o.id,
|
|
111
|
-
entity:
|
|
112
|
-
record:
|
|
111
|
+
entity: L,
|
|
112
|
+
record: D,
|
|
113
113
|
onCommitted: async () => {
|
|
114
114
|
await b.refetch();
|
|
115
115
|
}
|
|
116
|
-
},
|
|
116
|
+
}, q(D)) })
|
|
117
117
|
}),
|
|
118
|
-
/* @__PURE__ */
|
|
118
|
+
/* @__PURE__ */ U(M, {
|
|
119
119
|
label: v("profile.display_name", "Display name"),
|
|
120
|
-
children:
|
|
120
|
+
children: K("display_name")
|
|
121
121
|
}),
|
|
122
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ U(M, {
|
|
123
123
|
label: v("profile.personal.email", "Email"),
|
|
124
124
|
"data-testid": "profile-email",
|
|
125
|
-
children:
|
|
125
|
+
children: K("email")
|
|
126
126
|
}),
|
|
127
|
-
/* @__PURE__ */
|
|
127
|
+
/* @__PURE__ */ U(M, {
|
|
128
128
|
label: v("profile.personal.timezone", "Timezone"),
|
|
129
|
-
children:
|
|
129
|
+
children: X()
|
|
130
130
|
}),
|
|
131
|
-
/* @__PURE__ */
|
|
131
|
+
/* @__PURE__ */ U($, {})
|
|
132
132
|
] })
|
|
133
133
|
})
|
|
134
134
|
}),
|
|
135
|
-
/* @__PURE__ */
|
|
135
|
+
/* @__PURE__ */ U(m, {
|
|
136
136
|
title: v("profile.security.title", "Security"),
|
|
137
|
-
icon: /* @__PURE__ */
|
|
138
|
-
children: /* @__PURE__ */
|
|
137
|
+
icon: /* @__PURE__ */ U(c.shield, { size: 14 }),
|
|
138
|
+
children: /* @__PURE__ */ U(N, { children: /* @__PURE__ */ U(M, {
|
|
139
139
|
label: v("profile.security.password", "Password"),
|
|
140
140
|
hint: v("profile.security.password_hint", "Update at any time"),
|
|
141
|
-
children: /* @__PURE__ */
|
|
141
|
+
children: /* @__PURE__ */ U(l, {
|
|
142
142
|
size: "xs",
|
|
143
|
-
onClick: () =>
|
|
143
|
+
onClick: () => k(!0),
|
|
144
144
|
children: v("profile.security.password_change", "Change")
|
|
145
145
|
})
|
|
146
146
|
}) })
|
|
147
147
|
}),
|
|
148
|
-
/* @__PURE__ */
|
|
148
|
+
/* @__PURE__ */ U(m, {
|
|
149
149
|
title: v("profile.access.title", "Access"),
|
|
150
|
-
icon: /* @__PURE__ */
|
|
151
|
-
children: /* @__PURE__ */
|
|
152
|
-
/* @__PURE__ */
|
|
150
|
+
icon: /* @__PURE__ */ U(c.key, { size: 14 }),
|
|
151
|
+
children: /* @__PURE__ */ W(N, { children: [
|
|
152
|
+
/* @__PURE__ */ U(M, {
|
|
153
153
|
label: v("profile.access.role", "Role"),
|
|
154
|
-
children: /* @__PURE__ */
|
|
154
|
+
children: /* @__PURE__ */ U(d, {
|
|
155
155
|
tone: "violet",
|
|
156
156
|
size: "xs",
|
|
157
157
|
dot: !0,
|
|
158
|
-
children:
|
|
158
|
+
children: B
|
|
159
159
|
})
|
|
160
160
|
}),
|
|
161
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ U(M, {
|
|
162
162
|
label: v("profile.access.groups", "Groups"),
|
|
163
|
-
children: o?.roles && o.roles.length > 0 ? /* @__PURE__ */
|
|
163
|
+
children: o?.roles && o.roles.length > 0 ? /* @__PURE__ */ U("div", {
|
|
164
164
|
className: "flex flex-wrap gap-1",
|
|
165
|
-
children: o.roles.map((e) => /* @__PURE__ */
|
|
166
|
-
}) :
|
|
165
|
+
children: o.roles.map((e) => /* @__PURE__ */ U(f, { children: z(e) }, e))
|
|
166
|
+
}) : te
|
|
167
167
|
}),
|
|
168
|
-
/* @__PURE__ */
|
|
168
|
+
/* @__PURE__ */ U(M, {
|
|
169
169
|
label: v("profile.access.permissions", "Permissions"),
|
|
170
170
|
children: i(v, "profile.access.permissions_explicit", o?.permissions?.length ?? 0, {
|
|
171
171
|
one: "{count} explicit",
|
|
@@ -174,44 +174,44 @@ function X() {
|
|
|
174
174
|
})
|
|
175
175
|
] })
|
|
176
176
|
}),
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
o?.id && /* @__PURE__ */
|
|
179
|
-
g?.screen && h &&
|
|
177
|
+
/* @__PURE__ */ U(ie, { userId: o?.id }),
|
|
178
|
+
o?.id && /* @__PURE__ */ U(Z, { userId: o.id }),
|
|
179
|
+
g?.screen && h && L && D && /* @__PURE__ */ U(F, {
|
|
180
180
|
screen: g.screen,
|
|
181
|
-
entity:
|
|
181
|
+
entity: L,
|
|
182
182
|
entityCode: "profile",
|
|
183
|
-
record:
|
|
183
|
+
record: D,
|
|
184
184
|
recordId: o?.id,
|
|
185
185
|
schema: h
|
|
186
186
|
})
|
|
187
187
|
]
|
|
188
188
|
}),
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
open:
|
|
189
|
+
/* @__PURE__ */ U(Y, {
|
|
190
|
+
open: j,
|
|
191
191
|
initialName: o?.display_name ?? "",
|
|
192
192
|
userId: o?.id ?? "",
|
|
193
|
-
onClose: () =>
|
|
193
|
+
onClose: () => P(!1),
|
|
194
194
|
onSaved: async () => {
|
|
195
|
-
await u(),
|
|
195
|
+
await u(), P(!1);
|
|
196
196
|
}
|
|
197
197
|
}),
|
|
198
|
-
/* @__PURE__ */
|
|
199
|
-
open:
|
|
200
|
-
onClose: () =>
|
|
198
|
+
/* @__PURE__ */ U(ne, {
|
|
199
|
+
open: O,
|
|
200
|
+
onClose: () => k(!1),
|
|
201
201
|
onSubmit: async ({ current: t, next: n }) => {
|
|
202
202
|
await e(t, n), y.success(v("profile.password.changed", "Password changed. Sign in again to continue."));
|
|
203
203
|
}
|
|
204
204
|
})
|
|
205
205
|
] });
|
|
206
206
|
}
|
|
207
|
-
function
|
|
208
|
-
return k(
|
|
207
|
+
function q(e) {
|
|
208
|
+
return O(k(e, G))?.id ?? "";
|
|
209
209
|
}
|
|
210
|
-
function
|
|
211
|
-
let i = p(), c = p("errors"), l =
|
|
212
|
-
let f =
|
|
210
|
+
function J({ userId: e, entity: t, record: n, onCommitted: r }) {
|
|
211
|
+
let i = p(), c = p("errors"), l = D(), [u, d] = V(!1), [f, m] = V(0), h = async (u) => {
|
|
212
|
+
let f = j({
|
|
213
213
|
entity: t,
|
|
214
|
-
formData: { [
|
|
214
|
+
formData: { [G]: u },
|
|
215
215
|
record: n,
|
|
216
216
|
isNew: !1
|
|
217
217
|
});
|
|
@@ -219,7 +219,7 @@ function ee({ userId: e, entity: t, record: n, onCommitted: r }) {
|
|
|
219
219
|
d(!0);
|
|
220
220
|
try {
|
|
221
221
|
await o(a, { id: e }, { $files: f });
|
|
222
|
-
let t =
|
|
222
|
+
let t = q({ [G]: u });
|
|
223
223
|
t && l.markCommitted(t), await r(), y.success(i("profile.avatar.updated", "Avatar updated."));
|
|
224
224
|
} catch (e) {
|
|
225
225
|
await l.flushAllDrafts(), m((e) => e + 1), y.error(s(c, e));
|
|
@@ -228,10 +228,10 @@ function ee({ userId: e, entity: t, record: n, onCommitted: r }) {
|
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
};
|
|
231
|
-
return /* @__PURE__ */
|
|
231
|
+
return /* @__PURE__ */ U(z, { children: A({
|
|
232
232
|
entity: t,
|
|
233
233
|
entityCode: a,
|
|
234
|
-
fieldName:
|
|
234
|
+
fieldName: G,
|
|
235
235
|
record: n,
|
|
236
236
|
mode: "edit",
|
|
237
237
|
onChange: (e) => void h(e),
|
|
@@ -240,13 +240,13 @@ function ee({ userId: e, entity: t, record: n, onCommitted: r }) {
|
|
|
240
240
|
fieldId: "profile-avatar"
|
|
241
241
|
}) }, f);
|
|
242
242
|
}
|
|
243
|
-
function
|
|
244
|
-
let d = h().isPhone, f = p(), m = p("errors"), y =
|
|
243
|
+
function Y({ open: e, initialName: t, userId: n, onClose: r, onSaved: i }) {
|
|
244
|
+
let d = h().isPhone, f = p(), m = p("errors"), y = B(), [b, x] = V(t), [S, C] = V(!1), [w, T] = V(null);
|
|
245
245
|
if (!e) return null;
|
|
246
246
|
let E = () => {
|
|
247
247
|
x(t), T(null), r();
|
|
248
248
|
};
|
|
249
|
-
return /* @__PURE__ */
|
|
249
|
+
return /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("div", {
|
|
250
250
|
onClick: E,
|
|
251
251
|
style: {
|
|
252
252
|
position: "fixed",
|
|
@@ -255,7 +255,7 @@ function te({ open: e, initialName: t, userId: n, onClose: r, onSaved: i }) {
|
|
|
255
255
|
zIndex: 60,
|
|
256
256
|
backdropFilter: "blur(2px)"
|
|
257
257
|
}
|
|
258
|
-
}), /* @__PURE__ */
|
|
258
|
+
}), /* @__PURE__ */ W("div", {
|
|
259
259
|
"data-testid": "edit-profile-dialog",
|
|
260
260
|
style: {
|
|
261
261
|
position: "fixed",
|
|
@@ -272,7 +272,7 @@ function te({ open: e, initialName: t, userId: n, onClose: r, onSaved: i }) {
|
|
|
272
272
|
overflow: "hidden"
|
|
273
273
|
},
|
|
274
274
|
children: [
|
|
275
|
-
/* @__PURE__ */
|
|
275
|
+
/* @__PURE__ */ W("div", {
|
|
276
276
|
style: {
|
|
277
277
|
padding: "14px 18px 0",
|
|
278
278
|
display: "flex",
|
|
@@ -280,7 +280,7 @@ function te({ open: e, initialName: t, userId: n, onClose: r, onSaved: i }) {
|
|
|
280
280
|
gap: 10
|
|
281
281
|
},
|
|
282
282
|
children: [
|
|
283
|
-
/* @__PURE__ */
|
|
283
|
+
/* @__PURE__ */ U("span", {
|
|
284
284
|
style: {
|
|
285
285
|
width: 28,
|
|
286
286
|
height: 28,
|
|
@@ -291,18 +291,18 @@ function te({ open: e, initialName: t, userId: n, onClose: r, onSaved: i }) {
|
|
|
291
291
|
alignItems: "center",
|
|
292
292
|
justifyContent: "center"
|
|
293
293
|
},
|
|
294
|
-
children: /* @__PURE__ */
|
|
294
|
+
children: /* @__PURE__ */ U(c.edit, { size: 15 })
|
|
295
295
|
}),
|
|
296
|
-
/* @__PURE__ */
|
|
296
|
+
/* @__PURE__ */ W("div", {
|
|
297
297
|
style: { flex: 1 },
|
|
298
|
-
children: [/* @__PURE__ */
|
|
298
|
+
children: [/* @__PURE__ */ U("div", {
|
|
299
299
|
style: {
|
|
300
300
|
fontSize: 14,
|
|
301
301
|
fontWeight: 600,
|
|
302
302
|
color: "var(--text)"
|
|
303
303
|
},
|
|
304
304
|
children: f("profile.edit", "Edit profile")
|
|
305
|
-
}), /* @__PURE__ */
|
|
305
|
+
}), /* @__PURE__ */ U("div", {
|
|
306
306
|
style: {
|
|
307
307
|
fontSize: 11.5,
|
|
308
308
|
color: "var(--text-3)"
|
|
@@ -310,33 +310,33 @@ function te({ open: e, initialName: t, userId: n, onClose: r, onSaved: i }) {
|
|
|
310
310
|
children: f("profile.edit.subtitle", "Update your display name.")
|
|
311
311
|
})]
|
|
312
312
|
}),
|
|
313
|
-
/* @__PURE__ */
|
|
314
|
-
icon: /* @__PURE__ */
|
|
313
|
+
/* @__PURE__ */ U(u, {
|
|
314
|
+
icon: /* @__PURE__ */ U(c.x, { size: 14 }),
|
|
315
315
|
title: f("profile.edit.close", "Close"),
|
|
316
316
|
onClick: E
|
|
317
317
|
})
|
|
318
318
|
]
|
|
319
319
|
}),
|
|
320
|
-
/* @__PURE__ */
|
|
320
|
+
/* @__PURE__ */ W("div", {
|
|
321
321
|
style: {
|
|
322
322
|
padding: "12px 18px 16px",
|
|
323
323
|
display: "flex",
|
|
324
324
|
flexDirection: "column",
|
|
325
325
|
gap: 12
|
|
326
326
|
},
|
|
327
|
-
children: [/* @__PURE__ */
|
|
327
|
+
children: [/* @__PURE__ */ W("div", { children: [/* @__PURE__ */ U(_, {
|
|
328
328
|
required: !0,
|
|
329
329
|
htmlFor: y,
|
|
330
330
|
children: f("profile.display_name", "Display name")
|
|
331
|
-
}), /* @__PURE__ */
|
|
331
|
+
}), /* @__PURE__ */ U(v, {
|
|
332
332
|
id: y,
|
|
333
333
|
value: b,
|
|
334
334
|
onChange: x,
|
|
335
335
|
placeholder: f("profile.edit.name_placeholder", "Your name"),
|
|
336
336
|
autoFocus: !0
|
|
337
|
-
})] }), w && /* @__PURE__ */
|
|
337
|
+
})] }), w && /* @__PURE__ */ U(L, { text: w })]
|
|
338
338
|
}),
|
|
339
|
-
/* @__PURE__ */
|
|
339
|
+
/* @__PURE__ */ W("div", {
|
|
340
340
|
style: {
|
|
341
341
|
padding: "10px 16px",
|
|
342
342
|
borderTop: "1px solid var(--divider)",
|
|
@@ -347,14 +347,14 @@ function te({ open: e, initialName: t, userId: n, onClose: r, onSaved: i }) {
|
|
|
347
347
|
flexWrap: d ? "wrap" : "nowrap"
|
|
348
348
|
},
|
|
349
349
|
children: [
|
|
350
|
-
/* @__PURE__ */
|
|
351
|
-
/* @__PURE__ */
|
|
350
|
+
/* @__PURE__ */ U("div", { style: { flex: 1 } }),
|
|
351
|
+
/* @__PURE__ */ U(l, {
|
|
352
352
|
onClick: E,
|
|
353
353
|
children: f("dialog.cancel", "Cancel")
|
|
354
354
|
}),
|
|
355
|
-
/* @__PURE__ */
|
|
355
|
+
/* @__PURE__ */ U(l, {
|
|
356
356
|
kind: "primary",
|
|
357
|
-
icon:
|
|
357
|
+
icon: U(S ? g : c.check, { size: 13 }),
|
|
358
358
|
onClick: async () => {
|
|
359
359
|
if (!b.trim()) T(f("profile.edit.name_required", "Display name is required."));
|
|
360
360
|
else {
|
|
@@ -376,33 +376,38 @@ function te({ open: e, initialName: t, userId: n, onClose: r, onSaved: i }) {
|
|
|
376
376
|
]
|
|
377
377
|
})] });
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function X() {
|
|
380
380
|
try {
|
|
381
381
|
return Intl.DateTimeFormat().resolvedOptions().timeZone || "—";
|
|
382
382
|
} catch {
|
|
383
383
|
return "—";
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
function
|
|
387
|
-
let { data: t } = n(), r = t
|
|
388
|
-
return /* @__PURE__ */
|
|
386
|
+
function Z({ userId: e }) {
|
|
387
|
+
let { data: t } = n(), r = Q(t);
|
|
388
|
+
return /* @__PURE__ */ U(R, {
|
|
389
389
|
carrierEntityCode: a,
|
|
390
390
|
carrierScope: r,
|
|
391
391
|
rowId: e
|
|
392
392
|
});
|
|
393
393
|
}
|
|
394
|
+
function Q(e) {
|
|
395
|
+
return e?.entities.profile?.params_scope ?? "profile";
|
|
396
|
+
}
|
|
394
397
|
function $() {
|
|
395
|
-
let e = p(), { data: t } = n(), i = b().data?.find((e) => e.code === r)
|
|
396
|
-
|
|
398
|
+
let e = p(), { data: t } = n(), i = b().data?.find((e) => e.code === r);
|
|
399
|
+
if (i?.scopes?.includes(Q(t))) return null;
|
|
400
|
+
let a = typeof i?.value == "string" ? i.value : e.language, o = t?.languages?.find((e) => e.code === a);
|
|
401
|
+
return /* @__PURE__ */ U(M, {
|
|
397
402
|
label: e(i?.name),
|
|
398
|
-
children: i ? o?.name[o.code] || e(o?.name) || a : /* @__PURE__ */
|
|
403
|
+
children: i ? o?.name[o.code] || e(o?.name) || a : /* @__PURE__ */ U(g, { size: 12 })
|
|
399
404
|
});
|
|
400
405
|
}
|
|
401
|
-
function
|
|
406
|
+
function ie({ userId: e }) {
|
|
402
407
|
let { data: t } = n();
|
|
403
408
|
if (!e || !t) return null;
|
|
404
409
|
let r = t.entities[a];
|
|
405
|
-
return r ? /* @__PURE__ */
|
|
410
|
+
return r ? /* @__PURE__ */ U(P, {
|
|
406
411
|
node: {
|
|
407
412
|
associated: "api_key",
|
|
408
413
|
foreign_key: "user_id"
|
|
@@ -419,4 +424,4 @@ function re({ userId: e }) {
|
|
|
419
424
|
}) : null;
|
|
420
425
|
}
|
|
421
426
|
//#endregion
|
|
422
|
-
export {
|
|
427
|
+
export { K as Profile, $ as ProfileLanguageRow, Z as ProfileParamsBlock };
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { coerceDisplayString as e } from "../../lib/display-value.js";
|
|
2
2
|
import { useSchema as t } from "../../hooks/useSchema.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
3
|
+
import { Icon as n } from "../primitives/Icons.js";
|
|
4
|
+
import { Btn as r } from "../primitives/Btn.js";
|
|
5
|
+
import { useText as i } from "../../hooks/useText.js";
|
|
6
|
+
import { Spinner as a } from "../primitives/Spinner.js";
|
|
7
|
+
import { FieldLabel as o } from "../primitives/Fields.js";
|
|
8
|
+
import { ModalFrame as s } from "../shared/ModalFrame.js";
|
|
9
|
+
import { ConfirmDialog as c } from "../shared/ConfirmDialog.js";
|
|
10
|
+
import { renderField as l } from "../fields/index.js";
|
|
11
|
+
import { refLabel as u, useRefRecords as d } from "../../hooks/useRefRecords.js";
|
|
12
|
+
import { useState as f } from "react";
|
|
13
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
15
14
|
//#region src/components/params/param-editors.tsx
|
|
16
|
-
var
|
|
15
|
+
var g = {
|
|
17
16
|
object: ["params.source.object", "Record"],
|
|
18
17
|
user: ["params.source.user", "User"],
|
|
19
18
|
role: ["params.source.role", "Role"],
|
|
@@ -22,29 +21,29 @@ var _ = {
|
|
|
22
21
|
yaml: ["params.source.yaml", "Default"],
|
|
23
22
|
none: ["params.source.none", "Not set"]
|
|
24
23
|
};
|
|
25
|
-
function
|
|
26
|
-
let n =
|
|
24
|
+
function _(e, t) {
|
|
25
|
+
let n = g[t];
|
|
27
26
|
return n ? e(n[0], n[1]) : t;
|
|
28
27
|
}
|
|
29
|
-
var
|
|
30
|
-
function
|
|
31
|
-
let
|
|
32
|
-
return /* @__PURE__ */
|
|
28
|
+
var v = n["undo-2"];
|
|
29
|
+
function y({ param: e, description: t, onReset: n }) {
|
|
30
|
+
let a = i(), [o, s] = f(!1);
|
|
31
|
+
return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(r, {
|
|
33
32
|
size: "xs",
|
|
34
|
-
icon: /* @__PURE__ */
|
|
33
|
+
icon: /* @__PURE__ */ m(v, { size: 12 }),
|
|
35
34
|
onClick: () => s(!0),
|
|
36
|
-
children:
|
|
37
|
-
}), /* @__PURE__ */
|
|
35
|
+
children: a("params.reset", "Reset to default")
|
|
36
|
+
}), /* @__PURE__ */ m(c, {
|
|
38
37
|
open: o,
|
|
39
38
|
onOpenChange: s,
|
|
40
|
-
title:
|
|
39
|
+
title: a("params.reset_confirm.title", "Reset {name} to default?", { name: a(e.name) || e.code }),
|
|
41
40
|
description: t,
|
|
42
|
-
confirmLabel:
|
|
41
|
+
confirmLabel: a("params.reset", "Reset to default"),
|
|
43
42
|
onConfirm: () => n(e)
|
|
44
43
|
})] });
|
|
45
44
|
}
|
|
46
|
-
function
|
|
47
|
-
return /* @__PURE__ */
|
|
45
|
+
function b({ text: e }) {
|
|
46
|
+
return /* @__PURE__ */ h("div", {
|
|
48
47
|
style: {
|
|
49
48
|
padding: "8px 10px",
|
|
50
49
|
background: "var(--danger-soft)",
|
|
@@ -54,61 +53,46 @@ function x({ text: e }) {
|
|
|
54
53
|
display: "flex",
|
|
55
54
|
gap: 6
|
|
56
55
|
},
|
|
57
|
-
children: [/* @__PURE__ */
|
|
56
|
+
children: [/* @__PURE__ */ m(n.info, { size: 13 }), /* @__PURE__ */ m("span", { children: e })]
|
|
58
57
|
});
|
|
59
58
|
}
|
|
60
|
-
function
|
|
61
|
-
let n =
|
|
59
|
+
function x(e) {
|
|
60
|
+
let n = i(), { data: r } = t(), a = e.flatMap((e) => e.ref?.entity && e.value != null && e.value !== "" ? [{
|
|
62
61
|
ref: e.ref,
|
|
63
62
|
value: e.value
|
|
64
|
-
}] : []), { refs: o } =
|
|
65
|
-
return (e) => e.ref?.entity ?
|
|
63
|
+
}] : []), { refs: o } = d(a, void 0, r?.entities);
|
|
64
|
+
return (e) => e.ref?.entity ? u(n, o, e.ref, e.value, r?.entities) : void 0;
|
|
66
65
|
}
|
|
67
|
-
function
|
|
68
|
-
let
|
|
69
|
-
let n =
|
|
70
|
-
return n &&
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
else if (r == null) u = "—";
|
|
74
|
-
else if (i && i.length > 0) u = (Array.isArray(r) ? r.map(l).join(", ") : l(r)) || "—";
|
|
75
|
-
else if (t === "bool") u = r ? c("params.value.on", "On") : c("params.value.off", "Off");
|
|
76
|
-
else if (t === "multilang" || t === "multilang_text") u = c(r) || "—";
|
|
77
|
-
else if (t === "multilang_array" && Array.isArray(r)) u = r.map((e) => c(e)).join(", ") || "—";
|
|
78
|
-
else if (t === "json" || t === "structure") {
|
|
79
|
-
if (r && typeof r == "object") {
|
|
80
|
-
let e = Array.isArray(r) ? r.length : Object.keys(r).length;
|
|
81
|
-
u = `{${n(c, "params.value.keys", e, {
|
|
82
|
-
one: "{count} key",
|
|
83
|
-
other: "{count} keys"
|
|
84
|
-
})}}`;
|
|
85
|
-
} else u = e(r);
|
|
86
|
-
} else u = e(r);
|
|
87
|
-
return /* @__PURE__ */ h("span", {
|
|
66
|
+
function S({ type: t, value: n, values: r, label: a, maxWidth: o = 180 }) {
|
|
67
|
+
let s = i(), c = (t) => {
|
|
68
|
+
let n = r?.find((e) => e.code === t);
|
|
69
|
+
return n && s(n.name) || e(t);
|
|
70
|
+
}, l;
|
|
71
|
+
return l = a === void 0 ? n == null ? "—" : r && r.length > 0 ? (Array.isArray(n) ? n.map(c).join(", ") : c(n)) || "—" : t === "bool" ? n ? s("params.value.on", "On") : s("params.value.off", "Off") : t === "multilang" || t === "multilang_text" ? s(n) || "—" : t === "multilang_array" && Array.isArray(n) ? n.map((e) => s(e)).join(", ") || "—" : t === "json" || t === "structure" ? Array.isArray(n) ? `[${n.map((t) => t && typeof t == "object" ? "{…}" : e(t)).join(", ")}]` : n && typeof n == "object" ? `{${Object.keys(n).join(", ")}}` : e(n) : e(n) : a, /* @__PURE__ */ m("span", {
|
|
88
72
|
className: "mono",
|
|
89
|
-
title:
|
|
73
|
+
title: l,
|
|
90
74
|
style: {
|
|
91
75
|
display: "inline-block",
|
|
92
76
|
verticalAlign: "middle",
|
|
93
77
|
fontSize: 11.5,
|
|
94
78
|
color: "var(--text-2)",
|
|
95
|
-
maxWidth:
|
|
79
|
+
maxWidth: o,
|
|
96
80
|
overflow: "hidden",
|
|
97
81
|
textOverflow: "ellipsis",
|
|
98
82
|
whiteSpace: "nowrap"
|
|
99
83
|
},
|
|
100
|
-
children:
|
|
84
|
+
children: l
|
|
101
85
|
});
|
|
102
86
|
}
|
|
103
|
-
function
|
|
104
|
-
let d =
|
|
87
|
+
function C({ param: e, current: t, error: c, onCancel: l, onSave: u }) {
|
|
88
|
+
let d = i(), [p, g] = f(() => T(e, t)), [_, v] = f(!1), [y, x] = f(null);
|
|
105
89
|
async function S() {
|
|
106
|
-
|
|
90
|
+
x(null);
|
|
107
91
|
let e;
|
|
108
92
|
try {
|
|
109
|
-
e =
|
|
93
|
+
e = E(d, p);
|
|
110
94
|
} catch (e) {
|
|
111
|
-
|
|
95
|
+
x(String(e instanceof Error ? e.message : e));
|
|
112
96
|
return;
|
|
113
97
|
}
|
|
114
98
|
v(!0);
|
|
@@ -118,21 +102,21 @@ function w({ param: e, current: t, error: n, onCancel: l, onSave: u }) {
|
|
|
118
102
|
v(!1);
|
|
119
103
|
}
|
|
120
104
|
}
|
|
121
|
-
return /* @__PURE__ */
|
|
105
|
+
return /* @__PURE__ */ h(s, {
|
|
122
106
|
label: d(e.name) || e.code,
|
|
123
107
|
maxWidth: 440,
|
|
124
108
|
onClose: l,
|
|
125
109
|
testId: "param-edit-dialog",
|
|
126
110
|
children: [
|
|
127
|
-
/* @__PURE__ */
|
|
111
|
+
/* @__PURE__ */ h("div", {
|
|
128
112
|
style: { padding: "14px 18px 0" },
|
|
129
|
-
children: [/* @__PURE__ */
|
|
113
|
+
children: [/* @__PURE__ */ m("div", {
|
|
130
114
|
style: {
|
|
131
115
|
fontSize: 14,
|
|
132
116
|
fontWeight: 600
|
|
133
117
|
},
|
|
134
118
|
children: d(e.name) || e.code
|
|
135
|
-
}), e.description && /* @__PURE__ */
|
|
119
|
+
}), e.description && /* @__PURE__ */ m("div", {
|
|
136
120
|
style: {
|
|
137
121
|
fontSize: 11.5,
|
|
138
122
|
color: "var(--text-3)",
|
|
@@ -141,7 +125,7 @@ function w({ param: e, current: t, error: n, onCancel: l, onSave: u }) {
|
|
|
141
125
|
children: d(e.description)
|
|
142
126
|
})]
|
|
143
127
|
}),
|
|
144
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ h("div", {
|
|
145
129
|
style: {
|
|
146
130
|
padding: "12px 18px 16px",
|
|
147
131
|
display: "flex",
|
|
@@ -150,16 +134,16 @@ function w({ param: e, current: t, error: n, onCancel: l, onSave: u }) {
|
|
|
150
134
|
overflowY: "auto"
|
|
151
135
|
},
|
|
152
136
|
children: [
|
|
153
|
-
/* @__PURE__ */
|
|
154
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ m(o, { children: d("params.value", "Value") }),
|
|
138
|
+
/* @__PURE__ */ m(w, {
|
|
155
139
|
param: e,
|
|
156
|
-
value:
|
|
157
|
-
onChange:
|
|
140
|
+
value: p,
|
|
141
|
+
onChange: g
|
|
158
142
|
}),
|
|
159
|
-
(y ||
|
|
143
|
+
(y || c) && /* @__PURE__ */ m(b, { text: y || c })
|
|
160
144
|
]
|
|
161
145
|
}),
|
|
162
|
-
/* @__PURE__ */
|
|
146
|
+
/* @__PURE__ */ h("div", {
|
|
163
147
|
style: {
|
|
164
148
|
padding: "10px 16px",
|
|
165
149
|
borderTop: "1px solid var(--divider)",
|
|
@@ -169,14 +153,14 @@ function w({ param: e, current: t, error: n, onCancel: l, onSave: u }) {
|
|
|
169
153
|
flexShrink: 0
|
|
170
154
|
},
|
|
171
155
|
children: [
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
-
/* @__PURE__ */
|
|
156
|
+
/* @__PURE__ */ m("div", { style: { flex: 1 } }),
|
|
157
|
+
/* @__PURE__ */ m(r, {
|
|
174
158
|
onClick: l,
|
|
175
159
|
children: d("dialog.cancel", "Cancel")
|
|
176
160
|
}),
|
|
177
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ m(r, {
|
|
178
162
|
kind: "primary",
|
|
179
|
-
icon:
|
|
163
|
+
icon: m(_ ? a : n.check, { size: 13 }),
|
|
180
164
|
onClick: S,
|
|
181
165
|
disabled: _,
|
|
182
166
|
children: _ ? d("dialog.saving", "Saving…") : d("dialog.save", "Save")
|
|
@@ -186,15 +170,15 @@ function w({ param: e, current: t, error: n, onCancel: l, onSave: u }) {
|
|
|
186
170
|
]
|
|
187
171
|
});
|
|
188
172
|
}
|
|
189
|
-
function
|
|
190
|
-
let r =
|
|
173
|
+
function w({ param: e, value: t, onChange: n }) {
|
|
174
|
+
let r = i(), a = {
|
|
191
175
|
type: e.type,
|
|
192
176
|
structure: e.structure,
|
|
193
177
|
values: e.values,
|
|
194
178
|
ref: e.ref
|
|
195
179
|
};
|
|
196
|
-
return /* @__PURE__ */
|
|
197
|
-
field:
|
|
180
|
+
return /* @__PURE__ */ m(p, { children: l({
|
|
181
|
+
field: a,
|
|
198
182
|
fieldName: e.code,
|
|
199
183
|
value: t,
|
|
200
184
|
mode: "edit",
|
|
@@ -202,23 +186,23 @@ function T({ param: e, value: t, onChange: n }) {
|
|
|
202
186
|
t: r
|
|
203
187
|
}) });
|
|
204
188
|
}
|
|
205
|
-
function
|
|
189
|
+
function T(e, t) {
|
|
206
190
|
return e.type === "bool" ? t === !0 : e.type === "structure" ? t ?? {} : t ?? null;
|
|
207
191
|
}
|
|
208
|
-
function
|
|
192
|
+
function E(e, t) {
|
|
209
193
|
if (t == null) throw Error(e("params.value.required", "Enter a value."));
|
|
210
194
|
return t;
|
|
211
195
|
}
|
|
212
|
-
var
|
|
196
|
+
var D = /* @__PURE__ */ new Set([
|
|
213
197
|
"server",
|
|
214
198
|
"database",
|
|
215
199
|
"auth",
|
|
216
200
|
"sso",
|
|
217
201
|
"seeder"
|
|
218
202
|
]);
|
|
219
|
-
function
|
|
203
|
+
function O(e) {
|
|
220
204
|
let t = e.scopes ?? [];
|
|
221
|
-
return t.length === 0 ? !
|
|
205
|
+
return t.length === 0 ? !D.has(e.category ?? "") : t.includes("tenant");
|
|
222
206
|
}
|
|
223
207
|
//#endregion
|
|
224
|
-
export {
|
|
208
|
+
export { C as EditParamDialog, b as ErrorLine, y as ResetParamControl, S as ValuePreview, _ as paramSourceName, O as paramTenantEditable, x as useParamRefLabels };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NetworkError as e } from "../types/api.js";
|
|
2
2
|
//#region src/lib/query-retry.ts
|
|
3
3
|
function t(t, n) {
|
|
4
|
-
return n instanceof e && n.method === "GET" || t < 1;
|
|
4
|
+
return n instanceof e && n.method === "GET" && n.failure === "unreachable" || t < 1;
|
|
5
5
|
}
|
|
6
6
|
//#endregion
|
|
7
7
|
export { t as shouldRetryQuery };
|
package/dist-lib/stores/tabs.js
CHANGED
|
@@ -202,8 +202,17 @@ var y = t((t, n) => ({
|
|
|
202
202
|
...r
|
|
203
203
|
} : t) })), _(n().tabs, n().activeTabId);
|
|
204
204
|
},
|
|
205
|
-
setScope: (e,
|
|
206
|
-
|
|
205
|
+
setScope: (e, r) => {
|
|
206
|
+
let i = d !== null && (r !== d || e !== u);
|
|
207
|
+
if (i) {
|
|
208
|
+
let { tabs: e, activeTabId: t } = n();
|
|
209
|
+
_(e, t);
|
|
210
|
+
}
|
|
211
|
+
u = e, d = r, t(i ? {
|
|
212
|
+
tabs: [],
|
|
213
|
+
activeTabId: null,
|
|
214
|
+
restored: !1
|
|
215
|
+
} : { restored: !1 });
|
|
207
216
|
},
|
|
208
217
|
hydrate: () => {
|
|
209
218
|
let e = v();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@declarion/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.94.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "React SDK for Declarion, the schema-driven business apps platform.",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"check:bundle": "node scripts/check-eager-bundle.mjs",
|
|
117
117
|
"check:fonts": "node scripts/check-fonts.mjs",
|
|
118
118
|
"check:pkg": "publint run",
|
|
119
|
-
"lint": "tsc --noEmit && eslint src --max-warnings=0",
|
|
119
|
+
"lint": "tsc --noEmit --incremental --tsBuildInfoFile node_modules/.cache/tsc/lint.tsbuildinfo && eslint --concurrency \"${ESLINT_CONCURRENCY:-2}\" src --max-warnings=0",
|
|
120
120
|
"test": "vitest run",
|
|
121
121
|
"test:coverage": "vitest run --coverage --project sdk",
|
|
122
122
|
"preview": "vite preview"
|