@king-design/vue 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__/Vue Next Demos.md +441 -313
- package/__tests__/index.ts +4 -4
- 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
|
@@ -80,15 +80,15 @@ describe('Slider', function () {
|
|
|
80
80
|
}, _callee);
|
|
81
81
|
})));
|
|
82
82
|
it('range test', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
83
|
-
var _mount2, instance, element, windowWidth, _element$querySelecto2, first, second, wrapper;
|
|
83
|
+
var _mount2, instance, element, windowWidth, _element$querySelecto2, first, second, wrapper, increaseBtn, decreaseBtn, _element$querySelecto3, firstInput, secondInput;
|
|
84
84
|
|
|
85
85
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
86
86
|
while (1) {
|
|
87
87
|
switch (_context2.prev = _context2.next) {
|
|
88
88
|
case 0:
|
|
89
|
-
_mount2 = mount(RangeDemo), instance = _mount2[0], element = _mount2[1];
|
|
90
|
-
windowWidth = 800; //document.documentElement.clientWidth;
|
|
89
|
+
_mount2 = mount(RangeDemo), instance = _mount2[0], element = _mount2[1]; // const windowWidth = 800; //document.documentElement.clientWidth;
|
|
91
90
|
|
|
91
|
+
windowWidth = element.querySelector('.k-slider-main').clientWidth;
|
|
92
92
|
_element$querySelecto2 = element.querySelectorAll('.k-slider-thumb'), first = _element$querySelecto2[0], second = _element$querySelecto2[1]; // drag
|
|
93
93
|
|
|
94
94
|
dispatchEvent(first, 'mousedown', {
|
|
@@ -145,9 +145,48 @@ describe('Slider', function () {
|
|
|
145
145
|
return wait();
|
|
146
146
|
|
|
147
147
|
case 33:
|
|
148
|
-
expect(instance.get('values')).eql([1, 1]);
|
|
148
|
+
expect(instance.get('values')).eql([1, 1]); // increase first value
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
increaseBtn = element.querySelector('.k-right');
|
|
151
|
+
increaseBtn.click();
|
|
152
|
+
_context2.next = 38;
|
|
153
|
+
return wait();
|
|
154
|
+
|
|
155
|
+
case 38:
|
|
156
|
+
expect(instance.get('values')).eql([2, 2]); // should disable second spinner's decrease button
|
|
157
|
+
|
|
158
|
+
decreaseBtn = element.querySelector('.k-spinner:last-of-type .k-left');
|
|
159
|
+
decreaseBtn.click();
|
|
160
|
+
_context2.next = 43;
|
|
161
|
+
return wait();
|
|
162
|
+
|
|
163
|
+
case 43:
|
|
164
|
+
expect(instance.get('values')).eql([2, 2]); // input value
|
|
165
|
+
|
|
166
|
+
_element$querySelecto3 = element.querySelectorAll('.k-input-inner'), firstInput = _element$querySelecto3[0], secondInput = _element$querySelecto3[1];
|
|
167
|
+
dispatchEvent(firstInput, 'focusin');
|
|
168
|
+
firstInput.value = '5';
|
|
169
|
+
dispatchEvent(firstInput, 'input');
|
|
170
|
+
firstInput.value = '50';
|
|
171
|
+
dispatchEvent(firstInput, 'input');
|
|
172
|
+
dispatchEvent(firstInput, 'change');
|
|
173
|
+
dispatchEvent(secondInput, 'focusin');
|
|
174
|
+
_context2.next = 54;
|
|
175
|
+
return wait();
|
|
176
|
+
|
|
177
|
+
case 54:
|
|
178
|
+
secondInput.value = '6';
|
|
179
|
+
dispatchEvent(secondInput, 'input');
|
|
180
|
+
secondInput.value = '60';
|
|
181
|
+
dispatchEvent(secondInput, 'input');
|
|
182
|
+
dispatchEvent(secondInput, 'change');
|
|
183
|
+
_context2.next = 61;
|
|
184
|
+
return wait();
|
|
185
|
+
|
|
186
|
+
case 61:
|
|
187
|
+
expect(instance.get('values')).eql([50, 60]);
|
|
188
|
+
|
|
189
|
+
case 62:
|
|
151
190
|
case "end":
|
|
152
191
|
return _context2.stop();
|
|
153
192
|
}
|
|
@@ -155,14 +194,14 @@ describe('Slider', function () {
|
|
|
155
194
|
}, _callee2);
|
|
156
195
|
})));
|
|
157
196
|
it('keyboard operation for basic', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
158
|
-
var _mount3, instance, element, _element$
|
|
197
|
+
var _mount3, instance, element, _element$querySelecto4, slider, handle;
|
|
159
198
|
|
|
160
199
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
161
200
|
while (1) {
|
|
162
201
|
switch (_context3.prev = _context3.next) {
|
|
163
202
|
case 0:
|
|
164
203
|
_mount3 = mount(BasicDemo), instance = _mount3[0], element = _mount3[1];
|
|
165
|
-
_element$
|
|
204
|
+
_element$querySelecto4 = element.querySelectorAll('.k-slider'), slider = _element$querySelecto4[1];
|
|
166
205
|
handle = slider.querySelector('.k-slider-thumb');
|
|
167
206
|
dispatchEvent(handle, 'focusin');
|
|
168
207
|
dispatchEvent(handle, 'keydown', {
|
|
@@ -198,14 +237,14 @@ describe('Slider', function () {
|
|
|
198
237
|
}, _callee3);
|
|
199
238
|
})));
|
|
200
239
|
it('keyboard operation for range', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
201
|
-
var _mount4, instance, element, _element$
|
|
240
|
+
var _mount4, instance, element, _element$querySelecto5, first, second;
|
|
202
241
|
|
|
203
242
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
204
243
|
while (1) {
|
|
205
244
|
switch (_context4.prev = _context4.next) {
|
|
206
245
|
case 0:
|
|
207
246
|
_mount4 = mount(RangeDemo), instance = _mount4[0], element = _mount4[1];
|
|
208
|
-
_element$
|
|
247
|
+
_element$querySelecto5 = element.querySelectorAll('.k-slider-thumb'), first = _element$querySelecto5[0], second = _element$querySelecto5[1];
|
|
209
248
|
instance.set('values', [50, 51]);
|
|
210
249
|
_context4.next = 5;
|
|
211
250
|
return wait();
|
|
@@ -48,7 +48,10 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
48
48
|
thumbFirstStyle = _this$styles.thumbFirstStyle,
|
|
49
49
|
thumbSecondStyle = _this$styles.thumbSecondStyle;
|
|
50
50
|
|
|
51
|
-
var
|
|
51
|
+
var _this$value = this.value,
|
|
52
|
+
onSpinnerChange = _this$value.onSpinnerChange,
|
|
53
|
+
onLeftSpinnerChange = _this$value.onLeftSpinnerChange,
|
|
54
|
+
onRightSpinnerChange = _this$value.onRightSpinnerChange;
|
|
52
55
|
var _this$keyboard = this.keyboard,
|
|
53
56
|
onKeydown = _this$keyboard.onKeydown,
|
|
54
57
|
onKeyup = _this$keyboard.onKeyup;
|
|
@@ -137,16 +140,24 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
137
140
|
'ev-click': linkEvent(min, setOneValue)
|
|
138
141
|
}), _$ce(2, 'span', max + unit, 0, null, {
|
|
139
142
|
'ev-click': linkEvent(max, setOneValue)
|
|
140
|
-
})], 4, 'k-slider-ends') : undefined], 0, 'k-slider-main'), showInput
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
143
|
+
})], 4, 'k-slider-ends') : undefined], 0, 'k-slider-main'), showInput ? _$ce(2, 'div', function () {
|
|
144
|
+
var props = {
|
|
145
|
+
disabled: disabled,
|
|
146
|
+
min: min,
|
|
147
|
+
max: max,
|
|
148
|
+
step: step || 0.01,
|
|
149
|
+
vertical: true,
|
|
150
|
+
suffix: unit,
|
|
151
|
+
forceStep: !!step && forceStep
|
|
152
|
+
};
|
|
153
|
+
return [_$cc(Spinner, _extends({}, props, {
|
|
154
|
+
'value': range ? value[0] : value,
|
|
155
|
+
'ev-$change:value': range ? onLeftSpinnerChange : onSpinnerChange
|
|
156
|
+
}, spinnerProps)), range ? [_$ce(2, 'span', '-', 16, 'k-slider-spinner-sep'), _$cc(Spinner, _extends({}, props, {
|
|
157
|
+
'min': value[0],
|
|
158
|
+
'value': range ? value[1] : value,
|
|
159
|
+
'ev-$change:value': onRightSpinnerChange
|
|
160
|
+
}, spinnerProps))] : undefined];
|
|
161
|
+
}(), 0, 'k-slider-spinner') : undefined]);
|
|
151
162
|
}
|
|
152
163
|
;
|
|
@@ -7,27 +7,38 @@ var defaults = {
|
|
|
7
7
|
return theme.transition.middle;
|
|
8
8
|
},
|
|
9
9
|
|
|
10
|
-
height: '
|
|
11
|
-
bgColor: '#
|
|
10
|
+
height: '6px',
|
|
11
|
+
bgColor: '#F0F2F4',
|
|
12
12
|
|
|
13
13
|
get barColor() {
|
|
14
14
|
return theme.color.primary;
|
|
15
15
|
},
|
|
16
16
|
|
|
17
|
-
borderRadius
|
|
17
|
+
get borderRadius() {
|
|
18
|
+
return theme.borderRadius;
|
|
19
|
+
},
|
|
20
|
+
|
|
18
21
|
thumb: {
|
|
19
22
|
height: '12px',
|
|
20
23
|
width: '12px',
|
|
21
24
|
|
|
22
25
|
get border() {
|
|
23
|
-
return "
|
|
26
|
+
return "3px solid #fff";
|
|
24
27
|
},
|
|
25
28
|
|
|
26
29
|
borderRadius: '50%',
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
|
|
31
|
+
get bgColor() {
|
|
32
|
+
return slider.barColor;
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
hoverTransform: 'scale(1.25)',
|
|
36
|
+
|
|
37
|
+
get hoverBgColor() {
|
|
38
|
+
return slider.barColor;
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
boxShadow: '0px 0px 5px 0px rgba(0, 0, 0, 0.08)'
|
|
31
42
|
},
|
|
32
43
|
endPadding: '10px 0 0',
|
|
33
44
|
disabled: {
|
|
@@ -35,15 +46,13 @@ var defaults = {
|
|
|
35
46
|
return theme.color.disabled;
|
|
36
47
|
},
|
|
37
48
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
49
|
+
// might be calculate according to the bar color
|
|
50
|
+
bgColor: '#B5E3FF'
|
|
42
51
|
},
|
|
43
52
|
// spinnerWidth: '124px',
|
|
44
53
|
spinnerGap: '16px',
|
|
45
54
|
point: {
|
|
46
|
-
width: '
|
|
55
|
+
width: '10px',
|
|
47
56
|
|
|
48
57
|
get height() {
|
|
49
58
|
return slider.point.width;
|
|
@@ -77,5 +86,5 @@ setDefault(function () {
|
|
|
77
86
|
}).slider;
|
|
78
87
|
});
|
|
79
88
|
export function makeStyles() {
|
|
80
|
-
return /*#__PURE__*/css("position:relative;outline:none;display:flex;.k-slider-main{flex:1;}.k-slider-track-wrapper{cursor:pointer;height:32px;display:flex;align-items:center;}.k-slider-track{flex:1;height:", slider.height, ";background-color:", slider.bgColor, ";border-radius:", slider.borderRadius, ";position:relative;user-select:none;}.k-slider-bar{background-color:", slider.barColor, ";position:absolute;height:100%;border-radius:", slider.borderRadius, ";transition:all ", slider.transition, ";}.k-slider-thumb-wrapper{position:absolute;top:50%;transform:translate(-50%, -50%);transition:left ", slider.transition, ";z-index:1;}.k-slider-thumb{height:", slider.thumb.height, ";width:", slider.thumb.width, ";transition:all ", slider.transition, ";border:", slider.thumb.border, ";border-radius:", slider.thumb.borderRadius, ";background-color:", slider.thumb.bgColor, ";outline:none;&:hover,&:focus{transform:", slider.thumb.hoverTransform, ";cursor:grab;background-color:", slider.thumb.hoverBgColor, ";}}.k-slider-ends{display:flex;justify-content:space-between;span{cursor:pointer;}}.k-slider-spinner{margin-left:", slider.spinnerGap, ";}&.k-dragging{.k-slider-bar{transition:none;}.k-slider-thumb-wrapper{transition:none;}}&.k-disabled{color:", slider.disabled.color, ";.k-slider-track-wrapper{cursor:not-allowed;}.k-slider-bar{background-color:", slider.disabled.
|
|
89
|
+
return /*#__PURE__*/css("position:relative;outline:none;display:flex;.k-slider-main{flex:1;}.k-slider-track-wrapper{cursor:pointer;height:32px;display:flex;align-items:center;}.k-slider-track{flex:1;height:", slider.height, ";background-color:", slider.bgColor, ";border-radius:", slider.borderRadius, ";position:relative;user-select:none;}.k-slider-bar{background-color:", slider.barColor, ";position:absolute;height:100%;border-radius:", slider.borderRadius, ";transition:all ", slider.transition, ";}.k-slider-thumb-wrapper{position:absolute;top:50%;transform:translate(-50%, -50%);transition:left ", slider.transition, ";z-index:1;}.k-slider-thumb{box-sizing:content-box;height:", slider.thumb.height, ";width:", slider.thumb.width, ";transition:all ", slider.transition, ";border:", slider.thumb.border, ";border-radius:", slider.thumb.borderRadius, ";background-color:", slider.thumb.bgColor, ";box-shadow:", slider.thumb.boxShadow, ";outline:none;&:hover,&:focus{transform:", slider.thumb.hoverTransform, ";cursor:grab;background-color:", slider.thumb.hoverBgColor, ";}}.k-slider-ends{display:flex;justify-content:space-between;span{cursor:pointer;}}.k-slider-spinner{margin-left:", slider.spinnerGap, ";}.k-slider-spinner-sep{display:inline-block;margin:auto 8px;}&.k-dragging{.k-slider-bar{transition:none;}.k-slider-thumb-wrapper{transition:none;}}&.k-disabled{color:", slider.disabled.color, ";.k-slider-track-wrapper{cursor:not-allowed;}.k-slider-bar{background-color:", slider.disabled.bgColor, ";}.k-slider-thumb{border-color:#fff;background-color:", slider.disabled.bgColor, ";&:hover,&:focus{background-color:", slider.disabled.bgColor, ";cursor:not-allowed;transform:none;}}.k-slider-ends{span{cursor:not-allowed;}}}.k-slider-point{position:absolute;top:calc((", slider.height, " - ", slider.point.height, ") / 2 );width:", slider.point.width, ";height:", slider.point.height, ";background:", slider.point.bgColor, ";transform:translateX(-50%);border-radius:", slider.point.borderRadius, ";border:", slider.point.border, ";&.k-active{border-color:", slider.point.activeBorderColor, ";}}.k-slider-marks{position:relative;height:", slider.marks.height, ";>span{position:absolute;transform:translateX(-50%);white-space:nowrap;cursor:pointer;&:first-child{transform:none;}&:last-child{transform:translateX(-100%);}&.k-active{color:", slider.marks.activeColor, ";}}}.k-slider-tooltip{white-space:nowrap;}");
|
|
81
90
|
}
|
|
@@ -2,7 +2,9 @@ import { NormalizedGetStep } from '../spinner/useStep';
|
|
|
2
2
|
export declare type Value<Range extends boolean = boolean> = Range extends true ? [number, number] : number;
|
|
3
3
|
export declare function useValue(getStep: NormalizedGetStep, getDragging: () => boolean): {
|
|
4
4
|
showValue: import("../../hooks/useState").State<number | [number, number]>;
|
|
5
|
-
onSpinnerChange: (v:
|
|
5
|
+
onSpinnerChange: (v: Value) => void;
|
|
6
|
+
onLeftSpinnerChange: (v: number) => void;
|
|
7
|
+
onRightSpinnerChange: (v: number) => void;
|
|
6
8
|
setValue: (value: Value) => void;
|
|
7
9
|
triggerChangeEvent: (oldValue: Value) => void;
|
|
8
10
|
fixValue: (value: Value, fixShowValue: boolean) => void;
|
|
@@ -80,6 +80,16 @@ export function useValue(getStep, getDragging) {
|
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
function onLeftSpinnerChange(v) {
|
|
84
|
+
var secondValue = showValue.value[1];
|
|
85
|
+
onSpinnerChange([v, Math.max(v, secondValue)]);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function onRightSpinnerChange(v) {
|
|
89
|
+
var firstValue = showValue.value[0];
|
|
90
|
+
onSpinnerChange([Math.min(v, firstValue), v]);
|
|
91
|
+
}
|
|
92
|
+
|
|
83
93
|
function triggerChangeEvent(oldValue) {
|
|
84
94
|
var _instance$get3 = instance.get(),
|
|
85
95
|
value = _instance$get3.value;
|
|
@@ -91,6 +101,8 @@ export function useValue(getStep, getDragging) {
|
|
|
91
101
|
return {
|
|
92
102
|
showValue: showValue,
|
|
93
103
|
onSpinnerChange: onSpinnerChange,
|
|
104
|
+
onLeftSpinnerChange: onLeftSpinnerChange,
|
|
105
|
+
onRightSpinnerChange: onRightSpinnerChange,
|
|
94
106
|
setValue: setValue,
|
|
95
107
|
triggerChangeEvent: triggerChangeEvent,
|
|
96
108
|
fixValue: fixValue
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
2
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
-
import _trimInstanceProperty from "@babel/runtime-corejs3/core-js/instance/trim";
|
|
4
|
-
import { __decorate } from "tslib";
|
|
5
3
|
import { Component } from 'intact-vue-next';
|
|
6
4
|
import template from './index.vdt';
|
|
7
|
-
import { bind } from '../utils';
|
|
8
5
|
import { sizes } from '../../styles/utils';
|
|
9
6
|
import { useStep } from './useStep';
|
|
10
7
|
import { useFormatter } from './useFormatter';
|
|
@@ -79,19 +76,6 @@ export var Spinner = /*#__PURE__*/function (_Component) {
|
|
|
79
76
|
disabled = _this$get2.disabled;
|
|
80
77
|
|
|
81
78
|
return disabled || value >= max;
|
|
82
|
-
} // we need change value as long as the input is valid, #213
|
|
83
|
-
;
|
|
84
|
-
|
|
85
|
-
_proto.onInput = function onInput(e) {
|
|
86
|
-
var val = e.target.value;
|
|
87
|
-
|
|
88
|
-
var _this$value$getFixedV = this.value.getFixedValue(_trimInstanceProperty(val).call(val), this.get('value')),
|
|
89
|
-
value = _this$value$getFixedV.value;
|
|
90
|
-
|
|
91
|
-
this.value.showValue.set(val);
|
|
92
|
-
this.set({
|
|
93
|
-
value: value
|
|
94
|
-
});
|
|
95
79
|
};
|
|
96
80
|
|
|
97
81
|
return Spinner;
|
|
@@ -99,6 +83,4 @@ export var Spinner = /*#__PURE__*/function (_Component) {
|
|
|
99
83
|
Spinner.template = template;
|
|
100
84
|
Spinner.typeDefs = typeDefs;
|
|
101
85
|
Spinner.defaults = defaults;
|
|
102
|
-
Spinner.events = events;
|
|
103
|
-
|
|
104
|
-
__decorate([bind], Spinner.prototype, "onInput", null);
|
|
86
|
+
Spinner.events = events;
|
|
@@ -6,16 +6,16 @@ import { Input } from '../input';
|
|
|
6
6
|
import { getRestProps } from '../utils';
|
|
7
7
|
import { makeStyles } from './styles';
|
|
8
8
|
var _$tmp0 = {
|
|
9
|
-
'className': 'k-spinner-icon
|
|
9
|
+
'className': 'k-spinner-icon k-icon-minus-small'
|
|
10
10
|
};
|
|
11
11
|
var _$tmp1 = {
|
|
12
|
-
'className': 'k-spinner-icon
|
|
12
|
+
'className': 'k-spinner-icon k-icon-arrow-down'
|
|
13
13
|
};
|
|
14
14
|
var _$tmp2 = {
|
|
15
|
-
'className': 'k-spinner-icon
|
|
15
|
+
'className': 'k-spinner-icon k-icon-add-small'
|
|
16
16
|
};
|
|
17
17
|
var _$tmp3 = {
|
|
18
|
-
'className': 'k-spinner-icon
|
|
18
|
+
'className': 'k-spinner-icon k-icon-arrow-up'
|
|
19
19
|
};
|
|
20
20
|
export default function ($props, $blocks, $__proto__) {
|
|
21
21
|
var _classNameObj;
|
|
@@ -39,8 +39,11 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
39
39
|
var _this$change = this.change,
|
|
40
40
|
decrease = _this$change.decrease,
|
|
41
41
|
increase = _this$change.increase,
|
|
42
|
-
|
|
42
|
+
onChangeValue = _this$change.onChangeValue,
|
|
43
43
|
onFocusin = _this$change.onFocusin;
|
|
44
|
+
var _this$value = this.value,
|
|
45
|
+
showValue = _this$value.showValue,
|
|
46
|
+
onInput = _this$value.onInput;
|
|
44
47
|
return _$cv('div', _extends({
|
|
45
48
|
'className': _$cn(classNameObj)
|
|
46
49
|
}, getRestProps(this)), [_$cc(Button, {
|
|
@@ -49,14 +52,16 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
49
52
|
'disabled': this.isDisabledDecrease(),
|
|
50
53
|
'className': 'k-spinner-btn k-left',
|
|
51
54
|
'size': size,
|
|
55
|
+
'type': 'none',
|
|
56
|
+
'tabindex': '-1',
|
|
52
57
|
'children': !vertical ? _$cc(Icon, _$tmp0) : _$cc(Icon, _$tmp1)
|
|
53
58
|
}), _$cc(Input, {
|
|
54
59
|
'className': 'k-spinner-input',
|
|
55
60
|
'disabled': disabled,
|
|
56
|
-
'ev-change':
|
|
61
|
+
'ev-change': onChangeValue,
|
|
57
62
|
'ev-focusin': onFocusin,
|
|
58
|
-
'value':
|
|
59
|
-
'ev-input':
|
|
63
|
+
'value': showValue.value,
|
|
64
|
+
'ev-input': onInput,
|
|
60
65
|
'size': size,
|
|
61
66
|
'width': width
|
|
62
67
|
}), _$cc(Button, {
|
|
@@ -65,6 +70,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
65
70
|
'disabled': this.isDisabledIncrease(),
|
|
66
71
|
'className': 'k-spinner-btn k-right',
|
|
67
72
|
'size': size,
|
|
73
|
+
'type': 'none',
|
|
74
|
+
'tabindex': '-1',
|
|
68
75
|
'children': !vertical ? _$cc(Icon, _$tmp2) : _$cc(Icon, _$tmp3)
|
|
69
76
|
})]);
|
|
70
77
|
}
|
|
@@ -4,13 +4,41 @@ import { deepDefaults, sizes } from '../../styles/utils';
|
|
|
4
4
|
import { theme, setDefault } from '../../styles/theme';
|
|
5
5
|
import '../../styles/global';
|
|
6
6
|
var defaults = {
|
|
7
|
+
get borderRadius() {
|
|
8
|
+
return theme.borderRadius;
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
get border() {
|
|
12
|
+
return "1px solid " + theme.color.border;
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
get hoverBorderColor() {
|
|
16
|
+
return theme.color.primary;
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
get hoverBtnBg() {
|
|
20
|
+
return theme.color.bg;
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
get disabledBorderColor() {
|
|
24
|
+
return theme.color.disabledBorder;
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
get disabledBg() {
|
|
28
|
+
return theme.color.disabledBg;
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
get disabledColor() {
|
|
32
|
+
return theme.color.disabled;
|
|
33
|
+
},
|
|
34
|
+
|
|
7
35
|
default: {
|
|
8
36
|
inputWidth: '46px',
|
|
9
|
-
iconFontSize: '
|
|
37
|
+
iconFontSize: '16px'
|
|
10
38
|
},
|
|
11
39
|
large: {
|
|
12
40
|
inputWidth: '60px',
|
|
13
|
-
iconFontSize: '
|
|
41
|
+
iconFontSize: '24px'
|
|
14
42
|
},
|
|
15
43
|
small: {
|
|
16
44
|
inputWidth: '32px',
|
|
@@ -42,9 +70,9 @@ setDefault(function () {
|
|
|
42
70
|
}).spinner;
|
|
43
71
|
});
|
|
44
72
|
export function makeStyles() {
|
|
45
|
-
return /*#__PURE__*/css("display:inline-block;vertical-align:middle;
|
|
73
|
+
return /*#__PURE__*/css("display:inline-block;vertical-align:middle;border:", spinner.border, ";border-radius:", spinner.borderRadius, ";&:hover{border-color:", spinner.hoverBorderColor, ";.k-spinner-btn{background:", spinner.hoverBtnBg, ";}.k-left{border-radius:", spinner.borderRadius, " 0 0 ", spinner.borderRadius, ";}.k-right{border-radius:0 ", spinner.borderRadius, " ", spinner.borderRadius, " 0;}}.k-spinner-input{width:", spinner.default.inputWidth, ";.k-input-inner{text-align:center;border:none;border-radius:0;&:hover,&:focus{border:none;}}}.k-spinner-icon{font-size:", spinner.default.iconFontSize, ";}&.k-vertical{position:relative;font-size:0;", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
46
74
|
var generate = function generate() {
|
|
47
|
-
return "\n .k-spinner-input {\n padding-right:
|
|
75
|
+
return "\n .k-spinner-input {\n padding-right: " + theme[size].height + ";\n width: " + spinner.vertical[size].width + ";\n }\n ";
|
|
48
76
|
};
|
|
49
77
|
|
|
50
78
|
if (size === 'default') {
|
|
@@ -52,7 +80,7 @@ export function makeStyles() {
|
|
|
52
80
|
} else {
|
|
53
81
|
return "\n &.k-" + size + " {\n " + generate() + "\n }\n ";
|
|
54
82
|
}
|
|
55
|
-
}), ";.k-spinner-btn{position:absolute;right:0;margin:0;height:calc(50%
|
|
83
|
+
}), ";.k-spinner-btn{position:absolute;right:0;margin:0;height:calc(50% - 2px);line-height:50%;}.k-spinner-icon{font-size:inherit!important;}.k-spinner-btn.k-left{bottom:1px;border-radius:0 0 ", spinner.borderRadius, " 0;}.k-spinner-btn.k-right{top:1px;border-radius:0 ", spinner.borderRadius, " 0 0;}.k-spinner-input{font-size:0;.k-input-inner{border-radius:", spinner.borderRadius, " 0 0 ", spinner.borderRadius, ";}}}&.k-disabled{border-color:", spinner.disabledBorderColor, ";background:", spinner.disabledBg, ";}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
56
84
|
var styles = spinner[size];
|
|
57
85
|
|
|
58
86
|
var generate = function generate() {
|
|
@@ -3,6 +3,6 @@ import type { useValue } from './useValue';
|
|
|
3
3
|
export declare function useChange(getStep: NormalizedGetStep, fixValue: ReturnType<typeof useValue>['fixValue']): {
|
|
4
4
|
increase: () => void;
|
|
5
5
|
decrease: () => void;
|
|
6
|
-
|
|
6
|
+
onChangeValue: (e: Event) => void;
|
|
7
7
|
onFocusin: () => void;
|
|
8
8
|
};
|
|
@@ -26,7 +26,7 @@ export function useChange(getStep, fixValue) {
|
|
|
26
26
|
fixAndTriggerChange(Number((value - step).toFixed(10)), 0);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
function
|
|
29
|
+
function onChangeValue(e) {
|
|
30
30
|
var _context;
|
|
31
31
|
|
|
32
32
|
fixAndTriggerChange(_trimInstanceProperty(_context = e.target.value).call(_context), instance.get('value'));
|
|
@@ -47,7 +47,7 @@ export function useChange(getStep, fixValue) {
|
|
|
47
47
|
return {
|
|
48
48
|
increase: increase,
|
|
49
49
|
decrease: decrease,
|
|
50
|
-
|
|
50
|
+
onChangeValue: onChangeValue,
|
|
51
51
|
onFocusin: onFocusin
|
|
52
52
|
};
|
|
53
53
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _Number$isNaN from "@babel/runtime-corejs3/core-js/number/is-nan";
|
|
2
|
+
import _trimInstanceProperty from "@babel/runtime-corejs3/core-js/instance/trim";
|
|
2
3
|
import { useInstance } from 'intact-vue-next';
|
|
3
4
|
import { useReceive } from '../../hooks/useReceive';
|
|
4
5
|
import { error, isNullOrUndefined, isString } from 'intact-shared';
|
|
@@ -63,12 +64,26 @@ export function useValue(getStep, formatter) {
|
|
|
63
64
|
valueString: valueString,
|
|
64
65
|
value: value
|
|
65
66
|
};
|
|
67
|
+
} // we need change value as long as the input is valid, #213
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
function onInput(e) {
|
|
71
|
+
var val = e.target.value;
|
|
72
|
+
|
|
73
|
+
var _getFixedValue2 = getFixedValue(_trimInstanceProperty(val).call(val), instance.get('value')),
|
|
74
|
+
value = _getFixedValue2.value;
|
|
75
|
+
|
|
76
|
+
showValue.set(val);
|
|
77
|
+
instance.set({
|
|
78
|
+
value: value
|
|
79
|
+
});
|
|
66
80
|
}
|
|
67
81
|
|
|
68
82
|
return {
|
|
69
83
|
showValue: showValue,
|
|
70
84
|
fixValue: fixValue,
|
|
71
|
-
getFixedValue: getFixedValue
|
|
85
|
+
getFixedValue: getFixedValue,
|
|
86
|
+
onInput: onInput
|
|
72
87
|
};
|
|
73
88
|
}
|
|
74
89
|
/**
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
|
+
import { createVNode as _$cv, className as _$cn, createElementVNode as _$ce, createUnknownComponentVNode as _$cc, noop as _$no } from 'intact-vue-next';
|
|
2
3
|
import { makeStyles } from './style';
|
|
3
4
|
import { kls } from './style';
|
|
5
|
+
import { MemoBlock } from './memo';
|
|
6
|
+
import { getRestProps } from '../utils';
|
|
4
7
|
export default function ($props, $blocks, $__proto__) {
|
|
5
8
|
var _classNameObj, _style, _style2;
|
|
6
9
|
|
|
@@ -26,17 +29,23 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
26
29
|
'k-split': true
|
|
27
30
|
}, _classNameObj["k-" + mode] = true, _classNameObj[makeStyles()] = true, _classNameObj['k-first-auto'] = firstSize.value === 'auto', _classNameObj['k-last-auto'] = lastSize.value === 'auto', _classNameObj['k-resizing'] = dragging.value, _classNameObj);
|
|
28
31
|
var stylePropName = mode === 'horizontal' ? 'width' : 'height';
|
|
29
|
-
return _$
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
return _$cv('div', _extends({
|
|
33
|
+
'className': _$cn(classNameObj),
|
|
34
|
+
'ref': elementRef
|
|
35
|
+
}, getRestProps(this)), [_$ce(2, 'div', _$cc(MemoBlock, {
|
|
36
|
+
'block': $blocks.first,
|
|
37
|
+
'children': (_$blocks['first'] = function ($super) {
|
|
38
|
+
return null;
|
|
39
|
+
}, __$blocks['first'] = function ($super, data) {
|
|
40
|
+
var block = $blocks['first'];
|
|
33
41
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
var callBlock = function callBlock() {
|
|
43
|
+
return _$blocks['first'].call($this, $super, data);
|
|
44
|
+
};
|
|
37
45
|
|
|
38
|
-
|
|
39
|
-
|
|
46
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
47
|
+
}, __$blocks['first'](_$no))
|
|
48
|
+
}), 2, _$cn(kls('first')), {
|
|
40
49
|
'style': (_style = {}, _style[stylePropName] = firstSize.value, _style)
|
|
41
50
|
}, null, firstRef), _$ce(2, 'div', (_$blocks['drag'] = function ($super) {
|
|
42
51
|
return _$ce(2, 'div', _$ce(2, 'div', null, 1, _$cn(kls('drag-lines'))), 2, _$cn(kls('line')));
|
|
@@ -50,18 +59,21 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
50
59
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
51
60
|
}, __$blocks['drag'](_$no)), 0, _$cn(kls('line-wrapper')), {
|
|
52
61
|
'ev-mousedown': start
|
|
53
|
-
}), _$ce(2, 'div',
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
62
|
+
}), _$ce(2, 'div', _$cc(MemoBlock, {
|
|
63
|
+
'block': $blocks.last,
|
|
64
|
+
'children': (_$blocks['last'] = function ($super) {
|
|
65
|
+
return null;
|
|
66
|
+
}, __$blocks['last'] = function ($super, data) {
|
|
67
|
+
var block = $blocks['last'];
|
|
57
68
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
69
|
+
var callBlock = function callBlock() {
|
|
70
|
+
return _$blocks['last'].call($this, $super, data);
|
|
71
|
+
};
|
|
61
72
|
|
|
62
|
-
|
|
63
|
-
|
|
73
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
74
|
+
}, __$blocks['last'](_$no))
|
|
75
|
+
}), 2, _$cn(kls('last')), {
|
|
64
76
|
'style': (_style2 = {}, _style2[stylePropName] = lastSize.value, _style2)
|
|
65
|
-
}, null, lastRef)]
|
|
77
|
+
}, null, lastRef)]);
|
|
66
78
|
}
|
|
67
79
|
;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Component, VNodeComponentClass, IntactDom } from 'intact-vue-next';
|
|
2
|
+
interface MemoBlockProps {
|
|
3
|
+
block: Function;
|
|
4
|
+
}
|
|
5
|
+
export declare class MemoBlock extends Component<MemoBlockProps> {
|
|
6
|
+
static template: (this: MemoBlock) => import("intact").Children;
|
|
7
|
+
$update(lastVNode: VNodeComponentClass<this>, nextVNode: VNodeComponentClass<this>, parentDom: Element, anchor: IntactDom | null, mountedQueue: Function[], force: boolean): void;
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import { Component } from 'intact-vue-next';
|
|
3
|
+
export var MemoBlock = /*#__PURE__*/function (_Component) {
|
|
4
|
+
_inheritsLoose(MemoBlock, _Component);
|
|
5
|
+
|
|
6
|
+
function MemoBlock() {
|
|
7
|
+
return _Component.apply(this, arguments) || this;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
var _proto = MemoBlock.prototype;
|
|
11
|
+
|
|
12
|
+
_proto.$update = function $update(lastVNode, nextVNode, parentDom, anchor, mountedQueue, force) {
|
|
13
|
+
var lastProps = lastVNode.props;
|
|
14
|
+
var nextProps = nextVNode.props;
|
|
15
|
+
if (lastProps.block === nextProps.block) return;
|
|
16
|
+
|
|
17
|
+
_Component.prototype.$update.call(this, lastVNode, nextVNode, parentDom, anchor, mountedQueue, force);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return MemoBlock;
|
|
21
|
+
}(Component);
|
|
22
|
+
|
|
23
|
+
MemoBlock.template = function () {
|
|
24
|
+
var props = this.$props;
|
|
25
|
+
return props.children;
|
|
26
|
+
};
|
|
@@ -2,9 +2,10 @@ import { Component, TypeDefs } from 'intact-vue-next';
|
|
|
2
2
|
export * from './step';
|
|
3
3
|
export interface StepsProps {
|
|
4
4
|
value?: number;
|
|
5
|
-
status?: 'normal' | 'error';
|
|
6
|
-
type?: 'default' | 'line' | 'simple';
|
|
5
|
+
status?: 'normal' | 'error' | 'done';
|
|
6
|
+
type?: 'default' | 'line' | 'simple' | 'line-compact' | 'dot';
|
|
7
7
|
clickable?: boolean;
|
|
8
|
+
vertical?: boolean;
|
|
8
9
|
}
|
|
9
10
|
export declare class Steps extends Component<StepsProps> {
|
|
10
11
|
static template: string | import("intact").Template<any>;
|