wini-web-components 2.3.6 → 2.3.8
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.
|
@@ -90,7 +90,7 @@ var TImportFile = /** @class */ (function (_super) {
|
|
|
90
90
|
var _this = _super.call(this, props) || this;
|
|
91
91
|
_this.fileRef = (0, react_1.createRef)();
|
|
92
92
|
_this.state = {
|
|
93
|
-
preview: Array.isArray(_this.props.value) ? _this.props.value : [_this.props.value]
|
|
93
|
+
preview: _this.props.value ? Array.isArray(_this.props.value) ? _this.props.value : [_this.props.value] : undefined
|
|
94
94
|
};
|
|
95
95
|
return _this;
|
|
96
96
|
}
|
|
@@ -105,7 +105,7 @@ var TImportFile = /** @class */ (function (_super) {
|
|
|
105
105
|
};
|
|
106
106
|
TImportFile.prototype.render = function () {
|
|
107
107
|
var _this = this;
|
|
108
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
108
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
109
109
|
var t = this.props.t;
|
|
110
110
|
var sizeTitle;
|
|
111
111
|
if (this.props.maxSize) {
|
|
@@ -144,8 +144,9 @@ var TImportFile = /** @class */ (function (_super) {
|
|
|
144
144
|
this.props.buttonOnly
|
|
145
145
|
? null
|
|
146
146
|
: this.props.multiple && ((_c = this.state.preview) === null || _c === void 0 ? void 0 : _c.length) ? react_1.default.createElement("div", { className: 'row', style: { flex: 1, flexWrap: "wrap", gap: "0.8rem" } }, this.state.preview.map(function (f) {
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
var _a;
|
|
148
|
+
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)" } },
|
|
149
|
+
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" }),
|
|
149
150
|
react_1.default.createElement(index_1.Text, { className: 'subtitle-4', style: { flex: 1, width: "100%" }, maxLine: 1 }, f.name),
|
|
150
151
|
react_1.default.createElement(index_1.Winicon, { src: 'fill/user interface/e-remove', size: "1.4rem", onClick: function () {
|
|
151
152
|
var _a;
|
|
@@ -153,22 +154,22 @@ var TImportFile = /** @class */ (function (_super) {
|
|
|
153
154
|
_this.setState(__assign(__assign({}, _this.state), { preview: newValue }));
|
|
154
155
|
if (_this.props.onChange)
|
|
155
156
|
_this.props.onChange(newValue);
|
|
156
|
-
} }));
|
|
157
|
+
}, color: '#E14337' }));
|
|
157
158
|
})) : react_1.default.createElement(react_1.default.Fragment, null,
|
|
158
|
-
react_1.default.createElement("div", { className: "".concat(import_file_module_css_1.default['import-file-prefix'], " row") }, this.state.preview ? ((
|
|
159
|
+
react_1.default.createElement("div", { className: "".concat(import_file_module_css_1.default['import-file-prefix'], " row") }, ((_d = this.state.preview) === null || _d === void 0 ? void 0 : _d.length) ? ((_e = this.state.preview[0].type) === null || _e === void 0 ? void 0 : _e.includes('image')) ? react_1.default.createElement("img", { src: this.state.preview[0] instanceof File ? URL.createObjectURL(this.state.preview[0]) : (_g = (_f = this.state.preview) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.url }) : fileSvg : cloudSvg),
|
|
159
160
|
react_1.default.createElement("div", { className: "".concat(import_file_module_css_1.default['file-preview-content'], " col") },
|
|
160
|
-
react_1.default.createElement(index_1.Text, { className: "".concat(import_file_module_css_1.default['title-file'], " heading-8"), style: { maxWidth: '100%' } }, (
|
|
161
|
-
react_1.default.createElement(index_1.Text, { className: "".concat(import_file_module_css_1.default['subtitle-file'], " subtitle-3"), style: { maxWidth: '100%' } }, ((
|
|
162
|
-
? "".concat((
|
|
163
|
-
: ((
|
|
164
|
-
this.state.preview && this.props.buttonOnly && !this.props.multiple ? react_1.default.createElement("div", { className: 'row', style: { gap: "0.4rem" } },
|
|
165
|
-
react_1.default.createElement(index_1.Text, { className: 'button-text-6' }, (
|
|
161
|
+
react_1.default.createElement(index_1.Text, { className: "".concat(import_file_module_css_1.default['title-file'], " heading-8"), style: { maxWidth: '100%' } }, (_k = (_j = (_h = this.state.preview) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.name) !== null && _k !== void 0 ? _k : ((_l = this.props.label) !== null && _l !== void 0 ? _l : t("uploadFileAction"))),
|
|
162
|
+
react_1.default.createElement(index_1.Text, { className: "".concat(import_file_module_css_1.default['subtitle-file'], " subtitle-3"), style: { maxWidth: '100%' } }, ((_o = (_m = this.state.preview) === null || _m === void 0 ? void 0 : _m[0]) === null || _o === void 0 ? void 0 : _o.size)
|
|
163
|
+
? "".concat((_p = this.state.preview) === null || _p === void 0 ? void 0 : _p[0].size, "KB")
|
|
164
|
+
: ((_q = this.props.subTitle) !== null && _q !== void 0 ? _q : (sizeTitle ? t("limitFileWarning", { sizeTitle: sizeTitle }) : ''))))),
|
|
165
|
+
((_r = this.state.preview) === null || _r === void 0 ? void 0 : _r.length) && this.props.buttonOnly && !this.props.multiple ? react_1.default.createElement("div", { className: 'row', style: { gap: "0.4rem" } },
|
|
166
|
+
react_1.default.createElement(index_1.Text, { className: 'button-text-6' }, (_t = (_s = this.state.preview) === null || _s === void 0 ? void 0 : _s[0].name) !== null && _t !== void 0 ? _t : ''),
|
|
166
167
|
react_1.default.createElement("button", { type: 'button', className: "".concat(import_file_module_css_1.default['remove-preview-file']), onClick: function () {
|
|
167
168
|
_this.setState(__assign(__assign({}, _this.state), { preview: undefined }));
|
|
168
169
|
if (_this.props.onChange)
|
|
169
170
|
_this.props.onChange(undefined);
|
|
170
171
|
} }, closeSvg))
|
|
171
|
-
: react_1.default.createElement(index_1.Button, { label: this.state.preview ? 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" }, className: 'button-text-4', onClick: function () {
|
|
172
|
+
: react_1.default.createElement(index_1.Button, { label: ((_u = this.state.preview) === null || _u === void 0 ? void 0 : _u.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" }, className: 'button-text-4', onClick: function () {
|
|
172
173
|
if (_this.state.preview && !_this.props.multiple) {
|
|
173
174
|
_this.setState(__assign(__assign({}, _this.state), { preview: undefined }));
|
|
174
175
|
if (_this.props.onChange)
|
|
@@ -134,6 +134,8 @@ var InputOpt = /** @class */ (function (_super) {
|
|
|
134
134
|
ev.target.value = "";
|
|
135
135
|
break;
|
|
136
136
|
default:
|
|
137
|
+
ev.preventDefault();
|
|
138
|
+
ev.stopPropagation();
|
|
137
139
|
var numberCheck = /[0-9]/g;
|
|
138
140
|
if (numberCheck.test(key)) {
|
|
139
141
|
if (!ev.target.value.length)
|
|
@@ -143,8 +145,6 @@ var InputOpt = /** @class */ (function (_super) {
|
|
|
143
145
|
else
|
|
144
146
|
ev.target.blur();
|
|
145
147
|
}
|
|
146
|
-
else
|
|
147
|
-
ev.preventDefault();
|
|
148
148
|
break;
|
|
149
149
|
}
|
|
150
150
|
}, onBlur: function () {
|