@qin-ui/element-plus-pro 1.0.2 → 1.0.4

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,4 +1,4 @@
1
- import { inject, camelize, reactive, provide, ref, toValue } from "vue";
1
+ import { inject, ref, reactive, provide, camelize, toValue } from "vue";
2
2
  import { i as isPlainObject, s as set, g as get, c as cloneDeep, t as toPath, p as pick } from "../vendor/utils/lodash-es-p6jau26B.js";
3
3
  const InjectionFormKey = Symbol("form");
4
4
  const InjectionPathKey = Symbol("path");
@@ -109,23 +109,6 @@ const useFields = (initFields) => {
109
109
  options
110
110
  );
111
111
  }
112
- function addFields(path, newFields, options, placement) {
113
- if (newFields.length === 0) return;
114
- if (path) {
115
- updaterMatch(
116
- path,
117
- ({ fieldIndex, parentField }) => {
118
- const index = placement === "after" ? fieldIndex + 1 : fieldIndex;
119
- parentField.fields.splice(index, 0, ...newFields);
120
- },
121
- options
122
- );
123
- } else if (placement === "after") {
124
- fields.value.push(...newFields);
125
- } else {
126
- fields.value.unshift(...newFields);
127
- }
128
- }
129
112
  function appendField(path, field, options) {
130
113
  const newFields = Array.isArray(field) ? field : [field];
131
114
  addFields(path, newFields, options, "after");
@@ -146,6 +129,23 @@ const useFields = (initFields) => {
146
129
  );
147
130
  return (options == null ? void 0 : options.all) ? res : res[0];
148
131
  }
132
+ function addFields(path, newFields, options, placement) {
133
+ if (newFields.length === 0) return;
134
+ if (path) {
135
+ updaterMatch(
136
+ path,
137
+ ({ fieldIndex, parentField }) => {
138
+ const index = placement === "after" ? fieldIndex + 1 : fieldIndex;
139
+ parentField.fields.splice(index, 0, ...newFields);
140
+ },
141
+ options
142
+ );
143
+ } else if (placement === "after") {
144
+ fields.value.push(...newFields);
145
+ } else {
146
+ fields.value.unshift(...newFields);
147
+ }
148
+ }
149
149
  return {
150
150
  fields,
151
151
  getField,
@@ -309,6 +309,14 @@ const useTable = (params) => {
309
309
  options
310
310
  );
311
311
  }
312
+ function appendColumn(path, column, options) {
313
+ const newColumns = Array.isArray(column) ? column : [column];
314
+ addColumns(path, newColumns, options, "after");
315
+ }
316
+ function prependColumn(path, column, options) {
317
+ const newColumns = Array.isArray(column) ? column : [column];
318
+ addColumns(path, newColumns, options, "before");
319
+ }
312
320
  function addColumns(path, newColumns, options, placement) {
313
321
  if (newColumns.length === 0) return;
314
322
  if (path) {
@@ -326,14 +334,6 @@ const useTable = (params) => {
326
334
  columns.value.unshift(...newColumns);
327
335
  }
328
336
  }
329
- function appendColumn(path, column, options) {
330
- const newColumns = Array.isArray(column) ? column : [column];
331
- addColumns(path, newColumns, options, "after");
332
- }
333
- function prependColumn(path, column, options) {
334
- const newColumns = Array.isArray(column) ? column : [column];
335
- addColumns(path, newColumns, options, "before");
336
- }
337
337
  return {
338
338
  columns,
339
339
  dataSource,
@@ -348,8 +348,8 @@ const useTable = (params) => {
348
348
  };
349
349
  };
350
350
  export {
351
- InjectionFormKey as I,
352
- InjectionPathKey as a,
351
+ InjectionPathKey as I,
352
+ InjectionFormKey as a,
353
353
  useFields as b,
354
354
  camelizeProperties as c,
355
355
  useFormRef as d,
@@ -1,4 +1,4 @@
1
- [class*='-form-item'] [class*='-form-item'][data-v-f9126ed0] {
1
+ [class*='-form-item'] [class*='-form-item'][data-v-1dd9fcdd] {
2
2
  margin-bottom: 18px;
3
3
  }
4
4
  .pro-table_search-form[data-v-f615ff61] [class*='-form-item'] {
@@ -43,24 +43,24 @@
43
43
  .pro-table_column-control_button[data-v-ce445821] svg {
44
44
  transform: scale(1.2, 1.4);
45
45
  }
46
- .pro-table_header[data-v-890fd0f5] {
46
+ .pro-table_header[data-v-939fc661] {
47
47
  display: flex;
48
48
  align-items: center;
49
49
  justify-content: flex-end;
50
50
  }
51
- .pro-table_header[data-v-890fd0f5]:empty {
51
+ .pro-table_header[data-v-939fc661]:empty {
52
52
  display: none;
53
53
  }
54
- .pro-table_header + .pro-table_header_content[data-v-890fd0f5] {
54
+ .pro-table_header + .pro-table_header_content[data-v-939fc661] {
55
55
  margin-top: 16px;
56
56
  }
57
- .pro-table_header_button-bar[data-v-890fd0f5] {
57
+ .pro-table_header_button-bar[data-v-939fc661] {
58
58
  flex: 1;
59
59
  }
60
- .pro-table_header_toolbar[data-v-890fd0f5] {
60
+ .pro-table_header_toolbar[data-v-939fc661] {
61
61
  margin-left: 12px;
62
62
  }
63
- .pro-table_pagination[data-v-890fd0f5] {
63
+ .pro-table_pagination[data-v-939fc661] {
64
64
  justify-content: flex-end;
65
65
  padding: 16px 0;
66
66
  }
@@ -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
  };