@vunk/form 0.0.1-alpha.35 → 0.0.1-alpha.37

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,11 +1,13 @@
1
1
  import { _VkfFormItemCtx, VkfFormItem } from '@vunk/form/components/form-item';
2
2
  import { bindPropsFactory, onEmitsFactory } from '@vunk/core/shared/utils-vue';
3
3
  import { cascaderProps, cascaderEmits, createCascaderBindProps, createCascaderOnEmits } from '@vunk/form/shared/element-plus';
4
- import { defineComponent, resolveComponent, openBlock, createBlock, normalizeProps, guardReactiveProps, withCtx, createVNode, mergeProps, toHandlers } from 'vue';
4
+ import { defineComponent, ref, watch, computed, resolveComponent, openBlock, createBlock, normalizeProps, guardReactiveProps, withCtx, createVNode, mergeProps, toHandlers } from 'vue';
5
5
  import { ElCascader } from 'element-plus';
6
6
  import { useComputedReadonly } from '@vunk/form/composables';
7
7
 
8
8
  var __defProp = Object.defineProperty;
9
+ var __defProps = Object.defineProperties;
10
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
9
11
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
10
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
11
13
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -21,7 +23,13 @@ var __spreadValues = (a, b) => {
21
23
  }
22
24
  return a;
23
25
  };
24
- const props = __spreadValues(__spreadValues({}, cascaderProps), _VkfFormItemCtx.props);
26
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27
+ const props = __spreadProps(__spreadValues(__spreadValues({}, cascaderProps), _VkfFormItemCtx.props), {
28
+ optionsUrl: {
29
+ type: String,
30
+ default: ""
31
+ }
32
+ });
25
33
  bindPropsFactory(props);
26
34
  const emits = __spreadValues({}, cascaderEmits);
27
35
  onEmitsFactory(emits);
@@ -35,15 +43,28 @@ var script = defineComponent({
35
43
  emits,
36
44
  props,
37
45
  setup(props2, { emit }) {
38
- const coreBindProps = createCascaderBindProps(props2);
46
+ const coreBindProps = createCascaderBindProps(props2, ["options"]);
39
47
  const coreOnEmits = createCascaderOnEmits(emit);
40
48
  const formItemBindProps = _VkfFormItemCtx.createBindProps(props2);
41
49
  const readonly = useComputedReadonly(props2);
50
+ const optionsFromUrl = ref([]);
51
+ watch(() => props2.optionsUrl, (url) => {
52
+ emit("update:modelValue", void 0);
53
+ if (url) {
54
+ fetch(url).then((res) => res.json()).then((data) => {
55
+ optionsFromUrl.value = data;
56
+ });
57
+ } else {
58
+ optionsFromUrl.value = [];
59
+ }
60
+ }, { immediate: true });
61
+ const options = computed(() => optionsFromUrl.value.length ? optionsFromUrl.value : props2.options);
42
62
  return {
43
63
  coreBindProps,
44
64
  coreOnEmits,
45
65
  formItemBindProps,
46
- readonly
66
+ readonly,
67
+ options
47
68
  };
48
69
  }
49
70
  });
@@ -53,7 +74,10 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
53
74
  const _component_VkfFormItem = resolveComponent("VkfFormItem");
54
75
  return openBlock(), createBlock(_component_VkfFormItem, normalizeProps(guardReactiveProps(_ctx.formItemBindProps)), {
55
76
  default: withCtx(() => [
56
- createVNode(_component_ElCascader, mergeProps(_ctx.coreBindProps, toHandlers(_ctx.coreOnEmits), { readonly: _ctx.readonly }), null, 16, ["readonly"])
77
+ createVNode(_component_ElCascader, mergeProps(_ctx.coreBindProps, toHandlers(_ctx.coreOnEmits), {
78
+ readonly: _ctx.readonly,
79
+ options: _ctx.options
80
+ }), null, 16, ["readonly", "options"])
57
81
  ]),
58
82
  _: 1
59
83
  }, 16);
@@ -1,4 +1,8 @@
1
1
  export declare const props: {
2
+ optionsUrl: {
3
+ type: StringConstructor;
4
+ default: string;
5
+ };
2
6
  required: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
3
7
  label: StringConstructor;
4
8
  labelWidth: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
@@ -105,7 +109,7 @@ export declare const props: {
105
109
  default: () => import("element-plus").CascaderProps;
106
110
  };
107
111
  };
108
- export declare const createBindProps: <T2 extends import("@vunk/core").NormalObject, EX extends (Extract<"required", keyof T2> | Extract<"label", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"prop", keyof T2> | Extract<"rules", keyof T2> | Extract<"error", keyof T2> | Extract<"validateStatus", keyof T2> | Extract<"for", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"size", keyof T2> | Extract<"formItemSize", keyof T2> | Extract<"formItemSlots", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"props", keyof T2> | Extract<"disabled", keyof T2> | Extract<"separator", keyof T2> | Extract<"validateEvent", keyof T2> | Extract<"popperClass", keyof T2> | Extract<"clearable", keyof T2> | Extract<"placeholder", keyof T2> | Extract<"modelValue", keyof T2> | Extract<"filterable", keyof T2> | Extract<"filterMethod", keyof T2> | Extract<"collapseTags", keyof T2> | Extract<"collapseTagsTooltip", keyof T2> | Extract<"teleported", keyof T2> | Extract<"tagType", keyof T2> | Extract<"options", keyof T2> | Extract<"showAllLevels", keyof T2> | Extract<"debounce", keyof T2> | Extract<"beforeFilter", keyof T2>)[] | undefined>(propsArg: T2, excludes?: EX | undefined) => import("vue").ComputedRef<{ [P in EX extends (infer KE)[] ? Exclude<Extract<"required", keyof T2>, KE> | Exclude<Extract<"label", keyof T2>, KE> | Exclude<Extract<"labelWidth", keyof T2>, KE> | Exclude<Extract<"prop", keyof T2>, KE> | Exclude<Extract<"rules", keyof T2>, KE> | Exclude<Extract<"error", keyof T2>, KE> | Exclude<Extract<"validateStatus", keyof T2>, KE> | Exclude<Extract<"for", keyof T2>, KE> | Exclude<Extract<"inlineMessage", keyof T2>, KE> | Exclude<Extract<"showMessage", keyof T2>, KE> | Exclude<Extract<"size", keyof T2>, KE> | Exclude<Extract<"formItemSize", keyof T2>, KE> | Exclude<Extract<"formItemSlots", keyof T2>, KE> | Exclude<Extract<"elRef", keyof T2>, KE> | Exclude<Extract<"inline", keyof T2>, KE> | Exclude<Extract<"readonly", keyof T2>, KE> | Exclude<Extract<"props", keyof T2>, KE> | Exclude<Extract<"disabled", keyof T2>, KE> | Exclude<Extract<"separator", keyof T2>, KE> | Exclude<Extract<"validateEvent", keyof T2>, KE> | Exclude<Extract<"popperClass", keyof T2>, KE> | Exclude<Extract<"clearable", keyof T2>, KE> | Exclude<Extract<"placeholder", keyof T2>, KE> | Exclude<Extract<"modelValue", keyof T2>, KE> | Exclude<Extract<"filterable", keyof T2>, KE> | Exclude<Extract<"filterMethod", keyof T2>, KE> | Exclude<Extract<"collapseTags", keyof T2>, KE> | Exclude<Extract<"collapseTagsTooltip", keyof T2>, KE> | Exclude<Extract<"teleported", keyof T2>, KE> | Exclude<Extract<"tagType", keyof T2>, KE> | Exclude<Extract<"options", keyof T2>, KE> | Exclude<Extract<"showAllLevels", keyof T2>, KE> | Exclude<Extract<"debounce", keyof T2>, KE> | Exclude<Extract<"beforeFilter", keyof T2>, KE> : Extract<"required", keyof T2> | Extract<"label", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"prop", keyof T2> | Extract<"rules", keyof T2> | Extract<"error", keyof T2> | Extract<"validateStatus", keyof T2> | Extract<"for", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"size", keyof T2> | Extract<"formItemSize", keyof T2> | Extract<"formItemSlots", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"props", keyof T2> | Extract<"disabled", keyof T2> | Extract<"separator", keyof T2> | Extract<"validateEvent", keyof T2> | Extract<"popperClass", keyof T2> | Extract<"clearable", keyof T2> | Extract<"placeholder", keyof T2> | Extract<"modelValue", keyof T2> | Extract<"filterable", keyof T2> | Extract<"filterMethod", keyof T2> | Extract<"collapseTags", keyof T2> | Extract<"collapseTagsTooltip", keyof T2> | Extract<"teleported", keyof T2> | Extract<"tagType", keyof T2> | Extract<"options", keyof T2> | Extract<"showAllLevels", keyof T2> | Extract<"debounce", keyof T2> | Extract<"beforeFilter", keyof T2>]: { [k in Extract<"required", keyof T2> | Extract<"label", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"prop", keyof T2> | Extract<"rules", keyof T2> | Extract<"error", keyof T2> | Extract<"validateStatus", keyof T2> | Extract<"for", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"size", keyof T2> | Extract<"formItemSize", keyof T2> | Extract<"formItemSlots", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"props", keyof T2> | Extract<"disabled", keyof T2> | Extract<"separator", keyof T2> | Extract<"validateEvent", keyof T2> | Extract<"popperClass", keyof T2> | Extract<"clearable", keyof T2> | Extract<"placeholder", keyof T2> | Extract<"modelValue", keyof T2> | Extract<"filterable", keyof T2> | Extract<"filterMethod", keyof T2> | Extract<"collapseTags", keyof T2> | Extract<"collapseTagsTooltip", keyof T2> | Extract<"teleported", keyof T2> | Extract<"tagType", keyof T2> | Extract<"options", keyof T2> | Extract<"showAllLevels", keyof T2> | Extract<"debounce", keyof T2> | Extract<"beforeFilter", keyof T2>]: T2[k]; }[P]; }>;
112
+ export declare const createBindProps: <T2 extends import("@vunk/core").NormalObject, EX extends (Extract<"required", keyof T2> | Extract<"label", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"prop", keyof T2> | Extract<"rules", keyof T2> | Extract<"error", keyof T2> | Extract<"validateStatus", keyof T2> | Extract<"for", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"size", keyof T2> | Extract<"formItemSize", keyof T2> | Extract<"formItemSlots", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"props", keyof T2> | Extract<"disabled", keyof T2> | Extract<"separator", keyof T2> | Extract<"validateEvent", keyof T2> | Extract<"popperClass", keyof T2> | Extract<"clearable", keyof T2> | Extract<"placeholder", keyof T2> | Extract<"modelValue", keyof T2> | Extract<"filterable", keyof T2> | Extract<"filterMethod", keyof T2> | Extract<"collapseTags", keyof T2> | Extract<"collapseTagsTooltip", keyof T2> | Extract<"teleported", keyof T2> | Extract<"tagType", keyof T2> | Extract<"options", keyof T2> | Extract<"optionsUrl", keyof T2> | Extract<"showAllLevels", keyof T2> | Extract<"debounce", keyof T2> | Extract<"beforeFilter", keyof T2>)[] | undefined>(propsArg: T2, excludes?: EX | undefined) => import("vue").ComputedRef<{ [P in EX extends (infer KE)[] ? Exclude<Extract<"required", keyof T2>, KE> | Exclude<Extract<"label", keyof T2>, KE> | Exclude<Extract<"labelWidth", keyof T2>, KE> | Exclude<Extract<"prop", keyof T2>, KE> | Exclude<Extract<"rules", keyof T2>, KE> | Exclude<Extract<"error", keyof T2>, KE> | Exclude<Extract<"validateStatus", keyof T2>, KE> | Exclude<Extract<"for", keyof T2>, KE> | Exclude<Extract<"inlineMessage", keyof T2>, KE> | Exclude<Extract<"showMessage", keyof T2>, KE> | Exclude<Extract<"size", keyof T2>, KE> | Exclude<Extract<"formItemSize", keyof T2>, KE> | Exclude<Extract<"formItemSlots", keyof T2>, KE> | Exclude<Extract<"elRef", keyof T2>, KE> | Exclude<Extract<"inline", keyof T2>, KE> | Exclude<Extract<"readonly", keyof T2>, KE> | Exclude<Extract<"props", keyof T2>, KE> | Exclude<Extract<"disabled", keyof T2>, KE> | Exclude<Extract<"separator", keyof T2>, KE> | Exclude<Extract<"validateEvent", keyof T2>, KE> | Exclude<Extract<"popperClass", keyof T2>, KE> | Exclude<Extract<"clearable", keyof T2>, KE> | Exclude<Extract<"placeholder", keyof T2>, KE> | Exclude<Extract<"modelValue", keyof T2>, KE> | Exclude<Extract<"filterable", keyof T2>, KE> | Exclude<Extract<"filterMethod", keyof T2>, KE> | Exclude<Extract<"collapseTags", keyof T2>, KE> | Exclude<Extract<"collapseTagsTooltip", keyof T2>, KE> | Exclude<Extract<"teleported", keyof T2>, KE> | Exclude<Extract<"tagType", keyof T2>, KE> | Exclude<Extract<"options", keyof T2>, KE> | Exclude<Extract<"optionsUrl", keyof T2>, KE> | Exclude<Extract<"showAllLevels", keyof T2>, KE> | Exclude<Extract<"debounce", keyof T2>, KE> | Exclude<Extract<"beforeFilter", keyof T2>, KE> : Extract<"required", keyof T2> | Extract<"label", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"prop", keyof T2> | Extract<"rules", keyof T2> | Extract<"error", keyof T2> | Extract<"validateStatus", keyof T2> | Extract<"for", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"size", keyof T2> | Extract<"formItemSize", keyof T2> | Extract<"formItemSlots", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"props", keyof T2> | Extract<"disabled", keyof T2> | Extract<"separator", keyof T2> | Extract<"validateEvent", keyof T2> | Extract<"popperClass", keyof T2> | Extract<"clearable", keyof T2> | Extract<"placeholder", keyof T2> | Extract<"modelValue", keyof T2> | Extract<"filterable", keyof T2> | Extract<"filterMethod", keyof T2> | Extract<"collapseTags", keyof T2> | Extract<"collapseTagsTooltip", keyof T2> | Extract<"teleported", keyof T2> | Extract<"tagType", keyof T2> | Extract<"options", keyof T2> | Extract<"optionsUrl", keyof T2> | Extract<"showAllLevels", keyof T2> | Extract<"debounce", keyof T2> | Extract<"beforeFilter", keyof T2>]: { [k in Extract<"required", keyof T2> | Extract<"label", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"prop", keyof T2> | Extract<"rules", keyof T2> | Extract<"error", keyof T2> | Extract<"validateStatus", keyof T2> | Extract<"for", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"size", keyof T2> | Extract<"formItemSize", keyof T2> | Extract<"formItemSlots", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"props", keyof T2> | Extract<"disabled", keyof T2> | Extract<"separator", keyof T2> | Extract<"validateEvent", keyof T2> | Extract<"popperClass", keyof T2> | Extract<"clearable", keyof T2> | Extract<"placeholder", keyof T2> | Extract<"modelValue", keyof T2> | Extract<"filterable", keyof T2> | Extract<"filterMethod", keyof T2> | Extract<"collapseTags", keyof T2> | Extract<"collapseTagsTooltip", keyof T2> | Extract<"teleported", keyof T2> | Extract<"tagType", keyof T2> | Extract<"options", keyof T2> | Extract<"optionsUrl", keyof T2> | Extract<"showAllLevels", keyof T2> | Extract<"debounce", keyof T2> | Extract<"beforeFilter", keyof T2>]: T2[k]; }[P]; }>;
109
113
  export declare const emits: {
110
114
  "update:modelValue": null;
111
115
  change: null;
@@ -3,6 +3,8 @@ import { bindPropsFactory, onEmitsFactory } from '@vunk/core/shared/utils-vue';
3
3
  import { cascaderProps, cascaderEmits } from '@vunk/form/shared/element-plus';
4
4
 
5
5
  var __defProp = Object.defineProperty;
6
+ var __defProps = Object.defineProperties;
7
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
8
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
10
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -18,7 +20,13 @@ var __spreadValues = (a, b) => {
18
20
  }
19
21
  return a;
20
22
  };
21
- const props = __spreadValues(__spreadValues({}, cascaderProps), _VkfFormItemCtx.props);
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ const props = __spreadProps(__spreadValues(__spreadValues({}, cascaderProps), _VkfFormItemCtx.props), {
25
+ optionsUrl: {
26
+ type: String,
27
+ default: ""
28
+ }
29
+ });
22
30
  const createBindProps = bindPropsFactory(props);
23
31
  const emits = __spreadValues({}, cascaderEmits);
24
32
  const createOnEmits = onEmitsFactory(emits);
@@ -1,4 +1,8 @@
1
1
  declare const _default: import("vue").DefineComponent<{
2
+ optionsUrl: {
3
+ type: StringConstructor;
4
+ default: string;
5
+ };
2
6
  required: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
3
7
  label: StringConstructor;
4
8
  labelWidth: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
@@ -121,7 +125,6 @@ declare const _default: import("vue").DefineComponent<{
121
125
  collapseTagsTooltip: boolean;
122
126
  teleported: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
123
127
  tagType: import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "success" | "warning" | "info" | "danger", unknown>;
124
- options: import("element-plus").CascaderOption[];
125
128
  showAllLevels: boolean;
126
129
  debounce: number;
127
130
  beforeFilter: (value: string) => boolean | Promise<any>;
@@ -153,6 +156,7 @@ declare const _default: import("vue").DefineComponent<{
153
156
  readonly: boolean | undefined;
154
157
  }>;
155
158
  readonly: import("vue").ComputedRef<boolean>;
159
+ options: import("vue").ComputedRef<import("element-plus").CascaderOption[]>;
156
160
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
157
161
  "update:modelValue": null;
158
162
  change: null;
@@ -162,6 +166,10 @@ declare const _default: import("vue").DefineComponent<{
162
166
  'expand-change': null;
163
167
  'remove-tag': null;
164
168
  }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
169
+ optionsUrl: {
170
+ type: StringConstructor;
171
+ default: string;
172
+ };
165
173
  required: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
166
174
  label: StringConstructor;
167
175
  labelWidth: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
@@ -297,6 +305,7 @@ declare const _default: import("vue").DefineComponent<{
297
305
  teleported: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
298
306
  tagType: import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "success" | "warning" | "info" | "danger", unknown>;
299
307
  options: import("element-plus").CascaderOption[];
308
+ optionsUrl: string;
300
309
  showAllLevels: boolean;
301
310
  debounce: number;
302
311
  beforeFilter: (value: string) => boolean | Promise<any>;
@@ -1,6 +1,6 @@
1
1
  import { _VkfFormItemCtx, VkfFormItem } from '@vunk/form/components/form-item';
2
2
  import { selectProps, selectEmits, createSelectBindProps, createSelectOnEmits } from '@vunk/form/shared/element-plus';
3
- import { defineComponent, computed, ref, watch, nextTick, resolveComponent, openBlock, createBlock, normalizeProps, guardReactiveProps, withCtx, mergeProps, toHandlers, createSlots, createElementBlock, Fragment, renderList, renderSlot, resolveDynamicComponent, createCommentVNode } from 'vue';
3
+ import { defineComponent, ref, watch, computed, 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
6
  import { useComputedReadonly } from '@vunk/form/composables';
@@ -32,6 +32,10 @@ const props = __spreadProps$1(__spreadValues$1(__spreadValues$1({}, _VkfFormItem
32
32
  selectSlots: {
33
33
  type: Object,
34
34
  default: void 0
35
+ },
36
+ optionsUrl: {
37
+ type: String,
38
+ default: ""
35
39
  }
36
40
  });
37
41
  const emits = __spreadValues$1({}, selectEmits);
@@ -68,9 +72,22 @@ var script = defineComponent({
68
72
  const formItemBindProps = _VkfFormItemCtx.createBindProps(props2);
69
73
  const selectBindProps = createSelectBindProps(props2, ["disabled"]);
70
74
  const selectOnEmits = createSelectOnEmits(emit);
75
+ const readonly = useComputedReadonly(props2);
76
+ const optionsFromUrl = ref([]);
77
+ watch(() => props2.optionsUrl, (url) => {
78
+ emit("update:modelValue", void 0);
79
+ if (url) {
80
+ fetch(url).then((res) => res.json()).then((data) => {
81
+ optionsFromUrl.value = data;
82
+ });
83
+ } else {
84
+ optionsFromUrl.value = [];
85
+ }
86
+ }, { immediate: true });
71
87
  const getKey = (item) => isPlainObject(item.value) ? item.value[selectBindProps.value.valueKey] : item.value;
72
88
  const selectOptions = computed(() => {
73
- return props2.options.reduce((a, c) => {
89
+ const options = optionsFromUrl.value.length ? optionsFromUrl.value : props2.options;
90
+ return options.reduce((a, c) => {
74
91
  const k = getKey(c);
75
92
  if (!k && k !== 0)
76
93
  return a;
@@ -88,7 +105,6 @@ var script = defineComponent({
88
105
  reshow.value = true;
89
106
  });
90
107
  });
91
- const readonly = useComputedReadonly(props2);
92
108
  return {
93
109
  formItemBindProps,
94
110
  selectBindProps,
@@ -69,6 +69,10 @@ export declare const props: {
69
69
  type: PropType<SelectSlots>;
70
70
  default: undefined;
71
71
  };
72
+ optionsUrl: {
73
+ type: StringConstructor;
74
+ default: string;
75
+ };
72
76
  name: StringConstructor;
73
77
  id: StringConstructor;
74
78
  modelValue: {
@@ -28,6 +28,10 @@ const props = __spreadProps(__spreadValues(__spreadValues({}, _VkfFormItemCtx.pr
28
28
  selectSlots: {
29
29
  type: Object,
30
30
  default: void 0
31
+ },
32
+ optionsUrl: {
33
+ type: String,
34
+ default: ""
31
35
  }
32
36
  });
33
37
  const emits = __spreadValues({}, selectEmits);
@@ -66,6 +66,10 @@ declare const _default: import("vue").DefineComponent<{
66
66
  type: import("vue").PropType<import("./types").SelectSlots>;
67
67
  default: undefined;
68
68
  };
69
+ optionsUrl: {
70
+ type: StringConstructor;
71
+ default: string;
72
+ };
69
73
  name: StringConstructor;
70
74
  id: StringConstructor;
71
75
  modelValue: {
@@ -391,6 +395,10 @@ declare const _default: import("vue").DefineComponent<{
391
395
  type: import("vue").PropType<import("./types").SelectSlots>;
392
396
  default: undefined;
393
397
  };
398
+ optionsUrl: {
399
+ type: StringConstructor;
400
+ default: string;
401
+ };
394
402
  name: StringConstructor;
395
403
  id: StringConstructor;
396
404
  modelValue: {
@@ -617,5 +625,6 @@ declare const _default: import("vue").DefineComponent<{
617
625
  created: boolean;
618
626
  }>>>[];
619
627
  selectSlots: import("./types").SelectSlots;
628
+ optionsUrl: string;
620
629
  }>;
621
630
  export default _default;
@@ -437,15 +437,15 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
437
437
  const _component_VkfFormItem = resolveComponent("VkfFormItem");
438
438
  return openBlock(), createBlock(_component_VkfFormItem, normalizeProps(guardReactiveProps(_ctx.formItemBindProps)), {
439
439
  default: withCtx(() => {
440
- var _a;
440
+ var _a, _b, _c;
441
441
  return [
442
442
  createVNode(_component_ElUpload, mergeProps({
443
443
  class: ["vkf-upload", {
444
444
  "is-readonly": _ctx.readonly,
445
- "is-empty": _ctx.fileList.length === 0
445
+ "is-empty": ((_a = _ctx.fileList) == null ? void 0 : _a.length) === 0
446
446
  }]
447
447
  }, _ctx.coreBindProps, {
448
- fileList: (_a = _ctx.fileList) != null ? _a : [],
448
+ fileList: (_b = _ctx.fileList) != null ? _b : [],
449
449
  "onUpdate:fileList": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:fileList", $event)),
450
450
  ref: "uploadRef",
451
451
  disabled: _ctx.readonly || _ctx.disabled
@@ -480,7 +480,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
480
480
  createElementVNode("span", {
481
481
  class: normalizeClass(["vkf-upload-empty-tip", {
482
482
  "is-readonly": _ctx.readonly,
483
- "is-empty": _ctx.fileList.length === 0
483
+ "is-empty": ((_c = _ctx.fileList) == null ? void 0 : _c.length) === 0
484
484
  }])
485
485
  }, "\u6682\u65E0", 2)
486
486
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vunk/form",
3
- "version": "0.0.1-alpha.35",
3
+ "version": "0.0.1-alpha.37",
4
4
  "description": "",
5
5
  "main": "index.esm.js",
6
6
  "scripts": {