@qin-ui/antd-vue-pro 2.1.9 → 2.1.11

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,5 +1,5 @@
1
- import { inject, camelize, reactive, provide, ref, toValue } from "vue";
2
- import { i as isPlainObject, c as cloneDeep, s as set, g as get, p as pick, t as toPath } from "../vendor/utils/lodash-es-p6jau26B.js";
1
+ import { inject, ref, reactive, provide, toValue, camelize } from "vue";
2
+ import { c as cloneDeep, i as isPlainObject, s as set, g as get, p as pick, t as toPath } from "../vendor/utils/lodash-es-p6jau26B.js";
3
3
  const InjectionFormKey = Symbol("form");
4
4
  const InjectionPathKey = Symbol("path");
5
5
  function getObject(val) {
@@ -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,
package/es/form/index.js CHANGED
@@ -1,56 +1,14 @@
1
- import { Form, Transfer, TreeSelect, Slider, Switch, RadioGroup, CheckboxGroup, TimePicker, RangePicker, DatePicker, Cascader, Select, InputNumber, InputPassword, InputSearch, Textarea, Input, Row, Col, FormItem } from "ant-design-vue";
1
+ import { Transfer, TreeSelect, Slider, Switch, RadioGroup, CheckboxGroup, TimePicker, RangePicker, DatePicker, Cascader, Select, InputNumber, InputPassword, InputSearch, Textarea, Input, Row, Col, FormItem, Form } from "ant-design-vue";
2
2
  import "ant-design-vue/es/table";
3
3
  import "ant-design-vue/es/config-provider/context";
4
4
  import { useProviderDisabled, useInjectDisabled } from "ant-design-vue/es/config-provider/DisabledContext";
5
5
  import { colProps } from "ant-design-vue/es/grid/Col";
6
6
  import { formItemProps, useInjectFormItemContext } from "ant-design-vue/es/form";
7
- import { defineComponent, provide, inject, useSlots, watchEffect, createBlock, openBlock, unref, mergeProps, withCtx, createVNode, renderSlot, computed, toValue, normalizeProps, guardReactiveProps, resolveComponent, createElementBlock, Fragment, renderList, createSlots, ref, useAttrs, createCommentVNode, resolveDynamicComponent, isVNode, createTextVNode, toDisplayString } from "vue";
8
- import { INJECT_CONFIG, getInjectConfig, INJECT_COMPONENTS } from "../component-provider/index.js";
9
- 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-C98RSrpN.js";
10
- import { e } from "../core/index-C98RSrpN.js";
7
+ import { defineComponent, computed, provide, renderSlot, inject, mergeProps, toValue, normalizeProps, guardReactiveProps, resolveComponent, createBlock, openBlock, unref, withCtx, createElementBlock, Fragment, renderList, createVNode, createSlots, ref, useAttrs, createCommentVNode, resolveDynamicComponent, isVNode, createTextVNode, toDisplayString, useSlots, watchEffect } from "vue";
8
+ import { I as INJECT_CONFIG, g as getInjectConfig, a as INJECT_COMPONENTS } from "../component-provider/index-Dmz32tSB.js";
9
+ 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-ghYuQ3Sy.js";
10
+ import { e } from "../core/index-ghYuQ3Sy.js";
11
11
  import { i as isPlainObject, t as toPath, o as omit, c as cloneDeep } from "../vendor/utils/lodash-es-p6jau26B.js";
12
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
13
- ...{ name: "ProForm", inheritAttrs: false },
14
- __name: "index",
15
- props: {
16
- grid: { type: [Boolean, Object], default: false },
17
- form: { default: () => ({}) }
18
- },
19
- setup(__props) {
20
- provide(InjectionFormKey, __props.form);
21
- const { formData, fields, setFormRef } = __props.form;
22
- const config = INJECT_CONFIG["pro-form"];
23
- const { grid: _injectGrid, ...injectAttrs } = inject(
24
- config.injectionKey,
25
- config.default
26
- );
27
- const slots = useSlots();
28
- watchEffect(() => {
29
- Object.keys(slots).forEach((name) => {
30
- if (name === "default") return;
31
- provide(`${TeleportComponentNamePrefix}${name}`, slots[name]);
32
- });
33
- });
34
- return (_ctx, _cache) => {
35
- return openBlock(), createBlock(unref(Form), mergeProps({
36
- ref: (el) => {
37
- var _a;
38
- return (_a = unref(setFormRef)) == null ? void 0 : _a(el);
39
- },
40
- model: unref(formData)
41
- }, mergeProps(injectAttrs, unref(camelizeProperties)(_ctx.$attrs)), { class: "pro-form" }), {
42
- default: withCtx(() => [
43
- createVNode(unref(_sfc_main$3), {
44
- fields: unref(fields),
45
- grid: __props.grid
46
- }, null, 8, ["fields", "grid"]),
47
- renderSlot(_ctx.$slots, "default")
48
- ]),
49
- _: 3
50
- }, 16, ["model"]);
51
- };
52
- }
53
- });
54
12
  const FORM_ITEM_SLOT_KEYS = [
55
13
  "label",
56
14
  "extra",
@@ -76,7 +34,7 @@ const componentMap = {
76
34
  "transfer": Transfer
77
35
  };
78
36
  const TeleportComponentNamePrefix = "TeleportComponent_";
79
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
37
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
80
38
  __name: "index",
81
39
  props: {
82
40
  path: {}
@@ -92,7 +50,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
92
50
  };
93
51
  }
94
52
  });
95
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
53
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
96
54
  __name: "index",
97
55
  props: {
98
56
  field: {}
@@ -157,7 +115,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
157
115
  };
158
116
  }
159
117
  });
160
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
118
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
161
119
  ...{ name: "BaseFormItem", inheritAttrs: false },
162
120
  __name: "index",
163
121
  props: {
@@ -204,27 +162,27 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
204
162
  };
205
163
  return (_ctx, _cache) => {
206
164
  const _component_BaseFormItem = resolveComponent("BaseFormItem");
207
- return openBlock(), createBlock(unref(_sfc_main$1), mergeProps({
165
+ return openBlock(), createBlock(unref(_sfc_main$2), mergeProps({
208
166
  component: enableGrid.value ? unref(Row) : void 0
209
167
  }, computedGridProps.value), {
210
168
  default: withCtx(() => [
211
169
  (openBlock(true), createElementBlock(Fragment, null, renderList(validFields.value, ({ path: _path, name: _name, ...field }, index) => {
212
- return openBlock(), createBlock(_sfc_main$5, mergeProps({
170
+ return openBlock(), createBlock(_sfc_main$6, mergeProps({
213
171
  key: unref(toPath)(toValue(_name ?? _path)).join(".") || index
214
172
  }, { ref_for: true }, { path: _name ?? _path }), {
215
173
  default: withCtx(({ path }) => [
216
- createVNode(_sfc_main$4, { field }, {
174
+ createVNode(_sfc_main$5, { field }, {
217
175
  default: withCtx(({
218
176
  gridItemProps,
219
177
  formItemProps: { formItemContainer, ...formItemProps2 },
220
178
  componentProps,
221
179
  formItemSlots
222
180
  }) => [
223
- createVNode(unref(_sfc_main$1), mergeProps({
181
+ createVNode(unref(_sfc_main$2), mergeProps({
224
182
  component: enableGrid.value ? unref(Col) : void 0
225
183
  }, { ref_for: true }, gridItemProps), {
226
184
  default: withCtx(() => [
227
- createVNode(unref(_sfc_main$1), {
185
+ createVNode(unref(_sfc_main$2), {
228
186
  component: formItemContainer,
229
187
  path
230
188
  }, {
@@ -242,7 +200,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
242
200
  grid: field.grid ?? __props.grid,
243
201
  fields: field.fields,
244
202
  disabled: toValue(field.disabled)
245
- }, null, 8, ["grid", "fields", "disabled"])) : (openBlock(), createBlock(unref(_sfc_main$2), mergeProps({
203
+ }, null, 8, ["grid", "fields", "disabled"])) : (openBlock(), createBlock(unref(_sfc_main$3), mergeProps({
246
204
  key: 1,
247
205
  ref_for: true,
248
206
  ref: (el) => componentRefs[index] = el
@@ -257,7 +215,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
257
215
  return {
258
216
  name,
259
217
  fn: withCtx((scoped) => [
260
- createVNode(unref(_sfc_main), mergeProps({
218
+ createVNode(unref(_sfc_main$1), mergeProps({
261
219
  path,
262
220
  component: slot
263
221
  }, { ref_for: true }, scoped), null, 16, ["path", "component"])
@@ -297,7 +255,7 @@ const getInitProps = (field) => {
297
255
  }
298
256
  return {};
299
257
  };
300
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
258
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
301
259
  ...{ name: "BaseField", inheritAttrs: false },
302
260
  __name: "index",
303
261
  props: {
@@ -380,7 +338,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
380
338
  getComponentComputedProps: () => groupedAttrs.value.attrs
381
339
  });
382
340
  return (_ctx, _cache) => {
383
- return openBlock(), createBlock(unref(_sfc_main$1), {
341
+ return openBlock(), createBlock(unref(_sfc_main$2), {
384
342
  component: groupedAttrs.value.componentContainer,
385
343
  path: __props.path
386
344
  }, {
@@ -396,7 +354,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
396
354
  return {
397
355
  name,
398
356
  fn: withCtx((scoped) => [
399
- createVNode(unref(_sfc_main), mergeProps({ path: __props.path }, scoped, { component: slot }), null, 16, ["path", "component"])
357
+ createVNode(unref(_sfc_main$1), mergeProps({ path: __props.path }, scoped, { component: slot }), null, 16, ["path", "component"])
400
358
  ])
401
359
  };
402
360
  })
@@ -407,7 +365,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
407
365
  };
408
366
  }
409
367
  });
410
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
368
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
411
369
  ...{ name: "ContainerFragment", inheritAttrs: false },
412
370
  __name: "index",
413
371
  props: {
@@ -424,7 +382,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
424
382
  };
425
383
  }
426
384
  });
427
- const _sfc_main = /* @__PURE__ */ defineComponent({
385
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
428
386
  ...{ name: "SlotComponent", inheritAttrs: false },
429
387
  __name: "index",
430
388
  props: {
@@ -438,21 +396,54 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
438
396
  };
439
397
  }
440
398
  });
399
+ const _sfc_main = /* @__PURE__ */ defineComponent({
400
+ ...{ name: "ProForm", inheritAttrs: false },
401
+ __name: "index",
402
+ props: {
403
+ grid: { type: [Boolean, Object], default: false },
404
+ form: { default: () => ({}) }
405
+ },
406
+ setup(__props) {
407
+ provide(InjectionFormKey, __props.form);
408
+ const { formData, fields, setFormRef } = __props.form;
409
+ const config = INJECT_CONFIG["pro-form"];
410
+ const { grid: _injectGrid, ...injectAttrs } = inject(
411
+ config.injectionKey,
412
+ config.default
413
+ );
414
+ const slots = useSlots();
415
+ watchEffect(() => {
416
+ Object.keys(slots).forEach((name) => {
417
+ if (name === "default") return;
418
+ provide(`${TeleportComponentNamePrefix}${name}`, slots[name]);
419
+ });
420
+ });
421
+ return (_ctx, _cache) => {
422
+ return openBlock(), createBlock(unref(Form), mergeProps({
423
+ ref: (el) => {
424
+ var _a;
425
+ return (_a = unref(setFormRef)) == null ? void 0 : _a(el);
426
+ },
427
+ model: unref(formData)
428
+ }, mergeProps(injectAttrs, unref(camelizeProperties)(_ctx.$attrs)), { class: "pro-form" }), {
429
+ default: withCtx(() => [
430
+ createVNode(unref(_sfc_main$4), {
431
+ fields: unref(fields),
432
+ grid: __props.grid
433
+ }, null, 8, ["fields", "grid"]),
434
+ renderSlot(_ctx.$slots, "default")
435
+ ]),
436
+ _: 3
437
+ }, 16, ["model"]);
438
+ };
439
+ }
440
+ });
441
441
  const useFields = useFields$1;
442
442
  const useFormRef = useFormRef$1;
443
443
  export {
444
- _sfc_main$2 as BaseField,
445
- _sfc_main$6 as BaseForm,
446
- _sfc_main$3 as BaseFormItem,
447
- _sfc_main$1 as ContainerFragment,
448
- FORM_ITEM_SLOT_KEYS,
449
- InjectionFormKey,
450
- InjectionPathKey,
451
- _sfc_main as SlotComponent,
452
- TeleportComponentNamePrefix,
453
- componentMap,
454
- _sfc_main$6 as default,
455
- getInitProps,
444
+ _sfc_main$2 as ContainerFragment,
445
+ _sfc_main$1 as SlotComponent,
446
+ _sfc_main as default,
456
447
  useFields,
457
448
  useForm,
458
449
  e as useFormData,