@silver-formily/vue 2.3.1 → 2.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +6 -6
- package/README.md +6 -6
- package/esm/components/ArrayField.d.ts +2 -0
- package/esm/components/Field.d.ts +2 -0
- package/esm/components/ObjectField.d.ts +2 -0
- package/esm/components/ReactiveField.mjs +48 -40
- package/esm/components/ReactiveField.mjs.map +1 -1
- package/esm/components/RecursionField.d.ts +127 -15
- package/esm/components/RecursionField.mjs +51 -53
- package/esm/components/RecursionField.mjs.map +1 -1
- package/esm/components/SchemaField.d.ts +142 -31
- package/esm/components/SchemaField.mjs +53 -51
- package/esm/components/SchemaField.mjs.map +1 -1
- package/esm/types/index.d.ts +2 -0
- package/esm/utils/fieldProps.d.ts +1 -0
- package/esm/utils/fieldProps.mjs +1 -0
- package/esm/utils/fieldProps.mjs.map +1 -1
- package/esm/utils/reactiveFieldHelpers.d.ts +2 -1
- package/esm/utils/reactiveFieldHelpers.mjs.map +1 -1
- package/esm/utils/slotMap.d.ts +1 -0
- package/esm/utils/slotMap.mjs +2 -0
- package/esm/utils/slotMap.mjs.map +1 -0
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaField.mjs","sources":["../../src/components/SchemaField.ts"],"sourcesContent":["import type { ISchema, SchemaTypes } from '@formily/json-schema'\nimport type {\n
|
|
1
|
+
{"version":3,"file":"SchemaField.mjs","sources":["../../src/components/SchemaField.ts"],"sourcesContent":["import type { ISchema, SchemaTypes } from '@formily/json-schema'\nimport type { VNode } from 'vue'\nimport type {\n ISchemaFieldVueFactoryOptions,\n SchemaExpressionScope,\n SchemaVueComponents,\n} from '../types'\nimport { Schema } from '@formily/json-schema'\nimport { lazyMerge } from '@formily/shared'\nimport { computed, defineComponent, Fragment, h, inject, provide, shallowRef, watch } from 'vue'\nimport { SchemaExpressionScopeSymbol, SchemaMarkupSymbol, SchemaOptionsSymbol } from '../shared'\nimport { resolveSchemaProps } from '../utils/resolveSchemaProps'\nimport { markupSchemaProps, schemaFieldProps } from '../utils/schemaFieldProps'\nimport RecursionField from './RecursionField'\n\ntype SchemaFieldProps = import('../utils/schemaFieldProps').SchemaFieldProps\ntype MarkupSchemaProps = import('../utils/schemaFieldProps').MarkupSchemaProps\n\nconst env = {\n nonameId: 0,\n}\n\nfunction getRandomName() {\n return `NO_NAME_FIELD_$${env.nonameId++}`\n}\n\nexport function createSchemaField<Components extends SchemaVueComponents = SchemaVueComponents>(\n options: ISchemaFieldVueFactoryOptions<Components> = {},\n) {\n const SchemaField = defineComponent({\n name: 'SchemaField',\n inheritAttrs: false,\n props: schemaFieldProps,\n setup(props: SchemaFieldProps, { slots }) {\n const schemaRef = computed<Schema>(() =>\n Schema.isSchemaInstance(props.schema)\n ? props.schema\n : new Schema({\n type: 'object',\n ...props.schema,\n }),\n )\n\n const scopeRef = computed<SchemaExpressionScope>(() =>\n lazyMerge({} as SchemaExpressionScope, options.scope ?? {}, props.scope ?? {}),\n )\n\n const optionsRef = computed<ISchemaFieldVueFactoryOptions>(() => ({\n ...options,\n components: {\n ...options.components,\n ...props.components,\n },\n }))\n\n provide(SchemaMarkupSymbol, schemaRef)\n provide(SchemaOptionsSymbol, optionsRef)\n provide(SchemaExpressionScopeSymbol, scopeRef)\n\n return () => {\n env.nonameId = 0\n\n const normalizedSlots = slots.default?.() ?? []\n\n const recursionNode = h(RecursionField, {\n ...props,\n schema: schemaRef.value,\n })\n\n return h(Fragment, null, [...normalizedSlots, recursionNode])\n }\n },\n })\n\n const MarkupField = defineComponent({\n name: 'MarkupField',\n props: {\n type: String,\n ...markupSchemaProps,\n },\n setup(props: MarkupSchemaProps, { slots }) {\n const parentRef = inject(SchemaMarkupSymbol, null)\n let render: () => VNode | null = () => null\n\n if (parentRef?.value) {\n const name = props.name || getRandomName()\n const appendArraySchema = (schema: ISchema) => {\n if (parentRef.value.items) {\n return parentRef.value.addProperty(name, schema)\n }\n else {\n return parentRef.value.setItems(resolveSchemaProps(props))\n }\n }\n\n const schemaRef = shallowRef<Schema>(parentRef.value)\n\n watch(\n parentRef,\n () => {\n if (parentRef.value.type === 'object' || parentRef.value.type === 'void') {\n schemaRef.value = parentRef.value.addProperty(name, resolveSchemaProps(props))\n }\n else if (parentRef.value.type === 'array') {\n const schema = appendArraySchema(resolveSchemaProps(props))\n schemaRef.value = Array.isArray(schema) ? schema[0] : schema\n }\n },\n { immediate: true, flush: 'sync' },\n )\n provide(SchemaMarkupSymbol, schemaRef)\n\n render = () => h(Fragment, null, slots.default?.() ?? [])\n }\n\n return render\n },\n })\n\n const SchemaFieldFactory = (type: SchemaTypes, name: string) => {\n return defineComponent({\n name,\n props: { ...markupSchemaProps },\n setup(props, { slots }) {\n return () =>\n h(\n MarkupField,\n {\n ...props,\n type,\n },\n slots,\n )\n },\n })\n }\n\n return {\n SchemaField,\n SchemaMarkupField: MarkupField,\n SchemaStringField: SchemaFieldFactory('string', 'SchemaStringField'),\n SchemaObjectField: SchemaFieldFactory('object', 'SchemaObjectField'),\n SchemaArrayField: SchemaFieldFactory('array', 'SchemaArrayField'),\n SchemaBooleanField: SchemaFieldFactory('boolean', 'SchemaBooleanField'),\n SchemaDateField: SchemaFieldFactory('date', 'SchemaDateField'),\n SchemaDateTimeField: SchemaFieldFactory('datetime', 'SchemaDatetimeField'),\n SchemaVoidField: SchemaFieldFactory('void', 'SchemaVoidField'),\n SchemaNumberField: SchemaFieldFactory('number', 'SchemaNumberField'),\n }\n}\n"],"names":["env","getRandomName","createSchemaField","options","SchemaField","defineComponent","schemaFieldProps","props","slots","schemaRef","computed","Schema","scopeRef","lazyMerge","optionsRef","provide","SchemaMarkupSymbol","SchemaOptionsSymbol","SchemaExpressionScopeSymbol","normalizedSlots","recursionNode","h","RecursionField","Fragment","MarkupField","markupSchemaProps","parentRef","inject","render","name","appendArraySchema","schema","resolveSchemaProps","shallowRef","watch","SchemaFieldFactory","type"],"mappings":";;;;;;;;;AA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AU,mBAAmB;AAAA,IACnE,mBAAmBA,EAAmB,UAAU,mBAAmB;AAAA,IACnE,kBAAkBA,EAAmB,SAAS,kBAAkB;AAAA,IAChE,oBAAoBA,EAAmB,WAAW,oBAAoB;AAAA,IACtE,iBAAiBA,EAAmB,QAAQ,iBAAiB;AAAA,IAC7D,qBAAqBA,EAAmB,YAAY,qBAAqB;AAAA,IACzE,iBAAiBA,EAAmB,QAAQ,iBAAiB;AAAA,IAC7D,mBAAmBA,EAAmB,UAAU,mBAAmB;AAAA,EAAA;AAEvE;"}
|
package/esm/types/index.d.ts
CHANGED
|
@@ -18,10 +18,12 @@ export interface IProviderProps {
|
|
|
18
18
|
form: Form;
|
|
19
19
|
}
|
|
20
20
|
export interface IFieldProps<D extends Component = Component, C extends Component = Component, TextType = any, ValueType = any> extends Omit<CoreFieldProps<D, C, TextType, ValueType>, 'validator'> {
|
|
21
|
+
loading?: boolean;
|
|
21
22
|
validator?: SchemaFieldValidator;
|
|
22
23
|
decoratorContent?: any;
|
|
23
24
|
}
|
|
24
25
|
export interface IFieldFactoryProps<D extends Component = Component, C extends Component = Component, TextType = any, ValueType = any> extends Omit<CoreFieldFactoryProps<D, C, TextType, ValueType>, 'validator'> {
|
|
26
|
+
loading?: boolean;
|
|
25
27
|
validator?: SchemaFieldValidator;
|
|
26
28
|
decoratorContent?: any;
|
|
27
29
|
}
|
|
@@ -19,6 +19,7 @@ export declare const fieldProps: {
|
|
|
19
19
|
readonly disabled: import('./runtimeProps').RuntimeProp<boolean>;
|
|
20
20
|
readonly readOnly: import('./runtimeProps').RuntimeProp<boolean>;
|
|
21
21
|
readonly readPretty: import('./runtimeProps').RuntimeProp<boolean>;
|
|
22
|
+
readonly loading: import('./runtimeProps').RuntimeProp<boolean>;
|
|
22
23
|
readonly dataSource: import('./runtimeProps').RuntimeProp<import('@formily/core').FieldDataSource | undefined>;
|
|
23
24
|
readonly validatePattern: import('./runtimeProps').RuntimeProp<import('@formily/core').FieldPatternTypes[] | undefined>;
|
|
24
25
|
readonly validateDisplay: import('./runtimeProps').RuntimeProp<import('@formily/core').FieldDisplayTypes[] | undefined>;
|
package/esm/utils/fieldProps.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldProps.mjs","sources":["../../src/utils/fieldProps.ts"],"sourcesContent":["import type { ComponentObjectPropsOptions, ExtractPropTypes } from 'vue'\nimport type { IFieldProps, IVoidFieldProps } from '../types'\nimport { createBooleanProp, createProp } from './runtimeProps'\n\nexport const fieldProps = {\n name: createProp<IFieldProps['name']>({ required: true }),\n title: createProp<IFieldProps['title']>(),\n description: createProp<IFieldProps['description']>(),\n value: createProp<IFieldProps['value']>(),\n initialValue: createProp<IFieldProps['initialValue']>(),\n basePath: createProp<IFieldProps['basePath']>(),\n decorator: createProp<IFieldProps['decorator']>(),\n decoratorContent: createProp<IFieldProps['decoratorContent']>(),\n component: createProp<IFieldProps['component']>(),\n display: createProp<IFieldProps['display']>(),\n pattern: createProp<IFieldProps['pattern']>(),\n required: createBooleanProp(),\n validateFirst: createBooleanProp(),\n hidden: createBooleanProp(),\n visible: createBooleanProp(),\n editable: createBooleanProp(),\n disabled: createBooleanProp(),\n readOnly: createBooleanProp(),\n readPretty: createBooleanProp(),\n dataSource: createProp<IFieldProps['dataSource']>(),\n validatePattern: createProp<IFieldProps['validatePattern']>(),\n validateDisplay: createProp<IFieldProps['validateDisplay']>(),\n validator: createProp<IFieldProps['validator']>(),\n reactions: createProp<IFieldProps['reactions']>(),\n content: createProp<IFieldProps['content']>(),\n data: createProp<IFieldProps['data']>(),\n} as const satisfies ComponentObjectPropsOptions<IFieldProps>\n\nexport const voidFieldProps = {\n name: createProp<IVoidFieldProps['name']>({ required: true }),\n title: createProp<IVoidFieldProps['title']>(),\n description: createProp<IVoidFieldProps['description']>(),\n basePath: createProp<IVoidFieldProps['basePath']>(),\n decorator: createProp<IVoidFieldProps['decorator']>(),\n decoratorContent: createProp<IVoidFieldProps['decoratorContent']>(),\n component: createProp<IVoidFieldProps['component']>(),\n display: createProp<IVoidFieldProps['display']>(),\n pattern: createProp<IVoidFieldProps['pattern']>(),\n hidden: createBooleanProp(),\n visible: createBooleanProp(),\n editable: createBooleanProp(),\n disabled: createBooleanProp(),\n readOnly: createBooleanProp(),\n readPretty: createBooleanProp(),\n reactions: createProp<IVoidFieldProps['reactions']>(),\n content: createProp<IVoidFieldProps['content']>(),\n data: createProp<IVoidFieldProps['data']>(),\n} as const satisfies ComponentObjectPropsOptions<IVoidFieldProps>\n\nexport type FieldProps = ExtractPropTypes<typeof fieldProps>\nexport type VoidFieldProps = ExtractPropTypes<typeof voidFieldProps>\n"],"names":["fieldProps","createProp","createBooleanProp","voidFieldProps"],"mappings":";AAIO,MAAMA,IAAa;AAAA,EACxB,MAAMC,EAAgC,EAAE,UAAU,IAAM;AAAA,EACxD,OAAOA,EAAA;AAAA,EACP,aAAaA,EAAA;AAAA,EACb,OAAOA,EAAA;AAAA,EACP,cAAcA,EAAA;AAAA,EACd,UAAUA,EAAA;AAAA,EACV,WAAWA,EAAA;AAAA,EACX,kBAAkBA,EAAA;AAAA,EAClB,WAAWA,EAAA;AAAA,EACX,SAASA,EAAA;AAAA,EACT,SAASA,EAAA;AAAA,EACT,UAAUC,EAAA;AAAA,EACV,eAAeA,EAAA;AAAA,EACf,QAAQA,EAAA;AAAA,EACR,SAASA,EAAA;AAAA,EACT,UAAUA,EAAA;AAAA,EACV,UAAUA,EAAA;AAAA,EACV,UAAUA,EAAA;AAAA,EACV,YAAYA,EAAA;AAAA,EACZ,YAAYD,EAAA;AAAA,EACZ,iBAAiBA,EAAA;AAAA,EACjB,iBAAiBA,EAAA;AAAA,EACjB,WAAWA,EAAA;AAAA,EACX,WAAWA,EAAA;AAAA,EACX,SAASA,EAAA;AAAA,EACT,MAAMA,EAAA;AACR,GAEaE,IAAiB;AAAA,EAC5B,MAAMF,EAAoC,EAAE,UAAU,IAAM;AAAA,EAC5D,OAAOA,EAAA;AAAA,EACP,aAAaA,EAAA;AAAA,EACb,UAAUA,EAAA;AAAA,EACV,WAAWA,EAAA;AAAA,EACX,kBAAkBA,EAAA;AAAA,EAClB,WAAWA,EAAA;AAAA,EACX,SAASA,EAAA;AAAA,EACT,SAASA,EAAA;AAAA,EACT,QAAQC,EAAA;AAAA,EACR,SAASA,EAAA;AAAA,EACT,UAAUA,EAAA;AAAA,EACV,UAAUA,EAAA;AAAA,EACV,UAAUA,EAAA;AAAA,EACV,YAAYA,EAAA;AAAA,EACZ,WAAWD,EAAA;AAAA,EACX,SAASA,EAAA;AAAA,EACT,MAAMA,EAAA;AACR;"}
|
|
1
|
+
{"version":3,"file":"fieldProps.mjs","sources":["../../src/utils/fieldProps.ts"],"sourcesContent":["import type { ComponentObjectPropsOptions, ExtractPropTypes } from 'vue'\nimport type { IFieldProps, IVoidFieldProps } from '../types'\nimport { createBooleanProp, createProp } from './runtimeProps'\n\nexport const fieldProps = {\n name: createProp<IFieldProps['name']>({ required: true }),\n title: createProp<IFieldProps['title']>(),\n description: createProp<IFieldProps['description']>(),\n value: createProp<IFieldProps['value']>(),\n initialValue: createProp<IFieldProps['initialValue']>(),\n basePath: createProp<IFieldProps['basePath']>(),\n decorator: createProp<IFieldProps['decorator']>(),\n decoratorContent: createProp<IFieldProps['decoratorContent']>(),\n component: createProp<IFieldProps['component']>(),\n display: createProp<IFieldProps['display']>(),\n pattern: createProp<IFieldProps['pattern']>(),\n required: createBooleanProp(),\n validateFirst: createBooleanProp(),\n hidden: createBooleanProp(),\n visible: createBooleanProp(),\n editable: createBooleanProp(),\n disabled: createBooleanProp(),\n readOnly: createBooleanProp(),\n readPretty: createBooleanProp(),\n loading: createBooleanProp(),\n dataSource: createProp<IFieldProps['dataSource']>(),\n validatePattern: createProp<IFieldProps['validatePattern']>(),\n validateDisplay: createProp<IFieldProps['validateDisplay']>(),\n validator: createProp<IFieldProps['validator']>(),\n reactions: createProp<IFieldProps['reactions']>(),\n content: createProp<IFieldProps['content']>(),\n data: createProp<IFieldProps['data']>(),\n} as const satisfies ComponentObjectPropsOptions<IFieldProps>\n\nexport const voidFieldProps = {\n name: createProp<IVoidFieldProps['name']>({ required: true }),\n title: createProp<IVoidFieldProps['title']>(),\n description: createProp<IVoidFieldProps['description']>(),\n basePath: createProp<IVoidFieldProps['basePath']>(),\n decorator: createProp<IVoidFieldProps['decorator']>(),\n decoratorContent: createProp<IVoidFieldProps['decoratorContent']>(),\n component: createProp<IVoidFieldProps['component']>(),\n display: createProp<IVoidFieldProps['display']>(),\n pattern: createProp<IVoidFieldProps['pattern']>(),\n hidden: createBooleanProp(),\n visible: createBooleanProp(),\n editable: createBooleanProp(),\n disabled: createBooleanProp(),\n readOnly: createBooleanProp(),\n readPretty: createBooleanProp(),\n reactions: createProp<IVoidFieldProps['reactions']>(),\n content: createProp<IVoidFieldProps['content']>(),\n data: createProp<IVoidFieldProps['data']>(),\n} as const satisfies ComponentObjectPropsOptions<IVoidFieldProps>\n\nexport type FieldProps = ExtractPropTypes<typeof fieldProps>\nexport type VoidFieldProps = ExtractPropTypes<typeof voidFieldProps>\n"],"names":["fieldProps","createProp","createBooleanProp","voidFieldProps"],"mappings":";AAIO,MAAMA,IAAa;AAAA,EACxB,MAAMC,EAAgC,EAAE,UAAU,IAAM;AAAA,EACxD,OAAOA,EAAA;AAAA,EACP,aAAaA,EAAA;AAAA,EACb,OAAOA,EAAA;AAAA,EACP,cAAcA,EAAA;AAAA,EACd,UAAUA,EAAA;AAAA,EACV,WAAWA,EAAA;AAAA,EACX,kBAAkBA,EAAA;AAAA,EAClB,WAAWA,EAAA;AAAA,EACX,SAASA,EAAA;AAAA,EACT,SAASA,EAAA;AAAA,EACT,UAAUC,EAAA;AAAA,EACV,eAAeA,EAAA;AAAA,EACf,QAAQA,EAAA;AAAA,EACR,SAASA,EAAA;AAAA,EACT,UAAUA,EAAA;AAAA,EACV,UAAUA,EAAA;AAAA,EACV,UAAUA,EAAA;AAAA,EACV,YAAYA,EAAA;AAAA,EACZ,SAASA,EAAA;AAAA,EACT,YAAYD,EAAA;AAAA,EACZ,iBAAiBA,EAAA;AAAA,EACjB,iBAAiBA,EAAA;AAAA,EACjB,WAAWA,EAAA;AAAA,EACX,WAAWA,EAAA;AAAA,EACX,SAASA,EAAA;AAAA,EACT,MAAMA,EAAA;AACR,GAEaE,IAAiB;AAAA,EAC5B,MAAMF,EAAoC,EAAE,UAAU,IAAM;AAAA,EAC5D,OAAOA,EAAA;AAAA,EACP,aAAaA,EAAA;AAAA,EACb,UAAUA,EAAA;AAAA,EACV,WAAWA,EAAA;AAAA,EACX,kBAAkBA,EAAA;AAAA,EAClB,WAAWA,EAAA;AAAA,EACX,SAASA,EAAA;AAAA,EACT,SAASA,EAAA;AAAA,EACT,QAAQC,EAAA;AAAA,EACR,SAASA,EAAA;AAAA,EACT,UAAUA,EAAA;AAAA,EACV,UAAUA,EAAA;AAAA,EACV,UAAUA,EAAA;AAAA,EACV,YAAYA,EAAA;AAAA,EACZ,WAAWD,EAAA;AAAA,EACX,SAASA,EAAA;AAAA,EACT,MAAMA,EAAA;AACR;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { GeneralField } from '@formily/core';
|
|
2
2
|
import { Component, Slots, VNode } from 'vue';
|
|
3
|
+
import { NamedSlotMap } from './slotMap';
|
|
3
4
|
type SlotContent = string | Component | null | undefined;
|
|
4
|
-
type SlotContentMap =
|
|
5
|
+
type SlotContentMap = NamedSlotMap<SlotContent>;
|
|
5
6
|
type FieldContent = SlotContent | SlotContentMap | null | undefined;
|
|
6
7
|
type EventHandler = (...args: unknown[]) => unknown;
|
|
7
8
|
type EventMap = Partial<Record<string, EventHandler>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactiveFieldHelpers.mjs","sources":["../../src/utils/reactiveFieldHelpers.ts"],"sourcesContent":["import type { GeneralField } from '@formily/core'\nimport type { Component, Slot, Slots, VNode } from 'vue'\nimport { createTextVNode, Fragment, h } from 'vue'\n\ninterface VueLikeOptions {\n template?: string\n render?: (...args: unknown[]) => unknown\n setup?: (...args: unknown[]) => unknown\n}\n\ntype SlotContent = string | Component | null | undefined\ntype SlotContentMap = Record<string, SlotContent>\ntype FieldContent = SlotContent | SlotContentMap | null | undefined\n\ntype EventHandler = (...args: unknown[]) => unknown\ntype EventMap = Partial<Record<string, EventHandler>>\ntype Attrs = Record<string, unknown>\n\nconst EMPTY_SLOT: Slot = () => []\n\ntype ComponentWithProps = Component & { props?: unknown }\n\nfunction normalizePropKeys(propsDef: unknown): string[] | null {\n if (!propsDef)\n return null\n if (Array.isArray(propsDef))\n return propsDef.map(key => String(key))\n if (typeof propsDef === 'object')\n return Object.keys(propsDef as Record<string, unknown>)\n return null\n}\n\nfunction extractComponentPropKeys(component: SlotContent): string[] | null {\n if (!component || typeof component === 'string')\n return null\n const target = component as ComponentWithProps\n return normalizePropKeys(target.props)\n}\n\nfunction pickScopedProps(\n scopedProps: Record<string, unknown> | undefined,\n propKeys: string[] | null | undefined,\n) {\n if (!scopedProps)\n return undefined\n if (!propKeys || !propKeys.length)\n return scopedProps\n const picked: Record<string, unknown> = {}\n propKeys.forEach((key) => {\n if (key in scopedProps)\n picked[key] = scopedProps[key]\n })\n if (!Object.keys(picked).length)\n return undefined\n return picked\n}\n\nfunction isVueOptions(options: unknown): options is VueLikeOptions {\n if (typeof options !== 'object' || options === null) {\n return false\n }\n const candidates = options as Record<string, unknown>\n return (\n typeof candidates.template === 'string'\n || typeof candidates.render === 'function'\n || typeof candidates.setup === 'function'\n )\n}\n\nfunction isSlotContentMap(content: unknown): content is SlotContentMap {\n if (typeof content !== 'object' || content === null) {\n return false\n }\n return !isVueOptions(content)\n}\n\nexport function wrapFragment(childNodes?: VNode[] | VNode | null): VNode | null {\n if (!childNodes) {\n return null\n }\n if (!Array.isArray(childNodes)) {\n return childNodes\n }\n if (childNodes.length === 0) {\n return null\n }\n if (childNodes.length === 1) {\n return childNodes[0] ?? null\n }\n return h(Fragment, null, childNodes)\n}\n\nfunction resolveComponent(render: Slot, extra?: SlotContent): Slot {\n if (extra === undefined || extra === null) {\n return render\n }\n if (typeof extra === 'string') {\n return () => [...render(), createTextVNode(extra)]\n }\n\n const component = extra\n const propKeys = extractComponentPropKeys(component)\n const needsScopedProps\n = (typeof component === 'function' && component.length > 1)\n || (isVueOptions(component)\n && typeof component.render === 'function'\n && component.render.length > 1)\n || !!(propKeys && propKeys.length)\n\n if (needsScopedProps) {\n return (scopedProps?: Record<string, unknown>) => [\n ...render(),\n h(component, pickScopedProps(scopedProps, propKeys) ?? {}),\n ]\n }\n\n return () => [...render(), h(component)]\n}\n\nexport function mergeSlots(field: GeneralField, slots: Slots, content: FieldContent): Slots {\n const slotNames = Object.keys(slots)\n if (!slotNames.length) {\n if (!content) {\n return {}\n }\n if (typeof content === 'string') {\n return {\n default: resolveComponent(EMPTY_SLOT, content),\n }\n }\n }\n const patchSlot\n = (slotName: string): Slot =>\n (...originArgs: Parameters<Slot>) => {\n const firstArg = originArgs[0]\n const scopedProps\n = typeof firstArg === 'object' && firstArg !== null\n ? (firstArg as Record<string, unknown>)\n : {}\n return slots[slotName]?.({ field, form: field.form, ...scopedProps }) ?? []\n }\n\n const patchedSlots: Record<string, Slot> = {}\n slotNames.forEach((name) => {\n patchedSlots[name] = patchSlot(name)\n })\n\n if (isSlotContentMap(content)) {\n Object.keys(content).forEach((key) => {\n const child = content[key]\n const slot = patchedSlots[key] ?? EMPTY_SLOT\n patchedSlots[key] = resolveComponent(slot, child)\n })\n return patchedSlots\n }\n patchedSlots.default = resolveComponent(patchedSlots.default ?? EMPTY_SLOT, content)\n return patchedSlots\n}\n\nfunction normalizeOnEventName(eventKey: string) {\n if (eventKey.length <= 2)\n return ''\n const rawName = eventKey.slice(2)\n return rawName.charAt(0).toLowerCase() + rawName.slice(1)\n}\n\nfunction toEventPropKey(eventName: string) {\n if (!eventName)\n return ''\n return `on${eventName.charAt(0).toUpperCase()}${eventName.slice(1)}`\n}\n\nexport function extractAttrsAndEvents(rawAttrs: Attrs = {}): { attrs: Attrs, events: EventMap } {\n const normalizedAttrs: Attrs = { ...rawAttrs }\n const events: EventMap = {}\n\n Object.keys(rawAttrs).forEach((eventKey) => {\n const value = rawAttrs[eventKey]\n const onEvent = eventKey.startsWith('on')\n const atEvent = eventKey.startsWith('@')\n if (!onEvent && !atEvent)\n return\n if (atEvent) {\n const eventName = eventKey.slice(1)\n delete normalizedAttrs[eventKey]\n if (typeof value === 'function') {\n events[eventName] = value as EventHandler\n }\n return\n }\n const eventName = normalizeOnEventName(eventKey)\n if (!eventName)\n return\n if (!events[eventName] && typeof value === 'function') {\n events[eventName] = value as EventHandler\n }\n delete normalizedAttrs[eventKey]\n })\n\n return { attrs: normalizedAttrs, events }\n}\n\nexport function createVNodeProps(attrs: Attrs, events: EventMap): Attrs {\n const { style, class: className, ...rest } = attrs\n const eventProps = Object.keys(events).reduce<Record<string, EventHandler>>((acc, eventName) => {\n const propKey = toEventPropKey(eventName)\n const handler = events[eventName]\n if (propKey && handler) {\n acc[propKey] = handler\n }\n return acc\n }, {})\n\n return {\n ...rest,\n style,\n class: className,\n ...eventProps,\n }\n}\n"],"names":["EMPTY_SLOT","normalizePropKeys","propsDef","key","extractComponentPropKeys","component","pickScopedProps","scopedProps","propKeys","picked","isVueOptions","options","candidates","isSlotContentMap","content","wrapFragment","childNodes","h","Fragment","resolveComponent","render","extra","createTextVNode","mergeSlots","field","slots","slotNames","patchSlot","slotName","originArgs","firstArg","patchedSlots","name","child","slot","normalizeOnEventName","eventKey","rawName","toEventPropKey","eventName","extractAttrsAndEvents","rawAttrs","normalizedAttrs","events","value","onEvent","atEvent","createVNodeProps","attrs","style","className","rest","eventProps","acc","propKey","handler"],"mappings":";AAkBA,MAAMA,IAAmB,MAAM,CAAA;AAI/B,SAASC,EAAkBC,GAAoC;AAC7D,SAAKA,IAED,MAAM,QAAQA,CAAQ,IACjBA,EAAS,IAAI,CAAAC,MAAO,OAAOA,CAAG,CAAC,IACpC,OAAOD,KAAa,WACf,OAA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GF;AAAA,IACH,OAAAF;AAAA,IACA,OAAOC;AAAA,IACP,GAAGE;AAAA,EAAA;AAEP;"}
|
|
1
|
+
{"version":3,"file":"reactiveFieldHelpers.mjs","sources":["../../src/utils/reactiveFieldHelpers.ts"],"sourcesContent":["import type { GeneralField } from '@formily/core'\nimport type { Component, Slot, Slots, VNode } from 'vue'\nimport type { NamedSlotMap } from './slotMap'\nimport { createTextVNode, Fragment, h } from 'vue'\n\ninterface VueLikeOptions {\n template?: string\n render?: (...args: unknown[]) => unknown\n setup?: (...args: unknown[]) => unknown\n}\n\ntype SlotContent = string | Component | null | undefined\ntype SlotContentMap = NamedSlotMap<SlotContent>\ntype FieldContent = SlotContent | SlotContentMap | null | undefined\n\ntype EventHandler = (...args: unknown[]) => unknown\ntype EventMap = Partial<Record<string, EventHandler>>\ntype Attrs = Record<string, unknown>\n\nconst EMPTY_SLOT: Slot = () => []\n\ntype ComponentWithProps = Component & { props?: unknown }\n\nfunction normalizePropKeys(propsDef: unknown): string[] | null {\n if (!propsDef)\n return null\n if (Array.isArray(propsDef))\n return propsDef.map(key => String(key))\n if (typeof propsDef === 'object')\n return Object.keys(propsDef as Record<string, unknown>)\n return null\n}\n\nfunction extractComponentPropKeys(component: SlotContent): string[] | null {\n if (!component || typeof component === 'string')\n return null\n const target = component as ComponentWithProps\n return normalizePropKeys(target.props)\n}\n\nfunction pickScopedProps(\n scopedProps: Record<string, unknown> | undefined,\n propKeys: string[] | null | undefined,\n) {\n if (!scopedProps)\n return undefined\n if (!propKeys || !propKeys.length)\n return scopedProps\n const picked: Record<string, unknown> = {}\n propKeys.forEach((key) => {\n if (key in scopedProps)\n picked[key] = scopedProps[key]\n })\n if (!Object.keys(picked).length)\n return undefined\n return picked\n}\n\nfunction isVueOptions(options: unknown): options is VueLikeOptions {\n if (typeof options !== 'object' || options === null) {\n return false\n }\n const candidates = options as Record<string, unknown>\n return (\n typeof candidates.template === 'string'\n || typeof candidates.render === 'function'\n || typeof candidates.setup === 'function'\n )\n}\n\nfunction isSlotContentMap(content: unknown): content is SlotContentMap {\n if (typeof content !== 'object' || content === null) {\n return false\n }\n return !isVueOptions(content)\n}\n\nexport function wrapFragment(childNodes?: VNode[] | VNode | null): VNode | null {\n if (!childNodes) {\n return null\n }\n if (!Array.isArray(childNodes)) {\n return childNodes\n }\n if (childNodes.length === 0) {\n return null\n }\n if (childNodes.length === 1) {\n return childNodes[0] ?? null\n }\n return h(Fragment, null, childNodes)\n}\n\nfunction resolveComponent(render: Slot, extra?: SlotContent): Slot {\n if (extra === undefined || extra === null) {\n return render\n }\n if (typeof extra === 'string') {\n return () => [...render(), createTextVNode(extra)]\n }\n\n const component = extra\n const propKeys = extractComponentPropKeys(component)\n const needsScopedProps\n = (typeof component === 'function' && component.length > 1)\n || (isVueOptions(component)\n && typeof component.render === 'function'\n && component.render.length > 1)\n || !!(propKeys && propKeys.length)\n\n if (needsScopedProps) {\n return (scopedProps?: Record<string, unknown>) => [\n ...render(),\n h(component, pickScopedProps(scopedProps, propKeys) ?? {}),\n ]\n }\n\n return () => [...render(), h(component)]\n}\n\nexport function mergeSlots(field: GeneralField, slots: Slots, content: FieldContent): Slots {\n const slotNames = Object.keys(slots)\n if (!slotNames.length) {\n if (!content) {\n return {}\n }\n if (typeof content === 'string') {\n return {\n default: resolveComponent(EMPTY_SLOT, content),\n }\n }\n }\n const patchSlot\n = (slotName: string): Slot =>\n (...originArgs: Parameters<Slot>) => {\n const firstArg = originArgs[0]\n const scopedProps\n = typeof firstArg === 'object' && firstArg !== null\n ? (firstArg as Record<string, unknown>)\n : {}\n return slots[slotName]?.({ field, form: field.form, ...scopedProps }) ?? []\n }\n\n const patchedSlots: NamedSlotMap<Slot> = {}\n slotNames.forEach((name) => {\n patchedSlots[name] = patchSlot(name)\n })\n\n if (isSlotContentMap(content)) {\n Object.keys(content).forEach((key) => {\n const child = content[key]\n const slot = patchedSlots[key] ?? EMPTY_SLOT\n patchedSlots[key] = resolveComponent(slot, child)\n })\n return patchedSlots\n }\n patchedSlots.default = resolveComponent(patchedSlots.default ?? EMPTY_SLOT, content)\n return patchedSlots\n}\n\nfunction normalizeOnEventName(eventKey: string) {\n if (eventKey.length <= 2)\n return ''\n const rawName = eventKey.slice(2)\n return rawName.charAt(0).toLowerCase() + rawName.slice(1)\n}\n\nfunction toEventPropKey(eventName: string) {\n if (!eventName)\n return ''\n return `on${eventName.charAt(0).toUpperCase()}${eventName.slice(1)}`\n}\n\nexport function extractAttrsAndEvents(rawAttrs: Attrs = {}): { attrs: Attrs, events: EventMap } {\n const normalizedAttrs: Attrs = { ...rawAttrs }\n const events: EventMap = {}\n\n Object.keys(rawAttrs).forEach((eventKey) => {\n const value = rawAttrs[eventKey]\n const onEvent = eventKey.startsWith('on')\n const atEvent = eventKey.startsWith('@')\n if (!onEvent && !atEvent)\n return\n if (atEvent) {\n const eventName = eventKey.slice(1)\n delete normalizedAttrs[eventKey]\n if (typeof value === 'function') {\n events[eventName] = value as EventHandler\n }\n return\n }\n const eventName = normalizeOnEventName(eventKey)\n if (!eventName)\n return\n if (!events[eventName] && typeof value === 'function') {\n events[eventName] = value as EventHandler\n }\n delete normalizedAttrs[eventKey]\n })\n\n return { attrs: normalizedAttrs, events }\n}\n\nexport function createVNodeProps(attrs: Attrs, events: EventMap): Attrs {\n const { style, class: className, ...rest } = attrs\n const eventProps = Object.keys(events).reduce<Record<string, EventHandler>>((acc, eventName) => {\n const propKey = toEventPropKey(eventName)\n const handler = events[eventName]\n if (propKey && handler) {\n acc[propKey] = handler\n }\n return acc\n }, {})\n\n return {\n ...rest,\n style,\n class: className,\n ...eventProps,\n }\n}\n"],"names":["EMPTY_SLOT","normalizePropKeys","propsDef","key","extractComponentPropKeys","component","pickScopedProps","scopedProps","propKeys","picked","isVueOptions","options","candidates","isSlotContentMap","content","wrapFragment","childNodes","h","Fragment","resolveComponent","render","extra","createTextVNode","mergeSlots","field","slots","slotNames","patchSlot","slotName","originArgs","firstArg","patchedSlots","name","child","slot","normalizeOnEventName","eventKey","rawName","toEventPropKey","eventName","extractAttrsAndEvents","rawAttrs","normalizedAttrs","events","value","onEvent","atEvent","createVNodeProps","attrs","style","className","rest","eventProps","acc","propKey","handler"],"mappings":";AAmBA,MAAMA,IAAmB,MAAM,CAAA;AAI/B,SAASC,EAAkBC,GAAoC;AAC7D,SAAKA,IAED,MAAM,QAAQA,CAAQ,IACjBA,EAAS,IAAI,CAAAC,MAAO,OAAOA,CAAG,CAAC,IACpC,OAAOD,KAAa,WACf,OAAO,KAAKA,CAAmC,IACjD,OALE;AAMX;AAEA,SAASE,EAAyBC,GAAyC;AACzE,SAAI,CAACA,KAAa,OAAOA,KAAc,WAC9B,OAEFJ,EADQI,EACiB,KAAK;AACvC;AAEA,SAASC,EACPC,GACAC,GACA;AACA,MAAI,CAACD;AACH;AACF,MAAI,CAACC,KAAY,CAACA,EAAS;AACzB,WAAOD;AACT,QAAME,IAAkC,CAAA;AAKxC,MAJAD,EAAS,QAAQ,CAACL,MAAQ;AACxB,IAAIA,KAAOI,MACTE,EAAON,CAAG,IAAII,EAAYJ,CAAG;AAAA,EACjC,CAAC,GACG,EAAC,OAAO,KAAKM,CAAM,EAAE;AAEzB,WAAOA;AACT;AAEA,SAASC,EAAaC,GAA6C;AACjE,MAAI,OAAOA,KAAY,YAAYA,MAAY;AAC7C,WAAO;AAET,QAAMC,IAAaD;AACnB,SACE,OAAOC,EAAW,YAAa,YAC5B,OAAOA,EAAW,UAAW,cAC7B,OAAOA,EAAW,SAAU;AAEnC;AAEA,SAASC,EAAiBC,GAA6C;AACrE,SAAI,OAAOA,KAAY,YAAYA,MAAY,OACtC,KAEF,CAACJ,EAAaI,CAAO;AAC9B;AAEO,SAASC,EAAaC,GAAmD;AAC9E,SAAKA,IAGA,MAAM,QAAQA,CAAU,IAGzBA,EAAW,WAAW,IACjB,OAELA,EAAW,WAAW,IACjBA,EAAW,CAAC,KAAK,OAEnBC,EAAEC,GAAU,MAAMF,CAAU,IAR1BA,IAHA;AAYX;AAEA,S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AAyB;AACtE,QAAM,EAAE,OAAAM,GAAO,OAAOC,GAAW,GAAGC,MAASH,GACvCI,IAAa,OAAO,KAAKT,CAAM,EAAE,OAAqC,CAACU,GAAKd,MAAc;AAC9F,UAAMe,IAAUhB,EAAeC,CAAS,GAClCgB,IAAUZ,EAAOJ,CAAS;AAChC,WAAIe,KAAWC,MACbF,EAAIC,CAAO,IAAIC,IAEVF;AAAA,EACT,GAAG,CAAA,CAAE;AAEL,SAAO;AAAA,IACL,GAAGF;AAAA,IACH,OAAAF;AAAA,IACA,OAAOC;AAAA,IACP,GAAGE;AAAA,EAAA;AAEP;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type NamedSlotMap<T> = Record<string, T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slotMap.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@silver-formily/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.3",
|
|
5
5
|
"description": "Vue3 版本的 @formily/vue",
|
|
6
6
|
"author": "hezhengxu",
|
|
7
7
|
"license": "MIT",
|
|
@@ -49,25 +49,25 @@
|
|
|
49
49
|
"@formily/validator": "^2.3.7",
|
|
50
50
|
"@types/node": "^24.3.0",
|
|
51
51
|
"@vitejs/plugin-vue": "^6.0.3",
|
|
52
|
+
"@vue/language-core": "~3.0.1",
|
|
52
53
|
"@vue/shared": "^3.5.27",
|
|
53
54
|
"commitlint": "^19.8.1",
|
|
54
55
|
"cz-git": "^1.12.0",
|
|
55
56
|
"czg": "^1.12.0",
|
|
56
|
-
"eslint": "^9.
|
|
57
|
+
"eslint": "^9.36.0",
|
|
57
58
|
"eslint-plugin-format": "^1.3.1",
|
|
58
59
|
"fast-glob": "^3.3.3",
|
|
59
|
-
"typescript": "
|
|
60
|
+
"typescript": "5.9.2",
|
|
60
61
|
"unplugin-dts": "1.0.0-beta.6",
|
|
61
62
|
"vite": "^7.3.1",
|
|
62
|
-
"@silver-formily/reactive-vue": "1.
|
|
63
|
+
"@silver-formily/reactive-vue": "1.1.0",
|
|
63
64
|
"@silver-formily/typescript-config": "0.0.0"
|
|
64
65
|
},
|
|
65
66
|
"scripts": {
|
|
66
67
|
"build": "vite build",
|
|
67
68
|
"lint": "eslint .",
|
|
68
69
|
"format": "eslint . --fix",
|
|
69
|
-
"
|
|
70
|
-
"docs:build": "pnpm --filter vue-docs build",
|
|
70
|
+
"check-types": "vue-tsc --noEmit",
|
|
71
71
|
"commit": "czg"
|
|
72
72
|
}
|
|
73
73
|
}
|