@qin-ui/antd-vue-pro 2.0.7 → 2.0.9

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.
@@ -36,17 +36,17 @@
36
36
  .control-icon[data-v-88c80679] :hover {
37
37
  color: #1677ff;
38
38
  }
39
- .pro-table .pro-table-header[data-v-a9d8c25c] {
39
+ .pro-table .pro-table-header[data-v-eb2f3860] {
40
40
  display: flex;
41
41
  align-items: center;
42
42
  justify-content: flex-end;
43
43
  }
44
- .pro-table .pro-table-header[data-v-a9d8c25c]:empty {
44
+ .pro-table .pro-table-header[data-v-eb2f3860]:empty {
45
45
  display: none;
46
46
  }
47
- .pro-table .pro-table-header + .pro-table-content[data-v-a9d8c25c] {
47
+ .pro-table .pro-table-header + .pro-table-content[data-v-eb2f3860] {
48
48
  margin-top: 16px;
49
49
  }
50
- .pro-table[data-v-a9d8c25c] .ant-pagination .ant-pagination-total-text {
50
+ .pro-table[data-v-eb2f3860] .ant-pagination .ant-pagination-total-text {
51
51
  flex: 1;
52
52
  }
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
@@ -365,96 +365,7 @@ export default _default;
365
365
  declare const _default_2: <T extends Table<any> = Table>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
366
366
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, never> & ({
367
367
  table?: T;
368
- search?: (params: T["searchForm"]["formData"] & Required<Pick<Partial<ExtractPropTypes< {
369
- total: NumberConstructor;
370
- defaultCurrent: NumberConstructor;
371
- disabled: {
372
- type: BooleanConstructor;
373
- default: boolean;
374
- };
375
- current: NumberConstructor;
376
- defaultPageSize: NumberConstructor;
377
- pageSize: NumberConstructor;
378
- hideOnSinglePage: {
379
- type: BooleanConstructor;
380
- default: boolean;
381
- };
382
- showSizeChanger: {
383
- type: BooleanConstructor;
384
- default: boolean;
385
- };
386
- pageSizeOptions: {
387
- type: PropType<(string | number)[]>;
388
- default: (string | number)[];
389
- };
390
- buildOptionText: {
391
- type: PropType<(opt: {
392
- value: any;
393
- }) => any>;
394
- default: (opt: {
395
- value: any;
396
- }) => any;
397
- };
398
- showQuickJumper: {
399
- type: PropType<boolean | {
400
- goButton?: any;
401
- }>;
402
- default: boolean | {
403
- goButton?: any;
404
- };
405
- };
406
- showTotal: {
407
- type: PropType<(total: number, range: [number, number]) => any>;
408
- default: (total: number, range: [number, number]) => any;
409
- };
410
- size: {
411
- type: PropType<"default" | "small">;
412
- default: "default" | "small";
413
- };
414
- simple: {
415
- type: BooleanConstructor;
416
- default: boolean;
417
- };
418
- locale: ObjectConstructor;
419
- prefixCls: StringConstructor;
420
- selectPrefixCls: StringConstructor;
421
- totalBoundaryShowSizeChanger: NumberConstructor;
422
- selectComponentClass: StringConstructor;
423
- itemRender: {
424
- type: PropType<(opt: {
425
- page: number;
426
- type: "page" | "prev" | "next" | "jump-prev" | "jump-next";
427
- originalElement: any;
428
- }) => any>;
429
- default: (opt: {
430
- page: number;
431
- type: "page" | "prev" | "next" | "jump-prev" | "jump-next";
432
- originalElement: any;
433
- }) => any;
434
- };
435
- role: StringConstructor;
436
- responsive: BooleanConstructor;
437
- showLessItems: {
438
- type: BooleanConstructor;
439
- default: boolean;
440
- };
441
- onChange: {
442
- type: PropType<(page: number, pageSize: number) => void>;
443
- default: (page: number, pageSize: number) => void;
444
- };
445
- onShowSizeChange: {
446
- type: PropType<(current: number, size: number) => void>;
447
- default: (current: number, size: number) => void;
448
- };
449
- 'onUpdate:current': {
450
- type: PropType<(current: number) => void>;
451
- default: (current: number) => void;
452
- };
453
- 'onUpdate:pageSize': {
454
- type: PropType<(size: number) => void>;
455
- default: (size: number) => void;
456
- };
457
- }>>, "current" | "pageSize">>) => Promise<unknown>;
368
+ search?: () => Promise<unknown>;
458
369
  addIndexColumn?: boolean;
459
370
  immediateSearch?: boolean;
460
371
  control?: boolean | Partial<{
@@ -544,8 +455,6 @@ declare type FindBy<D extends Data> = (field: Readonly<Field<D>>) => boolean;
544
455
 
545
456
  declare type FindBy_2<D extends Data> = (column: Readonly<Column<D>>) => boolean;
546
457
 
547
- export declare const FORM: InjectionKey<Form>;
548
-
549
458
  export declare type Form<D extends Data = Data> = ReturnType<typeof useFormData<D>> & ReturnType<typeof useFields<D>> & ReturnType<typeof useFormRef>;
550
459
 
551
460
  export declare const FORM_ITEM_SLOT_KEYS: readonly ["label", "extra", "help", "tooltip"];
@@ -569,6 +478,10 @@ export declare const INJECT_CONFIG: {
569
478
  };
570
479
  };
571
480
 
481
+ export declare const InjectionFormKey: InjectionKey<Form>;
482
+
483
+ export declare const InjectionPathKey: InjectionKey<ComputedRef<string | undefined>>;
484
+
572
485
  declare type InputNumberSlots = CompSlot<'addonAfter' | 'addonBefore' | 'prefix' | 'upIcon' | 'downIcon'>;
573
486
 
574
487
  declare type InputSlots = CompSlot<'addonAfter' | 'addonBefore' | 'clearIcon' | 'prefix' | 'suffix'>;
@@ -604,8 +517,6 @@ declare type PageParam = Required<Pick<PaginationProps, (typeof pageParamPropert
604
517
 
605
518
  declare const pageParamProperty: readonly ["current", "pageSize", "total"];
606
519
 
607
- export declare const PATH: InjectionKey<ComputedRef<string | undefined>>;
608
-
609
520
  declare type Path<D extends Data = Data> = KeyPathString<D>;
610
521
 
611
522
  export declare type PathProps = {
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
@@ -466,11 +466,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
466
466
  const loading = useModel(attrs, "loading");
467
467
  const _search = async () => {
468
468
  var _a;
469
- const { current = 0, pageSize = 0 } = pageParam || {};
470
- const param = { ...searchForm == null ? void 0 : searchForm.formData, current, pageSize };
471
469
  try {
472
470
  loading.value = true;
473
- await ((_a = props.search) == null ? void 0 : _a.call(props, param));
471
+ await ((_a = props.search) == null ? void 0 : _a.call(props));
474
472
  } finally {
475
473
  loading.value = false;
476
474
  }
@@ -622,7 +620,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
622
620
  };
623
621
  }
624
622
  });
625
- const BaseTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a9d8c25c"]]);
623
+ const BaseTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-eb2f3860"]]);
626
624
  const getDefaultPageParam = () => ({ current: 1, pageSize: 10, total: 0 });
627
625
  const pageParamProperty = ["current", "pageSize", "total"];
628
626
  const useTable = (params) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qin-ui/antd-vue-pro",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "description": "二次封装antd vue组件",
5
5
  "type": "module",
6
6
  "module": "es/index.js",