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

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 (215) hide show
  1. package/es/index.mjs +114 -83
  2. package/es/src/ap-action/constant.d.ts +0 -0
  3. package/es/src/ap-action/group/index.vue.d.ts +38 -0
  4. package/es/src/ap-action/group/index.vue.mjs +64 -0
  5. package/es/src/ap-action/group/index.vue2.mjs +4 -0
  6. package/es/src/ap-action/index.d.ts +14 -0
  7. package/es/src/ap-action/index.mjs +17 -0
  8. package/es/src/ap-action/interface.d.ts +81 -0
  9. package/es/src/ap-action/item/index.vue.d.ts +44 -0
  10. package/es/src/ap-action/item/index.vue.mjs +49 -0
  11. package/es/src/ap-action/item/index.vue2.mjs +4 -0
  12. package/es/src/ap-action/item-dropdown/index.vue.d.ts +57 -0
  13. package/es/src/ap-action/item-dropdown/index.vue.mjs +92 -0
  14. package/es/src/ap-action/item-dropdown/index.vue2.mjs +4 -0
  15. package/es/src/ap-action/item-modal/index.vue.d.ts +41 -0
  16. package/es/src/ap-action/item-modal/index.vue.mjs +34 -0
  17. package/es/src/ap-action/item-modal/index.vue2.mjs +4 -0
  18. package/es/src/ap-action/item-popconfirm/index.vue.d.ts +343 -0
  19. package/es/src/ap-action/item-popconfirm/index.vue.mjs +37 -0
  20. package/es/src/ap-action/item-popconfirm/index.vue2.mjs +4 -0
  21. package/es/src/ap-action/style/item-dropdown.css +11 -0
  22. package/es/src/ap-action/style/item.css +28 -0
  23. package/es/src/ap-field/checkbox/helper.mjs +5 -0
  24. package/es/src/ap-field/checkbox/index.vue.d.ts +39 -0
  25. package/es/src/ap-field/checkbox/index.vue.mjs +56 -0
  26. package/es/src/ap-field/checkbox/index.vue2.mjs +4 -0
  27. package/es/src/ap-field/date/constant.mjs +50 -0
  28. package/es/src/ap-field/date/helper.d.ts +2 -0
  29. package/es/src/ap-field/date/helper.mjs +10 -0
  30. package/es/src/ap-field/date/index.vue.d.ts +57 -0
  31. package/es/src/ap-field/date/index.vue.mjs +75 -0
  32. package/es/src/ap-field/date/index.vue2.mjs +4 -0
  33. package/es/src/ap-field/date-range/index.vue.d.ts +59 -0
  34. package/es/src/ap-field/date-range/index.vue.mjs +87 -0
  35. package/es/src/ap-field/date-range/index.vue2.mjs +4 -0
  36. package/es/src/ap-field/index.d.ts +9 -3
  37. package/es/src/ap-field/interface.d.ts +65 -5
  38. package/es/src/ap-field/number/helper.d.ts +1 -0
  39. package/es/src/ap-field/number/helper.mjs +14 -0
  40. package/es/src/ap-field/number/index.vue.d.ts +72 -0
  41. package/es/src/ap-field/number/index.vue.mjs +108 -0
  42. package/es/src/ap-field/number/index.vue2.mjs +4 -0
  43. package/es/src/ap-field/number/style.css +6 -0
  44. package/es/src/ap-field/radio/helper.d.ts +4 -0
  45. package/es/src/ap-field/radio/helper.mjs +5 -0
  46. package/es/src/ap-field/radio/index.vue.d.ts +40 -0
  47. package/es/src/ap-field/radio/index.vue.mjs +68 -0
  48. package/es/src/ap-field/radio/index.vue2.mjs +4 -0
  49. package/es/src/ap-field/select/index.vue.d.ts +235 -0
  50. package/es/src/ap-field/select/index.vue.mjs +114 -0
  51. package/es/src/ap-field/select/index.vue2.mjs +4 -0
  52. package/es/src/ap-field/switch/index.vue.d.ts +54 -0
  53. package/es/src/ap-field/switch/index.vue.mjs +122 -0
  54. package/es/src/ap-field/switch/index.vue2.mjs +4 -0
  55. package/es/src/ap-field/text/index.vue.d.ts +63 -0
  56. package/es/src/ap-field/text/index.vue.mjs +132 -0
  57. package/es/src/ap-field/text/index.vue2.mjs +4 -0
  58. package/es/src/ap-field/text-area/index.vue.d.ts +49 -0
  59. package/es/src/ap-field/text-area/index.vue.mjs +86 -0
  60. package/es/src/ap-field/text-area/index.vue2.mjs +4 -0
  61. package/es/src/ap-field/text-area/style.css +5 -0
  62. package/es/src/ap-form/index.d.ts +64 -64
  63. package/es/src/base-button/index.d.ts +28 -28
  64. package/es/src/basic/help.vue.d.ts +1 -1
  65. package/es/src/basic/index.d.ts +3 -3
  66. package/es/src/config-provider/config-provider.d.ts +2 -2
  67. package/es/src/config-provider/index.d.ts +6 -6
  68. package/es/src/count-down/index.d.ts +12 -12
  69. package/es/src/cropper/cropper-avatar.vue.d.ts +1 -1
  70. package/es/src/cropper/cropper-image.vue.d.ts +1 -1
  71. package/es/src/cropper/index.d.ts +42 -42
  72. package/es/src/description/description.vue.d.ts +1 -1
  73. package/es/src/description/index.d.ts +3 -3
  74. package/es/src/design-token/index.d.ts +4 -0
  75. package/es/src/design-token/index.mjs +59 -0
  76. package/es/src/dropdown/dropdown.vue.d.ts +1 -1
  77. package/es/src/dropdown/index.d.ts +7 -7
  78. package/es/src/icon/index.d.ts +41 -41
  79. package/es/src/icon-picker/icon-picker.vue.d.ts +3 -3
  80. package/es/src/icon-picker/index.d.ts +45 -45
  81. package/es/src/index.d.ts +3 -0
  82. package/es/src/index.mjs +121 -90
  83. package/es/src/modal/basic.vue.d.ts +3 -2
  84. package/es/src/modal/basic.vue.mjs +53 -49
  85. package/es/src/modal/components/modal-footer.vue.d.ts +1 -1
  86. package/es/src/modal/components/modal.d.ts +1 -1
  87. package/es/src/modal/index.d.ts +7 -8
  88. package/es/src/modal/index.mjs +2 -3
  89. package/es/src/modal/props.mjs +1 -1
  90. package/es/src/modal/style/index.css +29 -30
  91. package/es/src/pro-form/components/api-radio-group.vue.d.ts +1 -1
  92. package/es/src/pro-form/components/api-select.vue.d.ts +2 -2
  93. package/es/src/pro-form/components/api-tree.vue.d.ts +1 -1
  94. package/es/src/pro-form/hooks/use-form-events.mjs +22 -22
  95. package/es/src/pro-form/hooks/use-form-values.mjs +12 -12
  96. package/es/src/pro-form/hooks/use-label-width.d.ts +5 -5
  97. package/es/src/pro-form/pro-form.vue.d.ts +1 -1
  98. package/es/src/pro-form/pro-form.vue.mjs +23 -23
  99. package/es/src/pro-table/hooks/use-columns.mjs +24 -24
  100. package/es/src/strength-meter/index.d.ts +12 -12
  101. package/es/src/theme/ap-action/item-dropdown.css +11 -0
  102. package/es/src/theme/ap-action/item.css +28 -0
  103. package/es/src/theme/ap-field/number.css +6 -0
  104. package/es/src/theme/ap-field/text-area.css +5 -0
  105. package/es/src/theme/modal/index.css +29 -30
  106. package/es/src/type.d.ts +3 -1
  107. package/es/src/utils/index.d.ts +7 -0
  108. package/lib/index.js +1 -1
  109. package/lib/src/ap-action/constant.d.ts +0 -0
  110. package/lib/src/ap-action/group/index.vue.d.ts +38 -0
  111. package/lib/src/ap-action/group/index.vue.js +1 -0
  112. package/lib/src/ap-action/group/index.vue2.js +1 -0
  113. package/lib/src/ap-action/index.d.ts +14 -0
  114. package/lib/src/ap-action/index.js +1 -0
  115. package/lib/src/ap-action/interface.d.ts +81 -0
  116. package/lib/src/ap-action/item/index.vue.d.ts +44 -0
  117. package/lib/src/ap-action/item/index.vue.js +1 -0
  118. package/lib/src/ap-action/item/index.vue2.js +1 -0
  119. package/lib/src/ap-action/item-dropdown/index.vue.d.ts +57 -0
  120. package/lib/src/ap-action/item-dropdown/index.vue.js +1 -0
  121. package/lib/src/ap-action/item-dropdown/index.vue2.js +1 -0
  122. package/lib/src/ap-action/item-modal/index.vue.d.ts +41 -0
  123. package/lib/src/ap-action/item-modal/index.vue.js +1 -0
  124. package/lib/src/ap-action/item-modal/index.vue2.js +1 -0
  125. package/lib/src/ap-action/item-popconfirm/index.vue.d.ts +343 -0
  126. package/lib/src/ap-action/item-popconfirm/index.vue.js +1 -0
  127. package/lib/src/ap-action/item-popconfirm/index.vue2.js +1 -0
  128. package/lib/src/ap-action/style/item-dropdown.css +11 -0
  129. package/lib/src/ap-action/style/item.css +28 -0
  130. package/lib/src/ap-field/checkbox/helper.js +1 -0
  131. package/lib/src/ap-field/checkbox/index.vue.d.ts +39 -0
  132. package/lib/src/ap-field/checkbox/index.vue.js +1 -0
  133. package/lib/src/ap-field/checkbox/index.vue2.js +1 -0
  134. package/lib/src/ap-field/date/constant.js +1 -0
  135. package/lib/src/ap-field/date/helper.d.ts +2 -0
  136. package/lib/src/ap-field/date/helper.js +1 -0
  137. package/lib/src/ap-field/date/index.vue.d.ts +57 -0
  138. package/lib/src/ap-field/date/index.vue.js +1 -0
  139. package/lib/src/ap-field/date/index.vue2.js +1 -0
  140. package/lib/src/ap-field/date-range/index.vue.d.ts +59 -0
  141. package/lib/src/ap-field/date-range/index.vue.js +1 -0
  142. package/lib/src/ap-field/date-range/index.vue2.js +1 -0
  143. package/lib/src/ap-field/index.d.ts +9 -3
  144. package/lib/src/ap-field/interface.d.ts +65 -5
  145. package/lib/src/ap-field/number/helper.d.ts +1 -0
  146. package/lib/src/ap-field/number/helper.js +1 -0
  147. package/lib/src/ap-field/number/index.vue.d.ts +72 -0
  148. package/lib/src/ap-field/number/index.vue.js +1 -0
  149. package/lib/src/ap-field/number/index.vue2.js +1 -0
  150. package/lib/src/ap-field/number/style.css +6 -0
  151. package/lib/src/ap-field/radio/helper.d.ts +4 -0
  152. package/lib/src/ap-field/radio/helper.js +1 -0
  153. package/lib/src/ap-field/radio/index.vue.d.ts +40 -0
  154. package/lib/src/ap-field/radio/index.vue.js +1 -0
  155. package/lib/src/ap-field/radio/index.vue2.js +1 -0
  156. package/lib/src/ap-field/select/index.vue.d.ts +235 -0
  157. package/lib/src/ap-field/select/index.vue.js +1 -0
  158. package/lib/src/ap-field/select/index.vue2.js +1 -0
  159. package/lib/src/ap-field/switch/index.vue.d.ts +54 -0
  160. package/lib/src/ap-field/switch/index.vue.js +1 -0
  161. package/lib/src/ap-field/switch/index.vue2.js +1 -0
  162. package/lib/src/ap-field/text/index.vue.d.ts +63 -0
  163. package/lib/src/ap-field/text/index.vue.js +1 -0
  164. package/lib/src/ap-field/text/index.vue2.js +1 -0
  165. package/lib/src/ap-field/text-area/index.vue.d.ts +49 -0
  166. package/lib/src/ap-field/text-area/index.vue.js +1 -0
  167. package/lib/src/ap-field/text-area/index.vue2.js +1 -0
  168. package/lib/src/ap-field/text-area/style.css +5 -0
  169. package/lib/src/ap-form/index.d.ts +64 -64
  170. package/lib/src/base-button/index.d.ts +28 -28
  171. package/lib/src/basic/help.vue.d.ts +1 -1
  172. package/lib/src/basic/index.d.ts +3 -3
  173. package/lib/src/config-provider/config-provider.d.ts +2 -2
  174. package/lib/src/config-provider/index.d.ts +6 -6
  175. package/lib/src/count-down/index.d.ts +12 -12
  176. package/lib/src/cropper/cropper-avatar.vue.d.ts +1 -1
  177. package/lib/src/cropper/cropper-image.vue.d.ts +1 -1
  178. package/lib/src/cropper/index.d.ts +42 -42
  179. package/lib/src/description/description.vue.d.ts +1 -1
  180. package/lib/src/description/index.d.ts +3 -3
  181. package/lib/src/design-token/index.d.ts +4 -0
  182. package/lib/src/design-token/index.js +1 -0
  183. package/lib/src/dropdown/dropdown.vue.d.ts +1 -1
  184. package/lib/src/dropdown/index.d.ts +7 -7
  185. package/lib/src/icon/index.d.ts +41 -41
  186. package/lib/src/icon-picker/icon-picker.vue.d.ts +3 -3
  187. package/lib/src/icon-picker/index.d.ts +45 -45
  188. package/lib/src/index.d.ts +3 -0
  189. package/lib/src/index.js +1 -1
  190. package/lib/src/modal/basic.vue.d.ts +3 -2
  191. package/lib/src/modal/basic.vue.js +1 -1
  192. package/lib/src/modal/components/modal-footer.vue.d.ts +1 -1
  193. package/lib/src/modal/components/modal.d.ts +1 -1
  194. package/lib/src/modal/index.d.ts +7 -8
  195. package/lib/src/modal/index.js +1 -1
  196. package/lib/src/modal/props.js +1 -1
  197. package/lib/src/modal/style/index.css +29 -30
  198. package/lib/src/pro-form/components/api-radio-group.vue.d.ts +1 -1
  199. package/lib/src/pro-form/components/api-select.vue.d.ts +2 -2
  200. package/lib/src/pro-form/components/api-tree.vue.d.ts +1 -1
  201. package/lib/src/pro-form/hooks/use-form-events.js +1 -1
  202. package/lib/src/pro-form/hooks/use-form-values.js +1 -1
  203. package/lib/src/pro-form/hooks/use-label-width.d.ts +5 -5
  204. package/lib/src/pro-form/pro-form.vue.d.ts +1 -1
  205. package/lib/src/pro-form/pro-form.vue.js +1 -1
  206. package/lib/src/pro-table/hooks/use-columns.js +1 -1
  207. package/lib/src/strength-meter/index.d.ts +12 -12
  208. package/lib/src/theme/ap-action/item-dropdown.css +11 -0
  209. package/lib/src/theme/ap-action/item.css +28 -0
  210. package/lib/src/theme/ap-field/number.css +6 -0
  211. package/lib/src/theme/ap-field/text-area.css +5 -0
  212. package/lib/src/theme/modal/index.css +29 -30
  213. package/lib/src/type.d.ts +3 -1
  214. package/lib/src/utils/index.d.ts +7 -0
  215. package/package.json +3 -3
@@ -0,0 +1,56 @@
1
+ import { defineComponent as x, ref as k, onMounted as y, openBlock as o, createElementBlock as i, Fragment as p, unref as e, createTextVNode as m, toDisplayString as s, createBlock as g, mergeProps as h } from "vue";
2
+ import { isFunction as C, isNil as V } from "lodash-unified";
3
+ import { CheckboxGroup as b } from "ant-design-vue";
4
+ import "../../hooks/useMessage.mjs";
5
+ import { useControllableValue as _ } from "../../hooks/useControllableValue.mjs";
6
+ import { getOptionValue as B, getOptionLabel as T } from "./helper.mjs";
7
+ const D = /* @__PURE__ */ x({
8
+ name: "ApFieldCheckbox",
9
+ inheritAttrs: !1,
10
+ __name: "index",
11
+ props: {
12
+ mode: { default: "edit" },
13
+ defaultValue: {},
14
+ value: {},
15
+ onChange: {},
16
+ "onUpdate:value": {},
17
+ name: {},
18
+ prefixCls: {},
19
+ options: { default: () => [] },
20
+ disabled: { type: Boolean },
21
+ id: {},
22
+ emptyText: { default: "-" },
23
+ request: {}
24
+ },
25
+ emits: ["update:value"],
26
+ setup(d, { emit: f }) {
27
+ const c = f, t = d, a = k(t.options);
28
+ y(() => {
29
+ C(t.request) && t.request().then((l) => a.value = l);
30
+ });
31
+ const { value: n, updateValue: v } = _(
32
+ t,
33
+ c,
34
+ {
35
+ defaultValue: []
36
+ }
37
+ );
38
+ return (l, q) => {
39
+ var u;
40
+ return l.mode === "read" ? (o(), i(p, { key: 0 }, [
41
+ e(V)(e(n)) ? (o(), i(p, { key: 0 }, [
42
+ m(s(t.emptyText), 1)
43
+ ], 64)) : (o(), i(p, { key: 1 }, [
44
+ m(s(((u = a.value) == null ? void 0 : u.filter((r) => e(n).indexOf(e(B)(r)) > -1).map((r) => e(T)(r)).join("、")) || t.emptyText), 1)
45
+ ], 64))
46
+ ], 64)) : (o(), g(e(b), h({ key: 1 }, t, {
47
+ options: a.value,
48
+ value: e(n),
49
+ "onUpdate:value": e(v)
50
+ }), null, 16, ["options", "value", "onUpdate:value"]));
51
+ };
52
+ }
53
+ });
54
+ export {
55
+ D as default
56
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,50 @@
1
+ const Y = [
2
+ "Y",
3
+ "Y-M",
4
+ "Y-D",
5
+ "Y-h",
6
+ "Y-m",
7
+ "Y-s"
8
+ ], e = {
9
+ Y: "YYYY",
10
+ "Y-M": "YYYY-MM",
11
+ "Y-D": "YYYY-MM-DD",
12
+ "Y-h": "YYYY-MM-DD HH",
13
+ "Y-m": "YYYY-MM-DD HH:mm",
14
+ "Y-s": "YYYY-MM-DD HH:mm:ss"
15
+ }, s = {
16
+ Y: "year",
17
+ "Y-M": "month",
18
+ "Y-D": "date",
19
+ "Y-h": "date",
20
+ "Y-m": "date",
21
+ "Y-s": "date"
22
+ }, M = {
23
+ Y: {
24
+ showTime: !1
25
+ },
26
+ "Y-M": {
27
+ showTime: !1
28
+ },
29
+ "Y-D": {
30
+ showTime: !1
31
+ },
32
+ "Y-h": {
33
+ showTime: !0,
34
+ showSecond: !1,
35
+ showMinute: !1
36
+ },
37
+ "Y-m": {
38
+ showTime: !0,
39
+ showSecond: !1
40
+ },
41
+ "Y-s": {
42
+ showTime: !0
43
+ }
44
+ };
45
+ export {
46
+ Y as ApFieldDatePresetFormats,
47
+ e as PRESET_FORMAT_MAP,
48
+ s as PRESET_FORMAT_PICK_MAP,
49
+ M as PRESET_FORMAT_TIME_MAP
50
+ };
@@ -1,3 +1,5 @@
1
+ import { EventValue } from 'ant-design-vue/es/vc-picker/interface';
1
2
  import { Dayjs } from 'dayjs';
2
3
 
3
4
  export declare const formatDay: (d: Dayjs, f: string, begin?: boolean) => number | null;
5
+ export declare const formatValue: (v: EventValue<Dayjs>) => number | null;
@@ -0,0 +1,10 @@
1
+ const o = (e, n, f = !0) => {
2
+ if (!e)
3
+ return null;
4
+ let t = e.clone();
5
+ return t = t.millisecond(0), n.indexOf("ss") === -1 && (t = t.second(f ? 0 : 59)), n.indexOf("mm") === -1 && (t = t.minute(f ? 0 : 59)), n.indexOf("HH") === -1 && (t = t.hour(f ? 0 : 23)), n.indexOf("DD") === -1 && (t = t.date(f ? 1 : 0), f || (t = t.month(t.month() + 1))), n.indexOf("MM") === -1 && (t = t.month(f ? 0 : 12)), t.valueOf();
6
+ }, i = (e) => e && e.valueOf();
7
+ export {
8
+ o as formatDay,
9
+ i as formatValue
10
+ };
@@ -0,0 +1,57 @@
1
+ import { ApFieldDateProps, FieldMode } from '../interface';
2
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes, PropType } from 'vue';
3
+ import { DatePickerProps } from 'ant-design-vue';
4
+
5
+ type ApFieldDataSlots = {
6
+ dateRender: any;
7
+ suffixIcon?: any;
8
+ prevIcon?: any;
9
+ nextIcon?: any;
10
+ superPrevIcon?: any;
11
+ superNextIcon?: any;
12
+ renderExtraFooter?: any;
13
+ monthCellRender?: any;
14
+ monthCellContentRender?: any;
15
+ clearIcon?: any;
16
+ default?: any;
17
+ };
18
+ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApFieldDateProps>, {
19
+ format: string;
20
+ mode: string;
21
+ fieldProps: () => {};
22
+ }>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
23
+ "update:value": (...args: any[]) => void;
24
+ }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApFieldDateProps>, {
25
+ format: string;
26
+ mode: string;
27
+ fieldProps: () => {};
28
+ }>>> & {
29
+ "onUpdate:value"?: ((...args: any[]) => any) | undefined;
30
+ }, {
31
+ mode: FieldMode;
32
+ format: string;
33
+ fieldProps: Omit< DatePickerProps, "mode" | "onOk" | "onChange" | "value" | "defaultValue" | "format">;
34
+ }, {}>, Readonly<ApFieldDataSlots> & ApFieldDataSlots>;
35
+ export default _default;
36
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
37
+ type __VLS_TypePropsToRuntimeProps<T> = {
38
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
39
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
40
+ } : {
41
+ type: PropType<T[K]>;
42
+ required: true;
43
+ };
44
+ };
45
+ type __VLS_WithDefaults<P, D> = {
46
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
47
+ default: D[K];
48
+ }> : P[K];
49
+ };
50
+ type __VLS_Prettify<T> = {
51
+ [K in keyof T]: T[K];
52
+ } & {};
53
+ type __VLS_WithTemplateSlots<T, S> = T & {
54
+ new (): {
55
+ $slots: S;
56
+ };
57
+ };
@@ -0,0 +1,75 @@
1
+ import { defineComponent as C, computed as s, unref as o, openBlock as p, createElementBlock as E, Fragment as F, createTextVNode as R, toDisplayString as M, createBlock as D, mergeProps as S, createSlots as V, renderList as x, withCtx as j, renderSlot as B, normalizeProps as I, guardReactiveProps as N } from "vue";
2
+ import i from "dayjs";
3
+ import { DatePicker as U } from "ant-design-vue";
4
+ import { ApFieldDatePresetFormats as $, PRESET_FORMAT_MAP as b, PRESET_FORMAT_PICK_MAP as w, PRESET_FORMAT_TIME_MAP as z } from "./constant.mjs";
5
+ import "../../hooks/useMessage.mjs";
6
+ import { useControllableValue as K } from "../../hooks/useControllableValue.mjs";
7
+ import { isNil as P } from "lodash-unified";
8
+ import { formatDay as d } from "./helper.mjs";
9
+ const X = /* @__PURE__ */ C({
10
+ name: "ApFieldDate",
11
+ inheritAttrs: !1,
12
+ __name: "index",
13
+ props: {
14
+ mode: { default: "edit" },
15
+ fieldProps: { default: () => ({}) },
16
+ emptyText: {},
17
+ value: {},
18
+ defaultValue: {},
19
+ onChange: {},
20
+ onOk: {},
21
+ format: { default: "Y-D" }
22
+ },
23
+ emits: ["update:value"],
24
+ setup(k, { emit: v }) {
25
+ const e = k, _ = v, { value: u, updateValue: c } = K(e, _), n = s(
26
+ () => $.indexOf(e.format) > -1
27
+ ), l = s(
28
+ () => n.value ? b[e.format] : e.format
29
+ ), O = s(() => P(o(u)) ? void 0 : i(o(u))), g = s(() => o(n) ? e.fieldProps.picker ?? w[e.format] : e.fieldProps.picker), h = s(() => {
30
+ const t = o(n) ? z[e.format] : {};
31
+ return {
32
+ ...e.fieldProps,
33
+ ...t
34
+ };
35
+ });
36
+ function y(t) {
37
+ if (P(t)) {
38
+ c(null);
39
+ return;
40
+ }
41
+ const r = i(t);
42
+ o(n) ? c(d(r, o(l))) : c(r.valueOf());
43
+ }
44
+ function T(t, r) {
45
+ var f;
46
+ const m = i(t), a = o(n) ? d(m, o(l)) : t ? m.valueOf() : null;
47
+ (f = e.onChange) == null || f.call(e, a, r);
48
+ }
49
+ function A(t) {
50
+ var a;
51
+ const r = i(t), m = o(n) ? d(r, o(l)) : t ? r.valueOf() : null;
52
+ (a = e.onOk) == null || a.call(e, m);
53
+ }
54
+ return (t, r) => t.mode === "read" ? (p(), E(F, { key: 0 }, [
55
+ R(M(o(u) ? o(i)(o(u)).format(l.value) : t.emptyText), 1)
56
+ ], 64)) : (p(), D(o(U), S({ key: 1 }, h.value, {
57
+ value: O.value,
58
+ format: l.value,
59
+ "onUpdate:value": y,
60
+ onChange: T,
61
+ onOk: A,
62
+ picker: g.value
63
+ }), V({ _: 2 }, [
64
+ x(t.$slots, (m, a) => ({
65
+ name: a,
66
+ fn: j((f) => [
67
+ B(t.$slots, a, I(N(f || {})))
68
+ ])
69
+ }))
70
+ ]), 1040, ["value", "format", "picker"]));
71
+ }
72
+ });
73
+ export {
74
+ X as default
75
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,59 @@
1
+ import { ApFieldDateRangeProps, FieldMode } from '../interface';
2
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes, PropType } from 'vue';
3
+ import { RangePickerProps } from 'ant-design-vue/es/date-picker';
4
+
5
+ type ApFieldDateRangeSlots = {
6
+ suffixIcon?: any;
7
+ prevIcon?: any;
8
+ nextIcon?: any;
9
+ superPrevIcon?: any;
10
+ superNextIcon?: any;
11
+ dateRender?: any;
12
+ renderExtraFooter?: any;
13
+ default?: any;
14
+ separator?: any;
15
+ clearIcon?: any;
16
+ };
17
+ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApFieldDateRangeProps>, {
18
+ emptyText: string;
19
+ mode: string;
20
+ format: string;
21
+ fieldProps: () => {};
22
+ }>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
23
+ "update:value": (...args: any[]) => void;
24
+ }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApFieldDateRangeProps>, {
25
+ emptyText: string;
26
+ mode: string;
27
+ format: string;
28
+ fieldProps: () => {};
29
+ }>>> & {
30
+ "onUpdate:value"?: ((...args: any[]) => any) | undefined;
31
+ }, {
32
+ mode: FieldMode;
33
+ format: string;
34
+ emptyText: string;
35
+ fieldProps: Omit< RangePickerProps, "onOk" | "onChange" | "value" | "defaultValue" | "renderExtraFooter" | "onPanelChange">;
36
+ }, {}>, Readonly<ApFieldDateRangeSlots> & ApFieldDateRangeSlots>;
37
+ export default _default;
38
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
39
+ type __VLS_TypePropsToRuntimeProps<T> = {
40
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
41
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
42
+ } : {
43
+ type: PropType<T[K]>;
44
+ required: true;
45
+ };
46
+ };
47
+ type __VLS_WithDefaults<P, D> = {
48
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
49
+ default: D[K];
50
+ }> : P[K];
51
+ };
52
+ type __VLS_Prettify<T> = {
53
+ [K in keyof T]: T[K];
54
+ } & {};
55
+ type __VLS_WithTemplateSlots<T, S> = T & {
56
+ new (): {
57
+ $slots: S;
58
+ };
59
+ };
@@ -0,0 +1,87 @@
1
+ import { defineComponent as V, computed as m, unref as t, openBlock as p, createElementBlock as k, Fragment as _, createTextVNode as T, toDisplayString as O, createVNode as C, createBlock as x, mergeProps as B, createSlots as N, renderList as w, withCtx as I, renderSlot as U, normalizeProps as $, guardReactiveProps as b } from "vue";
2
+ import { ApFieldDatePresetFormats as j, PRESET_FORMAT_MAP as z, PRESET_FORMAT_PICK_MAP as K, PRESET_FORMAT_TIME_MAP as L } from "../date/constant.mjs";
3
+ import "../../hooks/useMessage.mjs";
4
+ import { useControllableValue as Y } from "../../hooks/useControllableValue.mjs";
5
+ import { isNil as q, isString as c } from "lodash-unified";
6
+ import u from "dayjs";
7
+ import { DatePicker as G } from "ant-design-vue";
8
+ import { formatDay as d, formatValue as R } from "../date/helper.mjs";
9
+ import { SwapRightOutlined as H } from "@ant-design/icons-vue";
10
+ const ae = /* @__PURE__ */ V({
11
+ __name: "index",
12
+ props: {
13
+ mode: { default: "edit" },
14
+ fieldProps: { default: () => ({}) },
15
+ emptyText: { default: "-" },
16
+ value: {},
17
+ defaultValue: {},
18
+ onChange: {},
19
+ onOk: {},
20
+ format: { default: "Y-D" }
21
+ },
22
+ emits: ["update:value"],
23
+ setup(y, { emit: D }) {
24
+ const o = y, E = D, l = m(
25
+ () => j.indexOf(o.format) > -1
26
+ ), n = m(
27
+ () => l.value ? z[o.format] : o.format
28
+ ), { value: P, updateValue: v } = Y(
29
+ o,
30
+ E
31
+ ), s = m(() => {
32
+ var e, r;
33
+ if (!q(t(P)))
34
+ return [
35
+ u((e = t(P)) == null ? void 0 : e[0]),
36
+ u((r = t(P)) == null ? void 0 : r[1])
37
+ ];
38
+ }), S = m(() => t(l) ? o.fieldProps.picker ?? K[o.format] : o.fieldProps.picker), A = m(() => {
39
+ const e = t(l) ? L[o.format] : {};
40
+ return {
41
+ ...o.fieldProps,
42
+ ...e
43
+ };
44
+ });
45
+ function F(e) {
46
+ e || v(null);
47
+ const r = c(e[0]) ? u(e[0]) : e[0], a = c(e[1]) ? u(e[1]) : e[1];
48
+ t(l) ? v([
49
+ d(r, t(n)),
50
+ d(a, t(n), !1)
51
+ ]) : v([R(r), R(a)]);
52
+ }
53
+ function M(e) {
54
+ var i;
55
+ const r = c(e[0]) ? u(e[0]) : e[0], a = c(e[1]) ? u(e[1]) : e[1], f = e[0] ? t(l) ? d(r, t(n)) : r.valueOf() : null, g = e[1] ? t(l) ? d(a, t(n), !1) : a.valueOf() : null;
56
+ (i = o.onOk) == null || i.call(o, [f, g]);
57
+ }
58
+ return (e, r) => {
59
+ var a, f;
60
+ return e.mode === "read" ? (p(), k(_, { key: 0 }, [
61
+ s.value ? (p(), k(_, { key: 0 }, [
62
+ T(O((a = s.value[0]) == null ? void 0 : a.format(n.value)) + " ", 1),
63
+ C(t(H)),
64
+ T(" " + O((f = s.value[1]) == null ? void 0 : f.format(n.value)), 1)
65
+ ], 64)) : (p(), k(_, { key: 1 }, [
66
+ T(O(e.emptyText), 1)
67
+ ], 64))
68
+ ], 64)) : (p(), x(t(G).RangePicker, B({ key: 1 }, A.value, {
69
+ value: s.value,
70
+ "onUpdate:value": F,
71
+ picker: S.value,
72
+ format: n.value,
73
+ onOk: M
74
+ }), N({ _: 2 }, [
75
+ w(e.$slots, (g, i) => ({
76
+ name: i,
77
+ fn: I((h) => [
78
+ U(e.$slots, i, $(b(h || {})))
79
+ ])
80
+ }))
81
+ ]), 1040, ["value", "picker", "format"]));
82
+ };
83
+ }
84
+ });
85
+ export {
86
+ ae as default
87
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -1,6 +1,12 @@
1
1
  import { default as ApFieldText } from './text/index.vue';
2
- import { default as ApFiledCheckbox } from './checkbox/index.vue';
3
- import { default as ApFiledDate } from './date/index.vue';
2
+ import { default as ApFieldCheckbox } from './checkbox/index.vue';
3
+ import { default as ApFieldDate } from './date/index.vue';
4
+ import { default as ApFieldNumber } from './number/index.vue';
5
+ import { default as ApFieldRadio } from './radio/index.vue';
6
+ import { default as ApFieldSwitch } from './switch/index.vue';
7
+ import { default as ApFieldTextArea } from './text-area/index.vue';
8
+ import { default as ApFieldDateRange } from './date-range/index.vue';
9
+ import { default as ApFieldSelect } from './select/index.vue';
4
10
 
5
11
  export * from './interface';
6
- export { ApFieldText, ApFiledCheckbox, ApFiledDate };
12
+ export { ApFieldText, ApFieldCheckbox, ApFieldDate, ApFieldNumber, ApFieldRadio, ApFieldSwitch, ApFieldTextArea, ApFieldDateRange, ApFieldSelect };
@@ -1,18 +1,24 @@
1
- import { InputProps, CheckboxGroupProps, DatePickerProps } from 'ant-design-vue';
1
+ import { InputProps, CheckboxGroupProps, DatePickerProps, InputNumberProps, RadioGroupProps, SwitchProps, TextAreaProps, SelectProps, PopconfirmProps } from 'ant-design-vue';
2
2
  import { InputFocusOptions } from 'ant-design-vue/es/vc-input/utils/commonUtils';
3
3
  import { ApFormatPresetType } from './date/interface';
4
- import { PanelMode } from 'ant-design-vue/es/vc-picker/interface';
4
+ import { RangeValue } from 'ant-design-vue/es/vc-picker/interface';
5
+ import { RangePickerProps } from 'ant-design-vue/es/date-picker/dayjs';
5
6
 
6
7
  export type FieldMode = 'read' | 'edit';
7
8
  export type BasicApFieldProps<FieldPropsType = any> = {
8
9
  mode?: FieldMode;
9
10
  } & FieldPropsType;
11
+ export type ApFieldComposedProps<FieldPropsType = any> = {
12
+ mode?: FieldMode;
13
+ fieldProps?: FieldPropsType;
14
+ };
10
15
  export type ApFieldTextProps = BasicApFieldProps<InputProps> & {
11
16
  emptyText?: string;
12
17
  };
13
18
  export type ApFieldTextExpose = {
14
19
  focus: (options?: InputFocusOptions) => void;
15
20
  blur: () => void;
21
+ input: any;
16
22
  setSelectionRange: (start: number, end: number, direction?: 'forward' | 'backward' | 'none') => void;
17
23
  select: () => void;
18
24
  };
@@ -20,12 +26,66 @@ export type ApFieldCheckboxProps = BasicApFieldProps<CheckboxGroupProps> & {
20
26
  emptyText?: string;
21
27
  request?: () => Promise<CheckboxGroupProps['options']>;
22
28
  };
23
- export type ApFieldDateProps = BasicApFieldProps<Omit<DatePickerProps, 'mode' | 'value' | 'defaultValue'>> & {
29
+ export type ApFieldDateProps = ApFieldComposedProps<Omit<DatePickerProps, 'mode' | 'value' | 'defaultValue' | 'onChange' | 'onOk' | 'format'>> & {
24
30
  emptyText?: string;
25
31
  value?: number | null;
26
32
  defaultValue?: number;
27
33
  onChange?: (ts: number | null, dayStr: string) => void;
28
34
  onOk?: (ts: number | null) => void;
29
- format?: ApFormatPresetType;
30
- pickerMode?: PanelMode | undefined;
35
+ format?: ApFormatPresetType | string;
36
+ };
37
+ export type ApFieldNumberProps = BasicApFieldProps<InputNumberProps> & {
38
+ emptyText?: string;
39
+ /**
40
+ * 是否展示千分位,只读模式可用
41
+ */
42
+ thousands?: boolean;
43
+ /**
44
+ * 强制保留指定的小数位,只读模式可用,只有在设置了`precision`才生效
45
+ */
46
+ limitDecimalsRetain?: boolean;
47
+ };
48
+ export type ApiFieldNumberExpose = {
49
+ focus: () => void;
50
+ blur: () => void;
51
+ };
52
+ export type ApFieldRadioProps = BasicApFieldProps<RadioGroupProps> & {
53
+ emptyText?: string;
54
+ request?: () => Promise<RadioGroupProps['options']>;
55
+ };
56
+ export type ApiFieldRadioExpose = {
57
+ focus: () => void;
58
+ blur: () => void;
59
+ };
60
+ export type ApFieldSwitchProps = BasicApFieldProps<Omit<SwitchProps, 'onClick'>> & {
61
+ emptyText?: string;
62
+ onAction?: (checked: string | boolean | number, e?: Event) => boolean | Promise<boolean>;
63
+ confirm?: Pick<PopconfirmProps, 'title' | 'okText' | 'cancelText' | 'description' | 'showCancel' | 'icon' | 'okType' | 'onCancel'>;
64
+ };
65
+ export type ApFieldTextAreaProps = BasicApFieldProps<TextAreaProps> & {
66
+ emptyText?: string;
67
+ };
68
+ export type ApFieldTextAreaExpose = {
69
+ focus: (options?: InputFocusOptions) => void;
70
+ blur: () => void;
71
+ resizableTextArea: any;
72
+ };
73
+ export type ApFieldDateRangeProps = ApFieldComposedProps<Omit<RangePickerProps, 'value' | 'onChange' | 'onPanelChange' | 'defaultValue' | 'onOk' | 'renderExtraFooter'>> & {
74
+ emptyText?: string;
75
+ value?: RangeValue<number>;
76
+ defaultValue?: RangeValue<number>;
77
+ onChange?: (ts: RangeValue<number>, dayStr: string) => void;
78
+ onOk?: (ts: RangeValue<number>) => void;
79
+ format?: ApFormatPresetType | string;
80
+ };
81
+ export type ApFieldSelectProps = ApFieldComposedProps<Omit<SelectProps, 'mode' | 'value' | 'onUpdate:value' | 'onSearch'>> & {
82
+ emptyText?: string;
83
+ request?: (value?: string) => Promise<SelectProps['options']>;
84
+ multiple?: boolean;
85
+ value?: SelectProps['value'];
86
+ 'onUpdate:value'?: SelectProps['onUpdate:value'];
87
+ };
88
+ export type ApFieldSelectSlots = {
89
+ focus: () => void;
90
+ blur: () => void;
31
91
  };
@@ -0,0 +1 @@
1
+ export declare function addZeroToDecimalPlaces(numStr: string, precision?: number): string;
@@ -0,0 +1,14 @@
1
+ import { isNil as i } from "lodash-unified";
2
+ function a(t, r) {
3
+ if (i(r))
4
+ return t;
5
+ let [f, e] = t.split(".");
6
+ if (!e || e.length >= r)
7
+ return t;
8
+ for (let l = e.length; l < r; l++)
9
+ e += "0";
10
+ return f + "." + e;
11
+ }
12
+ export {
13
+ a as addZeroToDecimalPlaces
14
+ };
@@ -0,0 +1,72 @@
1
+ import { ApFieldNumberProps } from '../interface';
2
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes, PropType } from 'vue';
3
+ import { ValueType } from 'ant-design-vue/es/input-number/src/utils/MiniDecimal';
4
+
5
+ type ApFieldNumberSlots = {
6
+ addonBefore?: any;
7
+ addonAfter?: any;
8
+ prefix?: any;
9
+ default?: any;
10
+ upIcon?: any;
11
+ downIcon?: any;
12
+ };
13
+ declare function focus(): void;
14
+ declare function blur(): void;
15
+ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApFieldNumberProps>, {
16
+ emptyText: string;
17
+ thousands: boolean;
18
+ bordered: boolean;
19
+ controls: boolean;
20
+ keyboard: boolean;
21
+ max: number;
22
+ min: number;
23
+ step: number;
24
+ }>, {
25
+ focus: typeof focus;
26
+ blur: typeof blur;
27
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
28
+ "update:value": (...args: any[]) => void;
29
+ }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApFieldNumberProps>, {
30
+ emptyText: string;
31
+ thousands: boolean;
32
+ bordered: boolean;
33
+ controls: boolean;
34
+ keyboard: boolean;
35
+ max: number;
36
+ min: number;
37
+ step: number;
38
+ }>>> & {
39
+ "onUpdate:value"?: ((...args: any[]) => any) | undefined;
40
+ }, {
41
+ keyboard: boolean;
42
+ bordered: boolean;
43
+ min: ValueType;
44
+ max: ValueType;
45
+ step: ValueType;
46
+ controls: boolean;
47
+ emptyText: string;
48
+ thousands: boolean;
49
+ }, {}>, Readonly<ApFieldNumberSlots> & ApFieldNumberSlots>;
50
+ export default _default;
51
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
52
+ type __VLS_TypePropsToRuntimeProps<T> = {
53
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
54
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
55
+ } : {
56
+ type: PropType<T[K]>;
57
+ required: true;
58
+ };
59
+ };
60
+ type __VLS_WithDefaults<P, D> = {
61
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
62
+ default: D[K];
63
+ }> : P[K];
64
+ };
65
+ type __VLS_Prettify<T> = {
66
+ [K in keyof T]: T[K];
67
+ } & {};
68
+ type __VLS_WithTemplateSlots<T, S> = T & {
69
+ new (): {
70
+ $slots: S;
71
+ };
72
+ };