@king-design/vue 3.6.2 → 3.7.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.
- package/components/anchor/constants.d.ts +2 -0
- package/components/anchor/constants.js +2 -0
- package/components/anchor/index.d.ts +41 -0
- package/components/anchor/index.js +141 -0
- package/components/anchor/index.spec.d.ts +1 -0
- package/components/anchor/index.spec.js +230 -0
- package/components/anchor/index.vdt.js +31 -0
- package/components/anchor/link.d.ts +16 -0
- package/components/anchor/link.js +52 -0
- package/components/anchor/link.vdt.js +49 -0
- package/components/anchor/styles.d.ts +5 -0
- package/components/anchor/styles.js +30 -0
- package/components/anchor/useScroll.d.ts +7 -0
- package/components/anchor/useScroll.js +218 -0
- package/components/dialog/base.vdt.js +1 -1
- package/components/drawer/index.d.ts +3 -0
- package/components/drawer/index.js +22 -3
- package/components/drawer/index.spec.js +83 -0
- package/components/drawer/index.vdt.js +23 -3
- package/components/drawer/styles.js +1 -1
- package/components/drawer/useDrawerResizable.d.ts +10 -0
- package/components/drawer/useDrawerResizable.js +162 -0
- package/components/menu/styles.d.ts +1 -0
- package/components/menu/styles.js +4 -1
- package/components/notification/index.d.ts +1 -0
- package/components/notification/index.js +1 -0
- package/components/notification/index.spec.d.ts +1 -0
- package/components/notification/index.spec.js +317 -0
- package/components/notification/notification.d.ts +39 -0
- package/components/notification/notification.js +183 -0
- package/components/notification/notification.vdt.js +56 -0
- package/components/notification/notifications.d.ts +16 -0
- package/components/notification/notifications.js +51 -0
- package/components/notification/notifications.vdt.js +24 -0
- package/components/notification/styles.d.ts +9 -0
- package/components/notification/styles.js +110 -0
- package/components/select/styles.js +1 -1
- package/components/table/styles.js +1 -1
- package/components/tabs/useActiveBar.js +7 -3
- package/components/tag/base.d.ts +2 -0
- package/components/tag/base.js +3 -0
- package/components/tag/index.spec.js +17 -0
- package/components/tag/index.vdt.js +12 -5
- package/components/tag/styles.d.ts +9 -0
- package/components/tag/styles.js +14 -1
- package/components/tag/useColor.d.ts +7 -0
- package/components/tag/useColor.js +71 -0
- package/components/timepicker/index.spec.js +70 -42
- package/components/timepicker/useDefaultValue.js +12 -7
- package/components/timepicker/useStep.js +4 -2
- package/components/transfer/index.d.ts +13 -0
- package/components/transfer/index.js +6 -2
- package/components/transfer/index.spec.js +197 -0
- package/components/transfer/index.vdt.js +28 -5
- package/components/transfer/styles.js +4 -1
- package/components/transfer/useCheck.js +2 -1
- package/components/transfer/usePagination.d.ts +12 -0
- package/components/transfer/usePagination.js +79 -0
- package/dist/fonts/iconfont.eot +0 -0
- package/dist/fonts/iconfont.svg +235 -0
- package/dist/fonts/iconfont.ttf +0 -0
- package/dist/fonts/iconfont.woff +0 -0
- package/dist/fonts/iconfont.woff2 +0 -0
- package/dist/fonts/ionicons.eot +0 -0
- package/dist/fonts/ionicons.svg +2230 -0
- package/dist/fonts/ionicons.ttf +0 -0
- package/dist/fonts/ionicons.woff +0 -0
- package/dist/fonts/ionicons.woff2 +0 -0
- package/dist/i18n/en-US.js +1411 -0
- package/dist/i18n/en-US.js.map +1 -0
- package/dist/i18n/en-US.min.js +1 -0
- package/dist/i18n/index.js +283 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/index.min.js +1 -0
- package/dist/index.js +58128 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +1 -0
- package/index.d.ts +4 -2
- package/index.js +4 -2
- package/install.js +2 -0
- package/package.json +3 -1
- package/styles/fonts/iconfont.eot +0 -0
- package/styles/fonts/iconfont.js +1 -1
- package/styles/fonts/iconfont.svg +38 -0
- package/styles/fonts/iconfont.ttf +0 -0
- package/styles/fonts/iconfont.woff +0 -0
- package/styles/fonts/iconfont.woff2 +0 -0
- package/styles/theme.d.ts +8 -0
- package/styles/theme.js +5 -1
- package/yarn-error.log +43 -44
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createUnknownComponentVNode as _$cc, createElementVNode as _$ce, map as _$ma, className as _$cn } from 'intact-vue-next';
|
|
2
|
+
import { TransitionGroup } from 'intact-vue-next';
|
|
3
|
+
import { makeNotificationsStyles } from './styles';
|
|
4
|
+
import { ConfigProvider } from '../config';
|
|
5
|
+
export default function ($props, $blocks, $__proto__) {
|
|
6
|
+
var _$cn2;
|
|
7
|
+
$blocks || ($blocks = {});
|
|
8
|
+
$props || ($props = {});
|
|
9
|
+
var $this = this;
|
|
10
|
+
var k = this.get('classNamePrefix') || this.config.k;
|
|
11
|
+
var position = this.get('position') || 'topRight';
|
|
12
|
+
return _$cc(ConfigProvider, {
|
|
13
|
+
'value': {
|
|
14
|
+
classNamePrefix: k
|
|
15
|
+
},
|
|
16
|
+
'children': _$ce(2, 'div', _$cc(TransitionGroup, {
|
|
17
|
+
'onAfterLeave': this.onAfterLeave.bind(this),
|
|
18
|
+
'children': _$ma(this.notifications, function ($value, $key) {
|
|
19
|
+
return $value;
|
|
20
|
+
}, $this)
|
|
21
|
+
}), 2, _$cn((_$cn2 = {}, _$cn2[k + "-notifications"] = true, _$cn2[makeNotificationsStyles(k, position)] = true, _$cn2)))
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { css } from '@emotion/css';
|
|
2
|
+
import { theme, setDefault } from '../../styles/theme';
|
|
3
|
+
import { deepDefaults } from '../../styles/utils';
|
|
4
|
+
import '../../styles/global';
|
|
5
|
+
import { cache } from '../utils';
|
|
6
|
+
var defaults = {
|
|
7
|
+
get transition() {
|
|
8
|
+
return theme.transition.large;
|
|
9
|
+
},
|
|
10
|
+
top: "24px",
|
|
11
|
+
right: "24px",
|
|
12
|
+
left: "24px",
|
|
13
|
+
bottom: "24px",
|
|
14
|
+
leftTransform: "translateX(-100%)",
|
|
15
|
+
rightTransform: "translateX(100%)",
|
|
16
|
+
topTransform: "translateY(-100%)",
|
|
17
|
+
bottomTransform: "translateY(100%)",
|
|
18
|
+
bgColor: '#fff',
|
|
19
|
+
get borderRadius() {
|
|
20
|
+
return theme.borderRadius;
|
|
21
|
+
},
|
|
22
|
+
gap: "8px",
|
|
23
|
+
boxShadow: '0px 4px 32px 4px #00000014',
|
|
24
|
+
padding: "12px",
|
|
25
|
+
get fontSize() {
|
|
26
|
+
return theme.default.fontSize;
|
|
27
|
+
},
|
|
28
|
+
get contentColor() {
|
|
29
|
+
return theme.color.text;
|
|
30
|
+
},
|
|
31
|
+
get titleColor() {
|
|
32
|
+
return theme.color.title;
|
|
33
|
+
},
|
|
34
|
+
minWidth: '320px',
|
|
35
|
+
width: '360px',
|
|
36
|
+
maxWidth: '400px',
|
|
37
|
+
titleFontSize: '14px',
|
|
38
|
+
titleFontWeight: '500',
|
|
39
|
+
titleMarginBottom: '8px',
|
|
40
|
+
bodyLineHeight: '1.5',
|
|
41
|
+
icon: {
|
|
42
|
+
fontSize: "20px"
|
|
43
|
+
},
|
|
44
|
+
close: {
|
|
45
|
+
right: "12px",
|
|
46
|
+
top: "12px",
|
|
47
|
+
width: "20px",
|
|
48
|
+
height: "20px"
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var notification;
|
|
52
|
+
setDefault(function () {
|
|
53
|
+
notification = deepDefaults(theme, {
|
|
54
|
+
notification: defaults
|
|
55
|
+
}).notification;
|
|
56
|
+
makeNotificationsStyles == null || makeNotificationsStyles.clearCache();
|
|
57
|
+
makeNotificationStyles == null || makeNotificationStyles.clearCache();
|
|
58
|
+
});
|
|
59
|
+
export var makeNotificationsStyles = cache(function makeNotificationsStyles(k, position) {
|
|
60
|
+
// 位置配置
|
|
61
|
+
var positions = {
|
|
62
|
+
topRight: {
|
|
63
|
+
top: notification.top,
|
|
64
|
+
right: notification.right,
|
|
65
|
+
left: '',
|
|
66
|
+
bottom: '',
|
|
67
|
+
transform: ''
|
|
68
|
+
},
|
|
69
|
+
topLeft: {
|
|
70
|
+
top: notification.top,
|
|
71
|
+
left: notification.left,
|
|
72
|
+
right: '',
|
|
73
|
+
bottom: '',
|
|
74
|
+
transform: ''
|
|
75
|
+
},
|
|
76
|
+
bottomRight: {
|
|
77
|
+
bottom: notification.top,
|
|
78
|
+
right: notification.right,
|
|
79
|
+
left: '',
|
|
80
|
+
top: '',
|
|
81
|
+
transform: ''
|
|
82
|
+
},
|
|
83
|
+
bottomLeft: {
|
|
84
|
+
bottom: notification.top,
|
|
85
|
+
left: notification.left,
|
|
86
|
+
right: '',
|
|
87
|
+
top: '',
|
|
88
|
+
transform: ''
|
|
89
|
+
},
|
|
90
|
+
top: {
|
|
91
|
+
top: notification.top,
|
|
92
|
+
left: '50%',
|
|
93
|
+
right: '',
|
|
94
|
+
bottom: '',
|
|
95
|
+
transform: 'translateX(-50%)'
|
|
96
|
+
},
|
|
97
|
+
bottom: {
|
|
98
|
+
bottom: notification.top,
|
|
99
|
+
left: '50%',
|
|
100
|
+
right: '',
|
|
101
|
+
top: '',
|
|
102
|
+
transform: 'translateX(-50%)'
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
var pos = positions[position] || positions.topRight;
|
|
106
|
+
return /*#__PURE__*/css("position:fixed;", pos.top ? "top: " + pos.top + ";" : '', " ", pos.bottom ? "bottom: " + pos.bottom + ";" : '', " ", pos.left ? "left: " + pos.left + ";" : '', " ", pos.right ? "right: " + pos.right + ";" : '', " ", pos.transform ? "transform: " + pos.transform + ";" : '', " width:auto;pointer-events:none;z-index:", theme.maxZIndex + 1, ";");
|
|
107
|
+
});
|
|
108
|
+
export var makeNotificationStyles = cache(function makeNotificationStyles(k) {
|
|
109
|
+
return /*#__PURE__*/css(".", k, "-notification-container{display:flex;flex-direction:column;position:relative;box-shadow:", notification.boxShadow, ";border-radius:", notification.borderRadius, ";margin-bottom:", notification.gap, ";pointer-events:all;min-width:", notification.minWidth, ";max-width:", notification.maxWidth, ";width:", notification.width, ";background:", notification.bgColor, ";}.", k, "-notification-wrapper{position:relative;display:flex;gap:", notification.gap, ";padding:", notification.padding, ";}.", k, "-notification-icon{.", k, "-icon{font-size:", notification.icon.fontSize, ";}}.", k, "-notification-content{flex:1;display:flex;flex-direction:column;}.", k, "-notification-title{font-size:", notification.titleFontSize, ";font-weight:", notification.titleFontWeight, ";color:", notification.titleColor, ";margin-bottom:", notification.titleMarginBottom, ";line-height:", notification.bodyLineHeight, ";}.", k, "-notification-body{font-size:", notification.fontSize, ";color:", notification.contentColor, ";line-height:", notification.bodyLineHeight, ";word-break:break-word;word-wrap:break-word;}.", k, "-notification-close{position:absolute;right:", notification.close.right, ";top:", notification.close.top, ";width:", notification.close.width, ";height:", notification.close.height, ";}&.", k, "-position-topRight.transition-enter-from,&.", k, "-position-bottomRight.transition-enter-from,&.", k, "-position-topRight.transition-leave-to,&.", k, "-position-bottomRight.transition-leave-to{opacity:0;transform:", notification.rightTransform, ";}&.", k, "-position-topLeft.transition-enter-from,&.", k, "-position-bottomLeft.transition-enter-from,&.", k, "-position-topLeft.transition-leave-to,&.", k, "-position-bottomLeft.transition-leave-to{opacity:0;transform:", notification.leftTransform, ";}&.", k, "-position-top.transition-enter-from,&.", k, "-position-top.transition-leave-to{opacity:0;transform:", notification.topTransform, ";}&.", k, "-position-bottom.transition-enter-from,&.", k, "-position-bottom.transition-leave-to{opacity:0;transform:", notification.bottomTransform, ";}&.transition-enter-active,&.transition-leave-active{transition:transform ", notification.transition, ",opacity ", notification.transition, ";}&.transition-move{transition:transform ", notification.transition, ";}");
|
|
110
|
+
});
|
|
@@ -157,7 +157,7 @@ export var makeStyles = cache(function makeStyles(k) {
|
|
|
157
157
|
});
|
|
158
158
|
export var makeMenuStyles = cache(function makeMenuStyles(k) {
|
|
159
159
|
var searchable = select.searchable;
|
|
160
|
-
return /*#__PURE__*/css("min-width:auto;max-height:", select.menuMaxHeight, ";overflow:auto;&:not([class*=\"-active\"]){transition:left ", select.transition, ",top ", select.transition, ";}.", k, "-select-empty{padding:", select.empty.padding, ";color:", select.empty.color, ";text-align:center;}.", k, "-select-option{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;&.", k, "-active{color:", select.activeColor, ";}}&.", k, "-card{display:flex;height:", select.card.height, ";.", k, "-tabs{border:none;overflow:auto;}.", k, "-select-group{flex:1;overflow:auto;}.", k, "-select-option.", k, "-hover{background:", select.card.itemHoverBgColor, ";color:", select.card.itemHoverColor, ";}}&.", k, "-searchable{max-height:none;padding:", searchable.padding, ";.", k, "-select-option{padding:", searchable.optionPadding, ";}}.", k, "-select-header{display:flex;padding:", searchable.header.padding, ";border-bottom:", searchable.border, ";margin-bottom:", searchable.header.gap, ";}.", k, "-select-op{white-space:nowrap;.", k, "-btn{padding:", searchable.header.btnPadding, ";margin-left:", searchable.header.btnGap, ";}}.", k, "-select-body{max-height:", select.menuMaxHeight, ";overflow:auto;}.", k, "-select-footer{border-top:", searchable.border, ";padding:", searchable.footer.padding, ";text-align:right;margin-top:", searchable.footer.gap, ";.", k, "-btn{margin-left:", searchable.footer.btnGap, ";}}.", k, "-select-option{.", k, "-checkbox{margin:0 -", getRight(searchable.optionPadding), " 0 -", getLeft(searchable.optionPadding), ";padding:", searchable.optionPadding, ";}}.", k, "-select-checkmark{float:right;height:100%;font-size:", select.multiple.checkmark.fontSize, ";}");
|
|
160
|
+
return /*#__PURE__*/css("min-width:auto;max-height:", select.menuMaxHeight, ";overflow:auto;&:not([class*=\"-active\"]){transition:left ", select.transition, ",top ", select.transition, ";}.", k, "-select-empty{padding:", select.empty.padding, ";color:", select.empty.color, ";text-align:center;}.", k, "-select-option{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;&.", k, "-active{color:", select.activeColor, ";}}&.", k, "-card{display:flex;height:", select.card.height, ";.", k, "-tabs{border:none;border-top-right-radius:0;border-bottom-right-radius:0;overflow:auto;}.", k, "-select-group{flex:1;overflow:auto;}.", k, "-select-option.", k, "-hover{background:", select.card.itemHoverBgColor, ";color:", select.card.itemHoverColor, ";}}&.", k, "-searchable{max-height:none;padding:", searchable.padding, ";.", k, "-select-option{padding:", searchable.optionPadding, ";}}.", k, "-select-header{display:flex;padding:", searchable.header.padding, ";border-bottom:", searchable.border, ";margin-bottom:", searchable.header.gap, ";}.", k, "-select-op{white-space:nowrap;.", k, "-btn{padding:", searchable.header.btnPadding, ";margin-left:", searchable.header.btnGap, ";}}.", k, "-select-body{max-height:", select.menuMaxHeight, ";overflow:auto;}.", k, "-select-footer{border-top:", searchable.border, ";padding:", searchable.footer.padding, ";text-align:right;margin-top:", searchable.footer.gap, ";.", k, "-btn{margin-left:", searchable.footer.btnGap, ";}}.", k, "-select-option{.", k, "-checkbox{margin:0 -", getRight(searchable.optionPadding), " 0 -", getLeft(searchable.optionPadding), ";padding:", searchable.optionPadding, ";}}.", k, "-select-checkmark{float:right;height:100%;font-size:", select.multiple.checkmark.fontSize, ";}");
|
|
161
161
|
});
|
|
162
162
|
export var makeGroupStyles = cache(function makeGroupStyles(k) {
|
|
163
163
|
return /*#__PURE__*/css(".", k, "-select-group-label{color:", select.group.labelColor, ";padding:", select.group.labelPadding, ";}");
|
|
@@ -91,7 +91,7 @@ setDefault(function () {
|
|
|
91
91
|
});
|
|
92
92
|
export { table };
|
|
93
93
|
export var makeStyles = cache(function makeStyles(k) {
|
|
94
|
-
return /*#__PURE__*/css("font-size:", table.fontSize, ";color:", table.color, ";position:relative;z-index:0;.", k, "-table-wrapper{border-bottom:", table.border, ";overflow:auto;border-radius:", table.borderRadius, ";}table{width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed;}thead{text-align:", table.thead.textAlign, ";font-size:", table.thead.fontSize, ";font-weight:", table.thead.fontWeight, ";z-index:2;tr{height:", table.thead.height, ";&:not(:last-of-type) th{border-bottom:", table.border, ";}}}tfoot{z-index:2;tr{td{border-top:", table.border, ";border-bottom-color:transparent;}}}th{padding:", table.thead.padding, ";position:relative;background:", table.thead.bgColor, ";line-height:normal;&:before{display:none;content:'';height:", table.thead.delimiterHeight, ";position:absolute;background-color:", table.thead.delimiterColor, ";width:1px;left:1px;top:50%;transform:translateY(-50%);}&:not(.", k, "-
|
|
94
|
+
return /*#__PURE__*/css("font-size:", table.fontSize, ";color:", table.color, ";position:relative;z-index:0;.", k, "-table-wrapper{border-bottom:", table.border, ";overflow:auto;border-radius:", table.borderRadius, ";}table{width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed;}thead{text-align:", table.thead.textAlign, ";font-size:", table.thead.fontSize, ";font-weight:", table.thead.fontWeight, ";z-index:2;tr{height:", table.thead.height, ";&:not(:last-of-type) th{border-bottom:", table.border, ";}}}tfoot{z-index:2;tr{td{border-top:", table.border, ";border-bottom-color:transparent;}}}th{padding:", table.thead.padding, ";position:relative;background:", table.thead.bgColor, ";line-height:normal;&:before{display:none;content:'';height:", table.thead.delimiterHeight, ";position:absolute;background-color:", table.thead.delimiterColor, ";width:1px;left:1px;top:50%;transform:translateY(-50%);}&.", k, "-fixed-right:before{left:-2px;}}&:not(.", k, "-grid){th:not(.", k, "-hidden)~th:not(.", k, "-hidden):before{display:block;}}.", k, "-table-title{display:inline-flex;align-items:center;max-width:100%;color:", table.thead.color, ";}.", k, "-table-title-text{flex:1;display:inline-flex;line-height:1.4;}tbody{tr{&:hover td{background:", table.tbody.hoverBgcolor, ";}&:last-of-type td{border-bottom-color:transparent;}}}td{padding:", table.tbody.padding, ";border-bottom:", table.border, ";background:", table.bgColor, ";word-wrap:break-word;}.", k, "-fixed-left,.", k, "-fixed-right{position:sticky;z-index:1;&:after{content:'';display:block;transition:box-shadow ", table.transition, ";position:absolute;top:0;bottom:0px;width:10px;pointer-events:none;}}.", k, "-fixed-left:after{right:-11px;}.", k, "-fixed-right:after{left:-11px;}&.", k, "-scroll-left .", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}&.", k, "-scroll-right .", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}&.", k, "-scroll-middle{.", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}.", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}}.", k, "-fixed-right+.", k, "-fixed-right:after{display:none;}.", k, "-table-affix-header{position:sticky;top:0;left:0;.", k, "-affix-wrapper{overflow:hidden;}&.", k, "-fixed{position:relative;}}&.", k, "-border,&.", k, "-grid{.", k, "-table-wrapper{border-top:", table.border, ";border-left:", table.border, ";border-right:", table.border, ";}}&.", k, "-grid{td:not(:last-of-type),th:not(:last-of-type){border-right:", table.border, ";}th:before{display:none;}}&.", k, "-stripe{tr:nth-child(even):not(:hover) td{background:", table.stripeBgColor, ";}}.", k, "-table-group{margin-left:", table.group.gap, ";}.", k, "-table-check{.", k, "-checkbox,.", k, "-radio{position:relative;top:-1px;}}.", k, "-column-sortable{cursor:pointer;}.", k, "-column-sort{.", k, "-icon{display:block;height:", _sortInstanceProperty(table).iconHeight, ";line-height:", _sortInstanceProperty(table).iconHeight, ";margin:0 0 1px ", _sortInstanceProperty(table).gap, ";}&.", k, "-desc .", k, "-icon.", k, "-desc,&.", k, "-asc .", k, "-icon.", k, "-asc{color:", _sortInstanceProperty(table).enabledColor, ";}}.", k, "-table-spin.", k, "-overlay{z-index:2;}.", k, "-table-empty{text-align:center;}tr.", k, "-expand{td{padding:0;background:#fdfcff;}}&.", k, "-with-expand{tr:not(.", k, "-expand){td{border-bottom:none;}}}.", k, "-table-expand{border-top:", table.border, ";box-sizing:content-box;}tbody tr.", k, "-selected td{background:", table.selectedBgColor, ";}.", k, "-hidden{display:none;}.", k, "-table-arrow{width:", table.arrow.width, "!important;margin-right:", table.arrow.gap, ";transition:transform ", table.transition, ";position:relative;top:-1px;}tr.", k, "-spreaded{.", k, "-table-arrow{transform:rotate(90deg);}}.", k, "-table-resize{height:100%;width:", table.resizeWidth, ";position:absolute;top:0;left:-1px;cursor:ew-resize;}tr.", k, "-dragging{opacity:", table.draggingOpacity, ";}.", k, "-table-scrollbar{overflow-x:auto;overflow-y:hidden;}.", k, "-table-scrollbar-inner{height:1px;}", _mapInstanceProperty(aligns).call(aligns, function (type) {
|
|
95
95
|
return /*#__PURE__*/css(".", k, "-align-", type, "{text-align:", type, ";}");
|
|
96
96
|
}), ">.", k, "-pagination{margin:16px 0;}&.", k, "-fix-header{min-height:0;.", k, "-table-wrapper{height:100%;}thead{position:sticky;top:0;}}&.", k, "-fix-footer{min-height:0;.", k, "-table-wrapper{height:100%;}tfoot{position:sticky;bottom:0;}}.", k, "-table-phantom{position:static;}");
|
|
97
97
|
});
|
|
@@ -13,6 +13,7 @@ export function useActiveBar() {
|
|
|
13
13
|
var element = findDomFromVNode(instance.$lastInput, true);
|
|
14
14
|
var k = instance.config.k;
|
|
15
15
|
var activeTab = element.querySelector("." + k + "-tab." + k + "-active");
|
|
16
|
+
var vertical = instance.get('vertical');
|
|
16
17
|
if (!activeTab) {
|
|
17
18
|
var oldStyles = styles.value;
|
|
18
19
|
if (oldStyles) {
|
|
@@ -21,14 +22,17 @@ export function useActiveBar() {
|
|
|
21
22
|
width: '0'
|
|
22
23
|
} : {
|
|
23
24
|
top: oldStyles.top,
|
|
24
|
-
|
|
25
|
+
height: '0'
|
|
25
26
|
});
|
|
26
27
|
} else {
|
|
27
|
-
styles.set(
|
|
28
|
+
styles.set(vertical ? {
|
|
29
|
+
height: '0'
|
|
30
|
+
} : {
|
|
31
|
+
width: '0'
|
|
32
|
+
});
|
|
28
33
|
}
|
|
29
34
|
return;
|
|
30
35
|
}
|
|
31
|
-
var vertical = instance.get('vertical');
|
|
32
36
|
if (!vertical) {
|
|
33
37
|
var width = activeTab.offsetWidth;
|
|
34
38
|
var left = activeTab.offsetLeft;
|
package/components/tag/base.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Sizes } from '../../styles/utils';
|
|
|
3
3
|
import type { Events, Colors } from '../types';
|
|
4
4
|
export interface TagProps {
|
|
5
5
|
type?: Colors;
|
|
6
|
+
color?: Colors | 'purple' | 'teal' | 'blue' | 'yellow' | string;
|
|
6
7
|
closable?: boolean;
|
|
7
8
|
closed?: boolean;
|
|
8
9
|
disabled?: boolean;
|
|
@@ -21,5 +22,6 @@ export declare class Tag<T extends TagProps = TagProps, E extends TagEvents = Ta
|
|
|
21
22
|
static defaults: () => Partial<TagProps>;
|
|
22
23
|
static events: Events<TagEvents>;
|
|
23
24
|
private config;
|
|
25
|
+
private tagColor;
|
|
24
26
|
private onClose;
|
|
25
27
|
}
|
package/components/tag/base.js
CHANGED
|
@@ -6,8 +6,10 @@ import { bind } from '../utils';
|
|
|
6
6
|
import template from './index.vdt';
|
|
7
7
|
import { sizes } from '../../styles/utils';
|
|
8
8
|
import { useConfigContext } from '../config';
|
|
9
|
+
import { useColor } from './useColor';
|
|
9
10
|
export var typeDefs = {
|
|
10
11
|
type: ['default', 'primary', 'danger', 'success', 'warning'],
|
|
12
|
+
color: String,
|
|
11
13
|
closable: Boolean,
|
|
12
14
|
closed: Boolean,
|
|
13
15
|
disabled: Boolean,
|
|
@@ -34,6 +36,7 @@ export var Tag = /*#__PURE__*/function (_Component) {
|
|
|
34
36
|
}
|
|
35
37
|
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
36
38
|
_this.config = useConfigContext();
|
|
39
|
+
_this.tagColor = useColor();
|
|
37
40
|
return _this;
|
|
38
41
|
}
|
|
39
42
|
var _proto = Tag.prototype;
|
|
@@ -4,6 +4,7 @@ import ClosableDemo from '~/components/tag/demos/closable';
|
|
|
4
4
|
import { mount, unmount, wait, dispatchEvent, getElement } from '../../test/utils';
|
|
5
5
|
import TagsDemo from '~/components/tag/demos/tags';
|
|
6
6
|
import DraggableDemo from '~/components/tag/demos/draggable';
|
|
7
|
+
import ColorDemo from '~/components/tag/demos/color';
|
|
7
8
|
describe('Tag', function () {
|
|
8
9
|
afterEach(function () {
|
|
9
10
|
return unmount();
|
|
@@ -149,4 +150,20 @@ describe('Tag', function () {
|
|
|
149
150
|
}
|
|
150
151
|
}, _callee4);
|
|
151
152
|
})));
|
|
153
|
+
it('should support color property', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
154
|
+
var _mount4, instance, element;
|
|
155
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
156
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
157
|
+
case 0:
|
|
158
|
+
_mount4 = mount(ColorDemo), instance = _mount4[0], element = _mount4[1];
|
|
159
|
+
_context5.next = 3;
|
|
160
|
+
return wait();
|
|
161
|
+
case 3:
|
|
162
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
163
|
+
case 4:
|
|
164
|
+
case "end":
|
|
165
|
+
return _context5.stop();
|
|
166
|
+
}
|
|
167
|
+
}, _callee5);
|
|
168
|
+
})));
|
|
152
169
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
2
|
import { createUnknownComponentVNode as _$cc, createVNode as _$cv, className as _$cn, noop as _$no } from 'intact-vue-next';
|
|
3
3
|
import { Icon } from '../icon';
|
|
4
|
-
import { getRestProps } from '../utils';
|
|
4
|
+
import { addStyle, getRestProps } from '../utils';
|
|
5
5
|
import { makeStyles } from './styles';
|
|
6
6
|
import { Transition } from 'intact-vue-next';
|
|
7
7
|
export default function ($props, $blocks, $__proto__) {
|
|
@@ -19,14 +19,21 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
19
19
|
disabled = _this$get.disabled,
|
|
20
20
|
closable = _this$get.closable,
|
|
21
21
|
closed = _this$get.closed,
|
|
22
|
-
size = _this$get.size
|
|
22
|
+
size = _this$get.size,
|
|
23
|
+
style = _this$get.style;
|
|
23
24
|
var k = this.config.k;
|
|
24
|
-
var
|
|
25
|
+
var _this$tagColor = this.tagColor,
|
|
26
|
+
colorClassName = _this$tagColor.colorClassName,
|
|
27
|
+
customStyle = _this$tagColor.customStyle,
|
|
28
|
+
iconColor = _this$tagColor.iconColor;
|
|
29
|
+
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-tag"] = !$props.className, _classNameObj[className] = className, _classNameObj[k + "-" + colorClassName.value] = colorClassName.value, _classNameObj[k + "-" + size] = size !== 'default', _classNameObj[k + "-" + border] = border, _classNameObj[k + "-disabled"] = disabled, _classNameObj[k + "-closable"] = closable, _classNameObj[makeStyles(k)] = true, _classNameObj[$props.className] = $props.className, _classNameObj);
|
|
25
30
|
return _$cc(Transition, {
|
|
26
31
|
'name': $props.name || k + "-scale",
|
|
27
32
|
'children': !closed ? _$cv('div', _extends({
|
|
28
33
|
'className': _$cn(classNameObj)
|
|
29
|
-
}, getRestProps(this)
|
|
34
|
+
}, getRestProps(this), {
|
|
35
|
+
'style': addStyle(style, customStyle.value)
|
|
36
|
+
}), [(_$blocks['body'] = function ($super) {
|
|
30
37
|
return children;
|
|
31
38
|
}, __$blocks['body'] = function ($super, data) {
|
|
32
39
|
var block = $blocks['body'];
|
|
@@ -37,7 +44,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
37
44
|
}, __$blocks['body'](_$no)), (_$blocks['_close'] = function ($super) {
|
|
38
45
|
return closable ? _$cc(Icon, {
|
|
39
46
|
'className': _$cn(k + "-tag-close ion-ios-close-empty"),
|
|
40
|
-
'color':
|
|
47
|
+
'color': iconColor.value,
|
|
41
48
|
'hoverable': !disabled,
|
|
42
49
|
'ev-click': this.onClose
|
|
43
50
|
}) : undefined;
|
|
@@ -3,6 +3,10 @@ type TypeStyles = {
|
|
|
3
3
|
color: string;
|
|
4
4
|
bgColor: string;
|
|
5
5
|
};
|
|
6
|
+
type ColorStyles = {
|
|
7
|
+
color: string;
|
|
8
|
+
bgColor: string;
|
|
9
|
+
};
|
|
6
10
|
declare const defaults: {
|
|
7
11
|
readonly border: string;
|
|
8
12
|
readonly borderRadius: string;
|
|
@@ -62,6 +66,11 @@ declare const defaults: {
|
|
|
62
66
|
warning: TypeStyles;
|
|
63
67
|
danger: TypeStyles;
|
|
64
68
|
success: TypeStyles;
|
|
69
|
+
} & {
|
|
70
|
+
blue: ColorStyles;
|
|
71
|
+
purple: ColorStyles;
|
|
72
|
+
teal: ColorStyles;
|
|
73
|
+
yellow: ColorStyles;
|
|
65
74
|
};
|
|
66
75
|
declare let tag: typeof defaults;
|
|
67
76
|
export { tag };
|
package/components/tag/styles.js
CHANGED
|
@@ -5,6 +5,7 @@ import { theme, setDefault } from '../../styles/theme';
|
|
|
5
5
|
import '../../styles/global';
|
|
6
6
|
import { cache } from '../utils';
|
|
7
7
|
var types = ['primary', 'warning', 'danger', 'success', 'disabled'];
|
|
8
|
+
var colors = ['purple', 'teal', 'blue', 'yellow'];
|
|
8
9
|
var defaults = deepDefaults({
|
|
9
10
|
get border() {
|
|
10
11
|
return "1px solid " + theme.color.border;
|
|
@@ -91,6 +92,16 @@ var defaults = deepDefaults({
|
|
|
91
92
|
}
|
|
92
93
|
};
|
|
93
94
|
return memo;
|
|
95
|
+
}, {}), colors.reduce(function (memo, color) {
|
|
96
|
+
memo[color] = {
|
|
97
|
+
get color() {
|
|
98
|
+
return theme.color[color];
|
|
99
|
+
},
|
|
100
|
+
get bgColor() {
|
|
101
|
+
return palette(theme.color[color], -4);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
return memo;
|
|
94
105
|
}, {}));
|
|
95
106
|
var tag;
|
|
96
107
|
setDefault(function () {
|
|
@@ -102,7 +113,9 @@ setDefault(function () {
|
|
|
102
113
|
});
|
|
103
114
|
export { tag };
|
|
104
115
|
export var makeStyles = cache(function makeStyles(k) {
|
|
105
|
-
return /*#__PURE__*/css("display:inline-flex;align-items:center;padding:", tag.padding, ";border:", tag.border, ";border-radius:", tag.borderRadius, ";font-size:", tag.fontSize, ";height:", tag.height, ";.", k, "-tag-close{font-size:", tag.close.fontSize, ";margin-left:", tag.close.gap, ";width:", tag.close.width, ";}&.", k, "-none{border:none;background:", tag.none.bgColor, ";}", _mapInstanceProperty(
|
|
116
|
+
return /*#__PURE__*/css("display:inline-flex;align-items:center;padding:", tag.padding, ";border:", tag.border, ";border-radius:", tag.borderRadius, ";font-size:", tag.fontSize, ";height:", tag.height, ";.", k, "-tag-close{font-size:", tag.close.fontSize, ";margin-left:", tag.close.gap, ";width:", tag.close.width, ";}&.", k, "-none{border:none;background:", tag.none.bgColor, ";}", _mapInstanceProperty(colors).call(colors, function (c) {
|
|
117
|
+
return /*#__PURE__*/css("&.", k, "-", c, "{color:", tag[c].color, ";border-color:", tag[c].color, ";background:", tag[c].bgColor, ";}");
|
|
118
|
+
}), " ", _mapInstanceProperty(types).call(types, function (t) {
|
|
106
119
|
var styles = tag[t];
|
|
107
120
|
return /*#__PURE__*/css("&.", k, "-", t, "{color:", styles.color, ";border-color:", styles.color, ";background:", styles.bgColor, ";}");
|
|
108
121
|
}), " ", _mapInstanceProperty(sizes).call(sizes, function (s) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function getIconColorValue(color: string | undefined, disabled: boolean | undefined): string | undefined;
|
|
2
|
+
export declare function useColor(): {
|
|
3
|
+
effectiveColor: import("../../hooks/useState").State<string | undefined>;
|
|
4
|
+
colorClassName: import("../../hooks/useState").State<string | undefined>;
|
|
5
|
+
customStyle: import("../../hooks/useState").State<Record<string, string>>;
|
|
6
|
+
iconColor: import("../../hooks/useState").State<string | undefined>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
var _context;
|
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/includes";
|
|
4
|
+
import { useInstance } from 'intact-vue-next';
|
|
5
|
+
import { palette } from '../../styles/utils';
|
|
6
|
+
import { useState } from '../../hooks/useState';
|
|
7
|
+
import { useReceive } from '../../hooks/useReceive';
|
|
8
|
+
import { theme } from '../../styles/theme';
|
|
9
|
+
// type 支持的颜色
|
|
10
|
+
var TYPE_COLORS = ['default', 'primary', 'danger', 'success', 'warning'];
|
|
11
|
+
// color 支持的扩展内置颜色
|
|
12
|
+
var EXTENDED_COLORS = ['purple', 'teal', 'blue', 'yellow'];
|
|
13
|
+
// 所有内置颜色
|
|
14
|
+
var BUILT_IN_COLORS = _concatInstanceProperty(_context = []).call(_context, TYPE_COLORS, EXTENDED_COLORS);
|
|
15
|
+
export function getIconColorValue(color, disabled) {
|
|
16
|
+
if (disabled) return theme.color.disabled;
|
|
17
|
+
if (!color || color === 'default') return 'default';
|
|
18
|
+
if (_includesInstanceProperty(BUILT_IN_COLORS).call(BUILT_IN_COLORS, color)) {
|
|
19
|
+
var themeColor = theme.color[color];
|
|
20
|
+
return themeColor;
|
|
21
|
+
}
|
|
22
|
+
return color;
|
|
23
|
+
}
|
|
24
|
+
export function useColor() {
|
|
25
|
+
var instance = useInstance();
|
|
26
|
+
var effectiveColor = useState(undefined);
|
|
27
|
+
var colorClassName = useState(undefined);
|
|
28
|
+
var customStyle = useState({});
|
|
29
|
+
var iconColor = useState(undefined);
|
|
30
|
+
function updateColor() {
|
|
31
|
+
var _instance$get = instance.get(),
|
|
32
|
+
color = _instance$get.color,
|
|
33
|
+
type = _instance$get.type,
|
|
34
|
+
disabled = _instance$get.disabled;
|
|
35
|
+
var _effectiveColor = color || (_includesInstanceProperty(TYPE_COLORS).call(TYPE_COLORS, type) ? type : undefined); // color优先
|
|
36
|
+
effectiveColor.set(_effectiveColor);
|
|
37
|
+
var isBuiltIn = _effectiveColor ? _includesInstanceProperty(BUILT_IN_COLORS).call(BUILT_IN_COLORS, _effectiveColor) : false;
|
|
38
|
+
// 内置颜色 - 更新 colorClassName
|
|
39
|
+
if (_effectiveColor && isBuiltIn && _effectiveColor !== 'default') {
|
|
40
|
+
colorClassName.set(_effectiveColor);
|
|
41
|
+
} else {
|
|
42
|
+
colorClassName.set(undefined);
|
|
43
|
+
}
|
|
44
|
+
// 自定义颜色 - 更新 customStyle
|
|
45
|
+
if (_effectiveColor && !isBuiltIn && !disabled) {
|
|
46
|
+
var bgColor = palette(_effectiveColor, -4);
|
|
47
|
+
customStyle.set({
|
|
48
|
+
color: _effectiveColor,
|
|
49
|
+
borderColor: _effectiveColor,
|
|
50
|
+
backgroundColor: bgColor
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
customStyle.set({});
|
|
54
|
+
}
|
|
55
|
+
// 更新 iconColor
|
|
56
|
+
if (!_effectiveColor && !disabled) {
|
|
57
|
+
iconColor.set('default');
|
|
58
|
+
} else {
|
|
59
|
+
var _iconColor = getIconColorValue(_effectiveColor, disabled);
|
|
60
|
+
iconColor.set(_iconColor);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
useReceive(['color', 'type', 'disabled'], updateColor);
|
|
64
|
+
updateColor();
|
|
65
|
+
return {
|
|
66
|
+
effectiveColor: effectiveColor,
|
|
67
|
+
colorClassName: colorClassName,
|
|
68
|
+
customStyle: customStyle,
|
|
69
|
+
iconColor: iconColor
|
|
70
|
+
};
|
|
71
|
+
}
|