@silver-formily/element-plus 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.en-US.md +32 -0
- package/README.md +32 -35
- package/esm/__builtins__/configs/index.mjs.map +1 -1
- package/esm/__builtins__/index.mjs +15 -16
- package/esm/__builtins__/shared/hooks.mjs.map +1 -1
- package/esm/__builtins__/shared/index.mjs +11 -12
- package/esm/__builtins__/shared/loading.mjs.map +1 -1
- package/esm/__builtins__/shared/simple-version-compare.mjs.map +1 -1
- package/esm/__builtins__/shared/transform-component.d.ts +2 -6
- package/esm/__builtins__/shared/transform-component.mjs +16 -33
- package/esm/__builtins__/shared/transform-component.mjs.map +1 -1
- package/esm/__builtins__/shared/utils.mjs +10 -10
- package/esm/__builtins__/shared/utils.mjs.map +1 -1
- package/esm/array-base/index.mjs +76 -73
- package/esm/array-base/index.mjs.map +1 -1
- package/esm/array-base/symbols.mjs.map +1 -1
- package/esm/array-base/utils.mjs +33 -29
- package/esm/array-base/utils.mjs.map +1 -1
- package/esm/array-cards/index.mjs +56 -54
- package/esm/array-cards/index.mjs.map +1 -1
- package/esm/array-collapse/index.mjs +64 -62
- package/esm/array-collapse/index.mjs.map +1 -1
- package/esm/array-collapse/utils.mjs +8 -2
- package/esm/array-collapse/utils.mjs.map +1 -1
- package/esm/array-items/index.mjs +53 -47
- package/esm/array-items/index.mjs.map +1 -1
- package/esm/array-list-tabs/index.mjs +36 -34
- package/esm/array-list-tabs/index.mjs.map +1 -1
- package/esm/array-list-tabs/utils.mjs +11 -5
- package/esm/array-list-tabs/utils.mjs.map +1 -1
- package/esm/array-table/array-table.d.ts +28 -0
- package/esm/array-table/index.d.ts +28 -0
- package/esm/array-table/index.mjs +126 -123
- package/esm/array-table/index.mjs.map +1 -1
- package/esm/array-table/types.d.ts +1 -0
- package/esm/array-table/utils.mjs +18 -12
- package/esm/array-table/utils.mjs.map +1 -1
- package/esm/array-tabs/index.mjs +19 -17
- package/esm/array-tabs/index.mjs.map +1 -1
- package/esm/cascader/index.mjs +26 -24
- package/esm/cascader/index.mjs.map +1 -1
- package/esm/checkbox/checkbox-group.d.ts +1 -4
- package/esm/checkbox/index.d.ts +442 -379
- package/esm/checkbox/index.mjs +19 -16
- package/esm/checkbox/index.mjs.map +1 -1
- package/esm/date-picker/index.mjs +14 -12
- package/esm/date-picker/index.mjs.map +1 -1
- package/esm/editable/editable.d.ts +16 -12
- package/esm/editable/index.d.ts +8 -6
- package/esm/editable/index.mjs +113 -113
- package/esm/editable/index.mjs.map +1 -1
- package/esm/form/form.mjs +6 -6
- package/esm/form/form.mjs.map +1 -1
- package/esm/form-button-group/index.mjs +33 -29
- package/esm/form-button-group/index.mjs.map +1 -1
- package/esm/form-button-group/utils.mjs +8 -2
- package/esm/form-button-group/utils.mjs.map +1 -1
- package/esm/form-collapse/index.mjs +43 -42
- package/esm/form-collapse/index.mjs.map +1 -1
- package/esm/form-collapse/utils.mjs.map +1 -1
- package/esm/form-dialog/index.d.ts +1 -1
- package/esm/form-dialog/index.mjs +22 -22
- package/esm/form-dialog/index.mjs.map +1 -1
- package/esm/form-dialog/types.d.ts +6 -6
- package/esm/form-drawer/index.d.ts +1 -1
- package/esm/form-drawer/index.mjs +21 -21
- package/esm/form-drawer/index.mjs.map +1 -1
- package/esm/form-drawer/types.d.ts +6 -6
- package/esm/form-grid/hooks.mjs.map +1 -1
- package/esm/form-grid/index.d.ts +1 -183
- package/esm/form-grid/index.mjs +23 -20
- package/esm/form-grid/index.mjs.map +1 -1
- package/esm/form-item/form-item.d.ts +2 -1
- package/esm/form-item/index.d.ts +12 -6
- package/esm/form-item/index.mjs +157 -151
- package/esm/form-item/index.mjs.map +1 -1
- package/esm/form-item/types.d.ts +0 -1
- package/esm/form-item/utils.mjs.map +1 -1
- package/esm/form-layout/form-layout.d.ts +0 -1
- package/esm/form-layout/form-layout.mjs +56 -51
- package/esm/form-layout/form-layout.mjs.map +1 -1
- package/esm/form-layout/types.d.ts +0 -2
- package/esm/form-layout/utils.d.ts +3 -3
- package/esm/form-layout/utils.mjs +55 -45
- package/esm/form-layout/utils.mjs.map +1 -1
- package/esm/form-step/index.mjs +38 -34
- package/esm/form-step/index.mjs.map +1 -1
- package/esm/form-step/utils.mjs.map +1 -1
- package/esm/form-tab/hooks.mjs.map +1 -1
- package/esm/form-tab/index.d.ts +1 -26
- package/esm/form-tab/index.mjs +36 -35
- package/esm/form-tab/index.mjs.map +1 -1
- package/esm/form-tab/utils.mjs.map +1 -1
- package/esm/index.mjs +58 -58
- package/esm/input/index.mjs +23 -20
- package/esm/input/index.mjs.map +1 -1
- package/esm/input-number/index.d.ts +258 -147
- package/esm/input-number/index.mjs +9 -7
- package/esm/input-number/index.mjs.map +1 -1
- package/esm/pagination/components/jumper.mjs.map +1 -1
- package/esm/pagination/components/next.mjs.map +1 -1
- package/esm/pagination/components/pager.mjs.map +1 -1
- package/esm/pagination/components/prev.mjs.map +1 -1
- package/esm/pagination/components/total.mjs.map +1 -1
- package/esm/pagination/pagination.mjs +109 -110
- package/esm/pagination/pagination.mjs.map +1 -1
- package/esm/password/index.mjs.map +1 -1
- package/esm/preview-text/index.mjs +35 -32
- package/esm/preview-text/index.mjs.map +1 -1
- package/esm/preview-text/utils.mjs.map +1 -1
- package/esm/radio/index.d.ts +344 -194
- package/esm/radio/index.mjs +28 -25
- package/esm/radio/index.mjs.map +1 -1
- package/esm/reset/index.d.ts +1 -62
- package/esm/reset/index.mjs +1 -1
- package/esm/reset/index.mjs.map +1 -1
- package/esm/select/index.mjs +23 -20
- package/esm/select/index.mjs.map +1 -1
- package/esm/select-table/index.d.ts +28 -0
- package/esm/select-table/index.mjs +59 -55
- package/esm/select-table/index.mjs.map +1 -1
- package/esm/select-table/select-table.d.ts +56 -0
- package/esm/submit/index.d.ts +1 -47
- package/esm/submit/index.mjs +1 -1
- package/esm/submit/index.mjs.map +1 -1
- package/esm/switch/index.d.ts +225 -189
- package/esm/switch/index.mjs.map +1 -1
- package/esm/time-picker/index.mjs +8 -6
- package/esm/time-picker/index.mjs.map +1 -1
- package/esm/time-select/index.d.ts +163 -103
- package/esm/time-select/index.mjs +8 -6
- package/esm/time-select/index.mjs.map +1 -1
- package/esm/transfer/index.d.ts +196 -115
- package/esm/transfer/index.mjs.map +1 -1
- package/esm/tree/index.mjs +43 -40
- package/esm/tree/index.mjs.map +1 -1
- package/esm/tree/utils.mjs.map +1 -1
- package/esm/tree-select/index.mjs +20 -17
- package/esm/tree-select/index.mjs.map +1 -1
- package/esm/upload/index.d.ts +404 -399
- package/esm/upload/index.mjs +9 -7
- package/esm/upload/index.mjs.map +1 -1
- package/esm/upload/upload.d.ts +800 -790
- package/esm/vendor/icon.mjs.map +1 -1
- package/esm/vendor/lodash.mjs +12 -20
- package/esm/vendor/lodash.mjs.map +1 -1
- package/esm/vendor/runtime.mjs +29 -24
- package/esm/vendor/runtime.mjs.map +1 -1
- package/esm/vendor/shared.esm-bundler.mjs +2 -2
- package/esm/vendor/sizes.mjs.map +1 -1
- package/esm/vendor/types.mjs +5 -5
- package/esm/vendor/types.mjs.map +1 -1
- package/package.json +113 -114
|
@@ -16,7 +16,6 @@ declare const __VLS_component: import('vue').DefineComponent<IFormLayoutProps, {
|
|
|
16
16
|
layout: "vertical" | "horizontal" | "inline" | ("vertical" | "horizontal" | "inline")[];
|
|
17
17
|
colon: boolean;
|
|
18
18
|
labelWrap: boolean;
|
|
19
|
-
wrapperWrap: boolean;
|
|
20
19
|
fullness: boolean;
|
|
21
20
|
shallow: boolean;
|
|
22
21
|
statusIcon: boolean;
|
|
@@ -1,80 +1,85 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { isValid as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useFormDeepLayout as g, useResponsiveFormLayout as q, filterValidFormLayoutProps as o, formLayoutDeepContext as z, formLayoutShallowContext as D } from "./utils.mjs";
|
|
1
|
+
import { defineComponent as A, ref as l, computed as d, provide as e, watch as x, reactive as B, toRef as t, createBlock as P, openBlock as g, resolveDynamicComponent as I, mergeProps as b, unref as F, withModifiers as R, withCtx as _, renderSlot as q } from "vue";
|
|
2
|
+
import { isValid as z, isEmpty as D } from "@formily/shared";
|
|
3
|
+
import { useId as T, formContextKey as M } from "element-plus";
|
|
4
|
+
import { stylePrefix as S } from "../__builtins__/configs/index.mjs";
|
|
6
5
|
import { useThrottleFn as W } from "../__builtins__/shared/hooks.mjs";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
6
|
+
import "@formily/reactive";
|
|
7
|
+
import "@formily/core";
|
|
8
|
+
import "@silver-formily/reactive-vue";
|
|
9
|
+
import "@silver-formily/vue";
|
|
10
|
+
import { useCleanAttrs as $ } from "../__builtins__/shared/utils.mjs";
|
|
11
|
+
import { formLayoutIdContext as H, useFormDeepLayout as V, useResponsiveFormLayout as E, filterValidFormLayoutProps as r, formLayoutDeepContext as K, formLayoutShallowContext as j } from "./utils.mjs";
|
|
12
|
+
const to = /* @__PURE__ */ A({
|
|
10
13
|
name: "FFormLayout",
|
|
11
14
|
inheritAttrs: !1,
|
|
12
15
|
__name: "form-layout",
|
|
13
16
|
props: {
|
|
14
17
|
tag: { default: "form" },
|
|
15
|
-
colon: { type: Boolean, default:
|
|
16
|
-
labelAlign:
|
|
17
|
-
wrapperAlign:
|
|
18
|
-
labelWrap: { type: Boolean, default:
|
|
19
|
-
labelWidth:
|
|
20
|
-
wrapperWidth:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
fullness: { type: Boolean, default: !1 },
|
|
18
|
+
colon: { type: Boolean, default: void 0 },
|
|
19
|
+
labelAlign: {},
|
|
20
|
+
wrapperAlign: {},
|
|
21
|
+
labelWrap: { type: Boolean, default: void 0 },
|
|
22
|
+
labelWidth: {},
|
|
23
|
+
wrapperWidth: {},
|
|
24
|
+
labelCol: {},
|
|
25
|
+
wrapperCol: {},
|
|
26
|
+
fullness: { type: Boolean, default: void 0 },
|
|
25
27
|
size: { default: "default" },
|
|
26
28
|
layout: { default: "horizontal" },
|
|
27
|
-
feedbackLayout:
|
|
28
|
-
tooltipLayout:
|
|
29
|
-
breakpoints:
|
|
29
|
+
feedbackLayout: {},
|
|
30
|
+
tooltipLayout: {},
|
|
31
|
+
breakpoints: {},
|
|
30
32
|
shallow: { type: Boolean, default: !0 },
|
|
31
33
|
hideRequiredAsterisk: { type: Boolean },
|
|
32
34
|
statusIcon: { type: Boolean, default: !0 },
|
|
33
|
-
requireAsteriskPosition:
|
|
35
|
+
requireAsteriskPosition: {}
|
|
34
36
|
},
|
|
35
|
-
setup(
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
setup(c) {
|
|
38
|
+
const o = c, y = `${S}-form`, { props: s } = $(), n = l(), u = o.tag === "form", v = T(), p = d(() => s.value.id ?? `formily-${v.value}`), L = d(() => u ? p.value : s.value.id);
|
|
39
|
+
u && e(H, p);
|
|
40
|
+
const h = V(), { props: a } = E(o, n), C = l({
|
|
41
|
+
...h.value,
|
|
42
|
+
...o.shallow ? {
|
|
43
|
+
size: o.size,
|
|
44
|
+
...z(o.colon) && { colon: o.colon }
|
|
45
|
+
} : r(o)
|
|
42
46
|
});
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
if (!
|
|
48
|
-
const
|
|
49
|
-
|
|
47
|
+
e(K, C);
|
|
48
|
+
const f = l(o.shallow ? r(o) : {});
|
|
49
|
+
e(j, f);
|
|
50
|
+
const k = W(() => {
|
|
51
|
+
if (!D(a.value)) {
|
|
52
|
+
const i = r(a.value);
|
|
53
|
+
f.value = r({ ...o, ...i });
|
|
50
54
|
}
|
|
51
55
|
}, 200, !0);
|
|
52
|
-
|
|
56
|
+
x(() => [o, a], k, {
|
|
53
57
|
deep: !0,
|
|
54
58
|
immediate: !0
|
|
55
|
-
}), s(_, {
|
|
56
|
-
statusIcon: e.statusIcon,
|
|
57
|
-
hideRequiredAsterisk: e.hideRequiredAsterisk,
|
|
58
|
-
requireAsteriskPosition: e.requireAsteriskPosition
|
|
59
59
|
});
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
const w = B({
|
|
61
|
+
size: t(o, "size"),
|
|
62
|
+
statusIcon: t(o, "statusIcon"),
|
|
63
|
+
hideRequiredAsterisk: t(o, "hideRequiredAsterisk"),
|
|
64
|
+
requireAsteriskPosition: t(o, "requireAsteriskPosition")
|
|
65
|
+
});
|
|
66
|
+
return e(M, w), (i, m) => (g(), P(I(o.tag), b({
|
|
67
|
+
id: L.value,
|
|
63
68
|
ref_key: "rootHTMLRef",
|
|
64
|
-
ref:
|
|
65
|
-
class:
|
|
66
|
-
},
|
|
67
|
-
onSubmit:
|
|
69
|
+
ref: n,
|
|
70
|
+
class: y
|
|
71
|
+
}, F(s), {
|
|
72
|
+
onSubmit: m[0] || (m[0] = R(() => {
|
|
68
73
|
}, ["prevent", "stop"]))
|
|
69
74
|
}), {
|
|
70
|
-
default:
|
|
71
|
-
|
|
75
|
+
default: _(() => [
|
|
76
|
+
q(i.$slots, "default")
|
|
72
77
|
]),
|
|
73
78
|
_: 3
|
|
74
79
|
}, 16, ["id"]));
|
|
75
80
|
}
|
|
76
81
|
});
|
|
77
82
|
export {
|
|
78
|
-
|
|
83
|
+
to as _
|
|
79
84
|
};
|
|
80
85
|
//# sourceMappingURL=form-layout.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-layout.mjs","sources":["../../src/form-layout/form-layout.vue"],"sourcesContent":["<script lang=\"ts\" setup>\
|
|
1
|
+
{"version":3,"file":"form-layout.mjs","sources":["../../src/form-layout/form-layout.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { FormContext } from 'element-plus'\nimport type { IFormLayoutProps } from './types'\nimport { isEmpty, isValid } from '@formily/shared'\nimport { formContextKey, useId } from 'element-plus'\nimport { computed, provide, reactive, ref, toRef, watch } from 'vue'\nimport { stylePrefix, useCleanAttrs, useThrottleFn } from '../__builtins__'\nimport { filterValidFormLayoutProps, formLayoutDeepContext, formLayoutIdContext, formLayoutShallowContext, useFormDeepLayout, useResponsiveFormLayout } from './utils'\n\ndefineOptions({\n name: 'FFormLayout',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<IFormLayoutProps>(), {\n tag: 'form',\n colon: undefined,\n labelWrap: undefined,\n fullness: undefined,\n size: 'default',\n layout: 'horizontal',\n shallow: true,\n statusIcon: true,\n asterisk: undefined,\n})\nconst formPrefixCls = `${stylePrefix}-form`\nconst { props: attrs } = useCleanAttrs()\nconst rootHTMLRef = ref<HTMLElement>()\nconst isFormTag = props.tag === 'form'\nconst formLayoutBaseId = useId()\nconst formLayoutId = computed(() => attrs.value.id ?? `formily-${formLayoutBaseId.value}`)\nconst formLayoutDomId = computed(() => (isFormTag ? formLayoutId.value : attrs.value.id))\nif (isFormTag) {\n provide(formLayoutIdContext, formLayoutId)\n}\n\nconst formLayoutDeepConfig = useFormDeepLayout()\nconst { props: responsiveProps } = useResponsiveFormLayout(props, rootHTMLRef)\n\nconst deepLayout = ref({\n ...formLayoutDeepConfig.value,\n ...(props.shallow\n ? {\n size: props.size,\n ...(isValid(props.colon) && { colon: props.colon }),\n }\n : filterValidFormLayoutProps(props)),\n})\nprovide(formLayoutDeepContext, deepLayout)\n\nconst shallowLayout = ref(props.shallow ? filterValidFormLayoutProps(props) : {})\nprovide(formLayoutShallowContext, shallowLayout)\n\nconst updateLayout = useThrottleFn(() => {\n if (!isEmpty(responsiveProps.value)) {\n const _responsiveProps = filterValidFormLayoutProps(responsiveProps.value)\n shallowLayout.value = filterValidFormLayoutProps({ ...props, ..._responsiveProps })\n }\n}, 200, true)\n\nwatch(() => [props, responsiveProps], updateLayout, {\n deep: true,\n immediate: true,\n})\n\nconst formContext = reactive({\n size: toRef(props, 'size'),\n statusIcon: toRef(props, 'statusIcon'),\n hideRequiredAsterisk: toRef(props, 'hideRequiredAsterisk'),\n requireAsteriskPosition: toRef(props, 'requireAsteriskPosition'),\n})\nprovide(formContextKey, formContext as FormContext)\n</script>\n\n<template>\n <component\n :is=\"props.tag\"\n :id=\"formLayoutDomId\"\n ref=\"rootHTMLRef\"\n :class=\"formPrefixCls\"\n v-bind=\"attrs\"\n @submit.prevent.stop\n >\n <slot />\n </component>\n</template>\n"],"names":["props","__props","formPrefixCls","stylePrefix","attrs","useCleanAttrs","rootHTMLRef","ref","isFormTag","formLayoutBaseId","useId","formLayoutId","computed","formLayoutDomId","provide","formLayoutIdContext","formLayoutDeepConfig","useFormDeepLayout","responsiveProps","useResponsiveFormLayout","deepLayout","isValid","filterValidFormLayoutProps","formLayoutDeepContext","shallowLayout","formLayoutShallowContext","updateLayout","useThrottleFn","isEmpty","_responsiveProps","watch","formContext","reactive","toRef","formContextKey","_openBlock","_createBlock","_resolveDynamicComponent","_mergeProps","_unref","_renderSlot","_ctx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,UAAMA,IAAQC,GAWRC,IAAgB,GAAGC,CAAW,SAC9B,EAAE,OAAOC,EAAA,IAAUC,EAAA,GACnBC,IAAcC,EAAA,GACdC,IAAYR,EAAM,QAAQ,QAC1BS,IAAmBC,EAAA,GACnBC,IAAeC,EAAS,MAAMR,EAAM,MAAM,MAAM,WAAWK,EAAiB,KAAK,EAAE,GACnFI,IAAkBD,EAAS,MAAOJ,IAAYG,EAAa,QAAQP,EAAM,MAAM,EAAG;AACxF,IAAII,KACFM,EAAQC,GAAqBJ,CAAY;AAG3C,UAAMK,IAAuBC,EAAA,GACvB,EAAE,OAAOC,EAAA,IAAoBC,EAAwBnB,GAAOM,CAAW,GAEvEc,IAAab,EAAI;AAAA,MACrB,GAAGS,EAAqB;AAAA,MACxB,GAAIhB,EAAM,UACN;AAAA,QACE,MAAMA,EAAM;AAAA,QACZ,GAAIqB,EAAQrB,EAAM,KAA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
7
7
|
labelWidth?: number;
|
|
8
8
|
wrapperWidth?: number;
|
|
9
|
-
wrapperWrap?: boolean;
|
|
10
9
|
labelCol?: number | number[];
|
|
11
10
|
wrapperCol?: number | number[];
|
|
12
11
|
fullness?: boolean;
|
|
@@ -27,7 +26,6 @@ export interface ICalculatedFormLayoutProps {
|
|
|
27
26
|
labelWrap?: boolean;
|
|
28
27
|
labelWidth?: number | string;
|
|
29
28
|
wrapperWidth?: number | string;
|
|
30
|
-
wrapperWrap?: boolean;
|
|
31
29
|
labelCol?: number;
|
|
32
30
|
wrapperCol?: number;
|
|
33
31
|
fullness?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InjectionKey, Ref } from 'vue';
|
|
1
|
+
import { ComputedRef, InjectionKey, Ref } from 'vue';
|
|
2
2
|
import { IFormLayoutProps } from './types';
|
|
3
3
|
export declare function calcBreakpointIndex(breakpoints: number[], width: number): number;
|
|
4
4
|
export declare function calcFactor<T>(value: T | readonly T[], breakpointIndex: number): T;
|
|
@@ -13,7 +13,6 @@ export declare function useResponsiveFormLayout(props: IFormLayoutProps, root: R
|
|
|
13
13
|
labelWrap?: boolean;
|
|
14
14
|
labelWidth?: number;
|
|
15
15
|
wrapperWidth?: number;
|
|
16
|
-
wrapperWrap?: boolean;
|
|
17
16
|
labelCol?: number | number[];
|
|
18
17
|
wrapperCol?: number | number[];
|
|
19
18
|
fullness?: boolean;
|
|
@@ -34,7 +33,6 @@ export declare function useResponsiveFormLayout(props: IFormLayoutProps, root: R
|
|
|
34
33
|
labelWrap?: boolean;
|
|
35
34
|
labelWidth?: number;
|
|
36
35
|
wrapperWidth?: number;
|
|
37
|
-
wrapperWrap?: boolean;
|
|
38
36
|
labelCol?: number | number[];
|
|
39
37
|
wrapperCol?: number | number[];
|
|
40
38
|
fullness?: boolean;
|
|
@@ -51,7 +49,9 @@ export declare function useResponsiveFormLayout(props: IFormLayoutProps, root: R
|
|
|
51
49
|
};
|
|
52
50
|
export declare const formLayoutDeepContext: InjectionKey<Ref<IFormLayoutProps>>;
|
|
53
51
|
export declare const formLayoutShallowContext: InjectionKey<Ref<IFormLayoutProps>>;
|
|
52
|
+
export declare const formLayoutIdContext: InjectionKey<ComputedRef<string>>;
|
|
54
53
|
export declare function useFormDeepLayout(): Ref<IFormLayoutProps>;
|
|
55
54
|
export declare function useFormLayout(): Ref<IFormLayoutProps>;
|
|
55
|
+
export declare function useFormLayoutId(): ComputedRef<string>;
|
|
56
56
|
export declare const FORM_LAYOUT_PROPS_KEYS: ReadonlyArray<keyof IFormLayoutProps>;
|
|
57
57
|
export declare function filterValidFormLayoutProps(props: IFormLayoutProps): IFormLayoutProps;
|
|
@@ -1,77 +1,84 @@
|
|
|
1
|
-
import { isArr as
|
|
2
|
-
import { inject as
|
|
1
|
+
import { isArr as d, isValid as u } from "@formily/shared";
|
|
2
|
+
import { inject as l, ref as i, computed as s } from "vue";
|
|
3
3
|
import { useResizeObserver as h } from "../__builtins__/shared/hooks.mjs";
|
|
4
|
-
|
|
4
|
+
import "element-plus";
|
|
5
|
+
import "@formily/reactive";
|
|
6
|
+
import "@formily/core";
|
|
7
|
+
import "@silver-formily/reactive-vue";
|
|
8
|
+
import "@silver-formily/vue";
|
|
9
|
+
function A(t, o) {
|
|
5
10
|
for (const [r, e] of t.entries())
|
|
6
11
|
if (o <= e)
|
|
7
12
|
return r;
|
|
8
13
|
return -1;
|
|
9
14
|
}
|
|
10
|
-
function
|
|
15
|
+
function C(t, o) {
|
|
11
16
|
if (!Array.isArray(t) || t.length === 0)
|
|
12
17
|
return t;
|
|
13
18
|
const r = Math.max(-1, Math.min(o, t.length - 1));
|
|
14
19
|
return t.at(r);
|
|
15
20
|
}
|
|
16
21
|
function a(t, o) {
|
|
17
|
-
return u(t) ?
|
|
22
|
+
return u(t) ? C(t, o) : t;
|
|
18
23
|
}
|
|
19
|
-
function
|
|
24
|
+
function x(t, o) {
|
|
20
25
|
const { clientWidth: r } = t, {
|
|
21
26
|
breakpoints: e,
|
|
22
|
-
layout:
|
|
23
|
-
labelAlign:
|
|
24
|
-
wrapperAlign:
|
|
25
|
-
labelCol:
|
|
26
|
-
wrapperCol:
|
|
27
|
-
...
|
|
28
|
-
} = o, n =
|
|
27
|
+
layout: c,
|
|
28
|
+
labelAlign: f,
|
|
29
|
+
wrapperAlign: m,
|
|
30
|
+
labelCol: y,
|
|
31
|
+
wrapperCol: b,
|
|
32
|
+
...L
|
|
33
|
+
} = o, n = A(
|
|
29
34
|
e,
|
|
30
35
|
r
|
|
31
36
|
);
|
|
32
37
|
return {
|
|
33
|
-
layout: a(
|
|
34
|
-
labelAlign: a(
|
|
35
|
-
wrapperAlign: a(
|
|
36
|
-
labelCol: a(
|
|
37
|
-
wrapperCol: a(
|
|
38
|
-
...
|
|
38
|
+
layout: a(c, n),
|
|
39
|
+
labelAlign: a(f, n),
|
|
40
|
+
wrapperAlign: a(m, n),
|
|
41
|
+
labelCol: a(y, n),
|
|
42
|
+
wrapperCol: a(b, n),
|
|
43
|
+
...L
|
|
39
44
|
};
|
|
40
45
|
}
|
|
41
|
-
function
|
|
46
|
+
function _(t, o) {
|
|
42
47
|
const { breakpoints: r } = t;
|
|
43
|
-
if (!
|
|
48
|
+
if (!d(r))
|
|
44
49
|
return {
|
|
45
|
-
props:
|
|
50
|
+
props: i(t)
|
|
46
51
|
};
|
|
47
|
-
const e =
|
|
52
|
+
const e = i({});
|
|
48
53
|
return h(o, () => {
|
|
49
|
-
e.value =
|
|
54
|
+
e.value = x(o.value, t);
|
|
50
55
|
}), {
|
|
51
56
|
props: e
|
|
52
57
|
};
|
|
53
58
|
}
|
|
54
|
-
const
|
|
59
|
+
const p = Symbol(
|
|
55
60
|
"formLayoutDeepContext"
|
|
56
|
-
),
|
|
57
|
-
function
|
|
58
|
-
return
|
|
61
|
+
), w = Symbol("formLayoutShallowContext"), k = Symbol("formLayoutIdContext");
|
|
62
|
+
function j() {
|
|
63
|
+
return l(p, i({}));
|
|
59
64
|
}
|
|
60
|
-
function
|
|
61
|
-
const t =
|
|
62
|
-
return
|
|
65
|
+
function D() {
|
|
66
|
+
const t = l(w, i({})), o = l(p, i({}));
|
|
67
|
+
return s(() => ({
|
|
63
68
|
...o.value,
|
|
64
69
|
...t.value
|
|
65
70
|
}));
|
|
66
71
|
}
|
|
67
|
-
|
|
72
|
+
function M() {
|
|
73
|
+
return l(k, s(() => ""));
|
|
74
|
+
}
|
|
75
|
+
const q = [
|
|
68
76
|
"colon",
|
|
69
77
|
"labelAlign",
|
|
70
78
|
"wrapperAlign",
|
|
71
79
|
"labelWrap",
|
|
72
80
|
"labelWidth",
|
|
73
81
|
"wrapperWidth",
|
|
74
|
-
"wrapperWrap",
|
|
75
82
|
"labelCol",
|
|
76
83
|
"wrapperCol",
|
|
77
84
|
"fullness",
|
|
@@ -81,24 +88,27 @@ const R = [
|
|
|
81
88
|
"tooltipLayout",
|
|
82
89
|
"breakpoints",
|
|
83
90
|
"hideRequiredAsterisk",
|
|
84
|
-
"statusIcon"
|
|
91
|
+
"statusIcon",
|
|
92
|
+
"requireAsteriskPosition"
|
|
85
93
|
];
|
|
86
|
-
function
|
|
94
|
+
function z(t) {
|
|
87
95
|
return Object.fromEntries(
|
|
88
96
|
Object.entries(t).filter(([o, r]) => u(r))
|
|
89
97
|
);
|
|
90
98
|
}
|
|
91
99
|
export {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
100
|
+
q as FORM_LAYOUT_PROPS_KEYS,
|
|
101
|
+
A as calcBreakpointIndex,
|
|
102
|
+
C as calcFactor,
|
|
103
|
+
x as calculateProps,
|
|
96
104
|
a as factor,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
z as filterValidFormLayoutProps,
|
|
106
|
+
p as formLayoutDeepContext,
|
|
107
|
+
k as formLayoutIdContext,
|
|
108
|
+
w as formLayoutShallowContext,
|
|
109
|
+
j as useFormDeepLayout,
|
|
110
|
+
D as useFormLayout,
|
|
111
|
+
M as useFormLayoutId,
|
|
112
|
+
_ as useResponsiveFormLayout
|
|
103
113
|
};
|
|
104
114
|
//# sourceMappingURL=utils.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","sources":["../../src/form-layout/utils.ts"],"sourcesContent":["import type { InjectionKey, Ref } from 'vue'\
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../src/form-layout/utils.ts"],"sourcesContent":["import type { ComputedRef, InjectionKey, Ref } from 'vue'\nimport type { IFormLayoutProps } from './types'\nimport { isArr, isValid } from '@formily/shared'\nimport { computed, inject, ref } from 'vue'\nimport { useResizeObserver } from '../__builtins__'\n\nexport function calcBreakpointIndex(breakpoints: number[], width: number): number {\n for (const [i, breakpoint] of breakpoints.entries()) {\n if (width <= breakpoint) {\n return i\n }\n }\n return -1\n}\n\nexport function calcFactor<T>(value: T | readonly T[], breakpointIndex: number): T {\n if (!Array.isArray(value) || value.length === 0) {\n return value as T\n }\n const safeIndex = Math.max(-1, Math.min(breakpointIndex, value.length - 1))\n return value.at(safeIndex)\n}\n\nexport function factor<T>(value: T | T[], breakpointIndex: number): T {\n return isValid(value) ? calcFactor<T>(value, breakpointIndex) : value as T\n}\n\nexport function calculateProps(target: Element, props: IFormLayoutProps): IFormLayoutProps {\n const { clientWidth } = target\n const {\n breakpoints,\n layout,\n labelAlign,\n wrapperAlign,\n labelCol,\n wrapperCol,\n ...otherProps\n } = props\n const breakpointIndex = calcBreakpointIndex(\n breakpoints as number[],\n clientWidth,\n )\n\n return {\n layout: factor(layout, breakpointIndex),\n labelAlign: factor(labelAlign, breakpointIndex),\n wrapperAlign: factor(wrapperAlign, breakpointIndex),\n labelCol: factor(labelCol, breakpointIndex),\n wrapperCol: factor(wrapperCol, breakpointIndex),\n ...otherProps,\n }\n}\n\nexport function useResponsiveFormLayout(props: IFormLayoutProps, root: Ref<HTMLElement | null>) {\n const { breakpoints } = props\n if (!isArr(breakpoints)) {\n return {\n props: ref(props),\n }\n }\n\n const layoutProps = ref<IFormLayoutProps>({})\n\n useResizeObserver(root, () => {\n layoutProps.value = calculateProps(root.value, props)\n })\n\n return {\n props: layoutProps,\n }\n}\n\nexport const formLayoutDeepContext: InjectionKey<Ref<IFormLayoutProps>> = Symbol(\n 'formLayoutDeepContext',\n)\n\nexport const formLayoutShallowContext: InjectionKey<Ref<IFormLayoutProps>>\n = Symbol('formLayoutShallowContext')\n\nexport const formLayoutIdContext: InjectionKey<ComputedRef<string>>\n = Symbol('formLayoutIdContext')\n\nexport function useFormDeepLayout(): Ref<IFormLayoutProps> {\n return inject(formLayoutDeepContext, ref({}))\n}\n\nexport function useFormLayout(): Ref<IFormLayoutProps> {\n const shallowLayout = inject(formLayoutShallowContext, ref({}))\n const deepLayout = inject(formLayoutDeepContext, ref({}))\n\n const formLayout = computed(() => {\n return {\n ...deepLayout.value,\n ...shallowLayout.value,\n }\n })\n\n return formLayout\n}\n\nexport function useFormLayoutId(): ComputedRef<string> {\n return inject(formLayoutIdContext, computed(() => ''))\n}\n\nexport const FORM_LAYOUT_PROPS_KEYS: ReadonlyArray<keyof IFormLayoutProps> = [\n 'colon',\n 'labelAlign',\n 'wrapperAlign',\n 'labelWrap',\n 'labelWidth',\n 'wrapperWidth',\n 'labelCol',\n 'wrapperCol',\n 'fullness',\n 'size',\n 'layout',\n 'feedbackLayout',\n 'tooltipLayout',\n 'breakpoints',\n 'hideRequiredAsterisk',\n 'statusIcon',\n 'requireAsteriskPosition',\n] as const\n\nexport function filterValidFormLayoutProps(props: IFormLayoutProps): IFormLayoutProps {\n return Object.fromEntries(\n Object.entries(props)\n .filter(([_, value]) => isValid(value)),\n )\n}\n"],"names":["calcBreakpointIndex","breakpoints","width","i","breakpoint","calcFactor","value","breakpointIndex","safeIndex","factor","isValid","calculateProps","target","props","clientWidth","layout","labelAlign","wrapperAlign","labelCol","wrapperCol","otherProps","useResponsiveFormLayout","root","isArr","ref","layoutProps","useResizeObserver","formLayoutDeepContext","formLayoutShallowContext","formLayoutIdContext","useFormDeepLayout","inject","useFormLayout","shallowLayout","deepLayout","computed","useFormLayoutId","FORM_LAYOUT_PROPS_KEYS","filterValidFormLayoutProps","_"],"mappings":";;;;;;;;AAMO,SAASA,EAAoBC,GAAuBC,GAAuB;AAChF,aAAW,CAACC,GAAGC,CAAU,KAAKH,EAAY;AACxC,QAAIC,KAASE;AACX,aAAOD;AAGX,SAAO;AACT;AAEO,SAASE,EAAcC,GAAyBC,GAA4B;AACjF,MAAI,CAAC,MAAM,QAAQD,CAAK,KAAKA,EAAM,WAAW;AAC5C,WAAOA;AAET,QAAME,IAAY,KAAK,IAAI,IAAI,KAAK,IAAID,GAAiBD,EAAM,SAAS,CAAC,CAAC;AAC1E,SAAOA,EAAM,GAAGE,CAAS;AAC3B;AAEO,SAASC,EAAUH,GAAgBC,GAA4B;AACpE,SAAOG,EAAQJ,CAAK,IAAID,EAAcC,GAAOC,CAAe,IAAID;AAClE;AAEO,SAASK,EAAeC,GAAiBC,GAA2C;AACzF,QAAM,EAAE,aAAAC,MAAgBF,GAClB;AAAA,IACJ,aAAAX;AAAA,IACA,QAAAc;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,YAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDP,GACEN,IAAkBP;AAAA,IACtBC;AAAA,IACAa;AAAA,EAAA;AAGF,SAAO;AAAA,IACL,QAAQL,EAAOM,GAAQR,CAAe;AAAA,IACtC,YAAYE,EAAOO,GAAYT,CAAe;AAAA,IAC9C,cAAcE,EAAOQ,GAAcV,CAAe;AAAA,IAClD,UAAUE,EAAOS,GAAUX,CAAe;AAAA,IAC1C,YAAYE,EAAOU,GAAYZ,CAAe;AAAA,IAC9C,GAAGa;AAAA,EAAA;AAEP;AAEO,SAASC,EAAwBR,GAAyBS,GAA+B;AAC9F,QAAM,EAAE,aAAArB,MAAgBY;AACxB,MAAI,CAACU,EAAMtB,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computed as P, createElementBlock as o, openBlock as r, normalizeClass as B, createVNode as E, unref as t, mergeProps as h, withCtx as u, Fragment as c, renderList as x, createBlock as a, createSlots as N, resolveDynamicComponent as _, createTextVNode as v, toDisplayString as y, createCommentVNode as O } from "vue";
|
|
2
|
+
import { ElSteps as V, ElStep as b } from "element-plus";
|
|
3
|
+
import "@formily/reactive";
|
|
4
|
+
import "@formily/core";
|
|
5
|
+
import { useObserver as A } from "@silver-formily/reactive-vue";
|
|
6
|
+
import { useField as D, useFieldSchema as R, RecursionField as j } from "@silver-formily/vue";
|
|
7
|
+
import { composeExport as w } from "../__builtins__/shared/utils.mjs";
|
|
3
8
|
import { isObj as k } from "@formily/shared";
|
|
4
|
-
import { useField as A, useFieldSchema as D, RecursionField as O } from "@silver-formily/vue";
|
|
5
|
-
import { ElSteps as R, ElStep as j } from "element-plus";
|
|
6
|
-
import { createFormStep as S, parseSteps as w } from "./utils.mjs";
|
|
7
9
|
import { stylePrefix as z } from "../__builtins__/configs/index.mjs";
|
|
8
|
-
import {
|
|
9
|
-
const
|
|
10
|
+
import { createFormStep as C, parseSteps as L } from "./utils.mjs";
|
|
11
|
+
const T = $({
|
|
10
12
|
name: "FFormStepPane",
|
|
11
13
|
inheritAttrs: !1
|
|
12
|
-
}),
|
|
13
|
-
const
|
|
14
|
-
for (const [
|
|
15
|
-
|
|
16
|
-
return
|
|
14
|
+
}), q = (n, i) => {
|
|
15
|
+
const m = n.__vccOpts || n;
|
|
16
|
+
for (const [p, s] of i)
|
|
17
|
+
m[p] = s;
|
|
18
|
+
return m;
|
|
17
19
|
};
|
|
18
|
-
function
|
|
19
|
-
return
|
|
20
|
+
function G(n, i, m, p, s, f) {
|
|
21
|
+
return g(n.$slots, "default");
|
|
20
22
|
}
|
|
21
|
-
const
|
|
23
|
+
const H = /* @__PURE__ */ q(T, [["render", G]]), I = /* @__PURE__ */ $({
|
|
22
24
|
name: "FFormStep",
|
|
23
25
|
inheritAttrs: !1,
|
|
24
26
|
__name: "form-step",
|
|
25
27
|
props: {
|
|
26
|
-
formStep: { default: () =>
|
|
27
|
-
active:
|
|
28
|
+
formStep: { default: () => C() },
|
|
29
|
+
active: {}
|
|
28
30
|
},
|
|
29
31
|
setup(n) {
|
|
30
|
-
const i = n
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const i = n;
|
|
33
|
+
A();
|
|
34
|
+
const m = D().value, p = `${z}-form-step`, s = R(), f = L(s.value);
|
|
35
|
+
i.formStep.connect?.(f, m);
|
|
36
|
+
const F = P(() => i.active ?? i.formStep?.current ?? 0);
|
|
37
|
+
return (S, J) => (r(), o("div", {
|
|
38
|
+
class: B(p)
|
|
35
39
|
}, [
|
|
36
|
-
|
|
40
|
+
E(t(V), h(S.$attrs, {
|
|
37
41
|
active: F.value,
|
|
38
42
|
style: [{ marginBottom: "10px" }]
|
|
39
43
|
}), {
|
|
40
44
|
default: u(() => [
|
|
41
|
-
(r(!0), o(c, null, x(t(f), ({ props: l, slots: e }, d) => (r(),
|
|
45
|
+
(r(!0), o(c, null, x(t(f), ({ props: l, slots: e }, d) => (r(), a(t(b), h({ key: d }, { ref_for: !0 }, l), N({ _: 2 }, [
|
|
42
46
|
e?.title ? {
|
|
43
47
|
name: "title",
|
|
44
48
|
fn: u(() => [
|
|
45
|
-
t(k)(e.title) ? (r(),
|
|
49
|
+
t(k)(e.title) ? (r(), a(_(e.title), { key: 0 })) : (r(), o(c, { key: 1 }, [
|
|
46
50
|
v(y(e.title), 1)
|
|
47
51
|
], 64))
|
|
48
52
|
]),
|
|
@@ -51,7 +55,7 @@ const G = /* @__PURE__ */ T(L, [["render", q]]), H = /* @__PURE__ */ $({
|
|
|
51
55
|
e?.icon ? {
|
|
52
56
|
name: "icon",
|
|
53
57
|
fn: u(() => [
|
|
54
|
-
t(k)(e.icon) ? (r(),
|
|
58
|
+
t(k)(e.icon) ? (r(), a(_(e.icon), { key: 0 })) : (r(), o(c, { key: 1 }, [
|
|
55
59
|
v(y(e.icon), 1)
|
|
56
60
|
], 64))
|
|
57
61
|
]),
|
|
@@ -60,7 +64,7 @@ const G = /* @__PURE__ */ T(L, [["render", q]]), H = /* @__PURE__ */ $({
|
|
|
60
64
|
e?.description ? {
|
|
61
65
|
name: "description",
|
|
62
66
|
fn: u(() => [
|
|
63
|
-
t(k)(e.description) ? (r(),
|
|
67
|
+
t(k)(e.description) ? (r(), a(_(e.description), { key: 0 })) : (r(), o(c, { key: 1 }, [
|
|
64
68
|
v(y(e.description), 1)
|
|
65
69
|
], 64))
|
|
66
70
|
]),
|
|
@@ -71,20 +75,20 @@ const G = /* @__PURE__ */ T(L, [["render", q]]), H = /* @__PURE__ */ $({
|
|
|
71
75
|
_: 1
|
|
72
76
|
}, 16, ["active"]),
|
|
73
77
|
(r(!0), o(c, null, x(t(f), ({ name: l, schema: e }, d) => (r(), o(c, { key: l }, [
|
|
74
|
-
d === F.value ? (r(),
|
|
78
|
+
d === F.value ? (r(), a(t(j), {
|
|
75
79
|
key: 0,
|
|
76
80
|
name: l,
|
|
77
81
|
schema: e
|
|
78
|
-
}, null, 8, ["name", "schema"])) :
|
|
82
|
+
}, null, 8, ["name", "schema"])) : O("", !0)
|
|
79
83
|
], 64))), 128))
|
|
80
84
|
]));
|
|
81
85
|
}
|
|
82
|
-
}),
|
|
83
|
-
StepPane:
|
|
84
|
-
createFormStep:
|
|
86
|
+
}), te = w(I, {
|
|
87
|
+
StepPane: H,
|
|
88
|
+
createFormStep: C
|
|
85
89
|
});
|
|
86
90
|
export {
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
te as FormStep,
|
|
92
|
+
te as default
|
|
89
93
|
};
|
|
90
94
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/form-step/form-step-pane.vue","../../src/form-step/form-step
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/form-step/form-step-pane.vue","../../src/form-step/form-step.vue","../../src/form-step/index.ts"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent } from 'vue'\n\nexport default defineComponent({\n name: 'FFormStepPane',\n inheritAttrs: false,\n})\n</script>\n\n<template>\n <slot />\n</template>\n","<script setup lang=\"ts\">\nimport type { VoidField } from '@formily/core'\nimport type { IFormStepProps } from './types'\nimport { isObj } from '@formily/shared'\nimport { useObserver } from '@silver-formily/reactive-vue'\nimport { RecursionField, useField, useFieldSchema } from '@silver-formily/vue'\nimport { ElStep, ElSteps } from 'element-plus'\nimport { computed } from 'vue'\nimport { stylePrefix } from '../__builtins__'\nimport { createFormStep, parseSteps } from './utils'\n\ndefineOptions({\n name: 'FFormStep',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<IFormStepProps>(), {\n formStep: () => createFormStep(),\n})\n\nuseObserver()\n\nconst field = useField<VoidField>().value\nconst prefixCls = `${stylePrefix}-form-step`\nconst fieldSchemaRef = useFieldSchema()\n\nconst steps = parseSteps(fieldSchemaRef.value)\n\nprops.formStep.connect?.(steps, field)\n\nconst current = computed(() => props.active ?? props.formStep?.current ?? 0)\n</script>\n\n<template>\n <div :class=\"prefixCls\">\n <ElSteps\n v-bind=\"$attrs\"\n :active=\"current\"\n :style=\"[{ marginBottom: '10px' }]\"\n >\n <ElStep\n v-for=\"({ props: stepProps, slots: stepSlots }, key) of steps\"\n :key=\"key\"\n v-bind=\"stepProps\"\n >\n <template v-if=\"stepSlots?.title\" #title>\n <template v-if=\"isObj(stepSlots.title)\">\n <component :is=\"stepSlots.title\" />\n </template>\n <template v-else>\n {{ stepSlots.title }}\n </template>\n </template>\n <template v-if=\"stepSlots?.icon\" #icon>\n <template v-if=\"isObj(stepSlots.icon)\">\n <component :is=\"stepSlots.icon\" />\n </template>\n <template v-else>\n {{ stepSlots.icon }}\n </template>\n </template>\n <template v-if=\"stepSlots?.description\" #description>\n <template v-if=\"isObj(stepSlots.description)\">\n <component :is=\"stepSlots.description\" />\n </template>\n <template v-else>\n {{ stepSlots.description }}\n </template>\n </template>\n </ElStep>\n </ElSteps>\n\n <template v-for=\"({ name, schema }, key) of steps\" :key=\"name\">\n <RecursionField\n v-if=\"key === current\"\n :name=\"name\"\n :schema=\"schema\"\n />\n </template>\n </div>\n</template>\n","import { composeExport } from '../__builtins__'\nimport FFormStepPane from './form-step-pane.vue'\nimport FFormStep from './form-step.vue'\nimport { createFormStep } from './utils'\n\nexport const FormStep = composeExport(FFormStep, {\n StepPane: FFormStepPane,\n createFormStep,\n})\n\nexport default FormStep\n"],"names":["_sfc_main$1","defineComponent","_renderSlot","_ctx","props","__props","useObserver","field","useField","prefixCls","stylePrefix","fieldSchemaRef","useFieldSchema","steps","parseSteps","current","computed","_createElementBlock","_createVNode","_unref","ElSteps","_mergeProps","_openBlock","_Fragment","stepProps","stepSlots","key","_createBlock","_createSlots","isObj","_resolveDynamicComponent","_createTextVNode","_toDisplayString","name","schema","RecursionField","FormStep","composeExport","FFormStep","FFormStepPane","createFormStep"],"mappings":";;;;;;;;;;AAGA,MAAAA,IAAeC,EAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;;;;;;;SAICC,EAAQC,EAAA,QAAA,SAAA;;;;;;;;;;;ACMV,UAAMC,IAAQC;AAId,IAAAC,EAAA;AAEA,UAAMC,IAAQC,IAAsB,OAC9BC,IAAY,GAAGC,CAAW,cAC1BC,IAAiBC,EAAA,GAEjBC,IAAQC,EAAWH,EAAe,KAAK;AAE7C,IAAAP,EAAM,SAAS,UAAUS,GAAON,CAAK;AAErC,UAAMQ,IAAUC,EAAS,MAAMZ,EAAM,UAAUA,EAAM,UAAU,WAAW,CAAC;2BAIzEa,EA6CM,OAAA;AAAA,MA7CA,SAAOR,CAAS;AAAA,IAAA;MACpBS,EAmCUC,EAAAC,CAAA,GAnCVC,EAmCUlB,EAAA,QAlCM;AAAA,QACb,QAAQY,EAAA;AAAA,QACR,OAAO,CAAA,EAAA,cAAA,QAAA;AAAA,MAAA;mBAGN,MAA8D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AAAF;AAAA,UACA,QAAAC;AAAA,QAAA;;;;ICvEIE,KAAWC,EAAcC,GAAW;AAAA,EAC/C,UAAUC;AAAA,EACV,gBAAAC;AACF,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","sources":["../../src/form-step/utils.ts"],"sourcesContent":["import type { Schema, SchemaKey } from '@formily/json-schema'\
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../src/form-step/utils.ts"],"sourcesContent":["import type { Schema, SchemaKey } from '@formily/json-schema'\nimport type { Slots } from 'vue'\nimport type { FormStepEnv, IFormStep } from './types'\nimport { action, model, observable } from '@formily/reactive'\n\nexport interface SchemaStep {\n name: SchemaKey\n props: any\n schema: Schema\n slots: Slots\n}\n\nexport function createFormStep(defaultCurrent = 0): IFormStep {\n const env: FormStepEnv = observable({\n form: null,\n field: null,\n steps: [],\n })\n\n const setDisplay = action.bound((target: number) => {\n const currentStep = env.steps[target]\n for (const { name } of env.steps) {\n env.form.query(`${env.field.address}.${name}`).take((field) => {\n if (name === currentStep.name) {\n field.setDisplay('visible')\n }\n else {\n field.setDisplay('hidden')\n }\n })\n }\n })\n\n const formStep: IFormStep = model({\n connect(steps, field) {\n env.steps = steps\n env.form = field?.form\n env.field = field\n },\n current: defaultCurrent,\n setCurrent(key: number) {\n formStep.current = key\n },\n get allowNext() {\n return formStep.current < env.steps.length - 1\n },\n get allowBack() {\n return formStep.current > 0\n },\n async next() {\n try {\n await env.form.validate()\n // eslint-disable-next-line ts/no-use-before-define\n next()\n }\n catch {}\n },\n async back() {\n // eslint-disable-next-line ts/no-use-before-define\n back()\n },\n async submit(onSubmit) {\n return env.form?.submit?.(onSubmit)\n },\n })\n\n const next = action.bound(() => {\n /* istanbul ignore else -- @preserve */\n if (formStep.allowNext) {\n setDisplay(formStep.current + 1)\n formStep.setCurrent(formStep.current + 1)\n }\n })\n\n const back = action.bound(() => {\n /* istanbul ignore else -- @preserve */\n if (formStep.allowBack) {\n setDisplay(formStep.current - 1)\n formStep.setCurrent(formStep.current - 1)\n }\n })\n return formStep\n}\n\nexport function parseSteps(schema: Schema) {\n const steps: SchemaStep[] = []\n schema.mapProperties((schema, name) => {\n /* istanbul ignore else -- @preserve */\n if (schema['x-component']?.indexOf('StepPane') > -1) {\n steps.push({\n name,\n props: schema['x-component-props'],\n schema,\n slots: schema['x-content'],\n })\n }\n })\n return steps\n}\n"],"names":["createFormStep","defaultCurrent","env","observable","setDisplay","action","target","currentStep","name","field","formStep","model","steps","key","next","back","onSubmit","parseSteps","schema"],"mappings":";AAYO,SAASA,EAAeC,IAAiB,GAAc;AAC5D,QAAMC,IAAmBC,EAAW;AAAA,IAClC,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO,CAAA;AAAA,EAAC,CACT,GAEKC,IAAaC,EAAO,MAAM,CAACC,MAAmB;AAClD,UAAMC,IAAcL,EAAI,MAAMI,CAAM;AACpC,eAAW,EAAE,MAAAE,OAAUN,EAAI;AACzB,MAAAA,EAAI,KAAK,MAAM,GAAGA,EAAI,MAAM,OAAO,IAAIM,CAAI,EAAE,EAAE,KAAK,CAACC,MAAU;AAC7D,QAAID,MAASD,EAAY,OACvBE,EAAM,WAAW,SAAS,IAG1BA,EAAM,WAAW,QAAQ;AAAA,MAE7B,CAAC;AAAA,EAEL,CAAC,GAEKC,IAAsBC,EAAM;AAAA,IAChC,QAAQC,GAAOH,GAAO;AACpB,MAAAP,EAAI,QAAQU,GACZV,EAAI,OAAOO,GAAO,MAClBP,EAAI,QAAQO;AAAA,IACd;AAAA,IACA,SAASR;AAAA,IACT,WAAWY,GAAa;AACtB,MAAAH,EAAS,UAAUG;AAAA,IACrB;AAAA,IACA,IAAI,YAAY;AACd,aAAOH,EAAS,UAAUR,EAAI,MAAM,SAAS;AAAA,IAC/C;AAAA,IACA,IAAI,YAAY;AACd,aAAOQ,EAAS,UAAU;AAAA,IAC5B;AAAA,IACA,MAAM,OAAO;AACX,UAAI;AACF,cAAMR,EAAI,KAAK,SAAA,GAEfY,EAAA;AAAA,MACF,QACM;AAAA,MAAC;AAAA,IACT;AAAA,IACA,MAAM,OAAO;AAEX,MAAAC,EAAA;AAAA,IACF;AAAA,IACA,MAAM,OAAOC,GAAU;AACrB,aAAOd,EAAI,MAAM,SAASc,CAAQ;AAAA,IACpC;AAAA,EAAA,CACD,GAEKF,IAAOT,EAAO,MAAM,MAAM;AAAA,IAAA;AAE9B,IAAIK,EAAS,cACXN,EAAWM,EAAS,UAAU,CAAC,GAC/BA,EAAS,WAAWA,EAAS,UAAU,CAAC;AAAA,EAE5C,CAAC,GAEKK,IAAOV,EAAO,MAAM,MAAM;AAAA,IAAA;AAE9B,IAAIK,EAAS,cACXN,EAAWM,EAAS,UAAU,CAAC,GAC/BA,EAAS,WAAWA,EAAS,UAAU,CAAC;AAAA,EAE5C,CAAC;AACD,SAAOA;AACT;AAEO,SAASO,EAAWC,GAAgB;AACzC,QAAMN,IAAsB,CAAA;AAC5B,SAAAM,EAAO,cAAc,CAACA,GAAQV,MAAS;AAAA,IAAA;AAErC,IAAIU,EAAO,aAAa,GAAG,QAAQ,UAAU,IAAI,MAC/CN,EAAM,KAAK;AAAA,MACT,MAAAJ;AAAA,MACA,OAAOU,EAAO,mBAAmB;AAAA,MACjC,QAAAA;AAAAA,MACA,OAAOA,EAAO,WAAW;AAAA,IAAA,CAC1B;AAAA,EAEL,CAAC,GACMN;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.mjs","sources":["../../src/form-tab/hooks.ts"],"sourcesContent":["import type { Schema, SchemaKey } from '@formily/json-schema'\
|
|
1
|
+
{"version":3,"file":"hooks.mjs","sources":["../../src/form-tab/hooks.ts"],"sourcesContent":["import type { Schema, SchemaKey } from '@formily/json-schema'\nimport { observable, reaction } from '@formily/reactive'\nimport { useField, useFieldSchema } from '@silver-formily/vue'\n\nexport type Tabs = { name: SchemaKey, props: any, schema: Schema }[]\n\nexport function useTabs() {\n const tabsField = useField()\n const schema = useFieldSchema()\n const tabs: Tabs = observable([])\n reaction(() => {\n const tabDisplayStatus = schema.value?.mapProperties((schema, name) => {\n const field = tabsField.value\n .query(tabsField.value.address.concat(name))\n .take()\n return field?.display\n })\n return tabDisplayStatus\n }, () => {\n tabs.length = 0\n schema.value?.mapProperties((schema, name) => {\n const field = tabsField.value\n .query(tabsField.value.address.concat(name))\n .take()\n if (field?.display === 'none' || field?.display === 'hidden')\n return\n\n if (schema['x-component']?.indexOf('TabPane') > -1) {\n tabs.push({\n name,\n props: {\n name: schema?.['x-component-props']?.name || name,\n ...schema?.['x-component-props'],\n },\n schema,\n })\n }\n })\n }, {\n fireImmediately: true,\n })\n\n return tabs\n}\n"],"names":["useTabs","tabsField","useField","schema","useFieldSchema","tabs","observable","reaction","name","field"],"mappings":";;AAMO,SAASA,IAAU;AACxB,QAAMC,IAAYC,EAAA,GACZC,IAASC,EAAA,GACTC,IAAaC,EAAW,EAAE;AAChC,SAAAC,EAAS,MACkBJ,EAAO,OAAO,cAAc,CAACA,GAAQK,MAC9CP,EAAU,MACrB,MAAMA,EAAU,MAAM,QAAQ,OAAOO,CAAI,CAAC,EAC1C,KAAA,GACW,OACf,GAEA,MAAM;AACP,IAAAH,EAAK,SAAS,GACdF,EAAO,OAAO,cAAc,CAACA,GAAQK,MAAS;AAC5C,YAAMC,IAAQR,EAAU,MACrB,MAAMA,EAAU,MAAM,QAAQ,OAAOO,CAAI,CAAC,EAC1C,KAAA;AACH,MAAIC,GAAO,YAAY,UAAUA,GAAO,YAAY,YAGhDN,EAAO,aAAa,GAAG,QAAQ,SAAS,IAAI,MAC9CE,EAAK,KAAK;AAAA,QACR,MAAAG;AAAA,QACA,OAAO;AAAA,UACL,MAAML,IAAS,mBAAmB,GAAG,QAAQK;AAAA,UAC7C,GAAGL,IAAS,mBAAmB;AAAA,QAAA;AAAA,QAEjC,QAAAA;AAAAA,MAAA,CACD;AAAA,IAEL,CAAC;AAAA,EACH,GAAG;AAAA,IACD,iBAAiB;AAAA,EAAA,CAClB,GAEME;AACT;"}
|