@silver-formily/element-plus 3.0.1 → 3.0.2
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/loading.mjs +1 -1
- package/esm/__builtins__/shared/loading.mjs.map +1 -1
- package/esm/__builtins__/shared/use-enter-submit.mjs +57 -16
- package/esm/__builtins__/shared/use-enter-submit.mjs.map +1 -1
- package/esm/array-base/index.mjs +21 -22
- package/esm/array-base/index.mjs.map +1 -1
- package/esm/array-base/utils.mjs +17 -18
- package/esm/array-base/utils.mjs.map +1 -1
- package/esm/array-cards/index.mjs +11 -12
- package/esm/array-cards/index.mjs.map +1 -1
- package/esm/array-collapse/index.mjs +26 -27
- package/esm/array-collapse/index.mjs.map +1 -1
- package/esm/array-collapse/utils.mjs +3 -4
- package/esm/array-collapse/utils.mjs.map +1 -1
- package/esm/array-items/index.mjs +20 -21
- package/esm/array-items/index.mjs.map +1 -1
- package/esm/array-list-tabs/index.mjs +28 -29
- package/esm/array-list-tabs/index.mjs.map +1 -1
- package/esm/array-list-tabs/utils.mjs +5 -6
- package/esm/array-list-tabs/utils.mjs.map +1 -1
- package/esm/array-table/index.mjs +52 -53
- package/esm/array-table/index.mjs.map +1 -1
- package/esm/array-table/utils.mjs +10 -11
- package/esm/array-table/utils.mjs.map +1 -1
- package/esm/array-tabs/index.mjs +40 -43
- package/esm/array-tabs/index.mjs.map +1 -1
- package/esm/autocomplete/index.mjs +4 -5
- package/esm/autocomplete/index.mjs.map +1 -1
- package/esm/cascader/index.mjs +7 -8
- package/esm/cascader/index.mjs.map +1 -1
- package/esm/checkbox/index.mjs +4 -5
- package/esm/checkbox/index.mjs.map +1 -1
- package/esm/color-picker/index.mjs +1 -1
- package/esm/color-picker-panel/index.mjs +1 -1
- package/esm/date-picker/index.mjs +1 -1
- package/esm/date-picker-panel/index.mjs +1 -1
- package/esm/editable/index.mjs +28 -29
- package/esm/editable/index.mjs.map +1 -1
- package/esm/form-button-group/index.mjs +8 -9
- package/esm/form-button-group/index.mjs.map +1 -1
- package/esm/form-button-group/utils.mjs +3 -4
- package/esm/form-button-group/utils.mjs.map +1 -1
- package/esm/form-collapse/index.mjs +4 -5
- package/esm/form-collapse/index.mjs.map +1 -1
- package/esm/form-grid/index.mjs +3 -4
- package/esm/form-grid/index.mjs.map +1 -1
- package/esm/form-item/index.mjs +4 -5
- package/esm/form-item/index.mjs.map +1 -1
- package/esm/form-layout/form-layout.mjs +3 -4
- package/esm/form-layout/form-layout.mjs.map +1 -1
- package/esm/form-step/index.mjs +12 -13
- package/esm/form-step/index.mjs.map +1 -1
- package/esm/form-tab/index.mjs +19 -20
- package/esm/form-tab/index.mjs.map +1 -1
- package/esm/input/index.mjs +13 -14
- package/esm/input/index.mjs.map +1 -1
- package/esm/input-number/index.mjs +1 -1
- package/esm/input-tag/index.mjs +12 -13
- package/esm/input-tag/index.mjs.map +1 -1
- package/esm/mention/index.mjs +12 -13
- package/esm/mention/index.mjs.map +1 -1
- package/esm/preview-text/index.mjs +4 -5
- package/esm/preview-text/index.mjs.map +1 -1
- package/esm/query-form/index.mjs +135 -136
- package/esm/query-form/index.mjs.map +1 -1
- package/esm/query-form-item/index.mjs +23 -24
- package/esm/query-form-item/index.mjs.map +1 -1
- package/esm/radio/index.mjs +4 -5
- package/esm/radio/index.mjs.map +1 -1
- package/esm/rate/index.mjs +1 -1
- package/esm/segmented/index.mjs +4 -5
- package/esm/segmented/index.mjs.map +1 -1
- package/esm/select/index.mjs +13 -14
- package/esm/select/index.mjs.map +1 -1
- package/esm/select-table/index.mjs +4 -5
- package/esm/select-table/index.mjs.map +1 -1
- package/esm/slider/index.mjs +1 -1
- package/esm/time-picker/index.mjs +1 -1
- package/esm/time-select/index.d.ts +8 -8
- package/esm/time-select/index.mjs +1 -1
- package/esm/tree/index.mjs +8 -9
- package/esm/tree/index.mjs.map +1 -1
- package/esm/tree-select/index.mjs +4 -5
- package/esm/tree-select/index.mjs.map +1 -1
- package/esm/upload/index.mjs +36 -40
- package/esm/upload/index.mjs.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/form-grid/form-grid-column.vue","../../src/form-grid/form-grid.vue","../../src/form-grid/index.ts"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed } from 'vue'\n\ndefineOptions({\n name: 'FFormGridColumn',\n})\n\nconst props = defineProps({\n gridSpan: {\n type: Number,\n default: 1,\n },\n})\n\nconst gridColumnStyle = computed(() => {\n if (props.gridSpan === -1) {\n // gridSpan=-1 means \"fill remaining columns in current row\".\n // Leave gridColumn unset so @silver-formily/grid can manage it dynamically.\n return {}\n }\n return {\n gridColumn: `span ${props.gridSpan} / auto`,\n }\n})\n</script>\n\n<template>\n <!-- @silver-formily/grid 会优先使用这个值,如果没有会自动生成 -->\n <div :data-grid-span=\"props.gridSpan\" :style=\"gridColumnStyle\">\n <slot />\n </div>\n</template>\n","<script lang=\"ts\" setup>\nimport type { Grid, IGridOptions } from '@silver-formily/grid'\nimport type { PropType } from 'vue'\nimport { createGrid } from '@silver-formily/grid'\nimport { computed, provide, ref, watchEffect } from 'vue'\nimport { stylePrefix } from '../__builtins__'\nimport { FormGridSymbol } from './hooks'\n\ndefineOptions({\n name: 'FFormGrid',\n})\n\nconst props = defineProps({\n columnGap: {\n type: Number,\n },\n rowGap: {\n type: Number,\n },\n minColumns: {\n type: [Number, Array],\n },\n minWidth: {\n type: [Number, Array],\n },\n maxColumns: {\n type: [Number, Array],\n },\n maxWidth: {\n type: [Number, Array],\n },\n breakpoints: {\n type: Array as PropType<number[]>,\n },\n colWrap: {\n type: Boolean,\n default: true,\n },\n strictAutoFit: {\n type: Boolean,\n default: false,\n },\n shouldVisible: {\n type: Function as PropType<IGridOptions['shouldVisible']>,\n default() {\n return () => true\n },\n },\n grid: {\n type: Object as PropType<Grid<HTMLElement>>,\n },\n})\n\nconst prefixCls = `${stylePrefix}-form-grid`\nconst rootRef = ref<HTMLElement>()\n\nconst gridInstance = computed(() => {\n const { grid, ...restProps } = props\n const options = {\n columnGap: props?.columnGap ?? 8,\n rowGap: props.rowGap ?? 4,\n ...Object.fromEntries(\n Object.entries(restProps)\n .filter(([_, v]) => v !== undefined)\n .map(([k, v]) => [k, v]),\n ),\n }\n return grid ?? createGrid(options)\n})\n\nprovide(FormGridSymbol, gridInstance)\n\nwatchEffect((onInvalidate) => {\n const dispose = gridInstance.value.connect(rootRef.value)\n onInvalidate(() => {\n dispose()\n })\n})\n</script>\n\n<template>\n <div\n ref=\"rootRef\"\n :class=\"prefixCls\"\n :style=\"{\n gridTemplateColumns: gridInstance.templateColumns,\n gap: gridInstance.gap,\n }\"\n >\n <slot />\n </div>\n</template>\n","import { observer } from '@silver-formily/reactive-vue'\nimport { composeExport } from '../__builtins__'\nimport FFormGridColumn from './form-grid-column.vue'\nimport FFormGrid from './form-grid.vue'\nimport './style.scss'\n\nconst FormGridInner = observer(FFormGrid)\n\nconst FormGridColumn = observer(FFormGridColumn)\n\nexport const FormGrid = composeExport(FormGridInner, {\n GridColumn: FormGridColumn,\n})\n\nexport default FormGrid\n"],"names":["props","__props","gridColumnStyle","computed","_createElementBlock","_renderSlot","_ctx","prefixCls","stylePrefix","rootRef","ref","gridInstance","grid","restProps","options","_","v","k","createGrid","provide","FormGridSymbol","watchEffect","onInvalidate","dispose","_normalizeStyle","FormGridInner","observer","FFormGrid","FormGridColumn","FFormGridColumn","FormGrid","composeExport"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/form-grid/form-grid-column.vue","../../src/form-grid/form-grid.vue","../../src/form-grid/index.ts"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed } from 'vue'\n\ndefineOptions({\n name: 'FFormGridColumn',\n})\n\nconst props = defineProps({\n gridSpan: {\n type: Number,\n default: 1,\n },\n})\n\nconst gridColumnStyle = computed(() => {\n if (props.gridSpan === -1) {\n // gridSpan=-1 means \"fill remaining columns in current row\".\n // Leave gridColumn unset so @silver-formily/grid can manage it dynamically.\n return {}\n }\n return {\n gridColumn: `span ${props.gridSpan} / auto`,\n }\n})\n</script>\n\n<template>\n <!-- @silver-formily/grid 会优先使用这个值,如果没有会自动生成 -->\n <div :data-grid-span=\"props.gridSpan\" :style=\"gridColumnStyle\">\n <slot />\n </div>\n</template>\n","<script lang=\"ts\" setup>\nimport type { Grid, IGridOptions } from '@silver-formily/grid'\nimport type { PropType } from 'vue'\nimport { createGrid } from '@silver-formily/grid'\nimport { computed, provide, ref, watchEffect } from 'vue'\nimport { stylePrefix } from '../__builtins__'\nimport { FormGridSymbol } from './hooks'\n\ndefineOptions({\n name: 'FFormGrid',\n})\n\nconst props = defineProps({\n columnGap: {\n type: Number,\n },\n rowGap: {\n type: Number,\n },\n minColumns: {\n type: [Number, Array],\n },\n minWidth: {\n type: [Number, Array],\n },\n maxColumns: {\n type: [Number, Array],\n },\n maxWidth: {\n type: [Number, Array],\n },\n breakpoints: {\n type: Array as PropType<number[]>,\n },\n colWrap: {\n type: Boolean,\n default: true,\n },\n strictAutoFit: {\n type: Boolean,\n default: false,\n },\n shouldVisible: {\n type: Function as PropType<IGridOptions['shouldVisible']>,\n default() {\n return () => true\n },\n },\n grid: {\n type: Object as PropType<Grid<HTMLElement>>,\n },\n})\n\nconst prefixCls = `${stylePrefix}-form-grid`\nconst rootRef = ref<HTMLElement>()\n\nconst gridInstance = computed(() => {\n const { grid, ...restProps } = props\n const options = {\n columnGap: props?.columnGap ?? 8,\n rowGap: props.rowGap ?? 4,\n ...Object.fromEntries(\n Object.entries(restProps)\n .filter(([_, v]) => v !== undefined)\n .map(([k, v]) => [k, v]),\n ),\n }\n return grid ?? createGrid(options)\n})\n\nprovide(FormGridSymbol, gridInstance)\n\nwatchEffect((onInvalidate) => {\n const dispose = gridInstance.value.connect(rootRef.value)\n onInvalidate(() => {\n dispose()\n })\n})\n</script>\n\n<template>\n <div\n ref=\"rootRef\"\n :class=\"prefixCls\"\n :style=\"{\n gridTemplateColumns: gridInstance.templateColumns,\n gap: gridInstance.gap,\n }\"\n >\n <slot />\n </div>\n</template>\n","import { observer } from '@silver-formily/reactive-vue'\nimport { composeExport } from '../__builtins__'\nimport FFormGridColumn from './form-grid-column.vue'\nimport FFormGrid from './form-grid.vue'\nimport './style.scss'\n\nconst FormGridInner = observer(FFormGrid)\n\nconst FormGridColumn = observer(FFormGridColumn)\n\nexport const FormGrid = composeExport(FormGridInner, {\n GridColumn: FormGridColumn,\n})\n\nexport default FormGrid\n"],"names":["props","__props","gridColumnStyle","computed","_createElementBlock","_renderSlot","_ctx","prefixCls","stylePrefix","rootRef","ref","gridInstance","grid","restProps","options","_","v","k","createGrid","provide","FormGridSymbol","watchEffect","onInvalidate","dispose","_normalizeStyle","FormGridInner","observer","FFormGrid","FormGridColumn","FFormGridColumn","FormGrid","composeExport"],"mappings":";;;;;;;;;;;;;;;;;;;;AAOA,UAAMA,IAAQC,GAORC,IAAkBC,EAAS,MAC3BH,EAAM,aAAa,KAGd,CAAA,IAEF;AAAA,MACL,YAAY,QAAQA,EAAM,QAAQ;AAAA,IAAA,CAErC;2BAKCI,EAEM,OAAA;AAAA,MAFA,kBAAgBJ,EAAM;AAAA,MAAW,SAAOE,EAAA,KAAe;AAAA,IAAA;MAC3DG,EAAQC,EAAA,QAAA,SAAA;AAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjBZ,UAAMN,IAAQC,GAyCRM,IAAY,GAAGC,CAAW,cAC1BC,IAAUC,EAAA,GAEVC,IAAeR,EAAS,MAAM;AAClC,YAAM,EAAE,MAAAS,GAAM,GAAGC,EAAA,IAAcb,GACzBc,IAAU;AAAA,QACd,WAAWd,GAAO,aAAa;AAAA,QAC/B,QAAQA,EAAM,UAAU;AAAA,QACxB,GAAG,OAAO;AAAA,UACR,OAAO,QAAQa,CAAS,EACrB,OAAO,CAAC,CAACE,GAAGC,CAAC,MAAMA,MAAM,MAAS,EAClC,IAAI,CAAC,CAACC,GAAGD,CAAC,MAAM,CAACC,GAAGD,CAAC,CAAC;AAAA,QAAA;AAAA,MAC3B;AAEF,aAAOJ,KAAQM,EAAWJ,CAAO;AAAA,IACnC,CAAC;AAED,WAAAK,EAAQC,GAAgBT,CAAY,GAEpCU,EAAY,CAACC,MAAiB;AAC5B,YAAMC,IAAUZ,EAAa,MAAM,QAAQF,EAAQ,KAAK;AACxD,MAAAa,EAAa,MAAM;AACjB,QAAAC,EAAA;AAAA,MACF,CAAC;AAAA,IACH,CAAC,mBAICnB,EASM,OAAA;AAAA,eARA;AAAA,MAAJ,KAAIK;AAAA,MACH,SAAOF,CAAS;AAAA,MAChB,OAAKiB,EAAA;AAAA,QAA+B,qBAAAb,EAAA,MAAa;AAAA,QAA4B,KAAAA,EAAA,MAAa;AAAA,MAAA;;MAK3FN,EAAQC,EAAA,QAAA,SAAA;AAAA,IAAA;;ICnFNmB,IAAgBC,EAASC,CAAS,GAElCC,IAAiBF,EAASG,CAAe,GAElCC,IAAWC,EAAcN,GAAe;AAAA,EACnD,YAAYG;AACd,CAAC;"}
|
package/esm/form-item/index.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { isVoidField as ce } from "@formily/core";
|
|
2
2
|
import { useField as fe, connect as ve, mapProps as pe } from "@silver-formily/vue";
|
|
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
|
-
import "@formily/reactive";
|
|
4
|
+
import "@silver-formily/reactive-vue";
|
|
5
5
|
import { useResizeObserver as ge } from "@vueuse/core";
|
|
6
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
|
-
import "@silver-formily/reactive-vue";
|
|
8
7
|
import { composeExport as _e } from "../__builtins__/shared/utils.mjs";
|
|
9
8
|
import { InfoFilled as $e, CircleClose as we, CircleCheck as Fe, Warning as We } from "@element-plus/icons-vue";
|
|
10
9
|
import { isValid as v, isArr as Ae } from "@formily/shared";
|
|
@@ -322,13 +321,13 @@ const Ge = ve(
|
|
|
322
321
|
},
|
|
323
322
|
De
|
|
324
323
|
)
|
|
325
|
-
),
|
|
324
|
+
), it = _e(Ge, {
|
|
326
325
|
BaseItem: Y
|
|
327
326
|
});
|
|
328
327
|
export {
|
|
329
328
|
Y as FormBaseItem,
|
|
330
|
-
|
|
331
|
-
|
|
329
|
+
it as FormItem,
|
|
330
|
+
it as default,
|
|
332
331
|
De as fieldFeedbackMapper
|
|
333
332
|
};
|
|
334
333
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
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,MAAMT,EAAM,yBAAyBI,EAAG,GAAG,GACxEM,IAAiBD;AAAA,MAA8C,MACnE,OAAO;AAAA,QACL,OAAO,QAAQE,GAAKX,GAAOY,EAAsB,CAAC,EAC/C,OAAO,CAAC,CAACC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,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,MAAMT,EAAM,yBAAyBI,EAAG,GAAG,GACxEM,IAAiBD;AAAA,MAA8C,MACnE,OAAO;AAAA,QACL,OAAO,QAAQE,GA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D,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]}
|
|
@@ -3,13 +3,12 @@ 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";
|
|
5
5
|
import { stylePrefix as W } from "../__builtins__/configs/index.mjs";
|
|
6
|
-
import "@formily/reactive";
|
|
7
|
-
import "@formily/core";
|
|
8
6
|
import "@silver-formily/reactive-vue";
|
|
7
|
+
import "@formily/core";
|
|
9
8
|
import "@silver-formily/vue";
|
|
10
9
|
import { useCleanAttrs as $ } from "../__builtins__/shared/utils.mjs";
|
|
11
10
|
import { formLayoutIdContext as H, useFormDeepLayout as V, useResponsiveFormLayout as E, filterValidFormLayoutProps as r, formLayoutDeepContext as K, formLayoutShallowContext as j } from "./utils.mjs";
|
|
12
|
-
const
|
|
11
|
+
const eo = /* @__PURE__ */ A({
|
|
13
12
|
name: "FFormLayout",
|
|
14
13
|
inheritAttrs: !1,
|
|
15
14
|
__name: "form-layout",
|
|
@@ -80,6 +79,6 @@ const to = /* @__PURE__ */ A({
|
|
|
80
79
|
}
|
|
81
80
|
});
|
|
82
81
|
export {
|
|
83
|
-
|
|
82
|
+
eo as _
|
|
84
83
|
};
|
|
85
84
|
//# sourceMappingURL=form-layout.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-layout.mjs","sources":["../../src/form-layout/form-layout.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { FormContext } from 'element-plus'\nimport type { IFormLayoutProps } from './types'\nimport { isEmpty, isValid } from '@formily/shared'\nimport { useThrottleFn } from '@vueuse/core'\nimport { formContextKey, useId } from 'element-plus'\nimport { computed, provide, reactive, ref, toRef, watch } from 'vue'\nimport { stylePrefix, useCleanAttrs } from '../__builtins__'\nimport { filterValidFormLayoutProps, formLayoutDeepContext, formLayoutIdContext, formLayoutShallowContext, useFormDeepLayout, useResponsiveFormLayout } from './utils'\n\ndefineOptions({\n name: 'FFormLayout',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<IFormLayoutProps>(), {\n tag: 'form',\n colon: undefined,\n labelWrap: undefined,\n fullness: undefined,\n size: 'default',\n layout: 'horizontal',\n shallow: true,\n statusIcon: true,\n asterisk: undefined,\n})\nconst formPrefixCls = `${stylePrefix}-form`\nconst { props: attrs } = useCleanAttrs()\nconst rootHTMLRef = ref<HTMLElement>()\nconst isFormTag = props.tag === 'form'\nconst formLayoutBaseId = useId()\nconst formLayoutId = computed(() => attrs.value.id ?? `formily-${formLayoutBaseId.value}`)\nconst formLayoutDomId = computed(() => (isFormTag ? formLayoutId.value : attrs.value.id))\nif (isFormTag) {\n provide(formLayoutIdContext, formLayoutId)\n}\n\nconst formLayoutDeepConfig = useFormDeepLayout()\nconst { props: responsiveProps } = useResponsiveFormLayout(props, rootHTMLRef)\n\nconst deepLayout = ref({\n ...formLayoutDeepConfig.value,\n ...(props.shallow\n ? {\n size: props.size,\n ...(isValid(props.colon) && { colon: props.colon }),\n }\n : filterValidFormLayoutProps(props)),\n})\nprovide(formLayoutDeepContext, deepLayout)\n\nconst shallowLayout = ref(props.shallow ? filterValidFormLayoutProps(props) : {})\nprovide(formLayoutShallowContext, shallowLayout)\n\nconst updateLayout = useThrottleFn(() => {\n if (!isEmpty(responsiveProps.value)) {\n const _responsiveProps = filterValidFormLayoutProps(responsiveProps.value)\n shallowLayout.value = filterValidFormLayoutProps({ ...props, ..._responsiveProps })\n }\n}, 200, true)\n\nwatch(() => [props, responsiveProps], updateLayout, {\n deep: true,\n immediate: true,\n})\n\nconst formContext = reactive({\n size: toRef(props, 'size'),\n statusIcon: toRef(props, 'statusIcon'),\n hideRequiredAsterisk: toRef(props, 'hideRequiredAsterisk'),\n requireAsteriskPosition: toRef(props, 'requireAsteriskPosition'),\n})\nprovide(formContextKey, formContext as FormContext)\n</script>\n\n<template>\n <component\n :is=\"props.tag\"\n :id=\"formLayoutDomId\"\n ref=\"rootHTMLRef\"\n :class=\"formPrefixCls\"\n v-bind=\"attrs\"\n @submit.prevent.stop\n >\n <slot />\n </component>\n</template>\n"],"names":["props","__props","formPrefixCls","stylePrefix","attrs","useCleanAttrs","rootHTMLRef","ref","isFormTag","formLayoutBaseId","useId","formLayoutId","computed","formLayoutDomId","provide","formLayoutIdContext","formLayoutDeepConfig","useFormDeepLayout","responsiveProps","useResponsiveFormLayout","deepLayout","isValid","filterValidFormLayoutProps","formLayoutDeepContext","shallowLayout","formLayoutShallowContext","updateLayout","useThrottleFn","isEmpty","_responsiveProps","watch","formContext","reactive","toRef","formContextKey","_openBlock","_createBlock","_resolveDynamicComponent","_mergeProps","_unref","_renderSlot","_ctx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"form-layout.mjs","sources":["../../src/form-layout/form-layout.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { FormContext } from 'element-plus'\nimport type { IFormLayoutProps } from './types'\nimport { isEmpty, isValid } from '@formily/shared'\nimport { useThrottleFn } from '@vueuse/core'\nimport { formContextKey, useId } from 'element-plus'\nimport { computed, provide, reactive, ref, toRef, watch } from 'vue'\nimport { stylePrefix, useCleanAttrs } from '../__builtins__'\nimport { filterValidFormLayoutProps, formLayoutDeepContext, formLayoutIdContext, formLayoutShallowContext, useFormDeepLayout, useResponsiveFormLayout } from './utils'\n\ndefineOptions({\n name: 'FFormLayout',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<IFormLayoutProps>(), {\n tag: 'form',\n colon: undefined,\n labelWrap: undefined,\n fullness: undefined,\n size: 'default',\n layout: 'horizontal',\n shallow: true,\n statusIcon: true,\n asterisk: undefined,\n})\nconst formPrefixCls = `${stylePrefix}-form`\nconst { props: attrs } = useCleanAttrs()\nconst rootHTMLRef = ref<HTMLElement>()\nconst isFormTag = props.tag === 'form'\nconst formLayoutBaseId = useId()\nconst formLayoutId = computed(() => attrs.value.id ?? `formily-${formLayoutBaseId.value}`)\nconst formLayoutDomId = computed(() => (isFormTag ? formLayoutId.value : attrs.value.id))\nif (isFormTag) {\n provide(formLayoutIdContext, formLayoutId)\n}\n\nconst formLayoutDeepConfig = useFormDeepLayout()\nconst { props: responsiveProps } = useResponsiveFormLayout(props, rootHTMLRef)\n\nconst deepLayout = ref({\n ...formLayoutDeepConfig.value,\n ...(props.shallow\n ? {\n size: props.size,\n ...(isValid(props.colon) && { colon: props.colon }),\n }\n : filterValidFormLayoutProps(props)),\n})\nprovide(formLayoutDeepContext, deepLayout)\n\nconst shallowLayout = ref(props.shallow ? filterValidFormLayoutProps(props) : {})\nprovide(formLayoutShallowContext, shallowLayout)\n\nconst updateLayout = useThrottleFn(() => {\n if (!isEmpty(responsiveProps.value)) {\n const _responsiveProps = filterValidFormLayoutProps(responsiveProps.value)\n shallowLayout.value = filterValidFormLayoutProps({ ...props, ..._responsiveProps })\n }\n}, 200, true)\n\nwatch(() => [props, responsiveProps], updateLayout, {\n deep: true,\n immediate: true,\n})\n\nconst formContext = reactive({\n size: toRef(props, 'size'),\n statusIcon: toRef(props, 'statusIcon'),\n hideRequiredAsterisk: toRef(props, 'hideRequiredAsterisk'),\n requireAsteriskPosition: toRef(props, 'requireAsteriskPosition'),\n})\nprovide(formContextKey, formContext as FormContext)\n</script>\n\n<template>\n <component\n :is=\"props.tag\"\n :id=\"formLayoutDomId\"\n ref=\"rootHTMLRef\"\n :class=\"formPrefixCls\"\n v-bind=\"attrs\"\n @submit.prevent.stop\n >\n <slot />\n </component>\n</template>\n"],"names":["props","__props","formPrefixCls","stylePrefix","attrs","useCleanAttrs","rootHTMLRef","ref","isFormTag","formLayoutBaseId","useId","formLayoutId","computed","formLayoutDomId","provide","formLayoutIdContext","formLayoutDeepConfig","useFormDeepLayout","responsiveProps","useResponsiveFormLayout","deepLayout","isValid","filterValidFormLayoutProps","formLayoutDeepContext","shallowLayout","formLayoutShallowContext","updateLayout","useThrottleFn","isEmpty","_responsiveProps","watch","formContext","reactive","toRef","formContextKey","_openBlock","_createBlock","_resolveDynamicComponent","_mergeProps","_unref","_renderSlot","_ctx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,UAAMA,IAAQC,GAWRC,IAAgB,GAAGC,CAAW,SAC9B,EAAE,OAAOC,EAAA,IAAUC,EAAA,GACnBC,IAAcC,EAAA,GACdC,IAAYR,EAAM,QAAQ,QAC1BS,IAAmBC,EAAA,GACnBC,IAAeC,EAAS,MAAMR,EAAM,MAAM,MAAM,WAAWK,EAAiB,KAAK,EAAE,GACnFI,IAAkBD,EAAS,MAAOJ,IAAYG,EAAa,QAAQP,EAAM,MAAM,EAAG;AACxF,IAAII,KACFM,EAAQC,GAAqBJ,CAAY;AAG3C,UAAMK,IAAuBC,EAAA,GACvB,EAAE,OAAOC,EAAA,IAAoBC,EAAwBnB,GAAOM,CAAW,GAEvEc,IAAab,EAAI;AAAA,MACrB,GAAGS,EAAqB;AAAA,MACxB,GAAIhB,EAAM,UAC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form-step/index.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { ElSteps as g, ElStep as P } from "element-plus";
|
|
2
|
-
import "@formily/reactive";
|
|
2
|
+
import { useObserver as B } from "@silver-formily/reactive-vue";
|
|
3
3
|
import "@vueuse/core";
|
|
4
|
-
import { defineComponent as $, renderSlot as
|
|
4
|
+
import { defineComponent as $, renderSlot as E, computed as N, openBlock as r, createElementBlock as o, normalizeClass as O, createVNode as V, unref as t, mergeProps as h, withCtx as u, Fragment as c, renderList as x, createBlock as a, createSlots as b, resolveDynamicComponent as _, createTextVNode as v, toDisplayString as y, createCommentVNode as A } from "vue";
|
|
5
5
|
import "@formily/core";
|
|
6
|
-
import { useObserver as A } from "@silver-formily/reactive-vue";
|
|
7
6
|
import { useField as D, useFieldSchema as R, RecursionField as j } from "@silver-formily/vue";
|
|
8
7
|
import { composeExport as w } from "../__builtins__/shared/utils.mjs";
|
|
9
8
|
import { isObj as k } from "@formily/shared";
|
|
@@ -19,7 +18,7 @@ const T = $({
|
|
|
19
18
|
return m;
|
|
20
19
|
};
|
|
21
20
|
function G(n, i, m, p, s, f) {
|
|
22
|
-
return
|
|
21
|
+
return E(n.$slots, "default");
|
|
23
22
|
}
|
|
24
23
|
const H = /* @__PURE__ */ q(T, [["render", G]]), I = /* @__PURE__ */ $({
|
|
25
24
|
name: "FFormStep",
|
|
@@ -31,19 +30,19 @@ const H = /* @__PURE__ */ q(T, [["render", G]]), I = /* @__PURE__ */ $({
|
|
|
31
30
|
},
|
|
32
31
|
setup(n) {
|
|
33
32
|
const i = n;
|
|
34
|
-
|
|
33
|
+
B();
|
|
35
34
|
const m = D().value, p = `${z}-form-step`, s = R(), f = L(s.value);
|
|
36
35
|
i.formStep.connect?.(f, m);
|
|
37
|
-
const F =
|
|
36
|
+
const F = N(() => i.active ?? i.formStep?.current ?? 0);
|
|
38
37
|
return (S, J) => (r(), o("div", {
|
|
39
|
-
class:
|
|
38
|
+
class: O(p)
|
|
40
39
|
}, [
|
|
41
|
-
|
|
40
|
+
V(t(g), h(S.$attrs, {
|
|
42
41
|
active: F.value,
|
|
43
42
|
style: [{ marginBottom: "10px" }]
|
|
44
43
|
}), {
|
|
45
44
|
default: u(() => [
|
|
46
|
-
(r(!0), o(c, null, x(t(f), ({ props: l, slots: e }, d) => (r(), a(t(P), h({ key: d }, { ref_for: !0 }, l),
|
|
45
|
+
(r(!0), o(c, null, x(t(f), ({ props: l, slots: e }, d) => (r(), a(t(P), h({ key: d }, { ref_for: !0 }, l), b({ _: 2 }, [
|
|
47
46
|
e?.title ? {
|
|
48
47
|
name: "title",
|
|
49
48
|
fn: u(() => [
|
|
@@ -80,16 +79,16 @@ const H = /* @__PURE__ */ q(T, [["render", G]]), I = /* @__PURE__ */ $({
|
|
|
80
79
|
key: 0,
|
|
81
80
|
name: l,
|
|
82
81
|
schema: e
|
|
83
|
-
}, null, 8, ["name", "schema"])) :
|
|
82
|
+
}, null, 8, ["name", "schema"])) : A("", !0)
|
|
84
83
|
], 64))), 128))
|
|
85
84
|
]));
|
|
86
85
|
}
|
|
87
|
-
}),
|
|
86
|
+
}), te = w(I, {
|
|
88
87
|
StepPane: H,
|
|
89
88
|
createFormStep: C
|
|
90
89
|
});
|
|
91
90
|
export {
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
te as FormStep,
|
|
92
|
+
te as default
|
|
94
93
|
};
|
|
95
94
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/form-step/form-step-pane.vue","../../src/form-step/form-step.vue","../../src/form-step/index.ts"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent } from 'vue'\n\nexport default defineComponent({\n name: 'FFormStepPane',\n inheritAttrs: false,\n})\n</script>\n\n<template>\n <slot />\n</template>\n","<script setup lang=\"ts\">\nimport type { VoidField } from '@formily/core'\nimport type { IFormStepProps } from './types'\nimport { isObj } from '@formily/shared'\nimport { useObserver } from '@silver-formily/reactive-vue'\nimport { RecursionField, useField, useFieldSchema } from '@silver-formily/vue'\nimport { ElStep, ElSteps } from 'element-plus'\nimport { computed } from 'vue'\nimport { stylePrefix } from '../__builtins__'\nimport { createFormStep, parseSteps } from './utils'\n\ndefineOptions({\n name: 'FFormStep',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<IFormStepProps>(), {\n formStep: () => createFormStep(),\n})\n\nuseObserver()\n\nconst field = useField<VoidField>().value\nconst prefixCls = `${stylePrefix}-form-step`\nconst fieldSchemaRef = useFieldSchema()\n\nconst steps = parseSteps(fieldSchemaRef.value)\n\nprops.formStep.connect?.(steps, field)\n\nconst current = computed(() => props.active ?? props.formStep?.current ?? 0)\n</script>\n\n<template>\n <div :class=\"prefixCls\">\n <ElSteps\n v-bind=\"$attrs\"\n :active=\"current\"\n :style=\"[{ marginBottom: '10px' }]\"\n >\n <ElStep\n v-for=\"({ props: stepProps, slots: stepSlots }, key) of steps\"\n :key=\"key\"\n v-bind=\"stepProps\"\n >\n <template v-if=\"stepSlots?.title\" #title>\n <template v-if=\"isObj(stepSlots.title)\">\n <component :is=\"stepSlots.title\" />\n </template>\n <template v-else>\n {{ stepSlots.title }}\n </template>\n </template>\n <template v-if=\"stepSlots?.icon\" #icon>\n <template v-if=\"isObj(stepSlots.icon)\">\n <component :is=\"stepSlots.icon\" />\n </template>\n <template v-else>\n {{ stepSlots.icon }}\n </template>\n </template>\n <template v-if=\"stepSlots?.description\" #description>\n <template v-if=\"isObj(stepSlots.description)\">\n <component :is=\"stepSlots.description\" />\n </template>\n <template v-else>\n {{ stepSlots.description }}\n </template>\n </template>\n </ElStep>\n </ElSteps>\n\n <template v-for=\"({ name, schema }, key) of steps\" :key=\"name\">\n <RecursionField\n v-if=\"key === current\"\n :name=\"name\"\n :schema=\"schema\"\n />\n </template>\n </div>\n</template>\n","import { composeExport } from '../__builtins__'\nimport FFormStepPane from './form-step-pane.vue'\nimport FFormStep from './form-step.vue'\nimport { createFormStep } from './utils'\n\nexport const FormStep = composeExport(FFormStep, {\n StepPane: FFormStepPane,\n createFormStep,\n})\n\nexport default FormStep\n"],"names":["_sfc_main$1","defineComponent","_renderSlot","_ctx","props","__props","useObserver","field","useField","prefixCls","stylePrefix","fieldSchemaRef","useFieldSchema","steps","parseSteps","current","computed","_createElementBlock","_createVNode","_unref","ElSteps","_mergeProps","_openBlock","_Fragment","stepProps","stepSlots","key","_createBlock","_createSlots","isObj","_resolveDynamicComponent","_createTextVNode","_toDisplayString","name","schema","RecursionField","FormStep","composeExport","FFormStep","FFormStepPane","createFormStep"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/form-step/form-step-pane.vue","../../src/form-step/form-step.vue","../../src/form-step/index.ts"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent } from 'vue'\n\nexport default defineComponent({\n name: 'FFormStepPane',\n inheritAttrs: false,\n})\n</script>\n\n<template>\n <slot />\n</template>\n","<script setup lang=\"ts\">\nimport type { VoidField } from '@formily/core'\nimport type { IFormStepProps } from './types'\nimport { isObj } from '@formily/shared'\nimport { useObserver } from '@silver-formily/reactive-vue'\nimport { RecursionField, useField, useFieldSchema } from '@silver-formily/vue'\nimport { ElStep, ElSteps } from 'element-plus'\nimport { computed } from 'vue'\nimport { stylePrefix } from '../__builtins__'\nimport { createFormStep, parseSteps } from './utils'\n\ndefineOptions({\n name: 'FFormStep',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<IFormStepProps>(), {\n formStep: () => createFormStep(),\n})\n\nuseObserver()\n\nconst field = useField<VoidField>().value\nconst prefixCls = `${stylePrefix}-form-step`\nconst fieldSchemaRef = useFieldSchema()\n\nconst steps = parseSteps(fieldSchemaRef.value)\n\nprops.formStep.connect?.(steps, field)\n\nconst current = computed(() => props.active ?? props.formStep?.current ?? 0)\n</script>\n\n<template>\n <div :class=\"prefixCls\">\n <ElSteps\n v-bind=\"$attrs\"\n :active=\"current\"\n :style=\"[{ marginBottom: '10px' }]\"\n >\n <ElStep\n v-for=\"({ props: stepProps, slots: stepSlots }, key) of steps\"\n :key=\"key\"\n v-bind=\"stepProps\"\n >\n <template v-if=\"stepSlots?.title\" #title>\n <template v-if=\"isObj(stepSlots.title)\">\n <component :is=\"stepSlots.title\" />\n </template>\n <template v-else>\n {{ stepSlots.title }}\n </template>\n </template>\n <template v-if=\"stepSlots?.icon\" #icon>\n <template v-if=\"isObj(stepSlots.icon)\">\n <component :is=\"stepSlots.icon\" />\n </template>\n <template v-else>\n {{ stepSlots.icon }}\n </template>\n </template>\n <template v-if=\"stepSlots?.description\" #description>\n <template v-if=\"isObj(stepSlots.description)\">\n <component :is=\"stepSlots.description\" />\n </template>\n <template v-else>\n {{ stepSlots.description }}\n </template>\n </template>\n </ElStep>\n </ElSteps>\n\n <template v-for=\"({ name, schema }, key) of steps\" :key=\"name\">\n <RecursionField\n v-if=\"key === current\"\n :name=\"name\"\n :schema=\"schema\"\n />\n </template>\n </div>\n</template>\n","import { composeExport } from '../__builtins__'\nimport FFormStepPane from './form-step-pane.vue'\nimport FFormStep from './form-step.vue'\nimport { createFormStep } from './utils'\n\nexport const FormStep = composeExport(FFormStep, {\n StepPane: FFormStepPane,\n createFormStep,\n})\n\nexport default FormStep\n"],"names":["_sfc_main$1","defineComponent","_renderSlot","_ctx","props","__props","useObserver","field","useField","prefixCls","stylePrefix","fieldSchemaRef","useFieldSchema","steps","parseSteps","current","computed","_createElementBlock","_createVNode","_unref","ElSteps","_mergeProps","_openBlock","_Fragment","stepProps","stepSlots","key","_createBlock","_createSlots","isObj","_resolveDynamicComponent","_createTextVNode","_toDisplayString","name","schema","RecursionField","FormStep","composeExport","FFormStep","FFormStepPane","createFormStep"],"mappings":";;;;;;;;;;AAGA,MAAAA,IAAeC,EAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;;;;;;;SAICC,EAAQC,EAAA,QAAA,SAAA;;;;;;;;;;;ACMV,UAAMC,IAAQC;AAId,IAAAC,EAAA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A,oBACvC,MAEW;AAAA,gBAFKN,EAAAU,CAAA,EAAMJ,EAAU,WAAW,UACzCE,EAAyCG,EAAzBL,EAAU,WAAW,GAAA,EAAA,KAAA,EAAA,CAAA,WAEvCR,EAEWM,GAAA,EAAA,KAAA,KAAA;AAAA,kBADNQ,EAAAC,EAAAP,EAAU,WAAW,GAAA,CAAA;AAAA,gBAAA;;;;;;;;OAMhCH,EAAA,EAAA,GAAAL,EAMWM,WANiCJ,EAAAN,CAAA,GAAK,CAAA,EAA7B,MAAAoB,GAAM,QAAAC,EAAA,GAAUR,wBAAqBO,KAAI;AAAA,QAEnDP,MAAQX,EAAA,cADhBY,EAIER,EAAAgB,CAAA,GAAA;AAAA;UAFC,MAAAF;AAAA,UACA,QAAAC;AAAA,QAAA;;;;ICvEIE,KAAWC,EAAcC,GAAW;AAAA,EAC/C,UAAUC;AAAA,EACV,gBAAAC;AACF,CAAC;"}
|
package/esm/form-tab/index.mjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { formilyComputed as
|
|
2
|
-
import { ElTabs as
|
|
3
|
-
import { reaction as $ } from "@formily/reactive";
|
|
1
|
+
import { formilyComputed as p, reactionWatch as k, observer as B } from "@silver-formily/reactive-vue";
|
|
2
|
+
import { ElTabs as K, ElTabPane as w, ElBadge as $ } from "element-plus";
|
|
4
3
|
import "@vueuse/core";
|
|
5
4
|
import { defineComponent as L, computed as N, ref as R, watch as S, openBlock as t, createBlock as n, unref as a, withCtx as l, createElementBlock as v, Fragment as b, renderList as q, mergeProps as z, normalizeClass as A, createTextVNode as h, toDisplayString as T, createVNode as D } from "vue";
|
|
6
5
|
import "@formily/core";
|
|
7
|
-
import { useField as I, useFieldSchema as P, RecursionField as
|
|
8
|
-
import { composeExport as
|
|
9
|
-
import { stylePrefix as
|
|
10
|
-
import { useTabs as
|
|
6
|
+
import { useField as I, useFieldSchema as P, RecursionField as W } from "@silver-formily/vue";
|
|
7
|
+
import { composeExport as j } from "../__builtins__/shared/utils.mjs";
|
|
8
|
+
import { stylePrefix as G } from "../__builtins__/configs/index.mjs";
|
|
9
|
+
import { useTabs as H } from "./hooks.mjs";
|
|
11
10
|
import { createFormTab as y } from "./utils.mjs";
|
|
12
|
-
import '../styles/form-tab/index.css';const
|
|
11
|
+
import '../styles/form-tab/index.css';const J = /* @__PURE__ */ L({
|
|
13
12
|
name: "FFormTab",
|
|
14
13
|
__name: "form-tab",
|
|
15
14
|
props: {
|
|
@@ -18,39 +17,39 @@ import '../styles/form-tab/index.css';const M = /* @__PURE__ */ L({
|
|
|
18
17
|
},
|
|
19
18
|
emits: ["update:modelValue"],
|
|
20
19
|
setup(F, { emit: _ }) {
|
|
21
|
-
const c = F, g = _, m = I(), x = P(), C = `${
|
|
22
|
-
|
|
20
|
+
const c = F, g = _, m = I(), x = P(), C = `${G}-form-tab`, u = N(() => c.formTab ?? y()), r = p(() => H(m.value, x.value)), o = R(c?.modelValue ?? u.value.activeKey ?? r.value?.[0]?.name);
|
|
21
|
+
k(() => r.value.length, () => {
|
|
23
22
|
!r.value.some((e) => e.name === o.value) && (o.value = r.value?.[0]?.name);
|
|
24
23
|
}, {
|
|
25
24
|
fireImmediately: !0
|
|
26
25
|
}), S(() => u.value.activeKey, (e) => {
|
|
27
26
|
o.value = e;
|
|
28
27
|
});
|
|
29
|
-
const i =
|
|
28
|
+
const i = p(() => r.value.map((e) => m.value.form.queryFeedbacks({
|
|
30
29
|
type: "error",
|
|
31
30
|
address: `${m.value.address}.${e.name}.*`
|
|
32
31
|
}).length));
|
|
33
32
|
function V(e) {
|
|
34
33
|
typeof e == "string" && (g("update:modelValue", e), u.value.setActiveKey?.(e));
|
|
35
34
|
}
|
|
36
|
-
return (e,
|
|
35
|
+
return (e, O) => (t(), n(a(K), {
|
|
37
36
|
"model-value": o.value,
|
|
38
37
|
style: { width: "100%" },
|
|
39
38
|
onTabChange: V
|
|
40
39
|
}, {
|
|
41
40
|
default: l(() => [
|
|
42
|
-
(t(!0), v(b, null, q(a(r), ({ props: s, schema: E, name: f },
|
|
41
|
+
(t(!0), v(b, null, q(a(r), ({ props: s, schema: E, name: f }, d) => (t(), n(a(w), z({ key: f }, { ref_for: !0 }, s), {
|
|
43
42
|
default: l(() => [
|
|
44
|
-
D(a(
|
|
43
|
+
D(a(W), {
|
|
45
44
|
schema: E,
|
|
46
45
|
name: f
|
|
47
46
|
}, null, 8, ["schema", "name"])
|
|
48
47
|
]),
|
|
49
48
|
label: l(() => [
|
|
50
|
-
a(i)[
|
|
49
|
+
a(i)[d] !== 0 ? (t(), n(a($), {
|
|
51
50
|
key: 0,
|
|
52
51
|
class: A(C),
|
|
53
|
-
value: a(i)[
|
|
52
|
+
value: a(i)[d]
|
|
54
53
|
}, {
|
|
55
54
|
default: l(() => [
|
|
56
55
|
h(T(s.label), 1)
|
|
@@ -66,12 +65,12 @@ import '../styles/form-tab/index.css';const M = /* @__PURE__ */ L({
|
|
|
66
65
|
_: 1
|
|
67
66
|
}, 8, ["model-value"]));
|
|
68
67
|
}
|
|
69
|
-
}),
|
|
68
|
+
}), M = B(J), le = j(M, {
|
|
70
69
|
createFormTab: y
|
|
71
70
|
});
|
|
72
71
|
export {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
le as FormTab,
|
|
73
|
+
le as composeFormTab,
|
|
74
|
+
le as default
|
|
76
75
|
};
|
|
77
76
|
//# 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\">\nimport type { IFormTabProps } from './types.ts'\nimport {
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/form-tab/form-tab.vue","../../src/form-tab/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { IFormTabProps } from './types.ts'\nimport { formilyComputed, reactionWatch } from '@silver-formily/reactive-vue'\nimport { RecursionField, useField, useFieldSchema } from '@silver-formily/vue'\nimport { ElBadge, ElTabPane, ElTabs } from 'element-plus'\nimport { computed, ref, watch } from 'vue'\nimport { stylePrefix } from '../__builtins__'\nimport { useTabs } from './hooks'\nimport { createFormTab } from './utils'\n\ndefineOptions({\n name: 'FFormTab',\n})\n\nconst props = defineProps<IFormTabProps>()\nconst emit = defineEmits(['update:modelValue'])\n\nconst field = useField()\nconst schema = useFieldSchema()\nconst prefixCls = `${stylePrefix}-form-tab`\nconst formTabRef = computed(() => props.formTab ?? createFormTab())\nconst tabs = formilyComputed(() => useTabs(field.value, schema.value))\nconst _activeKey = ref(props?.modelValue ?? formTabRef.value.activeKey ?? tabs.value?.[0]?.name)\n\nreactionWatch(() => {\n return tabs.value.length\n}, () => {\n !tabs.value.some(tab => tab.name === _activeKey.value) && (_activeKey.value = tabs.value?.[0]?.name)\n}, {\n fireImmediately: true,\n})\nwatch(() => formTabRef.value.activeKey, (val) => {\n _activeKey.value = val\n})\n\nconst errorList = formilyComputed(() => {\n return tabs.value.map((tab) => {\n return field.value.form.queryFeedbacks({\n type: 'error',\n address: `${field.value.address}.${tab.name}.*`,\n }).length\n })\n})\n\nfunction handleTabChange(key: string) {\n /* istanbul ignore if -- @preserve */\n if (typeof key !== 'string')\n return\n emit('update:modelValue', key)\n formTabRef.value.setActiveKey?.(key)\n}\n</script>\n\n<template>\n <ElTabs\n :model-value=\"_activeKey\"\n style=\"width: 100%;\"\n @tab-change=\"handleTabChange\"\n >\n <ElTabPane\n v-for=\"({ props: tabProps, schema: tabSchema, name }, key) in tabs\"\n :key=\"name\"\n v-bind=\"tabProps\"\n >\n <template #default>\n <RecursionField :schema=\"tabSchema\" :name=\"name\" />\n </template>\n <template #label>\n <ElBadge\n v-if=\"errorList[key] !== 0\"\n :class=\"prefixCls\"\n :value=\"errorList[key]\"\n >\n {{ tabProps.label }}\n </ElBadge>\n <template v-else>\n {{ tabProps.label }}\n </template>\n </template>\n </ElTabPane>\n </ElTabs>\n</template>\n","import { observer } from '@silver-formily/reactive-vue'\nimport { composeExport } from '../__builtins__'\nimport FFormTab from './form-tab.vue'\nimport { createFormTab } from './utils'\nimport './style.scss'\n\nconst FormTab = observer(FFormTab)\n\nexport const composeFormTab = composeExport(FormTab, {\n createFormTab,\n})\n\nexport { composeFormTab as FormTab }\nexport default composeFormTab\n"],"names":["props","__props","emit","__emit","field","useField","schema","useFieldSchema","prefixCls","stylePrefix","formTabRef","computed","createFormTab","tabs","formilyComputed","useTabs","_activeKey","ref","reactionWatch","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":";;;;;;;;;;;;;;;;;;;AAcA,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,EAAc,MACLL,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,MAC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";
|
|
2
2
|
import { ElInput as d } from "element-plus";
|
|
3
|
-
import "@formily/reactive";
|
|
3
|
+
import "@silver-formily/reactive-vue";
|
|
4
4
|
import "@vueuse/core";
|
|
5
|
-
import { defineComponent as l, useSlots as c, openBlock as y, createBlock as x, unref as p, normalizeProps as I, guardReactiveProps as k, createSlots as v, withCtx as r, renderSlot as
|
|
5
|
+
import { defineComponent as l, useSlots as c, openBlock as y, createBlock as x, unref as p, normalizeProps as I, guardReactiveProps as k, createSlots as v, withCtx as r, renderSlot as n } from "vue";
|
|
6
6
|
import { mapReadPretty as i } from "../__builtins__/shared/transform-component.mjs";
|
|
7
7
|
import { useCleanAttrs as P, composeExport as _ } from "../__builtins__/shared/utils.mjs";
|
|
8
8
|
import { PreviewText as m } from "../preview-text/index.mjs";
|
|
9
9
|
import "@formily/core";
|
|
10
|
-
import "@silver-formily/reactive-vue";
|
|
11
10
|
const f = /* @__PURE__ */ l({
|
|
12
11
|
name: "FInput",
|
|
13
12
|
inheritAttrs: !1,
|
|
14
13
|
__name: "input",
|
|
15
|
-
setup(
|
|
14
|
+
setup(o) {
|
|
16
15
|
const e = c(), { props: u } = P();
|
|
17
16
|
return (t, A) => (y(), x(p(d), I(k(p(u))), v({ _: 2 }, [
|
|
18
17
|
e.prefix ? {
|
|
19
18
|
name: "prefix",
|
|
20
19
|
fn: r(() => [
|
|
21
|
-
|
|
20
|
+
n(t.$slots, "prefix")
|
|
22
21
|
]),
|
|
23
22
|
key: "0"
|
|
24
23
|
} : void 0,
|
|
25
24
|
e.suffix ? {
|
|
26
25
|
name: "suffix",
|
|
27
26
|
fn: r(() => [
|
|
28
|
-
|
|
27
|
+
n(t.$slots, "suffix")
|
|
29
28
|
]),
|
|
30
29
|
key: "1"
|
|
31
30
|
} : void 0,
|
|
32
31
|
e.prepend ? {
|
|
33
32
|
name: "prepend",
|
|
34
33
|
fn: r(() => [
|
|
35
|
-
|
|
34
|
+
n(t.$slots, "prepend")
|
|
36
35
|
]),
|
|
37
36
|
key: "2"
|
|
38
37
|
} : void 0,
|
|
39
38
|
e.append ? {
|
|
40
39
|
name: "append",
|
|
41
40
|
fn: r(() => [
|
|
42
|
-
|
|
41
|
+
n(t.$slots, "append")
|
|
43
42
|
]),
|
|
44
43
|
key: "3"
|
|
45
44
|
} : void 0
|
|
@@ -53,17 +52,17 @@ const f = /* @__PURE__ */ l({
|
|
|
53
52
|
i(m.Input)
|
|
54
53
|
), h = s(
|
|
55
54
|
f,
|
|
56
|
-
a((
|
|
57
|
-
...
|
|
58
|
-
readonly:
|
|
55
|
+
a((o) => ({
|
|
56
|
+
...o,
|
|
57
|
+
readonly: o.readOnly,
|
|
59
58
|
type: "textarea"
|
|
60
59
|
})),
|
|
61
60
|
i(m.Input)
|
|
62
|
-
),
|
|
61
|
+
), z = _($, {
|
|
63
62
|
TextArea: h
|
|
64
63
|
});
|
|
65
64
|
export {
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
z as Input,
|
|
66
|
+
z as default
|
|
68
67
|
};
|
|
69
68
|
//# sourceMappingURL=index.mjs.map
|
package/esm/input/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/input/input.vue","../../src/input/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ElInput } from 'element-plus'\nimport { useCleanAttrs } from '../__builtins__/index'\n\ndefineOptions({\n name: 'FInput',\n inheritAttrs: false,\n})\n\nconst slots = defineSlots<{\n prefix?: () => any\n suffix?: () => any\n prepend?: () => any\n append?: () => any\n}>()\n\nconst { props: inputProps } = useCleanAttrs()\n</script>\n\n<template>\n <ElInput\n v-bind=\"inputProps\"\n >\n <template v-if=\"slots.prefix\" #prefix>\n <slot name=\"prefix\" />\n </template>\n <template v-if=\"slots.suffix\" #suffix>\n <slot name=\"suffix\" />\n </template>\n <template v-if=\"slots.prepend\" #prepend>\n <slot name=\"prepend\" />\n </template>\n <template v-if=\"slots.append\" #append>\n <slot name=\"append\" />\n </template>\n </ElInput>\n</template>\n","import { connect, mapProps } from '@silver-formily/vue'\nimport { composeExport, mapReadPretty } from '../__builtins__'\nimport { PreviewText } from '../preview-text'\nimport FInput from './input.vue'\n\nconst InnerInput = connect<typeof FInput>(\n FInput,\n mapProps({\n readOnly: 'readonly',\n }),\n mapReadPretty(PreviewText.Input),\n)\n\nconst TextArea = connect<typeof FInput>(\n FInput,\n mapProps((props) => {\n return {\n ...props,\n readonly: props.readOnly,\n type: 'textarea',\n }\n }),\n mapReadPretty(PreviewText.Input),\n)\n\nexport const Input = composeExport(InnerInput, {\n TextArea,\n})\n\nexport default Input\n"],"names":["slots","_useSlots","inputProps","useCleanAttrs","_openBlock","_createBlock","_unref","_createSlots","_renderSlot","_ctx","InnerInput","connect","FInput","mapProps","mapReadPretty","PreviewText","TextArea","props","Input","composeExport"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/input/input.vue","../../src/input/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ElInput } from 'element-plus'\nimport { useCleanAttrs } from '../__builtins__/index'\n\ndefineOptions({\n name: 'FInput',\n inheritAttrs: false,\n})\n\nconst slots = defineSlots<{\n prefix?: () => any\n suffix?: () => any\n prepend?: () => any\n append?: () => any\n}>()\n\nconst { props: inputProps } = useCleanAttrs()\n</script>\n\n<template>\n <ElInput\n v-bind=\"inputProps\"\n >\n <template v-if=\"slots.prefix\" #prefix>\n <slot name=\"prefix\" />\n </template>\n <template v-if=\"slots.suffix\" #suffix>\n <slot name=\"suffix\" />\n </template>\n <template v-if=\"slots.prepend\" #prepend>\n <slot name=\"prepend\" />\n </template>\n <template v-if=\"slots.append\" #append>\n <slot name=\"append\" />\n </template>\n </ElInput>\n</template>\n","import { connect, mapProps } from '@silver-formily/vue'\nimport { composeExport, mapReadPretty } from '../__builtins__'\nimport { PreviewText } from '../preview-text'\nimport FInput from './input.vue'\n\nconst InnerInput = connect<typeof FInput>(\n FInput,\n mapProps({\n readOnly: 'readonly',\n }),\n mapReadPretty(PreviewText.Input),\n)\n\nconst TextArea = connect<typeof FInput>(\n FInput,\n mapProps((props) => {\n return {\n ...props,\n readonly: props.readOnly,\n type: 'textarea',\n }\n }),\n mapReadPretty(PreviewText.Input),\n)\n\nexport const Input = composeExport(InnerInput, {\n TextArea,\n})\n\nexport default Input\n"],"names":["slots","_useSlots","inputProps","useCleanAttrs","_openBlock","_createBlock","_unref","_createSlots","_renderSlot","_ctx","InnerInput","connect","FInput","mapProps","mapReadPretty","PreviewText","TextArea","props","Input","composeExport"],"mappings":";;;;;;;;;;;;;;AASA,UAAMA,IAAQC,EAAA,GAOR,EAAE,OAAOC,EAAA,IAAeC,EAAA;sBAI5BC,KAAAC,EAeUC,UAdAA,EAAAJ,CAAA,CAAU,CAAA,GAAAK,EAAA,EAAA,GAAA,KAAA;AAAA,MAEFP,EAAM;cAAS;AAAA,cAC7B,MAAsB;AAAA,UAAtBQ,EAAsBC,EAAA,QAAA,QAAA;AAAA,QAAA;;;MAERT,EAAM;cAAS;AAAA,cAC7B,MAAsB;AAAA,UAAtBQ,EAAsBC,EAAA,QAAA,QAAA;AAAA,QAAA;;;MAERT,EAAM;cAAU;AAAA,cAC9B,MAAuB;AAAA,UAAvBQ,EAAuBC,EAAA,QAAA,SAAA;AAAA,QAAA;;;MAETT,EAAM;cAAS;AAAA,cAC7B,MAAsB;AAAA,UAAtBQ,EAAsBC,EAAA,QAAA,QAAA;AAAA,QAAA;;;;;IC5BtBC,IAAaC;AAAA,EACjBC;AAAAA,EACAC,EAAS;AAAA,IACP,UAAU;AAAA,EAAA,CACX;AAAA,EACDC,EAAcC,EAAY,KAAK;AACjC,GAEMC,IAAWL;AAAA,EACfC;AAAAA,EACAC,EAAS,CAACI,OACD;AAAA,IACL,GAAGA;AAAA,IACH,UAAUA,EAAM;AAAA,IAChB,MAAM;AAAA,EAAA,EAET;AAAA,EACDH,EAAcC,EAAY,KAAK;AACjC,GAEaG,IAAQC,EAAcT,GAAY;AAAA,EAC7C,UAAAM;AACF,CAAC;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { connect as r, mapProps as t } from "@silver-formily/vue";
|
|
2
2
|
import { ElInputNumber as m } from "element-plus";
|
|
3
|
-
import "@formily/reactive";
|
|
3
|
+
import "@silver-formily/reactive-vue";
|
|
4
4
|
import "@vueuse/core";
|
|
5
5
|
import "vue";
|
|
6
6
|
import { mapReadPretty as p } from "../__builtins__/shared/transform-component.mjs";
|