@michalrakus/x-react-web-lib 1.8.0 → 1.10.0
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/README.md +3 -3
- package/XInputInterval.d.ts +3 -0
- package/XInputInterval.js +5 -0
- package/XInputIntervalBase.d.ts +3 -0
- package/XInputIntervalBase.js +5 -0
- package/gulpfile.js +84 -82
- package/lib/administration/XBrowseMetaBrowse.d.ts +2 -2
- package/lib/administration/XBrowseMetaBrowse.js +21 -21
- package/lib/administration/XBrowseMetaForm.d.ts +5 -5
- package/lib/administration/XBrowseMetaForm.js +63 -63
- package/lib/administration/XUserBrowse.d.ts +2 -2
- package/lib/administration/XUserBrowse.js +88 -87
- package/lib/administration/XUserForm.d.ts +9 -9
- package/lib/administration/XUserForm.js +195 -194
- package/lib/components/SearchTableParams.d.ts +11 -11
- package/lib/components/SearchTableParams.js +2 -2
- package/lib/components/SourceCodeLinkEntity.d.ts +4 -4
- package/lib/components/SourceCodeLinkEntity.js +14 -14
- package/lib/components/XAutoComplete.d.ts +36 -36
- package/lib/components/XAutoComplete.js +155 -155
- package/lib/components/XAutoCompleteBase.d.ts +45 -45
- package/lib/components/XAutoCompleteBase.js +371 -371
- package/lib/components/XAutoCompleteDT.d.ts +33 -33
- package/lib/components/XAutoCompleteDT.js +140 -140
- package/lib/components/XBrowse.d.ts +33 -33
- package/lib/components/XBrowse.js +360 -360
- package/lib/components/XButton.d.ts +9 -9
- package/lib/components/XButton.js +13 -13
- package/lib/components/XButtonIconMedium.d.ts +9 -9
- package/lib/components/XButtonIconMedium.js +13 -13
- package/lib/components/XButtonIconNarrow.d.ts +10 -10
- package/lib/components/XButtonIconNarrow.js +25 -25
- package/lib/components/XButtonIconSmall.d.ts +9 -9
- package/lib/components/XButtonIconSmall.js +13 -13
- package/lib/components/XCalendar.d.ts +9 -8
- package/lib/components/XCalendar.js +27 -27
- package/lib/components/XChangePasswordForm.d.ts +5 -5
- package/lib/components/XChangePasswordForm.js +160 -160
- package/lib/components/XCheckbox.d.ts +8 -8
- package/lib/components/XCheckbox.js +57 -57
- package/lib/components/XCheckboxDT.d.ts +10 -10
- package/lib/components/XCheckboxDT.js +46 -46
- package/lib/components/XDataTable.d.ts +11 -11
- package/lib/components/XDataTable.js +197 -197
- package/lib/components/XDropdown.d.ts +18 -18
- package/lib/components/XDropdown.js +57 -57
- package/lib/components/XDropdownDT.d.ts +16 -13
- package/lib/components/XDropdownDT.js +135 -128
- package/lib/components/XDropdownDTFilter.d.ts +7 -7
- package/lib/components/XDropdownDTFilter.js +121 -121
- package/lib/components/XDropdownForEntity.d.ts +26 -25
- package/lib/components/XDropdownForEntity.js +151 -149
- package/lib/components/XDropdownFormDTFilter.d.ts +7 -7
- package/lib/components/XDropdownFormDTFilter.js +121 -121
- package/lib/components/XEditColumnDialog.d.ts +13 -13
- package/lib/components/XEditColumnDialog.js +112 -112
- package/lib/components/XEnvVars.d.ts +15 -12
- package/lib/components/XEnvVars.js +23 -20
- package/lib/components/XErrors.d.ts +12 -12
- package/lib/components/XErrors.js +2 -2
- package/lib/components/XExportRowsDialog.d.ts +15 -15
- package/lib/components/XExportRowsDialog.js +184 -184
- package/lib/components/XFieldChangeEvent.d.ts +11 -11
- package/lib/components/XFieldChangeEvent.js +2 -2
- package/lib/components/XFieldSelector.d.ts +7 -7
- package/lib/components/XFieldSelector.js +113 -113
- package/lib/components/XFormBase.d.ts +68 -59
- package/lib/components/XFormBase.js +613 -526
- package/lib/components/XFormBaseModif.d.ts +5 -5
- package/lib/components/XFormBaseModif.js +33 -33
- package/lib/components/XFormBaseT.d.ts +4 -4
- package/lib/components/XFormBaseT.js +31 -31
- package/lib/components/XFormComponent.d.ts +40 -40
- package/lib/components/XFormComponent.js +177 -177
- package/lib/components/XFormComponentDT.d.ts +30 -30
- package/lib/components/XFormComponentDT.js +145 -145
- package/lib/components/XFormDataTable2.d.ts +144 -143
- package/lib/components/XFormDataTable2.js +679 -686
- package/lib/components/XFormFooter.d.ts +6 -6
- package/lib/components/XFormFooter.js +19 -19
- package/lib/components/XFormNavigator3.d.ts +12 -12
- package/lib/components/XFormNavigator3.js +130 -130
- package/lib/components/XHolders.d.ts +7 -7
- package/lib/components/XHolders.js +15 -15
- package/lib/components/XInput.d.ts +13 -13
- package/lib/components/XInput.js +38 -38
- package/lib/components/XInputDT.d.ts +11 -11
- package/lib/components/XInputDT.js +37 -37
- package/lib/components/XInputDate.d.ts +13 -13
- package/lib/components/XInputDate.js +63 -63
- package/lib/components/XInputDateDT.d.ts +10 -10
- package/lib/components/XInputDateDT.js +55 -55
- package/lib/components/XInputDecimal.d.ts +15 -15
- package/lib/components/XInputDecimal.js +78 -78
- package/lib/components/XInputDecimalBase.d.ts +12 -12
- package/lib/components/XInputDecimalBase.js +18 -18
- package/lib/components/XInputDecimalDT.d.ts +11 -11
- package/lib/components/XInputDecimalDT.js +74 -74
- package/lib/components/XInputFileList.d.ts +36 -36
- package/lib/components/XInputFileList.js +251 -251
- package/lib/components/XInputInterval.d.ts +14 -0
- package/lib/components/XInputInterval.js +56 -0
- package/lib/components/XInputIntervalBase.d.ts +10 -0
- package/lib/components/XInputIntervalBase.js +97 -0
- package/lib/components/XInputIntervalDT.d.ts +11 -0
- package/lib/components/XInputIntervalDT.js +43 -0
- package/lib/components/XInputText.d.ts +12 -12
- package/lib/components/XInputText.js +69 -69
- package/lib/components/XInputTextDT.d.ts +9 -9
- package/lib/components/XInputTextDT.js +42 -42
- package/lib/components/XInputTextarea.d.ts +18 -18
- package/lib/components/XInputTextarea.js +85 -85
- package/lib/components/XLazyDataTable.d.ts +78 -78
- package/lib/components/XLazyDataTable.js +899 -885
- package/lib/components/XLocale.d.ts +26 -26
- package/lib/components/XLocale.js +59 -59
- package/lib/components/XLoginDialog.d.ts +8 -8
- package/lib/components/XLoginDialog.js +21 -21
- package/lib/components/XLoginForm.d.ts +7 -7
- package/lib/components/XLoginForm.js +128 -128
- package/lib/components/XObject.d.ts +3 -3
- package/lib/components/XObject.js +2 -2
- package/lib/components/XResponseError.d.ts +11 -11
- package/lib/components/XResponseError.js +32 -32
- package/lib/components/XSearchButton.d.ts +26 -26
- package/lib/components/XSearchButton.js +225 -225
- package/lib/components/XSearchButtonDT.d.ts +12 -12
- package/lib/components/XSearchButtonDT.js +188 -188
- package/lib/components/XSearchButtonOld.d.ts +13 -13
- package/lib/components/XSearchButtonOld.js +212 -212
- package/lib/components/XToOneAssocButton.d.ts +8 -8
- package/lib/components/XToOneAssocButton.js +30 -30
- package/lib/components/XToken.d.ts +6 -6
- package/lib/components/XToken.js +2 -2
- package/lib/components/XUtils.d.ts +84 -74
- package/lib/components/XUtils.js +664 -627
- package/lib/components/XUtilsConversions.d.ts +15 -12
- package/lib/components/XUtilsConversions.js +177 -125
- package/lib/components/XUtilsMetadata.d.ts +39 -39
- package/lib/components/XUtilsMetadata.js +452 -452
- package/lib/components/locale/x-en.json +26 -26
- package/lib/components/useXToken.d.ts +2 -2
- package/lib/components/useXToken.js +44 -44
- package/lib/serverApi/ExportImportParam.d.ts +51 -51
- package/lib/serverApi/ExportImportParam.js +34 -34
- package/lib/serverApi/FindParam.d.ts +35 -34
- package/lib/serverApi/FindParam.js +30 -30
- package/lib/serverApi/FindResult.d.ts +8 -8
- package/lib/serverApi/FindResult.js +2 -2
- package/lib/serverApi/XBrowseMetadata.d.ts +19 -19
- package/lib/serverApi/XBrowseMetadata.js +2 -2
- package/lib/serverApi/XEntityMetadata.d.ts +35 -35
- package/lib/serverApi/XEntityMetadata.js +2 -2
- package/lib/serverApi/XFileJsonField.d.ts +6 -6
- package/lib/serverApi/XFileJsonField.js +2 -2
- package/lib/serverApi/XUser.d.ts +8 -7
- package/lib/serverApi/XUser.js +2 -2
- package/lib/serverApi/XUserAuthenticationIfc.d.ts +9 -9
- package/lib/serverApi/XUserAuthenticationIfc.js +2 -2
- package/lib/serverApi/XUtilsCommon.d.ts +14 -13
- package/lib/serverApi/XUtilsCommon.js +180 -110
- package/package.json +1 -1
|
@@ -1,251 +1,251 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
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;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
var __values = (this && this.__values) || function(o) {
|
|
54
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
55
|
-
if (m) return m.call(o);
|
|
56
|
-
if (o && typeof o.length === "number") return {
|
|
57
|
-
next: function () {
|
|
58
|
-
if (o && i >= o.length) o = void 0;
|
|
59
|
-
return { value: o && o[i++], done: !o };
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
63
|
-
};
|
|
64
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
65
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
66
|
-
};
|
|
67
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68
|
-
exports.XInputFileList = void 0;
|
|
69
|
-
var react_1 = __importDefault(require("react"));
|
|
70
|
-
var react_2 = require("react");
|
|
71
|
-
var fileupload_1 = require("primereact/fileupload");
|
|
72
|
-
var XUtilsMetadata_1 = require("./XUtilsMetadata");
|
|
73
|
-
var XUtils_1 = require("./XUtils");
|
|
74
|
-
var XButton_1 = require("./XButton");
|
|
75
|
-
var XButtonIconNarrow_1 = require("./XButtonIconNarrow");
|
|
76
|
-
var XUtilsConversions_1 = require("./XUtilsConversions");
|
|
77
|
-
var XLocale_1 = require("./XLocale");
|
|
78
|
-
var XInputFileList = /** @class */ (function (_super) {
|
|
79
|
-
__extends(XInputFileList, _super);
|
|
80
|
-
function XInputFileList(props) {
|
|
81
|
-
var _this = _super.call(this, props) || this;
|
|
82
|
-
_this.fileUploadRef = react_1.default.createRef();
|
|
83
|
-
_this.props = props;
|
|
84
|
-
var xEntityForm = XUtilsMetadata_1.XUtilsMetadata.getXEntity(props.form.getEntity());
|
|
85
|
-
var xAssocToMany = XUtilsMetadata_1.XUtilsMetadata.getXAssocToMany(xEntityForm, props.assocField);
|
|
86
|
-
_this.entity = xAssocToMany.entityName;
|
|
87
|
-
var xEntity = XUtilsMetadata_1.XUtilsMetadata.getXEntity(_this.entity);
|
|
88
|
-
_this.idField = xEntity.idField;
|
|
89
|
-
_this.xFileField = XUtilsMetadata_1.XUtilsMetadata.getXAssocToOneByAssocEntity(xEntity, 'XFile').name;
|
|
90
|
-
_this.onDownloadFile = _this.onDownloadFile.bind(_this);
|
|
91
|
-
_this.onRemoveFile = _this.onRemoveFile.bind(_this);
|
|
92
|
-
_this.uploadHandler = _this.uploadHandler.bind(_this);
|
|
93
|
-
var fieldFilename = "".concat(props.assocField, ".").concat(_this.xFileField, ".filename");
|
|
94
|
-
props.form.addField(fieldFilename);
|
|
95
|
-
return _this;
|
|
96
|
-
}
|
|
97
|
-
XInputFileList.prototype.uploadHandler = function (event) {
|
|
98
|
-
var _a, _b;
|
|
99
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
100
|
-
var endpoint, _c, _d, file, jsonFieldValue, xFile, e_1, newFileItem, e_2_1;
|
|
101
|
-
var e_2, _e;
|
|
102
|
-
return __generator(this, function (_f) {
|
|
103
|
-
switch (_f.label) {
|
|
104
|
-
case 0:
|
|
105
|
-
endpoint = this.props.saveDest === 'fileSystem' ? 'x-upload-file-into-file-system' : 'x-upload-file-into-db';
|
|
106
|
-
_f.label = 1;
|
|
107
|
-
case 1:
|
|
108
|
-
_f.trys.push([1, 9, 10, 11]);
|
|
109
|
-
_c = __values(event.files), _d = _c.next();
|
|
110
|
-
_f.label = 2;
|
|
111
|
-
case 2:
|
|
112
|
-
if (!!_d.done) return [3 /*break*/, 8];
|
|
113
|
-
file = _d.value;
|
|
114
|
-
// skontrolujeme velkost - robime to tuto, lebo ked nastavime maxFileSize na komponente FileUpload, tak prilis velky subor sem do handlera ani neposle
|
|
115
|
-
if (this.props.maxFileSize !== undefined && file.size > this.props.maxFileSize) {
|
|
116
|
-
alert((0, XLocale_1.xLocaleOption)('fileUploadSizeToBig', { fileName: file.name, fileSize: XInputFileList.sizeInMB(file.size), maxFileSize: XInputFileList.sizeInMB(this.props.maxFileSize) }));
|
|
117
|
-
return [3 /*break*/, 7]; // ideme na dalsi subor
|
|
118
|
-
}
|
|
119
|
-
jsonFieldValue = {
|
|
120
|
-
filename: file.name,
|
|
121
|
-
subdir: this.props.subdir,
|
|
122
|
-
modifDate: new Date(),
|
|
123
|
-
modifXUser: (_b = (_a = XUtils_1.XUtils.getXToken()) === null || _a === void 0 ? void 0 : _a.xUser) === null || _b === void 0 ? void 0 : _b.
|
|
124
|
-
};
|
|
125
|
-
xFile = void 0;
|
|
126
|
-
_f.label = 3;
|
|
127
|
-
case 3:
|
|
128
|
-
_f.trys.push([3, 5, , 6]);
|
|
129
|
-
return [4 /*yield*/, XUtils_1.XUtils.fetchFile(endpoint, jsonFieldValue, file)];
|
|
130
|
-
case 4:
|
|
131
|
-
xFile = _f.sent();
|
|
132
|
-
return [3 /*break*/, 6];
|
|
133
|
-
case 5:
|
|
134
|
-
e_1 = _f.sent();
|
|
135
|
-
XUtils_1.XUtils.showErrorMessage((0, XLocale_1.xLocaleOption)('fileUploadFailed', { fileName: file.name }), e_1);
|
|
136
|
-
this.fileUploadRef.current.clear(); // vyprazdnime hidden input, nech moze user znova zadat subory
|
|
137
|
-
return [2 /*return*/]; // prerusime upload tohto a dalsich suborov
|
|
138
|
-
case 6:
|
|
139
|
-
newFileItem = {};
|
|
140
|
-
newFileItem[this.xFileField] = xFile;
|
|
141
|
-
this.props.form.onTableAddRow(this.props.assocField, newFileItem, this.idField);
|
|
142
|
-
_f.label = 7;
|
|
143
|
-
case 7:
|
|
144
|
-
_d = _c.next();
|
|
145
|
-
return [3 /*break*/, 2];
|
|
146
|
-
case 8: return [3 /*break*/, 11];
|
|
147
|
-
case 9:
|
|
148
|
-
e_2_1 = _f.sent();
|
|
149
|
-
e_2 = { error: e_2_1 };
|
|
150
|
-
return [3 /*break*/, 11];
|
|
151
|
-
case 10:
|
|
152
|
-
try {
|
|
153
|
-
if (_d && !_d.done && (_e = _c.return)) _e.call(_c);
|
|
154
|
-
}
|
|
155
|
-
finally { if (e_2) throw e_2.error; }
|
|
156
|
-
return [7 /*endfinally*/];
|
|
157
|
-
case 11:
|
|
158
|
-
// vymaze zaznamy v event.files (hidden input type="file"), sposobi ze tlacitko "+Pridat" otvori dialog na vyber suborov
|
|
159
|
-
this.fileUploadRef.current.clear();
|
|
160
|
-
return [2 /*return*/];
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
};
|
|
165
|
-
XInputFileList.sizeInMB = function (size) {
|
|
166
|
-
var sizeInMB = size / (Math.pow(10, 6));
|
|
167
|
-
return (0, XUtilsConversions_1.numberAsUI)(sizeInMB, 2) + ' MB'; // zobrazime 2 desatinky
|
|
168
|
-
};
|
|
169
|
-
XInputFileList.prototype.onDownloadFile = function (xFile) {
|
|
170
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
171
|
-
var response, e_3, fileName, respBlob, url, a;
|
|
172
|
-
return __generator(this, function (_a) {
|
|
173
|
-
switch (_a.label) {
|
|
174
|
-
case 0:
|
|
175
|
-
_a.trys.push([0, 2, , 3]);
|
|
176
|
-
return [4 /*yield*/, XUtils_1.XUtils.fetchBasicJson('x-download-file', { xFileId: xFile.id })];
|
|
177
|
-
case 1:
|
|
178
|
-
response = _a.sent();
|
|
179
|
-
return [3 /*break*/, 3];
|
|
180
|
-
case 2:
|
|
181
|
-
e_3 = _a.sent();
|
|
182
|
-
XUtils_1.XUtils.showErrorMessage((0, XLocale_1.xLocaleOption)('fileDownloadFailed'), e_3);
|
|
183
|
-
return [2 /*return*/];
|
|
184
|
-
case 3:
|
|
185
|
-
fileName = xFile.name;
|
|
186
|
-
return [4 /*yield*/, response.blob()];
|
|
187
|
-
case 4:
|
|
188
|
-
respBlob = _a.sent();
|
|
189
|
-
url = window.URL.createObjectURL(respBlob);
|
|
190
|
-
a = document.createElement('a');
|
|
191
|
-
a.href = url;
|
|
192
|
-
a.download = fileName;
|
|
193
|
-
a.click();
|
|
194
|
-
return [2 /*return*/];
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
});
|
|
198
|
-
};
|
|
199
|
-
XInputFileList.prototype.onRemoveFile = function (fileItem) {
|
|
200
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
201
|
-
return __generator(this, function (_a) {
|
|
202
|
-
// poznamka: nemozme zmazat zaznam na backend-e, lebo ak user ukonci editaciu formulara tlacitkom Cancel (alebo odide uplne prec),
|
|
203
|
-
// tak musime mat v databaze zachovany povodny stav dat/suborov
|
|
204
|
-
this.props.form.onTableRemoveRow(this.props.assocField, fileItem);
|
|
205
|
-
return [2 /*return*/];
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
};
|
|
209
|
-
XInputFileList.prototype.render = function () {
|
|
210
|
-
var e_4, _a;
|
|
211
|
-
var _this = this;
|
|
212
|
-
var _b, _c, _d;
|
|
213
|
-
var label = (_b = this.props.label) !== null && _b !== void 0 ? _b : this.props.assocField;
|
|
214
|
-
var readOnly = this.props.form.formReadOnlyBase(this.props.assocField) || ((_c = this.props.readOnly) !== null && _c !== void 0 ? _c : false);
|
|
215
|
-
var object = this.props.form.state.object;
|
|
216
|
-
var fileItemList = object !== null ? object[this.props.assocField] : [];
|
|
217
|
-
var elemList = [];
|
|
218
|
-
var _loop_1 = function (fileItem) {
|
|
219
|
-
var xFile = fileItem[this_1.xFileField];
|
|
220
|
-
// p-inputgroup uklada child elementy do riadku (display:flex)
|
|
221
|
-
// TODO - pouzit XButtonIconSmall pre button na mazanie - problem je ze tam nevieme (narychlo) dat class m-1
|
|
222
|
-
elemList.push(react_1.default.createElement("div", { key: fileItem[this_1.idField].toString(), className: "p-inputgroup p-mb-1" },
|
|
223
|
-
react_1.default.createElement(XButton_1.XButton, { label: xFile.name, onClick: function () { return _this.onDownloadFile(xFile); } }),
|
|
224
|
-
react_1.default.createElement(XButtonIconNarrow_1.XButtonIconNarrow, { icon: "pi pi-times", onClick: function () { return _this.onRemoveFile(fileItem); }, disabled: readOnly })));
|
|
225
|
-
};
|
|
226
|
-
var this_1 = this;
|
|
227
|
-
try {
|
|
228
|
-
for (var fileItemList_1 = __values(fileItemList), fileItemList_1_1 = fileItemList_1.next(); !fileItemList_1_1.done; fileItemList_1_1 = fileItemList_1.next()) {
|
|
229
|
-
var fileItem = fileItemList_1_1.value;
|
|
230
|
-
_loop_1(fileItem);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
234
|
-
finally {
|
|
235
|
-
try {
|
|
236
|
-
if (fileItemList_1_1 && !fileItemList_1_1.done && (_a = fileItemList_1.return)) _a.call(fileItemList_1);
|
|
237
|
-
}
|
|
238
|
-
finally { if (e_4) throw e_4.error; }
|
|
239
|
-
}
|
|
240
|
-
// vrchny div uklada child elementy pod seba (standardny display:block), zarovnane su dolava
|
|
241
|
-
return (react_1.default.createElement("div", null,
|
|
242
|
-
react_1.default.createElement("label", null, label),
|
|
243
|
-
elemList,
|
|
244
|
-
react_1.default.createElement(fileupload_1.FileUpload, { ref: this.fileUploadRef, mode: "basic", multiple: true, auto: true, customUpload: true, uploadHandler: this.uploadHandler, chooseLabel: (_d = this.props.chooseLabel) !== null && _d !== void 0 ? _d : (0, XLocale_1.xLocaleOption)('addRow'), className: "m-1", disabled: readOnly })));
|
|
245
|
-
};
|
|
246
|
-
XInputFileList.defaultProps = {
|
|
247
|
-
saveDest: "fileSystem"
|
|
248
|
-
};
|
|
249
|
-
return XInputFileList;
|
|
250
|
-
}(react_2.Component));
|
|
251
|
-
exports.XInputFileList = XInputFileList;
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
+
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;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var __values = (this && this.__values) || function(o) {
|
|
54
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
55
|
+
if (m) return m.call(o);
|
|
56
|
+
if (o && typeof o.length === "number") return {
|
|
57
|
+
next: function () {
|
|
58
|
+
if (o && i >= o.length) o = void 0;
|
|
59
|
+
return { value: o && o[i++], done: !o };
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
63
|
+
};
|
|
64
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
65
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
66
|
+
};
|
|
67
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68
|
+
exports.XInputFileList = void 0;
|
|
69
|
+
var react_1 = __importDefault(require("react"));
|
|
70
|
+
var react_2 = require("react");
|
|
71
|
+
var fileupload_1 = require("primereact/fileupload");
|
|
72
|
+
var XUtilsMetadata_1 = require("./XUtilsMetadata");
|
|
73
|
+
var XUtils_1 = require("./XUtils");
|
|
74
|
+
var XButton_1 = require("./XButton");
|
|
75
|
+
var XButtonIconNarrow_1 = require("./XButtonIconNarrow");
|
|
76
|
+
var XUtilsConversions_1 = require("./XUtilsConversions");
|
|
77
|
+
var XLocale_1 = require("./XLocale");
|
|
78
|
+
var XInputFileList = /** @class */ (function (_super) {
|
|
79
|
+
__extends(XInputFileList, _super);
|
|
80
|
+
function XInputFileList(props) {
|
|
81
|
+
var _this = _super.call(this, props) || this;
|
|
82
|
+
_this.fileUploadRef = react_1.default.createRef();
|
|
83
|
+
_this.props = props;
|
|
84
|
+
var xEntityForm = XUtilsMetadata_1.XUtilsMetadata.getXEntity(props.form.getEntity());
|
|
85
|
+
var xAssocToMany = XUtilsMetadata_1.XUtilsMetadata.getXAssocToMany(xEntityForm, props.assocField);
|
|
86
|
+
_this.entity = xAssocToMany.entityName;
|
|
87
|
+
var xEntity = XUtilsMetadata_1.XUtilsMetadata.getXEntity(_this.entity);
|
|
88
|
+
_this.idField = xEntity.idField;
|
|
89
|
+
_this.xFileField = XUtilsMetadata_1.XUtilsMetadata.getXAssocToOneByAssocEntity(xEntity, 'XFile').name;
|
|
90
|
+
_this.onDownloadFile = _this.onDownloadFile.bind(_this);
|
|
91
|
+
_this.onRemoveFile = _this.onRemoveFile.bind(_this);
|
|
92
|
+
_this.uploadHandler = _this.uploadHandler.bind(_this);
|
|
93
|
+
var fieldFilename = "".concat(props.assocField, ".").concat(_this.xFileField, ".filename");
|
|
94
|
+
props.form.addField(fieldFilename);
|
|
95
|
+
return _this;
|
|
96
|
+
}
|
|
97
|
+
XInputFileList.prototype.uploadHandler = function (event) {
|
|
98
|
+
var _a, _b;
|
|
99
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
100
|
+
var endpoint, _c, _d, file, jsonFieldValue, xFile, e_1, newFileItem, e_2_1;
|
|
101
|
+
var e_2, _e;
|
|
102
|
+
return __generator(this, function (_f) {
|
|
103
|
+
switch (_f.label) {
|
|
104
|
+
case 0:
|
|
105
|
+
endpoint = this.props.saveDest === 'fileSystem' ? 'x-upload-file-into-file-system' : 'x-upload-file-into-db';
|
|
106
|
+
_f.label = 1;
|
|
107
|
+
case 1:
|
|
108
|
+
_f.trys.push([1, 9, 10, 11]);
|
|
109
|
+
_c = __values(event.files), _d = _c.next();
|
|
110
|
+
_f.label = 2;
|
|
111
|
+
case 2:
|
|
112
|
+
if (!!_d.done) return [3 /*break*/, 8];
|
|
113
|
+
file = _d.value;
|
|
114
|
+
// skontrolujeme velkost - robime to tuto, lebo ked nastavime maxFileSize na komponente FileUpload, tak prilis velky subor sem do handlera ani neposle
|
|
115
|
+
if (this.props.maxFileSize !== undefined && file.size > this.props.maxFileSize) {
|
|
116
|
+
alert((0, XLocale_1.xLocaleOption)('fileUploadSizeToBig', { fileName: file.name, fileSize: XInputFileList.sizeInMB(file.size), maxFileSize: XInputFileList.sizeInMB(this.props.maxFileSize) }));
|
|
117
|
+
return [3 /*break*/, 7]; // ideme na dalsi subor
|
|
118
|
+
}
|
|
119
|
+
jsonFieldValue = {
|
|
120
|
+
filename: file.name,
|
|
121
|
+
subdir: this.props.subdir,
|
|
122
|
+
modifDate: new Date(),
|
|
123
|
+
modifXUser: (_b = (_a = XUtils_1.XUtils.getXToken()) === null || _a === void 0 ? void 0 : _a.xUser) === null || _b === void 0 ? void 0 : _b.id
|
|
124
|
+
};
|
|
125
|
+
xFile = void 0;
|
|
126
|
+
_f.label = 3;
|
|
127
|
+
case 3:
|
|
128
|
+
_f.trys.push([3, 5, , 6]);
|
|
129
|
+
return [4 /*yield*/, XUtils_1.XUtils.fetchFile(endpoint, jsonFieldValue, file)];
|
|
130
|
+
case 4:
|
|
131
|
+
xFile = _f.sent();
|
|
132
|
+
return [3 /*break*/, 6];
|
|
133
|
+
case 5:
|
|
134
|
+
e_1 = _f.sent();
|
|
135
|
+
XUtils_1.XUtils.showErrorMessage((0, XLocale_1.xLocaleOption)('fileUploadFailed', { fileName: file.name }), e_1);
|
|
136
|
+
this.fileUploadRef.current.clear(); // vyprazdnime hidden input, nech moze user znova zadat subory
|
|
137
|
+
return [2 /*return*/]; // prerusime upload tohto a dalsich suborov
|
|
138
|
+
case 6:
|
|
139
|
+
newFileItem = {};
|
|
140
|
+
newFileItem[this.xFileField] = xFile;
|
|
141
|
+
this.props.form.onTableAddRow(this.props.assocField, newFileItem, this.idField);
|
|
142
|
+
_f.label = 7;
|
|
143
|
+
case 7:
|
|
144
|
+
_d = _c.next();
|
|
145
|
+
return [3 /*break*/, 2];
|
|
146
|
+
case 8: return [3 /*break*/, 11];
|
|
147
|
+
case 9:
|
|
148
|
+
e_2_1 = _f.sent();
|
|
149
|
+
e_2 = { error: e_2_1 };
|
|
150
|
+
return [3 /*break*/, 11];
|
|
151
|
+
case 10:
|
|
152
|
+
try {
|
|
153
|
+
if (_d && !_d.done && (_e = _c.return)) _e.call(_c);
|
|
154
|
+
}
|
|
155
|
+
finally { if (e_2) throw e_2.error; }
|
|
156
|
+
return [7 /*endfinally*/];
|
|
157
|
+
case 11:
|
|
158
|
+
// vymaze zaznamy v event.files (hidden input type="file"), sposobi ze tlacitko "+Pridat" otvori dialog na vyber suborov
|
|
159
|
+
this.fileUploadRef.current.clear();
|
|
160
|
+
return [2 /*return*/];
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
XInputFileList.sizeInMB = function (size) {
|
|
166
|
+
var sizeInMB = size / (Math.pow(10, 6));
|
|
167
|
+
return (0, XUtilsConversions_1.numberAsUI)(sizeInMB, 2) + ' MB'; // zobrazime 2 desatinky
|
|
168
|
+
};
|
|
169
|
+
XInputFileList.prototype.onDownloadFile = function (xFile) {
|
|
170
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
171
|
+
var response, e_3, fileName, respBlob, url, a;
|
|
172
|
+
return __generator(this, function (_a) {
|
|
173
|
+
switch (_a.label) {
|
|
174
|
+
case 0:
|
|
175
|
+
_a.trys.push([0, 2, , 3]);
|
|
176
|
+
return [4 /*yield*/, XUtils_1.XUtils.fetchBasicJson('x-download-file', { xFileId: xFile.id })];
|
|
177
|
+
case 1:
|
|
178
|
+
response = _a.sent();
|
|
179
|
+
return [3 /*break*/, 3];
|
|
180
|
+
case 2:
|
|
181
|
+
e_3 = _a.sent();
|
|
182
|
+
XUtils_1.XUtils.showErrorMessage((0, XLocale_1.xLocaleOption)('fileDownloadFailed'), e_3);
|
|
183
|
+
return [2 /*return*/];
|
|
184
|
+
case 3:
|
|
185
|
+
fileName = xFile.name;
|
|
186
|
+
return [4 /*yield*/, response.blob()];
|
|
187
|
+
case 4:
|
|
188
|
+
respBlob = _a.sent();
|
|
189
|
+
url = window.URL.createObjectURL(respBlob);
|
|
190
|
+
a = document.createElement('a');
|
|
191
|
+
a.href = url;
|
|
192
|
+
a.download = fileName;
|
|
193
|
+
a.click();
|
|
194
|
+
return [2 /*return*/];
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
XInputFileList.prototype.onRemoveFile = function (fileItem) {
|
|
200
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
201
|
+
return __generator(this, function (_a) {
|
|
202
|
+
// poznamka: nemozme zmazat zaznam na backend-e, lebo ak user ukonci editaciu formulara tlacitkom Cancel (alebo odide uplne prec),
|
|
203
|
+
// tak musime mat v databaze zachovany povodny stav dat/suborov
|
|
204
|
+
this.props.form.onTableRemoveRow(this.props.assocField, fileItem);
|
|
205
|
+
return [2 /*return*/];
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
};
|
|
209
|
+
XInputFileList.prototype.render = function () {
|
|
210
|
+
var e_4, _a;
|
|
211
|
+
var _this = this;
|
|
212
|
+
var _b, _c, _d;
|
|
213
|
+
var label = (_b = this.props.label) !== null && _b !== void 0 ? _b : this.props.assocField;
|
|
214
|
+
var readOnly = this.props.form.formReadOnlyBase(this.props.assocField) || ((_c = this.props.readOnly) !== null && _c !== void 0 ? _c : false);
|
|
215
|
+
var object = this.props.form.state.object;
|
|
216
|
+
var fileItemList = object !== null ? object[this.props.assocField] : [];
|
|
217
|
+
var elemList = [];
|
|
218
|
+
var _loop_1 = function (fileItem) {
|
|
219
|
+
var xFile = fileItem[this_1.xFileField];
|
|
220
|
+
// p-inputgroup uklada child elementy do riadku (display:flex)
|
|
221
|
+
// TODO - pouzit XButtonIconSmall pre button na mazanie - problem je ze tam nevieme (narychlo) dat class m-1
|
|
222
|
+
elemList.push(react_1.default.createElement("div", { key: fileItem[this_1.idField].toString(), className: "p-inputgroup p-mb-1" },
|
|
223
|
+
react_1.default.createElement(XButton_1.XButton, { label: xFile.name, onClick: function () { return _this.onDownloadFile(xFile); } }),
|
|
224
|
+
react_1.default.createElement(XButtonIconNarrow_1.XButtonIconNarrow, { icon: "pi pi-times", onClick: function () { return _this.onRemoveFile(fileItem); }, disabled: readOnly })));
|
|
225
|
+
};
|
|
226
|
+
var this_1 = this;
|
|
227
|
+
try {
|
|
228
|
+
for (var fileItemList_1 = __values(fileItemList), fileItemList_1_1 = fileItemList_1.next(); !fileItemList_1_1.done; fileItemList_1_1 = fileItemList_1.next()) {
|
|
229
|
+
var fileItem = fileItemList_1_1.value;
|
|
230
|
+
_loop_1(fileItem);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
234
|
+
finally {
|
|
235
|
+
try {
|
|
236
|
+
if (fileItemList_1_1 && !fileItemList_1_1.done && (_a = fileItemList_1.return)) _a.call(fileItemList_1);
|
|
237
|
+
}
|
|
238
|
+
finally { if (e_4) throw e_4.error; }
|
|
239
|
+
}
|
|
240
|
+
// vrchny div uklada child elementy pod seba (standardny display:block), zarovnane su dolava
|
|
241
|
+
return (react_1.default.createElement("div", null,
|
|
242
|
+
react_1.default.createElement("label", null, label),
|
|
243
|
+
elemList,
|
|
244
|
+
react_1.default.createElement(fileupload_1.FileUpload, { ref: this.fileUploadRef, mode: "basic", multiple: true, auto: true, customUpload: true, uploadHandler: this.uploadHandler, chooseLabel: (_d = this.props.chooseLabel) !== null && _d !== void 0 ? _d : (0, XLocale_1.xLocaleOption)('addRow'), className: "m-1", disabled: readOnly })));
|
|
245
|
+
};
|
|
246
|
+
XInputFileList.defaultProps = {
|
|
247
|
+
saveDest: "fileSystem"
|
|
248
|
+
};
|
|
249
|
+
return XInputFileList;
|
|
250
|
+
}(react_2.Component));
|
|
251
|
+
exports.XInputFileList = XInputFileList;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { XFormComponentProps } from "./XFormComponent";
|
|
3
|
+
import { XInput } from "./XInput";
|
|
4
|
+
import { IPostgresInterval } from "./XUtils";
|
|
5
|
+
export interface XInputIntervalProps extends XFormComponentProps<number> {
|
|
6
|
+
field: string;
|
|
7
|
+
inputStyle?: React.CSSProperties;
|
|
8
|
+
}
|
|
9
|
+
export declare class XInputInterval extends XInput<number, XInputIntervalProps> {
|
|
10
|
+
constructor(props: XInputIntervalProps);
|
|
11
|
+
getValue(): IPostgresInterval | null;
|
|
12
|
+
onValueChange(value: IPostgresInterval | null): void;
|
|
13
|
+
render(): JSX.Element;
|
|
14
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.XInputInterval = void 0;
|
|
33
|
+
var react_1 = __importDefault(require("react"));
|
|
34
|
+
var XInput_1 = require("./XInput");
|
|
35
|
+
var XInputIntervalBase_1 = require("./XInputIntervalBase");
|
|
36
|
+
var XInputInterval = /** @class */ (function (_super) {
|
|
37
|
+
__extends(XInputInterval, _super);
|
|
38
|
+
function XInputInterval(props) {
|
|
39
|
+
var _this = _super.call(this, props) || this;
|
|
40
|
+
_this.onValueChange = _this.onValueChange.bind(_this);
|
|
41
|
+
return _this;
|
|
42
|
+
}
|
|
43
|
+
XInputInterval.prototype.getValue = function () {
|
|
44
|
+
return this.getValueFromObject();
|
|
45
|
+
};
|
|
46
|
+
XInputInterval.prototype.onValueChange = function (value) {
|
|
47
|
+
this.onValueChangeBase(value, this.props.onChange);
|
|
48
|
+
};
|
|
49
|
+
XInputInterval.prototype.render = function () {
|
|
50
|
+
return (react_1.default.createElement("div", { className: "field grid" },
|
|
51
|
+
react_1.default.createElement("label", { htmlFor: this.props.field, className: "col-fixed", style: this.getLabelStyle() }, this.getLabel()),
|
|
52
|
+
react_1.default.createElement(XInputIntervalBase_1.XInputIntervalBase, __assign({ id: this.props.field, value: this.getValue(), onChange: this.onValueChange, readOnly: this.isReadOnly(), error: this.getError(), style: this.props.inputStyle }, this.getClassNameTooltip()))));
|
|
53
|
+
};
|
|
54
|
+
return XInputInterval;
|
|
55
|
+
}(XInput_1.XInput));
|
|
56
|
+
exports.XInputInterval = XInputInterval;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CSSProperties } from "react";
|
|
2
|
+
import { IPostgresInterval } from "./XUtils";
|
|
3
|
+
export declare const XInputIntervalBase: (props: {
|
|
4
|
+
id?: string | undefined;
|
|
5
|
+
value: IPostgresInterval | null;
|
|
6
|
+
onChange: (value: IPostgresInterval | null) => void;
|
|
7
|
+
readOnly?: boolean | undefined;
|
|
8
|
+
error?: string | undefined;
|
|
9
|
+
style?: CSSProperties | undefined;
|
|
10
|
+
}) => JSX.Element;
|