@aplus-frontend/ui 6.20.1 → 6.21.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 (77) hide show
  1. package/es/index.mjs +159 -155
  2. package/es/src/ap-field/hooks/use-default-presets.d.ts +1 -0
  3. package/es/src/ap-field/hooks/use-default-presets.mjs +18 -12
  4. package/es/src/ap-pro-card/components/card/index.vue.d.ts +25 -0
  5. package/es/src/ap-pro-card/components/card/index.vue.mjs +4 -0
  6. package/es/src/ap-pro-card/components/card/index.vue2.mjs +226 -0
  7. package/es/src/ap-pro-card/index.d.ts +42 -0
  8. package/es/src/ap-pro-card/index.mjs +7 -0
  9. package/es/src/ap-pro-card/interface.d.ts +61 -0
  10. package/es/src/ap-pro-card/style/css.d.ts +0 -0
  11. package/es/src/ap-pro-card/style/css.js +1 -0
  12. package/es/src/ap-pro-card/style/index.d.ts +0 -0
  13. package/es/src/ap-pro-card/style/index.js +1 -0
  14. package/es/src/ap-pro-card/utils/css-var.d.ts +17 -0
  15. package/es/src/ap-pro-card/utils/css-var.mjs +29 -0
  16. package/es/src/business/ap-value-select-card/index.d.ts +8 -0
  17. package/es/src/business/ap-value-select-card/index.mjs +9 -0
  18. package/es/src/business/ap-value-select-card/index.vue.d.ts +48 -0
  19. package/es/src/business/ap-value-select-card/index.vue.mjs +4 -0
  20. package/es/src/business/ap-value-select-card/index.vue2.mjs +186 -0
  21. package/es/src/business/ap-value-select-card/interface.d.ts +107 -0
  22. package/es/src/business/ap-value-select-card/interface.mjs +1 -0
  23. package/es/src/business/ap-value-select-card/style/css.d.ts +0 -0
  24. package/es/src/business/ap-value-select-card/style/css.js +1 -0
  25. package/es/src/business/ap-value-select-card/style/index.d.ts +0 -0
  26. package/es/src/business/ap-value-select-card/style/index.js +1 -0
  27. package/es/src/business/ap-value-select-card/utils.d.ts +7 -0
  28. package/es/src/business/ap-value-select-card/utils.mjs +9 -0
  29. package/es/src/business/index.d.ts +1 -0
  30. package/es/src/business/index.mjs +15 -13
  31. package/es/src/index.d.ts +1 -0
  32. package/es/src/index.mjs +275 -271
  33. package/es/src/path-map.mjs +3 -1
  34. package/es/src/version.d.ts +1 -1
  35. package/es/src/version.mjs +1 -1
  36. package/lib/index.js +1 -1
  37. package/lib/src/ap-field/hooks/use-default-presets.d.ts +1 -0
  38. package/lib/src/ap-field/hooks/use-default-presets.js +1 -1
  39. package/lib/src/ap-pro-card/components/card/index.vue.d.ts +25 -0
  40. package/lib/src/ap-pro-card/components/card/index.vue.js +1 -0
  41. package/lib/src/ap-pro-card/components/card/index.vue2.js +1 -0
  42. package/lib/src/ap-pro-card/index.d.ts +42 -0
  43. package/lib/src/ap-pro-card/index.js +1 -0
  44. package/lib/src/ap-pro-card/interface.d.ts +61 -0
  45. package/lib/src/ap-pro-card/style/css.cjs +1 -0
  46. package/lib/src/ap-pro-card/style/css.d.ts +0 -0
  47. package/lib/src/ap-pro-card/style/index.cjs +1 -0
  48. package/lib/src/ap-pro-card/style/index.d.ts +0 -0
  49. package/lib/src/ap-pro-card/utils/css-var.d.ts +17 -0
  50. package/lib/src/ap-pro-card/utils/css-var.js +1 -0
  51. package/lib/src/business/ap-value-select-card/index.d.ts +8 -0
  52. package/lib/src/business/ap-value-select-card/index.js +1 -0
  53. package/lib/src/business/ap-value-select-card/index.vue.d.ts +48 -0
  54. package/lib/src/business/ap-value-select-card/index.vue.js +1 -0
  55. package/lib/src/business/ap-value-select-card/index.vue2.js +1 -0
  56. package/lib/src/business/ap-value-select-card/interface.d.ts +107 -0
  57. package/lib/src/business/ap-value-select-card/interface.js +1 -0
  58. package/lib/src/business/ap-value-select-card/style/css.cjs +1 -0
  59. package/lib/src/business/ap-value-select-card/style/css.d.ts +0 -0
  60. package/lib/src/business/ap-value-select-card/style/index.cjs +1 -0
  61. package/lib/src/business/ap-value-select-card/style/index.d.ts +0 -0
  62. package/lib/src/business/ap-value-select-card/utils.d.ts +7 -0
  63. package/lib/src/business/ap-value-select-card/utils.js +1 -0
  64. package/lib/src/business/index.d.ts +1 -0
  65. package/lib/src/business/index.js +1 -1
  66. package/lib/src/index.d.ts +1 -0
  67. package/lib/src/index.js +1 -1
  68. package/lib/src/path-map.js +1 -1
  69. package/lib/src/version.d.ts +1 -1
  70. package/lib/src/version.js +1 -1
  71. package/package.json +1 -1
  72. package/theme/ap-pro-card/index.css +259 -0
  73. package/theme/ap-pro-card/index.less +129 -0
  74. package/theme/ap-value-select-card/index.css +163 -0
  75. package/theme/ap-value-select-card/index.less +157 -0
  76. package/theme/index.css +330 -0
  77. package/theme/index.less +2 -0
@@ -0,0 +1,226 @@
1
+ import { defineComponent as Y, useSlots as Z, computed as s, ref as ee, createVNode as u, Fragment as x, createElementBlock as b, openBlock as n, mergeProps as te, createCommentVNode as v, createElementVNode as re, normalizeStyle as w, normalizeClass as m, unref as g, renderSlot as G, createBlock as p, resolveDynamicComponent as h, withCtx as P } from "vue";
2
+ import { Spin as oe, Tooltip as le } from "@aplus-frontend/antdv";
3
+ import { QuestionCircleOutlined as ne } from "@ant-design/icons-vue";
4
+ import { getProCardCssVar as ae } from "../../utils/css-var.mjs";
5
+ import "../../../config-provider/index.mjs";
6
+ import { mergeClass as S } from "../../../editable-table/utils.mjs";
7
+ import ie from "@aplus-frontend/antdv/es/_util/hooks/useBreakpoint";
8
+ import { useNamespace as se } from "../../../config-provider/hooks/use-namespace.mjs";
9
+ import { useGlobalConfig as de } from "../../../config-provider/hooks/use-global-config.mjs";
10
+ const be = /* @__PURE__ */ Y({
11
+ name: "ApProCard",
12
+ __name: "index",
13
+ props: {
14
+ headStyle: {},
15
+ bodyStyle: {},
16
+ actionsStyle: {},
17
+ headerBordered: {
18
+ type: Boolean,
19
+ default: !1
20
+ },
21
+ title: {
22
+ type: [Object, String, Number, Boolean, null, Array]
23
+ },
24
+ tooltip: {
25
+ type: [Object, String, Number, Boolean, null, Array]
26
+ },
27
+ extra: {
28
+ type: [Object, String, Number, Boolean, null, Array]
29
+ },
30
+ layout: {},
31
+ type: {},
32
+ direction: {},
33
+ wrap: {
34
+ type: Boolean,
35
+ default: !1
36
+ },
37
+ loading: {
38
+ type: [Boolean, Object, String, Number, null, Array]
39
+ },
40
+ colSpan: {},
41
+ colStyle: {},
42
+ gutter: {
43
+ default: 0
44
+ },
45
+ actions: {
46
+ type: [Object, String, Number, Boolean, null, Array]
47
+ },
48
+ split: {},
49
+ bordered: {
50
+ type: Boolean,
51
+ default: !1
52
+ },
53
+ hoverable: {
54
+ type: Boolean,
55
+ default: !1
56
+ },
57
+ ghost: {
58
+ type: Boolean,
59
+ default: !1
60
+ },
61
+ boxShadow: {
62
+ type: Boolean,
63
+ default: !1
64
+ }
65
+ },
66
+ setup(E) {
67
+ const t = E, r = Z(), {
68
+ b: c
69
+ } = se("pro-card"), V = de("uiMode"), M = s(() => ae(V.value)), $ = ["xxxl", "xxl", "xl", "lg", "md", "sm", "xs"], f = ie(), k = (e, o) => e ? o : {}, _ = (e) => {
70
+ const o = [0, 0];
71
+ return (Array.isArray(e) ? e : [e, 0]).forEach((a, d) => {
72
+ if (typeof a == "object")
73
+ for (let i = 0; i < $.length; i += 1) {
74
+ const y = $[i];
75
+ if ({
76
+ lg: !0,
77
+ md: !0,
78
+ sm: !0,
79
+ xl: !1,
80
+ xs: !1,
81
+ xxl: !1,
82
+ xxxl: !1,
83
+ ...f == null ? void 0 : f.value
84
+ }[y] && a[y] !== void 0) {
85
+ o[d] = a[y];
86
+ break;
87
+ }
88
+ }
89
+ else
90
+ o[d] = a || 0;
91
+ }), o;
92
+ }, I = (e) => {
93
+ let o = e;
94
+ if (typeof e == "object")
95
+ for (let a = 0; a < $.length; a += 1) {
96
+ const d = $[a], i = {
97
+ lg: !0,
98
+ md: !0,
99
+ sm: !0,
100
+ xl: !1,
101
+ xs: !1,
102
+ xxl: !1,
103
+ xxxl: !1,
104
+ ...f == null ? void 0 : f.value
105
+ };
106
+ if (i != null && i[d] && (e == null ? void 0 : e[d]) !== void 0) {
107
+ o = e[d];
108
+ break;
109
+ }
110
+ }
111
+ const l = k(typeof o == "string" && /\d%|\dpx/i.test(o), {
112
+ width: o,
113
+ flexShrink: 0
114
+ });
115
+ return {
116
+ span: o,
117
+ colSpanStyle: l
118
+ };
119
+ }, D = s(() => _(t.gutter)), N = ee(!1), O = (e) => {
120
+ N.value = e;
121
+ }, F = s(() => {
122
+ var e;
123
+ return u(x, null, [t.title || ((e = r.title) == null ? void 0 : e.call(r))]);
124
+ }), H = s(() => u(x, null, [t.tooltip])), Q = s(() => {
125
+ var e;
126
+ return u(x, null, [t.extra || ((e = r.extra) == null ? void 0 : e.call(r))]);
127
+ }), T = s(() => {
128
+ var e;
129
+ return u(x, null, [t.actions || ((e = r.actions) == null ? void 0 : e.call(r))]);
130
+ }), q = s(() => t.loading === !0 ? u(oe, {
131
+ style: {
132
+ width: "100%",
133
+ height: "100%",
134
+ display: "flex",
135
+ alignItems: "center",
136
+ justifyContent: "center"
137
+ }
138
+ }, null) : u(x, null, [t.loading]));
139
+ function J() {
140
+ var o;
141
+ const e = (o = r.default) == null ? void 0 : o.call(r);
142
+ return O(!1), u(x, null, [Array.isArray(e) ? e == null ? void 0 : e.map((l, a, d) => {
143
+ var i, y, z;
144
+ if (l && typeof l == "object" && "type" in l && ((i = l.type) == null ? void 0 : i.isProCard) === !0) {
145
+ O(!0);
146
+ const U = ((y = l == null ? void 0 : l.props) == null ? void 0 : y.colSpan) || ((z = l == null ? void 0 : l.props) == null ? void 0 : z["col-span"]) || {}, {
147
+ span: C,
148
+ colSpanStyle: W
149
+ } = I(U), B = c("col"), X = S(`${B}`, [typeof C == "number" && C >= 0 && C <= 24 ? `${B}-span-${C}` : void 0, t.split === "horizontal" && a !== d.length - 1 ? `${B}-split-horizontal` : void 0, t.split === "vertical" && a !== d.length - 1 ? `${B}-split-vertical` : void 0].filter(Boolean)), [A, j] = D.value;
150
+ return u("div", {
151
+ class: X,
152
+ style: {
153
+ ...W,
154
+ ...k(A > 0, {
155
+ paddingInlineStart: `${A / 2}px`,
156
+ paddingInlineEnd: `${A / 2}px`
157
+ }),
158
+ ...k(j > 0, {
159
+ paddingBlockStart: `${j / 2}px`,
160
+ paddingBlockEnd: `${j / 2}px`
161
+ }),
162
+ ...t.colStyle
163
+ }
164
+ }, [l]);
165
+ }
166
+ return l;
167
+ }) : e]);
168
+ }
169
+ const K = s(() => {
170
+ const e = c();
171
+ return S(`${e}`, [t.bordered ? `${e}-border` : void 0, t.boxShadow ? `${e}-box-shadow` : void 0, N.value ? `${e}-contain-card` : void 0, t.loading ? `${e}-loading` : void 0, t.split === "vertical" || t.split === "horizontal" ? `${e}-split` : void 0, t.ghost ? `${e}-ghost` : void 0, t.hoverable ? `${e}-hoverable` : void 0, t.type ? `${e}-type-${t.type}` : void 0].filter(Boolean));
172
+ }), L = s(() => {
173
+ const e = c("header");
174
+ return S(`${e}`, [t.headerBordered || t.type === "inner" ? `${e}-border` : void 0].filter(Boolean));
175
+ }), R = s(() => {
176
+ const e = c("body");
177
+ return S(`${e}`, [t.layout === "center" ? `${e}-center` : void 0, t.split === "horizontal" || t.direction === "column" ? `${e}-direction-column` : void 0, t.wrap && N.value ? `${e}-wrap` : void 0].filter(Boolean));
178
+ });
179
+ return (e, o) => (n(), b("div", te({
180
+ class: K.value,
181
+ style: {
182
+ ...M.value
183
+ }
184
+ }, {
185
+ ...e.$attrs
186
+ }), [t.title || r.title || t.extra || r.extra ? (n(), b("div", {
187
+ key: 0,
188
+ class: m(L.value),
189
+ style: w({
190
+ ...t.headStyle
191
+ })
192
+ }, [t.title || r.title ? (n(), b("div", {
193
+ key: 0,
194
+ class: m(g(c)("header-title"))
195
+ }, [G(e.$slots, "title", {}, () => [(n(), p(h(F.value)))]), t.tooltip ? (n(), p(g(le), {
196
+ key: 0
197
+ }, {
198
+ title: P(() => [(n(), p(h(H.value)))]),
199
+ default: P(() => [u(g(ne), {
200
+ class: m(g(c)("header-title-tooltip"))
201
+ }, null, 8, ["class"])]),
202
+ _: 1
203
+ })) : v("", !0)], 2)) : v("", !0), t.extra || r.extra ? (n(), b("div", {
204
+ key: 1,
205
+ class: m(g(c)("header-extra"))
206
+ }, [G(e.$slots, "extra", {}, () => [(n(), p(h(Q.value)))])], 2)) : v("", !0)], 6)) : v("", !0), re("div", {
207
+ class: m(R.value),
208
+ style: w({
209
+ ...t.bodyStyle
210
+ })
211
+ }, [t.loading ? (n(), p(h(q.value), {
212
+ key: 0
213
+ })) : (n(), p(h(J()), {
214
+ key: 1
215
+ }))], 6), t.actions || r.actions ? (n(), b("div", {
216
+ key: 1,
217
+ class: m(g(c)("actions")),
218
+ style: w({
219
+ ...t.actionsStyle
220
+ })
221
+ }, [(n(), p(h(T.value)))], 6)) : v("", !0)], 16));
222
+ }
223
+ });
224
+ export {
225
+ be as default
226
+ };
@@ -0,0 +1,42 @@
1
+ import { CreateComponentPublicInstanceWithMixins, ComponentOptionsMixin, PublicProps, GlobalComponents, GlobalDirectives, ComponentProvideOptions, ComponentOptionsBase, VNodeProps, AllowedComponentProps, ComponentCustomProps } from 'vue';
2
+ import { ApProCardProps, ApProCardGutter, ApProCardSolts } from './interface';
3
+ declare const ApProCard: {
4
+ new (...args: any[]): CreateComponentPublicInstanceWithMixins<Readonly< ApProCardProps> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, {
5
+ wrap: boolean;
6
+ boxShadow: boolean;
7
+ gutter: ApProCardGutter | ApProCardGutter[];
8
+ ghost: boolean;
9
+ bordered: boolean;
10
+ headerBordered: boolean;
11
+ hoverable: boolean;
12
+ }, false, {}, {}, GlobalComponents, GlobalDirectives, string, {}, HTMLDivElement, ComponentProvideOptions, {
13
+ P: {};
14
+ B: {};
15
+ D: {};
16
+ C: {};
17
+ M: {};
18
+ Defaults: {};
19
+ }, Readonly< ApProCardProps> & Readonly<{}>, {}, {}, {}, {}, {
20
+ wrap: boolean;
21
+ boxShadow: boolean;
22
+ gutter: ApProCardGutter | ApProCardGutter[];
23
+ ghost: boolean;
24
+ bordered: boolean;
25
+ headerBordered: boolean;
26
+ hoverable: boolean;
27
+ }>;
28
+ __isFragment?: never;
29
+ __isTeleport?: never;
30
+ __isSuspense?: never;
31
+ } & ComponentOptionsBase<Readonly< ApProCardProps> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {
32
+ wrap: boolean;
33
+ boxShadow: boolean;
34
+ gutter: ApProCardGutter | ApProCardGutter[];
35
+ ghost: boolean;
36
+ bordered: boolean;
37
+ headerBordered: boolean;
38
+ hoverable: boolean;
39
+ }, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & VNodeProps & AllowedComponentProps & ComponentCustomProps & (new () => {
40
+ $slots: Readonly< ApProCardSolts> & ApProCardSolts;
41
+ });
42
+ export { ApProCard };
@@ -0,0 +1,7 @@
1
+ import "./components/card/index.vue.mjs";
2
+ import r from "./components/card/index.vue2.mjs";
3
+ const o = r;
4
+ o.isProCard = !0;
5
+ export {
6
+ o as ApProCard
7
+ };
@@ -0,0 +1,61 @@
1
+ import { CSSProperties, VNodeChild } from 'vue';
2
+ export type ApProCardBreakpoint = 'xxxl' | 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
3
+ export type ApProCardGutter = number | Partial<Record<ApProCardBreakpoint, number>>;
4
+ export type ApProCardColSpanType = number | string;
5
+ export interface ApProCardProps {
6
+ /** 标题样式 */
7
+ headStyle?: CSSProperties;
8
+ /** 内容样式 */
9
+ bodyStyle?: CSSProperties;
10
+ /** 操作区样式 */
11
+ actionsStyle?: CSSProperties;
12
+ /** 页头是否有分割线 */
13
+ headerBordered?: boolean;
14
+ /** 卡片标题 */
15
+ title?: VNodeChild;
16
+ /** 标题说明 */
17
+ tooltip?: VNodeChild;
18
+ /** 右上角自定义区域 */
19
+ extra?: VNodeChild;
20
+ /** 布局,center 代表垂直居中 */
21
+ layout?: 'default' | 'center';
22
+ /** 卡片类型 */
23
+ type?: 'default' | 'inner';
24
+ /** 指定 Flex 方向,仅在嵌套子卡片时有效 */
25
+ direction?: 'column' | 'row';
26
+ /** 是否自动换行,仅在嵌套子卡片时有效 */
27
+ wrap?: boolean;
28
+ /** 加载中 */
29
+ loading?: boolean | VNodeChild;
30
+ /** 栅格布局宽度,24 栅格,支持指定宽度或百分,需要支持响应式 colSpan={{ xs: 12, sm: 6 }} */
31
+ colSpan?: ApProCardColSpanType | Partial<Record<ApProCardBreakpoint, ApProCardColSpanType>>;
32
+ colStyle?: CSSProperties;
33
+ /** 栅格间距 */
34
+ gutter?: ApProCardGutter | ApProCardGutter[];
35
+ /** 操作区 */
36
+ actions?: VNodeChild;
37
+ /** 拆分卡片方式 */
38
+ split?: 'vertical' | 'horizontal';
39
+ /** 是否有边框 */
40
+ bordered?: boolean;
41
+ /**
42
+ * 鼠标移过时可浮起
43
+ *
44
+ * @default false
45
+ */
46
+ hoverable?: boolean;
47
+ /** 幽灵模式,即是否取消卡片内容区域的 padding 和 背景颜色。 */
48
+ ghost?: boolean;
49
+ /** card的阴影 */
50
+ boxShadow?: boolean;
51
+ }
52
+ export type ApProCardSolts = {
53
+ /** 内容区 */
54
+ default?: () => VNodeChild;
55
+ /** 标题 */
56
+ title?: () => VNodeChild;
57
+ /** 右上角自定义区域 */
58
+ extra?: () => VNodeChild;
59
+ /** 卡片操作组,位置在卡片底部 */
60
+ actions?: () => VNodeChild;
61
+ };
File without changes
@@ -0,0 +1 @@
1
+ import '@aplus-frontend/ui/theme/ap-pro-card/index.css';
File without changes
@@ -0,0 +1 @@
1
+ import '@aplus-frontend/ui/theme/ap-pro-card/index.less';
@@ -0,0 +1,17 @@
1
+ export declare const getProCardCssVar: (uiMode: "aplus" | "admin") => {
2
+ '--ap-pro-card-border-color-split': string;
3
+ '--ap-pro-card-box-shadow': string;
4
+ '--ap-pro-card-tooltip-color': string;
5
+ '--ap-pro-card-header-title-font-color': string;
6
+ '--ap-pro-card-area-color': string;
7
+ '--ap-pro-card-colo-bg-container': string;
8
+ '--ap-pro-card-border-radius': string;
9
+ '--ap-pro-card-header-padding': string;
10
+ '--ap-pro-card-header-padding-bottom': string;
11
+ '--ap-pro-card-body-padding': string;
12
+ '--ap-pro-card-actions-padding': string;
13
+ '--ap-pro-card-border-line-width': string;
14
+ '--ap-pro-card-border-line-type': string;
15
+ '--ap-pro-card-header-title-font-size': string;
16
+ '--ap-pro-card-split-line-height': string;
17
+ };
@@ -0,0 +1,29 @@
1
+ const r = {
2
+ "--ap-pro-card-colo-bg-container": "transparent",
3
+ "--ap-pro-card-border-radius": "4px",
4
+ "--ap-pro-card-header-padding": "12px 16px 0",
5
+ "--ap-pro-card-header-padding-bottom": "12px",
6
+ "--ap-pro-card-body-padding": "12px 16px",
7
+ "--ap-pro-card-actions-padding": "12px 16px",
8
+ "--ap-pro-card-border-line-width": "1px",
9
+ "--ap-pro-card-border-line-type": "solid",
10
+ "--ap-pro-card-border-color-split": "#e9edf3",
11
+ "--ap-pro-card-box-shadow": "0 1px 2px -2px #00000029, 0 3px 6px #0000001f, 0 5px 12px 4px #00000017",
12
+ "--ap-pro-card-tooltip-color": "#8896b0",
13
+ "--ap-pro-card-header-title-font-size": "16px",
14
+ "--ap-pro-card-header-title-font-color": "#182948",
15
+ "--ap-pro-card-area-color": "#f1f7ff",
16
+ "--ap-pro-card-split-line-height": "100%"
17
+ }, a = {
18
+ "--ap-pro-card-border-color-split": "#e9e9e9",
19
+ "--ap-pro-card-box-shadow": "0 1px 2px -2px #00000029, 0 3px 6px #0000001f, 0 5px 12px 4px #00000017",
20
+ "--ap-pro-card-tooltip-color": "#999",
21
+ "--ap-pro-card-header-title-font-color": "#333",
22
+ "--ap-pro-card-area-color": "#eff9f5"
23
+ }, o = (p) => ({
24
+ ...r,
25
+ ...p === "admin" ? a : {}
26
+ });
27
+ export {
28
+ o as getProCardCssVar
29
+ };
@@ -0,0 +1,8 @@
1
+ import { default as _ApValueSelectCard } from './index.vue';
2
+ import { hexToRgba } from './utils';
3
+ type ApValueSelectCardInstance = typeof _ApValueSelectCard & {
4
+ hexToRgba: typeof hexToRgba;
5
+ };
6
+ export * from './interface';
7
+ declare const ApValueSelectCard: ApValueSelectCardInstance;
8
+ export { ApValueSelectCard };
@@ -0,0 +1,9 @@
1
+ import "./index.vue.mjs";
2
+ import { hexToRgba as r } from "./utils.mjs";
3
+ import "./interface.mjs";
4
+ import o from "./index.vue2.mjs";
5
+ const a = o;
6
+ o.hexToRgba = r;
7
+ export {
8
+ a as ApValueSelectCard
9
+ };
@@ -0,0 +1,48 @@
1
+ import { ApValueSelectCardProps, ApValueSelectCardOption } from './interface';
2
+ import { VNodeProps, AllowedComponentProps, ComponentCustomProps, PublicProps, ShallowUnwrapRef, Ref, ComputedRef, VNode } from 'vue';
3
+ declare const _default: <T extends Record<string, any> = Record<string, any>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
5
+ readonly onChange?: ((keys: (string | number)[]) => any) | undefined;
6
+ readonly onSelect?: ((key: string | number) => any) | undefined;
7
+ readonly onRemove?: ((key: string | number) => any) | undefined;
8
+ readonly onHighlight?: ((keys: (string | number)[]) => any) | undefined;
9
+ readonly "onUpdate:selectedKeys"?: ((keys: (string | number)[]) => any) | undefined;
10
+ readonly "onUpdate:highlightedKeys"?: ((keys: (string | number)[]) => any) | undefined;
11
+ } & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, "onChange" | "onSelect" | "onUpdate:selectedKeys" | "onRemove" | "onHighlight" | "onUpdate:highlightedKeys"> & ApValueSelectCardProps<T> & Partial<{}>> & PublicProps;
12
+ expose(exposed: ShallowUnwrapRef<{
13
+ popoverVisible: Ref<boolean, boolean>;
14
+ allOptions: ComputedRef< ApValueSelectCardOption<T>[]>;
15
+ selectedOptions: ComputedRef< ApValueSelectCardOption<T>[]>;
16
+ isSelected: (key: string | number) => boolean;
17
+ isHighlighted: (key: string | number) => boolean;
18
+ toggleOption: (key: string | number) => void;
19
+ addOption: (key: string | number) => void;
20
+ removeOption: (key: string | number) => void;
21
+ highlightOption: (key: string | number) => void;
22
+ }>): void;
23
+ attrs: any;
24
+ slots: {
25
+ 'close-icon'?(_: {}): any;
26
+ label?(_: {
27
+ option: ApValueSelectCardOption<T>;
28
+ }): any;
29
+ value?(_: {
30
+ option: ApValueSelectCardOption<T>;
31
+ }): any;
32
+ 'add-button'?(_: {}): any;
33
+ };
34
+ emit: {
35
+ (e: "update:selectedKeys", keys: (string | number)[]): void;
36
+ (e: "update:highlightedKeys", keys: (string | number)[]): void;
37
+ (e: "change", keys: (string | number)[]): void;
38
+ (e: "select", key: string | number): void;
39
+ (e: "remove", key: string | number): void;
40
+ (e: "highlight", keys: (string | number)[]): void;
41
+ };
42
+ }>) => VNode & {
43
+ __ctx?: Awaited<typeof __VLS_setup>;
44
+ };
45
+ export default _default;
46
+ type __VLS_PrettifyLocal<T> = {
47
+ [K in keyof T]: T[K];
48
+ } & {};
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue2.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,186 @@
1
+ import { defineComponent as q, ref as N, computed as R, resolveComponent as J, createElementBlock as u, openBlock as c, normalizeStyle as $, normalizeClass as d, unref as l, createVNode as I, withCtx as _, createElementVNode as h, createCommentVNode as f, Fragment as D, renderList as E, withModifiers as y, renderSlot as v, createTextVNode as O, toDisplayString as g, createBlock as Q } from "vue";
2
+ import { Popover as U } from "@aplus-frontend/antdv";
3
+ import { PlusOutlined as W } from "@ant-design/icons-vue";
4
+ import { IconApAdLinePoor as X } from "@aplus-frontend/icon";
5
+ import "../../config-provider/index.mjs";
6
+ import { useNamespace as Y } from "../../config-provider/hooks/use-namespace.mjs";
7
+ import { useGlobalConfig as Z } from "../../config-provider/hooks/use-global-config.mjs";
8
+ const x = ["onClick"], ee = { class: "label" }, te = { class: "value" }, le = ["onClick"], se = ["onClick"], ie = { class: "label" }, oe = { class: "value" }, ne = { class: "text" }, pe = /* @__PURE__ */ q({
9
+ name: "ApValueSelectCard",
10
+ __name: "index",
11
+ props: {
12
+ options: {},
13
+ selectedKeys: { default: () => [] },
14
+ highlightedKeys: { default: () => [] },
15
+ maxSelected: { default: 4 },
16
+ maxRowDisplay: { default: 4 },
17
+ popoverTitle: { default: "" },
18
+ showTitleIcon: { type: Boolean, default: !0 },
19
+ showCloseIcon: { type: Boolean, default: !0 },
20
+ showAddButton: { type: Boolean, default: !0 },
21
+ addButtonText: { default: "" },
22
+ getContainer: { type: Function, default: (K) => K.parentElement || document.body },
23
+ getCardStyle: { type: Function, default: () => ({}) },
24
+ wrapperStyle: { type: [Boolean, null, String, Object, Array] }
25
+ },
26
+ emits: ["update:selectedKeys", "update:highlightedKeys", "change", "select", "remove", "highlight"],
27
+ setup(K, { expose: M, emit: P }) {
28
+ const o = P, t = K, { b: n, m: z } = Y("ap-value-select-card"), L = Z("uiMode", "aplus"), p = N(null), m = N(!1), C = R(() => t.options), S = R(() => C.value.filter(
29
+ (e) => t.selectedKeys.includes(e.key)
30
+ )), T = (e) => t.selectedKeys.includes(e), k = (e) => t.highlightedKeys.includes(e), H = (e) => {
31
+ t.selectedKeys.includes(e) ? w(e) : A(e);
32
+ }, A = (e) => {
33
+ if (t.maxSelected && t.selectedKeys.length >= t.maxSelected)
34
+ return;
35
+ const s = [...t.selectedKeys, e];
36
+ o("update:selectedKeys", s), o("change", s), o("select", e), t.highlightedKeys.includes(e) || b(e);
37
+ }, w = (e) => {
38
+ if (t.selectedKeys.length <= 1 || t.highlightedKeys.length <= 1 && t.highlightedKeys.includes(e))
39
+ return;
40
+ const s = t.selectedKeys.filter((r) => r !== e);
41
+ if (o("update:selectedKeys", s), o("change", s), o("remove", e), t.highlightedKeys.includes(e)) {
42
+ const r = t.highlightedKeys.filter((a) => a !== e);
43
+ o("update:highlightedKeys", r), o("highlight", r);
44
+ }
45
+ }, b = (e) => {
46
+ let s;
47
+ if (t.highlightedKeys.includes(e))
48
+ if (t.highlightedKeys.length > 1)
49
+ s = t.highlightedKeys.filter((r) => r !== e);
50
+ else
51
+ return;
52
+ else
53
+ s = [...t.highlightedKeys, e];
54
+ o("update:highlightedKeys", s), o("highlight", s);
55
+ }, j = (e) => {
56
+ e || (m.value = e);
57
+ };
58
+ return M({
59
+ popoverVisible: m,
60
+ allOptions: C,
61
+ selectedOptions: S,
62
+ isSelected: T,
63
+ isHighlighted: k,
64
+ toggleOption: H,
65
+ addOption: A,
66
+ removeOption: w,
67
+ highlightOption: b
68
+ }), (e, s) => {
69
+ const r = J("InfoCircleFilled");
70
+ return c(), u("div", {
71
+ class: d([l(n)(), `${l(z)(l(L))}`]),
72
+ style: $({
73
+ ...e.wrapperStyle,
74
+ "--ap-value-select-card-column-count": e.maxRowDisplay
75
+ })
76
+ }, [
77
+ I(l(U), {
78
+ open: m.value,
79
+ trigger: "click",
80
+ placement: "bottomRight",
81
+ arrow: !1,
82
+ "get-popup-container": e.getContainer,
83
+ onOpenChange: j
84
+ }, {
85
+ content: _(() => [
86
+ h("div", {
87
+ class: d(l(n)("popover"))
88
+ }, [
89
+ e.popoverTitle ? (c(), u("div", {
90
+ key: 0,
91
+ class: d(l(n)("title"))
92
+ }, [
93
+ e.showTitleIcon ? (c(), Q(r, {
94
+ key: 0,
95
+ class: d(l(n)("title-icon"))
96
+ }, null, 8, ["class"])) : f("", !0),
97
+ O(" " + g(e.popoverTitle), 1)
98
+ ], 2)) : f("", !0),
99
+ h("div", {
100
+ class: d(l(n)("list"))
101
+ }, [
102
+ (c(!0), u(D, null, E(C.value, (a) => (c(), u("div", {
103
+ key: a.key,
104
+ class: d([
105
+ l(n)("list-item"),
106
+ "all",
107
+ {
108
+ select: T(a.key),
109
+ disabled: e.maxSelected && e.selectedKeys.length >= e.maxSelected
110
+ }
111
+ ]),
112
+ onClick: y((B) => H(a.key), ["stop"])
113
+ }, [
114
+ h("div", ee, g(a.label), 1),
115
+ h("div", te, g(a.value), 1)
116
+ ], 10, x))), 128))
117
+ ], 2)
118
+ ], 2)
119
+ ]),
120
+ default: _(() => {
121
+ var a, B, V, F;
122
+ return [
123
+ h("div", {
124
+ class: d(l(n)("list"))
125
+ }, [
126
+ (c(!0), u(D, null, E(S.value, (i) => (c(), u("div", {
127
+ key: i.key,
128
+ ref_for: !0,
129
+ ref_key: "listItemRef",
130
+ ref: p,
131
+ class: d([
132
+ l(n)("list-item"),
133
+ {
134
+ select: k(i.key),
135
+ custom: i.customClass
136
+ },
137
+ i.customClass
138
+ ]),
139
+ style: $(e.getCardStyle(i.key)),
140
+ onClick: y((G) => b(i.key), ["stop"])
141
+ }, [
142
+ e.showCloseIcon && (!(e.highlightedKeys.length === 1 && k(i.key)) && S.value.length > 1) ? (c(), u("div", {
143
+ key: 0,
144
+ class: d(l(n)("list-item-close")),
145
+ onClick: y((G) => w(i.key), ["stop"])
146
+ }, [
147
+ v(e.$slots, "close-icon", {}, () => [
148
+ I(l(X))
149
+ ])
150
+ ], 10, se)) : f("", !0),
151
+ h("div", ie, [
152
+ v(e.$slots, "label", { option: i }, () => [
153
+ O(g(i.label), 1)
154
+ ])
155
+ ]),
156
+ h("div", oe, [
157
+ v(e.$slots, "value", { option: i }, () => [
158
+ O(g(i.value), 1)
159
+ ])
160
+ ])
161
+ ], 14, le))), 128)),
162
+ e.showAddButton && (!e.maxSelected || e.selectedKeys.length < e.maxSelected) ? (c(), u("div", {
163
+ key: 0,
164
+ class: d([l(n)("list-item"), "choose"]),
165
+ style: $({
166
+ minHeight: p.value ? `${(B = (a = p.value) == null ? void 0 : a[0]) != null && B.offsetHeight ? `${(F = (V = p.value) == null ? void 0 : V[0]) == null ? void 0 : F.offsetHeight}px` : "auto"}` : "auto"
167
+ }),
168
+ onClick: s[0] || (s[0] = y((i) => m.value = !0, ["stop"]))
169
+ }, [
170
+ v(e.$slots, "add-button", {}, () => [
171
+ I(l(W)),
172
+ h("span", ne, g(e.addButtonText), 1)
173
+ ])
174
+ ], 6)) : f("", !0)
175
+ ], 2)
176
+ ];
177
+ }),
178
+ _: 3
179
+ }, 8, ["open", "get-popup-container"])
180
+ ], 6);
181
+ };
182
+ }
183
+ });
184
+ export {
185
+ pe as default
186
+ };