wini-web-components 2.4.1 → 2.4.3

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.
@@ -84,6 +84,12 @@ var fileSvg = (react_1.default.createElement("svg", { className: import_file_mod
84
84
  react_1.default.createElement("path", { d: 'M29.9264 10.7084H23.3469V4.12884L29.9264 10.7084Z', style: { fill: "var(--primary-main-color)" } })));
85
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' },
86
86
  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) {
88
+ if (bytes == 0)
89
+ return '0 Bytes';
90
+ 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
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
92
+ };
87
93
  var TImportFile = /** @class */ (function (_super) {
88
94
  __extends(TImportFile, _super);
89
95
  function TImportFile(props) {
@@ -108,9 +114,8 @@ var TImportFile = /** @class */ (function (_super) {
108
114
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
109
115
  var t = this.props.t;
110
116
  var sizeTitle;
111
- if (this.props.maxSize) {
112
- sizeTitle = this.props.maxSize > Math.pow(1024, 3) ? "".concat(Math.round(this.props.maxSize / Math.pow(1024, 3)), "TB") : this.props.maxSize > Math.pow(1024, 2) ? "".concat(Math.round(this.props.maxSize / Math.pow(1024, 2)), "GB") : this.props.maxSize > 1024 ? "".concat(Math.round(this.props.maxSize / 1024), "MB") : "".concat(this.props.maxSize, "KB");
113
- }
117
+ if (this.props.maxSize)
118
+ sizeTitle = formatFileSize(this.props.maxSize);
114
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 : {}));
115
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 () {
116
121
  if (!_this.state.preview && !_this.props.buttonOnly)
@@ -146,7 +151,7 @@ var TImportFile = /** @class */ (function (_super) {
146
151
  ? null
147
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) {
148
153
  var _a;
149
- return react_1.default.createElement("div", { key: "".concat(f.name, "-").concat(f.size, "-").concat(f.lastModified), className: 'row col6', style: { "--gutter": "0.8rem", gap: "0.8rem", padding: "0.6rem 0.8rem", borderRadius: "0.4rem", border: "var(--neutral-main-border)" } },
154
+ return react_1.default.createElement("div", { key: "".concat(f.name, "-").concat(f.size, "-").concat(f.lastModified), className: 'row', style: { 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: 120 } },
150
155
  react_1.default.createElement(index_1.Winicon, { src: "outline/".concat(((_a = f.type) === null || _a === void 0 ? void 0 : _a.includes('image')) ? "multimedia/image" : "files/file-export"), size: "1.4rem" }),
151
156
  react_1.default.createElement(index_1.Text, { className: 'subtitle-4', style: { flex: 1, width: "100%" }, maxLine: 1 }, f.name),
152
157
  react_1.default.createElement(index_1.Winicon, { src: 'fill/user interface/e-remove', size: "1.4rem", onClick: function () {
@@ -327,7 +327,7 @@ var TSelectMultiple = /** @class */ (function (_super) {
327
327
  }
328
328
  } : undefined },
329
329
  ((_g = this.state.search) !== null && _g !== void 0 ? _g : this.state.options).filter(function (e) { return !e.parentId; }).map(function (item) { return _this.renderOptions(item); }),
330
- (((_h = this.state.search) === null || _h === void 0 ? void 0 : _h.length) === 0 || ((_j = this.props.options) === null || _j === void 0 ? void 0 : _j.length) === 0) && (react_1.default.createElement("div", { className: input_multi_select_module_css_1.default['no-results-found'] }, t("noResultFound"))))), document.body));
330
+ (!((_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"))))), document.body));
331
331
  };
332
332
  return TSelectMultiple;
333
333
  }(react_1.default.Component));
@@ -298,7 +298,7 @@ var TSelect1 = /** @class */ (function (_super) {
298
298
  var _a, _b;
299
299
  return react_1.default.createElement(OptionsItemTile, { key: item.id, item: item, children: ((_a = _this.state.search) !== null && _a !== void 0 ? _a : _this.state.options).filter(function (e) { return e.parentId === item.id; }), selected: _this.state.selected === item.id, onClick: _this.onSelect, treeData: ((_b = _this.state.search) !== null && _b !== void 0 ? _b : _this.state.options).some(function (e) { return e.parentId; }) });
300
300
  }),
301
- (((_j = this.state.search) === null || _j === void 0 ? void 0 : _j.length) === 0 || ((_k = this.props.options) === null || _k === void 0 ? void 0 : _k.length) === 0) && (react_1.default.createElement("div", { className: select1_module_css_1.default['no-results-found'] }, t("noResultFound"))))), document.body));
301
+ (!((_j = this.state.search) === null || _j === void 0 ? void 0 : _j.length) && !((_k = this.props.options) === null || _k === void 0 ? void 0 : _k.length)) && (react_1.default.createElement("div", { className: select1_module_css_1.default['no-results-found'] }, t("noResultFound"))))), document.body));
302
302
  };
303
303
  return TSelect1;
304
304
  }(react_1.default.Component));
@@ -314,7 +314,7 @@ function OptionsItemTile(_a) {
314
314
  onClick(item);
315
315
  } },
316
316
  treeData ? react_1.default.createElement("div", { className: 'row', style: { width: '1.4rem', height: '1.4rem' } }, (children === null || children === void 0 ? void 0 : children.length) ? react_1.default.createElement(winicon_1.Winicon, { src: isOpen ? "fill/arrows/triangle-down" : "fill/arrows/triangle-right", size: "1.2rem" }) : null) : undefined,
317
- react_1.default.createElement(text_1.Text, { className: 'body-3' }, item.title && typeof item.title === "string" ? item.title : item.name)),
317
+ ((item.title && typeof item.title === "string") || typeof item.name === "string") ? react_1.default.createElement(text_1.Text, { className: 'body-3' }, item.title && typeof item.title === "string" ? item.title : item.name) : item.name),
318
318
  (children === null || children === void 0 ? void 0 : children.length) ? react_1.default.createElement("div", { className: 'col', style: { display: isOpen ? "flex" : "none", width: '100%' } }, children.map(function (e) { return react_1.default.createElement(OptionsItemTile, { key: e.id, item: e, onClick: onClick }); })) : undefined);
319
319
  }
320
320
  exports.Select1 = (0, react_i18next_1.withTranslation)()(TSelect1);
@@ -29,7 +29,7 @@ var Tag = /** @class */ (function (_super) {
29
29
  }
30
30
  Tag.prototype.render = function () {
31
31
  var _a, _b;
32
- return react_1.default.createElement("div", { id: this.props.id, "tag-type": (_a = this.state) !== null && _a !== void 0 ? _a : 'default', className: "".concat(tag_module_css_1.default['tag-container'], " row ").concat(this.props.onClick ? tag_module_css_1.default['type-button'] : '', " ").concat(this.props.disabled ? tag_module_css_1.default['disabled'] : "", " ").concat((_b = this.props.className) !== null && _b !== void 0 ? _b : "button-text-2", " "), style: this.props.style, onClick: this.props.onClick },
32
+ return react_1.default.createElement("div", { id: this.props.id, "tag-type": (_a = this.props.status) !== null && _a !== void 0 ? _a : 'default', className: "".concat(tag_module_css_1.default['tag-container'], " row ").concat(this.props.onClick ? tag_module_css_1.default['type-button'] : '', " ").concat(this.props.disabled ? tag_module_css_1.default['disabled'] : "", " ").concat((_b = this.props.className) !== null && _b !== void 0 ? _b : "button-text-3", " "), style: this.props.style, onClick: this.props.onClick },
33
33
  this.props.prefix,
34
34
  react_1.default.createElement(text_1.Text, { maxLine: 1, className: tag_module_css_1.default['tag-label'] }, this.props.title),
35
35
  this.props.suffix);