@vunk/form 0.0.1-alpha.21 → 0.0.1-alpha.23

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.
Files changed (53) hide show
  1. package/components/button/src/ctx.d.ts +4 -0
  2. package/components/button/src/index.vue.d.ts +10 -0
  3. package/components/checkbox/index.css +38 -0
  4. package/components/checkbox/index.js +13 -4
  5. package/components/checkbox/src/ctx.d.ts +4 -0
  6. package/components/checkbox/src/index.vue.d.ts +18 -8
  7. package/components/color-picker/src/ctx.d.ts +4 -0
  8. package/components/color-picker/src/index.vue.d.ts +13 -3
  9. package/components/date-picker/index.js +11 -5
  10. package/components/date-picker/src/ctx.d.ts +45 -42
  11. package/components/date-picker/src/ctx.js +1 -1
  12. package/components/date-picker/src/index.vue.d.ts +102 -96
  13. package/components/form/index.js +14 -5
  14. package/components/form/src/ctx.d.ts +4 -1
  15. package/components/form/src/ctx.js +5 -2
  16. package/components/form/src/index.vue.d.ts +7 -0
  17. package/components/form-item/index.js +9 -1
  18. package/components/form-item/src/ctx.d.ts +5 -1
  19. package/components/form-item/src/ctx.js +4 -0
  20. package/components/form-item/src/index.vue.d.ts +10 -0
  21. package/components/input/index.js +7 -4
  22. package/components/input/src/ctx.d.ts +46 -43
  23. package/components/input/src/ctx.js +1 -1
  24. package/components/input/src/index.vue.d.ts +96 -90
  25. package/components/input-number/index.css +14 -0
  26. package/components/input-number/index.js +12 -3
  27. package/components/input-number/src/ctx.d.ts +4 -0
  28. package/components/input-number/src/index.vue.d.ts +19 -9
  29. package/components/radio/index.css +29 -0
  30. package/components/radio/index.js +13 -4
  31. package/components/radio/src/ctx.d.ts +4 -0
  32. package/components/radio/src/index.vue.d.ts +15 -5
  33. package/components/select/index.css +11 -0
  34. package/components/select/index.js +12 -4
  35. package/components/select/src/ctx.d.ts +4 -0
  36. package/components/select/src/index.vue.d.ts +33 -23
  37. package/components/switch/index.css +11 -0
  38. package/components/switch/index.js +15 -4
  39. package/components/switch/src/ctx.d.ts +4 -0
  40. package/components/switch/src/index.vue.d.ts +14 -4
  41. package/components/upload/index.css +10 -0
  42. package/components/upload/index.js +14 -6
  43. package/components/upload/src/ctx.d.ts +4 -0
  44. package/components/upload/src/index.vue.d.ts +11 -1
  45. package/composables/index.d.ts +1 -0
  46. package/composables/index.js +318 -7
  47. package/composables/useForm.d.ts +9 -0
  48. package/composables/useSourceManager.d.ts +2 -0
  49. package/index.css +118 -0
  50. package/package.json +1 -1
  51. package/shared/element-plus/ctx.d.ts +9 -9
  52. package/shared/infer-prop/index.d.ts +16 -0
  53. package/shared/infer-prop/index.js +29 -0
@@ -3,6 +3,7 @@ import { radioGroupProps, radioGroupEmits, ElRadio, ElRadioGroup, ElRadioButton
3
3
  import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeProps, guardReactiveProps, withCtx, createVNode, mergeProps, toHandlers, createElementBlock, Fragment, renderList, resolveDynamicComponent, createTextVNode, toDisplayString } from 'vue';
4
4
  import { createRadioGroupBindProps, createRadioGroupOnEmits } from '@vunk/form/shared/element-plus';
5
5
  import { pickObject } from '@vunk/core/shared/utils-object';
6
+ import { useComputedReadonly } from '@vunk/form/composables';
6
7
 
7
8
  var __defProp = Object.defineProperty;
8
9
  var __defProps = Object.defineProperties;
@@ -47,17 +48,19 @@ var script = defineComponent({
47
48
  props,
48
49
  setup(props2, { emit }) {
49
50
  const formItemBindProps = _VkfFormItemCtx.createBindProps(props2);
50
- const coreBindProps = createRadioGroupBindProps(props2);
51
+ const coreBindProps = createRadioGroupBindProps(props2, ["disabled"]);
51
52
  const coreOnEmits = createRadioGroupOnEmits(emit);
52
53
  const options = computed(() => {
53
54
  return props2.options.filter((item) => item.value !== void 0 && item.value !== null);
54
55
  });
56
+ const readonly = useComputedReadonly(props2);
55
57
  return {
56
58
  formItemBindProps,
57
59
  coreBindProps,
58
60
  coreOnEmits,
59
61
  options,
60
- pickObject
62
+ pickObject,
63
+ readonly
61
64
  };
62
65
  }
63
66
  });
@@ -67,7 +70,13 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
67
70
  const _component_VkfFormItem = resolveComponent("VkfFormItem");
68
71
  return openBlock(), createBlock(_component_VkfFormItem, normalizeProps(guardReactiveProps(_ctx.formItemBindProps)), {
69
72
  default: withCtx(() => [
70
- createVNode(_component_ElRadioGroup, mergeProps(_ctx.coreBindProps, toHandlers(_ctx.coreOnEmits)), {
73
+ createVNode(_component_ElRadioGroup, mergeProps({
74
+ class: {
75
+ "is-readonly": _ctx.readonly
76
+ }
77
+ }, _ctx.coreBindProps, toHandlers(_ctx.coreOnEmits), {
78
+ disabled: _ctx.readonly || _ctx.disabled
79
+ }), {
71
80
  default: withCtx(() => [
72
81
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (item) => {
73
82
  return openBlock(), createBlock(resolveDynamicComponent(_ctx.type === "button" ? "ElRadioButton" : "ElRadio"), mergeProps({
@@ -87,7 +96,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
87
96
  }), 128))
88
97
  ]),
89
98
  _: 1
90
- }, 16)
99
+ }, 16, ["class", "disabled"])
91
100
  ]),
92
101
  _: 1
93
102
  }, 16);
@@ -63,6 +63,10 @@ export declare const props: {
63
63
  type: BooleanConstructor;
64
64
  default: boolean;
65
65
  };
66
+ readonly: {
67
+ type: BooleanConstructor;
68
+ default: undefined;
69
+ };
66
70
  };
67
71
  export declare const emits: {
68
72
  "update:modelValue": (val: string | number | boolean) => boolean;
@@ -61,6 +61,10 @@ declare const _default: import("vue").DefineComponent<{
61
61
  type: BooleanConstructor;
62
62
  default: boolean;
63
63
  };
64
+ readonly: {
65
+ type: BooleanConstructor;
66
+ default: undefined;
67
+ };
64
68
  }, {
65
69
  formItemBindProps: import("vue").ComputedRef<{
66
70
  required: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown> | undefined;
@@ -77,16 +81,16 @@ declare const _default: import("vue").DefineComponent<{
77
81
  formItemSlots: import("../../form-item/src/types").FormItemSlots | undefined;
78
82
  elRef: any;
79
83
  inline: boolean;
84
+ readonly: boolean | undefined;
80
85
  }>;
81
86
  coreBindProps: import("vue").ComputedRef<{
82
87
  label: string | undefined;
83
88
  size: import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", never> | undefined;
84
89
  fill: string;
85
90
  name: string | undefined;
86
- disabled: boolean;
87
91
  id: string | undefined;
88
- modelValue: import("element-plus/es/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor, BooleanConstructor], unknown, unknown>;
89
92
  validateEvent: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
93
+ modelValue: import("element-plus/es/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor, BooleanConstructor], unknown, unknown>;
90
94
  textColor: string;
91
95
  }>;
92
96
  coreOnEmits: {
@@ -98,6 +102,7 @@ declare const _default: import("vue").DefineComponent<{
98
102
  excludes?: EX | undefined;
99
103
  includes?: KI[] | undefined;
100
104
  } | undefined) => { [P in EX extends (infer KE)[] ? Exclude<KI, KE> : KI]: T[P]; };
105
+ readonly: import("vue").ComputedRef<boolean>;
101
106
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
102
107
  "update:modelValue": (val: string | number | boolean) => boolean;
103
108
  change: (val: string | number | boolean) => boolean;
@@ -164,9 +169,13 @@ declare const _default: import("vue").DefineComponent<{
164
169
  type: BooleanConstructor;
165
170
  default: boolean;
166
171
  };
172
+ readonly: {
173
+ type: BooleanConstructor;
174
+ default: undefined;
175
+ };
167
176
  }>> & {
168
- onChange?: ((val: string | number | boolean) => any) | undefined;
169
177
  "onUpdate:modelValue"?: ((val: string | number | boolean) => any) | undefined;
178
+ onChange?: ((val: string | number | boolean) => any) | undefined;
170
179
  }, {
171
180
  required: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
172
181
  type: "default" | "button";
@@ -177,13 +186,14 @@ declare const _default: import("vue").DefineComponent<{
177
186
  formItemSize: "default" | "small" | "large";
178
187
  formItemSlots: import("../../form-item/src/types").FormItemSlots;
179
188
  inline: boolean;
189
+ readonly: boolean;
180
190
  fill: string;
181
191
  name: string;
182
192
  disabled: boolean;
183
193
  id: string;
184
- modelValue: import("element-plus/es/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor, BooleanConstructor], unknown, unknown>;
185
194
  validateEvent: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
186
- textColor: string;
195
+ modelValue: import("element-plus/es/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor, BooleanConstructor], unknown, unknown>;
187
196
  options: import("../../../shared/types/form").RadioProps[];
197
+ textColor: string;
188
198
  }>;
189
199
  export default _default;
@@ -0,0 +1,11 @@
1
+
2
+ .el-select.is-readonly{
3
+ --el-readonly-cursor: text;
4
+ --el-disabled-bg-color: initial;
5
+ --el-disabled-text-color: var(--el-input-text-color);
6
+ }
7
+ .el-select.is-readonly .el-input.is-disabled .el-input__inner,
8
+ .el-select.is-readonly .el-input.is-disabled .el-select__caret,
9
+ .el-select.is-readonly .el-input.is-disabled .el-input__wrapper{
10
+ cursor: var(--el-readonly-cursor);
11
+ }
@@ -3,6 +3,7 @@ import { selectProps, selectEmits, createSelectBindProps, createSelectOnEmits }
3
3
  import { defineComponent, computed, ref, watch, nextTick, resolveComponent, openBlock, createBlock, normalizeProps, guardReactiveProps, withCtx, mergeProps, toHandlers, createSlots, createElementBlock, Fragment, renderList, renderSlot, resolveDynamicComponent, createCommentVNode } from 'vue';
4
4
  import { ElSelect, ElOption } from 'element-plus';
5
5
  import { isPlainObject } from '@vunk/core/shared/utils-object';
6
+ import { useComputedReadonly } from '@vunk/form/composables';
6
7
 
7
8
  var __defProp$1 = Object.defineProperty;
8
9
  var __defProps$1 = Object.defineProperties;
@@ -65,7 +66,7 @@ var script = defineComponent({
65
66
  props,
66
67
  setup(props2, { emit }) {
67
68
  const formItemBindProps = _VkfFormItemCtx.createBindProps(props2);
68
- const selectBindProps = createSelectBindProps(props2);
69
+ const selectBindProps = createSelectBindProps(props2, ["disabled"]);
69
70
  const selectOnEmits = createSelectOnEmits(emit);
70
71
  const getKey = (item) => isPlainObject(item.value) ? item.value[selectBindProps.value.valueKey] : item.value;
71
72
  const selectOptions = computed(() => {
@@ -87,12 +88,14 @@ var script = defineComponent({
87
88
  reshow.value = true;
88
89
  });
89
90
  });
91
+ const readonly = useComputedReadonly(props2);
90
92
  return {
91
93
  formItemBindProps,
92
94
  selectBindProps,
93
95
  selectOnEmits,
94
96
  selectOptions,
95
- reshow
97
+ reshow,
98
+ readonly
96
99
  };
97
100
  }
98
101
  });
@@ -103,7 +106,12 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
103
106
  const _component_VkfFormItem = resolveComponent("VkfFormItem");
104
107
  return openBlock(), createBlock(_component_VkfFormItem, normalizeProps(guardReactiveProps(_ctx.formItemBindProps)), {
105
108
  default: withCtx(() => [
106
- _ctx.reshow ? (openBlock(), createBlock(_component_ElSelect, mergeProps({ key: 0 }, _ctx.selectBindProps, toHandlers(_ctx.selectOnEmits)), createSlots({
109
+ _ctx.reshow ? (openBlock(), createBlock(_component_ElSelect, mergeProps({ key: 0 }, _ctx.selectBindProps, toHandlers(_ctx.selectOnEmits), {
110
+ disabled: _ctx.readonly || _ctx.disabled,
111
+ class: {
112
+ "is-readonly": _ctx.readonly
113
+ }
114
+ }), createSlots({
107
115
  default: withCtx(() => [
108
116
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selectOptions, (item) => {
109
117
  return openBlock(), createBlock(_component_ElOption, mergeProps(item, {
@@ -122,7 +130,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
122
130
  ])
123
131
  };
124
132
  })
125
- ]), 1040)) : createCommentVNode("v-if", true)
133
+ ]), 1040, ["disabled", "class"])) : createCommentVNode("v-if", true)
126
134
  ]),
127
135
  _: 3
128
136
  }, 16);
@@ -189,6 +189,10 @@ export declare const props: {
189
189
  type: BooleanConstructor;
190
190
  default: boolean;
191
191
  };
192
+ readonly: {
193
+ type: BooleanConstructor;
194
+ default: undefined;
195
+ };
192
196
  };
193
197
  export declare const emits: {
194
198
  'update:modelValue': null;
@@ -186,6 +186,10 @@ declare const _default: import("vue").DefineComponent<{
186
186
  type: BooleanConstructor;
187
187
  default: boolean;
188
188
  };
189
+ readonly: {
190
+ type: BooleanConstructor;
191
+ default: undefined;
192
+ };
189
193
  }, {
190
194
  formItemBindProps: import("vue").ComputedRef<{
191
195
  required: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown> | undefined;
@@ -202,19 +206,19 @@ declare const _default: import("vue").DefineComponent<{
202
206
  formItemSlots: import("../../form-item/src/types").FormItemSlots | undefined;
203
207
  elRef: any;
204
208
  inline: boolean;
209
+ readonly: boolean | undefined;
205
210
  }>;
206
211
  selectBindProps: import("vue").ComputedRef<{
207
212
  size: "" | "default" | "small" | "large" | undefined;
208
213
  name: string | undefined;
209
- disabled: boolean;
210
214
  loading: boolean;
211
215
  multiple: boolean;
212
216
  id: string | undefined;
213
- modelValue: string | number | boolean | Record<string, any> | unknown[] | undefined;
214
217
  popperClass: string;
215
218
  clearable: boolean;
216
219
  clearIcon: string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
217
220
  placeholder: string | undefined;
221
+ modelValue: string | number | boolean | Record<string, any> | unknown[] | undefined;
218
222
  autocomplete: string;
219
223
  suffixIcon: string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
220
224
  automaticDropdown: boolean;
@@ -310,6 +314,7 @@ declare const _default: import("vue").DefineComponent<{
310
314
  key: any;
311
315
  })[]>;
312
316
  reshow: import("vue").Ref<boolean>;
317
+ readonly: import("vue").ComputedRef<boolean>;
313
318
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
314
319
  'update:modelValue': null;
315
320
  change: null;
@@ -506,10 +511,14 @@ declare const _default: import("vue").DefineComponent<{
506
511
  type: BooleanConstructor;
507
512
  default: boolean;
508
513
  };
514
+ readonly: {
515
+ type: BooleanConstructor;
516
+ default: undefined;
517
+ };
509
518
  }>> & {
510
- onChange?: ((...args: any[]) => any) | undefined;
511
519
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
512
520
  onBlur?: ((...args: any[]) => any) | undefined;
521
+ onChange?: ((...args: any[]) => any) | undefined;
513
522
  onFocus?: ((...args: any[]) => any) | undefined;
514
523
  "onVisible-change"?: ((...args: any[]) => any) | undefined;
515
524
  onClear?: ((...args: any[]) => any) | undefined;
@@ -522,10 +531,31 @@ declare const _default: import("vue").DefineComponent<{
522
531
  formItemSize: "default" | "small" | "large";
523
532
  formItemSlots: import("../../form-item/src/types").FormItemSlots;
524
533
  inline: boolean;
534
+ readonly: boolean;
525
535
  disabled: boolean;
526
536
  loading: boolean;
527
537
  multiple: boolean;
538
+ popperClass: string;
539
+ clearable: boolean;
540
+ clearIcon: string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
528
541
  modelValue: string | number | boolean | Record<string, any> | unknown[];
542
+ autocomplete: string;
543
+ suffixIcon: string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
544
+ automaticDropdown: boolean;
545
+ effect: string;
546
+ filterable: boolean;
547
+ allowCreate: boolean;
548
+ remote: boolean;
549
+ multipleLimit: number;
550
+ defaultFirstOption: boolean;
551
+ reserveKeyword: boolean;
552
+ valueKey: string;
553
+ collapseTags: boolean;
554
+ collapseTagsTooltip: boolean;
555
+ teleported: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
556
+ persistent: boolean;
557
+ fitInputWidth: boolean;
558
+ tagType: import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "success" | "warning" | "info" | "danger", unknown>;
529
559
  options: import("@vunk/core").VueComponentPropsType<import("element-plus/es/utils").SFCWithInstall<import("vue").DefineComponent<{
530
560
  value: {
531
561
  required: true;
@@ -586,26 +616,6 @@ declare const _default: import("vue").DefineComponent<{
586
616
  disabled: boolean;
587
617
  created: boolean;
588
618
  }>>>[];
589
- popperClass: string;
590
- clearable: boolean;
591
- clearIcon: string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
592
- autocomplete: string;
593
- suffixIcon: string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
594
- automaticDropdown: boolean;
595
- effect: string;
596
- filterable: boolean;
597
- allowCreate: boolean;
598
- remote: boolean;
599
- multipleLimit: number;
600
- defaultFirstOption: boolean;
601
- reserveKeyword: boolean;
602
- valueKey: string;
603
- collapseTags: boolean;
604
- collapseTagsTooltip: boolean;
605
- teleported: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
606
- persistent: boolean;
607
- fitInputWidth: boolean;
608
- tagType: import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "success" | "warning" | "info" | "danger", unknown>;
609
619
  selectSlots: import("./types").SelectSlots;
610
620
  }>;
611
621
  export default _default;
@@ -0,0 +1,11 @@
1
+
2
+ .el-switch.is-readonly{
3
+ --el-readonly-cursor: auto;
4
+ }
5
+ .el-switch.is-readonly.is-readonly{
6
+ opacity: .9;
7
+ }
8
+ .el-switch.is-readonly.is-readonly .el-switch__core,
9
+ .el-switch.is-readonly.is-readonly .el-switch__label{
10
+ cursor: var(--el-readonly-cursor);
11
+ }
@@ -2,6 +2,7 @@ import { switchProps, switchEmits, ElSwitch } from 'element-plus';
2
2
  import { _VkfFormItemCtx, VkfFormItem } from '@vunk/form/components/form-item';
3
3
  import { defineComponent, resolveComponent, openBlock, createBlock, normalizeProps, guardReactiveProps, withCtx, createVNode, mergeProps, toHandlers, renderSlot } from 'vue';
4
4
  import { createSwitchBindProps, createSwitchOnEmits } from '@vunk/form/shared/element-plus';
5
+ import { useComputedReadonly } from '@vunk/form/composables';
5
6
 
6
7
  var __defProp = Object.defineProperty;
7
8
  var __defProps = Object.defineProperties;
@@ -44,12 +45,17 @@ var script = defineComponent({
44
45
  props,
45
46
  setup(props2, { emit }) {
46
47
  const formItemBindProps = _VkfFormItemCtx.createBindProps(props2);
47
- const switchBindProps = createSwitchBindProps(props2, ["modelValue"]);
48
+ const switchBindProps = createSwitchBindProps(props2, [
49
+ "modelValue",
50
+ "disabled"
51
+ ]);
48
52
  const switchOnEmits = createSwitchOnEmits(emit);
53
+ const readonly = useComputedReadonly(props2);
49
54
  return {
50
55
  formItemBindProps,
51
56
  switchBindProps,
52
- switchOnEmits
57
+ switchOnEmits,
58
+ readonly
53
59
  };
54
60
  }
55
61
  });
@@ -62,13 +68,18 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
62
68
  var _a;
63
69
  return [
64
70
  createVNode(_component_ElSwitch, mergeProps({
71
+ class: {
72
+ "is-readonly": _ctx.readonly
73
+ },
65
74
  modelValue: (_a = _ctx.modelValue) != null ? _a : _ctx.defaultModelValue
66
- }, _ctx.switchBindProps, toHandlers(_ctx.switchOnEmits)), {
75
+ }, _ctx.switchBindProps, toHandlers(_ctx.switchOnEmits), {
76
+ disabled: _ctx.readonly || _ctx.disabled
77
+ }), {
67
78
  default: withCtx(() => [
68
79
  renderSlot(_ctx.$slots, "default")
69
80
  ]),
70
81
  _: 3
71
- }, 16, ["modelValue"])
82
+ }, 16, ["class", "modelValue", "disabled"])
72
83
  ];
73
84
  }),
74
85
  _: 3
@@ -83,6 +83,10 @@ export declare const props: {
83
83
  type: BooleanConstructor;
84
84
  default: boolean;
85
85
  };
86
+ readonly: {
87
+ type: BooleanConstructor;
88
+ default: undefined;
89
+ };
86
90
  };
87
91
  export declare const emits: {
88
92
  "update:modelValue": (val: string | number | boolean) => boolean;
@@ -83,6 +83,10 @@ declare const _default: import("vue").DefineComponent<{
83
83
  type: BooleanConstructor;
84
84
  default: boolean;
85
85
  };
86
+ readonly: {
87
+ type: BooleanConstructor;
88
+ default: undefined;
89
+ };
86
90
  }, {
87
91
  formItemBindProps: import("vue").ComputedRef<{
88
92
  required: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown> | undefined;
@@ -99,12 +103,12 @@ declare const _default: import("vue").DefineComponent<{
99
103
  formItemSlots: import("../../form-item/src/types").FormItemSlots | undefined;
100
104
  elRef: any;
101
105
  inline: boolean;
106
+ readonly: boolean | undefined;
102
107
  }>;
103
108
  switchBindProps: import("vue").ComputedRef<{
104
109
  size: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => ("" | "default" | "small" | "large") & {}) | (() => "" | "default" | "small" | "large") | ((new (...args: any[]) => ("" | "default" | "small" | "large") & {}) | (() => "" | "default" | "small" | "large"))[], unknown, "" | "default" | "small" | "large"> | undefined;
105
110
  name: string;
106
111
  value: import("element-plus/es/utils").EpPropMergeType<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown>;
107
- disabled: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
108
112
  loading: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
109
113
  width: import("element-plus/es/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>;
110
114
  borderColor: string;
@@ -127,6 +131,7 @@ declare const _default: import("vue").DefineComponent<{
127
131
  change: (val: string | number | boolean) => void;
128
132
  "update:modelValue": (val: string | number | boolean) => void;
129
133
  };
134
+ readonly: import("vue").ComputedRef<boolean>;
130
135
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
131
136
  "update:modelValue": (val: string | number | boolean) => boolean;
132
137
  change: (val: string | number | boolean) => boolean;
@@ -216,9 +221,13 @@ declare const _default: import("vue").DefineComponent<{
216
221
  type: BooleanConstructor;
217
222
  default: boolean;
218
223
  };
224
+ readonly: {
225
+ type: BooleanConstructor;
226
+ default: undefined;
227
+ };
219
228
  }>> & {
220
- onChange?: ((val: string | number | boolean) => any) | undefined;
221
229
  "onUpdate:modelValue"?: ((val: string | number | boolean) => any) | undefined;
230
+ onChange?: ((val: string | number | boolean) => any) | undefined;
222
231
  onInput?: ((val: string | number | boolean) => any) | undefined;
223
232
  }, {
224
233
  required: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
@@ -228,15 +237,15 @@ declare const _default: import("vue").DefineComponent<{
228
237
  formItemSize: "default" | "small" | "large";
229
238
  formItemSlots: import("../../form-item/src/types").FormItemSlots;
230
239
  inline: boolean;
240
+ readonly: boolean;
231
241
  name: string;
232
242
  value: import("element-plus/es/utils").EpPropMergeType<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown>;
233
243
  disabled: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
234
244
  loading: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
235
245
  width: import("element-plus/es/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>;
236
246
  borderColor: string;
237
- modelValue: boolean;
238
247
  validateEvent: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
239
- defaultModelValue: boolean;
248
+ modelValue: boolean;
240
249
  inlinePrompt: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
241
250
  activeIcon: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>) & {}) | (() => string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>) | ((new (...args: any[]) => (string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>) & {}) | (() => string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>))[], unknown, unknown>;
242
251
  inactiveIcon: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>) & {}) | (() => string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>) | ((new (...args: any[]) => (string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>) & {}) | (() => string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>))[], unknown, unknown>;
@@ -246,5 +255,6 @@ declare const _default: import("vue").DefineComponent<{
246
255
  inactiveColor: string;
247
256
  activeValue: import("element-plus/es/utils").EpPropMergeType<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown>;
248
257
  inactiveValue: import("element-plus/es/utils").EpPropMergeType<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown>;
258
+ defaultModelValue: boolean;
249
259
  }>;
250
260
  export default _default;
@@ -1,3 +1,13 @@
1
+
2
+
3
+ .vkf-upload.is-readonly .el-upload,
4
+ .vkf-upload.is-readonly .el-upload{
5
+ display: none;
6
+ }
7
+ .vkf-upload .el-upload-list{
8
+ min-width: 100px;
9
+ }
10
+
1
11
 
2
12
  .el-upload-list__item-status-label{
3
13
  z-index: 1;
@@ -5,6 +5,7 @@ import { pickObject } from '@vunk/core/shared/utils-object';
5
5
  import { createUploadBindProps } from '@vunk/form/shared/element-plus';
6
6
  import { NOOP } from '@vunk/core/shared/utils-function';
7
7
  import { RestFetch } from '@vunk/core/shared/utils-fetch';
8
+ import { useComputedReadonly } from '@vunk/form/composables';
8
9
 
9
10
  var __defProp = Object.defineProperty;
10
11
  var __defProps = Object.defineProperties;
@@ -398,18 +399,20 @@ var script = defineComponent({
398
399
  props,
399
400
  setup(props2) {
400
401
  const formItemBindProps = _VkfFormItemCtx.createBindProps(props2);
401
- const coreBindProps = createUploadBindProps(props2);
402
+ const coreBindProps = createUploadBindProps(props2, ["disabled"]);
402
403
  const uploadRef = shallowRef();
403
404
  const handleRemove = (file) => {
404
405
  var _a;
405
406
  (_a = uploadRef.value) == null ? void 0 : _a.handleRemove(file);
406
407
  };
408
+ const readonly = useComputedReadonly(props2);
407
409
  return {
408
410
  formItemBindProps,
409
411
  pickObject,
410
412
  coreBindProps,
411
413
  uploadRef,
412
- handleRemove
414
+ handleRemove,
415
+ readonly
413
416
  };
414
417
  }
415
418
  });
@@ -423,15 +426,20 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
423
426
  const _component_VkfFormItem = resolveComponent("VkfFormItem");
424
427
  return openBlock(), createBlock(_component_VkfFormItem, normalizeProps(guardReactiveProps(_ctx.formItemBindProps)), {
425
428
  default: withCtx(() => [
426
- createVNode(_component_ElUpload, mergeProps(_ctx.coreBindProps, {
429
+ createVNode(_component_ElUpload, mergeProps({
430
+ class: ["vkf-upload", {
431
+ "is-readonly": _ctx.readonly
432
+ }]
433
+ }, _ctx.coreBindProps, {
427
434
  "onUpdate:fileList": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:fileList", $event)),
428
- ref: "uploadRef"
435
+ ref: "uploadRef",
436
+ disabled: _ctx.readonly || _ctx.disabled
429
437
  }), createSlots({
430
438
  file: withCtx(({ file }) => [
431
439
  createVNode(_component_FileVue, {
432
440
  file,
433
441
  listType: _ctx.listType,
434
- disabled: _ctx.disabled,
442
+ disabled: _ctx.readonly || _ctx.disabled,
435
443
  onPreview: _ctx.onPreview,
436
444
  onRemove: _ctx.handleRemove
437
445
  }, null, 8, ["file", "listType", "disabled", "onPreview", "onRemove"])
@@ -453,7 +461,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
453
461
  createElementVNode("div", _hoisted_2, toDisplayString(_ctx.tip), 1)
454
462
  ])
455
463
  } : void 0
456
- ]), 1040)
464
+ ]), 1040, ["class", "disabled"])
457
465
  ]),
458
466
  _: 3
459
467
  }, 16);
@@ -157,6 +157,10 @@ export declare const props: {
157
157
  type: BooleanConstructor;
158
158
  default: boolean;
159
159
  };
160
+ readonly: {
161
+ type: BooleanConstructor;
162
+ default: undefined;
163
+ };
160
164
  };
161
165
  export declare const emits: {
162
166
  'update:fileList': null;
@@ -158,6 +158,10 @@ declare const _default: import("vue").DefineComponent<{
158
158
  type: BooleanConstructor;
159
159
  default: boolean;
160
160
  };
161
+ readonly: {
162
+ type: BooleanConstructor;
163
+ default: undefined;
164
+ };
161
165
  }, {
162
166
  formItemBindProps: import("vue").ComputedRef<{
163
167
  required: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown> | undefined;
@@ -174,6 +178,7 @@ declare const _default: import("vue").DefineComponent<{
174
178
  formItemSlots: import("../../form-item/src/types").FormItemSlots | undefined;
175
179
  elRef: any;
176
180
  inline: boolean;
181
+ readonly: boolean | undefined;
177
182
  }>;
178
183
  pickObject: <T extends import("@vunk/core").NormalObject, EX extends (keyof T)[] | undefined, KI extends keyof T>(data: T, opts?: {
179
184
  excludes?: EX | undefined;
@@ -183,7 +188,6 @@ declare const _default: import("vue").DefineComponent<{
183
188
  type: string;
184
189
  name: string;
185
190
  data: Record<string, any>;
186
- disabled: boolean;
187
191
  drag: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
188
192
  multiple: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
189
193
  onChange: (uploadFile: UploadFile, uploadFiles: import("element-plus").UploadFiles) => void;
@@ -211,6 +215,7 @@ declare const _default: import("vue").DefineComponent<{
211
215
  handleRemove: AnyFunc;
212
216
  } | undefined>;
213
217
  handleRemove: (file: UploadFile) => void;
218
+ readonly: import("vue").ComputedRef<boolean>;
214
219
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
215
220
  'update:fileList': null;
216
221
  remove: (e: UploadFile) => UploadFile;
@@ -372,6 +377,10 @@ declare const _default: import("vue").DefineComponent<{
372
377
  type: BooleanConstructor;
373
378
  default: boolean;
374
379
  };
380
+ readonly: {
381
+ type: BooleanConstructor;
382
+ default: undefined;
383
+ };
375
384
  }>> & {
376
385
  onRemove?: ((e: UploadFile) => any) | undefined;
377
386
  "onUpdate:fileList"?: ((...args: any[]) => any) | undefined;
@@ -384,6 +393,7 @@ declare const _default: import("vue").DefineComponent<{
384
393
  formItemSize: "default" | "small" | "large";
385
394
  formItemSlots: import("../../form-item/src/types").FormItemSlots;
386
395
  inline: boolean;
396
+ readonly: boolean;
387
397
  name: string;
388
398
  data: Record<string, any>;
389
399
  disabled: boolean;
@@ -1 +1,2 @@
1
1
  export * from './useSourceManager';
2
+ export * from './useForm';