@aplus-frontend/ui 0.2.0 → 0.2.2

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 (99) hide show
  1. package/es/index.mjs +1 -1
  2. package/es/src/ap-button/ap-action-button.vue.mjs +1 -0
  3. package/es/src/ap-button/ap-button.vue.d.ts +3 -0
  4. package/es/src/ap-button/ap-button.vue.mjs +47 -66
  5. package/es/src/ap-button/interface.d.ts +1 -0
  6. package/es/src/ap-button/utils/index.d.ts +3 -0
  7. package/es/src/ap-button/utils/index.mjs +33 -0
  8. package/es/src/ap-descriptions/help-message/index.vue.d.ts +2 -2
  9. package/es/src/ap-descriptions/interface.d.ts +1 -1
  10. package/es/src/ap-field/checkbox/index.vue.mjs +23 -22
  11. package/es/src/ap-field/hooks/use-options.d.ts +8 -0
  12. package/es/src/ap-field/hooks/use-options.mjs +22 -0
  13. package/es/src/ap-field/radio/index.vue.mjs +25 -24
  14. package/es/src/ap-field/segmented/index.vue.mjs +37 -33
  15. package/es/src/ap-field/select/index.vue.mjs +74 -73
  16. package/es/src/ap-table/ap-table.vue.mjs +2 -428
  17. package/es/src/ap-table/ap-table.vue2.mjs +428 -2
  18. package/es/src/ap-table/components/setting/modal/index.vue.d.ts +16 -1
  19. package/es/src/ap-table/components/setting/modal/index.vue2.mjs +22 -20
  20. package/es/src/ap-table/hooks/use-table-column-state.mjs +72 -69
  21. package/es/src/ap-table/index.d.ts +6 -1
  22. package/es/src/ap-table/index.mjs +9 -3
  23. package/es/src/ap-upload/apUpload.vue.d.ts +2 -2
  24. package/es/src/ap-upload/components/Picture.vue2.mjs +10 -10
  25. package/es/src/business/ap-batch-action/ApBatchAction.vue.d.ts +8 -3
  26. package/es/src/business/ap-batch-action/ApBatchAction.vue2.mjs +42 -29
  27. package/es/src/business/ap-batch-action/index.d.ts +8 -3
  28. package/es/src/business/ap-batch-action-group/ApBatchActionGroup.vue2.mjs +14 -13
  29. package/es/src/business/ap-batch-action-group/index.d.ts +4 -0
  30. package/es/src/business/ap-button-group/index.d.ts +8 -0
  31. package/es/src/business/ap-export-group/ApExportGroup.vue2.mjs +42 -40
  32. package/es/src/business/ap-summary/style/css.js +1 -1
  33. package/es/src/business/ap-table-modal/index.d.ts +38 -1
  34. package/es/src/business/ap-table-modal/interface.d.ts +17 -2
  35. package/es/src/business/ap-table-modal/style/css.js +1 -1
  36. package/es/src/business/ap-table-modal/style/index.js +1 -1
  37. package/es/src/business/ap-table-modal/table-layout/index.vue.d.ts +57 -0
  38. package/es/src/business/ap-table-modal/table-layout/index.vue.mjs +4 -0
  39. package/es/src/business/ap-table-modal/table-layout/index.vue2.mjs +74 -0
  40. package/es/src/business/ap-table-modal/table-modal.vue2.mjs +134 -79
  41. package/es/src/config-provider/config-provider.d.ts +1 -0
  42. package/es/src/config-provider/css-var.d.ts +1 -0
  43. package/es/src/config-provider/css-var.mjs +7 -5
  44. package/es/src/config-provider/index.d.ts +6 -0
  45. package/es/src/editable-table/interface.d.ts +2 -2
  46. package/es/src/index.mjs +201 -202
  47. package/es/src/locale/lang/en.mjs +3 -1
  48. package/es/src/locale/lang/zh-cn.mjs +3 -1
  49. package/es/src/path-map.mjs +2 -0
  50. package/lib/index.js +1 -1
  51. package/lib/src/ap-button/ap-action-button.vue.js +1 -1
  52. package/lib/src/ap-button/ap-button.vue.d.ts +3 -0
  53. package/lib/src/ap-button/ap-button.vue.js +1 -1
  54. package/lib/src/ap-button/interface.d.ts +1 -0
  55. package/lib/src/ap-button/utils/index.d.ts +3 -0
  56. package/lib/src/ap-button/utils/index.js +1 -0
  57. package/lib/src/ap-descriptions/help-message/index.vue.d.ts +2 -2
  58. package/lib/src/ap-descriptions/interface.d.ts +1 -1
  59. package/lib/src/ap-field/checkbox/index.vue.js +1 -1
  60. package/lib/src/ap-field/hooks/use-options.d.ts +8 -0
  61. package/lib/src/ap-field/hooks/use-options.js +1 -0
  62. package/lib/src/ap-field/radio/index.vue.js +1 -1
  63. package/lib/src/ap-field/segmented/index.vue.js +1 -1
  64. package/lib/src/ap-field/select/index.vue.js +1 -1
  65. package/lib/src/ap-table/ap-table.vue.js +1 -1
  66. package/lib/src/ap-table/ap-table.vue2.js +1 -1
  67. package/lib/src/ap-table/components/setting/modal/index.vue.d.ts +16 -1
  68. package/lib/src/ap-table/components/setting/modal/index.vue2.js +1 -1
  69. package/lib/src/ap-table/hooks/use-table-column-state.js +1 -1
  70. package/lib/src/ap-table/index.d.ts +6 -1
  71. package/lib/src/ap-table/index.js +1 -1
  72. package/lib/src/ap-upload/apUpload.vue.d.ts +2 -2
  73. package/lib/src/ap-upload/components/Picture.vue2.js +1 -1
  74. package/lib/src/business/ap-batch-action/ApBatchAction.vue.d.ts +8 -3
  75. package/lib/src/business/ap-batch-action/ApBatchAction.vue2.js +1 -1
  76. package/lib/src/business/ap-batch-action/index.d.ts +8 -3
  77. package/lib/src/business/ap-batch-action-group/ApBatchActionGroup.vue2.js +1 -1
  78. package/lib/src/business/ap-batch-action-group/index.d.ts +4 -0
  79. package/lib/src/business/ap-button-group/index.d.ts +8 -0
  80. package/lib/src/business/ap-export-group/ApExportGroup.vue2.js +1 -1
  81. package/lib/src/business/ap-summary/style/css.js +1 -1
  82. package/lib/src/business/ap-table-modal/index.d.ts +38 -1
  83. package/lib/src/business/ap-table-modal/interface.d.ts +17 -2
  84. package/lib/src/business/ap-table-modal/style/css.js +1 -1
  85. package/lib/src/business/ap-table-modal/style/index.js +1 -1
  86. package/lib/src/business/ap-table-modal/table-layout/index.vue.d.ts +57 -0
  87. package/lib/src/business/ap-table-modal/table-layout/index.vue.js +1 -0
  88. package/lib/src/business/ap-table-modal/table-layout/index.vue2.js +1 -0
  89. package/lib/src/business/ap-table-modal/table-modal.vue2.js +1 -1
  90. package/lib/src/config-provider/config-provider.d.ts +1 -0
  91. package/lib/src/config-provider/css-var.d.ts +1 -0
  92. package/lib/src/config-provider/css-var.js +1 -1
  93. package/lib/src/config-provider/index.d.ts +6 -0
  94. package/lib/src/editable-table/interface.d.ts +2 -2
  95. package/lib/src/index.js +1 -1
  96. package/lib/src/locale/lang/en.js +1 -1
  97. package/lib/src/locale/lang/zh-cn.js +1 -1
  98. package/lib/src/path-map.js +1 -1
  99. package/package.json +2 -2
package/es/index.mjs CHANGED
@@ -89,7 +89,7 @@ import { useTableRefresh as Nr } from "./src/business/hooks/useTableRefresh.mjs"
89
89
  import { computedRecords as wr, flattenColumns as Rr, formatDataIndex as vr, formatNumber as Er } from "./src/business/ap-summary/utils.mjs";
90
90
  import { ApSummary as Kr } from "./src/business/ap-summary/index.mjs";
91
91
  import { useTablePaging as Wr } from "./src/ap-table/hooks/use-table-paging.mjs";
92
- import { default as Ur } from "./src/ap-table/ap-table.vue.mjs";
92
+ import { ApTable as Ur } from "./src/ap-table/index.mjs";
93
93
  import { default as $r } from "./src/editable-table/index.vue.mjs";
94
94
  import { default as qr } from "./src/editable-table/form-item.vue.mjs";
95
95
  import { default as Jr } from "./src/ap-descriptions/ap-descriptions.vue.mjs";
@@ -21,6 +21,7 @@ const k = /* @__PURE__ */ p({
21
21
  type: { default: "borderLink" },
22
22
  borderLinkColor: {},
23
23
  minWidth: { type: [Boolean, Number, String], default: !0 },
24
+ lazy: { type: [Boolean, Number] },
24
25
  onClick: {}
25
26
  },
26
27
  setup(n) {
@@ -11,16 +11,19 @@ declare const __VLS_component: DefineComponent<__VLS_WithDefaults<__VLS_TypeProp
11
11
  type: string;
12
12
  minWidth: boolean;
13
13
  loading: undefined;
14
+ lazy: boolean;
14
15
  }>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<ApButtonProps>, {
15
16
  type: string;
16
17
  minWidth: boolean;
17
18
  loading: undefined;
19
+ lazy: boolean;
18
20
  }>>>, {
19
21
  type: ButtonType | "borderLink";
20
22
  minWidth: boolean | number | string;
21
23
  loading: boolean | {
22
24
  delay?: number;
23
25
  };
26
+ lazy: boolean | number;
24
27
  }, {}>;
25
28
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
26
29
  export default _default;
@@ -1,10 +1,12 @@
1
- import { defineComponent as L, ref as $, computed as a, openBlock as M, createBlock as j, unref as c, mergeProps as w, createSlots as P, renderList as x, withCtx as _, renderSlot as N, normalizeProps as z, guardReactiveProps as A } from "vue";
2
- import { Button as F } from "@aplus-frontend/antdv";
1
+ import { defineComponent as C, ref as B, computed as t, openBlock as W, createBlock as z, unref as a, mergeProps as L, createSlots as w, renderList as M, withCtx as T, renderSlot as $, normalizeProps as P, guardReactiveProps as _ } from "vue";
2
+ import { Button as x } from "@aplus-frontend/antdv";
3
+ import { wait as N } from "@aplus-frontend/utils";
3
4
  import "../config-provider/index.mjs";
4
5
  import { omit as O } from "lodash-unified";
5
- import { useNamespace as S } from "../config-provider/hooks/use-namespace.mjs";
6
- import { useGlobalConfig as T } from "../config-provider/hooks/use-global-config.mjs";
7
- const G = 88, K = /* @__PURE__ */ L({
6
+ import { transferOpacityColor as j, isAsynchronous as A } from "./utils/index.mjs";
7
+ import { useNamespace as D } from "../config-provider/hooks/use-namespace.mjs";
8
+ import { useGlobalConfig as F } from "../config-provider/hooks/use-global-config.mjs";
9
+ const S = 88, G = 300, U = /* @__PURE__ */ C({
8
10
  __name: "ap-button",
9
11
  props: {
10
12
  prefixCls: {},
@@ -24,94 +26,73 @@ const G = 88, K = /* @__PURE__ */ L({
24
26
  type: { default: "default" },
25
27
  borderLinkColor: {},
26
28
  minWidth: { type: [Boolean, Number, String], default: !1 },
29
+ lazy: { type: [Boolean, Number], default: !0 },
27
30
  onClick: {}
28
31
  },
29
- setup(y) {
30
- const e = y, d = {
32
+ setup(f) {
33
+ const e = f, l = {
31
34
  aplus: "#0070FF",
32
35
  admin: "#34b77c"
33
- }, { b: f } = S("ap-action-button"), g = T("uiMode"), s = $(!1), h = a(
34
- () => e.borderLinkColor || d[g.value] || d.aplus
35
- ), p = a(
36
- () => e.type === "borderLink" ? h.value : void 0
37
- ), m = a(() => W(p.value)), v = a(() => e.minWidth === !0 ? `${G}px` : typeof e.minWidth == "number" ? `${e.minWidth}px` : typeof e.minWidth == "string" ? e.minWidth : void 0), k = a(
36
+ }, { b: i } = D("ap-action-button"), m = F("uiMode"), r = B(!1), y = t(
37
+ () => e.borderLinkColor || l[m.value] || l.aplus
38
+ ), s = t(
39
+ () => e.type === "borderLink" ? y.value : void 0
40
+ ), u = t(
41
+ () => j(s.value)
42
+ ), b = t(() => e.minWidth === !0 ? `${S}px` : typeof e.minWidth == "number" ? `${e.minWidth}px` : typeof e.minWidth == "string" ? e.minWidth : void 0), v = t(
38
43
  () => (e.type === "borderLink" ? "default" : e.type) || "default"
39
- ), b = a(() => e.loading ?? s.value ?? !1);
40
- function C() {
41
- const t = O(e, [
44
+ ), d = t(() => e.loading ?? r.value ?? !1), p = t(() => e.lazy === !0 ? G : typeof e.lazy == "number" && e.lazy >= 0 ? e.lazy : 0);
45
+ function h() {
46
+ const o = O(e, [
42
47
  "type",
43
48
  "borderLinkColor",
44
49
  "minWidth",
45
50
  "onClick",
46
51
  "loading"
47
52
  ]);
48
- return t ? {
49
- ...t,
50
- type: k.value,
51
- onclick: B
53
+ return o ? {
54
+ ...o,
55
+ type: v.value,
56
+ onclick: k
52
57
  } : {};
53
58
  }
54
- async function B() {
55
- var t;
56
- if (!b.value) {
57
- s.value = !0;
58
- try {
59
- await ((t = e.onClick) == null ? void 0 : t.call(e));
60
- } finally {
61
- s.value = !1;
62
- }
63
- }
64
- }
65
- function W(t, u = "0.7") {
66
- var i;
59
+ async function k() {
60
+ if (d.value) return;
61
+ const o = A(e.onClick), c = Date.now();
67
62
  try {
68
- let o = t == null ? void 0 : t.toLowerCase();
69
- if (o && /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(o)) {
70
- if (o.length === 4) {
71
- let r = "#";
72
- for (let l = 1; l < 4; l += 1)
73
- r += o.slice(l, l + 1).concat(o.slice(l, l + 1));
74
- o = r;
75
- }
76
- const n = [];
77
- for (let r = 1; r < 7; r += 2)
78
- n.push(parseInt("0x" + o.slice(r, r + 2)));
79
- return "rgba(" + n.join(",") + "," + u + ")";
80
- }
81
- if (o && o.startsWith("rgb")) {
82
- let n = o.match(/(\d(\.\d+)?)+/g);
83
- return n = (i = n == null ? void 0 : n.slice(0, 3)) == null ? void 0 : i.concat(u), "rgba(" + n.join(",") + ")";
63
+ o && (r.value = !0, await o);
64
+ } finally {
65
+ if (o) {
66
+ const n = Date.now() - c;
67
+ n < p.value && await N(p.value - n), r.value = !1;
84
68
  }
85
- return o;
86
- } catch {
87
- return;
88
69
  }
89
70
  }
90
- return (t, u) => (M(), j(c(F), w({
71
+ return (o, c) => (W(), z(a(x), L({
91
72
  class: {
92
- [c(f)()]: !0,
93
- [`${c(f)()}-border-link`]: m.value
73
+ [a(i)()]: !0,
74
+ [`${a(i)()}-border-link`]: u.value
94
75
  }
95
76
  }, {
96
- ...t.$attrs,
97
- ...C()
77
+ ...o.$attrs,
78
+ ...h()
98
79
  }, {
99
80
  style: {
100
- color: p.value,
101
- minWidth: v.value,
102
- "--button-border-color": m.value
81
+ color: s.value,
82
+ minWidth: b.value,
83
+ "--button-border-color": u.value
103
84
  },
104
- loading: b.value
105
- }), P({ _: 2 }, [
106
- x(Object.keys(t.$slots), (i) => ({
107
- name: i,
108
- fn: _((o) => [
109
- N(t.$slots, i, z(A(o || {})))
85
+ loading: d.value
86
+ }), w({ _: 2 }, [
87
+ M(Object.keys(o.$slots), (n) => ({
88
+ name: n,
89
+ fn: T((g) => [
90
+ $(o.$slots, n, P(_(g || {})))
110
91
  ])
111
92
  }))
112
93
  ]), 1040, ["class", "style", "loading"]));
113
94
  }
114
95
  });
115
96
  export {
116
- K as default
97
+ U as default
117
98
  };
@@ -3,6 +3,7 @@ export type ApButtonProps = Omit<ButtonProps, 'type' | 'onClick'> & {
3
3
  type?: ButtonProps['type'] | 'borderLink';
4
4
  borderLinkColor?: string;
5
5
  minWidth?: boolean | number | string;
6
+ lazy?: boolean | number;
6
7
  onClick?: () => any | Promise<any>;
7
8
  };
8
9
  export type ApActionButtonProps = ApButtonProps;
@@ -0,0 +1,3 @@
1
+ export declare function isPromise(fn: any): any;
2
+ export declare const isAsynchronous: (fn: any) => any;
3
+ export declare const transferOpacityColor: (thisColor?: string, thisOpacity?: string) => string | undefined;
@@ -0,0 +1,33 @@
1
+ function a(t) {
2
+ return typeof t == "object" && typeof t.then == "function" ? t : !1;
3
+ }
4
+ const l = (t) => typeof t == "function" && a(t == null ? void 0 : t()), f = (t, n = "0.7") => {
5
+ var s;
6
+ try {
7
+ let e = t == null ? void 0 : t.toLowerCase();
8
+ if (e && /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(e)) {
9
+ if (e.length === 4) {
10
+ let o = "#";
11
+ for (let c = 1; c < 4; c += 1)
12
+ o += e.slice(c, c + 1).concat(e.slice(c, c + 1));
13
+ e = o;
14
+ }
15
+ const r = [];
16
+ for (let o = 1; o < 7; o += 2)
17
+ r.push(parseInt("0x" + e.slice(o, o + 2)));
18
+ return "rgba(" + r.join(",") + "," + n + ")";
19
+ }
20
+ if (e && e.startsWith("rgb")) {
21
+ let r = e.match(/(\d(\.\d+)?)+/g);
22
+ return r = (s = r == null ? void 0 : r.slice(0, 3)) == null ? void 0 : s.concat(n), "rgba(" + r.join(",") + ")";
23
+ }
24
+ return e;
25
+ } catch {
26
+ return;
27
+ }
28
+ };
29
+ export {
30
+ l as isAsynchronous,
31
+ a as isPromise,
32
+ f as transferOpacityColor
33
+ };
@@ -8,9 +8,9 @@ declare function __VLS_template(): {
8
8
  };
9
9
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
10
10
  declare const __VLS_component: DefineComponent<__VLS_TypePropsToOption<{
11
- helpMessage?: string;
11
+ helpMessage?: any;
12
12
  }>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_TypePropsToOption<{
13
- helpMessage?: string;
13
+ helpMessage?: any;
14
14
  }>>>, {}, {}>;
15
15
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
16
16
  export default _default;
@@ -23,7 +23,7 @@ export interface ItemSchema<T extends Recordable = Recordable> {
23
23
  labelStyle?: CSSProperties;
24
24
  customRender?: (record?: T) => VNodeChild | VNode;
25
25
  contentSlotName?: string;
26
- helpMessage?: string;
26
+ helpMessage?: any;
27
27
  }
28
28
  /** 空的类型描述类型 */
29
29
  export type EmptyItemSchema = {
@@ -1,12 +1,13 @@
1
- import { defineComponent as h, ref as m, onMounted as b, openBlock as o, createElementBlock as l, Fragment as n, unref as e, createTextVNode as c, toDisplayString as d, createBlock as f, mergeProps as C } from "vue";
2
- import { isFunction as V, isNil as B, omit as q } from "lodash-unified";
1
+ import { defineComponent as h, ref as b, onMounted as C, openBlock as o, createElementBlock as l, Fragment as n, unref as e, createTextVNode as m, toDisplayString as c, createBlock as d, mergeProps as V } from "vue";
2
+ import { isFunction as B, isNil as O, omit as q } from "lodash-unified";
3
3
  import { Spin as T, CheckboxGroup as U } from "@aplus-frontend/antdv";
4
4
  import "../../hooks/index.mjs";
5
5
  import { getOptionValue as _, getOptionLabel as F } from "./helper.mjs";
6
6
  import "../../config-provider/index.mjs";
7
- import { useNamespace as N } from "../../config-provider/hooks/use-namespace.mjs";
8
- import { useControllableValue as O } from "../../hooks/useControllableValue.mjs";
9
- const P = /* @__PURE__ */ h({
7
+ import N from "../hooks/use-options.mjs";
8
+ import { useNamespace as A } from "../../config-provider/hooks/use-namespace.mjs";
9
+ import { useControllableValue as S } from "../../hooks/useControllableValue.mjs";
10
+ const I = /* @__PURE__ */ h({
10
11
  name: "ApFieldCheckbox",
11
12
  inheritAttrs: !1,
12
13
  __name: "index",
@@ -28,35 +29,35 @@ const P = /* @__PURE__ */ h({
28
29
  vertical: { type: Boolean }
29
30
  },
30
31
  emits: ["update:value"],
31
- setup(v, { emit: y }) {
32
- const k = y, t = v, i = m(t.options), { m: x } = N("field-checkbox"), r = m(!1);
33
- b(() => {
34
- V(t.request) && (r.value = !0, t.request().then((a) => i.value = a).finally(() => {
35
- r.value = !1;
32
+ setup(f, { emit: v }) {
33
+ const y = v, t = f, { options: p, updateOptions: k } = N(t), { m: x } = A("field-checkbox"), i = b(!1);
34
+ C(() => {
35
+ B(t.request) && (i.value = !0, t.request().then((a) => k(a)).finally(() => {
36
+ i.value = !1;
36
37
  }));
37
38
  });
38
- const { value: u, updateValue: g } = O(
39
+ const { value: r, updateValue: g } = S(
39
40
  t,
40
- k,
41
+ y,
41
42
  {
42
43
  defaultValue: []
43
44
  }
44
45
  );
45
- return (a, A) => {
46
- var p;
46
+ return (a, j) => {
47
+ var u;
47
48
  return a.mode === "read" ? (o(), l(n, { key: 0 }, [
48
- e(B)(e(u)) ? (o(), l(n, { key: 0 }, [
49
- c(d(t.emptyText), 1)
49
+ e(O)(e(r)) ? (o(), l(n, { key: 0 }, [
50
+ m(c(t.emptyText), 1)
50
51
  ], 64)) : (o(), l(n, { key: 1 }, [
51
- c(d(((p = i.value) == null ? void 0 : p.filter((s) => e(u).indexOf(e(_)(s)) > -1).map((s) => e(F)(s)).join("、")) || t.emptyText), 1)
52
+ m(c(((u = e(p)) == null ? void 0 : u.filter((s) => e(r).indexOf(e(_)(s)) > -1).map((s) => e(F)(s)).join("、")) || t.emptyText), 1)
52
53
  ], 64))
53
54
  ], 64)) : (o(), l(n, { key: 1 }, [
54
- r.value ? (o(), f(e(T), {
55
+ i.value ? (o(), d(e(T), {
55
56
  key: 0,
56
57
  size: "small"
57
- })) : (o(), f(e(U), C({ key: 1 }, e(q)(t, ["onUpdate:value", "value", "request", "vertical"]), {
58
- options: i.value,
59
- value: e(u),
58
+ })) : (o(), d(e(U), V({ key: 1 }, e(q)(t, ["onUpdate:value", "value", "request", "vertical"]), {
59
+ options: e(p),
60
+ value: e(r),
60
61
  "onUpdate:value": e(g),
61
62
  class: a.vertical ? e(x)("vertical") : null
62
63
  }), null, 16, ["options", "value", "onUpdate:value", "class"]))
@@ -65,5 +66,5 @@ const P = /* @__PURE__ */ h({
65
66
  }
66
67
  });
67
68
  export {
68
- P as default
69
+ I as default
69
70
  };
@@ -0,0 +1,8 @@
1
+ import { Ref } from 'vue';
2
+ declare const useOptions: <OptionType = any>(props: {
3
+ options?: OptionType[];
4
+ }) => {
5
+ options: Ref<OptionType[]>;
6
+ updateOptions: (nextOptions?: OptionType[]) => void;
7
+ };
8
+ export default useOptions;
@@ -0,0 +1,22 @@
1
+ import { ref as i, watch as o } from "vue";
2
+ const f = (e) => {
3
+ const u = i((e == null ? void 0 : e.options) || []);
4
+ function n(t) {
5
+ t && (u.value = t);
6
+ }
7
+ return o(
8
+ () => e.options,
9
+ (t) => {
10
+ t && (u.value = t);
11
+ },
12
+ {
13
+ deep: !0
14
+ }
15
+ ), {
16
+ options: u,
17
+ updateOptions: n
18
+ };
19
+ };
20
+ export {
21
+ f as default
22
+ };
@@ -1,12 +1,13 @@
1
- import { defineComponent as _, ref as i, onMounted as q, computed as C, unref as o, openBlock as l, createElementBlock as m, Fragment as c, createTextVNode as R, toDisplayString as U, createBlock as d, mergeProps as h } from "vue";
1
+ import { defineComponent as q, ref as p, onMounted as C, computed as O, unref as o, openBlock as l, createElementBlock as m, Fragment as c, createTextVNode as R, toDisplayString as U, createBlock as d, mergeProps as h } from "vue";
2
2
  import { Spin as G, RadioGroup as N } from "@aplus-frontend/antdv";
3
3
  import "../../hooks/index.mjs";
4
4
  import { isNil as S, omit as z } from "lodash-unified";
5
- import { getOptionValue as F, getOptionLabel as O } from "./helper.mjs";
5
+ import { getOptionValue as F, getOptionLabel as A } from "./helper.mjs";
6
6
  import "../../config-provider/index.mjs";
7
- import { useControllableValue as A } from "../../hooks/useControllableValue.mjs";
8
- import { useNamespace as D } from "../../config-provider/hooks/use-namespace.mjs";
9
- const J = /* @__PURE__ */ _({
7
+ import D from "../hooks/use-options.mjs";
8
+ import { useControllableValue as E } from "../../hooks/useControllableValue.mjs";
9
+ import { useNamespace as L } from "../../config-provider/hooks/use-namespace.mjs";
10
+ const W = /* @__PURE__ */ q({
10
11
  name: "ApFieldRadio",
11
12
  __name: "index",
12
13
  props: {
@@ -30,36 +31,36 @@ const J = /* @__PURE__ */ _({
30
31
  },
31
32
  emits: ["update:value"],
32
33
  setup(f, { expose: v, emit: y }) {
33
- const t = f, g = y, n = i(), u = i((t == null ? void 0 : t.options) || []), { value: s, updateValue: k } = A(t, g), { m: x } = D("field-radio"), r = i(!1);
34
- q(() => {
34
+ const t = f, g = y, n = p(), { options: u, updateOptions: k } = D(t), { value: i, updateValue: x } = E(t, g), { m: b } = L("field-radio"), r = p(!1);
35
+ C(() => {
35
36
  var e;
36
- t.request && (r.value = !0, (e = t.request) == null || e.call(t).then((a) => u.value = a).finally(() => {
37
+ t.request && (r.value = !0, (e = t.request) == null || e.call(t).then((a) => k(a)).finally(() => {
37
38
  r.value = !1;
38
39
  }));
39
40
  });
40
- const b = C(() => {
41
- var p;
42
- const e = o(s);
41
+ const T = O(() => {
42
+ var s;
43
+ const e = o(i);
43
44
  if (S(e))
44
45
  return t.emptyText;
45
- const a = (p = u.value) == null ? void 0 : p.find(
46
- (V) => e === F(V)
46
+ const a = (s = u.value) == null ? void 0 : s.find(
47
+ (_) => e === F(_)
47
48
  );
48
- return O(a) || t.emptyText;
49
+ return A(a) || t.emptyText;
49
50
  });
50
- function T() {
51
+ function B() {
51
52
  var e;
52
53
  (e = n.value) == null || e.focus();
53
54
  }
54
- function B() {
55
+ function V() {
55
56
  var e;
56
57
  (e = n.value) == null || e.blur();
57
58
  }
58
59
  return v({
59
- focus: T,
60
- blur: B
60
+ focus: B,
61
+ blur: V
61
62
  }), (e, a) => e.mode === "read" ? (l(), m(c, { key: 0 }, [
62
- R(U(b.value), 1)
63
+ R(U(T.value), 1)
63
64
  ], 64)) : (l(), m(c, { key: 1 }, [
64
65
  r.value ? (l(), d(o(G), {
65
66
  key: 0,
@@ -74,17 +75,17 @@ const J = /* @__PURE__ */ _({
74
75
  "vertical"
75
76
  ]),
76
77
  {
77
- value: o(s),
78
- "onUpdate:value": o(k),
79
- options: u.value,
78
+ value: o(i),
79
+ "onUpdate:value": o(x),
80
+ options: o(u),
80
81
  ref_key: "radioGroupRef",
81
82
  ref: n,
82
- class: e.vertical ? o(x)("vertical") : null
83
+ class: e.vertical ? o(b)("vertical") : null
83
84
  }
84
85
  ), null, 16, ["value", "onUpdate:value", "options", "class"]))
85
86
  ], 64));
86
87
  }
87
88
  });
88
89
  export {
89
- J as default
90
+ W as default
90
91
  };
@@ -1,9 +1,10 @@
1
- import { defineComponent as S, ref as c, useSlots as B, onMounted as U, computed as V, unref as a, createVNode as s, Fragment as o, openBlock as r, createBlock as m, createElementBlock as _, resolveDynamicComponent as h, mergeProps as N, withCtx as q, renderSlot as z, normalizeProps as F, guardReactiveProps as P } from "vue";
2
- import { Spin as T, Segmented as R } from "@aplus-frontend/antdv";
3
- import { isFunction as v, isUndefined as w, isString as A, isNumber as D, omit as E } from "lodash-unified";
1
+ import { defineComponent as S, ref as B, useSlots as U, onMounted as V, computed as _, unref as l, createVNode as s, Fragment as a, openBlock as r, createBlock as d, createElementBlock as h, resolveDynamicComponent as N, mergeProps as q, withCtx as z, renderSlot as F, normalizeProps as P, guardReactiveProps as T } from "vue";
2
+ import { Spin as O, Segmented as R } from "@aplus-frontend/antdv";
3
+ import { isFunction as c, isUndefined as w, isString as A, isNumber as D, omit as E } from "lodash-unified";
4
4
  import "../../hooks/index.mjs";
5
- import { useControllableValue as M } from "../../hooks/useControllableValue.mjs";
6
- const J = /* @__PURE__ */ S({
5
+ import M from "../hooks/use-options.mjs";
6
+ import { useControllableValue as $ } from "../../hooks/useControllableValue.mjs";
7
+ const L = /* @__PURE__ */ S({
7
8
  name: "ApFieldSegmented",
8
9
  __name: "index",
9
10
  props: {
@@ -34,50 +35,53 @@ const J = /* @__PURE__ */ S({
34
35
  request: {}
35
36
  },
36
37
  emits: ["update:value"],
37
- setup(y, {
38
- emit: g
38
+ setup(v, {
39
+ emit: y
39
40
  }) {
40
- const e = y, i = c((e == null ? void 0 : e.options) || []), k = g, {
41
+ const o = v, {
42
+ options: m,
43
+ updateOptions: g
44
+ } = M(o), k = y, {
41
45
  value: p,
42
46
  updateValue: b
43
- } = M(e, k), d = c(!1), x = B();
44
- U(() => {
45
- v(e.request) && (d.value = !0, e.request().then((t) => i.value = t).finally(() => {
46
- d.value = !1;
47
+ } = $(o, k), i = B(!1), x = U();
48
+ V(() => {
49
+ c(o.request) && (i.value = !0, o.request().then((e) => g(e)).finally(() => {
50
+ i.value = !1;
47
51
  }));
48
52
  });
49
- const C = V(() => {
53
+ const C = _(() => {
50
54
  var f;
51
- const t = a(p);
52
- if (w(t))
53
- return s(o, null, [e.emptyText]);
54
- const l = (f = a(i)) == null ? void 0 : f.find((u) => u === t || (u == null ? void 0 : u.value) === t);
55
- if (A(l) || D(l))
56
- return s(o, null, [l]);
57
- const n = (l == null ? void 0 : l.label) || x.label;
58
- return v(n) ? s(o, null, [n == null ? void 0 : n({
59
- ...l
60
- })]) : s(o, null, [n || e.emptyText]);
55
+ const e = l(p);
56
+ if (w(e))
57
+ return s(a, null, [o.emptyText]);
58
+ const t = (f = l(m)) == null ? void 0 : f.find((u) => u === e || (u == null ? void 0 : u.value) === e);
59
+ if (A(t) || D(t))
60
+ return s(a, null, [t]);
61
+ const n = (t == null ? void 0 : t.label) || x.label;
62
+ return c(n) ? s(a, null, [n == null ? void 0 : n({
63
+ ...t
64
+ })]) : s(a, null, [n || o.emptyText]);
61
65
  });
62
- return (t, l) => d.value ? (r(), m(a(T), {
66
+ return (e, t) => i.value ? (r(), d(l(O), {
63
67
  key: 0,
64
68
  size: "small"
65
- })) : (r(), _(o, {
69
+ })) : (r(), h(a, {
66
70
  key: 1
67
- }, [t.mode === "read" ? (r(), m(h(C.value), {
71
+ }, [e.mode === "read" ? (r(), d(N(C.value), {
68
72
  key: 0
69
- })) : (r(), m(a(R), N({
73
+ })) : (r(), d(l(R), q({
70
74
  key: 1
71
- }, a(E)(e, ["onUpdate:value", "value", "defaultValue", "options"]), {
72
- value: a(p),
73
- "onUpdate:value": a(b),
74
- options: i.value
75
+ }, l(E)(o, ["onUpdate:value", "value", "defaultValue", "options"]), {
76
+ value: l(p),
77
+ "onUpdate:value": l(b),
78
+ options: l(m)
75
79
  }), {
76
- label: q((n) => [z(t.$slots, "label", F(P(n)))]),
80
+ label: z((n) => [F(e.$slots, "label", P(T(n)))]),
77
81
  _: 3
78
82
  }, 16, ["value", "onUpdate:value", "options"]))], 64));
79
83
  }
80
84
  });
81
85
  export {
82
- J as default
86
+ L as default
83
87
  };