@silver-formily/element-plus 2.3.0 → 3.0.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/esm/__builtins__/index.mjs +20 -19
- package/esm/__builtins__/shared/index.mjs +11 -10
- package/esm/__builtins__/shared/transform-component.d.ts +1 -1
- package/esm/__builtins__/shared/utils.d.ts +1 -0
- package/esm/__builtins__/shared/utils.mjs +22 -18
- package/esm/__builtins__/shared/utils.mjs.map +1 -1
- package/esm/array-base/index.mjs +27 -27
- package/esm/array-base/index.mjs.map +1 -1
- package/esm/array-base/symbols.mjs +1 -1
- package/esm/array-base/symbols.mjs.map +1 -1
- package/esm/array-base/utils.d.ts +0 -1
- package/esm/array-base/utils.mjs +27 -35
- package/esm/array-base/utils.mjs.map +1 -1
- package/esm/array-cards/index.mjs +1 -1
- package/esm/array-cards/index.mjs.map +1 -1
- package/esm/array-collapse/index.mjs +2 -5
- package/esm/array-collapse/index.mjs.map +1 -1
- package/esm/array-items/index.mjs +1 -1
- package/esm/array-list-tabs/index.mjs +9 -9
- package/esm/array-table/index.mjs +7 -9
- package/esm/array-table/index.mjs.map +1 -1
- package/esm/array-tabs/index.mjs +1 -2
- package/esm/array-tabs/index.mjs.map +1 -1
- package/esm/autocomplete/autocomplete.d.ts +16 -16
- package/esm/autocomplete/index.d.ts +8 -8
- package/esm/autocomplete/index.mjs +2 -2
- package/esm/autocomplete/index.mjs.map +1 -1
- package/esm/cascader/index.mjs +2 -2
- package/esm/checkbox/index.d.ts +27 -27
- package/esm/checkbox/index.mjs +7 -12
- package/esm/checkbox/index.mjs.map +1 -1
- package/esm/editable/editable.d.ts +14 -12
- package/esm/editable/index.d.ts +7 -6
- package/esm/editable/index.mjs +57 -61
- package/esm/editable/index.mjs.map +1 -1
- package/esm/env.d.d.ts +1 -0
- package/esm/form/form.mjs +5 -5
- package/esm/form-button-group/form-button-group.d.ts +9 -0
- package/esm/form-button-group/index.d.ts +15 -0
- package/esm/form-button-group/index.mjs +33 -25
- package/esm/form-button-group/index.mjs.map +1 -1
- package/esm/form-collapse/index.mjs +1 -1
- package/esm/form-collapse/utils.mjs +0 -2
- package/esm/form-collapse/utils.mjs.map +1 -1
- package/esm/form-dialog/index.mjs +63 -70
- package/esm/form-dialog/index.mjs.map +1 -1
- package/esm/form-drawer/index.mjs +62 -69
- package/esm/form-drawer/index.mjs.map +1 -1
- package/esm/form-grid/form-grid.d.ts +2 -2
- package/esm/form-grid/hooks.d.ts +1 -2
- package/esm/form-grid/hooks.mjs +4 -11
- package/esm/form-grid/hooks.mjs.map +1 -1
- package/esm/form-grid/index.mjs +38 -35
- package/esm/form-grid/index.mjs.map +1 -1
- package/esm/form-item/index.d.ts +1 -0
- package/esm/form-item/index.mjs +102 -107
- package/esm/form-item/index.mjs.map +1 -1
- package/esm/form-item/types.d.ts +12 -6
- package/esm/form-layout/form-layout.mjs +2 -2
- package/esm/form-layout/utils.mjs +24 -24
- package/esm/form-layout/utils.mjs.map +1 -1
- package/esm/form-step/index.mjs +2 -2
- package/esm/form-step/utils.mjs +0 -3
- package/esm/form-step/utils.mjs.map +1 -1
- package/esm/form-tab/hooks.d.ts +2 -1
- package/esm/form-tab/hooks.mjs +13 -20
- package/esm/form-tab/hooks.mjs.map +1 -1
- package/esm/form-tab/index.mjs +38 -39
- package/esm/form-tab/index.mjs.map +1 -1
- package/esm/index.d.ts +2 -0
- package/esm/index.mjs +62 -58
- package/esm/index.mjs.map +1 -1
- package/esm/input/index.mjs +2 -2
- package/esm/input-number/index.d.ts +15 -15
- package/esm/input-tag/index.mjs +2 -2
- package/esm/mention/index.mjs +2 -2
- package/esm/pagination/pagination.mjs +1 -1
- package/esm/pagination/pagination.mjs.map +1 -1
- package/esm/preview-text/index.mjs +33 -42
- package/esm/preview-text/index.mjs.map +1 -1
- package/esm/preview-text/utils.mjs +1 -1
- package/esm/preview-text/utils.mjs.map +1 -1
- package/esm/query-form/default-components.d.ts +5 -0
- package/esm/query-form/default-components.mjs +47 -0
- package/esm/query-form/default-components.mjs.map +1 -0
- package/esm/query-form/hooks.d.ts +25 -0
- package/esm/query-form/hooks.mjs +29 -0
- package/esm/query-form/hooks.mjs.map +1 -0
- package/esm/query-form/index.d.ts +117 -0
- package/esm/query-form/index.mjs +331 -0
- package/esm/query-form/index.mjs.map +1 -0
- package/esm/query-form/query-form-light.d.ts +27 -0
- package/esm/query-form/query-form.d.ts +52 -0
- package/esm/query-form/types.d.ts +44 -0
- package/esm/query-form/types.mjs +2 -0
- package/esm/query-form/types.mjs.map +1 -0
- package/esm/query-form-item/index.d.ts +151 -0
- package/esm/query-form-item/index.mjs +181 -0
- package/esm/query-form-item/index.mjs.map +1 -0
- package/esm/query-form-item/query-form-item.d.ts +96 -0
- package/esm/query-form-item/types.d.ts +46 -0
- package/esm/query-form-item/types.mjs +2 -0
- package/esm/query-form-item/types.mjs.map +1 -0
- package/esm/radio/index.d.ts +18 -18
- package/esm/radio/index.mjs +7 -12
- package/esm/radio/index.mjs.map +1 -1
- package/esm/reset/index.mjs +2 -2
- package/esm/segmented/index.mjs +2 -2
- package/esm/select/index.d.ts +16 -16
- package/esm/select/index.mjs +1 -1
- package/esm/select-table/index.d.ts +6 -6
- package/esm/select-table/index.mjs +22 -24
- package/esm/select-table/index.mjs.map +1 -1
- package/esm/select-table/select-table.d.ts +2 -2
- package/esm/shared/overlay-elements.mjs +14 -11
- package/esm/shared/overlay-elements.mjs.map +1 -1
- package/esm/styles/form-button-group/index.css +1 -1
- package/esm/styles/form-grid/index.css +1 -1
- package/esm/styles/form-item/index.css +1 -1
- package/esm/styles/query-form/index.css +1 -0
- package/esm/styles/query-form-item/index.css +1 -0
- package/esm/submit/index.mjs +3 -3
- package/esm/submit/index.mjs.map +1 -1
- package/esm/switch/index.d.ts +9 -9
- package/esm/time-select/index.d.ts +12 -12
- package/esm/transfer/index.d.ts +12 -12
- package/esm/tree/index.mjs +3 -3
- package/esm/tree/utils.mjs +0 -2
- package/esm/tree/utils.mjs.map +1 -1
- package/esm/tree-select/index.mjs +2 -2
- package/esm/upload/index.d.ts +12 -12
- package/esm/upload/index.mjs +3 -3
- package/esm/upload/upload.d.ts +24 -24
- package/esm/vendor/icon.mjs.map +1 -1
- package/esm/vendor/lodash.mjs +777 -663
- package/esm/vendor/lodash.mjs.map +1 -1
- package/esm/vendor/runtime.mjs +23 -29
- package/esm/vendor/runtime.mjs.map +1 -1
- package/esm/vendor/shared.esm-bundler.mjs +2 -7
- package/esm/vendor/shared.esm-bundler.mjs.map +1 -1
- 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 +89 -115
- package/LICENSE +0 -21
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isArr as
|
|
2
|
-
import { useResizeObserver as
|
|
3
|
-
import { inject as l, ref as i, computed as
|
|
1
|
+
import { isArr as L, isValid as u } from "@formily/shared";
|
|
2
|
+
import { useResizeObserver as d } from "@vueuse/core";
|
|
3
|
+
import { inject as l, ref as i, computed as h } from "vue";
|
|
4
4
|
function A(t, o) {
|
|
5
5
|
for (const [r, e] of t.entries())
|
|
6
6
|
if (o <= e)
|
|
@@ -19,53 +19,53 @@ function a(t, o) {
|
|
|
19
19
|
function x(t, o) {
|
|
20
20
|
const { clientWidth: r } = t, {
|
|
21
21
|
breakpoints: e,
|
|
22
|
-
layout:
|
|
23
|
-
labelAlign:
|
|
24
|
-
wrapperAlign:
|
|
25
|
-
labelCol:
|
|
26
|
-
wrapperCol:
|
|
27
|
-
...
|
|
22
|
+
layout: c,
|
|
23
|
+
labelAlign: p,
|
|
24
|
+
wrapperAlign: f,
|
|
25
|
+
labelCol: m,
|
|
26
|
+
wrapperCol: y,
|
|
27
|
+
...b
|
|
28
28
|
} = o, n = A(
|
|
29
29
|
e,
|
|
30
30
|
r
|
|
31
31
|
);
|
|
32
32
|
return {
|
|
33
|
-
layout: a(
|
|
34
|
-
labelAlign: a(
|
|
35
|
-
wrapperAlign: a(
|
|
36
|
-
labelCol: a(
|
|
37
|
-
wrapperCol: a(
|
|
38
|
-
...
|
|
33
|
+
layout: a(c, n),
|
|
34
|
+
labelAlign: a(p, n),
|
|
35
|
+
wrapperAlign: a(f, n),
|
|
36
|
+
labelCol: a(m, n),
|
|
37
|
+
wrapperCol: a(y, n),
|
|
38
|
+
...b
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
function P(t, o) {
|
|
42
42
|
const { breakpoints: r } = t;
|
|
43
|
-
if (!
|
|
43
|
+
if (!L(r))
|
|
44
44
|
return {
|
|
45
45
|
props: i(t)
|
|
46
46
|
};
|
|
47
47
|
const e = i({});
|
|
48
|
-
return
|
|
48
|
+
return d(o, () => {
|
|
49
49
|
e.value = x(o.value, t);
|
|
50
50
|
}), {
|
|
51
51
|
props: e
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
const
|
|
54
|
+
const s = /* @__PURE__ */ Symbol(
|
|
55
55
|
"formLayoutDeepContext"
|
|
56
|
-
), w = Symbol("formLayoutShallowContext"), k = Symbol("formLayoutIdContext");
|
|
56
|
+
), w = /* @__PURE__ */ Symbol("formLayoutShallowContext"), k = /* @__PURE__ */ Symbol("formLayoutIdContext");
|
|
57
57
|
function S() {
|
|
58
|
-
return l(
|
|
58
|
+
return l(s, i({}));
|
|
59
59
|
}
|
|
60
60
|
function O() {
|
|
61
|
-
const t = l(w, i({})), o = l(
|
|
62
|
-
return
|
|
61
|
+
const t = l(w, i({})), o = l(s, i({}));
|
|
62
|
+
return h(() => ({
|
|
63
63
|
...o.value,
|
|
64
64
|
...t.value
|
|
65
65
|
}));
|
|
66
66
|
}
|
|
67
67
|
function R() {
|
|
68
|
-
return l(k
|
|
68
|
+
return l(k);
|
|
69
69
|
}
|
|
70
70
|
const W = [
|
|
71
71
|
"colon",
|
|
@@ -98,7 +98,7 @@ export {
|
|
|
98
98
|
x as calculateProps,
|
|
99
99
|
a as factor,
|
|
100
100
|
_ as filterValidFormLayoutProps,
|
|
101
|
-
|
|
101
|
+
s as formLayoutDeepContext,
|
|
102
102
|
k as formLayoutIdContext,
|
|
103
103
|
w as formLayoutShallowContext,
|
|
104
104
|
S as useFormDeepLayout,
|
|
@@ -1 +1 @@
|
|
|
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 { useResizeObserver } from '@vueuse/core'\r\nimport { computed, inject, ref } from 'vue'\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
|
|
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 { useResizeObserver } from '@vueuse/core'\r\nimport { computed, inject, ref } from 'vue'\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)\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","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,CAAW;AACpB,WAAO;AAAA,MACL,OAAOuB,EAAIX,CAAK;AAAA,IAAA;AAIpB,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,2BACF,0BAA0B,GAExBC,2BACF,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,CAAmB;AACnC;AAEO,MAAMQ,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,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as $, renderSlot as g, computed as P,
|
|
1
|
+
import { defineComponent as $, renderSlot as g, computed as P, openBlock as r, createElementBlock as o, 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";
|
|
2
2
|
import { isObj as k } from "@formily/shared";
|
|
3
3
|
import { useObserver as V } from "@silver-formily/reactive-vue";
|
|
4
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 {
|
|
6
|
+
import { parseSteps as w, createFormStep as C } from "./utils.mjs";
|
|
7
7
|
import { stylePrefix as z } from "../__builtins__/configs/index.mjs";
|
|
8
8
|
import { composeExport as L } from "../__builtins__/shared/utils.mjs";
|
|
9
9
|
const T = $({
|
package/esm/form-step/utils.mjs
CHANGED
|
@@ -37,10 +37,8 @@ function d(o = 0) {
|
|
|
37
37
|
return e.form?.submit?.(n);
|
|
38
38
|
}
|
|
39
39
|
}), p = c.bound(() => {
|
|
40
|
-
/* istanbul ignore else -- @preserve */
|
|
41
40
|
t.allowNext && (r(t.current + 1), t.setCurrent(t.current + 1));
|
|
42
41
|
}), l = c.bound(() => {
|
|
43
|
-
/* istanbul ignore else -- @preserve */
|
|
44
42
|
t.allowBack && (r(t.current - 1), t.setCurrent(t.current - 1));
|
|
45
43
|
});
|
|
46
44
|
return t;
|
|
@@ -48,7 +46,6 @@ function d(o = 0) {
|
|
|
48
46
|
function b(o) {
|
|
49
47
|
const e = [];
|
|
50
48
|
return o.mapProperties((r, t) => {
|
|
51
|
-
/* istanbul ignore else -- @preserve */
|
|
52
49
|
r["x-component"]?.indexOf("StepPane") > -1 && e.push({
|
|
53
50
|
name: t,
|
|
54
51
|
props: r["x-component-props"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","sources":["../../src/form-step/utils.ts"],"sourcesContent":["import type { Schema, SchemaKey } from '@formily/json-schema'\r\nimport type { Slots } from 'vue'\r\nimport type { FormStepEnv, IFormStep } from './types'\r\nimport { action, model, observable } from '@formily/reactive'\r\n\r\nexport interface SchemaStep {\r\n name: SchemaKey\r\n props: any\r\n schema: Schema\r\n slots: Slots\r\n}\r\n\r\nexport function createFormStep(defaultCurrent = 0): IFormStep {\r\n const env: FormStepEnv = observable({\r\n form: null,\r\n field: null,\r\n steps: [],\r\n })\r\n\r\n const setDisplay = action.bound((target: number) => {\r\n const currentStep = env.steps[target]\r\n for (const { name } of env.steps) {\r\n env.form.query(`${env.field.address}.${name}`).take((field) => {\r\n if (name === currentStep.name) {\r\n field.setDisplay('visible')\r\n }\r\n else {\r\n field.setDisplay('hidden')\r\n }\r\n })\r\n }\r\n })\r\n\r\n const formStep: IFormStep = model({\r\n connect(steps, field) {\r\n env.steps = steps\r\n env.form = field?.form\r\n env.field = field\r\n },\r\n current: defaultCurrent,\r\n setCurrent(key: number) {\r\n formStep.current = key\r\n },\r\n get allowNext() {\r\n return formStep.current < env.steps.length - 1\r\n },\r\n get allowBack() {\r\n return formStep.current > 0\r\n },\r\n async next() {\r\n try {\r\n await env.form.validate()\r\n // eslint-disable-next-line ts/no-use-before-define\r\n next()\r\n }\r\n catch {}\r\n },\r\n async back() {\r\n // eslint-disable-next-line ts/no-use-before-define\r\n back()\r\n },\r\n async submit(onSubmit) {\r\n return env.form?.submit?.(onSubmit)\r\n },\r\n })\r\n\r\n const next = action.bound(() => {\r\n /* istanbul ignore else -- @preserve */\r\n if (formStep.allowNext) {\r\n setDisplay(formStep.current + 1)\r\n formStep.setCurrent(formStep.current + 1)\r\n }\r\n })\r\n\r\n const back = action.bound(() => {\r\n /* istanbul ignore else -- @preserve */\r\n if (formStep.allowBack) {\r\n setDisplay(formStep.current - 1)\r\n formStep.setCurrent(formStep.current - 1)\r\n }\r\n })\r\n return formStep\r\n}\r\n\r\nexport function parseSteps(schema: Schema) {\r\n const steps: SchemaStep[] = []\r\n schema.mapProperties((schema, name) => {\r\n /* istanbul ignore else -- @preserve */\r\n if (schema['x-component']?.indexOf('StepPane') > -1) {\r\n steps.push({\r\n name,\r\n props: schema['x-component-props'],\r\n schema,\r\n slots: schema['x-content'],\r\n })\r\n }\r\n })\r\n return steps\r\n}\r\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;
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../src/form-step/utils.ts"],"sourcesContent":["import type { Schema, SchemaKey } from '@formily/json-schema'\r\nimport type { Slots } from 'vue'\r\nimport type { FormStepEnv, IFormStep } from './types'\r\nimport { action, model, observable } from '@formily/reactive'\r\n\r\nexport interface SchemaStep {\r\n name: SchemaKey\r\n props: any\r\n schema: Schema\r\n slots: Slots\r\n}\r\n\r\nexport function createFormStep(defaultCurrent = 0): IFormStep {\r\n const env: FormStepEnv = observable({\r\n form: null,\r\n field: null,\r\n steps: [],\r\n })\r\n\r\n const setDisplay = action.bound((target: number) => {\r\n const currentStep = env.steps[target]\r\n for (const { name } of env.steps) {\r\n env.form.query(`${env.field.address}.${name}`).take((field) => {\r\n if (name === currentStep.name) {\r\n field.setDisplay('visible')\r\n }\r\n else {\r\n field.setDisplay('hidden')\r\n }\r\n })\r\n }\r\n })\r\n\r\n const formStep: IFormStep = model({\r\n connect(steps, field) {\r\n env.steps = steps\r\n env.form = field?.form\r\n env.field = field\r\n },\r\n current: defaultCurrent,\r\n setCurrent(key: number) {\r\n formStep.current = key\r\n },\r\n get allowNext() {\r\n return formStep.current < env.steps.length - 1\r\n },\r\n get allowBack() {\r\n return formStep.current > 0\r\n },\r\n async next() {\r\n try {\r\n await env.form.validate()\r\n // eslint-disable-next-line ts/no-use-before-define\r\n next()\r\n }\r\n catch {}\r\n },\r\n async back() {\r\n // eslint-disable-next-line ts/no-use-before-define\r\n back()\r\n },\r\n async submit(onSubmit) {\r\n return env.form?.submit?.(onSubmit)\r\n },\r\n })\r\n\r\n const next = action.bound(() => {\r\n /* istanbul ignore else -- @preserve */\r\n if (formStep.allowNext) {\r\n setDisplay(formStep.current + 1)\r\n formStep.setCurrent(formStep.current + 1)\r\n }\r\n })\r\n\r\n const back = action.bound(() => {\r\n /* istanbul ignore else -- @preserve */\r\n if (formStep.allowBack) {\r\n setDisplay(formStep.current - 1)\r\n formStep.setCurrent(formStep.current - 1)\r\n }\r\n })\r\n return formStep\r\n}\r\n\r\nexport function parseSteps(schema: Schema) {\r\n const steps: SchemaStep[] = []\r\n schema.mapProperties((schema, name) => {\r\n /* istanbul ignore else -- @preserve */\r\n if (schema['x-component']?.indexOf('StepPane') > -1) {\r\n steps.push({\r\n name,\r\n props: schema['x-component-props'],\r\n schema,\r\n slots: schema['x-content'],\r\n })\r\n }\r\n })\r\n return steps\r\n}\r\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;AAE9B,IAAIK,EAAS,cACXN,EAAWM,EAAS,UAAU,CAAC,GAC/BA,EAAS,WAAWA,EAAS,UAAU,CAAC;AAAA,EAE5C,CAAC,GAEKK,IAAOV,EAAO,MAAM,MAAM;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;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;"}
|
package/esm/form-tab/hooks.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { GeneralField } from '@formily/core';
|
|
1
2
|
import { Schema, SchemaKey } from '@formily/json-schema';
|
|
2
3
|
export type Tabs = {
|
|
3
4
|
name: SchemaKey;
|
|
4
5
|
props: any;
|
|
5
6
|
schema: Schema;
|
|
6
7
|
}[];
|
|
7
|
-
export declare function useTabs(): Tabs;
|
|
8
|
+
export declare function useTabs(tabField: GeneralField, schema: Schema): Tabs;
|
package/esm/form-tab/hooks.mjs
CHANGED
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
schema: e
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
}, {
|
|
18
|
-
fireImmediately: !0
|
|
19
|
-
}), o;
|
|
1
|
+
function r(n, a) {
|
|
2
|
+
return a.mapProperties((s, e) => ({
|
|
3
|
+
name: e,
|
|
4
|
+
props: {
|
|
5
|
+
name: s?.["x-component-props"]?.name || e,
|
|
6
|
+
...s?.["x-component-props"]
|
|
7
|
+
},
|
|
8
|
+
schema: s
|
|
9
|
+
})).filter((s) => {
|
|
10
|
+
const e = n.query(n.address.concat(s.name)).take();
|
|
11
|
+
return e?.display === "none" || e?.display === "hidden" ? !1 : s?.schema?.["x-component"]?.includes("TabPane") ?? !1;
|
|
12
|
+
});
|
|
20
13
|
}
|
|
21
14
|
export {
|
|
22
|
-
|
|
15
|
+
r as useTabs
|
|
23
16
|
};
|
|
24
17
|
//# sourceMappingURL=hooks.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.mjs","sources":["../../src/form-tab/hooks.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"hooks.mjs","sources":["../../src/form-tab/hooks.ts"],"sourcesContent":["import type { GeneralField } from '@formily/core'\r\nimport type { Schema, SchemaKey } from '@formily/json-schema'\r\n\r\nexport type Tabs = { name: SchemaKey, props: any, schema: Schema }[]\r\n\r\nexport function useTabs(tabField: GeneralField, schema: Schema) {\r\n const schemaList = schema.mapProperties((item, name) => ({\r\n name,\r\n props: {\r\n name: item?.['x-component-props']?.name || name,\r\n ...item?.['x-component-props'],\r\n },\r\n schema: item,\r\n }))\r\n\r\n const tabs: Tabs = schemaList.filter((item) => {\r\n const field = tabField.query(tabField.address.concat(item.name)).take()\r\n const isHidden = field?.display === 'none' || field?.display === 'hidden'\r\n if (isHidden)\r\n return false\r\n return item?.schema?.['x-component']?.includes('TabPane') ?? false\r\n })\r\n\r\n return tabs\r\n}\r\n"],"names":["useTabs","tabField","schema","item","name","field"],"mappings":"AAKO,SAASA,EAAQC,GAAwBC,GAAgB;AAkB9D,SAjBmBA,EAAO,cAAc,CAACC,GAAMC,OAAU;AAAA,IACvD,MAAAA;AAAA,IACA,OAAO;AAAA,MACL,MAAMD,IAAO,mBAAmB,GAAG,QAAQC;AAAA,MAC3C,GAAGD,IAAO,mBAAmB;AAAA,IAAA;AAAA,IAE/B,QAAQA;AAAA,EAAA,EACR,EAE4B,OAAO,CAACA,MAAS;AAC7C,UAAME,IAAQJ,EAAS,MAAMA,EAAS,QAAQ,OAAOE,EAAK,IAAI,CAAC,EAAE,KAAA;AAEjE,WADiBE,GAAO,YAAY,UAAUA,GAAO,YAAY,WAExD,KACFF,GAAM,SAAS,aAAa,GAAG,SAAS,SAAS,KAAK;AAAA,EAC/D,CAAC;AAGH;"}
|
package/esm/form-tab/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { formilyComputed as
|
|
2
|
-
import { defineComponent as
|
|
1
|
+
import { formilyComputed as p, observer as k } from "@silver-formily/reactive-vue";
|
|
2
|
+
import { defineComponent as B, computed as K, ref as w, watch as $, openBlock as t, createBlock as n, unref as a, withCtx as l, createElementBlock as v, Fragment as b, renderList as L, mergeProps as N, normalizeClass as R, createTextVNode as h, toDisplayString as T, createVNode as S } from "vue";
|
|
3
3
|
import { reaction as q } from "@formily/reactive";
|
|
4
|
-
import { useField as z,
|
|
5
|
-
import { ElTabs as
|
|
6
|
-
import { useTabs as
|
|
4
|
+
import { useField as z, useFieldSchema as A, RecursionField as D } from "@silver-formily/vue";
|
|
5
|
+
import { ElTabs as I, ElTabPane as P, ElBadge as j } from "element-plus";
|
|
6
|
+
import { useTabs as G } from "./hooks.mjs";
|
|
7
7
|
import { createFormTab as y } from "./utils.mjs";
|
|
8
|
-
import { stylePrefix as
|
|
9
|
-
import { composeExport as
|
|
10
|
-
import '../styles/form-tab/index.css';const
|
|
8
|
+
import { stylePrefix as H } from "../__builtins__/configs/index.mjs";
|
|
9
|
+
import { composeExport as J } from "../__builtins__/shared/utils.mjs";
|
|
10
|
+
import '../styles/form-tab/index.css';const M = /* @__PURE__ */ B({
|
|
11
11
|
name: "FFormTab",
|
|
12
12
|
__name: "form-tab",
|
|
13
13
|
props: {
|
|
@@ -15,48 +15,47 @@ import '../styles/form-tab/index.css';const H = /* @__PURE__ */ k({
|
|
|
15
15
|
modelValue: {}
|
|
16
16
|
},
|
|
17
17
|
emits: ["update:modelValue"],
|
|
18
|
-
setup(
|
|
19
|
-
const
|
|
20
|
-
q(() =>
|
|
21
|
-
!
|
|
18
|
+
setup(F, { emit: _ }) {
|
|
19
|
+
const c = F, g = _, m = z(), x = A(), C = `${H}-form-tab`, u = K(() => c.formTab ?? y()), r = p(() => G(m.value, x.value)), o = w(c?.modelValue ?? u.value.activeKey ?? r.value?.[0]?.name);
|
|
20
|
+
q(() => r.value.length, () => {
|
|
21
|
+
!r.value.some((e) => e.name === o.value) && (o.value = r.value?.[0]?.name);
|
|
22
22
|
}, {
|
|
23
23
|
fireImmediately: !0
|
|
24
|
-
}),
|
|
25
|
-
|
|
24
|
+
}), $(() => u.value.activeKey, (e) => {
|
|
25
|
+
o.value = e;
|
|
26
26
|
});
|
|
27
|
-
const
|
|
27
|
+
const i = p(() => r.value.map((e) => m.value.form.queryFeedbacks({
|
|
28
28
|
type: "error",
|
|
29
|
-
address: `${
|
|
29
|
+
address: `${m.value.address}.${e.name}.*`
|
|
30
30
|
}).length));
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
typeof e == "string" && (F("update:modelValue", e), l.value.setActiveKey?.(e));
|
|
31
|
+
function V(e) {
|
|
32
|
+
typeof e == "string" && (g("update:modelValue", e), u.value.setActiveKey?.(e));
|
|
34
33
|
}
|
|
35
|
-
return (e,
|
|
36
|
-
"model-value":
|
|
34
|
+
return (e, Q) => (t(), n(a(I), {
|
|
35
|
+
"model-value": o.value,
|
|
37
36
|
style: { width: "100%" },
|
|
38
|
-
onTabChange:
|
|
37
|
+
onTabChange: V
|
|
39
38
|
}, {
|
|
40
|
-
default:
|
|
41
|
-
(
|
|
42
|
-
default:
|
|
43
|
-
|
|
44
|
-
schema:
|
|
39
|
+
default: l(() => [
|
|
40
|
+
(t(!0), v(b, null, L(a(r), ({ props: s, schema: E, name: f }, d) => (t(), n(a(P), N({ key: f }, { ref_for: !0 }, s), {
|
|
41
|
+
default: l(() => [
|
|
42
|
+
S(a(D), {
|
|
43
|
+
schema: E,
|
|
45
44
|
name: f
|
|
46
45
|
}, null, 8, ["schema", "name"])
|
|
47
46
|
]),
|
|
48
|
-
label:
|
|
49
|
-
|
|
47
|
+
label: l(() => [
|
|
48
|
+
a(i)[d] !== 0 ? (t(), n(a(j), {
|
|
50
49
|
key: 0,
|
|
51
|
-
class:
|
|
52
|
-
value:
|
|
50
|
+
class: R(C),
|
|
51
|
+
value: a(i)[d]
|
|
53
52
|
}, {
|
|
54
|
-
default:
|
|
55
|
-
|
|
53
|
+
default: l(() => [
|
|
54
|
+
h(T(s.label), 1)
|
|
56
55
|
]),
|
|
57
56
|
_: 2
|
|
58
|
-
}, 1032, ["value"])) : (
|
|
59
|
-
|
|
57
|
+
}, 1032, ["value"])) : (t(), v(b, { key: 1 }, [
|
|
58
|
+
h(T(s.label), 1)
|
|
60
59
|
], 64))
|
|
61
60
|
]),
|
|
62
61
|
_: 2
|
|
@@ -65,12 +64,12 @@ import '../styles/form-tab/index.css';const H = /* @__PURE__ */ k({
|
|
|
65
64
|
_: 1
|
|
66
65
|
}, 8, ["model-value"]));
|
|
67
66
|
}
|
|
68
|
-
}),
|
|
67
|
+
}), O = k(M), oe = J(O, {
|
|
69
68
|
createFormTab: y
|
|
70
69
|
});
|
|
71
70
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
oe as FormTab,
|
|
72
|
+
oe as composeFormTab,
|
|
73
|
+
oe as default
|
|
75
74
|
};
|
|
76
75
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/form-tab/form-tab.vue","../../src/form-tab/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport type { IFormTabProps } from './types.ts'\r\nimport { reaction } from '@formily/reactive'\r\nimport { formilyComputed } from '@silver-formily/reactive-vue'\r\nimport { RecursionField, useField } from '@silver-formily/vue'\r\nimport { ElBadge, ElTabPane, ElTabs } from 'element-plus'\r\nimport { computed, ref, watch } from 'vue'\r\nimport { stylePrefix } from '../__builtins__'\r\nimport { useTabs } from './hooks'\r\nimport { createFormTab } from './utils'\r\n\r\ndefineOptions({\r\n name: 'FFormTab',\r\n})\r\n\r\nconst props = defineProps<IFormTabProps>()\r\nconst emit = defineEmits(['update:modelValue'])\r\n\r\nconst field = useField()\r\nconst prefixCls = `${stylePrefix}-form-tab`\r\nconst formTabRef = computed(() => props.formTab ?? createFormTab())\r\nconst tabs = useTabs()\r\nconst _activeKey = ref(props?.modelValue ?? formTabRef.value.activeKey ?? tabs?.[0]?.name)\r\n\r\nreaction(() => {\r\n return tabs.length\r\n}, () => {\r\n !tabs.some(tab => tab.name === _activeKey.value) && (_activeKey.value = tabs?.[0]?.name)\r\n}, {\r\n fireImmediately: true,\r\n})\r\nwatch(() => formTabRef.value.activeKey, (val) => {\r\n _activeKey.value = val\r\n})\r\n\r\nconst errorList = formilyComputed(() => {\r\n return tabs.map((tab) => {\r\n return field.value.form.queryFeedbacks({\r\n type: 'error',\r\n address: `${field.value.address}.${tab.name}.*`,\r\n }).length\r\n })\r\n})\r\n\r\nfunction handleTabChange(key: string) {\r\n /* istanbul ignore if -- @preserve */\r\n if (typeof key !== 'string')\r\n return\r\n emit('update:modelValue', key)\r\n formTabRef.value.setActiveKey?.(key)\r\n}\r\n</script>\r\n\r\n<template>\r\n <ElTabs\r\n :model-value=\"_activeKey\"\r\n style=\"width: 100%;\"\r\n @tab-change=\"handleTabChange\"\r\n >\r\n <ElTabPane\r\n v-for=\"({ props: tabProps, schema, name }, key) in tabs\"\r\n :key=\"name\"\r\n v-bind=\"tabProps\"\r\n >\r\n <template #default>\r\n <RecursionField :schema=\"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/form-tab/form-tab.vue","../../src/form-tab/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport type { IFormTabProps } from './types.ts'\r\nimport { reaction } from '@formily/reactive'\r\nimport { formilyComputed } from '@silver-formily/reactive-vue'\r\nimport { RecursionField, useField, useFieldSchema } from '@silver-formily/vue'\r\nimport { ElBadge, ElTabPane, ElTabs } from 'element-plus'\r\nimport { computed, ref, watch } from 'vue'\r\nimport { stylePrefix } from '../__builtins__'\r\nimport { useTabs } from './hooks'\r\nimport { createFormTab } from './utils'\r\n\r\ndefineOptions({\r\n name: 'FFormTab',\r\n})\r\n\r\nconst props = defineProps<IFormTabProps>()\r\nconst emit = defineEmits(['update:modelValue'])\r\n\r\nconst field = useField()\r\nconst schema = useFieldSchema()\r\nconst prefixCls = `${stylePrefix}-form-tab`\r\nconst formTabRef = computed(() => props.formTab ?? createFormTab())\r\nconst tabs = formilyComputed(() => useTabs(field.value, schema.value))\r\nconst _activeKey = ref(props?.modelValue ?? formTabRef.value.activeKey ?? tabs.value?.[0]?.name)\r\n\r\nreaction(() => {\r\n return tabs.value.length\r\n}, () => {\r\n !tabs.value.some(tab => tab.name === _activeKey.value) && (_activeKey.value = tabs.value?.[0]?.name)\r\n}, {\r\n fireImmediately: true,\r\n})\r\nwatch(() => formTabRef.value.activeKey, (val) => {\r\n _activeKey.value = val\r\n})\r\n\r\nconst errorList = formilyComputed(() => {\r\n return tabs.value.map((tab) => {\r\n return field.value.form.queryFeedbacks({\r\n type: 'error',\r\n address: `${field.value.address}.${tab.name}.*`,\r\n }).length\r\n })\r\n})\r\n\r\nfunction handleTabChange(key: string) {\r\n /* istanbul ignore if -- @preserve */\r\n if (typeof key !== 'string')\r\n return\r\n emit('update:modelValue', key)\r\n formTabRef.value.setActiveKey?.(key)\r\n}\r\n</script>\r\n\r\n<template>\r\n <ElTabs\r\n :model-value=\"_activeKey\"\r\n style=\"width: 100%;\"\r\n @tab-change=\"handleTabChange\"\r\n >\r\n <ElTabPane\r\n v-for=\"({ props: tabProps, schema: tabSchema, name }, key) in tabs\"\r\n :key=\"name\"\r\n v-bind=\"tabProps\"\r\n >\r\n <template #default>\r\n <RecursionField :schema=\"tabSchema\" :name=\"name\" />\r\n </template>\r\n <template #label>\r\n <ElBadge\r\n v-if=\"errorList[key] !== 0\"\r\n :class=\"prefixCls\"\r\n :value=\"errorList[key]\"\r\n >\r\n {{ tabProps.label }}\r\n </ElBadge>\r\n <template v-else>\r\n {{ tabProps.label }}\r\n </template>\r\n </template>\r\n </ElTabPane>\r\n </ElTabs>\r\n</template>\r\n","import { observer } from '@silver-formily/reactive-vue'\r\nimport { composeExport } from '../__builtins__'\r\nimport FFormTab from './form-tab.vue'\r\nimport { createFormTab } from './utils'\r\nimport './style.scss'\r\n\r\nconst FormTab = observer(FFormTab)\r\n\r\nexport const composeFormTab = composeExport(FormTab, {\r\n createFormTab,\r\n})\r\n\r\nexport { composeFormTab as FormTab }\r\nexport default composeFormTab\r\n"],"names":["props","__props","emit","__emit","field","useField","schema","useFieldSchema","prefixCls","stylePrefix","formTabRef","computed","createFormTab","tabs","formilyComputed","useTabs","_activeKey","ref","reaction","tab","watch","val","errorList","handleTabChange","key","_createBlock","_unref","ElTabs","_createElementBlock","_Fragment","_renderList","tabProps","tabSchema","name","_openBlock","_mergeProps","_createVNode","RecursionField","ElBadge","_createTextVNode","_toDisplayString","FormTab","observer","FFormTab","composeFormTab","composeExport"],"mappings":";;;;;;;;;;;;;;;;;;AAeA,UAAMA,IAAQC,GACRC,IAAOC,GAEPC,IAAQC,EAAA,GACRC,IAASC,EAAA,GACTC,IAAY,GAAGC,CAAW,aAC1BC,IAAaC,EAAS,MAAMX,EAAM,WAAWY,GAAe,GAC5DC,IAAOC,EAAgB,MAAMC,EAAQX,EAAM,OAAOE,EAAO,KAAK,CAAC,GAC/DU,IAAaC,EAAIjB,GAAO,cAAcU,EAAW,MAAM,aAAaG,EAAK,QAAQ,CAAC,GAAG,IAAI;AAE/F,IAAAK,EAAS,MACAL,EAAK,MAAM,QACjB,MAAM;AACP,OAACA,EAAK,MAAM,KAAK,CAAAM,MAAOA,EAAI,SAASH,EAAW,KAAK,MAAMA,EAAW,QAAQH,EAAK,QAAQ,CAAC,GAAG;AAAA,IACjG,GAAG;AAAA,MACD,iBAAiB;AAAA,IAAA,CAClB,GACDO,EAAM,MAAMV,EAAW,MAAM,WAAW,CAACW,MAAQ;AAC/C,MAAAL,EAAW,QAAQK;AAAA,IACrB,CAAC;AAED,UAAMC,IAAYR,EAAgB,MACzBD,EAAK,MAAM,IAAI,CAACM,MACdf,EAAM,MAAM,KAAK,eAAe;AAAA,MACrC,MAAM;AAAA,MACN,SAAS,GAAGA,EAAM,MAAM,OAAO,IAAIe,EAAI,IAAI;AAAA,IAAA,CAC5C,EAAE,MACJ,CACF;AAED,aAASI,EAAgBC,GAAa;AAEpC,MAAI,OAAOA,KAAQ,aAEnBtB,EAAK,qBAAqBsB,CAAG,GAC7Bd,EAAW,MAAM,eAAec,CAAG;AAAA,IACrC;2BAIEC,EA0BSC,EAAAC,CAAA,GAAA;AAAA,MAzBN,eAAaX,EAAA;AAAA,MACd,OAAA,EAAA,OAAA,OAAA;AAAA,MACC,aAAYO;AAAA,IAAA;iBAGX,MAAmE;AAAA,gBADrEK,EAoBYC,GAAA,MAAAC,EAnBoDJ,MAAI,CAAA,EAAA,OAAjDK,WAAkBC,GAAW,MAAAC,EAAA,GAAQT,OADxDU,KAAAT,EAoBYC,MApBZS,EAoBY,EAlBT,KAAKF,EAAA,oBACEF,CAAQ,GAAA;AAAA,UAEL,WACT,MAAmD;AAAA,YAAnDK,EAAmDV,EAAAW,CAAA,GAAA;AAAA,cAAlC,QAAQL;AAAA,cAAY,MAAAC;AAAA,YAAA;;UAE5B,SACT,MAMU;AAAA,YALFP,EAAAJ,CAAA,EAAUE,CAAG,MAAA,UADrBC,EAMUC,EAAAY,CAAA,GAAA;AAAA;cAJP,SAAO9B,CAAS;AAAA,cAChB,OAAOkB,EAAAJ,CAAA,EAAUE,CAAG;AAAA,YAAA;yBAErB,MAAoB;AAAA,gBAAjBe,EAAAC,EAAAT,EAAS,KAAK,GAAA,CAAA;AAAA,cAAA;;yCAEnBH,EAEWC,GAAA,EAAA,KAAA,KAAA;AAAA,cADNU,EAAAC,EAAAT,EAAS,KAAK,GAAA,CAAA;AAAA,YAAA;;;;;;;;ICvErBU,IAAUC,EAASC,CAAQ,GAEpBC,KAAiBC,EAAcJ,GAAS;AAAA,EACnD,eAAA7B;AACF,CAAC;"}
|
package/esm/index.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export * from './input-tag';
|
|
|
28
28
|
export * from './mention';
|
|
29
29
|
export * from './password';
|
|
30
30
|
export * from './preview-text';
|
|
31
|
+
export * from './query-form';
|
|
32
|
+
export * from './query-form-item';
|
|
31
33
|
export * from './radio';
|
|
32
34
|
export * from './rate';
|
|
33
35
|
export * from './reset';
|
package/esm/index.mjs
CHANGED
|
@@ -3,97 +3,101 @@ import { ArrayCollapse as m } from "./array-collapse/index.mjs";
|
|
|
3
3
|
import { ArrayItems as f } from "./array-items/index.mjs";
|
|
4
4
|
import { ArrayListTabs as a } from "./array-list-tabs/index.mjs";
|
|
5
5
|
import { ArrayTable as s } from "./array-table/index.mjs";
|
|
6
|
-
import { ArrayTabs as
|
|
6
|
+
import { ArrayTabs as c } from "./array-tabs/index.mjs";
|
|
7
7
|
import { Autocomplete as T } from "./autocomplete/index.mjs";
|
|
8
8
|
import { Cascader as d } from "./cascader/index.mjs";
|
|
9
|
-
import { Checkbox as
|
|
10
|
-
import { ColorPicker as
|
|
11
|
-
import { ColorPickerPanel as
|
|
12
|
-
import { DatePicker as
|
|
9
|
+
import { Checkbox as S } from "./checkbox/index.mjs";
|
|
10
|
+
import { ColorPicker as y } from "./color-picker/index.mjs";
|
|
11
|
+
import { ColorPickerPanel as C } from "./color-picker-panel/index.mjs";
|
|
12
|
+
import { DatePicker as k } from "./date-picker/index.mjs";
|
|
13
13
|
import { DatePickerPanel as w } from "./date-picker-panel/index.mjs";
|
|
14
14
|
import { Editable as g } from "./editable/index.mjs";
|
|
15
15
|
import { FormButtonGroup as h } from "./form-button-group/index.mjs";
|
|
16
16
|
import { FormCollapse as E, FormCollapseItem as G } from "./form-collapse/index.mjs";
|
|
17
17
|
import { FormDialog as M } from "./form-dialog/index.mjs";
|
|
18
|
-
import { FormDrawer as
|
|
19
|
-
import { FormGrid as
|
|
20
|
-
import { FormBaseItem as
|
|
21
|
-
import { FormStep as
|
|
22
|
-
import {
|
|
18
|
+
import { FormDrawer as _ } from "./form-drawer/index.mjs";
|
|
19
|
+
import { FormGrid as N } from "./form-grid/index.mjs";
|
|
20
|
+
import { FormBaseItem as j, FormItem as q, fieldFeedbackMapper as z } from "./form-item/index.mjs";
|
|
21
|
+
import { FormStep as J } from "./form-step/index.mjs";
|
|
22
|
+
import { FormTab as O, FormTab as V } from "./form-tab/index.mjs";
|
|
23
23
|
import { Input as X } from "./input/index.mjs";
|
|
24
24
|
import { InputNumber as Z } from "./input-number/index.mjs";
|
|
25
25
|
import { InputTag as rr } from "./input-tag/index.mjs";
|
|
26
26
|
import { Mention as er } from "./mention/index.mjs";
|
|
27
27
|
import { Password as mr } from "./password/index.mjs";
|
|
28
28
|
import { PreviewText as fr } from "./preview-text/index.mjs";
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
29
|
+
import { QueryForm as ar } from "./query-form/index.mjs";
|
|
30
|
+
import { QueryFormItem as sr } from "./query-form-item/index.mjs";
|
|
31
|
+
import { Radio as cr } from "./radio/index.mjs";
|
|
32
|
+
import { Rate as Tr } from "./rate/index.mjs";
|
|
33
|
+
import { Reset as dr } from "./reset/index.mjs";
|
|
34
|
+
import { Segmented as Sr } from "./segmented/index.mjs";
|
|
35
|
+
import { Select as yr } from "./select/index.mjs";
|
|
36
|
+
import { SelectTable as Cr } from "./select-table/index.mjs";
|
|
37
|
+
import { Slider as kr } from "./slider/index.mjs";
|
|
38
|
+
import { Submit as wr } from "./submit/index.mjs";
|
|
39
|
+
import { Switch as gr } from "./switch/index.mjs";
|
|
40
|
+
import { TimePicker as hr } from "./time-picker/index.mjs";
|
|
41
|
+
import { TimeSelect as Er } from "./time-select/index.mjs";
|
|
42
|
+
import { Transfer as Lr } from "./transfer/index.mjs";
|
|
43
|
+
import { Tree as Qr } from "./tree/index.mjs";
|
|
44
|
+
import { TreeSelect as vr } from "./tree-select/index.mjs";
|
|
45
|
+
import { Upload as Ur } from "./upload/index.mjs";
|
|
46
|
+
import { _ as qr } from "./form/form.mjs";
|
|
47
|
+
import { _ as Hr } from "./form-layout/form-layout.mjs";
|
|
48
|
+
import { ElSpace as Kr } from "element-plus";
|
|
47
49
|
export {
|
|
48
50
|
e as ArrayCards,
|
|
49
51
|
m as ArrayCollapse,
|
|
50
52
|
f as ArrayItems,
|
|
51
53
|
a as ArrayListTabs,
|
|
52
54
|
s as ArrayTable,
|
|
53
|
-
|
|
55
|
+
c as ArrayTabs,
|
|
54
56
|
T as Autocomplete,
|
|
55
57
|
d as Cascader,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
S as Checkbox,
|
|
59
|
+
y as ColorPicker,
|
|
60
|
+
C as ColorPickerPanel,
|
|
61
|
+
k as DatePicker,
|
|
60
62
|
w as DatePickerPanel,
|
|
61
63
|
g as Editable,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
qr as Form,
|
|
65
|
+
j as FormBaseItem,
|
|
64
66
|
h as FormButtonGroup,
|
|
65
67
|
E as FormCollapse,
|
|
66
68
|
G as FormCollapseItem,
|
|
67
69
|
M as FormDialog,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
_ as FormDrawer,
|
|
71
|
+
N as FormGrid,
|
|
72
|
+
q as FormItem,
|
|
73
|
+
Hr as FormLayout,
|
|
74
|
+
J as FormStep,
|
|
75
|
+
O as FormTab,
|
|
74
76
|
X as Input,
|
|
75
77
|
Z as InputNumber,
|
|
76
78
|
rr as InputTag,
|
|
77
79
|
er as Mention,
|
|
78
80
|
mr as Password,
|
|
79
81
|
fr as PreviewText,
|
|
80
|
-
ar as
|
|
81
|
-
sr as
|
|
82
|
-
|
|
83
|
-
Tr as
|
|
84
|
-
dr as
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
kr as
|
|
89
|
-
|
|
90
|
-
wr as
|
|
91
|
-
gr as
|
|
92
|
-
hr as
|
|
93
|
-
Er as
|
|
94
|
-
Lr as
|
|
95
|
-
|
|
82
|
+
ar as QueryForm,
|
|
83
|
+
sr as QueryFormItem,
|
|
84
|
+
cr as Radio,
|
|
85
|
+
Tr as Rate,
|
|
86
|
+
dr as Reset,
|
|
87
|
+
Sr as Segmented,
|
|
88
|
+
yr as Select,
|
|
89
|
+
Cr as SelectTable,
|
|
90
|
+
kr as Slider,
|
|
91
|
+
Kr as Space,
|
|
92
|
+
wr as Submit,
|
|
93
|
+
gr as Switch,
|
|
94
|
+
hr as TimePicker,
|
|
95
|
+
Er as TimeSelect,
|
|
96
|
+
Lr as Transfer,
|
|
97
|
+
Qr as Tree,
|
|
98
|
+
vr as TreeSelect,
|
|
99
|
+
Ur as Upload,
|
|
96
100
|
V as composeFormTab,
|
|
97
|
-
|
|
101
|
+
z as fieldFeedbackMapper
|
|
98
102
|
};
|
|
99
103
|
//# sourceMappingURL=index.mjs.map
|
package/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/esm/input/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { connect as s, mapProps as a } from "@silver-formily/vue";
|
|
2
2
|
import { PreviewText as i } from "../preview-text/index.mjs";
|
|
3
|
-
import { defineComponent as d, useSlots as l,
|
|
3
|
+
import { defineComponent as d, useSlots as l, openBlock as c, createBlock as y, unref as p, normalizeProps as x, guardReactiveProps as I, createSlots as k, withCtx as t, renderSlot as r } from "vue";
|
|
4
4
|
import { ElInput as v } from "element-plus";
|
|
5
5
|
import { useCleanAttrs as P, composeExport as _ } from "../__builtins__/shared/utils.mjs";
|
|
6
6
|
import { mapReadPretty as f } from "../__builtins__/shared/transform-component.mjs";
|
|
@@ -10,7 +10,7 @@ const m = /* @__PURE__ */ d({
|
|
|
10
10
|
__name: "input",
|
|
11
11
|
setup(o) {
|
|
12
12
|
const e = l(), { props: u } = P();
|
|
13
|
-
return (n, A) => (
|
|
13
|
+
return (n, A) => (c(), y(p(v), x(I(p(u))), k({ _: 2 }, [
|
|
14
14
|
e.prefix ? {
|
|
15
15
|
name: "prefix",
|
|
16
16
|
fn: t(() => [
|