@silver-formily/element-plus 2.0.1 → 2.2.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/README.en-US.md +32 -0
- package/README.md +32 -35
- package/esm/__builtins__/index.mjs +15 -16
- package/esm/__builtins__/shared/index.mjs +11 -12
- 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 +58 -58
- package/esm/array-base/index.mjs.map +1 -1
- package/esm/array-cards/index.mjs +44 -44
- package/esm/array-cards/index.mjs.map +1 -1
- package/esm/array-collapse/index.mjs +59 -58
- package/esm/array-collapse/index.mjs.map +1 -1
- package/esm/array-items/index.mjs +46 -43
- package/esm/array-items/index.mjs.map +1 -1
- package/esm/array-list-tabs/index.mjs +15 -14
- package/esm/array-list-tabs/index.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 +113 -111
- package/esm/array-table/index.mjs.map +1 -1
- package/esm/array-table/types.d.ts +1 -0
- package/esm/cascader/index.mjs +19 -20
- 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.map +1 -1
- package/esm/editable/editable.d.ts +16 -12
- package/esm/editable/index.d.ts +8 -6
- package/esm/editable/index.mjs +110 -112
- package/esm/editable/index.mjs.map +1 -1
- package/esm/form-button-group/index.mjs +29 -28
- package/esm/form-button-group/index.mjs.map +1 -1
- package/esm/form-collapse/index.mjs +42 -43
- package/esm/form-collapse/index.mjs.map +1 -1
- package/esm/form-dialog/index.d.ts +1 -1
- package/esm/form-dialog/index.mjs +4 -4
- 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 +4 -4
- package/esm/form-drawer/index.mjs.map +1 -1
- package/esm/form-drawer/types.d.ts +6 -6
- package/esm/form-grid/index.d.ts +1 -183
- package/esm/form-grid/index.mjs +1 -1
- 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 +163 -155
- package/esm/form-item/index.mjs.map +1 -1
- package/esm/form-item/types.d.ts +0 -1
- package/esm/form-layout/form-layout.d.ts +0 -1
- package/esm/form-layout/form-layout.mjs +53 -52
- 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 +48 -43
- package/esm/form-layout/utils.mjs.map +1 -1
- package/esm/form-step/index.mjs +27 -25
- package/esm/form-step/index.mjs.map +1 -1
- package/esm/form-tab/index.d.ts +1 -26
- package/esm/form-tab/index.mjs +30 -30
- package/esm/form-tab/index.mjs.map +1 -1
- package/esm/index.d.ts +3 -0
- package/esm/index.mjs +44 -38
- package/esm/index.mjs.map +1 -1
- package/esm/input/index.mjs.map +1 -1
- package/esm/input-number/index.d.ts +258 -147
- 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.d.ts +5 -0
- package/esm/preview-text/index.mjs +165 -141
- package/esm/preview-text/index.mjs.map +1 -1
- package/esm/preview-text/rate.d.ts +5 -0
- package/esm/preview-text/utils.d.ts +5 -5
- package/esm/preview-text/utils.mjs.map +1 -1
- package/esm/radio/index.d.ts +344 -194
- package/esm/radio/index.mjs.map +1 -1
- package/esm/rate/index.d.ts +187 -0
- package/esm/rate/index.mjs +14 -0
- package/esm/rate/index.mjs.map +1 -0
- 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/segmented/index.d.ts +26 -0
- package/esm/segmented/index.mjs +37 -0
- package/esm/segmented/index.mjs.map +1 -0
- package/esm/segmented/segmented.d.ts +25 -0
- package/esm/select/index.mjs +8 -8
- package/esm/select/index.mjs.map +1 -1
- package/esm/select-table/index.d.ts +28 -0
- package/esm/select-table/index.mjs +48 -47
- package/esm/select-table/index.mjs.map +1 -1
- package/esm/select-table/select-table.d.ts +56 -0
- package/esm/slider/index.d.ts +177 -0
- package/esm/slider/index.mjs +14 -0
- package/esm/slider/index.mjs.map +1 -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/time-select/index.d.ts +163 -103
- package/esm/transfer/index.d.ts +196 -115
- package/esm/transfer/index.mjs.map +1 -1
- package/esm/tree/index.mjs +26 -26
- package/esm/tree/index.mjs.map +1 -1
- package/esm/tree-select/index.mjs.map +1 -1
- package/esm/upload/index.d.ts +404 -399
- 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 +8 -9
|
@@ -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,81 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { isValid as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const G = /* @__PURE__ */ w({
|
|
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 { formLayoutIdContext as S, useFormDeepLayout as W, useResponsiveFormLayout as $, filterValidFormLayoutProps as r, formLayoutDeepContext as H, formLayoutShallowContext as V } from "./utils.mjs";
|
|
5
|
+
import { useThrottleFn as E } from "../__builtins__/shared/hooks.mjs";
|
|
6
|
+
import { useCleanAttrs as K } from "../__builtins__/shared/utils.mjs";
|
|
7
|
+
import { stylePrefix as j } from "../__builtins__/configs/index.mjs";
|
|
8
|
+
const Y = /* @__PURE__ */ A({
|
|
10
9
|
name: "FFormLayout",
|
|
11
10
|
inheritAttrs: !1,
|
|
12
11
|
__name: "form-layout",
|
|
13
12
|
props: {
|
|
14
13
|
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 },
|
|
14
|
+
colon: { type: Boolean, default: void 0 },
|
|
15
|
+
labelAlign: {},
|
|
16
|
+
wrapperAlign: {},
|
|
17
|
+
labelWrap: { type: Boolean, default: void 0 },
|
|
18
|
+
labelWidth: {},
|
|
19
|
+
wrapperWidth: {},
|
|
20
|
+
labelCol: {},
|
|
21
|
+
wrapperCol: {},
|
|
22
|
+
fullness: { type: Boolean, default: void 0 },
|
|
25
23
|
size: { default: "default" },
|
|
26
24
|
layout: { default: "horizontal" },
|
|
27
|
-
feedbackLayout:
|
|
28
|
-
tooltipLayout:
|
|
29
|
-
breakpoints:
|
|
25
|
+
feedbackLayout: {},
|
|
26
|
+
tooltipLayout: {},
|
|
27
|
+
breakpoints: {},
|
|
30
28
|
shallow: { type: Boolean, default: !0 },
|
|
31
29
|
hideRequiredAsterisk: { type: Boolean },
|
|
32
30
|
statusIcon: { type: Boolean, default: !0 },
|
|
33
|
-
requireAsteriskPosition:
|
|
31
|
+
requireAsteriskPosition: {}
|
|
34
32
|
},
|
|
35
|
-
setup(
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
setup(c) {
|
|
34
|
+
const o = c, y = `${j}-form`, { props: s } = K(), n = l(), u = o.tag === "form", v = T(), p = d(() => s.value.id ?? `formily-${v.value}`), L = d(() => u ? p.value : s.value.id);
|
|
35
|
+
u && e(S, p);
|
|
36
|
+
const h = W(), { props: a } = $(o, n), C = l({
|
|
37
|
+
...h.value,
|
|
38
|
+
...o.shallow ? {
|
|
39
|
+
size: o.size,
|
|
40
|
+
...z(o.colon) && { colon: o.colon }
|
|
41
|
+
} : r(o)
|
|
42
42
|
});
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
if (!
|
|
48
|
-
const
|
|
49
|
-
|
|
43
|
+
e(H, C);
|
|
44
|
+
const f = l(o.shallow ? r(o) : {});
|
|
45
|
+
e(V, f);
|
|
46
|
+
const k = E(() => {
|
|
47
|
+
if (!D(a.value)) {
|
|
48
|
+
const i = r(a.value);
|
|
49
|
+
f.value = r({ ...o, ...i });
|
|
50
50
|
}
|
|
51
51
|
}, 200, !0);
|
|
52
|
-
|
|
52
|
+
x(() => [o, a], k, {
|
|
53
53
|
deep: !0,
|
|
54
54
|
immediate: !0
|
|
55
|
-
}), s(_, {
|
|
56
|
-
statusIcon: e.statusIcon,
|
|
57
|
-
hideRequiredAsterisk: e.hideRequiredAsterisk,
|
|
58
|
-
requireAsteriskPosition: e.requireAsteriskPosition
|
|
59
55
|
});
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
const w = B({
|
|
57
|
+
size: t(o, "size"),
|
|
58
|
+
statusIcon: t(o, "statusIcon"),
|
|
59
|
+
hideRequiredAsterisk: t(o, "hideRequiredAsterisk"),
|
|
60
|
+
requireAsteriskPosition: t(o, "requireAsteriskPosition")
|
|
61
|
+
});
|
|
62
|
+
return e(M, w), (i, m) => (g(), P(I(o.tag), b({
|
|
63
|
+
id: L.value,
|
|
63
64
|
ref_key: "rootHTMLRef",
|
|
64
|
-
ref:
|
|
65
|
-
class:
|
|
66
|
-
},
|
|
67
|
-
onSubmit:
|
|
65
|
+
ref: n,
|
|
66
|
+
class: y
|
|
67
|
+
}, F(s), {
|
|
68
|
+
onSubmit: m[0] || (m[0] = R(() => {
|
|
68
69
|
}, ["prevent", "stop"]))
|
|
69
70
|
}), {
|
|
70
|
-
default:
|
|
71
|
-
|
|
71
|
+
default: _(() => [
|
|
72
|
+
q(i.$slots, "default")
|
|
72
73
|
]),
|
|
73
74
|
_: 3
|
|
74
75
|
}, 16, ["id"]));
|
|
75
76
|
}
|
|
76
77
|
});
|
|
77
78
|
export {
|
|
78
|
-
|
|
79
|
+
Y as _
|
|
79
80
|
};
|
|
80
81
|
//# 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>\r\nimport type { FormContext } from 'element-plus'\r\nimport type { IFormLayoutProps } from './types'\r\nimport { isEmpty, isValid } from '@formily/shared'\r\nimport {
|
|
1
|
+
{"version":3,"file":"form-layout.mjs","sources":["../../src/form-layout/form-layout.vue"],"sourcesContent":["<script lang=\"ts\" setup>\r\nimport type { FormContext } from 'element-plus'\r\nimport type { IFormLayoutProps } from './types'\r\nimport { isEmpty, isValid } from '@formily/shared'\r\nimport { formContextKey, useId } from 'element-plus'\r\nimport { computed, provide, reactive, ref, toRef, watch } from 'vue'\r\nimport { stylePrefix, useCleanAttrs, useThrottleFn } from '../__builtins__'\r\nimport { filterValidFormLayoutProps, formLayoutDeepContext, formLayoutIdContext, formLayoutShallowContext, useFormDeepLayout, useResponsiveFormLayout } from './utils'\r\n\r\ndefineOptions({\r\n name: 'FFormLayout',\r\n inheritAttrs: false,\r\n})\r\n\r\nconst props = withDefaults(defineProps<IFormLayoutProps>(), {\r\n tag: 'form',\r\n colon: undefined,\r\n labelWrap: undefined,\r\n fullness: undefined,\r\n size: 'default',\r\n layout: 'horizontal',\r\n shallow: true,\r\n statusIcon: true,\r\n asterisk: undefined,\r\n})\r\nconst formPrefixCls = `${stylePrefix}-form`\r\nconst { props: attrs } = useCleanAttrs()\r\nconst rootHTMLRef = ref<HTMLElement>()\r\nconst isFormTag = props.tag === 'form'\r\nconst formLayoutBaseId = useId()\r\nconst formLayoutId = computed(() => attrs.value.id ?? `formily-${formLayoutBaseId.value}`)\r\nconst formLayoutDomId = computed(() => (isFormTag ? formLayoutId.value : attrs.value.id))\r\nif (isFormTag) {\r\n provide(formLayoutIdContext, formLayoutId)\r\n}\r\n\r\nconst formLayoutDeepConfig = useFormDeepLayout()\r\nconst { props: responsiveProps } = useResponsiveFormLayout(props, rootHTMLRef)\r\n\r\nconst deepLayout = ref({\r\n ...formLayoutDeepConfig.value,\r\n ...(props.shallow\r\n ? {\r\n size: props.size,\r\n ...(isValid(props.colon) && { colon: props.colon }),\r\n }\r\n : filterValidFormLayoutProps(props)),\r\n})\r\nprovide(formLayoutDeepContext, deepLayout)\r\n\r\nconst shallowLayout = ref(props.shallow ? filterValidFormLayoutProps(props) : {})\r\nprovide(formLayoutShallowContext, shallowLayout)\r\n\r\nconst updateLayout = useThrottleFn(() => {\r\n if (!isEmpty(responsiveProps.value)) {\r\n const _responsiveProps = filterValidFormLayoutProps(responsiveProps.value)\r\n shallowLayout.value = filterValidFormLayoutProps({ ...props, ..._responsiveProps })\r\n }\r\n}, 200, true)\r\n\r\nwatch(() => [props, responsiveProps], updateLayout, {\r\n deep: true,\r\n immediate: true,\r\n})\r\n\r\nconst formContext = reactive({\r\n size: toRef(props, 'size'),\r\n statusIcon: toRef(props, 'statusIcon'),\r\n hideRequiredAsterisk: toRef(props, 'hideRequiredAsterisk'),\r\n requireAsteriskPosition: toRef(props, 'requireAsteriskPosition'),\r\n})\r\nprovide(formContextKey, formContext as FormContext)\r\n</script>\r\n\r\n<template>\r\n <component\r\n :is=\"props.tag\"\r\n :id=\"formLayoutDomId\"\r\n ref=\"rootHTMLRef\"\r\n :class=\"formPrefixCls\"\r\n v-bind=\"attrs\"\r\n @submit.prevent.stop\r\n >\r\n <slot />\r\n </component>\r\n</template>\r\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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EAAQoB,GAAgBH,CAA0B,cAIhDI,KAAAC,EASYC,EARLrC,EAAM,GAAG,GADhBsC,EASY;AAAA,MAPT,IAAIzB,EAAA;AAAA,eACD;AAAA,MAAJ,KAAIP;AAAA,MACH,OAAOJ;AAAA,IAAA,GACAqC,EAAAnC,CAAA,GAAK;AAAA,MACZ,4BAAD,MAAA;AAAA,MAAA,GAAoB,CAAA,WAAA,MAAA,CAAA;AAAA,IAAA;iBAEpB,MAAQ;AAAA,QAARoC,EAAQC,EAAA,QAAA,SAAA;AAAA,MAAA;;;;;"}
|
|
@@ -6,7 +6,6 @@ export interface IFormLayoutProps {
|
|
|
6
6
|
labelWrap?: boolean;
|
|
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,79 @@
|
|
|
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
|
-
function
|
|
4
|
+
function A(t, o) {
|
|
5
5
|
for (const [r, e] of t.entries())
|
|
6
6
|
if (o <= e)
|
|
7
7
|
return r;
|
|
8
8
|
return -1;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function C(t, o) {
|
|
11
11
|
if (!Array.isArray(t) || t.length === 0)
|
|
12
12
|
return t;
|
|
13
13
|
const r = Math.max(-1, Math.min(o, t.length - 1));
|
|
14
14
|
return t.at(r);
|
|
15
15
|
}
|
|
16
16
|
function a(t, o) {
|
|
17
|
-
return u(t) ?
|
|
17
|
+
return u(t) ? C(t, o) : t;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function x(t, o) {
|
|
20
20
|
const { clientWidth: r } = t, {
|
|
21
21
|
breakpoints: e,
|
|
22
22
|
layout: p,
|
|
23
|
-
labelAlign:
|
|
24
|
-
wrapperAlign:
|
|
25
|
-
labelCol:
|
|
26
|
-
wrapperCol:
|
|
27
|
-
...
|
|
28
|
-
} = o, n =
|
|
23
|
+
labelAlign: f,
|
|
24
|
+
wrapperAlign: m,
|
|
25
|
+
labelCol: y,
|
|
26
|
+
wrapperCol: b,
|
|
27
|
+
...L
|
|
28
|
+
} = o, n = A(
|
|
29
29
|
e,
|
|
30
30
|
r
|
|
31
31
|
);
|
|
32
32
|
return {
|
|
33
33
|
layout: a(p, n),
|
|
34
|
-
labelAlign: a(
|
|
35
|
-
wrapperAlign: a(
|
|
36
|
-
labelCol: a(
|
|
37
|
-
wrapperCol: a(
|
|
38
|
-
...
|
|
34
|
+
labelAlign: a(f, n),
|
|
35
|
+
wrapperAlign: a(m, n),
|
|
36
|
+
labelCol: a(y, n),
|
|
37
|
+
wrapperCol: a(b, n),
|
|
38
|
+
...L
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function P(t, o) {
|
|
42
42
|
const { breakpoints: r } = t;
|
|
43
|
-
if (!
|
|
43
|
+
if (!d(r))
|
|
44
44
|
return {
|
|
45
|
-
props:
|
|
45
|
+
props: i(t)
|
|
46
46
|
};
|
|
47
|
-
const e =
|
|
47
|
+
const e = i({});
|
|
48
48
|
return h(o, () => {
|
|
49
|
-
e.value =
|
|
49
|
+
e.value = x(o.value, t);
|
|
50
50
|
}), {
|
|
51
51
|
props: e
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
const
|
|
54
|
+
const c = Symbol(
|
|
55
55
|
"formLayoutDeepContext"
|
|
56
|
-
),
|
|
57
|
-
function P() {
|
|
58
|
-
return i(s, l({}));
|
|
59
|
-
}
|
|
56
|
+
), w = Symbol("formLayoutShallowContext"), k = Symbol("formLayoutIdContext");
|
|
60
57
|
function S() {
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
return l(c, i({}));
|
|
59
|
+
}
|
|
60
|
+
function O() {
|
|
61
|
+
const t = l(w, i({})), o = l(c, i({}));
|
|
62
|
+
return s(() => ({
|
|
63
63
|
...o.value,
|
|
64
64
|
...t.value
|
|
65
65
|
}));
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
function R() {
|
|
68
|
+
return l(k, s(() => ""));
|
|
69
|
+
}
|
|
70
|
+
const W = [
|
|
68
71
|
"colon",
|
|
69
72
|
"labelAlign",
|
|
70
73
|
"wrapperAlign",
|
|
71
74
|
"labelWrap",
|
|
72
75
|
"labelWidth",
|
|
73
76
|
"wrapperWidth",
|
|
74
|
-
"wrapperWrap",
|
|
75
77
|
"labelCol",
|
|
76
78
|
"wrapperCol",
|
|
77
79
|
"fullness",
|
|
@@ -81,24 +83,27 @@ const R = [
|
|
|
81
83
|
"tooltipLayout",
|
|
82
84
|
"breakpoints",
|
|
83
85
|
"hideRequiredAsterisk",
|
|
84
|
-
"statusIcon"
|
|
86
|
+
"statusIcon",
|
|
87
|
+
"requireAsteriskPosition"
|
|
85
88
|
];
|
|
86
|
-
function
|
|
89
|
+
function _(t) {
|
|
87
90
|
return Object.fromEntries(
|
|
88
91
|
Object.entries(t).filter(([o, r]) => u(r))
|
|
89
92
|
);
|
|
90
93
|
}
|
|
91
94
|
export {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
W as FORM_LAYOUT_PROPS_KEYS,
|
|
96
|
+
A as calcBreakpointIndex,
|
|
97
|
+
C as calcFactor,
|
|
98
|
+
x as calculateProps,
|
|
96
99
|
a as factor,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
S as
|
|
102
|
-
O as
|
|
100
|
+
_ as filterValidFormLayoutProps,
|
|
101
|
+
c as formLayoutDeepContext,
|
|
102
|
+
k as formLayoutIdContext,
|
|
103
|
+
w as formLayoutShallowContext,
|
|
104
|
+
S as useFormDeepLayout,
|
|
105
|
+
O as useFormLayout,
|
|
106
|
+
R as useFormLayoutId,
|
|
107
|
+
P as useResponsiveFormLayout
|
|
103
108
|
};
|
|
104
109
|
//# 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'\r\nimport type { IFormLayoutProps } from './types'\r\nimport { isArr, isValid } from '@formily/shared'\r\nimport { computed, inject, ref } from 'vue'\r\nimport { useResizeObserver } from '../__builtins__'\r\n\r\nexport function calcBreakpointIndex(breakpoints: number[], width: number): number {\r\n for (const [i, breakpoint] of breakpoints.entries()) {\r\n if (width <= breakpoint) {\r\n return i\r\n }\r\n }\r\n return -1\r\n}\r\n\r\nexport function calcFactor<T>(value: T | readonly T[], breakpointIndex: number): T {\r\n if (!Array.isArray(value) || value.length === 0) {\r\n return value as T\r\n }\r\n const safeIndex = Math.max(-1, Math.min(breakpointIndex, value.length - 1))\r\n return value.at(safeIndex)\r\n}\r\n\r\nexport function factor<T>(value: T | T[], breakpointIndex: number): T {\r\n return isValid(value) ? calcFactor<T>(value, breakpointIndex) : value as T\r\n}\r\n\r\nexport function calculateProps(target: Element, props: IFormLayoutProps): IFormLayoutProps {\r\n const { clientWidth } = target\r\n const {\r\n breakpoints,\r\n layout,\r\n labelAlign,\r\n wrapperAlign,\r\n labelCol,\r\n wrapperCol,\r\n ...otherProps\r\n } = props\r\n const breakpointIndex = calcBreakpointIndex(\r\n breakpoints as number[],\r\n clientWidth,\r\n )\r\n\r\n return {\r\n layout: factor(layout, breakpointIndex),\r\n labelAlign: factor(labelAlign, breakpointIndex),\r\n wrapperAlign: factor(wrapperAlign, breakpointIndex),\r\n labelCol: factor(labelCol, breakpointIndex),\r\n wrapperCol: factor(wrapperCol, breakpointIndex),\r\n ...otherProps,\r\n }\r\n}\r\n\r\nexport function useResponsiveFormLayout(props: IFormLayoutProps, root: Ref<HTMLElement | null>) {\r\n const { breakpoints } = props\r\n if (!isArr(breakpoints)) {\r\n return {\r\n props: ref(props),\r\n }\r\n }\r\n\r\n const layoutProps = ref<IFormLayoutProps>({})\r\n\r\n useResizeObserver(root, () => {\r\n layoutProps.value = calculateProps(root.value, props)\r\n })\r\n\r\n return {\r\n props: layoutProps,\r\n }\r\n}\r\n\r\nexport const formLayoutDeepContext: InjectionKey<Ref<IFormLayoutProps>> = Symbol(\r\n 'formLayoutDeepContext',\r\n)\r\n\r\nexport const formLayoutShallowContext: InjectionKey<Ref<IFormLayoutProps>>\r\n = Symbol('formLayoutShallowContext')\r\n\r\nexport function useFormDeepLayout(): Ref<IFormLayoutProps> {\r\n return inject(formLayoutDeepContext, ref({}))\r\n}\r\n\r\nexport function useFormLayout(): Ref<IFormLayoutProps> {\r\n const shallowLayout = inject(formLayoutShallowContext, ref({}))\r\n const deepLayout = inject(formLayoutDeepContext, ref({}))\r\n\r\n const formLayout = computed(() => {\r\n return {\r\n ...deepLayout.value,\r\n ...shallowLayout.value,\r\n }\r\n })\r\n\r\n return formLayout\r\n}\r\n\r\nexport const FORM_LAYOUT_PROPS_KEYS: ReadonlyArray<keyof IFormLayoutProps> = [\r\n 'colon',\r\n 'labelAlign',\r\n 'wrapperAlign',\r\n 'labelWrap',\r\n 'labelWidth',\r\n 'wrapperWidth',\r\n '
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../src/form-layout/utils.ts"],"sourcesContent":["import type { ComputedRef, InjectionKey, Ref } from 'vue'\r\nimport type { IFormLayoutProps } from './types'\r\nimport { isArr, isValid } from '@formily/shared'\r\nimport { computed, inject, ref } from 'vue'\r\nimport { useResizeObserver } from '../__builtins__'\r\n\r\nexport function calcBreakpointIndex(breakpoints: number[], width: number): number {\r\n for (const [i, breakpoint] of breakpoints.entries()) {\r\n if (width <= breakpoint) {\r\n return i\r\n }\r\n }\r\n return -1\r\n}\r\n\r\nexport function calcFactor<T>(value: T | readonly T[], breakpointIndex: number): T {\r\n if (!Array.isArray(value) || value.length === 0) {\r\n return value as T\r\n }\r\n const safeIndex = Math.max(-1, Math.min(breakpointIndex, value.length - 1))\r\n return value.at(safeIndex)\r\n}\r\n\r\nexport function factor<T>(value: T | T[], breakpointIndex: number): T {\r\n return isValid(value) ? calcFactor<T>(value, breakpointIndex) : value as T\r\n}\r\n\r\nexport function calculateProps(target: Element, props: IFormLayoutProps): IFormLayoutProps {\r\n const { clientWidth } = target\r\n const {\r\n breakpoints,\r\n layout,\r\n labelAlign,\r\n wrapperAlign,\r\n labelCol,\r\n wrapperCol,\r\n ...otherProps\r\n } = props\r\n const breakpointIndex = calcBreakpointIndex(\r\n breakpoints as number[],\r\n clientWidth,\r\n )\r\n\r\n return {\r\n layout: factor(layout, breakpointIndex),\r\n labelAlign: factor(labelAlign, breakpointIndex),\r\n wrapperAlign: factor(wrapperAlign, breakpointIndex),\r\n labelCol: factor(labelCol, breakpointIndex),\r\n wrapperCol: factor(wrapperCol, breakpointIndex),\r\n ...otherProps,\r\n }\r\n}\r\n\r\nexport function useResponsiveFormLayout(props: IFormLayoutProps, root: Ref<HTMLElement | null>) {\r\n const { breakpoints } = props\r\n if (!isArr(breakpoints)) {\r\n return {\r\n props: ref(props),\r\n }\r\n }\r\n\r\n const layoutProps = ref<IFormLayoutProps>({})\r\n\r\n useResizeObserver(root, () => {\r\n layoutProps.value = calculateProps(root.value, props)\r\n })\r\n\r\n return {\r\n props: layoutProps,\r\n }\r\n}\r\n\r\nexport const formLayoutDeepContext: InjectionKey<Ref<IFormLayoutProps>> = Symbol(\r\n 'formLayoutDeepContext',\r\n)\r\n\r\nexport const formLayoutShallowContext: InjectionKey<Ref<IFormLayoutProps>>\r\n = Symbol('formLayoutShallowContext')\r\n\r\nexport const formLayoutIdContext: InjectionKey<ComputedRef<string>>\r\n = Symbol('formLayoutIdContext')\r\n\r\nexport function useFormDeepLayout(): Ref<IFormLayoutProps> {\r\n return inject(formLayoutDeepContext, ref({}))\r\n}\r\n\r\nexport function useFormLayout(): Ref<IFormLayoutProps> {\r\n const shallowLayout = inject(formLayoutShallowContext, ref({}))\r\n const deepLayout = inject(formLayoutDeepContext, ref({}))\r\n\r\n const formLayout = computed(() => {\r\n return {\r\n ...deepLayout.value,\r\n ...shallowLayout.value,\r\n }\r\n })\r\n\r\n return formLayout\r\n}\r\n\r\nexport function useFormLayoutId(): ComputedRef<string> {\r\n return inject(formLayoutIdContext, computed(() => ''))\r\n}\r\n\r\nexport const FORM_LAYOUT_PROPS_KEYS: ReadonlyArray<keyof IFormLayoutProps> = [\r\n 'colon',\r\n 'labelAlign',\r\n 'wrapperAlign',\r\n 'labelWrap',\r\n 'labelWidth',\r\n 'wrapperWidth',\r\n 'labelCol',\r\n 'wrapperCol',\r\n 'fullness',\r\n 'size',\r\n 'layout',\r\n 'feedbackLayout',\r\n 'tooltipLayout',\r\n 'breakpoints',\r\n 'hideRequiredAsterisk',\r\n 'statusIcon',\r\n 'requireAsteriskPosition',\r\n] as const\r\n\r\nexport function filterValidFormLayoutProps(props: IFormLayoutProps): IFormLayoutProps {\r\n return Object.fromEntries(\r\n Object.entries(props)\r\n .filter(([_, value]) => isValid(value)),\r\n )\r\n}\r\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","useFormL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pB,QAAMY,IAAcD,EAAsB,EAAE;AAE5C,SAAAE,EAAkBJ,GAAM,MAAM;AAC5B,IAAAG,EAAY,QAAQd,EAAeW,EAAK,OAAOT,CAAK;AAAA,EACtD,CAAC,GAEM;AAAA,IACL,OAAOY;AAAA,EAAA;AAEX;AAEO,MAAME,IAA6D;AAAA,EACxE;AACF,GAEaC,IACT,OAAO,0BAA0B,GAExBC,IACT,OAAO,qBAAqB;AAEzB,SAASC,IAA2C;AACzD,SAAOC,EAAOJ,GAAuBH,EAAI,CAAA,CAAE,CAAC;AAC9C;AAEO,SAASQ,IAAuC;AACrD,QAAMC,IAAgBF,EAAOH,GAA0BJ,EAAI,CAAA,CAAE,CAAC,GACxDU,IAAaH,EAAOJ,GAAuBH,EAAI,CAAA,CAAE,CAAC;AASxD,SAPmBW,EAAS,OACnB;AAAA,IACL,GAAGD,EAAW;AAAA,IACd,GAAGD,EAAc;AAAA,EAAA,EAEpB;AAGH;AAEO,SAASG,IAAuC;AACrD,SAAOL,EAAOF,GAAqBM,EAAS,MAAM,EAAE,CAAC;AACvD;AAEO,MAAME,IAAgE;AAAA,EAC3E;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,SAASC,EAA2BzB,GAA2C;AACpF,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQA,CAAK,EACjB,OAAO,CAAC,CAAC0B,GAAGjC,CAAK,MAAMI,EAAQJ,CAAK,CAAC;AAAA,EAAA;AAE5C;"}
|
package/esm/form-step/index.mjs
CHANGED
|
@@ -1,44 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { defineComponent as $, renderSlot as P, computed as B, createElementBlock as o, openBlock as r, normalizeClass as E, createVNode as N, unref as t, mergeProps as h, withCtx as u, Fragment as c, renderList as x, createBlock as m, createSlots as V, resolveDynamicComponent as _, createTextVNode as v, toDisplayString as y, createCommentVNode as b } from "vue";
|
|
1
|
+
import { defineComponent as $, renderSlot as g, 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 m, createSlots as N, resolveDynamicComponent as _, createTextVNode as v, toDisplayString as y, createCommentVNode as O } from "vue";
|
|
3
2
|
import { isObj as k } from "@formily/shared";
|
|
4
|
-
import {
|
|
3
|
+
import { useObserver as V } from "@silver-formily/reactive-vue";
|
|
4
|
+
import { useField as b, useFieldSchema as A, RecursionField as D } from "@silver-formily/vue";
|
|
5
5
|
import { ElSteps as R, ElStep as j } from "element-plus";
|
|
6
|
-
import { createFormStep as
|
|
6
|
+
import { createFormStep as C, parseSteps as w } from "./utils.mjs";
|
|
7
7
|
import { stylePrefix as z } from "../__builtins__/configs/index.mjs";
|
|
8
|
-
import { composeExport as
|
|
9
|
-
const
|
|
8
|
+
import { composeExport as L } from "../__builtins__/shared/utils.mjs";
|
|
9
|
+
const T = $({
|
|
10
10
|
name: "FFormStepPane",
|
|
11
11
|
inheritAttrs: !1
|
|
12
|
-
}),
|
|
12
|
+
}), q = (n, i) => {
|
|
13
13
|
const a = n.__vccOpts || n;
|
|
14
14
|
for (const [s, p] of i)
|
|
15
15
|
a[s] = p;
|
|
16
16
|
return a;
|
|
17
17
|
};
|
|
18
|
-
function
|
|
19
|
-
return
|
|
18
|
+
function G(n, i, a, s, p, f) {
|
|
19
|
+
return g(n.$slots, "default");
|
|
20
20
|
}
|
|
21
|
-
const
|
|
21
|
+
const H = /* @__PURE__ */ q(T, [["render", G]]), I = /* @__PURE__ */ $({
|
|
22
22
|
name: "FFormStep",
|
|
23
23
|
inheritAttrs: !1,
|
|
24
24
|
__name: "form-step",
|
|
25
25
|
props: {
|
|
26
|
-
formStep: { default: () =>
|
|
27
|
-
active:
|
|
26
|
+
formStep: { default: () => C() },
|
|
27
|
+
active: {}
|
|
28
28
|
},
|
|
29
29
|
setup(n) {
|
|
30
|
-
const i = n
|
|
30
|
+
const i = n;
|
|
31
|
+
V();
|
|
32
|
+
const a = b().value, s = `${z}-form-step`, p = A(), f = w(p.value);
|
|
31
33
|
i.formStep.connect?.(f, a);
|
|
32
|
-
const F =
|
|
33
|
-
return (
|
|
34
|
-
class:
|
|
34
|
+
const F = P(() => i.active ?? i.formStep?.current ?? 0);
|
|
35
|
+
return (S, J) => (r(), o("div", {
|
|
36
|
+
class: B(s)
|
|
35
37
|
}, [
|
|
36
|
-
|
|
38
|
+
E(t(R), h(S.$attrs, {
|
|
37
39
|
active: F.value,
|
|
38
40
|
style: [{ marginBottom: "10px" }]
|
|
39
41
|
}), {
|
|
40
42
|
default: u(() => [
|
|
41
|
-
(r(!0), o(c, null, x(t(f), ({ props: l, slots: e }, d) => (r(), m(t(j), h({ key: d }, { ref_for: !0 }, l),
|
|
43
|
+
(r(!0), o(c, null, x(t(f), ({ props: l, slots: e }, d) => (r(), m(t(j), h({ key: d }, { ref_for: !0 }, l), N({ _: 2 }, [
|
|
42
44
|
e?.title ? {
|
|
43
45
|
name: "title",
|
|
44
46
|
fn: u(() => [
|
|
@@ -71,20 +73,20 @@ const G = /* @__PURE__ */ T(L, [["render", q]]), H = /* @__PURE__ */ $({
|
|
|
71
73
|
_: 1
|
|
72
74
|
}, 16, ["active"]),
|
|
73
75
|
(r(!0), o(c, null, x(t(f), ({ name: l, schema: e }, d) => (r(), o(c, { key: l }, [
|
|
74
|
-
d === F.value ? (r(), m(t(
|
|
76
|
+
d === F.value ? (r(), m(t(D), {
|
|
75
77
|
key: 0,
|
|
76
78
|
name: l,
|
|
77
79
|
schema: e
|
|
78
|
-
}, null, 8, ["name", "schema"])) :
|
|
80
|
+
}, null, 8, ["name", "schema"])) : O("", !0)
|
|
79
81
|
], 64))), 128))
|
|
80
82
|
]));
|
|
81
83
|
}
|
|
82
|
-
}),
|
|
83
|
-
StepPane:
|
|
84
|
-
createFormStep:
|
|
84
|
+
}), ee = L(I, {
|
|
85
|
+
StepPane: H,
|
|
86
|
+
createFormStep: C
|
|
85
87
|
});
|
|
86
88
|
export {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
ee as FormStep,
|
|
90
|
+
ee as default
|
|
89
91
|
};
|
|
90
92
|
//# 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-pane.vue","../../src/form-step/form-step.vue","../../src/form-step/index.ts"],"sourcesContent":["<script lang=\"ts\">\r\nimport { defineComponent } from 'vue'\r\n\r\nexport default defineComponent({\r\n name: 'FFormStepPane',\r\n inheritAttrs: false,\r\n})\r\n</script>\r\n\r\n<template>\r\n <slot />\r\n</template>\r\n","<script lang=\"ts\">\r\nimport { defineComponent } from 'vue'\r\n\r\nexport default defineComponent({\r\n name: 'FFormStepPane',\r\n inheritAttrs: false,\r\n})\r\n</script>\r\n\r\n<template>\r\n <slot />\r\n</template>\r\n","<script setup lang=\"ts\">\r\nimport type { VoidField } from '@formily/core'\r\nimport type { IFormStepProps } from './types'\r\nimport { isObj } from '@formily/shared'\r\nimport { RecursionField, useField, useFieldSchema } from '@silver-formily/vue'\r\nimport { ElStep, ElSteps } from 'element-plus'\r\nimport { computed } from 'vue'\r\nimport { stylePrefix } from '../__builtins__'\r\nimport { createFormStep, parseSteps } from './utils'\r\n\r\ndefineOptions({\r\n name: 'FFormStep',\r\n inheritAttrs: false,\r\n})\r\n\r\nconst props = defineProps({\n formStep:
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/form-step/form-step-pane.vue","../../src/form-step/form-step-pane.vue","../../src/form-step/form-step.vue","../../src/form-step/index.ts"],"sourcesContent":["<script lang=\"ts\">\r\nimport { defineComponent } from 'vue'\r\n\r\nexport default defineComponent({\r\n name: 'FFormStepPane',\r\n inheritAttrs: false,\r\n})\r\n</script>\r\n\r\n<template>\r\n <slot />\r\n</template>\r\n","<script lang=\"ts\">\r\nimport { defineComponent } from 'vue'\r\n\r\nexport default defineComponent({\r\n name: 'FFormStepPane',\r\n inheritAttrs: false,\r\n})\r\n</script>\r\n\r\n<template>\r\n <slot />\r\n</template>\r\n","<script setup lang=\"ts\">\r\nimport type { VoidField } from '@formily/core'\r\nimport type { IFormStepProps } from './types'\r\nimport { isObj } from '@formily/shared'\r\nimport { useObserver } from '@silver-formily/reactive-vue'\r\nimport { RecursionField, useField, useFieldSchema } from '@silver-formily/vue'\r\nimport { ElStep, ElSteps } from 'element-plus'\r\nimport { computed } from 'vue'\r\nimport { stylePrefix } from '../__builtins__'\r\nimport { createFormStep, parseSteps } from './utils'\r\n\r\ndefineOptions({\r\n name: 'FFormStep',\r\n inheritAttrs: false,\r\n})\r\n\r\nconst props = withDefaults(defineProps<IFormStepProps>(), {\r\n formStep: () => createFormStep(),\r\n})\r\n\r\nuseObserver()\r\n\r\nconst field = useField<VoidField>().value\r\nconst prefixCls = `${stylePrefix}-form-step`\r\nconst fieldSchemaRef = useFieldSchema()\r\n\r\nconst steps = parseSteps(fieldSchemaRef.value)\r\n\r\nprops.formStep.connect?.(steps, field)\r\n\r\nconst current = computed(() => props.active ?? props.formStep?.current ?? 0)\r\n</script>\r\n\r\n<template>\r\n <div :class=\"prefixCls\">\r\n <ElSteps\r\n v-bind=\"$attrs\"\r\n :active=\"current\"\r\n :style=\"[{ marginBottom: '10px' }]\"\r\n >\r\n <ElStep\r\n v-for=\"({ props: stepProps, slots: stepSlots }, key) of steps\"\r\n :key=\"key\"\r\n v-bind=\"stepProps\"\r\n >\r\n <template v-if=\"stepSlots?.title\" #title>\r\n <template v-if=\"isObj(stepSlots.title)\">\r\n <component :is=\"stepSlots.title\" />\r\n </template>\r\n <template v-else>\r\n {{ stepSlots.title }}\r\n </template>\r\n </template>\r\n <template v-if=\"stepSlots?.icon\" #icon>\r\n <template v-if=\"isObj(stepSlots.icon)\">\r\n <component :is=\"stepSlots.icon\" />\r\n </template>\r\n <template v-else>\r\n {{ stepSlots.icon }}\r\n </template>\r\n </template>\r\n <template v-if=\"stepSlots?.description\" #description>\r\n <template v-if=\"isObj(stepSlots.description)\">\r\n <component :is=\"stepSlots.description\" />\r\n </template>\r\n <template v-else>\r\n {{ stepSlots.description }}\r\n </template>\r\n </template>\r\n </ElStep>\r\n </ElSteps>\r\n\r\n <template v-for=\"({ name, schema }, key) of steps\" :key=\"name\">\r\n <RecursionField\r\n v-if=\"key === current\"\r\n :name=\"name\"\r\n :schema=\"schema\"\r\n />\r\n </template>\r\n </div>\r\n</template>\r\n","import { composeExport } from '../__builtins__'\r\nimport FFormStepPane from './form-step-pane.vue'\r\nimport FFormStep from './form-step.vue'\r\nimport { createFormStep } from './utils'\r\n\r\nexport const FormStep = composeExport(FFormStep, {\r\n StepPane: FFormStepPane,\r\n createFormStep,\r\n})\r\n\r\nexport default FormStep\r\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;;;;;;;SCICC,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,UA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WAAW,GAAA,CAAA;AAAA,gBAAA;;;;;;;;OAMhCH,EAAA,EAAA,GAAAL,EAMWM,WANiCJ,EAAAN,CAAA,GAAK,CAAA,EAA7B,MAAAoB,GAAM,QAAAC,EAAA,GAAUR,wBAAqBO,KAAI;AAAA,QAEnDP,MAAQX,EAAA,cADhBY,EAIER,EAAAgB,CAAA,GAAA;AAAA;UAFC,MAAAF;AAAA,UACA,QAAAC;AAAA,QAAA;;;;ICvEIE,KAAWC,EAAcC,GAAW;AAAA,EAC/C,UAAUC;AAAA,EACV,gBAAAC;AACF,CAAC;"}
|
package/esm/form-tab/index.d.ts
CHANGED
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const composeFormTab: {
|
|
3
|
-
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./types').IFormTabProps> & Readonly<{
|
|
4
|
-
"onUpdate:modelValue"?: (...args: any[]) => any;
|
|
5
|
-
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
6
|
-
"update:modelValue": (...args: any[]) => void;
|
|
7
|
-
}, import('vue').PublicProps, {}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
|
|
8
|
-
P: {};
|
|
9
|
-
B: {};
|
|
10
|
-
D: {};
|
|
11
|
-
C: {};
|
|
12
|
-
M: {};
|
|
13
|
-
Defaults: {};
|
|
14
|
-
}, Readonly<import('./types').IFormTabProps> & Readonly<{
|
|
15
|
-
"onUpdate:modelValue"?: (...args: any[]) => any;
|
|
16
|
-
}>, {}, {}, {}, {}, {}>;
|
|
17
|
-
__isFragment?: never;
|
|
18
|
-
__isTeleport?: never;
|
|
19
|
-
__isSuspense?: never;
|
|
20
|
-
} & import('vue').ComponentOptionsBase<Readonly<import('./types').IFormTabProps> & Readonly<{
|
|
21
|
-
"onUpdate:modelValue"?: (...args: any[]) => any;
|
|
22
|
-
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
23
|
-
"update:modelValue": (...args: any[]) => void;
|
|
24
|
-
}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & {
|
|
25
|
-
createFormTab: typeof createFormTab;
|
|
26
|
-
};
|
|
1
|
+
export declare const composeFormTab: any;
|
|
27
2
|
export { composeFormTab as FormTab };
|
|
28
3
|
export default composeFormTab;
|