@king-design/react 2.1.1 → 3.0.0-beta.1
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/__tests__/__snapshots__/Dialog.md +1 -1
- package/__tests__/__snapshots__/React Demos.md +410 -374
- package/__tests__/components/drawer.spec.tsx +67 -5
- package/components/button/index.d.ts +1 -1
- package/components/button/index.js +1 -1
- package/components/button/styles.js +3 -3
- package/components/card/styles.js +10 -2
- package/components/checkbox/styles.js +21 -10
- package/components/collapse/styles.js +6 -1
- package/components/copy/index.d.ts +17 -0
- package/components/copy/index.js +43 -0
- package/components/copy/index.spec.d.ts +1 -0
- package/components/copy/index.spec.js +52 -0
- package/components/copy/index.vdt.js +45 -0
- package/components/copy/styles.d.ts +2 -0
- package/components/copy/styles.js +14 -0
- package/components/copy/useCopy.d.ts +4 -0
- package/components/copy/useCopy.js +90 -0
- package/components/datepicker/index.spec.js +1 -1
- package/components/datepicker/index.vdt.js +1 -1
- package/components/datepicker/styles.d.ts +1 -1
- package/components/datepicker/styles.js +5 -2
- package/components/diagram/shapes/callout.d.ts +1 -1
- package/components/diagram/shapes/circle.d.ts +1 -1
- package/components/diagram/shapes/document.d.ts +1 -1
- package/components/diagram/shapes/ellipse.d.ts +1 -1
- package/components/diagram/shapes/hexagon.d.ts +1 -1
- package/components/diagram/shapes/image.d.ts +1 -1
- package/components/diagram/shapes/parallelogram.d.ts +1 -1
- package/components/diagram/shapes/rectangle.d.ts +1 -1
- package/components/diagram/shapes/square.d.ts +1 -1
- package/components/diagram/shapes/text.d.ts +1 -1
- package/components/dialog/alert.vdt.js +6 -5
- package/components/dialog/base.vdt.js +5 -6
- package/components/dialog/index.spec.js +4 -4
- package/components/dialog/styles.js +16 -14
- package/components/drawer/styles.js +20 -5
- package/components/dropdown/styles.js +1 -1
- package/components/form/index.spec.js +4 -2
- package/components/form/item.vdt.js +2 -1
- package/components/form/styles.js +5 -5
- package/components/grid/useGutter.js +8 -8
- package/components/icon/index.d.ts +1 -0
- package/components/icon/index.js +2 -1
- package/components/icon/index.vdt.js +4 -2
- package/components/icon/styles.js +10 -2
- package/components/input/index.d.ts +1 -0
- package/components/input/index.js +4 -11
- package/components/input/index.vdt.js +4 -2
- package/components/input/styles.js +13 -11
- package/components/message/message.js +1 -1
- package/components/message/message.vdt.js +7 -6
- package/components/message/styles.js +8 -8
- package/components/pagination/index.d.ts +1 -1
- package/components/pagination/index.js +1 -1
- package/components/pagination/index.spec.js +4 -2
- package/components/pagination/index.vdt.js +16 -18
- package/components/pagination/styles.js +12 -3
- package/components/popover/content.d.ts +19 -0
- package/components/popover/content.js +31 -0
- package/components/popover/content.vdt.js +68 -0
- package/components/popover/index.d.ts +16 -0
- package/components/popover/index.js +44 -0
- package/components/popover/index.spec.d.ts +1 -0
- package/components/popover/index.spec.js +195 -0
- package/components/popover/styles.d.ts +1 -0
- package/components/popover/styles.js +22 -0
- package/components/progress/index.js +1 -1
- package/components/progress/index.vdt.js +46 -8
- package/components/progress/styles.js +19 -13
- package/components/radio/styles.js +16 -6
- package/components/rate/styles.js +1 -1
- package/components/select/base.d.ts +5 -2
- package/components/select/base.js +7 -3
- package/components/select/base.vdt.js +46 -38
- package/components/select/index.spec.js +2 -2
- package/components/select/menu.vdt.js +1 -1
- package/components/select/styles.js +14 -28
- package/components/select/useDraggble.d.ts +2 -0
- package/components/select/useDraggble.js +11 -0
- package/components/select/useNowrap.d.ts +3 -0
- package/components/select/useNowrap.js +19 -0
- package/components/slider/index.spec.js +48 -9
- package/components/slider/index.vdt.js +23 -12
- package/components/slider/styles.js +23 -14
- package/components/slider/useValue.d.ts +3 -1
- package/components/slider/useValue.js +12 -0
- package/components/spinner/index.d.ts +0 -1
- package/components/spinner/index.js +1 -19
- package/components/spinner/index.vdt.js +15 -8
- package/components/spinner/styles.js +33 -5
- package/components/spinner/useChange.d.ts +1 -1
- package/components/spinner/useChange.js +2 -2
- package/components/spinner/useValue.d.ts +1 -0
- package/components/spinner/useValue.js +16 -1
- package/components/split/index.vdt.js +32 -20
- package/components/split/memo.d.ts +9 -0
- package/components/split/memo.js +26 -0
- package/components/steps/index.d.ts +3 -2
- package/components/steps/index.js +4 -3
- package/components/steps/index.spec.js +1 -1
- package/components/steps/index.vdt.js +8 -4
- package/components/steps/step.vdt.js +17 -9
- package/components/steps/styles.d.ts +2 -1
- package/components/steps/styles.js +106 -72
- package/components/switch/index.spec.js +82 -65
- package/components/switch/styles.js +20 -34
- package/components/table/styles.js +9 -4
- package/components/table/useDraggable.js +3 -10
- package/components/table/useStickyScrollbar.js +2 -2
- package/components/table/useWidth.js +2 -2
- package/components/tabs/index.d.ts +1 -1
- package/components/tabs/index.js +1 -1
- package/components/tabs/index.spec.js +67 -0
- package/components/tabs/index.vdt.js +5 -5
- package/components/tabs/styles.js +73 -29
- package/components/tabs/useScroll.d.ts +1 -1
- package/components/tabs/useScroll.js +75 -48
- package/components/tag/base.d.ts +1 -0
- package/components/tag/base.js +2 -2
- package/components/tag/index.d.ts +1 -0
- package/components/tag/index.js +2 -1
- package/components/tag/index.spec.js +147 -4
- package/components/tag/styles.d.ts +67 -0
- package/components/tag/styles.js +42 -12
- package/components/tag/tags.d.ts +27 -0
- package/components/tag/tags.js +51 -0
- package/components/tag/tags.vdt.js +79 -0
- package/components/tag/useChildren.d.ts +2 -0
- package/components/tag/useChildren.js +39 -0
- package/components/tag/useDraggable.d.ts +3 -0
- package/components/tag/useDraggable.js +89 -0
- package/components/tag/useNowrap.d.ts +7 -0
- package/components/tag/useNowrap.js +115 -0
- package/components/timepicker/index.spec.js +1 -1
- package/components/tip/index.vdt.js +1 -3
- package/components/tip/styles.js +4 -3
- package/components/tooltip/content.d.ts +2 -2
- package/components/tooltip/content.vdt.js +23 -13
- package/components/tooltip/index.spec.js +56 -108
- package/components/tooltip/styles.d.ts +1 -0
- package/components/tooltip/styles.js +13 -8
- package/components/transfer/index.vdt.js +3 -1
- package/components/transfer/styles.js +1 -1
- package/components/transfer/useCheck.d.ts +1 -0
- package/components/transfer/useCheck.js +8 -1
- package/components/upload/index.spec.js +5 -6
- package/components/upload/index.vdt.js +24 -21
- package/components/upload/styles.js +22 -30
- package/components/utils.d.ts +2 -0
- package/components/utils.js +24 -3
- package/hooks/useResizeObserver.d.ts +1 -1
- package/hooks/useResizeObserver.js +19 -6
- package/i18n/en-US.d.ts +6 -2
- package/i18n/en-US.js +8 -3
- package/index.d.ts +4 -2
- package/index.js +4 -2
- package/package.json +1 -1
- package/styles/fonts/iconfont.eot +0 -0
- package/styles/fonts/iconfont.js +2 -2
- package/styles/fonts/iconfont.svg +189 -369
- package/styles/fonts/iconfont.ttf +0 -0
- package/styles/fonts/iconfont.woff +0 -0
- package/styles/fonts/ionicons.js +2 -2
- package/styles/global.js +1 -1
- package/styles/theme.d.ts +10 -2
- package/styles/theme.js +23 -21
- package/components/table/useResizeObserver.d.ts +0 -2
- package/components/table/useResizeObserver.js +0 -20
|
@@ -14,14 +14,8 @@ var _$tmp0 = {
|
|
|
14
14
|
var _$tmp1 = {
|
|
15
15
|
'viewBox': '0 0 120 120'
|
|
16
16
|
};
|
|
17
|
-
var _$tmp2 = {
|
|
18
|
-
'className': 'k-progress-icon k-icon-truth'
|
|
19
|
-
};
|
|
20
|
-
var _$tmp3 = {
|
|
21
|
-
'className': 'k-progress-icon k-icon-fault'
|
|
22
|
-
};
|
|
23
17
|
export default function ($props, $blocks, $__proto__) {
|
|
24
|
-
var _classNameObj, r, circumference;
|
|
18
|
+
var _classNameObj, r, circumference, icon, _$cn2;
|
|
25
19
|
|
|
26
20
|
$blocks || ($blocks = {});
|
|
27
21
|
$props || ($props = {});
|
|
@@ -75,6 +69,50 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
75
69
|
'stroke-width': strokeWidth,
|
|
76
70
|
'stroke-dasharray': circumference,
|
|
77
71
|
'stroke-dashoffset': circumference
|
|
78
|
-
}) : undefined]), 0, 'k-progress-canvas', _$tmp1) : undefined, children ? _$ce(2, 'div', children, 0, 'k-progress-text') : showOuterText ? _$ce(2, 'div',
|
|
72
|
+
}) : undefined]), 0, 'k-progress-canvas', _$tmp1) : undefined, children ? _$ce(2, 'div', children, 0, 'k-progress-text') : showOuterText ? _$ce(2, 'div', function () {
|
|
73
|
+
if (type !== 'circle') {
|
|
74
|
+
switch (status) {
|
|
75
|
+
case 'success':
|
|
76
|
+
icon = 'k-icon-success-fill';
|
|
77
|
+
break;
|
|
78
|
+
|
|
79
|
+
case 'error':
|
|
80
|
+
icon = 'k-icon-error-fill';
|
|
81
|
+
break;
|
|
82
|
+
|
|
83
|
+
case 'warning':
|
|
84
|
+
icon = 'k-icon-warning-fill';
|
|
85
|
+
break;
|
|
86
|
+
|
|
87
|
+
default:
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
switch (status) {
|
|
92
|
+
case 'success':
|
|
93
|
+
icon = 'k-icon-truth';
|
|
94
|
+
break;
|
|
95
|
+
|
|
96
|
+
case 'error':
|
|
97
|
+
case 'warning':
|
|
98
|
+
icon = 'k-icon-close';
|
|
99
|
+
break;
|
|
100
|
+
|
|
101
|
+
default:
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (icon) {
|
|
107
|
+
return _$cc(Icon, {
|
|
108
|
+
'className': _$cn((_$cn2 = {
|
|
109
|
+
"k-progress-icon": true
|
|
110
|
+
}, _$cn2[icon] = true, _$cn2)),
|
|
111
|
+
'color': status === 'error' ? 'danger' : status
|
|
112
|
+
});
|
|
113
|
+
} else {
|
|
114
|
+
return _$ce(2, 'span', [percent, _$ct('%')], 0);
|
|
115
|
+
}
|
|
116
|
+
}(), 0, 'k-progress-text') : undefined]);
|
|
79
117
|
}
|
|
80
118
|
;
|
|
@@ -9,11 +9,11 @@ import '../../styles/global';
|
|
|
9
9
|
export var types = ['active', 'normal', 'error', 'success', 'warning'];
|
|
10
10
|
var sizes = ['small', 'mini'];
|
|
11
11
|
var progressBarAnimation = /*#__PURE__*/keyframes(process.env.NODE_ENV === "production" ? {
|
|
12
|
-
name: "
|
|
13
|
-
styles: "from{opacity:0.2;width:
|
|
12
|
+
name: "sckwkj",
|
|
13
|
+
styles: "from{opacity:0.2;width:0;}to{opacity:0;width:100%;}"
|
|
14
14
|
} : {
|
|
15
|
-
name: "
|
|
16
|
-
styles: "from{opacity:0.2;width:
|
|
15
|
+
name: "sckwkj",
|
|
16
|
+
styles: "from{opacity:0.2;width:0;}to{opacity:0;width:100%;}",
|
|
17
17
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
18
18
|
});
|
|
19
19
|
var defaults = {
|
|
@@ -41,15 +41,18 @@ var defaults = {
|
|
|
41
41
|
},
|
|
42
42
|
bar: {
|
|
43
43
|
fontColor: '#404040',
|
|
44
|
-
height: '
|
|
44
|
+
height: '8px',
|
|
45
45
|
textWidth: '40px',
|
|
46
46
|
textMarginLeft: '16px',
|
|
47
47
|
innerText: {
|
|
48
48
|
fontSize: '12px',
|
|
49
49
|
padding: "0 10px 0 3px"
|
|
50
50
|
},
|
|
51
|
+
outerText: {
|
|
52
|
+
height: '16px'
|
|
53
|
+
},
|
|
51
54
|
small: {
|
|
52
|
-
height: '
|
|
55
|
+
height: '6px',
|
|
53
56
|
fontSize: '12px'
|
|
54
57
|
},
|
|
55
58
|
mini: {
|
|
@@ -60,13 +63,16 @@ var defaults = {
|
|
|
60
63
|
circle: {
|
|
61
64
|
width: '104px',
|
|
62
65
|
fontSize: '16px',
|
|
66
|
+
iconFontSize: '50px',
|
|
63
67
|
small: {
|
|
64
68
|
width: '80px',
|
|
65
|
-
fontSize: '14px'
|
|
69
|
+
fontSize: '14px',
|
|
70
|
+
iconFontSize: '30px'
|
|
66
71
|
},
|
|
67
72
|
mini: {
|
|
68
|
-
width: '
|
|
69
|
-
fontSize: '
|
|
73
|
+
width: '24px',
|
|
74
|
+
fontSize: '10px',
|
|
75
|
+
iconFontSize: '14px'
|
|
70
76
|
}
|
|
71
77
|
}
|
|
72
78
|
};
|
|
@@ -77,10 +83,10 @@ setDefault(function () {
|
|
|
77
83
|
}).progress;
|
|
78
84
|
});
|
|
79
85
|
export function makeStyles() {
|
|
80
|
-
return /*#__PURE__*/css("position:relative;line-height:1;&.k-bar{display:flex;align-items:center;.k-progress-container{height:", progress.bar.height, ";border-radius:", progress.bar.height, ";background-color:", progress.stokeColor.color, ";overflow:hidden;position:relative;vertical-align:middle;font-size:", progress.bar.innerText.fontSize, ";flex:1;}.k-progress-content{position:relative;left:0;top:0;white-space:nowrap;width:100%;height:100%;border-radius:", progress.bar.height, ";}.k-progress-bg{background-color:", progress.stokeColor.normal, ";height:100%;border-radius:", progress.bar.height, ";transition:", progress.animation.transition, ";position:relative;}.k-progress-inner-text{display:inline-block;vertical-align:
|
|
86
|
+
return /*#__PURE__*/css("position:relative;line-height:1;&.k-bar{display:flex;align-items:center;.k-progress-container{height:", progress.bar.height, ";border-radius:", progress.bar.height, ";background-color:", progress.stokeColor.color, ";overflow:hidden;position:relative;vertical-align:middle;font-size:", progress.bar.innerText.fontSize, ";flex:1;}.k-progress-content{position:relative;left:0;top:0;white-space:nowrap;width:100%;height:100%;border-radius:", progress.bar.height, ";}.k-progress-bg{background-color:", progress.stokeColor.normal, ";height:100%;border-radius:", progress.bar.height, ";transition:", progress.animation.transition, ";position:relative;}.k-progress-inner-text{display:inline-block;vertical-align:top;color:#ffffff;line-height:", progress.bar.height, ";width:100%;text-align:right;padding:", progress.bar.innerText.padding, ";}&.k-success{.k-progress-bg{background:", progress.stokeColor.success, ";}}&.k-error{.k-progress-bg{background:", progress.stokeColor.error, ";}}&.k-warning{.k-progress-bg{background:", progress.stokeColor.warning, ";}}&.k-active{.k-progress-bg{&:before{content:\"\";position:absolute;top:0;bottom:0;right:0;left:0;background-color:#fff;animation:", progressBarAnimation, " 2s ease infinite;border-radius:", progress.bar.height, ";}}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
81
87
|
return /*#__PURE__*/css("&.k-", size, "{font-size:", progress.bar[size].fontSize, ";.k-progress-container{height:", progress.bar[size].height, ";}}");
|
|
82
|
-
}), " .k-progress-text{margin-left:", progress.bar.textMarginLeft, ";width:", progress.bar.textWidth, ";}}&.k-circle{width:", progress.circle.width, ";height:", progress.circle.width, ";font-size:", progress.circle.fontSize, ";", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
88
|
+
}), " .k-progress-text{margin-left:", progress.bar.textMarginLeft, ";width:", progress.bar.textWidth, ";line-height:", progress.bar.outerText.height, ";height:", progress.bar.outerText.height, ";}}&.k-circle{width:", progress.circle.width, ";height:", progress.circle.width, ";font-size:", progress.circle.fontSize, ";", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
83
89
|
var styles = progress.circle[size];
|
|
84
|
-
return /*#__PURE__*/css("&.k-", size, "{width:", styles.width, ";height:", styles.width, ";font-size:", styles.fontSize, ";}");
|
|
85
|
-
}), ";.k-progress-canvas{transform:rotate(-90deg);}.k-progress-meter,.k-progress-value,.k-progress-animate{fill:none;}.k-progress-meter{stroke:", progress.stokeColor.color, ";}.k-progress-value{stroke:", progress.stokeColor.normal, ";stroke-linecap:round;transition:", progress.animation.transition, ";}.k-progress-animate{stroke:#fff;stroke-linecap:round;}.k-progress-text{position:absolute;top:50%;text-align:center;width:100%;transform:translateY(-50%);}&.k-success{.k-progress-value{stroke:", progress.stokeColor.success, ";}}&.k-error{.k-progress-value{stroke:", progress.stokeColor.error, ";}}}");
|
|
90
|
+
return /*#__PURE__*/css("&.k-", size, "{width:", styles.width, ";height:", styles.width, ";font-size:", styles.fontSize, ";.k-progress-icon{font-size:", styles.iconFontSize, ";}}");
|
|
91
|
+
}), ";.k-progress-canvas{transform:rotate(-90deg);}.k-progress-meter,.k-progress-value,.k-progress-animate{fill:none;}.k-progress-meter{stroke:", progress.stokeColor.color, ";}.k-progress-value{stroke:", progress.stokeColor.normal, ";stroke-linecap:round;transition:", progress.animation.transition, ";}.k-progress-animate{stroke:#fff;stroke-linecap:round;}.k-progress-text{position:absolute;top:50%;text-align:center;width:100%;transform:translateY(-50%);}.k-progress-icon{font-size:", progress.circle.iconFontSize, ";}&.k-success{.k-progress-value{stroke:", progress.stokeColor.success, ";}}&.k-error{.k-progress-value{stroke:", progress.stokeColor.error, ";}}&.k-warning{.k-progress-value{stroke:", progress.stokeColor.warning, ";}}}");
|
|
86
92
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { css } from '@emotion/css';
|
|
2
|
-
import { deepDefaults } from '../../styles/utils';
|
|
2
|
+
import { deepDefaults, palette } from '../../styles/utils';
|
|
3
3
|
import { theme, setDefault } from '../../styles/theme';
|
|
4
4
|
import '../../styles/global';
|
|
5
5
|
var defaults = {
|
|
6
|
-
width: '
|
|
6
|
+
width: '16px',
|
|
7
7
|
|
|
8
8
|
get transition() {
|
|
9
9
|
return theme.transition.small;
|
|
@@ -38,10 +38,20 @@ var defaults = {
|
|
|
38
38
|
return theme.color.disabledBg;
|
|
39
39
|
},
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
checked: {
|
|
42
|
+
get borderColor() {
|
|
43
|
+
return palette(theme.color.primary, -2);
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
get bgColor() {
|
|
47
|
+
return palette(theme.color.primary, -4);
|
|
48
|
+
},
|
|
44
49
|
|
|
50
|
+
get innerColor() {
|
|
51
|
+
return palette(theme.color.primary, -3);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
}
|
|
45
55
|
}
|
|
46
56
|
};
|
|
47
57
|
var radio;
|
|
@@ -51,5 +61,5 @@ setDefault(function () {
|
|
|
51
61
|
}).radio;
|
|
52
62
|
});
|
|
53
63
|
export function makeStyles() {
|
|
54
|
-
return /*#__PURE__*/css("display:inline-flex;align-items:center;cursor:pointer;vertical-align:middle;.k-radio-wrapper{width:", radio.width, ";height:", radio.width, ";border:1px solid ", radio.borderColor, ";border-radius:50%;transition:all ", radio.transition, ";position:relative;background:", radio.bgColor, ";flex:0 0 auto;&:before{content:\"\";display:block;position:absolute;width:", radio.innerWidth, ";height:", radio.innerWidth, ";top:50%;left:50%;margin-left:calc(-", radio.innerWidth, " / 2);margin-top:calc(-", radio.innerWidth, " / 2);border-radius:50%;background-color:", radio.checkedColor, ";transform:scale(0);transition:all ", radio.transition, ";}}input{width:100%;height:100%;opacity:0;cursor:pointer;position:absolute;}.k-radio-text{margin-left:", radio.textGap, ";flex:0 1 auto;}&.k-checked{.k-radio-wrapper{border-color:", radio.checkedColor, ";&:before{transform:scale(1);}}}&:focus{outline:none;.k-radio-wrapper{border-color:", radio.checkedColor, ";}}&.k-disabled{color:", radio.disabled.color, ";cursor:not-allowed;.k-radio-wrapper{border-color:", radio.disabled.borderColor, ";background:", radio.disabled.bgColor, ";&:before{background:", radio.disabled.innerColor, ";}}
|
|
64
|
+
return /*#__PURE__*/css("display:inline-flex;align-items:center;cursor:pointer;vertical-align:middle;.k-radio-wrapper{width:", radio.width, ";height:", radio.width, ";border:1px solid ", radio.borderColor, ";border-radius:50%;transition:all ", radio.transition, ";position:relative;background:", radio.bgColor, ";flex:0 0 auto;&:before{content:\"\";display:block;position:absolute;width:", radio.innerWidth, ";height:", radio.innerWidth, ";top:50%;left:50%;margin-left:calc(-", radio.innerWidth, " / 2);margin-top:calc(-", radio.innerWidth, " / 2);border-radius:50%;background-color:", radio.checkedColor, ";transform:scale(0);transition:all ", radio.transition, ";}&:hover{border:1px solid ", radio.hoverBorderColor, ";}}input{width:100%;height:100%;opacity:0;cursor:pointer;position:absolute;}.k-radio-text{margin-left:", radio.textGap, ";flex:0 1 auto;}&.k-checked{.k-radio-wrapper{border-color:", radio.checkedColor, ";&:before{transform:scale(1);}}}&:focus{outline:none;.k-radio-wrapper{border-color:", radio.checkedColor, ";}}&.k-disabled{color:", radio.disabled.color, ";cursor:not-allowed;.k-radio-wrapper{border-color:", radio.disabled.borderColor, ";background:", radio.disabled.bgColor, ";}input{cursor:not-allowed;}&.k-checked{.k-radio-wrapper{border-color:", radio.disabled.checked.borderColor, ";background:", radio.disabled.checked.bgColor, ";&:before{background:", radio.disabled.checked.innerColor, ";}}}}");
|
|
55
65
|
}
|
|
@@ -26,5 +26,5 @@ setDefault(function () {
|
|
|
26
26
|
}).rate;
|
|
27
27
|
});
|
|
28
28
|
export function makeStyles() {
|
|
29
|
-
return /*#__PURE__*/css("display:inline-block;.k-rate-item{display:inline-block;margin-right:", rate.item.gap, ";cursor:pointer;position:relative;color:", rate.color, ";transition:all ", rate.transition, ";&:hover{transform:", rate.item.hoverTransform, ";}&.k-full{color:", rate.activeColor, ";}&.k-half{.k-rate-first{color:", rate.activeColor, ";}}}.k-rate-first{position:absolute;top:0;left:0;width:50%;height:100%;overflow:hidden;}.k-icon{font-size:", rate.iconFontSize, ";}&.k-disabled{.k-rate-item{cursor:default;&:hover{transform:none;}}}");
|
|
29
|
+
return /*#__PURE__*/css("display:inline-block;.k-rate-item{display:inline-block;margin-right:", rate.item.gap, ";cursor:pointer;position:relative;color:", rate.color, ";transition:all ", rate.transition, ";&:hover{transform:", rate.item.hoverTransform, ";}&.k-full{color:", rate.activeColor, ";}&.k-half{.k-rate-first{color:", rate.activeColor, ";}}}.k-rate-first{position:absolute;top:0;left:0;width:50%;height:100%;overflow:hidden;}.k-icon{font-size:", rate.iconFontSize, ";color:inherit;}&.k-disabled{.k-rate-item{cursor:default;&:hover{transform:none;}}}");
|
|
30
30
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Component, Children, TypeDefs, RefObject } from 'intact-react';
|
|
2
2
|
import { Sizes } from '../../styles/utils';
|
|
3
|
-
import type { Input } from '../input';
|
|
4
3
|
import { Dropdown, DropdownProps } from '../dropdown';
|
|
5
4
|
import { State } from '../../hooks/useState';
|
|
6
5
|
import { Container } from '../portal';
|
|
@@ -22,6 +21,9 @@ export interface BaseSelectProps<V, Multipe extends boolean = boolean, Attach =
|
|
|
22
21
|
width?: string | number;
|
|
23
22
|
show?: boolean;
|
|
24
23
|
position?: DropdownProps['position'];
|
|
24
|
+
flat?: boolean;
|
|
25
|
+
nowrap?: boolean;
|
|
26
|
+
draggable?: boolean;
|
|
25
27
|
}
|
|
26
28
|
export interface BaseSelectEvents {
|
|
27
29
|
keydown: [KeyboardEvent];
|
|
@@ -45,9 +47,10 @@ export declare abstract class BaseSelect<T extends BaseSelectProps<any> = BaseSe
|
|
|
45
47
|
input: {
|
|
46
48
|
onInput: (value: string) => void;
|
|
47
49
|
keywords: State<string>;
|
|
48
|
-
inputRef: RefObject<Input<string | number>>;
|
|
50
|
+
inputRef: RefObject<import("../input").Input<string | number>>;
|
|
49
51
|
};
|
|
50
52
|
private focusout;
|
|
53
|
+
private draggable;
|
|
51
54
|
init(): void;
|
|
52
55
|
protected abstract getPlaceholder(): Children;
|
|
53
56
|
protected abstract getLabel(): Children;
|
|
@@ -13,6 +13,7 @@ import { Dropdown } from '../dropdown';
|
|
|
13
13
|
import { useInput } from './useInput';
|
|
14
14
|
import { useFocusout } from './useFocusout';
|
|
15
15
|
import { isNullOrUndefined } from 'intact-shared';
|
|
16
|
+
import { useDraggable } from './useDraggble';
|
|
16
17
|
var typeDefs = {
|
|
17
18
|
value: null,
|
|
18
19
|
multiple: Boolean,
|
|
@@ -29,7 +30,10 @@ var typeDefs = {
|
|
|
29
30
|
container: [Function, String],
|
|
30
31
|
width: [String, Number],
|
|
31
32
|
show: Boolean,
|
|
32
|
-
position: Dropdown.typeDefs.position
|
|
33
|
+
position: Dropdown.typeDefs.position,
|
|
34
|
+
flat: Boolean,
|
|
35
|
+
nowrap: Boolean,
|
|
36
|
+
draggable: Boolean
|
|
33
37
|
};
|
|
34
38
|
|
|
35
39
|
var defaults = function defaults() {
|
|
@@ -60,6 +64,7 @@ export var BaseSelect = /*#__PURE__*/function (_Component) {
|
|
|
60
64
|
_this.dropdownRef = createRef();
|
|
61
65
|
_this.input = useInput(_this.resetKeywords);
|
|
62
66
|
_this.focusout = useFocusout();
|
|
67
|
+
_this.draggable = useDraggable();
|
|
63
68
|
return _this;
|
|
64
69
|
}
|
|
65
70
|
|
|
@@ -67,8 +72,7 @@ export var BaseSelect = /*#__PURE__*/function (_Component) {
|
|
|
67
72
|
|
|
68
73
|
_proto.init = function init() {
|
|
69
74
|
provide(SELECT, this);
|
|
70
|
-
useShowHideEvents('show');
|
|
71
|
-
|
|
75
|
+
useShowHideEvents('show');
|
|
72
76
|
this.watch('value', this.position, {
|
|
73
77
|
presented: true
|
|
74
78
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
|
+
import _flatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/flat";
|
|
2
3
|
import _valuesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/values";
|
|
3
4
|
import { createUnknownComponentVNode as _$cc, createVNode as _$cv, className as _$cn, createElementVNode as _$ce, noop as _$no, map as _$ma } from 'intact-react';
|
|
4
5
|
import { TransitionGroup, Transition } from 'intact';
|
|
@@ -10,6 +11,7 @@ import { Dropdown } from '../dropdown';
|
|
|
10
11
|
import { getRestProps, addStyle } from '../utils';
|
|
11
12
|
import { Wave } from '../wave';
|
|
12
13
|
import { context as ErrorContext } from '../form/useError';
|
|
14
|
+
import { Tags, Tag } from '../tag';
|
|
13
15
|
var _$tmp0 = {
|
|
14
16
|
'className': 'ion-load-c',
|
|
15
17
|
'rotate': true
|
|
@@ -41,12 +43,15 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
41
43
|
style = _this$get.style,
|
|
42
44
|
width = _this$get.width,
|
|
43
45
|
show = _this$get.show,
|
|
44
|
-
position = _this$get.position
|
|
46
|
+
position = _this$get.position,
|
|
47
|
+
flat = _flatInstanceProperty(_this$get),
|
|
48
|
+
nowrap = _this$get.nowrap,
|
|
49
|
+
draggable = _this$get.draggable;
|
|
45
50
|
|
|
46
51
|
var classNameObj = (_classNameObj = {
|
|
47
52
|
'k-select': true,
|
|
48
53
|
'k-disabled': disabled
|
|
49
|
-
}, _classNameObj["k-" + size] = size !== 'default', _classNameObj['k-fluid'] = fluid, _classNameObj['k-inline'] = inline, _classNameObj[className] = className, _classNameObj[$props.className] = $props.className, _classNameObj[makeStyles()] = true, _classNameObj);
|
|
54
|
+
}, _classNameObj["k-" + size] = size !== 'default', _classNameObj['k-fluid'] = fluid, _classNameObj['k-inline'] = inline, _classNameObj['k-flat'] = flat, _classNameObj['k-nowrap'] = nowrap, _classNameObj[className] = className, _classNameObj[$props.className] = $props.className, _classNameObj[makeStyles()] = true, _classNameObj);
|
|
50
55
|
var placeholder = this.getPlaceholder();
|
|
51
56
|
var label = this.getLabel();
|
|
52
57
|
var hasValue = this.hasValue();
|
|
@@ -106,7 +111,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
106
111
|
'inline': true,
|
|
107
112
|
'key': 'input',
|
|
108
113
|
'readonly': !show,
|
|
109
|
-
'waveDisabled': true
|
|
114
|
+
'waveDisabled': true,
|
|
115
|
+
'flat': flat
|
|
110
116
|
}, 'input', inputRef) : !filterable && !hasValue ? _$ce(2, 'div', placeholder, 0, 'k-select-placeholder c-ellipsis', null, 'placeholder') : !multiple ? _$ce(2, 'div', (_$blocks['value'] = function ($super) {
|
|
111
117
|
return label;
|
|
112
118
|
}, __$blocks['value'] = function ($super, data) {
|
|
@@ -117,36 +123,42 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
117
123
|
};
|
|
118
124
|
|
|
119
125
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
120
|
-
}, __$blocks['value'](_$no, [value, label])), 0, 'k-select-value c-ellipsis', null, 'value') : _$ce(2, 'div', [_$
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
}, __$blocks['value'](_$no, [value, label])), 0, 'k-select-value c-ellipsis', null, 'value') : _$ce(2, 'div', [(_$blocks['values'] = function ($super) {
|
|
127
|
+
return label && label.length ? _$cc(Tags, {
|
|
128
|
+
'nowrap': nowrap,
|
|
129
|
+
'size': size,
|
|
130
|
+
'draggable': draggable,
|
|
131
|
+
'ev-dragend': this.draggable,
|
|
132
|
+
'children': _$ma(label, function ($label, $key) {
|
|
133
|
+
return _$cc(Tag, {
|
|
134
|
+
'key': isStringOrNumber($label) ? $label : isStringOrNumber(value[$key]) ? value[$key] : $key,
|
|
135
|
+
'closable': true,
|
|
136
|
+
'ev-close': this.delete.bind(this, $key),
|
|
137
|
+
'disabled': disabled,
|
|
138
|
+
'size': size,
|
|
139
|
+
'children': (_$blocks['value'] = function ($super) {
|
|
140
|
+
return $label;
|
|
141
|
+
}, __$blocks['value'] = function ($super, data) {
|
|
142
|
+
var block = $blocks['value'];
|
|
128
143
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
144
|
+
var callBlock = function callBlock() {
|
|
145
|
+
return _$blocks['value'].call($this, $super, data);
|
|
146
|
+
};
|
|
132
147
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}, __$blocks['values'] = function ($super, data) {
|
|
141
|
-
var block = _valuesInstanceProperty($blocks);
|
|
148
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
149
|
+
}, __$blocks['value'](_$no, [value[$key], $label]))
|
|
150
|
+
}, isStringOrNumber($label) ? $label : isStringOrNumber(value[$key]) ? value[$key] : $key);
|
|
151
|
+
}, $this)
|
|
152
|
+
}) : undefined;
|
|
153
|
+
}, __$blocks['values'] = function ($super, data) {
|
|
154
|
+
var block = _valuesInstanceProperty($blocks);
|
|
142
155
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
156
|
+
var callBlock = function callBlock() {
|
|
157
|
+
return _valuesInstanceProperty(_$blocks).call($this, $super, data);
|
|
158
|
+
};
|
|
146
159
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}), filterable ? _$cc(Input, {
|
|
160
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
161
|
+
}, _valuesInstanceProperty(__$blocks).call(__$blocks, _$no, [value, label])), filterable ? _$cc(Input, {
|
|
150
162
|
'className': 'k-select-input',
|
|
151
163
|
'value': keywords,
|
|
152
164
|
'ev-$change:value': onInput,
|
|
@@ -158,11 +170,9 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
158
170
|
'size': size,
|
|
159
171
|
'key': 'filter',
|
|
160
172
|
'readonly': !show,
|
|
161
|
-
'waveDisabled': true
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
"k-with-values": _valuesInstanceProperty($blocks)
|
|
165
|
-
}), null, 'values')
|
|
173
|
+
'waveDisabled': true,
|
|
174
|
+
'flat': flat
|
|
175
|
+
}, 'filter', inputRef) : undefined], 0, 'k-select-values', null, 'values')
|
|
166
176
|
})], 0, 'k-select-main'), !hideIcon || clearable || loading || $blocks.suffix ? _$ce(2, 'span', [clearable && !disabled ? _$cc(Icon, {
|
|
167
177
|
'className': _$cn({
|
|
168
178
|
"k-select-clear ion-ios-close": true,
|
|
@@ -172,10 +182,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
172
182
|
'hoverable': true
|
|
173
183
|
}) : undefined, _$ce(2, 'span', (_$blocks['suffix'] = function ($super) {
|
|
174
184
|
return loading ? _$cc(Icon, _$tmp0) : !hideIcon ? _$cc(Icon, {
|
|
175
|
-
'className':
|
|
176
|
-
|
|
177
|
-
'k-disabled': $props.isDisableArrow
|
|
178
|
-
})
|
|
185
|
+
'className': 'k-select-arrow ion-ios-arrow-down',
|
|
186
|
+
'disabled': $props.isDisableArrow
|
|
179
187
|
}) : undefined;
|
|
180
188
|
}, __$blocks['suffix'] = function ($super, data) {
|
|
181
189
|
var block = $blocks['suffix'];
|
|
@@ -73,7 +73,7 @@ describe('Select', function () {
|
|
|
73
73
|
case 5:
|
|
74
74
|
dropdown = getElement('.k-select-menu');
|
|
75
75
|
expect(dropdown.innerHTML).to.matchSnapshot();
|
|
76
|
-
close = element.querySelector('.k-
|
|
76
|
+
close = element.querySelector('.k-tag-close');
|
|
77
77
|
close.click();
|
|
78
78
|
_context2.next = 11;
|
|
79
79
|
return wait();
|
|
@@ -180,7 +180,7 @@ describe('Select', function () {
|
|
|
180
180
|
expect(dropdown.innerHTML).to.matchSnapshot();
|
|
181
181
|
expect(instance.get('days')).to.eql(['Monday', 'Tuesday']); // delete
|
|
182
182
|
|
|
183
|
-
deleteBtn = element.querySelector('.k-
|
|
183
|
+
deleteBtn = element.querySelector('.k-tag-close');
|
|
184
184
|
deleteBtn.click();
|
|
185
185
|
_context5.next = 17;
|
|
186
186
|
return wait();
|
|
@@ -46,7 +46,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
46
46
|
|
|
47
47
|
children = [_$cc(Tabs, {
|
|
48
48
|
'vertical': true,
|
|
49
|
-
'type': '
|
|
49
|
+
'type': 'card',
|
|
50
50
|
'value': activeIndex.value,
|
|
51
51
|
'ev-$change:value': activeIndex.set,
|
|
52
52
|
'children': _$ma(labels, function ($value, $key) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
2
|
+
import _flatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/flat";
|
|
2
3
|
import { css } from '@emotion/css';
|
|
3
4
|
import { theme, setDefault } from '../../styles/theme';
|
|
4
5
|
import { deepDefaults, sizes, getRight, getLeft } from '../../styles/utils';
|
|
@@ -33,10 +34,6 @@ var defaults = deepDefaults({
|
|
|
33
34
|
return "1px solid " + theme.color.primary;
|
|
34
35
|
},
|
|
35
36
|
|
|
36
|
-
get iconColor() {
|
|
37
|
-
return theme.color.placeholder;
|
|
38
|
-
},
|
|
39
|
-
|
|
40
37
|
get activeColor() {
|
|
41
38
|
return theme.color.primary;
|
|
42
39
|
},
|
|
@@ -46,7 +43,6 @@ var defaults = deepDefaults({
|
|
|
46
43
|
},
|
|
47
44
|
|
|
48
45
|
suffixGap: '10px',
|
|
49
|
-
disabledArrowColor: '#e5e5e5',
|
|
50
46
|
clearGap: "8px",
|
|
51
47
|
|
|
52
48
|
get placeholderColor() {
|
|
@@ -94,7 +90,7 @@ var defaults = deepDefaults({
|
|
|
94
90
|
},
|
|
95
91
|
tag: {
|
|
96
92
|
margin: "3px 8px 3px 0",
|
|
97
|
-
padding: "
|
|
93
|
+
padding: "1px 8px",
|
|
98
94
|
|
|
99
95
|
get borderRadius() {
|
|
100
96
|
return theme.borderRadius;
|
|
@@ -104,13 +100,13 @@ var defaults = deepDefaults({
|
|
|
104
100
|
return theme.color.bg;
|
|
105
101
|
},
|
|
106
102
|
|
|
107
|
-
disabledBgColor: '#
|
|
103
|
+
disabledBgColor: '#f8f9fa',
|
|
108
104
|
delete: {
|
|
109
105
|
gap: "8px",
|
|
110
106
|
fontSize: '14px',
|
|
111
107
|
|
|
112
108
|
get color() {
|
|
113
|
-
return theme.color.
|
|
109
|
+
return theme.color.lightBlack;
|
|
114
110
|
}
|
|
115
111
|
|
|
116
112
|
}
|
|
@@ -146,6 +142,13 @@ var defaults = deepDefaults({
|
|
|
146
142
|
gap: "8px",
|
|
147
143
|
btnGap: "8px"
|
|
148
144
|
}
|
|
145
|
+
},
|
|
146
|
+
// flat
|
|
147
|
+
flat: {
|
|
148
|
+
get color() {
|
|
149
|
+
return theme.color.lightBlack;
|
|
150
|
+
}
|
|
151
|
+
|
|
149
152
|
}
|
|
150
153
|
}, sizes.reduce(function (memo, size) {
|
|
151
154
|
memo[size] = {
|
|
@@ -159,26 +162,9 @@ var defaults = deepDefaults({
|
|
|
159
162
|
|
|
160
163
|
get fontSize() {
|
|
161
164
|
return theme[size].fontSize;
|
|
162
|
-
}
|
|
165
|
+
}
|
|
163
166
|
|
|
164
|
-
multipleGap: "1px",
|
|
165
|
-
multipleMargin: "0 2px 1px 0"
|
|
166
167
|
};
|
|
167
|
-
|
|
168
|
-
if (size === 'large') {
|
|
169
|
-
// use default padding for large size
|
|
170
|
-
Object.defineProperty(memo.large, 'padding', {
|
|
171
|
-
get: function get() {
|
|
172
|
-
return "0 " + theme.default.padding;
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
Object.defineProperty(memo.large, 'fontSize', {
|
|
176
|
-
get: function get() {
|
|
177
|
-
return theme.default.fontSize;
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
|
|
182
168
|
return memo;
|
|
183
169
|
}, {}));
|
|
184
170
|
var select;
|
|
@@ -188,12 +174,12 @@ setDefault(function () {
|
|
|
188
174
|
}).select;
|
|
189
175
|
});
|
|
190
176
|
export default function makeStyles() {
|
|
191
|
-
return /*#__PURE__*/css("display:inline-flex;align-items:center;vertical-align:middle;position:relative;width:", select.width, ";cursor:pointer;outline:none;border:", select.border, ";background:", select.bgColor, ";transition:border ", select.transition, ",background ", select.transition, ",box-shadow ", select.transition, ";border-radius:", select.borderRadius, ";.k-select-main{flex:1;min-width:0;}.k-select-prefix,.k-select-suffix{
|
|
177
|
+
return /*#__PURE__*/css("display:inline-flex;align-items:center;vertical-align:middle;position:relative;width:", select.width, ";cursor:pointer;outline:none;border:", select.border, ";background:", select.bgColor, ";transition:border ", select.transition, ",background ", select.transition, ",box-shadow ", select.transition, ";border-radius:", select.borderRadius, ";.k-select-main{flex:1;min-width:0;}.k-select-prefix,.k-select-suffix{position:relative;}.k-select-suffix{margin-left:", select.suffixGap, ";}.k-select-placeholder{color:", select.placeholderColor, ";user-select:none;}.k-input .k-input-inner{background:transparent;}&.k-fluid{width:100%;}.k-select-clear{opacity:0;transition:opacity ", select.transition, ",color ", select.transition, "!important;pointer-events:none;position:absolute;z-index:1;top:50%;left:50%;transform:translate(-50%, -50%);}&:hover{border:", select.hoverBorder, ";.k-select-clear.k-show{opacity:1;pointer-events:all;+.k-select-suffix-icon{opacity:0;}}}.k-select-suffix-icon{display:inline-block;transition:opacity ", select.transition, ";}.k-select-arrow{display:inline-block;transition:transform ", select.transition, ";}&.k-dropdown-open{border:", select.focusBorder, ";.k-select-arrow{transform:rotateX(180deg);}}&:focus{outline:none;border:", select.focusBorder, ";}.k-tags{padding:3px 0;}.k-tag{word-break:break-word;height:auto;}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
192
178
|
var styles = select[size];
|
|
193
179
|
var className = /*#__PURE__*/css("font-size:", styles.fontSize, ";min-height:", styles.height, ";padding:", styles.padding, ";");
|
|
194
180
|
if (size === 'default') return className;
|
|
195
181
|
return /*#__PURE__*/css("&.k-", size, "{", className, ";}");
|
|
196
|
-
}), "&.k-inline{width:auto;border:none;min-height:0;background:transparent;.k-select-placeholder,.k-select-value{line-height:inherit;}}");
|
|
182
|
+
}), "&.k-inline{width:auto;border:none;min-height:0;background:transparent;.k-select-placeholder,.k-select-value{line-height:inherit;}}&.k-flat{border:none;background:", theme.color.bg, ";color:", _flatInstanceProperty(defaults).color, ";.k-tag{background:", select.tag.disabledBgColor, ";}}&.k-disabled{color:", select.disabled.color, ";cursor:not-allowed;background:", select.disabled.bgColor, ";border-color:", select.disabled.borderColor, ";.k-tag{background:", select.tag.disabledBgColor, ";}}&.k-nowrap{.k-select-values{display:flex;align-items:center;}.k-tags{flex:1;}.k-select-text{white-space:nowrap;overflow:hidden;text-overlay:ellipsis;}}");
|
|
197
183
|
}
|
|
198
184
|
export function makeMenuStyles() {
|
|
199
185
|
var searchable = select.searchable;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useInstance } from 'intact-react';
|
|
2
|
+
import { swap } from '../utils';
|
|
3
|
+
export function useDraggable() {
|
|
4
|
+
var instance = useInstance();
|
|
5
|
+
return function onEnd(_ref) {
|
|
6
|
+
var key = _ref.key,
|
|
7
|
+
from = _ref.from,
|
|
8
|
+
to = _ref.to;
|
|
9
|
+
instance.set('value', swap(instance.get('value'), from, to));
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useInstance, createRef } from 'intact-react';
|
|
2
|
+
export function useNowrap() {
|
|
3
|
+
var instance = useInstance();
|
|
4
|
+
var containerRef = createRef();
|
|
5
|
+
instance.watch('value', refresh, {
|
|
6
|
+
presented: true
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
function refresh() {
|
|
10
|
+
if (!instance.get('multiple')) return;
|
|
11
|
+
var container = containerRef.value;
|
|
12
|
+
var width = container.getBoundingClientRect().width;
|
|
13
|
+
console.log('aaa', width);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
containerRef: containerRef
|
|
18
|
+
};
|
|
19
|
+
}
|