@qin-ui/element-plus-pro 1.0.3 → 1.0.5

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,7 @@
1
- import { inject, computed, provide, toValue, defineComponent, useAttrs, useSlots, watchEffect, createBlock, openBlock, unref, mergeProps, withModifiers, withCtx, createVNode, renderSlot, normalizeProps, guardReactiveProps, resolveComponent, createElementBlock, Fragment, renderList, createSlots, ref, createCommentVNode, resolveDynamicComponent, isVNode, createTextVNode, toDisplayString } from "vue";
2
- import { ElFormItem, ElCol, ElTable, ElPagination, useFormDisabled, ElForm, ElTransfer, ElTreeSelect, ElSlider, ElSwitch, ElRadioGroup, ElCheckboxGroup, ElTimeSelect, ElTimePicker, ElDatePicker, ElCascader, ElSelect, ElAutocomplete, ElInputNumber, ElInput, ElRow } from "element-plus";
3
- import { INJECT_CONFIG, getInjectConfig, INJECT_COMPONENTS } from "../component-provider/index.js";
4
- import { I as InjectionFormKey, c as camelizeProperties, a as InjectionPathKey, g as getObject, u as useForm$1, b as useFields$1, d as useFormRef$1 } from "../core/index-DVXUNE-L.js";
1
+ import { inject, computed, provide, toValue, defineComponent, renderSlot, mergeProps, normalizeProps, guardReactiveProps, resolveComponent, createBlock, openBlock, unref, withCtx, createElementBlock, Fragment, renderList, createVNode, createSlots, ref, useAttrs, createCommentVNode, resolveDynamicComponent, isVNode, createTextVNode, toDisplayString, useSlots, watchEffect, withModifiers } from "vue";
2
+ import { ElFormItem, ElCol, ElTable, ElPagination, useFormDisabled, ElTransfer, ElTreeSelect, ElSlider, ElSwitch, ElRadioGroup, ElCheckboxGroup, ElTimeSelect, ElTimePicker, ElDatePicker, ElCascader, ElSelect, ElAutocomplete, ElInputNumber, ElInput, ElRow, ElForm } from "element-plus";
3
+ import { I as INJECT_CONFIG, g as getInjectConfig, a as INJECT_COMPONENTS } from "../component-provider/index-Bmx9Q9Q-.js";
4
+ import { I as InjectionPathKey, g as getObject, u as useForm$1, a as InjectionFormKey, c as camelizeProperties, b as useFields$1, d as useFormRef$1 } from "../core/index-C0Pbv44C.js";
5
5
  import { i as isPlainObject, t as toPath, o as omit, c as cloneDeep } from "../vendor/utils/lodash-es-p6jau26B.js";
6
6
  const tableProps = () => ElTable.props || {};
7
7
  const paginationProps = () => ElPagination.props || {};
@@ -21,54 +21,6 @@ const useDisabledContextProvider = (disabled) => {
21
21
  computed(() => !!toValue(disabled))
22
22
  );
23
23
  };
24
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
25
- ...{ name: "ProForm", inheritAttrs: false },
26
- __name: "index",
27
- props: {
28
- grid: { type: [Boolean, Object], default: false },
29
- form: { default: () => ({}) }
30
- },
31
- setup(__props) {
32
- provide(InjectionFormKey, __props.form);
33
- const { formData, fields, setFormRef } = __props.form;
34
- const _fields = computed(() => fields.value);
35
- const config = INJECT_CONFIG["pro-form"];
36
- const attrs = useAttrs();
37
- const { grid: _injectGrid, ...injectAttrs } = inject(
38
- config.injectionKey,
39
- config.default
40
- );
41
- const slots = useSlots();
42
- watchEffect(() => {
43
- Object.keys(slots).forEach((name) => {
44
- if (name === "default") return;
45
- provide(`${TeleportComponentNamePrefix}${name}`, slots[name]);
46
- });
47
- });
48
- return (_ctx, _cache) => {
49
- return openBlock(), createBlock(unref(ElForm), mergeProps({
50
- ref: (el) => {
51
- var _a;
52
- return (_a = unref(setFormRef)) == null ? void 0 : _a(el);
53
- },
54
- model: unref(formData)
55
- }, mergeProps(injectAttrs, unref(camelizeProperties)(unref(attrs))), {
56
- class: "pro-form",
57
- onSubmit: _cache[0] || (_cache[0] = withModifiers(() => {
58
- }, ["prevent"]))
59
- }), {
60
- default: withCtx(() => [
61
- createVNode(unref(BaseFormItem), {
62
- fields: _fields.value,
63
- grid: __props.grid
64
- }, null, 8, ["fields", "grid"]),
65
- renderSlot(_ctx.$slots, "default")
66
- ]),
67
- _: 3
68
- }, 16, ["model"]);
69
- };
70
- }
71
- });
72
24
  const FORM_ITEM_SLOT_KEYS = ["label", "error"];
73
25
  const componentMap = {
74
26
  "input": ElInput,
@@ -87,7 +39,7 @@ const componentMap = {
87
39
  "transfer": ElTransfer
88
40
  };
89
41
  const TeleportComponentNamePrefix = "TeleportComponent_";
90
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
42
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
91
43
  __name: "index",
92
44
  props: {
93
45
  path: {}
@@ -103,7 +55,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
103
55
  };
104
56
  }
105
57
  });
106
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
58
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
107
59
  __name: "index",
108
60
  props: {
109
61
  field: {}
@@ -167,7 +119,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
167
119
  };
168
120
  }
169
121
  });
170
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
122
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
171
123
  ...{ name: "BaseFormItem", inheritAttrs: false },
172
124
  __name: "index",
173
125
  props: {
@@ -214,27 +166,27 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
214
166
  };
215
167
  return (_ctx, _cache) => {
216
168
  const _component_BaseFormItem = resolveComponent("BaseFormItem");
217
- return openBlock(), createBlock(unref(_sfc_main$1), mergeProps({
169
+ return openBlock(), createBlock(unref(_sfc_main$2), mergeProps({
218
170
  component: enableGrid.value ? unref(ElRow) : void 0
219
171
  }, computedGridProps.value, { style: { "width": "100%" } }), {
220
172
  default: withCtx(() => [
221
173
  (openBlock(true), createElementBlock(Fragment, null, renderList(validFields.value, ({ path: _path, ...field }, index) => {
222
- return openBlock(), createBlock(_sfc_main$5, mergeProps({
174
+ return openBlock(), createBlock(_sfc_main$6, mergeProps({
223
175
  key: unref(toPath)(toValue(_path ?? index)).join(".") || index
224
176
  }, { ref_for: true }, { path: _path }), {
225
177
  default: withCtx(({ path }) => [
226
- createVNode(_sfc_main$4, { field }, {
178
+ createVNode(_sfc_main$5, { field }, {
227
179
  default: withCtx(({
228
180
  gridItemProps: gridItemProps2,
229
181
  formItemProps: { container, ...formItemProps2 },
230
182
  componentProps,
231
183
  formItemSlots
232
184
  }) => [
233
- createVNode(unref(_sfc_main$1), mergeProps({
185
+ createVNode(unref(_sfc_main$2), mergeProps({
234
186
  component: enableGrid.value ? unref(ElCol) : void 0
235
187
  }, { ref_for: true }, gridItemProps2), {
236
188
  default: withCtx(() => [
237
- createVNode(unref(_sfc_main$1), {
189
+ createVNode(unref(_sfc_main$2), {
238
190
  component: container,
239
191
  path
240
192
  }, {
@@ -252,7 +204,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
252
204
  grid: field.grid ?? __props.grid,
253
205
  fields: field.fields,
254
206
  disabled: toValue(field.disabled)
255
- }, null, 8, ["grid", "fields", "disabled"])) : (openBlock(), createBlock(unref(_sfc_main$2), mergeProps({
207
+ }, null, 8, ["grid", "fields", "disabled"])) : (openBlock(), createBlock(unref(_sfc_main$3), mergeProps({
256
208
  key: 1,
257
209
  ref_for: true,
258
210
  ref: (el) => componentRefs[index] = el
@@ -267,7 +219,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
267
219
  return {
268
220
  name,
269
221
  fn: withCtx((scoped) => [
270
- createVNode(unref(_sfc_main), mergeProps({
222
+ createVNode(unref(_sfc_main$1), mergeProps({
271
223
  path,
272
224
  component: slot
273
225
  }, { ref_for: true }, scoped), null, 16, ["path", "component"])
@@ -301,7 +253,7 @@ const _export_sfc = (sfc, props) => {
301
253
  }
302
254
  return target;
303
255
  };
304
- const BaseFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-f9126ed0"]]);
256
+ const BaseFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-1dd9fcdd"]]);
305
257
  const useForm = useForm$1;
306
258
  const getInitProps = (field) => {
307
259
  const { component, type } = field;
@@ -314,7 +266,7 @@ const getInitProps = (field) => {
314
266
  }
315
267
  return {};
316
268
  };
317
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
269
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
318
270
  ...{ name: "BaseField", inheritAttrs: false },
319
271
  __name: "index",
320
272
  props: {
@@ -397,7 +349,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
397
349
  getComponentComputedProps: () => groupedAttrs.value.attrs
398
350
  });
399
351
  return (_ctx, _cache) => {
400
- return openBlock(), createBlock(unref(_sfc_main$1), {
352
+ return openBlock(), createBlock(unref(_sfc_main$2), {
401
353
  component: groupedAttrs.value.componentContainer,
402
354
  path: __props.path
403
355
  }, {
@@ -413,7 +365,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
413
365
  return {
414
366
  name,
415
367
  fn: withCtx((scoped) => [
416
- createVNode(unref(_sfc_main), mergeProps({ path: __props.path }, scoped, { component: slot }), null, 16, ["path", "component"])
368
+ createVNode(unref(_sfc_main$1), mergeProps({ path: __props.path }, scoped, { component: slot }), null, 16, ["path", "component"])
417
369
  ])
418
370
  };
419
371
  })
@@ -424,7 +376,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
424
376
  };
425
377
  }
426
378
  });
427
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
379
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
428
380
  ...{ name: "ContainerFragment", inheritAttrs: false },
429
381
  __name: "index",
430
382
  props: {
@@ -441,7 +393,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
441
393
  };
442
394
  }
443
395
  });
444
- const _sfc_main = /* @__PURE__ */ defineComponent({
396
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
445
397
  ...{ name: "SlotComponent", inheritAttrs: false },
446
398
  __name: "index",
447
399
  props: {
@@ -455,21 +407,63 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
455
407
  };
456
408
  }
457
409
  });
410
+ const _sfc_main = /* @__PURE__ */ defineComponent({
411
+ ...{ name: "ProForm", inheritAttrs: false },
412
+ __name: "index",
413
+ props: {
414
+ grid: { type: [Boolean, Object], default: false },
415
+ form: { default: () => ({}) }
416
+ },
417
+ setup(__props) {
418
+ provide(InjectionFormKey, __props.form);
419
+ const { formData, fields, setFormRef } = __props.form;
420
+ const _fields = computed(() => fields.value);
421
+ const config = INJECT_CONFIG["pro-form"];
422
+ const attrs = useAttrs();
423
+ const { grid: _injectGrid, ...injectAttrs } = inject(
424
+ config.injectionKey,
425
+ config.default
426
+ );
427
+ const slots = useSlots();
428
+ watchEffect(() => {
429
+ Object.keys(slots).forEach((name) => {
430
+ if (name === "default") return;
431
+ provide(`${TeleportComponentNamePrefix}${name}`, slots[name]);
432
+ });
433
+ });
434
+ return (_ctx, _cache) => {
435
+ return openBlock(), createBlock(unref(ElForm), mergeProps({
436
+ ref: (el) => {
437
+ var _a;
438
+ return (_a = unref(setFormRef)) == null ? void 0 : _a(el);
439
+ },
440
+ model: unref(formData)
441
+ }, mergeProps(injectAttrs, unref(camelizeProperties)(unref(attrs))), {
442
+ class: "pro-form",
443
+ onSubmit: _cache[0] || (_cache[0] = withModifiers(() => {
444
+ }, ["prevent"]))
445
+ }), {
446
+ default: withCtx(() => [
447
+ createVNode(unref(BaseFormItem), {
448
+ fields: _fields.value,
449
+ grid: __props.grid
450
+ }, null, 8, ["fields", "grid"]),
451
+ renderSlot(_ctx.$slots, "default")
452
+ ]),
453
+ _: 3
454
+ }, 16, ["model"]);
455
+ };
456
+ }
457
+ });
458
458
  const useFields = useFields$1;
459
459
  const useFormRef = useFormRef$1;
460
460
  export {
461
- BaseFormItem as B,
462
- FORM_ITEM_SLOT_KEYS as F,
463
- TeleportComponentNamePrefix as T,
464
461
  _export_sfc as _,
465
- _sfc_main$6 as a,
466
- _sfc_main$1 as b,
467
- _sfc_main$2 as c,
468
- _sfc_main as d,
469
- componentMap as e,
470
- useFields as f,
471
- useFormRef as g,
472
- getInitProps as h,
462
+ _sfc_main as a,
463
+ _sfc_main$2 as b,
464
+ _sfc_main$1 as c,
465
+ useFields as d,
466
+ useFormRef as e,
473
467
  paginationProps as p,
474
468
  tableProps as t,
475
469
  useForm as u
package/es/form/index.js CHANGED
@@ -1,20 +1,13 @@
1
- import { c, a, B, b, F, d, T, e, a as a2, h, f, u, g } from "./index-CWHWUZhj.js";
2
- import { I, a as a3, e as e2 } from "../core/index-DVXUNE-L.js";
1
+ import { b, c, a, d, u, e } from "./index-D8btGgqa.js";
2
+ import "vue";
3
+ import { e as e2 } from "../core/index-C0Pbv44C.js";
4
+ import "element-plus";
3
5
  export {
4
- c as BaseField,
5
- a as BaseForm,
6
- B as BaseFormItem,
7
6
  b as ContainerFragment,
8
- F as FORM_ITEM_SLOT_KEYS,
9
- I as InjectionFormKey,
10
- a3 as InjectionPathKey,
11
- d as SlotComponent,
12
- T as TeleportComponentNamePrefix,
13
- e as componentMap,
14
- a2 as default,
15
- h as getInitProps,
16
- f as useFields,
7
+ c as SlotComponent,
8
+ a as default,
9
+ d as useFields,
17
10
  u as useForm,
18
11
  e2 as useFormData,
19
- g as useFormRef
12
+ e as useFormRef
20
13
  };