@king-design/react 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__/React Demos.md +317 -291
- package/__tests__/index.ts +5 -2
- package/__tests__/karma.conf.js +1 -1
- 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/package.json +2 -2
- package/styles/global.js +4 -3
- package/styles/theme.d.ts +16 -7
- package/styles/theme.js +15 -7
|
@@ -3,6 +3,10 @@ import { theme, setDefault } from '../../styles/theme';
|
|
|
3
3
|
import { deepDefaults } from '../../styles/utils';
|
|
4
4
|
import '../../styles/global';
|
|
5
5
|
var defaults = {
|
|
6
|
+
get transition() {
|
|
7
|
+
return theme.transition.middle;
|
|
8
|
+
},
|
|
9
|
+
|
|
6
10
|
maxHeight: "400px",
|
|
7
11
|
padding: "3px 6px"
|
|
8
12
|
};
|
|
@@ -13,5 +17,5 @@ setDefault(function () {
|
|
|
13
17
|
}).treeSelect;
|
|
14
18
|
});
|
|
15
19
|
export function makeStyles() {
|
|
16
|
-
return /*#__PURE__*/css("min-width:auto;max-height:", treeSelect.maxHeight, ";padding:", treeSelect.padding, ";overflow:auto;&:not([class*=\"-active\"]){transition:left ",
|
|
20
|
+
return /*#__PURE__*/css("min-width:auto;max-height:", treeSelect.maxHeight, ";padding:", treeSelect.padding, ";overflow:auto;&:not([class*=\"-active\"]){transition:left ", treeSelect.transition, ",top ", treeSelect.transition, ";}");
|
|
17
21
|
}
|
|
@@ -2,7 +2,7 @@ import { Component, TypeDefs } from 'intact-react';
|
|
|
2
2
|
import { UploadFileStatus } from './useUpload';
|
|
3
3
|
import type { RequestError } from './ajaxUploader';
|
|
4
4
|
import type { Events } from '../types';
|
|
5
|
-
export type { RequestError };
|
|
5
|
+
export type { RequestError, UploadFileStatus };
|
|
6
6
|
export interface UploadProps {
|
|
7
7
|
accept?: string;
|
|
8
8
|
files?: UploadFile[];
|
|
@@ -28,7 +28,7 @@ var _$tmp5 = {
|
|
|
28
28
|
'className': 'k-upload-status-icon ion-ios-close-outline'
|
|
29
29
|
};
|
|
30
30
|
export default function ($props, $blocks, $__proto__) {
|
|
31
|
-
var _classNameObj, _$
|
|
31
|
+
var _classNameObj, _$cn3;
|
|
32
32
|
|
|
33
33
|
$blocks || ($blocks = {});
|
|
34
34
|
$props || ($props = {});
|
|
@@ -91,17 +91,16 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
91
91
|
var removeFile = this.files.removeFile;
|
|
92
92
|
|
|
93
93
|
var closeBtn = function closeBtn(value, index, icon) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
'
|
|
98
|
-
|
|
94
|
+
var _$cn2;
|
|
95
|
+
|
|
96
|
+
return _$cc(Icon, {
|
|
97
|
+
'className': _$cn((_$cn2 = {
|
|
98
|
+
"k-upload-close": true
|
|
99
|
+
}, _$cn2[icon] = true, _$cn2)),
|
|
99
100
|
'ev-click': function evClick() {
|
|
100
101
|
return removeFile(value, index);
|
|
101
102
|
},
|
|
102
|
-
'
|
|
103
|
-
'className': _$cn(icon)
|
|
104
|
-
})
|
|
103
|
+
'hoverable': true
|
|
105
104
|
});
|
|
106
105
|
};
|
|
107
106
|
|
|
@@ -166,9 +165,9 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
166
165
|
'key': 'dialog',
|
|
167
166
|
'value': isShow.value,
|
|
168
167
|
'ev-close': close,
|
|
169
|
-
'className': _$cn((_$
|
|
168
|
+
'className': _$cn((_$cn3 = {
|
|
170
169
|
"k-upload-dialog": true
|
|
171
|
-
}, _$
|
|
170
|
+
}, _$cn3[makeUploadDialogStyles()] = true, _$cn3)),
|
|
172
171
|
'children': image.value ? _$ce(2, 'a', _$ce(2, 'img', null, 1, null, {
|
|
173
172
|
'src': image.value.url
|
|
174
173
|
}), 2, null, {
|
|
@@ -5,6 +5,10 @@ import { theme, setDefault } from '../../styles/theme';
|
|
|
5
5
|
import { deepDefaults } from '../../styles/utils';
|
|
6
6
|
import '../../styles/global';
|
|
7
7
|
var defaults = {
|
|
8
|
+
get transition() {
|
|
9
|
+
return theme.transition.middle;
|
|
10
|
+
},
|
|
11
|
+
|
|
8
12
|
fontSize: '12px',
|
|
9
13
|
tip: {
|
|
10
14
|
gap: '16px',
|
|
@@ -140,7 +144,7 @@ setDefault(function () {
|
|
|
140
144
|
}).upload;
|
|
141
145
|
});
|
|
142
146
|
export function makeStyles() {
|
|
143
|
-
return /*#__PURE__*/css("font-size:", upload.fontSize, ";position:relative;.k-upload-handle,.k-upload-tip{display:inline-block;vertical-align:middle;}.k-upload-tip{margin-left:", upload.tip.gap, ";color:", upload.tip.color, ";}.k-upload-files{margin-top:", upload.filesGap, ";}.k-upload-file{margin:", upload.file.margin, ";padding:", upload.file.padding, ";border-radius:", upload.file.borderRadius, ";&:hover{background:", upload.file.bgColor, ";.k-upload-close{display:inline-flex;}}}.k-upload-name{display:flex;align-items:center;height:", upload.file.height, ";}.k-upload-file-icon{margin-right:", upload.file.fileIconGap, ";}.k-upload-file-name{flex:1;}.k-upload-status-icon{color:", upload.file.status.color, ";margin-left:", upload.file.status.gap, ";}.k-upload-close{display:none;.k-icon{font-size:", upload.closeFontSize, ";}}.k-upload-file.k-error{color:", upload.file.errorColor, ";.k-upload-status-icon{color:", upload.file.status.errorColor, ";}}.k-upload-progress{.k-progress-text{width:auto!important;}}&.k-drag{.k-upload-handle{color:", upload.drag.color, ";display:block;border:", upload.drag.border, ";border-radius:", upload.drag.borderRadius, ";cursor:pointer;text-align:center;transition:border-color ",
|
|
147
|
+
return /*#__PURE__*/css("font-size:", upload.fontSize, ";position:relative;.k-upload-handle,.k-upload-tip{display:inline-block;vertical-align:middle;}.k-upload-tip{margin-left:", upload.tip.gap, ";color:", upload.tip.color, ";}.k-upload-files{margin-top:", upload.filesGap, ";}.k-upload-file{margin:", upload.file.margin, ";padding:", upload.file.padding, ";border-radius:", upload.file.borderRadius, ";&:hover{background:", upload.file.bgColor, ";.k-upload-close{display:inline-flex;}}}.k-upload-name{display:flex;align-items:center;height:", upload.file.height, ";}.k-upload-file-icon{margin-right:", upload.file.fileIconGap, ";}.k-upload-file-name{flex:1;}.k-upload-status-icon{color:", upload.file.status.color, ";margin-left:", upload.file.status.gap, ";}.k-upload-close{display:none;.k-icon{font-size:", upload.closeFontSize, ";}}.k-upload-file.k-error{color:", upload.file.errorColor, ";.k-upload-status-icon{color:", upload.file.status.errorColor, ";}}.k-upload-progress{.k-progress-text{width:auto!important;}}&.k-drag{.k-upload-handle{color:", upload.drag.color, ";display:block;border:", upload.drag.border, ";border-radius:", upload.drag.borderRadius, ";cursor:pointer;text-align:center;transition:border-color ", upload.transition, ";&:hover{border-color:", upload.drag.hoverBorderColor, ";}}.k-upload-area{padding:", upload.drag.padding, ";.k-icon{font-size:", upload.drag.icon.fontSize, ";color:", upload.drag.icon.color, ";line-height:1;}}&.k-dragover{.k-upload-handle{border-color:", upload.drag.overBorderColor, ";}}}.k-upload-pictures{display:inline-block;vertical-align:middle;}.k-upload-picture{padding:", upload.gallery.padding, ";position:relative;vertical-align:middle;&.k-error{border-color:", upload.gallery.errorBorderColor, ";}&:hover{.k-upload-close{opacity:1;pointer-events:all;}}.k-upload-img{display:inline-block;width:100%;height:100%;}.k-upload-close{position:absolute;top:", upload.gallery.close.top, ";right:", upload.gallery.close.right, ";display:inline-block;opacity:0;transition:opacity ", upload.transition, ";pointer-events:none;.k-icon{font-size:", upload.gallery.close.fontSize, ";}}.k-upload-icons{opacity:0;transition:opacity ", upload.transition, ";}&:hover{.k-upload-icons{opacity:1;}}}.k-upload-picture-card{display:inline-block;width:", upload.gallery.width, ";height:", upload.gallery.height, ";border-radius:", upload.gallery.borderRadius, ";border:", upload.gallery.border, ";text-align:center;cursor:pointer;margin:", upload.gallery.margin, ";background:", upload.gallery.bgColor, ";}.k-upload-add{border:", upload.gallery.add.border, ";font-size:", upload.gallery.add.fontSize, ";line-height:calc(", upload.gallery.height, " - 2px);&:hover{border-color:", upload.gallery.add.hoverBorderColor, ";}}.k-upload-overlap{position:absolute;width:100%;height:100%;left:0;top:0;color:", upload.overlap.color, ";background:", upload.overlap.bgColor, ";.k-upload-progress{position:absolute;width:100%;top:50%;padding:", upload.gallery.padding, ";transform:translateY(-50%);}}.k-upload-zoom{display:inline-block;position:relative;top:50%;transform:translateY(-50%);font-size:", upload.overlap.zoomFontSize, ";}");
|
|
144
148
|
}
|
|
145
149
|
export function makeUploadDialogStyles() {
|
|
146
150
|
return /*#__PURE__*/css(process.env.NODE_ENV === "production" ? {
|
package/components/utils.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare function isTextVNode(o: VNode): boolean;
|
|
|
7
7
|
export declare function isTextBlock(o: any): boolean;
|
|
8
8
|
export declare function isStringOrNumberNotEmpty(o: any): o is string | number;
|
|
9
9
|
export declare function getRestProps<T>(component: Component<T>, props?: import("intact").Props<T, Component<T, {}, {}, {}>>): Partial<T>;
|
|
10
|
-
export declare function isExternalLink(to?: string):
|
|
10
|
+
export declare function isExternalLink(to?: string | object): to is string;
|
|
11
11
|
export declare function clamp(number: number, lower: number, upper: number): number;
|
|
12
12
|
export declare function stopPropagation(e: Event): void;
|
|
13
13
|
export declare type ValidVNode = VNode | string | number;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Component, TypeDefs, VNode } from 'intact-react';
|
|
2
|
+
export interface WaveProps {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
color?: string;
|
|
5
|
+
inset?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class Wave extends Component<WaveProps> {
|
|
8
|
+
static typeDefs: Required<TypeDefs<WaveProps>>;
|
|
9
|
+
static defaults: () => Partial<WaveProps>;
|
|
10
|
+
static template: (this: Wave) => VNode<import("intact").VNodeTag>;
|
|
11
|
+
private instance;
|
|
12
|
+
private className;
|
|
13
|
+
private timer;
|
|
14
|
+
private initClassName;
|
|
15
|
+
mounted(): void;
|
|
16
|
+
beforeUnmount(): void;
|
|
17
|
+
private onClick;
|
|
18
|
+
resetAnimation(): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import { __decorate } from "tslib";
|
|
4
|
+
import { Component, findDomFromVNode } from 'intact-react';
|
|
5
|
+
import { isArray } from 'intact-shared';
|
|
6
|
+
import { bind } from '../utils';
|
|
7
|
+
import { makeStyles } from './styles';
|
|
8
|
+
import { theme } from '../../styles/theme';
|
|
9
|
+
var typeDefs = {
|
|
10
|
+
disabled: Boolean,
|
|
11
|
+
color: String,
|
|
12
|
+
inset: String
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
var defaults = function defaults() {
|
|
16
|
+
return {
|
|
17
|
+
color: theme.color.primary,
|
|
18
|
+
inset: '-1px'
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export var Wave = /*#__PURE__*/function (_Component) {
|
|
23
|
+
_inheritsLoose(Wave, _Component);
|
|
24
|
+
|
|
25
|
+
function Wave() {
|
|
26
|
+
var _context;
|
|
27
|
+
|
|
28
|
+
var _this;
|
|
29
|
+
|
|
30
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
31
|
+
args[_key] = arguments[_key];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
35
|
+
_this.instance = null;
|
|
36
|
+
_this.className = void 0;
|
|
37
|
+
_this.timer = 0;
|
|
38
|
+
return _this;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
var _proto = Wave.prototype;
|
|
42
|
+
|
|
43
|
+
_proto.initClassName = function initClassName() {
|
|
44
|
+
var _this$get = this.get(),
|
|
45
|
+
color = _this$get.color,
|
|
46
|
+
inset = _this$get.inset;
|
|
47
|
+
|
|
48
|
+
this.className = makeStyles(color || theme.color.primary, inset);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
_proto.mounted = function mounted() {
|
|
52
|
+
var children = this.get('children');
|
|
53
|
+
var node = findDomFromVNode(children, true);
|
|
54
|
+
|
|
55
|
+
if (!node || node.nodeType !== 1) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
this.instance = node;
|
|
60
|
+
node.addEventListener('click', this.onClick);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
_proto.beforeUnmount = function beforeUnmount() {
|
|
64
|
+
if (this.instance) {
|
|
65
|
+
this.instance.removeEventListener('click', this.onClick);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
this.resetAnimation();
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
_proto.onClick = function onClick(e) {
|
|
72
|
+
var _this2 = this;
|
|
73
|
+
|
|
74
|
+
this.initClassName();
|
|
75
|
+
var instance = this.instance;
|
|
76
|
+
|
|
77
|
+
var _this$get2 = this.get(),
|
|
78
|
+
disabled = _this$get2.disabled;
|
|
79
|
+
|
|
80
|
+
var node = e.target; // 点击输入框中的icon时,此时输入框不需要动效
|
|
81
|
+
|
|
82
|
+
var isInput = instance.classList.contains('k-input-wrapper');
|
|
83
|
+
if (disabled || isInput && node.classList.contains('k-icon')) return;
|
|
84
|
+
this.resetAnimation();
|
|
85
|
+
instance.addEventListener('animationend', this.resetAnimation);
|
|
86
|
+
this.timer = window.setTimeout(function () {
|
|
87
|
+
instance.classList.add(_this2.className);
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
_proto.resetAnimation = function resetAnimation() {
|
|
92
|
+
var node = this.instance;
|
|
93
|
+
if (!node) return;
|
|
94
|
+
node.classList.remove(this.className);
|
|
95
|
+
node.removeEventListener('animationend', this.resetAnimation);
|
|
96
|
+
clearTimeout(this.timer);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
return Wave;
|
|
100
|
+
}(Component);
|
|
101
|
+
Wave.typeDefs = typeDefs;
|
|
102
|
+
Wave.defaults = defaults;
|
|
103
|
+
|
|
104
|
+
Wave.template = function () {
|
|
105
|
+
var children = this.get('children');
|
|
106
|
+
|
|
107
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
108
|
+
if (!children || isArray(children) && children.length > 1) {
|
|
109
|
+
throw new Error('Wave must receive only one Element children');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return children;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
__decorate([bind], Wave.prototype, "mounted", null);
|
|
117
|
+
|
|
118
|
+
__decorate([bind], Wave.prototype, "onClick", null);
|
|
119
|
+
|
|
120
|
+
__decorate([bind], Wave.prototype, "resetAnimation", null);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { css, keyframes } from '@emotion/css';
|
|
2
|
+
import { theme, setDefault } from '../../styles/theme';
|
|
3
|
+
import { deepDefaults } from '../../styles/utils';
|
|
4
|
+
import '../../styles/global';
|
|
5
|
+
var defaults = {
|
|
6
|
+
inset: '-3px'
|
|
7
|
+
};
|
|
8
|
+
var wave;
|
|
9
|
+
setDefault(function () {
|
|
10
|
+
wave = deepDefaults(theme, {
|
|
11
|
+
wave: defaults
|
|
12
|
+
}).wave;
|
|
13
|
+
});
|
|
14
|
+
export function makeStyles(color, inset) {
|
|
15
|
+
var waveEffect = /*#__PURE__*/keyframes("100%{top:calc(", inset, " + ", wave.inset, ");bottom:calc(", inset, " + ", wave.inset, ");left:calc(", inset, " + ", wave.inset, ");right:calc(", inset, " + ", wave.inset, ");opacity:0.05;}");
|
|
16
|
+
return /*#__PURE__*/css("position:relative;&::after{display:block;content:'';position:absolute;top:", inset, ";bottom:", inset, ";left:", inset, ";right:", inset, ";opacity:0.4;border-radius:4px;z-index:2;animation:", waveEffect, " .2s ease-in;animation-fill-mode:forwards;border:2px solid ", color, ";}&.k-circle,&.k-radio-wrapper{&:after{border-radius:calc(", theme.large.height, " / 2 + 4px);}}");
|
|
17
|
+
}
|
package/hooks/useRouter.d.ts
CHANGED
package/hooks/useRouter.js
CHANGED
|
@@ -19,6 +19,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
19
19
|
* in Vue, find the $router
|
|
20
20
|
*/
|
|
21
21
|
import { useInstance, createRef, onMounted } from 'intact-react';
|
|
22
|
+
import { isExternalLink } from '../components/utils';
|
|
22
23
|
export function useRouter() {
|
|
23
24
|
var instance = useInstance();
|
|
24
25
|
var ref = createRef();
|
|
@@ -27,6 +28,15 @@ export function useRouter() {
|
|
|
27
28
|
});
|
|
28
29
|
return ref;
|
|
29
30
|
}
|
|
31
|
+
export function navigate(router, to) {
|
|
32
|
+
if (to) {
|
|
33
|
+
if (router && !isExternalLink(to)) {
|
|
34
|
+
router.push(to);
|
|
35
|
+
} else {
|
|
36
|
+
location.href = to;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
30
40
|
|
|
31
41
|
function findRouter(instance) {
|
|
32
42
|
var Component = instance.constructor;
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.0
|
|
2
|
+
* @king-design v2.0.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -55,7 +55,8 @@ export * from './components/transfer';
|
|
|
55
55
|
export * from './components/tree';
|
|
56
56
|
export * from './components/treeSelect';
|
|
57
57
|
export * from './components/upload';
|
|
58
|
-
export
|
|
58
|
+
export * from './components/wave';
|
|
59
|
+
export declare const version = "2.0.0";
|
|
59
60
|
|
|
60
61
|
|
|
61
62
|
export {normalize} from 'intact-react';
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.0
|
|
2
|
+
* @king-design v2.0.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -57,7 +57,8 @@ export * from './components/transfer';
|
|
|
57
57
|
export * from './components/tree';
|
|
58
58
|
export * from './components/treeSelect';
|
|
59
59
|
export * from './components/upload';
|
|
60
|
-
export
|
|
60
|
+
export * from './components/wave';
|
|
61
|
+
export var version = '2.0.0';
|
|
61
62
|
/* generate end */
|
|
62
63
|
|
|
63
64
|
export {normalize} from 'intact-react';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@king-design/react",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "King-Design UI components for React.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"component",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dayjs": "^1.10.7",
|
|
38
38
|
"downloadjs": "^1.4.7",
|
|
39
39
|
"enquire.js": "^2.1.6",
|
|
40
|
-
"intact-react": "^3.0.0
|
|
40
|
+
"intact-react": "^3.0.0",
|
|
41
41
|
"monaco-editor": "^0.26.1",
|
|
42
42
|
"mxgraphx": "^4.0.7",
|
|
43
43
|
"resize-observer-polyfill": "^1.5.1",
|
package/styles/global.js
CHANGED
|
@@ -4,6 +4,7 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
|
4
4
|
import _Object$keys from "@babel/runtime-corejs3/core-js/object/keys";
|
|
5
5
|
import { injectGlobal } from '@emotion/css';
|
|
6
6
|
import { theme } from './theme';
|
|
7
|
+
import { palette } from '../styles/utils';
|
|
7
8
|
var slideDirections = {
|
|
8
9
|
down: 'center top 0',
|
|
9
10
|
up: 'center bottom 0',
|
|
@@ -11,6 +12,6 @@ var slideDirections = {
|
|
|
11
12
|
right: 'left center 0'
|
|
12
13
|
}; // TODO: update global when theme changed
|
|
13
14
|
|
|
14
|
-
injectGlobal("html{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,SF Pro SC,SF Pro Text,Helvetica Neue,Helvetica,PingFang SC,Segoe UI,Roboto,Hiragino Sans GB,arial,microsoft yahei ui,Microsoft YaHei,SimSun,sans-serif;}body{font-size:", theme.fontSize, ";line-height:", theme.lineHeight, ";margin:0;padding:0;color:", theme.color.text, ";}*,*:before,*:after{box-sizing:inherit;}", _mapInstanceProperty(_context = _Object$keys(slideDirections)).call(_context, function (direction) {
|
|
15
|
-
return "\n .k-slide" + direction + "-enter-from,\n .k-slide" + direction + "-leave-to {\n transform-origin: " + slideDirections[direction] + ";\n opacity: 0;\n transform: " + (direction === 'down' || direction === 'up' ? "scaleY(.8)" : 'scaleX(.8)') + ";\n }\n .k-slide" + direction + "-enter-active,\n .k-slide" + direction + "-leave-active {\n transform-origin: " + slideDirections[direction] + ";\n transition: opacity " + theme.transition + ", transform " + theme.transition + " !important;\n pointer-events: none;\n }\n ";
|
|
16
|
-
}).join(''), " .k-fade-enter-from,.k-fade-leave-to{opacity:0!important;}.k-fade-enter-active,.k-fade-leave-active{transition:opacity ", theme.transition, ";}.k-fade-leave-active:not(tr){position:absolute;}.k-fade-move{transition:transform ", theme.transition, ";}.k-scale-enter-from,.k-scale-leave-to{transform:scale(0);}.k-scale-enter-active,.k-scale-leave-active{transition:transform ", theme.transition, ";}.k-expand-enter-from,.k-expand-leave-to{opacity:0;overflow:hidden;}.k-expand-enter-active,.k-expand-leave-active{transition:all ", theme.transition, "!important;overflow:hidden;}.k-expand-move{transition:transform ", theme.transition, ";}.k-dropdown-enter-from,.k-dropdown-leave-to{opacity:0;transform:translateY(-20px);}.k-dropdown-enter-active,.k-dropdown-leave-active,.k-dropdown-move{transition:all ", theme.transition, ";}.k-dropdown-leave-active{position:absolute!important;}.k-dropdown-move{transition:transform ", theme.transition, ";}.c-ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.c-hidden{display:none;}.c-middle{display:inline-block;vertical-align:middle;}");
|
|
15
|
+
injectGlobal("html{--var-wave-color:", theme.color.primary, ";box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,SF Pro SC,SF Pro Text,Helvetica Neue,Helvetica,PingFang SC,Segoe UI,Roboto,Hiragino Sans GB,arial,microsoft yahei ui,Microsoft YaHei,SimSun,sans-serif;}body{font-size:", theme.fontSize, ";line-height:", theme.lineHeight, ";margin:0;padding:0;color:", theme.color.text, ";}*,*:before,*:after{box-sizing:inherit;}", _mapInstanceProperty(_context = _Object$keys(slideDirections)).call(_context, function (direction) {
|
|
16
|
+
return "\n .k-slide" + direction + "-enter-from,\n .k-slide" + direction + "-leave-to {\n transform-origin: " + slideDirections[direction] + ";\n opacity: 0;\n transform: " + (direction === 'down' || direction === 'up' ? "scaleY(.8)" : 'scaleX(.8)') + ";\n }\n .k-slide" + direction + "-enter-active,\n .k-slide" + direction + "-leave-active {\n transform-origin: " + slideDirections[direction] + ";\n transition: opacity " + theme.transition.large + ", transform " + theme.transition.large + " !important;\n pointer-events: none;\n }\n ";
|
|
17
|
+
}).join(''), " .k-fade-enter-from,.k-fade-leave-to{opacity:0!important;}.k-fade-enter-active,.k-fade-leave-active{transition:opacity ", theme.transition.large, ";}.k-fade-leave-active:not(tr){position:absolute;}.k-fade-move{transition:transform ", theme.transition.large, ";}.k-scale-enter-from,.k-scale-leave-to{transform:scale(0);}.k-scale-enter-active,.k-scale-leave-active{transition:transform ", theme.transition.large, ";}.k-expand-enter-from,.k-expand-leave-to{opacity:0;overflow:hidden;}.k-expand-enter-active,.k-expand-leave-active{transition:all ", theme.transition.large, "!important;overflow:hidden;}.k-expand-move{transition:transform ", theme.transition.large, ";}.k-dropdown-enter-from,.k-dropdown-leave-to{opacity:0;transform:translateY(-20px);}.k-dropdown-enter-active,.k-dropdown-leave-active,.k-dropdown-move{transition:all ", theme.transition.large, ";}.k-dropdown-leave-active{position:absolute!important;}.k-dropdown-move{transition:transform ", theme.transition.large, ";}.k-fade-in-left-enter-from,.k-fade-in-left-leave-to{opacity:0;transform:translate3d(-15px, 0, 0);}.k-fade-in-left-enter-active,.k-fade-in-left-leave-active{transition:all ", theme.transition.large, ";td{background:", palette(theme.color.primary, -4), "!important;}}.k-fade-in-left-move{transition:transform ", theme.transition.large, ";}.k-fade-expand-enter-from,.k-fade-expand-leave-to{opacity:0;}.k-fade-expand-enter-active,.k-fade-expand-leave-active{transition:all ", theme.transition.large, ";background:", palette(theme.color.primary, -4), "!important;}.c-ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.c-hidden{display:none;}.c-middle{display:inline-block;vertical-align:middle;}");
|
package/styles/theme.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export declare type ThemeValue<T> = T;
|
|
2
1
|
export declare type Theme = {
|
|
3
|
-
[name: string]:
|
|
2
|
+
[name: string]: string | number | Theme;
|
|
4
3
|
};
|
|
5
|
-
export declare function
|
|
4
|
+
export declare function defaultTheme(): {
|
|
6
5
|
large: {
|
|
7
6
|
height: string;
|
|
8
7
|
fontSize: string;
|
|
@@ -24,7 +23,6 @@ export declare function defualtTheme(): {
|
|
|
24
23
|
padding: string;
|
|
25
24
|
};
|
|
26
25
|
color: {
|
|
27
|
-
lightBlack: string;
|
|
28
26
|
primary: string;
|
|
29
27
|
warning: string;
|
|
30
28
|
danger: string;
|
|
@@ -38,9 +36,11 @@ export declare function defualtTheme(): {
|
|
|
38
36
|
placeholder: string;
|
|
39
37
|
readonly link: string;
|
|
40
38
|
readonly linkHover: string;
|
|
39
|
+
readonly hoverBg: string;
|
|
41
40
|
disabled: string;
|
|
42
41
|
disabledBg: string;
|
|
43
42
|
disabledBorder: string;
|
|
43
|
+
lightBlack: string;
|
|
44
44
|
};
|
|
45
45
|
borderRadius: string;
|
|
46
46
|
boxShadow: string;
|
|
@@ -48,7 +48,11 @@ export declare function defualtTheme(): {
|
|
|
48
48
|
lineHeight: number;
|
|
49
49
|
maxZIndex: number;
|
|
50
50
|
midZIndex: number;
|
|
51
|
-
transition:
|
|
51
|
+
transition: {
|
|
52
|
+
small: string;
|
|
53
|
+
middle: string;
|
|
54
|
+
large: string;
|
|
55
|
+
};
|
|
52
56
|
};
|
|
53
57
|
declare let theme: {
|
|
54
58
|
large: {
|
|
@@ -72,7 +76,6 @@ declare let theme: {
|
|
|
72
76
|
padding: string;
|
|
73
77
|
};
|
|
74
78
|
color: {
|
|
75
|
-
lightBlack: string;
|
|
76
79
|
primary: string;
|
|
77
80
|
warning: string;
|
|
78
81
|
danger: string;
|
|
@@ -86,9 +89,11 @@ declare let theme: {
|
|
|
86
89
|
placeholder: string;
|
|
87
90
|
readonly link: string;
|
|
88
91
|
readonly linkHover: string;
|
|
92
|
+
readonly hoverBg: string;
|
|
89
93
|
disabled: string;
|
|
90
94
|
disabledBg: string;
|
|
91
95
|
disabledBorder: string;
|
|
96
|
+
lightBlack: string;
|
|
92
97
|
};
|
|
93
98
|
borderRadius: string;
|
|
94
99
|
boxShadow: string;
|
|
@@ -96,7 +101,11 @@ declare let theme: {
|
|
|
96
101
|
lineHeight: number;
|
|
97
102
|
maxZIndex: number;
|
|
98
103
|
midZIndex: number;
|
|
99
|
-
transition:
|
|
104
|
+
transition: {
|
|
105
|
+
small: string;
|
|
106
|
+
middle: string;
|
|
107
|
+
large: string;
|
|
108
|
+
};
|
|
100
109
|
};
|
|
101
110
|
export declare function resetTheme(): void;
|
|
102
111
|
export { theme };
|
package/styles/theme.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { palette, deepExtends } from './utils';
|
|
2
|
-
export function
|
|
2
|
+
export function defaultTheme() {
|
|
3
3
|
return {
|
|
4
4
|
large: {
|
|
5
5
|
height: '40px',
|
|
@@ -22,7 +22,6 @@ export function defualtTheme() {
|
|
|
22
22
|
padding: '8px'
|
|
23
23
|
},
|
|
24
24
|
color: {
|
|
25
|
-
lightBlack: '#737373',
|
|
26
25
|
primary: '#0091ea',
|
|
27
26
|
warning: '#ff9800',
|
|
28
27
|
danger: '#ff4133',
|
|
@@ -43,22 +42,31 @@ export function defualtTheme() {
|
|
|
43
42
|
return palette(theme.color.primary, -1);
|
|
44
43
|
},
|
|
45
44
|
|
|
45
|
+
get hoverBg() {
|
|
46
|
+
return palette(theme.color.primary, -4);
|
|
47
|
+
},
|
|
48
|
+
|
|
46
49
|
disabled: '#ccc',
|
|
47
50
|
disabledBg: '#f2f2f2',
|
|
48
|
-
disabledBorder: '#ccc'
|
|
51
|
+
disabledBorder: '#ccc',
|
|
52
|
+
lightBlack: '#737373'
|
|
49
53
|
},
|
|
50
54
|
borderRadius: '2px',
|
|
51
|
-
boxShadow: '0 0
|
|
55
|
+
boxShadow: '0 0 16px 0 rgba(0, 0, 0, .1)',
|
|
52
56
|
fontSize: '12px',
|
|
53
57
|
lineHeight: 1.5,
|
|
54
58
|
maxZIndex: 9999,
|
|
55
59
|
midZIndex: 999,
|
|
56
|
-
transition:
|
|
60
|
+
transition: {
|
|
61
|
+
small: '.1s cubic-bezier(0.42, 0, 0.58, 1)',
|
|
62
|
+
middle: '.2s cubic-bezier(0.25, 0.1, 0.25, 1)',
|
|
63
|
+
large: '.3s cubic-bezier(0.25, 0.1, 0.25, 1)'
|
|
64
|
+
}
|
|
57
65
|
};
|
|
58
66
|
}
|
|
59
|
-
var theme =
|
|
67
|
+
var theme = defaultTheme();
|
|
60
68
|
export function resetTheme() {
|
|
61
|
-
theme =
|
|
69
|
+
theme = defaultTheme();
|
|
62
70
|
}
|
|
63
71
|
export { theme };
|
|
64
72
|
var queue = [];
|