@antdv-next1/pro-card 1.0.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.
@@ -0,0 +1,228 @@
1
+ import Statistic$1 from "../Statistic/index.js";
2
+ import { useStyle } from "./style/index.js";
3
+ import { Fragment, computed, createVNode, defineComponent, mergeProps } from "vue";
4
+ import { classNames } from "@v-c/util";
5
+ import { BorderBeam, Card } from "antdv-next";
6
+ import { useConfig } from "antdv-next/dist/config-provider/context";
7
+ //#region src/components/StatisticCard/index.tsx
8
+ const StatisticCard = /* @__PURE__ */ defineComponent((props, { attrs, slots }) => {
9
+ const config = useConfig();
10
+ const prefixCls = computed(() => props.prefixCls || config.value.getPrefixCls("pro"));
11
+ const baseClassName = computed(() => `${prefixCls.value}-statistic-card`);
12
+ const { wrapSSR, hashId } = useStyle(baseClassName);
13
+ return () => {
14
+ const { statistic, chart, headerBordered = false, borderBeam, chartPlacement, footer, ...restProps } = props;
15
+ const statisticDom = statistic && createVNode(Statistic$1, mergeProps({ "layout": "vertical" }, statistic), null);
16
+ const chartDom = chart && createVNode("div", { "class": classNames(`${baseClassName.value}-chart`, hashId.value, {
17
+ [`${baseClassName.value}-chart-left`]: chartPlacement === "left" && chart && statistic,
18
+ [`${baseClassName.value}-chart-right`]: chartPlacement === "right" && chart && statistic
19
+ }) }, [chart]);
20
+ const contentCls = classNames(`${baseClassName.value}-content `, hashId.value, { [`${baseClassName.value}-content-horizontal`]: chartPlacement === "left" || chartPlacement === "right" });
21
+ const contentDom = (chartDom || statisticDom) && (chartPlacement === "left" ? createVNode("div", { "class": contentCls }, [chartDom, statisticDom]) : createVNode("div", { "class": contentCls }, [statisticDom, chartDom]));
22
+ return wrapSSR(createVNode(Fragment, null, [restProps.variant !== "borderless" && borderBeam ? createVNode(BorderBeam, typeof borderBeam === "boolean" ? {} : borderBeam, { default: () => [createVNode(Card, mergeProps({
23
+ "style": attrs.style,
24
+ "class": classNames(baseClassName.value, attrs.class, hashId.value)
25
+ }, restProps, { "styles": {
26
+ header: headerBordered ? {} : { borderBlockEnd: "none" },
27
+ ...restProps.styles
28
+ } }), { default: () => [
29
+ contentDom,
30
+ slots.default?.(),
31
+ footer && createVNode("div", { "class": classNames(`${baseClassName.value}-footer`, hashId.value) }, [footer])
32
+ ] })] }) : createVNode(Card, mergeProps({
33
+ "style": attrs.style,
34
+ "class": classNames(baseClassName.value, attrs.class, hashId.value)
35
+ }, restProps, { "styles": {
36
+ header: headerBordered ? {} : { borderBlockEnd: "none" },
37
+ ...restProps.styles
38
+ } }), { default: () => [
39
+ contentDom,
40
+ slots.default?.(),
41
+ footer && createVNode("div", { "class": classNames(`${baseClassName.value}-footer`, hashId.value) }, [footer])
42
+ ] })]));
43
+ };
44
+ }, {
45
+ props: {
46
+ chart: {
47
+ type: [
48
+ Object,
49
+ Function,
50
+ String,
51
+ Number,
52
+ null,
53
+ Boolean,
54
+ Array
55
+ ],
56
+ required: false,
57
+ default: void 0
58
+ },
59
+ headerBordered: {
60
+ type: Boolean,
61
+ required: false,
62
+ default: void 0
63
+ },
64
+ borderBeam: {
65
+ type: [Object, Boolean],
66
+ required: false,
67
+ default: void 0
68
+ },
69
+ statistic: {
70
+ type: Object,
71
+ required: false
72
+ },
73
+ chartPlacement: {
74
+ type: String,
75
+ required: false
76
+ },
77
+ footer: {
78
+ type: [
79
+ Object,
80
+ Function,
81
+ String,
82
+ Number,
83
+ null,
84
+ Boolean,
85
+ Array
86
+ ],
87
+ required: false,
88
+ default: void 0
89
+ },
90
+ title: {
91
+ type: [
92
+ Function,
93
+ String,
94
+ Number,
95
+ null,
96
+ Object,
97
+ Boolean
98
+ ],
99
+ required: false,
100
+ default: void 0
101
+ },
102
+ extra: {
103
+ type: [
104
+ Function,
105
+ String,
106
+ Number,
107
+ null,
108
+ Object,
109
+ Boolean
110
+ ],
111
+ required: false,
112
+ default: void 0
113
+ },
114
+ bordered: {
115
+ type: Boolean,
116
+ required: false,
117
+ default: void 0
118
+ },
119
+ headStyle: {
120
+ type: Object,
121
+ required: false
122
+ },
123
+ bodyStyle: {
124
+ type: Object,
125
+ required: false
126
+ },
127
+ loading: {
128
+ type: Boolean,
129
+ required: false,
130
+ default: void 0
131
+ },
132
+ hoverable: {
133
+ type: Boolean,
134
+ required: false,
135
+ default: void 0
136
+ },
137
+ id: {
138
+ type: String,
139
+ required: false
140
+ },
141
+ size: {
142
+ type: String,
143
+ required: false
144
+ },
145
+ type: {
146
+ type: String,
147
+ required: false
148
+ },
149
+ cover: {
150
+ type: [
151
+ Function,
152
+ String,
153
+ Number,
154
+ null,
155
+ Object,
156
+ Boolean
157
+ ],
158
+ required: false,
159
+ default: void 0
160
+ },
161
+ actions: {
162
+ type: Array,
163
+ required: false
164
+ },
165
+ tabList: {
166
+ type: Array,
167
+ required: false
168
+ },
169
+ tabBarExtraContent: {
170
+ type: [
171
+ Function,
172
+ String,
173
+ Number,
174
+ null,
175
+ Object,
176
+ Boolean
177
+ ],
178
+ required: false,
179
+ default: void 0
180
+ },
181
+ activeTabKey: {
182
+ type: String,
183
+ required: false
184
+ },
185
+ defaultActiveTabKey: {
186
+ type: String,
187
+ required: false
188
+ },
189
+ tabProps: {
190
+ type: Object,
191
+ required: false
192
+ },
193
+ classes: {
194
+ type: [Object, Function],
195
+ required: false
196
+ },
197
+ styles: {
198
+ type: [Object, Function],
199
+ required: false
200
+ },
201
+ variant: {
202
+ type: String,
203
+ required: false
204
+ },
205
+ rootClass: {
206
+ type: String,
207
+ required: false
208
+ },
209
+ prefixCls: {
210
+ type: String,
211
+ required: false
212
+ },
213
+ onTabChange: {
214
+ type: Function,
215
+ required: false
216
+ },
217
+ "onUpdate:activeTabKey": {
218
+ type: Function,
219
+ required: false
220
+ }
221
+ },
222
+ name: "StatisticCard",
223
+ inheritAttrs: false
224
+ });
225
+ StatisticCard.isProCard = true;
226
+ StatisticCard.Statistic = Statistic$1;
227
+ //#endregion
228
+ export { StatisticCard as default };
@@ -0,0 +1,11 @@
1
+ import { ComputedRef } from "vue";
2
+ import * as _$_antdv_next1_pro_provider0 from "@antdv-next1/pro-provider";
3
+ import { ProAliasToken } from "@antdv-next1/pro-provider";
4
+
5
+ //#region src/components/StatisticCard/style/index.d.ts
6
+ interface ProListToken extends ProAliasToken {
7
+ componentCls: string;
8
+ }
9
+ declare function useStyle(prefixCls: ComputedRef<string>): _$_antdv_next1_pro_provider0.UseStyleResult;
10
+ //#endregion
11
+ export { ProListToken, useStyle };
@@ -0,0 +1,47 @@
1
+ import { useStyle as useStyle$1 } from "@antdv-next1/pro-provider";
2
+ //#region src/components/StatisticCard/style/index.ts
3
+ const genProStyle = (token) => {
4
+ return { [token.componentCls]: {
5
+ boxSizing: "border-box",
6
+ "&-chart": {
7
+ display: "flex",
8
+ flexDirection: "column",
9
+ marginBlockStart: 8,
10
+ marginBlockEnd: 8,
11
+ "&-left": {
12
+ marginBlockStart: 0,
13
+ marginInlineEnd: "16px"
14
+ },
15
+ "&-right": {
16
+ marginBlockStart: 0,
17
+ marginInlineStart: "16px"
18
+ }
19
+ },
20
+ "&-content": {
21
+ display: "flex",
22
+ flexDirection: "column",
23
+ "&-horizontal": {
24
+ flexDirection: "row",
25
+ [`${token.componentCls}-chart`]: {
26
+ alignItems: "center",
27
+ alignSelf: "flex-start"
28
+ }
29
+ }
30
+ },
31
+ "&-footer": {
32
+ marginBlockStart: 8,
33
+ paddingBlockStart: "16px",
34
+ borderBlockStart: `rgba(0, 0, 0, 0.08) solid ${token.colorBorder}`
35
+ }
36
+ } };
37
+ };
38
+ function useStyle(prefixCls) {
39
+ return useStyle$1("StatisticCard", (token) => {
40
+ return [genProStyle({
41
+ ...token,
42
+ componentCls: `.${prefixCls.value}`
43
+ })];
44
+ });
45
+ }
46
+ //#endregion
47
+ export { useStyle };
@@ -0,0 +1,6 @@
1
+ import ProCard, { ProCardProps } from "./ProCard.js";
2
+ import ProCheckCardGroup, { ProCheckCardGroupProps } from "./components/CheckCard/Group.js";
3
+ import ProCheckCard, { ProCheckCardProps } from "./components/CheckCard/CheckCard.js";
4
+ import Statistic, { StatisticProps } from "./components/Statistic/index.js";
5
+ import StatisticCard, { StatisticCardProps } from "./components/StatisticCard/index.js";
6
+ export { ProCard, type ProCardProps, ProCheckCard, ProCheckCardGroup, type ProCheckCardGroupProps, type ProCheckCardProps, Statistic, StatisticCard, type StatisticCardProps, type StatisticProps, ProCard as default };
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ import ProCard from "./ProCard.js";
2
+ import ProCheckCardGroup from "./components/CheckCard/Group.js";
3
+ import ProCheckCard from "./components/CheckCard/CheckCard.js";
4
+ import Statistic from "./components/Statistic/index.js";
5
+ import StatisticCard from "./components/StatisticCard/index.js";
6
+ export { ProCard, ProCheckCard, ProCheckCardGroup, Statistic, StatisticCard, ProCard as default };