@stsdti/approvable-vue 0.1.4 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/approvable-vue.mjs
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { inject as
|
|
2
|
-
import { mergeMessages as Le, ApprovableAuditRepository as xe, formatMessage as
|
|
3
|
-
import { ApprovableClient as
|
|
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
4
|
const ve = Symbol("approvable.messages");
|
|
5
|
-
function
|
|
6
|
-
return Le(
|
|
5
|
+
function F() {
|
|
6
|
+
return Le(X(ve, null));
|
|
7
7
|
}
|
|
8
|
-
const
|
|
8
|
+
const Ue = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "approvable-timeline-header"
|
|
11
|
-
},
|
|
11
|
+
}, Fe = { class: "approvable-timeline-eyebrow" }, Ge = { class: "approvable-timeline-title" }, He = ["disabled"], ze = {
|
|
12
12
|
key: 1,
|
|
13
13
|
class: "approvable-timeline-state",
|
|
14
14
|
role: "status"
|
|
15
|
-
},
|
|
15
|
+
}, Qe = {
|
|
16
16
|
key: 2,
|
|
17
17
|
class: "approvable-timeline-error"
|
|
18
|
-
},
|
|
18
|
+
}, We = {
|
|
19
19
|
key: 3,
|
|
20
20
|
class: "approvable-timeline-state"
|
|
21
|
-
},
|
|
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 = {
|
|
22
22
|
key: 0,
|
|
23
23
|
class: "approvable-timeline-comment"
|
|
24
|
-
},
|
|
24
|
+
}, lt = {
|
|
25
25
|
key: 1,
|
|
26
26
|
class: "approvable-timeline-change"
|
|
27
|
-
},
|
|
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 = {
|
|
28
28
|
__name: "ApprovableAuditTimeline",
|
|
29
29
|
props: {
|
|
30
30
|
approvableId: { type: [Number, String], required: !0 },
|
|
@@ -32,13 +32,13 @@ const Ke = {
|
|
|
32
32
|
showHeader: { type: Boolean, default: !0 }
|
|
33
33
|
},
|
|
34
34
|
emits: ["loaded"],
|
|
35
|
-
setup(
|
|
36
|
-
const f =
|
|
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 = {
|
|
37
37
|
approvable_status_name: "Status",
|
|
38
38
|
comment: "Comment",
|
|
39
39
|
responsible: "Assigned to",
|
|
40
40
|
is_active: "Active step"
|
|
41
|
-
},
|
|
41
|
+
}, x = {
|
|
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,129 +47,129 @@ const Ke = {
|
|
|
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
|
-
},
|
|
51
|
-
const
|
|
52
|
-
for (const l of
|
|
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
53
|
const i = l.request_id || `audit-${l.id}`;
|
|
54
|
-
|
|
54
|
+
r.has(i) || r.set(i, []), r.get(i).push(l);
|
|
55
55
|
}
|
|
56
|
-
return [...
|
|
57
|
-
const i = l[0],
|
|
56
|
+
return [...r.values()].map((l) => {
|
|
57
|
+
const i = l[0], A = O(i), G = l.flatMap(u);
|
|
58
58
|
return {
|
|
59
59
|
id: i.request_id || `audit-${i.id}`,
|
|
60
60
|
entries: l,
|
|
61
61
|
audit: i,
|
|
62
|
-
kind:
|
|
62
|
+
kind: A,
|
|
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--${
|
|
67
|
-
icon:
|
|
68
|
-
isQuiet:
|
|
69
|
-
isSingleLine:
|
|
66
|
+
kindClass: `approvable-timeline-marker--${A}`,
|
|
67
|
+
icon: x[A],
|
|
68
|
+
isQuiet: c.has(A),
|
|
69
|
+
isSingleLine: G.length === 0
|
|
70
70
|
};
|
|
71
71
|
}).sort((l, i) => new Date(i.audit.created_at) - new Date(l.audit.created_at));
|
|
72
72
|
});
|
|
73
|
-
function
|
|
74
|
-
var l, i,
|
|
75
|
-
const
|
|
76
|
-
return
|
|
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";
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
var i,
|
|
80
|
-
const
|
|
81
|
-
return l !== void 0 &&
|
|
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;
|
|
82
82
|
}
|
|
83
|
-
function R(
|
|
84
|
-
var i,
|
|
85
|
-
const
|
|
86
|
-
if (
|
|
87
|
-
const
|
|
88
|
-
return
|
|
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;
|
|
89
89
|
}
|
|
90
|
-
if (((
|
|
91
|
-
if (((
|
|
92
|
-
if (
|
|
93
|
-
const l = (
|
|
94
|
-
return
|
|
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";
|
|
95
95
|
}
|
|
96
|
-
function p(
|
|
97
|
-
return
|
|
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";
|
|
98
98
|
}
|
|
99
|
-
function u(
|
|
100
|
-
const
|
|
101
|
-
return Object.keys(
|
|
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);
|
|
102
102
|
}
|
|
103
|
-
function E(
|
|
104
|
-
return
|
|
103
|
+
function E(a) {
|
|
104
|
+
return a.oldValue !== void 0 && a.oldValue !== null && a.oldValue !== "";
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
if (
|
|
108
|
-
if (typeof
|
|
109
|
-
if (Array.isArray(
|
|
110
|
-
const
|
|
111
|
-
return
|
|
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;
|
|
112
112
|
}
|
|
113
|
-
function I(
|
|
114
|
-
if (!
|
|
115
|
-
const
|
|
116
|
-
return Number.isNaN(
|
|
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, {
|
|
117
117
|
dateStyle: "medium",
|
|
118
118
|
timeStyle: "short"
|
|
119
|
-
}).format(
|
|
119
|
+
}).format(r);
|
|
120
120
|
}
|
|
121
121
|
async function M() {
|
|
122
|
-
var
|
|
122
|
+
var a, r;
|
|
123
123
|
if (!f.approvableId) {
|
|
124
|
-
|
|
124
|
+
n.value = [], v.value = !1, L.value = "The approval history is unavailable because the approvable has no id.";
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
|
-
|
|
127
|
+
v.value = !0, L.value = "";
|
|
128
128
|
try {
|
|
129
|
-
const l = await
|
|
129
|
+
const l = await _.fetchTimeline(f.approvableId, f.limit);
|
|
130
130
|
if (!l || l.status < 200 || l.status >= 300)
|
|
131
|
-
throw new Error(((
|
|
132
|
-
const i = Array.isArray(l.data) ? l.data : (
|
|
133
|
-
|
|
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
134
|
} catch (l) {
|
|
135
135
|
L.value = (l == null ? void 0 : l.message) || "The audit timeline could not be loaded.";
|
|
136
136
|
} finally {
|
|
137
|
-
|
|
137
|
+
v.value = !1;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
const
|
|
141
|
-
return
|
|
142
|
-
class:
|
|
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"])
|
|
143
143
|
}, [
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
o.showHeader ? (t(), s("div", Ue, [
|
|
145
|
+
e("p", Fe, d(C(g).history), 1),
|
|
146
|
+
e("h3", Ge, d(S.value), 1),
|
|
147
|
+
e("button", {
|
|
148
148
|
type: "button",
|
|
149
149
|
class: "approvable-timeline-refresh",
|
|
150
|
-
disabled:
|
|
150
|
+
disabled: v.value,
|
|
151
151
|
onClick: M
|
|
152
|
-
},
|
|
153
|
-
])) :
|
|
154
|
-
|
|
155
|
-
|
|
152
|
+
}, d(v.value ? "Loading…" : "Refresh"), 9, He)
|
|
153
|
+
])) : k("", !0),
|
|
154
|
+
v.value ? (t(), s("div", ze, [...r[0] || (r[0] = [
|
|
155
|
+
e("span", {
|
|
156
156
|
class: "approvable-spinner",
|
|
157
157
|
"aria-hidden": "true"
|
|
158
158
|
}, null, -1),
|
|
159
|
-
|
|
160
|
-
])])) : L.value ? (
|
|
161
|
-
|
|
162
|
-
(
|
|
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
163
|
key: l.id,
|
|
164
|
-
class:
|
|
164
|
+
class: B(["approvable-timeline-item", {
|
|
165
165
|
"approvable-timeline-item--single-line": l.isSingleLine,
|
|
166
166
|
"approvable-timeline-item--quiet": l.isQuiet
|
|
167
167
|
}])
|
|
168
168
|
}, [
|
|
169
|
-
|
|
170
|
-
class:
|
|
169
|
+
e("span", {
|
|
170
|
+
class: B(["approvable-timeline-marker", l.kindClass])
|
|
171
171
|
}, [
|
|
172
|
-
(
|
|
172
|
+
(t(), s("svg", {
|
|
173
173
|
fill: "none",
|
|
174
174
|
stroke: "currentColor",
|
|
175
175
|
"stroke-width": l.icon.width,
|
|
@@ -178,51 +178,78 @@ const Ke = {
|
|
|
178
178
|
viewBox: "0 0 16 16",
|
|
179
179
|
"aria-hidden": "true"
|
|
180
180
|
}, [
|
|
181
|
-
(
|
|
182
|
-
key:
|
|
181
|
+
(t(!0), s(D, null, P(l.icon.paths, (i, A) => (t(), s("path", {
|
|
182
|
+
key: A,
|
|
183
183
|
d: i
|
|
184
|
-
}, null, 8,
|
|
185
|
-
], 8,
|
|
184
|
+
}, null, 8, Xe))), 128))
|
|
185
|
+
], 8, Je))
|
|
186
186
|
], 2),
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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)
|
|
192
192
|
]),
|
|
193
|
-
(
|
|
193
|
+
(t(!0), s(D, null, P(l.entries, (i) => (t(), s(D, {
|
|
194
194
|
key: i.id
|
|
195
195
|
}, [
|
|
196
|
-
(
|
|
197
|
-
key: `${i.id}-${
|
|
196
|
+
(t(!0), s(D, null, P(u(i), (A) => (t(), s(D, {
|
|
197
|
+
key: `${i.id}-${A.key}`
|
|
198
198
|
}, [
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
E(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
], 64)) :
|
|
205
|
-
|
|
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)
|
|
206
206
|
]))
|
|
207
207
|
], 64))), 128))
|
|
208
208
|
], 64))), 128))
|
|
209
209
|
])
|
|
210
210
|
], 2))), 128))
|
|
211
211
|
]),
|
|
212
|
-
|
|
213
|
-
], 64)) : (
|
|
212
|
+
e("p", pt, d(C(g).allEventsShown), 1)
|
|
213
|
+
], 64)) : (t(), s("p", We, "No approval activity yet."))
|
|
214
214
|
], 2));
|
|
215
215
|
}
|
|
216
|
-
},
|
|
216
|
+
}, be = Symbol("approvable.iconRegistry");
|
|
217
|
+
function ut() {
|
|
218
|
+
return X(be, {});
|
|
219
|
+
}
|
|
220
|
+
const dt = ["src"], J = {
|
|
221
|
+
__name: "ApprovableIcon",
|
|
222
|
+
props: {
|
|
223
|
+
icon: {
|
|
224
|
+
type: String,
|
|
225
|
+
default: ""
|
|
226
|
+
}
|
|
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]), {
|
|
231
|
+
key: 0,
|
|
232
|
+
class: "approvable-btn-icon"
|
|
233
|
+
})) : C(Me)(o.icon) ? (t(), s("img", {
|
|
234
|
+
key: 1,
|
|
235
|
+
src: o.icon,
|
|
236
|
+
alt: "",
|
|
237
|
+
class: "approvable-btn-icon"
|
|
238
|
+
}, null, 8, dt)) : C(Ie)(o.icon) ? (t(), s("i", {
|
|
239
|
+
key: 2,
|
|
240
|
+
class: B(o.icon)
|
|
241
|
+
}, null, 2)) : k("", !0);
|
|
242
|
+
}
|
|
243
|
+
}, ct = ["title"], vt = {
|
|
217
244
|
key: 0,
|
|
218
245
|
class: "approvable-popover-panel"
|
|
219
|
-
},
|
|
246
|
+
}, mt = {
|
|
220
247
|
key: 0,
|
|
221
248
|
class: "approvable-loading"
|
|
222
|
-
},
|
|
249
|
+
}, bt = { class: "approvable-popover-title" }, ft = {
|
|
223
250
|
key: 1,
|
|
224
251
|
class: "approvable-popover-meta"
|
|
225
|
-
},
|
|
252
|
+
}, ht = { class: "approvable-popover-author" }, yt = { class: "approvable-popover-actions" }, fe = {
|
|
226
253
|
__name: "ApprovableStepComment",
|
|
227
254
|
props: {
|
|
228
255
|
approvableStep: {
|
|
@@ -234,56 +261,56 @@ const Ke = {
|
|
|
234
261
|
}
|
|
235
262
|
},
|
|
236
263
|
emits: ["isLoading", "refresh"],
|
|
237
|
-
setup(
|
|
238
|
-
const
|
|
239
|
-
function
|
|
240
|
-
|
|
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();
|
|
241
268
|
}
|
|
242
|
-
function
|
|
243
|
-
|
|
269
|
+
function x() {
|
|
270
|
+
v.value = N(m.approvableStep, "comment"), _.value = !0, Ae($);
|
|
244
271
|
}
|
|
245
|
-
function
|
|
246
|
-
|
|
272
|
+
function c() {
|
|
273
|
+
_.value = !1;
|
|
247
274
|
}
|
|
248
|
-
function
|
|
249
|
-
const u =
|
|
275
|
+
function $() {
|
|
276
|
+
const u = g.value;
|
|
250
277
|
u && (u.style.height = "auto", u.style.height = `${u.scrollHeight}px`);
|
|
251
278
|
}
|
|
252
|
-
function
|
|
253
|
-
|
|
279
|
+
function O(u) {
|
|
280
|
+
_.value && h.value && !h.value.contains(u.target) && c();
|
|
254
281
|
}
|
|
255
|
-
function
|
|
256
|
-
u.key === "Escape" &&
|
|
282
|
+
function V(u) {
|
|
283
|
+
u.key === "Escape" && c();
|
|
257
284
|
}
|
|
258
|
-
|
|
259
|
-
document.addEventListener("click",
|
|
285
|
+
ie(() => {
|
|
286
|
+
document.addEventListener("click", O), document.addEventListener("keydown", V);
|
|
260
287
|
}), ke(() => {
|
|
261
|
-
document.removeEventListener("click",
|
|
288
|
+
document.removeEventListener("click", O), document.removeEventListener("keydown", V);
|
|
262
289
|
});
|
|
263
|
-
const R =
|
|
290
|
+
const R = F();
|
|
264
291
|
async function p() {
|
|
265
|
-
if (!
|
|
266
|
-
|
|
292
|
+
if (!N(m.approvableStep, "comment") && !v.value) {
|
|
293
|
+
re(R.commentRequired);
|
|
267
294
|
return;
|
|
268
295
|
}
|
|
269
|
-
|
|
296
|
+
n.value = !0, f("isLoading", !0);
|
|
270
297
|
const u = {
|
|
271
|
-
comment:
|
|
272
|
-
}, E = await new ue().comment(
|
|
273
|
-
de(E) ? (ce(R.commentSaved),
|
|
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);
|
|
274
301
|
}
|
|
275
|
-
return (u, E) => (
|
|
302
|
+
return (u, E) => (t(), s("div", {
|
|
276
303
|
ref_key: "rootRef",
|
|
277
304
|
ref: h,
|
|
278
305
|
class: "approvable-popover"
|
|
279
306
|
}, [
|
|
280
|
-
|
|
307
|
+
e("button", {
|
|
281
308
|
class: "approvable-btn",
|
|
282
|
-
title:
|
|
309
|
+
title: C(R).comments,
|
|
283
310
|
type: "button",
|
|
284
|
-
onClick:
|
|
311
|
+
onClick: y
|
|
285
312
|
}, [...E[1] || (E[1] = [
|
|
286
|
-
|
|
313
|
+
e("svg", {
|
|
287
314
|
xmlns: "http://www.w3.org/2000/svg",
|
|
288
315
|
width: "16",
|
|
289
316
|
height: "16",
|
|
@@ -295,58 +322,54 @@ const Ke = {
|
|
|
295
322
|
"stroke-linejoin": "round",
|
|
296
323
|
"aria-hidden": "true"
|
|
297
324
|
}, [
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
325
|
+
e("path", { d: "M8 9h8" }),
|
|
326
|
+
e("path", { d: "M8 13h6" }),
|
|
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" })
|
|
301
328
|
], -1)
|
|
302
|
-
])], 8,
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
])])) :
|
|
307
|
-
|
|
308
|
-
L.value ? (
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
])) :
|
|
312
|
-
|
|
313
|
-
ge(
|
|
329
|
+
])], 8, ct),
|
|
330
|
+
_.value ? (t(), s("div", vt, [
|
|
331
|
+
n.value ? (t(), s("div", mt, [...E[2] || (E[2] = [
|
|
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", {
|
|
314
341
|
ref_key: "textareaRef",
|
|
315
|
-
ref:
|
|
316
|
-
"onUpdate:modelValue": E[0] || (E[0] = (
|
|
342
|
+
ref: g,
|
|
343
|
+
"onUpdate:modelValue": E[0] || (E[0] = (j) => v.value = j),
|
|
317
344
|
class: "approvable-textarea",
|
|
318
345
|
rows: "1",
|
|
319
|
-
onInput:
|
|
346
|
+
onInput: $
|
|
320
347
|
}, null, 544), [
|
|
321
|
-
[Se,
|
|
348
|
+
[Se, v.value]
|
|
322
349
|
]),
|
|
323
|
-
|
|
324
|
-
|
|
350
|
+
e("div", yt, [
|
|
351
|
+
e("button", {
|
|
325
352
|
class: "approvable-btn approvable-btn--primary",
|
|
326
353
|
type: "button",
|
|
327
354
|
onClick: p
|
|
328
|
-
},
|
|
355
|
+
}, d(C(R).save), 1)
|
|
329
356
|
])
|
|
330
357
|
], 64))
|
|
331
|
-
])) :
|
|
358
|
+
])) : k("", !0)
|
|
332
359
|
], 512));
|
|
333
360
|
}
|
|
334
361
|
};
|
|
335
|
-
function
|
|
336
|
-
return
|
|
362
|
+
function va(o, b) {
|
|
363
|
+
return Te(o, we(b));
|
|
337
364
|
}
|
|
338
|
-
const
|
|
339
|
-
function
|
|
340
|
-
return
|
|
365
|
+
const he = Symbol("approvable.linkComponent");
|
|
366
|
+
function _t() {
|
|
367
|
+
return X(he, "a");
|
|
341
368
|
}
|
|
342
|
-
function
|
|
343
|
-
return
|
|
369
|
+
function kt(o, b) {
|
|
370
|
+
return o === "a" ? { href: b } : { to: b };
|
|
344
371
|
}
|
|
345
|
-
const
|
|
346
|
-
function yt() {
|
|
347
|
-
return J(he, {});
|
|
348
|
-
}
|
|
349
|
-
const _t = {
|
|
372
|
+
const gt = {
|
|
350
373
|
key: 0,
|
|
351
374
|
"aria-hidden": "true",
|
|
352
375
|
fill: "none",
|
|
@@ -354,25 +377,25 @@ const _t = {
|
|
|
354
377
|
"stroke-linecap": "round",
|
|
355
378
|
"stroke-linejoin": "round",
|
|
356
379
|
viewBox: "0 0 16 16"
|
|
357
|
-
},
|
|
380
|
+
}, St = ["d", "stroke-width"], At = { class: "approvable-step-body" }, wt = { class: "approvable-step-line" }, $t = { class: "approvable-step-name" }, Ct = ["title"], Et = {
|
|
358
381
|
key: 1,
|
|
359
382
|
class: "approvable-step-spacer"
|
|
360
|
-
},
|
|
383
|
+
}, Rt = {
|
|
361
384
|
key: 0,
|
|
362
385
|
class: "approvable-step-status"
|
|
363
|
-
},
|
|
386
|
+
}, Dt = { key: 0 }, Lt = {
|
|
364
387
|
key: 1,
|
|
365
388
|
class: "approvable-step-date"
|
|
366
|
-
},
|
|
389
|
+
}, xt = {
|
|
367
390
|
key: 1,
|
|
368
391
|
class: "approvable-step-actions"
|
|
369
|
-
},
|
|
392
|
+
}, Ot = { class: "approvable-btn-group" }, Mt = ["title", "onClick"], It = ["title", "onClick"], Tt = {
|
|
370
393
|
key: 0,
|
|
371
394
|
class: "approvable-btn-group"
|
|
372
|
-
},
|
|
395
|
+
}, Nt = {
|
|
373
396
|
key: 0,
|
|
374
397
|
class: "approvable-step-comment"
|
|
375
|
-
},
|
|
398
|
+
}, Vt = ["title"], jt = ["aria-expanded"], ye = {
|
|
376
399
|
__name: "ApprovableStep",
|
|
377
400
|
props: {
|
|
378
401
|
value: {
|
|
@@ -389,149 +412,147 @@ const _t = {
|
|
|
389
412
|
}
|
|
390
413
|
},
|
|
391
414
|
emits: ["isLoading", "refresh"],
|
|
392
|
-
setup(
|
|
393
|
-
const
|
|
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(() => ({
|
|
394
417
|
"approvable-step": !0,
|
|
395
|
-
"approvable-step--active":
|
|
418
|
+
"approvable-step--active": n.value.isActive,
|
|
396
419
|
// A step nobody has reached yet is dimmed; one with an outcome is not.
|
|
397
|
-
"approvable-step--pending": !
|
|
398
|
-
[`approvable-step--${
|
|
420
|
+
"approvable-step--pending": !n.value.isActive && !v.value,
|
|
421
|
+
[`approvable-step--${v.value}`]: !!v.value,
|
|
399
422
|
// Nothing wraps below the name, so the row can hold to a single line.
|
|
400
|
-
"approvable-step--single-line": !L.value && !
|
|
401
|
-
})),
|
|
423
|
+
"approvable-step--single-line": !L.value && !n.value.comment.text
|
|
424
|
+
})), c = {
|
|
402
425
|
check: { d: "M4 8.4l2.8 2.8 5.4-6", width: 2.8 },
|
|
403
426
|
cross: { d: "M5.2 5.2l5.6 5.6M10.8 5.2l-5.6 5.6", width: 2.4 },
|
|
404
427
|
dash: { d: "M4.4 8h7.2", width: 2.2 }
|
|
405
|
-
},
|
|
428
|
+
}, $ = {
|
|
406
429
|
check: "success",
|
|
407
430
|
cross: "danger",
|
|
408
431
|
dash: "muted",
|
|
409
432
|
ring: "ring",
|
|
410
433
|
pending: "pending"
|
|
411
|
-
},
|
|
434
|
+
}, O = w(() => je(v.value, n.value.isActive)), V = w(() => c[O.value] ?? null), R = w(() => ({
|
|
412
435
|
"approvable-step-disc": !0,
|
|
413
|
-
[`approvable-step-disc--${
|
|
414
|
-
})), p =
|
|
436
|
+
[`approvable-step-disc--${$[O.value]}`]: !0
|
|
437
|
+
})), p = w(() => _.value ? n.value.comment.text : n.value.comment.preview), u = (I) => ({
|
|
415
438
|
"approvable-btn": !0,
|
|
416
439
|
// A button carrying only an icon collapses to a circle, so the row keeps its
|
|
417
440
|
// rhythm instead of stretching around an empty label.
|
|
418
441
|
"approvable-btn--icon": !I.text,
|
|
419
442
|
"approvable-btn--primary": I.result === "approved"
|
|
420
|
-
}), E = (I) =>
|
|
421
|
-
|
|
422
|
-
const M = await
|
|
423
|
-
stepId:
|
|
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,
|
|
424
447
|
button: I,
|
|
425
|
-
buttons:
|
|
448
|
+
buttons: n.value.buttons
|
|
426
449
|
});
|
|
427
|
-
|
|
450
|
+
m("isLoading", !1), M.skipped || m("refresh");
|
|
428
451
|
};
|
|
429
|
-
return (I, M) =>
|
|
452
|
+
return (I, M) => n.value.isVisible ? (t(), s("li", {
|
|
430
453
|
key: 0,
|
|
431
|
-
class:
|
|
454
|
+
class: B(x.value)
|
|
432
455
|
}, [
|
|
433
|
-
|
|
434
|
-
class:
|
|
456
|
+
e("span", {
|
|
457
|
+
class: B(R.value)
|
|
435
458
|
}, [
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
d:
|
|
439
|
-
"stroke-width":
|
|
440
|
-
}, null, 8,
|
|
441
|
-
])) :
|
|
459
|
+
V.value ? (t(), s("svg", gt, [
|
|
460
|
+
e("path", {
|
|
461
|
+
d: V.value.d,
|
|
462
|
+
"stroke-width": V.value.width
|
|
463
|
+
}, null, 8, St)
|
|
464
|
+
])) : k("", !0)
|
|
442
465
|
], 2),
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
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)
|
|
447
470
|
]),
|
|
448
|
-
|
|
449
|
-
step:
|
|
450
|
-
role:
|
|
471
|
+
z(I.$slots, "approvableStepRole", {
|
|
472
|
+
step: o.value,
|
|
473
|
+
role: n.value.approverRole
|
|
451
474
|
}, () => [
|
|
452
|
-
|
|
475
|
+
n.value.approverRole ? (t(), s("span", {
|
|
453
476
|
key: 0,
|
|
454
|
-
title:
|
|
477
|
+
title: n.value.approverRole,
|
|
455
478
|
class: "approvable-step-role"
|
|
456
|
-
},
|
|
479
|
+
}, d(n.value.approverRole), 9, Ct)) : (t(), s("span", Et))
|
|
457
480
|
]),
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
])) :
|
|
462
|
-
L.value ? (
|
|
463
|
-
|
|
464
|
-
(
|
|
465
|
-
key:
|
|
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
|
|
466
489
|
}, [
|
|
467
|
-
E(
|
|
490
|
+
E(S) ? (t(), K(Y(E(S)), {
|
|
468
491
|
key: 0,
|
|
469
|
-
"action-ui":
|
|
470
|
-
approvable:
|
|
471
|
-
button:
|
|
472
|
-
buttons: [
|
|
473
|
-
complete:
|
|
474
|
-
resource:
|
|
475
|
-
step:
|
|
476
|
-
onIsLoading: M[0] || (M[0] = (
|
|
477
|
-
onRefresh: M[1] || (M[1] = (
|
|
478
|
-
}, null, 40, ["action-ui", "approvable", "button", "buttons", "resource", "step"])) :
|
|
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({
|
|
479
502
|
key: 1,
|
|
480
503
|
ref_for: !0
|
|
481
|
-
},
|
|
482
|
-
default:
|
|
483
|
-
|
|
484
|
-
title:
|
|
485
|
-
class:
|
|
504
|
+
}, C(kt)(C(h), S.link)), {
|
|
505
|
+
default: pe(() => [
|
|
506
|
+
e("button", {
|
|
507
|
+
title: S.tooltip,
|
|
508
|
+
class: B(u(S)),
|
|
486
509
|
type: "button",
|
|
487
|
-
onClick: (
|
|
510
|
+
onClick: (r) => j(S)
|
|
488
511
|
}, [
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
], 10, xt)
|
|
512
|
+
U(J, {
|
|
513
|
+
icon: S.icon
|
|
514
|
+
}, null, 8, ["icon"])
|
|
515
|
+
], 10, Mt)
|
|
494
516
|
]),
|
|
495
517
|
_: 2
|
|
496
|
-
}, 1040)) : (
|
|
518
|
+
}, 1040)) : (t(), s("button", {
|
|
497
519
|
key: 2,
|
|
498
|
-
title:
|
|
499
|
-
class:
|
|
520
|
+
title: S.tooltip,
|
|
521
|
+
class: B(u(S)),
|
|
500
522
|
type: "button",
|
|
501
|
-
onClick: (
|
|
523
|
+
onClick: (r) => j(S)
|
|
502
524
|
}, [
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
], 10, Ot))
|
|
525
|
+
U(J, {
|
|
526
|
+
icon: S.icon
|
|
527
|
+
}, null, 8, ["icon"]),
|
|
528
|
+
Q(" " + d(S.text), 1)
|
|
529
|
+
], 10, It))
|
|
509
530
|
], 64))), 128))
|
|
510
531
|
]),
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
"approvable-step":
|
|
514
|
-
disabled: !
|
|
515
|
-
onRefresh: M[2] || (M[2] = (
|
|
516
|
-
onIsLoading: M[3] || (M[3] = (
|
|
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))
|
|
517
538
|
}, null, 8, ["approvable-step", "disabled"])
|
|
518
|
-
])) :
|
|
519
|
-
])) :
|
|
539
|
+
])) : k("", !0)
|
|
540
|
+
])) : k("", !0)
|
|
520
541
|
]),
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
title:
|
|
524
|
-
},
|
|
525
|
-
|
|
542
|
+
n.value.comment.text ? (t(), s("p", Nt, [
|
|
543
|
+
e("span", {
|
|
544
|
+
title: n.value.comment.title
|
|
545
|
+
}, d(p.value), 9, Vt),
|
|
546
|
+
n.value.comment.isTrimmed ? (t(), s("button", {
|
|
526
547
|
key: 0,
|
|
527
548
|
type: "button",
|
|
528
549
|
class: "approvable-step-comment-more",
|
|
529
|
-
"aria-expanded":
|
|
530
|
-
onClick: M[4] || (M[4] = (
|
|
531
|
-
},
|
|
532
|
-
])) :
|
|
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)
|
|
533
554
|
])
|
|
534
|
-
], 2)) :
|
|
555
|
+
], 2)) : k("", !0);
|
|
535
556
|
}
|
|
536
557
|
}, _e = {
|
|
537
558
|
__name: "ApproveStatusInfo",
|
|
@@ -543,39 +564,39 @@ const _t = {
|
|
|
543
564
|
default: null
|
|
544
565
|
}
|
|
545
566
|
},
|
|
546
|
-
setup(
|
|
547
|
-
const
|
|
548
|
-
const h =
|
|
567
|
+
setup(o) {
|
|
568
|
+
const b = o, m = w(() => {
|
|
569
|
+
const h = N(b.value, "code", " - ");
|
|
549
570
|
return {
|
|
550
571
|
"approvable-badge": !0,
|
|
551
|
-
"approvable-badge--draft": [
|
|
552
|
-
"approvable-badge--waiting": [
|
|
553
|
-
"approvable-badge--success": [
|
|
554
|
-
"approvable-badge--danger": [
|
|
555
|
-
"approvable-badge--muted": [
|
|
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),
|
|
556
577
|
"approvable-badge--empty": h === " - "
|
|
557
578
|
};
|
|
558
|
-
}), f =
|
|
559
|
-
return (h,
|
|
560
|
-
class:
|
|
561
|
-
},
|
|
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));
|
|
562
583
|
}
|
|
563
|
-
},
|
|
584
|
+
}, Bt = {
|
|
564
585
|
key: 0,
|
|
565
586
|
class: "approvable"
|
|
566
|
-
},
|
|
587
|
+
}, Pt = {
|
|
567
588
|
key: 0,
|
|
568
589
|
class: "approvable-loading"
|
|
569
|
-
},
|
|
590
|
+
}, qt = { class: "approvable-header" }, Kt = { class: "approvable-sr-only" }, Ut = { class: "approvable-updated-at" }, Ft = ["title", "aria-label"], Gt = {
|
|
570
591
|
class: "approvable-sr-only",
|
|
571
592
|
"aria-live": "polite"
|
|
572
|
-
},
|
|
593
|
+
}, Ht = {
|
|
573
594
|
key: 1,
|
|
574
595
|
class: "approvable-footer"
|
|
575
|
-
},
|
|
596
|
+
}, zt = { class: "approvable-dialog-header" }, Qt = { class: "approvable-dialog-eyebrow" }, Wt = {
|
|
576
597
|
id: "approvable-history-title",
|
|
577
598
|
class: "approvable-dialog-title"
|
|
578
|
-
},
|
|
599
|
+
}, Yt = ["aria-label"], Jt = { class: "approvable-dialog-body" }, Xt = {
|
|
579
600
|
__name: "Approvable",
|
|
580
601
|
props: {
|
|
581
602
|
value: {},
|
|
@@ -584,130 +605,130 @@ const _t = {
|
|
|
584
605
|
isDirectionRow: { default: !1 }
|
|
585
606
|
},
|
|
586
607
|
emits: ["refresh", "isLoading"],
|
|
587
|
-
setup(
|
|
588
|
-
const
|
|
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 = [
|
|
589
610
|
{ name: "118px", meta: "56px", delay: "0s", metaDelay: "0.15s" },
|
|
590
611
|
{ name: "96px", meta: "72px", delay: "0.1s", metaDelay: "0.25s" },
|
|
591
612
|
{ name: "78px", meta: "48px", delay: "0.2s", metaDelay: "0.35s" }
|
|
592
|
-
],
|
|
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(() => ({
|
|
593
614
|
"approvable-steps": !0,
|
|
594
|
-
"approvable-steps--row":
|
|
595
|
-
})),
|
|
596
|
-
const { activeStepNumber: R, visibleStepCount: p, activeApproverName: u } =
|
|
615
|
+
"approvable-steps--row": m.isDirectionRow
|
|
616
|
+
})), O = w(() => {
|
|
617
|
+
const { activeStepNumber: R, visibleStepCount: p, activeApproverName: u } = y.value;
|
|
597
618
|
if (!R || !p)
|
|
598
619
|
return null;
|
|
599
|
-
const E =
|
|
620
|
+
const E = H(v.stepProgress, {
|
|
600
621
|
current: R,
|
|
601
622
|
total: p
|
|
602
623
|
});
|
|
603
|
-
return u ? `${E} — ${
|
|
604
|
-
}),
|
|
624
|
+
return u ? `${E} — ${H(v.awaitingApprover, { name: u })}` : E;
|
|
625
|
+
}), V = () => {
|
|
605
626
|
var R;
|
|
606
|
-
(R =
|
|
627
|
+
(R = g.value) == null || R.refresh(), f("refresh");
|
|
607
628
|
};
|
|
608
|
-
return (R, p) =>
|
|
609
|
-
h.value &&
|
|
610
|
-
|
|
611
|
-
])])) :
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
p[7] || (p[7] =
|
|
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] = [
|
|
631
|
+
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", {
|
|
616
637
|
"aria-hidden": "true",
|
|
617
638
|
class: "approvable-skeleton-bar approvable-skeleton-bar--pill"
|
|
618
639
|
}, null, -1)),
|
|
619
|
-
p[8] || (p[8] =
|
|
620
|
-
p[9] || (p[9] =
|
|
640
|
+
p[8] || (p[8] = e("span", { class: "approvable-skeleton-spacer" }, null, -1)),
|
|
641
|
+
p[9] || (p[9] = e("span", {
|
|
621
642
|
"aria-hidden": "true",
|
|
622
643
|
class: "approvable-skeleton-bar approvable-skeleton-bar--soft",
|
|
623
644
|
style: { width: "104px", "animation-delay": "0.2s" }
|
|
624
645
|
}, null, -1))
|
|
625
|
-
], 64)) : (
|
|
626
|
-
|
|
646
|
+
], 64)) : (t(), s(D, { key: 1 }, [
|
|
647
|
+
o.showApprovableStatus ? (t(), K(_e, {
|
|
627
648
|
key: 0,
|
|
628
|
-
label:
|
|
629
|
-
value:
|
|
630
|
-
}, null, 8, ["label", "value"])) :
|
|
631
|
-
|
|
632
|
-
|
|
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", {
|
|
633
654
|
key: 1,
|
|
634
655
|
type: "button",
|
|
635
656
|
class: "approvable-history-btn",
|
|
636
|
-
title:
|
|
637
|
-
"aria-label":
|
|
638
|
-
onClick: p[0] || (p[0] = (u) =>
|
|
639
|
-
},
|
|
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)
|
|
640
661
|
], 64))
|
|
641
662
|
]),
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
(
|
|
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", {
|
|
645
666
|
key: u.delay,
|
|
646
667
|
"aria-hidden": "true",
|
|
647
668
|
class: "approvable-skeleton-row"
|
|
648
669
|
}, [
|
|
649
|
-
|
|
670
|
+
e("span", {
|
|
650
671
|
class: "approvable-skeleton-disc",
|
|
651
|
-
style:
|
|
672
|
+
style: W({ animationDelay: u.delay })
|
|
652
673
|
}, null, 4),
|
|
653
|
-
|
|
674
|
+
e("span", {
|
|
654
675
|
class: "approvable-skeleton-bar",
|
|
655
|
-
style:
|
|
676
|
+
style: W({ width: u.name, animationDelay: u.delay })
|
|
656
677
|
}, null, 4),
|
|
657
|
-
p[10] || (p[10] =
|
|
658
|
-
|
|
678
|
+
p[10] || (p[10] = e("span", { class: "approvable-skeleton-spacer" }, null, -1)),
|
|
679
|
+
e("span", {
|
|
659
680
|
class: "approvable-skeleton-bar approvable-skeleton-bar--soft",
|
|
660
|
-
style:
|
|
681
|
+
style: W({ width: u.meta, animationDelay: u.metaDelay })
|
|
661
682
|
}, null, 4)
|
|
662
683
|
])), 64)),
|
|
663
|
-
p[11] || (p[11] =
|
|
684
|
+
p[11] || (p[11] = e("div", {
|
|
664
685
|
class: "approvable-footer",
|
|
665
686
|
"aria-hidden": "true"
|
|
666
687
|
}, [
|
|
667
|
-
|
|
688
|
+
e("span", {
|
|
668
689
|
class: "approvable-skeleton-bar approvable-skeleton-bar--soft",
|
|
669
690
|
style: { display: "block", width: "132px" }
|
|
670
691
|
})
|
|
671
692
|
], -1))
|
|
672
|
-
], 64)) : (
|
|
673
|
-
|
|
693
|
+
], 64)) : (t(), s(D, { key: 2 }, [
|
|
694
|
+
y.value.steps.length ? (t(), s("ol", {
|
|
674
695
|
key: 0,
|
|
675
|
-
class:
|
|
696
|
+
class: B($.value)
|
|
676
697
|
}, [
|
|
677
|
-
(
|
|
698
|
+
(t(!0), s(D, null, P(y.value.steps, (u) => (t(), K(ye, {
|
|
678
699
|
key: u.id,
|
|
679
|
-
approvable:
|
|
680
|
-
resource:
|
|
700
|
+
approvable: y.value.approvable,
|
|
701
|
+
resource: o.value,
|
|
681
702
|
value: u,
|
|
682
703
|
onIsLoading: p[1] || (p[1] = (E) => h.value = E),
|
|
683
|
-
onRefresh:
|
|
704
|
+
onRefresh: V
|
|
684
705
|
}, $e({ _: 2 }, [
|
|
685
|
-
|
|
706
|
+
P(Object.keys(R.$slots), (E) => ({
|
|
686
707
|
name: E,
|
|
687
|
-
fn:
|
|
688
|
-
|
|
708
|
+
fn: pe((j) => [
|
|
709
|
+
z(R.$slots, E, Z({ ref_for: !0 }, j ?? {}))
|
|
689
710
|
])
|
|
690
711
|
}))
|
|
691
712
|
]), 1032, ["approvable", "resource", "value"]))), 128))
|
|
692
|
-
], 2)) :
|
|
693
|
-
|
|
713
|
+
], 2)) : k("", !0),
|
|
714
|
+
O.value ? (t(), s("p", Ht, d(O.value), 1)) : k("", !0)
|
|
694
715
|
], 64)),
|
|
695
|
-
(
|
|
696
|
-
|
|
716
|
+
(t(), K(Ce, { to: "body" }, [
|
|
717
|
+
_.value ? (t(), s("div", {
|
|
697
718
|
key: 0,
|
|
698
719
|
class: "approvable-dialog-backdrop",
|
|
699
|
-
onClick: p[5] || (p[5] = Ee((u) =>
|
|
720
|
+
onClick: p[5] || (p[5] = Ee((u) => _.value = !1, ["self"]))
|
|
700
721
|
}, [
|
|
701
|
-
|
|
722
|
+
e("section", {
|
|
702
723
|
role: "dialog",
|
|
703
724
|
"aria-modal": "true",
|
|
704
725
|
"aria-labelledby": "approvable-history-title",
|
|
705
726
|
class: "approvable-dialog",
|
|
706
|
-
onKeydown: p[4] || (p[4] = Re((u) =>
|
|
727
|
+
onKeydown: p[4] || (p[4] = Re((u) => _.value = !1, ["esc"]))
|
|
707
728
|
}, [
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
p[12] || (p[12] =
|
|
729
|
+
e("header", zt, [
|
|
730
|
+
e("p", Qt, [
|
|
731
|
+
p[12] || (p[12] = e("svg", {
|
|
711
732
|
"aria-hidden": "true",
|
|
712
733
|
fill: "none",
|
|
713
734
|
stroke: "currentColor",
|
|
@@ -716,18 +737,18 @@ const _t = {
|
|
|
716
737
|
"stroke-width": "2",
|
|
717
738
|
viewBox: "0 0 16 16"
|
|
718
739
|
}, [
|
|
719
|
-
|
|
740
|
+
e("path", { d: "M9.6 4.5 6 8l3.6 3.5" })
|
|
720
741
|
], -1)),
|
|
721
|
-
|
|
742
|
+
Q(" " + d(C(v).history), 1)
|
|
722
743
|
]),
|
|
723
|
-
|
|
724
|
-
|
|
744
|
+
e("h2", Wt, d(x.value), 1),
|
|
745
|
+
e("button", {
|
|
725
746
|
type: "button",
|
|
726
747
|
class: "approvable-dialog-close",
|
|
727
|
-
"aria-label":
|
|
728
|
-
onClick: p[2] || (p[2] = (u) =>
|
|
748
|
+
"aria-label": C(v).historyClose,
|
|
749
|
+
onClick: p[2] || (p[2] = (u) => _.value = !1)
|
|
729
750
|
}, [...p[13] || (p[13] = [
|
|
730
|
-
|
|
751
|
+
e("svg", {
|
|
731
752
|
"aria-hidden": "true",
|
|
732
753
|
class: "approvable-icon",
|
|
733
754
|
fill: "none",
|
|
@@ -736,28 +757,28 @@ const _t = {
|
|
|
736
757
|
"stroke-width": "2",
|
|
737
758
|
viewBox: "0 0 16 16"
|
|
738
759
|
}, [
|
|
739
|
-
|
|
760
|
+
e("path", { d: "m5.2 5.2 5.6 5.6M10.8 5.2l-5.6 5.6" })
|
|
740
761
|
], -1)
|
|
741
|
-
])], 8,
|
|
762
|
+
])], 8, Yt)
|
|
742
763
|
]),
|
|
743
|
-
|
|
744
|
-
|
|
764
|
+
e("div", Jt, [
|
|
765
|
+
U(me, {
|
|
745
766
|
ref_key: "auditTimeline",
|
|
746
|
-
ref:
|
|
747
|
-
"approvable-id":
|
|
767
|
+
ref: g,
|
|
768
|
+
"approvable-id": y.value.id,
|
|
748
769
|
"show-header": !1,
|
|
749
|
-
onLoaded: p[3] || (p[3] = (u) =>
|
|
770
|
+
onLoaded: p[3] || (p[3] = (u) => n.value = u)
|
|
750
771
|
}, null, 8, ["approvable-id"])
|
|
751
772
|
])
|
|
752
773
|
], 32)
|
|
753
|
-
])) :
|
|
774
|
+
])) : k("", !0)
|
|
754
775
|
]))
|
|
755
|
-
])) :
|
|
776
|
+
])) : k("", !0);
|
|
756
777
|
}
|
|
757
|
-
},
|
|
778
|
+
}, Zt = {
|
|
758
779
|
key: 0,
|
|
759
780
|
class: "approvable-actions"
|
|
760
|
-
},
|
|
781
|
+
}, ea = { class: "approvable-actions-list" }, ta = ["title", "onClick"], aa = {
|
|
761
782
|
__name: "ApprovableButtons",
|
|
762
783
|
props: {
|
|
763
784
|
value: {
|
|
@@ -765,52 +786,43 @@ const _t = {
|
|
|
765
786
|
}
|
|
766
787
|
},
|
|
767
788
|
emits: ["isLoading", "refresh"],
|
|
768
|
-
setup(
|
|
769
|
-
const
|
|
770
|
-
let
|
|
771
|
-
|
|
772
|
-
},
|
|
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) => {
|
|
773
794
|
f("isLoading", !0), h.value = !0;
|
|
774
|
-
const
|
|
775
|
-
de(
|
|
795
|
+
const c = await new ue().updateApproveStatus(y, x);
|
|
796
|
+
de(c) && ce(n.actionSucceeded), f("isLoading", !1), f("refresh");
|
|
776
797
|
};
|
|
777
|
-
return (
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
(
|
|
781
|
-
key:
|
|
782
|
-
title:
|
|
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,
|
|
783
804
|
class: "approvable-btn",
|
|
784
805
|
type: "button",
|
|
785
|
-
onClick: (
|
|
806
|
+
onClick: ($) => v(c)
|
|
786
807
|
}, [
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
})) : A(qe)(d.icon) ? (e(), a("img", {
|
|
792
|
-
key: 1,
|
|
793
|
-
src: d.icon,
|
|
794
|
-
alt: "",
|
|
795
|
-
class: "approvable-btn-icon"
|
|
796
|
-
}, null, 8, ea)) : A(Y)(d.icon) ? (e(), a("i", {
|
|
797
|
-
key: 2,
|
|
798
|
-
class: N(d.icon)
|
|
799
|
-
}, null, 2)) : y("", !0)
|
|
808
|
+
z(y.$slots, "icon", { button: c }, () => [
|
|
809
|
+
U(J, {
|
|
810
|
+
icon: c.icon
|
|
811
|
+
}, null, 8, ["icon"])
|
|
800
812
|
]),
|
|
801
|
-
|
|
802
|
-
], 8,
|
|
813
|
+
Q(" " + d(c.text), 1)
|
|
814
|
+
], 8, ta))), 128))
|
|
803
815
|
])
|
|
804
|
-
])) :
|
|
816
|
+
])) : k("", !0);
|
|
805
817
|
}
|
|
806
|
-
},
|
|
818
|
+
}, sa = { class: "approvable-select" }, oa = {
|
|
807
819
|
key: 0,
|
|
808
820
|
class: "approvable-select-label"
|
|
809
|
-
},
|
|
821
|
+
}, la = ["value"], na = ["value"], ra = /* @__PURE__ */ Object.assign({
|
|
810
822
|
inheritAttrs: !1
|
|
811
823
|
}, {
|
|
812
824
|
__name: "ApprovableStatusSelect",
|
|
813
|
-
props: /* @__PURE__ */
|
|
825
|
+
props: /* @__PURE__ */ ne({
|
|
814
826
|
getList: {},
|
|
815
827
|
label: {
|
|
816
828
|
default: "Status"
|
|
@@ -819,90 +831,90 @@ const _t = {
|
|
|
819
831
|
modelValue: {},
|
|
820
832
|
modelModifiers: {}
|
|
821
833
|
}),
|
|
822
|
-
emits: /* @__PURE__ */
|
|
823
|
-
setup(
|
|
824
|
-
const
|
|
825
|
-
let
|
|
826
|
-
return await new
|
|
827
|
-
},
|
|
828
|
-
const
|
|
829
|
-
f.value =
|
|
830
|
-
},
|
|
831
|
-
const
|
|
832
|
-
|
|
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($) ? $ : [];
|
|
833
845
|
};
|
|
834
|
-
return
|
|
835
|
-
await
|
|
836
|
-
}), (
|
|
837
|
-
|
|
838
|
-
|
|
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({
|
|
839
851
|
value: L.value,
|
|
840
852
|
class: "approvable-select-input"
|
|
841
|
-
},
|
|
842
|
-
|
|
843
|
-
(
|
|
844
|
-
key:
|
|
845
|
-
value:
|
|
846
|
-
},
|
|
847
|
-
], 16,
|
|
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)
|
|
848
860
|
]));
|
|
849
861
|
}
|
|
850
|
-
}),
|
|
862
|
+
}), ia = { class: "approvable-select-option" }, pa = {
|
|
851
863
|
__name: "ApprovableStatusSelectOption",
|
|
852
864
|
props: {
|
|
853
865
|
value: {}
|
|
854
866
|
},
|
|
855
|
-
setup(
|
|
856
|
-
const
|
|
857
|
-
return (f, h) => (
|
|
858
|
-
|
|
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)
|
|
859
871
|
]));
|
|
860
872
|
}
|
|
861
|
-
},
|
|
862
|
-
Approvable:
|
|
873
|
+
}, ua = {
|
|
874
|
+
Approvable: Xt,
|
|
863
875
|
ApprovableStep: ye,
|
|
864
|
-
ApprovableButtons:
|
|
865
|
-
ApprovableStepComment:
|
|
876
|
+
ApprovableButtons: aa,
|
|
877
|
+
ApprovableStepComment: fe,
|
|
866
878
|
ApprovableAuditTimeline: me,
|
|
867
879
|
ApproveStatusInfo: _e,
|
|
868
|
-
ApprovableStatusSelect:
|
|
869
|
-
ApprovableStatusSelectOption:
|
|
870
|
-
},
|
|
871
|
-
install(
|
|
872
|
-
if (
|
|
873
|
-
for (const [
|
|
874
|
-
|
|
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, _);
|
|
875
887
|
}
|
|
876
888
|
};
|
|
877
889
|
export {
|
|
878
|
-
|
|
879
|
-
|
|
890
|
+
be as APPROVABLE_ICON_REGISTRY,
|
|
891
|
+
he as APPROVABLE_LINK_COMPONENT,
|
|
880
892
|
ve as APPROVABLE_MESSAGES,
|
|
881
|
-
|
|
893
|
+
Xt as Approvable,
|
|
882
894
|
me as ApprovableAuditTimeline,
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
895
|
+
aa as ApprovableButtons,
|
|
896
|
+
ha as ApprovableClient,
|
|
897
|
+
ra as ApprovableStatusSelect,
|
|
898
|
+
pa as ApprovableStatusSelectOption,
|
|
887
899
|
ye as ApprovableStep,
|
|
888
|
-
|
|
900
|
+
fe as ApprovableStepComment,
|
|
889
901
|
_e as ApproveStatusInfo,
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
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,
|
|
918
|
+
F as useMessages
|
|
907
919
|
};
|
|
908
920
|
//# sourceMappingURL=approvable-vue.mjs.map
|