@aplus-frontend/ui 7.15.8 → 7.17.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.
Files changed (95) hide show
  1. package/es/index.mjs +285 -281
  2. package/es/src/ag-grid/components/header-cell/index.vue2.mjs +56 -41
  3. package/es/src/ag-grid/context.d.ts +8 -0
  4. package/es/src/ag-grid/context.mjs +18 -7
  5. package/es/src/ag-grid/hooks/use-columns-def.d.ts +2 -2
  6. package/es/src/ag-grid/hooks/use-columns-def.mjs +64 -61
  7. package/es/src/ag-grid/hooks/use-columns.mjs +39 -30
  8. package/es/src/ag-grid/index.vue.mjs +270 -255
  9. package/es/src/ag-grid/interface.d.ts +20 -1
  10. package/es/src/ag-grid/style/custom-header.mjs +22 -13
  11. package/es/src/ap-field/cascader/index.vue.d.ts +60 -0
  12. package/es/src/ap-field/cascader/index.vue.mjs +217 -0
  13. package/es/src/ap-field/cascader/index.vue2.mjs +4 -0
  14. package/es/src/ap-field/cascader/read.vue.d.ts +8 -0
  15. package/es/src/ap-field/cascader/read.vue.mjs +4 -0
  16. package/es/src/ap-field/cascader/read.vue2.mjs +159 -0
  17. package/es/src/ap-field/cascader/use-options.d.ts +25 -0
  18. package/es/src/ap-field/cascader/use-options.mjs +66 -0
  19. package/es/src/ap-field/hooks/use-default-placeholder.d.ts +3 -1
  20. package/es/src/ap-field/hooks/use-default-placeholder.mjs +13 -8
  21. package/es/src/ap-field/index.d.ts +8 -2
  22. package/es/src/ap-field/index.mjs +72 -65
  23. package/es/src/ap-field/interface.d.ts +27 -1
  24. package/es/src/ap-field/tree-select/index.vue.mjs +43 -39
  25. package/es/src/ap-field/tree-select/use-request.mjs +22 -19
  26. package/es/src/ap-form/items/cascader/index.vue.d.ts +435 -0
  27. package/es/src/ap-form/items/cascader/index.vue.mjs +102 -0
  28. package/es/src/ap-form/items/cascader/index.vue2.mjs +4 -0
  29. package/es/src/ap-form/items/index.d.ts +2 -1
  30. package/es/src/ap-form/items/index.mjs +3 -2
  31. package/es/src/ap-form/items/interface.d.ts +6 -1
  32. package/es/src/ap-table/components/setting/sortable/item.vue2.mjs +86 -65
  33. package/es/src/ap-table/constants.d.ts +269 -4
  34. package/es/src/ap-table/constants.mjs +29 -26
  35. package/es/src/ap-table/interface.d.ts +5 -1
  36. package/es/src/ap-table/style/setting.mjs +30 -27
  37. package/es/src/ap-table/utils.d.ts +1 -1
  38. package/es/src/business/ag-grid-modal/interface.d.ts +4 -0
  39. package/es/src/business/ag-grid-modal/modal-layout/index.vue.d.ts +1 -0
  40. package/es/src/business/ag-grid-modal/modal-layout/index.vue2.mjs +25 -21
  41. package/es/src/business/ag-grid-modal/style/index.mjs +1 -1
  42. package/es/src/business/ag-grid-modal/utils.d.ts +1 -0
  43. package/es/src/index.mjs +250 -246
  44. package/es/src/locale/lang/en.mjs +1 -0
  45. package/es/src/locale/lang/zh-cn.mjs +1 -0
  46. package/es/src/version.d.ts +1 -1
  47. package/es/src/version.mjs +1 -1
  48. package/lib/index.js +1 -1
  49. package/lib/src/ag-grid/components/header-cell/index.vue2.js +1 -1
  50. package/lib/src/ag-grid/context.d.ts +8 -0
  51. package/lib/src/ag-grid/context.js +1 -1
  52. package/lib/src/ag-grid/hooks/use-columns-def.d.ts +2 -2
  53. package/lib/src/ag-grid/hooks/use-columns-def.js +1 -1
  54. package/lib/src/ag-grid/hooks/use-columns.js +1 -1
  55. package/lib/src/ag-grid/index.vue.js +1 -1
  56. package/lib/src/ag-grid/interface.d.ts +20 -1
  57. package/lib/src/ag-grid/style/custom-header.js +1 -1
  58. package/lib/src/ap-field/cascader/index.vue.d.ts +60 -0
  59. package/lib/src/ap-field/cascader/index.vue.js +1 -0
  60. package/lib/src/ap-field/cascader/index.vue2.js +1 -0
  61. package/lib/src/ap-field/cascader/read.vue.d.ts +8 -0
  62. package/lib/src/ap-field/cascader/read.vue.js +1 -0
  63. package/lib/src/ap-field/cascader/read.vue2.js +1 -0
  64. package/lib/src/ap-field/cascader/use-options.d.ts +25 -0
  65. package/lib/src/ap-field/cascader/use-options.js +1 -0
  66. package/lib/src/ap-field/hooks/use-default-placeholder.d.ts +3 -1
  67. package/lib/src/ap-field/hooks/use-default-placeholder.js +1 -1
  68. package/lib/src/ap-field/index.d.ts +8 -2
  69. package/lib/src/ap-field/index.js +1 -1
  70. package/lib/src/ap-field/interface.d.ts +27 -1
  71. package/lib/src/ap-field/tree-select/index.vue.js +1 -1
  72. package/lib/src/ap-field/tree-select/use-request.js +1 -1
  73. package/lib/src/ap-form/items/cascader/index.vue.d.ts +435 -0
  74. package/lib/src/ap-form/items/cascader/index.vue.js +1 -0
  75. package/lib/src/ap-form/items/cascader/index.vue2.js +1 -0
  76. package/lib/src/ap-form/items/index.d.ts +2 -1
  77. package/lib/src/ap-form/items/index.js +1 -1
  78. package/lib/src/ap-form/items/interface.d.ts +6 -1
  79. package/lib/src/ap-table/components/setting/sortable/item.vue2.js +1 -1
  80. package/lib/src/ap-table/constants.d.ts +269 -4
  81. package/lib/src/ap-table/constants.js +1 -1
  82. package/lib/src/ap-table/interface.d.ts +5 -1
  83. package/lib/src/ap-table/style/setting.js +1 -1
  84. package/lib/src/ap-table/utils.d.ts +1 -1
  85. package/lib/src/business/ag-grid-modal/interface.d.ts +4 -0
  86. package/lib/src/business/ag-grid-modal/modal-layout/index.vue.d.ts +1 -0
  87. package/lib/src/business/ag-grid-modal/modal-layout/index.vue2.js +1 -1
  88. package/lib/src/business/ag-grid-modal/style/index.js +1 -1
  89. package/lib/src/business/ag-grid-modal/utils.d.ts +1 -0
  90. package/lib/src/index.js +1 -1
  91. package/lib/src/locale/lang/en.js +1 -1
  92. package/lib/src/locale/lang/zh-cn.js +1 -1
  93. package/lib/src/version.d.ts +1 -1
  94. package/lib/src/version.js +1 -1
  95. package/package.json +4 -4
@@ -1,6 +1,6 @@
1
1
  import { TableProps } from '@aplus-frontend/antdv';
2
2
  import { SortOrder, TableRowSelection } from '@aplus-frontend/antdv/es/table/interface';
3
- import { ColDef, GridApi, ICellRendererParams, IRowNode, IsFullWidthRowParams, RedrawRowsParams, RefreshCellsParams, RowClassRules, RowHeightParams, RowPinnedType, ScrollDirection, ThemeDefaultParams } from 'ag-grid-community';
3
+ import { AgColumn, ColDef, GridApi, ICellRendererParams, IRowNode, IsFullWidthRowParams, RedrawRowsParams, RefreshCellsParams, RowClassRules, RowHeightParams, RowPinnedType, ScrollDirection, ThemeDefaultParams } from 'ag-grid-community';
4
4
  import { ComputedRef, CSSProperties, VNode } from 'vue';
5
5
  import { ApFormSearchFormPopoverSorterItem, ApFormSearchFormProps } from '../ap-form/interface';
6
6
  import { InternalPagingType } from '../ap-table/hooks/use-table-paging-ng';
@@ -89,6 +89,10 @@ export type AgGridColumnType<RecordType = any, ExtraValueType = 'text', ValueTyp
89
89
  width?: number;
90
90
  minWidth?: number;
91
91
  maxWidth?: number;
92
+ /**
93
+ * @since 7.16.0
94
+ */
95
+ flex?: number;
92
96
  colSpan?: ColDef<RecordType>['colSpan'];
93
97
  spanRows?: ColDef<RecordType>['spanRows'];
94
98
  /**
@@ -122,6 +126,17 @@ export type AgGridColumnType<RecordType = any, ExtraValueType = 'text', ValueTyp
122
126
  * @private 仅限内部使用,请勿传递
123
127
  */
124
128
  _path?: (string | number)[];
129
+ /**
130
+ * 作为子列时的显示策略
131
+ * open: 仅展开时显示
132
+ * closed: 仅关闭时显示
133
+ * null,undefined: 总是显示
134
+ */
135
+ columnGroupShow?: 'open' | 'closed';
136
+ /**
137
+ * 是否锁定固定(设置后不可以通过表格设置修改其固定属性)
138
+ */
139
+ lockFixed?: boolean;
125
140
  } : null;
126
141
  export type AgGridRowSelection<RecordType> = Pick<TableRowSelection<RecordType>, 'type' | 'fixed' | 'columnWidth' | 'defaultSelectedRowKeys'> & {
127
142
  /**
@@ -500,4 +515,8 @@ export type AgGridSlots<RecordType> = {
500
515
  shownColumns: AgGridColumnType<RecordType>[];
501
516
  clearAll: () => void;
502
517
  }) => any;
518
+ headerCell?: (props: {
519
+ title: any;
520
+ column: Omit<AgColumn, keyof AgGridColumnType> & AgGridColumnType;
521
+ }) => void;
503
522
  };
@@ -1,8 +1,8 @@
1
1
  import { genComponentStyleHook as o } from "../../utils/cssinjs/index.mjs";
2
- const t = (e) => {
3
- const { componentCls: r } = e;
2
+ const n = (r) => {
3
+ const { componentCls: e } = r;
4
4
  return {
5
- [r]: {
5
+ [e]: {
6
6
  display: "flex",
7
7
  flexDirection: "row",
8
8
  flexWrap: "nowrap",
@@ -17,31 +17,40 @@ const t = (e) => {
17
17
  "&.align-right": {
18
18
  justifyContent: "end"
19
19
  },
20
- [`${r}__sort-wrapper`]: {
20
+ [`${e}__sort-wrapper`]: {
21
21
  display: "inline-flex",
22
22
  flexDirection: "column",
23
23
  alignItems: "center",
24
24
  color: "rgba(0, 0, 0, 0.3)",
25
- marginInlineStart: e.spaceXS,
25
+ marginInlineStart: r.spaceXS,
26
26
  "&:hover": {
27
27
  color: "rgba(0, 0, 0, 0.6)"
28
28
  }
29
29
  },
30
- [`${r}__sorter-up.active`]: {
31
- color: e.colorPrimary
30
+ [`${e}__expand-wrapper`]: {
31
+ padding: r.spaceXS,
32
+ cursor: "pointer",
33
+ display: "flex",
34
+ borderRadius: r.borderRadiusXS,
35
+ "&:hover": {
36
+ background: r.colorBg1
37
+ }
38
+ },
39
+ [`${e}__sorter-up.active`]: {
40
+ color: r.colorPrimary
32
41
  },
33
- [`${r}__sorter-down`]: {
42
+ [`${e}__sorter-down`]: {
34
43
  marginTop: "-0.3em",
35
44
  "&.active": {
36
- color: e.colorPrimary
45
+ color: r.colorPrimary
37
46
  }
38
47
  }
39
48
  }
40
49
  };
41
- }, l = o("AgGrid.CustomHeader", (e) => [
42
- t(e)
50
+ }, a = o("AgGrid.CustomHeader", (r) => [
51
+ n(r)
43
52
  ]);
44
53
  export {
45
- l as default,
46
- t as genAgGridCustomHeaderCellStyle
54
+ a as default,
55
+ n as genAgGridCustomHeaderCellStyle
47
56
  };
@@ -0,0 +1,60 @@
1
+ import { ApFieldCascaderProps } from '../interface';
2
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
3
+ import { DefaultOptionType } from '@aplus-frontend/antdv/es/select';
4
+ import { FieldMode } from '..';
5
+ import { ShowSearchType, DefaultOptionType } from '@aplus-frontend/antdv/es/vc-cascader';
6
+ declare function __VLS_template(): {
7
+ attrs: Partial<{}>;
8
+ slots: Readonly<{
9
+ displayRender?: any;
10
+ notFoundContent?: any;
11
+ expandIcon?: any;
12
+ suffixIcon?: any;
13
+ clearIcon?: any;
14
+ menuItemSelectedIcon?: any;
15
+ tagRender?: any;
16
+ maxTagPlaceholder?: any;
17
+ default?: any;
18
+ optionRender?: any;
19
+ }> & {
20
+ displayRender?: any;
21
+ notFoundContent?: any;
22
+ expandIcon?: any;
23
+ suffixIcon?: any;
24
+ clearIcon?: any;
25
+ menuItemSelectedIcon?: any;
26
+ tagRender?: any;
27
+ maxTagPlaceholder?: any;
28
+ default?: any;
29
+ optionRender?: any;
30
+ };
31
+ refs: {};
32
+ rootEl: any;
33
+ };
34
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
35
+ declare const __VLS_component: DefineComponent<ApFieldCascaderProps, {
36
+ blur: () => void;
37
+ focus: () => void;
38
+ request: (selectOptions?: DefaultOptionType[] | undefined, clear?: boolean) => Promise<void>;
39
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
40
+ "update:value": (...args: any[]) => void;
41
+ }, string, PublicProps, Readonly<ApFieldCascaderProps> & Readonly<{
42
+ "onUpdate:value"?: ((...args: any[]) => any) | undefined;
43
+ }>, {
44
+ mode: FieldMode;
45
+ open: boolean;
46
+ multiple: boolean;
47
+ bordered: boolean;
48
+ allowClear: boolean;
49
+ showSearch: boolean | ShowSearchType<DefaultOptionType>;
50
+ defaultOpen: boolean;
51
+ emptyText: string;
52
+ popupVisible: boolean;
53
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
54
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
55
+ export default _default;
56
+ type __VLS_WithTemplateSlots<T, S> = T & {
57
+ new (): {
58
+ $slots: S;
59
+ };
60
+ };
@@ -0,0 +1,217 @@
1
+ import { isVNode as O, defineComponent as j, useSlots as z, ref as F, computed as L, unref as e, createVNode as u, Fragment as C, resolveComponent as M, createBlock as b, openBlock as w, resolveDynamicComponent as A, mergeProps as U, createSlots as K, renderList as q, withCtx as S, renderSlot as E, normalizeProps as W, guardReactiveProps as $ } from "vue";
2
+ import { Space as G, Cascader as H } from "@aplus-frontend/antdv";
3
+ import { isArray as J, omit as Q } from "lodash-unified";
4
+ import "../../hooks/index.mjs";
5
+ import { useDefaultPlaceholder as X } from "../hooks/use-default-placeholder.mjs";
6
+ import { useOptions as Y } from "./use-options.mjs";
7
+ import { useControllableValue as Z } from "../../hooks/useControllableValue.mjs";
8
+ function ee(t) {
9
+ return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !O(t);
10
+ }
11
+ const ue = /* @__PURE__ */ j({
12
+ name: "ApFieldCascader",
13
+ __name: "index",
14
+ props: {
15
+ mode: {
16
+ default: "edit"
17
+ },
18
+ class: {},
19
+ style: {},
20
+ multiple: {
21
+ type: Boolean,
22
+ default: void 0
23
+ },
24
+ size: {},
25
+ bordered: {
26
+ type: Boolean,
27
+ default: !0
28
+ },
29
+ placement: {},
30
+ suffixIcon: {},
31
+ status: {},
32
+ options: {},
33
+ popupClassName: {},
34
+ dropdownClassName: {},
35
+ "onUpdate:value": {},
36
+ variant: {},
37
+ value: {},
38
+ children: {},
39
+ onMouseenter: {},
40
+ onMouseleave: {},
41
+ tabindex: {},
42
+ onClick: {},
43
+ onFocus: {},
44
+ onBlur: {},
45
+ onChange: {},
46
+ onKeydown: {},
47
+ onKeyup: {},
48
+ onMousedown: {},
49
+ open: {
50
+ type: Boolean,
51
+ default: void 0
52
+ },
53
+ animation: {},
54
+ direction: {},
55
+ disabled: {
56
+ type: Boolean
57
+ },
58
+ prefixCls: {},
59
+ id: {},
60
+ autofocus: {
61
+ type: Boolean
62
+ },
63
+ getPopupContainer: {},
64
+ dropdownMatchSelectWidth: {
65
+ type: [Number, Boolean]
66
+ },
67
+ placeholder: {},
68
+ loading: {
69
+ type: Boolean
70
+ },
71
+ defaultValue: {},
72
+ prefix: {},
73
+ clearIcon: {},
74
+ allowClear: {
75
+ type: Boolean,
76
+ default: !0
77
+ },
78
+ getInputElement: {},
79
+ getRawInputElement: {},
80
+ fieldNames: {},
81
+ searchValue: {},
82
+ onSearch: {},
83
+ maxCount: {},
84
+ showSearch: {
85
+ type: [Boolean, Object],
86
+ default: !1
87
+ },
88
+ tagRender: {},
89
+ optionLabelRender: {},
90
+ notFoundContent: {},
91
+ onClear: {},
92
+ choiceTransitionName: {},
93
+ defaultOpen: {
94
+ type: Boolean,
95
+ default: void 0
96
+ },
97
+ onDropdownVisibleChange: {},
98
+ maxTagTextLength: {},
99
+ maxTagCount: {},
100
+ maxTagPlaceholder: {},
101
+ removeIcon: {},
102
+ transitionName: {},
103
+ dropdownStyle: {},
104
+ dropdownRender: {},
105
+ dropdownAlign: {},
106
+ showAction: {},
107
+ onPopupScroll: {},
108
+ onInputKeyDown: {},
109
+ onPopupVisibleChange: {},
110
+ popupStyle: {},
111
+ popupPlacement: {},
112
+ popupVisible: {
113
+ type: Boolean,
114
+ default: void 0
115
+ },
116
+ expandIcon: {},
117
+ changeOnSelect: {
118
+ type: Boolean
119
+ },
120
+ displayRender: {},
121
+ showCheckedStrategy: {},
122
+ expandTrigger: {},
123
+ dropdownPrefixCls: {},
124
+ dropdownMenuColumnStyle: {},
125
+ loadingIcon: {},
126
+ emptyText: {
127
+ default: "--"
128
+ },
129
+ request: {},
130
+ lazy: {
131
+ type: Boolean
132
+ },
133
+ params: {},
134
+ loadData: {
135
+ type: Boolean
136
+ }
137
+ },
138
+ emits: ["update:value"],
139
+ setup(t, {
140
+ expose: x,
141
+ emit: B
142
+ }) {
143
+ const o = t, N = z(), T = B, f = F(), {
144
+ value: m,
145
+ updateValue: P
146
+ } = Z(o, T), V = X("Cascader", o), {
147
+ options: y,
148
+ request: h,
149
+ loading: g
150
+ } = Y(o), _ = L(() => {
151
+ let n;
152
+ const a = e(m);
153
+ if (!a.length)
154
+ return u(C, null, [o.emptyText]);
155
+ const l = [], v = o.fieldNames?.label || "label", s = o.fieldNames?.value || "value";
156
+ function i(r, d) {
157
+ const p = [];
158
+ for (const c of r) {
159
+ if (d.find((R) => R === c[s]) && p.push(c[v]), p.length === d.length)
160
+ return p;
161
+ c.children?.length && p.push(...i(c.children, d));
162
+ }
163
+ return p;
164
+ }
165
+ const D = J(a[0]) ? a : [a];
166
+ for (const r of D)
167
+ l.push(i(y.value, r));
168
+ return l.length ? u(G, {
169
+ size: 4
170
+ }, ee(n = l.map((r, d) => u("span", {
171
+ key: d
172
+ }, [r.join(", ")]))) ? n : {
173
+ default: () => [n]
174
+ }) : u(C, null, [o.emptyText]);
175
+ });
176
+ function k() {
177
+ f.value?.focus?.();
178
+ }
179
+ function I() {
180
+ f.value?.blur?.();
181
+ }
182
+ return x({
183
+ focus: k,
184
+ blur: I,
185
+ request: h
186
+ }), (n, a) => {
187
+ const l = M("Spin");
188
+ return n.mode === "read" ? (w(), b(A(_.value), {
189
+ key: 0
190
+ })) : (w(), b(e(H), U({
191
+ key: 1
192
+ }, e(Q)(o, ["onUpdate:value", "value", "options", "loadData"]), {
193
+ ref: f.value,
194
+ value: e(m),
195
+ loading: e(g),
196
+ options: e(y),
197
+ placeholder: e(V),
198
+ "load-data": n.loadData ? e(h) : void 0,
199
+ "onUpdate:value": e(P)
200
+ }), K({
201
+ _: 2
202
+ }, [q(N, (v, s) => ({
203
+ name: s,
204
+ fn: S((i) => [E(n.$slots, s, W($(i || {})))])
205
+ })), e(g) ? {
206
+ name: "notFoundContent",
207
+ fn: S(() => [u(l, {
208
+ size: "small"
209
+ })]),
210
+ key: "0"
211
+ } : void 0]), 1040, ["value", "loading", "options", "placeholder", "load-data", "onUpdate:value"]));
212
+ };
213
+ }
214
+ });
215
+ export {
216
+ ue as default
217
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,8 @@
1
+ import { ApFieldCascaderProps } from '../interface';
2
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
3
+ import { FieldMode } from '..';
4
+ declare const _default: DefineComponent<ApFieldCascaderProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ApFieldCascaderProps> & Readonly<{}>, {
5
+ mode: FieldMode;
6
+ emptyText: string;
7
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
8
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import f from "./read.vue2.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,159 @@
1
+ import { isVNode as g, defineComponent as C, computed as b, createVNode as d, Fragment as c, createBlock as w, openBlock as x, resolveDynamicComponent as B } from "vue";
2
+ import { Space as N } from "@aplus-frontend/antdv";
3
+ import { isArray as v } from "lodash-unified";
4
+ function S(o) {
5
+ return typeof o == "function" || Object.prototype.toString.call(o) === "[object Object]" && !g(o);
6
+ }
7
+ const P = /* @__PURE__ */ C({
8
+ name: "ApFieldCascaderRead",
9
+ __name: "read",
10
+ props: {
11
+ mode: {
12
+ default: "read"
13
+ },
14
+ class: {},
15
+ style: {},
16
+ multiple: {
17
+ type: Boolean
18
+ },
19
+ size: {},
20
+ bordered: {
21
+ type: Boolean
22
+ },
23
+ placement: {},
24
+ suffixIcon: {},
25
+ status: {},
26
+ options: {},
27
+ popupClassName: {},
28
+ dropdownClassName: {},
29
+ "onUpdate:value": {},
30
+ variant: {},
31
+ value: {},
32
+ children: {},
33
+ onMouseenter: {},
34
+ onMouseleave: {},
35
+ tabindex: {},
36
+ onClick: {},
37
+ onFocus: {},
38
+ onBlur: {},
39
+ onChange: {},
40
+ onKeydown: {},
41
+ onKeyup: {},
42
+ onMousedown: {},
43
+ open: {
44
+ type: Boolean
45
+ },
46
+ animation: {},
47
+ direction: {},
48
+ disabled: {
49
+ type: Boolean
50
+ },
51
+ prefixCls: {},
52
+ id: {},
53
+ autofocus: {
54
+ type: Boolean
55
+ },
56
+ getPopupContainer: {},
57
+ dropdownMatchSelectWidth: {
58
+ type: [Number, Boolean]
59
+ },
60
+ placeholder: {},
61
+ loading: {
62
+ type: Boolean
63
+ },
64
+ defaultValue: {},
65
+ prefix: {},
66
+ clearIcon: {},
67
+ allowClear: {
68
+ type: Boolean
69
+ },
70
+ getInputElement: {},
71
+ getRawInputElement: {},
72
+ fieldNames: {},
73
+ searchValue: {},
74
+ onSearch: {},
75
+ maxCount: {},
76
+ showSearch: {
77
+ type: [Boolean, Object]
78
+ },
79
+ tagRender: {},
80
+ optionLabelRender: {},
81
+ notFoundContent: {},
82
+ onClear: {},
83
+ choiceTransitionName: {},
84
+ defaultOpen: {
85
+ type: Boolean
86
+ },
87
+ onDropdownVisibleChange: {},
88
+ maxTagTextLength: {},
89
+ maxTagCount: {},
90
+ maxTagPlaceholder: {},
91
+ removeIcon: {},
92
+ transitionName: {},
93
+ dropdownStyle: {},
94
+ dropdownRender: {},
95
+ dropdownAlign: {},
96
+ showAction: {},
97
+ onPopupScroll: {},
98
+ onInputKeyDown: {},
99
+ onPopupVisibleChange: {},
100
+ popupStyle: {},
101
+ popupPlacement: {},
102
+ popupVisible: {
103
+ type: Boolean
104
+ },
105
+ expandIcon: {},
106
+ changeOnSelect: {
107
+ type: Boolean
108
+ },
109
+ displayRender: {},
110
+ showCheckedStrategy: {},
111
+ expandTrigger: {},
112
+ dropdownPrefixCls: {},
113
+ dropdownMenuColumnStyle: {},
114
+ loadingIcon: {},
115
+ emptyText: {
116
+ default: "--"
117
+ },
118
+ request: {},
119
+ lazy: {
120
+ type: Boolean
121
+ },
122
+ params: {},
123
+ loadData: {
124
+ type: Boolean
125
+ }
126
+ },
127
+ setup(o) {
128
+ const e = o, u = b(() => {
129
+ let p;
130
+ const n = e.value;
131
+ if (!n.length)
132
+ return d(c, null, [e.emptyText]);
133
+ const i = [], m = e.fieldNames?.label || "label", f = e.fieldNames?.value || "value";
134
+ function s(t, a) {
135
+ const l = [];
136
+ for (const r of t) {
137
+ if (a.find((h) => h === r[f]) && l.push(r[m]), l.length === a.length)
138
+ return l;
139
+ r.children?.length && l.push(...s(r.children, a));
140
+ }
141
+ return l;
142
+ }
143
+ const y = v(n[0]) ? n : [n];
144
+ for (const t of y)
145
+ i.push(s(e.options, t));
146
+ return i.length ? d(N, {
147
+ size: 4
148
+ }, S(p = i.map((t, a) => d("span", {
149
+ key: a
150
+ }, [t.join(", ")]))) ? p : {
151
+ default: () => [p]
152
+ }) : d(c, null, [e.emptyText]);
153
+ });
154
+ return (p, n) => (x(), w(B(u.value)));
155
+ }
156
+ });
157
+ export {
158
+ P as default
159
+ };
@@ -0,0 +1,25 @@
1
+ import { CascaderOptionType } from '@aplus-frontend/antdv/es/cascader';
2
+ import { DefaultOptionType } from '@aplus-frontend/antdv/es/select';
3
+ import { ApFieldCascaderProps } from '../interface';
4
+ import { Ref } from 'vue';
5
+ export declare const useOptions: (props: ApFieldCascaderProps) => {
6
+ options: Ref<{
7
+ [x: string]: any;
8
+ isLeaf?: boolean | undefined;
9
+ loading?: boolean | undefined;
10
+ children?: /*elided*/ any[] | undefined;
11
+ label?: any;
12
+ value?: string | number | null | undefined;
13
+ disabled?: boolean | undefined;
14
+ }[] | undefined, CascaderOptionType[] | {
15
+ [x: string]: any;
16
+ isLeaf?: boolean | undefined;
17
+ loading?: boolean | undefined;
18
+ children?: /*elided*/ any[] | undefined;
19
+ label?: any;
20
+ value?: string | number | null | undefined;
21
+ disabled?: boolean | undefined;
22
+ }[] | undefined>;
23
+ request: (selectOptions?: DefaultOptionType[], clear?: boolean) => Promise<void>;
24
+ loading: Ref<boolean, boolean>;
25
+ };
@@ -0,0 +1,66 @@
1
+ import { isFunction as v } from "lodash-unified";
2
+ import { ref as d, watch as h, onMounted as g } from "vue";
3
+ const q = (t) => {
4
+ let i = 0;
5
+ const r = d(t.options || []), l = d(!1);
6
+ h(
7
+ () => t.options,
8
+ (e) => {
9
+ r.value = e;
10
+ },
11
+ {
12
+ deep: !0
13
+ }
14
+ );
15
+ function c(e, u) {
16
+ if (!e?.length)
17
+ return;
18
+ const a = t.fieldNames?.value || "value";
19
+ for (const n of e) {
20
+ if (n[a] === u[a])
21
+ return n;
22
+ if (n.children?.length) {
23
+ const f = c(n.children, u);
24
+ if (f)
25
+ return f;
26
+ }
27
+ }
28
+ }
29
+ async function o(e, u = !1) {
30
+ if (!v(t.request))
31
+ return;
32
+ e?.length || (l.value = !0), i += 1;
33
+ const a = i;
34
+ try {
35
+ u && (r.value = []);
36
+ const n = await t.request(e, t.params);
37
+ if (a !== i)
38
+ return;
39
+ if (e?.length) {
40
+ const f = e[e.length - 1], s = c(r.value, f);
41
+ s && (s.children = n);
42
+ } else
43
+ r.value = n;
44
+ } finally {
45
+ l.value = !1;
46
+ }
47
+ }
48
+ return g(() => {
49
+ t.lazy || o();
50
+ }), h(
51
+ () => t.params,
52
+ () => {
53
+ o();
54
+ },
55
+ {
56
+ deep: !0
57
+ }
58
+ ), {
59
+ options: r,
60
+ request: o,
61
+ loading: l
62
+ };
63
+ };
64
+ export {
65
+ q as useOptions
66
+ };
@@ -1,5 +1,5 @@
1
1
  import { ComputedRef } from 'vue';
2
- import { ApFieldTextPasswordProps, ApFieldTextProps, ApFieldTextAreaProps, ApFieldNumberProps, ApFieldDateProps, ApFieldDateRangeProps, ApFieldSelectProps, BasicApFieldProps, ApFieldSecondProps } from '../interface';
2
+ import { ApFieldTextPasswordProps, ApFieldTextProps, ApFieldTextAreaProps, ApFieldNumberProps, ApFieldDateProps, ApFieldDateRangeProps, ApFieldSelectProps, BasicApFieldProps, ApFieldSecondProps, ApFieldCascaderProps, ApFieldTreeSelectProps } from '../interface';
3
3
  type FieldType = {
4
4
  Text: ApFieldTextProps;
5
5
  TextArea: ApFieldTextAreaProps;
@@ -9,6 +9,8 @@ type FieldType = {
9
9
  Select: ApFieldSelectProps;
10
10
  TextPassword: ApFieldTextPasswordProps;
11
11
  Second: ApFieldSecondProps;
12
+ Cascader: ApFieldCascaderProps;
13
+ TreeSelect: ApFieldTreeSelectProps;
12
14
  };
13
15
  type FieldNames = keyof FieldType;
14
16
  export declare const useDefaultPlaceholder: <FieldName extends FieldNames>(fieldName: FieldName, props: BasicApFieldProps<{