@antdv-next1/pro-card 2.0.8 → 2.0.11
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.
- package/dist/Card.d.ts +54 -0
- package/dist/Card.js +474 -0
- package/dist/ProCard.d.ts +69 -54
- package/dist/ProCard.js +116 -290
- package/dist/components/CheckCard/CheckCard.d.ts +9 -8
- package/dist/components/CheckCard/CheckCard.js +30 -18
- package/dist/components/CheckCard/Group.js +2 -2
- package/dist/components/CheckCard/index.d.ts +2 -2
- package/dist/components/CheckCard/style/index.js +25 -12
- package/dist/components/Statistic/index.d.ts +18 -14
- package/dist/components/Statistic/index.js +49 -49
- package/dist/components/StatisticCard/index.d.ts +52 -12
- package/dist/components/StatisticCard/index.js +132 -138
- package/dist/index.d.ts +2 -2
- package/dist/pro-card.esm.js +15472 -19272
- package/dist/pro-card.js +39 -39
- package/dist/style/index.js +88 -39
- package/package.json +3 -3
package/dist/ProCard.js
CHANGED
|
@@ -1,296 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { classNames } from "@v-c/util";
|
|
6
|
-
import { BorderBeam, Card, Col, Collapse, Row, Tooltip, useBreakpoint } from "antdv-next";
|
|
7
|
-
import { responsiveArray } from "antdv-next/dist/_util/responsiveObserver";
|
|
8
|
-
import { useConfig } from "antdv-next/dist/config-provider/context";
|
|
1
|
+
import InternalProCard from "./Card.js";
|
|
2
|
+
import { createVNode, defineComponent, mergeProps } from "vue";
|
|
3
|
+
import { CardGrid, CardMeta } from "antdv-next";
|
|
4
|
+
import ProConfigProvider from "@antdv-next1/pro-provider";
|
|
9
5
|
//#region src/ProCard.tsx
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
const ProCard = /* @__PURE__ */ defineComponent((props, { slots, attrs }) => {
|
|
14
|
-
const config = useConfig();
|
|
15
|
-
const prefixCls = computed(() => props.prefixCls || config.value.getPrefixCls("pro"));
|
|
16
|
-
const baseClassName = computed(() => `${prefixCls.value}-card`);
|
|
17
|
-
const { wrapSSR, hashId } = useStyle(baseClassName);
|
|
18
|
-
const activeKey = ref();
|
|
19
|
-
const screens = useBreakpoint();
|
|
20
|
-
/**
|
|
21
|
-
* 根据响应式获取 gutter, 参考 antd 实现
|
|
22
|
-
* @param gut
|
|
23
|
-
*/
|
|
24
|
-
const getNormalizedGutter = (gut) => {
|
|
25
|
-
const results = [0, 0];
|
|
26
|
-
(Array.isArray(gut) ? gut : [gut, 0]).forEach((g, index) => {
|
|
27
|
-
if (typeof g === "object") for (let i = 0; i < responsiveArray.length; i += 1) {
|
|
28
|
-
const breakpoint = responsiveArray[i];
|
|
29
|
-
if (screens.value?.[breakpoint] && g[breakpoint] !== void 0) {
|
|
30
|
-
results[index] = g[breakpoint];
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
else results[index] = g || 0;
|
|
35
|
-
});
|
|
36
|
-
return results;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* 根据条件返回 style.ts,负责返回空对象
|
|
40
|
-
*
|
|
41
|
-
* @param withStyle 是否符合条件
|
|
42
|
-
* @param appendStyle 如果符合条件要返回的 style.ts 属性
|
|
43
|
-
*/
|
|
44
|
-
const getStyle = (withStyle, appendStyle) => {
|
|
45
|
-
return withStyle ? appendStyle : {};
|
|
46
|
-
};
|
|
47
|
-
watch(() => props.defaultCollapsed, (next) => {
|
|
48
|
-
if (!next) activeKey.value = ["collapseCard"];
|
|
49
|
-
}, { immediate: true });
|
|
50
|
-
let containProCard = false;
|
|
51
|
-
const slotTitleProps = computed(() => {
|
|
52
|
-
if (props.title && props.tooltip || slots.title && props.tooltip) return { title: () => createVNode(Fragment, null, [props.title || slots.title?.(), createVNode(Tooltip, null, {
|
|
53
|
-
default: () => [createVNode(InfoCircleOutlined, { "style": {
|
|
54
|
-
marginInlineStart: "4px",
|
|
55
|
-
cursor: "pointer"
|
|
56
|
-
} }, null)],
|
|
57
|
-
title: () => props.tooltip
|
|
58
|
-
})]) };
|
|
59
|
-
if (slots.title && !props.tooltip) return { title: slots.title };
|
|
60
|
-
return {};
|
|
61
|
-
});
|
|
62
|
-
return () => {
|
|
63
|
-
const { ghost, direction, boxShadow, colSpan, split, align, borderBeam, colStyle, headerBordered = false, collapsible = false, collapsibleIconRender, collapsed: controlCollapsed, defaultCollapsed = false, onChecked, checked, onCollapse, justify, colLg, colFlex, colMd, colXl, colXxl, colSm, colPush, colPull, colXs, disabled, gutter = 0, title, tooltip, ...rest } = props;
|
|
64
|
-
const [horizontalGutter, verticalGutter] = getNormalizedGutter(gutter);
|
|
65
|
-
const { default: children, title: slotTitle, ...restSlots } = slots;
|
|
66
|
-
const childrenDom = childrenToArray(children?.())?.map((element) => {
|
|
67
|
-
if (isVNode(element) && !isSpecialNode(element)) {
|
|
68
|
-
if (element.props && element.type.isProCard && direction === "column") {
|
|
69
|
-
const colBreakpointKeyList = [
|
|
70
|
-
"span",
|
|
71
|
-
"flex",
|
|
72
|
-
"offset",
|
|
73
|
-
"order",
|
|
74
|
-
"pull",
|
|
75
|
-
"push",
|
|
76
|
-
"xs",
|
|
77
|
-
"sm",
|
|
78
|
-
"md",
|
|
79
|
-
"lg",
|
|
80
|
-
"xl",
|
|
81
|
-
"xxl"
|
|
82
|
-
];
|
|
83
|
-
const colPropsClass = Object.entries(element.props).reduce((prev, [key, value]) => {
|
|
84
|
-
const keys = key.split("-");
|
|
85
|
-
if (colBreakpointKeyList.includes(keys[keys.length - 1])) if (["span", "flex"].includes(keys[keys.length - 1])) prev[`${baseClassName.value}-${keys[keys.length - 2]}-${value}`] = true;
|
|
86
|
-
else prev[`${baseClassName.value}-${key}-${value}`] = true;
|
|
87
|
-
return prev;
|
|
88
|
-
}, {});
|
|
89
|
-
containProCard = true;
|
|
90
|
-
return createVNode("div", {
|
|
91
|
-
"style": {
|
|
92
|
-
...getStyle(horizontalGutter > 0, {
|
|
93
|
-
paddingInlineEnd: `${horizontalGutter / 2}px`,
|
|
94
|
-
paddingInlineStart: `${horizontalGutter / 2}px`
|
|
95
|
-
}),
|
|
96
|
-
...getStyle(verticalGutter > 0, {
|
|
97
|
-
paddingBlockStart: `${verticalGutter / 2}px`,
|
|
98
|
-
paddingBlockEnd: `${verticalGutter / 2}px`
|
|
99
|
-
})
|
|
100
|
-
},
|
|
101
|
-
"class": classNames([`${baseClassName.value}-col`], colPropsClass)
|
|
102
|
-
}, [element]);
|
|
103
|
-
}
|
|
104
|
-
if (element.type.isProCard) {
|
|
105
|
-
containProCard = true;
|
|
106
|
-
return createVNode(Col, [
|
|
107
|
-
"span",
|
|
108
|
-
"flex",
|
|
109
|
-
"offset",
|
|
110
|
-
"order",
|
|
111
|
-
"pull",
|
|
112
|
-
"push",
|
|
113
|
-
"xs",
|
|
114
|
-
"sm",
|
|
115
|
-
"md",
|
|
116
|
-
"lg",
|
|
117
|
-
"xl",
|
|
118
|
-
"xxl"
|
|
119
|
-
].reduce((prev, key) => {
|
|
120
|
-
if (element.props?.[`col-${key}`] !== void 0) prev[key] = element.props?.[`col-${key}`];
|
|
121
|
-
return prev;
|
|
122
|
-
}, {}), _isSlot(element) ? element : { default: () => [element] });
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return element;
|
|
126
|
-
});
|
|
127
|
-
return wrapSSR(createVNode(Fragment, null, [collapsible ? createVNode(Collapse, mergeProps({ "bordered": rest.variant !== "borderless" }, defaultCollapsed ? {} : { activeKey: activeKey.value }, {
|
|
128
|
-
"class": classNames(baseClassName.value, attrs.class, hashId.value),
|
|
129
|
-
"ghost": !ghost
|
|
130
|
-
}), { default: () => [createTextVNode("asdsa")] }) : createVNode(Fragment, null, [rest.variant !== "borderless" && borderBeam && !disabled ? createVNode(BorderBeam, typeof borderBeam === "boolean" ? {} : borderBeam, { default: () => [createVNode(Card, mergeProps(attrs, rest, { "class": classNames(baseClassName.value, attrs.class, hashId.value, {
|
|
131
|
-
[`${baseClassName.value}-direction-column`]: split === "horizontal" || direction === "column",
|
|
132
|
-
[`${baseClassName.value}-ghost`]: ghost,
|
|
133
|
-
[`${baseClassName.value}-box-shadow`]: boxShadow,
|
|
134
|
-
[`${baseClassName.value}-contain-card`]: containProCard
|
|
135
|
-
}) }, title && !tooltip && !slotTitle ? { title } : {}, { "styles": {
|
|
136
|
-
header: headerBordered ? {} : { borderBlockEnd: "none" },
|
|
137
|
-
...rest.styles
|
|
138
|
-
} }), {
|
|
139
|
-
default: () => [direction !== "column" && containProCard ? createVNode(Row, { "gutter": gutter }, _isSlot(childrenDom) ? childrenDom : { default: () => [childrenDom] }) : ghost && containProCard ? createVNode("div", {
|
|
140
|
-
"class": `${baseClassName.value}-column`,
|
|
141
|
-
"style": {
|
|
142
|
-
...getStyle(horizontalGutter > 0, {
|
|
143
|
-
marginInlineEnd: `-${horizontalGutter / 2}px`,
|
|
144
|
-
marginInlineStart: `-${horizontalGutter / 2}px`
|
|
145
|
-
}),
|
|
146
|
-
...getStyle(verticalGutter > 0, {
|
|
147
|
-
marginBlockStart: `-${verticalGutter / 2}px`,
|
|
148
|
-
marginBlockEnd: `-${verticalGutter / 2}px`
|
|
149
|
-
})
|
|
150
|
-
}
|
|
151
|
-
}, [childrenDom]) : childrenDom],
|
|
152
|
-
...restSlots,
|
|
153
|
-
...slotTitleProps.value
|
|
154
|
-
})] }) : createVNode(Card, mergeProps(attrs, rest, { "class": classNames(baseClassName.value, attrs.class, hashId.value, {
|
|
155
|
-
[`${baseClassName.value}-direction-column`]: split === "horizontal" || direction === "column",
|
|
156
|
-
[`${baseClassName.value}-ghost`]: ghost,
|
|
157
|
-
[`${baseClassName.value}-disabled`]: disabled,
|
|
158
|
-
[`${baseClassName.value}-box-shadow`]: boxShadow,
|
|
159
|
-
[`${baseClassName.value}-contain-card`]: containProCard
|
|
160
|
-
}) }, title && !tooltip && !slotTitle ? { title } : {}, { "styles": {
|
|
161
|
-
header: headerBordered ? {} : { borderBlockEnd: "none" },
|
|
162
|
-
...rest.styles
|
|
163
|
-
} }), {
|
|
164
|
-
default: () => [direction !== "column" && containProCard ? createVNode(Row, { "gutter": gutter }, _isSlot(childrenDom) ? childrenDom : { default: () => [childrenDom] }) : ghost && containProCard ? createVNode("div", {
|
|
165
|
-
"class": `${baseClassName.value}-column`,
|
|
166
|
-
"style": {
|
|
167
|
-
...getStyle(horizontalGutter > 0, {
|
|
168
|
-
marginInlineEnd: `-${horizontalGutter / 2}px`,
|
|
169
|
-
marginInlineStart: `-${horizontalGutter / 2}px`
|
|
170
|
-
}),
|
|
171
|
-
...getStyle(verticalGutter > 0, {
|
|
172
|
-
marginBlockStart: `-${verticalGutter / 2}px`,
|
|
173
|
-
marginBlockEnd: `-${verticalGutter / 2}px`
|
|
174
|
-
})
|
|
175
|
-
}
|
|
176
|
-
}, [childrenDom]) : childrenDom],
|
|
177
|
-
...restSlots,
|
|
178
|
-
...slotTitleProps.value
|
|
179
|
-
})])]));
|
|
180
|
-
};
|
|
6
|
+
const ProCard = /* @__PURE__ */ defineComponent((props, { slots, expose, attrs }) => {
|
|
7
|
+
expose({});
|
|
8
|
+
return () => createVNode(ProConfigProvider, { "needDeps": true }, { default: () => [createVNode(InternalProCard, mergeProps(attrs, props), slots)] });
|
|
181
9
|
}, {
|
|
182
10
|
props: {
|
|
183
|
-
tooltip: {
|
|
184
|
-
type: [
|
|
185
|
-
Object,
|
|
186
|
-
Function,
|
|
187
|
-
String,
|
|
188
|
-
Number,
|
|
189
|
-
null,
|
|
190
|
-
Boolean,
|
|
191
|
-
Array
|
|
192
|
-
],
|
|
193
|
-
required: false,
|
|
194
|
-
default: void 0
|
|
195
|
-
},
|
|
196
|
-
split: {
|
|
197
|
-
type: String,
|
|
198
|
-
required: false
|
|
199
|
-
},
|
|
200
|
-
direction: {
|
|
201
|
-
type: String,
|
|
202
|
-
required: false
|
|
203
|
-
},
|
|
204
|
-
gutter: {
|
|
205
|
-
type: [
|
|
206
|
-
Number,
|
|
207
|
-
null,
|
|
208
|
-
Object,
|
|
209
|
-
Array
|
|
210
|
-
],
|
|
211
|
-
required: false
|
|
212
|
-
},
|
|
213
|
-
colStyle: {
|
|
214
|
-
type: Object,
|
|
215
|
-
required: false
|
|
216
|
-
},
|
|
217
|
-
borderBeam: {
|
|
218
|
-
type: [Object, Boolean],
|
|
219
|
-
required: false,
|
|
220
|
-
default: void 0
|
|
221
|
-
},
|
|
222
|
-
layout: {
|
|
223
|
-
type: String,
|
|
224
|
-
required: false
|
|
225
|
-
},
|
|
226
|
-
boxShadow: {
|
|
227
|
-
type: Boolean,
|
|
228
|
-
required: false,
|
|
229
|
-
default: void 0
|
|
230
|
-
},
|
|
231
|
-
disabled: {
|
|
232
|
-
type: Boolean,
|
|
233
|
-
required: false,
|
|
234
|
-
default: void 0
|
|
235
|
-
},
|
|
236
|
-
headerBordered: {
|
|
237
|
-
type: Boolean,
|
|
238
|
-
required: false,
|
|
239
|
-
default: void 0
|
|
240
|
-
},
|
|
241
|
-
ghost: {
|
|
242
|
-
type: Boolean,
|
|
243
|
-
required: false,
|
|
244
|
-
default: void 0
|
|
245
|
-
},
|
|
246
|
-
collapsible: {
|
|
247
|
-
type: [String, Boolean],
|
|
248
|
-
required: false,
|
|
249
|
-
default: void 0
|
|
250
|
-
},
|
|
251
|
-
collapsed: {
|
|
252
|
-
type: Boolean,
|
|
253
|
-
required: false,
|
|
254
|
-
default: void 0
|
|
255
|
-
},
|
|
256
|
-
collapsibleIconRender: {
|
|
257
|
-
type: Function,
|
|
258
|
-
required: false
|
|
259
|
-
},
|
|
260
|
-
defaultCollapsed: {
|
|
261
|
-
type: Boolean,
|
|
262
|
-
required: false,
|
|
263
|
-
default: void 0
|
|
264
|
-
},
|
|
265
|
-
onCollapse: {
|
|
266
|
-
type: Function,
|
|
267
|
-
required: false
|
|
268
|
-
},
|
|
269
|
-
checked: {
|
|
270
|
-
type: Boolean,
|
|
271
|
-
required: false,
|
|
272
|
-
default: void 0
|
|
273
|
-
},
|
|
274
|
-
onChecked: {
|
|
275
|
-
type: Function,
|
|
276
|
-
required: false
|
|
277
|
-
},
|
|
278
|
-
colSpan: { required: false },
|
|
279
|
-
colOffset: { required: false },
|
|
280
|
-
colFlex: { required: false },
|
|
281
|
-
colOrder: { required: false },
|
|
282
|
-
colPull: { required: false },
|
|
283
|
-
colPush: { required: false },
|
|
284
|
-
colXs: { required: false },
|
|
285
|
-
colSm: { required: false },
|
|
286
|
-
colMd: { required: false },
|
|
287
|
-
colLg: { required: false },
|
|
288
|
-
colXl: { required: false },
|
|
289
|
-
colXxl: { required: false },
|
|
290
|
-
onClick: {
|
|
291
|
-
type: Function,
|
|
292
|
-
required: false
|
|
293
|
-
},
|
|
294
11
|
title: {
|
|
295
12
|
type: [
|
|
296
13
|
Function,
|
|
@@ -422,6 +139,15 @@ const ProCard = /* @__PURE__ */ defineComponent((props, { slots, attrs }) => {
|
|
|
422
139
|
type: Function,
|
|
423
140
|
required: false
|
|
424
141
|
},
|
|
142
|
+
gutter: {
|
|
143
|
+
type: [
|
|
144
|
+
Number,
|
|
145
|
+
null,
|
|
146
|
+
Object,
|
|
147
|
+
Array
|
|
148
|
+
],
|
|
149
|
+
required: false
|
|
150
|
+
},
|
|
425
151
|
align: {
|
|
426
152
|
type: [String, Object],
|
|
427
153
|
required: false
|
|
@@ -434,14 +160,114 @@ const ProCard = /* @__PURE__ */ defineComponent((props, { slots, attrs }) => {
|
|
|
434
160
|
type: Boolean,
|
|
435
161
|
required: false,
|
|
436
162
|
default: void 0
|
|
163
|
+
},
|
|
164
|
+
tooltip: {
|
|
165
|
+
type: [
|
|
166
|
+
Object,
|
|
167
|
+
Function,
|
|
168
|
+
String,
|
|
169
|
+
Number,
|
|
170
|
+
null,
|
|
171
|
+
Boolean
|
|
172
|
+
],
|
|
173
|
+
required: false,
|
|
174
|
+
default: void 0
|
|
175
|
+
},
|
|
176
|
+
split: {
|
|
177
|
+
type: String,
|
|
178
|
+
required: false
|
|
179
|
+
},
|
|
180
|
+
direction: {
|
|
181
|
+
type: String,
|
|
182
|
+
required: false
|
|
183
|
+
},
|
|
184
|
+
colStyle: {
|
|
185
|
+
type: Object,
|
|
186
|
+
required: false
|
|
187
|
+
},
|
|
188
|
+
borderBeam: {
|
|
189
|
+
type: [Object, Boolean],
|
|
190
|
+
required: false,
|
|
191
|
+
default: void 0
|
|
192
|
+
},
|
|
193
|
+
layout: {
|
|
194
|
+
type: String,
|
|
195
|
+
required: false
|
|
196
|
+
},
|
|
197
|
+
boxShadow: {
|
|
198
|
+
type: Boolean,
|
|
199
|
+
required: false,
|
|
200
|
+
default: void 0
|
|
201
|
+
},
|
|
202
|
+
disabled: {
|
|
203
|
+
type: Boolean,
|
|
204
|
+
required: false,
|
|
205
|
+
default: void 0
|
|
206
|
+
},
|
|
207
|
+
headerBordered: {
|
|
208
|
+
type: Boolean,
|
|
209
|
+
required: false,
|
|
210
|
+
default: void 0
|
|
211
|
+
},
|
|
212
|
+
ghost: {
|
|
213
|
+
type: Boolean,
|
|
214
|
+
required: false,
|
|
215
|
+
default: void 0
|
|
216
|
+
},
|
|
217
|
+
collapsible: {
|
|
218
|
+
type: [String, Boolean],
|
|
219
|
+
required: false,
|
|
220
|
+
default: void 0
|
|
221
|
+
},
|
|
222
|
+
collapsibleIconRender: {
|
|
223
|
+
type: Function,
|
|
224
|
+
required: false
|
|
225
|
+
},
|
|
226
|
+
defaultCollapsed: {
|
|
227
|
+
type: Boolean,
|
|
228
|
+
required: false,
|
|
229
|
+
default: void 0
|
|
230
|
+
},
|
|
231
|
+
onCollapse: {
|
|
232
|
+
type: Function,
|
|
233
|
+
required: false
|
|
234
|
+
},
|
|
235
|
+
checked: {
|
|
236
|
+
type: Boolean,
|
|
237
|
+
required: false,
|
|
238
|
+
default: void 0
|
|
239
|
+
},
|
|
240
|
+
onChecked: {
|
|
241
|
+
type: Function,
|
|
242
|
+
required: false
|
|
243
|
+
},
|
|
244
|
+
colSpan: { required: false },
|
|
245
|
+
colOffset: { required: false },
|
|
246
|
+
colFlex: { required: false },
|
|
247
|
+
colOrder: { required: false },
|
|
248
|
+
colPull: { required: false },
|
|
249
|
+
colPush: { required: false },
|
|
250
|
+
colXs: { required: false },
|
|
251
|
+
colSm: { required: false },
|
|
252
|
+
colMd: { required: false },
|
|
253
|
+
colLg: { required: false },
|
|
254
|
+
colXl: { required: false },
|
|
255
|
+
colXxl: { required: false },
|
|
256
|
+
onClick: {
|
|
257
|
+
type: Function,
|
|
258
|
+
required: false
|
|
437
259
|
}
|
|
438
260
|
},
|
|
439
261
|
name: "ProCard",
|
|
440
262
|
inheritAttrs: false
|
|
441
263
|
});
|
|
442
264
|
ProCard.isProCard = true;
|
|
265
|
+
ProCard.CardGrid = CardGrid;
|
|
266
|
+
ProCard.CardMeta = CardMeta;
|
|
443
267
|
ProCard.install = (app) => {
|
|
444
268
|
app.component(ProCard.name, ProCard);
|
|
269
|
+
app.component(ProCard.CardGrid.name, CardGrid);
|
|
270
|
+
app.component(ProCard.CardMeta.name, CardMeta);
|
|
445
271
|
return app;
|
|
446
272
|
};
|
|
447
273
|
//#endregion
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ProCardProps } from "../../ProCard.js";
|
|
2
2
|
import ProCheckCardGroup from "./Group.js";
|
|
3
3
|
import * as _$vue from "vue";
|
|
4
|
-
import { VNode } from "vue";
|
|
4
|
+
import { Plugin, VNode } from "vue";
|
|
5
|
+
import { VueNode } from "@v-c/util";
|
|
5
6
|
import { BorderBeamProps, CardMetaProps, CardProps } from "antdv-next";
|
|
6
7
|
import { CustomSlotsType } from "@v-c/util/dist/type";
|
|
7
8
|
|
|
@@ -20,13 +21,13 @@ type ProCheckCardProps = CardMetaProps & Omit<CardProps, 'title' | 'onTabChange'
|
|
|
20
21
|
collapsible?: ProCardProps['collapsible'];
|
|
21
22
|
};
|
|
22
23
|
declare const _ProCheckCard: _$vue.DefineSetupFnComponent<ProCheckCardProps, {}, CustomSlotsType<{
|
|
23
|
-
default?: () =>
|
|
24
|
-
avatar?: () =>
|
|
25
|
-
title?: () =>
|
|
26
|
-
extra?: () =>
|
|
27
|
-
cover?: () =>
|
|
24
|
+
default?: () => VueNode[];
|
|
25
|
+
avatar?: () => VueNode[];
|
|
26
|
+
title?: () => VueNode[];
|
|
27
|
+
extra?: () => VueNode[];
|
|
28
|
+
cover?: () => VueNode[];
|
|
28
29
|
description?: () => VNode[];
|
|
29
|
-
}>, CardMetaProps & Omit<CardProps, "size" | "title" | "
|
|
30
|
+
}>, CardMetaProps & Omit<CardProps, "size" | "title" | "type" | "headStyle" | "bodyStyle" | "tabList" | "tabBarExtraContent" | "activeTabKey" | "defaultActiveTabKey" | "onTabChange"> & {
|
|
30
31
|
/** 边框流光 */borderBeam?: BorderBeamProps | boolean;
|
|
31
32
|
size?: CardProps["size"] | "large";
|
|
32
33
|
checked?: boolean;
|
|
@@ -41,6 +42,6 @@ declare const _ProCheckCard: _$vue.DefineSetupFnComponent<ProCheckCardProps, {},
|
|
|
41
42
|
} & {}, _$vue.PublicProps>;
|
|
42
43
|
declare const ProCheckCard: typeof _ProCheckCard & {
|
|
43
44
|
Group?: typeof ProCheckCardGroup;
|
|
44
|
-
};
|
|
45
|
+
} & Plugin;
|
|
45
46
|
//#endregion
|
|
46
47
|
export { ProCheckCardProps, ProCheckCard as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import ProCard from "../../ProCard.js";
|
|
2
2
|
import ProCheckCardGroup, { useCheckCardGroupContextInject } from "./Group.js";
|
|
3
3
|
import { useStyle } from "./style/index.js";
|
|
4
|
-
import { Fragment, computed, createVNode, defineComponent,
|
|
5
|
-
import { isNil, useEffect, useMountMergeState } from "@antdv-next1/pro-utils";
|
|
4
|
+
import { Fragment, computed, createVNode, defineComponent, mergeProps, reactive, ref, toRef } from "vue";
|
|
5
|
+
import { isImg, isNil, isUrl, transformVueNodeType, useEffect, useMountMergeState } from "@antdv-next1/pro-utils";
|
|
6
6
|
import { classNames } from "@v-c/util";
|
|
7
7
|
import { Avatar, CardMeta } from "antdv-next";
|
|
8
8
|
import { useConfig } from "antdv-next/dist/config-provider/context";
|
|
@@ -22,6 +22,7 @@ const ProCheckCard = /* @__PURE__ */ defineComponent((props, { slots, attrs }) =
|
|
|
22
22
|
const checkCardProps = reactive({});
|
|
23
23
|
const [stateChecked, setStateChecked] = useMountMergeState(props.defaultChecked || false, {
|
|
24
24
|
value: toRef(() => props.checked),
|
|
25
|
+
defaultValue: props.defaultChecked,
|
|
25
26
|
onChange: (checked) => {
|
|
26
27
|
props["onUpdate:checked"]?.(checked);
|
|
27
28
|
props.onChange?.(checked);
|
|
@@ -51,20 +52,22 @@ const ProCheckCard = /* @__PURE__ */ defineComponent((props, { slots, attrs }) =
|
|
|
51
52
|
setStateChecked?.(newChecked);
|
|
52
53
|
};
|
|
53
54
|
return () => {
|
|
54
|
-
const { title, avatar, prefixCls, onChange, value, disabled: propsDisabled, defaultChecked, checked, "onUpdate:checked": onUpdateChecked, "onUpdate:value": onUpdateValue, description, borderBeam, size: propsSize, onClick, ...rest } = props;
|
|
55
|
+
const { title = slots.title, avatar = slots.avatar, prefixCls, onChange, value, disabled: propsDisabled, defaultChecked, checked, "onUpdate:checked": onUpdateChecked, "onUpdate:value": onUpdateValue, description = slots.description, borderBeam, size: propsSize, onClick, ...rest } = props;
|
|
55
56
|
Object.keys(rest).forEach((key) => {
|
|
56
57
|
checkCardProps[key] = rest[key];
|
|
57
58
|
});
|
|
58
|
-
const { disabled = propsDisabled || false, loading: cardLoading, bordered = true, size, checked: propsChecked = checked, cover, extra, ...restCardProps } = checkCardProps;
|
|
59
|
+
const { disabled = propsDisabled || false, loading: cardLoading, bordered = true, size, checked: propsChecked = checked, cover = slots.cover, extra = slots.extra, ...restCardProps } = checkCardProps;
|
|
59
60
|
const sizeCls = getSizeCls(size || propsSize);
|
|
60
|
-
const
|
|
61
|
+
const titleDom = transformVueNodeType(title);
|
|
62
|
+
const descriptionDom = transformVueNodeType(description);
|
|
63
|
+
const coverDom = transformVueNodeType(cover);
|
|
64
|
+
const extraDom = transformVueNodeType(extra);
|
|
65
|
+
const avatarDom = typeof avatar === "string" && isUrl(avatar) && isImg(avatar) ? createVNode(Avatar, {
|
|
61
66
|
"size": 48,
|
|
62
67
|
"shape": "square",
|
|
63
68
|
"src": avatar
|
|
64
|
-
}, null);
|
|
65
|
-
const headerDom = isNil(
|
|
66
|
-
const descriptionDom = slots.description?.() || description;
|
|
67
|
-
const coverDom = cover || slots.cover?.();
|
|
69
|
+
}, null) : transformVueNodeType(avatar);
|
|
70
|
+
const headerDom = isNil(titleDom ?? extraDom) ? null : createVNode(Fragment, null, [titleDom && createVNode("div", { "class": classNames(`${baseClassName.value}-meta-header`, hashId.value) }, [createVNode("div", { "class": classNames(`${baseClassName.value}-meta-title`, `${baseClassName.value}-meta-title-with-ellipsis`, hashId.value) }, [titleDom])]), extraDom && createVNode("div", { "class": classNames(`${baseClassName.value}-meta-title-extra`, hashId.value) }, [extraDom])]);
|
|
68
71
|
return wrapSSR(createVNode(ProCard, mergeProps({
|
|
69
72
|
"style": attrs.style,
|
|
70
73
|
"class": classNames(baseClassName.value, attrs.class, hashId.value, {
|
|
@@ -79,21 +82,22 @@ const ProCheckCard = /* @__PURE__ */ defineComponent((props, { slots, attrs }) =
|
|
|
79
82
|
"loading": cardLoading,
|
|
80
83
|
"onClick": (e) => {
|
|
81
84
|
if (!cardLoading && !disabled) handleClick(e);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"src": coverDom,
|
|
85
|
+
},
|
|
86
|
+
"cover": typeof cover === "string" ? createVNode("img", {
|
|
87
|
+
"src": cover,
|
|
86
88
|
"alt": "checkcard"
|
|
87
|
-
}, null) : coverDom
|
|
88
|
-
|
|
89
|
+
}, null) : coverDom
|
|
90
|
+
}), {
|
|
91
|
+
...slots,
|
|
92
|
+
default: () => createVNode(Fragment, null, [(headerDom || avatarDom || descriptionDom || cardLoading) && createVNode(CardMeta, {
|
|
89
93
|
"title": headerDom,
|
|
90
94
|
"description": descriptionDom,
|
|
91
95
|
"class": classNames(`${baseClassName.value}-meta`, hashId.value, {
|
|
92
96
|
[`${baseClassName.value}-meta-avatar-header`]: avatarDom && headerDom && !descriptionDom,
|
|
93
|
-
[`${baseClassName.value}-meta-extra-header`]: !isNil(
|
|
97
|
+
[`${baseClassName.value}-meta-extra-header`]: !isNil(extraDom)
|
|
94
98
|
}),
|
|
95
99
|
"avatar": avatarDom
|
|
96
|
-
}, null)
|
|
100
|
+
}, null), slots.default?.() && createVNode("div", { "class": classNames(`${baseClassName.value}-body`, hashId.value) }, [slots.default?.()])])
|
|
97
101
|
}));
|
|
98
102
|
};
|
|
99
103
|
}, {
|
|
@@ -258,11 +262,19 @@ const ProCheckCard = /* @__PURE__ */ defineComponent((props, { slots, attrs }) =
|
|
|
258
262
|
type: Function,
|
|
259
263
|
required: false
|
|
260
264
|
},
|
|
261
|
-
collapsible: {
|
|
265
|
+
collapsible: {
|
|
266
|
+
type: [String, Boolean],
|
|
267
|
+
required: false,
|
|
268
|
+
default: void 0
|
|
269
|
+
}
|
|
262
270
|
},
|
|
263
271
|
name: "ProCheckCard",
|
|
264
272
|
inheritAttrs: false
|
|
265
273
|
});
|
|
266
274
|
ProCheckCard.Group = ProCheckCardGroup;
|
|
275
|
+
ProCheckCard.install = (app) => {
|
|
276
|
+
app.component(ProCheckCard.name, ProCheckCard);
|
|
277
|
+
app.component(ProCheckCardGroup.name, ProCheckCardGroup);
|
|
278
|
+
};
|
|
267
279
|
//#endregion
|
|
268
280
|
export { ProCheckCard as default };
|
|
@@ -5,7 +5,7 @@ import { computed, createVNode, defineComponent, inject, provide, shallowRef, to
|
|
|
5
5
|
import { childrenToArray, isSpecialNode, useMountMergeState } from "@antdv-next1/pro-utils";
|
|
6
6
|
import { classNames } from "@v-c/util";
|
|
7
7
|
import { useConfig } from "antdv-next/dist/config-provider/context";
|
|
8
|
-
import { ProConfigProvider } from "@antdv-next1/pro-provider";
|
|
8
|
+
import { ProConfigProvider as ProConfigProvider$1 } from "@antdv-next1/pro-provider";
|
|
9
9
|
//#region src/components/CheckCard/Group.tsx
|
|
10
10
|
/**
|
|
11
11
|
* Represents the possible value types for a CheckGroup.
|
|
@@ -178,6 +178,6 @@ const InternalCheckCardGroup = /* @__PURE__ */ defineComponent((props, { slots,
|
|
|
178
178
|
name: "InternalCheckCardGroup",
|
|
179
179
|
inheritAttrs: false
|
|
180
180
|
});
|
|
181
|
-
const ProCheckCardGroup = (props, { slots }) => createVNode(ProConfigProvider, { "needDeps": true }, { default: () => [createVNode(InternalCheckCardGroup, props, slots)] });
|
|
181
|
+
const ProCheckCardGroup = (props, { slots }) => createVNode(ProConfigProvider$1, { "needDeps": true }, { default: () => [createVNode(InternalCheckCardGroup, props, slots)] });
|
|
182
182
|
//#endregion
|
|
183
183
|
export { checkCardGroupContextKey, ProCheckCardGroup as default, useCheckCardGroupContextInject, useCheckCardGroupContextProvider };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import ProCheckCardGroup, { ProCheckCardGroupProps } from "./Group.js";
|
|
1
|
+
import ProCheckCardGroup, { CheckCardGroupContextType, CheckCardItemGroupType, CheckCardItemType, CheckCardOptionType, CheckCardValueType, CheckGroupValueType, ProCheckCardGroupProps } from "./Group.js";
|
|
2
2
|
import ProCheckCard, { ProCheckCardProps } from "./CheckCard.js";
|
|
3
|
-
export { ProCheckCard, ProCheckCardGroup, type ProCheckCardGroupProps, type ProCheckCardProps };
|
|
3
|
+
export { type CheckCardGroupContextType, type CheckCardItemGroupType, type CheckCardItemType, type CheckCardOptionType, type CheckCardValueType, type CheckGroupValueType, ProCheckCard, ProCheckCardGroup, type ProCheckCardGroupProps, type ProCheckCardProps };
|
|
@@ -35,6 +35,7 @@ const genProCheckCardStyle = (token) => {
|
|
|
35
35
|
cursor: "pointer",
|
|
36
36
|
transition: "all 0.3s",
|
|
37
37
|
verticalAlign: "top",
|
|
38
|
+
"&-body": { paddingBlockStart: token.padding },
|
|
38
39
|
"&:not(:last-child)": {
|
|
39
40
|
marginInlineEnd: token.margin,
|
|
40
41
|
marginBlockEnd: token.margin
|
|
@@ -59,6 +60,7 @@ const genProCheckCardStyle = (token) => {
|
|
|
59
60
|
} }
|
|
60
61
|
} },
|
|
61
62
|
[`&${token.antCls}-card`]: {
|
|
63
|
+
boxSizing: "border-box",
|
|
62
64
|
[`${token.antCls}-card-cover`]: {
|
|
63
65
|
paddingInline: token.paddingXXS,
|
|
64
66
|
paddingBlock: token.paddingXXS,
|
|
@@ -84,15 +86,33 @@ const genProCheckCardStyle = (token) => {
|
|
|
84
86
|
}
|
|
85
87
|
},
|
|
86
88
|
[`${token.antCls}-card-body`]: {
|
|
87
|
-
paddingBlock: token.
|
|
89
|
+
paddingBlock: token.paddingMD,
|
|
88
90
|
paddingInline: token.paddingSM,
|
|
89
91
|
[`${token.componentCls}-meta`]: { [`&${token.antCls}-card-meta`]: {
|
|
92
|
+
margin: 0,
|
|
90
93
|
[`${token.antCls}-card-meta-avatar`]: { paddingInlineEnd: token.paddingXS },
|
|
91
94
|
[`${token.antCls}-card-meta-section`]: {
|
|
92
95
|
"&>div:not(:last-child)": { marginBottom: token.marginXXS },
|
|
93
96
|
[`${token.antCls}-card-meta-title`]: {
|
|
94
97
|
fontSize: token.fontSize,
|
|
95
|
-
fontWeight: 500
|
|
98
|
+
fontWeight: 500,
|
|
99
|
+
[`${token.componentCls}-meta-header`]: {
|
|
100
|
+
display: "flex",
|
|
101
|
+
alignItems: "center",
|
|
102
|
+
justifyContent: "space-between",
|
|
103
|
+
lineHeight: token.lineHeight,
|
|
104
|
+
[`${token.componentCls}-meta-title`]: {
|
|
105
|
+
fontSize: token.fontSize,
|
|
106
|
+
fontWeight: 500,
|
|
107
|
+
overflow: "hidden",
|
|
108
|
+
whiteSpace: "nowrap",
|
|
109
|
+
textOverflow: "ellipsis",
|
|
110
|
+
display: "flex",
|
|
111
|
+
alignItems: "center",
|
|
112
|
+
justifyContent: "space-between",
|
|
113
|
+
"&-with-ellipsis": { display: "inline-block" }
|
|
114
|
+
}
|
|
115
|
+
}
|
|
96
116
|
}
|
|
97
117
|
},
|
|
98
118
|
[`&${token.componentCls}-meta-avatar-header`]: { alignItems: "center" },
|
|
@@ -105,20 +125,13 @@ const genProCheckCardStyle = (token) => {
|
|
|
105
125
|
whiteSpace: "normal",
|
|
106
126
|
textOverflow: "unset",
|
|
107
127
|
lineHeight: token.lineHeight,
|
|
108
|
-
[`${token.componentCls}-meta-
|
|
128
|
+
[`${token.componentCls}-meta-header`]: {
|
|
109
129
|
display: "flex",
|
|
110
130
|
alignItems: "center",
|
|
111
131
|
gap: token.sizeSM,
|
|
112
|
-
minWidth: 0
|
|
113
|
-
[`${token.componentCls}-meta-title-left-text`]: {
|
|
114
|
-
display: "inline-block",
|
|
115
|
-
overflow: "hidden",
|
|
116
|
-
textOverflow: "ellipsis",
|
|
117
|
-
whiteSpace: "nowrap",
|
|
118
|
-
alignItems: "center"
|
|
119
|
-
}
|
|
132
|
+
minWidth: 0
|
|
120
133
|
},
|
|
121
|
-
[`${token.componentCls}-meta-title-extra`]: {}
|
|
134
|
+
[`${token.componentCls}-meta-title-extra`]: { fontWeight: "normal" }
|
|
122
135
|
} } }
|
|
123
136
|
} },
|
|
124
137
|
"&:after": {
|