@stsdti/approvable-vue 0.1.7 → 0.1.12

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.
@@ -1,30 +1,30 @@
1
- import { inject as X, ref as T, computed as w, watch as oe, openBlock as t, createElementBlock as s, normalizeClass as B, createElementVNode as e, toDisplayString as d, unref as C, createCommentVNode as k, createTextVNode as Q, Fragment as D, renderList as P, createBlock as K, resolveDynamicComponent as Y, useTemplateRef as le, onMounted as ie, onBeforeUnmount as ke, withDirectives as ge, vModelText as Se, nextTick as Ae, markRaw as we, renderSlot as z, mergeProps as Z, withCtx as pe, createVNode as U, normalizeStyle as W, createSlots as $e, Teleport as Ce, withModifiers as Ee, withKeys as Re, useModel as De, mergeModels as ne } from "vue";
2
- import { mergeMessages as Le, ApprovableAuditRepository as xe, formatMessage as H, isRegisteredIcon as Oe, isUrlIcon as Me, isClassIcon as Ie, get as N, notifyError as re, ApprovableStepRepository as ue, isSuccessResponse as de, notifySuccess as ce, registerActionRenderer as Te, createStepViewModel as Ne, approvableStatusTone as Ve, approvableStepGlyph as je, actionRenderer as Be, performStepAction as Pe, ApprovableStatus as q, createApprovableViewModel as qe, ApprovableStatusRepository as Ke } from "@stsdti/approvable-core";
3
- import { ApprovableClient as ha, actionRenderer as ya, actionSlotName as _a, axiosAdapter as ka, configureApprovableClient as ga, fetchAdapter as Sa, getApprovableClient as Aa, isClassIcon as wa, isRegisteredIcon as $a, isUrlIcon as Ca, setApprovableClient as Ea, unregisterActionRenderer as Ra } from "@stsdti/approvable-core";
4
- const ve = Symbol("approvable.messages");
1
+ import { inject as ee, ref as O, computed as _, watch as Y, openBlock as t, createElementBlock as a, normalizeClass as j, createElementVNode as e, toDisplayString as c, unref as w, createCommentVNode as S, createTextVNode as z, Fragment as L, renderList as T, createBlock as P, resolveDynamicComponent as J, useTemplateRef as ie, onMounted as de, onBeforeUnmount as we, withDirectives as Ce, vModelText as Re, nextTick as xe, markRaw as Ee, mergeProps as te, withCtx as X, createVNode as U, renderSlot as H, createSlots as pe, normalizeProps as Le, guardReactiveProps as De, normalizeStyle as Q, Teleport as Oe, withModifiers as Me, withKeys as Ie, useModel as Ne, mergeModels as ue } from "vue";
2
+ import { mergeMessages as Te, ApprovableAuditRepository as Ve, formatMessage as G, isRegisteredIcon as je, isUrlIcon as Be, isClassIcon as Pe, get as V, notifyError as ve, ApprovableStepRepository as ce, isSuccessResponse as me, notifySuccess as be, registerActionRenderer as qe, createStepViewModel as fe, actionRenderer as Ke, performStepAction as He, ApprovableStatus as K, createApprovableViewModel as he, createCompactViewModel as Ue, approvableStatusTone as Fe, approvableStepGlyph as Ge, createStepWindow as ze, ApprovableStatusRepository as We } from "@stsdti/approvable-core";
3
+ import { ApprovableClient as Na, actionRenderer as Ta, actionSlotName as Va, axiosAdapter as ja, configureApprovableClient as Ba, fetchAdapter as Pa, getApprovableClient as qa, isClassIcon as Ka, isRegisteredIcon as Ha, isUrlIcon as Ua, setApprovableClient as Fa, unregisterActionRenderer as Ga } from "@stsdti/approvable-core";
4
+ const ye = Symbol("approvable.messages");
5
5
  function F() {
6
- return Le(X(ve, null));
6
+ return Te(ee(ye, null));
7
7
  }
8
- const Ue = {
8
+ const Qe = {
9
9
  key: 0,
10
10
  class: "approvable-timeline-header"
11
- }, Fe = { class: "approvable-timeline-eyebrow" }, Ge = { class: "approvable-timeline-title" }, He = ["disabled"], ze = {
11
+ }, Ye = { class: "approvable-timeline-eyebrow" }, Je = { class: "approvable-timeline-title" }, Xe = ["disabled"], Ze = {
12
12
  key: 1,
13
13
  class: "approvable-timeline-state",
14
14
  role: "status"
15
- }, Qe = {
15
+ }, et = {
16
16
  key: 2,
17
17
  class: "approvable-timeline-error"
18
- }, We = {
18
+ }, tt = {
19
19
  key: 3,
20
20
  class: "approvable-timeline-state"
21
- }, Ye = { class: "approvable-timeline-list" }, Je = ["stroke-width"], Xe = ["d"], Ze = { class: "approvable-timeline-content" }, et = { class: "approvable-timeline-line" }, tt = { class: "approvable-timeline-actor" }, at = { class: "approvable-timeline-operation" }, st = { class: "approvable-timeline-time" }, ot = {
21
+ }, at = { class: "approvable-timeline-list" }, st = ["stroke-width"], ot = ["d"], lt = { class: "approvable-timeline-content" }, nt = { class: "approvable-timeline-line" }, rt = { class: "approvable-timeline-actor" }, it = { class: "approvable-timeline-operation" }, pt = { class: "approvable-timeline-time" }, ut = {
22
22
  key: 0,
23
23
  class: "approvable-timeline-comment"
24
- }, lt = {
24
+ }, vt = {
25
25
  key: 1,
26
26
  class: "approvable-timeline-change"
27
- }, nt = { class: "approvable-timeline-change-label" }, rt = { class: "approvable-timeline-value approvable-timeline-value--old" }, it = { class: "approvable-timeline-value approvable-timeline-value--new" }, pt = { class: "approvable-timeline-footer" }, me = {
27
+ }, dt = { class: "approvable-timeline-change-label" }, ct = { class: "approvable-timeline-value approvable-timeline-value--old" }, mt = { class: "approvable-timeline-value approvable-timeline-value--new" }, bt = { class: "approvable-timeline-footer" }, ke = {
28
28
  __name: "ApprovableAuditTimeline",
29
29
  props: {
30
30
  approvableId: { type: [Number, String], required: !0 },
@@ -32,13 +32,13 @@ const Ue = {
32
32
  showHeader: { type: Boolean, default: !0 }
33
33
  },
34
34
  emits: ["loaded"],
35
- setup(o, { expose: b, emit: m }) {
36
- const f = o, h = m, g = F(), _ = new xe(), n = T([]), v = T(!1), L = T(""), y = {
35
+ setup(l, { expose: y, emit: u }) {
36
+ const f = l, h = u, m = F(), n = new Ve(), g = O([]), $ = O(!1), C = O(""), v = {
37
37
  approvable_status_name: "Status",
38
38
  comment: "Comment",
39
39
  responsible: "Assigned to",
40
40
  is_active: "Active step"
41
- }, x = {
41
+ }, b = {
42
42
  approve: { paths: ["M4 8.4l2.8 2.8 5.4-6"], width: 2.8 },
43
43
  reject: { paths: ["M5.2 5.2l5.6 5.6M10.8 5.2l-5.6 5.6"], width: 2.4 },
44
44
  comment: { paths: ["M8 4.6v3.6l2.6 1.6"], width: 2.2 },
@@ -47,177 +47,177 @@ const Ue = {
47
47
  signal: { paths: ["M8 3.4v3.2M5.2 5.2l2.2 2.2M8 11.6a1.4 1.4 0 1 0 0-2.8 1.4 1.4 0 0 0 0 2.8"], width: 1.8 },
48
48
  created: { paths: ["M4.4 8h7.2"], width: 2.2 },
49
49
  update: { paths: ["M4.4 8h7.2"], width: 2.2 }
50
- }, c = /* @__PURE__ */ new Set(["created", "update"]), $ = w(() => {
51
- const a = n.value.filter((l) => l.approvable_step_id), r = /* @__PURE__ */ new Map();
52
- for (const l of a) {
53
- const i = l.request_id || `audit-${l.id}`;
54
- r.has(i) || r.set(i, []), r.get(i).push(l);
50
+ }, s = /* @__PURE__ */ new Set(["created", "update"]), k = _(() => {
51
+ const o = g.value.filter((i) => i.approvable_step_id), p = /* @__PURE__ */ new Map();
52
+ for (const i of o) {
53
+ const d = i.request_id || `audit-${i.id}`;
54
+ p.has(d) || p.set(d, []), p.get(d).push(i);
55
55
  }
56
- return [...r.values()].map((l) => {
57
- const i = l[0], A = O(i), G = l.flatMap(u);
56
+ return [...p.values()].map((i) => {
57
+ const d = i[0], E = A(d), W = i.flatMap(x);
58
58
  return {
59
- id: i.request_id || `audit-${i.id}`,
60
- entries: l,
61
- audit: i,
62
- kind: A,
59
+ id: d.request_id || `audit-${d.id}`,
60
+ entries: i,
61
+ audit: d,
62
+ kind: E,
63
63
  // A modifier class rather than utilities: the accent for each kind of
64
64
  // event is a theme decision, so it belongs in the stylesheets alongside
65
65
  // every other colour, not baked into the component.
66
- kindClass: `approvable-timeline-marker--${A}`,
67
- icon: x[A],
68
- isQuiet: c.has(A),
69
- isSingleLine: G.length === 0
66
+ kindClass: `approvable-timeline-marker--${E}`,
67
+ icon: b[E],
68
+ isQuiet: s.has(E),
69
+ isSingleLine: W.length === 0
70
70
  };
71
- }).sort((l, i) => new Date(i.audit.created_at) - new Date(l.audit.created_at));
71
+ }).sort((i, d) => new Date(d.audit.created_at) - new Date(i.audit.created_at));
72
72
  });
73
- function O(a) {
74
- var l, i, A;
75
- const r = (l = a.metadata) == null ? void 0 : l.button;
76
- return r != null && r.is_undo ? "undo" : (r == null ? void 0 : r.result) === "rejected" ? "reject" : (r == null ? void 0 : r.result) === "approved" ? "approve" : ((i = a.metadata) == null ? void 0 : i.operation) === "comment" ? "comment" : ((A = a.metadata) == null ? void 0 : A.operation) === "signal" ? "signal" : a.event === "created" ? "created" : V(a) ? "status" : "update";
73
+ function A(o) {
74
+ var i, d, E;
75
+ const p = (i = o.metadata) == null ? void 0 : i.button;
76
+ return p != null && p.is_undo ? "undo" : (p == null ? void 0 : p.result) === "rejected" ? "reject" : (p == null ? void 0 : p.result) === "approved" ? "approve" : ((d = o.metadata) == null ? void 0 : d.operation) === "comment" ? "comment" : ((E = o.metadata) == null ? void 0 : E.operation) === "signal" ? "signal" : o.event === "created" ? "created" : N(o) ? "status" : "update";
77
77
  }
78
- function V(a) {
79
- var i, A;
80
- const r = (i = a.old_values) == null ? void 0 : i.approvable_status_name, l = (A = a.new_values) == null ? void 0 : A.approvable_status_name;
81
- return l !== void 0 && r !== l;
78
+ function N(o) {
79
+ var d, E;
80
+ const p = (d = o.old_values) == null ? void 0 : d.approvable_status_name, i = (E = o.new_values) == null ? void 0 : E.approvable_status_name;
81
+ return i !== void 0 && p !== i;
82
82
  }
83
- function R(a) {
84
- var i, A, G, ee, te, ae;
85
- const r = (i = a.metadata) == null ? void 0 : i.button;
86
- if (r) {
87
- const se = r.text || r.label || r.id || "action";
88
- return r.is_undo ? "Reverted the decision" : r.is_revision ? `Changed decision to ${se}` : se;
83
+ function I(o) {
84
+ var d, E, W, oe, le, ne;
85
+ const p = (d = o.metadata) == null ? void 0 : d.button;
86
+ if (p) {
87
+ const re = p.text || p.label || p.id || "action";
88
+ return p.is_undo ? "Reverted the decision" : p.is_revision ? `Changed decision to ${re}` : re;
89
89
  }
90
- if (((A = a.metadata) == null ? void 0 : A.operation) === "comment") return "Comment added";
91
- if (((G = a.metadata) == null ? void 0 : G.operation) === "signal") return `Signal received: ${((te = (ee = a.metadata) == null ? void 0 : ee.signal) == null ? void 0 : te.name) || ""}`.trim();
92
- if (a.event === "created") return "Step started";
93
- const l = (ae = a.new_values) == null ? void 0 : ae.approvable_status_name;
94
- return V(a) && l ? `Status set to ${l}` : "Step updated";
90
+ if (((E = o.metadata) == null ? void 0 : E.operation) === "comment") return "Comment added";
91
+ if (((W = o.metadata) == null ? void 0 : W.operation) === "signal") return `Signal received: ${((le = (oe = o.metadata) == null ? void 0 : oe.signal) == null ? void 0 : le.name) || ""}`.trim();
92
+ if (o.event === "created") return "Step started";
93
+ const i = (ne = o.new_values) == null ? void 0 : ne.approvable_status_name;
94
+ return N(o) && i ? `Status set to ${i}` : "Step updated";
95
95
  }
96
- function p(a = {}) {
97
- return a.type === "system" ? "System" : a.name ? a.name : a.email ? a.email : a.id ? a.type === "fake" ? `Test user ${a.id}` : `User ${a.id}` : a.type === "fake" ? "Test identity" : "Automated";
96
+ function B(o = {}) {
97
+ return o.type === "system" ? "System" : o.name ? o.name : o.email ? o.email : o.id ? o.type === "fake" ? `Test user ${o.id}` : `User ${o.id}` : o.type === "fake" ? "Test identity" : "Automated";
98
98
  }
99
- function u(a) {
100
- const r = a.old_values || {}, l = a.new_values || {};
101
- return Object.keys(y).filter((i) => i in r || i in l).map((i) => ({ key: i, label: y[i], oldValue: r[i], newValue: l[i] })).filter((i) => i.oldValue !== i.newValue);
99
+ function x(o) {
100
+ const p = o.old_values || {}, i = o.new_values || {};
101
+ return Object.keys(v).filter((d) => d in p || d in i).map((d) => ({ key: d, label: v[d], oldValue: p[d], newValue: i[d] })).filter((d) => d.oldValue !== d.newValue);
102
102
  }
103
- function E(a) {
104
- return a.oldValue !== void 0 && a.oldValue !== null && a.oldValue !== "";
103
+ function D(o) {
104
+ return o.oldValue !== void 0 && o.oldValue !== null && o.oldValue !== "";
105
105
  }
106
- function j(a) {
107
- if (a == null || a === "") return "—";
108
- if (typeof a == "boolean") return a ? "Yes" : "No";
109
- if (Array.isArray(a)) return a.length ? a.join(", ") : "—";
110
- const r = typeof a == "object" ? JSON.stringify(a) : String(a);
111
- return r.length > 180 ? `${r.slice(0, 177)}…` : r;
106
+ function q(o) {
107
+ if (o == null || o === "") return "—";
108
+ if (typeof o == "boolean") return o ? "Yes" : "No";
109
+ if (Array.isArray(o)) return o.length ? o.join(", ") : "—";
110
+ const p = typeof o == "object" ? JSON.stringify(o) : String(o);
111
+ return p.length > 180 ? `${p.slice(0, 177)}…` : p;
112
112
  }
113
- function I(a) {
114
- if (!a) return "";
115
- const r = new Date(a);
116
- return Number.isNaN(r.getTime()) ? a : new Intl.DateTimeFormat(void 0, {
113
+ function M(o) {
114
+ if (!o) return "";
115
+ const p = new Date(o);
116
+ return Number.isNaN(p.getTime()) ? o : new Intl.DateTimeFormat(void 0, {
117
117
  dateStyle: "medium",
118
118
  timeStyle: "short"
119
- }).format(r);
119
+ }).format(p);
120
120
  }
121
- async function M() {
122
- var a, r;
121
+ async function r() {
122
+ var o, p;
123
123
  if (!f.approvableId) {
124
- n.value = [], v.value = !1, L.value = "The approval history is unavailable because the approvable has no id.";
124
+ g.value = [], $.value = !1, C.value = "The approval history is unavailable because the approvable has no id.";
125
125
  return;
126
126
  }
127
- v.value = !0, L.value = "";
127
+ $.value = !0, C.value = "";
128
128
  try {
129
- const l = await _.fetchTimeline(f.approvableId, f.limit);
130
- if (!l || l.status < 200 || l.status >= 300)
131
- throw new Error(((a = l == null ? void 0 : l.data) == null ? void 0 : a.message) || "The audit timeline could not be loaded.");
132
- const i = Array.isArray(l.data) ? l.data : (r = l.data) == null ? void 0 : r.data;
133
- n.value = Array.isArray(i) ? i : [];
134
- } catch (l) {
135
- L.value = (l == null ? void 0 : l.message) || "The audit timeline could not be loaded.";
129
+ const i = await n.fetchTimeline(f.approvableId, f.limit);
130
+ if (!i || i.status < 200 || i.status >= 300)
131
+ throw new Error(((o = i == null ? void 0 : i.data) == null ? void 0 : o.message) || "The audit timeline could not be loaded.");
132
+ const d = Array.isArray(i.data) ? i.data : (p = i.data) == null ? void 0 : p.data;
133
+ g.value = Array.isArray(d) ? d : [];
134
+ } catch (i) {
135
+ C.value = (i == null ? void 0 : i.message) || "The audit timeline could not be loaded.";
136
136
  } finally {
137
- v.value = !1;
137
+ $.value = !1;
138
138
  }
139
139
  }
140
- const S = w(() => H(g.eventCount, { count: $.value.length }));
141
- return oe($, (a) => h("loaded", a.length)), oe(() => f.approvableId, M, { immediate: !0 }), b({ refresh: M }), (a, r) => (t(), s("section", {
142
- class: B(["approvable-timeline", o.showHeader && "approvable-timeline--panel"])
140
+ const R = _(() => G(m.eventCount, { count: k.value.length }));
141
+ return Y(k, (o) => h("loaded", o.length)), Y(() => f.approvableId, r, { immediate: !0 }), y({ refresh: r }), (o, p) => (t(), a("section", {
142
+ class: j(["approvable-timeline", l.showHeader && "approvable-timeline--panel"])
143
143
  }, [
144
- o.showHeader ? (t(), s("div", Ue, [
145
- e("p", Fe, d(C(g).history), 1),
146
- e("h3", Ge, d(S.value), 1),
144
+ l.showHeader ? (t(), a("div", Qe, [
145
+ e("p", Ye, c(w(m).history), 1),
146
+ e("h3", Je, c(R.value), 1),
147
147
  e("button", {
148
148
  type: "button",
149
149
  class: "approvable-timeline-refresh",
150
- disabled: v.value,
151
- onClick: M
152
- }, d(v.value ? "Loading…" : "Refresh"), 9, He)
153
- ])) : k("", !0),
154
- v.value ? (t(), s("div", ze, [...r[0] || (r[0] = [
150
+ disabled: $.value,
151
+ onClick: r
152
+ }, c($.value ? "Loading…" : "Refresh"), 9, Xe)
153
+ ])) : S("", !0),
154
+ $.value ? (t(), a("div", Ze, [...p[0] || (p[0] = [
155
155
  e("span", {
156
156
  class: "approvable-spinner",
157
157
  "aria-hidden": "true"
158
158
  }, null, -1),
159
- Q(" Loading approval history… ", -1)
160
- ])])) : L.value ? (t(), s("p", Qe, d(L.value), 1)) : $.value.length ? (t(), s(D, { key: 4 }, [
161
- e("ol", Ye, [
162
- (t(!0), s(D, null, P($.value, (l) => (t(), s("li", {
163
- key: l.id,
164
- class: B(["approvable-timeline-item", {
165
- "approvable-timeline-item--single-line": l.isSingleLine,
166
- "approvable-timeline-item--quiet": l.isQuiet
159
+ z(" Loading approval history… ", -1)
160
+ ])])) : C.value ? (t(), a("p", et, c(C.value), 1)) : k.value.length ? (t(), a(L, { key: 4 }, [
161
+ e("ol", at, [
162
+ (t(!0), a(L, null, T(k.value, (i) => (t(), a("li", {
163
+ key: i.id,
164
+ class: j(["approvable-timeline-item", {
165
+ "approvable-timeline-item--single-line": i.isSingleLine,
166
+ "approvable-timeline-item--quiet": i.isQuiet
167
167
  }])
168
168
  }, [
169
169
  e("span", {
170
- class: B(["approvable-timeline-marker", l.kindClass])
170
+ class: j(["approvable-timeline-marker", i.kindClass])
171
171
  }, [
172
- (t(), s("svg", {
172
+ (t(), a("svg", {
173
173
  fill: "none",
174
174
  stroke: "currentColor",
175
- "stroke-width": l.icon.width,
175
+ "stroke-width": i.icon.width,
176
176
  "stroke-linecap": "round",
177
177
  "stroke-linejoin": "round",
178
178
  viewBox: "0 0 16 16",
179
179
  "aria-hidden": "true"
180
180
  }, [
181
- (t(!0), s(D, null, P(l.icon.paths, (i, A) => (t(), s("path", {
182
- key: A,
183
- d: i
184
- }, null, 8, Xe))), 128))
185
- ], 8, Je))
181
+ (t(!0), a(L, null, T(i.icon.paths, (d, E) => (t(), a("path", {
182
+ key: E,
183
+ d
184
+ }, null, 8, ot))), 128))
185
+ ], 8, st))
186
186
  ], 2),
187
- e("div", Ze, [
188
- e("div", et, [
189
- e("p", tt, d(p(l.audit.actor)), 1),
190
- e("p", at, d(R(l.audit)), 1),
191
- e("time", st, d(I(l.audit.created_at)), 1)
187
+ e("div", lt, [
188
+ e("div", nt, [
189
+ e("p", rt, c(B(i.audit.actor)), 1),
190
+ e("p", it, c(I(i.audit)), 1),
191
+ e("time", pt, c(M(i.audit.created_at)), 1)
192
192
  ]),
193
- (t(!0), s(D, null, P(l.entries, (i) => (t(), s(D, {
194
- key: i.id
193
+ (t(!0), a(L, null, T(i.entries, (d) => (t(), a(L, {
194
+ key: d.id
195
195
  }, [
196
- (t(!0), s(D, null, P(u(i), (A) => (t(), s(D, {
197
- key: `${i.id}-${A.key}`
196
+ (t(!0), a(L, null, T(x(d), (E) => (t(), a(L, {
197
+ key: `${d.id}-${E.key}`
198
198
  }, [
199
- A.key === "comment" ? (t(), s("p", ot, d(j(A.newValue)), 1)) : (t(), s("p", lt, [
200
- e("span", nt, d(A.label), 1),
201
- E(A) ? (t(), s(D, { key: 0 }, [
202
- e("span", rt, d(j(A.oldValue)), 1),
203
- r[1] || (r[1] = e("span", { class: "approvable-timeline-arrow" }, "→", -1))
204
- ], 64)) : k("", !0),
205
- e("span", it, d(j(A.newValue)), 1)
199
+ E.key === "comment" ? (t(), a("p", ut, c(q(E.newValue)), 1)) : (t(), a("p", vt, [
200
+ e("span", dt, c(E.label), 1),
201
+ D(E) ? (t(), a(L, { key: 0 }, [
202
+ e("span", ct, c(q(E.oldValue)), 1),
203
+ p[1] || (p[1] = e("span", { class: "approvable-timeline-arrow" }, "→", -1))
204
+ ], 64)) : S("", !0),
205
+ e("span", mt, c(q(E.newValue)), 1)
206
206
  ]))
207
207
  ], 64))), 128))
208
208
  ], 64))), 128))
209
209
  ])
210
210
  ], 2))), 128))
211
211
  ]),
212
- e("p", pt, d(C(g).allEventsShown), 1)
213
- ], 64)) : (t(), s("p", We, "No approval activity yet."))
212
+ e("p", bt, c(w(m).allEventsShown), 1)
213
+ ], 64)) : (t(), a("p", tt, "No approval activity yet."))
214
214
  ], 2));
215
215
  }
216
- }, be = Symbol("approvable.iconRegistry");
217
- function ut() {
218
- return X(be, {});
216
+ }, ge = Symbol("approvable.iconRegistry");
217
+ function ft() {
218
+ return ee(ge, {});
219
219
  }
220
- const dt = ["src"], J = {
220
+ const ht = ["src"], Z = {
221
221
  __name: "ApprovableIcon",
222
222
  props: {
223
223
  icon: {
@@ -225,31 +225,31 @@ const dt = ["src"], J = {
225
225
  default: ""
226
226
  }
227
227
  },
228
- setup(o) {
229
- const b = ut();
230
- return (m, f) => C(Oe)(C(b), o.icon) ? (t(), K(Y(C(b)[o.icon]), {
228
+ setup(l) {
229
+ const y = ft();
230
+ return (u, f) => w(je)(w(y), l.icon) ? (t(), P(J(w(y)[l.icon]), {
231
231
  key: 0,
232
232
  class: "approvable-btn-icon"
233
- })) : C(Me)(o.icon) ? (t(), s("img", {
233
+ })) : w(Be)(l.icon) ? (t(), a("img", {
234
234
  key: 1,
235
- src: o.icon,
235
+ src: l.icon,
236
236
  alt: "",
237
237
  class: "approvable-btn-icon"
238
- }, null, 8, dt)) : C(Ie)(o.icon) ? (t(), s("i", {
238
+ }, null, 8, ht)) : w(Pe)(l.icon) ? (t(), a("i", {
239
239
  key: 2,
240
- class: B(o.icon)
241
- }, null, 2)) : k("", !0);
240
+ class: j(l.icon)
241
+ }, null, 2)) : S("", !0);
242
242
  }
243
- }, ct = ["title"], vt = {
243
+ }, yt = ["title"], kt = {
244
244
  key: 0,
245
245
  class: "approvable-popover-panel"
246
- }, mt = {
246
+ }, gt = {
247
247
  key: 0,
248
248
  class: "approvable-loading"
249
- }, bt = { class: "approvable-popover-title" }, ft = {
249
+ }, _t = { class: "approvable-popover-title" }, St = {
250
250
  key: 1,
251
251
  class: "approvable-popover-meta"
252
- }, ht = { class: "approvable-popover-author" }, yt = { class: "approvable-popover-actions" }, fe = {
252
+ }, $t = { class: "approvable-popover-author" }, At = { class: "approvable-popover-actions" }, _e = {
253
253
  __name: "ApprovableStepComment",
254
254
  props: {
255
255
  approvableStep: {
@@ -261,55 +261,55 @@ const dt = ["src"], J = {
261
261
  }
262
262
  },
263
263
  emits: ["isLoading", "refresh"],
264
- setup(o, { emit: b }) {
265
- const m = o, f = b, h = le("rootRef"), g = le("textareaRef"), _ = T(!1), n = T(!1), v = T(null), L = w(() => N(m.approvableStep, "commented_by"));
266
- function y() {
267
- _.value ? c() : x();
264
+ setup(l, { emit: y }) {
265
+ const u = l, f = y, h = ie("rootRef"), m = ie("textareaRef"), n = O(!1), g = O(!1), $ = O(null), C = _(() => V(u.approvableStep, "commented_by"));
266
+ function v() {
267
+ n.value ? s() : b();
268
268
  }
269
- function x() {
270
- v.value = N(m.approvableStep, "comment"), _.value = !0, Ae($);
269
+ function b() {
270
+ $.value = V(u.approvableStep, "comment"), n.value = !0, xe(k);
271
271
  }
272
- function c() {
273
- _.value = !1;
272
+ function s() {
273
+ n.value = !1;
274
274
  }
275
- function $() {
276
- const u = g.value;
277
- u && (u.style.height = "auto", u.style.height = `${u.scrollHeight}px`);
275
+ function k() {
276
+ const x = m.value;
277
+ x && (x.style.height = "auto", x.style.height = `${x.scrollHeight}px`);
278
278
  }
279
- function O(u) {
280
- _.value && h.value && !h.value.contains(u.target) && c();
279
+ function A(x) {
280
+ n.value && h.value && !h.value.contains(x.target) && s();
281
281
  }
282
- function V(u) {
283
- u.key === "Escape" && c();
282
+ function N(x) {
283
+ x.key === "Escape" && s();
284
284
  }
285
- ie(() => {
286
- document.addEventListener("click", O), document.addEventListener("keydown", V);
287
- }), ke(() => {
288
- document.removeEventListener("click", O), document.removeEventListener("keydown", V);
285
+ de(() => {
286
+ document.addEventListener("click", A), document.addEventListener("keydown", N);
287
+ }), we(() => {
288
+ document.removeEventListener("click", A), document.removeEventListener("keydown", N);
289
289
  });
290
- const R = F();
291
- async function p() {
292
- if (!N(m.approvableStep, "comment") && !v.value) {
293
- re(R.commentRequired);
290
+ const I = F();
291
+ async function B() {
292
+ if (!V(u.approvableStep, "comment") && !$.value) {
293
+ ve(I.commentRequired);
294
294
  return;
295
295
  }
296
- n.value = !0, f("isLoading", !0);
297
- const u = {
298
- comment: v.value
299
- }, E = await new ue().comment(m.approvableStep.id, u);
300
- de(E) ? (ce(R.commentSaved), c(), f("refresh")) : re(R.commentFailed), n.value = !1, f("isLoading", !1);
296
+ g.value = !0, f("isLoading", !0);
297
+ const x = {
298
+ comment: $.value
299
+ }, D = await new ce().comment(u.approvableStep.id, x);
300
+ me(D) ? (be(I.commentSaved), s(), f("refresh")) : ve(I.commentFailed), g.value = !1, f("isLoading", !1);
301
301
  }
302
- return (u, E) => (t(), s("div", {
302
+ return (x, D) => (t(), a("div", {
303
303
  ref_key: "rootRef",
304
304
  ref: h,
305
305
  class: "approvable-popover"
306
306
  }, [
307
307
  e("button", {
308
308
  class: "approvable-btn",
309
- title: C(R).comments,
309
+ title: w(I).comments,
310
310
  type: "button",
311
- onClick: y
312
- }, [...E[1] || (E[1] = [
311
+ onClick: v
312
+ }, [...D[1] || (D[1] = [
313
313
  e("svg", {
314
314
  xmlns: "http://www.w3.org/2000/svg",
315
315
  width: "16",
@@ -326,50 +326,272 @@ const dt = ["src"], J = {
326
326
  e("path", { d: "M8 13h6" }),
327
327
  e("path", { d: "M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12z" })
328
328
  ], -1)
329
- ])], 8, ct),
330
- _.value ? (t(), s("div", vt, [
331
- n.value ? (t(), s("div", mt, [...E[2] || (E[2] = [
329
+ ])], 8, yt),
330
+ n.value ? (t(), a("div", kt, [
331
+ g.value ? (t(), a("div", gt, [...D[2] || (D[2] = [
332
332
  e("span", { class: "approvable-spinner" }, null, -1)
333
- ])])) : k("", !0),
334
- e("div", bt, d(C(R).comments), 1),
335
- L.value ? (t(), s("div", ft, [
336
- e("div", null, d(C(R).commentAuthor) + ":", 1),
337
- e("div", ht, d(L.value), 1)
338
- ])) : k("", !0),
339
- o.disabled ? k("", !0) : (t(), s(D, { key: 2 }, [
340
- ge(e("textarea", {
333
+ ])])) : S("", !0),
334
+ e("div", _t, c(w(I).comments), 1),
335
+ C.value ? (t(), a("div", St, [
336
+ e("div", null, c(w(I).commentAuthor) + ":", 1),
337
+ e("div", $t, c(C.value), 1)
338
+ ])) : S("", !0),
339
+ l.disabled ? S("", !0) : (t(), a(L, { key: 2 }, [
340
+ Ce(e("textarea", {
341
341
  ref_key: "textareaRef",
342
- ref: g,
343
- "onUpdate:modelValue": E[0] || (E[0] = (j) => v.value = j),
342
+ ref: m,
343
+ "onUpdate:modelValue": D[0] || (D[0] = (q) => $.value = q),
344
344
  class: "approvable-textarea",
345
345
  rows: "1",
346
- onInput: $
346
+ onInput: k
347
347
  }, null, 544), [
348
- [Se, v.value]
348
+ [Re, $.value]
349
349
  ]),
350
- e("div", yt, [
350
+ e("div", At, [
351
351
  e("button", {
352
352
  class: "approvable-btn approvable-btn--primary",
353
353
  type: "button",
354
- onClick: p
355
- }, d(C(R).save), 1)
354
+ onClick: B
355
+ }, c(w(I).save), 1)
356
356
  ])
357
357
  ], 64))
358
- ])) : k("", !0)
358
+ ])) : S("", !0)
359
359
  ], 512));
360
360
  }
361
361
  };
362
- function va(o, b) {
363
- return Te(o, we(b));
362
+ function Da(l, y) {
363
+ return qe(l, Ee(y));
364
364
  }
365
- const he = Symbol("approvable.linkComponent");
366
- function _t() {
367
- return X(he, "a");
365
+ const Se = Symbol("approvable.linkComponent");
366
+ function wt() {
367
+ return ee(Se, "a");
368
368
  }
369
- function kt(o, b) {
370
- return o === "a" ? { href: b } : { to: b };
369
+ function Ct(l, y) {
370
+ return l === "a" ? { href: y } : { to: y };
371
371
  }
372
- const gt = {
372
+ const Rt = {
373
+ key: 0,
374
+ class: "approvable-step-actions"
375
+ }, xt = { class: "approvable-btn-group" }, Et = ["title", "onClick"], Lt = ["title", "onClick"], Dt = {
376
+ key: 0,
377
+ class: "approvable-btn-group"
378
+ }, ae = {
379
+ __name: "ApprovableStepActions",
380
+ props: {
381
+ value: {
382
+ type: Object,
383
+ required: !0
384
+ },
385
+ approvable: {
386
+ type: Object,
387
+ required: !0
388
+ },
389
+ resource: {
390
+ type: Object,
391
+ required: !0
392
+ }
393
+ },
394
+ emits: ["isLoading", "refresh"],
395
+ setup(l, { emit: y }) {
396
+ const u = y, f = l, h = wt(), m = _(() => fe(f.value)), n = _(() => m.value.buttons.length > 0 || !!f.value.can_comment), g = (v) => ({
397
+ "approvable-btn": !0,
398
+ // A button carrying only an icon collapses to a circle, so the row keeps its
399
+ // rhythm instead of stretching around an empty label.
400
+ "approvable-btn--icon": !v.text,
401
+ "approvable-btn--primary": v.result === "approved"
402
+ }), $ = (v) => m.value.isActive ? Ke(v == null ? void 0 : v.action_ui) : null, C = async (v) => {
403
+ u("isLoading", !0);
404
+ const b = await He({
405
+ stepId: m.value.id,
406
+ button: v,
407
+ buttons: m.value.buttons
408
+ });
409
+ u("isLoading", !1), b.skipped || u("refresh");
410
+ };
411
+ return (v, b) => n.value ? (t(), a("div", Rt, [
412
+ e("div", xt, [
413
+ (t(!0), a(L, null, T(m.value.buttons, (s, k) => (t(), a(L, {
414
+ key: s.id ?? k
415
+ }, [
416
+ $(s) ? (t(), P(J($(s)), {
417
+ key: 0,
418
+ "action-ui": s.action_ui,
419
+ approvable: l.approvable,
420
+ button: s,
421
+ buttons: [s],
422
+ complete: C,
423
+ resource: l.resource,
424
+ step: l.value,
425
+ onIsLoading: b[0] || (b[0] = (A) => u("isLoading", A)),
426
+ onRefresh: b[1] || (b[1] = (A) => u("refresh"))
427
+ }, null, 40, ["action-ui", "approvable", "button", "buttons", "resource", "step"])) : s.link ? (t(), P(J(w(h)), te({
428
+ key: 1,
429
+ ref_for: !0
430
+ }, w(Ct)(w(h), s.link)), {
431
+ default: X(() => [
432
+ e("button", {
433
+ title: s.tooltip,
434
+ class: j(g(s)),
435
+ type: "button",
436
+ onClick: (A) => C(s)
437
+ }, [
438
+ U(Z, {
439
+ icon: s.icon
440
+ }, null, 8, ["icon"])
441
+ ], 10, Et)
442
+ ]),
443
+ _: 2
444
+ }, 1040)) : (t(), a("button", {
445
+ key: 2,
446
+ title: s.tooltip,
447
+ class: j(g(s)),
448
+ type: "button",
449
+ onClick: (A) => C(s)
450
+ }, [
451
+ U(Z, {
452
+ icon: s.icon
453
+ }, null, 8, ["icon"]),
454
+ z(" " + c(s.text), 1)
455
+ ], 10, Lt))
456
+ ], 64))), 128))
457
+ ]),
458
+ l.value.can_comment ? (t(), a("div", Dt, [
459
+ U(_e, {
460
+ "approvable-step": l.value,
461
+ disabled: !l.value.can_comment,
462
+ onRefresh: b[2] || (b[2] = (s) => u("refresh")),
463
+ onIsLoading: b[3] || (b[3] = (s) => u("isLoading", s))
464
+ }, null, 8, ["approvable-step", "disabled"])
465
+ ])) : S("", !0)
466
+ ])) : S("", !0);
467
+ }
468
+ }, se = {
469
+ __name: "ApproveStatusInfo",
470
+ props: {
471
+ value: {
472
+ required: !0
473
+ },
474
+ label: {
475
+ default: null
476
+ }
477
+ },
478
+ setup(l) {
479
+ const y = l, u = _(() => {
480
+ const h = V(y.value, "code", " - ");
481
+ return {
482
+ "approvable-badge": !0,
483
+ "approvable-badge--draft": [K.CODES.CODE_DRAFT].includes(h),
484
+ "approvable-badge--waiting": [K.CODES.CODE_WAITING].includes(h),
485
+ "approvable-badge--success": [K.CODES.CODE_APPROVED, K.CODES.CODE_VIEWED, K.CODES.CODE_NOTICED].includes(h),
486
+ "approvable-badge--danger": [K.CODES.CODE_REJECTED].includes(h),
487
+ "approvable-badge--muted": [K.CODES.CODE_EXPIRED, K.CODES.CODE_SOLVED].includes(h),
488
+ "approvable-badge--empty": h === " - "
489
+ };
490
+ }), f = _(() => y.label ? y.label : V(y.value, "name", " - "));
491
+ return (h, m) => (t(), a("span", {
492
+ class: j(u.value)
493
+ }, c(f.value), 3));
494
+ }
495
+ }, Ot = { class: "approvable-compact" }, Mt = { class: "approvable-compact-main" }, It = { class: "approvable-compact-line" }, Nt = ["aria-label"], Tt = ["title"], Vt = {
496
+ key: 0,
497
+ class: "approvable-compact-who"
498
+ }, jt = { class: "approvable-compact-name" }, Bt = { class: "approvable-compact-side" }, Pt = ["aria-label", "title"], $e = {
499
+ __name: "ApprovableCompact",
500
+ props: {
501
+ value: {
502
+ type: Object,
503
+ required: !0
504
+ },
505
+ showApprovableStatus: { type: Boolean, default: !0 }
506
+ },
507
+ emits: ["expand", "isLoading", "refresh"],
508
+ setup(l, { emit: y }) {
509
+ const u = l, f = y, h = F(), m = _(() => he(u.value)), n = _(() => Ue(m.value.steps)), g = _(() => n.value.focus), $ = _(() => G(h.stepProgress, {
510
+ current: n.value.focusStepNumber ?? 0,
511
+ total: n.value.stepCount
512
+ })), C = (b) => ({
513
+ "approvable-compact-dot": !0,
514
+ [`approvable-compact-dot--${b.tone}`]: !0
515
+ }), v = (b) => [
516
+ G(h.stepProgress, { current: b.number, total: n.value.stepCount }),
517
+ b.approverName,
518
+ b.statusName
519
+ ].filter(Boolean).join(" — ");
520
+ return (b, s) => (t(), a("div", Ot, [
521
+ e("div", Mt, [
522
+ e("div", It, [
523
+ l.showApprovableStatus ? (t(), P(se, {
524
+ key: 0,
525
+ label: m.value.statusName,
526
+ value: m.value.status
527
+ }, null, 8, ["label", "value"])) : S("", !0),
528
+ n.value.dots.length ? (t(), a("span", {
529
+ key: 1,
530
+ class: "approvable-compact-dots",
531
+ role: "img",
532
+ "aria-label": $.value
533
+ }, [
534
+ (t(!0), a(L, null, T(n.value.dots, (k) => (t(), a("span", {
535
+ key: k.id,
536
+ class: j(C(k)),
537
+ title: v(k)
538
+ }, null, 10, Tt))), 128))
539
+ ], 8, Nt)) : S("", !0)
540
+ ]),
541
+ g.value ? (t(), a("p", Vt, [
542
+ H(b.$slots, "approvableStepInfo", {
543
+ step: n.value.focusStep
544
+ }, () => [
545
+ e("span", jt, c(g.value.approverName), 1)
546
+ ]),
547
+ H(b.$slots, "approvableStepRole", {
548
+ role: g.value.approverRole,
549
+ step: n.value.focusStep
550
+ }, () => [
551
+ g.value.approverRole ? (t(), a(L, { key: 0 }, [
552
+ s[3] || (s[3] = e("span", {
553
+ "aria-hidden": "true",
554
+ class: "approvable-compact-sep"
555
+ }, "·", -1)),
556
+ z(c(g.value.approverRole), 1)
557
+ ], 64)) : S("", !0)
558
+ ])
559
+ ])) : S("", !0)
560
+ ]),
561
+ e("div", Bt, [
562
+ n.value.hasActiveStep && n.value.focusStep ? (t(), P(ae, {
563
+ key: 0,
564
+ approvable: m.value.approvable,
565
+ resource: l.value,
566
+ value: n.value.focusStep,
567
+ onIsLoading: s[0] || (s[0] = (k) => f("isLoading", k)),
568
+ onRefresh: s[1] || (s[1] = (k) => f("refresh"))
569
+ }, null, 8, ["approvable", "resource", "value"])) : S("", !0),
570
+ e("button", {
571
+ type: "button",
572
+ class: "approvable-compact-toggle",
573
+ "aria-expanded": !1,
574
+ "aria-label": w(h).compactExpand,
575
+ title: w(h).compactExpand,
576
+ onClick: s[2] || (s[2] = (k) => f("expand"))
577
+ }, [...s[4] || (s[4] = [
578
+ e("svg", {
579
+ "aria-hidden": "true",
580
+ class: "approvable-icon",
581
+ fill: "none",
582
+ stroke: "currentColor",
583
+ "stroke-linecap": "round",
584
+ "stroke-linejoin": "round",
585
+ "stroke-width": "2",
586
+ viewBox: "0 0 16 16"
587
+ }, [
588
+ e("path", { d: "M4.5 6.4 8 9.9l3.5-3.5" })
589
+ ], -1)
590
+ ])], 8, Pt)
591
+ ])
592
+ ]));
593
+ }
594
+ }, qt = {
373
595
  key: 0,
374
596
  "aria-hidden": "true",
375
597
  fill: "none",
@@ -377,25 +599,19 @@ const gt = {
377
599
  "stroke-linecap": "round",
378
600
  "stroke-linejoin": "round",
379
601
  viewBox: "0 0 16 16"
380
- }, St = ["d", "stroke-width"], At = { class: "approvable-step-body" }, wt = { class: "approvable-step-line" }, $t = { class: "approvable-step-name" }, Ct = ["title"], Et = {
602
+ }, Kt = ["d", "stroke-width"], Ht = { class: "approvable-step-body" }, Ut = { class: "approvable-step-line" }, Ft = { class: "approvable-step-name" }, Gt = ["title"], zt = {
381
603
  key: 1,
382
604
  class: "approvable-step-spacer"
383
- }, Rt = {
605
+ }, Wt = {
384
606
  key: 0,
385
607
  class: "approvable-step-status"
386
- }, Dt = { key: 0 }, Lt = {
608
+ }, Qt = { key: 0 }, Yt = {
387
609
  key: 1,
388
610
  class: "approvable-step-date"
389
- }, xt = {
390
- key: 1,
391
- class: "approvable-step-actions"
392
- }, Ot = { class: "approvable-btn-group" }, Mt = ["title", "onClick"], It = ["title", "onClick"], Tt = {
393
- key: 0,
394
- class: "approvable-btn-group"
395
- }, Nt = {
611
+ }, Jt = {
396
612
  key: 0,
397
613
  class: "approvable-step-comment"
398
- }, Vt = ["title"], jt = ["aria-expanded"], ye = {
614
+ }, Xt = ["title"], Zt = ["aria-expanded"], Ae = {
399
615
  __name: "ApprovableStep",
400
616
  props: {
401
617
  value: {
@@ -412,323 +628,314 @@ const gt = {
412
628
  }
413
629
  },
414
630
  emits: ["isLoading", "refresh"],
415
- setup(o, { emit: b }) {
416
- const m = b, f = o, h = _t(), g = F(), _ = T(!1), n = w(() => Ne(f.value)), v = w(() => Ve(n.value.status)), L = w(() => n.value.buttons.length > 0 || !!f.value.can_comment), y = w(() => (!n.value.isActive || !L.value) && !!(n.value.statusName || n.value.performedAt)), x = w(() => ({
631
+ setup(l, { emit: y }) {
632
+ const u = y, f = l, h = F(), m = O(!1), n = _(() => fe(f.value)), g = _(() => Fe(n.value.status)), $ = _(() => n.value.buttons.length > 0 || !!f.value.can_comment), C = _(() => (!n.value.isActive || !$.value) && !!(n.value.statusName || n.value.performedAt)), v = _(() => ({
417
633
  "approvable-step": !0,
418
634
  "approvable-step--active": n.value.isActive,
419
635
  // A step nobody has reached yet is dimmed; one with an outcome is not.
420
- "approvable-step--pending": !n.value.isActive && !v.value,
421
- [`approvable-step--${v.value}`]: !!v.value,
636
+ "approvable-step--pending": !n.value.isActive && !g.value,
637
+ [`approvable-step--${g.value}`]: !!g.value,
422
638
  // Nothing wraps below the name, so the row can hold to a single line.
423
- "approvable-step--single-line": !L.value && !n.value.comment.text
424
- })), c = {
639
+ "approvable-step--single-line": !$.value && !n.value.comment.text
640
+ })), b = {
425
641
  check: { d: "M4 8.4l2.8 2.8 5.4-6", width: 2.8 },
426
642
  cross: { d: "M5.2 5.2l5.6 5.6M10.8 5.2l-5.6 5.6", width: 2.4 },
427
643
  dash: { d: "M4.4 8h7.2", width: 2.2 }
428
- }, $ = {
644
+ }, s = {
429
645
  check: "success",
430
646
  cross: "danger",
431
647
  dash: "muted",
432
648
  ring: "ring",
433
649
  pending: "pending"
434
- }, O = w(() => je(v.value, n.value.isActive)), V = w(() => c[O.value] ?? null), R = w(() => ({
650
+ }, k = _(() => Ge(g.value, n.value.isActive)), A = _(() => b[k.value] ?? null), N = _(() => ({
435
651
  "approvable-step-disc": !0,
436
- [`approvable-step-disc--${$[O.value]}`]: !0
437
- })), p = w(() => _.value ? n.value.comment.text : n.value.comment.preview), u = (I) => ({
438
- "approvable-btn": !0,
439
- // A button carrying only an icon collapses to a circle, so the row keeps its
440
- // rhythm instead of stretching around an empty label.
441
- "approvable-btn--icon": !I.text,
442
- "approvable-btn--primary": I.result === "approved"
443
- }), E = (I) => n.value.isActive ? Be(I == null ? void 0 : I.action_ui) : null, j = async (I) => {
444
- m("isLoading", !0);
445
- const M = await Pe({
446
- stepId: n.value.id,
447
- button: I,
448
- buttons: n.value.buttons
449
- });
450
- m("isLoading", !1), M.skipped || m("refresh");
451
- };
452
- return (I, M) => n.value.isVisible ? (t(), s("li", {
652
+ [`approvable-step-disc--${s[k.value]}`]: !0
653
+ })), I = _(() => m.value ? n.value.comment.text : n.value.comment.preview);
654
+ return (B, x) => n.value.isVisible ? (t(), a("li", {
453
655
  key: 0,
454
- class: B(x.value)
656
+ class: j(v.value)
455
657
  }, [
456
658
  e("span", {
457
- class: B(R.value)
659
+ class: j(N.value)
458
660
  }, [
459
- V.value ? (t(), s("svg", gt, [
661
+ A.value ? (t(), a("svg", qt, [
460
662
  e("path", {
461
- d: V.value.d,
462
- "stroke-width": V.value.width
463
- }, null, 8, St)
464
- ])) : k("", !0)
663
+ d: A.value.d,
664
+ "stroke-width": A.value.width
665
+ }, null, 8, Kt)
666
+ ])) : S("", !0)
465
667
  ], 2),
466
- e("div", At, [
467
- e("div", wt, [
468
- z(I.$slots, "approvableStepInfo", { step: o.value }, () => [
469
- e("span", $t, d(n.value.approverName), 1)
668
+ e("div", Ht, [
669
+ e("div", Ut, [
670
+ H(B.$slots, "approvableStepInfo", { step: l.value }, () => [
671
+ e("span", Ft, c(n.value.approverName), 1)
470
672
  ]),
471
- z(I.$slots, "approvableStepRole", {
472
- step: o.value,
673
+ H(B.$slots, "approvableStepRole", {
674
+ step: l.value,
473
675
  role: n.value.approverRole
474
676
  }, () => [
475
- n.value.approverRole ? (t(), s("span", {
677
+ n.value.approverRole ? (t(), a("span", {
476
678
  key: 0,
477
679
  title: n.value.approverRole,
478
680
  class: "approvable-step-role"
479
- }, d(n.value.approverRole), 9, Ct)) : (t(), s("span", Et))
681
+ }, c(n.value.approverRole), 9, Gt)) : (t(), a("span", zt))
480
682
  ]),
481
- y.value ? (t(), s("span", Rt, [
482
- n.value.statusName ? (t(), s("span", Dt, d(n.value.statusName), 1)) : k("", !0),
483
- n.value.performedAt ? (t(), s("time", Lt, d(n.value.performedAt), 1)) : k("", !0)
484
- ])) : k("", !0),
485
- L.value ? (t(), s("div", xt, [
486
- e("div", Ot, [
487
- (t(!0), s(D, null, P(n.value.buttons, (S, a) => (t(), s(D, {
488
- key: S.id ?? a
489
- }, [
490
- E(S) ? (t(), K(Y(E(S)), {
491
- key: 0,
492
- "action-ui": S.action_ui,
493
- approvable: o.approvable,
494
- button: S,
495
- buttons: [S],
496
- complete: j,
497
- resource: o.resource,
498
- step: o.value,
499
- onIsLoading: M[0] || (M[0] = (r) => m("isLoading", r)),
500
- onRefresh: M[1] || (M[1] = (r) => m("refresh"))
501
- }, null, 40, ["action-ui", "approvable", "button", "buttons", "resource", "step"])) : S.link ? (t(), K(Y(C(h)), Z({
502
- key: 1,
503
- ref_for: !0
504
- }, C(kt)(C(h), S.link)), {
505
- default: pe(() => [
506
- e("button", {
507
- title: S.tooltip,
508
- class: B(u(S)),
509
- type: "button",
510
- onClick: (r) => j(S)
511
- }, [
512
- U(J, {
513
- icon: S.icon
514
- }, null, 8, ["icon"])
515
- ], 10, Mt)
516
- ]),
517
- _: 2
518
- }, 1040)) : (t(), s("button", {
519
- key: 2,
520
- title: S.tooltip,
521
- class: B(u(S)),
522
- type: "button",
523
- onClick: (r) => j(S)
524
- }, [
525
- U(J, {
526
- icon: S.icon
527
- }, null, 8, ["icon"]),
528
- Q(" " + d(S.text), 1)
529
- ], 10, It))
530
- ], 64))), 128))
531
- ]),
532
- o.value.can_comment ? (t(), s("div", Tt, [
533
- U(fe, {
534
- "approvable-step": o.value,
535
- disabled: !o.value.can_comment,
536
- onRefresh: M[2] || (M[2] = (S) => m("refresh")),
537
- onIsLoading: M[3] || (M[3] = (S) => m("isLoading", S))
538
- }, null, 8, ["approvable-step", "disabled"])
539
- ])) : k("", !0)
540
- ])) : k("", !0)
683
+ C.value ? (t(), a("span", Wt, [
684
+ n.value.statusName ? (t(), a("span", Qt, c(n.value.statusName), 1)) : S("", !0),
685
+ n.value.performedAt ? (t(), a("time", Yt, c(n.value.performedAt), 1)) : S("", !0)
686
+ ])) : S("", !0),
687
+ U(ae, {
688
+ approvable: l.approvable,
689
+ resource: l.resource,
690
+ value: l.value,
691
+ onIsLoading: x[0] || (x[0] = (D) => u("isLoading", D)),
692
+ onRefresh: x[1] || (x[1] = (D) => u("refresh"))
693
+ }, null, 8, ["approvable", "resource", "value"])
541
694
  ]),
542
- n.value.comment.text ? (t(), s("p", Nt, [
695
+ n.value.comment.text ? (t(), a("p", Jt, [
543
696
  e("span", {
544
697
  title: n.value.comment.title
545
- }, d(p.value), 9, Vt),
546
- n.value.comment.isTrimmed ? (t(), s("button", {
698
+ }, c(I.value), 9, Xt),
699
+ n.value.comment.isTrimmed ? (t(), a("button", {
547
700
  key: 0,
548
701
  type: "button",
549
702
  class: "approvable-step-comment-more",
550
- "aria-expanded": _.value,
551
- onClick: M[4] || (M[4] = (S) => _.value = !_.value)
552
- }, d(_.value ? C(g).showLess : C(g).showMore), 9, jt)) : k("", !0)
553
- ])) : k("", !0)
703
+ "aria-expanded": m.value,
704
+ onClick: x[2] || (x[2] = (D) => m.value = !m.value)
705
+ }, c(m.value ? w(h).showLess : w(h).showMore), 9, Zt)) : S("", !0)
706
+ ])) : S("", !0)
554
707
  ])
555
- ], 2)) : k("", !0);
556
- }
557
- }, _e = {
558
- __name: "ApproveStatusInfo",
559
- props: {
560
- value: {
561
- required: !0
562
- },
563
- label: {
564
- default: null
565
- }
566
- },
567
- setup(o) {
568
- const b = o, m = w(() => {
569
- const h = N(b.value, "code", " - ");
570
- return {
571
- "approvable-badge": !0,
572
- "approvable-badge--draft": [q.CODES.CODE_DRAFT].includes(h),
573
- "approvable-badge--waiting": [q.CODES.CODE_WAITING].includes(h),
574
- "approvable-badge--success": [q.CODES.CODE_APPROVED, q.CODES.CODE_VIEWED, q.CODES.CODE_NOTICED].includes(h),
575
- "approvable-badge--danger": [q.CODES.CODE_REJECTED].includes(h),
576
- "approvable-badge--muted": [q.CODES.CODE_EXPIRED, q.CODES.CODE_SOLVED].includes(h),
577
- "approvable-badge--empty": h === " - "
578
- };
579
- }), f = w(() => b.label ? b.label : N(b.value, "name", " - "));
580
- return (h, g) => (t(), s("span", {
581
- class: B(m.value)
582
- }, d(f.value), 3));
708
+ ], 2)) : S("", !0);
583
709
  }
584
- }, Bt = {
585
- key: 0,
586
- class: "approvable"
587
- }, Pt = {
710
+ }, ea = {
588
711
  key: 0,
589
712
  class: "approvable-loading"
590
- }, qt = { class: "approvable-header" }, Kt = { class: "approvable-sr-only" }, Ut = { class: "approvable-updated-at" }, Ft = ["title", "aria-label"], Gt = {
713
+ }, ta = { class: "approvable-sr-only" }, aa = {
714
+ key: 0,
715
+ class: "approvable-compact"
716
+ }, sa = {
591
717
  class: "approvable-sr-only",
592
718
  "aria-live": "polite"
593
- }, Ht = {
594
- key: 1,
595
- class: "approvable-footer"
596
- }, zt = { class: "approvable-dialog-header" }, Qt = { class: "approvable-dialog-eyebrow" }, Wt = {
719
+ }, oa = { class: "approvable-header" }, la = { class: "approvable-sr-only" }, na = { class: "approvable-updated-at" }, ra = ["aria-expanded"], ia = ["title", "aria-label"], pa = ["aria-label", "title"], ua = {
720
+ class: "approvable-sr-only",
721
+ "aria-live": "polite"
722
+ }, va = { class: "approvable-dialog-header" }, da = { class: "approvable-dialog-eyebrow" }, ca = {
597
723
  id: "approvable-history-title",
598
724
  class: "approvable-dialog-title"
599
- }, Yt = ["aria-label"], Jt = { class: "approvable-dialog-body" }, Xt = {
725
+ }, ma = ["aria-label"], ba = { class: "approvable-dialog-body" }, fa = {
600
726
  __name: "Approvable",
601
727
  props: {
602
728
  value: {},
603
729
  showApprovableStatus: { type: Boolean, default: !0 },
730
+ /** Whether the History button — and so the audit dialog — is offered. */
731
+ isHistoryVisible: { type: Boolean, default: !0 },
604
732
  title: { default: "Approval" },
605
- isDirectionRow: { default: !1 }
733
+ isDirectionRow: { default: !1 },
734
+ /**
735
+ * How many steps stay on screen above and below the active one, with the
736
+ * rest folded behind a toggle. `null` shows the whole trail.
737
+ */
738
+ visibleStepRange: { type: Number, default: null },
739
+ /**
740
+ * Start collapsed: the status, a dot per step, and the active step's controls
741
+ * on one line. Supports `v-model:compact`, and the panel's own chevron drives
742
+ * it either way.
743
+ */
744
+ compact: { type: Boolean, default: !1 },
745
+ /**
746
+ * Whether the chevron that switches between the two forms is offered at all.
747
+ * `null` means "whenever the panel was asked for compact" — a caller that
748
+ * wants the control but the full trail first passes `true` explicitly.
749
+ */
750
+ collapsible: { type: Boolean, default: null }
606
751
  },
607
- emits: ["refresh", "isLoading"],
608
- setup(o, { emit: b }) {
609
- const m = o, f = b, h = T(!1), g = T(null), _ = T(!1), n = T(null), v = F(), L = [
752
+ emits: ["refresh", "isLoading", "update:compact"],
753
+ setup(l, { emit: y }) {
754
+ const u = l, f = y, h = O(!1), m = O(null), n = O(!1), g = O(null), $ = O(!1), C = O(u.compact), v = F(), b = [
610
755
  { name: "118px", meta: "56px", delay: "0s", metaDelay: "0.15s" },
611
756
  { name: "96px", meta: "72px", delay: "0.1s", metaDelay: "0.25s" },
612
757
  { name: "78px", meta: "48px", delay: "0.2s", metaDelay: "0.35s" }
613
- ], y = w(() => qe(m.value)), x = w(() => n.value === null ? v.historyTitle : H(v.eventCount, { count: n.value })), c = w(() => h.value && !y.value.steps.length), $ = w(() => ({
758
+ ];
759
+ Y(() => u.compact, (M) => C.value = M);
760
+ const s = (M) => {
761
+ C.value = M, f("update:compact", M);
762
+ }, k = _(() => u.collapsible ?? u.compact), A = _(() => he(u.value)), N = _(() => ze(A.value.steps, {
763
+ range: u.visibleStepRange,
764
+ isExpanded: $.value
765
+ })), I = _(() => g.value === null ? v.historyTitle : G(v.eventCount, { count: g.value })), B = _(() => h.value && !A.value.steps.length), x = _(() => ({
766
+ approvable: !0,
767
+ "approvable--compact": C.value
768
+ })), D = _(() => ({
614
769
  "approvable-steps": !0,
615
- "approvable-steps--row": m.isDirectionRow
616
- })), O = w(() => {
617
- const { activeStepNumber: R, visibleStepCount: p, activeApproverName: u } = y.value;
618
- if (!R || !p)
619
- return null;
620
- const E = H(v.stepProgress, {
621
- current: R,
622
- total: p
623
- });
624
- return u ? `${E} — ${H(v.awaitingApprover, { name: u })}` : E;
625
- }), V = () => {
626
- var R;
627
- (R = g.value) == null || R.refresh(), f("refresh");
770
+ "approvable-steps--row": u.isDirectionRow
771
+ })), q = () => {
772
+ var M;
773
+ (M = m.value) == null || M.refresh(), f("refresh");
628
774
  };
629
- return (R, p) => y.value.hasApprovable ? (t(), s("div", Bt, [
630
- h.value && y.value.steps.length ? (t(), s("div", Pt, [...p[6] || (p[6] = [
775
+ return (M, r) => A.value.hasApprovable ? (t(), a("div", {
776
+ key: 0,
777
+ class: j(x.value)
778
+ }, [
779
+ h.value && A.value.steps.length ? (t(), a("div", ea, [...r[10] || (r[10] = [
631
780
  e("span", { class: "approvable-spinner" }, null, -1)
632
- ])])) : k("", !0),
633
- e("div", qt, [
634
- e("h2", Kt, d(o.title), 1),
635
- c.value ? (t(), s(D, { key: 0 }, [
636
- p[7] || (p[7] = e("span", {
781
+ ])])) : S("", !0),
782
+ C.value ? (t(), a(L, { key: 1 }, [
783
+ e("h2", ta, c(l.title), 1),
784
+ B.value ? (t(), a("div", aa, [
785
+ e("span", sa, c(w(v).loadingStatus), 1),
786
+ r[11] || (r[11] = e("span", {
637
787
  "aria-hidden": "true",
638
788
  class: "approvable-skeleton-bar approvable-skeleton-bar--pill"
639
789
  }, null, -1)),
640
- p[8] || (p[8] = e("span", { class: "approvable-skeleton-spacer" }, null, -1)),
641
- p[9] || (p[9] = e("span", {
790
+ r[12] || (r[12] = e("span", {
642
791
  "aria-hidden": "true",
643
792
  class: "approvable-skeleton-bar approvable-skeleton-bar--soft",
644
- style: { width: "104px", "animation-delay": "0.2s" }
793
+ style: { width: "96px", "animation-delay": "0.15s" }
794
+ }, null, -1)),
795
+ r[13] || (r[13] = e("span", {
796
+ "aria-hidden": "true",
797
+ class: "approvable-skeleton-spacer"
798
+ }, null, -1)),
799
+ r[14] || (r[14] = e("span", {
800
+ "aria-hidden": "true",
801
+ class: "approvable-skeleton-disc",
802
+ style: { "animation-delay": "0.25s" }
645
803
  }, null, -1))
646
- ], 64)) : (t(), s(D, { key: 1 }, [
647
- o.showApprovableStatus ? (t(), K(_e, {
804
+ ])) : (t(), P($e, {
805
+ key: 1,
806
+ "show-approvable-status": l.showApprovableStatus,
807
+ value: l.value,
808
+ onExpand: r[0] || (r[0] = (R) => s(!1)),
809
+ onIsLoading: r[1] || (r[1] = (R) => h.value = R),
810
+ onRefresh: q
811
+ }, pe({ _: 2 }, [
812
+ T(Object.keys(M.$slots), (R) => ({
813
+ name: R,
814
+ fn: X((o) => [
815
+ H(M.$slots, R, Le(De(o ?? {})))
816
+ ])
817
+ }))
818
+ ]), 1032, ["show-approvable-status", "value"]))
819
+ ], 64)) : (t(), a(L, { key: 2 }, [
820
+ e("div", oa, [
821
+ e("h2", la, c(l.title), 1),
822
+ B.value ? (t(), a(L, { key: 0 }, [
823
+ r[15] || (r[15] = e("span", {
824
+ "aria-hidden": "true",
825
+ class: "approvable-skeleton-bar approvable-skeleton-bar--pill"
826
+ }, null, -1)),
827
+ r[16] || (r[16] = e("span", { class: "approvable-skeleton-spacer" }, null, -1)),
828
+ r[17] || (r[17] = e("span", {
829
+ "aria-hidden": "true",
830
+ class: "approvable-skeleton-bar approvable-skeleton-bar--soft",
831
+ style: { width: "104px", "animation-delay": "0.2s" }
832
+ }, null, -1))
833
+ ], 64)) : (t(), a(L, { key: 1 }, [
834
+ l.showApprovableStatus ? (t(), P(se, {
835
+ key: 0,
836
+ label: A.value.statusName,
837
+ value: A.value.status
838
+ }, null, 8, ["label", "value"])) : S("", !0),
839
+ e("span", na, c(A.value.updatedAt), 1),
840
+ N.value.isCollapsible ? (t(), a("button", {
841
+ key: 1,
842
+ type: "button",
843
+ class: "approvable-steps-toggle-btn",
844
+ "aria-expanded": $.value,
845
+ onClick: r[2] || (r[2] = (R) => $.value = !$.value)
846
+ }, c($.value ? w(v).stepsShowLess : w(G)(w(v).stepsShowMore, { count: N.value.totalCount })), 9, ra)) : S("", !0),
847
+ l.isHistoryVisible && A.value.id ? (t(), a("button", {
848
+ key: 2,
849
+ type: "button",
850
+ class: "approvable-history-btn",
851
+ title: w(v).historyTitle,
852
+ "aria-label": w(v).historyTitle,
853
+ onClick: r[3] || (r[3] = (R) => n.value = !0)
854
+ }, c(w(v).history), 9, ia)) : S("", !0),
855
+ k.value ? (t(), a("button", {
856
+ key: 3,
857
+ type: "button",
858
+ class: "approvable-compact-toggle approvable-compact-toggle--expanded",
859
+ "aria-expanded": !0,
860
+ "aria-label": w(v).compactCollapse,
861
+ title: w(v).compactCollapse,
862
+ onClick: r[4] || (r[4] = (R) => s(!0))
863
+ }, [...r[18] || (r[18] = [
864
+ e("svg", {
865
+ "aria-hidden": "true",
866
+ class: "approvable-icon",
867
+ fill: "none",
868
+ stroke: "currentColor",
869
+ "stroke-linecap": "round",
870
+ "stroke-linejoin": "round",
871
+ "stroke-width": "2",
872
+ viewBox: "0 0 16 16"
873
+ }, [
874
+ e("path", { d: "M4.5 6.4 8 9.9l3.5-3.5" })
875
+ ], -1)
876
+ ])], 8, pa)) : S("", !0)
877
+ ], 64))
878
+ ]),
879
+ B.value ? (t(), a(L, { key: 0 }, [
880
+ e("span", ua, c(w(v).loadingStatus), 1),
881
+ (t(), a(L, null, T(b, (R) => e("div", {
882
+ key: R.delay,
883
+ "aria-hidden": "true",
884
+ class: "approvable-skeleton-row"
885
+ }, [
886
+ e("span", {
887
+ class: "approvable-skeleton-disc",
888
+ style: Q({ animationDelay: R.delay })
889
+ }, null, 4),
890
+ e("span", {
891
+ class: "approvable-skeleton-bar",
892
+ style: Q({ width: R.name, animationDelay: R.delay })
893
+ }, null, 4),
894
+ r[19] || (r[19] = e("span", { class: "approvable-skeleton-spacer" }, null, -1)),
895
+ e("span", {
896
+ class: "approvable-skeleton-bar approvable-skeleton-bar--soft",
897
+ style: Q({ width: R.meta, animationDelay: R.metaDelay })
898
+ }, null, 4)
899
+ ])), 64))
900
+ ], 64)) : (t(), a(L, { key: 1 }, [
901
+ N.value.steps.length ? (t(), a("ol", {
648
902
  key: 0,
649
- label: y.value.statusName,
650
- value: y.value.status
651
- }, null, 8, ["label", "value"])) : k("", !0),
652
- e("span", Ut, d(y.value.updatedAt), 1),
653
- y.value.id ? (t(), s("button", {
654
- key: 1,
655
- type: "button",
656
- class: "approvable-history-btn",
657
- title: C(v).historyTitle,
658
- "aria-label": C(v).historyTitle,
659
- onClick: p[0] || (p[0] = (u) => _.value = !0)
660
- }, d(C(v).history), 9, Ft)) : k("", !0)
903
+ class: j(D.value)
904
+ }, [
905
+ (t(!0), a(L, null, T(N.value.steps, (R) => (t(), P(Ae, {
906
+ key: R.id,
907
+ approvable: A.value.approvable,
908
+ resource: l.value,
909
+ value: R,
910
+ onIsLoading: r[5] || (r[5] = (o) => h.value = o),
911
+ onRefresh: q
912
+ }, pe({ _: 2 }, [
913
+ T(Object.keys(M.$slots), (o) => ({
914
+ name: o,
915
+ fn: X((p) => [
916
+ H(M.$slots, o, te({ ref_for: !0 }, p ?? {}))
917
+ ])
918
+ }))
919
+ ]), 1032, ["approvable", "resource", "value"]))), 128))
920
+ ], 2)) : S("", !0)
661
921
  ], 64))
662
- ]),
663
- c.value ? (t(), s(D, { key: 1 }, [
664
- e("span", Gt, d(C(v).loadingStatus), 1),
665
- (t(), s(D, null, P(L, (u) => e("div", {
666
- key: u.delay,
667
- "aria-hidden": "true",
668
- class: "approvable-skeleton-row"
669
- }, [
670
- e("span", {
671
- class: "approvable-skeleton-disc",
672
- style: W({ animationDelay: u.delay })
673
- }, null, 4),
674
- e("span", {
675
- class: "approvable-skeleton-bar",
676
- style: W({ width: u.name, animationDelay: u.delay })
677
- }, null, 4),
678
- p[10] || (p[10] = e("span", { class: "approvable-skeleton-spacer" }, null, -1)),
679
- e("span", {
680
- class: "approvable-skeleton-bar approvable-skeleton-bar--soft",
681
- style: W({ width: u.meta, animationDelay: u.metaDelay })
682
- }, null, 4)
683
- ])), 64)),
684
- p[11] || (p[11] = e("div", {
685
- class: "approvable-footer",
686
- "aria-hidden": "true"
687
- }, [
688
- e("span", {
689
- class: "approvable-skeleton-bar approvable-skeleton-bar--soft",
690
- style: { display: "block", width: "132px" }
691
- })
692
- ], -1))
693
- ], 64)) : (t(), s(D, { key: 2 }, [
694
- y.value.steps.length ? (t(), s("ol", {
695
- key: 0,
696
- class: B($.value)
697
- }, [
698
- (t(!0), s(D, null, P(y.value.steps, (u) => (t(), K(ye, {
699
- key: u.id,
700
- approvable: y.value.approvable,
701
- resource: o.value,
702
- value: u,
703
- onIsLoading: p[1] || (p[1] = (E) => h.value = E),
704
- onRefresh: V
705
- }, $e({ _: 2 }, [
706
- P(Object.keys(R.$slots), (E) => ({
707
- name: E,
708
- fn: pe((j) => [
709
- z(R.$slots, E, Z({ ref_for: !0 }, j ?? {}))
710
- ])
711
- }))
712
- ]), 1032, ["approvable", "resource", "value"]))), 128))
713
- ], 2)) : k("", !0),
714
- O.value ? (t(), s("p", Ht, d(O.value), 1)) : k("", !0)
715
922
  ], 64)),
716
- (t(), K(Ce, { to: "body" }, [
717
- _.value ? (t(), s("div", {
923
+ (t(), P(Oe, { to: "body" }, [
924
+ n.value ? (t(), a("div", {
718
925
  key: 0,
719
926
  class: "approvable-dialog-backdrop",
720
- onClick: p[5] || (p[5] = Ee((u) => _.value = !1, ["self"]))
927
+ onClick: r[9] || (r[9] = Me((R) => n.value = !1, ["self"]))
721
928
  }, [
722
929
  e("section", {
723
930
  role: "dialog",
724
931
  "aria-modal": "true",
725
932
  "aria-labelledby": "approvable-history-title",
726
933
  class: "approvable-dialog",
727
- onKeydown: p[4] || (p[4] = Re((u) => _.value = !1, ["esc"]))
934
+ onKeydown: r[8] || (r[8] = Ie((R) => n.value = !1, ["esc"]))
728
935
  }, [
729
- e("header", zt, [
730
- e("p", Qt, [
731
- p[12] || (p[12] = e("svg", {
936
+ e("header", va, [
937
+ e("p", da, [
938
+ r[20] || (r[20] = e("svg", {
732
939
  "aria-hidden": "true",
733
940
  fill: "none",
734
941
  stroke: "currentColor",
@@ -739,15 +946,15 @@ const gt = {
739
946
  }, [
740
947
  e("path", { d: "M9.6 4.5 6 8l3.6 3.5" })
741
948
  ], -1)),
742
- Q(" " + d(C(v).history), 1)
949
+ z(" " + c(w(v).history), 1)
743
950
  ]),
744
- e("h2", Wt, d(x.value), 1),
951
+ e("h2", ca, c(I.value), 1),
745
952
  e("button", {
746
953
  type: "button",
747
954
  class: "approvable-dialog-close",
748
- "aria-label": C(v).historyClose,
749
- onClick: p[2] || (p[2] = (u) => _.value = !1)
750
- }, [...p[13] || (p[13] = [
955
+ "aria-label": w(v).historyClose,
956
+ onClick: r[6] || (r[6] = (R) => n.value = !1)
957
+ }, [...r[21] || (r[21] = [
751
958
  e("svg", {
752
959
  "aria-hidden": "true",
753
960
  class: "approvable-icon",
@@ -759,26 +966,26 @@ const gt = {
759
966
  }, [
760
967
  e("path", { d: "m5.2 5.2 5.6 5.6M10.8 5.2l-5.6 5.6" })
761
968
  ], -1)
762
- ])], 8, Yt)
969
+ ])], 8, ma)
763
970
  ]),
764
- e("div", Jt, [
765
- U(me, {
971
+ e("div", ba, [
972
+ U(ke, {
766
973
  ref_key: "auditTimeline",
767
- ref: g,
768
- "approvable-id": y.value.id,
974
+ ref: m,
975
+ "approvable-id": A.value.id,
769
976
  "show-header": !1,
770
- onLoaded: p[3] || (p[3] = (u) => n.value = u)
977
+ onLoaded: r[7] || (r[7] = (R) => g.value = R)
771
978
  }, null, 8, ["approvable-id"])
772
979
  ])
773
980
  ], 32)
774
- ])) : k("", !0)
981
+ ])) : S("", !0)
775
982
  ]))
776
- ])) : k("", !0);
983
+ ], 2)) : S("", !0);
777
984
  }
778
- }, Zt = {
985
+ }, ha = {
779
986
  key: 0,
780
987
  class: "approvable-actions"
781
- }, ea = { class: "approvable-actions-list" }, ta = ["title", "onClick"], aa = {
988
+ }, ya = { class: "approvable-actions-list" }, ka = ["title", "onClick"], ga = {
782
989
  __name: "ApprovableButtons",
783
990
  props: {
784
991
  value: {
@@ -786,43 +993,43 @@ const gt = {
786
993
  }
787
994
  },
788
995
  emits: ["isLoading", "refresh"],
789
- setup(o, { emit: b }) {
790
- const m = o, f = b, h = T(!1), g = w(() => N(m.value, "buttons", [])), _ = w(() => g.value ? g.value.length > 0 : !1), n = F(), v = (y) => {
791
- let x = N(m.value, "id");
792
- x && L(x, y);
793
- }, L = async (y, x) => {
996
+ setup(l, { emit: y }) {
997
+ const u = l, f = y, h = O(!1), m = _(() => V(u.value, "buttons", [])), n = _(() => m.value ? m.value.length > 0 : !1), g = F(), $ = (v) => {
998
+ let b = V(u.value, "id");
999
+ b && C(b, v);
1000
+ }, C = async (v, b) => {
794
1001
  f("isLoading", !0), h.value = !0;
795
- const c = await new ue().updateApproveStatus(y, x);
796
- de(c) && ce(n.actionSucceeded), f("isLoading", !1), f("refresh");
1002
+ const s = await new ce().updateApproveStatus(v, b);
1003
+ me(s) && be(g.actionSucceeded), f("isLoading", !1), f("refresh");
797
1004
  };
798
- return (y, x) => _.value ? (t(), s("div", Zt, [
799
- x[0] || (x[0] = e("hr", { class: "approvable-divider" }, null, -1)),
800
- e("div", ea, [
801
- (t(!0), s(D, null, P(g.value, (c) => (t(), s("button", {
802
- key: c.code,
803
- title: c.tooltip,
1005
+ return (v, b) => n.value ? (t(), a("div", ha, [
1006
+ b[0] || (b[0] = e("hr", { class: "approvable-divider" }, null, -1)),
1007
+ e("div", ya, [
1008
+ (t(!0), a(L, null, T(m.value, (s) => (t(), a("button", {
1009
+ key: s.code,
1010
+ title: s.tooltip,
804
1011
  class: "approvable-btn",
805
1012
  type: "button",
806
- onClick: ($) => v(c)
1013
+ onClick: (k) => $(s)
807
1014
  }, [
808
- z(y.$slots, "icon", { button: c }, () => [
809
- U(J, {
810
- icon: c.icon
1015
+ H(v.$slots, "icon", { button: s }, () => [
1016
+ U(Z, {
1017
+ icon: s.icon
811
1018
  }, null, 8, ["icon"])
812
1019
  ]),
813
- Q(" " + d(c.text), 1)
814
- ], 8, ta))), 128))
1020
+ z(" " + c(s.text), 1)
1021
+ ], 8, ka))), 128))
815
1022
  ])
816
- ])) : k("", !0);
1023
+ ])) : S("", !0);
817
1024
  }
818
- }, sa = { class: "approvable-select" }, oa = {
1025
+ }, _a = { class: "approvable-select" }, Sa = {
819
1026
  key: 0,
820
1027
  class: "approvable-select-label"
821
- }, la = ["value"], na = ["value"], ra = /* @__PURE__ */ Object.assign({
1028
+ }, $a = ["value"], Aa = ["value"], wa = /* @__PURE__ */ Object.assign({
822
1029
  inheritAttrs: !1
823
1030
  }, {
824
1031
  __name: "ApprovableStatusSelect",
825
- props: /* @__PURE__ */ ne({
1032
+ props: /* @__PURE__ */ ue({
826
1033
  getList: {},
827
1034
  label: {
828
1035
  default: "Status"
@@ -831,90 +1038,94 @@ const gt = {
831
1038
  modelValue: {},
832
1039
  modelModifiers: {}
833
1040
  }),
834
- emits: /* @__PURE__ */ ne(["mounted"], ["update:modelValue"]),
835
- setup(o, { emit: b }) {
836
- const m = b, f = De(o, "modelValue"), h = o, g = T([]), _ = async (c) => {
837
- let $ = [{ field: "search", value: c }];
838
- return await new Ke().fetchAll({ filters: $ });
839
- }, n = (c) => String(N(c, "id") ?? N(c, "code", "")), v = (c) => N(c, "name") ?? N(c, "text", ""), L = w(() => f.value ? n(f.value) : ""), y = (c) => {
840
- const $ = c.target.value;
841
- f.value = g.value.find((O) => n(O) === $) ?? null;
842
- }, x = async (c = null) => {
843
- const $ = await (h.getList ?? _)(c);
844
- g.value = Array.isArray($) ? $ : [];
1041
+ emits: /* @__PURE__ */ ue(["mounted"], ["update:modelValue"]),
1042
+ setup(l, { emit: y }) {
1043
+ const u = y, f = Ne(l, "modelValue"), h = l, m = O([]), n = async (s) => {
1044
+ let k = [{ field: "search", value: s }];
1045
+ return await new We().fetchAll({ filters: k });
1046
+ }, g = (s) => String(V(s, "id") ?? V(s, "code", "")), $ = (s) => V(s, "name") ?? V(s, "text", ""), C = _(() => f.value ? g(f.value) : ""), v = (s) => {
1047
+ const k = s.target.value;
1048
+ f.value = m.value.find((A) => g(A) === k) ?? null;
1049
+ }, b = async (s = null) => {
1050
+ const k = await (h.getList ?? n)(s);
1051
+ m.value = Array.isArray(k) ? k : [];
845
1052
  };
846
- return ie(async () => {
847
- await x(), m("mounted", { refresh: x, options: g });
848
- }), (c, $) => (t(), s("label", sa, [
849
- o.label ? (t(), s("span", oa, d(o.label), 1)) : k("", !0),
850
- e("select", Z({
851
- value: L.value,
1053
+ return de(async () => {
1054
+ await b(), u("mounted", { refresh: b, options: m });
1055
+ }), (s, k) => (t(), a("label", _a, [
1056
+ l.label ? (t(), a("span", Sa, c(l.label), 1)) : S("", !0),
1057
+ e("select", te({
1058
+ value: C.value,
852
1059
  class: "approvable-select-input"
853
- }, c.$attrs, { onChange: y }), [
854
- $[0] || ($[0] = e("option", { value: "" }, "-", -1)),
855
- (t(!0), s(D, null, P(g.value, (O) => (t(), s("option", {
856
- key: n(O),
857
- value: n(O)
858
- }, d(v(O)), 9, na))), 128))
859
- ], 16, la)
1060
+ }, s.$attrs, { onChange: v }), [
1061
+ k[0] || (k[0] = e("option", { value: "" }, "-", -1)),
1062
+ (t(!0), a(L, null, T(m.value, (A) => (t(), a("option", {
1063
+ key: g(A),
1064
+ value: g(A)
1065
+ }, c($(A)), 9, Aa))), 128))
1066
+ ], 16, $a)
860
1067
  ]));
861
1068
  }
862
- }), ia = { class: "approvable-select-option" }, pa = {
1069
+ }), Ca = { class: "approvable-select-option" }, Ra = {
863
1070
  __name: "ApprovableStatusSelectOption",
864
1071
  props: {
865
1072
  value: {}
866
1073
  },
867
- setup(o) {
868
- const b = o, m = w(() => N(b.value, "name"));
869
- return (f, h) => (t(), s("div", ia, [
870
- e("span", null, d(m.value), 1)
1074
+ setup(l) {
1075
+ const y = l, u = _(() => V(y.value, "name"));
1076
+ return (f, h) => (t(), a("div", Ca, [
1077
+ e("span", null, c(u.value), 1)
871
1078
  ]));
872
1079
  }
873
- }, ua = {
874
- Approvable: Xt,
875
- ApprovableStep: ye,
876
- ApprovableButtons: aa,
877
- ApprovableStepComment: fe,
878
- ApprovableAuditTimeline: me,
879
- ApproveStatusInfo: _e,
880
- ApprovableStatusSelect: ra,
881
- ApprovableStatusSelectOption: pa
882
- }, ma = {
883
- install(o, { linkComponent: b = null, icons: m = null, messages: f = null, register: h = !0 } = {}) {
884
- if (b && o.provide(he, b), m && o.provide(be, m), f && o.provide(ve, f), h)
885
- for (const [g, _] of Object.entries(ua))
886
- o.component(g, _);
1080
+ }, xa = {
1081
+ Approvable: fa,
1082
+ ApprovableCompact: $e,
1083
+ ApprovableStep: Ae,
1084
+ ApprovableStepActions: ae,
1085
+ ApprovableButtons: ga,
1086
+ ApprovableStepComment: _e,
1087
+ ApprovableAuditTimeline: ke,
1088
+ ApproveStatusInfo: se,
1089
+ ApprovableStatusSelect: wa,
1090
+ ApprovableStatusSelectOption: Ra
1091
+ }, Oa = {
1092
+ install(l, { linkComponent: y = null, icons: u = null, messages: f = null, register: h = !0 } = {}) {
1093
+ if (y && l.provide(Se, y), u && l.provide(ge, u), f && l.provide(ye, f), h)
1094
+ for (const [m, n] of Object.entries(xa))
1095
+ l.component(m, n);
887
1096
  }
888
1097
  };
889
1098
  export {
890
- be as APPROVABLE_ICON_REGISTRY,
891
- he as APPROVABLE_LINK_COMPONENT,
892
- ve as APPROVABLE_MESSAGES,
893
- Xt as Approvable,
894
- me as ApprovableAuditTimeline,
895
- aa as ApprovableButtons,
896
- ha as ApprovableClient,
897
- ra as ApprovableStatusSelect,
898
- pa as ApprovableStatusSelectOption,
899
- ye as ApprovableStep,
900
- fe as ApprovableStepComment,
901
- _e as ApproveStatusInfo,
902
- ya as approvableActionRenderer,
903
- _a as approvableActionSlotName,
904
- ka as axiosAdapter,
905
- ga as configureApprovableClient,
906
- ma as default,
907
- Sa as fetchAdapter,
908
- Aa as getApprovableClient,
909
- wa as isClassIcon,
910
- $a as isRegisteredIcon,
911
- Ca as isUrlIcon,
912
- kt as linkProps,
913
- va as registerApprovableActionRenderer,
914
- Ea as setApprovableClient,
915
- Ra as unregisterApprovableActionRenderer,
916
- ut as useIconRegistry,
917
- _t as useLinkComponent,
1099
+ ge as APPROVABLE_ICON_REGISTRY,
1100
+ Se as APPROVABLE_LINK_COMPONENT,
1101
+ ye as APPROVABLE_MESSAGES,
1102
+ fa as Approvable,
1103
+ ke as ApprovableAuditTimeline,
1104
+ ga as ApprovableButtons,
1105
+ Na as ApprovableClient,
1106
+ $e as ApprovableCompact,
1107
+ wa as ApprovableStatusSelect,
1108
+ Ra as ApprovableStatusSelectOption,
1109
+ Ae as ApprovableStep,
1110
+ ae as ApprovableStepActions,
1111
+ _e as ApprovableStepComment,
1112
+ se as ApproveStatusInfo,
1113
+ Ta as approvableActionRenderer,
1114
+ Va as approvableActionSlotName,
1115
+ ja as axiosAdapter,
1116
+ Ba as configureApprovableClient,
1117
+ Oa as default,
1118
+ Pa as fetchAdapter,
1119
+ qa as getApprovableClient,
1120
+ Ka as isClassIcon,
1121
+ Ha as isRegisteredIcon,
1122
+ Ua as isUrlIcon,
1123
+ Ct as linkProps,
1124
+ Da as registerApprovableActionRenderer,
1125
+ Fa as setApprovableClient,
1126
+ Ga as unregisterApprovableActionRenderer,
1127
+ ft as useIconRegistry,
1128
+ wt as useLinkComponent,
918
1129
  F as useMessages
919
1130
  };
920
1131
  //# sourceMappingURL=approvable-vue.mjs.map