wini-web-components 2.4.2 → 2.4.4
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/dist/component/button/button.d.ts +4 -0
- package/dist/component/calendar/calendar.d.ts +10 -4
- package/dist/component/calendar/calendar.js +181 -222
- package/dist/component/date-picker/date-picker.js +2 -2
- package/dist/component/dialog/dialog.d.ts +1 -0
- package/dist/component/dialog/dialog.js +6 -1
- package/dist/component/import-file/import-file.d.ts +1 -0
- package/dist/component/import-file/import-file.js +3 -3
- package/dist/component/input-otp/input-otp.d.ts +21 -0
- package/dist/component/input-otp/input-otp.js +157 -0
- package/dist/component/tag/tag.d.ts +4 -0
- package/dist/component/tag/tag.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -150,9 +150,9 @@ var TImportFile = /** @class */ (function (_super) {
|
|
|
150
150
|
this.props.buttonOnly
|
|
151
151
|
? null
|
|
152
152
|
: this.props.multiple && ((_g = this.state.preview) === null || _g === void 0 ? void 0 : _g.length) ? react_1.default.createElement("div", { className: 'row', style: { flex: 1, flexWrap: "wrap", gap: "0.8rem" } }, this.state.preview.map(function (f) {
|
|
153
|
-
var _a;
|
|
154
|
-
return react_1.default.createElement("div", { key: "".concat(f.name, "-").concat(f.size, "-").concat(f.lastModified), className: 'row
|
|
155
|
-
react_1.default.createElement(index_1.Winicon, { src: "outline/".concat(((
|
|
153
|
+
var _a, _b;
|
|
154
|
+
return react_1.default.createElement("div", { key: "".concat(f.name, "-").concat(f.size, "-").concat(f.lastModified), className: 'row', style: __assign({ gap: "0.8rem", padding: "0.6rem 0.8rem", borderRadius: "0.4rem", border: "var(--neutral-main-border)", flex: "0 calc((100% * 6 / 24) - 0.8rem * 3 / 4)", width: "auto", minWidth: "11.4rem" }, ((_a = _this.props.fileTagStyle) !== null && _a !== void 0 ? _a : {})) },
|
|
155
|
+
react_1.default.createElement(index_1.Winicon, { src: "outline/".concat(((_b = f.type) === null || _b === void 0 ? void 0 : _b.includes('image')) ? "multimedia/image" : "files/file-export"), size: "1.4rem" }),
|
|
156
156
|
react_1.default.createElement(index_1.Text, { className: 'subtitle-4', style: { flex: 1, width: "100%" }, maxLine: 1 }, f.name),
|
|
157
157
|
react_1.default.createElement(index_1.Winicon, { src: 'fill/user interface/e-remove', size: "1.4rem", onClick: function () {
|
|
158
158
|
var _a;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { CSSProperties, ReactNode } from "react";
|
|
2
|
+
interface Props {
|
|
3
|
+
id?: string;
|
|
4
|
+
onChange?: (value: string, target: HTMLDivElement) => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
value?: string;
|
|
7
|
+
length?: number;
|
|
8
|
+
inputStyle?: CSSProperties;
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
className?: string;
|
|
11
|
+
helperText?: string;
|
|
12
|
+
helperTextColor?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class InputOtp extends React.Component<Props> {
|
|
15
|
+
private containerRef;
|
|
16
|
+
constructor(props: Props | Readonly<Props>);
|
|
17
|
+
getValue: () => string;
|
|
18
|
+
componentDidUpdate(prevProps: Readonly<Props>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
19
|
+
render(): ReactNode;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
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
|
+
})();
|
|
61
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
62
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
63
|
+
if (ar || !(i in from)) {
|
|
64
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
65
|
+
ar[i] = from[i];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
69
|
+
};
|
|
70
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
71
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
72
|
+
};
|
|
73
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
74
|
+
exports.InputOtp = void 0;
|
|
75
|
+
var react_1 = __importStar(require("react"));
|
|
76
|
+
var input_otp_module_css_1 = __importDefault(require("./input-otp.module.css"));
|
|
77
|
+
var InputOtp = /** @class */ (function (_super) {
|
|
78
|
+
__extends(InputOtp, _super);
|
|
79
|
+
function InputOtp(props) {
|
|
80
|
+
var _this = _super.call(this, props) || this;
|
|
81
|
+
_this.containerRef = (0, react_1.createRef)();
|
|
82
|
+
_this.getValue = function () {
|
|
83
|
+
var _a;
|
|
84
|
+
if (_this.containerRef.current)
|
|
85
|
+
return __spreadArray([], _this.containerRef.current.querySelectorAll("input"), true).map(function (v) { return v.value; }).join("");
|
|
86
|
+
else
|
|
87
|
+
return (_a = _this.props.value) !== null && _a !== void 0 ? _a : "";
|
|
88
|
+
};
|
|
89
|
+
_this.getValue = _this.getValue.bind(_this);
|
|
90
|
+
return _this;
|
|
91
|
+
}
|
|
92
|
+
InputOtp.prototype.componentDidUpdate = function (prevProps, prevState, snapshot) {
|
|
93
|
+
var _a;
|
|
94
|
+
if (prevProps.value !== this.props.value && this.containerRef.current) {
|
|
95
|
+
var inputList = __spreadArray([], this.containerRef.current.querySelectorAll("input"), true);
|
|
96
|
+
if ((_a = this.props.value) === null || _a === void 0 ? void 0 : _a.length) {
|
|
97
|
+
for (var i = 0; i < inputList.length; i++)
|
|
98
|
+
inputList[i].value = this.props.value[i];
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
for (var i = 0; i < inputList.length; i++)
|
|
102
|
+
inputList[i].value = "";
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
InputOtp.prototype.render = function () {
|
|
107
|
+
var _this = this;
|
|
108
|
+
var _a, _b, _c, _d, _e;
|
|
109
|
+
return react_1.default.createElement("div", { id: this.props.id, ref: this.containerRef, "helper-text": this.props.helperText, style: this.props.style ? __assign(__assign({}, { '--helper-text-color': (_a = this.props.helperTextColor) !== null && _a !== void 0 ? _a : '#e14337' }), this.props.style) : { '--helper-text-color': (_b = this.props.helperTextColor) !== null && _b !== void 0 ? _b : '#e14337' }, className: "row body-1 ".concat(input_otp_module_css_1.default['input-opt-container'], " ").concat(((_c = this.props.helperText) === null || _c === void 0 ? void 0 : _c.length) && 'helper-text', " ").concat((_d = this.props.className) !== null && _d !== void 0 ? _d : ''), onMouseDown: function (ev) {
|
|
110
|
+
ev.stopPropagation();
|
|
111
|
+
ev.preventDefault();
|
|
112
|
+
var inputList = __spreadArray([], ev.target.closest("div").childNodes, true);
|
|
113
|
+
for (var _i = 0, _a = inputList.entries(); _i < _a.length; _i++) {
|
|
114
|
+
var _b = _a[_i], index = _b[0], input = _b[1];
|
|
115
|
+
if (!input.value.length || index === (inputList.length - 1)) {
|
|
116
|
+
input.focus();
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
continue;
|
|
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, style: _this.props.inputStyle, onKeyDown: function (ev) {
|
|
122
|
+
var _a, _b;
|
|
123
|
+
var key = ev.key.toLowerCase();
|
|
124
|
+
switch (key) {
|
|
125
|
+
case "backspace":
|
|
126
|
+
if (ev.target.value.length)
|
|
127
|
+
ev.target.value = "";
|
|
128
|
+
else if (((_a = ev.target.previousSibling) === null || _a === void 0 ? void 0 : _a.localName) === "input")
|
|
129
|
+
ev.target.previousSibling.focus();
|
|
130
|
+
else
|
|
131
|
+
ev.target.blur();
|
|
132
|
+
break;
|
|
133
|
+
case "delete":
|
|
134
|
+
ev.target.value = "";
|
|
135
|
+
break;
|
|
136
|
+
default:
|
|
137
|
+
ev.preventDefault();
|
|
138
|
+
ev.stopPropagation();
|
|
139
|
+
var numberCheck = /[0-9]/g;
|
|
140
|
+
if (numberCheck.test(key)) {
|
|
141
|
+
if (!ev.target.value.length)
|
|
142
|
+
ev.target.value = key;
|
|
143
|
+
if (((_b = ev.target.nextSibling) === null || _b === void 0 ? void 0 : _b.localName) === "input" && !ev.target.nextSibling.value.length)
|
|
144
|
+
ev.target.nextSibling.focus();
|
|
145
|
+
else
|
|
146
|
+
ev.target.blur();
|
|
147
|
+
}
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
}, onBlur: function () {
|
|
151
|
+
if (_this.props.onChange)
|
|
152
|
+
_this.props.onChange(_this.getValue(), _this.containerRef.current);
|
|
153
|
+
} }); }));
|
|
154
|
+
};
|
|
155
|
+
return InputOtp;
|
|
156
|
+
}(react_1.default.Component));
|
|
157
|
+
exports.InputOtp = InputOtp;
|
|
@@ -7,6 +7,10 @@ interface TagProps {
|
|
|
7
7
|
suffix?: ReactNode;
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
style?: CSSProperties;
|
|
10
|
+
/**
|
|
11
|
+
* default: size24: button-text-6 \
|
|
12
|
+
* recommend: size24: button-text-6 | size32: button-text-4
|
|
13
|
+
* */
|
|
10
14
|
className?: string;
|
|
11
15
|
status?: ComponentStatus;
|
|
12
16
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
@@ -29,7 +29,7 @@ var Tag = /** @class */ (function (_super) {
|
|
|
29
29
|
}
|
|
30
30
|
Tag.prototype.render = function () {
|
|
31
31
|
var _a, _b;
|
|
32
|
-
return react_1.default.createElement("div", { id: this.props.id, "tag-type": (_a = this.props.status) !== null && _a !== void 0 ? _a : 'default', className: "".concat(tag_module_css_1.default['tag-container'], " row ").concat(this.props.onClick ? tag_module_css_1.default['type-button'] : '', " ").concat(this.props.disabled ? tag_module_css_1.default['disabled'] : "", " ").concat((_b = this.props.className) !== null && _b !== void 0 ? _b : "button-text-
|
|
32
|
+
return react_1.default.createElement("div", { id: this.props.id, "tag-type": (_a = this.props.status) !== null && _a !== void 0 ? _a : 'default', className: "".concat(tag_module_css_1.default['tag-container'], " row ").concat(this.props.onClick ? tag_module_css_1.default['type-button'] : '', " ").concat(this.props.disabled ? tag_module_css_1.default['disabled'] : "", " ").concat((_b = this.props.className) !== null && _b !== void 0 ? _b : "button-text-6", " "), style: this.props.style, onClick: this.props.onClick },
|
|
33
33
|
this.props.prefix,
|
|
34
34
|
react_1.default.createElement(text_1.Text, { maxLine: 1, className: tag_module_css_1.default['tag-label'] }, this.props.title),
|
|
35
35
|
this.props.suffix);
|
package/dist/index.d.ts
CHANGED
|
@@ -25,9 +25,9 @@ import { Button } from './component/button/button';
|
|
|
25
25
|
import { Tag } from './component/tag/tag';
|
|
26
26
|
import { Winicon } from './component/wini-icon/winicon';
|
|
27
27
|
import { NumberPicker } from './component/number-picker/number-picker';
|
|
28
|
-
import {
|
|
28
|
+
import { InputOtp } from './component/input-otp/input-otp';
|
|
29
29
|
import { WLoginView } from './form/login/view';
|
|
30
30
|
import { CustomCkEditor5 } from './component/ck-editor/ckeditor';
|
|
31
|
-
export { Calendar, CalendarType, ComponentStatus, getStatusIcon, Checkbox, Select1, Switch, Popup, showPopup, closePopup, Dialog, showDialog, DialogAlignment, DatePicker, SelectMultiple, ProgressBar, Text, Pagination, Table, TbCell, TbHeader, TbBody, TbRow, CellAlignItems, TextField, RadioButton, TextArea, ImportFile, ToastMessage, InfiniteScroll, Rating, ProgressCircle, CustomSlider, ToastContainer, Button, Tag, Winicon, NumberPicker,
|
|
31
|
+
export { Calendar, CalendarType, ComponentStatus, getStatusIcon, Checkbox, Select1, Switch, Popup, showPopup, closePopup, Dialog, showDialog, DialogAlignment, DatePicker, SelectMultiple, ProgressBar, Text, Pagination, Table, TbCell, TbHeader, TbBody, TbRow, CellAlignItems, TextField, RadioButton, TextArea, ImportFile, ToastMessage, InfiniteScroll, Rating, ProgressCircle, CustomSlider, ToastContainer, Button, Tag, Winicon, NumberPicker, InputOtp, WLoginView, CustomCkEditor5 };
|
|
32
32
|
export type { OptionsItem };
|
|
33
33
|
export { i18n } from './language/i18n';
|