@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
package/__tests__/index.ts
CHANGED
|
@@ -40,7 +40,10 @@ describe('React Demos', () => {
|
|
|
40
40
|
|
|
41
41
|
testDemos(reactReq, async (Demo) => {
|
|
42
42
|
const [instance, element] = mount(wrap(Demo as any));
|
|
43
|
-
await wait();
|
|
44
|
-
|
|
43
|
+
await wait(100);
|
|
44
|
+
// FIXME: I don't why the width of `autoWidth` input is an unexpected value
|
|
45
|
+
// while we run test on Github Actions.
|
|
46
|
+
const innerHTML = element.innerHTML.replace(/(\<input.*?style="width: )(?:.*?)(px;")/g, '$1$2');
|
|
47
|
+
expect(innerHTML).to.matchSnapshot();
|
|
45
48
|
});
|
|
46
49
|
});
|
package/__tests__/karma.conf.js
CHANGED
|
@@ -16,7 +16,7 @@ module.exports = function (config) {
|
|
|
16
16
|
customLaunchers: {
|
|
17
17
|
'MyChromeHeadless': {
|
|
18
18
|
base: 'ChromeHeadless',
|
|
19
|
-
flags: ['--window-size=1920,1080'],
|
|
19
|
+
flags: ['--window-size=1920,1080', '--force-device-scale-factor=1'],
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
frameworks: ['webpack', 'mocha', 'sinon-chai', 'snapshot', 'mocha-snapshot'],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component, TypeDefs } from 'intact-react';
|
|
2
2
|
export interface BreadcrumbItemProps {
|
|
3
|
-
to?: string;
|
|
3
|
+
to?: string | object;
|
|
4
4
|
}
|
|
5
5
|
export declare class BreadcrumbItem extends Component<BreadcrumbItemProps> {
|
|
6
6
|
static template: string | import("intact").Template<any>;
|
|
@@ -4,10 +4,9 @@ import { __decorate } from "tslib";
|
|
|
4
4
|
import { Component } from 'intact-react';
|
|
5
5
|
import { bind } from '../utils';
|
|
6
6
|
import template from './item.vdt';
|
|
7
|
-
import {
|
|
8
|
-
import { useRouter } from '../../hooks/useRouter';
|
|
7
|
+
import { useRouter, navigate } from '../../hooks/useRouter';
|
|
9
8
|
var typeDefs = {
|
|
10
|
-
to: String
|
|
9
|
+
to: [String, Object]
|
|
11
10
|
};
|
|
12
11
|
export var BreadcrumbItem = /*#__PURE__*/function (_Component) {
|
|
13
12
|
_inheritsLoose(BreadcrumbItem, _Component);
|
|
@@ -29,17 +28,7 @@ export var BreadcrumbItem = /*#__PURE__*/function (_Component) {
|
|
|
29
28
|
var _proto = BreadcrumbItem.prototype;
|
|
30
29
|
|
|
31
30
|
_proto.onClick = function onClick() {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (to) {
|
|
35
|
-
var router = this.router.value;
|
|
36
|
-
|
|
37
|
-
if (router && !isExternalLink(to)) {
|
|
38
|
-
router.push(to);
|
|
39
|
-
} else {
|
|
40
|
-
window.location.href = to;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
31
|
+
navigate(this.router.value, this.get('to'));
|
|
43
32
|
};
|
|
44
33
|
|
|
45
34
|
return BreadcrumbItem;
|
|
@@ -24,5 +24,5 @@ setDefault(function () {
|
|
|
24
24
|
}).breadcrumb;
|
|
25
25
|
});
|
|
26
26
|
export default function makeStyles() {
|
|
27
|
-
return /*#__PURE__*/css("font-size:", breadcrumb.fontSize, ";.k-breadcrumb-item{
|
|
27
|
+
return /*#__PURE__*/css("font-size:", breadcrumb.fontSize, ";display:flex;align-items:center;.k-breadcrumb-item{&:last-of-type .k-breadcrumb-link{font-weight:", breadcrumb.activeFontWeight, ";color:", breadcrumb.activeColor, ";}}.k-breadcrumb-link,.k-breadcrumb-link a{color:", breadcrumb.color, ";}a.k-breadcrumb-link,.k-breadcrumb-link a{cursor:pointer;&:hover{color:", breadcrumb.hoverColor, ";}}.k-breadcrumb-separator{margin:0 ", breadcrumb.gap, ";}");
|
|
28
28
|
}
|
|
@@ -4,6 +4,8 @@ import { getRestProps } from '../utils';
|
|
|
4
4
|
import { Icon } from '../icon';
|
|
5
5
|
import { makeButtonStyles } from './styles';
|
|
6
6
|
import { DynamicButton } from './dynamicButton';
|
|
7
|
+
import { Wave } from '../wave';
|
|
8
|
+
import { button as theme } from './styles';
|
|
7
9
|
export default function ($props, $blocks, $__proto__) {
|
|
8
10
|
var _classNameObj;
|
|
9
11
|
|
|
@@ -72,22 +74,29 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
72
74
|
var buttonGroup = this.buttonGroup;
|
|
73
75
|
var checkType = buttonGroup ? buttonGroup.get('checkType') : 'none';
|
|
74
76
|
var isCheckType = checkType !== 'none';
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
'
|
|
80
|
-
'
|
|
81
|
-
'
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
'
|
|
87
|
-
'
|
|
88
|
-
'
|
|
89
|
-
'
|
|
90
|
-
|
|
91
|
-
|
|
77
|
+
var typeStyles = theme[type];
|
|
78
|
+
var waveColor = typeStyles && typeStyles.borderColor || theme.primary.borderColor;
|
|
79
|
+
return _$cc(Wave, {
|
|
80
|
+
'disabled': loading || disabled || type === 'none' || type === 'link',
|
|
81
|
+
'inset': '-2px',
|
|
82
|
+
'color': waveColor,
|
|
83
|
+
'children': _$cc(DynamicButton, _extends({
|
|
84
|
+
'className': _$cn(classNameObj),
|
|
85
|
+
'tagName': tagName
|
|
86
|
+
}, getRestProps(this), {
|
|
87
|
+
'ref': this.elementRef,
|
|
88
|
+
'tabindex': disabled || loading ? '-1' : tabindex,
|
|
89
|
+
'ev-click': this.onClick,
|
|
90
|
+
'ev-mouseup': this.onMouseUp,
|
|
91
|
+
'htmlType': htmlType,
|
|
92
|
+
'name': isCheckType ? null : name,
|
|
93
|
+
'children': [loading ? iconSide === 'right' ? [children, loadingIcon] : [loadingIcon, children] : children, isCheckType ? _$ce(64, 'input', null, 1, 'k-button-input', {
|
|
94
|
+
'type': checkType,
|
|
95
|
+
'name': name,
|
|
96
|
+
'checked': checked,
|
|
97
|
+
'tabindex': '-1'
|
|
98
|
+
}) : undefined]
|
|
99
|
+
}), null, this.elementRef)
|
|
100
|
+
});
|
|
92
101
|
}
|
|
93
102
|
;
|
|
@@ -1,6 +1,87 @@
|
|
|
1
1
|
import '../../styles/global';
|
|
2
|
+
declare type TypeStyles = {
|
|
3
|
+
color: string;
|
|
4
|
+
bgColor: string;
|
|
5
|
+
borderColor: string;
|
|
6
|
+
hoverBorderColor: string;
|
|
7
|
+
ghostColor: string;
|
|
8
|
+
};
|
|
9
|
+
declare type SizeStyles = {
|
|
10
|
+
fontSize: string;
|
|
11
|
+
height: string;
|
|
12
|
+
padding: string;
|
|
13
|
+
};
|
|
2
14
|
export declare const types: readonly ["primary", "warning", "danger", "active", "success"];
|
|
3
|
-
declare
|
|
15
|
+
declare const defaults: {
|
|
16
|
+
readonly transition: string;
|
|
17
|
+
active: TypeStyles;
|
|
18
|
+
secondary: {
|
|
19
|
+
readonly color: string;
|
|
20
|
+
readonly borderColor: string;
|
|
21
|
+
readonly hoverBgColor: string;
|
|
22
|
+
readonly activeBgColor: string;
|
|
23
|
+
};
|
|
24
|
+
link: {
|
|
25
|
+
readonly color: string;
|
|
26
|
+
readonly hoverColor: string;
|
|
27
|
+
readonly hoverBgColor: string;
|
|
28
|
+
};
|
|
29
|
+
none: {
|
|
30
|
+
readonly hoverBgColor: string;
|
|
31
|
+
};
|
|
32
|
+
group: {
|
|
33
|
+
primary: {
|
|
34
|
+
readonly borderColor: string;
|
|
35
|
+
};
|
|
36
|
+
warning: {
|
|
37
|
+
readonly borderColor: string;
|
|
38
|
+
};
|
|
39
|
+
danger: {
|
|
40
|
+
readonly borderColor: string;
|
|
41
|
+
};
|
|
42
|
+
success: {
|
|
43
|
+
readonly borderColor: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
} & {
|
|
47
|
+
readonly color: string;
|
|
48
|
+
bgColor: string;
|
|
49
|
+
lineHeight: string;
|
|
50
|
+
readonly padding: string;
|
|
51
|
+
readonly borderColor: string;
|
|
52
|
+
readonly borderRadius: string;
|
|
53
|
+
readonly fontSize: string;
|
|
54
|
+
readonly height: string;
|
|
55
|
+
readonly hoverBorderColor: string;
|
|
56
|
+
readonly hoverColor: string;
|
|
57
|
+
ghost: {
|
|
58
|
+
color: string;
|
|
59
|
+
readonly hoverColor: string;
|
|
60
|
+
borderColor: string;
|
|
61
|
+
readonly hoverBorderColor: string;
|
|
62
|
+
};
|
|
63
|
+
icon: {
|
|
64
|
+
gap: string;
|
|
65
|
+
fontSize: string;
|
|
66
|
+
};
|
|
67
|
+
disabled: {
|
|
68
|
+
readonly color: string;
|
|
69
|
+
readonly bgColor: string;
|
|
70
|
+
readonly borderColor: string;
|
|
71
|
+
readonly ghostBorderColor: string;
|
|
72
|
+
};
|
|
73
|
+
} & {
|
|
74
|
+
primary: TypeStyles;
|
|
75
|
+
warning: TypeStyles;
|
|
76
|
+
danger: TypeStyles;
|
|
77
|
+
success: TypeStyles;
|
|
78
|
+
active: TypeStyles;
|
|
79
|
+
} & {
|
|
80
|
+
small: SizeStyles;
|
|
81
|
+
large: SizeStyles;
|
|
82
|
+
mini: SizeStyles;
|
|
83
|
+
};
|
|
84
|
+
declare let button: typeof defaults;
|
|
4
85
|
export { button };
|
|
5
86
|
export declare function makeButtonStyles({ iconSide }: {
|
|
6
87
|
iconSide?: string;
|
|
@@ -149,6 +149,10 @@ var btnSizeStyles = sizes.reduce(function (memo, size) {
|
|
|
149
149
|
return memo;
|
|
150
150
|
}, {});
|
|
151
151
|
var defaults = deepDefaults({
|
|
152
|
+
get transition() {
|
|
153
|
+
return theme.transition.middle;
|
|
154
|
+
},
|
|
155
|
+
|
|
152
156
|
active: btnActiveStyles,
|
|
153
157
|
secondary: {
|
|
154
158
|
get color() {
|
|
@@ -175,6 +179,16 @@ var defaults = deepDefaults({
|
|
|
175
179
|
|
|
176
180
|
get hoverColor() {
|
|
177
181
|
return theme.color.linkHover;
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
get hoverBgColor() {
|
|
185
|
+
return theme.color.hoverBg;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
},
|
|
189
|
+
none: {
|
|
190
|
+
get hoverBgColor() {
|
|
191
|
+
return theme.color.bg;
|
|
178
192
|
}
|
|
179
193
|
|
|
180
194
|
},
|
|
@@ -221,10 +235,10 @@ export function makeButtonStyles(_ref) {
|
|
|
221
235
|
return cx(
|
|
222
236
|
/*#__PURE__*/
|
|
223
237
|
// extract static styles to individual css method for performance
|
|
224
|
-
css("display:inline-flex;align-items:center;justify-content:center;cursor:pointer;height:", button.height, ";padding:", button.padding, ";outline:none;vertical-align:middle;color:", button.color, ";background:", button.bgColor, ";border-radius:", button.borderRadius, ";border:1px solid ", button.borderColor, ";font-size:", button.fontSize, ";white-space:nowrap;transition:all ",
|
|
238
|
+
css("display:inline-flex;align-items:center;justify-content:center;cursor:pointer;height:", button.height, ";padding:", button.padding, ";outline:none;vertical-align:middle;color:", button.color, ";background:", button.bgColor, ";border-radius:", button.borderRadius, ";border:1px solid ", button.borderColor, ";font-size:", button.fontSize, ";white-space:nowrap;transition:all ", button.transition, ";line-height:", button.lineHeight, ";&:hover,&:focus{border-color:", button.hoverBorderColor, ";color:", button.hoverColor, ";}&:active{background:", palette(theme.color.primary, -4), ";}.k-button-input{position:absolute;opacity:0;width:0;height:0;}", _mapInstanceProperty(types).call(types, function (type) {
|
|
225
239
|
var typeStyles = button[type];
|
|
226
240
|
return /*#__PURE__*/css("&.k-", type, "{background:", typeStyles.bgColor, ";color:", typeStyles.color, ";border-color:", typeStyles.borderColor, ";&:hover,&:focus{background:", palette(typeStyles.bgColor, -1), ";border-color:", typeStyles.hoverBorderColor, ";color:", typeStyles.color, ";}&:active{background:", palette(typeStyles.bgColor, 1), ";border-color:", palette(typeStyles.borderColor, 1), ";}}");
|
|
227
|
-
}), "&.k-secondary{color:", secondary.color, ";border-color:", secondary.borderColor, ";&:hover,&:focus{background:", secondary.hoverBgColor, ";}&:active{background:", secondary.activeBgColor, ";}}&.k-link{color:", link.color, ";&:hover{color:", link.hoverColor, ";}}&.k-disabled{&,&:hover{color:", button.disabled.color, ";background:", button.disabled.bgColor, ";border-color:", button.disabled.borderColor, ";cursor:not-allowed;}}&.k-none,&.k-link{
|
|
241
|
+
}), "&.k-secondary{color:", secondary.color, ";border-color:", secondary.borderColor, ";&:hover,&:focus{background:", secondary.hoverBgColor, ";}&:active{background:", secondary.activeBgColor, ";}}&.k-link{color:", link.color, ";&:hover{color:", link.hoverColor, ";background:", link.hoverBgColor, ";}}&.k-disabled{&,&:hover{color:", button.disabled.color, ";background:", button.disabled.bgColor, ";border-color:", button.disabled.borderColor, ";cursor:not-allowed;}}&.k-none,&.k-link{background:transparent;&,&:hover{border:none;}&.k-active{color:", theme.color.primary, ";}}&.k-none:hover{background:", button.none.hoverBgColor, ";}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
228
242
|
var styles = button[size];
|
|
229
243
|
return /*#__PURE__*/css("&.k-", size, "{font-size:", styles.fontSize, ";height:", styles.height, ";padding:", styles.padding, ";&.k-btn-icon{width:", styles.height, ";}}");
|
|
230
244
|
}), "&.k-btn-icon{width:", button.height, ";padding:0;.k-icon{margin:0;}}&.k-fluid{width:100%;padding:0;}&.k-circle{border-radius:calc(", button.large.height, " / 2);}&.k-loading{", _mapInstanceProperty(types).call(types, function (type) {
|
|
@@ -3,7 +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
|
-
transition
|
|
6
|
+
get transition() {
|
|
7
|
+
return theme.transition.large;
|
|
8
|
+
},
|
|
9
|
+
|
|
7
10
|
height: "300px",
|
|
8
11
|
indicator: {
|
|
9
12
|
bottom: "8px",
|
|
@@ -48,7 +48,7 @@ export function useSlide(getItems, getItemsWithCloned) {
|
|
|
48
48
|
|
|
49
49
|
function _translateToItem() {
|
|
50
50
|
_translateToItem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(item, oldIndex, newIndex, keepDirection) {
|
|
51
|
-
var itemsWithCloned, length;
|
|
51
|
+
var itemsWithCloned, length, lengthWithCloned;
|
|
52
52
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
53
53
|
while (1) {
|
|
54
54
|
switch (_context.prev = _context.next) {
|
|
@@ -62,7 +62,7 @@ export function useSlide(getItems, getItemsWithCloned) {
|
|
|
62
62
|
|
|
63
63
|
case 2:
|
|
64
64
|
if (!keepDirection) {
|
|
65
|
-
_context.next =
|
|
65
|
+
_context.next = 14;
|
|
66
66
|
break;
|
|
67
67
|
}
|
|
68
68
|
|
|
@@ -75,25 +75,26 @@ export function useSlide(getItems, getItemsWithCloned) {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
_context.next = 8;
|
|
78
|
-
return setTranslate(itemsWithCloned[
|
|
78
|
+
return setTranslate(itemsWithCloned[(itemsWithCloned.length - length) / 2 - 1], false);
|
|
79
79
|
|
|
80
80
|
case 8:
|
|
81
|
-
_context.next =
|
|
81
|
+
_context.next = 14;
|
|
82
82
|
break;
|
|
83
83
|
|
|
84
84
|
case 10:
|
|
85
85
|
if (!(oldIndex === 0 && newIndex === length - 1)) {
|
|
86
|
-
_context.next =
|
|
86
|
+
_context.next = 14;
|
|
87
87
|
break;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
lengthWithCloned = itemsWithCloned.length;
|
|
91
|
+
_context.next = 14;
|
|
92
|
+
return setTranslate(itemsWithCloned[lengthWithCloned - (lengthWithCloned - length) / 2], false);
|
|
92
93
|
|
|
93
|
-
case
|
|
94
|
+
case 14:
|
|
94
95
|
setTranslate(item, true);
|
|
95
96
|
|
|
96
|
-
case
|
|
97
|
+
case 15:
|
|
97
98
|
case "end":
|
|
98
99
|
return _context.stop();
|
|
99
100
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime-corejs3/helpers/objectWithoutPropertiesLoose";
|
|
3
3
|
var _excluded = ["className", "disabled", "falseValue", "children", "value", "trueValue", "style", "indeterminate", "title"];
|
|
4
|
-
import { createVNode as _$cv, className as _$cn, createElementVNode as _$ce } from 'intact-react';
|
|
4
|
+
import { createVNode as _$cv, className as _$cn, createUnknownComponentVNode as _$cc, createElementVNode as _$ce } from 'intact-react';
|
|
5
5
|
import { getRestProps } from '../utils';
|
|
6
6
|
import makeStyles from './styles';
|
|
7
|
+
import { Wave } from '../wave';
|
|
7
8
|
export default function ($props, $blocks, $__proto__) {
|
|
8
9
|
var _classNameObj;
|
|
9
10
|
|
|
@@ -51,15 +52,19 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
51
52
|
'title': title,
|
|
52
53
|
'ev-click': this.onClick,
|
|
53
54
|
'ev-keypress': this.onKeypress
|
|
54
|
-
}, events), [_$
|
|
55
|
-
'type': 'checkbox',
|
|
56
|
-
'checked': isChecked,
|
|
57
|
-
'value': trueValue,
|
|
58
|
-
'trueValue': trueValue,
|
|
59
|
-
'falseValue': falseValue,
|
|
55
|
+
}, events), [_$cc(Wave, {
|
|
60
56
|
'disabled': disabled,
|
|
61
|
-
'
|
|
62
|
-
'
|
|
63
|
-
|
|
57
|
+
'inset': '-2px',
|
|
58
|
+
'children': _$ce(2, 'span', _$cv('input', _extends({
|
|
59
|
+
'type': 'checkbox',
|
|
60
|
+
'checked': isChecked,
|
|
61
|
+
'value': trueValue,
|
|
62
|
+
'trueValue': trueValue,
|
|
63
|
+
'falseValue': falseValue,
|
|
64
|
+
'disabled': disabled,
|
|
65
|
+
'tabindex': '-1',
|
|
66
|
+
'ref': this.inputRef
|
|
67
|
+
}, getRestProps(this, rest))), 2, 'k-checkbox-wrapper')
|
|
68
|
+
}), children ? _$ce(2, 'span', children, 0, 'k-checkbox-text') : undefined]);
|
|
64
69
|
}
|
|
65
70
|
;
|
|
@@ -14,7 +14,7 @@ var defaults = {
|
|
|
14
14
|
},
|
|
15
15
|
|
|
16
16
|
get transition() {
|
|
17
|
-
return theme.transition;
|
|
17
|
+
return theme.transition.small;
|
|
18
18
|
},
|
|
19
19
|
|
|
20
20
|
bgColor: '#fff',
|
|
@@ -71,5 +71,5 @@ setDefault(function () {
|
|
|
71
71
|
}).checkbox;
|
|
72
72
|
});
|
|
73
73
|
export default function makeStyles() {
|
|
74
|
-
return /*#__PURE__*/css("display:inline-flex;align-items:center;cursor:pointer;vertical-align:middle;.k-checkbox-wrapper{
|
|
74
|
+
return /*#__PURE__*/css("display:inline-flex;align-items:center;cursor:pointer;vertical-align:middle;.k-checkbox-wrapper{width:", checkbox.width, ";height:", checkbox.width, ";border:1px solid ", checkbox.borderColor, ";border-radius:", checkbox.borderRadius, ";position:relative;transition:all ", checkbox.transition, ";background:", checkbox.bgColor, ";flex:0 0 auto;&:before{content:\"\";display:block;position:absolute;width:", checkbox.inner.width, ";height:", checkbox.inner.height, ";top:", checkbox.inner.top, ";left:", checkbox.inner.left, ";border:", checkbox.inner.border, ";border-top:0;border-left:0;transform:rotate(45deg) scale(0);transition:all ", checkbox.transition, ";}}input{width:100%;height:100%;opacity:0;cursor:pointer;position:absolute;left:0;top:0;margin:0;}.k-checkbox-text{margin-left:", checkbox.text.gap, ";flex:0 1 auto;}&.k-checked,&.k-indeterminate{.k-checkbox-wrapper{border-color:", checkbox.checked.borderColor, ";background:", checkbox.checked.bgColor, ";}}&.k-indeterminate{.k-checkbox-wrapper{&:before{transform:rotate(90deg) scale(1);border-bottom:0;left:", checkbox.indeterminate.innerLeft, ";}}}&.k-checked{.k-checkbox-wrapper{&:before{transform:rotate(45deg) scale(1);}}}&:focus{outline:none;.k-checkbox-wrapper{border-color:", checkbox.checked.borderColor, ";}}&.k-disabled{color:", checkbox.disabled.color, ";cursor:not-allowed;.k-checkbox-wrapper{border-color:", checkbox.disabled.borderColor, ";background:", checkbox.disabled.bgColor, ";&:before{border-color:", checkbox.disabled.innerColor, ";}}input{cursor:not-allowed;}}");
|
|
75
75
|
}
|
|
@@ -39,7 +39,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
39
39
|
|
|
40
40
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
41
41
|
}, __$blocks['title'](_$no)), _$cc(Icon, {
|
|
42
|
-
'className': _$cn((_$cn2 = {}, _$cn2[kls('arrow')] = true, _$cn2['ion-ios-arrow-right'] = true, _$cn2))
|
|
42
|
+
'className': _$cn((_$cn2 = {}, _$cn2[kls('arrow')] = true, _$cn2['ion-ios-arrow-right'] = true, _$cn2)),
|
|
43
|
+
'hoverable': !disabled
|
|
43
44
|
})], 0, _$cn(kls('title')), {
|
|
44
45
|
'ev-click': this.toggle
|
|
45
46
|
}), _$cc(Transition, _extends({
|
|
@@ -6,6 +6,10 @@ export var kls = function kls(className) {
|
|
|
6
6
|
return "k-collapse-" + className;
|
|
7
7
|
};
|
|
8
8
|
var defaults = {
|
|
9
|
+
get transition() {
|
|
10
|
+
return theme.transition.large;
|
|
11
|
+
},
|
|
12
|
+
|
|
9
13
|
fontSize: '12px',
|
|
10
14
|
titleMarginRight: '8px',
|
|
11
15
|
borderPadding: '0 24px',
|
|
@@ -27,5 +31,5 @@ export function makeStyles() {
|
|
|
27
31
|
}
|
|
28
32
|
export function makeItemStyles() {
|
|
29
33
|
var collapseItem = collapse.item;
|
|
30
|
-
return /*#__PURE__*/css("border-bottom:", collapseItem.borderBottom, ";&:last-of-type{border-bottom-color:transparent;}.", kls('title'), "{cursor:pointer;font-weight:bold;height:", collapseItem.titleHeight, ";line-height:", collapseItem.titleHeight, ";transition:color ",
|
|
34
|
+
return /*#__PURE__*/css("border-bottom:", collapseItem.borderBottom, ";&:last-of-type{border-bottom-color:transparent;}.", kls('title'), "{cursor:pointer;font-weight:bold;height:", collapseItem.titleHeight, ";line-height:", collapseItem.titleHeight, ";transition:color ", collapse.transition, ";}.", kls('arrow'), "{float:right;transition:transform ", collapse.transition, ";line-height:", collapseItem.titleHeight, ";height:", collapseItem.titleHeight, ";transform-origin:left center 0;}&:not(.k-disabled){.", kls('title'), "{&:hover{color:", theme.color.primary, ";}}}.", kls('content'), "{overflow:hidden;.", kls('wrapper'), "{overflow:hidden;padding:", collapseItem.contentPadding, ";}}&.k-active{.", kls('arrow'), "{transform:rotate(90deg);}}&.k-disabled{color:", theme.color.disabledBorder, ";.", kls('title'), "{cursor:not-allowed;}}");
|
|
31
35
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Component, TypeDefs } from 'intact-react';
|
|
2
2
|
import { Sizes } from '../../styles/utils';
|
|
3
|
+
import { Container } from '../portal';
|
|
3
4
|
export interface ColorpickerProps {
|
|
4
5
|
value: string;
|
|
5
6
|
presets?: string[];
|
|
6
7
|
size?: Sizes;
|
|
7
8
|
disabled?: boolean;
|
|
9
|
+
container?: Container;
|
|
8
10
|
}
|
|
9
11
|
export interface ColorpickerEvents {
|
|
10
12
|
}
|
|
@@ -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-react';
|
|
|
2
2
|
export interface ProviderProps<T> {
|
|
3
3
|
value?: T;
|
|
4
4
|
}
|
|
5
|
+
export interface ConsumerProps<T> {
|
|
6
|
+
defaultValue?: T;
|
|
7
|
+
}
|
|
5
8
|
declare type ProviderConstructor<T> = ComponentConstructor<Component<ProviderProps<T>>>;
|
|
6
|
-
declare type ConsumerConstructor = ComponentConstructor<Component<
|
|
9
|
+
declare type ConsumerConstructor<T> = ComponentConstructor<Component<ConsumerProps<T>>>;
|
|
7
10
|
export declare function createContext<T = any>(defaultValue?: T): {
|
|
8
11
|
Provider: ProviderConstructor<T>;
|
|
9
|
-
Consumer: ConsumerConstructor
|
|
12
|
+
Consumer: ConsumerConstructor<T>;
|
|
10
13
|
};
|
|
11
14
|
export {};
|
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;
|