@king-design/vue 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.
- package/__tests__/__snapshots__/Vue Next Demos.md +1795 -0
- package/__tests__/components/dropdown.spec.ts +72 -0
- package/__tests__/components/select.spec.ts +29 -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 +89 -1
- package/components/cascader/index.vdt.js +4 -4
- package/components/cascader/useLabel.js +8 -12
- 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/index.vdt.js +10 -5
- 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/dropdown.js +1 -0
- 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 +10 -12
- 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 +15 -8
- package/components/menu/item.d.ts +1 -2
- package/components/menu/item.js +10 -17
- package/components/menu/item.vdt.js +4 -4
- package/components/menu/menu.d.ts +3 -0
- package/components/menu/menu.js +4 -0
- package/components/menu/styles.d.ts +62 -1
- package/components/menu/styles.js +6 -2
- package/components/menu/useExpanded.d.ts +1 -4
- package/components/menu/useHighlight.d.ts +5 -8
- package/components/menu/useHighlight.js +44 -33
- 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 +32 -25
- package/components/transfer/index.spec.js +20 -19
- package/components/transfer/styles.js +2 -6
- 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/i18n/en-US.d.ts +1 -0
- package/i18n/en-US.js +1 -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
|
@@ -5,6 +5,7 @@ import { Tooltip } from '../tooltip';
|
|
|
5
5
|
import { Icon } from '../icon';
|
|
6
6
|
import { Transition } from 'intact';
|
|
7
7
|
import { makeItemStyles } from './styles';
|
|
8
|
+
import { context as ErrorContext } from './useError';
|
|
8
9
|
var _$tmp0 = {
|
|
9
10
|
'className': 'ion-ios-information-outline k-form-error-more',
|
|
10
11
|
'size': 'small'
|
|
@@ -77,17 +78,20 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
77
78
|
}, __$blocks['label'](_$no))], 0, 'k-form-label', {
|
|
78
79
|
'htmlFor': htmlFor,
|
|
79
80
|
'style': labelStyle
|
|
80
|
-
}) : undefined, _$ce(2, 'div', [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
}) : undefined, _$ce(2, 'div', [_$cc(ErrorContext.Provider, {
|
|
82
|
+
'value': isDirty && !isValid,
|
|
83
|
+
'children': (_$blocks['content'] = function ($super) {
|
|
84
|
+
return children;
|
|
85
|
+
}, __$blocks['content'] = function ($super, data) {
|
|
86
|
+
var block = $blocks['content'];
|
|
84
87
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
var callBlock = function callBlock() {
|
|
89
|
+
return _$blocks['content'].call($this, $super, data);
|
|
90
|
+
};
|
|
88
91
|
|
|
89
|
-
|
|
90
|
-
|
|
92
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
93
|
+
}, __$blocks['content'](_$no))
|
|
94
|
+
}), _$cc(Transition, {
|
|
91
95
|
'key': 'error',
|
|
92
96
|
'name': 'k-fade',
|
|
93
97
|
'children': isDirty && !isValid ? _$ce(2, 'div', [_$ce(2, 'div', message.value, 0, 'k-error-message c-ellipsis', null, null, errorRef), _$cc(Tooltip, {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
export declare const context: {
|
|
2
|
+
Provider: import('intact-vue-next').ComponentConstructor<import("intact").Component<import("../context").ProviderProps<any>, {}, {}, {}>>;
|
|
3
|
+
Consumer: import("intact").ComponentConstructor<import("intact").Component<import("../context").ConsumerProps<any>, {}, {}, {}>>;
|
|
4
|
+
};
|
|
1
5
|
export declare function useError(): {
|
|
2
6
|
ellipsis: import("../../hooks/useState").State<boolean>;
|
|
3
7
|
message: import("../../hooks/useState").State<string | undefined>;
|
|
4
|
-
errorRef: import(
|
|
8
|
+
errorRef: import("intact").RefObject<HTMLDivElement>;
|
|
5
9
|
getErrorMessage: (key: string) => string;
|
|
6
10
|
getErrorClassName: (key: string) => string;
|
|
7
11
|
reset: () => void;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { useInstance, nextTick, createRef } from 'intact-vue-next';
|
|
2
2
|
import { useState, watchState } from '../../hooks/useState';
|
|
3
3
|
import { messages as globalMessages, classNames as globalClassNames } from './methods';
|
|
4
|
-
import { isFunction } from 'intact-shared';
|
|
4
|
+
import { isFunction } from 'intact-shared';
|
|
5
|
+
import { createContext } from '../context'; // enum MessageOrClassname {
|
|
5
6
|
// Message,
|
|
6
7
|
// ClassName,
|
|
7
8
|
// }
|
|
8
9
|
|
|
10
|
+
export var context = createContext();
|
|
9
11
|
export function useError() {
|
|
10
12
|
var instance = useInstance();
|
|
11
13
|
var ellipsis = useState(false);
|
|
@@ -64,7 +64,7 @@ export function useValidate(getErrorMessage, getErrorClassName, message, isDirty
|
|
|
64
64
|
|
|
65
65
|
if (result !== true) {
|
|
66
66
|
var ruleName = ruleNames[index];
|
|
67
|
-
return [false, result || getErrorMessage(ruleName),
|
|
67
|
+
return [false, result || getErrorMessage(ruleName), getErrorClassName(ruleName)];
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
@@ -77,7 +77,7 @@ export function useValidate(getErrorMessage, getErrorClassName, message, isDirty
|
|
|
77
77
|
message = err;
|
|
78
78
|
} else if (err) {
|
|
79
79
|
message = err.message || getErrorMessage(err.name);
|
|
80
|
-
className = err.className ||
|
|
80
|
+
className = err.className || getErrorClassName(err.name);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
return [false, message, className];
|
|
@@ -22,7 +22,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
22
22
|
|
|
23
23
|
return _$cc(GutterContext.Consumer, {
|
|
24
24
|
'children': function children(gutter) {
|
|
25
|
-
var _extends2;
|
|
25
|
+
var _extends2, _$cn2;
|
|
26
26
|
|
|
27
27
|
var classNameObj = _extends((_extends2 = {
|
|
28
28
|
'k-col': true
|
|
@@ -33,7 +33,9 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
33
33
|
'className': _$cn(classNameObj)
|
|
34
34
|
}, getRestProps(_this), {
|
|
35
35
|
'style': newStyle
|
|
36
|
-
}), gutter ? _$ce(2, 'div', _children, 0, _$cn(
|
|
36
|
+
}), gutter ? _$ce(2, 'div', _children, 0, _$cn((_$cn2 = {
|
|
37
|
+
'k-col-wrapper': true
|
|
38
|
+
}, _$cn2[className] = className, _$cn2))) : _children);
|
|
37
39
|
}
|
|
38
40
|
});
|
|
39
41
|
}
|
|
@@ -24,7 +24,7 @@ export function makeRowStyles() {
|
|
|
24
24
|
}
|
|
25
25
|
var colsStyles = makeBreakpointsCols();
|
|
26
26
|
export function makeColStyles() {
|
|
27
|
-
return /*#__PURE__*/css("position:relative;width:100%;", colsStyles, ";");
|
|
27
|
+
return /*#__PURE__*/css("position:relative;width:100%;.k-col-wrapper{height:100%;}", colsStyles, ";");
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
function makeBreakpointsCols() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const context: {
|
|
2
2
|
Provider: import('intact-vue-next').ComponentConstructor<import("intact").Component<import("../context").ProviderProps<number>, {}, {}, {}>>;
|
|
3
|
-
Consumer: import("intact").ComponentConstructor<import("intact").Component<
|
|
3
|
+
Consumer: import("intact").ComponentConstructor<import("intact").Component<import("../context").ConsumerProps<number>, {}, {}, {}>>;
|
|
4
4
|
};
|
|
5
5
|
export declare function useGutter(): {
|
|
6
6
|
getGutter: () => import("./constants").PrimitiveValue | null | undefined;
|
|
@@ -15,7 +15,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
15
15
|
size = _this$get.size,
|
|
16
16
|
color = _this$get.color,
|
|
17
17
|
rotate = _this$get.rotate,
|
|
18
|
-
hoverable = _this$get.hoverable
|
|
18
|
+
hoverable = _this$get.hoverable,
|
|
19
|
+
children = _this$get.children;
|
|
19
20
|
|
|
20
21
|
var classNameObj = (_classNameObj = {
|
|
21
22
|
'k-icon': true,
|
|
@@ -43,6 +44,6 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
43
44
|
return _$cv('i', _extends({
|
|
44
45
|
'className': _$cn(classNameObj),
|
|
45
46
|
'style': addStyle(style, _style)
|
|
46
|
-
}, getRestProps(this)));
|
|
47
|
+
}, getRestProps(this)), children);
|
|
47
48
|
}
|
|
48
49
|
;
|
|
@@ -6,7 +6,11 @@ import { rotate } from '../../styles/keyframes';
|
|
|
6
6
|
import '../../styles/fonts/iconfont';
|
|
7
7
|
import '../../styles/fonts/ionicons';
|
|
8
8
|
import '../../styles/global';
|
|
9
|
-
var
|
|
9
|
+
var defaults = {
|
|
10
|
+
get transition() {
|
|
11
|
+
return theme.transition.small;
|
|
12
|
+
},
|
|
13
|
+
|
|
10
14
|
fontSize: {
|
|
11
15
|
default: '16px',
|
|
12
16
|
large: '22px',
|
|
@@ -14,7 +18,6 @@ var iconStyles = {
|
|
|
14
18
|
mini: '12px'
|
|
15
19
|
}
|
|
16
20
|
};
|
|
17
|
-
var defaults = iconStyles;
|
|
18
21
|
var icon;
|
|
19
22
|
setDefault(function () {
|
|
20
23
|
icon = deepDefaults(theme, {
|
|
@@ -25,9 +28,10 @@ export var colors = ['primary', 'warning', 'danger', 'success'];
|
|
|
25
28
|
export var sizes = ['large', 'small', 'mini'];
|
|
26
29
|
export default function makeStyles(color) {
|
|
27
30
|
return /*#__PURE__*/css("font-size:", icon.fontSize.default, ";line-height:1;", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
28
|
-
|
|
31
|
+
var fontSize = icon.fontSize[size];
|
|
32
|
+
return /*#__PURE__*/css("&.k-", size, "{font-size:", fontSize, ";}");
|
|
29
33
|
}), " ", _mapInstanceProperty(colors).call(colors, function (color) {
|
|
30
34
|
var _color = theme.color[color];
|
|
31
35
|
return /*#__PURE__*/css("&.k-", color, "{color:", _color, ";&.k-hoverable:hover{color:", palette(_color, -2), ";}}");
|
|
32
|
-
}), " &.k-rotate:before{animation:", rotate, " 1s infinite linear;}&:before{font-size:inherit;}&.k-hoverable{cursor:pointer;transition:color ",
|
|
36
|
+
}), " &.k-rotate:before{animation:", rotate, " 1s infinite linear;}&:before{position:relative;font-size:inherit;z-index:1;}&.k-hoverable{cursor:pointer;transition:color ", icon.transition, ";", color && "\n &:hover {\n color: " + palette(color, -2) + " !important;\n }\n ", ";&:hover{color:", theme.color.primary, ";}}");
|
|
33
37
|
}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime-corejs3/helpers/objectWithoutPropertiesLoose";
|
|
3
|
-
var _excluded = ["className", "style", "type", "value", "defaultValue", "placeholder", "clearable", "disabled", "size", "rows", "autoWidth", "fluid", "width", "stackClearIcon", "frozenOnInput", "readonly", "inline", "ev-click", "ev-mounseenter", "ev-mouseleave"];
|
|
4
|
-
import { createElementVNode as _$ce, className as _$cn,
|
|
3
|
+
var _excluded = ["className", "style", "type", "value", "defaultValue", "placeholder", "clearable", "disabled", "size", "rows", "autoWidth", "fluid", "width", "stackClearIcon", "frozenOnInput", "readonly", "inline", "waveDisabled", "ev-click", "ev-mounseenter", "ev-mouseleave"];
|
|
4
|
+
import { createElementVNode as _$ce, className as _$cn, createUnknownComponentVNode as _$cc, noop as _$no, createVNode as _$cv } from 'intact-vue-next';
|
|
5
5
|
import { Icon } from '../icon';
|
|
6
6
|
import { addStyle, isTextBlock, getRestProps } from '../utils';
|
|
7
7
|
import { makeStyles } from './styles';
|
|
8
8
|
import { noop, isNullOrUndefined } from 'intact-shared';
|
|
9
|
+
import { Wave } from '../wave';
|
|
10
|
+
import { context as ErrorContext } from '../form/useError';
|
|
9
11
|
export default function ($props, $blocks, $__proto__) {
|
|
10
|
-
var _classNameObj,
|
|
12
|
+
var _classNameObj,
|
|
13
|
+
children,
|
|
14
|
+
_this = this,
|
|
15
|
+
_children;
|
|
11
16
|
|
|
12
17
|
$blocks || ($blocks = {});
|
|
13
18
|
$props || ($props = {});
|
|
@@ -33,6 +38,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
33
38
|
frozenOnInput = _this$get.frozenOnInput,
|
|
34
39
|
readonly = _this$get.readonly,
|
|
35
40
|
inline = _this$get.inline,
|
|
41
|
+
waveDisabled = _this$get.waveDisabled,
|
|
36
42
|
click = _this$get['ev-click'],
|
|
37
43
|
mouseenter = _this$get['ev-mounseenter'],
|
|
38
44
|
mouseleave = _this$get['ev-mouseleave'],
|
|
@@ -77,39 +83,48 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
77
83
|
return _$ce(2, 'div', [$blocks.prepend ? (children = $blocks.prepend(noop), _$ce(2, 'div', children, 0, _$cn({
|
|
78
84
|
"k-input-prepend": true,
|
|
79
85
|
"k-input-padding": isTextBlock(children)
|
|
80
|
-
}))) : void 0, _$
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
86
|
+
}))) : void 0, _$cc(ErrorContext.Consumer, {
|
|
87
|
+
'defaultValue': false,
|
|
88
|
+
'children': function children(isInvalid) {
|
|
89
|
+
return _$cc(Wave, {
|
|
90
|
+
'disabled': waveDisabled || disabled || isInvalid,
|
|
91
|
+
'children': _$ce(2, 'div', [$blocks.prefix ? _$ce(2, 'div', (_$blocks['prefix'] = function ($super) {
|
|
92
|
+
return null;
|
|
93
|
+
}, __$blocks['prefix'] = function ($super, data) {
|
|
94
|
+
var block = $blocks['prefix'];
|
|
84
95
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
96
|
+
var callBlock = function callBlock() {
|
|
97
|
+
return _$blocks['prefix'].call($this, $super, data);
|
|
98
|
+
};
|
|
88
99
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
100
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
101
|
+
}, __$blocks['prefix'](_$no)), 0, 'k-input-prefix') : undefined, type !== 'textarea' ? _$cv('input', _extends({}, inputProps, {
|
|
102
|
+
'className': 'k-input-inner',
|
|
103
|
+
'type': type
|
|
104
|
+
})) : _$cv('textarea', _extends({}, inputProps, {
|
|
105
|
+
'className': 'k-input-inner k-textarea',
|
|
106
|
+
'rows': rows
|
|
107
|
+
})), $blocks.suffix || clearable && !disabled ? _$ce(2, 'div', [clearable && !disabled ? _$cc(Icon, {
|
|
108
|
+
'className': _$cn({
|
|
109
|
+
"k-input-clear ion-ios-close": true,
|
|
110
|
+
"k-input-show": hasValue
|
|
111
|
+
}),
|
|
112
|
+
'ev-click': _this.clear,
|
|
113
|
+
'hoverable': true
|
|
114
|
+
}) : undefined, ' ', (_$blocks['suffix'] = function ($super) {
|
|
115
|
+
return null;
|
|
116
|
+
}, __$blocks['suffix'] = function ($super, data) {
|
|
117
|
+
var block = $blocks['suffix'];
|
|
106
118
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
119
|
+
var callBlock = function callBlock() {
|
|
120
|
+
return _$blocks['suffix'].call($this, $super, data);
|
|
121
|
+
};
|
|
110
122
|
|
|
111
|
-
|
|
112
|
-
|
|
123
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
124
|
+
}, __$blocks['suffix'](_$no))], 0, 'k-input-suffix') : undefined, autoWidth ? _$ce(2, 'div', !hasValue ? placeholder : inputValue, 0, 'k-input-fake', null, null, fakeRef) : undefined], 0, 'k-input-wrapper')
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}), $blocks.append ? (_children = $blocks.append(noop), _$ce(2, 'div', _children, 0, _$cn({
|
|
113
128
|
"k-input-append": true,
|
|
114
129
|
"k-input-padding": isTextBlock(_children)
|
|
115
130
|
}))) : void 0], 0, _$cn(classNameObj), {
|
|
@@ -23,9 +23,10 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
23
23
|
size = _this$get.size,
|
|
24
24
|
open = _this$get.open;
|
|
25
25
|
|
|
26
|
+
var isTypeNotDefault = type !== 'default';
|
|
26
27
|
var classNameObj = (_classNameObj = {
|
|
27
28
|
'k-search': true
|
|
28
|
-
}, _classNameObj[className] = className, _classNameObj['k-open'] = open, _classNameObj['k-hide'] = !open, _classNameObj["k-" + type] =
|
|
29
|
+
}, _classNameObj[className] = className, _classNameObj['k-open'] = open, _classNameObj['k-hide'] = !open, _classNameObj["k-" + type] = isTypeNotDefault, _classNameObj[makeSearchStyles()] = true, _classNameObj);
|
|
29
30
|
return _$cv('form', _extends({}, getRestProps(this), {
|
|
30
31
|
'className': _$cn(classNameObj),
|
|
31
32
|
'ev-submit': this.onSubmit,
|
|
@@ -38,7 +39,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
38
39
|
'ev-$change:value': this.onChangeValue,
|
|
39
40
|
'readonly': !open,
|
|
40
41
|
'size': size,
|
|
41
|
-
'className': 'k-with-suffix'
|
|
42
|
+
'className': 'k-with-suffix',
|
|
43
|
+
'waveDisabled': isTypeNotDefault
|
|
42
44
|
}, null, this.inputRef), _$cc(Button, {
|
|
43
45
|
'icon': true,
|
|
44
46
|
'type': 'none',
|
|
@@ -4,6 +4,10 @@ import { theme, setDefault } from '../../styles/theme';
|
|
|
4
4
|
import { deepDefaults, sizes } from '../../styles/utils';
|
|
5
5
|
import '../../styles/global';
|
|
6
6
|
var defaults = deepDefaults({
|
|
7
|
+
get transition() {
|
|
8
|
+
return theme.transition.middle;
|
|
9
|
+
},
|
|
10
|
+
|
|
7
11
|
get fontSize() {
|
|
8
12
|
return theme.default.fontSize;
|
|
9
13
|
},
|
|
@@ -32,8 +36,9 @@ var defaults = deepDefaults({
|
|
|
32
36
|
return "1px solid " + theme.color.primary;
|
|
33
37
|
},
|
|
34
38
|
|
|
39
|
+
// get hoverBorder() { return `1px solid ${theme.color.darkBorder}` },
|
|
35
40
|
get hoverBorder() {
|
|
36
|
-
return "1px solid " + theme.color.
|
|
41
|
+
return "1px solid " + theme.color.primary;
|
|
37
42
|
},
|
|
38
43
|
|
|
39
44
|
get borderRadius() {
|
|
@@ -115,7 +120,7 @@ setDefault(function () {
|
|
|
115
120
|
}).input;
|
|
116
121
|
});
|
|
117
122
|
export function makeStyles() {
|
|
118
|
-
return /*#__PURE__*/css("display:inline-block;width:", input.width, ";vertical-align:middle;.k-input-wrapper{display:inline-block;width:100%;position:relative;}.k-input-inner{display:inline-block;width:100%;border:", input.border, ";background-color:", input.bgColor, ";transition:border ",
|
|
123
|
+
return /*#__PURE__*/css("display:inline-block;width:", input.width, ";vertical-align:middle;.k-input-wrapper{display:inline-block;width:100%;position:relative;}.k-input-inner{display:inline-block;width:100%;border:", input.border, ";background-color:", input.bgColor, ";transition:border ", input.transition, ",background ", input.transition, ",box-shadow ", input.transition, ";border-radius:", input.borderRadius, ";outline:none;position:relative;color:", input.color, ";&:hover{border:", input.hoverBorder, ";z-index:1;}&:focus{border:", input.focusBorder, ";z-index:1;}&::placeholder{color:", input.placeholderColor, ";}}&.k-fluid{width:100%;}.k-input-prefix,.k-input-suffix{position:absolute;top:50%;transform:translateY(-50%);z-index:2;}.k-input-clear{opacity:0;transition:opacity ", input.transition, ";pointer-events:none;color:", input.clearIconColor, ";+*{margin-left:", input.clearIconGap, ";}}&:hover .k-input-clear.k-input-show{opacity:1;pointer-events:all;}&.k-stack-clear{.k-input-clear{position:absolute;z-index:1;right:0;&.k-input-show+i{transition:opacity ", input.transition, ";}}&:hover{.k-input-clear.k-input-show+i{opacity:0;}}}&.k-group{display:table;.k-input-inner{border-radius:0;}.k-input-wrapper:first-child{.k-input-inner{border-radius:", input.borderRadius, " 0 0 ", input.borderRadius, ";}}.k-input-wrapper:last-child{.k-input-inner{border-radius:0 ", input.borderRadius, " ", input.borderRadius, " 0;}}}.k-input-prepend,.k-input-append{display:table-cell;width:1px;vertical-align:middle;background-color:", input.groupBgColor, ";border:", input.border, ";text-align:center;white-space:nowrap;.k-btn{margin:-1px 0;border-radius:0;border:none;}.k-select{margin:-1px;text-align:left;}}.k-input-prepend{border-radius:", input.borderRadius, " 0 0 ", input.borderRadius, ";.k-select{z-index:1;.k-select-wrapper{border-radius:", theme.borderRadius, " 0 0 ", theme.borderRadius, ";}}}.k-input-append{border-radius:0 ", input.borderRadius, " ", input.borderRadius, " 0;.k-select{.k-select-wrapper{border-radius:0 ", theme.borderRadius, " ", theme.borderRadius, " 0;}}}.k-input-padding{padding:0 ", input.groupPaddingGap, ";}.k-input-prepend{border-right:none;}.k-input-append{border-left:none;}&.k-disabled{color:", input.disabledColor, ";cursor:not-allowed;.k-input-inner{color:", input.disabledColor, ";border-color:", input.disabledBorderColor, ";background:", input.disabledBgColor, ";cursor:not-allowed;}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
119
124
|
var styles = input[size];
|
|
120
125
|
var sizeClassName = /*#__PURE__*/css("font-size:", styles.fontSize, ";.k-input-inner{height:", styles.height, ";line-height:", styles.height, ";font-size:", styles.fontSize, ";padding:0 ", styles.paddingGap, ";}.k-input-prefix{left:", styles.paddingGap, ";}.k-input-suffix{right:", styles.paddingGap, ";}&.k-with-prefix{.k-input-inner{padding-left:calc(", styles.paddingGap, " + 1rem + ", input.clearIconGap, ");}}&.k-with-suffix,&.k-clearable{.k-input-inner{padding-right:calc(", styles.paddingGap, " + 1rem + ", input.clearIconGap, ");}}&:not(.k-stack-clear).k-with-suffix.k-clearable{.k-input-inner{padding-right:calc(", styles.paddingGap, " + 2rem + ", input.clearIconGap, " * 2);}}");
|
|
121
126
|
if (size === 'default') return sizeClassName;
|
|
@@ -123,7 +128,7 @@ export function makeStyles() {
|
|
|
123
128
|
}), "&.k-inline{.k-input-inner{height:auto;line-height:inherit;border:none;border-radius:0;padding:0;}}.k-textarea{padding:", input.textareaPadding, ";height:auto;line-height:1.5;vertical-align:top;}.k-input-fake{position:absolute;visibility:hidden;top:0;white-space:nowrap;}&.k-auto-width{width:auto;.k-input-inner{box-sizing:content-box;}}");
|
|
124
129
|
}
|
|
125
130
|
export function makeSearchStyles() {
|
|
126
|
-
return /*#__PURE__*/css("position:relative;display:inline-block;.k-input{transition:width ",
|
|
131
|
+
return /*#__PURE__*/css("position:relative;display:inline-block;.k-input{transition:width ", input.transition, ";}.k-btn{position:absolute;top:0;right:0;z-index:1;}.k-input-suffix{margin-right:", input.search.suffixMarginRight, ";}&.k-hide{", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
127
132
|
if (size == 'default') return;
|
|
128
133
|
return /*#__PURE__*/css(".k-input.k-", size, "{width:", input[size].height, ";}");
|
|
129
134
|
}), ";.k-input{width:", input.default.height, ";}.k-input-inner{padding:0!important;}}&.k-line{.k-input-inner{border-width:0;}&.k-open{.k-input-inner{border-bottom-width:1px;}}}");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../styles/global';
|
|
2
2
|
export declare const themes: readonly ["light", "dark", "white"];
|
|
3
|
-
export declare function getCollapseWidth():
|
|
3
|
+
export declare function getCollapseWidth(): string;
|
|
4
4
|
export declare function makeLayoutStyles(): string;
|
|
5
5
|
export declare function makeHeaderStyles(): string;
|
|
6
6
|
export declare function makeAsideStyles(): string;
|
|
@@ -7,6 +7,10 @@ import { menu } from '../menu/styles';
|
|
|
7
7
|
var sizes = ['small', 'large'];
|
|
8
8
|
export var themes = ['light', 'dark', 'white'];
|
|
9
9
|
var defaults = {
|
|
10
|
+
get transition() {
|
|
11
|
+
return theme.transition.large;
|
|
12
|
+
},
|
|
13
|
+
|
|
10
14
|
get color() {
|
|
11
15
|
return menu.item.color;
|
|
12
16
|
},
|
|
@@ -61,17 +65,17 @@ export function getCollapseWidth() {
|
|
|
61
65
|
return layout.collapsedWidth;
|
|
62
66
|
}
|
|
63
67
|
export function makeLayoutStyles() {
|
|
64
|
-
return /*#__PURE__*/css("display:flex;flex-direction:column;flex:1;transition:padding-left ",
|
|
68
|
+
return /*#__PURE__*/css("display:flex;flex-direction:column;flex:1;transition:padding-left ", layout.transition, ";&.k-has-aside{flex-direction:row;}.k-layout-footer{padding:", layout.footerPadding, ";}.k-layout-body{flex:1;}");
|
|
65
69
|
}
|
|
66
70
|
export function makeHeaderStyles() {
|
|
67
|
-
return /*#__PURE__*/css("display:flex;align-items:center;color:", layout.color, ";background:", layout.bgColor, ";left:0;transition:left ",
|
|
71
|
+
return /*#__PURE__*/css("display:flex;align-items:center;color:", layout.color, ";background:", layout.bgColor, ";left:0;transition:left ", layout.transition, ";&.k-fixed{position:fixed;left:0;right:0;top:0;z-index:", theme.midZIndex + 1, ";}", _mapInstanceProperty(themes).call(themes, function (theme) {
|
|
68
72
|
if (theme === 'dark') return;
|
|
69
73
|
var styles = layout[theme];
|
|
70
74
|
return /*#__PURE__*/css("&.k-", theme, "{background:", styles.bgColor, ";color:", styles.color, ";border-bottom:", styles.border, ";}");
|
|
71
75
|
}), ";");
|
|
72
76
|
}
|
|
73
77
|
export function makeAsideStyles() {
|
|
74
|
-
return /*#__PURE__*/css("transition:width ",
|
|
78
|
+
return /*#__PURE__*/css("transition:width ", layout.transition, ";display:flex;flex-direction:column;background:", layout.bgColor, ";color:", layout.color, ";", _mapInstanceProperty(themes).call(themes, function (theme) {
|
|
75
79
|
if (theme === 'dark') return;
|
|
76
80
|
var styles = layout[theme];
|
|
77
81
|
return /*#__PURE__*/css("&.k-", theme, "{background:", styles.bgColor, ";color:", styles.color, ";border-right:", styles.border, ";}");
|
|
@@ -18,14 +18,14 @@ describe('Menu', function () {
|
|
|
18
18
|
title = element.querySelector('.k-expanded .k-menu-title');
|
|
19
19
|
title.click();
|
|
20
20
|
_context.next = 5;
|
|
21
|
-
return wait(
|
|
21
|
+
return wait(500);
|
|
22
22
|
|
|
23
23
|
case 5:
|
|
24
24
|
expect(element.outerHTML).to.matchSnapshot();
|
|
25
25
|
expect(instance.get('expandedKeys')).to.eql([]);
|
|
26
26
|
title.click();
|
|
27
27
|
_context.next = 10;
|
|
28
|
-
return wait(
|
|
28
|
+
return wait(500);
|
|
29
29
|
|
|
30
30
|
case 10:
|
|
31
31
|
expect(element.outerHTML).to.matchSnapshot();
|
|
@@ -39,14 +39,14 @@ describe('Menu', function () {
|
|
|
39
39
|
}, _callee);
|
|
40
40
|
})));
|
|
41
41
|
it('select', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
42
|
-
var _mount2, instance, element,
|
|
42
|
+
var _mount2, instance, element, _element$querySelecto, title, disabledTitle, subTitle;
|
|
43
43
|
|
|
44
44
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
45
45
|
while (1) {
|
|
46
46
|
switch (_context2.prev = _context2.next) {
|
|
47
47
|
case 0:
|
|
48
48
|
_mount2 = mount(CollapseDemo), instance = _mount2[0], element = _mount2[1];
|
|
49
|
-
|
|
49
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
50
50
|
_element$querySelecto = element.querySelectorAll('.k-menu-title'), title = _element$querySelecto[0], disabledTitle = _element$querySelecto[1];
|
|
51
51
|
title.click();
|
|
52
52
|
_context2.next = 6;
|
|
@@ -54,14 +54,14 @@ describe('Menu', function () {
|
|
|
54
54
|
|
|
55
55
|
case 6:
|
|
56
56
|
expect(element.outerHTML).to.matchSnapshot();
|
|
57
|
-
expect(
|
|
57
|
+
expect(instance.get('selectedKey')).to.eql('1');
|
|
58
58
|
disabledTitle.click();
|
|
59
59
|
_context2.next = 11;
|
|
60
60
|
return wait();
|
|
61
61
|
|
|
62
62
|
case 11:
|
|
63
63
|
expect(element.outerHTML).to.matchSnapshot();
|
|
64
|
-
expect(
|
|
64
|
+
expect(instance.get('selectedKey')).to.eql('1');
|
|
65
65
|
subTitle = element.querySelector('.k-expanded .k-menu .k-menu-title');
|
|
66
66
|
subTitle.click();
|
|
67
67
|
_context2.next = 17;
|
|
@@ -69,9 +69,16 @@ describe('Menu', function () {
|
|
|
69
69
|
|
|
70
70
|
case 17:
|
|
71
71
|
expect(element.outerHTML).to.matchSnapshot();
|
|
72
|
-
expect(
|
|
72
|
+
expect(instance.get('selectedKey')).to.eql('3-1'); // clear
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
instance.set('selectedKey', '');
|
|
75
|
+
_context2.next = 22;
|
|
76
|
+
return wait();
|
|
77
|
+
|
|
78
|
+
case 22:
|
|
79
|
+
expect(element.querySelector('.k-highlighted')).to.be.null;
|
|
80
|
+
|
|
81
|
+
case 23:
|
|
75
82
|
case "end":
|
|
76
83
|
return _context2.stop();
|
|
77
84
|
}
|
|
@@ -2,7 +2,7 @@ import { Component, TypeDefs, Key } from 'intact-vue-next';
|
|
|
2
2
|
import { Menu } from './menu';
|
|
3
3
|
export interface MenuItemProps {
|
|
4
4
|
key: Key;
|
|
5
|
-
to?: string;
|
|
5
|
+
to?: string | object;
|
|
6
6
|
dot?: boolean;
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
}
|
|
@@ -18,7 +18,6 @@ export declare class MenuItem extends Component<MenuItemProps, MenuItemEvents> {
|
|
|
18
18
|
parentMenu: Menu<Key>;
|
|
19
19
|
parentMenuItem: MenuItem | null;
|
|
20
20
|
private expanded;
|
|
21
|
-
private highlight;
|
|
22
21
|
private dropdown;
|
|
23
22
|
private router;
|
|
24
23
|
init(): void;
|
package/components/menu/item.js
CHANGED
|
@@ -4,17 +4,18 @@ import { __decorate } from "tslib";
|
|
|
4
4
|
import { Component, inject, provide } from 'intact-vue-next';
|
|
5
5
|
import { ROOT_MENU, MENU } from './menu';
|
|
6
6
|
import template from './item.vdt';
|
|
7
|
-
import { bind
|
|
8
|
-
import { useHighlight } from './useHighlight';
|
|
7
|
+
import { bind } from '../utils';
|
|
9
8
|
import { useExpanded } from './useExpanded';
|
|
10
9
|
import { useDropdown } from './useDropdown';
|
|
11
|
-
import { useRouter } from '../../hooks/useRouter';
|
|
10
|
+
import { useRouter, navigate } from '../../hooks/useRouter';
|
|
11
|
+
import { useRecordItem } from '../../hooks/useRecordComponent';
|
|
12
|
+
import { MENU_RECORD_KEY } from './useHighlight';
|
|
12
13
|
var typeDefs = {
|
|
13
14
|
key: {
|
|
14
15
|
type: [String, Number],
|
|
15
16
|
required: true
|
|
16
17
|
},
|
|
17
|
-
to: String,
|
|
18
|
+
to: [String, Object],
|
|
18
19
|
dot: Boolean,
|
|
19
20
|
disabled: Boolean
|
|
20
21
|
};
|
|
@@ -36,7 +37,6 @@ export var MenuItem = /*#__PURE__*/function (_Component) {
|
|
|
36
37
|
_this.parentMenu = inject(MENU);
|
|
37
38
|
_this.parentMenuItem = inject(MENU_ITEM, null);
|
|
38
39
|
_this.expanded = useExpanded(_this.rootMenu, _this.parentMenu);
|
|
39
|
-
_this.highlight = useHighlight(_this.rootMenu, _this.parentMenuItem);
|
|
40
40
|
_this.dropdown = useDropdown(_this.rootMenu, _this.parentMenu);
|
|
41
41
|
_this.router = useRouter();
|
|
42
42
|
return _this;
|
|
@@ -46,35 +46,28 @@ export var MenuItem = /*#__PURE__*/function (_Component) {
|
|
|
46
46
|
|
|
47
47
|
_proto.init = function init() {
|
|
48
48
|
provide(MENU_ITEM, this);
|
|
49
|
+
useRecordItem(MENU_RECORD_KEY);
|
|
49
50
|
};
|
|
50
51
|
|
|
51
52
|
_proto.onClick = function onClick(hasSubMenu, e) {
|
|
52
53
|
var _this$get = this.get(),
|
|
53
54
|
disabled = _this$get.disabled,
|
|
54
|
-
to = _this$get.to
|
|
55
|
+
to = _this$get.to,
|
|
56
|
+
key = _this$get.key;
|
|
55
57
|
|
|
56
58
|
if (disabled) return;
|
|
57
59
|
|
|
58
60
|
if (hasSubMenu) {
|
|
59
61
|
this.expanded.toggle();
|
|
60
62
|
} else {
|
|
61
|
-
this.highlight.select();
|
|
63
|
+
this.rootMenu.highlight.select(key);
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
this.trigger('click', e);
|
|
65
67
|
|
|
66
68
|
if (!hasSubMenu) {
|
|
67
69
|
this.trigger('select', this, e);
|
|
68
|
-
|
|
69
|
-
if (to) {
|
|
70
|
-
var router = this.router.value;
|
|
71
|
-
|
|
72
|
-
if (router && !isExternalLink(to)) {
|
|
73
|
-
router.push(to);
|
|
74
|
-
} else {
|
|
75
|
-
location.href = to;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
70
|
+
navigate(this.router.value, to);
|
|
78
71
|
}
|
|
79
72
|
};
|
|
80
73
|
|
|
@@ -32,9 +32,9 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
32
32
|
disabled = _this$get.disabled,
|
|
33
33
|
dot = _this$get.dot;
|
|
34
34
|
|
|
35
|
-
var
|
|
36
|
-
isHighlighted =
|
|
37
|
-
isSelected =
|
|
35
|
+
var _rootMenu$highlight = rootMenu.highlight,
|
|
36
|
+
isHighlighted = _rootMenu$highlight.isHighlighted,
|
|
37
|
+
isSelected = _rootMenu$highlight.isSelected;
|
|
38
38
|
var isExpandedKey = this.expanded.isExpanded;
|
|
39
39
|
var isExpanded = isExpandedKey(key);
|
|
40
40
|
|
|
@@ -50,7 +50,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
50
50
|
|
|
51
51
|
var classNameObj = (_classNameObj = {
|
|
52
52
|
'k-menu-item': true
|
|
53
|
-
}, _classNameObj[className] = className, _classNameObj['k-expanded'] = isExpanded, _classNameObj['k-disabled'] = disabled, _classNameObj['k-active'] = isSelected(), _classNameObj['k-highlighted'] = isHighlighted(), _classNameObj[makeItemStyles()] = true, _classNameObj);
|
|
53
|
+
}, _classNameObj[className] = className, _classNameObj['k-expanded'] = isExpanded, _classNameObj['k-disabled'] = disabled, _classNameObj['k-active'] = isSelected(key), _classNameObj['k-highlighted'] = isHighlighted(key), _classNameObj[makeItemStyles()] = true, _classNameObj);
|
|
54
54
|
var showDot = isTopItem && !iconVNode && isNullOrUndefined(dot) ? rootDot : dot;
|
|
55
55
|
|
|
56
56
|
var title = function title(children) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Component, TypeDefs, Key } from 'intact-vue-next';
|
|
2
|
+
import { useHighlight } from './useHighlight';
|
|
2
3
|
export interface MenuProps<K extends Key = Key> {
|
|
3
4
|
expandedKeys?: K[];
|
|
4
5
|
selectedKey?: K;
|
|
@@ -22,5 +23,7 @@ export declare class Menu<K extends Key = Key> extends Component<MenuProps<K>, M
|
|
|
22
23
|
static defaults: () => Partial<MenuProps<Key>>;
|
|
23
24
|
rootMenu: Menu<Key> | null;
|
|
24
25
|
parentMenu: Menu<Key> | null;
|
|
26
|
+
subExpandedKeys?: Set<K>;
|
|
27
|
+
highlight?: ReturnType<typeof useHighlight>;
|
|
25
28
|
init(): void;
|
|
26
29
|
}
|