@michalrakus/x-react-web-lib 1.0.0 → 1.2.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/FindParam.d.ts +3 -0
- package/FindParam.js +5 -0
- package/LICENSE.md +21 -0
- package/XButtonIconNarrow.d.ts +3 -0
- package/XButtonIconNarrow.js +5 -0
- package/XButtonIconSmall.d.ts +3 -0
- package/XButtonIconSmall.js +5 -0
- package/XFieldChangeEvent.d.ts +3 -0
- package/XFieldChangeEvent.js +5 -0
- package/XInputTextarea.d.ts +3 -0
- package/XInputTextarea.js +5 -0
- package/gulpfile.js +5 -0
- package/lib/administration/XBrowseMetaBrowse.js +2 -1
- package/lib/administration/XBrowseMetaForm.js +4 -2
- package/lib/administration/XUserBrowse.js +3 -2
- package/lib/administration/XUserForm.js +5 -3
- package/lib/components/SearchTableParams.d.ts +8 -2
- package/lib/components/SourceCodeLinkEntity.js +3 -2
- package/lib/components/XAutoComplete.d.ts +10 -7
- package/lib/components/XAutoComplete.js +37 -41
- package/lib/components/XAutoCompleteBase.d.ts +8 -5
- package/lib/components/XAutoCompleteBase.js +86 -43
- package/lib/components/XAutoCompleteDT.d.ts +33 -0
- package/lib/components/XAutoCompleteDT.js +141 -0
- package/lib/components/XBrowse.js +11 -5
- package/lib/components/XButton.d.ts +3 -1
- package/lib/components/XButton.js +3 -2
- package/lib/components/XButtonIconNarrow.d.ts +10 -0
- package/lib/components/XButtonIconNarrow.js +25 -0
- package/lib/components/XButtonIconSmall.d.ts +3 -1
- package/lib/components/XButtonIconSmall.js +2 -1
- package/lib/components/XChangePasswordForm.js +12 -7
- package/lib/components/XCheckbox.d.ts +8 -10
- package/lib/components/XCheckbox.js +39 -31
- package/lib/components/XCheckboxDT.js +2 -1
- package/lib/components/XDataTable.js +16 -10
- package/lib/components/XDropdown.d.ts +7 -5
- package/lib/components/XDropdown.js +24 -45
- package/lib/components/XDropdownDT.js +10 -5
- package/lib/components/XDropdownDTFilter.js +12 -7
- package/lib/components/XDropdownFormDTFilter.js +12 -7
- package/lib/components/XEditColumnDialog.js +12 -7
- package/lib/components/XErrors.d.ts +1 -0
- package/lib/components/XExportRowsDialog.js +13 -8
- package/lib/components/XFieldChangeEvent.d.ts +11 -0
- package/lib/components/XFieldChangeEvent.js +2 -0
- package/lib/components/XFieldSelector.js +11 -6
- package/lib/components/XFormBase.d.ts +17 -8
- package/lib/components/XFormBase.js +127 -48
- package/lib/components/XFormBaseT.js +3 -1
- package/lib/components/XFormComponent.d.ts +19 -7
- package/lib/components/XFormComponent.js +89 -49
- package/lib/components/XFormComponentDT.d.ts +30 -0
- package/lib/components/XFormComponentDT.js +119 -0
- package/lib/components/XFormDataTable2.d.ts +53 -8
- package/lib/components/XFormDataTable2.js +270 -57
- package/lib/components/XFormFooter.js +2 -1
- package/lib/components/XFormNavigator3.js +18 -7
- package/lib/components/XHolders.js +4 -2
- package/lib/components/XInput.d.ts +13 -0
- package/lib/components/XInput.js +38 -0
- package/lib/components/XInputDT.d.ts +11 -0
- package/lib/components/XInputDT.js +37 -0
- package/lib/components/XInputDate.d.ts +2 -1
- package/lib/components/XInputDate.js +7 -4
- package/lib/components/XInputDateDT.js +3 -2
- package/lib/components/XInputDecimal.d.ts +9 -2
- package/lib/components/XInputDecimal.js +63 -45
- package/lib/components/XInputDecimalDT.d.ts +10 -8
- package/lib/components/XInputDecimalDT.js +59 -36
- package/lib/components/XInputText.d.ts +7 -11
- package/lib/components/XInputText.js +22 -49
- package/lib/components/XInputTextDT.js +4 -4
- package/lib/components/XInputTextarea.d.ts +18 -0
- package/lib/components/XInputTextarea.js +85 -0
- package/lib/components/XLazyDataTable.d.ts +8 -0
- package/lib/components/XLazyDataTable.js +187 -85
- package/lib/components/XLoginDialog.js +2 -1
- package/lib/components/XLoginForm.js +11 -6
- package/lib/components/XResponseError.js +4 -2
- package/lib/components/XSearchButton.d.ts +8 -7
- package/lib/components/XSearchButton.js +32 -51
- package/lib/components/XSearchButtonDT.js +15 -10
- package/lib/components/XSearchButtonOld.js +13 -8
- package/lib/components/XToOneAssocButton.js +2 -1
- package/lib/components/XUtils.d.ts +13 -1
- package/lib/components/XUtils.js +125 -5
- package/lib/components/XUtilsConversions.d.ts +1 -0
- package/lib/components/XUtilsConversions.js +24 -3
- package/lib/components/XUtilsMetadata.d.ts +4 -1
- package/lib/components/XUtilsMetadata.js +62 -14
- package/lib/components/useXToken.js +1 -1
- package/lib/serverApi/ExportImportParam.d.ts +3 -3
- package/lib/serverApi/FindParam.d.ts +12 -14
- package/lib/serverApi/FindParam.js +14 -0
- package/lib/serverApi/XUtilsCommon.d.ts +1 -0
- package/lib/serverApi/XUtilsCommon.js +6 -2
- package/package.json +24 -25
|
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
3
3
|
var extendStatics = function (d, b) {
|
|
4
4
|
extendStatics = Object.setPrototypeOf ||
|
|
5
5
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
7
|
return extendStatics(d, b);
|
|
8
8
|
};
|
|
9
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");
|
|
10
12
|
extendStatics(d, b);
|
|
11
13
|
function __() { this.constructor = d; }
|
|
12
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -18,7 +20,7 @@ var XResponseError = /** @class */ (function (_super) {
|
|
|
18
20
|
__extends(XResponseError, _super);
|
|
19
21
|
function XResponseError(path, status, statusText, body) {
|
|
20
22
|
var _newTarget = this.constructor;
|
|
21
|
-
var _this = _super.call(this, "Http request \""
|
|
23
|
+
var _this = _super.call(this, "Http request \"".concat(path, "\" failed. Status: ").concat(status, ", status text: ").concat(statusText)) || this;
|
|
22
24
|
// see: typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html
|
|
23
25
|
Object.setPrototypeOf(_this, _newTarget.prototype); // restore prototype chain
|
|
24
26
|
_this.name = XResponseError.name; // stack traces display correctly now
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { XFormComponent, XFormComponentProps } from "./XFormComponent";
|
|
2
|
+
import { XFilterProp, XFormComponent, XFormComponentProps } from "./XFormComponent";
|
|
3
3
|
import { XAssoc } from "../serverApi/XEntityMetadata";
|
|
4
|
-
|
|
4
|
+
import { XObject } from "./XObject";
|
|
5
|
+
export interface XSearchButtonProps extends XFormComponentProps<XObject> {
|
|
5
6
|
assocField: string;
|
|
6
7
|
displayField: string;
|
|
7
8
|
searchTable: any;
|
|
8
9
|
assocForm?: any;
|
|
10
|
+
filter?: XFilterProp;
|
|
9
11
|
size?: number;
|
|
10
12
|
inputStyle?: React.CSSProperties;
|
|
11
13
|
}
|
|
12
|
-
export declare class XSearchButton extends XFormComponent<XSearchButtonProps> {
|
|
14
|
+
export declare class XSearchButton extends XFormComponent<XObject, XSearchButtonProps> {
|
|
13
15
|
protected xAssoc: XAssoc;
|
|
14
|
-
|
|
16
|
+
inputTextRef: any;
|
|
15
17
|
state: {
|
|
16
18
|
inputChanged: boolean;
|
|
17
19
|
inputValueState: any;
|
|
18
20
|
dialogOpened: boolean;
|
|
19
21
|
};
|
|
20
22
|
constructor(props: XSearchButtonProps);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
getValueFromObject(): any;
|
|
23
|
+
getField(): string;
|
|
24
|
+
isNotNull(): boolean;
|
|
24
25
|
render(): JSX.Element;
|
|
25
26
|
}
|
|
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
3
3
|
var extendStatics = function (d, b) {
|
|
4
4
|
extendStatics = Object.setPrototypeOf ||
|
|
5
5
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
7
|
return extendStatics(d, b);
|
|
8
8
|
};
|
|
9
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");
|
|
10
12
|
extendStatics(d, b);
|
|
11
13
|
function __() { this.constructor = d; }
|
|
12
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -38,7 +40,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
40
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
39
41
|
function step(op) {
|
|
40
42
|
if (f) throw new TypeError("Generator is already executing.");
|
|
41
|
-
while (_) try {
|
|
43
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
42
44
|
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;
|
|
43
45
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
44
46
|
switch (op[0]) {
|
|
@@ -76,7 +78,7 @@ var XSearchButton = /** @class */ (function (_super) {
|
|
|
76
78
|
function XSearchButton(props) {
|
|
77
79
|
var _this = _super.call(this, props) || this;
|
|
78
80
|
_this.xAssoc = XUtilsMetadata_1.XUtilsMetadata.getXAssocToOne(XUtilsMetadata_1.XUtilsMetadata.getXEntity(props.form.getEntity()), props.assocField);
|
|
79
|
-
_this.
|
|
81
|
+
_this.inputTextRef = react_1.default.createRef();
|
|
80
82
|
// POVODNY KOD
|
|
81
83
|
//this.overlayPanelEl = React.createRef();
|
|
82
84
|
_this.state = {
|
|
@@ -87,32 +89,15 @@ var XSearchButton = /** @class */ (function (_super) {
|
|
|
87
89
|
props.form.addField(props.assocField + '.' + props.displayField);
|
|
88
90
|
return _this;
|
|
89
91
|
}
|
|
90
|
-
XSearchButton.prototype.
|
|
91
|
-
|
|
92
|
-
// TODO - zohladnit aj aktualny readOnly stav
|
|
93
|
-
var readOnly = (_a = this.props.readOnly) !== null && _a !== void 0 ? _a : false;
|
|
94
|
-
if (!readOnly) {
|
|
95
|
-
return this.props.assocField;
|
|
96
|
-
}
|
|
97
|
-
return undefined;
|
|
92
|
+
XSearchButton.prototype.getField = function () {
|
|
93
|
+
return this.props.assocField;
|
|
98
94
|
};
|
|
99
|
-
XSearchButton.prototype.
|
|
100
|
-
|
|
101
|
-
// TODO - zohladnit aj aktualny readOnly stav
|
|
102
|
-
return !this.xAssoc.isNullable && !((_a = this.props.readOnly) !== null && _a !== void 0 ? _a : false);
|
|
103
|
-
};
|
|
104
|
-
XSearchButton.prototype.getValueFromObject = function () {
|
|
105
|
-
var object = this.props.form.state.object;
|
|
106
|
-
var assocObject = object !== null ? object[this.props.assocField] : null;
|
|
107
|
-
// ak je undefined, pre istotu dame na null, null je standard
|
|
108
|
-
if (assocObject === undefined) {
|
|
109
|
-
assocObject = null;
|
|
110
|
-
}
|
|
111
|
-
return assocObject;
|
|
95
|
+
XSearchButton.prototype.isNotNull = function () {
|
|
96
|
+
return !this.xAssoc.isNullable;
|
|
112
97
|
};
|
|
113
98
|
XSearchButton.prototype.render = function () {
|
|
114
99
|
var _this = this;
|
|
115
|
-
var _a
|
|
100
|
+
var _a;
|
|
116
101
|
var props = this.props;
|
|
117
102
|
var xEntityAssoc = XUtilsMetadata_1.XUtilsMetadata.getXEntity(this.xAssoc.entityName);
|
|
118
103
|
var xDisplayField = XUtilsMetadata_1.XUtilsMetadata.getXFieldByPath(xEntityAssoc, props.displayField);
|
|
@@ -124,7 +109,7 @@ var XSearchButton = /** @class */ (function (_super) {
|
|
|
124
109
|
var dialogOpened = this.state.dialogOpened;
|
|
125
110
|
var setDialogOpened = function (dialogOpened) { _this.setState({ dialogOpened: dialogOpened }); };
|
|
126
111
|
var computeInputValue = function () {
|
|
127
|
-
var inputValue
|
|
112
|
+
var inputValue;
|
|
128
113
|
if (!inputChanged) {
|
|
129
114
|
// TODO - pridat cez generikum typ fieldu (ak sa da)
|
|
130
115
|
// poznamka: ak assocObject === null tak treba do inputu zapisovat prazdny retazec, ak by sme pouzili null, neprejavila by sa zmena v modeli na null
|
|
@@ -136,31 +121,24 @@ var XSearchButton = /** @class */ (function (_super) {
|
|
|
136
121
|
}
|
|
137
122
|
return inputValue;
|
|
138
123
|
};
|
|
139
|
-
var
|
|
140
|
-
if (this.checkNotNull()) {
|
|
141
|
-
label = XUtils_1.XUtils.markNotNull(label);
|
|
142
|
-
}
|
|
143
|
-
var readOnly = (_b = props.readOnly) !== null && _b !== void 0 ? _b : false;
|
|
144
|
-
var size = (_c = props.size) !== null && _c !== void 0 ? _c : xDisplayField.length;
|
|
124
|
+
var size = (_a = props.size) !== null && _a !== void 0 ? _a : xDisplayField.length;
|
|
145
125
|
var onInputValueChange = function (e) {
|
|
146
126
|
setInputChanged(true);
|
|
147
127
|
setInputValueState(e.target.value);
|
|
148
128
|
};
|
|
149
129
|
var onInputBlur = function (e) { return __awaiter(_this, void 0, void 0, function () {
|
|
150
|
-
var rows;
|
|
130
|
+
var displayFieldFilter, customFilter, rows;
|
|
151
131
|
return __generator(this, function (_a) {
|
|
152
132
|
switch (_a.label) {
|
|
153
133
|
case 0:
|
|
154
134
|
if (!inputChanged) return [3 /*break*/, 3];
|
|
155
|
-
if (!(e.target.value === '')) return [3 /*break*/, 1];
|
|
135
|
+
if (!(e.target.value === '' || e.target.value === undefined || e.target.value === null)) return [3 /*break*/, 1];
|
|
156
136
|
setValueToModel(null); // prazdny retazec znamena null hodnotu
|
|
157
137
|
return [3 /*break*/, 3];
|
|
158
|
-
case 1:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
filter: e.target.value
|
|
163
|
-
})];
|
|
138
|
+
case 1:
|
|
139
|
+
displayFieldFilter = { filter: "[".concat(props.displayField, "] LIKE :xDisplayFieldValue"), values: { "xDisplayFieldValue": "".concat(e.target.value, "%") } };
|
|
140
|
+
customFilter = this.getFilterBase(this.props.filter);
|
|
141
|
+
return [4 /*yield*/, XUtils_1.XUtils.fetchRows(this.xAssoc.entityName, XUtils_1.XUtils.filterAnd(displayFieldFilter, customFilter))];
|
|
164
142
|
case 2:
|
|
165
143
|
rows = _a.sent();
|
|
166
144
|
if (rows.length === 0) {
|
|
@@ -184,13 +162,12 @@ var XSearchButton = /** @class */ (function (_super) {
|
|
|
184
162
|
});
|
|
185
163
|
}); };
|
|
186
164
|
var setValueToModel = function (row) {
|
|
187
|
-
|
|
188
|
-
props.form.onFieldChange(props.assocField, row, error);
|
|
165
|
+
_this.onValueChangeBase(row, _this.props.onChange);
|
|
189
166
|
setInputChanged(false);
|
|
190
167
|
};
|
|
191
168
|
var onClickSearch = function (e) {
|
|
192
169
|
console.log("zavolany onClickSearch");
|
|
193
|
-
if (!
|
|
170
|
+
if (!_this.isReadOnly()) {
|
|
194
171
|
setDialogOpened(true);
|
|
195
172
|
// POVODNY KOD
|
|
196
173
|
//overlayPanelEl.current.toggle(e);
|
|
@@ -219,24 +196,28 @@ var XSearchButton = /** @class */ (function (_super) {
|
|
|
219
196
|
setDialogOpened(false);
|
|
220
197
|
// ak mame v inpute neplatnu hodnotu, musime vratit kurzor na input
|
|
221
198
|
if (inputChanged) {
|
|
222
|
-
_this.
|
|
199
|
+
_this.inputTextRef.current.focus();
|
|
223
200
|
}
|
|
224
201
|
};
|
|
225
202
|
// {React.createElement(props.searchTable, {searchTableParams: {onChoose: onChoose, displayField: props.displayField, filter: (inputChanged ? inputValueState : undefined)}, ...props.searchTableProps}, null)}
|
|
226
203
|
// <BrandSearchTable searchTableParams={{onChoose: onChoose, displayField: props.displayField, filter: (inputChanged ? inputValueState : undefined)}} qqq="fiha"/>
|
|
204
|
+
// takto cez metodku, mozno sa metodka vola len ked sa otvori dialog a usetrime nieco...
|
|
205
|
+
var createSearchTableParams = function () {
|
|
206
|
+
return {
|
|
207
|
+
onChoose: onChoose,
|
|
208
|
+
displayFieldFilter: (inputChanged ? { field: props.displayField, constraint: { value: inputValueState, matchMode: "startsWith" } } : undefined),
|
|
209
|
+
customFilter: _this.getFilterBase(_this.props.filter)
|
|
210
|
+
};
|
|
211
|
+
};
|
|
227
212
|
// vypocitame inputValue
|
|
228
213
|
var inputValue = computeInputValue();
|
|
229
214
|
return (react_1.default.createElement("div", { className: "field grid" },
|
|
230
|
-
react_1.default.createElement("label", { htmlFor: props.assocField, className: "col-fixed", style:
|
|
215
|
+
react_1.default.createElement("label", { htmlFor: props.assocField, className: "col-fixed", style: this.getLabelStyle() }, this.getLabel()),
|
|
231
216
|
react_1.default.createElement("div", { className: "x-search-button-base" },
|
|
232
|
-
react_1.default.createElement(inputtext_1.InputText, __assign({ id: props.assocField, value: inputValue, onChange: onInputValueChange, onBlur: onInputBlur, readOnly:
|
|
217
|
+
react_1.default.createElement(inputtext_1.InputText, __assign({ id: props.assocField, value: inputValue, onChange: onInputValueChange, onBlur: onInputBlur, readOnly: this.isReadOnly(), ref: this.inputTextRef, maxLength: xDisplayField.length, size: size, style: props.inputStyle }, this.getClassNameTooltip())),
|
|
233
218
|
react_1.default.createElement(button_1.Button, { label: "...", onClick: onClickSearch })),
|
|
234
219
|
react_1.default.createElement(dialog_1.Dialog, { visible: dialogOpened, onHide: onHide }, react_1.default.cloneElement(props.searchTable, {
|
|
235
|
-
searchTableParams:
|
|
236
|
-
onChoose: onChoose,
|
|
237
|
-
displayField: props.displayField,
|
|
238
|
-
filter: (inputChanged ? inputValueState : undefined)
|
|
239
|
-
}
|
|
220
|
+
searchTableParams: createSearchTableParams()
|
|
240
221
|
}, props.searchTable.children))));
|
|
241
222
|
};
|
|
242
223
|
return XSearchButton;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
18
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
19
|
if (mod && mod.__esModule) return mod;
|
|
16
20
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
22
|
__setModuleDefault(result, mod);
|
|
19
23
|
return result;
|
|
20
24
|
};
|
|
@@ -33,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
33
37
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
34
38
|
function step(op) {
|
|
35
39
|
if (f) throw new TypeError("Generator is already executing.");
|
|
36
|
-
while (_) try {
|
|
40
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
37
41
|
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;
|
|
38
42
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
39
43
|
switch (op[0]) {
|
|
@@ -78,11 +82,11 @@ var inputtext_1 = require("primereact/inputtext");
|
|
|
78
82
|
var button_1 = require("primereact/button");
|
|
79
83
|
var dialog_1 = require("primereact/dialog");
|
|
80
84
|
var XUtilsMetadata_1 = require("./XUtilsMetadata");
|
|
81
|
-
|
|
82
|
-
var
|
|
83
|
-
var _a = __read(react_1.useState(false), 2), inputChanged = _a[0], setInputChanged = _a[1]; // priznak, ci uzivatel typovanim zmenil hodnotu v inpute
|
|
84
|
-
var _b = __read(react_1.useState(null), 2), inputValueState = _b[0], setInputValueState = _b[1]; // pouzivane, len ak inputChanged === true, je tu zapisana zmenena hodnota v inpute
|
|
85
|
-
var _c = __read(react_1.useState(false), 2), dialogOpened = _c[0], setDialogOpened = _c[1];
|
|
85
|
+
var XSearchButtonDT = function (props) {
|
|
86
|
+
var inputTextRef = (0, react_1.useRef)(null);
|
|
87
|
+
var _a = __read((0, react_1.useState)(false), 2), inputChanged = _a[0], setInputChanged = _a[1]; // priznak, ci uzivatel typovanim zmenil hodnotu v inpute
|
|
88
|
+
var _b = __read((0, react_1.useState)(null), 2), inputValueState = _b[0], setInputValueState = _b[1]; // pouzivane, len ak inputChanged === true, je tu zapisana zmenena hodnota v inpute
|
|
89
|
+
var _c = __read((0, react_1.useState)(false), 2), dialogOpened = _c[0], setDialogOpened = _c[1];
|
|
86
90
|
var computeInputValue = function () {
|
|
87
91
|
var inputValue = null;
|
|
88
92
|
if (!inputChanged) {
|
|
@@ -168,7 +172,7 @@ exports.XSearchButtonDT = function (props) {
|
|
|
168
172
|
setDialogOpened(false);
|
|
169
173
|
// ak mame v inpute neplatnu hodnotu, musime vratit kurzor na input
|
|
170
174
|
if (inputChanged) {
|
|
171
|
-
|
|
175
|
+
inputTextRef.current.focus();
|
|
172
176
|
}
|
|
173
177
|
};
|
|
174
178
|
// {React.createElement(props.searchTable, {searchTableParams: {onChoose: onChoose, displayField: props.displayField, filter: (inputChanged ? inputValueState : undefined)}, ...props.searchTableProps}, null)}
|
|
@@ -177,7 +181,8 @@ exports.XSearchButtonDT = function (props) {
|
|
|
177
181
|
var inputValue = computeInputValue();
|
|
178
182
|
return (react_1.default.createElement("div", null,
|
|
179
183
|
react_1.default.createElement("div", { className: "x-search-button-base" },
|
|
180
|
-
react_1.default.createElement(inputtext_1.InputText, { id: props.assocField, value: inputValue, onChange: onInputValueChange, onBlur: onInputBlur, readOnly: readOnly, ref:
|
|
184
|
+
react_1.default.createElement(inputtext_1.InputText, { id: props.assocField, value: inputValue, onChange: onInputValueChange, onBlur: onInputBlur, readOnly: readOnly, ref: inputTextRef }),
|
|
181
185
|
react_1.default.createElement(button_1.Button, { label: "...", onClick: onClickSearch })),
|
|
182
186
|
react_1.default.createElement(dialog_1.Dialog, { visible: dialogOpened, onHide: onHide }, react_1.default.cloneElement(props.searchTable, { searchTableParams: { onChoose: onChoose, displayField: props.displayField, filter: (inputChanged ? inputValueState : undefined) } }, props.searchTable.children))));
|
|
183
187
|
};
|
|
188
|
+
exports.XSearchButtonDT = XSearchButtonDT;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
18
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
19
|
if (mod && mod.__esModule) return mod;
|
|
16
20
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
22
|
__setModuleDefault(result, mod);
|
|
19
23
|
return result;
|
|
20
24
|
};
|
|
@@ -33,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
33
37
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
34
38
|
function step(op) {
|
|
35
39
|
if (f) throw new TypeError("Generator is already executing.");
|
|
36
|
-
while (_) try {
|
|
40
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
37
41
|
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;
|
|
38
42
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
39
43
|
switch (op[0]) {
|
|
@@ -78,7 +82,7 @@ var button_1 = require("primereact/button");
|
|
|
78
82
|
var XUtils_1 = require("./XUtils");
|
|
79
83
|
var dialog_1 = require("primereact/dialog");
|
|
80
84
|
var XUtilsMetadata_1 = require("./XUtilsMetadata");
|
|
81
|
-
|
|
85
|
+
var XSearchButtonOld = function (props) {
|
|
82
86
|
var _a, _b, _c;
|
|
83
87
|
props.form.addField(props.assocField + '.' + props.displayField);
|
|
84
88
|
var xEntity = XUtilsMetadata_1.XUtilsMetadata.getXEntity(props.form.getEntity());
|
|
@@ -87,10 +91,10 @@ exports.XSearchButtonOld = function (props) {
|
|
|
87
91
|
var xDisplayField = XUtilsMetadata_1.XUtilsMetadata.getXFieldByPath(xEntityAssoc, props.displayField);
|
|
88
92
|
// POVODNY KOD
|
|
89
93
|
//const overlayPanelEl = useRef<any>(null);
|
|
90
|
-
var inputTextEl = react_1.useRef(null);
|
|
91
|
-
var _d = __read(react_1.useState(false), 2), inputChanged = _d[0], setInputChanged = _d[1]; // priznak, ci uzivatel typovanim zmenil hodnotu v inpute
|
|
92
|
-
var _e = __read(react_1.useState(null), 2), inputValueState = _e[0], setInputValueState = _e[1]; // pouzivane, len ak inputChanged === true, je tu zapisana zmenena hodnota v inpute
|
|
93
|
-
var _f = __read(react_1.useState(false), 2), dialogOpened = _f[0], setDialogOpened = _f[1];
|
|
94
|
+
var inputTextEl = (0, react_1.useRef)(null);
|
|
95
|
+
var _d = __read((0, react_1.useState)(false), 2), inputChanged = _d[0], setInputChanged = _d[1]; // priznak, ci uzivatel typovanim zmenil hodnotu v inpute
|
|
96
|
+
var _e = __read((0, react_1.useState)(null), 2), inputValueState = _e[0], setInputValueState = _e[1]; // pouzivane, len ak inputChanged === true, je tu zapisana zmenena hodnota v inpute
|
|
97
|
+
var _f = __read((0, react_1.useState)(false), 2), dialogOpened = _f[0], setDialogOpened = _f[1];
|
|
94
98
|
var computeInputValue = function () {
|
|
95
99
|
var inputValue = null;
|
|
96
100
|
if (!inputChanged) {
|
|
@@ -205,3 +209,4 @@ exports.XSearchButtonOld = function (props) {
|
|
|
205
209
|
react_1.default.createElement(button_1.Button, { label: "...", onClick: onClickSearch }),
|
|
206
210
|
react_1.default.createElement(dialog_1.Dialog, { visible: dialogOpened, onHide: onHide }, react_1.default.cloneElement(props.searchTable, { searchTableParams: { onChoose: onChoose, displayField: props.displayField, filter: (inputChanged ? inputValueState : undefined) } }, props.searchTable.children))));
|
|
207
211
|
};
|
|
212
|
+
exports.XSearchButtonOld = XSearchButtonOld;
|
|
@@ -8,7 +8,7 @@ var react_1 = __importDefault(require("react"));
|
|
|
8
8
|
var button_1 = require("primereact/button");
|
|
9
9
|
var XUtilsMetadata_1 = require("./XUtilsMetadata");
|
|
10
10
|
var XUtils_1 = require("./XUtils");
|
|
11
|
-
|
|
11
|
+
var XToOneAssocButton = function (props) {
|
|
12
12
|
// mozno lepsie by bolo sem dat xEntityAssoc.idField ale postaci aj *FAKE*
|
|
13
13
|
props.form.addField(props.assocField + '.*FAKE*');
|
|
14
14
|
var label = props.label !== undefined ? props.label : props.assocField;
|
|
@@ -27,3 +27,4 @@ exports.XToOneAssocButton = function (props) {
|
|
|
27
27
|
react_1.default.createElement("label", { htmlFor: props.assocField, className: "col-fixed", style: { width: XUtils_1.XUtils.FIELD_LABEL_WIDTH } }, label),
|
|
28
28
|
react_1.default.createElement(button_1.Button, { label: label, onClick: onClickButton, disabled: assocObject === null })));
|
|
29
29
|
};
|
|
30
|
+
exports.XToOneAssocButton = XToOneAssocButton;
|
|
@@ -2,6 +2,8 @@ import { XToken } from "./XToken";
|
|
|
2
2
|
import { CsvDecimalFormat, CsvSeparator, ExportType } from "../serverApi/ExportImportParam";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { XEnvVar } from "./XEnvVars";
|
|
5
|
+
import { XError, XErrorMap } from "./XErrors";
|
|
6
|
+
import { XCustomFilter } from "../serverApi/FindParam";
|
|
5
7
|
export declare enum OperationType {
|
|
6
8
|
None = 0,
|
|
7
9
|
Insert = 1,
|
|
@@ -32,6 +34,7 @@ export declare class XUtils {
|
|
|
32
34
|
static registerAppForm(elem: any, entity: string, formId?: string): void;
|
|
33
35
|
static getAppForm(entity: string, formId?: string): any;
|
|
34
36
|
static fetchMany(path: string, value: any, usePublicToken?: boolean | XToken): Promise<any[]>;
|
|
37
|
+
static fetchRows(entity: string, customFilter: XCustomFilter | undefined, sortField?: string): Promise<any[]>;
|
|
35
38
|
static fetchOne(path: string, value: any, usePublicToken?: boolean | XToken): Promise<any>;
|
|
36
39
|
static fetchString(path: string, value: any): Promise<string>;
|
|
37
40
|
static fetch(path: string, value: any, usePublicToken?: boolean | XToken): Promise<any>;
|
|
@@ -53,9 +56,18 @@ export declare class XUtils {
|
|
|
53
56
|
static getEnvVarValue(envVarEnum: XEnvVar): string;
|
|
54
57
|
static removeRow(entity: string, row: any): Promise<void>;
|
|
55
58
|
static arrayMoveElement(array: any[], position: number, offset: number): void;
|
|
59
|
+
static arraySort(array: any[], fieldOrStringFunction: string | ((item: any) => string)): any[];
|
|
56
60
|
static isReadOnly(path: string, readOnlyInit?: boolean): boolean;
|
|
57
61
|
static markNotNull(label: string): string;
|
|
58
|
-
static showErrorMessage(message: string, e:
|
|
62
|
+
static showErrorMessage(message: string, e: unknown): void;
|
|
59
63
|
static createErrorProps(error: string | undefined): {};
|
|
64
|
+
static addClassName(props: {
|
|
65
|
+
[key: string]: any;
|
|
66
|
+
}, className: string): {
|
|
67
|
+
[key: string]: any;
|
|
68
|
+
};
|
|
69
|
+
static getErrorMessages(xErrorMap: XErrorMap): string;
|
|
70
|
+
static getErrorMessage(xError: XError): string | undefined;
|
|
60
71
|
static normalizeString(value: string): string;
|
|
72
|
+
static filterAnd(filter1: XCustomFilter | undefined, filter2: XCustomFilter | undefined): XCustomFilter | undefined;
|
|
61
73
|
}
|
package/lib/components/XUtils.js
CHANGED
|
@@ -25,7 +25,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
29
|
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;
|
|
30
30
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
31
|
switch (op[0]) {
|
|
@@ -79,6 +79,7 @@ var XUtilsMetadata_1 = require("./XUtilsMetadata");
|
|
|
79
79
|
var XUtilsCommon_1 = require("../serverApi/XUtilsCommon");
|
|
80
80
|
var ExportImportParam_1 = require("../serverApi/ExportImportParam");
|
|
81
81
|
var XResponseError_1 = require("./XResponseError");
|
|
82
|
+
var FindParam_1 = require("../serverApi/FindParam");
|
|
82
83
|
var OperationType;
|
|
83
84
|
(function (OperationType) {
|
|
84
85
|
OperationType[OperationType["None"] = 0] = "None";
|
|
@@ -202,7 +203,7 @@ var XUtils = /** @class */ (function () {
|
|
|
202
203
|
finally { if (e_2) throw e_2.error; }
|
|
203
204
|
}
|
|
204
205
|
// should not happen
|
|
205
|
-
console.log("XUtils.processGridBreakpoints: unexpected error: no breakpoint value found, breakpointExp = "
|
|
206
|
+
console.log("XUtils.processGridBreakpoints: unexpected error: no breakpoint value found, breakpointExp = ".concat(breakpointExp, ", availWidth = ").concat(availWidth));
|
|
206
207
|
return undefined;
|
|
207
208
|
};
|
|
208
209
|
XUtils.processPropWidth = function (widthProp) {
|
|
@@ -252,6 +253,22 @@ var XUtils = /** @class */ (function () {
|
|
|
252
253
|
XUtils.fetchMany = function (path, value, usePublicToken) {
|
|
253
254
|
return XUtils.fetch(path, value, usePublicToken);
|
|
254
255
|
};
|
|
256
|
+
// pomocna metodka pouzivajuca lazyDataTable service
|
|
257
|
+
XUtils.fetchRows = function (entity, customFilter, sortField) {
|
|
258
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
259
|
+
var findParam, rowList;
|
|
260
|
+
return __generator(this, function (_a) {
|
|
261
|
+
switch (_a.label) {
|
|
262
|
+
case 0:
|
|
263
|
+
findParam = { resultType: FindParam_1.ResultType.AllRows, entity: entity, customFilter: customFilter, multiSortMeta: sortField ? [{ field: sortField, order: 1 }] : undefined };
|
|
264
|
+
return [4 /*yield*/, XUtils.fetchOne('lazyDataTableFindRows', findParam)];
|
|
265
|
+
case 1:
|
|
266
|
+
rowList = (_a.sent()).rowList;
|
|
267
|
+
return [2 /*return*/, rowList];
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
};
|
|
255
272
|
XUtils.fetchOne = function (path, value, usePublicToken) {
|
|
256
273
|
return XUtils.fetch(path, value, usePublicToken);
|
|
257
274
|
};
|
|
@@ -325,7 +342,7 @@ var XUtils = /** @class */ (function () {
|
|
|
325
342
|
xToken = XUtils.xTokenPublic; // ak nikto nie je prihlaseny, posleme public token
|
|
326
343
|
}
|
|
327
344
|
}
|
|
328
|
-
headers = __assign(__assign({}, headers), { 'Authorization': "Basic "
|
|
345
|
+
headers = __assign(__assign({}, headers), { 'Authorization': "Basic ".concat(Buffer.from(xToken.username + ':' + xToken.password).toString('base64')) });
|
|
329
346
|
return [4 /*yield*/, fetch(XUtils.getXBackendUrl() + path, {
|
|
330
347
|
method: 'POST',
|
|
331
348
|
headers: headers,
|
|
@@ -361,7 +378,7 @@ var XUtils = /** @class */ (function () {
|
|
|
361
378
|
xToken = XUtils.xTokenPublic; // ak nikto nie je prihlaseny, posleme public token
|
|
362
379
|
}
|
|
363
380
|
}
|
|
364
|
-
headers = __assign(__assign({}, headers), { 'Authorization': "Bearer "
|
|
381
|
+
headers = __assign(__assign({}, headers), { 'Authorization': "Bearer ".concat(xToken.accessToken) });
|
|
365
382
|
return [4 /*yield*/, fetch(XUtils.getXBackendUrl() + path, {
|
|
366
383
|
method: 'POST',
|
|
367
384
|
headers: headers,
|
|
@@ -408,7 +425,7 @@ var XUtils = /** @class */ (function () {
|
|
|
408
425
|
XUtils.getEnvVarValue = function (envVarEnum) {
|
|
409
426
|
var value = process.env[envVarEnum];
|
|
410
427
|
if (value === undefined) {
|
|
411
|
-
throw "Environment variable "
|
|
428
|
+
throw "Environment variable ".concat(envVarEnum, " - value not found. Check configuration file .env*");
|
|
412
429
|
}
|
|
413
430
|
return value;
|
|
414
431
|
};
|
|
@@ -443,6 +460,29 @@ var XUtils = /** @class */ (function () {
|
|
|
443
460
|
array.splice(positionNew, 0, element);
|
|
444
461
|
}
|
|
445
462
|
};
|
|
463
|
+
// helper function
|
|
464
|
+
XUtils.arraySort = function (array, fieldOrStringFunction) {
|
|
465
|
+
var stringFunction;
|
|
466
|
+
if (typeof fieldOrStringFunction === 'string') {
|
|
467
|
+
stringFunction = function (item) { return item[fieldOrStringFunction]; };
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
stringFunction = fieldOrStringFunction;
|
|
471
|
+
}
|
|
472
|
+
return array.sort(function (suggestion1, suggestion2) {
|
|
473
|
+
var value1 = stringFunction(suggestion1);
|
|
474
|
+
var value2 = stringFunction(suggestion2);
|
|
475
|
+
if (value1 > value2) {
|
|
476
|
+
return 1;
|
|
477
|
+
}
|
|
478
|
+
else if (value1 < value2) {
|
|
479
|
+
return -1;
|
|
480
|
+
}
|
|
481
|
+
else {
|
|
482
|
+
return 0;
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
};
|
|
446
486
|
// helper
|
|
447
487
|
XUtils.isReadOnly = function (path, readOnlyInit) {
|
|
448
488
|
// ak mame path dlzky 2 a viac, field je vzdy readOnly
|
|
@@ -467,12 +507,77 @@ var XUtils = /** @class */ (function () {
|
|
|
467
507
|
else if (e instanceof Error) {
|
|
468
508
|
msg += e.message;
|
|
469
509
|
}
|
|
510
|
+
else if (typeof e === 'string' || typeof e === 'number') {
|
|
511
|
+
// chyba typu: throw 'nieco'
|
|
512
|
+
msg += e;
|
|
513
|
+
}
|
|
470
514
|
alert(msg);
|
|
471
515
|
};
|
|
472
516
|
// pouziva sa hlavne na inputy
|
|
473
517
|
XUtils.createErrorProps = function (error) {
|
|
474
518
|
return error ? { className: "p-invalid", tooltip: error, tooltipOptions: { className: 'pink-tooltip', position: 'bottom' } } : {};
|
|
475
519
|
};
|
|
520
|
+
// pomocna metodka - prida className do props, ak uz className v props existuje tak len pripoji dalsiu hodnotu
|
|
521
|
+
// pouzivame ju, lebo XUtils.createErrorProps nam prebijal className
|
|
522
|
+
XUtils.addClassName = function (props, className) {
|
|
523
|
+
var propsClassName = props.className;
|
|
524
|
+
if (propsClassName !== undefined) {
|
|
525
|
+
propsClassName += " " + className;
|
|
526
|
+
}
|
|
527
|
+
else {
|
|
528
|
+
propsClassName = className;
|
|
529
|
+
}
|
|
530
|
+
props.className = propsClassName;
|
|
531
|
+
return props;
|
|
532
|
+
};
|
|
533
|
+
// pomocna metodka
|
|
534
|
+
// ak nie su v xErrorMap ziadne chyby, vrati ""
|
|
535
|
+
XUtils.getErrorMessages = function (xErrorMap) {
|
|
536
|
+
var e_5, _a;
|
|
537
|
+
var _b;
|
|
538
|
+
var msg = "";
|
|
539
|
+
try {
|
|
540
|
+
for (var _c = __values(Object.entries(xErrorMap)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
541
|
+
var _e = __read(_d.value, 2), field = _e[0], xError = _e[1];
|
|
542
|
+
if (xError) {
|
|
543
|
+
var errorMessage = XUtils.getErrorMessage(xError);
|
|
544
|
+
if (errorMessage) {
|
|
545
|
+
msg += "".concat((_b = xError.fieldLabel) !== null && _b !== void 0 ? _b : field, ": ").concat(errorMessage).concat(XUtilsCommon_1.XUtilsCommon.newLine);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
551
|
+
finally {
|
|
552
|
+
try {
|
|
553
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
554
|
+
}
|
|
555
|
+
finally { if (e_5) throw e_5.error; }
|
|
556
|
+
}
|
|
557
|
+
return msg;
|
|
558
|
+
};
|
|
559
|
+
XUtils.getErrorMessage = function (xError) {
|
|
560
|
+
if (xError.onChange || xError.onBlur || xError.form) {
|
|
561
|
+
var message = '';
|
|
562
|
+
if (xError.onChange) {
|
|
563
|
+
message += xError.onChange;
|
|
564
|
+
}
|
|
565
|
+
if (xError.onBlur) {
|
|
566
|
+
if (message !== '') {
|
|
567
|
+
message += ' ';
|
|
568
|
+
}
|
|
569
|
+
message += xError.onBlur;
|
|
570
|
+
}
|
|
571
|
+
if (xError.form) {
|
|
572
|
+
if (message !== '') {
|
|
573
|
+
message += ' ';
|
|
574
|
+
}
|
|
575
|
+
message += xError.form;
|
|
576
|
+
}
|
|
577
|
+
return message;
|
|
578
|
+
}
|
|
579
|
+
return undefined;
|
|
580
|
+
};
|
|
476
581
|
// pomocna metodka pouzivana (zatial len) pre autocomplete na ignorovanie velkych-malych znakov a diakritiky
|
|
477
582
|
XUtils.normalizeString = function (value) {
|
|
478
583
|
if (value) {
|
|
@@ -481,6 +586,21 @@ var XUtils = /** @class */ (function () {
|
|
|
481
586
|
}
|
|
482
587
|
return value;
|
|
483
588
|
};
|
|
589
|
+
// pomocna metodka
|
|
590
|
+
XUtils.filterAnd = function (filter1, filter2) {
|
|
591
|
+
if (filter1 && filter2) {
|
|
592
|
+
return { filter: "(".concat(filter1.filter, ") AND (").concat(filter2.filter, ")"), values: __assign(__assign({}, filter1.values), filter2.values) };
|
|
593
|
+
}
|
|
594
|
+
else if (filter1 && filter2 === undefined) {
|
|
595
|
+
return filter1;
|
|
596
|
+
}
|
|
597
|
+
else if (filter1 === undefined && filter2) {
|
|
598
|
+
return filter2;
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
return undefined;
|
|
602
|
+
}
|
|
603
|
+
};
|
|
484
604
|
XUtils.dropdownEmptyOptionValue = " ";
|
|
485
605
|
XUtils.xBackendUrl = undefined;
|
|
486
606
|
// nacachovany XToken - na rozlicnych miestach potrebujeme vediet uzivatela
|
|
@@ -2,6 +2,7 @@ export declare function stringFromUI(stringValue: string): string | null;
|
|
|
2
2
|
export declare function stringAsUI(value: string | null): string;
|
|
3
3
|
export declare function numberFromUI(stringValue: string): number | null;
|
|
4
4
|
export declare function numberAsUI(value: number | null, fractionDigits?: number): string;
|
|
5
|
+
export declare function numberFromModel(value: any): number | null;
|
|
5
6
|
export declare function dateFromModel(value: any): Date | null;
|
|
6
7
|
export declare function dateAsUI(value: Date | null): string;
|
|
7
8
|
export declare function datetimeAsUI(value: Date | null): string;
|