@qin-ui/antd-vue-pro 2.0.8 → 2.0.10

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.
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  > 二次封装 ant-design-vue 组件,提供 ProForm 和 ProTable 高级组件。
4
4
 
5
+ ## [使用示例和文档详细内容](https://dufan3715.github.io/pro-components/)
6
+
5
7
  ---
6
8
 
7
9
  ## ✨ 特性
@@ -109,5 +111,3 @@ antd-vue-pro 导出了一个名为 `useTable` 的自定义 Hook,用于处理
109
111
  | button-bar | 自定义按钮组 |
110
112
  | toolbar | 自定义工具栏 |
111
113
  | table | 自定义表格 |
112
-
113
- ## [更多使用示例和文档详细内容](https://dufan3715.github.io/pro-components/)
@@ -28,12 +28,12 @@
28
28
  .control-icon[data-v-d8e78b5b] :hover {
29
29
  color: #1677ff;
30
30
  }
31
- .control-icon[data-v-88c80679] {
31
+ .control-icon[data-v-f75da747] {
32
32
  display: flex;
33
33
  align-items: center;
34
34
  cursor: pointer;
35
35
  }
36
- .control-icon[data-v-88c80679] :hover {
36
+ .control-icon[data-v-f75da747] :hover {
37
37
  color: #1677ff;
38
38
  }
39
39
  .pro-table .pro-table-header[data-v-eb2f3860] {
package/es/form/index.js CHANGED
@@ -15,7 +15,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
15
15
  },
16
16
  setup(__props) {
17
17
  const props = __props;
18
- provide(FORM, props.form);
18
+ provide(InjectionFormKey, props.form);
19
19
  const { formData, fields, setFormRef } = props.form;
20
20
  const config = INJECT_CONFIG["pro-form"];
21
21
  const { grid: _injectGrid, ...injectAttrs } = inject(
@@ -69,8 +69,8 @@ const COMPONENT_MAP = /* @__PURE__ */ new Map([
69
69
  ["transfer", Transfer]
70
70
  ]);
71
71
  const TeleportComponentNamePrefix = "TeleportComponent_";
72
- const FORM = Symbol("form");
73
- const PATH = Symbol("path");
72
+ const InjectionFormKey = Symbol("form");
73
+ const InjectionPathKey = Symbol("path");
74
74
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
75
75
  __name: "index",
76
76
  props: {
@@ -81,7 +81,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
81
81
  const namePath = computed(() => {
82
82
  return Array.isArray(props.path) ? props.path.join(".") : props.path;
83
83
  });
84
- provide(PATH, namePath);
84
+ provide(InjectionPathKey, namePath);
85
85
  return (_ctx, _cache) => {
86
86
  return renderSlot(_ctx.$slots, "default", { path: namePath.value });
87
87
  };
@@ -424,8 +424,13 @@ const useFields = (initFields) => {
424
424
  getParentField
425
425
  };
426
426
  };
427
- const useFormData = (initFormData = {}) => {
428
- const formData = reactive(initFormData);
427
+ const InjectionFormDataKey = Symbol("form-data");
428
+ const useFormData = (initFormData) => {
429
+ if (!initFormData) {
430
+ const injectFormDataStore = inject(InjectionFormDataKey, void 0);
431
+ if (injectFormDataStore) return injectFormDataStore;
432
+ }
433
+ const formData = reactive(initFormData ?? {});
429
434
  function getFormData(path) {
430
435
  if (!path) return void 0;
431
436
  return get(formData, path);
@@ -457,7 +462,9 @@ const useFormData = (initFormData = {}) => {
457
462
  Object.assign(formData, value);
458
463
  }
459
464
  }
460
- return { formData, getFormData, setFormData };
465
+ const formDataStore = { formData, getFormData, setFormData };
466
+ provide(InjectionFormDataKey, formDataStore);
467
+ return formDataStore;
461
468
  };
462
469
  const useFormRef = () => {
463
470
  const formRef = ref();
@@ -476,7 +483,7 @@ function useForm(...args) {
476
483
  root = args[2] ?? root;
477
484
  }
478
485
  if (!root) {
479
- const injectForm = inject(FORM);
486
+ const injectForm = inject(InjectionFormKey);
480
487
  if (injectForm) return injectForm;
481
488
  }
482
489
  return {
@@ -637,9 +644,9 @@ export {
637
644
  _sfc_main$3 as BaseFormItem,
638
645
  COMPONENT_MAP,
639
646
  _sfc_main$1 as ContainerFragment,
640
- FORM,
641
647
  FORM_ITEM_SLOT_KEYS,
642
- PATH,
648
+ InjectionFormKey,
649
+ InjectionPathKey,
643
650
  _sfc_main as SlotComponent,
644
651
  TeleportComponentNamePrefix,
645
652
  _sfc_main$6 as default,
package/es/index.d.ts CHANGED
@@ -253,95 +253,6 @@ export declare type ComponentVars = Partial<RequiredComponentVars>;
253
253
  */
254
254
  declare type CompSlot<T extends string> = Partial<Record<KeyExpandString<T>, SlotComponentType>>;
255
255
 
256
- /**
257
- * @type {CompType} 字段类型集合
258
- */
259
- export declare type CompType = {
260
- /** 文本框 */
261
- 'input': {
262
- component: 'input';
263
- slots?: InputSlots;
264
- } & InputProps;
265
- /** 文本域 */
266
- 'textarea': {
267
- component: 'textarea';
268
- slots?: InputSlots;
269
- } & TextAreaProps;
270
- /** 文本框-密码 */
271
- 'input-password': {
272
- component: 'input-password';
273
- slots?: InputSlots;
274
- } & InputProps;
275
- /** 文本框-搜索 */
276
- 'input-search': {
277
- component: 'input-search';
278
- slots?: InputSlots;
279
- } & InputProps;
280
- /** 数字文本框 */
281
- 'input-number': {
282
- component: 'input-number';
283
- slots?: InputNumberSlots;
284
- } & InputNumberProps;
285
- /** 下拉选择器 */
286
- 'select': {
287
- component: 'select';
288
- slots?: SelectSlots;
289
- } & SelectProps;
290
- /** 级联选择器 */
291
- 'cascader': {
292
- component: 'cascader';
293
- slots?: CascaderSlots;
294
- } & CascaderProps;
295
- /** 日期选择器 */
296
- 'date-picker': {
297
- component: 'date-picker';
298
- slots?: DatePickerSlots;
299
- } & DatePickerProps;
300
- /** 日期选择器-范围 */
301
- 'range-picker': {
302
- component: 'range-picker';
303
- slots?: RangePickerSlots;
304
- } & RangePickerProps;
305
- /** 时间选择器 */
306
- 'time-picker': {
307
- component: 'time-picker';
308
- slots?: TimePickerSlots;
309
- } & TimePickerProps;
310
- /** 复选框组 */
311
- 'checkbox-group': {
312
- component: 'checkbox-group';
313
- } & CheckboxGroupProps;
314
- /** 单选框组 */
315
- 'radio-group': {
316
- component: 'radio-group';
317
- } & RadioGroupProps;
318
- /** 开关 */
319
- 'switch': {
320
- component: 'switch';
321
- slots?: SwitchSlots;
322
- } & SwitchProps;
323
- /** 滑块 */
324
- 'slider': {
325
- component: 'slider';
326
- slots?: SliderSlots;
327
- } & SliderProps;
328
- /** 树形选择器 */
329
- 'tree-select': {
330
- component: 'tree-select';
331
- slots?: TreeSelectSlots;
332
- } & TreeSelectProps;
333
- /** 穿梭框 */
334
- 'transfer': {
335
- component: 'transfer';
336
- slots?: TransferSlots;
337
- } & TransferProps;
338
- /** 自定义组件 */
339
- 'custom': {
340
- component?: RenderComponentType | Raw<RenderComponentType>;
341
- slots?: Slots;
342
- } & Record<string, any>;
343
- };
344
-
345
256
  /**
346
257
  * @description 容器组件类型
347
258
  */
@@ -443,7 +354,11 @@ declare type ExtendWithAny<D> = {
443
354
  * @description 字段配置类型,包含所有字段属性和响应式支持
444
355
  * @template D - 数据对象类型
445
356
  */
446
- export declare type Field<D extends Data = Data> = WithRef<CompType[keyof CompType] & Omit<FormItemProps, 'label'> & ColProps & Base<D>>;
357
+ export declare type Field<D extends Data = Data> = {
358
+ [K in keyof FieldTypeMap]: {
359
+ component: K extends 'custom' ? FieldTypeMap<D>[K]['component'] : K;
360
+ } & FieldTypeMap<D>[K];
361
+ }[keyof FieldTypeMap];
447
362
 
448
363
  /**
449
364
  * @description 字段数组类型
@@ -451,12 +366,82 @@ export declare type Field<D extends Data = Data> = WithRef<CompType[keyof CompTy
451
366
  */
452
367
  export declare type Fields<D extends Data = Data> = Array<Field<D>>;
453
368
 
369
+ /**
370
+ * @type {FieldTypeMap} 字段类型集合
371
+ */
372
+ export declare type FieldTypeMap<D extends Data = Data> = {
373
+ /** 文本框 */
374
+ 'input': WithCommon<{
375
+ slots?: InputSlots;
376
+ } & InputProps, D>;
377
+ /** 文本域 */
378
+ 'textarea': WithCommon<{
379
+ slots?: InputSlots;
380
+ } & TextAreaProps, D>;
381
+ /** 文本框-密码 */
382
+ 'input-password': WithCommon<{
383
+ slots?: InputSlots;
384
+ } & InputProps, D>;
385
+ /** 文本框-搜索 */
386
+ 'input-search': WithCommon<{
387
+ slots?: InputSlots;
388
+ } & InputProps, D>;
389
+ /** 数字文本框 */
390
+ 'input-number': WithCommon<{
391
+ slots?: InputNumberSlots;
392
+ } & InputNumberProps, D>;
393
+ /** 下拉选择器 */
394
+ 'select': WithCommon<{
395
+ slots?: SelectSlots;
396
+ } & SelectProps, D>;
397
+ /** 级联选择器 */
398
+ 'cascader': WithCommon<{
399
+ slots?: CascaderSlots;
400
+ } & CascaderProps, D>;
401
+ /** 日期选择器 */
402
+ 'date-picker': WithCommon<{
403
+ slots?: DatePickerSlots;
404
+ } & DatePickerProps, D>;
405
+ /** 日期选择器-范围 */
406
+ 'range-picker': WithCommon<{
407
+ slots?: RangePickerSlots;
408
+ } & RangePickerProps, D>;
409
+ /** 时间选择器 */
410
+ 'time-picker': WithCommon<{
411
+ slots?: TimePickerSlots;
412
+ } & TimePickerProps, D>;
413
+ /** 复选框组 */
414
+ 'checkbox-group': WithCommon<CheckboxGroupProps, D>;
415
+ /** 单选框组 */
416
+ 'radio-group': WithCommon<RadioGroupProps, D>;
417
+ /** 开关 */
418
+ 'switch': WithCommon<{
419
+ slots?: SwitchSlots;
420
+ } & SwitchProps, D>;
421
+ /** 滑块 */
422
+ 'slider': WithCommon<{
423
+ slots?: SliderSlots;
424
+ } & SliderProps, D>;
425
+ /** 树形选择器 */
426
+ 'tree-select': WithCommon<{
427
+ slots?: TreeSelectSlots;
428
+ } & TreeSelectProps, D>;
429
+ /** 穿梭框 */
430
+ 'transfer': WithCommon<{
431
+ slots?: TransferSlots;
432
+ } & TransferProps, D>;
433
+ /** 自定义组件 */
434
+ 'custom': {
435
+ component?: RenderComponentType | Raw<RenderComponentType>;
436
+ } & WithCommon<{
437
+ slots?: Slots;
438
+ } & Record<string, any>, D>;
439
+ };
440
+
454
441
  declare type FindBy<D extends Data> = (field: Readonly<Field<D>>) => boolean;
455
442
 
456
443
  declare type FindBy_2<D extends Data> = (column: Readonly<Column<D>>) => boolean;
457
444
 
458
- export declare const FORM: InjectionKey<Form>;
459
-
460
445
  export declare type Form<D extends Data = Data> = ReturnType<typeof useFormData<D>> & ReturnType<typeof useFields<D>> & ReturnType<typeof useFormRef>;
461
446
 
462
447
  export declare const FORM_ITEM_SLOT_KEYS: readonly ["label", "extra", "help", "tooltip"];
@@ -480,6 +465,10 @@ export declare const INJECT_CONFIG: {
480
465
  };
481
466
  };
482
467
 
468
+ export declare const InjectionFormKey: InjectionKey<Form>;
469
+
470
+ export declare const InjectionPathKey: InjectionKey<ComputedRef<string | undefined>>;
471
+
483
472
  declare type InputNumberSlots = CompSlot<'addonAfter' | 'addonBefore' | 'prefix' | 'upIcon' | 'downIcon'>;
484
473
 
485
474
  declare type InputSlots = CompSlot<'addonAfter' | 'addonBefore' | 'clearIcon' | 'prefix' | 'suffix'>;
@@ -500,7 +489,7 @@ declare type MaybeRefOrComputedRef<T = any> = MaybeRef<T> | ComputedRef<T>;
500
489
  /**
501
490
  * @description 不支持响应式的属性名
502
491
  */
503
- declare type NotSupportedRefOrGetterProps = 'container' | 'componentContainer' | 'valueFormatter' | 'fields' | 'slots' | 'modelName';
492
+ declare type NotSupportedRefOrGetterProps = 'component' | 'container' | 'componentContainer' | 'valueFormatter' | 'fields' | 'slots' | 'modelName';
504
493
 
505
494
  declare type Option_2 = {
506
495
  label: string;
@@ -515,8 +504,6 @@ declare type PageParam = Required<Pick<PaginationProps, (typeof pageParamPropert
515
504
 
516
505
  declare const pageParamProperty: readonly ["current", "pageSize", "total"];
517
506
 
518
- export declare const PATH: InjectionKey<ComputedRef<string | undefined>>;
519
-
520
507
  declare type Path<D extends Data = Data> = KeyPathString<D>;
521
508
 
522
509
  export declare type PathProps = {
@@ -969,6 +956,8 @@ export declare type WithAdditionalMethodsGetter<T> = T & {
969
956
  }>;
970
957
  };
971
958
 
959
+ declare type WithCommon<T, D extends Data = Data> = WithRef<T & Omit<FormItemProps, 'label'> & ColProps & Base<D>>;
960
+
972
961
  /**
973
962
  * @description 为对象属性添加响应式支持的类型
974
963
  * @template T - 原始类型
package/es/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./antd-vue-pro.css";
2
2
  import _sfc_main from "./form/index.js";
3
- import { BaseField, BaseFormItem, COMPONENT_MAP, ContainerFragment, FORM, FORM_ITEM_SLOT_KEYS, PATH, SlotComponent, TeleportComponentNamePrefix, useFields, useForm, useFormData } from "./form/index.js";
3
+ import { BaseField, BaseFormItem, COMPONENT_MAP, ContainerFragment, FORM_ITEM_SLOT_KEYS, InjectionFormKey, InjectionPathKey, SlotComponent, TeleportComponentNamePrefix, useFields, useForm, useFormData } from "./form/index.js";
4
4
  import BaseTable from "./table/index.js";
5
5
  import { useTable } from "./table/index.js";
6
6
  import { _ as _sfc_main$1 } from "./component-provider/index-DXPHmG1H.js";
@@ -28,10 +28,10 @@ export {
28
28
  BaseFormItem,
29
29
  COMPONENT_MAP,
30
30
  ContainerFragment,
31
- FORM,
32
31
  FORM_ITEM_SLOT_KEYS,
33
32
  I as INJECT_CONFIG,
34
- PATH,
33
+ InjectionFormKey,
34
+ InjectionPathKey,
35
35
  ProComponentProvider,
36
36
  ProForm,
37
37
  ProTable,
package/es/table/index.js CHANGED
@@ -299,6 +299,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
299
299
  },
300
300
  setup(__props) {
301
301
  const props = __props;
302
+ const open = ref(false);
302
303
  const checkAll = ref(false);
303
304
  const indeterminate = ref(false);
304
305
  const checkedColumnsOptions = computed(
@@ -349,6 +350,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
349
350
  );
350
351
  return (_ctx, _cache) => {
351
352
  return openBlock(), createBlock(unref(Dropdown), {
353
+ open: open.value,
354
+ "onUpdate:open": _cache[1] || (_cache[1] = ($event) => open.value = $event),
352
355
  arrow: "",
353
356
  placement: "bottomRight"
354
357
  }, {
@@ -367,11 +370,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
367
370
  indeterminate: indeterminate.value,
368
371
  onChange: onCheckAllChange
369
372
  }, {
370
- default: withCtx(() => _cache[1] || (_cache[1] = [
373
+ default: withCtx(() => _cache[2] || (_cache[2] = [
371
374
  createTextVNode(" 全选 ", -1)
372
375
  ])),
373
376
  _: 1,
374
- __: [1]
377
+ __: [2]
375
378
  }, 8, ["checked", "indeterminate"])
376
379
  ])
377
380
  ]),
@@ -410,11 +413,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
410
413
  ])
411
414
  ]),
412
415
  _: 1
413
- });
416
+ }, 8, ["open"]);
414
417
  };
415
418
  }
416
419
  });
417
- const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-88c80679"]]);
420
+ const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-f75da747"]]);
418
421
  const _hoisted_1 = { class: "pro-table-header" };
419
422
  const _hoisted_2 = {
420
423
  key: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qin-ui/antd-vue-pro",
3
- "version": "2.0.8",
3
+ "version": "2.0.10",
4
4
  "description": "二次封装antd vue组件",
5
5
  "type": "module",
6
6
  "module": "es/index.js",