@expcat/tigercat-vue 0.0.68 → 0.1.6
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/chunk-2ONL76L4.js +118 -0
- package/dist/chunk-3JANYZE3.js +57 -0
- package/dist/chunk-3VTOJCER.js +260 -0
- package/dist/chunk-4FUWM7WP.js +105 -0
- package/dist/chunk-4LGW73OD.js +277 -0
- package/dist/chunk-4R45JF3W.js +308 -0
- package/dist/chunk-5GWL2UTZ.js +58 -0
- package/dist/chunk-5K74VD2K.js +235 -0
- package/dist/chunk-7PCCJR4X.js +402 -0
- package/dist/chunk-7ZEFGIDX.js +96 -0
- package/dist/chunk-BHFFQSYV.js +65 -0
- package/dist/chunk-BXFYOGMO.js +59 -0
- package/dist/chunk-CCI3RIZU.js +133 -0
- package/dist/chunk-DONDDWQU.js +627 -0
- package/dist/chunk-EE3KTSR6.js +101 -0
- package/dist/chunk-EQX22NAR.js +61 -0
- package/dist/chunk-F6TZCXCL.js +148 -0
- package/dist/chunk-FOQHXUHK.js +314 -0
- package/dist/chunk-G6YTJ7IE.mjs +226 -0
- package/dist/chunk-GGV4STQD.js +200 -0
- package/dist/chunk-GLW3P75K.js +72 -0
- package/dist/chunk-HOJP5HTJ.js +209 -0
- package/dist/chunk-HSXPJCRK.js +68 -0
- package/dist/chunk-HWHMM3QE.js +642 -0
- package/dist/chunk-HXHMGLWX.js +336 -0
- package/dist/chunk-I7GSAVM7.js +110 -0
- package/dist/chunk-IQA52MC4.js +72 -0
- package/dist/chunk-JHOTXOGL.js +190 -0
- package/dist/chunk-JI5MFFKJ.js +442 -0
- package/dist/chunk-JLHOX3YI.js +827 -0
- package/dist/chunk-KQOJTNUP.js +152 -0
- package/dist/chunk-LGKMVPIB.js +57 -0
- package/dist/{chunk-YHI3NT6N.mjs → chunk-LIZZ35NQ.mjs} +1 -1
- package/dist/chunk-LUN3PRLX.js +38 -0
- package/dist/chunk-N5I5Y5JG.js +53 -0
- package/dist/chunk-P2DJR6YG.js +383 -0
- package/dist/chunk-PDRPZ3SX.js +180 -0
- package/dist/chunk-Q4MH333P.js +110 -0
- package/dist/chunk-QIS3MLLN.js +227 -0
- package/dist/chunk-QJWFKTRQ.js +160 -0
- package/dist/chunk-QKKXUTDF.js +47 -0
- package/dist/chunk-RNZZQWX7.js +411 -0
- package/dist/chunk-RUD3FPP2.js +301 -0
- package/dist/chunk-SF63KE5T.js +249 -0
- package/dist/chunk-SKUTVXHP.js +113 -0
- package/dist/chunk-SZA7QYD2.js +384 -0
- package/dist/chunk-U2JWZTDN.js +47 -0
- package/dist/chunk-U5VOJ4G2.js +156 -0
- package/dist/chunk-U65XZCPB.js +155 -0
- package/dist/chunk-UTHNPU5T.js +45 -0
- package/dist/chunk-UZMGKLJE.js +746 -0
- package/dist/chunk-VIXWGRQT.js +141 -0
- package/dist/chunk-WEFTEDUS.js +191 -0
- package/dist/chunk-WO332QT2.js +176 -0
- package/dist/chunk-WPWMXSXK.js +667 -0
- package/dist/chunk-XKTQJXVN.js +276 -0
- package/dist/chunk-Y6C455RB.js +81 -0
- package/dist/chunk-Y7DJJOCW.js +617 -0
- package/dist/chunk-YFMXWX6H.js +127 -0
- package/dist/chunk-YIRWZYD3.js +238 -0
- package/dist/chunk-YLILPFDU.js +100 -0
- package/dist/{chunk-G7DCN7A4.mjs → chunk-YMIO4A2U.mjs} +2 -1
- package/dist/chunk-YXXOKLEC.js +349 -0
- package/dist/chunk-ZAEX6EMJ.js +229 -0
- package/dist/chunk-ZASXBDMT.js +250 -0
- package/dist/chunk-ZIG34M2R.js +241 -0
- package/dist/chunk-ZK26QLSW.js +222 -0
- package/dist/chunk-ZW36GTA3.js +227 -0
- package/dist/components/Alert.d.ts +170 -0
- package/dist/components/Alert.js +16 -0
- package/dist/components/Avatar.d.ts +162 -0
- package/dist/components/Avatar.js +16 -0
- package/dist/components/Badge.d.ts +190 -0
- package/dist/components/Badge.js +16 -0
- package/dist/components/Breadcrumb.d.ts +68 -0
- package/dist/components/Breadcrumb.js +20 -0
- package/dist/components/BreadcrumbItem.d.ts +135 -0
- package/dist/components/BreadcrumbItem.js +17 -0
- package/dist/components/Button.d.ts +120 -0
- package/dist/components/Button.js +16 -0
- package/dist/components/Button.mjs +1 -1
- package/dist/components/Card.d.ts +132 -0
- package/dist/components/Card.js +16 -0
- package/dist/components/Checkbox.d.ts +144 -0
- package/dist/components/Checkbox.js +17 -0
- package/dist/components/CheckboxGroup.d.ts +126 -0
- package/dist/components/CheckboxGroup.js +20 -0
- package/dist/components/Code.d.ts +71 -0
- package/dist/components/Code.js +16 -0
- package/dist/components/Col.d.ts +72 -0
- package/dist/components/Col.js +11 -0
- package/dist/components/ConfigProvider.d.ts +26 -0
- package/dist/components/ConfigProvider.js +24 -0
- package/dist/components/Container.d.ts +63 -0
- package/dist/components/Container.js +16 -0
- package/dist/components/Content.d.ts +45 -0
- package/dist/components/Content.js +16 -0
- package/dist/components/DatePicker.d.ts +313 -0
- package/dist/components/DatePicker.js +16 -0
- package/dist/components/Descriptions.d.ts +206 -0
- package/dist/components/Descriptions.js +16 -0
- package/dist/components/Divider.d.ts +51 -0
- package/dist/components/Divider.js +16 -0
- package/dist/components/Drawer.d.ts +280 -0
- package/dist/components/Drawer.js +17 -0
- package/dist/components/Dropdown.d.ts +146 -0
- package/dist/components/Dropdown.js +21 -0
- package/dist/components/DropdownItem.d.ts +90 -0
- package/dist/components/DropdownItem.js +18 -0
- package/dist/components/DropdownMenu.d.ts +38 -0
- package/dist/components/DropdownMenu.js +16 -0
- package/dist/components/Footer.d.ts +63 -0
- package/dist/components/Footer.js +16 -0
- package/dist/components/Form.d.ts +191 -0
- package/dist/components/Form.js +20 -0
- package/dist/components/FormItem.d.ts +114 -0
- package/dist/components/FormItem.js +17 -0
- package/dist/components/Header.d.ts +63 -0
- package/dist/components/Header.js +16 -0
- package/dist/components/Icon.d.ts +82 -0
- package/dist/components/Icon.js +16 -0
- package/dist/components/Input.d.mts +42 -1
- package/dist/components/Input.d.ts +263 -0
- package/dist/components/Input.js +16 -0
- package/dist/components/Input.mjs +1 -1
- package/dist/components/Layout.d.ts +45 -0
- package/dist/components/Layout.js +16 -0
- package/dist/components/Link.d.ts +152 -0
- package/dist/components/Link.js +16 -0
- package/dist/components/List.d.ts +249 -0
- package/dist/components/List.js +16 -0
- package/dist/components/Loading.d.ts +186 -0
- package/dist/components/Loading.js +16 -0
- package/dist/components/Menu.d.ts +204 -0
- package/dist/components/Menu.js +20 -0
- package/dist/components/MenuItem.d.ts +97 -0
- package/dist/components/MenuItem.js +17 -0
- package/dist/components/MenuItemGroup.d.ts +59 -0
- package/dist/components/MenuItemGroup.js +16 -0
- package/dist/components/Message.d.ts +53 -0
- package/dist/components/Message.js +20 -0
- package/dist/components/Modal.d.ts +317 -0
- package/dist/components/Modal.js +17 -0
- package/dist/components/Modal.mjs +2 -2
- package/dist/components/Notification.d.ts +49 -0
- package/dist/components/Notification.js +20 -0
- package/dist/components/Pagination.d.ts +331 -0
- package/dist/components/Pagination.js +16 -0
- package/dist/components/Popconfirm.d.ts +226 -0
- package/dist/components/Popconfirm.js +16 -0
- package/dist/components/Popover.d.ts +173 -0
- package/dist/components/Popover.js +17 -0
- package/dist/components/Progress.d.mts +1 -1
- package/dist/components/Progress.d.ts +274 -0
- package/dist/components/Progress.js +16 -0
- package/dist/components/Radio.d.ts +143 -0
- package/dist/components/Radio.js +17 -0
- package/dist/components/RadioGroup.d.ts +135 -0
- package/dist/components/RadioGroup.js +20 -0
- package/dist/components/Row.d.ts +90 -0
- package/dist/components/Row.js +14 -0
- package/dist/components/Select.d.ts +157 -0
- package/dist/components/Select.js +16 -0
- package/dist/components/Sidebar.d.ts +81 -0
- package/dist/components/Sidebar.js +16 -0
- package/dist/components/Skeleton.d.ts +172 -0
- package/dist/components/Skeleton.js +16 -0
- package/dist/components/Slider.d.ts +228 -0
- package/dist/components/Slider.js +16 -0
- package/dist/components/Space.d.ts +54 -0
- package/dist/components/Space.js +16 -0
- package/dist/components/Steps.d.mts +1 -1
- package/dist/components/Steps.d.ts +161 -0
- package/dist/components/Steps.js +20 -0
- package/dist/components/StepsItem.d.mts +1 -1
- package/dist/components/StepsItem.d.ts +143 -0
- package/dist/components/StepsItem.js +17 -0
- package/dist/components/SubMenu.d.ts +119 -0
- package/dist/components/SubMenu.js +17 -0
- package/dist/components/Switch.d.ts +94 -0
- package/dist/components/Switch.js +16 -0
- package/dist/components/TabPane.d.ts +169 -0
- package/dist/components/TabPane.js +17 -0
- package/dist/components/Table.d.ts +329 -0
- package/dist/components/Table.js +16 -0
- package/dist/components/Tabs.d.ts +203 -0
- package/dist/components/Tabs.js +20 -0
- package/dist/components/Tag.d.ts +120 -0
- package/dist/components/Tag.js +16 -0
- package/dist/components/Text.d.ts +171 -0
- package/dist/components/Text.js +16 -0
- package/dist/components/Textarea.d.ts +308 -0
- package/dist/components/Textarea.js +16 -0
- package/dist/components/TimePicker.d.ts +372 -0
- package/dist/components/TimePicker.js +16 -0
- package/dist/components/Timeline.d.ts +114 -0
- package/dist/components/Timeline.js +16 -0
- package/dist/components/Tooltip.d.ts +141 -0
- package/dist/components/Tooltip.js +16 -0
- package/dist/components/Tree.d.ts +374 -0
- package/dist/components/Tree.js +16 -0
- package/dist/components/Upload.d.ts +311 -0
- package/dist/components/Upload.js +17 -0
- package/dist/index.d.ts +77 -0
- package/dist/index.js +346 -0
- package/dist/index.mjs +3 -3
- package/package.json +3 -6
- package/dist/chunk-NKQMEF2R.mjs +0 -160
- package/dist/styles/index.css +0 -6
- package/dist/styles/index.d.mts +0 -2
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var vue = require('vue');
|
|
4
|
+
var tigercatCore = require('@expcat/tigercat-core');
|
|
5
|
+
|
|
6
|
+
// src/components/Button.ts
|
|
7
|
+
var spinnerSvg = tigercatCore.getSpinnerSVG("spinner");
|
|
8
|
+
var LoadingSpinner = vue.h(
|
|
9
|
+
"svg",
|
|
10
|
+
{
|
|
11
|
+
class: "animate-spin h-4 w-4",
|
|
12
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13
|
+
fill: "none",
|
|
14
|
+
viewBox: spinnerSvg.viewBox,
|
|
15
|
+
"aria-hidden": "true",
|
|
16
|
+
focusable: "false"
|
|
17
|
+
},
|
|
18
|
+
spinnerSvg.elements.map((el) => vue.h(el.type, tigercatCore.normalizeSvgAttrs(el.attrs)))
|
|
19
|
+
);
|
|
20
|
+
var Button = vue.defineComponent({
|
|
21
|
+
name: "TigerButton",
|
|
22
|
+
inheritAttrs: false,
|
|
23
|
+
props: {
|
|
24
|
+
/**
|
|
25
|
+
* Button variant style
|
|
26
|
+
* @default 'primary'
|
|
27
|
+
*/
|
|
28
|
+
variant: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "primary"
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* Button size
|
|
34
|
+
* @default 'md'
|
|
35
|
+
*/
|
|
36
|
+
size: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: "md"
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* Whether the button is disabled
|
|
42
|
+
*/
|
|
43
|
+
disabled: Boolean,
|
|
44
|
+
/**
|
|
45
|
+
* Whether the button is in loading state
|
|
46
|
+
*/
|
|
47
|
+
loading: Boolean,
|
|
48
|
+
/**
|
|
49
|
+
* Whether the button should take full width of its parent
|
|
50
|
+
*/
|
|
51
|
+
block: Boolean,
|
|
52
|
+
/**
|
|
53
|
+
* HTML button type
|
|
54
|
+
* @default 'button'
|
|
55
|
+
*/
|
|
56
|
+
type: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: "button"
|
|
59
|
+
},
|
|
60
|
+
className: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: void 0
|
|
63
|
+
},
|
|
64
|
+
style: {
|
|
65
|
+
type: Object,
|
|
66
|
+
default: void 0
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
emits: ["click"],
|
|
70
|
+
setup(props, { slots, emit, attrs }) {
|
|
71
|
+
const buttonClasses = vue.computed(() => {
|
|
72
|
+
return tigercatCore.classNames(
|
|
73
|
+
tigercatCore.buttonBaseClasses,
|
|
74
|
+
tigercatCore.getButtonVariantClasses(props.variant),
|
|
75
|
+
tigercatCore.buttonSizeClasses[props.size],
|
|
76
|
+
(props.disabled || props.loading) && tigercatCore.buttonDisabledClasses,
|
|
77
|
+
props.block && "w-full",
|
|
78
|
+
props.className,
|
|
79
|
+
tigercatCore.coerceClassValue(attrs.class)
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
const mergedStyle = vue.computed(() => tigercatCore.mergeStyleValues(attrs.style, props.style));
|
|
83
|
+
return () => {
|
|
84
|
+
const children = [];
|
|
85
|
+
const isDisabled = props.disabled || props.loading;
|
|
86
|
+
const ariaBusy = attrs["aria-busy"] ?? (props.loading ? "true" : void 0);
|
|
87
|
+
const ariaDisabled = attrs["aria-disabled"] ?? (isDisabled ? "true" : void 0);
|
|
88
|
+
if (props.loading) {
|
|
89
|
+
const loadingIcon = slots["loading-icon"] ? slots["loading-icon"]() : LoadingSpinner;
|
|
90
|
+
children.push(vue.h("span", { class: "mr-2" }, loadingIcon));
|
|
91
|
+
}
|
|
92
|
+
if (slots.default) {
|
|
93
|
+
children.push(slots.default());
|
|
94
|
+
}
|
|
95
|
+
return vue.h(
|
|
96
|
+
"button",
|
|
97
|
+
{
|
|
98
|
+
...attrs,
|
|
99
|
+
class: buttonClasses.value,
|
|
100
|
+
style: mergedStyle.value,
|
|
101
|
+
"aria-busy": ariaBusy,
|
|
102
|
+
"aria-disabled": ariaDisabled,
|
|
103
|
+
disabled: isDisabled,
|
|
104
|
+
type: props.type,
|
|
105
|
+
onClick: (event) => {
|
|
106
|
+
if (isDisabled) return;
|
|
107
|
+
emit("click", event);
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
children
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
var Button_default = Button;
|
|
116
|
+
|
|
117
|
+
exports.Button = Button;
|
|
118
|
+
exports.Button_default = Button_default;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var vue = require('vue');
|
|
4
|
+
var tigercatCore = require('@expcat/tigercat-core');
|
|
5
|
+
|
|
6
|
+
// src/components/Header.ts
|
|
7
|
+
var Header = vue.defineComponent({
|
|
8
|
+
name: "TigerHeader",
|
|
9
|
+
inheritAttrs: false,
|
|
10
|
+
props: {
|
|
11
|
+
/**
|
|
12
|
+
* Additional CSS classes
|
|
13
|
+
*/
|
|
14
|
+
className: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: void 0
|
|
17
|
+
},
|
|
18
|
+
/**
|
|
19
|
+
* Header height (CSS value)
|
|
20
|
+
* @default '64px'
|
|
21
|
+
*/
|
|
22
|
+
height: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: "64px"
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* Custom styles
|
|
28
|
+
*/
|
|
29
|
+
style: {
|
|
30
|
+
type: Object,
|
|
31
|
+
default: void 0
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
setup(props, { slots, attrs }) {
|
|
35
|
+
const attrsRecord = attrs;
|
|
36
|
+
const headerClasses = vue.computed(
|
|
37
|
+
() => tigercatCore.classNames(tigercatCore.layoutHeaderClasses, props.className, tigercatCore.coerceClassValue(attrsRecord.class))
|
|
38
|
+
);
|
|
39
|
+
return () => {
|
|
40
|
+
return vue.h(
|
|
41
|
+
"header",
|
|
42
|
+
{
|
|
43
|
+
...attrs,
|
|
44
|
+
class: headerClasses.value,
|
|
45
|
+
style: tigercatCore.mergeStyleValues(attrsRecord.style, props.style, {
|
|
46
|
+
height: props.height
|
|
47
|
+
})
|
|
48
|
+
},
|
|
49
|
+
slots.default?.()
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
var Header_default = Header;
|
|
55
|
+
|
|
56
|
+
exports.Header = Header;
|
|
57
|
+
exports.Header_default = Header_default;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var vue = require('vue');
|
|
4
|
+
var tigercatCore = require('@expcat/tigercat-core');
|
|
5
|
+
|
|
6
|
+
// src/components/Descriptions.ts
|
|
7
|
+
var Descriptions = vue.defineComponent({
|
|
8
|
+
name: "TigerDescriptions",
|
|
9
|
+
inheritAttrs: false,
|
|
10
|
+
props: {
|
|
11
|
+
/**
|
|
12
|
+
* Descriptions title
|
|
13
|
+
*/
|
|
14
|
+
title: {
|
|
15
|
+
type: [String, Number],
|
|
16
|
+
default: void 0
|
|
17
|
+
},
|
|
18
|
+
/**
|
|
19
|
+
* Extra content (actions, links, etc.)
|
|
20
|
+
*/
|
|
21
|
+
extra: {
|
|
22
|
+
type: null,
|
|
23
|
+
default: void 0
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
* Whether to show border
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
bordered: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
/**
|
|
34
|
+
* Number of columns per row
|
|
35
|
+
* @default 3
|
|
36
|
+
*/
|
|
37
|
+
column: {
|
|
38
|
+
type: Number,
|
|
39
|
+
default: 3,
|
|
40
|
+
validator: (value) => value > 0
|
|
41
|
+
},
|
|
42
|
+
/**
|
|
43
|
+
* Descriptions size
|
|
44
|
+
* @default 'md'
|
|
45
|
+
*/
|
|
46
|
+
size: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: "md"
|
|
49
|
+
},
|
|
50
|
+
/**
|
|
51
|
+
* Descriptions layout
|
|
52
|
+
* @default 'horizontal'
|
|
53
|
+
*/
|
|
54
|
+
layout: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: "horizontal"
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* Whether to show colon after label
|
|
60
|
+
* @default true
|
|
61
|
+
*/
|
|
62
|
+
colon: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: true
|
|
65
|
+
},
|
|
66
|
+
/**
|
|
67
|
+
* Label style
|
|
68
|
+
*/
|
|
69
|
+
labelStyle: {
|
|
70
|
+
type: Object,
|
|
71
|
+
default: void 0
|
|
72
|
+
},
|
|
73
|
+
/**
|
|
74
|
+
* Content style
|
|
75
|
+
*/
|
|
76
|
+
contentStyle: {
|
|
77
|
+
type: Object,
|
|
78
|
+
default: void 0
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* Items data source (alternative to using slots)
|
|
82
|
+
*/
|
|
83
|
+
items: {
|
|
84
|
+
type: Array,
|
|
85
|
+
default: () => []
|
|
86
|
+
},
|
|
87
|
+
className: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: void 0
|
|
90
|
+
},
|
|
91
|
+
style: {
|
|
92
|
+
type: [Object, String],
|
|
93
|
+
default: void 0
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
setup(props, { slots, attrs }) {
|
|
97
|
+
const descriptionsClasses = vue.computed(() => {
|
|
98
|
+
return tigercatCore.getDescriptionsClasses(props.bordered, props.size);
|
|
99
|
+
});
|
|
100
|
+
const tableClasses = vue.computed(() => {
|
|
101
|
+
return tigercatCore.getDescriptionsTableClasses(props.bordered);
|
|
102
|
+
});
|
|
103
|
+
function renderHeader() {
|
|
104
|
+
if (!props.title && !slots.title && !props.extra && !slots.extra) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
return vue.h("div", { class: tigercatCore.descriptionsHeaderClasses }, [
|
|
108
|
+
props.title || slots.title ? vue.h("div", { class: tigercatCore.descriptionsTitleClasses }, slots.title?.() || props.title) : null,
|
|
109
|
+
props.extra || slots.extra ? vue.h(
|
|
110
|
+
"div",
|
|
111
|
+
{ class: tigercatCore.descriptionsExtraClasses },
|
|
112
|
+
slots.extra?.() || (props.extra ?? void 0)
|
|
113
|
+
) : null
|
|
114
|
+
]);
|
|
115
|
+
}
|
|
116
|
+
function renderHorizontalLayout() {
|
|
117
|
+
const items = props.items;
|
|
118
|
+
if (items.length === 0 && !slots.default) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
const rows = tigercatCore.groupItemsIntoRows(items, props.column);
|
|
122
|
+
return vue.h("table", { class: tableClasses.value }, [
|
|
123
|
+
vue.h(
|
|
124
|
+
"tbody",
|
|
125
|
+
{},
|
|
126
|
+
rows.map((row) => renderRow(row))
|
|
127
|
+
)
|
|
128
|
+
]);
|
|
129
|
+
}
|
|
130
|
+
function renderRow(rowItems) {
|
|
131
|
+
const cells = [];
|
|
132
|
+
rowItems.forEach((item) => {
|
|
133
|
+
const span = Math.min(item.span || 1, props.column);
|
|
134
|
+
const labelClass = tigercatCore.classNames(
|
|
135
|
+
tigercatCore.getDescriptionsLabelClasses(props.bordered, props.size, props.layout),
|
|
136
|
+
item.labelClassName
|
|
137
|
+
);
|
|
138
|
+
const contentClass = tigercatCore.classNames(
|
|
139
|
+
tigercatCore.getDescriptionsContentClasses(props.bordered, props.size, props.layout),
|
|
140
|
+
item.contentClassName
|
|
141
|
+
);
|
|
142
|
+
cells.push(
|
|
143
|
+
vue.h(
|
|
144
|
+
"th",
|
|
145
|
+
{
|
|
146
|
+
class: labelClass,
|
|
147
|
+
style: props.labelStyle
|
|
148
|
+
},
|
|
149
|
+
[item.label, props.colon && props.layout === "horizontal" ? ":" : ""]
|
|
150
|
+
)
|
|
151
|
+
);
|
|
152
|
+
cells.push(
|
|
153
|
+
vue.h(
|
|
154
|
+
"td",
|
|
155
|
+
{
|
|
156
|
+
class: contentClass,
|
|
157
|
+
style: props.contentStyle,
|
|
158
|
+
colspan: span > 1 ? span * 2 - 1 : 1
|
|
159
|
+
},
|
|
160
|
+
item.content ?? void 0
|
|
161
|
+
)
|
|
162
|
+
);
|
|
163
|
+
});
|
|
164
|
+
return vue.h("tr", {}, cells);
|
|
165
|
+
}
|
|
166
|
+
function renderVerticalLayout() {
|
|
167
|
+
const items = props.items;
|
|
168
|
+
if (items.length === 0 && !slots.default) {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
if (props.bordered) {
|
|
172
|
+
return vue.h("table", { class: tableClasses.value }, [
|
|
173
|
+
vue.h(
|
|
174
|
+
"tbody",
|
|
175
|
+
{},
|
|
176
|
+
items.map((item) => renderVerticalItem(item))
|
|
177
|
+
)
|
|
178
|
+
]);
|
|
179
|
+
}
|
|
180
|
+
return vue.h(
|
|
181
|
+
"dl",
|
|
182
|
+
{ class: tigercatCore.descriptionsVerticalWrapperClasses },
|
|
183
|
+
items.map((item) => renderVerticalItem(item))
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
function renderVerticalItem(item) {
|
|
187
|
+
const labelClass = tigercatCore.classNames(
|
|
188
|
+
tigercatCore.getDescriptionsLabelClasses(props.bordered, props.size, props.layout),
|
|
189
|
+
item.labelClassName
|
|
190
|
+
);
|
|
191
|
+
const contentClass = tigercatCore.classNames(
|
|
192
|
+
tigercatCore.getDescriptionsContentClasses(props.bordered, props.size, props.layout),
|
|
193
|
+
item.contentClassName
|
|
194
|
+
);
|
|
195
|
+
if (props.bordered) {
|
|
196
|
+
return vue.h("tr", {}, [
|
|
197
|
+
vue.h(
|
|
198
|
+
"th",
|
|
199
|
+
{
|
|
200
|
+
class: labelClass,
|
|
201
|
+
style: props.labelStyle
|
|
202
|
+
},
|
|
203
|
+
[item.label, props.colon ? ":" : ""]
|
|
204
|
+
),
|
|
205
|
+
vue.h(
|
|
206
|
+
"td",
|
|
207
|
+
{
|
|
208
|
+
class: contentClass,
|
|
209
|
+
style: props.contentStyle
|
|
210
|
+
},
|
|
211
|
+
item.content ?? void 0
|
|
212
|
+
)
|
|
213
|
+
]);
|
|
214
|
+
}
|
|
215
|
+
const itemClasses = tigercatCore.getDescriptionsVerticalItemClasses(props.bordered, props.size);
|
|
216
|
+
return vue.h("div", { class: itemClasses }, [
|
|
217
|
+
vue.h(
|
|
218
|
+
"dt",
|
|
219
|
+
{
|
|
220
|
+
class: labelClass,
|
|
221
|
+
style: props.labelStyle
|
|
222
|
+
},
|
|
223
|
+
[item.label, props.colon ? ":" : ""]
|
|
224
|
+
),
|
|
225
|
+
vue.h(
|
|
226
|
+
"dd",
|
|
227
|
+
{
|
|
228
|
+
class: contentClass,
|
|
229
|
+
style: props.contentStyle
|
|
230
|
+
},
|
|
231
|
+
item.content ?? void 0
|
|
232
|
+
)
|
|
233
|
+
]);
|
|
234
|
+
}
|
|
235
|
+
return () => {
|
|
236
|
+
return vue.h(
|
|
237
|
+
"div",
|
|
238
|
+
{
|
|
239
|
+
...attrs,
|
|
240
|
+
class: tigercatCore.classNames(
|
|
241
|
+
tigercatCore.descriptionsWrapperClasses,
|
|
242
|
+
descriptionsClasses.value,
|
|
243
|
+
props.className,
|
|
244
|
+
tigercatCore.coerceClassValue(attrs.class)
|
|
245
|
+
),
|
|
246
|
+
style: tigercatCore.mergeStyleValues(props.style, attrs.style)
|
|
247
|
+
},
|
|
248
|
+
[
|
|
249
|
+
renderHeader(),
|
|
250
|
+
props.layout === "horizontal" ? renderHorizontalLayout() : renderVerticalLayout(),
|
|
251
|
+
slots.default?.()
|
|
252
|
+
]
|
|
253
|
+
);
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
var Descriptions_default = Descriptions;
|
|
258
|
+
|
|
259
|
+
exports.Descriptions = Descriptions;
|
|
260
|
+
exports.Descriptions_default = Descriptions_default;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var vue = require('vue');
|
|
4
|
+
var tigercatCore = require('@expcat/tigercat-core');
|
|
5
|
+
|
|
6
|
+
// src/components/Code.ts
|
|
7
|
+
var Code = vue.defineComponent({
|
|
8
|
+
name: "TigerCode",
|
|
9
|
+
inheritAttrs: false,
|
|
10
|
+
props: {
|
|
11
|
+
code: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: true
|
|
14
|
+
},
|
|
15
|
+
copyable: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: true
|
|
18
|
+
},
|
|
19
|
+
copyLabel: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "\u590D\u5236"
|
|
22
|
+
},
|
|
23
|
+
copiedLabel: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: "\u5DF2\u590D\u5236"
|
|
26
|
+
},
|
|
27
|
+
className: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: void 0
|
|
30
|
+
},
|
|
31
|
+
style: {
|
|
32
|
+
type: Object,
|
|
33
|
+
default: void 0
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
emits: ["copy"],
|
|
37
|
+
setup(props, { emit, attrs }) {
|
|
38
|
+
const isCopied = vue.ref(false);
|
|
39
|
+
const timerRef = vue.ref(null);
|
|
40
|
+
const containerClasses = vue.computed(() => {
|
|
41
|
+
const attrsRecord = attrs;
|
|
42
|
+
return tigercatCore.classNames(
|
|
43
|
+
tigercatCore.codeBlockContainerClasses,
|
|
44
|
+
props.className,
|
|
45
|
+
tigercatCore.coerceClassValue(attrsRecord.class)
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
const copyButtonClasses = vue.computed(() => {
|
|
49
|
+
return tigercatCore.classNames(
|
|
50
|
+
tigercatCore.codeBlockCopyButtonBaseClasses,
|
|
51
|
+
isCopied.value && tigercatCore.codeBlockCopyButtonCopiedClasses
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
const clearTimer = () => {
|
|
55
|
+
if (timerRef.value != null) {
|
|
56
|
+
window.clearTimeout(timerRef.value);
|
|
57
|
+
timerRef.value = null;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const handleCopy = async () => {
|
|
61
|
+
if (!props.copyable) return;
|
|
62
|
+
const ok = await tigercatCore.copyTextToClipboard(props.code);
|
|
63
|
+
if (!ok) return;
|
|
64
|
+
isCopied.value = true;
|
|
65
|
+
emit("copy", props.code);
|
|
66
|
+
clearTimer();
|
|
67
|
+
timerRef.value = window.setTimeout(() => {
|
|
68
|
+
isCopied.value = false;
|
|
69
|
+
timerRef.value = null;
|
|
70
|
+
}, 1500);
|
|
71
|
+
};
|
|
72
|
+
vue.onBeforeUnmount(() => {
|
|
73
|
+
clearTimer();
|
|
74
|
+
});
|
|
75
|
+
return () => {
|
|
76
|
+
const attrsRecord = attrs;
|
|
77
|
+
const attrsStyle = attrsRecord.style;
|
|
78
|
+
return vue.h(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
...attrs,
|
|
82
|
+
class: containerClasses.value,
|
|
83
|
+
style: tigercatCore.mergeStyleValues(attrsStyle, props.style)
|
|
84
|
+
},
|
|
85
|
+
[
|
|
86
|
+
vue.h("pre", { class: tigercatCore.codeBlockPreClasses }, [vue.h("code", { class: "block" }, props.code)]),
|
|
87
|
+
props.copyable ? vue.h(
|
|
88
|
+
"button",
|
|
89
|
+
{
|
|
90
|
+
type: "button",
|
|
91
|
+
class: copyButtonClasses.value,
|
|
92
|
+
onClick: handleCopy,
|
|
93
|
+
"aria-label": isCopied.value ? props.copiedLabel : props.copyLabel
|
|
94
|
+
},
|
|
95
|
+
isCopied.value ? props.copiedLabel : props.copyLabel
|
|
96
|
+
) : null
|
|
97
|
+
]
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
var Code_default = Code;
|
|
103
|
+
|
|
104
|
+
exports.Code = Code;
|
|
105
|
+
exports.Code_default = Code_default;
|