@michalrakus/x-react-web-lib 1.9.0 → 1.11.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/XEditBrowse.d.ts +3 -0
- package/XEditBrowse.js +5 -0
- package/XInputInterval.d.ts +3 -0
- package/XInputInterval.js +5 -0
- package/XInputIntervalBase.d.ts +3 -0
- package/XInputIntervalBase.js +5 -0
- package/XObject.d.ts +3 -0
- package/XObject.js +5 -0
- package/gulpfile.js +4 -1
- package/lib/administration/XBrowseMetaBrowse.d.ts +2 -1
- package/lib/administration/XUserBrowse.d.ts +2 -1
- package/lib/administration/XUserBrowse.js +1 -1
- package/lib/administration/XUserForm.d.ts +6 -3
- package/lib/administration/XUserForm.js +9 -16
- package/lib/components/XAutoComplete.d.ts +4 -4
- package/lib/components/XAutoComplete.js +10 -20
- package/lib/components/XAutoCompleteBase.d.ts +15 -5
- package/lib/components/XAutoCompleteBase.js +114 -95
- package/lib/components/XAutoCompleteDT.d.ts +4 -3
- package/lib/components/XAutoCompleteDT.js +8 -7
- package/lib/components/XCalendar.d.ts +2 -1
- package/lib/components/XCalendar.js +1 -1
- package/lib/components/XDropdownDT.d.ts +3 -0
- package/lib/components/XDropdownDT.js +14 -7
- package/lib/components/XDropdownForEntity.d.ts +1 -0
- package/lib/components/XDropdownForEntity.js +3 -1
- package/lib/components/{XBrowse.d.ts → XEditBrowse.d.ts} +3 -3
- package/lib/components/{XBrowse.js → XEditBrowse.js} +22 -22
- package/lib/components/XFormBase.d.ts +14 -4
- package/lib/components/XFormBase.js +137 -42
- package/lib/components/XFormDataTable2.d.ts +7 -6
- package/lib/components/XFormDataTable2.js +18 -38
- package/lib/components/XFormNavigator3.d.ts +3 -3
- package/lib/components/XFormNavigator3.js +2 -2
- package/lib/components/XInputDate.js +1 -1
- 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/XLazyDataTable.d.ts +9 -2
- package/lib/components/XLazyDataTable.js +58 -42
- package/lib/components/{SearchTableParams.d.ts → XSearchBrowseParams.d.ts} +2 -2
- package/lib/components/XSearchButton.d.ts +2 -2
- package/lib/components/XSearchButton.js +8 -12
- package/lib/components/XSearchButtonDT.d.ts +2 -2
- package/lib/components/XSearchButtonDT.js +9 -5
- package/lib/components/XUtils.d.ts +30 -2
- package/lib/components/XUtils.js +95 -17
- package/lib/components/XUtilsConversions.d.ts +3 -0
- package/lib/components/XUtilsConversions.js +53 -1
- package/lib/components/locale/x-en.json +4 -1
- package/lib/serverApi/ExportImportParam.d.ts +2 -2
- package/lib/serverApi/FindParam.d.ts +6 -5
- package/lib/serverApi/XUtilsCommon.d.ts +1 -0
- package/lib/serverApi/XUtilsCommon.js +70 -0
- package/package.json +1 -1
- package/XBrowse.d.ts +0 -3
- package/XBrowse.js +0 -5
- /package/lib/components/{SearchTableParams.js → XSearchBrowseParams.js} +0 -0
|
@@ -116,20 +116,20 @@ var XFormBase = /** @class */ (function (_super) {
|
|
|
116
116
|
function XFormBase(props) {
|
|
117
117
|
var _this = _super.call(this, props) || this;
|
|
118
118
|
// check
|
|
119
|
-
if (props.id !== undefined && props.
|
|
120
|
-
throw "Form cannot have both props id and
|
|
119
|
+
if (props.id !== undefined && props.initValues !== undefined) {
|
|
120
|
+
throw "Form cannot have both props id and initValues defined. Only one of them can be defined.";
|
|
121
121
|
}
|
|
122
122
|
//this.entity = props.entity; - nastavuje sa cez decorator @Form
|
|
123
123
|
var object = null;
|
|
124
|
-
if (props.id === undefined) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
124
|
+
// if (props.id === undefined) {
|
|
125
|
+
// // add row operation
|
|
126
|
+
// if (props.object !== undefined) {
|
|
127
|
+
// object = props.object;
|
|
128
|
+
// }
|
|
129
|
+
// else {
|
|
130
|
+
// object = {}; // empty new object
|
|
131
|
+
// }
|
|
132
|
+
// }
|
|
133
133
|
_this.fields = new Set();
|
|
134
134
|
_this.state = {
|
|
135
135
|
object: object,
|
|
@@ -137,15 +137,18 @@ var XFormBase = /** @class */ (function (_super) {
|
|
|
137
137
|
};
|
|
138
138
|
_this.xFormComponentList = [];
|
|
139
139
|
_this.xFormDataTableList = [];
|
|
140
|
+
_this.assocToValidateList = [];
|
|
141
|
+
_this.assocToSortList = [];
|
|
140
142
|
_this.onClickSave = _this.onClickSave.bind(_this);
|
|
141
143
|
_this.onClickCancel = _this.onClickCancel.bind(_this);
|
|
142
144
|
return _this;
|
|
143
145
|
}
|
|
144
146
|
XFormBase.prototype.componentDidMount = function () {
|
|
145
147
|
return __awaiter(this, void 0, void 0, function () {
|
|
146
|
-
var object, operationType;
|
|
147
|
-
|
|
148
|
-
|
|
148
|
+
var object, operationType, _a, _b, assocToSort, assocRowList;
|
|
149
|
+
var e_1, _c;
|
|
150
|
+
return __generator(this, function (_d) {
|
|
151
|
+
switch (_d.label) {
|
|
149
152
|
case 0:
|
|
150
153
|
//console.log("volany XFormBase.componentDidMount()");
|
|
151
154
|
// kontrola (musi byt tu, v konstruktore este property nie je nastavena)
|
|
@@ -157,14 +160,35 @@ var XFormBase = /** @class */ (function (_super) {
|
|
|
157
160
|
case 1:
|
|
158
161
|
//console.log('XFormBase.componentDidMount ide nacitat objekt');
|
|
159
162
|
//console.log(this.fields);
|
|
160
|
-
object =
|
|
163
|
+
object = _d.sent();
|
|
161
164
|
operationType = XUtils_1.OperationType.Update;
|
|
165
|
+
try {
|
|
166
|
+
// sortovanie, aby sme nemuseli sortovat v DB (neviem co je efektivnejsie)
|
|
167
|
+
for (_a = __values(this.assocToSortList), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
168
|
+
assocToSort = _b.value;
|
|
169
|
+
assocRowList = object[assocToSort.assoc];
|
|
170
|
+
if (assocRowList) {
|
|
171
|
+
object[assocToSort.assoc] = XUtils_1.XUtils.arraySort(assocRowList, assocToSort.sortField);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
176
|
+
finally {
|
|
177
|
+
try {
|
|
178
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
179
|
+
}
|
|
180
|
+
finally { if (e_1) throw e_1.error; }
|
|
181
|
+
}
|
|
162
182
|
return [3 /*break*/, 3];
|
|
163
183
|
case 2:
|
|
164
184
|
// add new row
|
|
165
|
-
object = this.
|
|
185
|
+
object = this.createNewObject();
|
|
186
|
+
// pridame pripadne "init values", ktore pridu cez prop object (pouziva sa napr. pri insertovani cez XAutoComplete na predplnenie hodnoty)
|
|
187
|
+
if (this.props.initValues !== undefined) {
|
|
188
|
+
object = __assign(__assign({}, object), this.props.initValues); // values from this.props.object will override values from object (if key is the same)
|
|
189
|
+
}
|
|
166
190
|
operationType = XUtils_1.OperationType.Insert;
|
|
167
|
-
|
|
191
|
+
_d.label = 3;
|
|
168
192
|
case 3:
|
|
169
193
|
this.preInitForm(object, operationType);
|
|
170
194
|
//console.log("volany XFormBase.componentDidMount() - ideme setnut object");
|
|
@@ -268,7 +292,7 @@ var XFormBase = /** @class */ (function (_super) {
|
|
|
268
292
|
this.setState({ object: object });
|
|
269
293
|
};
|
|
270
294
|
XFormBase.getNextRowId = function (rowList, dataKey) {
|
|
271
|
-
var
|
|
295
|
+
var e_2, _a;
|
|
272
296
|
var maxId = 0;
|
|
273
297
|
try {
|
|
274
298
|
for (var rowList_1 = __values(rowList), rowList_1_1 = rowList_1.next(); !rowList_1_1.done; rowList_1_1 = rowList_1.next()) {
|
|
@@ -279,12 +303,12 @@ var XFormBase = /** @class */ (function (_super) {
|
|
|
279
303
|
}
|
|
280
304
|
}
|
|
281
305
|
}
|
|
282
|
-
catch (
|
|
306
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
283
307
|
finally {
|
|
284
308
|
try {
|
|
285
309
|
if (rowList_1_1 && !rowList_1_1.done && (_a = rowList_1.return)) _a.call(rowList_1);
|
|
286
310
|
}
|
|
287
|
-
finally { if (
|
|
311
|
+
finally { if (e_2) throw e_2.error; }
|
|
288
312
|
}
|
|
289
313
|
return maxId + 1;
|
|
290
314
|
};
|
|
@@ -300,7 +324,6 @@ var XFormBase = /** @class */ (function (_super) {
|
|
|
300
324
|
// TODO - tu mozno treba setnut funkciu - koli moznej asynchronicite
|
|
301
325
|
this.setState({ object: object });
|
|
302
326
|
};
|
|
303
|
-
// tato metoda (aj vsetky ostatne metody precujuce s row-mi) by mali byt skor na XFormDataTable2 (ta pozna "assocField" (OneToMany asociaciu))
|
|
304
327
|
XFormBase.getXRowTechData = function (row) {
|
|
305
328
|
// ak este nemame rowTechData, tak ho vytvorime
|
|
306
329
|
if (row.__x_rowTechData === undefined) {
|
|
@@ -322,7 +345,7 @@ var XFormBase = /** @class */ (function (_super) {
|
|
|
322
345
|
this.xFormComponentList.push(xFormComponent);
|
|
323
346
|
};
|
|
324
347
|
XFormBase.prototype.findXFormComponent = function (field) {
|
|
325
|
-
var
|
|
348
|
+
var e_3, _a;
|
|
326
349
|
try {
|
|
327
350
|
// TODO - vytvorit mapu (field, ref(xFormComponent)), bude to rychlejsie
|
|
328
351
|
// vytvorit len mapu (a list zrusit) je problem - mozme mat pre jeden field viacero (napr. asociacnych) componentov
|
|
@@ -333,25 +356,31 @@ var XFormBase = /** @class */ (function (_super) {
|
|
|
333
356
|
}
|
|
334
357
|
}
|
|
335
358
|
}
|
|
336
|
-
catch (
|
|
359
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
337
360
|
finally {
|
|
338
361
|
try {
|
|
339
362
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
340
363
|
}
|
|
341
|
-
finally { if (
|
|
364
|
+
finally { if (e_3) throw e_3.error; }
|
|
342
365
|
}
|
|
343
366
|
return undefined;
|
|
344
367
|
};
|
|
345
368
|
XFormBase.prototype.addXFormDataTable = function (xFormDataTable) {
|
|
346
369
|
this.xFormDataTableList.push(xFormDataTable);
|
|
347
370
|
};
|
|
371
|
+
XFormBase.prototype.addAssocToValidate = function (oneToManyAssoc) {
|
|
372
|
+
this.assocToValidateList.push(oneToManyAssoc);
|
|
373
|
+
};
|
|
374
|
+
XFormBase.prototype.addAssocToSort = function (oneToManyAssoc, sortField) {
|
|
375
|
+
this.assocToSortList.push({ assoc: oneToManyAssoc, sortField: sortField });
|
|
376
|
+
};
|
|
348
377
|
XFormBase.prototype.formReadOnlyBase = function (field) {
|
|
349
378
|
// TODO - bude this.state.object vzdycky !== undefined?
|
|
350
379
|
return this.formReadOnly(this.state.object, field);
|
|
351
380
|
};
|
|
352
381
|
XFormBase.prototype.onClickSave = function () {
|
|
353
382
|
return __awaiter(this, void 0, void 0, function () {
|
|
354
|
-
var isAddRow, object,
|
|
383
|
+
var isAddRow, object, e_4;
|
|
355
384
|
return __generator(this, function (_a) {
|
|
356
385
|
switch (_a.label) {
|
|
357
386
|
case 0:
|
|
@@ -381,8 +410,8 @@ var XFormBase = /** @class */ (function (_super) {
|
|
|
381
410
|
object = _a.sent();
|
|
382
411
|
return [3 /*break*/, 4];
|
|
383
412
|
case 3:
|
|
384
|
-
|
|
385
|
-
XUtils_1.XUtils.showErrorMessage("Save row failed.",
|
|
413
|
+
e_4 = _a.sent();
|
|
414
|
+
XUtils_1.XUtils.showErrorMessage("Save row failed.", e_4);
|
|
386
415
|
return [2 /*return*/]; // zostavame vo formulari
|
|
387
416
|
case 4:
|
|
388
417
|
if (this.props.onSaveOrCancel !== undefined) {
|
|
@@ -409,23 +438,39 @@ var XFormBase = /** @class */ (function (_super) {
|
|
|
409
438
|
}
|
|
410
439
|
};
|
|
411
440
|
XFormBase.prototype.validateSave = function () {
|
|
412
|
-
var
|
|
441
|
+
var e_5, _a, e_6, _b;
|
|
413
442
|
var xErrorMap = this.validateForm();
|
|
414
443
|
// zatial takto jednoducho
|
|
415
444
|
var msg = XUtils_1.XUtils.getErrorMessages(xErrorMap);
|
|
416
445
|
try {
|
|
417
446
|
// este spracujeme editovatelne tabulky
|
|
418
|
-
for (var
|
|
419
|
-
var xFormDataTable =
|
|
420
|
-
msg += xFormDataTable.getErrorMessages();
|
|
447
|
+
for (var _c = __values(this.xFormDataTableList), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
448
|
+
var xFormDataTable = _d.value;
|
|
449
|
+
//msg += xFormDataTable.getErrorMessages();
|
|
450
|
+
msg += this.getErrorMessagesForAssoc(xFormDataTable.props.assocField);
|
|
421
451
|
}
|
|
422
452
|
}
|
|
423
|
-
catch (
|
|
453
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
424
454
|
finally {
|
|
425
455
|
try {
|
|
426
|
-
if (
|
|
456
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
457
|
+
}
|
|
458
|
+
finally { if (e_5) throw e_5.error; }
|
|
459
|
+
}
|
|
460
|
+
try {
|
|
461
|
+
// este spracujeme oneToMany asociacie, ktore boli explicitne uvedene, ze ich treba validovat
|
|
462
|
+
// (validaciu treba nakodit vo formulari, zavolat z metody validate() a ukoncit zavolanim XFormBase.saveErrorsIntoXRowTechData)
|
|
463
|
+
for (var _e = __values(this.assocToValidateList), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
464
|
+
var assocToValidate = _f.value;
|
|
465
|
+
msg += this.getErrorMessagesForAssoc(assocToValidate);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
469
|
+
finally {
|
|
470
|
+
try {
|
|
471
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
427
472
|
}
|
|
428
|
-
finally { if (
|
|
473
|
+
finally { if (e_6) throw e_6.error; }
|
|
429
474
|
}
|
|
430
475
|
var ok = true;
|
|
431
476
|
if (msg !== "") {
|
|
@@ -435,7 +480,7 @@ var XFormBase = /** @class */ (function (_super) {
|
|
|
435
480
|
return ok;
|
|
436
481
|
};
|
|
437
482
|
XFormBase.prototype.validateForm = function () {
|
|
438
|
-
var
|
|
483
|
+
var e_7, _a;
|
|
439
484
|
var xErrorMap = this.fieldValidation();
|
|
440
485
|
// form validation
|
|
441
486
|
var xErrors = this.validate(this.getXObject());
|
|
@@ -450,12 +495,12 @@ var XFormBase = /** @class */ (function (_super) {
|
|
|
450
495
|
}
|
|
451
496
|
}
|
|
452
497
|
}
|
|
453
|
-
catch (
|
|
498
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
454
499
|
finally {
|
|
455
500
|
try {
|
|
456
501
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
457
502
|
}
|
|
458
|
-
finally { if (
|
|
503
|
+
finally { if (e_7) throw e_7.error; }
|
|
459
504
|
}
|
|
460
505
|
// TODO - optimalizacia - netreba setovat stav ak by sme sli prec z formulara (ak by zbehla validacia aj save a isli by sme naspet do browsu)
|
|
461
506
|
// setujeme aj this.state.object, lebo mohli pribudnut/odbudnut chyby na rowData v editovatelnych tabulkach
|
|
@@ -463,7 +508,7 @@ var XFormBase = /** @class */ (function (_super) {
|
|
|
463
508
|
return xErrorMap;
|
|
464
509
|
};
|
|
465
510
|
XFormBase.prototype.fieldValidation = function () {
|
|
466
|
-
var
|
|
511
|
+
var e_8, _a, e_9, _b;
|
|
467
512
|
var xErrorMap = {};
|
|
468
513
|
try {
|
|
469
514
|
for (var _c = __values(this.xFormComponentList), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
@@ -475,12 +520,12 @@ var XFormBase = /** @class */ (function (_super) {
|
|
|
475
520
|
}
|
|
476
521
|
}
|
|
477
522
|
}
|
|
478
|
-
catch (
|
|
523
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
479
524
|
finally {
|
|
480
525
|
try {
|
|
481
526
|
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
482
527
|
}
|
|
483
|
-
finally { if (
|
|
528
|
+
finally { if (e_8) throw e_8.error; }
|
|
484
529
|
}
|
|
485
530
|
try {
|
|
486
531
|
for (var _e = __values(this.xFormDataTableList), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
@@ -488,21 +533,71 @@ var XFormBase = /** @class */ (function (_super) {
|
|
|
488
533
|
xFormDataTable.validate();
|
|
489
534
|
}
|
|
490
535
|
}
|
|
491
|
-
catch (
|
|
536
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
492
537
|
finally {
|
|
493
538
|
try {
|
|
494
539
|
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
495
540
|
}
|
|
496
|
-
finally { if (
|
|
541
|
+
finally { if (e_9) throw e_9.error; }
|
|
497
542
|
}
|
|
498
543
|
return xErrorMap;
|
|
499
544
|
};
|
|
545
|
+
XFormBase.prototype.getErrorMessagesForAssoc = function (oneToManyAssoc) {
|
|
546
|
+
var e_10, _a;
|
|
547
|
+
var msg = "";
|
|
548
|
+
var object = this.getXObject();
|
|
549
|
+
var rowList = object[oneToManyAssoc];
|
|
550
|
+
if (!Array.isArray(rowList)) {
|
|
551
|
+
throw "Array for the assoc ".concat(oneToManyAssoc, " not found in the form object");
|
|
552
|
+
}
|
|
553
|
+
try {
|
|
554
|
+
for (var rowList_2 = __values(rowList), rowList_2_1 = rowList_2.next(); !rowList_2_1.done; rowList_2_1 = rowList_2.next()) {
|
|
555
|
+
var row = rowList_2_1.value;
|
|
556
|
+
var xRowTechData = XFormBase.getXRowTechData(row);
|
|
557
|
+
msg += XUtils_1.XUtils.getErrorMessages(xRowTechData.errorMap);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
561
|
+
finally {
|
|
562
|
+
try {
|
|
563
|
+
if (rowList_2_1 && !rowList_2_1.done && (_a = rowList_2.return)) _a.call(rowList_2);
|
|
564
|
+
}
|
|
565
|
+
finally { if (e_10) throw e_10.error; }
|
|
566
|
+
}
|
|
567
|
+
return msg;
|
|
568
|
+
};
|
|
569
|
+
// can be called from AppForm in case of custom validation on oneToMany assoc
|
|
570
|
+
XFormBase.saveErrorsIntoXRowTechData = function (row, xErrors) {
|
|
571
|
+
var e_11, _a;
|
|
572
|
+
var xErrorMap = {};
|
|
573
|
+
try {
|
|
574
|
+
for (var _b = __values(Object.entries(xErrors)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
575
|
+
var _d = __read(_c.value, 2), field = _d[0], error = _d[1];
|
|
576
|
+
if (error) {
|
|
577
|
+
xErrorMap[field] = { form: error };
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
582
|
+
finally {
|
|
583
|
+
try {
|
|
584
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
585
|
+
}
|
|
586
|
+
finally { if (e_11) throw e_11.error; }
|
|
587
|
+
}
|
|
588
|
+
var xRowTechData = XFormBase.getXRowTechData(row);
|
|
589
|
+
xRowTechData.errorMap = xErrorMap;
|
|
590
|
+
};
|
|
500
591
|
// this method can be overriden in subclass if needed
|
|
501
592
|
// (the purpose is to put the whole form to read only mode (maybe with exception a few fields))
|
|
502
593
|
// if returns true for the param "field", then the field is read only, otherwise the property readOnly of the XInput* is processed
|
|
503
594
|
XFormBase.prototype.formReadOnly = function (object, field) {
|
|
504
595
|
return false;
|
|
505
596
|
};
|
|
597
|
+
// this method can be overriden in subclass if needed (to set some default values for insert)
|
|
598
|
+
XFormBase.prototype.createNewObject = function () {
|
|
599
|
+
return {};
|
|
600
|
+
};
|
|
506
601
|
// this method can be overriden in subclass if needed (to modify/save object after read from DB and before set into the form)
|
|
507
602
|
XFormBase.prototype.preInitForm = function (object, operationType) {
|
|
508
603
|
};
|
|
@@ -66,7 +66,6 @@ export declare class XFormDataTable2 extends Component<XFormDataTableProps> {
|
|
|
66
66
|
};
|
|
67
67
|
constructor(props: XFormDataTableProps);
|
|
68
68
|
getPathForColumn(columnProps: XFormColumnProps): string;
|
|
69
|
-
getDisplayFieldOrId(columnPropsAutoComplete: XFormAutoCompleteColumnProps): string;
|
|
70
69
|
static getHeader(columnProps: XFormColumnProps, xEntity: XEntity, field: string, xField: XField): string;
|
|
71
70
|
getEntity(): string;
|
|
72
71
|
createInitFilters(): DataTableFilterMeta;
|
|
@@ -83,7 +82,6 @@ export declare class XFormDataTable2 extends Component<XFormDataTableProps> {
|
|
|
83
82
|
onClickRemoveRowBySelection(): void;
|
|
84
83
|
removeRow(row: any): void;
|
|
85
84
|
validate(): void;
|
|
86
|
-
getErrorMessages(): string;
|
|
87
85
|
isReadOnly(): boolean;
|
|
88
86
|
render(): JSX.Element;
|
|
89
87
|
}
|
|
@@ -104,18 +102,21 @@ export interface XFormInputSimpleColumnProps extends XFormColumnProps {
|
|
|
104
102
|
export interface XFormDropdownColumnProps extends XFormColumnProps {
|
|
105
103
|
assocField: string;
|
|
106
104
|
displayField: string;
|
|
105
|
+
sortField?: string;
|
|
106
|
+
filter?: XCustomFilter;
|
|
107
107
|
}
|
|
108
108
|
export interface XFormAutoCompleteColumnProps extends XFormColumnProps {
|
|
109
109
|
assocField: string;
|
|
110
|
-
displayField: string
|
|
111
|
-
|
|
112
|
-
assocForm?:
|
|
110
|
+
displayField: string;
|
|
111
|
+
searchBrowse?: JSX.Element;
|
|
112
|
+
assocForm?: JSX.Element;
|
|
113
113
|
filter?: XTableFieldFilterProp;
|
|
114
|
+
suggestions?: any[];
|
|
114
115
|
}
|
|
115
116
|
export interface XFormSearchButtonColumnProps extends XFormColumnProps {
|
|
116
117
|
assocField: string;
|
|
117
118
|
displayField: string;
|
|
118
|
-
|
|
119
|
+
searchBrowse: JSX.Element;
|
|
119
120
|
}
|
|
120
121
|
export declare const XFormColumn: {
|
|
121
122
|
(props: XFormInputSimpleColumnProps): null;
|
|
@@ -80,6 +80,7 @@ var api_1 = require("primereact/api");
|
|
|
80
80
|
var XAutoCompleteDT_1 = require("./XAutoCompleteDT");
|
|
81
81
|
var XButtonIconNarrow_1 = require("./XButtonIconNarrow");
|
|
82
82
|
var XLocale_1 = require("./XLocale");
|
|
83
|
+
var XInputIntervalDT_1 = require("./XInputIntervalDT");
|
|
83
84
|
var XFormDataTable2 = /** @class */ (function (_super) {
|
|
84
85
|
__extends(XFormDataTable2, _super);
|
|
85
86
|
function XFormDataTable2(props) {
|
|
@@ -139,7 +140,7 @@ var XFormDataTable2 = /** @class */ (function (_super) {
|
|
|
139
140
|
}
|
|
140
141
|
else if (columnProps.type === "autoComplete") {
|
|
141
142
|
var columnPropsAutoComplete = columnProps;
|
|
142
|
-
return columnPropsAutoComplete.assocField + '.' +
|
|
143
|
+
return columnPropsAutoComplete.assocField + '.' + columnPropsAutoComplete.displayField;
|
|
143
144
|
}
|
|
144
145
|
else if (columnProps.type === "searchButton") {
|
|
145
146
|
var columnPropsSearchButton = columnProps;
|
|
@@ -149,19 +150,6 @@ var XFormDataTable2 = /** @class */ (function (_super) {
|
|
|
149
150
|
throw "Unknown prop type = " + columnProps.type;
|
|
150
151
|
}
|
|
151
152
|
};
|
|
152
|
-
XFormDataTable2.prototype.getDisplayFieldOrId = function (columnPropsAutoComplete) {
|
|
153
|
-
// toto je hack - ak ratame displayField cez funkciu, tak nam potom v kode chyba (hociaky) atribut asociovaneho objektu
|
|
154
|
-
// aby sme nemuseli robit nejake velke prerabky a zmeny, tak podsunieme id-ckovy atribut
|
|
155
|
-
if (typeof columnPropsAutoComplete.displayField === 'string') {
|
|
156
|
-
return columnPropsAutoComplete.displayField; // vsetko ok
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
// v displayField mame funkciu, zistime id-ckovy atribut
|
|
160
|
-
// TODO - problem - sortovanie/filtrovanie bude fungovat podla tohto id atributu
|
|
161
|
-
var xAssoc = XUtilsMetadata_1.XUtilsMetadata.getXAssocToOne(XUtilsMetadata_1.XUtilsMetadata.getXEntity(this.getEntity()), columnPropsAutoComplete.assocField);
|
|
162
|
-
return XUtilsMetadata_1.XUtilsMetadata.getXEntity(xAssoc.entityName).idField;
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
153
|
XFormDataTable2.getHeader = function (columnProps, xEntity, field, xField) {
|
|
166
154
|
var _a, _b, _c, _d;
|
|
167
155
|
// poznamky - parametre field a xField by sme mohli vyratavat na zaklade columnProps ale kedze ich uz mame, setrime performance a neduplikujeme vypocet
|
|
@@ -349,6 +337,9 @@ var XFormDataTable2 = /** @class */ (function (_super) {
|
|
|
349
337
|
else if (xField.type === "date" || xField.type === "datetime") {
|
|
350
338
|
body = react_1.default.createElement(XInputDateDT_1.XInputDateDT, { form: this.props.form, xField: xField, field: columnPropsInputSimple.field, rowData: rowData, readOnly: readOnly });
|
|
351
339
|
}
|
|
340
|
+
else if (xField.type === "interval") {
|
|
341
|
+
body = react_1.default.createElement(XInputIntervalDT_1.XInputIntervalDT, { form: this.props.form, entity: this.getEntity(), field: columnPropsInputSimple.field, rowData: rowData, readOnly: readOnly });
|
|
342
|
+
}
|
|
352
343
|
else if (xField.type === "boolean") {
|
|
353
344
|
body = react_1.default.createElement(XCheckboxDT_1.XCheckboxDT, { form: this.props.form, xField: xField, field: columnPropsInputSimple.field, rowData: rowData, readOnly: readOnly });
|
|
354
345
|
}
|
|
@@ -359,17 +350,17 @@ var XFormDataTable2 = /** @class */ (function (_super) {
|
|
|
359
350
|
}
|
|
360
351
|
else if (columnProps.type === "dropdown") {
|
|
361
352
|
var columnPropsDropdown = columnProps;
|
|
362
|
-
body = react_1.default.createElement(XDropdownDT_1.XDropdownDT, { form: this.props.form, entity: this.getEntity(), assocField: columnPropsDropdown.assocField, displayField: columnPropsDropdown.displayField, dropdownOptionsMap: this.state.dropdownOptionsMap, onDropdownOptionsMapChange: this.onDropdownOptionsMapChange, rowData: rowData });
|
|
353
|
+
body = react_1.default.createElement(XDropdownDT_1.XDropdownDT, { form: this.props.form, entity: this.getEntity(), assocField: columnPropsDropdown.assocField, displayField: columnPropsDropdown.displayField, sortField: columnPropsDropdown.sortField, filter: columnPropsDropdown.filter, dropdownOptionsMap: this.state.dropdownOptionsMap, onDropdownOptionsMapChange: this.onDropdownOptionsMapChange, rowData: rowData });
|
|
363
354
|
}
|
|
364
355
|
else if (columnProps.type === "autoComplete") {
|
|
365
356
|
var columnPropsAutoComplete = columnProps;
|
|
366
357
|
// tableReadOnly has higher prio then property readOnly
|
|
367
358
|
var readOnly = tableReadOnly || ((_b = columnPropsAutoComplete.readOnly) !== null && _b !== void 0 ? _b : false);
|
|
368
|
-
body = react_1.default.createElement(XAutoCompleteDT_1.XAutoCompleteDT, { form: this.props.form, entity: this.getEntity(), assocField: columnPropsAutoComplete.assocField, displayField: columnPropsAutoComplete.displayField,
|
|
359
|
+
body = react_1.default.createElement(XAutoCompleteDT_1.XAutoCompleteDT, { form: this.props.form, entity: this.getEntity(), assocField: columnPropsAutoComplete.assocField, displayField: columnPropsAutoComplete.displayField, searchBrowse: columnPropsAutoComplete.searchBrowse, assocForm: columnPropsAutoComplete.assocForm, filter: columnPropsAutoComplete.filter, suggestions: columnPropsAutoComplete.suggestions, rowData: rowData, readOnly: readOnly });
|
|
369
360
|
}
|
|
370
361
|
else if (columnProps.type === "searchButton") {
|
|
371
362
|
var columnPropsSearchButton = columnProps;
|
|
372
|
-
body = react_1.default.createElement(XSearchButtonDT_1.XSearchButtonDT, { form: this.props.form, entity: this.getEntity(), assocField: columnPropsSearchButton.assocField, displayField: columnPropsSearchButton.displayField,
|
|
363
|
+
body = react_1.default.createElement(XSearchButtonDT_1.XSearchButtonDT, { form: this.props.form, entity: this.getEntity(), assocField: columnPropsSearchButton.assocField, displayField: columnPropsSearchButton.displayField, searchBrowse: columnPropsSearchButton.searchBrowse, rowData: rowData, readOnly: columnPropsSearchButton.readOnly });
|
|
373
364
|
}
|
|
374
365
|
else {
|
|
375
366
|
throw "Unknown prop type = " + columnProps.type;
|
|
@@ -444,27 +435,16 @@ var XFormDataTable2 = /** @class */ (function (_super) {
|
|
|
444
435
|
finally { if (e_3) throw e_3.error; }
|
|
445
436
|
}
|
|
446
437
|
};
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
460
|
-
finally {
|
|
461
|
-
try {
|
|
462
|
-
if (rowList_2_1 && !rowList_2_1.done && (_a = rowList_2.return)) _a.call(rowList_2);
|
|
463
|
-
}
|
|
464
|
-
finally { if (e_5) throw e_5.error; }
|
|
465
|
-
}
|
|
466
|
-
return msg;
|
|
467
|
-
};
|
|
438
|
+
// getErrorMessages(): string {
|
|
439
|
+
// let msg: string = "";
|
|
440
|
+
// const object: XObject = this.props.form.getXObject();
|
|
441
|
+
// const rowList: any[] = object[this.props.assocField];
|
|
442
|
+
// for (const row of rowList) {
|
|
443
|
+
// const xRowTechData: XRowTechData = XFormBase.getXRowTechData(row);
|
|
444
|
+
// msg += XUtils.getErrorMessages(xRowTechData.errorMap);
|
|
445
|
+
// }
|
|
446
|
+
// return msg;
|
|
447
|
+
// }
|
|
468
448
|
// TODO - velmi podobna funkcia ako XFormComponent.isReadOnly() - zjednotit ak sa da
|
|
469
449
|
XFormDataTable2.prototype.isReadOnly = function () {
|
|
470
450
|
var readOnly;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Component } from "react";
|
|
2
2
|
export interface XFormNavigator3Props {
|
|
3
|
-
rootFormElement?:
|
|
3
|
+
rootFormElement?: JSX.Element;
|
|
4
4
|
}
|
|
5
5
|
export declare class XFormNavigator3 extends Component<XFormNavigator3Props> {
|
|
6
6
|
state: {
|
|
7
|
-
formElements:
|
|
7
|
+
formElements: JSX.Element[];
|
|
8
8
|
};
|
|
9
9
|
constructor(props: XFormNavigator3Props);
|
|
10
|
-
openForm(newFormElement:
|
|
10
|
+
openForm(newFormElement: JSX.Element | null): void;
|
|
11
11
|
render(): JSX.Element;
|
|
12
12
|
}
|
|
@@ -110,11 +110,11 @@ var XFormNavigator3 = /** @class */ (function (_super) {
|
|
|
110
110
|
};
|
|
111
111
|
XFormNavigator3.prototype.render = function () {
|
|
112
112
|
var _this = this;
|
|
113
|
-
var formElements = this.props.rootFormElement
|
|
113
|
+
var formElements = this.props.rootFormElement ? __spreadArray([this.props.rootFormElement], __read(this.state.formElements), false) : this.state.formElements;
|
|
114
114
|
var forms = formElements.map(function (formElement, index) {
|
|
115
115
|
var displayed = (index === formElements.length - 1);
|
|
116
116
|
// klonovanim elementu pridame atribut openForm={this.openForm} (nemusime tento atribut pridavat pri vytvarani elementu)
|
|
117
|
-
var formElementCloned = react_1.default.cloneElement(formElement, { openForm: _this.openForm, displayed: displayed }
|
|
117
|
+
var formElementCloned = react_1.default.cloneElement(formElement, { openForm: _this.openForm, displayed: displayed } /*, (formElement as any).children*/);
|
|
118
118
|
// prvych n - 1 komponentov skryjeme cez display: "none" a az posledny vyrenderujeme naozaj (cez display: "block")
|
|
119
119
|
// TODO - do buducnosti - ak nechceme drzat stav componentu cez display: "none", staci vratit null (komponent vobec nevyrenderujeme)
|
|
120
120
|
var display = (displayed ? "block" : "none");
|
|
@@ -56,7 +56,7 @@ var XInputDate = /** @class */ (function (_super) {
|
|
|
56
56
|
// note: style overrides size (width of the input according to character count)
|
|
57
57
|
return (react_1.default.createElement("div", { className: "field grid" },
|
|
58
58
|
react_1.default.createElement("label", { htmlFor: this.props.field, className: "col-fixed", style: this.getLabelStyle() }, this.getLabel()),
|
|
59
|
-
react_1.default.createElement(XCalendar_1.XCalendar, { id: this.props.field, value: this.getValue(), onChange: this.onValueChange, readOnly: this.isReadOnly(), datetime: this.xField.type === 'datetime' })));
|
|
59
|
+
react_1.default.createElement(XCalendar_1.XCalendar, { id: this.props.field, value: this.getValue(), onChange: this.onValueChange, readOnly: this.isReadOnly(), datetime: this.xField.type === 'datetime', onBlur: this.onBlur })));
|
|
60
60
|
};
|
|
61
61
|
return XInputDate;
|
|
62
62
|
}(XInput_1.XInput));
|
|
@@ -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;
|