@atscript/vue-wf 0.1.99 → 0.1.101
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/{as-wf-form-DJq4U5XH.mjs → as-wf-form-IIT8rtRM.mjs} +18 -9
- package/dist/as-wf-form.d.mts +1 -1
- package/dist/as-wf-form.mjs +1 -1
- package/dist/{as-wf-form.vue-Bh8OD4Wn.d.mts → as-wf-form.vue-COkfnHRG.d.mts} +9 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as as_wf_finish_default } from "./as-wf-finish-CfbsKJhX.mjs";
|
|
2
2
|
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createVNode, defineComponent, guardReactiveProps, normalizeProps, onMounted, onUnmounted, openBlock, reactive, ref, renderSlot, shallowRef, toDisplayString, toRaw, unref, watch, withCtx } from "vue";
|
|
3
|
-
import {
|
|
3
|
+
import { createFormData, createFormDef, getDeclaredFormActions } from "@atscript/ui";
|
|
4
4
|
import { deserializeAnnotatedType } from "@atscript/typescript/utils";
|
|
5
5
|
import { AsForm } from "@atscript/vue-form";
|
|
6
6
|
//#region src/use-wf-form.ts
|
|
@@ -292,7 +292,7 @@ var as_wf_form_default = /* @__PURE__ */ defineComponent({
|
|
|
292
292
|
"dismiss",
|
|
293
293
|
"action"
|
|
294
294
|
],
|
|
295
|
-
setup(__props, { emit: __emit }) {
|
|
295
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
296
296
|
const props = __props;
|
|
297
297
|
const emit = __emit;
|
|
298
298
|
const wf = useWfForm(props);
|
|
@@ -306,14 +306,13 @@ var as_wf_form_default = /* @__PURE__ */ defineComponent({
|
|
|
306
306
|
watch([() => wf.formDef.value, () => wf.formContext.value], ([def, ctx]) => {
|
|
307
307
|
if (def) emit("form", def, ctx);
|
|
308
308
|
});
|
|
309
|
-
const
|
|
309
|
+
const formActions = computed(() => {
|
|
310
310
|
const def = wf.formDef.value;
|
|
311
|
-
|
|
311
|
+
return def ? getDeclaredFormActions(def) : [];
|
|
312
|
+
});
|
|
313
|
+
const withDataActions = computed(() => {
|
|
312
314
|
const set = /* @__PURE__ */ new Set();
|
|
313
|
-
for (const
|
|
314
|
-
const wfAction = getFieldMeta(field.prop, WF_ACTION_WITH_DATA);
|
|
315
|
-
if (wfAction) set.add(wfAction);
|
|
316
|
-
}
|
|
315
|
+
for (const a of formActions.value) if (a.withData) set.add(a.id);
|
|
317
316
|
return set;
|
|
318
317
|
});
|
|
319
318
|
function onSubmit(data) {
|
|
@@ -325,6 +324,14 @@ var as_wf_form_default = /* @__PURE__ */ defineComponent({
|
|
|
325
324
|
if (withDataActions.value.has(name)) wf.actionWithData(name, toRaw(data));
|
|
326
325
|
else wf.action(name);
|
|
327
326
|
}
|
|
327
|
+
/** Whether the current step's form declares this action id (host gating). */
|
|
328
|
+
function supportsAction(name) {
|
|
329
|
+
return formActions.value.some((a) => a.id === name);
|
|
330
|
+
}
|
|
331
|
+
__expose({
|
|
332
|
+
action: onAction,
|
|
333
|
+
supportsAction
|
|
334
|
+
});
|
|
328
335
|
return (_ctx, _cache) => {
|
|
329
336
|
return renderSlot(_ctx.$slots, "default", {
|
|
330
337
|
form: {
|
|
@@ -341,7 +348,9 @@ var as_wf_form_default = /* @__PURE__ */ defineComponent({
|
|
|
341
348
|
actions: {
|
|
342
349
|
start: unref(wf).start,
|
|
343
350
|
submit: onSubmit,
|
|
344
|
-
retry: unref(wf).retry
|
|
351
|
+
retry: unref(wf).retry,
|
|
352
|
+
action: onAction,
|
|
353
|
+
supportsAction
|
|
345
354
|
}
|
|
346
355
|
}, () => [unref(wf).loading.value && !unref(wf).formDef.value ? (openBlock(), createElementBlock("div", _hoisted_1, [renderSlot(_ctx.$slots, "wf.loading", {}, () => [_cache[2] || (_cache[2] = createElementVNode("div", { class: "as-form-overlay" }, [createElementVNode("span", {
|
|
347
356
|
class: "as-form-overlay-icon",
|
package/dist/as-wf-form.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _default } from "./as-wf-form.vue-
|
|
1
|
+
import { t as _default } from "./as-wf-form.vue-COkfnHRG.mjs";
|
|
2
2
|
export { _default as default };
|
package/dist/as-wf-form.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as as_wf_form_default } from "./as-wf-form-
|
|
1
|
+
import { t as as_wf_form_default } from "./as-wf-form-IIT8rtRM.mjs";
|
|
2
2
|
export { as_wf_form_default as default };
|
|
@@ -85,6 +85,9 @@ interface AsWfFormProps extends UseWfFormOptions {
|
|
|
85
85
|
navigate?: (url: string) => void | Promise<void>;
|
|
86
86
|
}
|
|
87
87
|
declare function onSubmit(data: unknown): void;
|
|
88
|
+
declare function onAction(name: string, data?: unknown): void;
|
|
89
|
+
/** Whether the current step's form declares this action id (host gating). */
|
|
90
|
+
declare function supportsAction(name: string): boolean;
|
|
88
91
|
declare var __VLS_1: {
|
|
89
92
|
form: {
|
|
90
93
|
def: FormDef | null;
|
|
@@ -101,6 +104,8 @@ declare var __VLS_1: {
|
|
|
101
104
|
start: (input?: Record<string, unknown>) => Promise<void>;
|
|
102
105
|
submit: typeof onSubmit;
|
|
103
106
|
retry: () => Promise<void>;
|
|
107
|
+
action: typeof onAction;
|
|
108
|
+
supportsAction: typeof supportsAction;
|
|
104
109
|
};
|
|
105
110
|
}, __VLS_3: {}, __VLS_5: {
|
|
106
111
|
error: {};
|
|
@@ -282,7 +287,10 @@ type __VLS_Slots = {} & {
|
|
|
282
287
|
} & {
|
|
283
288
|
'form.loading'?: (props: typeof __VLS_64) => any;
|
|
284
289
|
};
|
|
285
|
-
declare const __VLS_base: vue.DefineComponent<AsWfFormProps, {
|
|
290
|
+
declare const __VLS_base: vue.DefineComponent<AsWfFormProps, {
|
|
291
|
+
action: typeof onAction;
|
|
292
|
+
supportsAction: typeof supportsAction;
|
|
293
|
+
}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
|
|
286
294
|
dismiss: () => any;
|
|
287
295
|
action: (action: WfActionRequest) => any;
|
|
288
296
|
error: (error: {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { a as WfNext, i as WfMessage, n as WfButton, r as WfFinished, t as WfActionRequest } from "./index-C5MmoWFB.mjs";
|
|
2
|
-
import { i as useWfForm, n as UseWfFormOptions, r as UseWfFormReturn, t as _default$1 } from "./as-wf-form.vue-
|
|
2
|
+
import { i as useWfForm, n as UseWfFormOptions, r as UseWfFormReturn, t as _default$1 } from "./as-wf-form.vue-COkfnHRG.mjs";
|
|
3
3
|
import { t as _default } from "./as-wf-finish.vue-BhXMooP3.mjs";
|
|
4
4
|
export { _default as AsWfFinish, _default$1 as AsWfForm, type UseWfFormOptions, type UseWfFormReturn, type WfActionRequest, type WfButton, type WfFinished, type WfMessage, type WfNext, useWfForm };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as useWfForm, t as as_wf_form_default } from "./as-wf-form-
|
|
1
|
+
import { n as useWfForm, t as as_wf_form_default } from "./as-wf-form-IIT8rtRM.mjs";
|
|
2
2
|
import { t as as_wf_finish_default } from "./as-wf-finish-CfbsKJhX.mjs";
|
|
3
3
|
export { as_wf_finish_default as AsWfFinish, as_wf_form_default as AsWfForm, useWfForm };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atscript/vue-wf",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.101",
|
|
4
4
|
"description": "Workflow form integration for Vue 3 — HTTP round-trip loop driven by atscript type metadata",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"atscript",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@atscript/ui": "^0.1.
|
|
54
|
+
"@atscript/ui": "^0.1.101"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@atscript/core": "^0.1.76",
|
|
@@ -63,13 +63,13 @@
|
|
|
63
63
|
"vitest": "npm:@voidzero-dev/vite-plus-test@0.1.14",
|
|
64
64
|
"vue": "^3",
|
|
65
65
|
"vue-tsc": "~3.2.9",
|
|
66
|
-
"@atscript/
|
|
67
|
-
"@atscript/
|
|
66
|
+
"@atscript/moost-wf": "^0.1.101",
|
|
67
|
+
"@atscript/vue-form": "^0.1.101"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@atscript/typescript": "^0.1.76",
|
|
71
71
|
"vue": "^3",
|
|
72
|
-
"@atscript/vue-form": "^0.1.
|
|
72
|
+
"@atscript/vue-form": "^0.1.101"
|
|
73
73
|
},
|
|
74
74
|
"scripts": {
|
|
75
75
|
"build": "node ../../scripts/gen-exports.mjs && vp pack",
|