wini-web-components 2.7.0 → 2.7.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.
- package/dist/types/index.d.ts +1 -0
- package/dist/vite.svg +1 -0
- package/dist/wini-web-components.css +4 -0
- package/dist/wini-web-components.js +32 -0
- package/dist/wini-web-components.mjs +6753 -0
- package/package.json +48 -82
- package/README.md +0 -21
- package/dist/component/button/button.d.ts +0 -21
- package/dist/component/button/button.js +0 -73
- package/dist/component/calendar/calendar.d.ts +0 -30
- package/dist/component/calendar/calendar.js +0 -357
- package/dist/component/card/card-info.d.ts +0 -15
- package/dist/component/card/card-info.js +0 -51
- package/dist/component/card/card.d.ts +0 -13
- package/dist/component/card/card.js +0 -33
- package/dist/component/checkbox/checkbox.d.ts +0 -24
- package/dist/component/checkbox/checkbox.js +0 -90
- package/dist/component/ck-editor/ckeditor.d.ts +0 -36
- package/dist/component/ck-editor/ckeditor.js +0 -392
- package/dist/component/component-status.d.ts +0 -8
- package/dist/component/component-status.js +0 -39
- package/dist/component/date-picker/date-picker.d.ts +0 -25
- package/dist/component/date-picker/date-picker.js +0 -329
- package/dist/component/date-time-picker/date-time-picker.d.ts +0 -36
- package/dist/component/date-time-picker/date-time-picker.js +0 -528
- package/dist/component/dialog/dialog.d.ts +0 -18
- package/dist/component/dialog/dialog.js +0 -113
- package/dist/component/import-file/import-file.d.ts +0 -33
- package/dist/component/import-file/import-file.js +0 -151
- package/dist/component/infinite-scroll/infinite-scroll.d.ts +0 -17
- package/dist/component/infinite-scroll/infinite-scroll.js +0 -37
- package/dist/component/input-multi-select/input-multi-select.d.ts +0 -21
- package/dist/component/input-multi-select/input-multi-select.js +0 -260
- package/dist/component/input-opt/input-opt.d.ts +0 -21
- package/dist/component/input-opt/input-opt.js +0 -157
- package/dist/component/input-otp/input-otp.d.ts +0 -22
- package/dist/component/input-otp/input-otp.js +0 -131
- package/dist/component/number-picker/number-picker.d.ts +0 -23
- package/dist/component/number-picker/number-picker.js +0 -125
- package/dist/component/pagination/pagination.d.ts +0 -13
- package/dist/component/pagination/pagination.js +0 -90
- package/dist/component/popup/popup.d.ts +0 -40
- package/dist/component/popup/popup.js +0 -125
- package/dist/component/progress-bar/progress-bar.d.ts +0 -16
- package/dist/component/progress-bar/progress-bar.js +0 -23
- package/dist/component/progress-circle/progress-circle.d.ts +0 -14
- package/dist/component/progress-circle/progress-circle.js +0 -19
- package/dist/component/radio-button/radio-button.d.ts +0 -20
- package/dist/component/radio-button/radio-button.js +0 -33
- package/dist/component/rating/rating.d.ts +0 -23
- package/dist/component/rating/rating.js +0 -54
- package/dist/component/select1/select1.d.ts +0 -31
- package/dist/component/select1/select1.js +0 -249
- package/dist/component/slider/slider.d.ts +0 -31
- package/dist/component/slider/slider.js +0 -64
- package/dist/component/switch/switch.d.ts +0 -23
- package/dist/component/switch/switch.js +0 -50
- package/dist/component/table/table.d.ts +0 -51
- package/dist/component/table/table.js +0 -66
- package/dist/component/tag/tag.d.ts +0 -22
- package/dist/component/tag/tag.js +0 -19
- package/dist/component/text/text.d.ts +0 -16
- package/dist/component/text/text.js +0 -20
- package/dist/component/text-area/text-area.d.ts +0 -27
- package/dist/component/text-area/text-area.js +0 -57
- package/dist/component/text-field/text-field.d.ts +0 -36
- package/dist/component/text-field/text-field.js +0 -80
- package/dist/component/toast-noti/toast-noti.d.ts +0 -5
- package/dist/component/toast-noti/toast-noti.js +0 -25
- package/dist/component/wini-icon/winicon.d.ts +0 -20
- package/dist/component/wini-icon/winicon.js +0 -176
- package/dist/form/login/view.d.ts +0 -40
- package/dist/form/login/view.js +0 -66
- package/dist/i18n.d.ts +0 -2
- package/dist/i18n.js +0 -125
- package/dist/index.d.ts +0 -33
- package/dist/index.js +0 -2
- package/dist/index.js.LICENSE.txt +0 -18
- package/dist/language/i18n.d.ts +0 -2
- package/dist/language/i18n.js +0 -146
- package/global.d.ts +0 -4
- /package/{public → dist}/favicon.ico +0 -0
- /package/{public → dist}/index.html +0 -0
- /package/{public → dist}/logo192.png +0 -0
- /package/{public → dist}/logo512.png +0 -0
- /package/{public → dist}/manifest.json +0 -0
- /package/{public → dist}/robots.txt +0 -0
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
-
};
|
|
47
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.SelectMultiple = void 0;
|
|
49
|
-
const react_1 = __importStar(require("react"));
|
|
50
|
-
const input_multi_select_module_css_1 = __importDefault(require("./input-multi-select.module.css"));
|
|
51
|
-
const checkbox_1 = require("../checkbox/checkbox");
|
|
52
|
-
const text_1 = require("../text/text");
|
|
53
|
-
const winicon_1 = require("../wini-icon/winicon");
|
|
54
|
-
const react_i18next_1 = require("react-i18next");
|
|
55
|
-
const popup_1 = require("../popup/popup");
|
|
56
|
-
;
|
|
57
|
-
class TSelectMultiple extends react_1.default.Component {
|
|
58
|
-
constructor(props) {
|
|
59
|
-
var _a;
|
|
60
|
-
super(props);
|
|
61
|
-
this.containerRef = (0, react_1.createRef)();
|
|
62
|
-
this.inputRef = (0, react_1.createRef)();
|
|
63
|
-
this.state = {
|
|
64
|
-
value: (_a = props.value) !== null && _a !== void 0 ? _a : [],
|
|
65
|
-
options: props.options,
|
|
66
|
-
offset: {
|
|
67
|
-
x: 0,
|
|
68
|
-
y: 0,
|
|
69
|
-
height: 0,
|
|
70
|
-
width: 0,
|
|
71
|
-
bottom: 0,
|
|
72
|
-
left: 0,
|
|
73
|
-
right: 0,
|
|
74
|
-
top: 0,
|
|
75
|
-
toJSON: function () {
|
|
76
|
-
throw new Error('Function not implemented.');
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
isOpen: false,
|
|
80
|
-
onSelect: null,
|
|
81
|
-
};
|
|
82
|
-
this.onCheck = this.onCheck.bind(this);
|
|
83
|
-
this.search = this.search.bind(this);
|
|
84
|
-
this.onClickItem = this.onClickItem.bind(this);
|
|
85
|
-
}
|
|
86
|
-
onCheck(value, list) {
|
|
87
|
-
let newValue = [];
|
|
88
|
-
if (value) {
|
|
89
|
-
newValue = [...this.state.value, ...list.map(e => e.id)];
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
newValue = this.state.value.filter(vl => list.every(e => vl !== e.id));
|
|
93
|
-
}
|
|
94
|
-
this.setState(Object.assign(Object.assign({}, this.state), { value: newValue }));
|
|
95
|
-
if (this.props.onChange)
|
|
96
|
-
this.props.onChange(newValue);
|
|
97
|
-
}
|
|
98
|
-
search(ev) {
|
|
99
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
-
var _a;
|
|
101
|
-
if (ev.target.value.trim().length) {
|
|
102
|
-
if ((_a = this.props) === null || _a === void 0 ? void 0 : _a.handleSearch) {
|
|
103
|
-
const res = yield this.props.handleSearch(ev.target.value.trim());
|
|
104
|
-
this.setState(Object.assign(Object.assign({}, this.state), { search: res }));
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
this.setState(Object.assign(Object.assign({}, this.state), { search: this.props.options.filter(e => typeof e.name === "string" && e.name.toLowerCase().includes(ev.target.value.trim().toLowerCase())) }));
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
this.setState(Object.assign(Object.assign({}, this.state), { search: undefined }));
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
onClickItem(ev, item) {
|
|
116
|
-
var _a, _b;
|
|
117
|
-
ev.stopPropagation();
|
|
118
|
-
let newValue = this.state.value.filter(vl => vl !== item);
|
|
119
|
-
this.setState(Object.assign(Object.assign(Object.assign({}, this.state), { value: newValue }), (this.state.isOpen ? {} : {
|
|
120
|
-
isOpen: true,
|
|
121
|
-
style: undefined,
|
|
122
|
-
offset: (_b = (_a = this.containerRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect(),
|
|
123
|
-
})));
|
|
124
|
-
if (this.props.onChange)
|
|
125
|
-
this.props.onChange(newValue);
|
|
126
|
-
}
|
|
127
|
-
renderOptions(item) {
|
|
128
|
-
var _a, _b;
|
|
129
|
-
let children = [];
|
|
130
|
-
if (!item.parentId)
|
|
131
|
-
children = ((_a = this.state.search) !== null && _a !== void 0 ? _a : this.state.options).filter(e => e.parentId === item.id);
|
|
132
|
-
//
|
|
133
|
-
return react_1.default.createElement("div", { key: item.id, className: 'col', style: { width: '100%' } },
|
|
134
|
-
react_1.default.createElement("div", { className: `${input_multi_select_module_css_1.default['select-tile']} row ${item.disabled ? input_multi_select_module_css_1.default["disabled"] : ""}`, style: { paddingLeft: item.parentId ? '4.4rem' : undefined }, onClick: children.length ? () => {
|
|
135
|
-
if (this.state.search) {
|
|
136
|
-
this.setState(Object.assign(Object.assign({}, this.state), { search: this.state.search.map(e => {
|
|
137
|
-
if (e.id === item.id)
|
|
138
|
-
return Object.assign(Object.assign({}, e), { isOpen: !item.isOpen });
|
|
139
|
-
else
|
|
140
|
-
return e;
|
|
141
|
-
}) }));
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
this.setState(Object.assign(Object.assign({}, this.state), { options: this.state.options.map(e => {
|
|
145
|
-
if (e.id === item.id)
|
|
146
|
-
return Object.assign(Object.assign({}, e), { isOpen: !item.isOpen });
|
|
147
|
-
else
|
|
148
|
-
return e;
|
|
149
|
-
}) }));
|
|
150
|
-
}
|
|
151
|
-
} : undefined },
|
|
152
|
-
((_b = this.state.search) !== null && _b !== void 0 ? _b : this.state.options).some(e => e.parentId) && react_1.default.createElement("div", { className: 'row', style: { width: '1.4rem', height: '1.4rem' } }, children.length ? react_1.default.createElement(winicon_1.Winicon, { src: item.isOpen ? 'fill/arrows/triangle-down' : 'fill/arrows/triangle-right', size: '1.2rem' }) : null),
|
|
153
|
-
react_1.default.createElement(checkbox_1.Checkbox, { disabled: item.disabled, value: children.length ? (children.every((e) => this.state.value.includes(e.id)) ? true : children.some((e) => this.state.value.includes(e.id)) ? undefined : false) : this.state.value.includes(item.id), onChange: (v) => { this.onCheck(v, [item, ...children]); }, size: '2rem' }),
|
|
154
|
-
react_1.default.createElement(text_1.Text, { className: 'body-3' }, item.name)),
|
|
155
|
-
react_1.default.createElement("div", { className: 'col', style: { display: item.isOpen ? "flex" : "none", width: '100%' } }, children.map(e => this.renderOptions(e))));
|
|
156
|
-
}
|
|
157
|
-
componentDidUpdate(prevProps, prevState) {
|
|
158
|
-
var _a, _b, _c, _d, _e;
|
|
159
|
-
if (prevProps.options !== this.props.options)
|
|
160
|
-
this.setState(Object.assign(Object.assign({}, this.state), { options: this.props.options }));
|
|
161
|
-
if (prevProps.value !== this.props.value)
|
|
162
|
-
this.setState(Object.assign(Object.assign({}, this.state), { value: (_a = this.props.value) !== null && _a !== void 0 ? _a : [] }));
|
|
163
|
-
//
|
|
164
|
-
if (this.state.isOpen && (prevState.isOpen !== this.state.isOpen || prevState.value.length !== this.state.value.length)) {
|
|
165
|
-
const thisPopupRect = (_b = this.containerRef.current.querySelector(`.select-multi-popup`)) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
166
|
-
if (thisPopupRect) {
|
|
167
|
-
let style;
|
|
168
|
-
if (prevState.isOpen !== this.state.isOpen && thisPopupRect.right > document.body.offsetWidth) {
|
|
169
|
-
style = {
|
|
170
|
-
top: this.state.offset.y + this.state.offset.height + 2 + 'px',
|
|
171
|
-
right: document.body.offsetWidth - this.state.offset.right + 'px'
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
let _bottom = thisPopupRect.bottom - 8;
|
|
175
|
-
const thisContainerRect = (_c = this.containerRef.current) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect();
|
|
176
|
-
if (thisContainerRect) {
|
|
177
|
-
if (prevState.value.length !== this.state.value.length) {
|
|
178
|
-
_bottom = thisContainerRect.bottom + 2 + thisPopupRect.height;
|
|
179
|
-
style = Object.assign(Object.assign({}, (style !== null && style !== void 0 ? style : {})), { top: `${thisContainerRect.bottom + 2}px` });
|
|
180
|
-
}
|
|
181
|
-
if (_bottom > document.body.offsetHeight) {
|
|
182
|
-
style = Object.assign(Object.assign({}, (style !== null && style !== void 0 ? style : {})), { top: `${thisContainerRect.y - 2 - thisPopupRect.height}px` });
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
if (style) {
|
|
186
|
-
(_d = style.left) !== null && _d !== void 0 ? _d : (style.left = style.right ? undefined : `${this.state.offset.x}px`);
|
|
187
|
-
(_e = style.width) !== null && _e !== void 0 ? _e : (style.width = `${this.state.offset.width}px`);
|
|
188
|
-
this.setState(Object.assign(Object.assign({}, this.state), { style: style }));
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
render() {
|
|
194
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
195
|
-
const { t } = this.props;
|
|
196
|
-
return react_1.default.createElement("div", { id: this.props.id, ref: this.containerRef, className: `${input_multi_select_module_css_1.default['select-multi-container']} row ${this.props.disabled ? input_multi_select_module_css_1.default['disabled'] : ''} ${((_a = this.props.helperText) === null || _a === void 0 ? void 0 : _a.length) && input_multi_select_module_css_1.default['helper-text']} ${(_b = this.props.className) !== null && _b !== void 0 ? _b : 'body-3'}`, "helper-text": this.props.helperText, style: this.props.style ? Object.assign(Object.assign({}, { '--helper-text-color': (_c = this.props.helperTextColor) !== null && _c !== void 0 ? _c : '#e14337' }), this.props.style) : { '--helper-text-color': (_d = this.props.helperTextColor) !== null && _d !== void 0 ? _d : '#e14337' }, onClick: () => {
|
|
197
|
-
var _a, _b;
|
|
198
|
-
if (!this.state.isOpen)
|
|
199
|
-
this.setState(Object.assign(Object.assign({}, this.state), { isOpen: true, style: undefined, offset: (_b = (_a = this.containerRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect() }));
|
|
200
|
-
} },
|
|
201
|
-
react_1.default.createElement("div", { className: 'row', style: { flexWrap: 'wrap', flex: 1, width: '100%', gap: '0.6rem 0.4rem' } },
|
|
202
|
-
this.state.value.map(item => {
|
|
203
|
-
const optionItem = this.props.options.find(e => e.id === item);
|
|
204
|
-
return react_1.default.createElement("div", { key: item, className: `row ${input_multi_select_module_css_1.default['selected-item-value']}`, onClick: (optionItem === null || optionItem === void 0 ? void 0 : optionItem.disabled) ? undefined : (ev) => this.onClickItem(ev, item) },
|
|
205
|
-
react_1.default.createElement(text_1.Text, { style: { color: "var(--neutral-text-title-color)", fontSize: '1.2rem', lineHeight: '1.4rem' } }, optionItem === null || optionItem === void 0 ? void 0 : optionItem.name),
|
|
206
|
-
react_1.default.createElement(winicon_1.Winicon, { src: "outline/user interface/e-remove", size: '1.2rem' }));
|
|
207
|
-
}),
|
|
208
|
-
(!this.state.value.length || this.state.isOpen) && react_1.default.createElement("input", { ref: this.inputRef, autoFocus: this.state.value.length > 0, onChange: this.search, placeholder: this.state.value.length ? undefined : this.props.placeholder, onBlur: ev => {
|
|
209
|
-
if (this.state.isOpen)
|
|
210
|
-
ev.target.focus();
|
|
211
|
-
} })),
|
|
212
|
-
this.props.showClearValueButton && this.state.value.length ? react_1.default.createElement("button", { type: 'button', className: 'row', style: { padding: '0.4rem' }, onClick: (ev) => {
|
|
213
|
-
ev.stopPropagation();
|
|
214
|
-
if (this.state.value.length)
|
|
215
|
-
this.setState(Object.assign(Object.assign({}, this.state), { isOpen: true, value: [] }));
|
|
216
|
-
} },
|
|
217
|
-
react_1.default.createElement(winicon_1.Winicon, { src: "outline/user interface/c-remove", size: '1.6rem' })) : react_1.default.createElement("div", { ref: iconRef => {
|
|
218
|
-
if ((iconRef === null || iconRef === void 0 ? void 0 : iconRef.parentElement) && iconRef.parentElement.getBoundingClientRect().width < 100)
|
|
219
|
-
iconRef.style.display = "none";
|
|
220
|
-
}, className: 'row' },
|
|
221
|
-
react_1.default.createElement(winicon_1.Winicon, { src: this.state.isOpen ? "fill/arrows/up-arrow" : "fill/arrows/down-arrow", size: '1.2rem' })),
|
|
222
|
-
this.state.isOpen && react_1.default.createElement(popup_1.PopupOverlay, { className: `hidden-overlay`, onClose: (ev) => {
|
|
223
|
-
if (ev.target !== this.inputRef.current)
|
|
224
|
-
this.setState(Object.assign(Object.assign({}, this.state), { isOpen: false }));
|
|
225
|
-
} },
|
|
226
|
-
react_1.default.createElement("div", { className: `${input_multi_select_module_css_1.default['select-multi-popup']} select-multi-popup col ${(_e = this.props.popupClassName) !== null && _e !== void 0 ? _e : ""}`, style: (_f = this.state.style) !== null && _f !== void 0 ? _f : {
|
|
227
|
-
top: this.state.offset.y + this.state.offset.height + 2 + 'px',
|
|
228
|
-
left: this.state.offset.x + 'px',
|
|
229
|
-
width: this.state.offset.width,
|
|
230
|
-
} },
|
|
231
|
-
react_1.default.createElement("div", { style: { padding: '1.2rem 1.6rem', width: '100%', borderBottom: "var(--neutral-main-border)" } }, (() => {
|
|
232
|
-
var _a, _b;
|
|
233
|
-
const _list = ((_b = (_a = this.state.search) !== null && _a !== void 0 ? _a : this.props.options) !== null && _b !== void 0 ? _b : []);
|
|
234
|
-
const isSelectedAll = _list.every(item => this.state.value.some(vl => vl === item.id));
|
|
235
|
-
return react_1.default.createElement(text_1.Text, { onClick: () => {
|
|
236
|
-
let newValue = [];
|
|
237
|
-
if (_list.length) {
|
|
238
|
-
if (isSelectedAll) {
|
|
239
|
-
newValue = this.state.value.filter(vl => _list.every(item => vl !== item.id || item.disabled));
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
newValue = [...this.state.value, ..._list.filter(item => this.state.value.every(vl => vl !== item.id) && !item.disabled).map(e => e.id)];
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
this.setState(Object.assign(Object.assign({}, this.state), { value: newValue }));
|
|
246
|
-
if (this.props.onChange)
|
|
247
|
-
this.props.onChange(newValue);
|
|
248
|
-
}, className: 'button-text-3', style: { color: _list.length ? undefined : 'var(--neutral-text-title-color)' } }, _list.length && isSelectedAll ? `${t("remove")} ${t("all").toLowerCase()}` : `${t("select")} ${t("all").toLowerCase()}`);
|
|
249
|
-
})()),
|
|
250
|
-
react_1.default.createElement("div", { className: `col ${input_multi_select_module_css_1.default['select-body']}`, onScroll: this.props.handleLoadmore ? (ev) => {
|
|
251
|
-
if (this.props.handleLoadmore) {
|
|
252
|
-
let scrollElement = ev.target;
|
|
253
|
-
this.props.handleLoadmore(Math.round(scrollElement.offsetHeight + scrollElement.scrollTop) >= (scrollElement.scrollHeight - 1), ev);
|
|
254
|
-
}
|
|
255
|
-
} : undefined },
|
|
256
|
-
((_g = this.state.search) !== null && _g !== void 0 ? _g : this.state.options).filter(e => !e.parentId).map(item => this.renderOptions(item)),
|
|
257
|
-
(!((_h = this.state.search) === null || _h === void 0 ? void 0 : _h.length) && !((_j = this.props.options) === null || _j === void 0 ? void 0 : _j.length)) && (react_1.default.createElement("div", { className: input_multi_select_module_css_1.default['no-results-found'] }, t("noResultFound")))))));
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
exports.SelectMultiple = (0, react_i18next_1.withTranslation)()(TSelectMultiple);
|
|
@@ -1,21 +0,0 @@
|
|
|
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 InputOpt 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 {};
|
|
@@ -1,157 +0,0 @@
|
|
|
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.InputOpt = void 0;
|
|
75
|
-
var react_1 = __importStar(require("react"));
|
|
76
|
-
var input_opt_module_css_1 = __importDefault(require("./input-opt.module.css"));
|
|
77
|
-
var InputOpt = /** @class */ (function (_super) {
|
|
78
|
-
__extends(InputOpt, _super);
|
|
79
|
-
function InputOpt(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
|
-
InputOpt.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
|
-
InputOpt.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_opt_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 InputOpt;
|
|
156
|
-
}(react_1.default.Component));
|
|
157
|
-
exports.InputOpt = InputOpt;
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
autoFocus?: boolean;
|
|
14
|
-
}
|
|
15
|
-
export declare class InputOtp extends React.Component<Props> {
|
|
16
|
-
private containerRef;
|
|
17
|
-
constructor(props: Props | Readonly<Props>);
|
|
18
|
-
getValue: () => string;
|
|
19
|
-
componentDidUpdate(prevProps: Readonly<Props>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
20
|
-
render(): ReactNode;
|
|
21
|
-
}
|
|
22
|
-
export {};
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.InputOtp = void 0;
|
|
40
|
-
const react_1 = __importStar(require("react"));
|
|
41
|
-
const input_otp_module_css_1 = __importDefault(require("./input-otp.module.css"));
|
|
42
|
-
class InputOtp extends react_1.default.Component {
|
|
43
|
-
constructor(props) {
|
|
44
|
-
super(props);
|
|
45
|
-
this.containerRef = (0, react_1.createRef)();
|
|
46
|
-
this.getValue = () => {
|
|
47
|
-
var _a;
|
|
48
|
-
if (this.containerRef.current)
|
|
49
|
-
return [...this.containerRef.current.querySelectorAll("input")].map(v => v.value).join("");
|
|
50
|
-
else
|
|
51
|
-
return (_a = this.props.value) !== null && _a !== void 0 ? _a : "";
|
|
52
|
-
};
|
|
53
|
-
this.getValue = this.getValue.bind(this);
|
|
54
|
-
}
|
|
55
|
-
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
56
|
-
var _a;
|
|
57
|
-
if (prevProps.value !== this.props.value && this.containerRef.current) {
|
|
58
|
-
const inputList = [...this.containerRef.current.querySelectorAll("input")];
|
|
59
|
-
if ((_a = this.props.value) === null || _a === void 0 ? void 0 : _a.length) {
|
|
60
|
-
for (let i = 0; i < inputList.length; i++)
|
|
61
|
-
inputList[i].value = this.props.value[i];
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
for (let i = 0; i < inputList.length; i++)
|
|
65
|
-
inputList[i].value = "";
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
render() {
|
|
70
|
-
var _a, _b, _c, _d, _e;
|
|
71
|
-
return react_1.default.createElement("div", { id: this.props.id, ref: this.containerRef, "helper-text": this.props.helperText, style: this.props.style ? Object.assign(Object.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 ${input_otp_module_css_1.default['input-opt-container']} ${((_c = this.props.helperText) === null || _c === void 0 ? void 0 : _c.length) && 'helper-text'} ${(_d = this.props.className) !== null && _d !== void 0 ? _d : ''}`, onMouseDown: (ev) => {
|
|
72
|
-
ev.stopPropagation();
|
|
73
|
-
ev.preventDefault();
|
|
74
|
-
const inputList = [...ev.target.closest("div").childNodes];
|
|
75
|
-
for (const [index, input] of inputList.entries()) {
|
|
76
|
-
if (!input.value.length || index === (inputList.length - 1)) {
|
|
77
|
-
input.focus();
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
} }, Array.from({ length: (_e = this.props.length) !== null && _e !== void 0 ? _e : 6 }).map((_, i) => react_1.default.createElement("input", { key: "opt-" + i, autoFocus: i === 0 && this.props.autoFocus, disabled: this.props.disabled, style: this.props.inputStyle, onKeyDown: (ev) => {
|
|
83
|
-
var _a, _b;
|
|
84
|
-
const key = ev.key.toLowerCase();
|
|
85
|
-
switch (key) {
|
|
86
|
-
case "backspace":
|
|
87
|
-
if (ev.target.value.length)
|
|
88
|
-
ev.target.value = "";
|
|
89
|
-
else if (((_a = ev.target.previousSibling) === null || _a === void 0 ? void 0 : _a.localName) === "input")
|
|
90
|
-
ev.target.previousSibling.focus();
|
|
91
|
-
else
|
|
92
|
-
ev.target.blur();
|
|
93
|
-
break;
|
|
94
|
-
case "delete":
|
|
95
|
-
ev.target.value = "";
|
|
96
|
-
break;
|
|
97
|
-
default:
|
|
98
|
-
ev.preventDefault();
|
|
99
|
-
ev.stopPropagation();
|
|
100
|
-
if (key === "v" && ev.ctrlKey) {
|
|
101
|
-
return navigator.clipboard.readText().then(text => {
|
|
102
|
-
const otpRegex = /^\d{6}$/g;
|
|
103
|
-
if (otpRegex.test(text)) {
|
|
104
|
-
const inputList = [...ev.target.closest("div").childNodes];
|
|
105
|
-
inputList.forEach((input, i) => {
|
|
106
|
-
input.value = text[i];
|
|
107
|
-
input.focus();
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
const numberCheck = /[0-9]/g;
|
|
114
|
-
if (numberCheck.test(key) && !key.startsWith("f")) {
|
|
115
|
-
if (!ev.target.value.length)
|
|
116
|
-
ev.target.value = key;
|
|
117
|
-
if (((_b = ev.target.nextSibling) === null || _b === void 0 ? void 0 : _b.localName) === "input" && !ev.target.nextSibling.value.length)
|
|
118
|
-
ev.target.nextSibling.focus();
|
|
119
|
-
else
|
|
120
|
-
ev.target.blur();
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
break;
|
|
124
|
-
}
|
|
125
|
-
}, onBlur: () => {
|
|
126
|
-
if (this.props.onChange)
|
|
127
|
-
this.props.onChange(this.getValue(), this.containerRef.current);
|
|
128
|
-
} })));
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
exports.InputOtp = InputOtp;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React, { CSSProperties } from "react";
|
|
2
|
-
interface Props {
|
|
3
|
-
id?: string;
|
|
4
|
-
value?: number;
|
|
5
|
-
onChange?: (ev: number) => void;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
readOnly?: boolean;
|
|
8
|
-
/**
|
|
9
|
-
* default: size32: body-3 \
|
|
10
|
-
* recommend: size40: body-2 | size24: body-3
|
|
11
|
-
* */
|
|
12
|
-
className?: string;
|
|
13
|
-
helperText?: string;
|
|
14
|
-
helperTextColor?: string;
|
|
15
|
-
/** default: 1 */
|
|
16
|
-
volume?: number;
|
|
17
|
-
style?: CSSProperties;
|
|
18
|
-
min?: number;
|
|
19
|
-
max?: number;
|
|
20
|
-
type?: "outline" | "icon-button";
|
|
21
|
-
}
|
|
22
|
-
export declare const NumberPicker: ({ id, value, onChange, disabled, readOnly, className, helperText, helperTextColor, max, min, style, type, volume }: Props) => React.JSX.Element;
|
|
23
|
-
export {};
|