wini-web-components 2.6.0 → 2.6.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/component/button/button.d.ts +2 -1
- package/dist/component/button/button.js +9 -29
- package/dist/component/calendar/calendar.d.ts +0 -6
- package/dist/component/calendar/calendar.js +141 -181
- package/dist/component/checkbox/checkbox.js +26 -56
- package/dist/component/ck-editor/ckeditor.js +18 -29
- package/dist/component/component-status.js +6 -6
- package/dist/component/date-picker/date-picker.js +141 -174
- package/dist/component/date-time-picker/date-time-picker.d.ts +36 -0
- package/dist/component/date-time-picker/date-time-picker.js +572 -0
- package/dist/component/dialog/dialog.js +37 -67
- package/dist/component/import-file/import-file.js +67 -106
- package/dist/component/infinite-scroll/infinite-scroll.js +17 -83
- package/dist/component/input-multi-select/input-multi-select.js +102 -178
- package/dist/component/input-otp/input-otp.js +29 -69
- package/dist/component/number-picker/number-picker.js +21 -33
- package/dist/component/pagination/pagination.js +19 -22
- package/dist/component/popup/popup.d.ts +2 -2
- package/dist/component/popup/popup.js +43 -70
- package/dist/component/progress-bar/progress-bar.js +12 -24
- package/dist/component/progress-circle/progress-circle.js +8 -19
- package/dist/component/radio-button/radio-button.js +11 -42
- package/dist/component/rating/rating.js +29 -48
- package/dist/component/select1/select1.js +91 -160
- package/dist/component/slider/slider.js +36 -54
- package/dist/component/switch/switch.js +22 -52
- package/dist/component/table/table.js +36 -89
- package/dist/component/tag/tag.js +8 -28
- package/dist/component/text/text.js +9 -40
- package/dist/component/text-area/text-area.js +12 -41
- package/dist/component/text-field/text-field.js +17 -47
- package/dist/component/toast-noti/toast-noti.js +7 -10
- package/dist/component/wini-icon/winicon.js +55 -113
- package/dist/form/login/view.js +28 -28
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/index.js.LICENSE.txt +1 -11
- package/dist/language/i18n.js +24 -5
- package/package.json +1 -1
|
@@ -1,30 +1,4 @@
|
|
|
1
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
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
29
3
|
if (k2 === undefined) k2 = k;
|
|
30
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -67,63 +41,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
67
41
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
68
42
|
});
|
|
69
43
|
};
|
|
70
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
71
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
72
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
73
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
74
|
-
function step(op) {
|
|
75
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
76
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
77
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
78
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
79
|
-
switch (op[0]) {
|
|
80
|
-
case 0: case 1: t = op; break;
|
|
81
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
82
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
83
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
84
|
-
default:
|
|
85
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
86
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
87
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
88
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
89
|
-
if (t[2]) _.ops.pop();
|
|
90
|
-
_.trys.pop(); continue;
|
|
91
|
-
}
|
|
92
|
-
op = body.call(thisArg, _);
|
|
93
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
94
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
98
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
99
|
-
if (ar || !(i in from)) {
|
|
100
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
101
|
-
ar[i] = from[i];
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
105
|
-
};
|
|
106
44
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
107
45
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
108
46
|
};
|
|
109
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
110
48
|
exports.SelectMultiple = void 0;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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");
|
|
118
56
|
;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
function TSelectMultiple(props) {
|
|
57
|
+
class TSelectMultiple extends react_1.default.Component {
|
|
58
|
+
constructor(props) {
|
|
122
59
|
var _a;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
60
|
+
super(props);
|
|
61
|
+
this.containerRef = (0, react_1.createRef)();
|
|
62
|
+
this.inputRef = (0, react_1.createRef)();
|
|
63
|
+
this.state = {
|
|
127
64
|
value: (_a = props.value) !== null && _a !== void 0 ? _a : [],
|
|
128
65
|
options: props.options,
|
|
129
66
|
offset: {
|
|
@@ -142,195 +79,182 @@ var TSelectMultiple = /** @class */ (function (_super) {
|
|
|
142
79
|
isOpen: false,
|
|
143
80
|
onSelect: null,
|
|
144
81
|
};
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return _this;
|
|
82
|
+
this.onCheck = this.onCheck.bind(this);
|
|
83
|
+
this.search = this.search.bind(this);
|
|
84
|
+
this.onClickItem = this.onClickItem.bind(this);
|
|
149
85
|
}
|
|
150
|
-
|
|
151
|
-
|
|
86
|
+
onCheck(value, list) {
|
|
87
|
+
let newValue = [];
|
|
152
88
|
if (value) {
|
|
153
|
-
newValue =
|
|
89
|
+
newValue = [...this.state.value, ...list.map(e => e.id)];
|
|
154
90
|
}
|
|
155
91
|
else {
|
|
156
|
-
newValue = this.state.value.filter(
|
|
92
|
+
newValue = this.state.value.filter(vl => list.every(e => vl !== e.id));
|
|
157
93
|
}
|
|
158
|
-
this.setState(
|
|
94
|
+
this.setState(Object.assign(Object.assign({}, this.state), { value: newValue }));
|
|
159
95
|
if (this.props.onChange)
|
|
160
96
|
this.props.onChange(newValue);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
164
|
-
var res;
|
|
97
|
+
}
|
|
98
|
+
search(ev) {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
165
100
|
var _a;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if (!((_a = this.props) === null || _a === void 0 ? void 0 : _a.handleSearch)) return [3 /*break*/, 2];
|
|
171
|
-
return [4 /*yield*/, this.props.handleSearch(ev.target.value.trim())];
|
|
172
|
-
case 1:
|
|
173
|
-
res = _b.sent();
|
|
174
|
-
this.setState(__assign(__assign({}, this.state), { search: res }));
|
|
175
|
-
return [3 /*break*/, 3];
|
|
176
|
-
case 2:
|
|
177
|
-
this.setState(__assign(__assign({}, this.state), { search: this.props.options.filter(function (e) { return typeof e.name === "string" && e.name.toLowerCase().includes(ev.target.value.trim().toLowerCase()); }) }));
|
|
178
|
-
_b.label = 3;
|
|
179
|
-
case 3: return [3 /*break*/, 5];
|
|
180
|
-
case 4:
|
|
181
|
-
this.setState(__assign(__assign({}, this.state), { search: undefined }));
|
|
182
|
-
_b.label = 5;
|
|
183
|
-
case 5: return [2 /*return*/];
|
|
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 }));
|
|
184
105
|
}
|
|
185
|
-
|
|
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
|
+
}
|
|
186
113
|
});
|
|
187
|
-
}
|
|
188
|
-
|
|
114
|
+
}
|
|
115
|
+
onClickItem(ev, item) {
|
|
189
116
|
var _a, _b;
|
|
190
117
|
ev.stopPropagation();
|
|
191
|
-
|
|
192
|
-
this.setState(
|
|
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 ? {} : {
|
|
193
120
|
isOpen: true,
|
|
194
121
|
style: undefined,
|
|
195
122
|
offset: (_b = (_a = this.containerRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect(),
|
|
196
123
|
})));
|
|
197
124
|
if (this.props.onChange)
|
|
198
125
|
this.props.onChange(newValue);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
var _this = this;
|
|
126
|
+
}
|
|
127
|
+
renderOptions(item) {
|
|
202
128
|
var _a, _b;
|
|
203
|
-
|
|
129
|
+
let children = [];
|
|
204
130
|
if (!item.parentId)
|
|
205
|
-
children = ((_a = this.state.search) !== null && _a !== void 0 ? _a : this.state.options).filter(
|
|
131
|
+
children = ((_a = this.state.search) !== null && _a !== void 0 ? _a : this.state.options).filter(e => e.parentId === item.id);
|
|
206
132
|
//
|
|
207
133
|
return react_1.default.createElement("div", { key: item.id, className: 'col', style: { width: '100%' } },
|
|
208
|
-
react_1.default.createElement("div", { className:
|
|
209
|
-
if (
|
|
210
|
-
|
|
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 => {
|
|
211
137
|
if (e.id === item.id)
|
|
212
|
-
return
|
|
138
|
+
return Object.assign(Object.assign({}, e), { isOpen: !item.isOpen });
|
|
213
139
|
else
|
|
214
140
|
return e;
|
|
215
141
|
}) }));
|
|
216
142
|
}
|
|
217
143
|
else {
|
|
218
|
-
|
|
144
|
+
this.setState(Object.assign(Object.assign({}, this.state), { options: this.state.options.map(e => {
|
|
219
145
|
if (e.id === item.id)
|
|
220
|
-
return
|
|
146
|
+
return Object.assign(Object.assign({}, e), { isOpen: !item.isOpen });
|
|
221
147
|
else
|
|
222
148
|
return e;
|
|
223
149
|
}) }));
|
|
224
150
|
}
|
|
225
151
|
} : undefined },
|
|
226
|
-
((_b = this.state.search) !== null && _b !== void 0 ? _b : this.state.options).some(
|
|
227
|
-
react_1.default.createElement(checkbox_1.Checkbox, { disabled: item.disabled, value: children.length ? (children.every(
|
|
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' }),
|
|
228
154
|
react_1.default.createElement(text_1.Text, { className: 'body-3' }, item.name)),
|
|
229
|
-
react_1.default.createElement("div", { className: 'col', style: { display: item.isOpen ? "flex" : "none", width: '100%' } }, children.map(
|
|
230
|
-
}
|
|
231
|
-
|
|
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) {
|
|
232
158
|
var _a, _b, _c, _d, _e;
|
|
233
159
|
if (prevProps.options !== this.props.options)
|
|
234
|
-
this.setState(
|
|
160
|
+
this.setState(Object.assign(Object.assign({}, this.state), { options: this.props.options }));
|
|
235
161
|
if (prevProps.value !== this.props.value)
|
|
236
|
-
this.setState(
|
|
162
|
+
this.setState(Object.assign(Object.assign({}, this.state), { value: (_a = this.props.value) !== null && _a !== void 0 ? _a : [] }));
|
|
237
163
|
//
|
|
238
164
|
if (this.state.isOpen && (prevState.isOpen !== this.state.isOpen || prevState.value.length !== this.state.value.length)) {
|
|
239
|
-
|
|
165
|
+
const thisPopupRect = (_b = this.containerRef.current.querySelector(`.select-multi-popup`)) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
240
166
|
if (thisPopupRect) {
|
|
241
|
-
|
|
167
|
+
let style;
|
|
242
168
|
if (prevState.isOpen !== this.state.isOpen && thisPopupRect.right > document.body.offsetWidth) {
|
|
243
169
|
style = {
|
|
244
170
|
top: this.state.offset.y + this.state.offset.height + 2 + 'px',
|
|
245
171
|
right: document.body.offsetWidth - this.state.offset.right + 'px'
|
|
246
172
|
};
|
|
247
173
|
}
|
|
248
|
-
|
|
249
|
-
|
|
174
|
+
let _bottom = thisPopupRect.bottom - 8;
|
|
175
|
+
const thisContainerRect = (_c = this.containerRef.current) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect();
|
|
250
176
|
if (thisContainerRect) {
|
|
251
177
|
if (prevState.value.length !== this.state.value.length) {
|
|
252
178
|
_bottom = thisContainerRect.bottom + 2 + thisPopupRect.height;
|
|
253
|
-
style =
|
|
179
|
+
style = Object.assign(Object.assign({}, (style !== null && style !== void 0 ? style : {})), { top: `${thisContainerRect.bottom + 2}px` });
|
|
254
180
|
}
|
|
255
181
|
if (_bottom > document.body.offsetHeight) {
|
|
256
|
-
style =
|
|
182
|
+
style = Object.assign(Object.assign({}, (style !== null && style !== void 0 ? style : {})), { top: `${thisContainerRect.y - 2 - thisPopupRect.height}px` });
|
|
257
183
|
}
|
|
258
184
|
}
|
|
259
185
|
if (style) {
|
|
260
|
-
(_d = style.left) !== null && _d !== void 0 ? _d : (style.left = style.right ? undefined :
|
|
261
|
-
(_e = style.width) !== null && _e !== void 0 ? _e : (style.width =
|
|
262
|
-
this.setState(
|
|
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 }));
|
|
263
189
|
}
|
|
264
190
|
}
|
|
265
191
|
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
var _this = this;
|
|
192
|
+
}
|
|
193
|
+
render() {
|
|
269
194
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
270
|
-
|
|
271
|
-
return react_1.default.createElement("div", { id: this.props.id, ref: this.containerRef, className:
|
|
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: () => {
|
|
272
197
|
var _a, _b;
|
|
273
|
-
if (!
|
|
274
|
-
|
|
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() }));
|
|
275
200
|
} },
|
|
276
201
|
react_1.default.createElement("div", { className: 'row', style: { flexWrap: 'wrap', flex: 1, width: '100%', gap: '0.6rem 0.4rem' } },
|
|
277
|
-
this.state.value.map(
|
|
278
|
-
|
|
279
|
-
return react_1.default.createElement("div", { key: item, className:
|
|
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) },
|
|
280
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),
|
|
281
206
|
react_1.default.createElement(winicon_1.Winicon, { src: "outline/user interface/e-remove", size: '1.2rem' }));
|
|
282
207
|
}),
|
|
283
|
-
(!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:
|
|
284
|
-
if (
|
|
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)
|
|
285
210
|
ev.target.focus();
|
|
286
211
|
} })),
|
|
287
|
-
this.props.showClearValueButton && this.state.value.length ? react_1.default.createElement("button", { type: 'button', className: 'row', style: { padding: '0.4rem' }, onClick:
|
|
212
|
+
this.props.showClearValueButton && this.state.value.length ? react_1.default.createElement("button", { type: 'button', className: 'row', style: { padding: '0.4rem' }, onClick: (ev) => {
|
|
288
213
|
ev.stopPropagation();
|
|
289
|
-
if (
|
|
290
|
-
|
|
214
|
+
if (this.state.value.length)
|
|
215
|
+
this.setState(Object.assign(Object.assign({}, this.state), { isOpen: true, value: [] }));
|
|
291
216
|
} },
|
|
292
|
-
react_1.default.createElement(winicon_1.Winicon, { src: "outline/user interface/c-remove", size: '1.6rem' })) : react_1.default.createElement("div", { ref:
|
|
217
|
+
react_1.default.createElement(winicon_1.Winicon, { src: "outline/user interface/c-remove", size: '1.6rem' })) : react_1.default.createElement("div", { ref: iconRef => {
|
|
293
218
|
if ((iconRef === null || iconRef === void 0 ? void 0 : iconRef.parentElement) && iconRef.parentElement.getBoundingClientRect().width < 100)
|
|
294
219
|
iconRef.style.display = "none";
|
|
295
220
|
}, className: 'row' },
|
|
296
221
|
react_1.default.createElement(winicon_1.Winicon, { src: this.state.isOpen ? "fill/arrows/up-arrow" : "fill/arrows/down-arrow", size: '1.2rem' })),
|
|
297
|
-
this.state.isOpen && react_1.default.createElement(popup_1.PopupOverlay, { className:
|
|
298
|
-
if (ev.target !==
|
|
299
|
-
|
|
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 }));
|
|
300
225
|
} },
|
|
301
|
-
react_1.default.createElement("div", { className:
|
|
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 : {
|
|
302
227
|
top: this.state.offset.y + this.state.offset.height + 2 + 'px',
|
|
303
228
|
left: this.state.offset.x + 'px',
|
|
304
229
|
width: this.state.offset.width,
|
|
305
230
|
} },
|
|
306
|
-
react_1.default.createElement("div", { style: { padding: '1.2rem 1.6rem', width: '100%', borderBottom: "var(--neutral-main-border)" } }, (
|
|
231
|
+
react_1.default.createElement("div", { style: { padding: '1.2rem 1.6rem', width: '100%', borderBottom: "var(--neutral-main-border)" } }, (() => {
|
|
307
232
|
var _a, _b;
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
return react_1.default.createElement(text_1.Text, { onClick:
|
|
311
|
-
|
|
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 = [];
|
|
312
237
|
if (_list.length) {
|
|
313
238
|
if (isSelectedAll) {
|
|
314
|
-
newValue =
|
|
239
|
+
newValue = this.state.value.filter(vl => _list.every(item => vl !== item.id || item.disabled));
|
|
315
240
|
}
|
|
316
241
|
else {
|
|
317
|
-
newValue =
|
|
242
|
+
newValue = [...this.state.value, ..._list.filter(item => this.state.value.every(vl => vl !== item.id) && !item.disabled).map(e => e.id)];
|
|
318
243
|
}
|
|
319
244
|
}
|
|
320
|
-
|
|
321
|
-
if (
|
|
322
|
-
|
|
323
|
-
}, className: 'button-text-3', style: { color: _list.length ? 'var(--infor-main-color)' : 'var(--neutral-text-title-color)' } }, _list.length && isSelectedAll ?
|
|
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 ? 'var(--infor-main-color)' : 'var(--neutral-text-title-color)' } }, _list.length && isSelectedAll ? `${t("remove")} ${t("all").toLowerCase()}` : `${t("select")} ${t("all").toLowerCase()}`);
|
|
324
249
|
})()),
|
|
325
|
-
react_1.default.createElement("div", { className:
|
|
326
|
-
if (
|
|
327
|
-
|
|
328
|
-
|
|
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);
|
|
329
254
|
}
|
|
330
255
|
} : undefined },
|
|
331
|
-
((_g = this.state.search) !== null && _g !== void 0 ? _g : this.state.options).filter(
|
|
256
|
+
((_g = this.state.search) !== null && _g !== void 0 ? _g : this.state.options).filter(e => !e.parentId).map(item => this.renderOptions(item)),
|
|
332
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")))))));
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
}(react_1.default.Component));
|
|
258
|
+
}
|
|
259
|
+
}
|
|
336
260
|
exports.SelectMultiple = (0, react_i18next_1.withTranslation)()(TSelectMultiple);
|
|
@@ -1,30 +1,4 @@
|
|
|
1
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
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
29
3
|
if (k2 === undefined) k2 = k;
|
|
30
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -58,69 +32,56 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
58
32
|
return result;
|
|
59
33
|
};
|
|
60
34
|
})();
|
|
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
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
71
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
72
37
|
};
|
|
73
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
74
39
|
exports.InputOtp = void 0;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
_this.getValue = function () {
|
|
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 = () => {
|
|
83
47
|
var _a;
|
|
84
|
-
if (
|
|
85
|
-
return
|
|
48
|
+
if (this.containerRef.current)
|
|
49
|
+
return [...this.containerRef.current.querySelectorAll("input")].map(v => v.value).join("");
|
|
86
50
|
else
|
|
87
|
-
return (_a =
|
|
51
|
+
return (_a = this.props.value) !== null && _a !== void 0 ? _a : "";
|
|
88
52
|
};
|
|
89
|
-
|
|
90
|
-
return _this;
|
|
53
|
+
this.getValue = this.getValue.bind(this);
|
|
91
54
|
}
|
|
92
|
-
|
|
55
|
+
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
93
56
|
var _a;
|
|
94
57
|
if (prevProps.value !== this.props.value && this.containerRef.current) {
|
|
95
|
-
|
|
58
|
+
const inputList = [...this.containerRef.current.querySelectorAll("input")];
|
|
96
59
|
if ((_a = this.props.value) === null || _a === void 0 ? void 0 : _a.length) {
|
|
97
|
-
for (
|
|
60
|
+
for (let i = 0; i < inputList.length; i++)
|
|
98
61
|
inputList[i].value = this.props.value[i];
|
|
99
62
|
}
|
|
100
63
|
else {
|
|
101
|
-
for (
|
|
64
|
+
for (let i = 0; i < inputList.length; i++)
|
|
102
65
|
inputList[i].value = "";
|
|
103
66
|
}
|
|
104
67
|
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
var _this = this;
|
|
68
|
+
}
|
|
69
|
+
render() {
|
|
108
70
|
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 ?
|
|
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) => {
|
|
110
72
|
ev.stopPropagation();
|
|
111
73
|
ev.preventDefault();
|
|
112
|
-
|
|
113
|
-
for (
|
|
114
|
-
var _b = _a[_i], index = _b[0], input = _b[1];
|
|
74
|
+
const inputList = [...ev.target.closest("div").childNodes];
|
|
75
|
+
for (const [index, input] of inputList.entries()) {
|
|
115
76
|
if (!input.value.length || index === (inputList.length - 1)) {
|
|
116
77
|
input.focus();
|
|
117
78
|
break;
|
|
118
79
|
}
|
|
119
80
|
continue;
|
|
120
81
|
}
|
|
121
|
-
} }, Array.from({ length: (_e = this.props.length) !== null && _e !== void 0 ? _e : 6 }).map(
|
|
82
|
+
} }, Array.from({ length: (_e = this.props.length) !== null && _e !== void 0 ? _e : 6 }).map((_, i) => react_1.default.createElement("input", { key: "opt-" + i, disabled: this.props.disabled, style: this.props.inputStyle, onKeyDown: (ev) => {
|
|
122
83
|
var _a, _b;
|
|
123
|
-
|
|
84
|
+
const key = ev.key.toLowerCase();
|
|
124
85
|
switch (key) {
|
|
125
86
|
case "backspace":
|
|
126
87
|
if (ev.target.value.length)
|
|
@@ -136,7 +97,7 @@ var InputOtp = /** @class */ (function (_super) {
|
|
|
136
97
|
default:
|
|
137
98
|
ev.preventDefault();
|
|
138
99
|
ev.stopPropagation();
|
|
139
|
-
|
|
100
|
+
const numberCheck = /[0-9]/g;
|
|
140
101
|
if (numberCheck.test(key)) {
|
|
141
102
|
if (!ev.target.value.length)
|
|
142
103
|
ev.target.value = key;
|
|
@@ -147,11 +108,10 @@ var InputOtp = /** @class */ (function (_super) {
|
|
|
147
108
|
}
|
|
148
109
|
break;
|
|
149
110
|
}
|
|
150
|
-
}, onBlur:
|
|
151
|
-
if (
|
|
152
|
-
|
|
153
|
-
} })
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
}(react_1.default.Component));
|
|
111
|
+
}, onBlur: () => {
|
|
112
|
+
if (this.props.onChange)
|
|
113
|
+
this.props.onChange(this.getValue(), this.containerRef.current);
|
|
114
|
+
} })));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
157
117
|
exports.InputOtp = InputOtp;
|