wini-web-components 2.5.9 → 2.6.1

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.
Files changed (34) hide show
  1. package/dist/component/button/button.js +9 -29
  2. package/dist/component/calendar/calendar.js +140 -173
  3. package/dist/component/checkbox/checkbox.js +26 -56
  4. package/dist/component/ck-editor/ckeditor.js +18 -29
  5. package/dist/component/component-status.js +6 -6
  6. package/dist/component/date-picker/date-picker.js +141 -174
  7. package/dist/component/dialog/dialog.js +37 -67
  8. package/dist/component/import-file/import-file.js +67 -106
  9. package/dist/component/infinite-scroll/infinite-scroll.js +17 -83
  10. package/dist/component/input-multi-select/input-multi-select.js +102 -178
  11. package/dist/component/input-otp/input-otp.js +29 -69
  12. package/dist/component/number-picker/number-picker.js +21 -33
  13. package/dist/component/pagination/pagination.js +19 -22
  14. package/dist/component/popup/popup.d.ts +2 -1
  15. package/dist/component/popup/popup.js +44 -70
  16. package/dist/component/progress-bar/progress-bar.js +12 -24
  17. package/dist/component/progress-circle/progress-circle.js +8 -19
  18. package/dist/component/radio-button/radio-button.js +11 -42
  19. package/dist/component/rating/rating.js +29 -48
  20. package/dist/component/select1/select1.js +91 -160
  21. package/dist/component/slider/slider.js +36 -54
  22. package/dist/component/switch/switch.js +22 -52
  23. package/dist/component/table/table.js +36 -89
  24. package/dist/component/tag/tag.js +8 -28
  25. package/dist/component/text/text.js +9 -40
  26. package/dist/component/text-area/text-area.js +12 -41
  27. package/dist/component/text-field/text-field.js +17 -47
  28. package/dist/component/toast-noti/toast-noti.js +7 -10
  29. package/dist/component/wini-icon/winicon.js +55 -113
  30. package/dist/form/login/view.js +28 -28
  31. package/dist/index.js +1 -1
  32. package/dist/index.js.LICENSE.txt +1 -11
  33. package/dist/language/i18n.js +4 -4
  34. 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);
@@ -63,77 +37,73 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
63
37
  };
64
38
  Object.defineProperty(exports, "__esModule", { value: true });
65
39
  exports.showDialog = exports.Dialog = exports.DialogAlignment = void 0;
66
- var react_1 = __importStar(require("react"));
67
- var react_dom_1 = __importDefault(require("react-dom"));
68
- var dialog_module_css_1 = __importDefault(require("./dialog.module.css"));
69
- var index_1 = require("../../index");
70
- var react_i18next_1 = require("react-i18next");
40
+ const react_1 = __importStar(require("react"));
41
+ const react_dom_1 = __importDefault(require("react-dom"));
42
+ const dialog_module_css_1 = __importDefault(require("./dialog.module.css"));
43
+ const index_1 = require("../../index");
44
+ const react_i18next_1 = require("react-i18next");
71
45
  var DialogAlignment;
72
46
  (function (DialogAlignment) {
73
47
  DialogAlignment["start"] = "start";
74
48
  DialogAlignment["center"] = "center";
75
49
  DialogAlignment["end"] = "end";
76
50
  })(DialogAlignment || (exports.DialogAlignment = DialogAlignment = {}));
77
- var TDialog = /** @class */ (function (_super) {
78
- __extends(TDialog, _super);
79
- function TDialog(props) {
80
- var _this = _super.call(this, props) || this;
81
- _this.state = {
51
+ class TDialog extends react_1.default.Component {
52
+ constructor(props) {
53
+ super(props);
54
+ this.state = {
82
55
  open: false,
83
56
  title: '',
84
57
  status: index_1.ComponentStatus.INFOR,
85
58
  content: '',
86
- onSubmit: function () { }
59
+ onSubmit: () => { }
87
60
  };
88
- return _this;
89
61
  }
90
- TDialog.prototype.showDialogNoti = function (data) {
91
- this.setState(__assign({ open: true }, data));
92
- };
93
- TDialog.prototype.closeDialog = function () {
62
+ showDialogNoti(data) {
63
+ this.setState(Object.assign({ open: true }, data));
64
+ }
65
+ closeDialog() {
94
66
  this.setState({ open: false });
95
- };
96
- TDialog.prototype.render = function () {
97
- var _this = this;
67
+ }
68
+ render() {
98
69
  var _a, _b;
99
- var t = this.props.t;
70
+ const { t } = this.props;
100
71
  return (react_1.default.createElement(react_1.default.Fragment, null, this.state.open &&
101
72
  react_dom_1.default.createPortal(react_1.default.createElement("div", { className: dialog_module_css_1.default['dialog-overlay'] },
102
- react_1.default.createElement("div", { className: "".concat(dialog_module_css_1.default['dialog-container'], " col"), style: { width: '41.4rem', alignItems: this.state.alignment }, "dialog-type": this.state.status, onClick: function (e) { return e.stopPropagation(); } },
103
- react_1.default.createElement("div", { className: "".concat(dialog_module_css_1.default['dialog-body'], " col"), style: { alignItems: 'inherit' } },
104
- react_1.default.createElement("div", { className: "".concat(dialog_module_css_1.default['dialog-status'], " row") }, (0, index_1.getStatusIcon)(this.state.status)),
73
+ react_1.default.createElement("div", { className: `${dialog_module_css_1.default['dialog-container']} col`, style: { width: '41.4rem', alignItems: this.state.alignment }, "dialog-type": this.state.status, onClick: e => e.stopPropagation() },
74
+ react_1.default.createElement("div", { className: `${dialog_module_css_1.default['dialog-body']} col`, style: { alignItems: 'inherit' } },
75
+ react_1.default.createElement("div", { className: `${dialog_module_css_1.default['dialog-status']} row` }, (0, index_1.getStatusIcon)(this.state.status)),
105
76
  react_1.default.createElement("div", { className: 'col' },
106
77
  react_1.default.createElement(index_1.Text, { className: 'heading-6', style: { textAlign: this.state.alignment === DialogAlignment.center ? 'center' : 'start' } }, this.state.title),
107
78
  react_1.default.createElement(index_1.Text, { className: 'body-3', style: { textAlign: this.state.alignment === DialogAlignment.center ? 'center' : 'start' } }, this.state.content))),
108
- react_1.default.createElement("div", { className: "".concat(dialog_module_css_1.default['dialog-footer'], " row") },
109
- react_1.default.createElement("button", { type: 'button', style: this.state.alignment === DialogAlignment.center ? { flex: 1, width: '100%' } : undefined, onClick: function () {
110
- if (_this.state.onCancel)
111
- _this.state.onCancel();
112
- _this.setState({ open: false });
113
- }, className: "".concat(dialog_module_css_1.default['dialog-action'], " row") },
79
+ react_1.default.createElement("div", { className: `${dialog_module_css_1.default['dialog-footer']} row` },
80
+ react_1.default.createElement("button", { type: 'button', style: this.state.alignment === DialogAlignment.center ? { flex: 1, width: '100%' } : undefined, onClick: () => {
81
+ if (this.state.onCancel)
82
+ this.state.onCancel();
83
+ this.setState({ open: false });
84
+ }, className: `${dialog_module_css_1.default['dialog-action']} row` },
114
85
  react_1.default.createElement(index_1.Text, { className: 'button-text-3' }, (_a = this.state.cancelTitle) !== null && _a !== void 0 ? _a : t("cancel"))),
115
- react_1.default.createElement("button", { type: 'button', style: this.state.alignment === DialogAlignment.center ? { flex: 1, width: '100%' } : undefined, onClick: function () {
116
- _this.state.onSubmit();
117
- _this.setState({ open: false });
118
- }, className: "".concat(dialog_module_css_1.default['dialog-action'], " row ").concat(dialog_module_css_1.default['dialog-submit']) },
86
+ react_1.default.createElement("button", { type: 'button', style: this.state.alignment === DialogAlignment.center ? { flex: 1, width: '100%' } : undefined, onClick: () => {
87
+ this.state.onSubmit();
88
+ this.setState({ open: false });
89
+ }, className: `${dialog_module_css_1.default['dialog-action']} row ${dialog_module_css_1.default['dialog-submit']}` },
119
90
  react_1.default.createElement(index_1.Text, { className: 'button-text-3' }, (_b = this.state.submitTitle) !== null && _b !== void 0 ? _b : t('submit')))))), document.body)));
120
- };
121
- return TDialog;
122
- }(react_1.default.Component));
123
- var dialogRef = (0, react_1.createRef)();
124
- var Dialog = function () {
125
- var _a = (0, react_i18next_1.useTranslation)(), t = _a.t, i18n = _a.i18n;
91
+ }
92
+ }
93
+ const dialogRef = (0, react_1.createRef)();
94
+ const Dialog = () => {
95
+ const { t, i18n } = (0, react_i18next_1.useTranslation)();
126
96
  return react_1.default.createElement(TDialog, { ref: dialogRef, t: t, i18n: i18n, tReady: true });
127
97
  };
128
98
  exports.Dialog = Dialog;
129
- var showDialog = function (props) {
99
+ const showDialog = (props) => {
130
100
  var _a, _b, _c, _d;
131
101
  if (dialogRef.current)
132
102
  dialogRef.current.showDialogNoti({
133
103
  title: (_a = props.title) !== null && _a !== void 0 ? _a : '',
134
104
  status: (_b = props.status) !== null && _b !== void 0 ? _b : index_1.ComponentStatus.INFOR,
135
105
  content: (_c = props.content) !== null && _c !== void 0 ? _c : '',
136
- onSubmit: (_d = props.onSubmit) !== null && _d !== void 0 ? _d : (function () { }),
106
+ onSubmit: (_d = props.onSubmit) !== null && _d !== void 0 ? _d : (() => { }),
137
107
  onCancel: props.onCancel,
138
108
  submitTitle: props.submitTitle,
139
109
  cancelTitle: props.cancelTitle,
@@ -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,133 +32,120 @@ 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.ImportFile = void 0;
75
- var react_1 = __importStar(require("react"));
76
- var import_file_module_css_1 = __importDefault(require("./import-file.module.css"));
77
- var index_1 = require("../../index");
78
- var react_i18next_1 = require("react-i18next");
79
- var cloudSvg = (react_1.default.createElement("svg", { width: '100%', height: '100%', style: { width: '3rem', height: '3rem' }, viewBox: '0 0 36 36', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' },
40
+ const react_1 = __importStar(require("react"));
41
+ const import_file_module_css_1 = __importDefault(require("./import-file.module.css"));
42
+ const index_1 = require("../../index");
43
+ const react_i18next_1 = require("react-i18next");
44
+ const cloudSvg = (react_1.default.createElement("svg", { width: '100%', height: '100%', style: { width: '3rem', height: '3rem' }, viewBox: '0 0 36 36', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' },
80
45
  react_1.default.createElement("path", { d: 'M22.5312 6.51941C20.3258 6.12929 18.0555 6.35518 15.9702 7.1722C13.8849 7.98923 12.0654 9.36573 10.712 11.1502C9.53042 12.7081 8.74407 14.5243 8.41412 16.4432C6.99557 16.9154 5.7486 17.8144 4.85059 19.0274C3.77621 20.4786 3.27749 22.2764 3.45068 24.0737C3.62388 25.871 4.45672 27.5405 5.78845 28.7599C7.12018 29.9792 8.85639 30.6621 10.662 30.6766H13.1063C13.7786 30.6766 14.3236 30.1316 14.3236 29.4594C14.3236 28.7871 13.7786 28.2421 13.1063 28.2421H10.6769C9.47485 28.2313 8.31921 27.7762 7.43253 26.9643C6.54471 26.1514 5.98948 25.0384 5.87402 23.8402C5.75855 22.642 6.09103 21.4435 6.80729 20.476C7.52354 19.5085 8.57279 18.8406 9.75252 18.6013C10.2753 18.4952 10.6682 18.061 10.7216 17.5303C10.9012 15.7476 11.5691 14.049 12.6518 12.6214C13.7345 11.1938 15.1901 10.0926 16.8583 9.43899C18.5266 8.78536 20.3428 8.60466 22.1071 8.91675C23.8715 9.22884 25.5155 10.0216 26.8583 11.2079C28.2011 12.3941 29.1905 13.9278 29.7178 15.6402C30.2451 17.3526 30.2898 19.1772 29.8469 20.9134C29.404 22.6495 28.4907 24.2297 27.2075 25.4802C25.9244 26.7308 24.3211 27.603 22.5742 28.001C21.9187 28.1504 21.5084 28.8028 21.6577 29.4583C21.807 30.1138 22.4595 30.5241 23.115 30.3748C25.2987 29.8772 27.3028 28.7869 28.9067 27.2238C30.5107 25.6606 31.6523 23.6853 32.2059 21.5152C32.7595 19.345 32.7037 17.0642 32.0446 14.9237C31.3855 12.7833 30.1486 10.8661 28.4701 9.38333C26.7916 7.90052 24.7366 6.90953 22.5312 6.51941Z', style: { fill: "var(--primary-main-color)" } }),
81
46
  react_1.default.createElement("path", { d: 'M17.1146 17.6431C17.2313 17.5264 17.3658 17.4384 17.5094 17.379C17.6513 17.3201 17.8067 17.2874 17.9697 17.2866L17.9753 17.2866L17.9809 17.2866C18.2906 17.288 18.5998 17.4069 18.8361 17.6431L23.7052 22.5123C24.1806 22.9876 24.1806 23.7584 23.7052 24.2338C23.2298 24.7091 22.4591 24.7091 21.9837 24.2338L19.1926 21.4427V29.4594C19.1926 30.1317 18.6476 30.6767 17.9753 30.6767C17.303 30.6767 16.758 30.1317 16.758 29.4594V21.4427L13.9669 24.2338C13.4916 24.7091 12.7208 24.7091 12.2455 24.2338C11.7701 23.7584 11.7701 22.9876 12.2455 22.5123L17.1146 17.6431Z', style: { fill: "var(--primary-main-color)" } })));
82
- var fileSvg = (react_1.default.createElement("svg", { className: import_file_module_css_1.default['preview-icon'], width: '100%', height: '100%', style: { width: '3rem', height: '3rem' }, viewBox: '0 0 36 36', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' },
47
+ const fileSvg = (react_1.default.createElement("svg", { className: import_file_module_css_1.default['preview-icon'], width: '100%', height: '100%', style: { width: '3rem', height: '3rem' }, viewBox: '0 0 36 36', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' },
83
48
  react_1.default.createElement("path", { d: 'M20.9163 3.41669H7.54829C7.22597 3.41669 6.91686 3.54472 6.68895 3.77263C6.46105 4.00054 6.33301 4.30965 6.33301 4.63196V31.3681C6.33301 31.6904 6.46105 31.9995 6.68895 32.2274C6.91686 32.4553 7.22597 32.5834 7.54829 32.5834H29.4233C29.7456 32.5834 30.0547 32.4553 30.2826 32.2274C30.5105 31.9995 30.6386 31.6904 30.6386 31.3681V13.1389H22.1316C21.8093 13.1389 21.5002 13.0109 21.2723 12.783C21.0444 12.5551 20.9163 12.2459 20.9163 11.9236V3.41669Z', style: { fill: "var(--primary-main-color)" } }),
84
49
  react_1.default.createElement("path", { d: 'M29.9264 10.7084H23.3469V4.12884L29.9264 10.7084Z', style: { fill: "var(--primary-main-color)" } })));
85
- var closeSvg = (react_1.default.createElement("svg", { width: '100%', height: '100%', style: { width: '2.4rem', height: '2.4rem' }, fill: 'none', xmlns: 'http://www.w3.org/2000/svg' },
50
+ const closeSvg = (react_1.default.createElement("svg", { width: '100%', height: '100%', style: { width: '2.4rem', height: '2.4rem' }, fill: 'none', xmlns: 'http://www.w3.org/2000/svg' },
86
51
  react_1.default.createElement("path", { d: 'M13.4144 12.0002L20.4144 5.00015L19.0002 3.58594L12.0002 10.5859L5.00015 3.58594L3.58594 5.00015L10.5859 12.0002L3.58594 19.0002L5.00015 20.4144L12.0002 13.4144L19.0002 20.4144L20.4144 19.0002L13.4144 12.0002Z', style: { fill: "var(--error-main-color)" } })));
87
- var formatFileSize = function (bytes, decimalPoint) {
52
+ const formatFileSize = (bytes, decimalPoint) => {
88
53
  if (bytes == 0)
89
54
  return '0 Bytes';
90
55
  var k = 1000, dm = decimalPoint || 2, sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], i = Math.floor(Math.log(bytes) / Math.log(k));
91
56
  return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
92
57
  };
93
- var TImportFile = /** @class */ (function (_super) {
94
- __extends(TImportFile, _super);
95
- function TImportFile(props) {
96
- var _this = _super.call(this, props) || this;
97
- _this.fileRef = (0, react_1.createRef)();
98
- _this.state = {
99
- preview: _this.props.value ? Array.isArray(_this.props.value) ? _this.props.value : [_this.props.value] : undefined
58
+ class TImportFile extends react_1.default.Component {
59
+ constructor(props) {
60
+ super(props);
61
+ this.fileRef = (0, react_1.createRef)();
62
+ this.state = {
63
+ preview: this.props.value ? Array.isArray(this.props.value) ? this.props.value : [this.props.value] : undefined
100
64
  };
101
- return _this;
102
65
  }
103
- TImportFile.prototype.showFilePicker = function () {
66
+ showFilePicker() {
104
67
  var _a;
105
68
  (_a = this.fileRef.current) === null || _a === void 0 ? void 0 : _a.click();
106
- };
107
- TImportFile.prototype.componentDidUpdate = function (prevProps, prevState) {
69
+ }
70
+ componentDidUpdate(prevProps, prevState) {
108
71
  if (prevProps.value !== this.props.value || prevProps.status !== this.props.status) {
109
- this.setState(__assign(__assign({}, this.state), { status: this.props.status, preview: this.props.value ? Array.isArray(this.props.value) ? this.props.value : [this.props.value] : undefined }));
72
+ this.setState(Object.assign(Object.assign({}, this.state), { status: this.props.status, preview: this.props.value ? Array.isArray(this.props.value) ? this.props.value : [this.props.value] : undefined }));
110
73
  }
111
- };
112
- TImportFile.prototype.render = function () {
113
- var _this = this;
74
+ }
75
+ render() {
114
76
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
115
- var t = this.props.t;
116
- var sizeTitle;
77
+ const { t } = this.props;
78
+ let sizeTitle;
117
79
  if (this.props.maxSize)
118
80
  sizeTitle = formatFileSize(this.props.maxSize);
119
- var _style = this.state.preview ? ((_a = this.props.style) !== null && _a !== void 0 ? _a : {}) : __assign({ cursor: 'pointer' }, ((_b = this.props.style) !== null && _b !== void 0 ? _b : {}));
120
- return react_1.default.createElement("div", { id: this.props.id, className: "".concat(import_file_module_css_1.default['import-file-container'], " ").concat((_c = this.props.className) !== null && _c !== void 0 ? _c : 'row', " ").concat(this.props.buttonOnly ? import_file_module_css_1.default['button-only'] : '', " ").concat(((_d = this.props.helperText) === null || _d === void 0 ? void 0 : _d.length) ? import_file_module_css_1.default['helper-text'] : ""), style: __assign({ '--helper-text-color': (_e = this.props.helperTextColor) !== null && _e !== void 0 ? _e : '#e14337' }, _style), "helper-text": this.props.helperText, onClick: function () {
121
- if (!_this.state.preview && !_this.props.buttonOnly)
122
- _this.showFilePicker();
81
+ let _style = this.state.preview ? ((_a = this.props.style) !== null && _a !== void 0 ? _a : {}) : Object.assign({ cursor: 'pointer' }, ((_b = this.props.style) !== null && _b !== void 0 ? _b : {}));
82
+ return react_1.default.createElement("div", { id: this.props.id, className: `${import_file_module_css_1.default['import-file-container']} ${(_c = this.props.className) !== null && _c !== void 0 ? _c : 'row'} ${this.props.buttonOnly ? import_file_module_css_1.default['button-only'] : ''} ${((_d = this.props.helperText) === null || _d === void 0 ? void 0 : _d.length) ? import_file_module_css_1.default['helper-text'] : ""}`, style: Object.assign({ '--helper-text-color': (_e = this.props.helperTextColor) !== null && _e !== void 0 ? _e : '#e14337' }, _style), "helper-text": this.props.helperText, onClick: () => {
83
+ if (!this.state.preview && !this.props.buttonOnly)
84
+ this.showFilePicker();
123
85
  } },
124
- react_1.default.createElement("input", { disabled: this.props.disabled, type: 'file', multiple: this.props.multiple, accept: ((_f = this.props.allowType) !== null && _f !== void 0 ? _f : []).join(','), ref: this.fileRef, onChange: function (ev) {
86
+ react_1.default.createElement("input", { disabled: this.props.disabled, type: 'file', multiple: this.props.multiple, accept: ((_f = this.props.allowType) !== null && _f !== void 0 ? _f : []).join(','), ref: this.fileRef, onChange: (ev) => {
125
87
  var _a, _b, _c, _d;
126
- var files;
88
+ let files;
127
89
  if ((_a = ev.target.files) === null || _a === void 0 ? void 0 : _a.length) {
128
- files = __spreadArray([], ev.target.files, true);
129
- if (_this.props.maxSize) {
130
- if (files.some(function (f) { return (f.size > (_this.props.maxSize * 1024)); })) {
131
- index_1.ToastMessage.errors(t("limitFileError", { name: (_b = files.find(function (f) { return (f.size > (_this.props.maxSize * 1024)); })) === null || _b === void 0 ? void 0 : _b.name, sizeTitle: sizeTitle }));
132
- files = files.filter(function (f) { return (f.size <= (_this.props.maxSize * 1024)); });
90
+ files = [...ev.target.files];
91
+ if (this.props.maxSize) {
92
+ if (files.some(f => (f.size > (this.props.maxSize * 1024)))) {
93
+ index_1.ToastMessage.errors(t("limitFileError", { name: (_b = files.find(f => (f.size > (this.props.maxSize * 1024)))) === null || _b === void 0 ? void 0 : _b.name, sizeTitle: sizeTitle }));
94
+ files = files.filter(f => (f.size <= (this.props.maxSize * 1024)));
133
95
  }
134
96
  }
135
97
  }
136
98
  if (files) {
137
- if (_this.props.multiple) {
138
- var newValue = (_d = (_c = _this.state.preview) === null || _c === void 0 ? void 0 : _c.filter(function (e) { return files.every(function (f) { return e.name !== f.name && e.size !== f.size && e.lastModified !== f.lastModified; }); })) !== null && _d !== void 0 ? _d : [];
139
- _this.setState(__assign(__assign({}, _this.state), { preview: __spreadArray(__spreadArray([], newValue, true), files, true) }));
140
- if (_this.props.onChange)
141
- _this.props.onChange(__spreadArray(__spreadArray([], newValue, true), files, true));
99
+ if (this.props.multiple) {
100
+ const newValue = (_d = (_c = this.state.preview) === null || _c === void 0 ? void 0 : _c.filter(e => files.every(f => e.name !== f.name && e.size !== f.size && e.lastModified !== f.lastModified))) !== null && _d !== void 0 ? _d : [];
101
+ this.setState(Object.assign(Object.assign({}, this.state), { preview: [...newValue, ...files] }));
102
+ if (this.props.onChange)
103
+ this.props.onChange([...newValue, ...files]);
142
104
  }
143
105
  else {
144
- _this.setState(__assign(__assign({}, _this.state), { preview: files }));
145
- if (_this.props.onChange)
146
- _this.props.onChange(files);
106
+ this.setState(Object.assign(Object.assign({}, this.state), { preview: files }));
107
+ if (this.props.onChange)
108
+ this.props.onChange(files);
147
109
  }
148
110
  }
149
111
  } }),
150
112
  this.props.buttonOnly
151
113
  ? null
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) {
114
+ : 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(f => {
153
115
  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" }),
116
+ return react_1.default.createElement("div", { key: `${f.name}-${f.size}-${f.lastModified}`, className: 'row', style: Object.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 : {})) },
117
+ react_1.default.createElement(index_1.Winicon, { src: `outline/${((_b = f.type) === null || _b === void 0 ? void 0 : _b.includes('image')) ? "multimedia/image" : "files/file-export"}`, size: "1.4rem" }),
156
118
  react_1.default.createElement(index_1.Text, { className: 'subtitle-4', style: { flex: 1, width: "100%" }, maxLine: 1 }, f.name),
157
- react_1.default.createElement(index_1.Winicon, { src: 'fill/user interface/e-remove', size: "1.4rem", onClick: function () {
119
+ react_1.default.createElement(index_1.Winicon, { src: 'fill/user interface/e-remove', size: "1.4rem", onClick: () => {
158
120
  var _a;
159
- var newValue = (_a = _this.state.preview) === null || _a === void 0 ? void 0 : _a.filter(function (e) { return e.name !== f.name && e.size !== f.size && e.lastModified !== f.lastModified; });
160
- _this.setState(__assign(__assign({}, _this.state), { preview: newValue }));
161
- if (_this.props.onChange)
162
- _this.props.onChange(newValue);
121
+ const newValue = (_a = this.state.preview) === null || _a === void 0 ? void 0 : _a.filter(e => e.name !== f.name && e.size !== f.size && e.lastModified !== f.lastModified);
122
+ this.setState(Object.assign(Object.assign({}, this.state), { preview: newValue }));
123
+ if (this.props.onChange)
124
+ this.props.onChange(newValue);
163
125
  }, color: '#E14337' }));
164
126
  })) : react_1.default.createElement(react_1.default.Fragment, null,
165
- react_1.default.createElement("div", { className: "".concat(import_file_module_css_1.default['import-file-prefix'], " row") }, ((_h = this.state.preview) === null || _h === void 0 ? void 0 : _h.length) ? ((_j = this.state.preview[0].type) === null || _j === void 0 ? void 0 : _j.includes('image')) ? react_1.default.createElement("img", { src: this.state.preview[0] instanceof File ? URL.createObjectURL(this.state.preview[0]) : (_l = (_k = this.state.preview) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.url }) : fileSvg : cloudSvg),
166
- react_1.default.createElement("div", { className: "".concat(import_file_module_css_1.default['file-preview-content'], " col") },
167
- react_1.default.createElement(index_1.Text, { className: "".concat(import_file_module_css_1.default['title-file'], " heading-8"), style: { maxWidth: '100%' } }, (_p = (_o = (_m = this.state.preview) === null || _m === void 0 ? void 0 : _m[0]) === null || _o === void 0 ? void 0 : _o.name) !== null && _p !== void 0 ? _p : ((_q = this.props.label) !== null && _q !== void 0 ? _q : t("uploadFileAction"))),
168
- react_1.default.createElement(index_1.Text, { className: "".concat(import_file_module_css_1.default['subtitle-file'], " subtitle-3"), style: { maxWidth: '100%' } }, ((_s = (_r = this.state.preview) === null || _r === void 0 ? void 0 : _r[0]) === null || _s === void 0 ? void 0 : _s.size)
169
- ? "".concat((_t = this.state.preview) === null || _t === void 0 ? void 0 : _t[0].size, "KB")
127
+ react_1.default.createElement("div", { className: `${import_file_module_css_1.default['import-file-prefix']} row` }, ((_h = this.state.preview) === null || _h === void 0 ? void 0 : _h.length) ? ((_j = this.state.preview[0].type) === null || _j === void 0 ? void 0 : _j.includes('image')) ? react_1.default.createElement("img", { src: this.state.preview[0] instanceof File ? URL.createObjectURL(this.state.preview[0]) : (_l = (_k = this.state.preview) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.url }) : fileSvg : cloudSvg),
128
+ react_1.default.createElement("div", { className: `${import_file_module_css_1.default['file-preview-content']} col` },
129
+ react_1.default.createElement(index_1.Text, { className: `${import_file_module_css_1.default['title-file']} heading-8`, style: { maxWidth: '100%' } }, (_p = (_o = (_m = this.state.preview) === null || _m === void 0 ? void 0 : _m[0]) === null || _o === void 0 ? void 0 : _o.name) !== null && _p !== void 0 ? _p : ((_q = this.props.label) !== null && _q !== void 0 ? _q : t("uploadFileAction"))),
130
+ react_1.default.createElement(index_1.Text, { className: `${import_file_module_css_1.default['subtitle-file']} subtitle-3`, style: { maxWidth: '100%' } }, ((_s = (_r = this.state.preview) === null || _r === void 0 ? void 0 : _r[0]) === null || _s === void 0 ? void 0 : _s.size)
131
+ ? `${(_t = this.state.preview) === null || _t === void 0 ? void 0 : _t[0].size}KB`
170
132
  : ((_u = this.props.subTitle) !== null && _u !== void 0 ? _u : (sizeTitle ? t("limitFileWarning", { sizeTitle: sizeTitle }) : ''))))),
171
133
  ((_v = this.state.preview) === null || _v === void 0 ? void 0 : _v.length) && this.props.buttonOnly && !this.props.multiple ? react_1.default.createElement("div", { className: 'row', style: { gap: "0.4rem" } },
172
134
  react_1.default.createElement(index_1.Text, { className: 'button-text-6' }, (_x = (_w = this.state.preview) === null || _w === void 0 ? void 0 : _w[0].name) !== null && _x !== void 0 ? _x : ''),
173
- react_1.default.createElement("button", { type: 'button', className: "".concat(import_file_module_css_1.default['remove-preview-file']), onClick: function () {
174
- _this.setState(__assign(__assign({}, _this.state), { preview: undefined }));
175
- if (_this.props.onChange)
176
- _this.props.onChange(undefined);
135
+ react_1.default.createElement("button", { type: 'button', className: `${import_file_module_css_1.default['remove-preview-file']}`, onClick: () => {
136
+ this.setState(Object.assign(Object.assign({}, this.state), { preview: undefined }));
137
+ if (this.props.onChange)
138
+ this.props.onChange(undefined);
177
139
  } }, closeSvg))
178
- : react_1.default.createElement(index_1.Button, { label: ((_y = this.state.preview) === null || _y === void 0 ? void 0 : _y.length) ? this.props.multiple ? "".concat(t("add"), " ").concat(t("file").toLowerCase()) : "".concat(t("remove"), " ").concat(t("file").toLowerCase()) : "".concat(t("choose"), " ").concat(t("file").toLowerCase()), style: { padding: "1.2rem", backgroundColor: "var(--neutral-main-background-color)" }, className: 'button-text-4', onClick: function () {
179
- if (_this.state.preview && !_this.props.multiple) {
180
- _this.setState(__assign(__assign({}, _this.state), { preview: undefined }));
181
- if (_this.props.onChange)
182
- _this.props.onChange(undefined);
140
+ : react_1.default.createElement(index_1.Button, { label: ((_y = this.state.preview) === null || _y === void 0 ? void 0 : _y.length) ? this.props.multiple ? `${t("add")} ${t("file").toLowerCase()}` : `${t("remove")} ${t("file").toLowerCase()}` : `${t("choose")} ${t("file").toLowerCase()}`, style: { padding: "1.2rem", backgroundColor: "var(--neutral-main-background-color)" }, className: 'button-text-4', onClick: () => {
141
+ if (this.state.preview && !this.props.multiple) {
142
+ this.setState(Object.assign(Object.assign({}, this.state), { preview: undefined }));
143
+ if (this.props.onChange)
144
+ this.props.onChange(undefined);
183
145
  }
184
- else if (_this.props.buttonOnly || _this.state.preview)
185
- _this.showFilePicker();
146
+ else if (this.props.buttonOnly || this.state.preview)
147
+ this.showFilePicker();
186
148
  } }));
187
- };
188
- return TImportFile;
189
- }(react_1.default.Component));
149
+ }
150
+ }
190
151
  exports.ImportFile = (0, react_i18next_1.withTranslation)()(TImportFile);
@@ -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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -34,70 +8,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
34
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
35
9
  });
36
10
  };
37
- var __generator = (this && this.__generator) || function (thisArg, body) {
38
- 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);
39
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
40
- function verb(n) { return function (v) { return step([n, v]); }; }
41
- function step(op) {
42
- if (f) throw new TypeError("Generator is already executing.");
43
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
44
- 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;
45
- if (y = 0, t) op = [op[0] & 2, t.value];
46
- switch (op[0]) {
47
- case 0: case 1: t = op; break;
48
- case 4: _.label++; return { value: op[1], done: false };
49
- case 5: _.label++; y = op[1]; op = [0]; continue;
50
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
51
- default:
52
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
53
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
54
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
55
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
56
- if (t[2]) _.ops.pop();
57
- _.trys.pop(); continue;
58
- }
59
- op = body.call(thisArg, _);
60
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
61
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
62
- }
63
- };
64
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
65
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
66
13
  };
67
14
  Object.defineProperty(exports, "__esModule", { value: true });
68
15
  exports.InfiniteScroll = void 0;
69
- var react_1 = __importDefault(require("react"));
70
- var infinite_scroll_module_css_1 = __importDefault(require("./infinite-scroll.module.css"));
71
- var InfiniteScroll = /** @class */ (function (_super) {
72
- __extends(InfiniteScroll, _super);
73
- function InfiniteScroll() {
74
- var _this = _super !== null && _super.apply(this, arguments) || this;
75
- _this.state = {
16
+ const react_1 = __importDefault(require("react"));
17
+ const infinite_scroll_module_css_1 = __importDefault(require("./infinite-scroll.module.css"));
18
+ class InfiniteScroll extends react_1.default.Component {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.state = {
76
22
  loading: false
77
23
  };
78
- return _this;
79
24
  }
80
- InfiniteScroll.prototype.render = function () {
81
- var _this = this;
25
+ render() {
82
26
  var _a, _b;
83
- return react_1.default.createElement("div", { id: this.props.id, onScroll: function (ev) { return __awaiter(_this, void 0, void 0, function () {
84
- var scrollElement;
85
- return __generator(this, function (_a) {
86
- switch (_a.label) {
87
- case 0:
88
- if (!this.props.handleScroll) return [3 /*break*/, 2];
89
- this.setState(__assign(__assign({}, this.state), { loading: true }));
90
- scrollElement = ev.target;
91
- return [4 /*yield*/, this.props.handleScroll(Math.round(scrollElement.offsetHeight + scrollElement.scrollTop) >= (scrollElement.scrollHeight - 1), ev)];
92
- case 1:
93
- _a.sent();
94
- this.setState({ loading: false });
95
- _a.label = 2;
96
- case 2: return [2 /*return*/];
97
- }
98
- });
99
- }); }, className: "".concat(infinite_scroll_module_css_1.default['infinite-scroll'], " ").concat(this.state.loading ? infinite_scroll_module_css_1.default['loading'] : '', " ").concat((_a = this.props.className) !== null && _a !== void 0 ? _a : 'col'), style: (_b = this.props.style) !== null && _b !== void 0 ? _b : { 'overflow': 'hidden auto' } }, this.props.children);
100
- };
101
- return InfiniteScroll;
102
- }(react_1.default.Component));
27
+ return react_1.default.createElement("div", { id: this.props.id, onScroll: (ev) => __awaiter(this, void 0, void 0, function* () {
28
+ if (this.props.handleScroll) {
29
+ this.setState(Object.assign(Object.assign({}, this.state), { loading: true }));
30
+ let scrollElement = ev.target;
31
+ yield this.props.handleScroll(Math.round(scrollElement.offsetHeight + scrollElement.scrollTop) >= (scrollElement.scrollHeight - 1), ev);
32
+ this.setState({ loading: false });
33
+ }
34
+ }), className: `${infinite_scroll_module_css_1.default['infinite-scroll']} ${this.state.loading ? infinite_scroll_module_css_1.default['loading'] : ''} ${(_a = this.props.className) !== null && _a !== void 0 ? _a : 'col'}`, style: (_b = this.props.style) !== null && _b !== void 0 ? _b : { 'overflow': 'hidden auto' } }, this.props.children);
35
+ }
36
+ }
103
37
  exports.InfiniteScroll = InfiniteScroll;