@michalrakus/x-react-web-lib 1.22.0 → 1.23.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/XMultiSelect.d.ts +3 -0
- package/XMultiSelect.js +5 -0
- package/XMultiSelectBase.d.ts +3 -0
- package/XMultiSelectBase.js +5 -0
- package/gulpfile.js +2 -0
- package/lib/administration/XBrowseMetaBrowse.d.ts +2 -2
- package/lib/administration/XBrowseMetaForm.d.ts +2 -2
- package/lib/administration/XParamBrowse.d.ts +2 -2
- package/lib/administration/XParamForm.d.ts +2 -2
- package/lib/administration/XUserBrowse.d.ts +2 -2
- package/lib/administration/XUserForm.d.ts +2 -2
- package/lib/components/SourceCodeLinkEntity.d.ts +2 -2
- package/lib/components/XAutoComplete.d.ts +2 -1
- package/lib/components/XAutoComplete.js +2 -2
- package/lib/components/XAutoCompleteBase.d.ts +5 -11
- package/lib/components/XAutoCompleteBase.js +28 -11
- package/lib/components/XAutoCompleteDT.d.ts +1 -1
- package/lib/components/XButton.d.ts +1 -1
- package/lib/components/XButtonIconMedium.d.ts +1 -1
- package/lib/components/XButtonIconNarrow.d.ts +1 -1
- package/lib/components/XButtonIconSmall.d.ts +1 -1
- package/lib/components/XCalendar.d.ts +2 -2
- package/lib/components/XCalendar.js +1 -1
- package/lib/components/XChangePasswordForm.d.ts +2 -2
- package/lib/components/XCheckboxDT.d.ts +2 -2
- package/lib/components/XDataTable.d.ts +2 -2
- package/lib/components/XDropdown.d.ts +2 -2
- package/lib/components/XDropdown.js +1 -1
- package/lib/components/XDropdownDT.d.ts +2 -2
- package/lib/components/XDropdownDTFilter.d.ts +2 -2
- package/lib/components/XDropdownForEntity.d.ts +2 -2
- package/lib/components/XDropdownForEntity.js +1 -1
- package/lib/components/XDropdownFormDTFilter.d.ts +2 -2
- package/lib/components/XEditBrowse.d.ts +2 -2
- package/lib/components/XEditColumnDialog.d.ts +2 -2
- package/lib/components/XEditor.d.ts +1 -1
- package/lib/components/XEditorBase.d.ts +1 -1
- package/lib/components/XEditorBase.js +1 -1
- package/lib/components/XFieldSelector.d.ts +2 -2
- package/lib/components/XFormComponent.d.ts +1 -0
- package/lib/components/XFormDataTable2.d.ts +1 -1
- package/lib/components/XFormFooter.d.ts +2 -2
- package/lib/components/XFormHeader.d.ts +2 -2
- package/lib/components/XFormNavigator3.d.ts +2 -2
- package/lib/components/XFormRowCol/XFormCol.d.ts +1 -1
- package/lib/components/XFormRowCol/XFormInlineRow.d.ts +1 -1
- package/lib/components/XFormRowCol/XFormRow.d.ts +1 -1
- package/lib/components/XFormRowCol/XFormRowCol.d.ts +1 -1
- package/lib/components/XFtsInput.d.ts +2 -2
- package/lib/components/XHolders.d.ts +3 -3
- package/lib/components/XInputDate.d.ts +2 -2
- package/lib/components/XInputDateDT.d.ts +2 -2
- package/lib/components/XInputDecimal.d.ts +1 -1
- package/lib/components/XInputDecimalBase.d.ts +2 -2
- package/lib/components/XInputDecimalDT.d.ts +2 -2
- package/lib/components/XInputDecimalDT.js +1 -1
- package/lib/components/XInputFileList.d.ts +2 -1
- package/lib/components/XInputInterval.d.ts +1 -1
- package/lib/components/XInputIntervalBase.d.ts +2 -2
- package/lib/components/XInputIntervalBase.js +1 -1
- package/lib/components/XInputIntervalDT.d.ts +2 -2
- package/lib/components/XInputText.d.ts +2 -2
- package/lib/components/XInputText.js +14 -3
- package/lib/components/XInputTextDT.d.ts +2 -2
- package/lib/components/XInputTextarea.d.ts +1 -1
- package/lib/components/XInputTextarea.js +13 -3
- package/lib/components/XInputTextareaBase.d.ts +3 -1
- package/lib/components/XInputTextareaBase.js +1 -1
- package/lib/components/XInputTextareaDT.d.ts +2 -2
- package/lib/components/XLazyDataTable/XExportRowsDialog.d.ts +2 -2
- package/lib/components/XLazyDataTable/XLazyDataTable.d.ts +1 -1
- package/lib/components/XLazyDataTable/XMultilineSwitch.d.ts +2 -2
- package/lib/components/XLazyDataTable/XOcfDropdown.d.ts +2 -2
- package/lib/components/XLoginDialog.d.ts +2 -2
- package/lib/components/XLoginForm.d.ts +2 -2
- package/lib/components/XMultiSelect.d.ts +25 -0
- package/lib/components/XMultiSelect.js +97 -0
- package/lib/components/XMultiSelectBase.d.ts +27 -0
- package/lib/components/XMultiSelectBase.js +145 -0
- package/lib/components/XSearchBrowseParams.d.ts +1 -1
- package/lib/components/XSearchButton.d.ts +1 -1
- package/lib/components/XSearchButtonDT.d.ts +2 -2
- package/lib/components/XSearchButtonOld.d.ts +1 -1
- package/lib/components/XToOneAssocButton.d.ts +2 -2
- package/lib/components/XToken.d.ts +1 -1
- package/lib/components/XUtils.d.ts +9 -2
- package/lib/components/XUtils.js +41 -21
- package/lib/serverApi/XUtilsMetadataCommon.d.ts +3 -1
- package/lib/serverApi/XUtilsMetadataCommon.js +9 -3
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { XFormBase } from "./XFormBase";
|
|
2
|
+
import React from "react";
|
|
3
3
|
import { XTableFieldReadOnlyProp } from "./XFormDataTable2";
|
|
4
4
|
export declare const XSearchButtonDT: (props: {
|
|
5
5
|
form: XFormBase;
|
|
@@ -10,4 +10,4 @@ export declare const XSearchButtonDT: (props: {
|
|
|
10
10
|
assocForm?: JSX.Element | undefined;
|
|
11
11
|
rowData: any;
|
|
12
12
|
readOnly?: XTableFieldReadOnlyProp | undefined;
|
|
13
|
-
}) => JSX.Element;
|
|
13
|
+
}) => React.JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { XFormBase } from "./XFormBase";
|
|
2
|
+
import React from "react";
|
|
3
3
|
export declare const XToOneAssocButton: (props: {
|
|
4
4
|
form: XFormBase;
|
|
5
5
|
assocField: string;
|
|
6
6
|
assocForm: any;
|
|
7
7
|
label?: string | undefined;
|
|
8
|
-
}) => JSX.Element;
|
|
8
|
+
}) => React.JSX.Element;
|
|
@@ -7,7 +7,6 @@ import { XCustomFilter, XCustomFilterItem } from "../serverApi/FindParam";
|
|
|
7
7
|
import { DataTableSortMeta } from "primereact/datatable";
|
|
8
8
|
import { XObject } from "./XObject";
|
|
9
9
|
import { XTableFieldReadOnlyProp } from "./XFormDataTable2";
|
|
10
|
-
import { XFilterOrFunction } from "./XAutoCompleteBase";
|
|
11
10
|
export declare enum OperationType {
|
|
12
11
|
None = 0,
|
|
13
12
|
Insert = 1,
|
|
@@ -29,6 +28,13 @@ export interface IPostgresInterval {
|
|
|
29
28
|
seconds?: number;
|
|
30
29
|
milliseconds?: number;
|
|
31
30
|
}
|
|
31
|
+
export type XFilterOrFunction = XCustomFilter | (() => XCustomFilter | undefined);
|
|
32
|
+
export interface XQuery {
|
|
33
|
+
entity: string;
|
|
34
|
+
filter?: XFilterOrFunction;
|
|
35
|
+
sortField?: string | DataTableSortMeta[];
|
|
36
|
+
fields?: string[];
|
|
37
|
+
}
|
|
32
38
|
export declare class XUtils {
|
|
33
39
|
static dropdownEmptyOptionValue: string;
|
|
34
40
|
static xBackendUrl: string | undefined;
|
|
@@ -69,6 +75,7 @@ export declare class XUtils {
|
|
|
69
75
|
static fetchById(entity: string, fields: string[], id: number): Promise<any>;
|
|
70
76
|
static setXToken(xToken: XToken | null): void;
|
|
71
77
|
static getXToken(): XToken | null;
|
|
78
|
+
static getAccessToken(): Promise<string>;
|
|
72
79
|
static getUsername(): string | undefined;
|
|
73
80
|
static getXBackendUrl(): string;
|
|
74
81
|
static setXBackendUrl(xBackendUrl: string | undefined): void;
|
|
@@ -102,7 +109,7 @@ export declare class XUtils {
|
|
|
102
109
|
static isReadOnlyTableField(path: string | undefined, readOnly: XTableFieldReadOnlyProp | undefined, object: XObject | null, tableRow: any): boolean;
|
|
103
110
|
static markNotNull(label: string): string;
|
|
104
111
|
static showErrorMessage(message: string, e: unknown): void;
|
|
105
|
-
static
|
|
112
|
+
static createTooltipOrErrorProps(error: string | undefined, tooltip?: string | undefined): object;
|
|
106
113
|
static addClassName(props: {
|
|
107
114
|
[key: string]: any;
|
|
108
115
|
}, className: string): {
|
package/lib/components/XUtils.js
CHANGED
|
@@ -424,36 +424,26 @@ var XUtils = /** @class */ (function () {
|
|
|
424
424
|
};
|
|
425
425
|
XUtils.fetchBasic = function (path, headers, body, usePublicToken) {
|
|
426
426
|
return __awaiter(this, void 0, void 0, function () {
|
|
427
|
-
var
|
|
427
|
+
var accessToken, response, responseBody;
|
|
428
428
|
return __generator(this, function (_a) {
|
|
429
429
|
switch (_a.label) {
|
|
430
|
-
case 0:
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
}
|
|
434
|
-
else if (usePublicToken) {
|
|
435
|
-
xToken = XUtils.xTokenPublic; // public token vzdy
|
|
436
|
-
}
|
|
437
|
-
else {
|
|
438
|
-
xToken = XUtils.getXToken();
|
|
439
|
-
if (xToken === null) {
|
|
440
|
-
xToken = XUtils.xTokenPublic; // ak nikto nie je prihlaseny, posleme public token
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
headers = __assign(__assign({}, headers), { 'Authorization': "Bearer ".concat(xToken.accessToken) });
|
|
430
|
+
case 0: return [4 /*yield*/, XUtils.getAccessToken()];
|
|
431
|
+
case 1:
|
|
432
|
+
accessToken = _a.sent();
|
|
433
|
+
headers = __assign(__assign({}, headers), { 'Authorization': "Bearer ".concat(accessToken) });
|
|
444
434
|
return [4 /*yield*/, fetch(XUtils.getXBackendUrl() + path, {
|
|
445
435
|
method: 'POST',
|
|
446
436
|
headers: headers,
|
|
447
437
|
body: body
|
|
448
438
|
})];
|
|
449
|
-
case
|
|
439
|
+
case 2:
|
|
450
440
|
response = _a.sent();
|
|
451
|
-
if (!!response.ok) return [3 /*break*/,
|
|
441
|
+
if (!!response.ok) return [3 /*break*/, 4];
|
|
452
442
|
return [4 /*yield*/, response.json()];
|
|
453
|
-
case
|
|
443
|
+
case 3:
|
|
454
444
|
responseBody = _a.sent();
|
|
455
445
|
throw new XResponseError_1.XResponseError(path, response.status, response.statusText, responseBody);
|
|
456
|
-
case
|
|
446
|
+
case 4: return [2 /*return*/, response];
|
|
457
447
|
}
|
|
458
448
|
});
|
|
459
449
|
});
|
|
@@ -467,6 +457,34 @@ var XUtils = /** @class */ (function () {
|
|
|
467
457
|
XUtils.getXToken = function () {
|
|
468
458
|
return XUtils.xToken;
|
|
469
459
|
};
|
|
460
|
+
XUtils.getAccessToken = function () {
|
|
461
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
462
|
+
var xToken, accessToken;
|
|
463
|
+
return __generator(this, function (_a) {
|
|
464
|
+
switch (_a.label) {
|
|
465
|
+
case 0:
|
|
466
|
+
xToken = XUtils.getXToken();
|
|
467
|
+
if (xToken === null) {
|
|
468
|
+
throw "Unexpected error - XUtils.xToken is null (no user signed in)";
|
|
469
|
+
}
|
|
470
|
+
if (!(typeof xToken.accessToken === 'function')) return [3 /*break*/, 2];
|
|
471
|
+
return [4 /*yield*/, xToken.accessToken()];
|
|
472
|
+
case 1:
|
|
473
|
+
accessToken = _a.sent(); // ziskame access token volanim getAccessTokenSilently (pripadne podobnym)
|
|
474
|
+
return [3 /*break*/, 3];
|
|
475
|
+
case 2:
|
|
476
|
+
if (xToken.accessToken !== undefined) {
|
|
477
|
+
accessToken = xToken.accessToken; // mame rovno access token
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
throw "Unexpected error - XUtils.xToken.accessToken is undefined";
|
|
481
|
+
}
|
|
482
|
+
_a.label = 3;
|
|
483
|
+
case 3: return [2 /*return*/, accessToken];
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
});
|
|
487
|
+
};
|
|
470
488
|
XUtils.getUsername = function () {
|
|
471
489
|
var _a, _b;
|
|
472
490
|
return (_b = (_a = XUtils.getXToken()) === null || _a === void 0 ? void 0 : _a.xUser) === null || _b === void 0 ? void 0 : _b.username;
|
|
@@ -653,8 +671,10 @@ var XUtils = /** @class */ (function () {
|
|
|
653
671
|
alert(msg);
|
|
654
672
|
};
|
|
655
673
|
// pouziva sa hlavne na inputy
|
|
656
|
-
XUtils.
|
|
657
|
-
|
|
674
|
+
XUtils.createTooltipOrErrorProps = function (error, tooltip) {
|
|
675
|
+
// error ma prednost, ak nemame error, dame tooltip ak mame
|
|
676
|
+
return error ? { className: "p-invalid", tooltip: error, tooltipOptions: { className: 'pink-tooltip', position: 'bottom' } }
|
|
677
|
+
: (tooltip ? { tooltip: tooltip, tooltipOptions: { position: 'bottom' } } : {});
|
|
658
678
|
};
|
|
659
679
|
// pomocna metodka - prida className do props, ak uz className v props existuje tak len pripoji dalsiu hodnotu
|
|
660
680
|
// pouzivame ju, lebo XUtils.createErrorProps nam prebijal className
|
|
@@ -16,7 +16,9 @@ export declare class XUtilsMetadataCommon {
|
|
|
16
16
|
static hasPathToManyAssoc(xEntity: XEntity, path: string): boolean;
|
|
17
17
|
static getXFieldByPathStr(entity: string, path: string): XField;
|
|
18
18
|
static getXAssocBase(xEntity: XEntity, assocField: string): XAssoc | undefined;
|
|
19
|
-
static
|
|
19
|
+
static getXAssocToOneByPath(xEntity: XEntity, path: string): XAssoc;
|
|
20
|
+
static getXAssocToManyByPath(xEntity: XEntity, path: string): XAssoc;
|
|
21
|
+
static getXAssocByPath(xEntity: XEntity, path: string, relationTypeList?: XRelationType[]): XAssoc;
|
|
20
22
|
static getLastXAssocByPath(xEntity: XEntity, path: string): XAssoc;
|
|
21
23
|
static getXAssocToOne(xEntity: XEntity, assocField: string): XAssoc;
|
|
22
24
|
static getXAssocToMany(xEntity: XEntity, assocField: string): XAssoc;
|
|
@@ -114,15 +114,21 @@ var XUtilsMetadataCommon = /** @class */ (function () {
|
|
|
114
114
|
XUtilsMetadataCommon.getXAssocBase = function (xEntity, assocField) {
|
|
115
115
|
return xEntity.assocMap[assocField];
|
|
116
116
|
};
|
|
117
|
-
XUtilsMetadataCommon.
|
|
117
|
+
XUtilsMetadataCommon.getXAssocToOneByPath = function (xEntity, path) {
|
|
118
|
+
return XUtilsMetadataCommon.getXAssocByPath(xEntity, path, ["many-to-one", "one-to-one"]);
|
|
119
|
+
};
|
|
120
|
+
XUtilsMetadataCommon.getXAssocToManyByPath = function (xEntity, path) {
|
|
121
|
+
return XUtilsMetadataCommon.getXAssocByPath(xEntity, path, ["one-to-many", "many-to-many"]);
|
|
122
|
+
};
|
|
123
|
+
XUtilsMetadataCommon.getXAssocByPath = function (xEntity, path, relationTypeList) {
|
|
118
124
|
var _a = __read(XUtilsCommon_1.XUtilsCommon.getFieldAndRestPath(path), 2), field = _a[0], restPath = _a[1];
|
|
119
125
|
if (restPath === null) {
|
|
120
126
|
return XUtilsMetadataCommon.getXAssoc(xEntity, field);
|
|
121
127
|
}
|
|
122
128
|
else {
|
|
123
|
-
var xAssoc = XUtilsMetadataCommon.getXAssoc(xEntity, field);
|
|
129
|
+
var xAssoc = XUtilsMetadataCommon.getXAssoc(xEntity, field, relationTypeList);
|
|
124
130
|
var xAssocEntity = XUtilsMetadataCommon.getXEntity(xAssoc.entityName);
|
|
125
|
-
return XUtilsMetadataCommon.getXAssocByPath(xAssocEntity, restPath);
|
|
131
|
+
return XUtilsMetadataCommon.getXAssocByPath(xAssocEntity, restPath, relationTypeList);
|
|
126
132
|
}
|
|
127
133
|
};
|
|
128
134
|
// for path assoc1.assoc2.field returns assoc2 (last assoc before field)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@michalrakus/x-react-web-lib",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rimraf lib",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"primeflex": "^3.3.1",
|
|
42
|
-
"primeicons": "^
|
|
43
|
-
"primereact": "~10.
|
|
42
|
+
"primeicons": "^7.0.0",
|
|
43
|
+
"primereact": "~10.6.5",
|
|
44
44
|
"quill": "^1.3.7",
|
|
45
45
|
"react": "^18.2.0",
|
|
46
46
|
"react-dom": "^18.2.0",
|