@wssto2/vue-core 0.14.0 → 0.15.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.
Files changed (94) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +2 -2
  3. package/bin/architecture/engine.mjs +11 -1
  4. package/bin/architecture/rules.mjs +95 -0
  5. package/bin/commands/check-architecture.mjs +8 -1
  6. package/bin/config.mjs +2 -0
  7. package/dist/{AccessGate.vue_vue_type_script_setup_true_lang-DEzXovsY.js → AccessGate.vue_vue_type_script_setup_true_lang-BH3f0hda.js} +1 -1
  8. package/dist/{Activity-C0HUEDUz.js → Activity-MOAIv6s4.js} +3 -3
  9. package/dist/{Changes-CSaHgVuz.js → Changes-Bu7D0dhY.js} +2 -2
  10. package/dist/{CollectionPage.vue_vue_type_script_setup_true_lang-dIrdS_Gn.js → CollectionPage.vue_vue_type_script_setup_true_lang-D5HsYIck.js} +2 -2
  11. package/dist/{DeadLetters-CHX4Ypgy.js → DeadLetters-DsujMnLG.js} +4 -4
  12. package/dist/FormGroup.vue_vue_type_script_setup_true_lang-CTVuhEbW.js +428 -0
  13. package/dist/{FormView.vue_vue_type_script_setup_true_lang-DvbPEiNQ.js → FormView.vue_vue_type_script_setup_true_lang-Cfvh7rF6.js} +1 -1
  14. package/dist/{General-v_24-zZw.js → General-Dswj1oXt.js} +6 -6
  15. package/dist/{IncidentRecord-BwSBNE37.js → IncidentRecord-DcmqpziF.js} +7 -7
  16. package/dist/{IncidentsList-BqzRU5cZ.js → IncidentsList-BRNqHZdU.js} +3 -3
  17. package/dist/{NewRolePage-Dt0O0VSI.js → NewRolePage-dFLznJGH.js} +2 -2
  18. package/dist/{PersonAccess.vue_vue_type_script_setup_true_lang-CWCt9_dM.js → PersonAccess.vue_vue_type_script_setup_true_lang-D3yp43o5.js} +4 -4
  19. package/dist/{ProfilePage-DApTxq8C.js → ProfilePage-BnHR3xGB.js} +8 -8
  20. package/dist/{RoleEditor.vue_vue_type_script_setup_true_lang-d_aaeXTT.js → RoleEditor.vue_vue_type_script_setup_true_lang-DNF9wzE9.js} +4 -4
  21. package/dist/{RolePage-noy-wmNc.js → RolePage-BtM2rFLm.js} +5 -5
  22. package/dist/{RolesPage-NRRainCw.js → RolesPage-MO1gAfdT.js} +3 -3
  23. package/dist/{SectionNavigator.vue_vue_type_script_setup_true_lang-D_08MS1-.js → SectionNavigator.vue_vue_type_script_setup_true_lang-TMdsmYAg.js} +1 -1
  24. package/dist/ServiceAccountDialog.vue_vue_type_script_setup_true_lang-Bo3phlqB.js +127 -0
  25. package/dist/{ServiceAccountRecord-D_HduQoK.js → ServiceAccountRecord-C1M-dcju.js} +6 -6
  26. package/dist/{ServiceAccountsList-CdSsqTGt.js → ServiceAccountsList-zfyS2WJB.js} +4 -4
  27. package/dist/{Sessions-CTjzMfNg.js → Sessions-BYBUSqHI.js} +3 -3
  28. package/dist/{SettingsPage-CpqASf_D.js → SettingsPage-C9Kp2ddX.js} +5 -5
  29. package/dist/{SignIn-D6tWsKf0.js → SignIn-HBYLSZ1M.js} +4 -4
  30. package/dist/{SignInPage-BCNGI871.js → SignInPage-CEoz3fWE.js} +3 -3
  31. package/dist/{SignIns-BxGGA99u.js → SignIns-BAz7V4vy.js} +2 -2
  32. package/dist/{UserRecord-B0kG0-Tm.js → UserRecord-DkyhGma-.js} +8 -8
  33. package/dist/{UsersList-KMgImERy.js → UsersList-CsW-jU0m.js} +3 -3
  34. package/dist/access/RestrictedPanel.vue.d.ts +20 -0
  35. package/dist/access/index.d.ts +1 -0
  36. package/dist/access/index.js +91 -31
  37. package/dist/app/application.d.ts +2 -2
  38. package/dist/app/current.d.ts +6 -0
  39. package/dist/app/index.d.ts +1 -1
  40. package/dist/app/index.js +17 -16
  41. package/dist/{application-CrXtiGdw.js → application-2gHiwAVy.js} +5 -5
  42. package/dist/client/client.d.ts +6 -0
  43. package/dist/client/index.js +1 -1
  44. package/dist/client-Do8v1I5l.js +193 -0
  45. package/dist/collection/index.js +4 -4
  46. package/dist/config/index.d.ts +21 -1
  47. package/dist/content/StatSummary.vue.d.ts +40 -0
  48. package/dist/content/index.d.ts +1 -0
  49. package/dist/content/index.js +245 -176
  50. package/dist/{contributions-obnyn03x.js → contributions-9CPT-Z5v.js} +1 -1
  51. package/dist/{current-B0lHKTWr.js → current-CslcEPXp.js} +8 -4
  52. package/dist/eslint/index.js +2 -2
  53. package/dist/form/index.js +8 -8
  54. package/dist/form/useForm.d.ts +1 -1
  55. package/dist/{guards-DGcSfTEh.js → guards-6fJxfUtk.js} +1 -1
  56. package/dist/{http-DOEfFCDA.js → http-D6qOS6xs.js} +1 -1
  57. package/dist/i18n/index.d.ts +5 -1
  58. package/dist/i18n/index.js +14 -13
  59. package/dist/i18n/serverMessages.d.ts +15 -1
  60. package/dist/identity/index.js +2 -2
  61. package/dist/incidents/index.js +1 -1
  62. package/dist/{index-D-2NNye6.js → index--AF_DNhE.js} +20 -20
  63. package/dist/{index-DNeIZpXo.js → index-DYva-K_4.js} +4 -4
  64. package/dist/{index-Crz-j_Hu.js → index-Dlu-PA4W.js} +105 -105
  65. package/dist/index.d.ts +1 -1
  66. package/dist/index.js +1 -1
  67. package/dist/{navigation-CctcxT51.js → navigation-DMJ6akat.js} +1 -1
  68. package/dist/{neighbors-Csfan8Ho.js → neighbors-DrEahe7B.js} +1 -1
  69. package/dist/notifications/index.js +1 -1
  70. package/dist/onboarding/index.js +1 -1
  71. package/dist/page/index.js +1 -1
  72. package/dist/phone/index.d.ts +1 -1
  73. package/dist/phone/index.js +153 -141
  74. package/dist/phone/phone.d.ts +6 -0
  75. package/dist/platform/index.js +3 -3
  76. package/dist/{platform-DtISOEt7.js → platform-ORzRR3Tw.js} +1 -1
  77. package/dist/resource/index.js +1 -1
  78. package/dist/router/index.js +3 -3
  79. package/dist/{sections-fkW_IJLc.js → sections-DI_JhgQG.js} +1 -1
  80. package/dist/serverMessages-Ce8-MK4e.js +30 -0
  81. package/dist/shell/index.js +4 -4
  82. package/dist/{state-CXMexi0l.js → state-QDaxntgR.js} +1 -1
  83. package/dist/styles.css +1 -1
  84. package/dist/testing/index.js +2 -2
  85. package/dist/{useCommand-Ch_nx1AQ.js → useCommand-BvcU3AlW.js} +1 -1
  86. package/dist/{useGroupSheet-CPjHydQV.js → useGroupSheet-BGIntPKD.js} +1 -1
  87. package/dist/{usePreferences-B8LIZp_f.js → usePreferences-BfMXVbSO.js} +1 -1
  88. package/dist/{useRecordDialog-DdkauXnU.js → useRecordDialog-q_BNXdb7.js} +1 -1
  89. package/dist/{useResourceForm-Dl6YFYyz.js → useResourceForm-C1S628UI.js} +1 -1
  90. package/package.json +1 -1
  91. package/dist/FormGroup.vue_vue_type_script_setup_true_lang-D6jYfNjW.js +0 -427
  92. package/dist/ServiceAccountDialog.vue_vue_type_script_setup_true_lang-DDcaju7L.js +0 -127
  93. package/dist/client-Dg303Pmc.js +0 -193
  94. package/dist/serverMessages-DnTqVS3h.js +0 -25
@@ -1,5 +1,5 @@
1
1
  import { shallowRef as t } from "vue";
2
- import { u as o } from "./useCommand-Ch_nx1AQ.js";
2
+ import { u as o } from "./useCommand-BvcU3AlW.js";
3
3
  function f(r) {
4
4
  const u = t(null);
5
5
  let n = null;
@@ -1,5 +1,5 @@
1
1
  import { shallowRef as v, watch as m, computed as f } from "vue";
2
- import { u as i, c as h } from "./FormGroup.vue_vue_type_script_setup_true_lang-D6jYfNjW.js";
2
+ import { u as i, c as h } from "./FormGroup.vue_vue_type_script_setup_true_lang-CTVuhEbW.js";
3
3
  function b(u) {
4
4
  const t = i(u), r = v(null), s = v(!1);
5
5
  let n = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wssto2/vue-core",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "goCore": "v1.19.0",
5
5
  "description": "Shared Vue 3 library for go-core applications: app shell, list / record / form pages and their controls.",
6
6
  "keywords": [
@@ -1,427 +0,0 @@
1
- var ue = Object.defineProperty;
2
- var ce = (o, e, t) => e in o ? ue(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var q = (o, e, t) => ce(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { shallowRef as W, computed as p, toRaw as de, reactive as fe, ref as R, watch as me, nextTick as pe, toValue as ve, defineComponent as Y, unref as O, openBlock as v, createBlock as J, withCtx as ae, createElementBlock as k, toDisplayString as w, createCommentVNode as h, Fragment as z, createElementVNode as M, normalizeClass as N, renderList as ge, createTextVNode as S, inject as ne, provide as P, useSlots as he, shallowReactive as te, useTemplateRef as ye, useId as be, normalizeStyle as ke, renderSlot as I } from "vue";
5
- import { useI18n as Q } from "vue-i18n";
6
- import { i as _e, a as L } from "./error-CD7x0Jrz.js";
7
- import { d as we, u as je, a as Ee } from "./describeError-B-NMa--w.js";
8
- import { _ as Oe } from "./Banner.vue_vue_type_script_setup_true_lang-sv0phngk.js";
9
- import { s as xe, u as $e } from "./sectionIndex-BS0ic5W7.js";
10
- import { d as re, i as Ae } from "./options-B48UiYsG.js";
11
- import { _ as Fe } from "./Button.vue_vue_type_script_setup_true_lang-C74hcb0N.js";
12
- class Be {
13
- constructor() {
14
- q(this, "messages", W({}));
15
- /** How many fields have a message. */
16
- q(this, "count", p(() => Object.keys(this.messages.value).length));
17
- }
18
- /** Replaces everything. Empty lists are dropped. */
19
- set(e) {
20
- this.messages.value = Object.fromEntries(Object.entries(e).filter(([, t]) => t.length > 0).map(([t, r]) => [t, [...r]]));
21
- }
22
- add(e, t) {
23
- this.messages.value = { ...this.messages.value, [e]: [...this.messages.value[e] ?? [], t] };
24
- }
25
- /** Clears one field (and its nested paths), or everything. */
26
- clear(e) {
27
- if (e === void 0) {
28
- this.count.value > 0 && (this.messages.value = {});
29
- return;
30
- }
31
- const t = Object.fromEntries(Object.entries(this.messages.value).filter(([r]) => r !== e && !r.startsWith(`${e}.`)));
32
- Object.keys(t).length !== this.count.value && (this.messages.value = t);
33
- }
34
- /** Whether the field, or a value inside it (`items.0.quantity` for `items`), has a message. */
35
- has(e) {
36
- return this.first(e) !== void 0 || Object.keys(this.messages.value).some((t) => t.startsWith(`${e}.`));
37
- }
38
- first(e) {
39
- return this.messages.value[e]?.[0];
40
- }
41
- all() {
42
- return this.messages.value;
43
- }
44
- }
45
- function m(o) {
46
- const e = de(o);
47
- return e === null || typeof e != "object" ? e : e instanceof Date ? new Date(e.getTime()) : typeof Blob < "u" && e instanceof Blob ? e : Array.isArray(e) ? e.map(m) : Object.fromEntries(Object.entries(e).map(([t, r]) => [t, m(r)]));
48
- }
49
- function H(o, e) {
50
- const t = o, r = e;
51
- if (Object.is(t, r)) return !0;
52
- if (t === null || r === null || typeof t != "object" || typeof r != "object") return !1;
53
- if (t instanceof Date || r instanceof Date) return t instanceof Date && r instanceof Date && t.getTime() === r.getTime();
54
- if (Array.isArray(t) || Array.isArray(r))
55
- return Array.isArray(t) && Array.isArray(r) && t.length === r.length && t.every((a, u) => H(a, r[u]));
56
- if (typeof Blob < "u" && (t instanceof Blob || r instanceof Blob)) return !1;
57
- const i = (a) => Object.keys(a).filter((u) => a[u] !== void 0), y = i(t);
58
- return y.length === i(r).length && y.every((a) => H(t[a], r[a]));
59
- }
60
- function se(o) {
61
- const e = {};
62
- for (const t of o) {
63
- const r = t.path.map(String).join(".");
64
- (e[r] ?? (e[r] = [])).push(t.message);
65
- }
66
- return e;
67
- }
68
- const De = (o) => o.split(".")[0] ?? o, oe = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).slice(2)}`;
69
- function Ke(o) {
70
- const { t: e } = Q(), t = o.describeFieldError ?? we(), r = je(), i = Ee(), a = fe(m(typeof o.defaults == "function" ? o.defaults() : o.defaults)), u = W(m(a)), c = new Be(), j = R(!1), g = W(null), V = p(() => !H(a, u.value));
71
- let x = null, G = oe();
72
- function F(s) {
73
- const n = a;
74
- for (const l of Object.keys(n)) l in s || delete n[l];
75
- Object.assign(n, m(s));
76
- }
77
- function f() {
78
- c.clear(), g.value = null;
79
- }
80
- function $(s, n) {
81
- const l = e(`core.form.failure.${s}`);
82
- if (s === "refresh") return l;
83
- const d = i?.(n);
84
- if (d !== void 0) return d;
85
- if (!L(n) || s === "invalid" && Object.keys(n.fields).length > 0) return l;
86
- const A = s === "invalid" || s === "failed" && n.status !== null && n.status < 500;
87
- return n.code ? r(n, { fallback: l }) : A && n.message ? r(n) : l;
88
- }
89
- function B(s, n) {
90
- const l = L(n) ? n.requestId : null, d = o.failureMessage?.(s, n) ?? $(s, n);
91
- return g.value = { kind: s, message: d, requestId: l, error: n };
92
- }
93
- function C(s, n = !1) {
94
- const { serverField: l } = o, d = t, A = n && l ? Object.entries(s).map(([b, _]) => [l(b), _]) : Object.entries(s);
95
- c.set(Object.fromEntries(d ? A.map(([b, _]) => [b, _.map((T) => d(T, b))]) : A));
96
- }
97
- function X() {
98
- if (c.clear(), !o.validator)
99
- return g.value = null, m(a);
100
- const s = o.validator.safeParse(m(a));
101
- return s.success ? (g.value = null, s.data) : (C(se(s.error.issues)), null);
102
- }
103
- function Z(s) {
104
- if (c.clear(), !o.validator) return !0;
105
- const n = o.validator.safeParse(m(a));
106
- if (n.success) return !0;
107
- const l = Object.fromEntries(Object.entries(se(n.error.issues)).filter(([d]) => s.includes(De(d))));
108
- return C(l), Object.keys(l).length === 0;
109
- }
110
- function ie(s) {
111
- if (!L(s)) return "failed";
112
- switch (s.kind) {
113
- case "validation":
114
- return "invalid";
115
- case "conflict":
116
- return "conflict";
117
- case "forbidden":
118
- return "forbidden";
119
- case "unauthorized":
120
- return "unauthorized";
121
- case "network":
122
- return "offline";
123
- default:
124
- return "failed";
125
- }
126
- }
127
- async function K(s, n, l, d) {
128
- if (x) return x;
129
- const b = (async () => {
130
- g.value = null;
131
- const _ = s();
132
- if (_ === null) return { status: "failed", failure: B("invalid", null) };
133
- const T = m(a);
134
- let D;
135
- j.value = !0;
136
- try {
137
- D = await n(_, { idempotencyKey: G });
138
- } catch (E) {
139
- if (j.value = !1, _e(E)) return { status: "aborted" };
140
- const ee = ie(E);
141
- return ee === "invalid" && L(E) && C(E.fields, !0), { status: "failed", failure: B(ee, E) };
142
- }
143
- const U = d?.hydrateFrom?.(D) ?? null;
144
- U ? (F(U), u.value = m(U), c.clear()) : l(D, T);
145
- try {
146
- await d?.refresh?.(D);
147
- } catch (E) {
148
- return B("refresh", E), { status: "saved-refresh-failed", value: D, error: E };
149
- } finally {
150
- j.value = !1;
151
- }
152
- return { status: "saved", value: D };
153
- })().finally(() => {
154
- x = null, G = oe();
155
- });
156
- return x = b, b;
157
- }
158
- return {
159
- values: a,
160
- errors: c,
161
- dirty: V,
162
- submitting: j,
163
- failure: g,
164
- bind(s) {
165
- return {
166
- get modelValue() {
167
- return a[s];
168
- },
169
- "onUpdate:modelValue"(n) {
170
- a[s] = n, c.clear(s);
171
- },
172
- get error() {
173
- return c.first(s);
174
- },
175
- "data-field-key": s
176
- };
177
- },
178
- bindMonthYear(s, n) {
179
- const l = a;
180
- return {
181
- get month() {
182
- return l[s] ?? null;
183
- },
184
- get year() {
185
- return l[n] ?? null;
186
- },
187
- "onUpdate:month"(d) {
188
- l[s] = d, c.clear(s);
189
- },
190
- "onUpdate:year"(d) {
191
- l[n] = d, c.clear(n);
192
- },
193
- get error() {
194
- return c.first(s) ?? c.first(n);
195
- },
196
- "data-field-key": `${s} ${n}`
197
- };
198
- },
199
- hydrate(s) {
200
- F(s), u.value = m(s), f();
201
- },
202
- reset() {
203
- F(u.value), f();
204
- },
205
- markClean() {
206
- u.value = m(a);
207
- },
208
- validate: X,
209
- check: Z,
210
- submit: (s, n) => K(X, s, (l, d) => u.value = d, n),
211
- submitFields: (s, n, l) => K(
212
- () => Z(s) ? Object.fromEntries(s.map((d) => [d, m(a[d])])) : null,
213
- n,
214
- (d, A) => {
215
- const b = m(u.value);
216
- for (const _ of s) b[_] = m(A[_]);
217
- u.value = b;
218
- },
219
- l
220
- ),
221
- dismissFailure() {
222
- g.value = null;
223
- }
224
- };
225
- }
226
- function Se(o) {
227
- const e = R([]);
228
- return me(
229
- () => o.form.errors.all(),
230
- async (t) => {
231
- await pe();
232
- const r = ve(o.root) ?? document, i = new Set([...r.querySelectorAll("[data-field-key]")].flatMap((a) => (a.getAttribute("data-field-key") ?? "").split(/\s+/))), y = (a) => a.split(".").some((u, c, j) => i.has(j.slice(0, c + 1).join(".")));
233
- e.value = Object.entries(t).flatMap(([a, u]) => u[0] && !y(a) ? [{ field: a, message: u[0] }] : []);
234
- },
235
- { immediate: !0 }
236
- ), p(() => e.value);
237
- }
238
- const Ge = {
239
- key: 0,
240
- class: "text-footnote font-medium"
241
- }, Ie = {
242
- class: "mt-1 list-inside list-disc text-footnote",
243
- "data-test": "form-errors-hidden"
244
- }, Le = {
245
- key: 2,
246
- class: "mt-1 text-caption text-content-muted"
247
- }, et = /* @__PURE__ */ Y({
248
- __name: "FormErrors",
249
- props: {
250
- form: {},
251
- label: { type: Function, default: (o) => o },
252
- scope: { default: null }
253
- },
254
- setup(o) {
255
- const e = o, { t } = Q(), r = Se({
256
- get form() {
257
- return e.form;
258
- },
259
- root: () => e.scope
260
- }), i = p(() => e.form.failure.value), y = p(() => i.value?.kind === "conflict" || i.value?.kind === "refresh" ? "warning" : "critical");
261
- return (a, u) => i.value || O(r).length ? (v(), J(Oe, {
262
- key: 0,
263
- tone: i.value ? y.value : "warning",
264
- "data-test": "form-errors"
265
- }, {
266
- default: ae(() => [
267
- i.value ? (v(), k("p", Ge, w(i.value.message), 1)) : h("", !0),
268
- O(r).length ? (v(), k(z, { key: 1 }, [
269
- M("p", {
270
- class: N(["text-footnote", i.value ? "mt-1" : "font-medium"])
271
- }, w(O(t)("core.form.errors.hidden_title")), 3),
272
- M("ul", Ie, [
273
- (v(!0), k(z, null, ge(O(r), (c) => (v(), k("li", {
274
- key: c.field
275
- }, [
276
- S(w(c.field ? e.label(c.field) : ""), 1),
277
- c.field ? (v(), k(z, { key: 0 }, [
278
- S(": ")
279
- ], 64)) : h("", !0),
280
- S(w(c.message), 1)
281
- ]))), 128))
282
- ])
283
- ], 64)) : h("", !0),
284
- i.value?.requestId ? (v(), k("p", Le, w(O(t)("core.form.errors.request", { id: i.value.requestId })), 1)) : h("", !0)
285
- ]),
286
- _: 1
287
- }, 8, ["tone"])) : h("", !0);
288
- }
289
- }), Me = /* @__PURE__ */ Y({
290
- __name: "GroupEditAction",
291
- props: {
292
- allowed: { type: Boolean, default: !0 },
293
- locked: { type: Boolean, default: !1 },
294
- label: { default: void 0 }
295
- },
296
- emits: ["click"],
297
- setup(o, { emit: e }) {
298
- const t = o, r = e, { t: i } = Q();
299
- return (y, a) => t.allowed && !t.locked ? (v(), J(Fe, {
300
- key: 0,
301
- prominence: "plain",
302
- size: "sm",
303
- "data-test": "group-edit",
304
- onClick: a[0] || (a[0] = (u) => r("click"))
305
- }, {
306
- default: ae(() => [
307
- S(w(t.label ?? O(i)("core.actions.edit")), 1)
308
- ]),
309
- _: 1
310
- })) : h("", !0);
311
- }
312
- }), le = Symbol("vue-core.recordGroups"), Re = () => ne(le, null);
313
- function Ve() {
314
- const o = /* @__PURE__ */ new Map();
315
- return {
316
- register(e, t) {
317
- const r = o.get(t) ?? /* @__PURE__ */ new Map();
318
- return r.set(e, (r.get(e) ?? 0) + 1), o.set(t, r), () => {
319
- const i = (r.get(e) ?? 1) - 1;
320
- i <= 0 ? r.delete(e) : r.set(e, i);
321
- };
322
- },
323
- groupOf: (e) => o.get(e)?.keys().next().value,
324
- fieldsOf: (e) => [...o.entries()].filter(([, t]) => t.has(e)).map(([t]) => t)
325
- };
326
- }
327
- function tt(o) {
328
- const e = Ve();
329
- return P(le, {
330
- only: R(null),
331
- edit: (t, r) => o.edit(t, r),
332
- editLabel: o.editLabel ? (t) => o.editLabel?.(t) : void 0,
333
- register: (t, r) => e.register(t, r)
334
- }), e;
335
- }
336
- const Ce = ["id", "data-group"], Te = {
337
- key: 0,
338
- class: "flex min-w-0 items-baseline gap-2 px-row-inset pb-2"
339
- }, Ue = { class: "min-w-0 flex-1 text-subheadline font-semibold text-content-strong compact:text-footnote compact:font-normal compact:uppercase compact:tracking-wide compact:text-content-muted" }, qe = { class: "form-group-cell rounded-group bg-surface-cell shadow-group" }, ze = {
340
- key: 1,
341
- class: "px-row-inset pt-2 text-footnote text-content-muted text-pretty"
342
- }, rt = /* @__PURE__ */ Y({
343
- __name: "FormGroup",
344
- props: {
345
- header: { default: void 0 },
346
- footer: { default: void 0 },
347
- hideEmpty: { type: Boolean, default: !0 },
348
- labelWidth: { default: "11rem" },
349
- section: { type: Boolean, default: !1 },
350
- anchor: { default: void 0 },
351
- editable: { type: Boolean, default: void 0 },
352
- lockedFooter: { default: void 0 },
353
- group: { default: void 0 }
354
- },
355
- setup(o) {
356
- const e = o, t = he(), r = ne(re, R(!0));
357
- P(re, p(() => r.value && e.editable !== !1));
358
- const i = te(/* @__PURE__ */ new Set()), y = p(() => [...i].some((f) => f.value)), a = Re(), u = te(/* @__PURE__ */ new Set()), c = p(() => u.size > 0 && [...u].every((f) => f.value)), j = p(() => !a?.only.value || a.only.value === e.group), g = p(() => e.group && a?.edit && !c.value ? a.edit(e.group, e.header ?? "") : null), V = p(() => !!e.group && a?.only.value === e.group);
359
- P(Ae, {
360
- hideEmpty: p(() => e.hideEmpty),
361
- registerLocked(f) {
362
- return i.add(f), () => i.delete(f);
363
- },
364
- registerField(f, $) {
365
- u.add($);
366
- const B = e.group && f && a?.register ? a.register(e.group, f) : null;
367
- return () => {
368
- u.delete($), B?.();
369
- };
370
- }
371
- });
372
- const x = p(() => y.value ? e.lockedFooter : void 0), G = ye("root"), F = e.anchor ?? (xe(e.header ?? "") || `group-${be()}`);
373
- return e.section && $e(F, () => e.header ?? "", G), (f, $) => j.value ? (v(), k("section", {
374
- key: 0,
375
- ref_key: "root",
376
- ref: G,
377
- id: e.section ? O(F) : void 0,
378
- "data-test": "form-group",
379
- "data-group": e.group,
380
- class: N(["form-group flex min-w-0 flex-col has-[>.form-group-cell:empty]:hidden", { "scroll-mt-4": e.section }]),
381
- style: ke({ "--form-label-width": e.labelWidth })
382
- }, [
383
- !V.value && (e.header || t.header || t["header-trailing"] || g.value) ? (v(), k("header", Te, [
384
- M("h3", Ue, [
385
- I(f.$slots, "header", {}, () => [
386
- S(w(e.header), 1)
387
- ])
388
- ]),
389
- I(f.$slots, "header-trailing", {}, () => [
390
- g.value ? (v(), J(Me, {
391
- key: 0,
392
- label: e.group ? O(a)?.editLabel?.(e.group) : void 0,
393
- onClick: $[0] || ($[0] = (B) => g.value())
394
- }, null, 8, ["label"])) : h("", !0)
395
- ])
396
- ])) : h("", !0),
397
- M("div", qe, [
398
- I(f.$slots, "default")
399
- ]),
400
- e.footer || t.footer ? (v(), k("p", ze, [
401
- I(f.$slots, "footer", {}, () => [
402
- S(w(e.footer), 1)
403
- ])
404
- ])) : h("", !0),
405
- x.value ? (v(), k("p", {
406
- key: 2,
407
- "data-test": "form-group-locked-footer",
408
- class: N(["px-row-inset text-footnote text-content-muted text-pretty", e.footer || t.footer ? "pt-1" : "pt-2"])
409
- }, w(x.value), 3)) : h("", !0)
410
- ], 14, Ce)) : h("", !0);
411
- }
412
- });
413
- export {
414
- Be as E,
415
- et as _,
416
- rt as a,
417
- Me as b,
418
- m as c,
419
- Ve as d,
420
- Se as e,
421
- De as f,
422
- Re as g,
423
- tt as p,
424
- le as r,
425
- H as s,
426
- Ke as u
427
- };
@@ -1,127 +0,0 @@
1
- import { defineComponent as I, computed as K, ref as V, openBlock as A, createBlock as k, unref as e, withCtx as b, createElementVNode as B, createVNode as p, mergeProps as f, createCommentVNode as D } from "vue";
2
- import { useI18n as G } from "vue-i18n";
3
- import { f as T, u as U } from "./refusals-DfPzVNNY.js";
4
- import { a as x } from "./FormGroup.vue_vue_type_script_setup_true_lang-D6jYfNjW.js";
5
- import { u as N, _ as O } from "./SelectField.vue_vue_type_script_setup_true_lang-BZwdANL3.js";
6
- import { _ as Z } from "./TextareaField.vue_vue_type_script_setup_true_lang-D2j4s96s.js";
7
- import { _ as j } from "./TextField.vue_vue_type_script_setup_true_lang-CWIeeZRE.js";
8
- import { _ as F } from "./useCommand-Ch_nx1AQ.js";
9
- import { u as H } from "./useRecordDialog-DdkauXnU.js";
10
- import { t as J } from "./toast-CqSDTWRX.js";
11
- import { u as C } from "./platform-DtISOEt7.js";
12
- import { l as Q, m as W } from "./index-D-2NNye6.js";
13
- import { r as X } from "./http-DOEfFCDA.js";
14
- import { i as Y } from "./preferences-hYhrw8Uy.js";
15
- import { s as l } from "./routes-Beyr5NQo.js";
16
- import { u as ee } from "./serverMessages-DnTqVS3h.js";
17
- const y = (o) => ({ headers: { "Idempotency-Key": o } }), S = 500;
18
- function ae(o) {
19
- return {
20
- list: async (s) => (await o.request(l.index, void 0, s)).data.service_accounts,
21
- show: async (s, t) => (await o.request(l.show, { id: s }, t)).data,
22
- create: async (s, t) => (await o.request(l.create, s, y(t))).data,
23
- update: async (s, t, c) => (await o.request(l.update, { ...t, id: s }, y(c))).data,
24
- deactivate: async (s) => (await o.request(l.deactivate, { id: s })).data,
25
- keys: async (s, t) => (await o.request(l.keys, { id: s }, t)).data.keys,
26
- /** The secret is in the answer, and only there. */
27
- createKey: async (s, t, c) => (await o.request(l.createkey, { ...t, id: s }, y(c))).data,
28
- revokeKey: async (s, t) => void await o.request(l.revokekey, { id: s, keyID: t }),
29
- /** The people who can answer for an account: the active ones of the users list (its largest page). */
30
- people: async (s) => X(await o.request(Y.usersList, { view: "active", order_col: "name", order_dir: "asc", page: 1, per_page: S }, s), { page: 1, pageSize: S }).rows.map((t) => ({ id: t.id, name: t.name }))
31
- };
32
- }
33
- const se = () => ae(C().http);
34
- function te() {
35
- const o = ee(), s = T();
36
- return { ...o, failureMessage: (t, c) => s(t, c) ?? o.failureMessage(t, c) };
37
- }
38
- const ne = {
39
- class: "flex min-w-0 flex-col gap-group-gap",
40
- "data-test": "service-account-form"
41
- }, h = 0, qe = /* @__PURE__ */ I({
42
- __name: "ServiceAccountDialog",
43
- emits: ["saved"],
44
- setup(o, { expose: s, emit: t }) {
45
- const c = t, { t: r } = G(), { access: L } = C(), M = U(), _ = se(), { tenants: u } = Q(), P = te(), v = K(() => {
46
- const a = L.held(W);
47
- return a !== null && a.scope.id === void 0;
48
- }), R = (a) => a.trim() === "", d = H({
49
- ...P,
50
- defaults: () => ({ name: "", description: "", tenant_id: u !== null && v.value ? h : null, owner_id: null }),
51
- validator: {
52
- safeParse(a) {
53
- const n = a, i = [], w = r("core.account.validation.required"), q = r("core.serviceaccounts.errors.too_long");
54
- return R(n.name) ? i.push({ path: ["name"], message: w }) : n.name.trim().length > 100 && i.push({ path: ["name"], message: q }), n.description.length > 500 && i.push({ path: ["description"], message: q }), n.owner_id === null && i.push({ path: ["owner_id"], message: w }), u !== null && n.tenant_id === null && i.push({ path: ["tenant_id"], message: w }), i.length > 0 || n.owner_id === null ? { success: !1, error: { issues: i } } : { success: !0, data: { name: n.name.trim(), description: n.description, tenant_id: u === null ? null : n.tenant_id || null, owner_id: n.owner_id } };
55
- }
56
- },
57
- toValues: (a) => ({ name: a.name, description: a.description, tenant_id: a.tenant?.id ?? (v.value ? h : null), owner_id: a.owner.id }),
58
- create: (a, { idempotencyKey: n }) => _.create(a, n),
59
- update: (a, n, { idempotencyKey: i }) => _.update(a.id, n, i),
60
- done: (a) => {
61
- J.success(r("core.serviceaccounts.toasts.saved")), c("saved", a);
62
- }
63
- }), m = d.form, g = V(!1), $ = N({
64
- for: () => g.value && u !== null ? !0 : null,
65
- load: async (a, { signal: n }) => [
66
- ...v.value ? [{ value: h, label: M.levelLabel("organization") }] : [],
67
- ...(await (u?.options(n) ?? [])).map((i) => ({ value: i.id, label: i.name }))
68
- ]
69
- }), z = N({
70
- for: () => g.value ? !0 : null,
71
- load: async (a, { signal: n }) => (await _.people({ signal: n })).map((i) => ({ value: i.id, label: i.name }))
72
- });
73
- function E(a) {
74
- g.value = !0, a ? d.edit(a) : d.create();
75
- }
76
- return s({ show: E, form: m }), (a, n) => (A(), k(e(F), {
77
- command: e(d).command,
78
- size: "md",
79
- title: e(d).editing.value ? e(r)("core.serviceaccounts.edit_title") : e(r)("core.serviceaccounts.create_title"),
80
- subtitle: e(r)("core.serviceaccounts.no_password"),
81
- "confirm-label": e(r)("core.serviceaccounts.save")
82
- }, {
83
- default: b(() => [
84
- B("div", ne, [
85
- p(e(x), null, {
86
- default: b(() => [
87
- p(e(j), f(e(m).bind("name"), {
88
- label: e(r)("core.serviceaccounts.fields.name"),
89
- "max-length": 100,
90
- required: ""
91
- }), null, 16, ["label"]),
92
- p(e(Z), f(e(m).bind("description"), {
93
- label: e(r)("core.serviceaccounts.fields.description"),
94
- rows: 2,
95
- "max-length": 500
96
- }), null, 16, ["label"])
97
- ]),
98
- _: 1
99
- }),
100
- p(e(x), {
101
- footer: e(r)("core.serviceaccounts.fields.owner_hint")
102
- }, {
103
- default: b(() => [
104
- e(u) ? (A(), k(e(O), f({ key: 0 }, e(m).bind("tenant_id"), {
105
- label: e(r)(e(u).labelKey),
106
- options: e($),
107
- required: ""
108
- }), null, 16, ["label", "options"])) : D("", !0),
109
- p(e(O), f(e(m).bind("owner_id"), {
110
- label: e(r)("core.serviceaccounts.fields.owner"),
111
- options: e(z),
112
- required: ""
113
- }), null, 16, ["label", "options"])
114
- ]),
115
- _: 1
116
- }, 8, ["footer"])
117
- ])
118
- ]),
119
- _: 1
120
- }, 8, ["command", "title", "subtitle", "confirm-label"]));
121
- }
122
- });
123
- export {
124
- qe as _,
125
- te as a,
126
- se as u
127
- };