@antcde/vue-utils 0.2.21-rc.5 → 0.2.21
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/index.js +75 -122
- package/dist/types/formatDate.d.ts +0 -20
- package/dist/types/index.d.ts +1 -2
- package/package.json +6 -6
- package/dist/types/useTriggerDispatch.d.ts +0 -28
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { objectOmit as e, objectPick as t, useAsyncState as n, useColorMode as r, useMagicKeys as i, watchDebounced as a, whenever as o } from "@vueuse/core";
|
|
2
|
-
import { computed as s, inject as c, onBeforeUnmount as l, onMounted as u,
|
|
3
|
-
import { useI18n as
|
|
4
|
-
import { clone as
|
|
5
|
-
import { BehaviorSubject as
|
|
2
|
+
import { computed as s, inject as c, onBeforeUnmount as l, onMounted as u, onUnmounted as d, readonly as f, ref as p, shallowRef as m, watch as h } from "vue";
|
|
3
|
+
import { useI18n as g } from "vue-i18n";
|
|
4
|
+
import { clone as _, newCommsClient as v, newCommsHost as y } from "@antcde/connect-ts";
|
|
5
|
+
import { BehaviorSubject as b, Subject as x, concat as S, concatMap as C, debounceTime as w, distinctUntilChanged as T, filter as E, map as D } from "rxjs";
|
|
6
6
|
//#region src/formatDate.ts
|
|
7
|
-
var
|
|
7
|
+
var O = "nl", k = {
|
|
8
8
|
short: {
|
|
9
9
|
day: "2-digit",
|
|
10
10
|
month: "2-digit",
|
|
@@ -40,36 +40,25 @@ var A = "nl", j = {
|
|
|
40
40
|
minute: "2-digit",
|
|
41
41
|
hour12: !1
|
|
42
42
|
}
|
|
43
|
-
},
|
|
44
|
-
function
|
|
43
|
+
}, A = new Set(["short", "shortDateTime"]);
|
|
44
|
+
function j(e) {
|
|
45
45
|
return e instanceof Date ? e : new Date(e);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function M(e) {
|
|
48
48
|
return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
let { preset: n = "short", locale: r =
|
|
50
|
+
function N(e, t = {}) {
|
|
51
|
+
let { preset: n = "short", locale: r = O, fallback: i = "" } = t;
|
|
52
52
|
if (e == null || e === "") return i;
|
|
53
|
-
let a =
|
|
53
|
+
let a = j(e);
|
|
54
54
|
if (Number.isNaN(a.getTime())) return i;
|
|
55
|
-
if (n === "iso") return
|
|
56
|
-
let o =
|
|
57
|
-
return new Intl.DateTimeFormat(o,
|
|
58
|
-
}
|
|
59
|
-
function I(e, t, n = {}) {
|
|
60
|
-
let { preset: r = "medium", locale: i = A, fallback: a = "" } = n, o = e == null || e === "" ? null : N(e), s = t == null || t === "" ? null : N(t), c = o && !Number.isNaN(o.getTime()) ? o : null, l = s && !Number.isNaN(s.getTime()) ? s : null;
|
|
61
|
-
if (!c && !l) return a;
|
|
62
|
-
if (!c || !l || P(c) === P(l)) return F(c ?? l, {
|
|
63
|
-
preset: r === "iso" ? "medium" : r,
|
|
64
|
-
locale: i,
|
|
65
|
-
fallback: a
|
|
66
|
-
});
|
|
67
|
-
let u = r === "iso" ? "medium" : r;
|
|
68
|
-
return new Intl.DateTimeFormat(i, j[u]).formatRange(c, l);
|
|
55
|
+
if (n === "iso") return M(a);
|
|
56
|
+
let o = A.has(n) && /^en\b/i.test(r) ? O : r;
|
|
57
|
+
return new Intl.DateTimeFormat(o, k[n]).format(a);
|
|
69
58
|
}
|
|
70
59
|
//#endregion
|
|
71
60
|
//#region src/useAntColorMode.ts
|
|
72
|
-
function
|
|
61
|
+
function P(e, n) {
|
|
73
62
|
let i = r(n), a = s(() => e.context.value.darkMode), o = s(() => {
|
|
74
63
|
switch (a.value) {
|
|
75
64
|
case null: return "auto";
|
|
@@ -95,28 +84,28 @@ function L(e, n) {
|
|
|
95
84
|
}
|
|
96
85
|
//#endregion
|
|
97
86
|
//#region src/useAntI18n.ts
|
|
98
|
-
function
|
|
99
|
-
let n =
|
|
100
|
-
return
|
|
87
|
+
function F(e, t) {
|
|
88
|
+
let n = g(t);
|
|
89
|
+
return h(() => e.context.value.user?.language, (e) => n.locale.value = e ?? "en", { immediate: !0 }), n;
|
|
101
90
|
}
|
|
102
91
|
//#endregion
|
|
103
92
|
//#region src/useAppTourMode.ts
|
|
104
|
-
var
|
|
105
|
-
function
|
|
93
|
+
var I = p(!1), L = p(null);
|
|
94
|
+
function R() {
|
|
106
95
|
function e(e) {
|
|
107
|
-
|
|
108
|
-
|
|
96
|
+
h(() => e.value.tourMode, (e) => {
|
|
97
|
+
I.value = !!e, e || (L.value = null);
|
|
109
98
|
}, { immediate: !0 });
|
|
110
99
|
}
|
|
111
100
|
function t(e) {
|
|
112
|
-
|
|
101
|
+
I.value && (L.value = e);
|
|
113
102
|
}
|
|
114
103
|
function n() {
|
|
115
|
-
|
|
104
|
+
I.value = !1, L.value = null;
|
|
116
105
|
}
|
|
117
106
|
return {
|
|
118
|
-
isActive:
|
|
119
|
-
activeZoneId:
|
|
107
|
+
isActive: f(I),
|
|
108
|
+
activeZoneId: f(L),
|
|
120
109
|
connectContext: e,
|
|
121
110
|
setActiveZone: t,
|
|
122
111
|
exit: n
|
|
@@ -124,27 +113,27 @@ function V() {
|
|
|
124
113
|
}
|
|
125
114
|
//#endregion
|
|
126
115
|
//#region src/useCommsClient.ts
|
|
127
|
-
function
|
|
128
|
-
let i =
|
|
116
|
+
function z(t, n, r) {
|
|
117
|
+
let i = p({}), a = v({
|
|
129
118
|
parent: window.parent,
|
|
130
119
|
connect: t,
|
|
131
120
|
manifest: r
|
|
132
|
-
}), o =
|
|
121
|
+
}), o = p(""), c = s({
|
|
133
122
|
get: () => o.value,
|
|
134
123
|
set: (e) => a.appState.set(e)
|
|
135
124
|
});
|
|
136
|
-
return a.context.subscribe((e) => i.value = e),
|
|
125
|
+
return a.context.subscribe((e) => i.value = e), S(a.appState.get(), a.appState).subscribe((e) => o.value = e), V(a.signal, a, n), l(() => a.unsubscribe()), Object.assign(e(a, [
|
|
137
126
|
"context",
|
|
138
127
|
"toolbar",
|
|
139
128
|
"appState"
|
|
140
129
|
]), {
|
|
141
130
|
context: i,
|
|
142
|
-
toolbar:
|
|
131
|
+
toolbar: B(a),
|
|
143
132
|
appState: c
|
|
144
133
|
});
|
|
145
134
|
}
|
|
146
|
-
function
|
|
147
|
-
let t =
|
|
135
|
+
function B(e) {
|
|
136
|
+
let t = p(""), n = {
|
|
148
137
|
title: s({
|
|
149
138
|
get: () => e.toolbar.get().title,
|
|
150
139
|
set: (t) => e.toolbar.set((e) => ({
|
|
@@ -194,23 +183,23 @@ function U(e) {
|
|
|
194
183
|
}))
|
|
195
184
|
})
|
|
196
185
|
};
|
|
197
|
-
return e.toolbar.pipe(
|
|
186
|
+
return e.toolbar.pipe(D((e) => e.search.input ?? ""), T(), w(300)).forEach((e) => t.value = e), n;
|
|
198
187
|
}
|
|
199
|
-
function
|
|
200
|
-
let r = i(), a = r.ctrl ?? s(() => !1), c = r.shift ?? s(() => !1), l = new
|
|
188
|
+
function V(e, t, n) {
|
|
189
|
+
let r = i(), a = r.ctrl ?? s(() => !1), c = r.shift ?? s(() => !1), l = new x(), u = l.pipe(C(n ?? ((e) => Promise.resolve(e))), C((t) => e(t))).subscribe();
|
|
201
190
|
return t.add(u), u.add(o(a, () => l.next({ hotkeys: { ctrl: !0 } }))), u.add(o(c, () => l.next({ hotkeys: { shift: !0 } }))), u;
|
|
202
191
|
}
|
|
203
192
|
//#endregion
|
|
204
193
|
//#region src/useCommsHost.ts
|
|
205
|
-
function
|
|
206
|
-
let { context: t } = e, n = new
|
|
194
|
+
function H(e) {
|
|
195
|
+
let { context: t } = e, n = new b({}), r = (e) => n.next(e(n.value)), i = p(), o = new b(void 0), c = h(i, (e) => o.next(e), { immediate: !0 }), l = o.asObservable().pipe(D((e) => e?.contentWindow), E((e) => !!e)), u = y({
|
|
207
196
|
...e,
|
|
208
197
|
contextChanges: n,
|
|
209
198
|
windowChanges: l
|
|
210
199
|
});
|
|
211
|
-
Object.entries(t).map(([e, t]) =>
|
|
200
|
+
Object.entries(t).map(([e, t]) => h(t, (t) => r((n) => ({
|
|
212
201
|
...n,
|
|
213
|
-
[e]:
|
|
202
|
+
[e]: _(t)
|
|
214
203
|
})), { immediate: !0 })).forEach((e) => u.scope.add(e)), u.toolbar.subscribe((t) => {
|
|
215
204
|
let n = e.toolbar;
|
|
216
205
|
n.title.value = t.title, n.subtitle.value = t.subtitle, n.searchEnabled.value = t.search?.enabled ?? !1, n.search.value = t.search?.input, n.menu.value = t.menu, n.isLoading.value = t?.isLoading ?? !1;
|
|
@@ -220,30 +209,30 @@ function G(e) {
|
|
|
220
209
|
debounce: 100
|
|
221
210
|
});
|
|
222
211
|
u.scope.add(c), u.scope.add(d);
|
|
223
|
-
let f =
|
|
212
|
+
let f = p(u.appState.get()), m = s({
|
|
224
213
|
get: () => f.value,
|
|
225
214
|
set: (e) => u.appState.set(e)
|
|
226
215
|
});
|
|
227
216
|
u.appState.changes.subscribe((e) => f.value = e);
|
|
228
|
-
let
|
|
229
|
-
u.isConnectionInitialized.subscribe((e) =>
|
|
230
|
-
let
|
|
231
|
-
u.manifest?.subscribe((e) =>
|
|
232
|
-
let { unsubscribe:
|
|
217
|
+
let g = p(!1);
|
|
218
|
+
u.isConnectionInitialized.subscribe((e) => g.value = e);
|
|
219
|
+
let v = p(null);
|
|
220
|
+
u.manifest?.subscribe((e) => v.value = e);
|
|
221
|
+
let { unsubscribe: x, signal: S, closed: C } = u;
|
|
233
222
|
return {
|
|
234
223
|
...e,
|
|
235
224
|
client: i,
|
|
236
|
-
appState:
|
|
237
|
-
isConnectionInitialized:
|
|
238
|
-
manifest:
|
|
239
|
-
unsubscribe:
|
|
240
|
-
signal:
|
|
225
|
+
appState: m,
|
|
226
|
+
isConnectionInitialized: g,
|
|
227
|
+
manifest: v,
|
|
228
|
+
unsubscribe: x,
|
|
229
|
+
signal: S,
|
|
241
230
|
closed: C
|
|
242
231
|
};
|
|
243
232
|
}
|
|
244
233
|
//#endregion
|
|
245
234
|
//#region src/usePermissions.ts
|
|
246
|
-
function
|
|
235
|
+
function U(e) {
|
|
247
236
|
let t = s(() => e.value?.user), n = s(() => e.value?.license), r = s(() => e.value?.project), i = s(() => !!t.value?.is_admin), a = s(() => !!n.value?.user_is_admin), o = s(() => !!r.value?.user_is_admin || a.value);
|
|
248
237
|
function c(e) {
|
|
249
238
|
return !t.value || !n.value ? !1 : i.value || a.value ? !0 : (n.value.user_roles ?? []).some((t) => t.name === e);
|
|
@@ -269,13 +258,12 @@ function K(e) {
|
|
|
269
258
|
}
|
|
270
259
|
//#endregion
|
|
271
260
|
//#region src/useTemplateVersioning.ts
|
|
272
|
-
function
|
|
273
|
-
let t =
|
|
261
|
+
function W(e) {
|
|
262
|
+
let t = m(null), n = m(null), r = m(null), i = m(null), a = m([]), o = m(null), c = p(!1), l = p(!1), u = p(!1), d = p(!1), f = p(!1), h = p(!1), g = s(() => t.value?.has_update ?? !1), _ = s(() => t.value?.current_version ?? null), v = s(() => t.value?.latest_version ?? null), y = s(() => n.value ? n.value.added.length + n.value.removed.length + n.value.modified.length + n.value.relations_added.length + n.value.relations_removed.length : 0);
|
|
274
263
|
async function b(n) {
|
|
275
264
|
c.value = !0;
|
|
276
265
|
try {
|
|
277
|
-
|
|
278
|
-
return t.value = r?.data ?? null, t.value;
|
|
266
|
+
return t.value = (await e.tasks.checkForUpdates(n))?.data ?? null, t.value;
|
|
279
267
|
} catch {
|
|
280
268
|
return t.value = null, null;
|
|
281
269
|
} finally {
|
|
@@ -285,8 +273,7 @@ function q(e) {
|
|
|
285
273
|
async function x(t, r) {
|
|
286
274
|
l.value = !0;
|
|
287
275
|
try {
|
|
288
|
-
|
|
289
|
-
return n.value = i?.data ?? null, n.value;
|
|
276
|
+
return n.value = (await e.tasks.versionDiff(t, r))?.data ?? null, n.value;
|
|
290
277
|
} catch {
|
|
291
278
|
return n.value = null, null;
|
|
292
279
|
} finally {
|
|
@@ -296,8 +283,7 @@ function q(e) {
|
|
|
296
283
|
async function S(t, r, i) {
|
|
297
284
|
l.value = !0;
|
|
298
285
|
try {
|
|
299
|
-
|
|
300
|
-
return n.value = a?.data ?? null, n.value;
|
|
286
|
+
return n.value = (await e.tasks.versionCompare(t, r, i))?.data ?? null, n.value;
|
|
301
287
|
} catch {
|
|
302
288
|
return n.value = null, null;
|
|
303
289
|
} finally {
|
|
@@ -307,8 +293,7 @@ function q(e) {
|
|
|
307
293
|
async function C(t) {
|
|
308
294
|
u.value = !0;
|
|
309
295
|
try {
|
|
310
|
-
|
|
311
|
-
return r.value = n?.data ?? null, r.value;
|
|
296
|
+
return r.value = (await e.tasks.versionDiffOriginal(t))?.data ?? null, r.value;
|
|
312
297
|
} catch {
|
|
313
298
|
return r.value = null, null;
|
|
314
299
|
} finally {
|
|
@@ -318,8 +303,7 @@ function q(e) {
|
|
|
318
303
|
async function w(r, a) {
|
|
319
304
|
d.value = !0;
|
|
320
305
|
try {
|
|
321
|
-
|
|
322
|
-
return i.value = o?.data ?? null, t.value = null, n.value = null, i.value;
|
|
306
|
+
return i.value = (await e.tasks.syncToLatestVersion(r, a))?.data ?? null, t.value = null, n.value = null, i.value;
|
|
323
307
|
} catch {
|
|
324
308
|
return i.value = null, null;
|
|
325
309
|
} finally {
|
|
@@ -338,30 +322,27 @@ function q(e) {
|
|
|
338
322
|
}
|
|
339
323
|
}
|
|
340
324
|
async function E(t) {
|
|
341
|
-
|
|
325
|
+
h.value = !0;
|
|
342
326
|
try {
|
|
343
|
-
|
|
344
|
-
return a.value = n?.data ?? [], a.value;
|
|
327
|
+
return a.value = (await e.tasks.listVersions(t))?.data ?? [], a.value;
|
|
345
328
|
} catch {
|
|
346
329
|
return a.value = [], [];
|
|
347
330
|
} finally {
|
|
348
|
-
|
|
331
|
+
h.value = !1;
|
|
349
332
|
}
|
|
350
333
|
}
|
|
351
334
|
async function D(t) {
|
|
352
335
|
try {
|
|
353
|
-
|
|
354
|
-
return o.value = n?.data ?? null, o.value;
|
|
336
|
+
return o.value = (await e.tasks.latestVersion(t))?.data ?? null, o.value;
|
|
355
337
|
} catch {
|
|
356
338
|
return o.value = null, null;
|
|
357
339
|
}
|
|
358
340
|
}
|
|
359
|
-
let O =
|
|
341
|
+
let O = m([]), k = p(!1), A = p(!1), j = m([]);
|
|
360
342
|
async function M(t) {
|
|
361
343
|
k.value = !0;
|
|
362
344
|
try {
|
|
363
|
-
|
|
364
|
-
return O.value = n?.data ?? [], O.value;
|
|
345
|
+
return O.value = (await e.tasks.getInstances(t))?.data ?? [], O.value;
|
|
365
346
|
} catch {
|
|
366
347
|
return O.value = [], [];
|
|
367
348
|
} finally {
|
|
@@ -371,8 +352,7 @@ function q(e) {
|
|
|
371
352
|
async function N(t, n) {
|
|
372
353
|
A.value = !0, j.value = [];
|
|
373
354
|
try {
|
|
374
|
-
|
|
375
|
-
return j.value = r?.data ?? [], j.value;
|
|
355
|
+
return j.value = (await e.tasks.pushSync(t, n))?.data ?? [], j.value;
|
|
376
356
|
} catch {
|
|
377
357
|
return j.value = [], [];
|
|
378
358
|
} finally {
|
|
@@ -396,7 +376,7 @@ function q(e) {
|
|
|
396
376
|
isFetchingCustomizations: u,
|
|
397
377
|
isSyncing: d,
|
|
398
378
|
isPublishing: f,
|
|
399
|
-
isFetchingVersions:
|
|
379
|
+
isFetchingVersions: h,
|
|
400
380
|
isFetchingInstances: k,
|
|
401
381
|
isPushSyncing: A,
|
|
402
382
|
hasUpdate: g,
|
|
@@ -417,46 +397,19 @@ function q(e) {
|
|
|
417
397
|
};
|
|
418
398
|
}
|
|
419
399
|
//#endregion
|
|
420
|
-
//#region src/useTriggerDispatch.ts
|
|
421
|
-
function J(e, t = {}) {
|
|
422
|
-
let n = t.authorizationTimeoutMs ?? 5 * 6e4, r = /* @__PURE__ */ new Set();
|
|
423
|
-
d(() => {
|
|
424
|
-
for (let e of r) e();
|
|
425
|
-
});
|
|
426
|
-
function i(t) {
|
|
427
|
-
return new Promise((i) => {
|
|
428
|
-
let a = !1, o, s, c, l = (e) => {
|
|
429
|
-
a || (a = !0, o?.(), s && clearTimeout(s), c && r.delete(c), i(e));
|
|
430
|
-
};
|
|
431
|
-
c = () => l(!1), r.add(c), o = e.signal.receive((e) => {
|
|
432
|
-
let n = e.oauthAuthorizeResult;
|
|
433
|
-
n && n.secretId === t.secret_id && l(n.ok);
|
|
434
|
-
}), s = setTimeout(l, n, !1), e.signal({ oauthAuthorize: {
|
|
435
|
-
authorizeUrl: t.authorize_url,
|
|
436
|
-
secretId: t.secret_id
|
|
437
|
-
} });
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
async function a(e) {
|
|
441
|
-
let t = await e();
|
|
442
|
-
return !y(t) || !await i(t) ? t : e();
|
|
443
|
-
}
|
|
444
|
-
return { dispatch: a };
|
|
445
|
-
}
|
|
446
|
-
//#endregion
|
|
447
400
|
//#region src/utils.ts
|
|
448
|
-
function
|
|
449
|
-
let [t, n] =
|
|
401
|
+
function G(e = "comms") {
|
|
402
|
+
let [t, n] = K(e, () => z(), (e) => e.unsubscribe());
|
|
450
403
|
return {
|
|
451
404
|
provideComms: t,
|
|
452
405
|
injectComms: n
|
|
453
406
|
};
|
|
454
407
|
}
|
|
455
|
-
function
|
|
408
|
+
function K(e, t, n) {
|
|
456
409
|
let r, i = () => (!r && (r = t()), r);
|
|
457
410
|
return [(t) => (t.onUnmount(() => n && r && n(r)), t.provide(e, i)), () => c(e)()];
|
|
458
411
|
}
|
|
459
|
-
function
|
|
412
|
+
function q(t, r, i) {
|
|
460
413
|
let a = n(t, r, {
|
|
461
414
|
immediate: !1,
|
|
462
415
|
...i
|
|
@@ -466,9 +419,9 @@ function Z(t, r, i) {
|
|
|
466
419
|
executeDelayed: a.execute
|
|
467
420
|
});
|
|
468
421
|
}
|
|
469
|
-
function
|
|
470
|
-
let t, n =
|
|
471
|
-
return u(() => t = e.signal.receive((e) => n.value = e)),
|
|
422
|
+
function J(e) {
|
|
423
|
+
let t, n = p(void 0);
|
|
424
|
+
return u(() => t = e.signal.receive((e) => n.value = e)), d(() => t?.()), [f(n), () => t?.()];
|
|
472
425
|
}
|
|
473
426
|
//#endregion
|
|
474
|
-
export {
|
|
427
|
+
export { N as formatDate, P as useAntColorMode, F as useAntI18n, q as useApi, R as useAppTourMode, z as useCommsClient, H as useCommsHost, G as useCommsInjection, U as usePermissions, J as useSignal, K as useSingleton, W as useTemplateVersioning };
|
|
@@ -7,14 +7,6 @@ export interface FormatDateOptions {
|
|
|
7
7
|
/** Returned when value is null/undefined/empty/invalid. Default: ''. */
|
|
8
8
|
fallback?: string;
|
|
9
9
|
}
|
|
10
|
-
export interface FormatDateRangeOptions {
|
|
11
|
-
/** Display preset. Default: 'medium' (e.g. 6 Aug 2025). */
|
|
12
|
-
preset?: DateFormatPreset;
|
|
13
|
-
/** BCP-47 locale tag. Default: 'nl'. */
|
|
14
|
-
locale?: string;
|
|
15
|
-
/** Returned when both ends are null/undefined/empty/invalid. Default: ''. */
|
|
16
|
-
fallback?: string;
|
|
17
|
-
}
|
|
18
10
|
/**
|
|
19
11
|
* Format a date for display across the ANT environment.
|
|
20
12
|
*
|
|
@@ -28,15 +20,3 @@ export interface FormatDateRangeOptions {
|
|
|
28
20
|
* serialisation, never for display.
|
|
29
21
|
*/
|
|
30
22
|
export declare function formatDate(value: Date | string | number | null | undefined, options?: FormatDateOptions): string;
|
|
31
|
-
/**
|
|
32
|
-
* Format a date range with a smart, non-redundant year.
|
|
33
|
-
*
|
|
34
|
-
* Uses native `Intl…formatRange`, so the year collapses when both ends share
|
|
35
|
-
* it and stays on both ends when the range spans years:
|
|
36
|
-
* same month : 6–20 Aug 2025
|
|
37
|
-
* same year : 6 Aug – 20 Sep 2025
|
|
38
|
-
* multi-year : 6 Dec 2025 – 20 Jan 2026
|
|
39
|
-
*
|
|
40
|
-
* One-sided or same-day ranges fall back to a single `formatDate`.
|
|
41
|
-
*/
|
|
42
|
-
export declare function formatDateRange(start: Date | string | number | null | undefined, end: Date | string | number | null | undefined, options?: FormatDateRangeOptions): string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { type DateFormatPreset, formatDate, type FormatDateOptions
|
|
1
|
+
export { type DateFormatPreset, formatDate, type FormatDateOptions } from './formatDate';
|
|
2
2
|
export { useAntColorMode, type UseAntColorModeOptions, type UseAntColorModeReturn } from './useAntColorMode';
|
|
3
3
|
export { useAntI18n, type UseAntI18nReturn } from './useAntI18n';
|
|
4
4
|
export { useAppTourMode } from './useAppTourMode';
|
|
@@ -6,5 +6,4 @@ export { type UseCommsClient, useCommsClient } from './useCommsClient';
|
|
|
6
6
|
export { type CommsHostArgs, type UseCommsHost, useCommsHost } from './useCommsHost';
|
|
7
7
|
export { type UsePermissions, usePermissions } from './usePermissions';
|
|
8
8
|
export { useTemplateVersioning, type UseTemplateVersioningReturn } from './useTemplateVersioning';
|
|
9
|
-
export { useTriggerDispatch, type UseTriggerDispatchOptions, type UseTriggerDispatchReturn } from './useTriggerDispatch';
|
|
10
9
|
export { type AnyUseApiReturn, type CommsToolbar, useApi, type UseApiReturn, useCommsInjection, useSignal, useSingleton, } from './utils';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antcde/vue-utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.21
|
|
4
|
+
"version": "0.2.21",
|
|
5
5
|
"description": "Helper to use ANT Comms in Vue 3",
|
|
6
6
|
"author": "CollaborAll",
|
|
7
7
|
"exports": {
|
|
@@ -31,16 +31,16 @@
|
|
|
31
31
|
"vue-i18n": "^11.1.12"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@antcde/connect-ts": "0.4.26
|
|
34
|
+
"@antcde/connect-ts": "0.4.26"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@tsconfig/node22": "^22.0.5",
|
|
38
|
-
"@types/node": "^22.
|
|
39
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
38
|
+
"@types/node": "^22.19.21",
|
|
39
|
+
"@vitejs/plugin-vue": "^6.0.7",
|
|
40
40
|
"@vue/tsconfig": "^0.9.1",
|
|
41
41
|
"typescript": "~6.0.3",
|
|
42
|
-
"vite": "^8.
|
|
42
|
+
"vite": "^8.0.16",
|
|
43
43
|
"vite-plugin-dts": "^4.5.4",
|
|
44
|
-
"vue-tsc": "^3.3.
|
|
44
|
+
"vue-tsc": "^3.3.5"
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { TriggerDispatchResult } from '@antcde/connect-ts';
|
|
2
|
-
import { UseCommsClient } from './useCommsClient';
|
|
3
|
-
export interface UseTriggerDispatchOptions {
|
|
4
|
-
authorizationTimeoutMs?: number;
|
|
5
|
-
}
|
|
6
|
-
export interface UseTriggerDispatchReturn {
|
|
7
|
-
dispatch: (run: () => Promise<TriggerDispatchResult>) => Promise<TriggerDispatchResult>;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Wrap a trigger dispatch so a per-user OAuth2 "authorization required" outcome is
|
|
11
|
-
* handled transparently for iframe apps: on that outcome the helper asks the HOST
|
|
12
|
-
* (via the `oauthAuthorize` signal) to open the provider consent popup, awaits the
|
|
13
|
-
* host's `oauthAuthorizeResult`, and — when the user authorized — re-runs the
|
|
14
|
-
* dispatch exactly once. Any other outcome is returned unchanged.
|
|
15
|
-
*
|
|
16
|
-
* `run` is the caller's own dispatch invocation (e.g. a `useApi(...).execute`
|
|
17
|
-
* wrapper that resolves to the response body), so this composable stays decoupled
|
|
18
|
-
* from how the request is made and re-runs the identical call after consent.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* const { dispatch } = useTriggerDispatch(comms)
|
|
22
|
-
* const call = useApi(connect.triggers.dispatch, null)
|
|
23
|
-
* const result = await dispatch(async () => {
|
|
24
|
-
* await call.execute(triggerableType, triggerableId, triggerId)
|
|
25
|
-
* return call.state.value
|
|
26
|
-
* })
|
|
27
|
-
*/
|
|
28
|
-
export declare function useTriggerDispatch(comms: UseCommsClient, options?: UseTriggerDispatchOptions): UseTriggerDispatchReturn;
|