wini-web-components 2.3.1 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { CSSProperties } from 'react';
|
|
2
2
|
interface CheckboxProps {
|
|
3
3
|
id?: string;
|
|
4
|
-
onChange?: (value: boolean) => void;
|
|
4
|
+
onChange?: (value: boolean, target: HTMLInputElement) => void;
|
|
5
5
|
value?: boolean;
|
|
6
6
|
checkColor?: string;
|
|
7
7
|
disabled?: boolean;
|
|
@@ -15,8 +15,10 @@ interface CheckboxState {
|
|
|
15
15
|
value?: boolean;
|
|
16
16
|
}
|
|
17
17
|
export declare class Checkbox extends React.Component<CheckboxProps, CheckboxState> {
|
|
18
|
-
|
|
18
|
+
private ref;
|
|
19
|
+
constructor(props: CheckboxProps);
|
|
19
20
|
componentDidUpdate(prevProps: Readonly<CheckboxProps>): void;
|
|
21
|
+
onChange: () => void;
|
|
20
22
|
render(): React.JSX.Element;
|
|
21
23
|
}
|
|
22
24
|
export {};
|
|
@@ -25,18 +25,58 @@ var __assign = (this && this.__assign) || function () {
|
|
|
25
25
|
};
|
|
26
26
|
return __assign.apply(this, arguments);
|
|
27
27
|
};
|
|
28
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
29
|
+
if (k2 === undefined) k2 = k;
|
|
30
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
31
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
32
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
33
|
+
}
|
|
34
|
+
Object.defineProperty(o, k2, desc);
|
|
35
|
+
}) : (function(o, m, k, k2) {
|
|
36
|
+
if (k2 === undefined) k2 = k;
|
|
37
|
+
o[k2] = m[k];
|
|
38
|
+
}));
|
|
39
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
40
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
41
|
+
}) : function(o, v) {
|
|
42
|
+
o["default"] = v;
|
|
43
|
+
});
|
|
44
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
45
|
+
var ownKeys = function(o) {
|
|
46
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
47
|
+
var ar = [];
|
|
48
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
49
|
+
return ar;
|
|
50
|
+
};
|
|
51
|
+
return ownKeys(o);
|
|
52
|
+
};
|
|
53
|
+
return function (mod) {
|
|
54
|
+
if (mod && mod.__esModule) return mod;
|
|
55
|
+
var result = {};
|
|
56
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
57
|
+
__setModuleDefault(result, mod);
|
|
58
|
+
return result;
|
|
59
|
+
};
|
|
60
|
+
})();
|
|
28
61
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
62
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
63
|
};
|
|
31
64
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
65
|
exports.Checkbox = void 0;
|
|
33
|
-
var react_1 =
|
|
66
|
+
var react_1 = __importStar(require("react"));
|
|
34
67
|
var checkbox_module_css_1 = __importDefault(require("./checkbox.module.css"));
|
|
35
68
|
var Checkbox = /** @class */ (function (_super) {
|
|
36
69
|
__extends(Checkbox, _super);
|
|
37
|
-
function Checkbox() {
|
|
70
|
+
function Checkbox(props) {
|
|
38
71
|
var _a;
|
|
39
|
-
var _this = _super.
|
|
72
|
+
var _this = _super.call(this, props) || this;
|
|
73
|
+
_this.ref = (0, react_1.createRef)();
|
|
74
|
+
_this.onChange = function () {
|
|
75
|
+
var newValue = !_this.state.value;
|
|
76
|
+
_this.setState({ value: newValue });
|
|
77
|
+
if (_this.props.onChange && _this.ref.current)
|
|
78
|
+
_this.props.onChange(newValue, _this.ref.current.querySelector("input"));
|
|
79
|
+
};
|
|
40
80
|
_this.state = {
|
|
41
81
|
value: (_a = _this.props.value) !== null && _a !== void 0 ? _a : false
|
|
42
82
|
};
|
|
@@ -63,13 +103,13 @@ var Checkbox = /** @class */ (function (_super) {
|
|
|
63
103
|
delete this.props.style.maxHeight;
|
|
64
104
|
convertStyle = __assign(__assign({}, this.props.style), convertStyle);
|
|
65
105
|
}
|
|
66
|
-
return react_1.default.createElement("label", { id: this.props.id, className: "".concat(checkbox_module_css_1.default['checkbox-container'], " row ").concat((_c = this.props.className) !== null && _c !== void 0 ? _c : ''), style: convertStyle, "is-null-value": "".concat(this.state.value == undefined), onClick: this.props.onClick },
|
|
106
|
+
return react_1.default.createElement("label", { ref: this.ref, id: this.props.id, className: "".concat(checkbox_module_css_1.default['checkbox-container'], " row ").concat((_c = this.props.className) !== null && _c !== void 0 ? _c : ''), style: convertStyle, "is-null-value": "".concat(this.state.value == undefined), onClick: this.props.onClick },
|
|
67
107
|
react_1.default.createElement("input", { type: "checkbox", checked: this.state.value ? true : false, disabled: this.props.disabled, onChange: function (ev) {
|
|
68
108
|
ev.stopPropagation();
|
|
69
109
|
var newValue = !_this.state.value;
|
|
70
110
|
_this.setState({ value: newValue });
|
|
71
111
|
if (_this.props.onChange)
|
|
72
|
-
_this.props.onChange(newValue);
|
|
112
|
+
_this.props.onChange(newValue, ev.target);
|
|
73
113
|
} }),
|
|
74
114
|
react_1.default.createElement("svg", { width: "100%", height: "100%", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", style: { '--check-color': this.props.checkColor } }, this.state.value === undefined ?
|
|
75
115
|
react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M4.79199 9.95298C4.79199 9.69148 5.00398 9.47949 5.26548 9.47949H14.7352C14.9967 9.47949 15.2087 9.69148 15.2087 9.95298C15.2087 10.2145 14.9967 10.4265 14.7352 10.4265H5.26548C5.00398 10.4265 4.79199 10.2145 4.79199 9.95298Z" }) :
|
|
@@ -118,7 +118,7 @@ var InputOpt = /** @class */ (function (_super) {
|
|
|
118
118
|
}
|
|
119
119
|
continue;
|
|
120
120
|
}
|
|
121
|
-
} }, Array.from({ length: (_e = this.props.length) !== null && _e !== void 0 ? _e : 6 }).map(function (_, i) { return react_1.default.createElement("input", { key: "opt-" + i, disabled: _this.props.disabled, onKeyDown: function (ev) {
|
|
121
|
+
} }, Array.from({ length: (_e = this.props.length) !== null && _e !== void 0 ? _e : 6 }).map(function (_, i) { return react_1.default.createElement("input", { key: "opt-" + i, disabled: _this.props.disabled, style: _this.props.inputStyle, onKeyDown: function (ev) {
|
|
122
122
|
var _a, _b;
|
|
123
123
|
var key = ev.key.toLowerCase();
|
|
124
124
|
switch (key) {
|