cosey 0.4.34 → 0.4.36

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.
@@ -1,7 +1,6 @@
1
1
  import { type SelectProps } from 'element-plus/es/components/select/src/select.mjs';
2
2
  import { type FieldComponentCommonProps } from '../common';
3
3
  import { type ExtractPropTypes } from 'vue';
4
- import { type OptionProps } from 'element-plus/es/components/select/src/type.mjs';
5
4
  export interface FieldSelectObjectOption {
6
5
  label?: string | number;
7
6
  value?: string | number | boolean;
@@ -32,7 +31,7 @@ export interface FieldSelectProps extends FieldComponentCommonProps {
32
31
  options?: FieldSelectOption[];
33
32
  labelKey?: string;
34
33
  valueKey?: string;
35
- optionProps?: Partial<OptionProps> | ((props: FieldSelectObjectOption, index: number) => Partial<OptionProps>);
34
+ optionProps?: Record<PropertyKey, any> | ((props: FieldSelectObjectOption, index: number) => Record<PropertyKey, any>);
36
35
  };
37
36
  componentSlots?: Partial<FieldSelectSlots>;
38
37
  }
@@ -3,7 +3,7 @@ declare const _default: <T extends FieldType>(__VLS_props: NonNullable<Awaited<t
3
3
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & FeildProps<T> & Partial<{}>> & import("vue").PublicProps;
4
4
  expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
5
5
  attrs: any;
6
- slots: FeildProps<T>;
6
+ slots: {};
7
7
  emit: {};
8
8
  }>) => import("vue").VNode & {
9
9
  __ctx?: Awaited<typeof __VLS_setup>;
@@ -1,4 +1,4 @@
1
- import { defineComponent, useSlots, computed, createBlock, openBlock, resolveDynamicComponent, unref } from 'vue';
1
+ import { defineComponent, computed, createBlock, openBlock, resolveDynamicComponent, unref } from 'vue';
2
2
  import { mapFieldTypeComponent } from './field.js';
3
3
  import { defineTemplate } from '../../utils/vue.js';
4
4
 
@@ -32,7 +32,6 @@ var stdin_default = /* @__PURE__ */defineComponent({
32
32
  },
33
33
  setup(__props) {
34
34
  const props = __props;
35
- const slots = useSlots();
36
35
  const component = computed(() => {
37
36
  return mapFieldTypeComponent[props.type || "input"];
38
37
  });
@@ -46,7 +45,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
46
45
  return h(component.value, {
47
46
  readonly: props.readonly,
48
47
  componentProps: mergedComponentProps.value
49
- }, slots);
48
+ }, props.componentSlots);
50
49
  });
51
50
  return (_ctx, _cache) => {
52
51
  return openBlock(), createBlock(resolveDynamicComponent(unref(template)));
@@ -1,6 +1,6 @@
1
1
  export * from './field';
2
2
  declare const _Field: (<T extends import("./field").FieldType>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
3
- slots: import("./field").FeildProps<T>;
3
+ slots: {};
4
4
  attrs: any;
5
5
  emit: {};
6
6
  }, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
@@ -13,7 +13,7 @@ declare const _Field: (<T extends import("./field").FieldType>(__VLS_props: NonN
13
13
  } & import("vue").PublicProps;
14
14
  expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
15
15
  attrs: any;
16
- slots: import("./field").FeildProps<T>;
16
+ slots: {};
17
17
  emit: {};
18
18
  }>) => import("vue").VNode & {
19
19
  __ctx?: Awaited<typeof __VLS_setup>;
@@ -14,6 +14,7 @@ export declare const mapFormItemWidth: {
14
14
  export interface FormItemProps<T extends FieldType> extends Partial<ElFormItemProps> {
15
15
  fieldType?: T;
16
16
  fieldProps?: MapFieldTypeComponentProps[T]['componentProps'];
17
+ fieldSlots?: MapFieldTypeComponentProps[FieldType]['componentSlots'];
17
18
  fieldRef?: (el: any) => void;
18
19
  modelValue?: NonNullable<MapFieldTypeComponentProps[T]['componentProps']>['modelValue'] | null;
19
20
  width?: FormItemWidth;
@@ -1,4 +1,4 @@
1
- import { defineComponent, mergeDefaults, useAttrs, useSlots, inject, useTemplateRef, computed, mergeProps, resolveComponent, createBlock, openBlock, unref, withCtx, createVNode, createSlots, createElementVNode, normalizeStyle, normalizeClass, renderSlot, createElementBlock, createCommentVNode, renderList, normalizeProps, guardReactiveProps, resolveDynamicComponent } from 'vue';
1
+ import { defineComponent, mergeDefaults, useAttrs, inject, useTemplateRef, computed, mergeProps, resolveComponent, createBlock, openBlock, unref, withCtx, createVNode, createSlots, createElementVNode, normalizeStyle, normalizeClass, renderSlot, createElementBlock, createCommentVNode, resolveDynamicComponent, renderList, normalizeProps, guardReactiveProps } from 'vue';
2
2
  import { defaultFormItemProps, formItemExposeKeys } from './form-item.js';
3
3
  import { formContextSymbol } from './form.js';
4
4
  import { Field as _Field } from '../field/index.js';
@@ -32,6 +32,10 @@ var stdin_default = /* @__PURE__ */defineComponent({
32
32
  type: Object,
33
33
  required: false
34
34
  },
35
+ fieldSlots: {
36
+ type: null,
37
+ required: false
38
+ },
35
39
  fieldRef: {
36
40
  type: Function,
37
41
  required: false
@@ -140,7 +144,6 @@ var stdin_default = /* @__PURE__ */defineComponent({
140
144
  } = useLocale();
141
145
  const formItemProps = reactiveOmit(props, "colProps", "width", "fieldType", "fieldProps", "fieldRef", "modelValue", "placeholder", "disabled", "readonly");
142
146
  const attrs = useAttrs();
143
- const slots = useSlots();
144
147
  const emit = __emit;
145
148
  const formContext = inject(formContextSymbol, null);
146
149
  const formItemRef = useTemplateRef("form-item");
@@ -215,10 +218,6 @@ var stdin_default = /* @__PURE__ */defineComponent({
215
218
  return formContext?.readonly || props.readonly;
216
219
  });
217
220
  const formItemSlotNames = ["error"];
218
- const exlucdeFieldSlotNames = ["error", "label", "default", "tooltip", "extra"];
219
- const fieldSlotNames = computed(() => {
220
- return Object.keys(slots).filter(key => !exlucdeFieldSlotNames.includes(key));
221
- });
222
221
  const labelTemplate = defineTemplate(() => props.label);
223
222
  const tooptipTemplate = defineTemplate(() => props.tooltip);
224
223
  const extraTemplate = defineTemplate(() => props.extra);
@@ -240,16 +239,9 @@ var stdin_default = /* @__PURE__ */defineComponent({
240
239
  readonly: mergedReadonly.value,
241
240
  type: _ctx.fieldType,
242
241
  "component-props": mergedFieldProps.value,
242
+ "component-slots": _ctx.fieldSlots,
243
243
  "component-ref": _ctx.fieldRef
244
- }, createSlots({
245
- _: 2
246
- /* DYNAMIC */
247
- }, [renderList(fieldSlotNames.value, name => {
248
- return {
249
- name,
250
- fn: withCtx(slotProps => [renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))])
251
- };
252
- })]), 1032, ["readonly", "type", "component-props", "component-ref"])]), _ctx.extra || _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
244
+ }, null, 8, ["readonly", "type", "component-props", "component-slots", "component-ref"])]), _ctx.extra || _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
253
245
  key: 0,
254
246
  class: normalizeClass(`${unref(prefixCls)}-item-extra`)
255
247
  }, [_ctx.extra ? (openBlock(), createBlock(resolveDynamicComponent(unref(extraTemplate)), {
@@ -481,6 +481,7 @@ declare const _FormItem: (<T extends import("..").FieldType>(__VLS_props: NonNul
481
481
  readonly "onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
482
482
  fieldType?: T | undefined;
483
483
  fieldProps?: import("..").MapFieldTypeComponentProps[T]["componentProps"] | undefined;
484
+ fieldSlots?: import("..").MapFieldTypeComponentProps[import("..").FieldType]["componentSlots"];
484
485
  fieldRef?: ((el: any) => void) | undefined;
485
486
  modelValue?: NonNullable<import("..").MapFieldTypeComponentProps[T]["componentProps"]>["modelValue"] | null | undefined;
486
487
  width?: import("./form-item").FormItemWidth | undefined;
@@ -64,6 +64,10 @@ var stdin_default = /* @__PURE__ */defineComponent({
64
64
  type: Object,
65
65
  required: false
66
66
  },
67
+ fieldSlots: {
68
+ type: null,
69
+ required: false
70
+ },
67
71
  fieldRef: {
68
72
  type: Function,
69
73
  required: false
@@ -42,6 +42,7 @@ declare const _FormList: (<T extends import("./form-list").FormListRow = import(
42
42
  onBlur?: (evt: FocusEvent) => void;
43
43
  onClear?: () => void;
44
44
  }) | undefined;
45
+ fieldSlots?: import("..").MapFieldTypeComponentProps[import("..").FieldType]["componentSlots"];
45
46
  fieldRef?: ((el: any) => void) | undefined;
46
47
  colProps?: import("..").ColProps | undefined;
47
48
  internalIndex?: number | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cosey",
3
- "version": "0.4.34",
3
+ "version": "0.4.36",
4
4
  "description": "基于 Vue3 + vite 的后台管理系统框架",
5
5
  "type": "module",
6
6
  "main": "index.js",