@king-design/react 2.1.1 → 3.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/__snapshots__/Dialog.md +1 -1
- package/__tests__/__snapshots__/React Demos.md +410 -374
- package/__tests__/components/drawer.spec.tsx +67 -5
- package/components/button/index.d.ts +1 -1
- package/components/button/index.js +1 -1
- package/components/button/styles.js +3 -3
- package/components/card/styles.js +10 -2
- package/components/checkbox/styles.js +21 -10
- package/components/collapse/styles.js +6 -1
- package/components/copy/index.d.ts +17 -0
- package/components/copy/index.js +43 -0
- package/components/copy/index.spec.d.ts +1 -0
- package/components/copy/index.spec.js +52 -0
- package/components/copy/index.vdt.js +45 -0
- package/components/copy/styles.d.ts +2 -0
- package/components/copy/styles.js +14 -0
- package/components/copy/useCopy.d.ts +4 -0
- package/components/copy/useCopy.js +90 -0
- package/components/datepicker/index.spec.js +1 -1
- package/components/datepicker/index.vdt.js +1 -1
- package/components/datepicker/styles.d.ts +1 -1
- package/components/datepicker/styles.js +5 -2
- package/components/diagram/shapes/callout.d.ts +1 -1
- package/components/diagram/shapes/circle.d.ts +1 -1
- package/components/diagram/shapes/document.d.ts +1 -1
- package/components/diagram/shapes/ellipse.d.ts +1 -1
- package/components/diagram/shapes/hexagon.d.ts +1 -1
- package/components/diagram/shapes/image.d.ts +1 -1
- package/components/diagram/shapes/parallelogram.d.ts +1 -1
- package/components/diagram/shapes/rectangle.d.ts +1 -1
- package/components/diagram/shapes/square.d.ts +1 -1
- package/components/diagram/shapes/text.d.ts +1 -1
- package/components/dialog/alert.vdt.js +6 -5
- package/components/dialog/base.vdt.js +5 -6
- package/components/dialog/index.spec.js +4 -4
- package/components/dialog/styles.js +16 -14
- package/components/drawer/styles.js +20 -5
- package/components/dropdown/styles.js +1 -1
- package/components/form/index.spec.js +4 -2
- package/components/form/item.vdt.js +2 -1
- package/components/form/styles.js +5 -5
- package/components/grid/useGutter.js +8 -8
- package/components/icon/index.d.ts +1 -0
- package/components/icon/index.js +2 -1
- package/components/icon/index.vdt.js +4 -2
- package/components/icon/styles.js +10 -2
- package/components/input/index.d.ts +1 -0
- package/components/input/index.js +4 -11
- package/components/input/index.vdt.js +4 -2
- package/components/input/styles.js +13 -11
- package/components/message/message.js +1 -1
- package/components/message/message.vdt.js +7 -6
- package/components/message/styles.js +8 -8
- package/components/pagination/index.d.ts +1 -1
- package/components/pagination/index.js +1 -1
- package/components/pagination/index.spec.js +4 -2
- package/components/pagination/index.vdt.js +16 -18
- package/components/pagination/styles.js +12 -3
- package/components/popover/content.d.ts +19 -0
- package/components/popover/content.js +31 -0
- package/components/popover/content.vdt.js +68 -0
- package/components/popover/index.d.ts +16 -0
- package/components/popover/index.js +44 -0
- package/components/popover/index.spec.d.ts +1 -0
- package/components/popover/index.spec.js +195 -0
- package/components/popover/styles.d.ts +1 -0
- package/components/popover/styles.js +22 -0
- package/components/progress/index.js +1 -1
- package/components/progress/index.vdt.js +46 -8
- package/components/progress/styles.js +19 -13
- package/components/radio/styles.js +16 -6
- package/components/rate/styles.js +1 -1
- package/components/select/base.d.ts +5 -2
- package/components/select/base.js +7 -3
- package/components/select/base.vdt.js +46 -38
- package/components/select/index.spec.js +2 -2
- package/components/select/menu.vdt.js +1 -1
- package/components/select/styles.js +14 -28
- package/components/select/useDraggble.d.ts +2 -0
- package/components/select/useDraggble.js +11 -0
- package/components/select/useNowrap.d.ts +3 -0
- package/components/select/useNowrap.js +19 -0
- package/components/slider/index.spec.js +48 -9
- package/components/slider/index.vdt.js +23 -12
- package/components/slider/styles.js +23 -14
- package/components/slider/useValue.d.ts +3 -1
- package/components/slider/useValue.js +12 -0
- package/components/spinner/index.d.ts +0 -1
- package/components/spinner/index.js +1 -19
- package/components/spinner/index.vdt.js +15 -8
- package/components/spinner/styles.js +33 -5
- package/components/spinner/useChange.d.ts +1 -1
- package/components/spinner/useChange.js +2 -2
- package/components/spinner/useValue.d.ts +1 -0
- package/components/spinner/useValue.js +16 -1
- package/components/split/index.vdt.js +32 -20
- package/components/split/memo.d.ts +9 -0
- package/components/split/memo.js +26 -0
- package/components/steps/index.d.ts +3 -2
- package/components/steps/index.js +4 -3
- package/components/steps/index.spec.js +1 -1
- package/components/steps/index.vdt.js +8 -4
- package/components/steps/step.vdt.js +17 -9
- package/components/steps/styles.d.ts +2 -1
- package/components/steps/styles.js +106 -72
- package/components/switch/index.spec.js +82 -65
- package/components/switch/styles.js +20 -34
- package/components/table/styles.js +9 -4
- package/components/table/useDraggable.js +3 -10
- package/components/table/useStickyScrollbar.js +2 -2
- package/components/table/useWidth.js +2 -2
- package/components/tabs/index.d.ts +1 -1
- package/components/tabs/index.js +1 -1
- package/components/tabs/index.spec.js +67 -0
- package/components/tabs/index.vdt.js +5 -5
- package/components/tabs/styles.js +73 -29
- package/components/tabs/useScroll.d.ts +1 -1
- package/components/tabs/useScroll.js +75 -48
- package/components/tag/base.d.ts +1 -0
- package/components/tag/base.js +2 -2
- package/components/tag/index.d.ts +1 -0
- package/components/tag/index.js +2 -1
- package/components/tag/index.spec.js +147 -4
- package/components/tag/styles.d.ts +67 -0
- package/components/tag/styles.js +42 -12
- package/components/tag/tags.d.ts +27 -0
- package/components/tag/tags.js +51 -0
- package/components/tag/tags.vdt.js +79 -0
- package/components/tag/useChildren.d.ts +2 -0
- package/components/tag/useChildren.js +39 -0
- package/components/tag/useDraggable.d.ts +3 -0
- package/components/tag/useDraggable.js +89 -0
- package/components/tag/useNowrap.d.ts +7 -0
- package/components/tag/useNowrap.js +115 -0
- package/components/timepicker/index.spec.js +1 -1
- package/components/tip/index.vdt.js +1 -3
- package/components/tip/styles.js +4 -3
- package/components/tooltip/content.d.ts +2 -2
- package/components/tooltip/content.vdt.js +23 -13
- package/components/tooltip/index.spec.js +56 -108
- package/components/tooltip/styles.d.ts +1 -0
- package/components/tooltip/styles.js +13 -8
- package/components/transfer/index.vdt.js +3 -1
- package/components/transfer/styles.js +1 -1
- package/components/transfer/useCheck.d.ts +1 -0
- package/components/transfer/useCheck.js +8 -1
- package/components/upload/index.spec.js +5 -6
- package/components/upload/index.vdt.js +24 -21
- package/components/upload/styles.js +22 -30
- package/components/utils.d.ts +2 -0
- package/components/utils.js +24 -3
- package/hooks/useResizeObserver.d.ts +1 -1
- package/hooks/useResizeObserver.js +19 -6
- package/i18n/en-US.d.ts +6 -2
- package/i18n/en-US.js +8 -3
- package/index.d.ts +4 -2
- package/index.js +4 -2
- package/package.json +1 -1
- package/styles/fonts/iconfont.eot +0 -0
- package/styles/fonts/iconfont.js +2 -2
- package/styles/fonts/iconfont.svg +189 -369
- package/styles/fonts/iconfont.ttf +0 -0
- package/styles/fonts/iconfont.woff +0 -0
- package/styles/fonts/ionicons.js +2 -2
- package/styles/global.js +1 -1
- package/styles/theme.d.ts +10 -2
- package/styles/theme.js +23 -21
- package/components/table/useResizeObserver.d.ts +0 -2
- package/components/table/useResizeObserver.js +0 -20
|
@@ -9,7 +9,6 @@ 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 './';
|
|
15
14
|
import { Dialog } from '../dialog';
|
|
@@ -252,7 +251,7 @@ describe('Tooltip', function () {
|
|
|
252
251
|
return wait(500);
|
|
253
252
|
|
|
254
253
|
case 13:
|
|
255
|
-
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
|
|
256
255
|
|
|
257
256
|
expect(content1).eql(content);
|
|
258
257
|
dispatchEvent(canHover, 'mouseleave');
|
|
@@ -294,81 +293,30 @@ describe('Tooltip', function () {
|
|
|
294
293
|
}
|
|
295
294
|
}, _callee5);
|
|
296
295
|
})));
|
|
297
|
-
it('should
|
|
298
|
-
var _mount6,
|
|
296
|
+
it('should always show tooltip', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
297
|
+
var _mount6, element, content;
|
|
299
298
|
|
|
300
299
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
301
300
|
while (1) {
|
|
302
301
|
switch (_context6.prev = _context6.next) {
|
|
303
302
|
case 0:
|
|
304
|
-
_mount6 = mount(
|
|
305
|
-
cancelCb = sinon.spy();
|
|
306
|
-
okCb = sinon.spy();
|
|
307
|
-
|
|
308
|
-
instance.refs.__test.on('cancel', cancelCb);
|
|
309
|
-
|
|
310
|
-
instance.refs.__test.on('ok', okCb);
|
|
311
|
-
|
|
312
|
-
dispatchEvent(element.children[0], 'click');
|
|
313
|
-
_context6.next = 8;
|
|
314
|
-
return wait();
|
|
315
|
-
|
|
316
|
-
case 8:
|
|
317
|
-
content = getElement('.k-tooltip-content');
|
|
318
|
-
expect(content.querySelector('.k-tooltip-buttons').outerHTML).to.matchSnapshot();
|
|
319
|
-
content.querySelector('.k-btn').click();
|
|
320
|
-
_context6.next = 13;
|
|
321
|
-
return wait(500);
|
|
322
|
-
|
|
323
|
-
case 13:
|
|
324
|
-
expect(content.style.display).eql('none');
|
|
325
|
-
dispatchEvent(element.firstElementChild, 'click');
|
|
326
|
-
_context6.next = 17;
|
|
327
|
-
return wait();
|
|
328
|
-
|
|
329
|
-
case 17:
|
|
330
|
-
content = getElement('.k-tooltip-content');
|
|
331
|
-
_Array$from5 = _Array$from2(content.querySelectorAll('.k-btn')), btn = _Array$from5[1];
|
|
332
|
-
btn.click();
|
|
333
|
-
_context6.next = 22;
|
|
334
|
-
return wait(500);
|
|
335
|
-
|
|
336
|
-
case 22:
|
|
337
|
-
expect(content.style.display).eql('none');
|
|
338
|
-
expect(cancelCb.callCount).eql(1);
|
|
339
|
-
expect(okCb.callCount).eql(1);
|
|
340
|
-
|
|
341
|
-
case 25:
|
|
342
|
-
case "end":
|
|
343
|
-
return _context6.stop();
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}, _callee6);
|
|
347
|
-
})));
|
|
348
|
-
it('should always show tooltip', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
349
|
-
var _mount7, element, content;
|
|
350
|
-
|
|
351
|
-
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
352
|
-
while (1) {
|
|
353
|
-
switch (_context7.prev = _context7.next) {
|
|
354
|
-
case 0:
|
|
355
|
-
_mount7 = mount(AlwaysDemo), element = _mount7[1];
|
|
303
|
+
_mount6 = mount(AlwaysDemo), element = _mount6[1];
|
|
356
304
|
content = getElement('.k-tooltip-content');
|
|
357
305
|
expect(content.textContent).eql('hello');
|
|
358
306
|
document.body.click();
|
|
359
|
-
|
|
307
|
+
_context6.next = 6;
|
|
360
308
|
return wait(500);
|
|
361
309
|
|
|
362
310
|
case 6:
|
|
363
311
|
expect(getElement('.k-tooltip-content')).eql(content);
|
|
364
312
|
element.querySelector('span').click();
|
|
365
|
-
|
|
313
|
+
_context6.next = 10;
|
|
366
314
|
return wait(500);
|
|
367
315
|
|
|
368
316
|
case 10:
|
|
369
317
|
expect(getElement('.k-tooltip-content')).eql(content);
|
|
370
318
|
dispatchEvent(content, 'mouseleave');
|
|
371
|
-
|
|
319
|
+
_context6.next = 14;
|
|
372
320
|
return wait(600);
|
|
373
321
|
|
|
374
322
|
case 14:
|
|
@@ -376,10 +324,10 @@ describe('Tooltip', function () {
|
|
|
376
324
|
|
|
377
325
|
case 15:
|
|
378
326
|
case "end":
|
|
379
|
-
return
|
|
327
|
+
return _context6.stop();
|
|
380
328
|
}
|
|
381
329
|
}
|
|
382
|
-
},
|
|
330
|
+
}, _callee6);
|
|
383
331
|
}))); // it('should hide tooltip when v-show is false in Vue', async () => {
|
|
384
332
|
// interface IData {
|
|
385
333
|
// show: boolean
|
|
@@ -403,7 +351,7 @@ describe('Tooltip', function () {
|
|
|
403
351
|
// document.body.appendChild(container);
|
|
404
352
|
// const app = new Vue({
|
|
405
353
|
// render: h => h(
|
|
406
|
-
// 'Test',
|
|
354
|
+
// 'Test',
|
|
407
355
|
// {ref: 'test'}),
|
|
408
356
|
// components: {Test},
|
|
409
357
|
// }).$mount(container);
|
|
@@ -432,7 +380,7 @@ describe('Tooltip', function () {
|
|
|
432
380
|
// </div>
|
|
433
381
|
// `,
|
|
434
382
|
// components: {
|
|
435
|
-
// Tooltip: Tooltip as any,
|
|
383
|
+
// Tooltip: Tooltip as any,
|
|
436
384
|
// Radio: Radio as any,
|
|
437
385
|
// },
|
|
438
386
|
// data: {
|
|
@@ -449,18 +397,18 @@ describe('Tooltip', function () {
|
|
|
449
397
|
// document.body.removeChild(app.$el);
|
|
450
398
|
// });
|
|
451
399
|
|
|
452
|
-
it('should hide layer when we have disabled Tooltip and also hide on next updating', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
453
|
-
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;
|
|
454
402
|
|
|
455
|
-
return _regeneratorRuntime.wrap(function
|
|
403
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context8) {
|
|
456
404
|
while (1) {
|
|
457
|
-
switch (
|
|
405
|
+
switch (_context8.prev = _context8.next) {
|
|
458
406
|
case 0:
|
|
459
407
|
Demo = /*#__PURE__*/function (_Component) {
|
|
460
408
|
_inheritsLoose(Demo, _Component);
|
|
461
409
|
|
|
462
410
|
function Demo() {
|
|
463
|
-
var
|
|
411
|
+
var _context7;
|
|
464
412
|
|
|
465
413
|
var _this;
|
|
466
414
|
|
|
@@ -468,7 +416,7 @@ describe('Tooltip', function () {
|
|
|
468
416
|
args[_key] = arguments[_key];
|
|
469
417
|
}
|
|
470
418
|
|
|
471
|
-
_this = _Component.call.apply(_Component, _concatInstanceProperty(
|
|
419
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context7 = [this]).call(_context7, args)) || this;
|
|
472
420
|
_this.Tooltip = Tooltip;
|
|
473
421
|
return _this;
|
|
474
422
|
}
|
|
@@ -484,23 +432,23 @@ describe('Tooltip', function () {
|
|
|
484
432
|
};
|
|
485
433
|
};
|
|
486
434
|
|
|
487
|
-
|
|
435
|
+
_mount7 = mount(Demo), i = _mount7[0];
|
|
488
436
|
dispatchEvent(i.refs.test, 'mouseenter');
|
|
489
|
-
|
|
437
|
+
_context8.next = 7;
|
|
490
438
|
return wait();
|
|
491
439
|
|
|
492
440
|
case 7:
|
|
493
441
|
content = getElement('.k-tooltip-content');
|
|
494
442
|
expect(content.textContent).eql('hello');
|
|
495
443
|
i.set('disabled', true);
|
|
496
|
-
|
|
444
|
+
_context8.next = 12;
|
|
497
445
|
return wait(500);
|
|
498
446
|
|
|
499
447
|
case 12:
|
|
500
448
|
content = getElement('.k-tooltip-content');
|
|
501
449
|
expect(content).eql(undefined);
|
|
502
450
|
i.set('disabled', false);
|
|
503
|
-
|
|
451
|
+
_context8.next = 17;
|
|
504
452
|
return wait();
|
|
505
453
|
|
|
506
454
|
case 17:
|
|
@@ -509,23 +457,23 @@ describe('Tooltip', function () {
|
|
|
509
457
|
|
|
510
458
|
case 19:
|
|
511
459
|
case "end":
|
|
512
|
-
return
|
|
460
|
+
return _context8.stop();
|
|
513
461
|
}
|
|
514
462
|
}
|
|
515
|
-
},
|
|
463
|
+
}, _callee7);
|
|
516
464
|
})));
|
|
517
|
-
it('should not detect collison when target is not in viewport', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
518
|
-
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;
|
|
519
467
|
|
|
520
|
-
return _regeneratorRuntime.wrap(function
|
|
468
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context10) {
|
|
521
469
|
while (1) {
|
|
522
|
-
switch (
|
|
470
|
+
switch (_context10.prev = _context10.next) {
|
|
523
471
|
case 0:
|
|
524
472
|
Demo = /*#__PURE__*/function (_Component2) {
|
|
525
473
|
_inheritsLoose(Demo, _Component2);
|
|
526
474
|
|
|
527
475
|
function Demo() {
|
|
528
|
-
var
|
|
476
|
+
var _context9;
|
|
529
477
|
|
|
530
478
|
var _this2;
|
|
531
479
|
|
|
@@ -533,7 +481,7 @@ describe('Tooltip', function () {
|
|
|
533
481
|
args[_key2] = arguments[_key2];
|
|
534
482
|
}
|
|
535
483
|
|
|
536
|
-
_this2 = _Component2.call.apply(_Component2, _concatInstanceProperty(
|
|
484
|
+
_this2 = _Component2.call.apply(_Component2, _concatInstanceProperty(_context9 = [this]).call(_context9, args)) || this;
|
|
537
485
|
_this2.Tooltip = Tooltip;
|
|
538
486
|
return _this2;
|
|
539
487
|
}
|
|
@@ -559,11 +507,11 @@ describe('Tooltip', function () {
|
|
|
559
507
|
};
|
|
560
508
|
};
|
|
561
509
|
|
|
562
|
-
|
|
510
|
+
_mount8 = mount(Demo), i = _mount8[0]; // await wait(500);
|
|
563
511
|
// window.scrollTo(0, 10000);
|
|
564
512
|
|
|
565
513
|
i.set('show', true);
|
|
566
|
-
|
|
514
|
+
_context10.next = 7;
|
|
567
515
|
return wait(500);
|
|
568
516
|
|
|
569
517
|
case 7:
|
|
@@ -574,23 +522,23 @@ describe('Tooltip', function () {
|
|
|
574
522
|
|
|
575
523
|
case 11:
|
|
576
524
|
case "end":
|
|
577
|
-
return
|
|
525
|
+
return _context10.stop();
|
|
578
526
|
}
|
|
579
527
|
}
|
|
580
|
-
},
|
|
528
|
+
}, _callee8);
|
|
581
529
|
})));
|
|
582
|
-
it('should add className', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
583
|
-
var Demo,
|
|
530
|
+
it('should add className', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
531
|
+
var Demo, _mount9, instance, element, trigger, dropdown;
|
|
584
532
|
|
|
585
|
-
return _regeneratorRuntime.wrap(function
|
|
533
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context12) {
|
|
586
534
|
while (1) {
|
|
587
|
-
switch (
|
|
535
|
+
switch (_context12.prev = _context12.next) {
|
|
588
536
|
case 0:
|
|
589
537
|
Demo = /*#__PURE__*/function (_Component3) {
|
|
590
538
|
_inheritsLoose(Demo, _Component3);
|
|
591
539
|
|
|
592
540
|
function Demo() {
|
|
593
|
-
var
|
|
541
|
+
var _context11;
|
|
594
542
|
|
|
595
543
|
var _this3;
|
|
596
544
|
|
|
@@ -598,7 +546,7 @@ describe('Tooltip', function () {
|
|
|
598
546
|
args[_key3] = arguments[_key3];
|
|
599
547
|
}
|
|
600
548
|
|
|
601
|
-
_this3 = _Component3.call.apply(_Component3, _concatInstanceProperty(
|
|
549
|
+
_this3 = _Component3.call.apply(_Component3, _concatInstanceProperty(_context11 = [this]).call(_context11, args)) || this;
|
|
602
550
|
_this3.Tooltip = Tooltip;
|
|
603
551
|
return _this3;
|
|
604
552
|
}
|
|
@@ -607,11 +555,11 @@ describe('Tooltip', function () {
|
|
|
607
555
|
}(Component);
|
|
608
556
|
|
|
609
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 ";
|
|
610
|
-
|
|
558
|
+
_mount9 = mount(Demo), instance = _mount9[0], element = _mount9[1];
|
|
611
559
|
trigger = instance.refs.test;
|
|
612
560
|
expect(trigger.className).to.eql('b a');
|
|
613
561
|
dispatchEvent(trigger, 'mouseenter');
|
|
614
|
-
|
|
562
|
+
_context12.next = 8;
|
|
615
563
|
return wait();
|
|
616
564
|
|
|
617
565
|
case 8:
|
|
@@ -620,23 +568,23 @@ describe('Tooltip', function () {
|
|
|
620
568
|
|
|
621
569
|
case 10:
|
|
622
570
|
case "end":
|
|
623
|
-
return
|
|
571
|
+
return _context12.stop();
|
|
624
572
|
}
|
|
625
573
|
}
|
|
626
|
-
},
|
|
574
|
+
}, _callee9);
|
|
627
575
|
})));
|
|
628
|
-
it('should fix the width in small container', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
629
|
-
var Demo,
|
|
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;
|
|
630
578
|
|
|
631
|
-
return _regeneratorRuntime.wrap(function
|
|
579
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context14) {
|
|
632
580
|
while (1) {
|
|
633
|
-
switch (
|
|
581
|
+
switch (_context14.prev = _context14.next) {
|
|
634
582
|
case 0:
|
|
635
583
|
Demo = /*#__PURE__*/function (_Component4) {
|
|
636
584
|
_inheritsLoose(Demo, _Component4);
|
|
637
585
|
|
|
638
586
|
function Demo() {
|
|
639
|
-
var
|
|
587
|
+
var _context13;
|
|
640
588
|
|
|
641
589
|
var _this4;
|
|
642
590
|
|
|
@@ -644,7 +592,7 @@ describe('Tooltip', function () {
|
|
|
644
592
|
args[_key4] = arguments[_key4];
|
|
645
593
|
}
|
|
646
594
|
|
|
647
|
-
_this4 = _Component4.call.apply(_Component4, _concatInstanceProperty(
|
|
595
|
+
_this4 = _Component4.call.apply(_Component4, _concatInstanceProperty(_context13 = [this]).call(_context13, args)) || this;
|
|
648
596
|
_this4.Tooltip = Tooltip;
|
|
649
597
|
_this4.Dialog = Dialog;
|
|
650
598
|
return _this4;
|
|
@@ -653,12 +601,12 @@ describe('Tooltip', function () {
|
|
|
653
601
|
return Demo;
|
|
654
602
|
}(Component);
|
|
655
603
|
|
|
656
|
-
Demo.template = "\n const {Tooltip, Dialog} = this;\n <div style=\"text-align: right; position: relative; width:
|
|
657
|
-
|
|
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];
|
|
658
606
|
trigger = element.querySelector('.trigger');
|
|
659
607
|
expecedWidth = parseInt(tooltipTheme.maxWidth);
|
|
660
608
|
dispatchEvent(trigger, 'mouseenter');
|
|
661
|
-
|
|
609
|
+
_context14.next = 8;
|
|
662
610
|
return wait();
|
|
663
611
|
|
|
664
612
|
case 8:
|
|
@@ -666,12 +614,12 @@ describe('Tooltip', function () {
|
|
|
666
614
|
width = content.offsetWidth;
|
|
667
615
|
expect(width).to.eql(expecedWidth);
|
|
668
616
|
dispatchEvent(trigger, 'mouseleave');
|
|
669
|
-
|
|
617
|
+
_context14.next = 14;
|
|
670
618
|
return wait();
|
|
671
619
|
|
|
672
620
|
case 14:
|
|
673
621
|
dispatchEvent(trigger, 'mouseenter');
|
|
674
|
-
|
|
622
|
+
_context14.next = 17;
|
|
675
623
|
return wait();
|
|
676
624
|
|
|
677
625
|
case 17:
|
|
@@ -680,9 +628,9 @@ describe('Tooltip', function () {
|
|
|
680
628
|
|
|
681
629
|
case 19:
|
|
682
630
|
case "end":
|
|
683
|
-
return
|
|
631
|
+
return _context14.stop();
|
|
684
632
|
}
|
|
685
633
|
}
|
|
686
|
-
},
|
|
634
|
+
}, _callee10);
|
|
687
635
|
})));
|
|
688
636
|
});
|
|
@@ -13,11 +13,16 @@ var defaults = {
|
|
|
13
13
|
|
|
14
14
|
bgColor: '#fff',
|
|
15
15
|
lineHeight: 1.4,
|
|
16
|
-
maxWidth: '
|
|
16
|
+
maxWidth: '312px',
|
|
17
|
+
|
|
18
|
+
get boxShadow() {
|
|
19
|
+
return theme.middleBoxShadow;
|
|
20
|
+
},
|
|
21
|
+
|
|
17
22
|
// arrow
|
|
18
23
|
arrow: {
|
|
19
|
-
borderColor: 'rgba(
|
|
20
|
-
width: '
|
|
24
|
+
borderColor: 'rgba(221, 221, 221, .5)',
|
|
25
|
+
width: '6px'
|
|
21
26
|
},
|
|
22
27
|
// confirm
|
|
23
28
|
confirm: {
|
|
@@ -26,13 +31,13 @@ var defaults = {
|
|
|
26
31
|
// dark
|
|
27
32
|
dark: {
|
|
28
33
|
get bgColor() {
|
|
29
|
-
return theme.color.
|
|
34
|
+
return theme.color.title;
|
|
30
35
|
},
|
|
31
36
|
|
|
32
37
|
color: '#fff',
|
|
33
38
|
|
|
34
39
|
get arrowBorderColor() {
|
|
35
|
-
return theme.color.
|
|
40
|
+
return theme.color.title;
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
},
|
|
@@ -53,9 +58,9 @@ var directionMap = {
|
|
|
53
58
|
};
|
|
54
59
|
export default function makeStyles() {
|
|
55
60
|
var arrowLong = tooltip.arrow.width;
|
|
56
|
-
var arrowShort = "calc(" + arrowLong + " -
|
|
61
|
+
var arrowShort = "calc(" + arrowLong + " - 1px)"; // use &.k-tooltip-content to override css in dropdown menu
|
|
57
62
|
|
|
58
|
-
return /*#__PURE__*/css("&.k-tooltip-content{max-width:", tooltip.maxWidth, ";min-width:0;padding:", tooltip.padding, ";line-height:", tooltip.lineHeight, ";word-wrap:break-word;pointer-events:none;&.k-hoverable,&.k-always{pointer-events:all;}.k-tooltip-arrow{pointer-events:none;&:before,&{position:absolute;display:block;border-style:solid;border-color:transparent;}&:before{content:' ';}&.k-top,&.k-bottom{&:before,&{border-width:", arrowLong, " ", arrowShort, ";}&:before{left:calc(-1 * ", arrowShort, ");}}&.k-top{top:calc(-2 * ", arrowLong, ");&:before{top:calc(-", arrowLong, " + 1px);}}&.k-bottom{bottom:calc(-2 * ", arrowLong, ");&:before{bottom:calc(-", arrowLong, " + 1px);}}&.k-left,&.k-right{&:before,&{border-width:", arrowShort, " ", arrowLong, ";}&:before{top:calc(-1 * ", arrowShort, ");}}&.k-left{left:calc(-2 * ", arrowLong, ");&:before{left:calc(-", arrowLong, " + 1px);}}&.k-right{right:calc(-2 * ", arrowLong, ");&:before{right:calc(-", arrowLong, " + 1px);}}}", _mapInstanceProperty(themes).call(themes, function (theme) {
|
|
63
|
+
return /*#__PURE__*/css("&.k-tooltip-content{max-width:", tooltip.maxWidth, ";min-width:0;padding:", tooltip.padding, ";line-height:", tooltip.lineHeight, ";word-wrap:break-word;pointer-events:none;box-shadow:", tooltip.boxShadow, ";&.k-hoverable,&.k-always{pointer-events:all;}.k-tooltip-arrow{pointer-events:none;&:before,&{position:absolute;display:block;border-style:solid;border-color:transparent;}&:before{content:' ';}&.k-top,&.k-bottom{&:before,&{border-width:", arrowLong, " ", arrowShort, ";}&:before{left:calc(-1 * ", arrowShort, ");}}&.k-top{top:calc(-2 * ", arrowLong, ");&:before{top:calc(-", arrowLong, " + 1px);}}&.k-bottom{bottom:calc(-2 * ", arrowLong, ");&:before{bottom:calc(-", arrowLong, " + 1px);}}&.k-left,&.k-right{&:before,&{border-width:", arrowShort, " ", arrowLong, ";}&:before{top:calc(-1 * ", arrowShort, ");}}&.k-left{left:calc(-2 * ", arrowLong, ");&:before{left:calc(-", arrowLong, " + 1px);}}&.k-right{right:calc(-2 * ", arrowLong, ");&:before{right:calc(-", arrowLong, " + 1px);}}}", _mapInstanceProperty(themes).call(themes, function (theme) {
|
|
59
64
|
var _context;
|
|
60
65
|
|
|
61
66
|
var borderColor;
|
|
@@ -76,5 +81,5 @@ export default function makeStyles() {
|
|
|
76
81
|
var borderDirection = directionMap[direction];
|
|
77
82
|
return /*#__PURE__*/css("&.k-", direction, "{border-", borderDirection, "-color:", borderColor, ";&:before{border-", borderDirection, "-color:", bgColor, ";}}");
|
|
78
83
|
}), ";}}");
|
|
79
|
-
}), ".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, ";}}");
|
|
80
85
|
}
|
|
@@ -37,7 +37,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
37
37
|
var _this$check = this.check,
|
|
38
38
|
isCheckAll = _this$check.isCheckAll,
|
|
39
39
|
toggleCheckAll = _this$check.toggleCheckAll,
|
|
40
|
-
onCheckboxChange = _this$check.onCheckboxChange
|
|
40
|
+
onCheckboxChange = _this$check.onCheckboxChange,
|
|
41
|
+
isIndeterminate = _this$check.isIndeterminate;
|
|
41
42
|
var classNameObj = (_classNameObj = {
|
|
42
43
|
'k-transfer': true
|
|
43
44
|
}, _classNameObj[className] = className, _classNameObj[makeStyles()] = true, _classNameObj);
|
|
@@ -50,6 +51,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
50
51
|
return [_$ce(2, 'div', [this.get(model + "CheckedKeys.length"), _$ct(' /\n '), data.length], 0, 'k-transfer-count'), _$cc(Checkbox, {
|
|
51
52
|
'className': 'c-ellipsis',
|
|
52
53
|
'value': isCheckAll(model),
|
|
54
|
+
'indeterminate': isIndeterminate(model),
|
|
53
55
|
'ev-click': toggleCheckAll.bind(null, model),
|
|
54
56
|
'children': title
|
|
55
57
|
})];
|
|
@@ -63,5 +63,5 @@ setDefault(function () {
|
|
|
63
63
|
}).transfer;
|
|
64
64
|
});
|
|
65
65
|
export function makeStyles() {
|
|
66
|
-
return /*#__PURE__*/css("font-size:", transfer.fontSize, ";.k-transfer-panel,.k-transfer-arrows{display:inline-block;vertical-align:middle;}.k-transfer-panel{width:", transfer.panel.width, ";border:", transfer.panel.border, ";border-radius:", transfer.panel.borderRadius, ";height:", transfer.panel.height, ";display:inline-flex;flex-direction:column;}.k-transfer-title{line-height:", transfer.title.lineHeight, ";background:", transfer.title.bgColor, ";padding:", transfer.title.padding, ";.k-checkbox{color:", transfer.title.color, ";font-size:", transfer.title.fontSize, ";}}.k-transfer-count{float:right;margin-left:", transfer.title.countGap, ";}.k-transfer-list{overflow:auto;position:relative;flex:1;}.k-transfer-item{color:", transfer.item.color, ";background:", transfer.item.bgColor, ";user-select:none;width:100%;&:not(.k-disabled):hover{background:", transfer.item.hoverBgColor, ";color:", transfer.item.hoverColor, ";p{color:", transfer.item.hoverColor, ";}}.k-checkbox{padding:", transfer.item.padding, ";display:flex;}p{margin:0;color:", transfer.item.descColor, ";}&.k-disabled{p{color:", theme.color.disabled, ";}}}.k-input{width:auto;margin:", transfer.searchGap, ";}.k-transfer-arrows{.k-btn{display:flex;margin:", transfer.arrow.gap, ";}}");
|
|
66
|
+
return /*#__PURE__*/css("font-size:", transfer.fontSize, ";.k-transfer-panel,.k-transfer-arrows{display:inline-block;vertical-align:middle;}.k-transfer-panel{width:", transfer.panel.width, ";border:", transfer.panel.border, ";border-radius:", transfer.panel.borderRadius, ";height:", transfer.panel.height, ";display:inline-flex;flex-direction:column;overflow:auto;}.k-transfer-title{line-height:", transfer.title.lineHeight, ";background:", transfer.title.bgColor, ";padding:", transfer.title.padding, ";.k-checkbox{color:", transfer.title.color, ";font-size:", transfer.title.fontSize, ";}}.k-transfer-count{float:right;margin-left:", transfer.title.countGap, ";}.k-transfer-list{overflow:auto;position:relative;flex:1;}.k-transfer-item{color:", transfer.item.color, ";background:", transfer.item.bgColor, ";user-select:none;width:100%;&:not(.k-disabled):hover{background:", transfer.item.hoverBgColor, ";color:", transfer.item.hoverColor, ";p{color:", transfer.item.hoverColor, ";}}.k-checkbox{padding:", transfer.item.padding, ";display:flex;}p{margin:0;color:", transfer.item.descColor, ";}&.k-disabled{p{color:", theme.color.disabled, ";}}}.k-input{width:auto;margin:", transfer.searchGap, ";}.k-transfer-arrows{.k-btn{display:flex;margin:", transfer.arrow.gap, ";}}");
|
|
67
67
|
}
|
|
@@ -4,4 +4,5 @@ export declare function useCheck({ getEnabledData, getShowedData }: ReturnType<t
|
|
|
4
4
|
isCheckAll: (model: Model) => boolean | 0;
|
|
5
5
|
toggleCheckAll: (model: Model, e: MouseEvent) => void;
|
|
6
6
|
onCheckboxChange: (model: Model, index: number, e: MouseEvent) => void;
|
|
7
|
+
isIndeterminate: (model: Model) => boolean;
|
|
7
8
|
};
|
|
@@ -33,6 +33,12 @@ export function useCheck(_ref) {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
function isIndeterminate(model) {
|
|
37
|
+
var checked = instance.get(model + "CheckedKeys");
|
|
38
|
+
var data = getEnabledData(model);
|
|
39
|
+
return checked.length > 0 && checked.length < data.length;
|
|
40
|
+
}
|
|
41
|
+
|
|
36
42
|
function onCheckboxChange(model, index, e) {
|
|
37
43
|
if (startIndex === undefined || !e.shiftKey) {
|
|
38
44
|
startIndex = index;
|
|
@@ -84,6 +90,7 @@ export function useCheck(_ref) {
|
|
|
84
90
|
return {
|
|
85
91
|
isCheckAll: isCheckAll,
|
|
86
92
|
toggleCheckAll: toggleCheckAll,
|
|
87
|
-
onCheckboxChange: onCheckboxChange
|
|
93
|
+
onCheckboxChange: onCheckboxChange,
|
|
94
|
+
isIndeterminate: isIndeterminate
|
|
88
95
|
};
|
|
89
96
|
}
|
|
@@ -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) {
|