@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,165 @@
1
+ import { useStyle as useStyle$1 } from "@antdv-next1/pro-provider";
2
+ import { Keyframes } from "@antdv-next/cssinjs";
3
+ //#region src/components/CheckCard/style/index.ts
4
+ function proCheckCardActive(token) {
5
+ return {
6
+ backgroundColor: token.colorPrimaryBg,
7
+ borderColor: token.colorPrimary
8
+ };
9
+ }
10
+ function proCheckCardDisabled(token) {
11
+ return {
12
+ backgroundColor: token.colorBgContainerDisabled,
13
+ borderColor: token.colorBorder,
14
+ cursor: "not-allowed",
15
+ [`${token.componentCls}-meta`]: { [`&${token.antCls}-card-meta`]: {
16
+ [`${token.antCls}-card-meta-detail`]: {
17
+ [`${token.antCls}-card-meta-description`]: { color: token.colorTextDisabled },
18
+ [`${token.antCls}-card-meta-title`]: { color: token.colorTextDisabled }
19
+ },
20
+ [`${token.antCls}-card-meta-avatar`]: { opacity: "0.25" }
21
+ } }
22
+ };
23
+ }
24
+ const cardLoading = new Keyframes("card-loading", {
25
+ "0%": { backgroundPosition: "0 50%" },
26
+ "50%": { backgroundPosition: "100% 50%" },
27
+ "100%": { backgroundPosition: "0 50%" }
28
+ });
29
+ const genProCheckCardStyle = (token) => {
30
+ return { [token.componentCls]: {
31
+ width: 320,
32
+ boxSizing: "border-box",
33
+ position: "relative",
34
+ display: "inline-block",
35
+ cursor: "pointer",
36
+ transition: "all 0.3s",
37
+ verticalAlign: "top",
38
+ "&:not(:last-child)": {
39
+ marginInlineEnd: token.margin,
40
+ marginBlockEnd: token.margin
41
+ },
42
+ "&-lg": { width: 440 },
43
+ "&-sm": { width: 212 },
44
+ "&&-checked": { [`&${token.antCls}-card`]: {
45
+ ...proCheckCardActive(token),
46
+ [`${token.antCls}-card-cover`]: { "&:after": {
47
+ opacity: 1,
48
+ border: `${token.borderRadius + 4}px solid ${token.colorPrimary}`,
49
+ borderBlockEnd: `${token.borderRadius + 4}px solid transparent`,
50
+ borderInlineStart: `${token.borderRadius + 4}px solid transparent`,
51
+ borderStartEndRadius: `${token.borderRadius}px`
52
+ } },
53
+ [`${token.antCls}-card-body`]: { "&:after": {
54
+ opacity: 1,
55
+ border: `${token.borderRadius + 4}px solid ${token.colorPrimary}`,
56
+ borderBlockEnd: `${token.borderRadius + 4}px solid transparent`,
57
+ borderInlineStart: `${token.borderRadius + 4}px solid transparent`,
58
+ borderStartEndRadius: `${token.borderRadius}px`
59
+ } }
60
+ } },
61
+ [`&${token.antCls}-card`]: {
62
+ [`${token.antCls}-card-cover`]: {
63
+ paddingInline: token.paddingXXS,
64
+ paddingBlock: token.paddingXXS,
65
+ img: {
66
+ display: "flex",
67
+ width: "100%",
68
+ height: "100%",
69
+ overflow: "hidden",
70
+ borderRadius: token.borderRadius
71
+ },
72
+ "&:after": {
73
+ content: "''",
74
+ position: "absolute",
75
+ insetBlockStart: 2,
76
+ insetInlineEnd: 2,
77
+ width: 0,
78
+ height: 0,
79
+ opacity: 0,
80
+ transition: `all 0.3s ${token.motionEaseInOut}`,
81
+ borderBlockEnd: `${token.borderRadius + 4}px solid transparent`,
82
+ borderInlineStart: `${token.borderRadius + 4}px solid transparent`,
83
+ borderStartEndRadius: `${token.borderRadius}px`
84
+ }
85
+ },
86
+ [`${token.antCls}-card-body`]: {
87
+ paddingBlock: token.padding,
88
+ paddingInline: token.paddingSM,
89
+ [`${token.componentCls}-meta`]: { [`&${token.antCls}-card-meta`]: {
90
+ [`${token.antCls}-card-meta-avatar`]: { paddingInlineEnd: token.paddingXS },
91
+ [`${token.antCls}-card-meta-section`]: {
92
+ "&>div:not(:last-child)": { marginBottom: token.marginXXS },
93
+ [`${token.antCls}-card-meta-title`]: {
94
+ fontSize: token.fontSize,
95
+ fontWeight: 500
96
+ }
97
+ },
98
+ [`&${token.componentCls}-meta-avatar-header`]: { alignItems: "center" },
99
+ [`&${token.componentCls}-meta-extra-header`]: { [`${token.antCls}-card-meta-section`]: { [`${token.antCls}-card-meta-title`]: {
100
+ display: "flex",
101
+ alignItems: "center",
102
+ justifyContent: "space-between",
103
+ overflow: "unset",
104
+ fontSize: "unset",
105
+ whiteSpace: "normal",
106
+ textOverflow: "unset",
107
+ lineHeight: token.lineHeight,
108
+ [`${token.componentCls}-meta-title-left`]: {
109
+ display: "flex",
110
+ alignItems: "center",
111
+ 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
+ }
120
+ },
121
+ [`${token.componentCls}-meta-title-extra`]: {}
122
+ } } }
123
+ } },
124
+ "&:after": {
125
+ content: "''",
126
+ position: "absolute",
127
+ insetBlockStart: 2,
128
+ insetInlineEnd: 2,
129
+ width: 0,
130
+ height: 0,
131
+ opacity: 0,
132
+ transition: `all 0.3s ${token.motionEaseInOut}`,
133
+ borderBlockEnd: `${token.borderRadius + 4}px solid transparent`,
134
+ borderInlineStart: `${token.borderRadius + 4}px solid transparent`,
135
+ borderStartEndRadius: `${token.borderRadius}px`
136
+ }
137
+ }
138
+ },
139
+ "&:focus": proCheckCardActive(token),
140
+ "&&-disabled,&&-checked&-disabled": proCheckCardDisabled(token),
141
+ "&&[disabled]": proCheckCardDisabled(token),
142
+ "&&-checked&&-disabled": { [`${token.antCls}-card-body`]: { "&:after": {
143
+ position: "absolute",
144
+ insetBlockStart: 2,
145
+ insetInlineEnd: 2,
146
+ width: 0,
147
+ height: 0,
148
+ border: `${token.borderRadius + 4}px solid ${token.colorTextDisabled}`,
149
+ borderBlockEnd: `${token.borderRadius + 4}px solid transparent`,
150
+ borderInlineStart: `${token.borderRadius + 4}px solid transparent`,
151
+ borderStartEndRadius: `${token.borderRadius}px`
152
+ } } },
153
+ [`&&:not(${token.componentCls}-disabled)`]: { "&:hover": { borderColor: token.colorPrimary } }
154
+ } };
155
+ };
156
+ function useStyle(prefixCls) {
157
+ return useStyle$1("ProCheckCard", (token) => {
158
+ return [genProCheckCardStyle({
159
+ ...token,
160
+ componentCls: `.${prefixCls.value}`
161
+ })];
162
+ });
163
+ }
164
+ //#endregion
165
+ export { cardLoading, useStyle };
@@ -0,0 +1,26 @@
1
+ import * as _$vue from "vue";
2
+ import { VNode } from "vue";
3
+ import { VueNode } from "@v-c/util";
4
+ import { BadgeProps, StatisticProps as StatisticProps$1 } from "antdv-next";
5
+ import { CustomSlotsType } from "@v-c/util/dist/type";
6
+
7
+ //#region src/components/Statistic/index.d.ts
8
+ interface StatisticProps extends StatisticProps$1 {
9
+ /** 描述性标签 */
10
+ description?: VueNode;
11
+ /** 标题提示 */
12
+ tooltip?: VueNode;
13
+ /** 当前项显示的状态 */
14
+ status?: BadgeProps['status'];
15
+ /** Icon 图标 */
16
+ icon?: VueNode;
17
+ /** Layout 布局 */
18
+ layout?: 'horizontal' | 'vertical' | 'inline';
19
+ /** 趋势 */
20
+ trend?: 'up' | 'down';
21
+ }
22
+ declare const Statistic: _$vue.DefineSetupFnComponent<StatisticProps, {}, CustomSlotsType<{
23
+ default?: () => VNode[];
24
+ }>, StatisticProps & {}, _$vue.PublicProps>;
25
+ //#endregion
26
+ export { StatisticProps, Statistic as default };
@@ -0,0 +1,185 @@
1
+ import { useStyle } from "./style/index.js";
2
+ import { Fragment, computed, createVNode, defineComponent, mergeProps } from "vue";
3
+ import { QuestionCircleOutlined } from "@antdv-next/icons";
4
+ import { classNames } from "@v-c/util";
5
+ import { Badge, Statistic as Statistic$1, Tooltip } from "antdv-next";
6
+ import { useConfig } from "antdv-next/dist/config-provider/context";
7
+ //#region src/components/Statistic/index.tsx
8
+ const Statistic = /* @__PURE__ */ defineComponent((props, { attrs }) => {
9
+ const config = useConfig();
10
+ const prefixCls = computed(() => props.prefixCls || config.value.getPrefixCls("pro"));
11
+ const baseClassName = computed(() => `${prefixCls.value}-card-statistic`);
12
+ const { wrapSSR, hashId } = useStyle(baseClassName);
13
+ return () => {
14
+ const { layout = "inline", description, title, tooltip, status, trend, prefix, icon, ...rest } = props;
15
+ const tooltipDom = tooltip && createVNode(Tooltip, { "title": tooltip }, { default: () => [createVNode(QuestionCircleOutlined, { "class": classNames(`${baseClassName.value}-tip`, hashId.value) }, null)] });
16
+ const trendDom = trend && createVNode("div", { "class": classNames(`${baseClassName.value}-trend-icon`, hashId.value, { [`${baseClassName.value}-trend-icon-${trend}`]: trend }) }, null);
17
+ return wrapSSR(createVNode("div", {
18
+ "class": classNames(baseClassName.value, attrs.class, hashId.value),
19
+ "style": attrs.style
20
+ }, [icon && createVNode("div", { "class": classNames(`${baseClassName.value}-icon`, hashId.value) }, [icon]), createVNode("div", { "class": classNames(`${baseClassName.value}-wrapper`, hashId.value) }, [status && createVNode("div", { "class": classNames(`${baseClassName.value}-status`, hashId.value) }, [createVNode(Badge, {
21
+ "status": status,
22
+ "text": null
23
+ }, null)]), createVNode("div", { "class": classNames(`${baseClassName.value}-content`, hashId.value) }, [createVNode(Statistic$1, mergeProps({
24
+ "title": (title || tooltipDom) && createVNode(Fragment, null, [title, tooltipDom]),
25
+ "prefix": (trendDom || prefix) && createVNode(Fragment, null, [trendDom, prefix]),
26
+ "class": classNames(hashId.value, {
27
+ [`${baseClassName.value}-layout-${layout}`]: layout,
28
+ [`${baseClassName.value}-trend-${trend}`]: trend
29
+ })
30
+ }, rest), null), description && createVNode("div", { "class": classNames(`${baseClassName.value}-description`, hashId.value) }, [description])])])]));
31
+ };
32
+ }, {
33
+ props: {
34
+ description: {
35
+ type: [
36
+ Object,
37
+ Function,
38
+ String,
39
+ Number,
40
+ null,
41
+ Boolean,
42
+ Array
43
+ ],
44
+ required: false,
45
+ default: void 0
46
+ },
47
+ tooltip: {
48
+ type: [
49
+ Object,
50
+ Function,
51
+ String,
52
+ Number,
53
+ null,
54
+ Boolean,
55
+ Array
56
+ ],
57
+ required: false,
58
+ default: void 0
59
+ },
60
+ status: { required: false },
61
+ icon: {
62
+ type: [
63
+ Object,
64
+ Function,
65
+ String,
66
+ Number,
67
+ null,
68
+ Boolean,
69
+ Array
70
+ ],
71
+ required: false,
72
+ default: void 0
73
+ },
74
+ layout: {
75
+ type: String,
76
+ required: false
77
+ },
78
+ trend: {
79
+ type: String,
80
+ required: false
81
+ },
82
+ formatter: {
83
+ type: [
84
+ Boolean,
85
+ String,
86
+ Function
87
+ ],
88
+ required: false,
89
+ default: void 0
90
+ },
91
+ decimalSeparator: {
92
+ type: String,
93
+ required: false
94
+ },
95
+ groupSeparator: {
96
+ type: String,
97
+ required: false
98
+ },
99
+ precision: {
100
+ type: Number,
101
+ required: false
102
+ },
103
+ rootClass: {
104
+ type: String,
105
+ required: false
106
+ },
107
+ prefixCls: {
108
+ type: String,
109
+ required: false
110
+ },
111
+ value: {
112
+ type: [Number, String],
113
+ required: false
114
+ },
115
+ valueStyle: {
116
+ type: Object,
117
+ required: false
118
+ },
119
+ valueRender: {
120
+ type: Function,
121
+ required: false
122
+ },
123
+ title: {
124
+ type: [
125
+ Function,
126
+ String,
127
+ Number,
128
+ null,
129
+ Object,
130
+ Boolean
131
+ ],
132
+ required: false,
133
+ default: void 0
134
+ },
135
+ prefix: {
136
+ type: [
137
+ Function,
138
+ String,
139
+ Number,
140
+ null,
141
+ Object,
142
+ Boolean
143
+ ],
144
+ required: false,
145
+ default: void 0
146
+ },
147
+ suffix: {
148
+ type: [
149
+ Function,
150
+ String,
151
+ Number,
152
+ null,
153
+ Object,
154
+ Boolean
155
+ ],
156
+ required: false,
157
+ default: void 0
158
+ },
159
+ loading: {
160
+ type: Boolean,
161
+ required: false,
162
+ default: void 0
163
+ },
164
+ classes: {
165
+ type: [Object, Function],
166
+ required: false
167
+ },
168
+ styles: {
169
+ type: [Object, Function],
170
+ required: false
171
+ },
172
+ onMouseenter: {
173
+ type: Function,
174
+ required: false
175
+ },
176
+ onMouseleave: {
177
+ type: Function,
178
+ required: false
179
+ }
180
+ },
181
+ name: "Statistic",
182
+ inheritAttrs: false
183
+ });
184
+ //#endregion
185
+ export { Statistic 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/Statistic/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,64 @@
1
+ import { useStyle as useStyle$1 } from "@antdv-next1/pro-provider";
2
+ //#region src/components/Statistic/style/index.ts
3
+ const genProStyle = (token) => {
4
+ return { [token.componentCls]: {
5
+ boxSizing: "border-box",
6
+ display: "flex",
7
+ fontSize: token.fontSize,
8
+ "& + &": { marginBlockStart: 4 },
9
+ "&-tip": { marginInlineStart: 4 },
10
+ "&-wrapper": {
11
+ display: "flex",
12
+ width: "100%",
13
+ [`${token.componentCls}-status`]: { width: "14px" }
14
+ },
15
+ "&-icon": { marginInlineEnd: 16 },
16
+ "&-trend-icon": {
17
+ width: 0,
18
+ height: 0,
19
+ borderInlineEnd: "3.5px solid transparent",
20
+ borderBlockEnd: "9px solid #000",
21
+ borderInlineStart: "3.5px solid transparent",
22
+ "&-up": { transform: "rotate(0deg)" },
23
+ "&-down": { transform: "rotate(180deg)" }
24
+ },
25
+ "&-content": { width: "100%" },
26
+ "&-description": { width: "100%" },
27
+ [`${token.antCls}-statistic-title`]: { color: token.colorText },
28
+ "&-trend-up": { [`${token.antCls}-statistic-content`]: {
29
+ color: "#f5222d",
30
+ [`${token.componentCls}-trend-icon`]: { borderBlockEndColor: "#f5222d" }
31
+ } },
32
+ "&-trend-down": { [`${token.antCls}-statistic-content`]: {
33
+ color: "#389e0d",
34
+ [`${token.componentCls}-trend-icon`]: { borderBlockEndColor: "#52c41a" }
35
+ } },
36
+ "& &-layout-horizontal": {
37
+ display: "flex",
38
+ justifyContent: "space-between",
39
+ [`${token.antCls}-statistic-title`]: { marginBlockEnd: 0 },
40
+ [`${token.antCls}-statistic-content-value`]: { fontWeight: 500 },
41
+ [`${token.antCls}-statistic-title,${token.antCls}-statistic-content,${token.antCls}-statistic-content-suffix,${token.antCls}-statistic-content-prefix,${token.antCls}-statistic-content-value-decimal`]: { fontSize: token.fontSize }
42
+ },
43
+ "& &-layout-inline": {
44
+ display: "inline-flex",
45
+ color: token.colorTextSecondary,
46
+ [`${token.antCls}-statistic-title`]: {
47
+ marginInlineEnd: "6px",
48
+ marginBlockEnd: 0
49
+ },
50
+ [`${token.antCls}-statistic-content`]: { color: token.colorTextSecondary },
51
+ [`${token.antCls}-statistic-title,${token.antCls}-statistic-content,${token.antCls}-statistic-content-suffix,${token.antCls}-statistic-content-prefix,${token.antCls}-statistic-content-value-decimal`]: { fontSize: token.fontSizeSM }
52
+ }
53
+ } };
54
+ };
55
+ function useStyle(prefixCls) {
56
+ return useStyle$1("Statistic", (token) => {
57
+ return [genProStyle({
58
+ ...token,
59
+ componentCls: `.${prefixCls.value}`
60
+ })];
61
+ });
62
+ }
63
+ //#endregion
64
+ export { useStyle };
@@ -0,0 +1,30 @@
1
+ import Statistic$1, { StatisticProps as StatisticProps$1 } from "../Statistic/index.js";
2
+ import * as _$vue from "vue";
3
+ import { VNode } from "vue";
4
+ import { VueNode } from "@v-c/util";
5
+ import { BorderBeamProps, CardProps } from "antdv-next";
6
+ import { CustomSlotsType } from "@v-c/util/dist/type";
7
+
8
+ //#region src/components/StatisticCard/index.d.ts
9
+ interface StatisticCardProps extends CardProps {
10
+ /** 图表配置 */
11
+ chart?: VueNode;
12
+ headerBordered?: boolean;
13
+ /** 边框流光 */
14
+ borderBeam?: BorderBeamProps | boolean;
15
+ /** 数值统计配置 */
16
+ statistic?: StatisticProps$1;
17
+ /** Chart 相对于 statistic 的位置 */
18
+ chartPlacement?: 'right' | 'bottom' | 'left';
19
+ /** 底部额外展示区域 */
20
+ footer?: VueNode;
21
+ }
22
+ declare const _StatisticCard: _$vue.DefineSetupFnComponent<StatisticCardProps, {}, CustomSlotsType<{
23
+ default?: () => VNode[];
24
+ }>, StatisticCardProps & {}, _$vue.PublicProps>;
25
+ declare const StatisticCard: typeof _StatisticCard & {
26
+ isProCard?: boolean;
27
+ Statistic?: typeof Statistic$1;
28
+ };
29
+ //#endregion
30
+ export { StatisticCardProps, StatisticCard as default };