@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
package/lib/components/XUtils.js
CHANGED
|
@@ -73,6 +73,15 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
73
73
|
}
|
|
74
74
|
return ar;
|
|
75
75
|
};
|
|
76
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
77
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
78
|
+
if (ar || !(i in from)) {
|
|
79
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
80
|
+
ar[i] = from[i];
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
84
|
+
};
|
|
76
85
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
77
86
|
exports.XUtils = exports.OperationType = void 0;
|
|
78
87
|
var XUtilsMetadata_1 = require("./XUtilsMetadata");
|
|
@@ -260,7 +269,7 @@ var XUtils = /** @class */ (function () {
|
|
|
260
269
|
return __generator(this, function (_a) {
|
|
261
270
|
switch (_a.label) {
|
|
262
271
|
case 0:
|
|
263
|
-
findParam = { resultType: FindParam_1.ResultType.AllRows, entity: entity,
|
|
272
|
+
findParam = { resultType: FindParam_1.ResultType.AllRows, entity: entity, customFilterItems: XUtils.createCustomFilterItems(customFilter), multiSortMeta: sortField ? [{ field: sortField, order: 1 }] : undefined, fields: fields };
|
|
264
273
|
return [4 /*yield*/, XUtils.fetchOne('lazyDataTableFindRows', findParam)];
|
|
265
274
|
case 1:
|
|
266
275
|
rowList = (_a.sent()).rowList;
|
|
@@ -446,6 +455,7 @@ var XUtils = /** @class */ (function () {
|
|
|
446
455
|
});
|
|
447
456
|
});
|
|
448
457
|
};
|
|
458
|
+
// TODO - prehodit do XUtilsCommon
|
|
449
459
|
XUtils.arrayMoveElement = function (array, position, offset) {
|
|
450
460
|
var element = array[position];
|
|
451
461
|
array.splice(position, 1);
|
|
@@ -460,7 +470,7 @@ var XUtils = /** @class */ (function () {
|
|
|
460
470
|
array.splice(positionNew, 0, element);
|
|
461
471
|
}
|
|
462
472
|
};
|
|
463
|
-
//
|
|
473
|
+
// TODO - prehodit do XUtilsCommon
|
|
464
474
|
XUtils.arraySort = function (array, fieldOrStringFunction) {
|
|
465
475
|
var stringFunction;
|
|
466
476
|
if (typeof fieldOrStringFunction === 'string') {
|
|
@@ -483,6 +493,47 @@ var XUtils = /** @class */ (function () {
|
|
|
483
493
|
}
|
|
484
494
|
});
|
|
485
495
|
};
|
|
496
|
+
// TODO - prehodit do XUtilsCommon
|
|
497
|
+
/**
|
|
498
|
+
* returns true, if param item is member of the array
|
|
499
|
+
* remark: null/undefined items in array are ignored, item = null/undefined is ignored
|
|
500
|
+
*
|
|
501
|
+
* @param array
|
|
502
|
+
* @param item
|
|
503
|
+
* @param idField
|
|
504
|
+
*/
|
|
505
|
+
XUtils.arrayIncludes = function (array, item, idField) {
|
|
506
|
+
return item && array.some(function (arrayItem) { return arrayItem && arrayItem[idField] === item[idField]; });
|
|
507
|
+
};
|
|
508
|
+
// TODO - prehodit do XUtilsCommon
|
|
509
|
+
/**
|
|
510
|
+
* returns intersection of 2 row lists
|
|
511
|
+
* remark: null/undefined items in both array1 and array2 are ignored
|
|
512
|
+
*
|
|
513
|
+
* @param array1
|
|
514
|
+
* @param array2
|
|
515
|
+
* @param idField
|
|
516
|
+
*/
|
|
517
|
+
XUtils.arrayIntersect = function (array1, array2, idField) {
|
|
518
|
+
var e_5, _a;
|
|
519
|
+
var array2IdSet = new Set();
|
|
520
|
+
try {
|
|
521
|
+
for (var array2_1 = __values(array2), array2_1_1 = array2_1.next(); !array2_1_1.done; array2_1_1 = array2_1.next()) {
|
|
522
|
+
var item = array2_1_1.value;
|
|
523
|
+
if (item) {
|
|
524
|
+
array2IdSet.add(item[idField]);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
529
|
+
finally {
|
|
530
|
+
try {
|
|
531
|
+
if (array2_1_1 && !array2_1_1.done && (_a = array2_1.return)) _a.call(array2_1);
|
|
532
|
+
}
|
|
533
|
+
finally { if (e_5) throw e_5.error; }
|
|
534
|
+
}
|
|
535
|
+
return array1.filter(function (item) { return item && array2IdSet.has(item[idField]); });
|
|
536
|
+
};
|
|
486
537
|
// helper
|
|
487
538
|
XUtils.isReadOnly = function (path, readOnlyInit) {
|
|
488
539
|
// ak mame path dlzky 2 a viac, field je vzdy readOnly
|
|
@@ -539,7 +590,7 @@ var XUtils = /** @class */ (function () {
|
|
|
539
590
|
// pomocna metodka
|
|
540
591
|
// ak nie su v xErrorMap ziadne chyby, vrati ""
|
|
541
592
|
XUtils.getErrorMessages = function (xErrorMap) {
|
|
542
|
-
var
|
|
593
|
+
var e_6, _a;
|
|
543
594
|
var _b;
|
|
544
595
|
var msg = "";
|
|
545
596
|
try {
|
|
@@ -553,12 +604,12 @@ var XUtils = /** @class */ (function () {
|
|
|
553
604
|
}
|
|
554
605
|
}
|
|
555
606
|
}
|
|
556
|
-
catch (
|
|
607
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
557
608
|
finally {
|
|
558
609
|
try {
|
|
559
610
|
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
560
611
|
}
|
|
561
|
-
finally { if (
|
|
612
|
+
finally { if (e_6) throw e_6.error; }
|
|
562
613
|
}
|
|
563
614
|
return msg;
|
|
564
615
|
};
|
|
@@ -592,20 +643,47 @@ var XUtils = /** @class */ (function () {
|
|
|
592
643
|
}
|
|
593
644
|
return value;
|
|
594
645
|
};
|
|
595
|
-
// pomocna metodka
|
|
596
|
-
XUtils.
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
646
|
+
// pomocna metodka - konvertuje XCustomFilter -> XCustomFilterItem[]
|
|
647
|
+
XUtils.createCustomFilterItems = function (customFilter) {
|
|
648
|
+
var customFilterItems = undefined;
|
|
649
|
+
if (customFilter) {
|
|
650
|
+
if (Array.isArray(customFilter)) {
|
|
651
|
+
customFilterItems = customFilter;
|
|
652
|
+
}
|
|
653
|
+
else {
|
|
654
|
+
customFilterItems = [customFilter];
|
|
655
|
+
}
|
|
605
656
|
}
|
|
606
|
-
|
|
607
|
-
|
|
657
|
+
return customFilterItems;
|
|
658
|
+
};
|
|
659
|
+
// pomocna metodka
|
|
660
|
+
XUtils.filterAnd = function () {
|
|
661
|
+
var e_7, _a;
|
|
662
|
+
var filters = [];
|
|
663
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
664
|
+
filters[_i] = arguments[_i];
|
|
665
|
+
}
|
|
666
|
+
var customFilterItemsResult = undefined;
|
|
667
|
+
if (filters.length > 0) {
|
|
668
|
+
customFilterItemsResult = [];
|
|
669
|
+
try {
|
|
670
|
+
for (var filters_1 = __values(filters), filters_1_1 = filters_1.next(); !filters_1_1.done; filters_1_1 = filters_1.next()) {
|
|
671
|
+
var filter = filters_1_1.value;
|
|
672
|
+
var customFilterItems = XUtils.createCustomFilterItems(filter);
|
|
673
|
+
if (customFilterItems) {
|
|
674
|
+
customFilterItemsResult.push.apply(customFilterItemsResult, __spreadArray([], __read(customFilterItems), false));
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
679
|
+
finally {
|
|
680
|
+
try {
|
|
681
|
+
if (filters_1_1 && !filters_1_1.done && (_a = filters_1.return)) _a.call(filters_1);
|
|
682
|
+
}
|
|
683
|
+
finally { if (e_7) throw e_7.error; }
|
|
684
|
+
}
|
|
608
685
|
}
|
|
686
|
+
return customFilterItemsResult;
|
|
609
687
|
};
|
|
610
688
|
XUtils.dropdownEmptyOptionValue = " ";
|
|
611
689
|
XUtils.xBackendUrl = undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IPostgresInterval } from "./XUtils";
|
|
1
2
|
export declare function stringFromUI(stringValue: string): string | null;
|
|
2
3
|
export declare function stringAsUI(value: string | null): string;
|
|
3
4
|
export declare function numberFromUI(stringValue: string): number | null;
|
|
@@ -10,3 +11,5 @@ export declare function timeFromModel(value: any): Date | null;
|
|
|
10
11
|
export declare function dateFormatUI(): string;
|
|
11
12
|
export declare function dateFormatCalendar(): string;
|
|
12
13
|
export declare function datetimeFormatUI(): string;
|
|
14
|
+
export declare function intervalFromUI(valueString: string): IPostgresInterval | null | undefined;
|
|
15
|
+
export declare function intervalAsUI(valueInterval: IPostgresInterval | null): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.datetimeFormatUI = exports.dateFormatCalendar = exports.dateFormatUI = exports.timeFromModel = exports.datetimeAsUI = exports.dateAsUI = exports.dateFromModel = exports.numberFromModel = exports.numberAsUI = exports.numberFromUI = exports.stringAsUI = exports.stringFromUI = void 0;
|
|
3
|
+
exports.intervalAsUI = exports.intervalFromUI = exports.datetimeFormatUI = exports.dateFormatCalendar = exports.dateFormatUI = exports.timeFromModel = exports.datetimeAsUI = exports.dateAsUI = exports.dateFromModel = exports.numberFromModel = exports.numberAsUI = exports.numberFromUI = exports.stringAsUI = exports.stringFromUI = void 0;
|
|
4
4
|
var XUtilsCommon_1 = require("../serverApi/XUtilsCommon");
|
|
5
5
|
function stringFromUI(stringValue) {
|
|
6
6
|
var value;
|
|
@@ -123,3 +123,55 @@ function datetimeFormatUI() {
|
|
|
123
123
|
return "dd.mm.yyyy HH:MM:ss";
|
|
124
124
|
}
|
|
125
125
|
exports.datetimeFormatUI = datetimeFormatUI;
|
|
126
|
+
function intervalFromUI(valueString) {
|
|
127
|
+
// convert e.target.value (e.g. 10:29) into IPostgresInterval (e.g. {hours: 10, minutes: 29})
|
|
128
|
+
// if stringValue is invalid, returns undefined
|
|
129
|
+
var valueInterval = undefined;
|
|
130
|
+
if (valueString === '') {
|
|
131
|
+
valueInterval = null;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
var posColon = valueString.indexOf(':');
|
|
135
|
+
if (posColon === -1) {
|
|
136
|
+
var minutes = parseInt(valueString);
|
|
137
|
+
if (!isNaN(minutes)) {
|
|
138
|
+
var hours = Math.floor(minutes / 60);
|
|
139
|
+
minutes = minutes - (hours * 60);
|
|
140
|
+
valueInterval = { hours: hours, minutes: minutes };
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
var hours = parseInt(valueString.substring(0, posColon));
|
|
145
|
+
var minutes = parseInt(valueString.substring(posColon + 1));
|
|
146
|
+
if (!isNaN(hours) && !isNaN(minutes)) {
|
|
147
|
+
if (minutes >= 60) {
|
|
148
|
+
var hoursFromMinutes = Math.floor(minutes / 60);
|
|
149
|
+
hours += hoursFromMinutes;
|
|
150
|
+
minutes = minutes - (hoursFromMinutes * 60);
|
|
151
|
+
}
|
|
152
|
+
valueInterval = { hours: hours, minutes: minutes };
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return valueInterval;
|
|
157
|
+
}
|
|
158
|
+
exports.intervalFromUI = intervalFromUI;
|
|
159
|
+
function intervalAsUI(valueInterval) {
|
|
160
|
+
var _a, _b;
|
|
161
|
+
// conversion e.g. {hours: 10, minutes: 29} => '10:29'
|
|
162
|
+
var valueString;
|
|
163
|
+
if (valueInterval !== null) {
|
|
164
|
+
var hours = (_a = valueInterval.hours) !== null && _a !== void 0 ? _a : 0;
|
|
165
|
+
var minutes = (_b = valueInterval.minutes) !== null && _b !== void 0 ? _b : 0;
|
|
166
|
+
//const seconds: number = value.seconds ?? 0;
|
|
167
|
+
if (valueInterval.days) {
|
|
168
|
+
hours += valueInterval.days * 24;
|
|
169
|
+
}
|
|
170
|
+
valueString = "".concat(hours.toString(), ":").concat(minutes.toString().padStart(2, '0'));
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
valueString = ''; // null
|
|
174
|
+
}
|
|
175
|
+
return valueString;
|
|
176
|
+
}
|
|
177
|
+
exports.intervalAsUI = intervalAsUI;
|
|
@@ -21,6 +21,9 @@
|
|
|
21
21
|
"expEncoding": "Encoding",
|
|
22
22
|
"fileUploadSizeToBig": "Upload of file \"{fileName}\" was canceled: file size {fileSize} is more than maximum allowed size {maxFileSize}.",
|
|
23
23
|
"fileUploadFailed": "Upload of file \"{fileName}\" failed.",
|
|
24
|
-
"fileDownloadFailed": "File download failed."
|
|
24
|
+
"fileDownloadFailed": "File download failed.",
|
|
25
|
+
"fieldSetSaveEditConfirm": "Are you sure to save the form?",
|
|
26
|
+
"fieldSetCancelEditConfirm": "Are you sure to cancel editing? All changes will be lost.",
|
|
27
|
+
"fieldSetRemoveFieldConfirm": "Are you sure to remove the field?"
|
|
25
28
|
}
|
|
26
29
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataTableFilterMeta, DataTableSortMeta } from "primereact/datatable";
|
|
2
|
-
import {
|
|
2
|
+
import { XCustomFilterItem } from "./FindParam";
|
|
3
3
|
export declare enum ExportType {
|
|
4
4
|
Csv = "csv",
|
|
5
5
|
Json = "json"
|
|
@@ -11,7 +11,7 @@ export interface ExportParam {
|
|
|
11
11
|
}
|
|
12
12
|
export interface LazyDataTableQueryParam {
|
|
13
13
|
filters: DataTableFilterMeta;
|
|
14
|
-
|
|
14
|
+
customFilterItems?: XCustomFilterItem[];
|
|
15
15
|
multiSortMeta?: DataTableSortMeta[];
|
|
16
16
|
entity: string;
|
|
17
17
|
fields: string[];
|
|
@@ -4,13 +4,14 @@ export declare enum ResultType {
|
|
|
4
4
|
RowCountAndPagedRows = 1,
|
|
5
5
|
AllRows = 2
|
|
6
6
|
}
|
|
7
|
-
export interface
|
|
7
|
+
export interface XParams {
|
|
8
8
|
[key: string]: any;
|
|
9
9
|
}
|
|
10
|
-
export interface
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
export interface XCustomFilterItem {
|
|
11
|
+
where: string;
|
|
12
|
+
params: XParams;
|
|
13
13
|
}
|
|
14
|
+
export type XCustomFilter = XCustomFilterItem | XCustomFilterItem[];
|
|
14
15
|
export declare enum XAggregateType {
|
|
15
16
|
Min = "MIN",
|
|
16
17
|
Max = "MAX",
|
|
@@ -26,7 +27,7 @@ export interface FindParam {
|
|
|
26
27
|
first?: number;
|
|
27
28
|
rows?: number;
|
|
28
29
|
filters?: DataTableFilterMeta;
|
|
29
|
-
|
|
30
|
+
customFilterItems?: XCustomFilterItem[];
|
|
30
31
|
multiSortMeta?: DataTableSortMeta[];
|
|
31
32
|
entity: string;
|
|
32
33
|
fields?: string[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare class XUtilsCommon {
|
|
2
2
|
static newLine: string;
|
|
3
3
|
static getValueByPath(object: any, path: string): any;
|
|
4
|
+
static getValueOrValueListByPath(object: any, path: string): any | any[];
|
|
4
5
|
static getFieldListForPath(path: string): string[];
|
|
5
6
|
static getFieldAndRestPath(path: string): [string, string | null];
|
|
6
7
|
static getPathToAssoc(path: string): string;
|
|
@@ -15,6 +15,26 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
15
15
|
}
|
|
16
16
|
return ar;
|
|
17
17
|
};
|
|
18
|
+
var __values = (this && this.__values) || function(o) {
|
|
19
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
20
|
+
if (m) return m.call(o);
|
|
21
|
+
if (o && typeof o.length === "number") return {
|
|
22
|
+
next: function () {
|
|
23
|
+
if (o && i >= o.length) o = void 0;
|
|
24
|
+
return { value: o && o[i++], done: !o };
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
28
|
+
};
|
|
29
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
30
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
31
|
+
if (ar || !(i in from)) {
|
|
32
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
33
|
+
ar[i] = from[i];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
37
|
+
};
|
|
18
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
39
|
exports.dateFormat = exports.XUtilsCommon = void 0;
|
|
20
40
|
// funkcie spolocne pre Web i pre Server
|
|
@@ -38,6 +58,56 @@ var XUtilsCommon = /** @class */ (function () {
|
|
|
38
58
|
}
|
|
39
59
|
}
|
|
40
60
|
};
|
|
61
|
+
// vseobecnejsia verzia, ktora funguje aj pre *toMany asociacie
|
|
62
|
+
// TODO - toto by sme mohli doplnit o kontrolu ak programator urobil preklep
|
|
63
|
+
XUtilsCommon.getValueOrValueListByPath = function (object, path) {
|
|
64
|
+
var e_1, _a;
|
|
65
|
+
var _b = __read(XUtilsCommon.getFieldAndRestPath(path), 2), field = _b[0], restPath = _b[1];
|
|
66
|
+
if (restPath === null) {
|
|
67
|
+
return object[field];
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
var assocObject = object[field];
|
|
71
|
+
if (Array.isArray(assocObject)) {
|
|
72
|
+
// natrafili sme na pole (atribut "field" je *toMany asociacia), pozbierame hodnoty z pola
|
|
73
|
+
var resultValueList = [];
|
|
74
|
+
try {
|
|
75
|
+
for (var assocObject_1 = __values(assocObject), assocObject_1_1 = assocObject_1.next(); !assocObject_1_1.done; assocObject_1_1 = assocObject_1.next()) {
|
|
76
|
+
var assocObjectItem = assocObject_1_1.value;
|
|
77
|
+
if (assocObjectItem !== null && assocObjectItem !== undefined) { // pre istotu, nemalo by nastat
|
|
78
|
+
var itemValue = XUtilsCommon.getValueOrValueListByPath(assocObjectItem, restPath);
|
|
79
|
+
if (Array.isArray(itemValue)) {
|
|
80
|
+
resultValueList.push.apply(resultValueList, __spreadArray([], __read(itemValue), false));
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
resultValueList.push(itemValue);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
resultValueList.push(null);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
92
|
+
finally {
|
|
93
|
+
try {
|
|
94
|
+
if (assocObject_1_1 && !assocObject_1_1.done && (_a = assocObject_1.return)) _a.call(assocObject_1);
|
|
95
|
+
}
|
|
96
|
+
finally { if (e_1) throw e_1.error; }
|
|
97
|
+
}
|
|
98
|
+
return resultValueList;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
// pri vytvarani noveho riadku - assocObject neni v novom objekte ani ako null (je undefined)
|
|
102
|
+
if (assocObject !== null && assocObject !== undefined) {
|
|
103
|
+
return XUtilsCommon.getValueOrValueListByPath(assocObject, restPath);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
return null; // asociovany objekt je null, aj hodnota atributu bude null
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
41
111
|
XUtilsCommon.getFieldListForPath = function (path) {
|
|
42
112
|
return path.split('.');
|
|
43
113
|
};
|
package/package.json
CHANGED
package/XBrowse.d.ts
DELETED
package/XBrowse.js
DELETED
|
File without changes
|