@king-design/vue 2.0.0-beta.1 → 2.0.0
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__/Vue Next Demos.md +1795 -0
- package/__tests__/components/dropdown.spec.ts +43 -0
- package/__tests__/index.ts +46 -0
- package/__tests__/karma.conf.js +54 -0
- package/__tests__/webpack.config.js +61 -0
- package/components/breadcrumb/item.d.ts +1 -1
- package/components/breadcrumb/item.js +3 -14
- package/components/breadcrumb/styles.js +1 -1
- package/components/button/index.vdt.js +26 -17
- package/components/button/styles.d.ts +82 -1
- package/components/button/styles.js +16 -2
- package/components/card/styles.js +1 -1
- package/components/carousel/styles.js +4 -1
- package/components/carousel/useSlide.js +10 -9
- package/components/cascader/index.spec.js +1 -1
- package/components/checkbox/index.vdt.js +15 -10
- package/components/checkbox/styles.js +2 -2
- package/components/collapse/item.vdt.js +2 -1
- package/components/collapse/styles.js +5 -1
- package/components/colorpicker/index.d.ts +2 -0
- package/components/colorpicker/index.js +2 -1
- package/components/colorpicker/index.spec.js +1 -1
- package/components/colorpicker/index.vdt.js +3 -1
- package/components/context.d.ts +5 -2
- package/components/context.js +7 -4
- package/components/datepicker/helpers.d.ts +2 -1
- package/components/datepicker/helpers.js +8 -2
- package/components/datepicker/index.spec.js +1 -1
- package/components/datepicker/styles.d.ts +46 -1
- package/components/diagram/shapes/generateShapes.js +3 -3
- package/components/diagram/shapes/line.d.ts +2 -2
- package/components/diagram/shapes/line.js +0 -1
- package/components/dialog/base.d.ts +2 -0
- package/components/dialog/base.js +2 -1
- package/components/dialog/index.spec.js +59 -94
- package/components/dialog/styles.js +5 -1
- package/components/dialog/useFixBody.d.ts +6 -0
- package/components/dialog/useFixBody.js +12 -0
- package/components/drawer/index.spec.js +5 -5
- package/components/drawer/styles.js +1 -1
- package/components/dropdown/index.js +1 -2
- package/components/dropdown/index.spec.js +3 -3
- package/components/dropdown/styles.js +1 -1
- package/components/editable/index.vdt.js +2 -1
- package/components/editable/styles.d.ts +8 -1
- package/components/form/index.spec.js +8 -8
- package/components/form/item.vdt.js +13 -9
- package/components/form/useError.d.ts +5 -1
- package/components/form/useError.js +3 -1
- package/components/form/useValidate.js +2 -2
- package/components/grid/col.vdt.js +4 -2
- package/components/grid/styles.js +1 -1
- package/components/grid/useGutter.d.ts +1 -1
- package/components/icon/index.vdt.js +3 -2
- package/components/icon/styles.js +8 -4
- package/components/input/index.d.ts +1 -0
- package/components/input/index.js +2 -1
- package/components/input/index.vdt.js +47 -32
- package/components/input/search.vdt.js +4 -2
- package/components/input/styles.js +8 -3
- package/components/layout/styles.d.ts +1 -1
- package/components/layout/styles.js +7 -3
- package/components/menu/index.spec.js +2 -2
- package/components/menu/item.d.ts +1 -1
- package/components/menu/item.js +4 -13
- package/components/menu/styles.d.ts +62 -1
- package/components/menu/styles.js +6 -2
- package/components/message/index.spec.js +1 -1
- package/components/message/styles.js +6 -2
- package/components/pagination/styles.js +1 -1
- package/components/radio/index.vdt.js +14 -9
- package/components/radio/styles.js +9 -1
- package/components/rate/styles.js +5 -1
- package/components/scrollSelect/styles.d.ts +14 -1
- package/components/scrollSelect/styles.js +9 -1
- package/components/select/base.vdt.js +135 -121
- package/components/select/index.spec.js +1 -1
- package/components/select/menu.vdt.js +1 -0
- package/components/select/styles.js +9 -4
- package/components/select/useSearchable.d.ts +1 -1
- package/components/slider/styles.js +5 -1
- package/components/spinner/index.d.ts +1 -1
- package/components/spinner/index.js +1 -1
- package/components/split/style.js +1 -1
- package/components/steps/context.d.ts +1 -1
- package/components/steps/styles.js +5 -1
- package/components/switch/styles.js +5 -1
- package/components/table/index.d.ts +1 -0
- package/components/table/index.spec.js +2 -1
- package/components/table/row.vdt.js +12 -4
- package/components/table/styles.js +6 -1
- package/components/table/table.d.ts +1 -0
- package/components/table/table.js +2 -1
- package/components/table/table.vdt.js +30 -27
- package/components/table/useColumns.d.ts +1 -1
- package/components/table/useFixedColumns.d.ts +1 -1
- package/components/table/useFixedColumns.js +5 -2
- package/components/table/useGroup.d.ts +1 -1
- package/components/table/useResizable.d.ts +1 -1
- package/components/table/useSortable.d.ts +1 -1
- package/components/table/useWidth.js +7 -1
- package/components/tabs/index.spec.js +1 -1
- package/components/tabs/styles.js +9 -2
- package/components/tabs/tab.vdt.js +2 -1
- package/components/tabs/useActiveBar.js +6 -3
- package/components/tag/base.js +1 -0
- package/components/tag/styles.js +8 -2
- package/components/timepicker/constants.d.ts +2 -1
- package/components/timepicker/constants.js +3 -2
- package/components/timepicker/index.spec.js +36 -35
- package/components/timepicker/useStep.js +3 -3
- package/components/timepicker/useValue.js +2 -2
- package/components/tooltip/index.spec.js +28 -24
- package/components/transfer/index.spec.js +20 -19
- package/components/tree/index.d.ts +1 -1
- package/components/tree/index.js +1 -1
- package/components/tree/index.spec.js +20 -19
- package/components/tree/index.vdt.js +1 -0
- package/components/tree/styles.js +5 -1
- package/components/treeSelect/index.spec.js +5 -5
- package/components/treeSelect/styles.js +5 -1
- package/components/upload/index.d.ts +1 -1
- package/components/upload/index.spec.js +1 -1
- package/components/upload/index.vdt.js +10 -11
- package/components/upload/styles.js +5 -1
- package/components/utils.d.ts +1 -1
- package/components/wave/index.d.ts +19 -0
- package/components/wave/index.js +120 -0
- package/components/wave/styles.d.ts +2 -0
- package/components/wave/styles.js +17 -0
- package/hooks/useRouter.d.ts +1 -0
- package/hooks/useRouter.js +10 -0
- package/index.d.ts +3 -2
- package/index.js +3 -2
- package/install.d.ts +2 -0
- package/package.json +2 -12
- package/styles/global.js +4 -3
- package/styles/theme.d.ts +16 -7
- package/styles/theme.js +15 -7
- package/tsconfig.json +22 -0
|
@@ -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
|
package/components/context.d.ts
CHANGED
|
@@ -2,10 +2,13 @@ import { Component, ComponentConstructor } from 'intact-vue-next';
|
|
|
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 {};
|
package/components/context.js
CHANGED
|
@@ -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 =
|
|
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
|
|
75
|
-
|
|
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';
|
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
import '../../styles/global';
|
|
2
|
-
declare
|
|
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
|
|
29
|
+
var _class;
|
|
30
30
|
|
|
31
31
|
var value = shapes[key];
|
|
32
|
-
components[key] = (
|
|
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,
|
|
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-vue-next';
|
|
|
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
|
|
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,
|
|
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, /^((?!
|
|
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 =
|
|
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",
|
|
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 =
|
|
332
|
+
_context9.next = 12;
|
|
342
333
|
return wait();
|
|
343
334
|
|
|
344
|
-
case
|
|
335
|
+
case 12:
|
|
345
336
|
expectDialog();
|
|
346
337
|
unmount();
|
|
347
338
|
|
|
348
|
-
case
|
|
339
|
+
case 14:
|
|
349
340
|
_context9.next = 3;
|
|
350
341
|
break;
|
|
351
342
|
|
|
352
|
-
case
|
|
353
|
-
_context9.next =
|
|
343
|
+
case 16:
|
|
344
|
+
_context9.next = 18;
|
|
354
345
|
return wait(500);
|
|
355
346
|
|
|
356
|
-
case
|
|
347
|
+
case 18:
|
|
357
348
|
expect(document.body.getAttribute('style')).to.be.null;
|
|
358
349
|
|
|
359
|
-
case
|
|
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('
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
420
|
+
return _context11.stop();
|
|
456
421
|
}
|
|
457
422
|
}
|
|
458
|
-
},
|
|
423
|
+
}, _callee8);
|
|
459
424
|
})));
|
|
460
|
-
it('static methods', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
425
|
+
it('static methods', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
461
426
|
var cb, dialog, cb1, cb2, overlay;
|
|
462
|
-
return _regeneratorRuntime.wrap(function
|
|
427
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context12) {
|
|
463
428
|
while (1) {
|
|
464
|
-
switch (
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
494
|
+
return _context12.stop();
|
|
530
495
|
}
|
|
531
496
|
}
|
|
532
|
-
},
|
|
497
|
+
}, _callee9);
|
|
533
498
|
})));
|
|
534
|
-
it('should double check for closing dialog', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
535
|
-
var
|
|
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
|
|
502
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context13) {
|
|
538
503
|
while (1) {
|
|
539
|
-
switch (
|
|
504
|
+
switch (_context13.prev = _context13.next) {
|
|
540
505
|
case 0:
|
|
541
|
-
|
|
506
|
+
_mount10 = mount(TerminateDemo), instance = _mount10[0], element = _mount10[1];
|
|
542
507
|
element.firstChild.click();
|
|
543
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
529
|
+
return _context13.stop();
|
|
565
530
|
}
|
|
566
531
|
}
|
|
567
|
-
},
|
|
532
|
+
}, _callee10);
|
|
568
533
|
})));
|
|
569
|
-
it('should remove body', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
570
|
-
var
|
|
534
|
+
it('should remove body', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
|
|
535
|
+
var _mount11, instance, element;
|
|
571
536
|
|
|
572
|
-
return _regeneratorRuntime.wrap(function
|
|
537
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context14) {
|
|
573
538
|
while (1) {
|
|
574
|
-
switch (
|
|
539
|
+
switch (_context14.prev = _context14.next) {
|
|
575
540
|
case 0:
|
|
576
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
558
|
+
return _context14.stop();
|
|
594
559
|
}
|
|
595
560
|
}
|
|
596
|
-
},
|
|
561
|
+
}, _callee11);
|
|
597
562
|
})));
|
|
598
|
-
it('should not close when click and move outside', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
599
|
-
var
|
|
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
|
|
566
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context15) {
|
|
602
567
|
while (1) {
|
|
603
|
-
switch (
|
|
568
|
+
switch (_context15.prev = _context15.next) {
|
|
604
569
|
case 0:
|
|
605
|
-
|
|
570
|
+
_mount12 = mount(BasicDemo), instance = _mount12[0], element = _mount12[1];
|
|
606
571
|
element.firstChild.click();
|
|
607
|
-
|
|
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
|
-
|
|
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
|
|
589
|
+
return _context15.stop();
|
|
625
590
|
}
|
|
626
591
|
}
|
|
627
|
-
},
|
|
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 ",
|
|
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
|
}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { RefObject } from 'intact-vue-next';
|
|
2
|
+
declare type Hooks = {
|
|
3
|
+
onStart?: (scrollBarWidth: number | undefined) => void;
|
|
4
|
+
onEnd?: () => void;
|
|
5
|
+
};
|
|
2
6
|
export declare function useFixBody(elementRef: RefObject<HTMLDivElement>): void;
|
|
7
|
+
export declare function setHooks(h: Hooks | null): void;
|
|
8
|
+
export {};
|