@silver-formily/element-plus 2.4.0 → 3.0.1
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__/shared/transform-component.d.ts +1 -1
- package/esm/__builtins__/shared/utils.mjs +0 -2
- package/esm/__builtins__/shared/utils.mjs.map +1 -1
- package/esm/array-base/index.mjs +11 -11
- package/esm/array-base/symbols.mjs +1 -1
- package/esm/array-base/symbols.mjs.map +1 -1
- package/esm/array-base/utils.mjs +0 -1
- package/esm/array-base/utils.mjs.map +1 -1
- package/esm/array-cards/index.mjs +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 -10
- 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 -4
- 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 +12 -12
- package/esm/editable/index.d.ts +6 -6
- package/esm/editable/index.mjs +27 -33
- 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/index.mjs +5 -12
- 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.d.ts +1 -1
- package/esm/form-dialog/index.mjs +63 -70
- package/esm/form-dialog/index.mjs.map +1 -1
- package/esm/form-dialog/types.d.ts +13 -5
- package/esm/form-drawer/index.d.ts +1 -1
- package/esm/form-drawer/index.mjs +62 -69
- package/esm/form-drawer/index.mjs.map +1 -1
- package/esm/form-drawer/types.d.ts +13 -5
- 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 +34 -32
- package/esm/form-grid/index.mjs.map +1 -1
- package/esm/form-item/index.mjs +25 -31
- package/esm/form-item/index.mjs.map +1 -1
- package/esm/form-item/types.d.ts +8 -6
- package/esm/form-layout/form-layout.mjs +2 -2
- package/esm/form-layout/utils.mjs +2 -2
- 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 +39 -40
- package/esm/form-tab/index.mjs.map +1 -1
- package/esm/index.mjs +9 -9
- 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 +2 -11
- 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/index.d.ts +3 -3
- package/esm/query-form/index.mjs +28 -31
- package/esm/query-form/index.mjs.map +1 -1
- package/esm/query-form/query-form.d.ts +1 -1
- package/esm/query-form/types.d.ts +1 -1
- package/esm/query-form-item/index.mjs +7 -11
- package/esm/query-form-item/index.mjs.map +1 -1
- 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 +4 -5
- package/esm/select-table/index.mjs.map +1 -1
- package/esm/select-table/select-table.d.ts +2 -2
- package/esm/styles/form-grid/index.css +1 -1
- 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 +111 -85
- 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 +57 -82
- package/LICENSE +0 -21
package/esm/form-item/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { useField as fe, connect as ve, mapProps as pe } from "@silver-formily/v
|
|
|
3
3
|
import { useNamespace as me, useFormSize as be, useId as ye, formItemContextKey as ke, ElTooltip as R, ElIcon as D } from "element-plus";
|
|
4
4
|
import "@formily/reactive";
|
|
5
5
|
import { useResizeObserver as ge } from "@vueuse/core";
|
|
6
|
-
import { defineComponent as Se, useSlots as he, computed as s, ref as b, reactive as xe, watch as Ce, provide as G,
|
|
6
|
+
import { defineComponent as Se, useSlots as he, computed as s, ref as b, reactive as xe, watch as Ce, provide as G, openBlock as a, createElementBlock as n, unref as l, normalizeClass as u, createBlock as f, resolveDynamicComponent as g, normalizeStyle as F, withCtx as m, isVNode as S, createVNode as x, createElementVNode as C, toDisplayString as y, Fragment as I, createTextVNode as E, createCommentVNode as c, renderSlot as K, TransitionGroup as Ie } from "vue";
|
|
7
7
|
import "@silver-formily/reactive-vue";
|
|
8
8
|
import { composeExport as _e } from "../__builtins__/shared/utils.mjs";
|
|
9
9
|
import { InfoFilled as $e, CircleClose as we, CircleCheck as Fe, Warning as We } from "@element-plus/icons-vue";
|
|
@@ -12,7 +12,7 @@ import { stylePrefix as Le } from "../__builtins__/configs/index.mjs";
|
|
|
12
12
|
import { FORM_LAYOUT_PROPS_KEYS as ze, useFormLayout as Be, formLayoutShallowContext as Te } from "../form-layout/utils.mjs";
|
|
13
13
|
import { p as Re } from "../vendor/lodash.mjs";
|
|
14
14
|
import { i as Ee, a as Ve, d as Pe } from "../vendor/types.mjs";
|
|
15
|
-
import {
|
|
15
|
+
import { a as Ne } from "../vendor/shared.esm-bundler.mjs";
|
|
16
16
|
import { getFeedbackMessage as Oe, determineFeedbackStatus as qe } from "./utils.mjs";
|
|
17
17
|
import '../styles/form-item/index.css';const Me = "utils/dom/style";
|
|
18
18
|
function U(i, p = "px") {
|
|
@@ -61,7 +61,7 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ Se({
|
|
|
61
61
|
feedbackLayout: "loose",
|
|
62
62
|
fullness: !1,
|
|
63
63
|
labelWrap: !1
|
|
64
|
-
}, Q.value, J.value)), V = fe(), X = be(void 0, { formItem: !1 }), P = s(() => v(t.value.size) ? t.value.size : X.value), A = ye().value, k = b([]), N = b(""), O = b(),
|
|
64
|
+
}, Q.value, J.value)), V = fe(), X = be(void 0, { formItem: !1 }), P = s(() => v(t.value.size) ? t.value.size : X.value), A = ye().value, k = b([]), N = b(""), O = b(), h = b(), q = b();
|
|
65
65
|
p({
|
|
66
66
|
feedbackTooltipRef: q
|
|
67
67
|
});
|
|
@@ -101,22 +101,16 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ Se({
|
|
|
101
101
|
async function oe() {
|
|
102
102
|
return !0;
|
|
103
103
|
}
|
|
104
|
-
/* istanbul ignore next -- @preserve */
|
|
105
104
|
const re = () => {
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const se = async () => {
|
|
109
|
-
};
|
|
110
|
-
/* istanbul ignore next -- @preserve */
|
|
111
|
-
const ie = () => {
|
|
105
|
+
}, se = async () => {
|
|
106
|
+
}, ie = () => {
|
|
112
107
|
}, ne = (r) => {
|
|
113
|
-
/* istanbul ignore else -- @preserve */
|
|
114
108
|
k.value.includes(r) || k.value.push(r);
|
|
115
109
|
}, ue = (r) => {
|
|
116
110
|
k.value = k.value.filter((w) => w !== r);
|
|
117
111
|
}, j = b(!1);
|
|
118
|
-
ge(
|
|
119
|
-
j.value =
|
|
112
|
+
ge(h, () => {
|
|
113
|
+
j.value = h.value?.scrollWidth > h.value?.clientWidth;
|
|
120
114
|
});
|
|
121
115
|
const T = s(() => j.value && !t.value.labelWrap), de = b(""), $ = xe({
|
|
122
116
|
$el: O,
|
|
@@ -170,17 +164,17 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ Se({
|
|
|
170
164
|
style: F(Z.value)
|
|
171
165
|
}, {
|
|
172
166
|
default: m(() => [
|
|
173
|
-
|
|
167
|
+
S(e.label) ? (a(), f(g(e.label), { key: 0 })) : (a(), n("div", {
|
|
174
168
|
key: 1,
|
|
175
169
|
class: u(`${d}-label__wrapper`)
|
|
176
170
|
}, [
|
|
177
|
-
|
|
171
|
+
x(l(R), {
|
|
178
172
|
disabled: !T.value && t.value.tooltipLayout !== "text"
|
|
179
173
|
}, {
|
|
180
174
|
content: m(() => [
|
|
181
|
-
|
|
175
|
+
S(e.tooltip) ? (a(), f(g(e.tooltip), { key: 0 })) : (a(), n("div", {
|
|
182
176
|
key: 1,
|
|
183
|
-
style: F(`width: ${
|
|
177
|
+
style: F(`width: ${h.value?.clientWidth ?? 0}px;`)
|
|
184
178
|
}, [
|
|
185
179
|
T.value ? (a(), n(I, { key: 0 }, [
|
|
186
180
|
E(y(e.label), 1)
|
|
@@ -191,30 +185,30 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ Se({
|
|
|
191
185
|
], 4))
|
|
192
186
|
]),
|
|
193
187
|
default: m(() => [
|
|
194
|
-
|
|
188
|
+
C("span", {
|
|
195
189
|
class: u({
|
|
196
190
|
[`${d}-label-content`]: !0,
|
|
197
191
|
"is-tooltip": T.value || e.tooltip && t.value.tooltipLayout === "text"
|
|
198
192
|
})
|
|
199
193
|
}, [
|
|
200
|
-
|
|
194
|
+
C("span", {
|
|
201
195
|
ref_key: "labelRef",
|
|
202
|
-
ref:
|
|
196
|
+
ref: h
|
|
203
197
|
}, y(e.label), 513)
|
|
204
198
|
], 2)
|
|
205
199
|
]),
|
|
206
200
|
_: 1
|
|
207
201
|
}, 8, ["disabled"]),
|
|
208
|
-
e.tooltip && t.value.tooltipLayout !== "text" ? (a(), f(l(R), {
|
|
202
|
+
e.tooltip && !S(e.tooltip) && t.value.tooltipLayout !== "text" ? (a(), f(l(R), {
|
|
209
203
|
key: 0,
|
|
210
204
|
content: e.tooltip
|
|
211
205
|
}, {
|
|
212
206
|
default: m(() => [
|
|
213
|
-
|
|
207
|
+
x(l(D), {
|
|
214
208
|
class: u(`${d}-label-tooltip`)
|
|
215
209
|
}, {
|
|
216
210
|
default: m(() => [
|
|
217
|
-
|
|
211
|
+
x(l($e))
|
|
218
212
|
]),
|
|
219
213
|
_: 1
|
|
220
214
|
}, 8, ["class"])
|
|
@@ -229,7 +223,7 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ Se({
|
|
|
229
223
|
]),
|
|
230
224
|
_: 1
|
|
231
225
|
}, 8, ["id", "for", "class", "style"])) : c("", !0),
|
|
232
|
-
|
|
226
|
+
C("div", {
|
|
233
227
|
class: u([
|
|
234
228
|
`${d}-content__wrapper`,
|
|
235
229
|
l(v)(t.value.wrapperCol) && `${d}-col-${t.value.wrapperCol}`
|
|
@@ -237,12 +231,12 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ Se({
|
|
|
237
231
|
style: F(te.value)
|
|
238
232
|
}, [
|
|
239
233
|
l(v)(e.addonBefore) ? (a(), n(I, { key: 0 }, [
|
|
240
|
-
|
|
234
|
+
S(e.addonBefore) ? (a(), f(g(e.addonBefore), { key: 0 })) : (a(), n("div", {
|
|
241
235
|
key: 1,
|
|
242
236
|
class: u(`${d}-addon-before`)
|
|
243
237
|
}, y(e.addonBefore), 3))
|
|
244
238
|
], 64)) : c("", !0),
|
|
245
|
-
|
|
239
|
+
C("div", {
|
|
246
240
|
class: u([
|
|
247
241
|
l(o).e("content"),
|
|
248
242
|
t.value.fullness && "is-fullness",
|
|
@@ -262,10 +256,10 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ Se({
|
|
|
262
256
|
K(r.$slots, "default")
|
|
263
257
|
]),
|
|
264
258
|
content: m(() => [
|
|
265
|
-
|
|
259
|
+
C("div", {
|
|
266
260
|
class: u([...M.value, l(o).is("tooltip")])
|
|
267
261
|
}, [
|
|
268
|
-
|
|
262
|
+
x(l(D), null, {
|
|
269
263
|
default: m(() => [
|
|
270
264
|
e.feedbackStatus === "error" ? (a(), f(l(we), { key: 0 })) : c("", !0),
|
|
271
265
|
e.feedbackStatus === "success" ? (a(), f(l(Fe), { key: 1 })) : c("", !0),
|
|
@@ -278,7 +272,7 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ Se({
|
|
|
278
272
|
]),
|
|
279
273
|
_: 3
|
|
280
274
|
}, 8, ["visible"])) : K(r.$slots, "default", { key: 1 }),
|
|
281
|
-
|
|
275
|
+
x(Ie, {
|
|
282
276
|
name: `${l(o).namespace.value}-zoom-in-top`
|
|
283
277
|
}, {
|
|
284
278
|
default: m(() => [
|
|
@@ -287,7 +281,7 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ Se({
|
|
|
287
281
|
class: u(M.value)
|
|
288
282
|
}, y(e.feedbackText), 3)) : c("", !0),
|
|
289
283
|
l(v)(e.extra) ? (a(), n(I, { key: 1 }, [
|
|
290
|
-
|
|
284
|
+
S(e.extra) ? (a(), f(g(e.extra), { key: 0 })) : (a(), n("div", {
|
|
291
285
|
key: 1,
|
|
292
286
|
class: u(`${d}-extra`)
|
|
293
287
|
}, y(e.extra), 3))
|
|
@@ -297,7 +291,7 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ Se({
|
|
|
297
291
|
}, 8, ["name"])
|
|
298
292
|
], 6),
|
|
299
293
|
l(v)(e.addonAfter) ? (a(), n(I, { key: 1 }, [
|
|
300
|
-
|
|
294
|
+
S(e.addonAfter) ? (a(), f(g(e.addonAfter), { key: 0 })) : (a(), n("div", {
|
|
301
295
|
key: 1,
|
|
302
296
|
class: u(`${d}-addon-after`)
|
|
303
297
|
}, y(e.addonAfter), 3))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.22_typescript@5.9.3_/node_modules/element-plus/es/utils/dom/style.mjs","../../src/form-item/form-item.vue","../../src/form-item/index.ts"],"sourcesContent":["import { isNumber, isStringNumber } from '../types.mjs';\nimport { isClient } from '@vueuse/core';\nimport { isString, camelize, isObject } from '@vue/shared';\nimport { entriesOf, keysOf } from '../objects.mjs';\nimport { debugWarn } from '../error.mjs';\n\nconst SCOPE = \"utils/dom/style\";\nconst classNameToArray = (cls = \"\") => cls.split(\" \").filter((item) => !!item.trim());\nconst hasClass = (el, cls) => {\n if (!el || !cls) return false;\n if (cls.includes(\" \")) throw new Error(\"className should not contain space.\");\n return el.classList.contains(cls);\n};\nconst addClass = (el, cls) => {\n if (!el || !cls.trim()) return;\n el.classList.add(...classNameToArray(cls));\n};\nconst removeClass = (el, cls) => {\n if (!el || !cls.trim()) return;\n el.classList.remove(...classNameToArray(cls));\n};\nconst getStyle = (element, styleName) => {\n var _a;\n if (!isClient || !element || !styleName) return \"\";\n let key = camelize(styleName);\n if (key === \"float\") key = \"cssFloat\";\n try {\n const style = element.style[key];\n if (style) return style;\n const computed = (_a = document.defaultView) == null ? void 0 : _a.getComputedStyle(element, \"\");\n return computed ? computed[key] : \"\";\n } catch (e) {\n return element.style[key];\n }\n};\nconst setStyle = (element, styleName, value) => {\n if (!element || !styleName) return;\n if (isObject(styleName)) {\n entriesOf(styleName).forEach(\n ([prop, value2]) => setStyle(element, prop, value2)\n );\n } else {\n const key = camelize(styleName);\n element.style[key] = value;\n }\n};\nconst removeStyle = (element, style) => {\n if (!element || !style) return;\n if (isObject(style)) {\n keysOf(style).forEach((prop) => removeStyle(element, prop));\n } else {\n setStyle(element, style, \"\");\n }\n};\nfunction addUnit(value, defaultUnit = \"px\") {\n if (!value && value !== 0) return \"\";\n if (isNumber(value) || isStringNumber(value)) {\n return `${value}${defaultUnit}`;\n } else if (isString(value)) {\n return value;\n }\n debugWarn(SCOPE, \"binding value must be a string or number\");\n}\n\nexport { addClass, addUnit, classNameToArray, getStyle, hasClass, removeClass, removeStyle, setStyle };\n//# sourceMappingURL=style.mjs.map\n","<script lang=\"ts\" setup>\nimport type { Field } from '@formily/core'\nimport type {\n FormItemContext,\n FormItemValidateState,\n FormValidationResult,\n TooltipInstance,\n} from 'element-plus'\nimport type { ICalculatedFormLayoutProps } from 'src/form-layout/types'\nimport type { CSSProperties } from 'vue'\nimport type { IFormItemProps } from './types'\nimport { CircleCheck, CircleClose, InfoFilled, Warning } from '@element-plus/icons-vue'\nimport { isArr, isValid } from '@formily/shared'\nimport { useField } from '@silver-formily/vue'\nimport { useResizeObserver } from '@vueuse/core'\nimport { ElIcon, ElTooltip, formItemContextKey, useFormSize, useId, useNamespace } from 'element-plus'\nimport { addUnit } from 'element-plus/es/utils/index'\nimport { pick } from 'lodash-es'\nimport { computed, isVNode, provide, reactive, ref, useSlots, watch } from 'vue'\nimport { stylePrefix } from '../__builtins__'\nimport { FORM_LAYOUT_PROPS_KEYS, formLayoutShallowContext, useFormLayout } from '../form-layout/utils'\n\ndefineOptions({\n name: 'FFormItem',\n})\nconst props = withDefaults(defineProps<IFormItemProps>(), {\n asterisk: undefined,\n colon: undefined,\n labelWrap: undefined,\n fullness: undefined,\n})\nconst slots = useSlots()\nconst ns = useNamespace('form-item')\nconst prefixCls = `${stylePrefix}-form-item`\nconst rootFormItemClass = computed(() => props.internalFormItemClass || ns.b())\nconst formItemConfig = computed<Partial<ICalculatedFormLayoutProps>>(() =>\n Object.fromEntries(\n Object.entries(pick(props, FORM_LAYOUT_PROPS_KEYS))\n .filter(([_, value]) => isValid(value)),\n ),\n)\nconst formlayoutConfig = useFormLayout()\nconst formlayout = computed(() => Object.assign({\n colon: true,\n feedbackLayout: 'loose',\n fullness: false,\n labelWrap: false,\n}, formlayoutConfig.value, formItemConfig.value))\nconst field = useField<Field>()\n\nconst inheritedSize = useFormSize(undefined, { formItem: false })\nconst formItemSize = computed(() => {\n if (isValid(formlayout.value.size)) {\n return formlayout.value.size\n }\n return inheritedSize.value\n})\n\nconst labelId = useId().value\nconst inputIds = ref<string[]>([])\n\nconst validateState = ref<FormItemValidateState>('')\nconst formItemRef = ref<HTMLDivElement>()\nconst labelRef = ref<HTMLElement>()\nconst feedbackTooltipRef = ref<TooltipInstance>()\ndefineExpose({\n feedbackTooltipRef,\n})\n\nconst labelPosition = computed(\n () => {\n if (formlayout.value.layout === 'vertical' || (isArr(formlayout.value.layout) && formlayout.value.layout.includes('vertical' as any))) {\n return 'top'\n }\n return formlayout.value.labelAlign ?? 'right'\n },\n)\n\nconst labelStyle = computed<CSSProperties>(() => {\n if (labelPosition.value === 'top') {\n return {}\n }\n\n const labelWidth = addUnit(formlayout.value.labelWidth || '')\n if (labelWidth)\n return { width: labelWidth }\n return {}\n})\n\nconst contentStyle = computed<CSSProperties>(() => {\n const contentWidth = addUnit(formlayout.value?.wrapperWidth || '')\n if (contentWidth)\n return { width: contentWidth, flex: 'unset' }\n return {}\n})\n\nconst contentWrapperStyle = computed<CSSProperties>(() => {\n return {\n justifyContent: formlayout.value?.wrapperAlign === 'right' && 'flex-end',\n }\n})\n\nconst isRequired = computed(() =>\n props.asterisk && field.value?.pattern !== 'readPretty',\n)\n\nconst formItemClasses = computed(() => [\n rootFormItemClass.value,\n ns.m(formItemSize.value || 'default'),\n ns.is(props.feedbackStatus),\n ns.is('validating', validateState.value === 'validating'),\n ns.is('success', validateState.value === 'success'),\n ns.is('required', isRequired.value || props.asterisk),\n ns.is('no-asterisk', formlayout.value?.hideRequiredAsterisk),\n ns.is(formlayout.value.feedbackLayout),\n formlayout.value?.requireAsteriskPosition === 'right'\n ? 'asterisk-right'\n : 'asterisk-left',\n {\n [ns.m('feedback')]: formlayout.value?.statusIcon,\n [ns.m(`label-${labelPosition.value}`)]: labelPosition.value,\n },\n])\n\nconst validateClasses = computed(() => [\n `${prefixCls}-feedback`,\n ns.is(props.feedbackStatus),\n ns.is('loose', formlayout.value.feedbackLayout === 'loose'),\n])\n\nconst hasLabel = computed<boolean>(() => {\n return (props.label !== '' && isValid(props.label)) || isValid(slots.label)\n})\n\nconst labelFor = computed<string | undefined>(() => {\n return (\n props.for || (inputIds.value.length === 1 ? inputIds.value[0] : undefined)\n )\n})\n\nconst isGroup = computed<boolean>(() => {\n return !labelFor.value && hasLabel.value\n})\n\nasync function validate(): FormValidationResult {\n return true\n}\n/* istanbul ignore next -- @preserve */\nconst clearValidate: FormItemContext['clearValidate'] = () => {}\n/* istanbul ignore next -- @preserve */\nconst resetField: FormItemContext['resetField'] = async () => {}\n/* istanbul ignore next -- @preserve */\nconst setInitialValue: FormItemContext['setInitialValue'] = () => {}\n\nconst addInputId: FormItemContext['addInputId'] = (id: string) => {\n /* istanbul ignore else -- @preserve */\n if (!inputIds.value.includes(id)) {\n inputIds.value.push(id)\n }\n}\n\nconst removeInputId: FormItemContext['removeInputId'] = (id: string) => {\n inputIds.value = inputIds.value.filter(listId => listId !== id)\n}\n\nconst isEllipsisActive = ref(false)\nuseResizeObserver(labelRef, () => {\n isEllipsisActive.value = labelRef.value?.scrollWidth > labelRef.value?.clientWidth\n})\nconst isEllipsis = computed(() => {\n return isEllipsisActive.value && !formlayout.value.labelWrap\n})\n\n// HACK computed无法监听到props.feedbackStatus的变化\nconst _validateState = ref<FormItemValidateState>('')\nconst context: FormItemContext = reactive({\n $el: formItemRef,\n labelWidth: formlayout.value?.labelWidth,\n size: formItemSize,\n validateState: _validateState.value,\n labelId,\n inputIds,\n isGroup,\n hasLabel,\n addInputId,\n removeInputId,\n resetField,\n clearValidate,\n validate,\n labelPosition,\n inlineMessage: true,\n showMessage: true,\n fieldValue: field.value?.value,\n validateMessage: '',\n propString: '',\n setInitialValue,\n})\nwatch(() => props.feedbackStatus, (val) => {\n if (val === 'pending') {\n context.validateState = 'validating'\n return\n }\n if (val === 'warning') {\n context.validateState = ''\n return\n }\n context.validateState = val\n}, {\n immediate: true,\n})\n\nprovide(formLayoutShallowContext, ref({\n ...(isValid(formlayout.value.size) && { size: formlayout.value.size }),\n ...(isValid(formlayout.value.colon) && { colon: formlayout.value.colon }),\n}))\nprovide(formItemContextKey, context)\n</script>\n\n<template>\n <div\n ref=\"formItemRef\" :class=\"[prefixCls, formlayout.labelWrap && 'is-warp', ...formItemClasses]\"\n :role=\"isGroup ? 'group' : undefined\" :aria-labelledby=\"isGroup ? labelId : undefined\"\n >\n <component\n :is=\"labelFor ? 'label' : 'div'\" v-if=\"hasLabel\" :id=\"labelId\" :for=\"labelFor\"\n :class=\"[ns.e('label'), isValid(formlayout.labelCol) && `${prefixCls}-col-${formlayout.labelCol}`]\"\n :style=\"labelStyle\"\n >\n <!-- label -->\n <template v-if=\"isVNode(props.label)\">\n <component :is=\"props.label\" />\n </template>\n <div v-else :class=\"`${prefixCls}-label__wrapper`\">\n <ElTooltip :disabled=\"!isEllipsis && formlayout.tooltipLayout !== 'text'\">\n <span\n :class=\"{\n [`${prefixCls}-label-content`]: true,\n ['is-tooltip']: isEllipsis || (props.tooltip && formlayout.tooltipLayout === 'text'),\n }\"\n >\n <span ref=\"labelRef\">{{ props.label }}</span>\n </span>\n <template #content>\n <template v-if=\"isVNode(props.tooltip)\">\n <component :is=\"props.tooltip\" />\n </template>\n <div v-else :style=\"`width: ${labelRef?.clientWidth ?? 0}px;`\">\n <template v-if=\"isEllipsis\">\n {{ props.label }}\n </template>\n <template v-if=\"formlayout.tooltipLayout === 'text'\">\n {{ props.tooltip }}\n </template>\n </div>\n </template>\n </ElTooltip>\n <ElTooltip v-if=\"props.tooltip && formlayout.tooltipLayout !== 'text'\" :content=\"props.tooltip\">\n <ElIcon :class=\"`${prefixCls}-label-tooltip`\">\n <InfoFilled />\n </ElIcon>\n </ElTooltip>\n <span v-if=\"formlayout.colon\" :class=\"`${prefixCls}-colon`\">:</span>\n </div>\n </component>\n <!-- content -->\n <div\n :class=\"[\n `${prefixCls}-content__wrapper`,\n isValid(formlayout.wrapperCol) && `${prefixCls}-col-${formlayout.wrapperCol}`,\n ]\"\n :style=\"contentWrapperStyle\"\n >\n <template v-if=\"isValid(props.addonBefore)\">\n <template v-if=\"isVNode(props.addonBefore)\">\n <component :is=\"props.addonBefore\" />\n </template>\n <div v-else :class=\"`${prefixCls}-addon-before`\">\n {{ props.addonBefore }}\n </div>\n </template>\n <div\n :class=\"[\n ns.e('content'),\n formlayout.fullness && 'is-fullness',\n ns.is('addon-after', !!props.addonAfter),\n ]\" :style=\"contentStyle\"\n >\n <ElTooltip\n v-if=\"formlayout.feedbackLayout === 'popover'\"\n ref=\"feedbackTooltipRef\"\n :visible=\"!!props.feedbackText\"\n effect=\"light\"\n :offset=\"6\"\n >\n <template #default>\n <slot />\n </template>\n <template #content>\n <div :class=\"[...validateClasses, ns.is('tooltip')]\">\n <ElIcon>\n <CircleClose v-if=\"props.feedbackStatus === 'error'\" />\n <CircleCheck v-if=\"props.feedbackStatus === 'success'\" />\n <Warning v-if=\"props.feedbackStatus === 'warning'\" />\n </ElIcon>\n {{ props.feedbackText }}\n </div>\n </template>\n </ElTooltip>\n <slot v-else />\n <TransitionGroup :name=\"`${ns.namespace.value}-zoom-in-top`\">\n <div v-if=\"props.feedbackText && formlayout.feedbackLayout !== 'popover'\" :class=\"validateClasses\">\n {{ props.feedbackText }}\n </div>\n <template v-if=\"isValid(props.extra)\">\n <template v-if=\"isVNode(props.extra)\">\n <component :is=\"props.extra\" />\n </template>\n <div v-else :class=\"`${prefixCls}-extra`\">\n {{ props.extra }}\n </div>\n </template>\n </TransitionGroup>\n </div>\n <template v-if=\"isValid(props.addonAfter)\">\n <template v-if=\"isVNode(props.addonAfter)\">\n <component :is=\"props.addonAfter\" />\n </template>\n <div v-else :class=\"`${prefixCls}-addon-after`\">\n {{ props.addonAfter }}\n </div>\n </template>\n </div>\n </div>\n</template>\n","import { isVoidField } from '@formily/core'\nimport { connect, mapProps } from '@silver-formily/vue'\nimport { composeExport } from '../__builtins__'\nimport FormBaseItem from './form-item.vue'\nimport { determineFeedbackStatus, getFeedbackMessage } from './utils'\nimport './style.scss'\n\nexport function fieldFeedbackMapper(props, field) {\n if (isVoidField(field) || !field) {\n return props\n }\n\n const feedbackText = getFeedbackMessage(field)\n const feedbackStatus = determineFeedbackStatus(field)\n const asterisk = 'asterisk' in props\n ? props.asterisk\n : field.required && field.pattern !== 'readPretty'\n\n return {\n ...props,\n feedbackText,\n feedbackStatus,\n asterisk,\n }\n}\n\nconst Item = connect<typeof FormBaseItem>(\n FormBaseItem,\n mapProps(\n {\n validateStatus: true,\n title: 'label',\n required: true,\n description: 'extra',\n },\n fieldFeedbackMapper,\n ),\n)\n\nexport const FormItem = composeExport(Item, {\n BaseItem: FormBaseItem,\n})\n\nexport default FormItem\n\nexport { default as FormBaseItem } from './form-item.vue'\nexport type { IFormItemProps } from './types'\n"],"names":["SCOPE","addUnit","value","defaultUnit","isNumber","isStringNumber","isString","debugWarn","props","__props","slots","useSlots","ns","useNamespace","prefixCls","stylePrefix","rootFormItemClass","computed","formItemConfig","pick","FORM_LAYOUT_PROPS_KEYS","_","isValid","formlayoutConfig","useFormLayout","formlayout","field","useField","inheritedSize","useFormSize","formItemSize","labelId","useId","inputIds","ref","validateState","formItemRef","labelRef","feedbackTooltipRef","__expose","labelPosition","isArr","labelStyle","labelWidth","contentStyle","contentWidth","contentWrapperStyle","isRequired","formItemClasses","validateClasses","hasLabel","labelFor","isGroup","validate","clearValidate","resetField","setInitialValue","addInputId","id","removeInputId","listId","isEllipsisActive","useResizeObserver","isEllipsis","_validateState","context","reactive","watch","val","provide","formLayoutShallowContext","formItemContextKey","_createElementBlock","_unref","_openBlock","_createBlock","_resolveDynamicComponent","_normalizeClass","isVNode","_createVNode","ElTooltip","_normalizeStyle","_Fragment","_createTextVNode","_toDisplayString","_createElementVNode","ElIcon","InfoFilled","_renderSlot","_ctx","CircleClose","CircleCheck","Warning","_TransitionGroup","fieldFeedbackMapper","isVoidField","feedbackText","getFeedbackMessage","feedbackStatus","determineFeedbackStatus","asterisk","Item","connect","FormBaseItem","mapProps","FormItem","composeExport"],"mappings":";;;;;;;;;;;;;;;;AAMA,MAAMA,KAAQ;AAgDd,SAASC,EAAQC,GAAOC,IAAc,MAAM;AAC1C,MAAI,CAACD,KAASA,MAAU,EAAG,QAAO;AAClC,MAAIE,GAASF,CAAK,KAAKG,GAAeH,CAAK;AACzC,WAAO,GAAGA,CAAK,GAAGC,CAAW;AACxB,MAAIG,GAASJ,CAAK;AACvB,WAAOA;AAET,EAAAK,GAAUP,IAAO,0CAA0C;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACrCA,UAAMQ,IAAQC,GAMRC,IAAQC,GAAA,GACRC,IAAKC,GAAa,WAAW,GAC7BC,IAAY,GAAGC,EAAW,cAC1BC,IAAoBC,EAAS,MAAMT,EAAM,yBAAyBI,EAAG,GAAG,GACxEM,IAAiBD;AAAA,MAA8C,MACnE,OAAO;AAAA,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AA,CAAA,WAElCgE,EAEM,OAAA;AAAA;YAFO,YAAU1D,CAAS,cAAA;AAAA,UAAA,GAC3BsE,EAAA5E,EAAM,UAAU,GAAA,CAAA;AAAA,QAAA;;;;;ACjUtB,SAASsF,GAAoBtF,GAAOkB,GAAO;AAChD,MAAIqE,GAAYrE,CAAK,KAAK,CAACA;AACzB,WAAOlB;AAGT,QAAMwF,IAAeC,GAAmBvE,CAAK,GACvCwE,IAAiBC,GAAwBzE,CAAK,GAC9C0E,IAAW,cAAc5F,IAC3BA,EAAM,WACNkB,EAAM,YAAYA,EAAM,YAAY;AAExC,SAAO;AAAA,IACL,GAAGlB;AAAA,IACH,cAAAwF;AAAA,IACA,gBAAAE;AAAA,IACA,UAAAE;AAAA,EAAA;AAEJ;AAEA,MAAMC,KAAOC;AAAA,EACXC;AAAAA,EACAC;AAAA,IACE;AAAA,MACE,gBAAgB;AAAA,MAChB,OAAO;AAAA,MACP,UAAU;AAAA,MACV,aAAa;AAAA,IAAA;AAAA,IAEfV;AAAA,EAAA;AAEJ,GAEaW,KAAWC,GAAcL,IAAM;AAAA,EAC1C,UAAUE;AACZ,CAAC;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.28_typescript@5.9.2_/node_modules/element-plus/es/utils/dom/style.mjs","../../src/form-item/form-item.vue","../../src/form-item/index.ts"],"sourcesContent":["import { isNumber, isStringNumber } from '../types.mjs';\nimport { isClient } from '@vueuse/core';\nimport { isString, camelize, isObject } from '@vue/shared';\nimport { entriesOf, keysOf } from '../objects.mjs';\nimport { debugWarn } from '../error.mjs';\n\nconst SCOPE = \"utils/dom/style\";\nconst classNameToArray = (cls = \"\") => cls.split(\" \").filter((item) => !!item.trim());\nconst hasClass = (el, cls) => {\n if (!el || !cls) return false;\n if (cls.includes(\" \")) throw new Error(\"className should not contain space.\");\n return el.classList.contains(cls);\n};\nconst addClass = (el, cls) => {\n if (!el || !cls.trim()) return;\n el.classList.add(...classNameToArray(cls));\n};\nconst removeClass = (el, cls) => {\n if (!el || !cls.trim()) return;\n el.classList.remove(...classNameToArray(cls));\n};\nconst getStyle = (element, styleName) => {\n var _a;\n if (!isClient || !element || !styleName) return \"\";\n let key = camelize(styleName);\n if (key === \"float\") key = \"cssFloat\";\n try {\n const style = element.style[key];\n if (style) return style;\n const computed = (_a = document.defaultView) == null ? void 0 : _a.getComputedStyle(element, \"\");\n return computed ? computed[key] : \"\";\n } catch (e) {\n return element.style[key];\n }\n};\nconst setStyle = (element, styleName, value) => {\n if (!element || !styleName) return;\n if (isObject(styleName)) {\n entriesOf(styleName).forEach(\n ([prop, value2]) => setStyle(element, prop, value2)\n );\n } else {\n const key = camelize(styleName);\n element.style[key] = value;\n }\n};\nconst removeStyle = (element, style) => {\n if (!element || !style) return;\n if (isObject(style)) {\n keysOf(style).forEach((prop) => removeStyle(element, prop));\n } else {\n setStyle(element, style, \"\");\n }\n};\nfunction addUnit(value, defaultUnit = \"px\") {\n if (!value && value !== 0) return \"\";\n if (isNumber(value) || isStringNumber(value)) {\n return `${value}${defaultUnit}`;\n } else if (isString(value)) {\n return value;\n }\n debugWarn(SCOPE, \"binding value must be a string or number\");\n}\n\nexport { addClass, addUnit, classNameToArray, getStyle, hasClass, removeClass, removeStyle, setStyle };\n//# sourceMappingURL=style.mjs.map\n","<script lang=\"ts\" setup>\nimport type { Field } from '@formily/core'\nimport type {\n FormItemContext,\n FormItemValidateState,\n FormValidationResult,\n TooltipInstance,\n} from 'element-plus'\nimport type { ICalculatedFormLayoutProps } from 'src/form-layout/types'\nimport type { CSSProperties } from 'vue'\nimport type { IFormItemProps } from './types'\nimport { CircleCheck, CircleClose, InfoFilled, Warning } from '@element-plus/icons-vue'\nimport { isArr, isValid } from '@formily/shared'\nimport { useField } from '@silver-formily/vue'\nimport { useResizeObserver } from '@vueuse/core'\nimport { ElIcon, ElTooltip, formItemContextKey, useFormSize, useId, useNamespace } from 'element-plus'\nimport { addUnit } from 'element-plus/es/utils/index'\nimport { pick } from 'lodash-es'\nimport { computed, isVNode, provide, reactive, ref, useSlots, watch } from 'vue'\nimport { stylePrefix } from '../__builtins__'\nimport { FORM_LAYOUT_PROPS_KEYS, formLayoutShallowContext, useFormLayout } from '../form-layout/utils'\n\ndefineOptions({\n name: 'FFormItem',\n})\nconst props = withDefaults(defineProps<IFormItemProps>(), {\n asterisk: undefined,\n colon: undefined,\n labelWrap: undefined,\n fullness: undefined,\n})\nconst slots = useSlots()\nconst ns = useNamespace('form-item')\nconst prefixCls = `${stylePrefix}-form-item`\nconst rootFormItemClass = computed(() => props.internalFormItemClass || ns.b())\nconst formItemConfig = computed<Partial<ICalculatedFormLayoutProps>>(() =>\n Object.fromEntries(\n Object.entries(pick(props, FORM_LAYOUT_PROPS_KEYS))\n .filter(([_, value]) => isValid(value)),\n ),\n)\nconst formlayoutConfig = useFormLayout()\nconst formlayout = computed(() => Object.assign({\n colon: true,\n feedbackLayout: 'loose',\n fullness: false,\n labelWrap: false,\n}, formlayoutConfig.value, formItemConfig.value))\nconst field = useField<Field>()\n\nconst inheritedSize = useFormSize(undefined, { formItem: false })\nconst formItemSize = computed(() => {\n if (isValid(formlayout.value.size)) {\n return formlayout.value.size\n }\n return inheritedSize.value\n})\n\nconst labelId = useId().value\nconst inputIds = ref<string[]>([])\n\nconst validateState = ref<FormItemValidateState>('')\nconst formItemRef = ref<HTMLDivElement>()\nconst labelRef = ref<HTMLElement>()\nconst feedbackTooltipRef = ref<TooltipInstance>()\ndefineExpose({\n feedbackTooltipRef,\n})\n\nconst labelPosition = computed(\n () => {\n if (formlayout.value.layout === 'vertical' || (isArr(formlayout.value.layout) && formlayout.value.layout.includes('vertical' as any))) {\n return 'top'\n }\n return formlayout.value.labelAlign ?? 'right'\n },\n)\n\nconst labelStyle = computed<CSSProperties>(() => {\n if (labelPosition.value === 'top') {\n return {}\n }\n\n const labelWidth = addUnit(formlayout.value.labelWidth || '')\n if (labelWidth)\n return { width: labelWidth }\n return {}\n})\n\nconst contentStyle = computed<CSSProperties>(() => {\n const contentWidth = addUnit(formlayout.value?.wrapperWidth || '')\n if (contentWidth)\n return { width: contentWidth, flex: 'unset' }\n return {}\n})\n\nconst contentWrapperStyle = computed<CSSProperties>(() => {\n return {\n justifyContent: formlayout.value?.wrapperAlign === 'right' && 'flex-end',\n }\n})\n\nconst isRequired = computed(() =>\n props.asterisk && field.value?.pattern !== 'readPretty',\n)\n\nconst formItemClasses = computed(() => [\n rootFormItemClass.value,\n ns.m(formItemSize.value || 'default'),\n ns.is(props.feedbackStatus),\n ns.is('validating', validateState.value === 'validating'),\n ns.is('success', validateState.value === 'success'),\n ns.is('required', isRequired.value || props.asterisk),\n ns.is('no-asterisk', formlayout.value?.hideRequiredAsterisk),\n ns.is(formlayout.value.feedbackLayout),\n formlayout.value?.requireAsteriskPosition === 'right'\n ? 'asterisk-right'\n : 'asterisk-left',\n {\n [ns.m('feedback')]: formlayout.value?.statusIcon,\n [ns.m(`label-${labelPosition.value}`)]: labelPosition.value,\n },\n])\n\nconst validateClasses = computed(() => [\n `${prefixCls}-feedback`,\n ns.is(props.feedbackStatus),\n ns.is('loose', formlayout.value.feedbackLayout === 'loose'),\n])\n\nconst hasLabel = computed<boolean>(() => {\n return (props.label !== '' && isValid(props.label)) || isValid(slots.label)\n})\n\nconst labelFor = computed<string | undefined>(() => {\n return (\n props.for || (inputIds.value.length === 1 ? inputIds.value[0] : undefined)\n )\n})\n\nconst isGroup = computed<boolean>(() => {\n return !labelFor.value && hasLabel.value\n})\n\nasync function validate(): FormValidationResult {\n return true\n}\n/* istanbul ignore next -- @preserve */\nconst clearValidate: FormItemContext['clearValidate'] = () => {}\n/* istanbul ignore next -- @preserve */\nconst resetField: FormItemContext['resetField'] = async () => {}\n/* istanbul ignore next -- @preserve */\nconst setInitialValue: FormItemContext['setInitialValue'] = () => {}\n\nconst addInputId: FormItemContext['addInputId'] = (id: string) => {\n /* istanbul ignore else -- @preserve */\n if (!inputIds.value.includes(id)) {\n inputIds.value.push(id)\n }\n}\n\nconst removeInputId: FormItemContext['removeInputId'] = (id: string) => {\n inputIds.value = inputIds.value.filter(listId => listId !== id)\n}\n\nconst isEllipsisActive = ref(false)\nuseResizeObserver(labelRef, () => {\n isEllipsisActive.value = labelRef.value?.scrollWidth > labelRef.value?.clientWidth\n})\nconst isEllipsis = computed(() => {\n return isEllipsisActive.value && !formlayout.value.labelWrap\n})\n\n// HACK computed无法监听到props.feedbackStatus的变化\nconst _validateState = ref<FormItemValidateState>('')\nconst context: FormItemContext = reactive({\n $el: formItemRef,\n labelWidth: formlayout.value?.labelWidth,\n size: formItemSize,\n validateState: _validateState.value,\n labelId,\n inputIds,\n isGroup,\n hasLabel,\n addInputId,\n removeInputId,\n resetField,\n clearValidate,\n validate,\n labelPosition,\n inlineMessage: true,\n showMessage: true,\n fieldValue: field.value?.value,\n validateMessage: '',\n propString: '',\n setInitialValue,\n})\nwatch(() => props.feedbackStatus, (val) => {\n if (val === 'pending') {\n context.validateState = 'validating'\n return\n }\n if (val === 'warning') {\n context.validateState = ''\n return\n }\n context.validateState = val\n}, {\n immediate: true,\n})\n\nprovide(formLayoutShallowContext, ref({\n ...(isValid(formlayout.value.size) && { size: formlayout.value.size }),\n ...(isValid(formlayout.value.colon) && { colon: formlayout.value.colon }),\n}))\nprovide(formItemContextKey, context)\n</script>\n\n<template>\n <div\n ref=\"formItemRef\" :class=\"[prefixCls, formlayout.labelWrap && 'is-warp', ...formItemClasses]\"\n :role=\"isGroup ? 'group' : undefined\" :aria-labelledby=\"isGroup ? labelId : undefined\"\n >\n <component\n :is=\"labelFor ? 'label' : 'div'\" v-if=\"hasLabel\" :id=\"labelId\" :for=\"labelFor\"\n :class=\"[ns.e('label'), isValid(formlayout.labelCol) && `${prefixCls}-col-${formlayout.labelCol}`]\"\n :style=\"labelStyle\"\n >\n <!-- label -->\n <template v-if=\"isVNode(props.label)\">\n <component :is=\"props.label\" />\n </template>\n <div v-else :class=\"`${prefixCls}-label__wrapper`\">\n <ElTooltip :disabled=\"!isEllipsis && formlayout.tooltipLayout !== 'text'\">\n <span\n :class=\"{\n [`${prefixCls}-label-content`]: true,\n ['is-tooltip']: isEllipsis || (props.tooltip && formlayout.tooltipLayout === 'text'),\n }\"\n >\n <span ref=\"labelRef\">{{ props.label }}</span>\n </span>\n <template #content>\n <template v-if=\"isVNode(props.tooltip)\">\n <component :is=\"props.tooltip\" />\n </template>\n <div v-else :style=\"`width: ${labelRef?.clientWidth ?? 0}px;`\">\n <template v-if=\"isEllipsis\">\n {{ props.label }}\n </template>\n <template v-if=\"formlayout.tooltipLayout === 'text'\">\n {{ props.tooltip }}\n </template>\n </div>\n </template>\n </ElTooltip>\n <ElTooltip v-if=\"props.tooltip && !isVNode(props.tooltip) && formlayout.tooltipLayout !== 'text'\" :content=\"props.tooltip\">\n <ElIcon :class=\"`${prefixCls}-label-tooltip`\">\n <InfoFilled />\n </ElIcon>\n </ElTooltip>\n <span v-if=\"formlayout.colon\" :class=\"`${prefixCls}-colon`\">:</span>\n </div>\n </component>\n <!-- content -->\n <div\n :class=\"[\n `${prefixCls}-content__wrapper`,\n isValid(formlayout.wrapperCol) && `${prefixCls}-col-${formlayout.wrapperCol}`,\n ]\"\n :style=\"contentWrapperStyle\"\n >\n <template v-if=\"isValid(props.addonBefore)\">\n <template v-if=\"isVNode(props.addonBefore)\">\n <component :is=\"props.addonBefore\" />\n </template>\n <div v-else :class=\"`${prefixCls}-addon-before`\">\n {{ props.addonBefore }}\n </div>\n </template>\n <div\n :class=\"[\n ns.e('content'),\n formlayout.fullness && 'is-fullness',\n ns.is('addon-after', !!props.addonAfter),\n ]\" :style=\"contentStyle\"\n >\n <ElTooltip\n v-if=\"formlayout.feedbackLayout === 'popover'\"\n ref=\"feedbackTooltipRef\"\n :visible=\"!!props.feedbackText\"\n effect=\"light\"\n :offset=\"6\"\n >\n <template #default>\n <slot />\n </template>\n <template #content>\n <div :class=\"[...validateClasses, ns.is('tooltip')]\">\n <ElIcon>\n <CircleClose v-if=\"props.feedbackStatus === 'error'\" />\n <CircleCheck v-if=\"props.feedbackStatus === 'success'\" />\n <Warning v-if=\"props.feedbackStatus === 'warning'\" />\n </ElIcon>\n {{ props.feedbackText }}\n </div>\n </template>\n </ElTooltip>\n <slot v-else />\n <TransitionGroup :name=\"`${ns.namespace.value}-zoom-in-top`\">\n <div v-if=\"props.feedbackText && formlayout.feedbackLayout !== 'popover'\" :class=\"validateClasses\">\n {{ props.feedbackText }}\n </div>\n <template v-if=\"isValid(props.extra)\">\n <template v-if=\"isVNode(props.extra)\">\n <component :is=\"props.extra\" />\n </template>\n <div v-else :class=\"`${prefixCls}-extra`\">\n {{ props.extra }}\n </div>\n </template>\n </TransitionGroup>\n </div>\n <template v-if=\"isValid(props.addonAfter)\">\n <template v-if=\"isVNode(props.addonAfter)\">\n <component :is=\"props.addonAfter\" />\n </template>\n <div v-else :class=\"`${prefixCls}-addon-after`\">\n {{ props.addonAfter }}\n </div>\n </template>\n </div>\n </div>\n</template>\n","import { isVoidField } from '@formily/core'\nimport { connect, mapProps } from '@silver-formily/vue'\nimport { composeExport } from '../__builtins__'\nimport FormBaseItem from './form-item.vue'\nimport { determineFeedbackStatus, getFeedbackMessage } from './utils'\nimport './style.scss'\n\nexport function fieldFeedbackMapper(props, field) {\n if (isVoidField(field) || !field) {\n return props\n }\n\n const feedbackText = getFeedbackMessage(field)\n const feedbackStatus = determineFeedbackStatus(field)\n const asterisk = 'asterisk' in props\n ? props.asterisk\n : field.required && field.pattern !== 'readPretty'\n\n return {\n ...props,\n feedbackText,\n feedbackStatus,\n asterisk,\n }\n}\n\nconst Item = connect<typeof FormBaseItem>(\n FormBaseItem,\n mapProps(\n {\n validateStatus: true,\n title: 'label',\n required: true,\n description: 'extra',\n },\n fieldFeedbackMapper,\n ),\n)\n\nexport const FormItem = composeExport(Item, {\n BaseItem: FormBaseItem,\n})\n\nexport default FormItem\n\nexport { default as FormBaseItem } from './form-item.vue'\nexport type { IFormItemProps } from './types'\n"],"names":["SCOPE","addUnit","value","defaultUnit","isNumber","isStringNumber","isString","debugWarn","props","__props","slots","useSlots","ns","useNamespace","prefixCls","stylePrefix","rootFormItemClass","computed","formItemConfig","pick","FORM_LAYOUT_PROPS_KEYS","_","isValid","formlayoutConfig","useFormLayout","formlayout","field","useField","inheritedSize","useFormSize","formItemSize","labelId","useId","inputIds","ref","validateState","formItemRef","labelRef","feedbackTooltipRef","__expose","labelPosition","isArr","labelStyle","labelWidth","contentStyle","contentWidth","contentWrapperStyle","isRequired","formItemClasses","validateClasses","hasLabel","labelFor","isGroup","validate","clearValidate","resetField","setInitialValue","addInputId","id","removeInputId","listId","isEllipsisActive","useResizeObserver","isEllipsis","_validateState","context","reactive","watch","val","provide","formLayoutShallowContext","formItemContextKey","_createElementBlock","_unref","_openBlock","_createBlock","_resolveDynamicComponent","_normalizeClass","isVNode","_createVNode","ElTooltip","_normalizeStyle","_Fragment","_createTextVNode","_toDisplayString","_createElementVNode","ElIcon","InfoFilled","_renderSlot","_ctx","CircleClose","CircleCheck","Warning","_TransitionGroup","fieldFeedbackMapper","isVoidField","feedbackText","getFeedbackMessage","feedbackStatus","determineFeedbackStatus","asterisk","Item","connect","FormBaseItem","mapProps","FormItem","composeExport"],"mappings":";;;;;;;;;;;;;;;;AAMA,MAAMA,KAAQ;AAgDd,SAASC,EAAQC,GAAOC,IAAc,MAAM;AAC1C,MAAI,CAACD,KAASA,MAAU,EAAG,QAAO;AAClC,MAAIE,GAASF,CAAK,KAAKG,GAAeH,CAAK;AACzC,WAAO,GAAGA,CAAK,GAAGC,CAAW;AACxB,MAAIG,GAASJ,CAAK;AACvB,WAAOA;AAET,EAAAK,GAAUP,IAAO,0CAA0C;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACrCA,UAAMQ,IAAQC,GAMRC,IAAQC,GAAA,GACRC,IAAKC,GAAa,WAAW,GAC7BC,IAAY,GAAGC,EAAW,cAC1BC,IAAoBC,EAAS,MAA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,EAAoCC,EAApBpE,EAAM,UAAU,GAAA,EAAA,KAAA,EAAA,CAAA,WAElCgE,EAEM,OAAA;AAAA;YAFO,YAAU1D,CAAS,cAAA;AAAA,UAAA,GAC3BsE,EAAA5E,EAAM,UAAU,GAAA,CAAA;AAAA,QAAA;;;;;ACjUtB,SAASsF,GAAoBtF,GAAOkB,GAAO;AAChD,MAAIqE,GAAYrE,CAAK,KAAK,CAACA;AACzB,WAAOlB;AAGT,QAAMwF,IAAeC,GAAmBvE,CAAK,GACvCwE,IAAiBC,GAAwBzE,CAAK,GAC9C0E,IAAW,cAAc5F,IAC3BA,EAAM,WACNkB,EAAM,YAAYA,EAAM,YAAY;AAExC,SAAO;AAAA,IACL,GAAGlB;AAAA,IACH,cAAAwF;AAAA,IACA,gBAAAE;AAAA,IACA,UAAAE;AAAA,EAAA;AAEJ;AAEA,MAAMC,KAAOC;AAAA,EACXC;AAAAA,EACAC;AAAA,IACE;AAAA,MACE,gBAAgB;AAAA,MAChB,OAAO;AAAA,MACP,UAAU;AAAA,MACV,aAAa;AAAA,IAAA;AAAA,IAEfV;AAAA,EAAA;AAEJ,GAEaW,KAAWC,GAAcL,IAAM;AAAA,EAC1C,UAAUE;AACZ,CAAC;","x_google_ignoreList":[0]}
|
package/esm/form-item/types.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
import { VNode } from 'vue';
|
|
2
|
+
export type FormItemContent = string | VNode;
|
|
1
3
|
export interface IFormItemProps {
|
|
2
4
|
/**
|
|
3
5
|
* Internal: override Element Plus root class for isolated scenes (e.g. QueryFormItem).
|
|
4
6
|
*/
|
|
5
7
|
internalFormItemClass?: string;
|
|
6
|
-
label?:
|
|
8
|
+
label?: FormItemContent;
|
|
7
9
|
for?: string;
|
|
8
|
-
tooltip?:
|
|
9
|
-
addonBefore?:
|
|
10
|
-
addonAfter?:
|
|
11
|
-
extra?:
|
|
12
|
-
feedbackText?:
|
|
10
|
+
tooltip?: FormItemContent;
|
|
11
|
+
addonBefore?: FormItemContent;
|
|
12
|
+
addonAfter?: FormItemContent;
|
|
13
|
+
extra?: FormItemContent;
|
|
14
|
+
feedbackText?: FormItemContent;
|
|
13
15
|
feedbackStatus?: 'error' | 'warning' | 'success' | 'pending';
|
|
14
16
|
asterisk?: boolean;
|
|
15
17
|
colon?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as A, ref as l, computed as d, provide as e, watch as x, reactive as B, toRef as t,
|
|
1
|
+
import { defineComponent as A, ref as l, computed as d, provide as e, watch as x, reactive as B, toRef as t, openBlock as P, createBlock as g, resolveDynamicComponent as I, mergeProps as b, unref as F, withModifiers as R, withCtx as _, renderSlot as q } from "vue";
|
|
2
2
|
import { isValid as z, isEmpty as D } from "@formily/shared";
|
|
3
3
|
import { useThrottleFn as T } from "@vueuse/core";
|
|
4
4
|
import { useId as M, formContextKey as S } from "element-plus";
|
|
@@ -63,7 +63,7 @@ const to = /* @__PURE__ */ A({
|
|
|
63
63
|
hideRequiredAsterisk: t(o, "hideRequiredAsterisk"),
|
|
64
64
|
requireAsteriskPosition: t(o, "requireAsteriskPosition")
|
|
65
65
|
});
|
|
66
|
-
return e(S, w), (i, m) => (
|
|
66
|
+
return e(S, w), (i, m) => (P(), g(I(o.tag), b({
|
|
67
67
|
id: L.value,
|
|
68
68
|
ref_key: "rootHTMLRef",
|
|
69
69
|
ref: n,
|
|
@@ -51,9 +51,9 @@ function P(t, o) {
|
|
|
51
51
|
props: e
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
const s = Symbol(
|
|
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
58
|
return l(s, i({}));
|
|
59
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","sources":["../../src/form-layout/utils.ts"],"sourcesContent":["import type { ComputedRef, InjectionKey, Ref } from 'vue'\nimport type { IFormLayoutProps } from './types'\nimport { isArr, isValid } from '@formily/shared'\nimport { useResizeObserver } from '@vueuse/core'\nimport { computed, inject, ref } from 'vue'\n\nexport function calcBreakpointIndex(breakpoints: number[], width: number): number {\n for (const [i, breakpoint] of breakpoints.entries()) {\n if (width <= breakpoint) {\n return i\n }\n }\n return -1\n}\n\nexport function calcFactor<T>(value: T | readonly T[], breakpointIndex: number): T {\n if (!Array.isArray(value) || value.length === 0) {\n return value as T\n }\n const safeIndex = Math.max(-1, Math.min(breakpointIndex, value.length - 1))\n return value.at(safeIndex)\n}\n\nexport function factor<T>(value: T | T[], breakpointIndex: number): T {\n return isValid(value) ? calcFactor<T>(value, breakpointIndex) : value as T\n}\n\nexport function calculateProps(target: Element, props: IFormLayoutProps): IFormLayoutProps {\n const { clientWidth } = target\n const {\n breakpoints,\n layout,\n labelAlign,\n wrapperAlign,\n labelCol,\n wrapperCol,\n ...otherProps\n } = props\n const breakpointIndex = calcBreakpointIndex(\n breakpoints as number[],\n clientWidth,\n )\n\n return {\n layout: factor(layout, breakpointIndex),\n labelAlign: factor(labelAlign, breakpointIndex),\n wrapperAlign: factor(wrapperAlign, breakpointIndex),\n labelCol: factor(labelCol, breakpointIndex),\n wrapperCol: factor(wrapperCol, breakpointIndex),\n ...otherProps,\n }\n}\n\nexport function useResponsiveFormLayout(props: IFormLayoutProps, root: Ref<HTMLElement | null>) {\n const { breakpoints } = props\n if (!isArr(breakpoints)) {\n return {\n props: ref(props),\n }\n }\n\n const layoutProps = ref<IFormLayoutProps>({})\n\n useResizeObserver(root, () => {\n layoutProps.value = calculateProps(root.value, props)\n })\n\n return {\n props: layoutProps,\n }\n}\n\nexport const formLayoutDeepContext: InjectionKey<Ref<IFormLayoutProps>> = Symbol(\n 'formLayoutDeepContext',\n)\n\nexport const formLayoutShallowContext: InjectionKey<Ref<IFormLayoutProps>>\n = Symbol('formLayoutShallowContext')\n\nexport const formLayoutIdContext: InjectionKey<ComputedRef<string>>\n = Symbol('formLayoutIdContext')\n\nexport function useFormDeepLayout(): Ref<IFormLayoutProps> {\n return inject(formLayoutDeepContext, ref({}))\n}\n\nexport function useFormLayout(): Ref<IFormLayoutProps> {\n const shallowLayout = inject(formLayoutShallowContext, ref({}))\n const deepLayout = inject(formLayoutDeepContext, ref({}))\n\n const formLayout = computed(() => {\n return {\n ...deepLayout.value,\n ...shallowLayout.value,\n }\n })\n\n return formLayout\n}\n\nexport function useFormLayoutId(): ComputedRef<string> {\n return inject(formLayoutIdContext)\n}\n\nexport const FORM_LAYOUT_PROPS_KEYS: ReadonlyArray<keyof IFormLayoutProps> = [\n 'colon',\n 'labelAlign',\n 'wrapperAlign',\n 'labelWrap',\n 'labelWidth',\n 'wrapperWidth',\n 'labelCol',\n 'wrapperCol',\n 'fullness',\n 'size',\n 'layout',\n 'feedbackLayout',\n 'tooltipLayout',\n 'breakpoints',\n 'hideRequiredAsterisk',\n 'statusIcon',\n 'requireAsteriskPosition',\n] as const\n\nexport function filterValidFormLayoutProps(props: IFormLayoutProps): IFormLayoutProps {\n return Object.fromEntries(\n Object.entries(props)\n .filter(([_, value]) => isValid(value)),\n )\n}\n"],"names":["calcBreakpointIndex","breakpoints","width","i","breakpoint","calcFactor","value","breakpointIndex","safeIndex","factor","isValid","calculateProps","target","props","clientWidth","layout","labelAlign","wrapperAlign","labelCol","wrapperCol","otherProps","useResponsiveFormLayout","root","isArr","ref","layoutProps","useResizeObserver","formLayoutDeepContext","formLayoutShallowContext","formLayoutIdContext","useFormDeepLayout","inject","useFormLayout","shallowLayout","deepLayout","computed","useFormLayoutId","FORM_LAYOUT_PROPS_KEYS","filterValidFormLayoutProps","_"],"mappings":";;;AAMO,SAASA,EAAoBC,GAAuBC,GAAuB;AAChF,aAAW,CAACC,GAAGC,CAAU,KAAKH,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;AAAA,EAAA;AAEX;AAEO,MAAME,IAA6D;AAAA,EACxE;AACF,GAEaC,
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../src/form-layout/utils.ts"],"sourcesContent":["import type { ComputedRef, InjectionKey, Ref } from 'vue'\nimport type { IFormLayoutProps } from './types'\nimport { isArr, isValid } from '@formily/shared'\nimport { useResizeObserver } from '@vueuse/core'\nimport { computed, inject, ref } from 'vue'\n\nexport function calcBreakpointIndex(breakpoints: number[], width: number): number {\n for (const [i, breakpoint] of breakpoints.entries()) {\n if (width <= breakpoint) {\n return i\n }\n }\n return -1\n}\n\nexport function calcFactor<T>(value: T | readonly T[], breakpointIndex: number): T {\n if (!Array.isArray(value) || value.length === 0) {\n return value as T\n }\n const safeIndex = Math.max(-1, Math.min(breakpointIndex, value.length - 1))\n return value.at(safeIndex)\n}\n\nexport function factor<T>(value: T | T[], breakpointIndex: number): T {\n return isValid(value) ? calcFactor<T>(value, breakpointIndex) : value as T\n}\n\nexport function calculateProps(target: Element, props: IFormLayoutProps): IFormLayoutProps {\n const { clientWidth } = target\n const {\n breakpoints,\n layout,\n labelAlign,\n wrapperAlign,\n labelCol,\n wrapperCol,\n ...otherProps\n } = props\n const breakpointIndex = calcBreakpointIndex(\n breakpoints as number[],\n clientWidth,\n )\n\n return {\n layout: factor(layout, breakpointIndex),\n labelAlign: factor(labelAlign, breakpointIndex),\n wrapperAlign: factor(wrapperAlign, breakpointIndex),\n labelCol: factor(labelCol, breakpointIndex),\n wrapperCol: factor(wrapperCol, breakpointIndex),\n ...otherProps,\n }\n}\n\nexport function useResponsiveFormLayout(props: IFormLayoutProps, root: Ref<HTMLElement | null>) {\n const { breakpoints } = props\n if (!isArr(breakpoints)) {\n return {\n props: ref(props),\n }\n }\n\n const layoutProps = ref<IFormLayoutProps>({})\n\n useResizeObserver(root, () => {\n layoutProps.value = calculateProps(root.value, props)\n })\n\n return {\n props: layoutProps,\n }\n}\n\nexport const formLayoutDeepContext: InjectionKey<Ref<IFormLayoutProps>> = Symbol(\n 'formLayoutDeepContext',\n)\n\nexport const formLayoutShallowContext: InjectionKey<Ref<IFormLayoutProps>>\n = Symbol('formLayoutShallowContext')\n\nexport const formLayoutIdContext: InjectionKey<ComputedRef<string>>\n = Symbol('formLayoutIdContext')\n\nexport function useFormDeepLayout(): Ref<IFormLayoutProps> {\n return inject(formLayoutDeepContext, ref({}))\n}\n\nexport function useFormLayout(): Ref<IFormLayoutProps> {\n const shallowLayout = inject(formLayoutShallowContext, ref({}))\n const deepLayout = inject(formLayoutDeepContext, ref({}))\n\n const formLayout = computed(() => {\n return {\n ...deepLayout.value,\n ...shallowLayout.value,\n }\n })\n\n return formLayout\n}\n\nexport function useFormLayoutId(): ComputedRef<string> {\n return inject(formLayoutIdContext)\n}\n\nexport const FORM_LAYOUT_PROPS_KEYS: ReadonlyArray<keyof IFormLayoutProps> = [\n 'colon',\n 'labelAlign',\n 'wrapperAlign',\n 'labelWrap',\n 'labelWidth',\n 'wrapperWidth',\n 'labelCol',\n 'wrapperCol',\n 'fullness',\n 'size',\n 'layout',\n 'feedbackLayout',\n 'tooltipLayout',\n 'breakpoints',\n 'hideRequiredAsterisk',\n 'statusIcon',\n 'requireAsteriskPosition',\n] as const\n\nexport function filterValidFormLayoutProps(props: IFormLayoutProps): IFormLayoutProps {\n return Object.fromEntries(\n Object.entries(props)\n .filter(([_, value]) => isValid(value)),\n )\n}\n"],"names":["calcBreakpointIndex","breakpoints","width","i","breakpoint","calcFactor","value","breakpointIndex","safeIndex","factor","isValid","calculateProps","target","props","clientWidth","layout","labelAlign","wrapperAlign","labelCol","wrapperCol","otherProps","useResponsiveFormLayout","root","isArr","ref","layoutProps","useResizeObserver","formLayoutDeepContext","formLayoutShallowContext","formLayoutIdContext","useFormDeepLayout","inject","useFormLayout","shallowLayout","deepLayout","computed","useFormLayoutId","FORM_LAYOUT_PROPS_KEYS","filterValidFormLayoutProps","_"],"mappings":";;;AAMO,SAASA,EAAoBC,GAAuBC,GAAuB;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AA,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,14 +1,14 @@
|
|
|
1
1
|
import { ElSteps as g, ElStep as P } from "element-plus";
|
|
2
2
|
import "@formily/reactive";
|
|
3
3
|
import "@vueuse/core";
|
|
4
|
-
import { defineComponent as $, renderSlot as B, computed as E,
|
|
4
|
+
import { defineComponent as $, renderSlot as B, computed as E, openBlock as r, createElementBlock as o, normalizeClass as N, createVNode as O, unref as t, mergeProps as h, withCtx as u, Fragment as c, renderList as x, createBlock as a, createSlots as V, resolveDynamicComponent as _, createTextVNode as v, toDisplayString as y, createCommentVNode as b } from "vue";
|
|
5
5
|
import "@formily/core";
|
|
6
6
|
import { useObserver as A } from "@silver-formily/reactive-vue";
|
|
7
7
|
import { useField as D, useFieldSchema as R, RecursionField as j } from "@silver-formily/vue";
|
|
8
8
|
import { composeExport as w } from "../__builtins__/shared/utils.mjs";
|
|
9
9
|
import { isObj as k } from "@formily/shared";
|
|
10
10
|
import { stylePrefix as z } from "../__builtins__/configs/index.mjs";
|
|
11
|
-
import {
|
|
11
|
+
import { parseSteps as L, createFormStep as C } from "./utils.mjs";
|
|
12
12
|
const T = $({
|
|
13
13
|
name: "FFormStepPane",
|
|
14
14
|
inheritAttrs: !1
|
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'\nimport type { Slots } from 'vue'\nimport type { FormStepEnv, IFormStep } from './types'\nimport { action, model, observable } from '@formily/reactive'\n\nexport interface SchemaStep {\n name: SchemaKey\n props: any\n schema: Schema\n slots: Slots\n}\n\nexport function createFormStep(defaultCurrent = 0): IFormStep {\n const env: FormStepEnv = observable({\n form: null,\n field: null,\n steps: [],\n })\n\n const setDisplay = action.bound((target: number) => {\n const currentStep = env.steps[target]\n for (const { name } of env.steps) {\n env.form.query(`${env.field.address}.${name}`).take((field) => {\n if (name === currentStep.name) {\n field.setDisplay('visible')\n }\n else {\n field.setDisplay('hidden')\n }\n })\n }\n })\n\n const formStep: IFormStep = model({\n connect(steps, field) {\n env.steps = steps\n env.form = field?.form\n env.field = field\n },\n current: defaultCurrent,\n setCurrent(key: number) {\n formStep.current = key\n },\n get allowNext() {\n return formStep.current < env.steps.length - 1\n },\n get allowBack() {\n return formStep.current > 0\n },\n async next() {\n try {\n await env.form.validate()\n // eslint-disable-next-line ts/no-use-before-define\n next()\n }\n catch {}\n },\n async back() {\n // eslint-disable-next-line ts/no-use-before-define\n back()\n },\n async submit(onSubmit) {\n return env.form?.submit?.(onSubmit)\n },\n })\n\n const next = action.bound(() => {\n /* istanbul ignore else -- @preserve */\n if (formStep.allowNext) {\n setDisplay(formStep.current + 1)\n formStep.setCurrent(formStep.current + 1)\n }\n })\n\n const back = action.bound(() => {\n /* istanbul ignore else -- @preserve */\n if (formStep.allowBack) {\n setDisplay(formStep.current - 1)\n formStep.setCurrent(formStep.current - 1)\n }\n })\n return formStep\n}\n\nexport function parseSteps(schema: Schema) {\n const steps: SchemaStep[] = []\n schema.mapProperties((schema, name) => {\n /* istanbul ignore else -- @preserve */\n if (schema['x-component']?.indexOf('StepPane') > -1) {\n steps.push({\n name,\n props: schema['x-component-props'],\n schema,\n slots: schema['x-content'],\n })\n }\n })\n return steps\n}\n"],"names":["createFormStep","defaultCurrent","env","observable","setDisplay","action","target","currentStep","name","field","formStep","model","steps","key","next","back","onSubmit","parseSteps","schema"],"mappings":";AAYO,SAASA,EAAeC,IAAiB,GAAc;AAC5D,QAAMC,IAAmBC,EAAW;AAAA,IAClC,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO,CAAA;AAAA,EAAC,CACT,GAEKC,IAAaC,EAAO,MAAM,CAACC,MAAmB;AAClD,UAAMC,IAAcL,EAAI,MAAMI,CAAM;AACpC,eAAW,EAAE,MAAAE,OAAUN,EAAI;AACzB,MAAAA,EAAI,KAAK,MAAM,GAAGA,EAAI,MAAM,OAAO,IAAIM,CAAI,EAAE,EAAE,KAAK,CAACC,MAAU;AAC7D,QAAID,MAASD,EAAY,OACvBE,EAAM,WAAW,SAAS,IAG1BA,EAAM,WAAW,QAAQ;AAAA,MAE7B,CAAC;AAAA,EAEL,CAAC,GAEKC,IAAsBC,EAAM;AAAA,IAChC,QAAQC,GAAOH,GAAO;AACpB,MAAAP,EAAI,QAAQU,GACZV,EAAI,OAAOO,GAAO,MAClBP,EAAI,QAAQO;AAAA,IACd;AAAA,IACA,SAASR;AAAA,IACT,WAAWY,GAAa;AACtB,MAAAH,EAAS,UAAUG;AAAA,IACrB;AAAA,IACA,IAAI,YAAY;AACd,aAAOH,EAAS,UAAUR,EAAI,MAAM,SAAS;AAAA,IAC/C;AAAA,IACA,IAAI,YAAY;AACd,aAAOQ,EAAS,UAAU;AAAA,IAC5B;AAAA,IACA,MAAM,OAAO;AACX,UAAI;AACF,cAAMR,EAAI,KAAK,SAAA,GAEfY,EAAA;AAAA,MACF,QACM;AAAA,MAAC;AAAA,IACT;AAAA,IACA,MAAM,OAAO;AAEX,MAAAC,EAAA;AAAA,IACF;AAAA,IACA,MAAM,OAAOC,GAAU;AACrB,aAAOd,EAAI,MAAM,SAASc,CAAQ;AAAA,IACpC;AAAA,EAAA,CACD,GAEKF,IAAOT,EAAO,MAAM,MAAM;
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../src/form-step/utils.ts"],"sourcesContent":["import type { Schema, SchemaKey } from '@formily/json-schema'\nimport type { Slots } from 'vue'\nimport type { FormStepEnv, IFormStep } from './types'\nimport { action, model, observable } from '@formily/reactive'\n\nexport interface SchemaStep {\n name: SchemaKey\n props: any\n schema: Schema\n slots: Slots\n}\n\nexport function createFormStep(defaultCurrent = 0): IFormStep {\n const env: FormStepEnv = observable({\n form: null,\n field: null,\n steps: [],\n })\n\n const setDisplay = action.bound((target: number) => {\n const currentStep = env.steps[target]\n for (const { name } of env.steps) {\n env.form.query(`${env.field.address}.${name}`).take((field) => {\n if (name === currentStep.name) {\n field.setDisplay('visible')\n }\n else {\n field.setDisplay('hidden')\n }\n })\n }\n })\n\n const formStep: IFormStep = model({\n connect(steps, field) {\n env.steps = steps\n env.form = field?.form\n env.field = field\n },\n current: defaultCurrent,\n setCurrent(key: number) {\n formStep.current = key\n },\n get allowNext() {\n return formStep.current < env.steps.length - 1\n },\n get allowBack() {\n return formStep.current > 0\n },\n async next() {\n try {\n await env.form.validate()\n // eslint-disable-next-line ts/no-use-before-define\n next()\n }\n catch {}\n },\n async back() {\n // eslint-disable-next-line ts/no-use-before-define\n back()\n },\n async submit(onSubmit) {\n return env.form?.submit?.(onSubmit)\n },\n })\n\n const next = action.bound(() => {\n /* istanbul ignore else -- @preserve */\n if (formStep.allowNext) {\n setDisplay(formStep.current + 1)\n formStep.setCurrent(formStep.current + 1)\n }\n })\n\n const back = action.bound(() => {\n /* istanbul ignore else -- @preserve */\n if (formStep.allowBack) {\n setDisplay(formStep.current - 1)\n formStep.setCurrent(formStep.current - 1)\n }\n })\n return formStep\n}\n\nexport function parseSteps(schema: Schema) {\n const steps: SchemaStep[] = []\n schema.mapProperties((schema, name) => {\n /* istanbul ignore else -- @preserve */\n if (schema['x-component']?.indexOf('StepPane') > -1) {\n steps.push({\n name,\n props: schema['x-component-props'],\n schema,\n slots: schema['x-content'],\n })\n }\n })\n return steps\n}\n"],"names":["createFormStep","defaultCurrent","env","observable","setDisplay","action","target","currentStep","name","field","formStep","model","steps","key","next","back","onSubmit","parseSteps","schema"],"mappings":";AAYO,SAASA,EAAeC,IAAiB,GAAc;AAC5D,QAAMC,IAAmBC,EAAW;AAAA,I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,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'\nimport type { Schema, SchemaKey } from '@formily/json-schema'\n\nexport type Tabs = { name: SchemaKey, props: any, schema: Schema }[]\n\nexport function useTabs(tabField: GeneralField, schema: Schema) {\n const schemaList = schema.mapProperties((item, name) => ({\n name,\n props: {\n name: item?.['x-component-props']?.name || name,\n ...item?.['x-component-props'],\n },\n schema: item,\n }))\n\n const tabs: Tabs = schemaList.filter((item) => {\n const field = tabField.query(tabField.address.concat(item.name)).take()\n const isHidden = field?.display === 'none' || field?.display === 'hidden'\n if (isHidden)\n return false\n return item?.schema?.['x-component']?.includes('TabPane') ?? false\n })\n\n return tabs\n}\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;"}
|