@aplus-frontend/ui 0.0.1-beta.5 → 0.0.1-beta.6

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 (127) hide show
  1. package/es/index.mjs +86 -65
  2. package/es/src/ap-field/checkbox/helper.mjs +5 -0
  3. package/es/src/ap-field/checkbox/index.vue.d.ts +39 -0
  4. package/es/src/ap-field/checkbox/index.vue.mjs +56 -0
  5. package/es/src/ap-field/checkbox/index.vue2.mjs +4 -0
  6. package/es/src/ap-field/date/constant.mjs +50 -0
  7. package/es/src/ap-field/date/helper.d.ts +2 -0
  8. package/es/src/ap-field/date/helper.mjs +10 -0
  9. package/es/src/ap-field/date/index.vue.d.ts +57 -0
  10. package/es/src/ap-field/date/index.vue.mjs +75 -0
  11. package/es/src/ap-field/date/index.vue2.mjs +4 -0
  12. package/es/src/ap-field/date-range/index.vue.d.ts +59 -0
  13. package/es/src/ap-field/date-range/index.vue.mjs +87 -0
  14. package/es/src/ap-field/date-range/index.vue2.mjs +4 -0
  15. package/es/src/ap-field/index.d.ts +9 -3
  16. package/es/src/ap-field/interface.d.ts +64 -5
  17. package/es/src/ap-field/number/helper.d.ts +1 -0
  18. package/es/src/ap-field/number/helper.mjs +14 -0
  19. package/es/src/ap-field/number/index.vue.d.ts +72 -0
  20. package/es/src/ap-field/number/index.vue.mjs +108 -0
  21. package/es/src/ap-field/number/index.vue2.mjs +4 -0
  22. package/es/src/ap-field/number/style.css +6 -0
  23. package/es/src/ap-field/radio/helper.d.ts +4 -0
  24. package/es/src/ap-field/radio/helper.mjs +5 -0
  25. package/es/src/ap-field/radio/index.vue.d.ts +40 -0
  26. package/es/src/ap-field/radio/index.vue.mjs +68 -0
  27. package/es/src/ap-field/radio/index.vue2.mjs +4 -0
  28. package/es/src/ap-field/select/index.vue.d.ts +235 -0
  29. package/es/src/ap-field/select/index.vue.mjs +114 -0
  30. package/es/src/ap-field/select/index.vue2.mjs +4 -0
  31. package/es/src/ap-field/switch/index.vue.d.ts +54 -0
  32. package/es/src/ap-field/switch/index.vue.mjs +93 -0
  33. package/es/src/ap-field/switch/index.vue2.mjs +4 -0
  34. package/es/src/ap-field/text/index.vue.d.ts +63 -0
  35. package/es/src/ap-field/text/index.vue.mjs +132 -0
  36. package/es/src/ap-field/text/index.vue2.mjs +4 -0
  37. package/es/src/ap-field/text-area/index.vue.d.ts +49 -0
  38. package/es/src/ap-field/text-area/index.vue.mjs +86 -0
  39. package/es/src/ap-field/text-area/index.vue2.mjs +4 -0
  40. package/es/src/ap-field/text-area/style.css +5 -0
  41. package/es/src/ap-form/index.d.ts +12 -12
  42. package/es/src/basic/help.vue.d.ts +1 -1
  43. package/es/src/basic/index.d.ts +3 -3
  44. package/es/src/config-provider/config-provider.d.ts +2 -2
  45. package/es/src/config-provider/index.d.ts +6 -6
  46. package/es/src/design-token/index.d.ts +4 -0
  47. package/es/src/design-token/index.mjs +59 -0
  48. package/es/src/index.d.ts +2 -0
  49. package/es/src/index.mjs +104 -83
  50. package/es/src/modal/basic.vue.d.ts +1 -1
  51. package/es/src/modal/components/modal-footer.vue.d.ts +1 -1
  52. package/es/src/modal/components/modal.d.ts +1 -1
  53. package/es/src/modal/index.d.ts +3 -3
  54. package/es/src/pro-form/components/api-transfer.vue.d.ts +1 -1
  55. package/es/src/pro-form/hooks/use-form-events.mjs +22 -22
  56. package/es/src/pro-form/hooks/use-form-values.mjs +12 -12
  57. package/es/src/pro-form/hooks/use-label-width.d.ts +3 -3
  58. package/es/src/pro-form/pro-form.vue.mjs +23 -23
  59. package/es/src/pro-table/hooks/use-columns.mjs +24 -24
  60. package/es/src/theme/ap-field/number.css +6 -0
  61. package/es/src/theme/ap-field/text-area.css +5 -0
  62. package/es/src/type.d.ts +3 -1
  63. package/es/src/utils/index.d.ts +7 -0
  64. package/lib/index.js +1 -1
  65. package/lib/src/ap-field/checkbox/helper.js +1 -0
  66. package/lib/src/ap-field/checkbox/index.vue.d.ts +39 -0
  67. package/lib/src/ap-field/checkbox/index.vue.js +1 -0
  68. package/lib/src/ap-field/checkbox/index.vue2.js +1 -0
  69. package/lib/src/ap-field/date/constant.js +1 -0
  70. package/lib/src/ap-field/date/helper.d.ts +2 -0
  71. package/lib/src/ap-field/date/helper.js +1 -0
  72. package/lib/src/ap-field/date/index.vue.d.ts +57 -0
  73. package/lib/src/ap-field/date/index.vue.js +1 -0
  74. package/lib/src/ap-field/date/index.vue2.js +1 -0
  75. package/lib/src/ap-field/date-range/index.vue.d.ts +59 -0
  76. package/lib/src/ap-field/date-range/index.vue.js +1 -0
  77. package/lib/src/ap-field/date-range/index.vue2.js +1 -0
  78. package/lib/src/ap-field/index.d.ts +9 -3
  79. package/lib/src/ap-field/interface.d.ts +64 -5
  80. package/lib/src/ap-field/number/helper.d.ts +1 -0
  81. package/lib/src/ap-field/number/helper.js +1 -0
  82. package/lib/src/ap-field/number/index.vue.d.ts +72 -0
  83. package/lib/src/ap-field/number/index.vue.js +1 -0
  84. package/lib/src/ap-field/number/index.vue2.js +1 -0
  85. package/lib/src/ap-field/number/style.css +6 -0
  86. package/lib/src/ap-field/radio/helper.d.ts +4 -0
  87. package/lib/src/ap-field/radio/helper.js +1 -0
  88. package/lib/src/ap-field/radio/index.vue.d.ts +40 -0
  89. package/lib/src/ap-field/radio/index.vue.js +1 -0
  90. package/lib/src/ap-field/radio/index.vue2.js +1 -0
  91. package/lib/src/ap-field/select/index.vue.d.ts +235 -0
  92. package/lib/src/ap-field/select/index.vue.js +1 -0
  93. package/lib/src/ap-field/select/index.vue2.js +1 -0
  94. package/lib/src/ap-field/switch/index.vue.d.ts +54 -0
  95. package/lib/src/ap-field/switch/index.vue.js +1 -0
  96. package/lib/src/ap-field/switch/index.vue2.js +1 -0
  97. package/lib/src/ap-field/text/index.vue.d.ts +63 -0
  98. package/lib/src/ap-field/text/index.vue.js +1 -0
  99. package/lib/src/ap-field/text/index.vue2.js +1 -0
  100. package/lib/src/ap-field/text-area/index.vue.d.ts +49 -0
  101. package/lib/src/ap-field/text-area/index.vue.js +1 -0
  102. package/lib/src/ap-field/text-area/index.vue2.js +1 -0
  103. package/lib/src/ap-field/text-area/style.css +5 -0
  104. package/lib/src/ap-form/index.d.ts +12 -12
  105. package/lib/src/basic/help.vue.d.ts +1 -1
  106. package/lib/src/basic/index.d.ts +3 -3
  107. package/lib/src/config-provider/config-provider.d.ts +2 -2
  108. package/lib/src/config-provider/index.d.ts +6 -6
  109. package/lib/src/design-token/index.d.ts +4 -0
  110. package/lib/src/design-token/index.js +1 -0
  111. package/lib/src/index.d.ts +2 -0
  112. package/lib/src/index.js +1 -1
  113. package/lib/src/modal/basic.vue.d.ts +1 -1
  114. package/lib/src/modal/components/modal-footer.vue.d.ts +1 -1
  115. package/lib/src/modal/components/modal.d.ts +1 -1
  116. package/lib/src/modal/index.d.ts +3 -3
  117. package/lib/src/pro-form/components/api-transfer.vue.d.ts +1 -1
  118. package/lib/src/pro-form/hooks/use-form-events.js +1 -1
  119. package/lib/src/pro-form/hooks/use-form-values.js +1 -1
  120. package/lib/src/pro-form/hooks/use-label-width.d.ts +3 -3
  121. package/lib/src/pro-form/pro-form.vue.js +1 -1
  122. package/lib/src/pro-table/hooks/use-columns.js +1 -1
  123. package/lib/src/theme/ap-field/number.css +6 -0
  124. package/lib/src/theme/ap-field/text-area.css +5 -0
  125. package/lib/src/type.d.ts +3 -1
  126. package/lib/src/utils/index.d.ts +7 -0
  127. package/package.json +2 -2
@@ -0,0 +1,235 @@
1
+ import { DefaultOptionType, SelectValue, LabeledValue } from 'ant-design-vue/es/select';
2
+ import { ApFieldSelectProps, FieldMode } from '../interface';
3
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes, PropType, CSSProperties } from 'vue';
4
+ import { VueTypeValidableDef } from '../../../node_modules/vue-types';
5
+ import { ButtonSize } from 'ant-design-vue/es/button';
6
+ import { VueNode } from 'ant-design-vue/es/_util/type';
7
+ import { SelectHandler, FieldNames, FilterFunc } from 'ant-design-vue/es/vc-select/Select';
8
+ import { RenderDOMFunc, DropdownRender, CustomTagProps } from 'ant-design-vue/es/vc-select/BaseSelect';
9
+ import { AlignType } from 'ant-design-vue/es/vc-trigger/interface';
10
+
11
+ type ApFieldSelectSlots = {
12
+ notFoundContent: any;
13
+ suffixIcon: any;
14
+ itemIcon: any;
15
+ removeIcon: any;
16
+ clearIcon: any;
17
+ dropdownRender: any;
18
+ option: any;
19
+ placeholder: any;
20
+ tagRender: any;
21
+ maxTagPlaceholder: any;
22
+ optionLabel: any;
23
+ default: any;
24
+ };
25
+ declare function focus(): void;
26
+ declare function blur(): void;
27
+ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApFieldSelectProps>, {
28
+ fieldProps: () => {};
29
+ emptyText: string;
30
+ mode: string;
31
+ }>, {
32
+ focus: typeof focus;
33
+ blur: typeof blur;
34
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
35
+ "update:value": (...args: any[]) => void;
36
+ }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApFieldSelectProps>, {
37
+ fieldProps: () => {};
38
+ emptyText: string;
39
+ mode: string;
40
+ }>>> & {
41
+ "onUpdate:value"?: ((...args: any[]) => any) | undefined;
42
+ }, {
43
+ mode: FieldMode;
44
+ emptyText: string;
45
+ fieldProps: Omit<Partial< ExtractPropTypes<{
46
+ value: {
47
+ type: PropType<SelectValue>;
48
+ default: SelectValue;
49
+ };
50
+ defaultValue: {
51
+ type: PropType<SelectValue>;
52
+ default: SelectValue;
53
+ };
54
+ notFoundContent: VueTypeValidableDef<any>;
55
+ suffixIcon: VueTypeValidableDef<any>;
56
+ itemIcon: VueTypeValidableDef<any>;
57
+ size: {
58
+ type: PropType<ButtonSize>;
59
+ default: ButtonSize;
60
+ };
61
+ mode: {
62
+ type: PropType<"multiple" | "tags" | "SECRET_COMBOBOX_MODE_DO_NOT_USE">;
63
+ default: "multiple" | "tags" | "SECRET_COMBOBOX_MODE_DO_NOT_USE";
64
+ };
65
+ bordered: {
66
+ type: BooleanConstructor;
67
+ default: boolean;
68
+ };
69
+ transitionName: StringConstructor;
70
+ choiceTransitionName: {
71
+ type: PropType<"">;
72
+ default: "";
73
+ };
74
+ popupClassName: StringConstructor;
75
+ dropdownClassName: StringConstructor;
76
+ placement: {
77
+ type: PropType<"bottomLeft" | "bottomRight" | "topLeft" | "topRight">;
78
+ default: "bottomLeft" | "bottomRight" | "topLeft" | "topRight";
79
+ };
80
+ status: {
81
+ type: PropType<"" | "error" | "warning">;
82
+ default: "" | "error" | "warning";
83
+ };
84
+ 'onUpdate:value': {
85
+ type: PropType<(val: SelectValue) => void>;
86
+ default: (val: SelectValue) => void;
87
+ };
88
+ children: PropType< VueNode[]>;
89
+ listHeight: NumberConstructor;
90
+ onMouseenter: PropType<(e: MouseEvent) => void>;
91
+ onMouseleave: PropType<(e: MouseEvent) => void>;
92
+ tabindex: NumberConstructor;
93
+ onClick: PropType<(e: MouseEvent) => void>;
94
+ onFocus: {
95
+ type: PropType<(e: FocusEvent) => void>;
96
+ };
97
+ onBlur: {
98
+ type: PropType<(e: FocusEvent) => void>;
99
+ };
100
+ onChange: PropType<(value: SelectValue, option: DefaultOptionType | DefaultOptionType[]) => void>;
101
+ onKeydown: PropType<(e: KeyboardEvent) => void>;
102
+ onKeyup: PropType<(e: KeyboardEvent) => void>;
103
+ onMousedown: PropType<(e: MouseEvent) => void>;
104
+ onSelect: PropType<SelectHandler<(string | number) | LabeledValue, DefaultOptionType>>;
105
+ open: {
106
+ type: BooleanConstructor;
107
+ default: any;
108
+ };
109
+ animation: StringConstructor;
110
+ direction: {
111
+ type: PropType<"ltr" | "rtl">;
112
+ };
113
+ disabled: {
114
+ type: BooleanConstructor;
115
+ default: any;
116
+ };
117
+ prefixCls: StringConstructor;
118
+ id: StringConstructor;
119
+ autofocus: BooleanConstructor;
120
+ getPopupContainer: {
121
+ type: PropType<RenderDOMFunc>;
122
+ };
123
+ virtual: {
124
+ type: BooleanConstructor;
125
+ default: any;
126
+ };
127
+ dropdownMatchSelectWidth: {
128
+ type: PropType<number | boolean>;
129
+ default: any;
130
+ };
131
+ options: PropType<DefaultOptionType[]>;
132
+ showAction: {
133
+ type: PropType<("click" | "focus")[]>;
134
+ };
135
+ placeholder: VueTypeValidableDef<any>;
136
+ onDeselect: PropType<SelectHandler<(string | number) | LabeledValue, DefaultOptionType>>;
137
+ loading: {
138
+ type: BooleanConstructor;
139
+ default: any;
140
+ };
141
+ clearIcon: VueTypeValidableDef<any>;
142
+ allowClear: {
143
+ type: BooleanConstructor;
144
+ default: any;
145
+ };
146
+ onSearch: PropType<(value: string) => void>;
147
+ fieldNames: PropType<FieldNames>;
148
+ dropdownStyle: {
149
+ type: PropType<CSSProperties>;
150
+ };
151
+ dropdownRender: {
152
+ type: PropType<DropdownRender>;
153
+ };
154
+ dropdownAlign: PropType<AlignType>;
155
+ showSearch: {
156
+ type: BooleanConstructor;
157
+ default: any;
158
+ };
159
+ searchValue: StringConstructor;
160
+ onInputKeyDown: PropType<(e: KeyboardEvent) => void>;
161
+ removeIcon: VueTypeValidableDef<any>;
162
+ maxTagCount: {
163
+ type: PropType<number | "responsive">;
164
+ };
165
+ maxTagTextLength: NumberConstructor;
166
+ maxTagPlaceholder: VueTypeValidableDef<any>;
167
+ tokenSeparators: {
168
+ type: PropType<string[]>;
169
+ };
170
+ tagRender: {
171
+ type: PropType<(props: CustomTagProps) => any>;
172
+ };
173
+ optionLabelRender: {
174
+ type: PropType<(option: Record<string, any>) => any>;
175
+ };
176
+ onClear: PropType<() => void>;
177
+ defaultOpen: {
178
+ type: BooleanConstructor;
179
+ default: any;
180
+ };
181
+ onDropdownVisibleChange: {
182
+ type: PropType<(open: boolean) => void>;
183
+ };
184
+ showArrow: {
185
+ type: BooleanConstructor;
186
+ default: any;
187
+ };
188
+ onPopupScroll: PropType<(e: UIEvent) => void>;
189
+ menuItemSelectedIcon: VueTypeValidableDef<any>;
190
+ listItemHeight: NumberConstructor;
191
+ inputValue: StringConstructor;
192
+ autoClearSearchValue: {
193
+ type: BooleanConstructor;
194
+ default: any;
195
+ };
196
+ filterOption: {
197
+ type: PropType<boolean | FilterFunc<DefaultOptionType>>;
198
+ default: any;
199
+ };
200
+ filterSort: PropType<(optionA: DefaultOptionType, optionB: DefaultOptionType) => number>;
201
+ optionFilterProp: StringConstructor;
202
+ optionLabelProp: StringConstructor;
203
+ defaultActiveFirstOption: {
204
+ type: BooleanConstructor;
205
+ default: any;
206
+ };
207
+ labelInValue: {
208
+ type: BooleanConstructor;
209
+ default: any;
210
+ };
211
+ }>>, "value" | "mode" | "onUpdate:value" | "onSearch">;
212
+ }, {}>, Readonly<ApFieldSelectSlots> & ApFieldSelectSlots>;
213
+ export default _default;
214
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
215
+ type __VLS_TypePropsToRuntimeProps<T> = {
216
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
217
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
218
+ } : {
219
+ type: PropType<T[K]>;
220
+ required: true;
221
+ };
222
+ };
223
+ type __VLS_WithDefaults<P, D> = {
224
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
225
+ default: D[K];
226
+ }> : P[K];
227
+ };
228
+ type __VLS_Prettify<T> = {
229
+ [K in keyof T]: T[K];
230
+ } & {};
231
+ type __VLS_WithTemplateSlots<T, S> = T & {
232
+ new (): {
233
+ $slots: S;
234
+ };
235
+ };
@@ -0,0 +1,114 @@
1
+ import { defineComponent as B, ref as d, onMounted as C, computed as v, unref as a, openBlock as h, createElementBlock as V, toDisplayString as T, createBlock as I, mergeProps as M, createSlots as R, renderList as U, withCtx as y, renderSlot as z, normalizeProps as N, guardReactiveProps as $, createVNode as j } from "vue";
2
+ import { debounce as D, isFunction as P, isArray as E, isNil as L } from "lodash-unified";
3
+ import { Select as G, Spin as H } from "ant-design-vue";
4
+ import "../../hooks/useMessage.mjs";
5
+ import { useControllableValue as J } from "../../hooks/useControllableValue.mjs";
6
+ const K = { key: 0 }, ee = /* @__PURE__ */ B({
7
+ name: "ApFieldSelect",
8
+ __name: "index",
9
+ props: {
10
+ mode: { default: "edit" },
11
+ fieldProps: { default: () => ({}) },
12
+ emptyText: { default: "-" },
13
+ request: {},
14
+ multiple: { type: Boolean },
15
+ value: {},
16
+ "onUpdate:value": {}
17
+ },
18
+ emits: ["update:value"],
19
+ setup(S, { expose: g, emit: F }) {
20
+ var p, m;
21
+ let s = 0;
22
+ const b = (e, l) => typeof (l == null ? void 0 : l.label) == "string" && l.label.indexOf(e) > -1, w = D((e) => {
23
+ if (!P(t.request))
24
+ return;
25
+ s += 1;
26
+ const l = s;
27
+ u.value = [], n.value = !0, t.request(e).then((o) => {
28
+ s === l && (u.value = o);
29
+ }).finally(() => {
30
+ n.value = !1;
31
+ });
32
+ }, 300), t = S, u = d(((p = t.fieldProps) == null ? void 0 : p.options) || []), f = d(), n = d(((m = t.fieldProps) == null ? void 0 : m.loading) || !1), k = F;
33
+ C(() => {
34
+ if (P(t.request)) {
35
+ n.value = !0, s += 1;
36
+ const e = s;
37
+ t.request().then((l) => {
38
+ e === s && (u.value = l);
39
+ }).finally(() => {
40
+ n.value = !1;
41
+ });
42
+ }
43
+ });
44
+ const { value: c, updateValue: _ } = J(t, k), x = v(() => {
45
+ const e = a(c);
46
+ if (!e)
47
+ return t.emptyText;
48
+ if (E(e))
49
+ return e.map(
50
+ (o) => {
51
+ var r;
52
+ return (r = a(u).find((i) => i.value === o)) == null ? void 0 : r.label;
53
+ }
54
+ ).filter(Boolean).join("、") || t.emptyText;
55
+ const l = a(u).find((o) => o.value === e);
56
+ return (l == null ? void 0 : l.label) || t.emptyText;
57
+ }), O = v(() => {
58
+ var o, r, i;
59
+ const l = !!((o = t.fieldProps) != null && o.showSearch) ? {
60
+ showArrow: !1,
61
+ defaultActiveFirstOption: !1,
62
+ onSearch: w,
63
+ notFoundContent: n.value ? void 0 : null
64
+ } : {
65
+ showArrow: !0
66
+ };
67
+ return {
68
+ ...t.fieldProps,
69
+ ...l,
70
+ filterOption: t.fieldProps.showSearch ? !1 : L((r = t.fieldProps) == null ? void 0 : r.filterOption) ? b : (i = t.fieldProps) == null ? void 0 : i.filterOption
71
+ };
72
+ });
73
+ function q() {
74
+ var e;
75
+ (e = f.value) == null || e.focus();
76
+ }
77
+ function A() {
78
+ var e;
79
+ (e = f.value) == null || e.blur();
80
+ }
81
+ return g({
82
+ focus: q,
83
+ blur: A
84
+ }), (e, l) => e.mode === "read" ? (h(), V("span", K, T(x.value), 1)) : (h(), I(a(G), M({
85
+ key: 1,
86
+ "allow-clear": "",
87
+ ref_key: "selectRef",
88
+ ref: f
89
+ }, O.value, {
90
+ mode: e.multiple ? "multiple" : void 0,
91
+ value: a(c),
92
+ "onUpdate:value": a(_),
93
+ options: u.value,
94
+ loading: n.value
95
+ }), R({ _: 2 }, [
96
+ U(e.$slots, (o, r) => ({
97
+ name: r,
98
+ fn: y((i) => [
99
+ z(e.$slots, r, N($(i || {})))
100
+ ])
101
+ })),
102
+ n.value ? {
103
+ name: "notFoundContent",
104
+ fn: y(() => [
105
+ j(a(H), { size: "small" })
106
+ ]),
107
+ key: "0"
108
+ } : void 0
109
+ ]), 1040, ["mode", "value", "onUpdate:value", "options", "loading"]));
110
+ }
111
+ });
112
+ export {
113
+ ee as default
114
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,54 @@
1
+ import { ApFieldSwitchProps } from '../interface';
2
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes, PropType } from 'vue';
3
+
4
+ type ApFieldSwitch = {
5
+ checkedChildren: any;
6
+ unCheckedChildren: any;
7
+ default: any;
8
+ };
9
+ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApFieldSwitchProps>, {
10
+ emptyText: string;
11
+ checkedValue: boolean;
12
+ unCheckedValue: boolean;
13
+ size: string;
14
+ loading: undefined;
15
+ }>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
16
+ "update:checked": (...args: any[]) => void;
17
+ }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApFieldSwitchProps>, {
18
+ emptyText: string;
19
+ checkedValue: boolean;
20
+ unCheckedValue: boolean;
21
+ size: string;
22
+ loading: undefined;
23
+ }>>> & {
24
+ "onUpdate:checked"?: ((...args: any[]) => any) | undefined;
25
+ }, {
26
+ size: "small" | "default";
27
+ loading: boolean;
28
+ checkedValue: string | number | boolean;
29
+ unCheckedValue: string | number | boolean;
30
+ emptyText: string;
31
+ }, {}>, Readonly<ApFieldSwitch> & ApFieldSwitch>;
32
+ export default _default;
33
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
34
+ type __VLS_TypePropsToRuntimeProps<T> = {
35
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
36
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
37
+ } : {
38
+ type: PropType<T[K]>;
39
+ required: true;
40
+ };
41
+ };
42
+ type __VLS_WithDefaults<P, D> = {
43
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
44
+ default: D[K];
45
+ }> : P[K];
46
+ };
47
+ type __VLS_Prettify<T> = {
48
+ [K in keyof T]: T[K];
49
+ } & {};
50
+ type __VLS_WithTemplateSlots<T, S> = T & {
51
+ new (): {
52
+ $slots: S;
53
+ };
54
+ };
@@ -0,0 +1,93 @@
1
+ import { defineComponent as v, useSlots as V, ref as B, computed as w, unref as c, createVNode as r, Fragment as u, openBlock as h, createBlock as p, resolveDynamicComponent as S, mergeProps as _, createSlots as A, renderList as N, withCtx as P, renderSlot as b, normalizeProps as F, guardReactiveProps as x } from "vue";
2
+ import { Switch as z } from "ant-design-vue";
3
+ import "../../hooks/useMessage.mjs";
4
+ import { useControllableValue as D } from "../../hooks/useControllableValue.mjs";
5
+ import { isNil as T, omit as U } from "lodash-unified";
6
+ import { isDef as $ } from "@fruits-chain/utils";
7
+ const E = /* @__PURE__ */ v({
8
+ name: "ApFieldSwitch",
9
+ __name: "index",
10
+ props: {
11
+ mode: {},
12
+ id: {},
13
+ prefixCls: {},
14
+ size: {
15
+ default: "default"
16
+ },
17
+ disabled: {
18
+ type: Boolean
19
+ },
20
+ checkedChildren: {},
21
+ unCheckedChildren: {},
22
+ tabindex: {},
23
+ autofocus: {
24
+ type: Boolean
25
+ },
26
+ loading: {
27
+ type: Boolean,
28
+ default: void 0
29
+ },
30
+ checked: {},
31
+ checkedValue: {
32
+ default: !0
33
+ },
34
+ unCheckedValue: {
35
+ default: !1
36
+ },
37
+ onChange: {},
38
+ onKeydown: {},
39
+ onMouseup: {},
40
+ "onUpdate:checked": {},
41
+ onBlur: {},
42
+ onFocus: {},
43
+ emptyText: {
44
+ default: "-"
45
+ },
46
+ onAction: {}
47
+ },
48
+ emits: ["update:checked"],
49
+ setup(m, {
50
+ emit: f
51
+ }) {
52
+ const o = V(), n = m, k = f, {
53
+ value: i,
54
+ updateValue: s
55
+ } = D(n, k, {
56
+ valuePropName: "checked"
57
+ }), l = B(!1);
58
+ async function C(e, a) {
59
+ if (!$(n.onAction)) {
60
+ s(e);
61
+ return;
62
+ }
63
+ l.value = !0;
64
+ try {
65
+ await n.onAction(e, a) && s(e);
66
+ } finally {
67
+ l.value = !1;
68
+ }
69
+ }
70
+ const y = w(() => {
71
+ var d, t;
72
+ const e = c(i);
73
+ return T(e) ? r(u, null, [n.emptyText]) : e === n.checkedValue ? r(u, null, [n.checkedChildren || ((d = o.checkedChildren) == null ? void 0 : d.call(o)) || n.checkedValue]) : r(u, null, [n.unCheckedChildren || ((t = o.unCheckedChildren) == null ? void 0 : t.call(o)) || n.unCheckedValue]);
74
+ });
75
+ return (e, a) => e.mode === "read" ? (h(), p(S(y.value), {
76
+ key: 0
77
+ })) : (h(), p(c(z), _({
78
+ key: 1
79
+ }, c(U)(n, "onUpdate:checked"), {
80
+ checked: c(i),
81
+ onClick: C,
82
+ loading: e.loading ?? l.value
83
+ }), A({
84
+ _: 2
85
+ }, [N(e.$slots, (d, t) => ({
86
+ name: t,
87
+ fn: P((g) => [b(e.$slots, t, F(x(g || {})))])
88
+ }))]), 1040, ["checked", "loading"]));
89
+ }
90
+ });
91
+ export {
92
+ E as default
93
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,63 @@
1
+ import { ApFieldTextProps, FieldMode } from '../interface';
2
+ import { InputFocusOptions } from 'ant-design-vue/es/vc-input/utils/commonUtils';
3
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes, PropType } from 'vue';
4
+
5
+ type ApFieldTextSlots = {
6
+ addonAfter(): any;
7
+ addonBefore(): any;
8
+ prefix(): any;
9
+ suffix(): any;
10
+ clearIcon(): any;
11
+ };
12
+ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApFieldTextProps>, {
13
+ emptyText: string;
14
+ mode: string;
15
+ bordered: boolean;
16
+ type: string;
17
+ lazy: boolean;
18
+ }>, {
19
+ focus: (options?: InputFocusOptions | undefined) => void;
20
+ blur: () => void;
21
+ input: any;
22
+ setSelectionRange: (start: number, end: number, direction?: "forward" | "backward" | "none" | undefined) => void;
23
+ select: () => void;
24
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
25
+ "update:value": (...args: any[]) => void;
26
+ }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApFieldTextProps>, {
27
+ emptyText: string;
28
+ mode: string;
29
+ bordered: boolean;
30
+ type: string;
31
+ lazy: boolean;
32
+ }>>> & {
33
+ "onUpdate:value"?: ((...args: any[]) => any) | undefined;
34
+ }, {
35
+ mode: FieldMode;
36
+ type: "number" | "hidden" | "button" | "time" | "reset" | "submit" | "image" | "text" | "search" | "color" | "checkbox" | "radio" | "range" | "date" | "url" | "email" | "week" | "month" | "datetime-local" | "file" | "password" | "tel";
37
+ lazy: boolean;
38
+ bordered: boolean;
39
+ emptyText: string;
40
+ }, {}>, Readonly<ApFieldTextSlots> & ApFieldTextSlots>;
41
+ export default _default;
42
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
43
+ type __VLS_TypePropsToRuntimeProps<T> = {
44
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
45
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
46
+ } : {
47
+ type: PropType<T[K]>;
48
+ required: true;
49
+ };
50
+ };
51
+ type __VLS_WithDefaults<P, D> = {
52
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
53
+ default: D[K];
54
+ }> : P[K];
55
+ };
56
+ type __VLS_Prettify<T> = {
57
+ [K in keyof T]: T[K];
58
+ } & {};
59
+ type __VLS_WithTemplateSlots<T, S> = T & {
60
+ new (): {
61
+ $slots: S;
62
+ };
63
+ };
@@ -0,0 +1,132 @@
1
+ import { defineComponent as y, ref as x, useSlots as v, computed as B, openBlock as g, createBlock as b, resolveDynamicComponent as C, createVNode as r, mergeProps as h, unref as S, Fragment as _, isVNode as R } from "vue";
2
+ import { Input as V } from "ant-design-vue";
3
+ import "../../hooks/useMessage.mjs";
4
+ import { useControllableValue as j } from "../../hooks/useControllableValue.mjs";
5
+ import { omit as F } from "lodash-unified";
6
+ function T(u) {
7
+ return typeof u == "function" || Object.prototype.toString.call(u) === "[object Object]" && !R(u);
8
+ }
9
+ const P = /* @__PURE__ */ y({
10
+ name: "ApFieldText",
11
+ __name: "index",
12
+ props: {
13
+ mode: {
14
+ default: "edit"
15
+ },
16
+ id: {},
17
+ placeholder: {},
18
+ autocomplete: {},
19
+ type: {
20
+ default: "text"
21
+ },
22
+ name: {},
23
+ size: {},
24
+ autofocus: {
25
+ type: Boolean
26
+ },
27
+ lazy: {
28
+ type: Boolean,
29
+ default: !0
30
+ },
31
+ maxlength: {},
32
+ loading: {
33
+ type: Boolean
34
+ },
35
+ bordered: {
36
+ type: Boolean,
37
+ default: !0
38
+ },
39
+ showCount: {
40
+ type: [Boolean, Object]
41
+ },
42
+ htmlSize: {},
43
+ onPressEnter: {},
44
+ onKeydown: {},
45
+ onKeyup: {},
46
+ onFocus: {},
47
+ onBlur: {},
48
+ onChange: {},
49
+ onInput: {},
50
+ "onUpdate:value": {},
51
+ onCompositionstart: {},
52
+ onCompositionend: {},
53
+ valueModifiers: {},
54
+ hidden: {
55
+ type: Boolean
56
+ },
57
+ status: {},
58
+ value: {},
59
+ defaultValue: {},
60
+ inputElement: {},
61
+ prefixCls: {},
62
+ disabled: {
63
+ type: Boolean
64
+ },
65
+ focused: {
66
+ type: Boolean
67
+ },
68
+ triggerFocus: {},
69
+ readonly: {
70
+ type: Boolean
71
+ },
72
+ handleReset: {},
73
+ addonBefore: {},
74
+ addonAfter: {},
75
+ prefix: {},
76
+ suffix: {},
77
+ clearIcon: {},
78
+ allowClear: {
79
+ type: Boolean
80
+ },
81
+ emptyText: {
82
+ default: "-"
83
+ }
84
+ },
85
+ emits: ["update:value"],
86
+ setup(u, {
87
+ expose: p,
88
+ emit: i
89
+ }) {
90
+ const a = x(), t = v();
91
+ p({
92
+ focus: (e) => {
93
+ var o;
94
+ (o = a.value) == null || o.focus(e);
95
+ },
96
+ blur: () => {
97
+ var e;
98
+ (e = a.value) == null || e.blur();
99
+ },
100
+ setSelectionRange: (e, o, m) => {
101
+ var l;
102
+ (l = a.value) == null || l.setSelectionRange(e, o, m);
103
+ },
104
+ select: () => {
105
+ var e;
106
+ (e = a.value) == null || e.select();
107
+ },
108
+ input: B(() => {
109
+ var e;
110
+ return (e = a.value) == null ? void 0 : e.input;
111
+ })
112
+ });
113
+ const c = i, n = u, {
114
+ value: d,
115
+ updateValue: f
116
+ } = j(n, c);
117
+ function s() {
118
+ var e, o;
119
+ return n.mode === "edit" ? r(V, h(F(n, ["mode", "emptyText"]), {
120
+ value: S(d),
121
+ "onUpdate:value": f,
122
+ ref: a
123
+ }), T(t) ? t : {
124
+ default: () => [t]
125
+ }) : r(_, null, [n.prefix || ((e = t == null ? void 0 : t.prefix) == null ? void 0 : e.call(t)), n.value || n.emptyText, n.suffix || ((o = t == null ? void 0 : t.suffix) == null ? void 0 : o.call(t))]);
126
+ }
127
+ return (e, o) => (g(), b(C(s())));
128
+ }
129
+ });
130
+ export {
131
+ P as default
132
+ };