@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
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
3
|
+
import _Array$from2 from "@babel/runtime-corejs3/core-js/array/from";
|
|
4
|
+
import BasicDemo from '~/components/popover/demos/basic';
|
|
5
|
+
import ContentDemo from '~/components/popover/demos/content';
|
|
6
|
+
import ButtonDemo from '~/components/popover/demos/button';
|
|
7
|
+
import TextDemo from '~/components/popover/demos/text';
|
|
8
|
+
import TypeDemo from '~/components/popover/demos/type';
|
|
9
|
+
import { mount, unmount, dispatchEvent, getElement, wait } from '../../test/utils';
|
|
10
|
+
describe("Popover", function () {
|
|
11
|
+
afterEach(function (done) {
|
|
12
|
+
unmount();
|
|
13
|
+
setTimeout(done, 500);
|
|
14
|
+
});
|
|
15
|
+
it('should handle popover correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
16
|
+
var _mount, instance, element, cancelCb, okCb, content, _Array$from, btn;
|
|
17
|
+
|
|
18
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
19
|
+
while (1) {
|
|
20
|
+
switch (_context.prev = _context.next) {
|
|
21
|
+
case 0:
|
|
22
|
+
_mount = mount(BasicDemo), instance = _mount[0], element = _mount[1];
|
|
23
|
+
cancelCb = sinon.spy();
|
|
24
|
+
okCb = sinon.spy();
|
|
25
|
+
instance.refs.popover1.on('cancel', cancelCb);
|
|
26
|
+
instance.refs.popover1.on('ok', okCb);
|
|
27
|
+
dispatchEvent(element.children[0], 'click');
|
|
28
|
+
_context.next = 8;
|
|
29
|
+
return wait();
|
|
30
|
+
|
|
31
|
+
case 8:
|
|
32
|
+
content = getElement('.k-tooltip-content');
|
|
33
|
+
expect(content.innerHTML).to.matchSnapshot();
|
|
34
|
+
content.querySelector('.k-btn').click();
|
|
35
|
+
_context.next = 13;
|
|
36
|
+
return wait(500);
|
|
37
|
+
|
|
38
|
+
case 13:
|
|
39
|
+
expect(content.style.display).eql('none');
|
|
40
|
+
dispatchEvent(element.firstElementChild, 'click');
|
|
41
|
+
_context.next = 17;
|
|
42
|
+
return wait();
|
|
43
|
+
|
|
44
|
+
case 17:
|
|
45
|
+
content = getElement('.k-tooltip-content');
|
|
46
|
+
_Array$from = _Array$from2(content.querySelectorAll('.k-btn')), btn = _Array$from[1];
|
|
47
|
+
btn.click();
|
|
48
|
+
_context.next = 22;
|
|
49
|
+
return wait(500);
|
|
50
|
+
|
|
51
|
+
case 22:
|
|
52
|
+
expect(content.style.display).eql('none');
|
|
53
|
+
expect(cancelCb.callCount).eql(1);
|
|
54
|
+
expect(okCb.callCount).eql(1);
|
|
55
|
+
|
|
56
|
+
case 25:
|
|
57
|
+
case "end":
|
|
58
|
+
return _context.stop();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}, _callee);
|
|
62
|
+
})));
|
|
63
|
+
it('should handle type correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
64
|
+
var _mount2, instance, element, _element$querySelecto, info, success, error, warning, test;
|
|
65
|
+
|
|
66
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
67
|
+
while (1) {
|
|
68
|
+
switch (_context3.prev = _context3.next) {
|
|
69
|
+
case 0:
|
|
70
|
+
_mount2 = mount(TypeDemo), instance = _mount2[0], element = _mount2[1];
|
|
71
|
+
_element$querySelecto = element.querySelectorAll('.k-btn'), info = _element$querySelecto[0], success = _element$querySelecto[1], error = _element$querySelecto[2], warning = _element$querySelecto[3];
|
|
72
|
+
|
|
73
|
+
test = /*#__PURE__*/function () {
|
|
74
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(element, className) {
|
|
75
|
+
var content;
|
|
76
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
77
|
+
while (1) {
|
|
78
|
+
switch (_context2.prev = _context2.next) {
|
|
79
|
+
case 0:
|
|
80
|
+
element.click();
|
|
81
|
+
_context2.next = 3;
|
|
82
|
+
return wait();
|
|
83
|
+
|
|
84
|
+
case 3:
|
|
85
|
+
content = getElement('.k-tooltip-content');
|
|
86
|
+
expect(content.querySelector('.k-popover-icon').classList.contains(className)).eql(true);
|
|
87
|
+
|
|
88
|
+
case 5:
|
|
89
|
+
case "end":
|
|
90
|
+
return _context2.stop();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}, _callee2);
|
|
94
|
+
}));
|
|
95
|
+
|
|
96
|
+
return function test(_x, _x2) {
|
|
97
|
+
return _ref3.apply(this, arguments);
|
|
98
|
+
};
|
|
99
|
+
}();
|
|
100
|
+
|
|
101
|
+
_context3.next = 5;
|
|
102
|
+
return test(info, 'k-icon-information-fill');
|
|
103
|
+
|
|
104
|
+
case 5:
|
|
105
|
+
_context3.next = 7;
|
|
106
|
+
return test(success, 'k-icon-success-fill');
|
|
107
|
+
|
|
108
|
+
case 7:
|
|
109
|
+
_context3.next = 9;
|
|
110
|
+
return test(error, 'k-icon-error-fill');
|
|
111
|
+
|
|
112
|
+
case 9:
|
|
113
|
+
_context3.next = 11;
|
|
114
|
+
return test(warning, 'k-icon-warning-fill');
|
|
115
|
+
|
|
116
|
+
case 11:
|
|
117
|
+
case "end":
|
|
118
|
+
return _context3.stop();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}, _callee3);
|
|
122
|
+
})));
|
|
123
|
+
it('should handle title/content slot correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
124
|
+
var _mount3, instance, element, content;
|
|
125
|
+
|
|
126
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
127
|
+
while (1) {
|
|
128
|
+
switch (_context4.prev = _context4.next) {
|
|
129
|
+
case 0:
|
|
130
|
+
_mount3 = mount(ContentDemo), instance = _mount3[0], element = _mount3[1];
|
|
131
|
+
dispatchEvent(element.children[0], 'click');
|
|
132
|
+
_context4.next = 4;
|
|
133
|
+
return wait();
|
|
134
|
+
|
|
135
|
+
case 4:
|
|
136
|
+
content = getElement('.k-tooltip-content');
|
|
137
|
+
expect(content.querySelector('.k-popover-title')).to.matchSnapshot();
|
|
138
|
+
expect(content.querySelector('.k-popover-content')).to.matchSnapshot();
|
|
139
|
+
|
|
140
|
+
case 7:
|
|
141
|
+
case "end":
|
|
142
|
+
return _context4.stop();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}, _callee4);
|
|
146
|
+
})));
|
|
147
|
+
it('should handle text props correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
148
|
+
var _mount4, instance, element, content, btns;
|
|
149
|
+
|
|
150
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
151
|
+
while (1) {
|
|
152
|
+
switch (_context5.prev = _context5.next) {
|
|
153
|
+
case 0:
|
|
154
|
+
_mount4 = mount(TextDemo), instance = _mount4[0], element = _mount4[1];
|
|
155
|
+
dispatchEvent(element.children[0], 'click');
|
|
156
|
+
_context5.next = 4;
|
|
157
|
+
return wait();
|
|
158
|
+
|
|
159
|
+
case 4:
|
|
160
|
+
content = getElement('.k-tooltip-content');
|
|
161
|
+
btns = content.querySelectorAll('.k-btn');
|
|
162
|
+
expect(btns[0].textContent).eql('cancel');
|
|
163
|
+
expect(btns[1].textContent).eql('confirm');
|
|
164
|
+
|
|
165
|
+
case 8:
|
|
166
|
+
case "end":
|
|
167
|
+
return _context5.stop();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}, _callee5);
|
|
171
|
+
})));
|
|
172
|
+
it('should handle footer slot correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
173
|
+
var _mount5, instance, element, content;
|
|
174
|
+
|
|
175
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
176
|
+
while (1) {
|
|
177
|
+
switch (_context6.prev = _context6.next) {
|
|
178
|
+
case 0:
|
|
179
|
+
_mount5 = mount(ButtonDemo), instance = _mount5[0], element = _mount5[1];
|
|
180
|
+
dispatchEvent(element.children[0], 'click');
|
|
181
|
+
_context6.next = 4;
|
|
182
|
+
return wait();
|
|
183
|
+
|
|
184
|
+
case 4:
|
|
185
|
+
content = getElement('.k-tooltip-content');
|
|
186
|
+
expect(content.querySelector('.k-tooltip-footer').outerHTML).to.matchSnapshot();
|
|
187
|
+
|
|
188
|
+
case 6:
|
|
189
|
+
case "end":
|
|
190
|
+
return _context6.stop();
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}, _callee6);
|
|
194
|
+
})));
|
|
195
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function makeStyles(): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { css } from '@emotion/css';
|
|
2
|
+
import { theme, setDefault } from '../../styles/theme';
|
|
3
|
+
import { deepDefaults } from '../../styles/utils';
|
|
4
|
+
var defaults = {
|
|
5
|
+
width: '240px',
|
|
6
|
+
padding: '8px 16px',
|
|
7
|
+
gap: '8px',
|
|
8
|
+
title: {
|
|
9
|
+
fontSize: '14px',
|
|
10
|
+
lineHeight: '20px',
|
|
11
|
+
fontWeight: 500
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
var popover;
|
|
15
|
+
setDefault(function () {
|
|
16
|
+
popover = deepDefaults(theme, {
|
|
17
|
+
popover: defaults
|
|
18
|
+
}).popover;
|
|
19
|
+
});
|
|
20
|
+
export default function makeStyles() {
|
|
21
|
+
return /*#__PURE__*/css("&.k-tooltip-content.k-popover{width:", popover.width, ";padding:", popover.padding, ";.k-popover-title{display:flex;align-items:center;font-size:", popover.title.fontSize, ";line-height:", popover.title.lineHeight, ";font-weight:", popover.title.fontWeight, ";}.k-popover-icon{margin-right:", popover.gap, ";}.k-popover-content{margin-top:", popover.gap, ";}.k-tooltip-footer{text-align:right;}}");
|
|
22
|
+
}
|
package/components/portal.d.ts
CHANGED
|
@@ -11,8 +11,12 @@ export declare class Portal<T extends PortalProps = PortalProps> extends Compone
|
|
|
11
11
|
mountedQueue?: Function[];
|
|
12
12
|
mountedDone?: boolean;
|
|
13
13
|
$isPortal: boolean;
|
|
14
|
-
$render(lastVNode: VNodeComponentClass<this> | null, nextVNode: VNodeComponentClass<this>, parentDom: Element, anchor: IntactDom | null, mountedQueue: Function[]
|
|
15
|
-
|
|
14
|
+
$render(lastVNode: VNodeComponentClass<this> | null, nextVNode: VNodeComponentClass<this>, parentDom: Element, anchor: IntactDom | null, mountedQueue: Function[] & {
|
|
15
|
+
priority?: Function[];
|
|
16
|
+
}): void;
|
|
17
|
+
$update(lastVNode: VNodeComponentClass<this>, nextVNode: VNodeComponentClass<this>, parentDom: Element, anchor: IntactDom | null, mountedQueue: Function[] & {
|
|
18
|
+
priority?: Function[];
|
|
19
|
+
}, force: boolean): void;
|
|
16
20
|
$unmount(vNode: VNodeComponentClass<this>, nextVNode: VNodeComponentClass<this> | null): void;
|
|
17
21
|
private initContainer;
|
|
18
22
|
}
|
package/components/portal.js
CHANGED
|
@@ -38,7 +38,8 @@ export var Portal = /*#__PURE__*/function (_Component) {
|
|
|
38
38
|
|
|
39
39
|
var _proto = Portal.prototype;
|
|
40
40
|
|
|
41
|
-
_proto.$render = function $render(lastVNode, nextVNode, parentDom, anchor, mountedQueue
|
|
41
|
+
_proto.$render = function $render(lastVNode, nextVNode, parentDom, anchor, mountedQueue // in React, it has priority property to add some prior functions
|
|
42
|
+
) {
|
|
42
43
|
var _this2 = this;
|
|
43
44
|
|
|
44
45
|
/**
|
|
@@ -47,7 +48,7 @@ export var Portal = /*#__PURE__*/function (_Component) {
|
|
|
47
48
|
*/
|
|
48
49
|
var nextProps = nextVNode.props;
|
|
49
50
|
var fakeContainer = document.createDocumentFragment();
|
|
50
|
-
mountedQueue.push(function () {
|
|
51
|
+
(mountedQueue.priority || mountedQueue).push(function () {
|
|
51
52
|
var parentDom = _this2.$lastInput.dom.parentElement;
|
|
52
53
|
|
|
53
54
|
_this2.initContainer(nextProps.container, parentDom, anchor);
|
|
@@ -87,7 +88,7 @@ export var Portal = /*#__PURE__*/function (_Component) {
|
|
|
87
88
|
|
|
88
89
|
if (!this.container) {
|
|
89
90
|
// in react, sometimes $update will be called before mountedQueue in $render
|
|
90
|
-
mountedQueue.push(update);
|
|
91
|
+
(mountedQueue.priority || mountedQueue).push(update);
|
|
91
92
|
} else {
|
|
92
93
|
update();
|
|
93
94
|
}
|
package/components/position.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _Object$assign from "@babel/runtime-corejs3/core-js/object/assign";
|
|
2
2
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
3
|
import _atInstanceProperty from "@babel/runtime-corejs3/core-js/instance/at";
|
|
4
|
+
import { isArray } from 'intact-shared';
|
|
4
5
|
var max = Math.max;
|
|
5
6
|
var abs = Math.abs;
|
|
6
7
|
var rHorizontal = /left|center|right/;
|
|
@@ -191,7 +192,7 @@ export default function position(elem, options) {
|
|
|
191
192
|
var basePosition = _Object$assign({}, targetOffset); // don't detect collison if the target is not in viewport
|
|
192
193
|
|
|
193
194
|
|
|
194
|
-
var collision = isInViewport(targetRect) ? (options.collision || 'flip').split(' ') : ['none', 'none'];
|
|
195
|
+
var collision = isInViewport(targetRect) ? !isArray(options.collision) ? (options.collision || 'flip').split(' ') : options.collision : ['none', 'none'];
|
|
195
196
|
var offsets = {};
|
|
196
197
|
var within = getWithinInfo(options.within);
|
|
197
198
|
var scrollInfo = getScrollInfo(within);
|
|
@@ -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-check';
|
|
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
|
}
|
|
@@ -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,7 +1,6 @@
|
|
|
1
1
|
import { Component, Children, TypeDefs, RefObject } from 'intact-react';
|
|
2
2
|
import { Sizes } from '../../styles/utils';
|
|
3
|
-
import
|
|
4
|
-
import { Dropdown } from '../dropdown';
|
|
3
|
+
import { Dropdown, DropdownProps } from '../dropdown';
|
|
5
4
|
import { State } from '../../hooks/useState';
|
|
6
5
|
import { Container } from '../portal';
|
|
7
6
|
import type { Events } from '../types';
|
|
@@ -21,6 +20,10 @@ export interface BaseSelectProps<V, Multipe extends boolean = boolean, Attach =
|
|
|
21
20
|
container?: Container;
|
|
22
21
|
width?: string | number;
|
|
23
22
|
show?: boolean;
|
|
23
|
+
position?: DropdownProps['position'];
|
|
24
|
+
flat?: boolean;
|
|
25
|
+
nowrap?: boolean;
|
|
26
|
+
draggable?: boolean;
|
|
24
27
|
}
|
|
25
28
|
export interface BaseSelectEvents {
|
|
26
29
|
keydown: [KeyboardEvent];
|
|
@@ -44,9 +47,10 @@ export declare abstract class BaseSelect<T extends BaseSelectProps<any> = BaseSe
|
|
|
44
47
|
input: {
|
|
45
48
|
onInput: (value: string) => void;
|
|
46
49
|
keywords: State<string>;
|
|
47
|
-
inputRef: RefObject<Input<string | number>>;
|
|
50
|
+
inputRef: RefObject<import("../input").Input<string | number>>;
|
|
48
51
|
};
|
|
49
52
|
private focusout;
|
|
53
|
+
private draggable;
|
|
50
54
|
init(): void;
|
|
51
55
|
protected abstract getPlaceholder(): Children;
|
|
52
56
|
protected abstract getLabel(): Children;
|
|
@@ -9,9 +9,11 @@ import { sizes } from '../../styles/utils';
|
|
|
9
9
|
import { SELECT } from './constants';
|
|
10
10
|
import { useShowHideEvents } from '../../hooks/useShowHideEvents';
|
|
11
11
|
import { bind } from '../utils';
|
|
12
|
+
import { Dropdown } from '../dropdown';
|
|
12
13
|
import { useInput } from './useInput';
|
|
13
14
|
import { useFocusout } from './useFocusout';
|
|
14
15
|
import { isNullOrUndefined } from 'intact-shared';
|
|
16
|
+
import { useDraggable } from './useDraggble';
|
|
15
17
|
var typeDefs = {
|
|
16
18
|
value: null,
|
|
17
19
|
multiple: Boolean,
|
|
@@ -27,7 +29,11 @@ var typeDefs = {
|
|
|
27
29
|
placeholder: [String, Number],
|
|
28
30
|
container: [Function, String],
|
|
29
31
|
width: [String, Number],
|
|
30
|
-
show: Boolean
|
|
32
|
+
show: Boolean,
|
|
33
|
+
position: Dropdown.typeDefs.position,
|
|
34
|
+
flat: Boolean,
|
|
35
|
+
nowrap: Boolean,
|
|
36
|
+
draggable: Boolean
|
|
31
37
|
};
|
|
32
38
|
|
|
33
39
|
var defaults = function defaults() {
|
|
@@ -58,6 +64,7 @@ export var BaseSelect = /*#__PURE__*/function (_Component) {
|
|
|
58
64
|
_this.dropdownRef = createRef();
|
|
59
65
|
_this.input = useInput(_this.resetKeywords);
|
|
60
66
|
_this.focusout = useFocusout();
|
|
67
|
+
_this.draggable = useDraggable();
|
|
61
68
|
return _this;
|
|
62
69
|
}
|
|
63
70
|
|
|
@@ -65,8 +72,7 @@ export var BaseSelect = /*#__PURE__*/function (_Component) {
|
|
|
65
72
|
|
|
66
73
|
_proto.init = function init() {
|
|
67
74
|
provide(SELECT, this);
|
|
68
|
-
useShowHideEvents('show');
|
|
69
|
-
|
|
75
|
+
useShowHideEvents('show');
|
|
70
76
|
this.watch('value', this.position, {
|
|
71
77
|
presented: true
|
|
72
78
|
});
|