@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
|
@@ -9,10 +9,11 @@ import BasicDemo from '~/components/tooltip/demos/basic';
|
|
|
9
9
|
import PositionDemo from '~/components/tooltip/demos/position';
|
|
10
10
|
import TriggerDemo from '~/components/tooltip/demos/trigger';
|
|
11
11
|
import ContentDemo from '~/components/tooltip/demos/content';
|
|
12
|
-
import ConfirmDemo from '~/components/tooltip/demos/confirm';
|
|
13
12
|
import AlwaysDemo from '~/components/tooltip/demos/always';
|
|
14
13
|
import { Tooltip } from './';
|
|
14
|
+
import { Dialog } from '../dialog';
|
|
15
15
|
import { mount, unmount, dispatchEvent, getElement, wait } from '../../test/utils';
|
|
16
|
+
import { tooltip as tooltipTheme } from './styles';
|
|
16
17
|
describe('Tooltip', function () {
|
|
17
18
|
afterEach(function (done) {
|
|
18
19
|
unmount();
|
|
@@ -250,7 +251,7 @@ describe('Tooltip', function () {
|
|
|
250
251
|
return wait(500);
|
|
251
252
|
|
|
252
253
|
case 13:
|
|
253
|
-
content1 = getElement('.k-tooltip-content'); // should not hide when move mouse from button to tooltip content
|
|
254
|
+
content1 = getElement('.k-tooltip-content'); // should not hide when move mouse from button to tooltip content
|
|
254
255
|
|
|
255
256
|
expect(content1).eql(content);
|
|
256
257
|
dispatchEvent(canHover, 'mouseleave');
|
|
@@ -292,81 +293,30 @@ describe('Tooltip', function () {
|
|
|
292
293
|
}
|
|
293
294
|
}, _callee5);
|
|
294
295
|
})));
|
|
295
|
-
it('should
|
|
296
|
-
var _mount6,
|
|
296
|
+
it('should always show tooltip', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
297
|
+
var _mount6, element, content;
|
|
297
298
|
|
|
298
299
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
299
300
|
while (1) {
|
|
300
301
|
switch (_context6.prev = _context6.next) {
|
|
301
302
|
case 0:
|
|
302
|
-
_mount6 = mount(
|
|
303
|
-
cancelCb = sinon.spy();
|
|
304
|
-
okCb = sinon.spy();
|
|
305
|
-
|
|
306
|
-
instance.refs.__test.on('cancel', cancelCb);
|
|
307
|
-
|
|
308
|
-
instance.refs.__test.on('ok', okCb);
|
|
309
|
-
|
|
310
|
-
dispatchEvent(element.children[0], 'click');
|
|
311
|
-
_context6.next = 8;
|
|
312
|
-
return wait();
|
|
313
|
-
|
|
314
|
-
case 8:
|
|
315
|
-
content = getElement('.k-tooltip-content');
|
|
316
|
-
expect(content.querySelector('.k-tooltip-buttons').outerHTML).to.matchSnapshot();
|
|
317
|
-
content.querySelector('.k-btn').click();
|
|
318
|
-
_context6.next = 13;
|
|
319
|
-
return wait(500);
|
|
320
|
-
|
|
321
|
-
case 13:
|
|
322
|
-
expect(content.style.display).eql('none');
|
|
323
|
-
dispatchEvent(element.firstElementChild, 'click');
|
|
324
|
-
_context6.next = 17;
|
|
325
|
-
return wait();
|
|
326
|
-
|
|
327
|
-
case 17:
|
|
328
|
-
content = getElement('.k-tooltip-content');
|
|
329
|
-
_Array$from5 = _Array$from2(content.querySelectorAll('.k-btn')), btn = _Array$from5[1];
|
|
330
|
-
btn.click();
|
|
331
|
-
_context6.next = 22;
|
|
332
|
-
return wait(500);
|
|
333
|
-
|
|
334
|
-
case 22:
|
|
335
|
-
expect(content.style.display).eql('none');
|
|
336
|
-
expect(cancelCb.callCount).eql(1);
|
|
337
|
-
expect(okCb.callCount).eql(1);
|
|
338
|
-
|
|
339
|
-
case 25:
|
|
340
|
-
case "end":
|
|
341
|
-
return _context6.stop();
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}, _callee6);
|
|
345
|
-
})));
|
|
346
|
-
it('should always show tooltip', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
347
|
-
var _mount7, element, content;
|
|
348
|
-
|
|
349
|
-
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
350
|
-
while (1) {
|
|
351
|
-
switch (_context7.prev = _context7.next) {
|
|
352
|
-
case 0:
|
|
353
|
-
_mount7 = mount(AlwaysDemo), element = _mount7[1];
|
|
303
|
+
_mount6 = mount(AlwaysDemo), element = _mount6[1];
|
|
354
304
|
content = getElement('.k-tooltip-content');
|
|
355
305
|
expect(content.textContent).eql('hello');
|
|
356
306
|
document.body.click();
|
|
357
|
-
|
|
307
|
+
_context6.next = 6;
|
|
358
308
|
return wait(500);
|
|
359
309
|
|
|
360
310
|
case 6:
|
|
361
311
|
expect(getElement('.k-tooltip-content')).eql(content);
|
|
362
312
|
element.querySelector('span').click();
|
|
363
|
-
|
|
313
|
+
_context6.next = 10;
|
|
364
314
|
return wait(500);
|
|
365
315
|
|
|
366
316
|
case 10:
|
|
367
317
|
expect(getElement('.k-tooltip-content')).eql(content);
|
|
368
318
|
dispatchEvent(content, 'mouseleave');
|
|
369
|
-
|
|
319
|
+
_context6.next = 14;
|
|
370
320
|
return wait(600);
|
|
371
321
|
|
|
372
322
|
case 14:
|
|
@@ -374,10 +324,10 @@ describe('Tooltip', function () {
|
|
|
374
324
|
|
|
375
325
|
case 15:
|
|
376
326
|
case "end":
|
|
377
|
-
return
|
|
327
|
+
return _context6.stop();
|
|
378
328
|
}
|
|
379
329
|
}
|
|
380
|
-
},
|
|
330
|
+
}, _callee6);
|
|
381
331
|
}))); // it('should hide tooltip when v-show is false in Vue', async () => {
|
|
382
332
|
// interface IData {
|
|
383
333
|
// show: boolean
|
|
@@ -401,7 +351,7 @@ describe('Tooltip', function () {
|
|
|
401
351
|
// document.body.appendChild(container);
|
|
402
352
|
// const app = new Vue({
|
|
403
353
|
// render: h => h(
|
|
404
|
-
// 'Test',
|
|
354
|
+
// 'Test',
|
|
405
355
|
// {ref: 'test'}),
|
|
406
356
|
// components: {Test},
|
|
407
357
|
// }).$mount(container);
|
|
@@ -430,7 +380,7 @@ describe('Tooltip', function () {
|
|
|
430
380
|
// </div>
|
|
431
381
|
// `,
|
|
432
382
|
// components: {
|
|
433
|
-
// Tooltip: Tooltip as any,
|
|
383
|
+
// Tooltip: Tooltip as any,
|
|
434
384
|
// Radio: Radio as any,
|
|
435
385
|
// },
|
|
436
386
|
// data: {
|
|
@@ -447,18 +397,18 @@ describe('Tooltip', function () {
|
|
|
447
397
|
// document.body.removeChild(app.$el);
|
|
448
398
|
// });
|
|
449
399
|
|
|
450
|
-
it('should hide layer when we have disabled Tooltip and also hide on next updating', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
451
|
-
var Demo,
|
|
400
|
+
it('should hide layer when we have disabled Tooltip and also hide on next updating', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
401
|
+
var Demo, _mount7, i, content;
|
|
452
402
|
|
|
453
|
-
return _regeneratorRuntime.wrap(function
|
|
403
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context8) {
|
|
454
404
|
while (1) {
|
|
455
|
-
switch (
|
|
405
|
+
switch (_context8.prev = _context8.next) {
|
|
456
406
|
case 0:
|
|
457
407
|
Demo = /*#__PURE__*/function (_Component) {
|
|
458
408
|
_inheritsLoose(Demo, _Component);
|
|
459
409
|
|
|
460
410
|
function Demo() {
|
|
461
|
-
var
|
|
411
|
+
var _context7;
|
|
462
412
|
|
|
463
413
|
var _this;
|
|
464
414
|
|
|
@@ -466,7 +416,7 @@ describe('Tooltip', function () {
|
|
|
466
416
|
args[_key] = arguments[_key];
|
|
467
417
|
}
|
|
468
418
|
|
|
469
|
-
_this = _Component.call.apply(_Component, _concatInstanceProperty(
|
|
419
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context7 = [this]).call(_context7, args)) || this;
|
|
470
420
|
_this.Tooltip = Tooltip;
|
|
471
421
|
return _this;
|
|
472
422
|
}
|
|
@@ -482,23 +432,23 @@ describe('Tooltip', function () {
|
|
|
482
432
|
};
|
|
483
433
|
};
|
|
484
434
|
|
|
485
|
-
|
|
435
|
+
_mount7 = mount(Demo), i = _mount7[0];
|
|
486
436
|
dispatchEvent(i.refs.test, 'mouseenter');
|
|
487
|
-
|
|
437
|
+
_context8.next = 7;
|
|
488
438
|
return wait();
|
|
489
439
|
|
|
490
440
|
case 7:
|
|
491
441
|
content = getElement('.k-tooltip-content');
|
|
492
442
|
expect(content.textContent).eql('hello');
|
|
493
443
|
i.set('disabled', true);
|
|
494
|
-
|
|
444
|
+
_context8.next = 12;
|
|
495
445
|
return wait(500);
|
|
496
446
|
|
|
497
447
|
case 12:
|
|
498
448
|
content = getElement('.k-tooltip-content');
|
|
499
449
|
expect(content).eql(undefined);
|
|
500
450
|
i.set('disabled', false);
|
|
501
|
-
|
|
451
|
+
_context8.next = 17;
|
|
502
452
|
return wait();
|
|
503
453
|
|
|
504
454
|
case 17:
|
|
@@ -507,23 +457,23 @@ describe('Tooltip', function () {
|
|
|
507
457
|
|
|
508
458
|
case 19:
|
|
509
459
|
case "end":
|
|
510
|
-
return
|
|
460
|
+
return _context8.stop();
|
|
511
461
|
}
|
|
512
462
|
}
|
|
513
|
-
},
|
|
463
|
+
}, _callee7);
|
|
514
464
|
})));
|
|
515
|
-
it('should not detect collison when target is not in viewport', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
516
|
-
var Demo,
|
|
465
|
+
it('should not detect collison when target is not in viewport', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
466
|
+
var Demo, _mount8, i, content;
|
|
517
467
|
|
|
518
|
-
return _regeneratorRuntime.wrap(function
|
|
468
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context10) {
|
|
519
469
|
while (1) {
|
|
520
|
-
switch (
|
|
470
|
+
switch (_context10.prev = _context10.next) {
|
|
521
471
|
case 0:
|
|
522
472
|
Demo = /*#__PURE__*/function (_Component2) {
|
|
523
473
|
_inheritsLoose(Demo, _Component2);
|
|
524
474
|
|
|
525
475
|
function Demo() {
|
|
526
|
-
var
|
|
476
|
+
var _context9;
|
|
527
477
|
|
|
528
478
|
var _this2;
|
|
529
479
|
|
|
@@ -531,7 +481,7 @@ describe('Tooltip', function () {
|
|
|
531
481
|
args[_key2] = arguments[_key2];
|
|
532
482
|
}
|
|
533
483
|
|
|
534
|
-
_this2 = _Component2.call.apply(_Component2, _concatInstanceProperty(
|
|
484
|
+
_this2 = _Component2.call.apply(_Component2, _concatInstanceProperty(_context9 = [this]).call(_context9, args)) || this;
|
|
535
485
|
_this2.Tooltip = Tooltip;
|
|
536
486
|
return _this2;
|
|
537
487
|
}
|
|
@@ -540,8 +490,10 @@ describe('Tooltip', function () {
|
|
|
540
490
|
|
|
541
491
|
_proto.mounted = function mounted() {
|
|
542
492
|
var element = findDomFromVNode(this.$lastInput, true);
|
|
543
|
-
var
|
|
544
|
-
|
|
493
|
+
var style = element.style;
|
|
494
|
+
style.position = 'fixed';
|
|
495
|
+
style.top = '-200px'; // const windowHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
496
|
+
// (element.parentNode as HTMLElement).style.height = `${windowHeight * 2}px`;
|
|
545
497
|
};
|
|
546
498
|
|
|
547
499
|
return Demo;
|
|
@@ -555,27 +507,130 @@ describe('Tooltip', function () {
|
|
|
555
507
|
};
|
|
556
508
|
};
|
|
557
509
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
return wait(500);
|
|
510
|
+
_mount8 = mount(Demo), i = _mount8[0]; // await wait(500);
|
|
511
|
+
// window.scrollTo(0, 10000);
|
|
561
512
|
|
|
562
|
-
case 6:
|
|
563
|
-
window.scrollTo(0, 10000);
|
|
564
513
|
i.set('show', true);
|
|
565
|
-
|
|
514
|
+
_context10.next = 7;
|
|
566
515
|
return wait(500);
|
|
567
516
|
|
|
568
|
-
case
|
|
517
|
+
case 7:
|
|
569
518
|
content = getElement('.k-tooltip-content');
|
|
570
519
|
console.log(content.outerHTML);
|
|
571
520
|
console.log(_JSON$stringify(content.getBoundingClientRect()));
|
|
572
521
|
expect(content.getBoundingClientRect().top < 0).to.be.true;
|
|
573
522
|
|
|
574
|
-
case
|
|
523
|
+
case 11:
|
|
524
|
+
case "end":
|
|
525
|
+
return _context10.stop();
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}, _callee8);
|
|
529
|
+
})));
|
|
530
|
+
it('should add className', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
531
|
+
var Demo, _mount9, instance, element, trigger, dropdown;
|
|
532
|
+
|
|
533
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context12) {
|
|
534
|
+
while (1) {
|
|
535
|
+
switch (_context12.prev = _context12.next) {
|
|
536
|
+
case 0:
|
|
537
|
+
Demo = /*#__PURE__*/function (_Component3) {
|
|
538
|
+
_inheritsLoose(Demo, _Component3);
|
|
539
|
+
|
|
540
|
+
function Demo() {
|
|
541
|
+
var _context11;
|
|
542
|
+
|
|
543
|
+
var _this3;
|
|
544
|
+
|
|
545
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
546
|
+
args[_key3] = arguments[_key3];
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
_this3 = _Component3.call.apply(_Component3, _concatInstanceProperty(_context11 = [this]).call(_context11, args)) || this;
|
|
550
|
+
_this3.Tooltip = Tooltip;
|
|
551
|
+
return _this3;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
return Demo;
|
|
555
|
+
}(Component);
|
|
556
|
+
|
|
557
|
+
Demo.template = "\n const Tooltip = this.Tooltip;\n <div>\n <Tooltip content=\"hello\" class=\"a\">\n <div ref=\"test\" class=\"b\">test</div>\n </Tooltip>\n </div>\n ";
|
|
558
|
+
_mount9 = mount(Demo), instance = _mount9[0], element = _mount9[1];
|
|
559
|
+
trigger = instance.refs.test;
|
|
560
|
+
expect(trigger.className).to.eql('b a');
|
|
561
|
+
dispatchEvent(trigger, 'mouseenter');
|
|
562
|
+
_context12.next = 8;
|
|
563
|
+
return wait();
|
|
564
|
+
|
|
565
|
+
case 8:
|
|
566
|
+
dropdown = getElement('.k-tooltip-content');
|
|
567
|
+
expect(dropdown.classList.contains('a')).to.be.true;
|
|
568
|
+
|
|
569
|
+
case 10:
|
|
575
570
|
case "end":
|
|
576
|
-
return
|
|
571
|
+
return _context12.stop();
|
|
577
572
|
}
|
|
578
573
|
}
|
|
579
574
|
}, _callee9);
|
|
580
575
|
})));
|
|
576
|
+
it('should fix the width in small container', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
|
|
577
|
+
var Demo, _mount10, instance, element, trigger, expecedWidth, content, width, newWidth;
|
|
578
|
+
|
|
579
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context14) {
|
|
580
|
+
while (1) {
|
|
581
|
+
switch (_context14.prev = _context14.next) {
|
|
582
|
+
case 0:
|
|
583
|
+
Demo = /*#__PURE__*/function (_Component4) {
|
|
584
|
+
_inheritsLoose(Demo, _Component4);
|
|
585
|
+
|
|
586
|
+
function Demo() {
|
|
587
|
+
var _context13;
|
|
588
|
+
|
|
589
|
+
var _this4;
|
|
590
|
+
|
|
591
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
592
|
+
args[_key4] = arguments[_key4];
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
_this4 = _Component4.call.apply(_Component4, _concatInstanceProperty(_context13 = [this]).call(_context13, args)) || this;
|
|
596
|
+
_this4.Tooltip = Tooltip;
|
|
597
|
+
_this4.Dialog = Dialog;
|
|
598
|
+
return _this4;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
return Demo;
|
|
602
|
+
}(Component);
|
|
603
|
+
|
|
604
|
+
Demo.template = "\n const {Tooltip, Dialog} = this;\n <div style=\"text-align: right; position: relative; width: 350px;\">\n <Tooltip content=\"\u8FD9\u662F\u4E00\u6BB5\u5F88\u957F\u7684\u63CF\u8FF0\u6587\u5B57\uFF0C\u8FD9\u662F\u4E00\u6BB5\u5F88\u957F\u7684\u63CF\u8FF0\u6587\u5B57\uFF0C\u8FD9\u662F\u4E00\u6BB5\u5F88\u957F\u7684\u63CF\u8FF0\u6587\u5B57\" container={dom => dom}>\n <span class=\"trigger\">test</span>\n </Tooltip>\n </div>\n ";
|
|
605
|
+
_mount10 = mount(Demo), instance = _mount10[0], element = _mount10[1];
|
|
606
|
+
trigger = element.querySelector('.trigger');
|
|
607
|
+
expecedWidth = parseInt(tooltipTheme.maxWidth);
|
|
608
|
+
dispatchEvent(trigger, 'mouseenter');
|
|
609
|
+
_context14.next = 8;
|
|
610
|
+
return wait();
|
|
611
|
+
|
|
612
|
+
case 8:
|
|
613
|
+
content = getElement('.k-tooltip-content');
|
|
614
|
+
width = content.offsetWidth;
|
|
615
|
+
expect(width).to.eql(expecedWidth);
|
|
616
|
+
dispatchEvent(trigger, 'mouseleave');
|
|
617
|
+
_context14.next = 14;
|
|
618
|
+
return wait();
|
|
619
|
+
|
|
620
|
+
case 14:
|
|
621
|
+
dispatchEvent(trigger, 'mouseenter');
|
|
622
|
+
_context14.next = 17;
|
|
623
|
+
return wait();
|
|
624
|
+
|
|
625
|
+
case 17:
|
|
626
|
+
newWidth = content.offsetWidth;
|
|
627
|
+
expect(newWidth).to.eql(width);
|
|
628
|
+
|
|
629
|
+
case 19:
|
|
630
|
+
case "end":
|
|
631
|
+
return _context14.stop();
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}, _callee10);
|
|
635
|
+
})));
|
|
581
636
|
});
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
import '../../styles/global';
|
|
2
|
+
declare const defaults: {
|
|
3
|
+
padding: string;
|
|
4
|
+
readonly color: string;
|
|
5
|
+
bgColor: string;
|
|
6
|
+
lineHeight: number;
|
|
7
|
+
maxWidth: string;
|
|
8
|
+
readonly boxShadow: string;
|
|
9
|
+
arrow: {
|
|
10
|
+
borderColor: string;
|
|
11
|
+
width: string;
|
|
12
|
+
};
|
|
13
|
+
confirm: {
|
|
14
|
+
gaps: string;
|
|
15
|
+
};
|
|
16
|
+
dark: {
|
|
17
|
+
readonly bgColor: string;
|
|
18
|
+
color: string;
|
|
19
|
+
readonly arrowBorderColor: string;
|
|
20
|
+
};
|
|
21
|
+
smallPadding: string;
|
|
22
|
+
};
|
|
23
|
+
export declare let tooltip: typeof defaults;
|
|
2
24
|
export declare type Theme = 'dark' | 'light';
|
|
3
25
|
export declare const themes: Theme[];
|
|
4
26
|
export default function makeStyles(): string;
|
|
27
|
+
export {};
|
|
@@ -43,7 +43,7 @@ var defaults = {
|
|
|
43
43
|
},
|
|
44
44
|
smallPadding: '4px'
|
|
45
45
|
};
|
|
46
|
-
var tooltip;
|
|
46
|
+
export var tooltip;
|
|
47
47
|
setDefault(function () {
|
|
48
48
|
tooltip = deepDefaults(theme, {
|
|
49
49
|
tooltip: defaults
|
|
@@ -81,5 +81,5 @@ export default function makeStyles() {
|
|
|
81
81
|
var borderDirection = directionMap[direction];
|
|
82
82
|
return /*#__PURE__*/css("&.k-", direction, "{border-", borderDirection, "-color:", borderColor, ";&:before{border-", borderDirection, "-color:", bgColor, ";}}");
|
|
83
83
|
}), ";}}");
|
|
84
|
-
}), ".k-tooltip-
|
|
84
|
+
}), ".k-tooltip-footer{padding-top:", tooltip.confirm.gaps, ";.k-btn:not(:first-of-type){margin-left:", tooltip.confirm.gaps, ";}}&.k-small{padding:", tooltip.smallPadding, ";}}");
|
|
85
85
|
}
|
|
@@ -23,6 +23,6 @@ export declare class Tooltip<T extends TooltipProps = TooltipProps, E extends To
|
|
|
23
23
|
static typeDefs: Required<TypeDefs<TooltipProps>>;
|
|
24
24
|
static defaults: () => Partial<TooltipProps>;
|
|
25
25
|
static events: Events<TooltipEvents>;
|
|
26
|
-
|
|
26
|
+
show(shouldFocus?: boolean): void;
|
|
27
27
|
hide(immediately: boolean): void;
|
|
28
28
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
2
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
3
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
4
3
|
import { Dropdown } from '../dropdown/dropdown';
|
|
5
4
|
import { _$ } from '../../i18n';
|
|
6
5
|
import { themes } from './styles';
|
|
@@ -26,6 +25,7 @@ var defaults = function defaults() {
|
|
|
26
25
|
at: 'center top',
|
|
27
26
|
collision: 'flipfit'
|
|
28
27
|
},
|
|
28
|
+
collison: 'flipfit',
|
|
29
29
|
hoverable: false,
|
|
30
30
|
always: false,
|
|
31
31
|
confirm: false,
|
|
@@ -44,20 +44,20 @@ export var Tooltip = /*#__PURE__*/function (_Dropdown) {
|
|
|
44
44
|
_inheritsLoose(Tooltip, _Dropdown);
|
|
45
45
|
|
|
46
46
|
function Tooltip() {
|
|
47
|
-
|
|
47
|
+
return _Dropdown.apply(this, arguments) || this;
|
|
48
|
+
}
|
|
48
49
|
|
|
49
|
-
|
|
50
|
+
var _proto = Tooltip.prototype;
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
_proto.show = function show(shouldFocus) {
|
|
53
|
+
if (shouldFocus === void 0) {
|
|
54
|
+
shouldFocus = false;
|
|
53
55
|
}
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
var _proto = Tooltip.prototype;
|
|
57
|
+
if (this.get('disabled')) return;
|
|
58
|
+
clearTimeout(this.timer);
|
|
59
|
+
this.set('value', true);
|
|
60
|
+
};
|
|
61
61
|
|
|
62
62
|
_proto.hide = function hide(immediately) {
|
|
63
63
|
if (this.get('always')) return;
|
|
@@ -8,6 +8,17 @@ import { Input } from '../input';
|
|
|
8
8
|
import { Checkbox } from '../checkbox';
|
|
9
9
|
import { Button } from '../button';
|
|
10
10
|
import { Tree } from '../tree';
|
|
11
|
+
import { Icon } from '../icon';
|
|
12
|
+
var _$tmp0 = {
|
|
13
|
+
'className': 'k-icon-search',
|
|
14
|
+
'size': 'small'
|
|
15
|
+
};
|
|
16
|
+
var _$tmp1 = {
|
|
17
|
+
'className': 'k-transfer-icon k-icon-left'
|
|
18
|
+
};
|
|
19
|
+
var _$tmp2 = {
|
|
20
|
+
'className': 'k-transfer-icon k-icon-right'
|
|
21
|
+
};
|
|
11
22
|
export default function ($props, $blocks, $__proto__) {
|
|
12
23
|
var _classNameObj,
|
|
13
24
|
_this = this;
|
|
@@ -73,7 +84,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
73
84
|
__$blocks = _$ex({}, $blocks);
|
|
74
85
|
|
|
75
86
|
return (_$blocks['prefix'] = function ($super) {
|
|
76
|
-
return _$
|
|
87
|
+
return _$cc(Icon, _$tmp0);
|
|
77
88
|
}, __$blocks['prefix'] = function ($super, data) {
|
|
78
89
|
var block = $blocks['prefix'];
|
|
79
90
|
|
|
@@ -147,7 +158,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
147
158
|
'ev-click': remove,
|
|
148
159
|
'type': 'primary',
|
|
149
160
|
'size': 'large',
|
|
150
|
-
'children': _$
|
|
161
|
+
'children': _$cc(Icon, _$tmp1)
|
|
151
162
|
}), _$cc(Button, {
|
|
152
163
|
'circle': true,
|
|
153
164
|
'icon': true,
|
|
@@ -155,7 +166,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
155
166
|
'ev-click': add,
|
|
156
167
|
'type': 'primary',
|
|
157
168
|
'size': 'large',
|
|
158
|
-
'children': _$
|
|
169
|
+
'children': _$cc(Icon, _$tmp2)
|
|
159
170
|
})], 4, 'k-transfer-arrows'), Panel('right')]);
|
|
160
171
|
}
|
|
161
172
|
;
|
package/components/types.d.ts
CHANGED
|
@@ -100,8 +100,7 @@ describe('Upload', function () {
|
|
|
100
100
|
|
|
101
101
|
var upload = instance.$lastInput.children;
|
|
102
102
|
upload.on('success', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
103
|
-
var remove, dialog,
|
|
104
|
-
|
|
103
|
+
var remove, dialog, cancel, ok;
|
|
105
104
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
106
105
|
while (1) {
|
|
107
106
|
switch (_context.prev = _context.next) {
|
|
@@ -119,7 +118,7 @@ describe('Upload', function () {
|
|
|
119
118
|
|
|
120
119
|
case 7:
|
|
121
120
|
dialog = getElement('.k-dialog');
|
|
122
|
-
|
|
121
|
+
cancel = dialog.querySelector('.k-dialog-footer .k-dialog-cancel');
|
|
123
122
|
cancel.click();
|
|
124
123
|
_context.next = 12;
|
|
125
124
|
return wait(500);
|
|
@@ -132,7 +131,7 @@ describe('Upload', function () {
|
|
|
132
131
|
|
|
133
132
|
case 16:
|
|
134
133
|
dialog = getElement('.k-dialog');
|
|
135
|
-
|
|
134
|
+
ok = dialog.querySelector('.k-dialog-footer .k-dialog-ok');
|
|
136
135
|
ok.click();
|
|
137
136
|
_context.next = 21;
|
|
138
137
|
return wait(500);
|
|
@@ -222,7 +221,7 @@ describe('Upload', function () {
|
|
|
222
221
|
|
|
223
222
|
case 2:
|
|
224
223
|
expect(element.innerHTML.replace(/blob:[^"]*/g, '')).to.matchSnapshot();
|
|
225
|
-
view = element.querySelector('.k-upload-
|
|
224
|
+
view = element.querySelector('.k-upload-zoom');
|
|
226
225
|
view.click();
|
|
227
226
|
_context3.next = 7;
|
|
228
227
|
return wait();
|
|
@@ -257,7 +256,7 @@ describe('Upload', function () {
|
|
|
257
256
|
instance = _mount4[0],
|
|
258
257
|
element = _mount4[1];
|
|
259
258
|
|
|
260
|
-
var upload = instance
|
|
259
|
+
var upload = instance.refs.instance;
|
|
261
260
|
upload.on('success', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
262
261
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
263
262
|
while (1) {
|
|
@@ -13,20 +13,20 @@ var _$tmp0 = {
|
|
|
13
13
|
'className': 'k-icon-upload'
|
|
14
14
|
};
|
|
15
15
|
var _$tmp1 = {
|
|
16
|
-
'className': 'k-icon-add-
|
|
16
|
+
'className': 'k-icon-add-bold'
|
|
17
17
|
};
|
|
18
18
|
var _$tmp2 = {
|
|
19
|
-
'className': 'k-icon-add-
|
|
19
|
+
'className': 'k-icon-add-bold',
|
|
20
20
|
'size': 'large'
|
|
21
21
|
};
|
|
22
22
|
var _$tmp3 = {
|
|
23
23
|
'className': 'k-upload-file-icon ion-document'
|
|
24
24
|
};
|
|
25
25
|
var _$tmp4 = {
|
|
26
|
-
'className': 'k-upload-status-icon
|
|
26
|
+
'className': 'k-upload-status-icon k-icon-success-fill'
|
|
27
27
|
};
|
|
28
28
|
var _$tmp5 = {
|
|
29
|
-
'className': 'k-upload-status-icon
|
|
29
|
+
'className': 'k-upload-status-icon k-icon-error-fill'
|
|
30
30
|
};
|
|
31
31
|
export default function ($props, $blocks, $__proto__) {
|
|
32
32
|
var _classNameObj, _$cn2;
|
|
@@ -131,7 +131,9 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
131
131
|
'className': 'k-upload-zoom ion-ios-eye-outline',
|
|
132
132
|
'size': 'large',
|
|
133
133
|
'hoverable': true,
|
|
134
|
-
'ev-click':
|
|
134
|
+
'ev-click': function evClick() {
|
|
135
|
+
return show($value);
|
|
136
|
+
}
|
|
135
137
|
}), closeBtn($value, $key)], 0, 'k-upload-overlap k-upload-icons')
|
|
136
138
|
})], 4, _$cn({
|
|
137
139
|
"k-upload-picture k-upload-picture-card": true,
|
package/components/utils.d.ts
CHANGED
|
@@ -36,4 +36,6 @@ export declare const expandAnimationCallbacks: {
|
|
|
36
36
|
export declare function throttle<T>(fn: (arg: T) => void, time: number, doAlways?: (arg: T) => void): (arg: T) => void;
|
|
37
37
|
export declare function debounce(fn: Function, time: number, immediately?: boolean): () => any;
|
|
38
38
|
export declare function nextFrame(fn: () => void): void;
|
|
39
|
+
export declare function selectValue(elem: HTMLInputElement | HTMLTextAreaElement): void;
|
|
40
|
+
export declare function swap(list: any[], from: number, to: number): any[];
|
|
39
41
|
export {};
|
package/components/utils.js
CHANGED
|
@@ -183,12 +183,15 @@ export function findChildren(children, callback) {
|
|
|
183
183
|
|
|
184
184
|
if (loop(vNode)) {
|
|
185
185
|
found = vNode;
|
|
186
|
-
|
|
186
|
+
return true;
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
} else {
|
|
190
|
-
|
|
189
|
+
} else if (callback(children, ++index)) {
|
|
190
|
+
found = children;
|
|
191
|
+
return true;
|
|
191
192
|
}
|
|
193
|
+
|
|
194
|
+
return false;
|
|
192
195
|
};
|
|
193
196
|
|
|
194
197
|
loop(children);
|
|
@@ -356,4 +359,22 @@ export function nextFrame(fn) {
|
|
|
356
359
|
requestAnimationFrame(function () {
|
|
357
360
|
requestAnimationFrame(fn);
|
|
358
361
|
});
|
|
362
|
+
}
|
|
363
|
+
export function selectValue(elem) {
|
|
364
|
+
if (elem.select) {
|
|
365
|
+
elem.select();
|
|
366
|
+
} else if (elem.setSelectionRange) {
|
|
367
|
+
// mobile safari
|
|
368
|
+
elem.focus();
|
|
369
|
+
elem.setSelectionRange(0, elem.value.length);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
export function swap(list, from, to) {
|
|
373
|
+
var newList = _sliceInstanceProperty(list).call(list, 0);
|
|
374
|
+
|
|
375
|
+
var item = _spliceInstanceProperty(newList).call(newList, from, 1)[0];
|
|
376
|
+
|
|
377
|
+
_spliceInstanceProperty(newList).call(newList, to, 0, item);
|
|
378
|
+
|
|
379
|
+
return newList;
|
|
359
380
|
}
|