dtable-ui-component 5.1.15 → 5.2.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.
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
.dtable-switch {
|
|
2
|
+
display: flex;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.dtable-switch.sm {
|
|
6
|
+
flex: 1;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.dtable-switch .custom-switch {
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.dtable-switch.disabled .custom-switch {
|
|
15
|
+
cursor: default;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.dtable-switch.sm .custom-switch {
|
|
19
|
+
width: 100%;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.dtable-switch.sm .custom-switch .custom-switch-description {
|
|
23
|
+
width: 192px;
|
|
24
|
+
margin: 0;
|
|
25
|
+
padding-right: 5px;
|
|
26
|
+
color: #212529;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.dtable-switch.sm .custom-switch .dtable-font {
|
|
30
|
+
-webkit-transform: scale(.8);
|
|
31
|
+
transform: scale(.8);
|
|
32
|
+
display: inline-block;
|
|
33
|
+
line-height: 24px;
|
|
34
|
+
margin-right: 8px;
|
|
35
|
+
color: #666;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.dtable-switch.sm .custom-switch .dtable-font.dtable-icon-use-help {
|
|
39
|
+
transform: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.dtable-switch.sm .custom-switch-indicator {
|
|
43
|
+
width: 22px;
|
|
44
|
+
height: 12px;
|
|
45
|
+
border-radius: 6px;
|
|
46
|
+
margin-right: 10px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.dtable-switch.sm .custom-switch-input:checked~.custom-switch-indicator:before {
|
|
50
|
+
left: 12px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.dtable-switch.sm .custom-switch-indicator:before {
|
|
54
|
+
height: 8px;
|
|
55
|
+
width: 8px;
|
|
56
|
+
}
|
|
@@ -6,16 +6,33 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _dtableUtils = require("dtable-utils");
|
|
11
|
+
require("./index.css");
|
|
12
|
+
function DTableSwitch(props) {
|
|
10
13
|
const {
|
|
11
14
|
onChange,
|
|
12
15
|
checked,
|
|
13
16
|
placeholder,
|
|
14
17
|
disabled,
|
|
18
|
+
size,
|
|
19
|
+
switchPosition,
|
|
15
20
|
switchClassName
|
|
16
21
|
} = props;
|
|
22
|
+
const switchNode = /*#__PURE__*/_react.default.createElement("span", {
|
|
23
|
+
className: "custom-switch-indicator"
|
|
24
|
+
});
|
|
25
|
+
const textNode = /*#__PURE__*/_react.default.createElement("span", {
|
|
26
|
+
className: "custom-switch-description text-truncate"
|
|
27
|
+
}, placeholder);
|
|
17
28
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
18
|
-
className:
|
|
29
|
+
className: (0, _classnames.default)('dtable-switch position-relative', {
|
|
30
|
+
'disabled': disabled
|
|
31
|
+
}, {
|
|
32
|
+
[size]: size
|
|
33
|
+
}, {
|
|
34
|
+
[switchClassName]: switchClassName
|
|
35
|
+
})
|
|
19
36
|
}, /*#__PURE__*/_react.default.createElement("label", {
|
|
20
37
|
className: "custom-switch"
|
|
21
38
|
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
@@ -24,11 +41,14 @@ function DtableSwitch(props) {
|
|
|
24
41
|
checked: checked,
|
|
25
42
|
onChange: onChange,
|
|
26
43
|
name: "custom-switch-checkbox",
|
|
27
|
-
disabled: disabled
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
className: "custom-switch-indicator"
|
|
32
|
-
})));
|
|
44
|
+
disabled: disabled,
|
|
45
|
+
"aria-label": placeholder,
|
|
46
|
+
id: 'dtable-switch-' + (0, _dtableUtils.generatorBase64Code)(12)
|
|
47
|
+
}), switchPosition === 'left' && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, switchNode, textNode), switchPosition === 'right' && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, textNode, switchNode)));
|
|
33
48
|
}
|
|
34
|
-
|
|
49
|
+
DTableSwitch.defaultProps = {
|
|
50
|
+
checked: false,
|
|
51
|
+
size: 'sm',
|
|
52
|
+
switchPosition: 'right'
|
|
53
|
+
};
|
|
54
|
+
var _default = exports.default = DTableSwitch;
|
|
@@ -38,37 +38,6 @@
|
|
|
38
38
|
cursor: grab;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
.field-item-container .dtable-switch .custom-switch {
|
|
42
|
-
|
|
43
|
-
justify-content: space-between;
|
|
41
|
+
.field-setting .field-item-container .dtable-switch .custom-switch .custom-switch-description {
|
|
42
|
+
white-space: nowrap;
|
|
44
43
|
}
|
|
45
|
-
|
|
46
|
-
.field-item-container .dtable-switch .custom-switch .dtable-font {
|
|
47
|
-
-webkit-transform: scale(.8);
|
|
48
|
-
transform: scale(.8);
|
|
49
|
-
display: inline-block;
|
|
50
|
-
line-height: 24px;
|
|
51
|
-
margin-right: 8px;
|
|
52
|
-
color: #666;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.field-item-container .dtable-switch .custom-switch .custom-switch-description {
|
|
56
|
-
width: 192px;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.field-item-container .dtable-switch .custom-switch .custom-switch-indicator {
|
|
60
|
-
width: 22px;
|
|
61
|
-
height: 12px;
|
|
62
|
-
border-radius: 6px;
|
|
63
|
-
margin-right: .25rem;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.field-item-container .dtable-switch .custom-switch .custom-switch-indicator::before {
|
|
67
|
-
height: 8px;
|
|
68
|
-
width: 8px;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.field-item-container .dtable-switch .custom-switch-input:checked~.custom-switch-indicator:before {
|
|
72
|
-
left: 12px;
|
|
73
|
-
}
|
|
74
|
-
|