@king-design/react 3.0.0-beta.0 → 3.0.0-beta.2
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 +468 -309
- package/__tests__/components/cascader.spec.tsx +53 -0
- 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.d.ts +1 -1
- package/components/button/styles.js +3 -5
- package/components/carousel/index.vdt.js +2 -2
- package/components/cascader/index.d.ts +22 -11
- package/components/cascader/index.js +9 -12
- package/components/cascader/index.spec.js +81 -0
- package/components/cascader/index.vdt.js +11 -9
- package/components/cascader/styles.js +1 -1
- package/components/cascader/useFields.d.ts +2 -0
- package/components/cascader/useFields.js +18 -0
- package/components/cascader/useFilterable.d.ts +2 -1
- package/components/cascader/useFilterable.js +17 -6
- package/components/cascader/useLabel.d.ts +2 -1
- package/components/cascader/useLabel.js +4 -4
- package/components/cascader/useLoad.d.ts +2 -1
- package/components/cascader/useLoad.js +9 -7
- package/components/collapse/item.vdt.js +1 -1
- package/components/colorpicker/index.d.ts +2 -0
- package/components/colorpicker/index.js +7 -2
- package/components/colorpicker/index.vdt.js +3 -6
- 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/calendar.vdt.js +6 -6
- package/components/datepicker/index.spec.js +171 -153
- package/components/datepicker/index.vdt.js +1 -1
- package/components/datepicker/styles.js +1 -1
- package/components/datepicker/useValue.d.ts +3 -3
- package/components/datepicker/useValue.js +38 -9
- 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/index.spec.js +6 -6
- package/components/dialog/styles.js +1 -1
- package/components/dropdown/dropdown.d.ts +6 -6
- package/components/dropdown/dropdown.js +58 -75
- package/components/dropdown/index.spec.js +96 -17
- package/components/dropdown/item.d.ts +1 -1
- package/components/dropdown/item.js +19 -7
- package/components/dropdown/menu.js +1 -1
- package/components/dropdown/usePosition.js +11 -2
- package/components/editable/index.d.ts +1 -0
- package/components/editable/index.js +20 -6
- package/components/editable/index.vdt.js +2 -1
- package/components/form/index.spec.js +4 -2
- package/components/form/item.vdt.js +2 -1
- package/components/form/styles.js +4 -4
- package/components/grid/useGutter.js +8 -8
- package/components/icon/styles.js +1 -1
- package/components/input/index.d.ts +13 -2
- package/components/input/index.js +16 -13
- package/components/input/index.spec.js +169 -1
- package/components/input/index.vdt.js +44 -12
- package/components/input/search.vdt.js +2 -4
- package/components/input/styles.js +30 -6
- package/components/input/useAutoRows.d.ts +2 -0
- package/components/input/useAutoRows.js +79 -0
- package/components/input/useAutoWidth.js +13 -3
- package/components/input/useFocus.d.ts +4 -0
- package/components/input/useFocus.js +21 -0
- package/components/input/useShowPassword.d.ts +7 -0
- package/components/input/useShowPassword.js +31 -0
- package/components/menu/index.spec.js +26 -15
- package/components/menu/item.d.ts +2 -0
- package/components/menu/item.js +5 -0
- package/components/menu/item.vdt.js +4 -1
- package/components/pagination/index.d.ts +1 -1
- package/components/pagination/index.js +3 -2
- package/components/pagination/index.spec.js +49 -0
- package/components/pagination/index.vdt.js +10 -12
- package/components/pagination/styles.js +1 -1
- 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/portal.d.ts +6 -2
- package/components/portal.js +4 -3
- package/components/position.js +2 -1
- package/components/progress/index.js +1 -1
- package/components/progress/index.vdt.js +46 -8
- package/components/progress/styles.js +19 -13
- package/components/rate/styles.js +1 -1
- package/components/select/base.d.ts +7 -3
- package/components/select/base.js +9 -3
- package/components/select/base.vdt.js +75 -47
- package/components/select/index.spec.js +25 -13
- package/components/select/menu.vdt.js +6 -6
- package/components/select/option.vdt.js +2 -1
- package/components/select/styles.js +11 -5
- package/components/select/useDraggble.d.ts +2 -0
- package/components/select/useDraggble.js +11 -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 +13 -8
- package/components/spinner/styles.js +2 -2
- 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 +1 -0
- package/components/steps/index.js +2 -1
- package/components/steps/index.spec.js +1 -1
- package/components/steps/index.vdt.js +7 -4
- package/components/steps/step.vdt.js +2 -3
- package/components/steps/styles.d.ts +1 -0
- package/components/steps/styles.js +50 -17
- package/components/switch/index.spec.js +82 -65
- package/components/table/cell.js +1 -6
- package/components/table/cell.vdt.js +1 -1
- package/components/table/column.vdt.js +40 -24
- package/components/table/index.spec.js +162 -20
- package/components/table/row.d.ts +1 -1
- package/components/table/row.js +2 -1
- package/components/table/styles.js +16 -9
- package/components/table/table.d.ts +15 -0
- package/components/table/table.js +16 -7
- package/components/table/table.vdt.js +20 -6
- package/components/table/useChecked.d.ts +3 -2
- package/components/table/useChecked.js +23 -12
- package/components/table/useDisableRow.d.ts +2 -1
- package/components/table/useDisableRow.js +4 -4
- package/components/table/useDraggable.d.ts +3 -2
- package/components/table/useDraggable.js +11 -15
- package/components/table/useGroup.d.ts +9 -3
- package/components/table/useGroup.js +48 -37
- package/components/table/useMerge.d.ts +2 -1
- package/components/table/useMerge.js +5 -4
- package/components/table/usePagination.d.ts +8 -0
- package/components/table/usePagination.js +81 -0
- package/components/table/useStickyScrollbar.js +2 -2
- package/components/table/useTree.d.ts +2 -1
- package/components/table/useTree.js +3 -4
- 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 +9 -4
- package/components/tabs/styles.js +32 -34
- 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 +1 -1
- 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 +33 -8
- package/components/tag/tags.d.ts +27 -0
- package/components/tag/tags.js +51 -0
- package/components/tag/tags.vdt.js +91 -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/tooltip/content.d.ts +3 -2
- package/components/tooltip/content.js +18 -1
- package/components/tooltip/content.vdt.js +22 -10
- package/components/tooltip/index.spec.js +147 -92
- package/components/tooltip/styles.d.ts +23 -0
- package/components/tooltip/styles.js +2 -2
- package/components/tooltip/tooltip.d.ts +1 -1
- package/components/tooltip/tooltip.js +11 -11
- package/components/transfer/index.vdt.js +14 -3
- package/components/types.d.ts +1 -0
- package/components/upload/index.spec.js +5 -6
- package/components/upload/index.vdt.js +7 -5
- package/components/utils.d.ts +2 -0
- package/components/utils.js +24 -3
- package/components/virtual.d.ts +8 -0
- package/components/virtual.js +126 -0
- package/hooks/useResizeObserver.d.ts +1 -1
- package/hooks/useResizeObserver.js +19 -6
- package/i18n/en-US.d.ts +4 -1
- package/i18n/en-US.js +6 -2
- package/index.d.ts +5 -3
- package/index.js +5 -3
- package/package.json +2 -2
- package/styles/fonts/iconfont.eot +0 -0
- package/styles/fonts/iconfont.js +2 -2
- package/styles/fonts/iconfont.svg +35 -35
- package/styles/fonts/iconfont.ttf +0 -0
- package/styles/fonts/iconfont.woff +0 -0
- package/styles/fonts/ionicons.js +3 -3
- package/styles/global.js +1 -1
- package/yarn-error.log +41 -43
- package/components/table/useResizeObserver.d.ts +0 -2
- package/components/table/useResizeObserver.js +0 -20
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
3
3
|
import BasicDemo from '~/components/switch/demos/basic';
|
|
4
|
+
import DisabledDemo from '~/components/switch/demos/disabled';
|
|
4
5
|
import ValueDemo from '~/components/switch/demos/value';
|
|
5
6
|
import WidthHeightDemo from '~/components/switch/demos/widthHeight';
|
|
6
7
|
import { mount, unmount, dispatchEvent, wait } from '../../test/utils';
|
|
@@ -9,14 +10,14 @@ describe('Switch', function () {
|
|
|
9
10
|
unmount();
|
|
10
11
|
});
|
|
11
12
|
it('change value by clicking', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
12
|
-
var _mount, instance, element, _element$querySelecto, el,
|
|
13
|
+
var _mount, instance, element, _element$querySelecto, el, handle;
|
|
13
14
|
|
|
14
15
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
15
16
|
while (1) {
|
|
16
17
|
switch (_context.prev = _context.next) {
|
|
17
18
|
case 0:
|
|
18
19
|
_mount = mount(BasicDemo), instance = _mount[0], element = _mount[1];
|
|
19
|
-
_element$querySelecto = element.querySelectorAll('.k-switch'), el = _element$querySelecto[0]
|
|
20
|
+
_element$querySelecto = element.querySelectorAll('.k-switch'), el = _element$querySelecto[0];
|
|
20
21
|
el.click();
|
|
21
22
|
_context.next = 5;
|
|
22
23
|
return wait();
|
|
@@ -38,29 +39,61 @@ describe('Switch', function () {
|
|
|
38
39
|
|
|
39
40
|
case 16:
|
|
40
41
|
expect(instance.get('value')).to.be.false;
|
|
41
|
-
disabledEl.click();
|
|
42
|
-
_context.next = 20;
|
|
43
|
-
return wait();
|
|
44
|
-
|
|
45
|
-
case 20:
|
|
46
|
-
expect(element.outerHTML).to.matchSnapshot();
|
|
47
42
|
|
|
48
|
-
case
|
|
43
|
+
case 17:
|
|
49
44
|
case "end":
|
|
50
45
|
return _context.stop();
|
|
51
46
|
}
|
|
52
47
|
}
|
|
53
48
|
}, _callee);
|
|
54
49
|
})));
|
|
55
|
-
it('
|
|
56
|
-
var _mount2, instance, element,
|
|
50
|
+
it('disabled', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
51
|
+
var _mount2, instance, element, el;
|
|
57
52
|
|
|
58
53
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
59
54
|
while (1) {
|
|
60
55
|
switch (_context2.prev = _context2.next) {
|
|
61
56
|
case 0:
|
|
62
|
-
_mount2 = mount(
|
|
63
|
-
|
|
57
|
+
_mount2 = mount(DisabledDemo), instance = _mount2[0], element = _mount2[1];
|
|
58
|
+
el = element.querySelector('.k-switch');
|
|
59
|
+
el.click();
|
|
60
|
+
_context2.next = 5;
|
|
61
|
+
return wait();
|
|
62
|
+
|
|
63
|
+
case 5:
|
|
64
|
+
expect(element.outerHTML).to.matchSnapshot();
|
|
65
|
+
dispatchEvent(el, 'mousedown', {
|
|
66
|
+
which: 1,
|
|
67
|
+
clientX: 0
|
|
68
|
+
});
|
|
69
|
+
dispatchEvent(document, 'mousemove', {
|
|
70
|
+
clientX: 30
|
|
71
|
+
});
|
|
72
|
+
dispatchEvent(document, 'mouseup', {
|
|
73
|
+
clientX: 30
|
|
74
|
+
});
|
|
75
|
+
_context2.next = 11;
|
|
76
|
+
return wait();
|
|
77
|
+
|
|
78
|
+
case 11:
|
|
79
|
+
expect(element.outerHTML).to.matchSnapshot();
|
|
80
|
+
|
|
81
|
+
case 12:
|
|
82
|
+
case "end":
|
|
83
|
+
return _context2.stop();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}, _callee2);
|
|
87
|
+
})));
|
|
88
|
+
it('change value by draging', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
89
|
+
var _mount3, instance, element, _element$querySelecto2, el;
|
|
90
|
+
|
|
91
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
92
|
+
while (1) {
|
|
93
|
+
switch (_context3.prev = _context3.next) {
|
|
94
|
+
case 0:
|
|
95
|
+
_mount3 = mount(BasicDemo), instance = _mount3[0], element = _mount3[1];
|
|
96
|
+
_element$querySelecto2 = element.querySelectorAll('.k-switch-handle'), el = _element$querySelecto2[0];
|
|
64
97
|
dispatchEvent(el, 'mousedown', {
|
|
65
98
|
which: 1,
|
|
66
99
|
clientX: 0
|
|
@@ -68,7 +101,7 @@ describe('Switch', function () {
|
|
|
68
101
|
dispatchEvent(document, 'mousemove', {
|
|
69
102
|
clientX: 1
|
|
70
103
|
});
|
|
71
|
-
|
|
104
|
+
_context3.next = 6;
|
|
72
105
|
return wait();
|
|
73
106
|
|
|
74
107
|
case 6:
|
|
@@ -77,7 +110,7 @@ describe('Switch', function () {
|
|
|
77
110
|
dispatchEvent(document, 'mouseup', {
|
|
78
111
|
clientX: 1
|
|
79
112
|
});
|
|
80
|
-
|
|
113
|
+
_context3.next = 10;
|
|
81
114
|
return wait();
|
|
82
115
|
|
|
83
116
|
case 10:
|
|
@@ -93,7 +126,7 @@ describe('Switch', function () {
|
|
|
93
126
|
dispatchEvent(document, 'mouseup', {
|
|
94
127
|
clientX: 30
|
|
95
128
|
});
|
|
96
|
-
|
|
129
|
+
_context3.next = 17;
|
|
97
130
|
return wait();
|
|
98
131
|
|
|
99
132
|
case 17:
|
|
@@ -109,7 +142,7 @@ describe('Switch', function () {
|
|
|
109
142
|
dispatchEvent(document, 'mouseup', {
|
|
110
143
|
clientX: -30
|
|
111
144
|
});
|
|
112
|
-
|
|
145
|
+
_context3.next = 24;
|
|
113
146
|
return wait();
|
|
114
147
|
|
|
115
148
|
case 24:
|
|
@@ -122,43 +155,27 @@ describe('Switch', function () {
|
|
|
122
155
|
dispatchEvent(document, 'mouseup', {
|
|
123
156
|
clientX: 0
|
|
124
157
|
});
|
|
125
|
-
|
|
158
|
+
_context3.next = 29;
|
|
126
159
|
return wait();
|
|
127
160
|
|
|
128
161
|
case 29:
|
|
129
|
-
expect(instance.get('value')).to.be.true;
|
|
130
|
-
|
|
131
|
-
dispatchEvent(disabledEl, 'mousedown', {
|
|
132
|
-
which: 1,
|
|
133
|
-
clientX: 0
|
|
134
|
-
});
|
|
135
|
-
dispatchEvent(document, 'mousemove', {
|
|
136
|
-
clientX: 30
|
|
137
|
-
});
|
|
138
|
-
dispatchEvent(document, 'mouseup', {
|
|
139
|
-
clientX: 30
|
|
140
|
-
});
|
|
141
|
-
_context2.next = 35;
|
|
142
|
-
return wait();
|
|
143
|
-
|
|
144
|
-
case 35:
|
|
145
|
-
expect(element.outerHTML).to.matchSnapshot();
|
|
162
|
+
expect(instance.get('value')).to.be.true;
|
|
146
163
|
|
|
147
|
-
case
|
|
164
|
+
case 30:
|
|
148
165
|
case "end":
|
|
149
|
-
return
|
|
166
|
+
return _context3.stop();
|
|
150
167
|
}
|
|
151
168
|
}
|
|
152
|
-
},
|
|
169
|
+
}, _callee3);
|
|
153
170
|
})));
|
|
154
|
-
it('drag switch which has custom width and height', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
155
|
-
var
|
|
171
|
+
it('drag switch which has custom width and height', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
172
|
+
var _mount4, instance, element, _element$querySelecto3, el;
|
|
156
173
|
|
|
157
|
-
return _regeneratorRuntime.wrap(function
|
|
174
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
158
175
|
while (1) {
|
|
159
|
-
switch (
|
|
176
|
+
switch (_context4.prev = _context4.next) {
|
|
160
177
|
case 0:
|
|
161
|
-
|
|
178
|
+
_mount4 = mount(WidthHeightDemo), instance = _mount4[0], element = _mount4[1];
|
|
162
179
|
_element$querySelecto3 = element.querySelectorAll('.k-switch-handle'), el = _element$querySelecto3[2];
|
|
163
180
|
dispatchEvent(el, 'mousedown', {
|
|
164
181
|
which: 1,
|
|
@@ -170,7 +187,7 @@ describe('Switch', function () {
|
|
|
170
187
|
dispatchEvent(document, 'mouseup', {
|
|
171
188
|
clientX: 50
|
|
172
189
|
});
|
|
173
|
-
|
|
190
|
+
_context4.next = 7;
|
|
174
191
|
return wait();
|
|
175
192
|
|
|
176
193
|
case 7:
|
|
@@ -185,7 +202,7 @@ describe('Switch', function () {
|
|
|
185
202
|
dispatchEvent(document, 'mouseup', {
|
|
186
203
|
clientX: -50
|
|
187
204
|
});
|
|
188
|
-
|
|
205
|
+
_context4.next = 13;
|
|
189
206
|
return wait();
|
|
190
207
|
|
|
191
208
|
case 13:
|
|
@@ -193,24 +210,24 @@ describe('Switch', function () {
|
|
|
193
210
|
|
|
194
211
|
case 14:
|
|
195
212
|
case "end":
|
|
196
|
-
return
|
|
213
|
+
return _context4.stop();
|
|
197
214
|
}
|
|
198
215
|
}
|
|
199
|
-
},
|
|
216
|
+
}, _callee4);
|
|
200
217
|
})));
|
|
201
|
-
it('change value by keypress', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
202
|
-
var
|
|
218
|
+
it('change value by keypress', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
219
|
+
var _mount5, instance, element, el;
|
|
203
220
|
|
|
204
|
-
return _regeneratorRuntime.wrap(function
|
|
221
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
205
222
|
while (1) {
|
|
206
|
-
switch (
|
|
223
|
+
switch (_context5.prev = _context5.next) {
|
|
207
224
|
case 0:
|
|
208
|
-
|
|
225
|
+
_mount5 = mount(BasicDemo), instance = _mount5[0], element = _mount5[1];
|
|
209
226
|
el = element.querySelector('.k-switch');
|
|
210
227
|
dispatchEvent(el, 'keypress', {
|
|
211
228
|
keyCode: 13
|
|
212
229
|
});
|
|
213
|
-
|
|
230
|
+
_context5.next = 5;
|
|
214
231
|
return wait();
|
|
215
232
|
|
|
216
233
|
case 5:
|
|
@@ -218,7 +235,7 @@ describe('Switch', function () {
|
|
|
218
235
|
dispatchEvent(el, 'keypress', {
|
|
219
236
|
keyCode: 13
|
|
220
237
|
});
|
|
221
|
-
|
|
238
|
+
_context5.next = 9;
|
|
222
239
|
return wait();
|
|
223
240
|
|
|
224
241
|
case 9:
|
|
@@ -226,30 +243,30 @@ describe('Switch', function () {
|
|
|
226
243
|
|
|
227
244
|
case 10:
|
|
228
245
|
case "end":
|
|
229
|
-
return
|
|
246
|
+
return _context5.stop();
|
|
230
247
|
}
|
|
231
248
|
}
|
|
232
|
-
},
|
|
249
|
+
}, _callee5);
|
|
233
250
|
})));
|
|
234
|
-
it('custom the value', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
235
|
-
var
|
|
251
|
+
it('custom the value', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
252
|
+
var _mount6, instance, element, _element$querySelecto4, el1, el2;
|
|
236
253
|
|
|
237
|
-
return _regeneratorRuntime.wrap(function
|
|
254
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
238
255
|
while (1) {
|
|
239
|
-
switch (
|
|
256
|
+
switch (_context6.prev = _context6.next) {
|
|
240
257
|
case 0:
|
|
241
|
-
|
|
258
|
+
_mount6 = mount(ValueDemo), instance = _mount6[0], element = _mount6[1];
|
|
242
259
|
_element$querySelecto4 = element.querySelectorAll('.k-switch'), el1 = _element$querySelecto4[0], el2 = _element$querySelecto4[1];
|
|
243
260
|
el1.click();
|
|
244
261
|
el2.click();
|
|
245
|
-
|
|
262
|
+
_context6.next = 6;
|
|
246
263
|
return wait();
|
|
247
264
|
|
|
248
265
|
case 6:
|
|
249
266
|
expect(element.outerHTML).to.matchSnapshot();
|
|
250
267
|
el1.click();
|
|
251
268
|
el2.click();
|
|
252
|
-
|
|
269
|
+
_context6.next = 11;
|
|
253
270
|
return wait();
|
|
254
271
|
|
|
255
272
|
case 11:
|
|
@@ -257,9 +274,9 @@ describe('Switch', function () {
|
|
|
257
274
|
|
|
258
275
|
case 12:
|
|
259
276
|
case "end":
|
|
260
|
-
return
|
|
277
|
+
return _context6.stop();
|
|
261
278
|
}
|
|
262
279
|
}
|
|
263
|
-
},
|
|
280
|
+
}, _callee6);
|
|
264
281
|
})));
|
|
265
282
|
});
|
package/components/table/cell.js
CHANGED
|
@@ -16,12 +16,7 @@ export var TableCell = /*#__PURE__*/function (_Component) {
|
|
|
16
16
|
var isSame = true;
|
|
17
17
|
|
|
18
18
|
for (var key in lastProps) {
|
|
19
|
-
if (lastProps[key] !== nextProps[key]) {
|
|
20
|
-
isSame = false;
|
|
21
|
-
break;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (key === 'props' && nextProps.props.$blocks) {
|
|
19
|
+
if (lastProps[key] !== nextProps[key] || key === 'props' && nextProps.props.$blocks) {
|
|
25
20
|
isSame = false;
|
|
26
21
|
break;
|
|
27
22
|
}
|
|
@@ -5,7 +5,7 @@ import { Button } from '../button';
|
|
|
5
5
|
import { Icon } from '../icon';
|
|
6
6
|
import { getTextByChildren } from '../utils';
|
|
7
7
|
var _$tmp0 = {
|
|
8
|
-
'className': '
|
|
8
|
+
'className': 'k-icon-right',
|
|
9
9
|
'size': 'small'
|
|
10
10
|
};
|
|
11
11
|
export default function ($props, $blocks, $__proto__) {
|
|
@@ -6,7 +6,7 @@ import { Button } from '../button';
|
|
|
6
6
|
import { Icon } from '../icon';
|
|
7
7
|
import { Checkbox } from '../checkbox';
|
|
8
8
|
import { makeGroupMenuStyles } from './styles';
|
|
9
|
-
import { isStringOrNumber, get } from 'intact-shared';
|
|
9
|
+
import { isStringOrNumber, get, isArray } from 'intact-shared';
|
|
10
10
|
import { context as GroupContext } from './useGroup';
|
|
11
11
|
import { context as SortableContext } from './useSortable';
|
|
12
12
|
import { linkEvent } from 'intact';
|
|
@@ -17,16 +17,15 @@ import { stopPropagation } from '../utils';
|
|
|
17
17
|
import { Input } from '../input';
|
|
18
18
|
import { _$ } from '../../i18n';
|
|
19
19
|
var _$tmp0 = {
|
|
20
|
-
'className': '
|
|
20
|
+
'className': 'k-icon-search'
|
|
21
21
|
};
|
|
22
22
|
var _$tmp1 = {
|
|
23
|
-
'className': '
|
|
23
|
+
'className': 'k-icon-up k-asc',
|
|
24
|
+
'size': 'mini'
|
|
24
25
|
};
|
|
25
26
|
var _$tmp2 = {
|
|
26
|
-
'className': '
|
|
27
|
-
|
|
28
|
-
var _$tmp3 = {
|
|
29
|
-
'className': 'ion-android-arrow-dropdown k-desc'
|
|
27
|
+
'className': 'k-icon-down k-desc',
|
|
28
|
+
'size': 'mini'
|
|
30
29
|
};
|
|
31
30
|
export default function ($props, $blocks, $__proto__) {
|
|
32
31
|
var _this = this;
|
|
@@ -50,9 +49,14 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
50
49
|
var _this$group = this.group,
|
|
51
50
|
onSelect = _this$group.onSelect,
|
|
52
51
|
isChecked = _this$group.isChecked,
|
|
53
|
-
getGroupText = _this$group.getGroupText,
|
|
54
52
|
keywords = _this$group.keywords,
|
|
55
|
-
filteredGroup = _this$group.filteredGroup
|
|
53
|
+
filteredGroup = _this$group.filteredGroup,
|
|
54
|
+
onShow = _this$group.onShow,
|
|
55
|
+
reset = _this$group.reset,
|
|
56
|
+
confirm = _this$group.confirm,
|
|
57
|
+
dropdownRef = _this$group.dropdownRef,
|
|
58
|
+
localGroupValue = _this$group.localGroupValue,
|
|
59
|
+
isEmptyValue = _this$group.isEmptyValue;
|
|
56
60
|
return _$cc(TableContext.Consumer, {
|
|
57
61
|
'children': function children(checkType) {
|
|
58
62
|
return _$cc(GroupContext.Consumer, {
|
|
@@ -80,7 +84,6 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
80
84
|
'k-column-sortable': sortable
|
|
81
85
|
}, _classNameObj[className] = className, _classNameObj);
|
|
82
86
|
var groupValue = currentGroup && currentGroup[key];
|
|
83
|
-
var groupText = getGroupText(groupValue);
|
|
84
87
|
var type = sort && sort.key === key && sort.type;
|
|
85
88
|
var checked;
|
|
86
89
|
return _$ce(2, 'th', [resizable && _this.$vNode.props.prevVNode ? _$ce(2, 'div', null, 1, 'k-table-resize', {
|
|
@@ -88,7 +91,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
88
91
|
e._vNode = _this.$vNode;
|
|
89
92
|
onStart(e);
|
|
90
93
|
}
|
|
91
|
-
}) : undefined, _$ce(2, 'div', [_$ce(2, 'div',
|
|
94
|
+
}) : undefined, _$ce(2, 'div', [_$ce(2, 'div', (_$blocks['title'] = function ($super) {
|
|
92
95
|
return title;
|
|
93
96
|
}, __$blocks['title'] = function ($super, data) {
|
|
94
97
|
var block = $blocks['title'];
|
|
@@ -98,7 +101,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
98
101
|
};
|
|
99
102
|
|
|
100
103
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
101
|
-
}, __$blocks['title'](_$no)),
|
|
104
|
+
}, __$blocks['title'](_$no)), 0, 'k-table-title-text c-ellipsis'), group ? _$cc(Dropdown, {
|
|
102
105
|
'position': {
|
|
103
106
|
my: 'center top',
|
|
104
107
|
at: 'center bottom+5',
|
|
@@ -107,16 +110,16 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
107
110
|
'key': 'dropdown',
|
|
108
111
|
'trigger': 'click',
|
|
109
112
|
'ev-show': function evShow() {
|
|
110
|
-
return
|
|
113
|
+
return onShow(groupValue);
|
|
111
114
|
},
|
|
112
|
-
'
|
|
113
|
-
|
|
114
|
-
'
|
|
115
|
-
'className': 'k-table-group',
|
|
115
|
+
'ref': dropdownRef,
|
|
116
|
+
'children': [_$cc(Icon, {
|
|
117
|
+
'className': 'k-icon-down-squared k-table-group',
|
|
116
118
|
'ev-click': function evClick(e) {
|
|
117
119
|
return e._ignoreSortable = true;
|
|
118
120
|
},
|
|
119
|
-
'
|
|
121
|
+
'hoverable': true,
|
|
122
|
+
'color': isEmptyValue(groupValue) ? null : 'primary'
|
|
120
123
|
}), _$cc(DropdownMenu, {
|
|
121
124
|
'className': _$cn((_$cn2 = {
|
|
122
125
|
"k-table-group-dropdown": true
|
|
@@ -133,7 +136,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
133
136
|
__$blocks = _$ex({}, $blocks);
|
|
134
137
|
|
|
135
138
|
return (_$blocks['suffix'] = function ($super) {
|
|
136
|
-
return _$cc(Icon, _$
|
|
139
|
+
return _$cc(Icon, _$tmp0);
|
|
137
140
|
}, __$blocks['suffix'] = function ($super, data) {
|
|
138
141
|
var block = $blocks['suffix'];
|
|
139
142
|
|
|
@@ -147,24 +150,37 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
147
150
|
}), 2, 'k-table-group-header'), _$ce(2, 'div', _$ma(filteredGroup.value, function ($value, $key) {
|
|
148
151
|
return _$cc(DropdownItem, {
|
|
149
152
|
'ev-select': function evSelect() {
|
|
150
|
-
return onSelect($value.value,
|
|
153
|
+
return onSelect($value.value, onChange);
|
|
151
154
|
},
|
|
152
155
|
'hideOnSelect': !multiple,
|
|
153
156
|
'className': _$cn({
|
|
154
|
-
'k-active': checked = isChecked($value.value
|
|
157
|
+
'k-active': checked = isChecked($value.value)
|
|
155
158
|
}),
|
|
156
159
|
'children': multiple ? _$cc(Checkbox, {
|
|
157
160
|
'value': checked,
|
|
158
161
|
'children': $value.label
|
|
159
162
|
}) : _$ce(2, 'span', $value.label, 0)
|
|
160
163
|
});
|
|
161
|
-
}, $this), 4, 'k-table-group-body')
|
|
164
|
+
}, $this), 4, 'k-table-group-body'), multiple ? _$ce(2, 'div', [_$cc(Button, {
|
|
165
|
+
'type': 'none',
|
|
166
|
+
'size': 'small',
|
|
167
|
+
'disabled': isEmptyValue(localGroupValue.value),
|
|
168
|
+
'ev-click': reset,
|
|
169
|
+
'children': '重置'
|
|
170
|
+
}), _$cc(Button, {
|
|
171
|
+
'type': 'primary',
|
|
172
|
+
'size': 'small',
|
|
173
|
+
'ev-click': function evClick() {
|
|
174
|
+
return confirm(onChange);
|
|
175
|
+
},
|
|
176
|
+
'children': '确定'
|
|
177
|
+
})], 4, 'k-table-group-footer') : undefined]
|
|
162
178
|
})]
|
|
163
|
-
}, 'dropdown') : undefined, sortable ? _$ce(2, 'div', [_$cc(Icon, _$
|
|
179
|
+
}, 'dropdown', dropdownRef) : undefined, sortable ? _$ce(2, 'div', [_$cc(Icon, _$tmp1), _$cc(Icon, _$tmp2)], 4, _$cn((_$cn3 = {
|
|
164
180
|
'k-column-sort': true
|
|
165
181
|
}, _$cn3["k-" + type] = type, _$cn3))) : undefined], 0, 'k-table-title')], 0, _$cn(classNameObj), {
|
|
166
182
|
'style': style,
|
|
167
|
-
'title': isStringOrNumber(title) ? title
|
|
183
|
+
'title': isStringOrNumber(title) ? title : null,
|
|
168
184
|
'ev-click': sortable ? linkEvent(key, onChangeSort) : null,
|
|
169
185
|
'colspan': cols,
|
|
170
186
|
'rowspan': rows
|