@king-design/react 3.3.2 → 3.4.0-beta.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/components/button/group.d.ts +1 -0
- package/components/button/group.js +2 -1
- package/components/button/index.d.ts +1 -0
- package/components/button/index.js +1 -0
- package/components/button/index.vdt.js +13 -6
- package/components/button/styles.d.ts +1 -1
- package/components/button/styles.js +3 -3
- package/components/dialog/alert.vdt.js +2 -2
- package/components/switch/index.d.ts +3 -1
- package/components/switch/index.js +65 -13
- package/components/switch/index.spec.js +21 -0
- package/components/switch/index.vdt.js +14 -4
- package/components/switch/styles.js +12 -7
- package/components/table/cell.vdt.js +3 -1
- package/components/table/column.d.ts +1 -0
- package/components/table/column.js +1 -0
- package/components/table/column.vdt.js +3 -2
- package/components/table/index.spec.js +313 -221
- package/components/table/styles.js +1 -1
- package/components/table/table.vdt.js +1 -1
- package/components/table/useChecked.js +3 -1
- package/components/table/useColumns.js +1 -1
- package/components/table/useDisableRow.js +3 -1
- package/components/table/useMerge.js +6 -1
- package/components/utils.js +17 -0
- package/i18n/en-US.js +6 -2
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +2 -2
- package/yarn-error.log +528 -0
|
@@ -5,6 +5,7 @@ export interface ButtonGroupProps {
|
|
|
5
5
|
checkType?: 'none' | 'radio' | 'checkbox';
|
|
6
6
|
fluid?: boolean;
|
|
7
7
|
seperate?: boolean;
|
|
8
|
+
btnWidth?: number | string;
|
|
8
9
|
}
|
|
9
10
|
export declare class ButtonGroup extends Component<ButtonGroupProps> {
|
|
10
11
|
static template: string | import('intact-react').Template<any>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
2
|
import { createUnknownComponentVNode as _$cc, className as _$cn, createElementVNode as _$ce } from 'intact-react';
|
|
3
|
-
import { getRestProps } from '../utils';
|
|
3
|
+
import { addStyle, getRestProps } from '../utils';
|
|
4
4
|
import { Icon } from '../icon';
|
|
5
5
|
import { makeButtonStyles } from './styles';
|
|
6
6
|
import { DynamicButton } from './dynamicButton';
|
|
7
7
|
import { Wave } from '../wave';
|
|
8
8
|
import { button as theme } from './styles';
|
|
9
9
|
export default function ($props, $blocks, $__proto__) {
|
|
10
|
-
var _classNameObj;
|
|
10
|
+
var _classNameObj, _buttonGroup$get;
|
|
11
11
|
$blocks || ($blocks = {});
|
|
12
12
|
$props || ($props = {});
|
|
13
13
|
var $this = this;
|
|
@@ -27,7 +27,9 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
27
27
|
loading = _this$get.loading,
|
|
28
28
|
disabled = _this$get.disabled,
|
|
29
29
|
name = _this$get.name,
|
|
30
|
-
ghost = _this$get.ghost
|
|
30
|
+
ghost = _this$get.ghost,
|
|
31
|
+
color = _this$get.color,
|
|
32
|
+
style = _this$get.style;
|
|
31
33
|
var _this$config = this.config,
|
|
32
34
|
cls = _this$config.cls,
|
|
33
35
|
k = _this$config.k;
|
|
@@ -53,7 +55,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
53
55
|
}
|
|
54
56
|
});
|
|
55
57
|
}
|
|
56
|
-
var classNameObj = (_classNameObj = {}, _classNameObj[cls('btn')] = true, _classNameObj[cls(size)] = size !== 'default', _classNameObj[cls(type)] =
|
|
58
|
+
var classNameObj = (_classNameObj = {}, _classNameObj[cls('btn')] = true, _classNameObj[cls(size)] = size !== 'default', _classNameObj[cls(type)] = !color, _classNameObj[cls("btn-icon")] = icon, _classNameObj[className] = className, _classNameObj[cls('circle')] = circle, _classNameObj[cls('loading')] = loading, _classNameObj[cls('fluid')] = fluid, _classNameObj[cls('active')] = checked, _classNameObj[cls('disabled')] = disabled || loading, _classNameObj[cls('ghost')] = ghost, _classNameObj[cls('custom')] = color, _classNameObj[makeButtonStyles(k, iconSide, color)] = true, _classNameObj);
|
|
57
59
|
var loadingIcon = _$cc(Icon, {
|
|
58
60
|
'className': _$cn("ion-load-c " + k + "-icon-loading"),
|
|
59
61
|
'size': size /*loadingSizeMap[size]*/,
|
|
@@ -61,10 +63,14 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
61
63
|
'rotate': true
|
|
62
64
|
}, 'k-loading');
|
|
63
65
|
var buttonGroup = this.buttonGroup;
|
|
64
|
-
var checkType = buttonGroup ? buttonGroup.get('checkType') : 'none';
|
|
66
|
+
var checkType = (_buttonGroup$get = buttonGroup == null ? void 0 : buttonGroup.get('checkType')) != null ? _buttonGroup$get : 'none';
|
|
67
|
+
var btnWidth = buttonGroup == null ? void 0 : buttonGroup.get('btnWidth');
|
|
68
|
+
var _style = {
|
|
69
|
+
width: typeof btnWidth === 'number' ? btnWidth + "px" : btnWidth
|
|
70
|
+
};
|
|
65
71
|
var isCheckType = checkType !== 'none';
|
|
66
72
|
var typeStyles = theme[type];
|
|
67
|
-
var waveColor = typeStyles && typeStyles.borderColor || theme.primary.borderColor;
|
|
73
|
+
var waveColor = typeStyles && typeStyles.borderColor || color || theme.primary.borderColor;
|
|
68
74
|
return _$cc(Wave, {
|
|
69
75
|
'disabled': loading || disabled || type === 'none' || type === 'link',
|
|
70
76
|
'inset': type === 'flat' ? '-1px' : '-2px',
|
|
@@ -73,6 +79,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
73
79
|
'className': _$cn(classNameObj),
|
|
74
80
|
'tagName': tagName
|
|
75
81
|
}, getRestProps(this), {
|
|
82
|
+
'style': btnWidth ? addStyle(style, _style) : style,
|
|
76
83
|
'ref': this.elementRef,
|
|
77
84
|
'tabindex': disabled || loading ? '-1' : tabindex,
|
|
78
85
|
'ev-click': this.onClick,
|
|
@@ -84,7 +84,7 @@ declare const defaults: {
|
|
|
84
84
|
declare let button: typeof defaults;
|
|
85
85
|
export { button };
|
|
86
86
|
export declare const makeButtonStyles: {
|
|
87
|
-
(k: string, iconSide?: string | undefined): string;
|
|
87
|
+
(k: string, iconSide?: string | undefined, color?: string | undefined): string;
|
|
88
88
|
clearCache(): {};
|
|
89
89
|
};
|
|
90
90
|
export declare const makeButtonGroupStyles: {
|
|
@@ -190,7 +190,7 @@ setDefault(function () {
|
|
|
190
190
|
makeButtonGroupStyles == null || makeButtonGroupStyles.clearCache();
|
|
191
191
|
});
|
|
192
192
|
export { button };
|
|
193
|
-
export var makeButtonStyles = cache(function makeButtonStyles(k, iconSide) {
|
|
193
|
+
export var makeButtonStyles = cache(function makeButtonStyles(k, iconSide, color) {
|
|
194
194
|
var _button = button,
|
|
195
195
|
secondary = _button.secondary,
|
|
196
196
|
link = _button.link;
|
|
@@ -200,7 +200,7 @@ export var makeButtonStyles = cache(function makeButtonStyles(k, iconSide) {
|
|
|
200
200
|
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, ";.", k, "-icon{color:inherit;}&.", k, "-default,&.", k, "-none,&.", k, "-flat{.", k, "-icon{color:", theme.color.lightBlack, ";}&:hover{.", k, "-icon{color:inherit;}}}&: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) {
|
|
201
201
|
var typeStyles = button[type];
|
|
202
202
|
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), ";}}");
|
|
203
|
-
}), "&.", 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, "-none,&.", k, "-link,&.", k, "-flat{background:transparent;&,&:hover{border:none;}&.", k, "-active{color:", theme.color.primary, ";}}&.", k, "-none:hover{background:", button.none.hoverBgColor, ";}&.", k, "-flat{background:", button.none.hoverBgColor, ";}&.", k, "-disabled{.", k, "-icon{color:inherit;}&,&:hover{color:", button.disabled.color, ";background:", button.disabled.bgColor, ";border-color:", button.disabled.borderColor, ";cursor:not-allowed;}}&.", k, "-none.", k, "-disabled,&.", k, "-link.", k, "-disabled{&,&:hover{background:transparent;}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
203
|
+
}), "&.", k, "-secondary{color:", secondary.color, ";border-color:", secondary.borderColor, ";&:hover,&:focus{background:", secondary.hoverBgColor, ";}&:active{background:", secondary.activeBgColor, ";}}", color && /*#__PURE__*/css("&.", k, "-custom{color:", color, ";border-color:", color, ";&:hover,&:focus{background:", palette(color, -4), ";}&:active{background:", palette(color, -3), ";}}"), " &.", k, "-link{color:", link.color, ";&:hover{color:", link.hoverColor, ";background:", link.hoverBgColor, ";}}&.", k, "-none,&.", k, "-link,&.", k, "-flat{background:transparent;&,&:hover{border:none;}&.", k, "-active{color:", theme.color.primary, ";}}&.", k, "-none:hover{background:", button.none.hoverBgColor, ";}&.", k, "-flat{background:", button.none.hoverBgColor, ";}&.", k, "-disabled{.", k, "-icon{color:inherit;}&,&:hover{color:", button.disabled.color, ";background:", button.disabled.bgColor, ";border-color:", button.disabled.borderColor, ";cursor:not-allowed;}}&.", k, "-none.", k, "-disabled,&.", k, "-link.", k, "-disabled{&,&:hover{background:transparent;}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
204
204
|
var styles = button[size];
|
|
205
205
|
return /*#__PURE__*/css("&.", k, "-", size, "{font-size:", styles.fontSize, ";height:", styles.height, ";padding:", styles.padding, ";&.", k, "-btn-icon{width:", styles.height, ";}}");
|
|
206
206
|
}), "&.", 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) {
|
|
@@ -211,7 +211,7 @@ export var makeButtonStyles = cache(function makeButtonStyles(k, iconSide) {
|
|
|
211
211
|
ghostColor = _button$type.ghostColor,
|
|
212
212
|
borderColor = _button$type.borderColor;
|
|
213
213
|
return /*#__PURE__*/css("&.", k, "-", type, "{color:", ghostColor, ";border-color:", borderColor, ";&:hover{color:", palette(ghostColor, -1), ";border-color:", palette(ghostColor, -1), ";}&:active{color:", palette(ghostColor, 1), ";border-color:", palette(ghostColor, 1), ";}}");
|
|
214
|
-
}), "&.", k, "-disabled{&,&:hover{color:", button.disabled.color, ";border-color:", button.disabled.ghostBorderColor, ";background:transparent;}}}"),
|
|
214
|
+
}), " ", color && /*#__PURE__*/css("&.", k, "-custom{color:", color, ";border-color:", color, ";&:hover{color:", palette(color, -1), ";border-color:", palette(color, -1), ";}&:active{color:", palette(color, 1), ";border-color:", palette(color, 1), ";}}"), "&.", k, "-disabled{&,&:hover{color:", button.disabled.color, ";border-color:", button.disabled.ghostBorderColor, ";background:transparent;}}}"),
|
|
215
215
|
/*#__PURE__*/
|
|
216
216
|
// dynamic styles
|
|
217
217
|
css(".", k, "-icon{", iconSide === 'right' ? "margin-left: " + button.icon.gap + ";" : "margin-right: " + button.icon.gap + ";", ";}", !iconSide && /*#__PURE__*/css("&.", k, "-loading{&:not(.", k, "-btn-icon){padding-left:calc(", getLeft(button.padding), " + 1em);", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
@@ -34,8 +34,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
34
34
|
}), (_$blocks['body'] = function ($super) {
|
|
35
35
|
var _ref;
|
|
36
36
|
return [_$ce(2, 'div', [!hideIcon && !icon ? _$cc(Icon, {
|
|
37
|
-
'className': _$cn(iconClassName || (_ref = {}, _ref[k + "-icon-success-fill"] = type === 'success', _ref[k + "-icon-warning-fill"] = type === 'warning'
|
|
38
|
-
'color': type === 'error' ? 'danger' : type === 'confirm' ? '
|
|
37
|
+
'className': _$cn(iconClassName || (_ref = {}, _ref[k + "-icon-success-fill"] = type === 'success', _ref[k + "-icon-warning-fill"] = type === 'warning' || type === 'confirm', _ref[k + "-icon-error-fill"] = type === 'error', _ref)),
|
|
38
|
+
'color': type === 'error' ? 'danger' : type === 'confirm' ? 'warning' : type
|
|
39
39
|
}) : undefined, icon], 0, _$cn(k + "-dialog-tip-icon")), _$ce(2, 'div', [title ? _$ce(2, 'div', title, 0, _$cn(k + "-alert-dialog-title")) : undefined, content], 0, _$cn(k + "-alert-dialog-wrapper"))];
|
|
40
40
|
}, __$blocks['body'] = function ($super, data) {
|
|
41
41
|
var block = $blocks['body'];
|
|
@@ -12,6 +12,8 @@ export interface SwitchProps<True = any, False = any> {
|
|
|
12
12
|
height?: number | string;
|
|
13
13
|
size?: Sizes;
|
|
14
14
|
disabled?: boolean;
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
beforeChange?: (value: True | False | undefined) => boolean | Promise<boolean>;
|
|
15
17
|
}
|
|
16
18
|
export interface SwitchEvents {
|
|
17
19
|
click: [MouseEvent];
|
|
@@ -32,7 +34,7 @@ export declare class Switch<True = true, False = false> extends Component<Switch
|
|
|
32
34
|
private onClick;
|
|
33
35
|
private onClickOnHandle;
|
|
34
36
|
private onKeypress;
|
|
35
|
-
toggle(isKeypress: boolean): void
|
|
37
|
+
toggle(isKeypress: boolean): Promise<void>;
|
|
36
38
|
isChecked(): boolean;
|
|
37
39
|
check(): void;
|
|
38
40
|
uncheck(): void;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
1
2
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
2
4
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
5
|
import { __decorate } from "tslib";
|
|
4
6
|
import { Component, createRef } from 'intact-react';
|
|
@@ -17,14 +19,17 @@ var typeDefs = {
|
|
|
17
19
|
width: [Number, String],
|
|
18
20
|
height: [Number, String],
|
|
19
21
|
size: sizes,
|
|
20
|
-
disabled: Boolean
|
|
22
|
+
disabled: Boolean,
|
|
23
|
+
loading: Boolean,
|
|
24
|
+
beforeChange: Function
|
|
21
25
|
};
|
|
22
26
|
var defaults = function defaults() {
|
|
23
27
|
return {
|
|
24
28
|
value: false,
|
|
25
29
|
trueValue: true,
|
|
26
30
|
falseValue: false,
|
|
27
|
-
size: 'default'
|
|
31
|
+
size: 'default',
|
|
32
|
+
loading: false
|
|
28
33
|
};
|
|
29
34
|
};
|
|
30
35
|
var events = {
|
|
@@ -62,18 +67,65 @@ export var Switch = /*#__PURE__*/function (_Component) {
|
|
|
62
67
|
this.toggle(true);
|
|
63
68
|
}
|
|
64
69
|
};
|
|
65
|
-
_proto.toggle = function
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
_proto.toggle = /*#__PURE__*/function () {
|
|
71
|
+
var _toggle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(isKeypress) {
|
|
72
|
+
var _this$get, disabled, beforeChange, value, ret;
|
|
73
|
+
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
|
74
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
75
|
+
case 0:
|
|
76
|
+
_this$get = this.get(), disabled = _this$get.disabled, beforeChange = _this$get.beforeChange, value = _this$get.value;
|
|
77
|
+
if (!disabled) {
|
|
78
|
+
_context2.next = 3;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
return _context2.abrupt("return");
|
|
82
|
+
case 3:
|
|
83
|
+
// if is not keypress, we blur it to remove focus style
|
|
84
|
+
if (!isKeypress) {
|
|
85
|
+
this.elementRef.value.blur();
|
|
86
|
+
}
|
|
87
|
+
if (!beforeChange) {
|
|
88
|
+
_context2.next = 15;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
this.set({
|
|
92
|
+
disabled: true,
|
|
93
|
+
loading: true
|
|
94
|
+
});
|
|
95
|
+
_context2.prev = 6;
|
|
96
|
+
_context2.next = 9;
|
|
97
|
+
return beforeChange(value);
|
|
98
|
+
case 9:
|
|
99
|
+
ret = _context2.sent;
|
|
100
|
+
if (ret) {
|
|
101
|
+
_context2.next = 12;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
return _context2.abrupt("return");
|
|
105
|
+
case 12:
|
|
106
|
+
_context2.prev = 12;
|
|
107
|
+
this.set({
|
|
108
|
+
disabled: false,
|
|
109
|
+
loading: false
|
|
110
|
+
});
|
|
111
|
+
return _context2.finish(12);
|
|
112
|
+
case 15:
|
|
113
|
+
if (this.isChecked()) {
|
|
114
|
+
this.uncheck();
|
|
115
|
+
} else {
|
|
116
|
+
this.check();
|
|
117
|
+
}
|
|
118
|
+
case 16:
|
|
119
|
+
case "end":
|
|
120
|
+
return _context2.stop();
|
|
121
|
+
}
|
|
122
|
+
}, _callee, this, [[6,, 12, 15]]);
|
|
123
|
+
}));
|
|
124
|
+
function toggle(_x) {
|
|
125
|
+
return _toggle.apply(this, arguments);
|
|
70
126
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
} else {
|
|
74
|
-
this.check();
|
|
75
|
-
}
|
|
76
|
-
};
|
|
127
|
+
return toggle;
|
|
128
|
+
}();
|
|
77
129
|
_proto.isChecked = function isChecked() {
|
|
78
130
|
return this.get('value') === this.get('trueValue');
|
|
79
131
|
};
|
|
@@ -4,6 +4,7 @@ import BasicDemo from '~/components/switch/demos/basic';
|
|
|
4
4
|
import DisabledDemo from '~/components/switch/demos/disabled';
|
|
5
5
|
import ValueDemo from '~/components/switch/demos/value';
|
|
6
6
|
import WidthHeightDemo from '~/components/switch/demos/widthHeight';
|
|
7
|
+
import BeforeChangeDemo from '~/components/switch/demos/beforeChange';
|
|
7
8
|
import { mount, unmount, dispatchEvent, wait } from '../../test/utils';
|
|
8
9
|
describe('Switch', function () {
|
|
9
10
|
afterEach(function () {
|
|
@@ -239,4 +240,24 @@ describe('Switch', function () {
|
|
|
239
240
|
}
|
|
240
241
|
}, _callee6);
|
|
241
242
|
})));
|
|
243
|
+
it('beforeChange', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
244
|
+
var _mount7, instance, element, _element$querySelecto5, el1, el2;
|
|
245
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
246
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
247
|
+
case 0:
|
|
248
|
+
_mount7 = mount(BeforeChangeDemo), instance = _mount7[0], element = _mount7[1];
|
|
249
|
+
_element$querySelecto5 = element.querySelectorAll('.k-switch'), el1 = _element$querySelecto5[0], el2 = _element$querySelecto5[1];
|
|
250
|
+
el1.click();
|
|
251
|
+
el2.click();
|
|
252
|
+
_context7.next = 6;
|
|
253
|
+
return wait(1000);
|
|
254
|
+
case 6:
|
|
255
|
+
expect(instance.get('value1')).to.be.true;
|
|
256
|
+
expect(instance.get('value2')).to.be.false;
|
|
257
|
+
case 8:
|
|
258
|
+
case "end":
|
|
259
|
+
return _context7.stop();
|
|
260
|
+
}
|
|
261
|
+
}, _callee7);
|
|
262
|
+
})));
|
|
242
263
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
2
|
import _Object$assign from "@babel/runtime-corejs3/core-js/object/assign";
|
|
3
|
-
import { createVNode as _$cv, className as _$cn, createElementVNode as _$ce, isChecked as _$isc, linkEvent as _$le, setCheckboxModel as _$scm, noop as _$no } from 'intact-react';
|
|
3
|
+
import { createVNode as _$cv, className as _$cn, createElementVNode as _$ce, isChecked as _$isc, linkEvent as _$le, setCheckboxModel as _$scm, noop as _$no, createUnknownComponentVNode as _$cc } from 'intact-react';
|
|
4
4
|
import { makeStyles } from './styles';
|
|
5
5
|
import { addStyle, getRestProps } from '../utils';
|
|
6
|
+
import { Icon } from '../icon';
|
|
6
7
|
var _$tmp0 = {
|
|
7
8
|
'src': 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
|
|
8
9
|
};
|
|
@@ -25,7 +26,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
25
26
|
width = _this$get.width,
|
|
26
27
|
height = _this$get.height,
|
|
27
28
|
size = _this$get.size,
|
|
28
|
-
disabled = _this$get.disabled
|
|
29
|
+
disabled = _this$get.disabled,
|
|
30
|
+
loading = _this$get.loading;
|
|
29
31
|
var _this$draggable = this.draggable,
|
|
30
32
|
start = _this$draggable.start,
|
|
31
33
|
dragging = _this$draggable.dragging,
|
|
@@ -36,6 +38,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
36
38
|
var onStyle;
|
|
37
39
|
var offStyle;
|
|
38
40
|
var barStyle;
|
|
41
|
+
var iconStyle;
|
|
39
42
|
if (width || height) {
|
|
40
43
|
var _style = {};
|
|
41
44
|
onStyle = {};
|
|
@@ -60,6 +63,9 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
60
63
|
barStyle = {
|
|
61
64
|
width: value === trueValue ? '100%' : height + "px"
|
|
62
65
|
};
|
|
66
|
+
iconStyle = {
|
|
67
|
+
fontSize: height * 0.7 + "px"
|
|
68
|
+
};
|
|
63
69
|
}
|
|
64
70
|
style = addStyle(style, _style);
|
|
65
71
|
}
|
|
@@ -106,10 +112,14 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
106
112
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
107
113
|
}, __$blocks['on'](_$no)), 0, _$cn(k + "-switch-on"), {
|
|
108
114
|
'style': onStyle
|
|
109
|
-
}) : undefined, _$ce(2, 'div',
|
|
115
|
+
}) : undefined, _$ce(2, 'div', [loading ? _$cc(Icon, {
|
|
116
|
+
'className': _$cn(k + "-switch-icon ion-load-c"),
|
|
117
|
+
'rotate': true,
|
|
118
|
+
'style': iconStyle
|
|
119
|
+
}) : undefined, _$ce(2, 'div', _$ce(2, 'img', null, 1, null, _$tmp0), 2, _$cn(k + "-switch-handle"), {
|
|
110
120
|
'ev-click': this.onClickOnHandle,
|
|
111
121
|
'ev-mousedown': start
|
|
112
|
-
}),
|
|
122
|
+
})], 0, _$cn(k + "-switch-wrapper"))], 0, _$cn(k + "-switch-bar"), {
|
|
113
123
|
'style': barStyle
|
|
114
124
|
}, null, barRef)]);
|
|
115
125
|
}
|
|
@@ -34,25 +34,29 @@ var defaults = {
|
|
|
34
34
|
default: {
|
|
35
35
|
width: "45px",
|
|
36
36
|
height: "24px",
|
|
37
|
-
padding: "3px"
|
|
37
|
+
padding: "3px",
|
|
38
|
+
iconSize: "16px"
|
|
38
39
|
},
|
|
39
40
|
// large
|
|
40
41
|
large: {
|
|
41
42
|
width: "58px",
|
|
42
43
|
height: "30px",
|
|
43
|
-
padding: "3px"
|
|
44
|
+
padding: "3px",
|
|
45
|
+
iconSize: "20px"
|
|
44
46
|
},
|
|
45
47
|
// small
|
|
46
48
|
small: {
|
|
47
49
|
width: "30px",
|
|
48
50
|
height: "16px",
|
|
49
|
-
padding: "2px"
|
|
51
|
+
padding: "2px",
|
|
52
|
+
iconSize: "10px"
|
|
50
53
|
},
|
|
51
54
|
// mini
|
|
52
55
|
mini: {
|
|
53
56
|
width: "18px",
|
|
54
57
|
height: "10px",
|
|
55
|
-
padding: "1px"
|
|
58
|
+
padding: "1px",
|
|
59
|
+
iconSize: "6px"
|
|
56
60
|
},
|
|
57
61
|
// disabled
|
|
58
62
|
get disabledBgColor() {
|
|
@@ -67,11 +71,12 @@ setDefault(function () {
|
|
|
67
71
|
makeStyles == null || makeStyles.clearCache();
|
|
68
72
|
});
|
|
69
73
|
export var makeStyles = cache(function makeStyles(k) {
|
|
70
|
-
return /*#__PURE__*/css("display:inline-block;vertical-align:middle;background:", kswitch.bgColor, ";position:relative;cursor:pointer;user-select:none;overflow:hidden;box-sizing:content-box;transition:background ", kswitch.transition, ";input{opacity:0;position:absolute;}.", k, "-switch-bar,.", k, "-switch-off{box-sizing:border-box;}.", k, "-switch-bar{position:absolute;text-align:right;overflow:hidden;}.", k, "-switch-wrapper{display:inline-block;position:relative;z-index:1;border-radius:", kswitch.handleBorderRadius, ";}.", k, "-switch-bar,.", k, "-switch-wrapper{height:100%;background:", kswitch.bgColor, ";transition:all ", kswitch.transition, ";}&:hover{&,.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.hoverBgColor, ";}}.", k, "-switch-handle{border-radius:", kswitch.handleBorderRadius, ";background:", kswitch.handleBgColor, ";height:100%;cursor:pointer;transition:left ", kswitch.transition, ";display:inline-block;img{height:100%;visibility:hidden;}}.", k, "-switch-on,.", k, "-switch-off{position:absolute;font-size:", kswitch.fontSize, ";color:", kswitch.color, ";text-align:center;}&.", k, "-dragging{.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.bgColor, ";transition:background ", kswitch.transition, ";}}&:focus{outline:none;}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
74
|
+
return /*#__PURE__*/css("display:inline-block;vertical-align:middle;background:", kswitch.bgColor, ";position:relative;cursor:pointer;user-select:none;overflow:hidden;box-sizing:content-box;transition:background ", kswitch.transition, ";input{opacity:0;position:absolute;}.", k, "-switch-bar,.", k, "-switch-off{box-sizing:border-box;}.", k, "-switch-bar{position:absolute;text-align:right;overflow:hidden;}.", k, "-switch-wrapper{display:inline-block;position:relative;z-index:1;border-radius:", kswitch.handleBorderRadius, ";}.", k, "-switch-bar,.", k, "-switch-wrapper{height:100%;background:", kswitch.bgColor, ";transition:all ", kswitch.transition, ";}&:hover{&,.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.hoverBgColor, ";}}.", k, "-switch-handle{border-radius:", kswitch.handleBorderRadius, ";background:", kswitch.handleBgColor, ";height:100%;cursor:pointer;transition:left ", kswitch.transition, ";display:inline-block;img{height:100%;visibility:hidden;}}.", k, "-switch-icon{position:absolute;left:50%;top:50%;transform:translate(-50%, -50%);}.", k, "-switch-on,.", k, "-switch-off{position:absolute;font-size:", kswitch.fontSize, ";color:", kswitch.color, ";text-align:center;}&.", k, "-dragging{.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.bgColor, ";transition:background ", kswitch.transition, ";}}&:focus{outline:none;}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
71
75
|
var _kswitch$size = kswitch[size],
|
|
72
76
|
width = _kswitch$size.width,
|
|
73
77
|
height = _kswitch$size.height,
|
|
74
|
-
padding = _kswitch$size.padding
|
|
75
|
-
|
|
78
|
+
padding = _kswitch$size.padding,
|
|
79
|
+
iconSize = _kswitch$size.iconSize;
|
|
80
|
+
return /*#__PURE__*/css("&.", k, "-", size, ",&.", k, "-", size, " .", k, "-switch-on,&.", k, "-", size, " .", k, "-switch-off{width:", width, ";height:", height, ";}&.", k, "-", size, "{border-radius:", height, ";.", k, "-switch-bar{width:", height, ";border-radius:", height, ";}.", k, "-switch-wrapper{padding:", padding, ";}.", k, "-switch-on,.", k, "-switch-off{line-height:", height, ";left:0;}.", k, "-switch-on{padding:0 ", height, " 0 calc(", height, " / 3);}.", k, "-switch-off{padding:0 calc(", height, " / 3) 0 ", height, ";}.", k, "-switch-icon{font-size:", iconSize, ";}}");
|
|
76
81
|
}), "&.", k, "-checked{.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.bgColor, ";}.", k, "-switch-bar{width:100%;}&:hover{.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.hoverBgColor, ";}}}&.", k, "-disabled{&,.", k, "-switch-handle{cursor:not-allowed;}&,.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.disabledBgColor, ";}&.", k, "-checked{&,.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.disabledBgColor, ";}}}");
|
|
77
82
|
});
|
|
@@ -5,6 +5,7 @@ import { Button } from '../button';
|
|
|
5
5
|
import { Icon } from '../icon';
|
|
6
6
|
import { getTextByChildren } from '../utils';
|
|
7
7
|
export default function ($props, $blocks, $__proto__) {
|
|
8
|
+
var _classNameObj;
|
|
8
9
|
$blocks || ($blocks = {});
|
|
9
10
|
$props || ($props = {});
|
|
10
11
|
var $this = this;
|
|
@@ -37,6 +38,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
37
38
|
style || (style = {});
|
|
38
39
|
style.paddingLeft = indent + "px";
|
|
39
40
|
}
|
|
41
|
+
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-hidden"] = props.hidden, _classNameObj[className] = className, _classNameObj);
|
|
40
42
|
return _$ce(2, 'td', [columnIndex === 0 && hasChildren ? _$cc(Button, {
|
|
41
43
|
'type': 'none',
|
|
42
44
|
'icon': true,
|
|
@@ -48,7 +50,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
48
50
|
'className': _$cn(k + "-icon-right"),
|
|
49
51
|
'size': 'small'
|
|
50
52
|
})
|
|
51
|
-
}) : undefined, children], 0, _$cn(
|
|
53
|
+
}) : undefined, children], 0, _$cn(classNameObj), {
|
|
52
54
|
'style': style,
|
|
53
55
|
'title': getTextByChildren(children),
|
|
54
56
|
'rowspan': rowspan,
|
|
@@ -32,7 +32,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
32
32
|
key = _this$get.key,
|
|
33
33
|
sortable = _this$get.sortable,
|
|
34
34
|
cols = _this$get.cols,
|
|
35
|
-
rows = _this$get.rows
|
|
35
|
+
rows = _this$get.rows,
|
|
36
|
+
hidden = _this$get.hidden;
|
|
36
37
|
var _this$group = this.group,
|
|
37
38
|
onSelect = _this$group.onSelect,
|
|
38
39
|
isChecked = _this$group.isChecked,
|
|
@@ -66,7 +67,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
66
67
|
var _getClassAndStyleForF = getClassAndStyleForFixed(_this.get(), offsetMap[key], k, checkType),
|
|
67
68
|
className = _getClassAndStyleForF.className,
|
|
68
69
|
style = _getClassAndStyleForF.style;
|
|
69
|
-
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-column-sortable"] = sortable, _classNameObj[className] = className, _classNameObj);
|
|
70
|
+
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-column-sortable"] = sortable, _classNameObj[k + "-hidden"] = hidden, _classNameObj[className] = className, _classNameObj);
|
|
70
71
|
var groupValue = currentGroup && currentGroup[key];
|
|
71
72
|
var type = sort && sort.key === key && sort.type;
|
|
72
73
|
var checked;
|