@king-design/react 2.0.0-beta.1 → 2.0.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.
Files changed (149) hide show
  1. package/__tests__/__snapshots__/React Demos.md +321 -295
  2. package/__tests__/index.ts +5 -2
  3. package/__tests__/karma.conf.js +1 -1
  4. package/components/breadcrumb/item.d.ts +1 -1
  5. package/components/breadcrumb/item.js +3 -14
  6. package/components/breadcrumb/styles.js +1 -1
  7. package/components/button/index.vdt.js +26 -17
  8. package/components/button/styles.d.ts +82 -1
  9. package/components/button/styles.js +16 -2
  10. package/components/card/styles.js +1 -1
  11. package/components/carousel/styles.js +4 -1
  12. package/components/carousel/useSlide.js +10 -9
  13. package/components/cascader/index.spec.js +89 -1
  14. package/components/cascader/index.vdt.js +4 -4
  15. package/components/cascader/useLabel.js +8 -12
  16. package/components/checkbox/index.vdt.js +15 -10
  17. package/components/checkbox/styles.js +2 -2
  18. package/components/collapse/item.vdt.js +2 -1
  19. package/components/collapse/styles.js +5 -1
  20. package/components/colorpicker/index.d.ts +2 -0
  21. package/components/colorpicker/index.js +2 -1
  22. package/components/colorpicker/index.spec.js +1 -1
  23. package/components/colorpicker/index.vdt.js +3 -1
  24. package/components/context.d.ts +5 -2
  25. package/components/context.js +7 -4
  26. package/components/datepicker/helpers.d.ts +2 -1
  27. package/components/datepicker/helpers.js +8 -2
  28. package/components/datepicker/index.spec.js +1 -1
  29. package/components/datepicker/index.vdt.js +10 -5
  30. package/components/datepicker/styles.d.ts +46 -1
  31. package/components/diagram/shapes/generateShapes.js +3 -3
  32. package/components/diagram/shapes/line.d.ts +2 -2
  33. package/components/diagram/shapes/line.js +0 -1
  34. package/components/dialog/base.d.ts +2 -0
  35. package/components/dialog/base.js +2 -1
  36. package/components/dialog/index.spec.js +59 -94
  37. package/components/dialog/styles.js +5 -1
  38. package/components/dialog/useFixBody.d.ts +6 -0
  39. package/components/dialog/useFixBody.js +12 -0
  40. package/components/drawer/index.spec.js +5 -5
  41. package/components/drawer/styles.js +1 -1
  42. package/components/dropdown/dropdown.js +1 -0
  43. package/components/dropdown/index.js +1 -2
  44. package/components/dropdown/index.spec.js +3 -3
  45. package/components/dropdown/styles.js +1 -1
  46. package/components/editable/index.vdt.js +2 -1
  47. package/components/editable/styles.d.ts +8 -1
  48. package/components/form/index.spec.js +10 -12
  49. package/components/form/item.vdt.js +13 -9
  50. package/components/form/useError.d.ts +5 -1
  51. package/components/form/useError.js +3 -1
  52. package/components/form/useValidate.js +2 -2
  53. package/components/grid/col.vdt.js +4 -2
  54. package/components/grid/styles.js +1 -1
  55. package/components/grid/useGutter.d.ts +1 -1
  56. package/components/icon/index.vdt.js +3 -2
  57. package/components/icon/styles.js +8 -4
  58. package/components/input/index.d.ts +1 -0
  59. package/components/input/index.js +2 -1
  60. package/components/input/index.vdt.js +47 -32
  61. package/components/input/search.vdt.js +4 -2
  62. package/components/input/styles.js +8 -3
  63. package/components/layout/styles.d.ts +1 -1
  64. package/components/layout/styles.js +7 -3
  65. package/components/menu/index.spec.js +15 -8
  66. package/components/menu/item.d.ts +1 -2
  67. package/components/menu/item.js +10 -17
  68. package/components/menu/item.vdt.js +4 -4
  69. package/components/menu/menu.d.ts +3 -0
  70. package/components/menu/menu.js +4 -0
  71. package/components/menu/styles.d.ts +62 -1
  72. package/components/menu/styles.js +6 -2
  73. package/components/menu/useExpanded.d.ts +1 -4
  74. package/components/menu/useHighlight.d.ts +5 -8
  75. package/components/menu/useHighlight.js +44 -33
  76. package/components/message/index.spec.js +1 -1
  77. package/components/message/styles.js +6 -2
  78. package/components/pagination/styles.js +1 -1
  79. package/components/radio/index.vdt.js +14 -9
  80. package/components/radio/styles.js +9 -1
  81. package/components/rate/styles.js +5 -1
  82. package/components/scrollSelect/styles.d.ts +14 -1
  83. package/components/scrollSelect/styles.js +9 -1
  84. package/components/select/base.vdt.js +135 -121
  85. package/components/select/index.spec.js +1 -1
  86. package/components/select/menu.vdt.js +1 -0
  87. package/components/select/styles.js +9 -4
  88. package/components/select/useSearchable.d.ts +1 -1
  89. package/components/slider/styles.js +5 -1
  90. package/components/spinner/index.d.ts +1 -1
  91. package/components/spinner/index.js +1 -1
  92. package/components/split/style.js +1 -1
  93. package/components/steps/context.d.ts +1 -1
  94. package/components/steps/styles.js +5 -1
  95. package/components/switch/styles.js +5 -1
  96. package/components/table/index.d.ts +1 -0
  97. package/components/table/index.spec.js +2 -1
  98. package/components/table/row.vdt.js +12 -4
  99. package/components/table/styles.js +6 -1
  100. package/components/table/table.d.ts +1 -0
  101. package/components/table/table.js +2 -1
  102. package/components/table/table.vdt.js +30 -27
  103. package/components/table/useColumns.d.ts +1 -1
  104. package/components/table/useFixedColumns.d.ts +1 -1
  105. package/components/table/useFixedColumns.js +5 -2
  106. package/components/table/useGroup.d.ts +1 -1
  107. package/components/table/useResizable.d.ts +1 -1
  108. package/components/table/useSortable.d.ts +1 -1
  109. package/components/table/useWidth.js +7 -1
  110. package/components/tabs/index.spec.js +1 -1
  111. package/components/tabs/styles.js +9 -2
  112. package/components/tabs/tab.vdt.js +2 -1
  113. package/components/tabs/useActiveBar.js +6 -3
  114. package/components/tag/base.js +1 -0
  115. package/components/tag/styles.js +8 -2
  116. package/components/timepicker/constants.d.ts +2 -1
  117. package/components/timepicker/constants.js +3 -2
  118. package/components/timepicker/index.spec.js +36 -35
  119. package/components/timepicker/useStep.js +3 -3
  120. package/components/timepicker/useValue.js +2 -2
  121. package/components/tooltip/index.spec.js +32 -25
  122. package/components/transfer/index.spec.js +20 -19
  123. package/components/transfer/styles.js +2 -6
  124. package/components/tree/index.d.ts +1 -1
  125. package/components/tree/index.js +1 -1
  126. package/components/tree/index.spec.js +20 -19
  127. package/components/tree/index.vdt.js +1 -0
  128. package/components/tree/styles.js +5 -1
  129. package/components/treeSelect/index.spec.js +5 -5
  130. package/components/treeSelect/styles.js +5 -1
  131. package/components/upload/index.d.ts +1 -1
  132. package/components/upload/index.spec.js +1 -1
  133. package/components/upload/index.vdt.js +10 -11
  134. package/components/upload/styles.js +5 -1
  135. package/components/utils.d.ts +1 -1
  136. package/components/wave/index.d.ts +19 -0
  137. package/components/wave/index.js +120 -0
  138. package/components/wave/styles.d.ts +2 -0
  139. package/components/wave/styles.js +17 -0
  140. package/hooks/useRouter.d.ts +1 -0
  141. package/hooks/useRouter.js +10 -0
  142. package/i18n/en-US.d.ts +1 -0
  143. package/i18n/en-US.js +1 -0
  144. package/index.d.ts +3 -2
  145. package/index.js +3 -2
  146. package/package.json +2 -2
  147. package/styles/global.js +4 -3
  148. package/styles/theme.d.ts +16 -7
  149. package/styles/theme.js +15 -7
@@ -38,7 +38,7 @@ describe('Colorpicker', function () {
38
38
  case 0:
39
39
  unmount();
40
40
  _context2.next = 3;
41
- return wait(400);
41
+ return wait(500);
42
42
 
43
43
  case 3:
44
44
  case "end":
@@ -18,7 +18,8 @@ export default function ($props, $blocks, $__proto__) {
18
18
  presets = _this$get.presets,
19
19
  value = _this$get.value,
20
20
  size = _this$get.size,
21
- disabled = _this$get.disabled;
21
+ disabled = _this$get.disabled,
22
+ container = _this$get.container;
22
23
 
23
24
  var classNameObj = (_classNameObj = {
24
25
  'k-colorpicker': true
@@ -33,6 +34,7 @@ export default function ($props, $blocks, $__proto__) {
33
34
  },
34
35
  'trigger': 'click',
35
36
  'disabled': disabled,
37
+ 'container': container,
36
38
  'children': [_$ce(2, 'div', _$ce(2, 'div', null, 1, 'k-colorpicker-inner', {
37
39
  'style': {
38
40
  backgroundColor: value
@@ -2,10 +2,13 @@ import { Component, ComponentConstructor } from 'intact-react';
2
2
  export interface ProviderProps<T> {
3
3
  value?: T;
4
4
  }
5
+ export interface ConsumerProps<T> {
6
+ defaultValue?: T;
7
+ }
5
8
  declare type ProviderConstructor<T> = ComponentConstructor<Component<ProviderProps<T>>>;
6
- declare type ConsumerConstructor = ComponentConstructor<Component<{}>>;
9
+ declare type ConsumerConstructor<T> = ComponentConstructor<Component<ConsumerProps<T>>>;
7
10
  export declare function createContext<T = any>(defaultValue?: T): {
8
11
  Provider: ProviderConstructor<T>;
9
- Consumer: ConsumerConstructor;
12
+ Consumer: ConsumerConstructor<T>;
10
13
  };
11
14
  export {};
@@ -53,14 +53,14 @@ export function createContext(defaultValue) {
53
53
  }
54
54
 
55
55
  _this2 = _Component2.call.apply(_Component2, _concatInstanceProperty(_context2 = [this]).call(_context2, args)) || this;
56
- _this2.ref = inject(injectionKey);
56
+ _this2.ref = inject(injectionKey, null);
57
57
  return _this2;
58
58
  }
59
59
 
60
60
  return Consumer;
61
61
  }(Component);
62
62
 
63
- Consumer.template = consumertemplate;
63
+ Consumer.template = consumerTemplate;
64
64
  return {
65
65
  Provider: Provider,
66
66
  Consumer: Consumer
@@ -71,8 +71,11 @@ function providerTemplate() {
71
71
  return this.$props.children;
72
72
  }
73
73
 
74
- function consumertemplate() {
75
- return this.$props.children(this.ref.value);
74
+ function consumerTemplate() {
75
+ var ref = this.ref;
76
+ var props = this.$props;
77
+ var value = ref && ref.value || props && props.value;
78
+ return this.$props.children(value);
76
79
  } // Maybe like legency context api of React
77
80
  // Error: Can not use it in multiple instances.
78
81
  // export function Context<T = any>(defaultValue?: T) {
@@ -1,7 +1,8 @@
1
1
  import dayjs, { Dayjs, OpUnitType } from 'dayjs';
2
2
  import { StateValueItem } from './basepicker';
3
- export declare function getNowDate(): dayjs.Dayjs;
3
+ export declare function getNowDate(isEnd?: boolean): dayjs.Dayjs;
4
4
  export declare function clearTime(date: Date): void;
5
+ export declare function endTime(date: Date): void;
5
6
  export declare function isEqual(a: Dayjs | undefined | null, b: Dayjs | undefined | null, type?: OpUnitType): boolean;
6
7
  export declare function isLT(a: Dayjs | undefined | null, b: Dayjs | undefined | null, type?: OpUnitType): boolean;
7
8
  export declare function isGT(a: Dayjs | undefined | null, b: Dayjs | undefined | null, type?: OpUnitType): boolean;
@@ -2,10 +2,10 @@ import _construct from "@babel/runtime-corejs3/helpers/construct";
2
2
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
3
3
  import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js/instance/find-index";
4
4
  import dayjs from 'dayjs';
5
- export function getNowDate() {
5
+ export function getNowDate(isEnd) {
6
6
  // only date without time
7
7
  var now = new Date();
8
- clearTime(now);
8
+ isEnd ? endTime(now) : clearTime(now);
9
9
  return dayjs(now);
10
10
  }
11
11
  export function clearTime(date) {
@@ -14,6 +14,12 @@ export function clearTime(date) {
14
14
  date.setSeconds(0);
15
15
  date.setMilliseconds(0);
16
16
  }
17
+ export function endTime(date) {
18
+ date.setHours(23);
19
+ date.setMinutes(59);
20
+ date.setSeconds(59);
21
+ date.setMilliseconds(999);
22
+ }
17
23
  export function isEqual(a, b, type) {
18
24
  if (type === void 0) {
19
25
  type = 'date';
@@ -28,7 +28,7 @@ describe('Datepicker', function () {
28
28
  case 0:
29
29
  unmount();
30
30
  _context.next = 3;
31
- return wait(400);
31
+ return wait(500);
32
32
 
33
33
  case 3:
34
34
  case "end":
@@ -1,4 +1,5 @@
1
- import { createElementVNode as _$ce, createUnknownComponentVNode as _$cc, superCall as _$su, extend as _$ex, EMPTY_OBJ as _$em, className as _$cn, map as _$ma, createTextVNode as _$ct } from 'intact-react';
1
+ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
2
+ import { createElementVNode as _$ce, createUnknownComponentVNode as _$cc, superCall as _$su, extend as _$ex, EMPTY_OBJ as _$em, className as _$cn, createTextVNode as _$ct } from 'intact-react';
2
3
  import { linkEvent } from 'intact';
3
4
  import { DropdownMenu } from '../dropdown';
4
5
  import { DatepickerCalendar } from './calendar';
@@ -102,13 +103,17 @@ export default function ($props, $blocks, $__proto__) {
102
103
  __$blocks = _$ex({}, $blocks);
103
104
 
104
105
  return (_$blocks['base-menu'] = function ($super) {
106
+ var _this2 = this;
107
+
105
108
  return _$cc(DropdownMenu, {
106
109
  'className': _$cn(classNameObj),
107
- 'children': [shortcuts && shortcuts.length ? _$ce(2, 'div', _$ma(shortcuts, function ($value, $key) {
108
- return _$ce(2, 'div', isFunction($value.label) ? $value.label() : $value.label, 0, 'k-datepicker-shortcut', {
109
- 'ev-click': linkEvent($value, this.setByShortcut)
110
+ 'children': [shortcuts && shortcuts.length ? _$ce(2, 'div', _mapInstanceProperty(shortcuts).call(shortcuts, function ($value) {
111
+ var label = isFunction($value.label) ? $value.label() : $value.label;
112
+ return _$ce(2, 'div', label, 0, 'k-datepicker-shortcut c-ellipsis', {
113
+ 'title': label,
114
+ 'ev-click': linkEvent($value, _this2.setByShortcut)
110
115
  });
111
- }, $this), 4, 'k-datepicker-shortcuts') : undefined, _$ce(2, 'div', [_$ce(2, 'div', [generatePanel(PanelFlags.Start), _$ct('\n '), range ? generatePanel(PanelFlags.End) : null], 0, 'k-datepicker-calendars'), type === 'datetime' ? _$ce(2, 'div', _$cc(Button, {
116
+ }), 0, 'k-datepicker-shortcuts') : undefined, _$ce(2, 'div', [_$ce(2, 'div', [generatePanel(PanelFlags.Start), _$ct('\n '), range ? generatePanel(PanelFlags.End) : null], 0, 'k-datepicker-calendars'), type === 'datetime' ? _$ce(2, 'div', _$cc(Button, {
112
117
  'type': 'primary',
113
118
  'size': 'small',
114
119
  'disabled': isDisabledConfirm(),
@@ -1,5 +1,50 @@
1
1
  import '../../styles/global';
2
- declare let datepicker: any;
2
+ declare const defaults: {
3
+ width: string;
4
+ padding: string;
5
+ border: string;
6
+ item: {
7
+ gutter: string;
8
+ height: string;
9
+ readonly hoverBgColor: string;
10
+ readonly exceedColor: string;
11
+ readonly todayBorder: string;
12
+ readonly borderRadius: string;
13
+ active: {
14
+ readonly bgColor: string;
15
+ color: string;
16
+ todayBorderColor: string;
17
+ };
18
+ disabled: {
19
+ color: string;
20
+ hoverBgColor: string;
21
+ };
22
+ range: {
23
+ readonly bgColor: string;
24
+ };
25
+ };
26
+ weekday: {
27
+ padding: string;
28
+ };
29
+ month: {
30
+ padding: string;
31
+ fontSize: string;
32
+ valueGap: string;
33
+ };
34
+ footer: {
35
+ padding: string;
36
+ };
37
+ shortcuts: {
38
+ width: string;
39
+ padding: string;
40
+ shortcut: {
41
+ readonly hoverBgcolor: string;
42
+ height: string;
43
+ padding: string;
44
+ };
45
+ };
46
+ };
47
+ declare let datepicker: typeof defaults;
3
48
  export { datepicker };
4
49
  export declare function makePanelStyles(): string;
5
50
  export declare function makeCalendarStyles(): string;
@@ -26,10 +26,10 @@ var shapes = {
26
26
  var components = {};
27
27
 
28
28
  var _loop = function _loop(key) {
29
- var _class, _temp;
29
+ var _class;
30
30
 
31
31
  var value = shapes[key];
32
- components[key] = (_temp = _class = /*#__PURE__*/function (_DShape) {
32
+ components[key] = (_class = /*#__PURE__*/function (_DShape) {
33
33
  _inheritsLoose(_class, _DShape);
34
34
 
35
35
  function _class() {
@@ -50,7 +50,7 @@ var _loop = function _loop(key) {
50
50
  };
51
51
 
52
52
  return _class;
53
- }(DShape), _class.displayName = "D" + key, _temp);
53
+ }(DShape), _class.displayName = "D" + key, _class);
54
54
  };
55
55
 
56
56
  for (var key in shapes) {
@@ -6,10 +6,10 @@ export interface DLineProps extends DBaseProps {
6
6
  endArrow?: Arrow;
7
7
  startPoint?: Point;
8
8
  endPoint?: Point;
9
- exit?: Point;
10
- entry?: Point;
11
9
  from?: Key;
12
10
  to?: Key;
11
+ exit?: Point;
12
+ entry?: Point;
13
13
  }
14
14
  declare type Arrow = 'none' | 'classic' | 'classicThin' | 'block' | 'blockThin' | 'open' | 'openThin' | 'oval' | 'diamond' | 'diamondThin';
15
15
  declare type Point = [number, number];
@@ -12,7 +12,6 @@ var mxCell = mx.mxCell,
12
12
  var arrows = ['none', 'classic', 'classicThin', 'block', 'blockThin', 'open', 'openThin', 'oval', 'diamond', 'diamondThin'];
13
13
 
14
14
  var typeDefs = _extends({}, DBase.typeDefs, {
15
- strokeStyle: ['solid', 'dashed', 'dotted'],
16
15
  type: ['rounded', 'sharp', 'curved', 'straight'],
17
16
  startArrow: arrows,
18
17
  endArrow: arrows,
@@ -2,6 +2,7 @@ import { Component, TypeDefs } from 'intact-react';
2
2
  import { Sizes } from '../../styles/utils';
3
3
  import { Container } from '../portal';
4
4
  import { SHOW, HIDE } from './constants';
5
+ import { setHooks } from './useFixBody';
5
6
  import type { Events } from '../types';
6
7
  export interface BaseDialogProps {
7
8
  title?: string;
@@ -42,6 +43,7 @@ export declare class BaseDialog<T extends BaseDialogProps = BaseDialogProps, E e
42
43
  static typeDefs: Required<TypeDefs<BaseDialogProps>>;
43
44
  static defaults: () => Partial<BaseDialogProps>;
44
45
  static events: Events<BaseDialogEvents>;
46
+ static setHooks: typeof setHooks;
45
47
  dialogRef: import("intact").RefObject<HTMLDivElement>;
46
48
  private overlayRef;
47
49
  private drag;
@@ -12,7 +12,7 @@ import { useMouseOutsidable } from '../../hooks/useMouseOutsidable';
12
12
  import { useDraggable } from './useDraggable';
13
13
  import { useEscClosable } from './useEscClosable';
14
14
  import { SHOW, HIDE, DIALOG } from './constants';
15
- import { useFixBody } from './useFixBody';
15
+ import { useFixBody, setHooks } from './useFixBody';
16
16
  var typeDefs = {
17
17
  title: String,
18
18
  value: Boolean,
@@ -153,6 +153,7 @@ BaseDialog.template = template;
153
153
  BaseDialog.typeDefs = typeDefs;
154
154
  BaseDialog.defaults = defaults;
155
155
  BaseDialog.events = events;
156
+ BaseDialog.setHooks = setHooks;
156
157
 
157
158
  __decorate([bind], BaseDialog.prototype, "terminate", null);
158
159
 
@@ -7,7 +7,7 @@ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
7
7
 
8
8
  function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
9
 
10
- function _unsupportedIterableToArray(o, minLen) { var _context17; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context17 = Object.prototype.toString.call(o)).call(_context17, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
+ function _unsupportedIterableToArray(o, minLen) { var _context16; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context16 = Object.prototype.toString.call(o)).call(_context16, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
11
 
12
12
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
13
13
 
@@ -20,13 +20,12 @@ import { Dialog, BaseDialog } from './';
20
20
  import { getElement, mount, unmount, dispatchEvent, wait } from '../../test/utils';
21
21
  import BasicDemo from '~/components/dialog/demos/basic';
22
22
  import AsyncCloseDemo from '~/components/dialog/demos/asyncClose';
23
- import AsyncOpenDemo from '~/components/dialog/demos/asyncOpen';
24
23
  import TerminateDemo from '~/components/dialog/demos/terminate';
25
24
  import DestroyDemo from '~/components/dialog/demos/destroy';
26
25
  describe('Dialog', function () {
27
26
  afterEach(function (done) {
28
27
  unmount();
29
- setTimeout(done, 400);
28
+ setTimeout(done, 500);
30
29
  });
31
30
 
32
31
  function expectDialog() {
@@ -308,12 +307,12 @@ describe('Dialog', function () {
308
307
  switch (_context9.prev = _context9.next) {
309
308
  case 0:
310
309
  this.timeout(0);
311
- req = require.context('~/components/dialog/demos', true, /^((?!async).)*index\.ts$/i);
310
+ req = require.context('~/components/dialog/demos', true, /^((?!static).)*index\.ts$/i);
312
311
  _iterator = _createForOfIteratorHelperLoose(_keysInstanceProperty(req).call(req));
313
312
 
314
313
  case 3:
315
314
  if ((_step = _iterator()).done) {
316
- _context9.next = 18;
315
+ _context9.next = 16;
317
316
  break;
318
317
  }
319
318
 
@@ -324,39 +323,31 @@ describe('Dialog', function () {
324
323
  break;
325
324
  }
326
325
 
327
- return _context9.abrupt("continue", 16);
326
+ return _context9.abrupt("continue", 14);
328
327
 
329
328
  case 7:
330
- if (!/static/.test(item)) {
331
- _context9.next = 9;
332
- break;
333
- }
334
-
335
- return _context9.abrupt("continue", 16);
336
-
337
- case 9:
338
329
  Demo = req(item).default;
339
330
  _mount7 = mount(Demo), instance = _mount7[0], element = _mount7[1];
340
331
  dispatchEvent(element.querySelector('.k-btn') || element, 'click');
341
- _context9.next = 14;
332
+ _context9.next = 12;
342
333
  return wait();
343
334
 
344
- case 14:
335
+ case 12:
345
336
  expectDialog();
346
337
  unmount();
347
338
 
348
- case 16:
339
+ case 14:
349
340
  _context9.next = 3;
350
341
  break;
351
342
 
352
- case 18:
353
- _context9.next = 20;
343
+ case 16:
344
+ _context9.next = 18;
354
345
  return wait(500);
355
346
 
356
- case 20:
347
+ case 18:
357
348
  expect(document.body.getAttribute('style')).to.be.null;
358
349
 
359
- case 21:
350
+ case 19:
360
351
  case "end":
361
352
  return _context9.stop();
362
353
  }
@@ -394,42 +385,16 @@ describe('Dialog', function () {
394
385
  }
395
386
  }, _callee7);
396
387
  })));
397
- it('async open', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
398
- var _mount9, instance, element, dialog;
388
+ it('drag', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
389
+ var _mount9, instance, element, dialog, top, header;
399
390
 
400
391
  return _regeneratorRuntime.wrap(function _callee8$(_context11) {
401
392
  while (1) {
402
393
  switch (_context11.prev = _context11.next) {
403
394
  case 0:
404
- this.timeout(0);
405
- _mount9 = mount(AsyncOpenDemo), instance = _mount9[0], element = _mount9[1];
395
+ _mount9 = mount(BasicDemo), instance = _mount9[0], element = _mount9[1];
406
396
  dispatchEvent(element.firstChild, 'click');
407
- expect(getElement('.k-dialog')).to.be.undefined;
408
- _context11.next = 6;
409
- return wait(3000);
410
-
411
- case 6:
412
- dialog = expectDialog(); // close
413
-
414
- dispatchEvent(dialog.querySelector('.k-dialog-ok'), 'click');
415
-
416
- case 8:
417
- case "end":
418
- return _context11.stop();
419
- }
420
- }
421
- }, _callee8, this);
422
- })));
423
- it('drag', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
424
- var _mount10, instance, element, dialog, top, header;
425
-
426
- return _regeneratorRuntime.wrap(function _callee9$(_context12) {
427
- while (1) {
428
- switch (_context12.prev = _context12.next) {
429
- case 0:
430
- _mount10 = mount(BasicDemo), instance = _mount10[0], element = _mount10[1];
431
- dispatchEvent(element.firstChild, 'click');
432
- _context12.next = 4;
397
+ _context11.next = 4;
433
398
  return wait();
434
399
 
435
400
  case 4:
@@ -444,7 +409,7 @@ describe('Dialog', function () {
444
409
  clientY: -1
445
410
  });
446
411
  dispatchEvent(document, 'mouseup');
447
- _context12.next = 12;
412
+ _context11.next = 12;
448
413
  return wait();
449
414
 
450
415
  case 12:
@@ -452,28 +417,28 @@ describe('Dialog', function () {
452
417
 
453
418
  case 13:
454
419
  case "end":
455
- return _context12.stop();
420
+ return _context11.stop();
456
421
  }
457
422
  }
458
- }, _callee9);
423
+ }, _callee8);
459
424
  })));
460
- it('static methods', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
425
+ it('static methods', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
461
426
  var cb, dialog, cb1, cb2, overlay;
462
- return _regeneratorRuntime.wrap(function _callee10$(_context13) {
427
+ return _regeneratorRuntime.wrap(function _callee9$(_context12) {
463
428
  while (1) {
464
- switch (_context13.prev = _context13.next) {
429
+ switch (_context12.prev = _context12.next) {
465
430
  case 0:
466
431
  cb = sinon.spy();
467
432
  Dialog.success({
468
433
  content: 'test'
469
434
  }).then(cb);
470
- _context13.next = 4;
435
+ _context12.next = 4;
471
436
  return wait();
472
437
 
473
438
  case 4:
474
439
  dialog = expectDialog();
475
440
  dialog.querySelector('.k-btn').click();
476
- _context13.next = 8;
441
+ _context12.next = 8;
477
442
  return wait();
478
443
 
479
444
  case 8:
@@ -484,13 +449,13 @@ describe('Dialog', function () {
484
449
  hideIcon: true,
485
450
  hideClose: false
486
451
  }).then(cb, cb1);
487
- _context13.next = 13;
452
+ _context12.next = 13;
488
453
  return wait();
489
454
 
490
455
  case 13:
491
456
  dialog = expectDialog();
492
457
  dialog.querySelector('.k-dialog-cancel').click();
493
- _context13.next = 17;
458
+ _context12.next = 17;
494
459
  return wait();
495
460
 
496
461
  case 17:
@@ -500,7 +465,7 @@ describe('Dialog', function () {
500
465
  title: 'error',
501
466
  content: 'test'
502
467
  });
503
- _context13.next = 21;
468
+ _context12.next = 21;
504
469
  return wait();
505
470
 
506
471
  case 21:
@@ -511,13 +476,13 @@ describe('Dialog', function () {
511
476
  content: 'test',
512
477
  closable: false
513
478
  }).then(function () {}, cb2);
514
- _context13.next = 27;
479
+ _context12.next = 27;
515
480
  return wait();
516
481
 
517
482
  case 27:
518
483
  overlay = getElement('.k-dialog-overlay');
519
484
  overlay.click();
520
- _context13.next = 31;
485
+ _context12.next = 31;
521
486
  return wait();
522
487
 
523
488
  case 31:
@@ -526,34 +491,34 @@ describe('Dialog', function () {
526
491
 
527
492
  case 33:
528
493
  case "end":
529
- return _context13.stop();
494
+ return _context12.stop();
530
495
  }
531
496
  }
532
- }, _callee10);
497
+ }, _callee9);
533
498
  })));
534
- it('should double check for closing dialog', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
535
- var _mount11, instance, element, dialog, confirm;
499
+ it('should double check for closing dialog', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
500
+ var _mount10, instance, element, dialog, confirm;
536
501
 
537
- return _regeneratorRuntime.wrap(function _callee11$(_context14) {
502
+ return _regeneratorRuntime.wrap(function _callee10$(_context13) {
538
503
  while (1) {
539
- switch (_context14.prev = _context14.next) {
504
+ switch (_context13.prev = _context13.next) {
540
505
  case 0:
541
- _mount11 = mount(TerminateDemo), instance = _mount11[0], element = _mount11[1];
506
+ _mount10 = mount(TerminateDemo), instance = _mount10[0], element = _mount10[1];
542
507
  element.firstChild.click();
543
- _context14.next = 4;
508
+ _context13.next = 4;
544
509
  return wait();
545
510
 
546
511
  case 4:
547
512
  dialog = getElement('.k-dialog');
548
513
  dialog.querySelector('.k-dialog-close').click();
549
- _context14.next = 8;
514
+ _context13.next = 8;
550
515
  return wait(500);
551
516
 
552
517
  case 8:
553
518
  expect(dialog.style.display).to.eql('');
554
519
  confirm = getElement('.k-alert-dialog');
555
520
  confirm.querySelector('.k-dialog-ok').click();
556
- _context14.next = 13;
521
+ _context13.next = 13;
557
522
  return wait(500);
558
523
 
559
524
  case 13:
@@ -561,28 +526,28 @@ describe('Dialog', function () {
561
526
 
562
527
  case 14:
563
528
  case "end":
564
- return _context14.stop();
529
+ return _context13.stop();
565
530
  }
566
531
  }
567
- }, _callee11);
532
+ }, _callee10);
568
533
  })));
569
- it('should remove body', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
570
- var _mount12, instance, element;
534
+ it('should remove body', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
535
+ var _mount11, instance, element;
571
536
 
572
- return _regeneratorRuntime.wrap(function _callee12$(_context15) {
537
+ return _regeneratorRuntime.wrap(function _callee11$(_context14) {
573
538
  while (1) {
574
- switch (_context15.prev = _context15.next) {
539
+ switch (_context14.prev = _context14.next) {
575
540
  case 0:
576
- _mount12 = mount(DestroyDemo), instance = _mount12[0], element = _mount12[1];
541
+ _mount11 = mount(DestroyDemo), instance = _mount11[0], element = _mount11[1];
577
542
  expect(getElement('.k-dialog')).to.be.undefined;
578
543
  instance.set('show', true);
579
- _context15.next = 5;
544
+ _context14.next = 5;
580
545
  return wait(500);
581
546
 
582
547
  case 5:
583
548
  expectDialog();
584
549
  instance.set('show', false);
585
- _context15.next = 9;
550
+ _context14.next = 9;
586
551
  return wait(500);
587
552
 
588
553
  case 9:
@@ -590,21 +555,21 @@ describe('Dialog', function () {
590
555
 
591
556
  case 10:
592
557
  case "end":
593
- return _context15.stop();
558
+ return _context14.stop();
594
559
  }
595
560
  }
596
- }, _callee12);
561
+ }, _callee11);
597
562
  })));
598
- it('should not close when click and move outside', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
599
- var _mount13, instance, element, dialog, wrapper;
563
+ it('should not close when click and move outside', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
564
+ var _mount12, instance, element, dialog, wrapper;
600
565
 
601
- return _regeneratorRuntime.wrap(function _callee13$(_context16) {
566
+ return _regeneratorRuntime.wrap(function _callee12$(_context15) {
602
567
  while (1) {
603
- switch (_context16.prev = _context16.next) {
568
+ switch (_context15.prev = _context15.next) {
604
569
  case 0:
605
- _mount13 = mount(BasicDemo), instance = _mount13[0], element = _mount13[1];
570
+ _mount12 = mount(BasicDemo), instance = _mount12[0], element = _mount12[1];
606
571
  element.firstChild.click();
607
- _context16.next = 4;
572
+ _context15.next = 4;
608
573
  return wait();
609
574
 
610
575
  case 4:
@@ -613,7 +578,7 @@ describe('Dialog', function () {
613
578
  dispatchEvent(dialog, 'mousedown');
614
579
  dispatchEvent(wrapper, 'mouseup');
615
580
  dispatchEvent(wrapper, 'click');
616
- _context16.next = 11;
581
+ _context15.next = 11;
617
582
  return wait(500);
618
583
 
619
584
  case 11:
@@ -621,10 +586,10 @@ describe('Dialog', function () {
621
586
 
622
587
  case 12:
623
588
  case "end":
624
- return _context16.stop();
589
+ return _context15.stop();
625
590
  }
626
591
  }
627
- }, _callee13);
592
+ }, _callee12);
628
593
  }))); // it('should handle v-if and v-model at the same time correctly in Vue', async () => {
629
594
  // const Test = {
630
595
  // template: `<Dialog v-model="show" v-if="show" ref="dialog">test</Dialog>`,
@@ -11,6 +11,10 @@ var defaults = {
11
11
  return theme.borderRadius;
12
12
  },
13
13
 
14
+ get transition() {
15
+ return theme.transition.large;
16
+ },
17
+
14
18
  padding: '0',
15
19
  margin: '0 20px',
16
20
 
@@ -79,7 +83,7 @@ setDefault(function () {
79
83
  export function makeDialogStyles() {
80
84
  var _context;
81
85
 
82
- return /*#__PURE__*/css("position:absolute;width:", dialog.width, ";border-radius:", dialog.borderRadius, ";background:", dialog.bgColor, ";font-size:", dialog.fontSize, ";color:", dialog.color, ";box-shadow:", dialog.boxShadow, ";max-width:100%;z-index:", theme.maxZIndex, ";&.k-dragging{cursor:move;user-select:none;}&.transition-enter-active,&.transition-leave-active,&.transition-appear-active{transition:all ", theme.transition, ";}&.transition-enter-from,&.transition-leave-to,&.transition-appear-from{transform:", dialog.transform, ";opacity:0;}", _mapInstanceProperty(_context = ['large', 'small', 'mini']).call(_context, function (size) {
86
+ return /*#__PURE__*/css("position:absolute;width:", dialog.width, ";border-radius:", dialog.borderRadius, ";background:", dialog.bgColor, ";font-size:", dialog.fontSize, ";color:", dialog.color, ";box-shadow:", dialog.boxShadow, ";max-width:100%;z-index:", theme.maxZIndex, ";&.k-dragging{cursor:move;user-select:none;}&.transition-enter-active,&.transition-leave-active,&.transition-appear-active{transition:all ", dialog.transition, ";}&.transition-enter-from,&.transition-leave-to,&.transition-appear-from{transform:", dialog.transform, ";opacity:0;}", _mapInstanceProperty(_context = ['large', 'small', 'mini']).call(_context, function (size) {
83
87
  return /*#__PURE__*/css("&.k-", size, "{width:", dialog[size + "Width"], ";}");
84
88
  }), ".k-dialog-header{padding:0 ", dialog.padding, ";margin:", dialog.margin, ";border-bottom:", dialog.header.border, ";height:", dialog.header.height, ";line-height:", dialog.header.height, ";font-size:", dialog.header.fontSize, ";color:", dialog.header.color, ";position:relative;}.k-dialog-title{display:inline-block;}.k-dialog-close{position:absolute;right:", dialog.header.closeRight, ";top:", dialog.header.closeTop, ";.k-icon{font-size:", dialog.header.closeIconFontSize, ";}}.k-dialog-body{padding:", dialog.body.padding, ";}.k-dialog-footer{text-align:right;padding:", dialog.footer.padding, ";margin:", dialog.margin, ";border-top:", dialog.footer.border, ";.k-btn{margin-left:", dialog.footer.btnGap, ";}}");
85
89
  }