@qin-ui/antdv-next-pro 1.0.4 → 1.1.0

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
@@ -135,19 +135,28 @@ const form = useForm<FormData>({}, [
135
135
 
136
136
  #### 注册可复用自定义组件
137
137
 
138
- ```ts
139
- import { registerComponent } from '@qin-ui/antdv-next-pro';
138
+ ```vue
139
+ <script setup lang="ts">
140
+ import { ProComponentProvider } from '@qin-ui/antdv-next-pro';
140
141
  import MyRateComponent from './MyRate.vue';
141
142
 
142
- // 注册后在 schema 中即可使用字符串引用
143
- registerComponent('my-rate', MyRateComponent);
143
+ const componentMap = {
144
+ 'my-rate': MyRateComponent,
145
+ };
146
+ </script>
147
+
148
+ <template>
149
+ <ProComponentProvider :component-map="componentMap">
150
+ <RouterView />
151
+ </ProComponentProvider>
152
+ </template>
144
153
  ```
145
154
 
146
155
  配合 TypeScript 模块扩充获得完整类型提示:
147
156
 
148
157
  ```ts
149
158
  declare module '@qin-ui/antdv-next-pro' {
150
- interface CustomFieldTypeMap {
159
+ interface ComponentMap {
151
160
  'my-rate': typeof MyRateComponent;
152
161
  }
153
162
  }
@@ -1,5 +1,171 @@
1
- import { a, _ } from "./index-DcaBbsiC.js";
1
+ import { defineComponent, provide, renderSlot } from "vue";
2
+ import { g as getObject } from "../core/index-BrBzu6aj.js";
3
+ const getPopupContainer = (triggerNode) => triggerNode.closest(".ant-form");
4
+ const INJECT_CONFIG = {
5
+ "pro-table": {
6
+ injectionKey: Symbol(""),
7
+ default: {
8
+ pagination: {
9
+ showTotal: (total) => `共 ${total} 条`,
10
+ showSizeChanger: true,
11
+ pageSizeOptions: ["10", "20", "30", "40", "50", "100"],
12
+ showQuickJumper: true
13
+ },
14
+ searchFormConfig: {
15
+ layout: "grid",
16
+ expand: { minExpandRows: 2, expandStatus: false }
17
+ },
18
+ control: true,
19
+ addIndexColumn: true
20
+ }
21
+ },
22
+ "pro-form": {
23
+ injectionKey: Symbol(""),
24
+ default: { grid: { gutter: { xs: 8, sm: 16, md: 16, lg: 24 } } }
25
+ },
26
+ "pro-form-item": {
27
+ injectionKey: Symbol(""),
28
+ default: { validateFirst: true, span: 8 }
29
+ },
30
+ // field
31
+ input: {
32
+ injectionKey: Symbol(""),
33
+ default: { maxlength: 100, allowClear: true, placeholder: "请输入" }
34
+ },
35
+ textarea: {
36
+ injectionKey: Symbol(""),
37
+ default: {
38
+ maxlength: 200,
39
+ autoSize: { minRows: 3, maxRows: 6 },
40
+ showCount: true,
41
+ allowClear: true,
42
+ placeholder: "请输入"
43
+ }
44
+ },
45
+ "input-password": {
46
+ injectionKey: Symbol(""),
47
+ default: { maxlength: 100, allowClear: true, placeholder: "请输入" }
48
+ },
49
+ "input-search": {
50
+ injectionKey: Symbol(""),
51
+ default: {}
52
+ },
53
+ "input-number": {
54
+ injectionKey: Symbol(""),
55
+ default: {
56
+ max: 10 ** 15 - 1,
57
+ min: -1000000000000001,
58
+ controls: false,
59
+ placeholder: "请输入",
60
+ style: { width: "100%" }
61
+ }
62
+ },
63
+ "input-otp": {
64
+ injectionKey: Symbol(""),
65
+ default: {}
66
+ },
67
+ "auto-complete": {
68
+ injectionKey: Symbol(""),
69
+ default: { allowClear: true, placeholder: "请选择", getPopupContainer }
70
+ },
71
+ select: {
72
+ injectionKey: Symbol(""),
73
+ default: { allowClear: true, placeholder: "请选择", getPopupContainer }
74
+ },
75
+ cascader: {
76
+ injectionKey: Symbol(""),
77
+ default: { allowClear: true, placeholder: "请选择", getPopupContainer }
78
+ },
79
+ "date-picker": {
80
+ injectionKey: Symbol(""),
81
+ default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
82
+ },
83
+ "date-picker.date": {
84
+ injectionKey: Symbol(""),
85
+ default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
86
+ },
87
+ "date-picker.week": {
88
+ injectionKey: Symbol(""),
89
+ default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
90
+ },
91
+ "date-picker.month": {
92
+ injectionKey: Symbol(""),
93
+ default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
94
+ },
95
+ "date-picker.year": {
96
+ injectionKey: Symbol(""),
97
+ default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
98
+ },
99
+ "date-picker.quarter": {
100
+ injectionKey: Symbol(""),
101
+ default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
102
+ },
103
+ "range-picker": {
104
+ injectionKey: Symbol(""),
105
+ default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
106
+ },
107
+ "time-picker": {
108
+ injectionKey: Symbol(""),
109
+ default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
110
+ },
111
+ "time-range-picker": {
112
+ injectionKey: Symbol(""),
113
+ default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
114
+ },
115
+ "checkbox-group": {
116
+ injectionKey: Symbol(""),
117
+ default: {}
118
+ },
119
+ "radio-group": {
120
+ injectionKey: Symbol(""),
121
+ default: {}
122
+ },
123
+ switch: {
124
+ injectionKey: Symbol(""),
125
+ default: { modelProp: "checked" }
126
+ },
127
+ slider: {
128
+ injectionKey: Symbol(""),
129
+ default: {}
130
+ },
131
+ "tree-select": {
132
+ injectionKey: Symbol(""),
133
+ default: {}
134
+ },
135
+ transfer: {
136
+ injectionKey: Symbol(""),
137
+ default: {}
138
+ }
139
+ };
140
+ const INJECT_COMPONENTS = Symbol("INJECT_COMPONENTS");
141
+ const _sfc_main = /* @__PURE__ */ defineComponent({
142
+ ...{
143
+ inheritAttrs: false
144
+ },
145
+ __name: "index",
146
+ props: {
147
+ componentVars: {},
148
+ componentMap: {}
149
+ },
150
+ setup(__props) {
151
+ const props = __props;
152
+ if (props.componentVars) {
153
+ Object.entries(props.componentVars).forEach(([key, val]) => {
154
+ const config = INJECT_CONFIG[key];
155
+ if (!config) return;
156
+ provide(config.injectionKey, { ...config.default, ...getObject(val) });
157
+ });
158
+ }
159
+ if (props.componentMap) {
160
+ provide(INJECT_COMPONENTS, props.componentMap);
161
+ }
162
+ return (_ctx, _cache) => {
163
+ return renderSlot(_ctx.$slots, "default");
164
+ };
165
+ }
166
+ });
2
167
  export {
3
- a as INJECT_CONFIG,
4
- _ as default
168
+ INJECT_COMPONENTS,
169
+ INJECT_CONFIG,
170
+ _sfc_main as default
5
171
  };
@@ -1,142 +1,5 @@
1
- import { inject, camelize, reactive, provide, ref, toValue, defineComponent, renderSlot } from "vue";
1
+ import { inject, camelize, reactive, provide, ref, toValue } from "vue";
2
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";
3
- const getPopupContainer = (triggerNode) => triggerNode.closest(".ant-form");
4
- const INJECT_CONFIG = {
5
- "pro-table": {
6
- injectionKey: Symbol(""),
7
- default: {
8
- pagination: {
9
- showTotal: (total) => `共 ${total} 条`,
10
- showSizeChanger: true,
11
- pageSizeOptions: ["10", "20", "30", "40", "50", "100"],
12
- showQuickJumper: true
13
- },
14
- searchFormConfig: {
15
- layout: "grid",
16
- expand: { minExpandRows: 2, expandStatus: false }
17
- },
18
- control: true,
19
- addIndexColumn: true
20
- }
21
- },
22
- "pro-form": {
23
- injectionKey: Symbol(""),
24
- default: { grid: { gutter: { xs: 8, sm: 16, md: 16, lg: 24 } } }
25
- },
26
- "pro-form-item": {
27
- injectionKey: Symbol(""),
28
- default: { validateFirst: true, span: 8 }
29
- },
30
- // field
31
- input: {
32
- injectionKey: Symbol(""),
33
- default: { maxlength: 100, allowClear: true, placeholder: "请输入" }
34
- },
35
- textarea: {
36
- injectionKey: Symbol(""),
37
- default: {
38
- maxlength: 200,
39
- autoSize: { minRows: 3, maxRows: 6 },
40
- showCount: true,
41
- allowClear: true,
42
- placeholder: "请输入"
43
- }
44
- },
45
- "input-password": {
46
- injectionKey: Symbol(""),
47
- default: { maxlength: 100, allowClear: true, placeholder: "请输入" }
48
- },
49
- "input-search": {
50
- injectionKey: Symbol(""),
51
- default: {}
52
- },
53
- "input-number": {
54
- injectionKey: Symbol(""),
55
- default: {
56
- max: 10 ** 15 - 1,
57
- min: -1000000000000001,
58
- controls: false,
59
- placeholder: "请输入",
60
- style: { width: "100%" }
61
- }
62
- },
63
- "input-otp": {
64
- injectionKey: Symbol(""),
65
- default: {}
66
- },
67
- "auto-complete": {
68
- injectionKey: Symbol(""),
69
- default: { allowClear: true, placeholder: "请选择", getPopupContainer }
70
- },
71
- select: {
72
- injectionKey: Symbol(""),
73
- default: { allowClear: true, placeholder: "请选择", getPopupContainer }
74
- },
75
- cascader: {
76
- injectionKey: Symbol(""),
77
- default: { allowClear: true, placeholder: "请选择", getPopupContainer }
78
- },
79
- "date-picker": {
80
- injectionKey: Symbol(""),
81
- default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
82
- },
83
- "date-picker.date": {
84
- injectionKey: Symbol(""),
85
- default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
86
- },
87
- "date-picker.week": {
88
- injectionKey: Symbol(""),
89
- default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
90
- },
91
- "date-picker.month": {
92
- injectionKey: Symbol(""),
93
- default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
94
- },
95
- "date-picker.year": {
96
- injectionKey: Symbol(""),
97
- default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
98
- },
99
- "date-picker.quarter": {
100
- injectionKey: Symbol(""),
101
- default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
102
- },
103
- "range-picker": {
104
- injectionKey: Symbol(""),
105
- default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
106
- },
107
- "time-picker": {
108
- injectionKey: Symbol(""),
109
- default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
110
- },
111
- "time-range-picker": {
112
- injectionKey: Symbol(""),
113
- default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
114
- },
115
- "checkbox-group": {
116
- injectionKey: Symbol(""),
117
- default: {}
118
- },
119
- "radio-group": {
120
- injectionKey: Symbol(""),
121
- default: {}
122
- },
123
- switch: {
124
- injectionKey: Symbol(""),
125
- default: { modelProp: "checked" }
126
- },
127
- slider: {
128
- injectionKey: Symbol(""),
129
- default: {}
130
- },
131
- "tree-select": {
132
- injectionKey: Symbol(""),
133
- default: {}
134
- },
135
- transfer: {
136
- injectionKey: Symbol(""),
137
- default: {}
138
- }
139
- };
140
3
  const InjectionFormKey = Symbol("form");
141
4
  const InjectionPathKey = Symbol("path");
142
5
  function getObject(val) {
@@ -486,38 +349,14 @@ const useTable = (params) => {
486
349
  resetQueryParams
487
350
  };
488
351
  };
489
- const _sfc_main = /* @__PURE__ */ defineComponent({
490
- ...{
491
- inheritAttrs: false
492
- },
493
- __name: "index",
494
- props: {
495
- componentVars: {}
496
- },
497
- setup(__props) {
498
- const props = __props;
499
- if (props.componentVars) {
500
- Object.entries(props.componentVars).forEach(([key, val]) => {
501
- const config = INJECT_CONFIG[key];
502
- if (!config) return;
503
- provide(config.injectionKey, { ...config.default, ...getObject(val) });
504
- });
505
- }
506
- return (_ctx, _cache) => {
507
- return renderSlot(_ctx.$slots, "default");
508
- };
509
- }
510
- });
511
352
  export {
512
353
  InjectionFormKey as I,
513
- _sfc_main as _,
514
- INJECT_CONFIG as a,
515
- InjectionPathKey as b,
354
+ InjectionPathKey as a,
355
+ useFields as b,
516
356
  camelizeProperties as c,
517
- useFields as d,
518
- useFormRef as e,
519
- useFormData as f,
357
+ useFormRef as d,
358
+ useFormData as e,
359
+ useTable as f,
520
360
  getObject as g,
521
- useTable as h,
522
361
  useForm as u
523
362
  };
@@ -1,7 +1,8 @@
1
1
  import { defineComponent, provide, computed, inject, useSlots, watchEffect, createBlock, openBlock, unref, mergeProps, withCtx, createVNode, renderSlot, toValue, normalizeProps, guardReactiveProps, resolveComponent, createElementBlock, Fragment, renderList, createSlots, ref, useAttrs, createCommentVNode, resolveDynamicComponent, isVNode, createTextVNode, toDisplayString } from "vue";
2
- import { FormItem, Col, Table, Form, Input, TextArea, InputSearch, InputPassword, InputNumber, InputOTP, AutoComplete, Select, Cascader, DatePicker, DateRangePicker, TimePicker, TimeRangePicker, CheckboxGroup, RadioGroup, Switch, Slider, TreeSelect, Transfer, Row } from "antdv-next";
2
+ import { FormItem, Col, Table, Form, Transfer, TreeSelect, Slider, Switch, RadioGroup, CheckboxGroup, TimeRangePicker, TimePicker, DateRangePicker, DatePicker, Cascader, Select, AutoComplete, InputOTP, InputNumber, InputPassword, InputSearch, TextArea, Input, Row } from "antdv-next";
3
3
  import { useDisabledContextProvider, useDisabledContext } from "antdv-next/dist/config-provider/DisabledContext";
4
- import { I as InjectionFormKey, a as INJECT_CONFIG, c as camelizeProperties, b as InjectionPathKey, g as getObject, u as useForm$1, d as useFields$1, e as useFormRef$1 } from "../component-provider/index-DcaBbsiC.js";
4
+ import { INJECT_CONFIG, INJECT_COMPONENTS } from "../component-provider/index.js";
5
+ 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-BrBzu6aj.js";
5
6
  import { i as isPlainObject, t as toPath, o as omit, c as cloneDeep } from "../vendor/utils/lodash-es-p6jau26B.js";
6
7
  const tableProps = () => Table.props || {};
7
8
  const gridItemProps = () => Col.props || {};
@@ -50,29 +51,26 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
50
51
  }
51
52
  });
52
53
  const FORM_ITEM_SLOT_KEYS = ["label", "extra", "help", "tooltip"];
53
- const COMPONENT_MAP = /* @__PURE__ */ new Map([
54
- ["input", Input],
55
- ["textarea", TextArea],
56
- ["input-search", InputSearch],
57
- ["input-password", InputPassword],
58
- ["input-number", InputNumber],
59
- ["input-otp", InputOTP],
60
- ["auto-complete", AutoComplete],
61
- ["select", Select],
62
- ["cascader", Cascader],
63
- ["date-picker", DatePicker],
64
- ["range-picker", DateRangePicker],
65
- ["time-picker", TimePicker],
66
- ["time-range-picker", TimeRangePicker],
67
- ["checkbox-group", CheckboxGroup],
68
- ["radio-group", RadioGroup],
69
- ["switch", Switch],
70
- ["slider", Slider],
71
- ["tree-select", TreeSelect],
72
- ["transfer", Transfer]
73
- ]);
74
- const registerComponent = (name, component) => {
75
- COMPONENT_MAP.set(name, component);
54
+ const componentMap = {
55
+ "input": Input,
56
+ "textarea": TextArea,
57
+ "input-search": InputSearch,
58
+ "input-password": InputPassword,
59
+ "input-number": InputNumber,
60
+ "input-otp": InputOTP,
61
+ "auto-complete": AutoComplete,
62
+ "select": Select,
63
+ "cascader": Cascader,
64
+ "date-picker": DatePicker,
65
+ "range-picker": DateRangePicker,
66
+ "time-picker": TimePicker,
67
+ "time-range-picker": TimeRangePicker,
68
+ "checkbox-group": CheckboxGroup,
69
+ "radio-group": RadioGroup,
70
+ "switch": Switch,
71
+ "slider": Slider,
72
+ "tree-select": TreeSelect,
73
+ "transfer": Transfer
76
74
  };
77
75
  const TeleportComponentNamePrefix = "TeleportComponent_";
78
76
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
@@ -287,7 +285,7 @@ const useForm = useForm$1;
287
285
  const getInitProps = (field) => {
288
286
  const { component } = field;
289
287
  const picker = component === "date-picker" ? "" : field.picker;
290
- if (COMPONENT_MAP.has(component)) {
288
+ if (typeof component === "string" && componentMap[component]) {
291
289
  const k = [component, picker].filter(Boolean).join(".");
292
290
  if (INJECT_CONFIG[k]) {
293
291
  const config = INJECT_CONFIG[k];
@@ -367,8 +365,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
367
365
  `${TeleportComponentNamePrefix}${__props.path}`,
368
366
  void 0
369
367
  );
368
+ const customComponents = inject(INJECT_COMPONENTS, {});
370
369
  const is = computed(() => {
371
- return teleportComponent ?? COMPONENT_MAP.get(__props.component) ?? __props.component;
370
+ if (teleportComponent) return teleportComponent;
371
+ if (typeof __props.component === "string") {
372
+ return customComponents[__props.component] || componentMap[__props.component] || __props.component;
373
+ }
374
+ return __props.component;
372
375
  });
373
376
  __expose({
374
377
  getComponentRef: () => componentRef.value,
@@ -436,7 +439,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
436
439
  const useFields = useFields$1;
437
440
  const useFormRef = useFormRef$1;
438
441
  export {
439
- COMPONENT_MAP as C,
440
442
  FORM_ITEM_SLOT_KEYS as F,
441
443
  TeleportComponentNamePrefix as T,
442
444
  _sfc_main$6 as _,
@@ -444,10 +446,10 @@ export {
444
446
  _sfc_main$3 as b,
445
447
  _sfc_main$2 as c,
446
448
  _sfc_main as d,
447
- useFields as e,
448
- useFormRef as f,
449
- getInitProps as g,
450
- registerComponent as r,
449
+ componentMap as e,
450
+ useFields as f,
451
+ useFormRef as g,
452
+ getInitProps as h,
451
453
  tableProps as t,
452
454
  useForm as u
453
455
  };
package/es/form/index.js CHANGED
@@ -1,21 +1,20 @@
1
- import { c, _, b, C, a, F, d, T, _ as _2, g, r, e, u, f } from "./index-idQHUPJc.js";
2
- import { I, b as b2, f as f2 } from "../component-provider/index-DcaBbsiC.js";
1
+ import { c, _, b, a, F, d, T, e, _ as _2, h, f, u, g } from "./index-DmAaZ_i3.js";
2
+ import { I, a as a2, e as e2 } from "../core/index-BrBzu6aj.js";
3
3
  export {
4
4
  c as BaseField,
5
5
  _ as BaseForm,
6
6
  b as BaseFormItem,
7
- C as COMPONENT_MAP,
8
7
  a as ContainerFragment,
9
8
  F as FORM_ITEM_SLOT_KEYS,
10
9
  I as InjectionFormKey,
11
- b2 as InjectionPathKey,
10
+ a2 as InjectionPathKey,
12
11
  d as SlotComponent,
13
12
  T as TeleportComponentNamePrefix,
13
+ e as componentMap,
14
14
  _2 as default,
15
- g as getInitProps,
16
- r as registerComponent,
17
- e as useFields,
15
+ h as getInitProps,
16
+ f as useFields,
18
17
  u as useForm,
19
- f2 as useFormData,
20
- f as useFormRef
18
+ e2 as useFormData,
19
+ g as useFormRef
21
20
  };
package/es/index.d.ts CHANGED
@@ -17,16 +17,11 @@ import { ComponentSlots } from 'vue-component-type-helpers';
17
17
  import { ComputedRef } from 'vue';
18
18
  import { CreateComponentPublicInstanceWithMixins } from 'vue';
19
19
  import { CSSProperties } from 'vue';
20
- import { Data } from '@qin-ui/core';
21
20
  import { DatePicker } from 'antdv-next';
22
21
  import { DateRangePicker } from 'antdv-next';
23
- import { DeepPartial } from '@qin-ui/core';
24
22
  import { DefineComponent } from 'vue';
25
- import { ExtendWithAny } from '@qin-ui/core';
26
23
  import { FeedbackIcons } from 'antdv-next/dist/form/FormItem/index';
27
- import { Fields as Fields_2 } from '@qin-ui/core';
28
24
  import { FilterDropdownProps } from 'antdv-next/dist/table/interface';
29
- import { Form as Form_2 } from '@qin-ui/core';
30
25
  import { FormClassNamesType } from 'antdv-next/dist/form/Form';
31
26
  import { FormEmits } from 'antdv-next';
32
27
  import { FormInstance } from 'antdv-next';
@@ -40,23 +35,19 @@ import { FormTooltipProps } from 'antdv-next/dist/form/FormItemLabel';
40
35
  import { GlobalComponents } from 'vue';
41
36
  import { GlobalDirectives } from 'vue';
42
37
  import { HTMLAttributes } from 'vue';
43
- import { InjectionFormKey } from '@qin-ui/core';
44
38
  import { InjectionKey } from 'vue';
45
- import { InjectionPathKey } from '@qin-ui/core';
46
39
  import { Input } from 'antdv-next';
47
40
  import { InputNumber } from 'antdv-next';
48
41
  import { InputOTP } from 'antdv-next';
49
42
  import { InputPassword } from 'antdv-next';
50
43
  import { InputSearch } from 'antdv-next';
51
- import { KeyExpandString } from '@qin-ui/core';
52
44
  import { MaybeRef } from 'vue';
53
- import { PageParam } from '@qin-ui/core';
54
- import { Path } from '@qin-ui/core';
55
- import { Paths } from '@qin-ui/core';
56
45
  import { Plugin as Plugin_2 } from 'vue';
57
46
  import { PublicProps } from 'vue';
58
47
  import { RadioGroup } from 'antdv-next';
59
48
  import { Raw } from 'vue';
49
+ import { Reactive } from 'vue';
50
+ import { Ref } from 'vue';
60
51
  import { RequiredMark } from 'antdv-next/dist/form/Form';
61
52
  import { RowProps } from 'antdv-next';
62
53
  import { Rule } from 'antdv-next/dist/form/types';
@@ -66,7 +57,6 @@ import { ShallowUnwrapRef } from 'vue';
66
57
  import { Slider } from 'antdv-next';
67
58
  import { Slot } from 'vue';
68
59
  import { Switch } from 'antdv-next';
69
- import { Table as Table_2 } from '@qin-ui/core';
70
60
  import { TableColumnType } from 'antdv-next';
71
61
  import { TableProps } from 'antdv-next';
72
62
  import { TextArea } from 'antdv-next';
@@ -74,9 +64,6 @@ import { TimePicker } from 'antdv-next';
74
64
  import { TimeRangePicker } from 'antdv-next';
75
65
  import { Transfer } from 'antdv-next';
76
66
  import { TreeSelect } from 'antdv-next';
77
- import { useFields as useFields_2 } from '@qin-ui/core';
78
- import { useFormData } from '@qin-ui/core';
79
- import { useFormRef as useFormRef_2 } from '@qin-ui/core';
80
67
  import { ValidateMessages } from 'antdv-next/dist/form/types';
81
68
  import { Variant } from 'antdv-next/dist/config-provider/context';
82
69
  import { VNode } from 'vue';
@@ -110,6 +97,10 @@ declare type __VLS_WithTemplateSlots<T, S> = T & {
110
97
  };
111
98
  };
112
99
 
100
+ declare type AllowStringKey<T, Prefix extends string = ''> = {
101
+ [K in keyof T]: K extends string ? T[K] extends (infer U)[] ? `${Prefix}${K}` | (IsRecord<U> extends true ? AllowStringKey<U, `${Prefix}${K}[index].`> : never) : IsRecord<T[K]> extends true ? `${Prefix}${K}` | AllowStringKey<T[K], `${Prefix}${K}.`> : `${Prefix}${K}` : never;
102
+ }[keyof T];
103
+
113
104
  /**
114
105
  * @type {Object} Base - 基础公共字段类型
115
106
  */
@@ -201,10 +192,34 @@ export declare interface Base<D extends Data = Data> {
201
192
  modelProp?: string;
202
193
  }
203
194
 
204
- /**
205
- * @description 基础组件字符串名称类型
206
- */
207
- export declare type BaseComponentStringName = Exclude<Field['component'], RenderComponentType | undefined>;
195
+ declare interface BaseColumn<D extends Data = Data> {
196
+ key?: Path<D>;
197
+ dataIndex?: Path<D> | Path<D>[];
198
+ children?: BaseColumn<D>[];
199
+ [key: string]: any;
200
+ }
201
+
202
+ export declare type BaseComponentMap = {
203
+ 'input': typeof Input;
204
+ 'textarea': typeof TextArea;
205
+ 'input-search': typeof InputSearch;
206
+ 'input-password': typeof InputPassword;
207
+ 'input-number': typeof InputNumber;
208
+ 'input-otp': typeof InputOTP;
209
+ 'auto-complete': typeof AutoComplete;
210
+ 'select': typeof Select;
211
+ 'cascader': typeof Cascader;
212
+ 'date-picker': typeof DatePicker;
213
+ 'range-picker': typeof DateRangePicker;
214
+ 'time-picker': typeof TimePicker;
215
+ 'time-range-picker': typeof TimeRangePicker;
216
+ 'checkbox-group': typeof CheckboxGroup;
217
+ 'radio-group': typeof RadioGroup;
218
+ 'switch': typeof Switch;
219
+ 'slider': typeof Slider;
220
+ 'tree-select': typeof TreeSelect;
221
+ 'transfer': typeof Transfer;
222
+ };
208
223
 
209
224
  export declare const BaseField: DefineComponent<Props, {
210
225
  getComponentRef: () => any;
@@ -213,6 +228,13 @@ getComponentComputedProps: () => any;
213
228
  componentRef: unknown;
214
229
  }, any>;
215
230
 
231
+ declare interface BaseField_2<D extends Data = Data> {
232
+ path?: Path<D> | any;
233
+ name?: any;
234
+ fields?: any[];
235
+ [key: string]: any;
236
+ }
237
+
216
238
  export declare const BaseForm: <F extends Form<any> = Form>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal_2<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
217
239
  props: __VLS_PrettifyLocal_2<Pick<Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, never> & ({
218
240
  grid?: Grid;
@@ -252,33 +274,45 @@ export declare type Column<D extends Data = Data> = Omit<TableColumnType, 'dataI
252
274
  hidden?: boolean;
253
275
  };
254
276
 
255
- export declare type Columns<D extends Data = Data> = Array<Column<D>>;
277
+ declare type ColumnFindBy<D extends Data, C extends BaseColumn<D> = BaseColumn<D>> = (column: Readonly<C>) => boolean;
256
278
 
257
- export declare const COMPONENT_MAP: Map<string, Component>;
279
+ export declare type Columns<D extends Data = Data> = Array<Column<D>>;
258
280
 
259
- export declare type ComponentVars = Partial<RequiredComponentVars>;
260
-
261
- /**
262
- * @description 容器组件类型
263
- */
264
- export declare type ContainerComponent = Component<PathProps>;
265
-
266
- export declare const ContainerFragment: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
281
+ declare type Columns_2<D extends Data = Data, C extends BaseColumn<D> = BaseColumn<D>> = Array<C>;
267
282
 
268
283
  /**
269
284
  * @description 暴露给外部扩充自定义组件类型的接口
270
285
  * @example
271
286
  * ```ts
272
287
  * declare module 'antdv-next-pro' {
273
- * interface CustomFieldTypeMap {
288
+ * interface ComponentMap {
274
289
  * 'my-custom-input': typeof MyCustomInput;
275
290
  * }
276
291
  * }
277
292
  * ```
278
293
  */
279
- export declare interface CustomFieldTypeMap<D extends Data = Data> {
294
+ export declare interface ComponentMap {
280
295
  }
281
296
 
297
+ export declare const componentMap: BaseComponentMap;
298
+
299
+ export declare type ComponentName = keyof BaseComponentMap | keyof ComponentMap;
300
+
301
+ export declare type ComponentVars = Partial<RequiredComponentVars>;
302
+
303
+ /**
304
+ * @description 容器组件类型
305
+ */
306
+ export declare type ContainerComponent = Component<PathProps>;
307
+
308
+ export declare const ContainerFragment: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
309
+
310
+ declare type Data = Record<string, any>;
311
+
312
+ declare type DeepPartial<T> = T extends object ? {
313
+ [P in keyof T]?: DeepPartial<T[P]>;
314
+ } : T;
315
+
282
316
  declare const _default: {
283
317
  install(app: App): void;
284
318
  };
@@ -401,15 +435,21 @@ declare type ExpandButtonProps = ButtonProps & {
401
435
  expandStatus: boolean;
402
436
  };
403
437
 
438
+ declare type ExtendWithAny<D> = {
439
+ [K in keyof D]: IsRecord<D[K]> extends true ? ExtendWithAny<D[K]> : D[K];
440
+ } & Record<string, any>;
441
+
404
442
  /**
405
443
  * @description 字段配置类型,包含所有字段属性和响应式支持
406
444
  * @template D - 数据对象类型
407
445
  */
408
- export declare type Field<D extends Data = Data> = {
446
+ export declare type Field<D extends Data = Data> = WithAdditionalMethodsGetter<{
409
447
  [K in keyof FieldTypeMap]: {
410
448
  component?: K extends 'custom' ? FieldTypeMap<D>[K]['component'] : K;
411
449
  } & FieldTypeMap<D>[K];
412
- }[keyof FieldTypeMap];
450
+ }[keyof FieldTypeMap]>;
451
+
452
+ declare type FieldFindBy<D extends Data, F extends BaseField_2<D> = BaseField_2<D>> = (field: Readonly<F>) => boolean;
413
453
 
414
454
  /**
415
455
  * @description 字段数组类型
@@ -417,55 +457,20 @@ export declare type Field<D extends Data = Data> = {
417
457
  */
418
458
  export declare type Fields<D extends Data = Data> = Array<Field<D>>;
419
459
 
460
+ declare type Fields_2<D extends Data = Data, F extends BaseField_2<D> = BaseField_2<D>> = F[];
461
+
420
462
  /**
421
463
  * @type {FieldTypeMap} 字段类型集合
422
464
  */
423
465
  export declare type FieldTypeMap<D extends Data = Data> = {
424
- /** 文本框 */
425
- 'input': WithComponent<typeof Input, D>;
426
- /** 文本域 */
427
- 'textarea': WithComponent<typeof TextArea, D>;
428
- /** 文本框-密码 */
429
- 'input-password': WithComponent<typeof InputPassword, D>;
430
- 'input-otp': WithComponent<typeof InputOTP, D>;
431
- /** 文本框-搜索 */
432
- 'input-search': WithComponent<typeof InputSearch, D>;
433
- /** 数字文本框 */
434
- 'input-number': WithComponent<typeof InputNumber, D>;
435
- /** 下拉选择器 */
436
- 'select': WithComponent<typeof Select, D>;
437
- /** 自动完成 */
438
- 'auto-complete': WithComponent<typeof AutoComplete, D>;
439
- /** 级联选择器 */
440
- 'cascader': WithComponent<typeof Cascader, D>;
441
- /** 日期选择器 */
442
- 'date-picker': WithComponent<typeof DatePicker, D>;
443
- /** 日期选择器-范围 */
444
- 'range-picker': WithComponent<typeof DateRangePicker, D>;
445
- /** 时间选择器 */
446
- 'time-picker': WithComponent<typeof TimePicker, D>;
447
- /** 时间范围选择器 */
448
- 'time-range-picker': WithComponent<typeof TimeRangePicker, D>;
449
- /** 复选框组 */
450
- 'checkbox-group': WithComponent<typeof CheckboxGroup, D>;
451
- /** 单选框组 */
452
- 'radio-group': WithComponent<typeof RadioGroup, D>;
453
- /** 开关 */
454
- 'switch': WithComponent<typeof Switch, D>;
455
- /** 滑块 */
456
- 'slider': WithComponent<typeof Slider, D>;
457
- /** 树形选择器 */
458
- 'tree-select': WithComponent<typeof TreeSelect, D>;
459
- /** 穿梭框 */
460
- 'transfer': WithComponent<typeof Transfer, D>;
461
466
  /** 自定义组件 */
462
- 'custom': {
467
+ custom: {
463
468
  component?: RenderComponentType | Raw<RenderComponentType>;
464
469
  } & WithCommon<{
465
470
  slots?: Slots;
466
471
  } & Record<string, any>, D>;
467
472
  } & {
468
- [K in keyof CustomFieldTypeMap<D>]: WithComponent<CustomFieldTypeMap[K], D>;
473
+ [K in ComponentName]: WithComponent<GetComponentType<K>, D>;
469
474
  };
470
475
 
471
476
  /**
@@ -476,6 +481,8 @@ export declare type FieldTypeMap<D extends Data = Data> = {
476
481
  */
477
482
  export declare type Form<D extends Data = Data, F extends Field<D> = Field<D>> = Form_2<D, F, FormInstance>;
478
483
 
484
+ declare type Form_2<D extends Data = Data, F extends BaseField_2<D> = BaseField_2<D>, I = any> = ReturnType<typeof useFormData<D>> & ReturnType<typeof useFields_2<D, F>> & ReturnType<typeof useFormRef_2<I>>;
485
+
479
486
  export declare const FORM_ITEM_SLOT_KEYS: readonly ["label", "extra", "help", "tooltip"];
480
487
 
481
488
  export { FormInstance }
@@ -486,10 +493,14 @@ declare type _FormProps = Pick<Partial<FormProps>, 'colon' | 'disabled' | 'label
486
493
 
487
494
  declare type FP<T extends Record<string, any>> = Partial<T & Pick<Base, 'valueFormatter' | 'componentContainer' | 'modelProp' | 'componentClass' | 'componentStyle'> & AllowedComponentProps>;
488
495
 
496
+ export declare type GetComponentType<K extends ComponentName> = K extends keyof ComponentMap ? ComponentMap[K] : K extends keyof BaseComponentMap ? BaseComponentMap[K] : never;
497
+
489
498
  export declare const getInitProps: (field: Field) => Record<string, any>;
490
499
 
491
500
  export declare type Grid = boolean | (RowProps & {});
492
501
 
502
+ export declare const INJECT_COMPONENTS: InjectionKey<Partial<Record<string, Component>>>;
503
+
493
504
  export declare const INJECT_CONFIG: {
494
505
  [key in keyof RequiredComponentVars]: {
495
506
  injectionKey: InjectionKey<RequiredComponentVars[key]>;
@@ -497,9 +508,20 @@ export declare const INJECT_CONFIG: {
497
508
  };
498
509
  };
499
510
 
500
- export { InjectionFormKey }
511
+ export declare const InjectionFormKey: InjectionKey<any>;
512
+
513
+ export declare const InjectionPathKey: InjectionKey<ComputedRef<string | undefined>>;
514
+
515
+ declare type IsRecord<T> = T extends object ? T extends ((...args: any[]) => any) | any[] | null ? false : true : false;
501
516
 
502
- export { InjectionPathKey }
517
+ declare type JoinPath<Prefix extends any[], Key extends PropertyKey> = [
518
+ ...Prefix,
519
+ KeyExpandString<Extract<Key, string>>
520
+ ];
521
+
522
+ declare type KeyExpandString<T extends string> = T | (string & {});
523
+
524
+ declare type KeyPathString<D extends Data> = KeyExpandString<AllowStringKey<D>>;
503
525
 
504
526
  declare type MaybeRefOrComputedRef<T = any> = MaybeRef<T> | ComputedRef<T>;
505
527
 
@@ -517,15 +539,29 @@ export { Option_2 as Option }
517
539
 
518
540
  export declare type Options = Array<Option_2>;
519
541
 
542
+ declare interface PageParam {
543
+ current: number;
544
+ pageSize: number;
545
+ total: number;
546
+ [key: string]: any;
547
+ }
548
+
549
+ declare type Path<D extends Data = Data> = KeyPathString<D>;
550
+
520
551
  export declare type PathProps = {
521
552
  path?: string;
522
553
  } & Data;
523
554
 
555
+ declare type Paths<T, Prefix extends any[] = []> = T extends object ? {
556
+ [K in keyof T]: IsRecord<T[K]> extends true ? JoinPath<Prefix, K> | Paths<T[K], JoinPath<Prefix, K>> : JoinPath<Prefix, K>;
557
+ }[keyof T] : never;
558
+
524
559
  declare type PP<T extends Record<string, any>> = Partial<T & AllowedComponentProps>;
525
560
 
526
561
  export declare const ProComponentProvider: SFCWithInstall<{
527
562
  new (...args: any[]): CreateComponentPublicInstanceWithMixins<Readonly<{
528
- componentVars: ComponentVars;
563
+ componentVars?: ComponentVars;
564
+ componentMap?: Partial<Record<KeyExpandString<ComponentName>, Component>>;
529
565
  }> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, {}, false, {}, {}, GlobalComponents, GlobalDirectives, string, {}, any, ComponentProvideOptions, {
530
566
  P: {};
531
567
  B: {};
@@ -534,13 +570,15 @@ export declare const ProComponentProvider: SFCWithInstall<{
534
570
  M: {};
535
571
  Defaults: {};
536
572
  }, Readonly<{
537
- componentVars: ComponentVars;
573
+ componentVars?: ComponentVars;
574
+ componentMap?: Partial<Record<KeyExpandString<ComponentName>, Component>>;
538
575
  }> & Readonly<{}>, {}, {}, {}, {}, {}>;
539
576
  __isFragment?: never;
540
577
  __isTeleport?: never;
541
578
  __isSuspense?: never;
542
579
  } & ComponentOptionsBase<Readonly<{
543
- componentVars: ComponentVars;
580
+ componentVars?: ComponentVars;
581
+ componentMap?: Partial<Record<KeyExpandString<ComponentName>, Component>>;
544
582
  }> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {}, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & VNodeProps & AllowedComponentProps & ComponentCustomProps & (new () => {
545
583
  $slots: {
546
584
  default?(_: {}): any;
@@ -657,13 +695,6 @@ export declare type ProTableInstance = ComponentExposed<typeof _default_2>;
657
695
 
658
696
  export declare type ProTableProps = ComponentProps<typeof _default_2>;
659
697
 
660
- /**
661
- * 注册自定义组件
662
- * @param name 组件名称标识
663
- * @param component Vue组件
664
- */
665
- export declare const registerComponent: (name: string, component: Component) => void;
666
-
667
698
  /**
668
699
  * @description 自定义组件
669
700
  * @example (p, ctx) => h('div', ctx.attrs)
@@ -676,30 +707,13 @@ export declare type RequiredComponentVars = {
676
707
  grid: Exclude<Grid, undefined | boolean>;
677
708
  }>;
678
709
  'pro-form-item': PP<FormItemProps & Pick<ColProps, 'span' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'> & Pick<Base, 'formItemContainer'>>;
679
- 'input': FP<ComponentProps<typeof Input>>;
680
- 'textarea': FP<ComponentProps<typeof TextArea>>;
681
- 'input-password': FP<ComponentProps<typeof InputPassword>>;
682
- 'input-search': FP<ComponentProps<typeof InputSearch>>;
683
- 'input-number': FP<ComponentProps<typeof InputNumber>>;
684
- 'input-otp': FP<ComponentProps<typeof InputOTP>>;
685
- 'auto-complete': FP<ComponentProps<typeof AutoComplete>>;
686
- 'select': FP<ComponentProps<typeof Select>>;
687
- 'cascader': FP<ComponentProps<typeof Cascader>>;
688
- 'date-picker': FP<ComponentProps<typeof DatePicker>>;
689
- 'date-picker.date': FP<ComponentProps<typeof DatePicker>>;
690
- 'date-picker.week': FP<ComponentProps<typeof DatePicker>>;
691
- 'date-picker.month': FP<ComponentProps<typeof DatePicker>>;
692
- 'date-picker.year': FP<ComponentProps<typeof DatePicker>>;
693
- 'date-picker.quarter': FP<ComponentProps<typeof DatePicker>>;
694
- 'range-picker': FP<ComponentProps<typeof DateRangePicker>>;
695
- 'time-picker': FP<ComponentProps<typeof TimePicker>>;
696
- 'time-range-picker': FP<ComponentProps<typeof TimeRangePicker>>;
697
- 'checkbox-group': FP<ComponentProps<typeof CheckboxGroup>>;
698
- 'radio-group': FP<ComponentProps<typeof RadioGroup>>;
699
- 'switch': FP<ComponentProps<typeof Switch>>;
700
- 'slider': FP<ComponentProps<typeof Slider>>;
701
- 'tree-select': FP<ComponentProps<typeof TreeSelect>>;
702
- 'transfer': FP<ComponentProps<typeof Transfer>>;
710
+ 'date-picker.date': FP<ComponentProps<GetComponentType<'date-picker'>>>;
711
+ 'date-picker.week': FP<ComponentProps<GetComponentType<'date-picker'>>>;
712
+ 'date-picker.month': FP<ComponentProps<GetComponentType<'date-picker'>>>;
713
+ 'date-picker.year': FP<ComponentProps<GetComponentType<'date-picker'>>>;
714
+ 'date-picker.quarter': FP<ComponentProps<GetComponentType<'date-picker'>>>;
715
+ } & {
716
+ [K in ComponentName]: FP<ComponentProps<GetComponentType<K>>>;
703
717
  };
704
718
 
705
719
  declare type SearchFormProps = {
@@ -711,6 +725,12 @@ declare type SearchFormProps = {
711
725
  expandButton?: Component<ExpandButtonProps> | DefineComponent<ExpandButtonProps>;
712
726
  } & /* @vue-ignore */ _FormProps & AllowedComponentProps;
713
727
 
728
+ declare type SetColumn<D extends Data = Data, C extends BaseColumn<D> = BaseColumn<D>> = (key: Path<D>, column: C | ((pre: Readonly<C>) => C), options?: {
729
+ updateType?: 'rewrite' | 'merge';
730
+ } & UpdateColumnOptions) => void;
731
+
732
+ declare type SetPageParam = (pageParam: Partial<PageParam> | ((pre: Readonly<PageParam>) => Partial<PageParam>)) => void;
733
+
714
734
  declare type SFCWithInstall<T> = T & Plugin_2;
715
735
 
716
736
  export declare const SlotComponent: DefineComponent<Props_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_3> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
@@ -732,10 +752,31 @@ export declare type Slots = {
732
752
  */
733
753
  export declare type Table<D extends Data = Data, T extends object = ExtendWithAny<D>> = Table_2<D, T, Column<D>>;
734
754
 
755
+ declare type Table_2<D extends Data = Data, T extends object = ExtendWithAny<D>, C extends BaseColumn<D> = BaseColumn<D>> = {
756
+ columns: Ref<Columns_2<D, C>>;
757
+ dataSource: Ref<T[]>;
758
+ pageParam: Reactive<PageParam>;
759
+ searchForm: Form_2<D>;
760
+ setColumn: SetColumn<D, C>;
761
+ deleteColumn: (path: Path<D> | ColumnFindBy<D, C>, options?: UpdateColumnOptions) => void;
762
+ appendColumn: (path: Path<D> | ColumnFindBy<D, C> | undefined, column: C | Columns_2<D, C>, options?: UpdateColumnOptions) => void;
763
+ prependColumn: (path: Path<D> | ColumnFindBy<D, C> | undefined, column: C | Columns_2<D, C>, options?: UpdateColumnOptions) => void;
764
+ setPageParam: SetPageParam;
765
+ resetQueryParams: () => void;
766
+ };
767
+
735
768
  export declare const TeleportComponentNamePrefix = "TeleportComponent_";
736
769
 
737
- /** useFields 返回值类型,F 默认绑定为本地 Field<D> */
738
- export declare type UseFields<D extends Data = Data, F extends Field<D> = Field<D>> = ReturnType<typeof useFields<D, F>>;
770
+ declare type UpdateColumnOptions = {
771
+ all?: boolean;
772
+ };
773
+
774
+ declare type UpdateFieldOptions = {
775
+ all?: boolean;
776
+ };
777
+
778
+ /** useFields 返回值类型,固定为本地 Fields<D> */
779
+ export declare type UseFields<D extends Data = Data> = ReturnType<typeof useFields<D>>;
739
780
 
740
781
  /**
741
782
  * 类型断言 re-export @qin-ui/core 的 useFields,
@@ -743,7 +784,35 @@ export declare type UseFields<D extends Data = Data, F extends Field<D> = Field<
743
784
  * 使得 fields、getField 等方法的类型推断包含 UI 库的完整属性签名。
744
785
  */
745
786
  export declare const useFields: {
746
- <D extends Data = Data, F extends Field<D> = Field<D>>(initFields?: F[]): ReturnType<typeof useFields_2<D, F>>;
787
+ <D extends Data = Data>(initFields?: Fields<D>): ReturnType<typeof useFields_2<D, Field<D>>>;
788
+ };
789
+
790
+ declare const useFields_2: <D extends Data = Data, F extends BaseField_2<D> = BaseField_2<D>>(initFields?: F[]) => {
791
+ fields: Ref<F[], F[]>;
792
+ getField: {
793
+ (path: Path<D> | FieldFindBy<D, F>): Readonly<F> | undefined;
794
+ (path: Path<D> | FieldFindBy<D, F>, options?: {
795
+ all?: false;
796
+ }): Readonly<F> | undefined;
797
+ (path: Path<D> | FieldFindBy<D, F>, options: {
798
+ all: true;
799
+ }): Readonly<F>[] | undefined;
800
+ };
801
+ setField: (path: Path<D> | FieldFindBy<D, F>, field: F | ((preField: Readonly<F>) => F), options?: {
802
+ updateType?: "rewrite" | "merge";
803
+ } & UpdateFieldOptions) => void;
804
+ deleteField: (path: Path<D> | FieldFindBy<D, F>, options?: UpdateFieldOptions) => void;
805
+ appendField: (path: Path<D> | FieldFindBy<D, F> | undefined, field: F | F[], options?: UpdateFieldOptions) => void;
806
+ prependField: (path: Path<D> | FieldFindBy<D, F> | undefined, field: F | F[], options?: UpdateFieldOptions) => void;
807
+ getParentField: {
808
+ (path: Path<D> | FieldFindBy<D, F>): F | undefined;
809
+ (path: Path<D> | FieldFindBy<D, F>, options: {
810
+ all?: false;
811
+ }): F | undefined;
812
+ (path: Path<D> | FieldFindBy<D, F>, options: {
813
+ all: true;
814
+ }): F[] | undefined;
815
+ };
747
816
  };
748
817
 
749
818
  /**
@@ -751,11 +820,30 @@ export declare const useFields: {
751
820
  * 将默认返回的 Form<D, BaseField<D>> 覆盖为本地的 Form<D, Field<D>>。
752
821
  */
753
822
  export declare const useForm: {
754
- <D extends Data = Data, F extends Field<D> = Field<D>>(initFormData?: ExtendWithAny<DeepPartial<D>>, initFields?: F[], root?: boolean): Form<D, F>;
755
- <D extends Data = Data, F extends Field<D> = Field<D>>(root?: boolean): Form<D, F>;
823
+ <D extends Data = Data>(initFormData?: ExtendWithAny<DeepPartial<D>>, initFields?: Field<D>[], root?: boolean): Form<D, Field<D>>;
824
+ <D extends Data = Data>(root?: boolean): Form<D, Field<D>>;
756
825
  };
757
826
 
758
- export { useFormData }
827
+ /**
828
+ * 表单数据处理hook
829
+ * @param initFormData 初始表单数据
830
+ * @returns {Object} { formData, getFormData, setFormData }
831
+ */
832
+ export declare const useFormData: <D extends Data = Data>(initFormData?: ExtendWithAny<DeepPartial<D>>) => {
833
+ formData: Reactive<ExtendWithAny<D>>;
834
+ getFormData: {
835
+ <K extends keyof D>(path: K): D[K];
836
+ <K extends keyof D & string, K1 extends keyof D[K] & string>(path: `${K}.${K1}`): D[K][K1];
837
+ <K extends keyof D & string, K1_1 extends keyof D[K] & string, K2 extends keyof D[K][K1_1] & string>(path: `${K}.${K1_1}.${K2}`): D[K][K1_1][K2];
838
+ (path: Path<D>): any;
839
+ };
840
+ setFormData: {
841
+ (path: Path<D>, value: any): void;
842
+ (path: Path<D>, value: (v: any) => any): void;
843
+ (value: ExtendWithAny<DeepPartial<D>>): void;
844
+ (value: (v: ExtendWithAny<DeepPartial<D>>) => ExtendWithAny<DeepPartial<D>>): void;
845
+ };
846
+ };
759
847
 
760
848
  /**
761
849
  * 类型断言 re-export @qin-ui/core 的 useFormRef,
@@ -765,6 +853,11 @@ export declare const useFormRef: {
765
853
  (): ReturnType<typeof useFormRef_2<FormInstance>>;
766
854
  };
767
855
 
856
+ declare const useFormRef_2: <F = any>() => {
857
+ formRef: Ref<F | undefined, F | undefined>;
858
+ setFormRef: (inst: F) => void;
859
+ };
860
+
768
861
  /**
769
862
  * 类型断言 re-export @qin-ui/core 的 useTable,
770
863
  */
package/es/index.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import "./antdv-next-pro.css";
2
- import { _ as _sfc_main } from "./form/index-idQHUPJc.js";
3
- import { c, b, C, a, F, d, T, g, r, e, u, f } from "./form/index-idQHUPJc.js";
4
- import { _ as _sfc_main$1 } from "./component-provider/index-DcaBbsiC.js";
5
- import { a as a2, I, b as b2, f as f2 } from "./component-provider/index-DcaBbsiC.js";
2
+ import { _ as _sfc_main } from "./form/index-DmAaZ_i3.js";
3
+ import { c, b, a, F, d, T, e, h, f, u, g } from "./form/index-DmAaZ_i3.js";
4
+ import { I, a as a2, e as e2 } from "./core/index-BrBzu6aj.js";
6
5
  import BaseTable from "./table/index.js";
7
6
  import { useTable } from "./table/index.js";
7
+ import _sfc_main$1 from "./component-provider/index.js";
8
+ import { INJECT_COMPONENTS, INJECT_CONFIG } from "./component-provider/index.js";
8
9
  const withInstall = (comp) => {
9
10
  comp.install = (app) => {
10
11
  app.component(comp.name, comp);
@@ -26,23 +27,23 @@ export {
26
27
  c as BaseField,
27
28
  _sfc_main as BaseForm,
28
29
  b as BaseFormItem,
29
- C as COMPONENT_MAP,
30
30
  a as ContainerFragment,
31
31
  F as FORM_ITEM_SLOT_KEYS,
32
- a2 as INJECT_CONFIG,
32
+ INJECT_COMPONENTS,
33
+ INJECT_CONFIG,
33
34
  I as InjectionFormKey,
34
- b2 as InjectionPathKey,
35
+ a2 as InjectionPathKey,
35
36
  ProComponentProvider,
36
37
  ProForm,
37
38
  ProTable,
38
39
  d as SlotComponent,
39
40
  T as TeleportComponentNamePrefix,
41
+ e as componentMap,
40
42
  index as default,
41
- g as getInitProps,
42
- r as registerComponent,
43
- e as useFields,
43
+ h as getInitProps,
44
+ f as useFields,
44
45
  u as useForm,
45
- f2 as useFormData,
46
- f as useFormRef,
46
+ e2 as useFormData,
47
+ g as useFormRef,
47
48
  useTable
48
49
  };
package/es/table/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { createElementBlock, openBlock, createElementVNode, defineComponent, ref, computed, watch, watchEffect, createBlock, unref, mergeProps, withCtx, createVNode, renderSlot, resolveDynamicComponent, createTextVNode, createCommentVNode, Fragment, toDisplayString, normalizeStyle, useModel, h, mergeModels, inject, useAttrs, useSlots, onMounted, normalizeClass, createSlots, renderList, normalizeProps, guardReactiveProps, nextTick } from "vue";
2
2
  import { Space, Button, theme, useConfig, Dropdown, Menu, Checkbox, Table } from "antdv-next";
3
3
  import "antdv-next/dist/config-provider/DisabledContext";
4
- import { _ as _sfc_main$9, t as tableProps, a as _sfc_main$a } from "../form/index-idQHUPJc.js";
5
- import { a as INJECT_CONFIG, g as getObject, c as camelizeProperties, h as useTable$1 } from "../component-provider/index-DcaBbsiC.js";
4
+ import { _ as _sfc_main$9, t as tableProps, a as _sfc_main$a } from "../form/index-DmAaZ_i3.js";
5
+ import { INJECT_CONFIG } from "../component-provider/index.js";
6
+ import { g as getObject, c as camelizeProperties, f as useTable$1 } from "../core/index-BrBzu6aj.js";
6
7
  import { p as pick } from "../vendor/utils/lodash-es-p6jau26B.js";
7
8
  const _export_sfc = (sfc, props) => {
8
9
  const target = sfc.__vccOpts || sfc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qin-ui/antdv-next-pro",
3
- "version": "1.0.4",
3
+ "version": "1.1.0",
4
4
  "description": "基于 antdv-next 的二次封装组件",
5
5
  "type": "module",
6
6
  "module": "es/index.js",
@@ -28,14 +28,12 @@
28
28
  "author": "dufan3715",
29
29
  "license": "MIT",
30
30
  "private": false,
31
- "dependencies": {
32
- "@qin-ui/core": "workspace:^"
33
- },
34
31
  "peerDependencies": {
35
32
  "antdv-next": "^1.1.0",
36
33
  "vue": "^3.5.0"
37
34
  },
38
35
  "devDependencies": {
36
+ "@qin-ui/core": "workspace:^",
39
37
  "@types/lodash-es": "^4.17.12",
40
38
  "antdv-next": "^1.1.0",
41
39
  "lodash-es": "^4.17.21",