@michalrakus/x-react-web-lib 1.8.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/XInputInterval.d.ts +3 -0
- package/XInputInterval.js +5 -0
- package/XInputIntervalBase.d.ts +3 -0
- package/XInputIntervalBase.js +5 -0
- package/gulpfile.js +84 -82
- package/lib/administration/XBrowseMetaBrowse.d.ts +2 -2
- package/lib/administration/XBrowseMetaBrowse.js +21 -21
- package/lib/administration/XBrowseMetaForm.d.ts +5 -5
- package/lib/administration/XBrowseMetaForm.js +63 -63
- package/lib/administration/XUserBrowse.d.ts +2 -2
- package/lib/administration/XUserBrowse.js +88 -87
- package/lib/administration/XUserForm.d.ts +9 -9
- package/lib/administration/XUserForm.js +195 -194
- package/lib/components/SearchTableParams.d.ts +11 -11
- package/lib/components/SearchTableParams.js +2 -2
- package/lib/components/SourceCodeLinkEntity.d.ts +4 -4
- package/lib/components/SourceCodeLinkEntity.js +14 -14
- package/lib/components/XAutoComplete.d.ts +36 -36
- package/lib/components/XAutoComplete.js +155 -155
- package/lib/components/XAutoCompleteBase.d.ts +45 -45
- package/lib/components/XAutoCompleteBase.js +371 -371
- package/lib/components/XAutoCompleteDT.d.ts +33 -33
- package/lib/components/XAutoCompleteDT.js +140 -140
- package/lib/components/XBrowse.d.ts +33 -33
- package/lib/components/XBrowse.js +360 -360
- package/lib/components/XButton.d.ts +9 -9
- package/lib/components/XButton.js +13 -13
- package/lib/components/XButtonIconMedium.d.ts +9 -9
- package/lib/components/XButtonIconMedium.js +13 -13
- package/lib/components/XButtonIconNarrow.d.ts +10 -10
- package/lib/components/XButtonIconNarrow.js +25 -25
- package/lib/components/XButtonIconSmall.d.ts +9 -9
- package/lib/components/XButtonIconSmall.js +13 -13
- package/lib/components/XCalendar.d.ts +9 -8
- package/lib/components/XCalendar.js +27 -27
- package/lib/components/XChangePasswordForm.d.ts +5 -5
- package/lib/components/XChangePasswordForm.js +160 -160
- package/lib/components/XCheckbox.d.ts +8 -8
- package/lib/components/XCheckbox.js +57 -57
- package/lib/components/XCheckboxDT.d.ts +10 -10
- package/lib/components/XCheckboxDT.js +46 -46
- package/lib/components/XDataTable.d.ts +11 -11
- package/lib/components/XDataTable.js +197 -197
- package/lib/components/XDropdown.d.ts +18 -18
- package/lib/components/XDropdown.js +57 -57
- package/lib/components/XDropdownDT.d.ts +16 -13
- package/lib/components/XDropdownDT.js +135 -128
- package/lib/components/XDropdownDTFilter.d.ts +7 -7
- package/lib/components/XDropdownDTFilter.js +121 -121
- package/lib/components/XDropdownForEntity.d.ts +26 -25
- package/lib/components/XDropdownForEntity.js +151 -149
- package/lib/components/XDropdownFormDTFilter.d.ts +7 -7
- package/lib/components/XDropdownFormDTFilter.js +121 -121
- package/lib/components/XEditColumnDialog.d.ts +13 -13
- package/lib/components/XEditColumnDialog.js +112 -112
- package/lib/components/XEnvVars.d.ts +15 -12
- package/lib/components/XEnvVars.js +23 -20
- package/lib/components/XErrors.d.ts +12 -12
- package/lib/components/XErrors.js +2 -2
- package/lib/components/XExportRowsDialog.d.ts +15 -15
- package/lib/components/XExportRowsDialog.js +184 -184
- package/lib/components/XFieldChangeEvent.d.ts +11 -11
- package/lib/components/XFieldChangeEvent.js +2 -2
- package/lib/components/XFieldSelector.d.ts +7 -7
- package/lib/components/XFieldSelector.js +113 -113
- package/lib/components/XFormBase.d.ts +68 -59
- package/lib/components/XFormBase.js +613 -526
- package/lib/components/XFormBaseModif.d.ts +5 -5
- package/lib/components/XFormBaseModif.js +33 -33
- package/lib/components/XFormBaseT.d.ts +4 -4
- package/lib/components/XFormBaseT.js +31 -31
- package/lib/components/XFormComponent.d.ts +40 -40
- package/lib/components/XFormComponent.js +177 -177
- package/lib/components/XFormComponentDT.d.ts +30 -30
- package/lib/components/XFormComponentDT.js +145 -145
- package/lib/components/XFormDataTable2.d.ts +144 -143
- package/lib/components/XFormDataTable2.js +679 -686
- package/lib/components/XFormFooter.d.ts +6 -6
- package/lib/components/XFormFooter.js +19 -19
- package/lib/components/XFormNavigator3.d.ts +12 -12
- package/lib/components/XFormNavigator3.js +130 -130
- package/lib/components/XHolders.d.ts +7 -7
- package/lib/components/XHolders.js +15 -15
- package/lib/components/XInput.d.ts +13 -13
- package/lib/components/XInput.js +38 -38
- package/lib/components/XInputDT.d.ts +11 -11
- package/lib/components/XInputDT.js +37 -37
- package/lib/components/XInputDate.d.ts +13 -13
- package/lib/components/XInputDate.js +63 -63
- package/lib/components/XInputDateDT.d.ts +10 -10
- package/lib/components/XInputDateDT.js +55 -55
- package/lib/components/XInputDecimal.d.ts +15 -15
- package/lib/components/XInputDecimal.js +78 -78
- package/lib/components/XInputDecimalBase.d.ts +12 -12
- package/lib/components/XInputDecimalBase.js +18 -18
- package/lib/components/XInputDecimalDT.d.ts +11 -11
- package/lib/components/XInputDecimalDT.js +74 -74
- package/lib/components/XInputFileList.d.ts +36 -36
- package/lib/components/XInputFileList.js +251 -251
- package/lib/components/XInputInterval.d.ts +14 -0
- package/lib/components/XInputInterval.js +56 -0
- package/lib/components/XInputIntervalBase.d.ts +10 -0
- package/lib/components/XInputIntervalBase.js +97 -0
- package/lib/components/XInputIntervalDT.d.ts +11 -0
- package/lib/components/XInputIntervalDT.js +43 -0
- package/lib/components/XInputText.d.ts +12 -12
- package/lib/components/XInputText.js +69 -69
- package/lib/components/XInputTextDT.d.ts +9 -9
- package/lib/components/XInputTextDT.js +42 -42
- package/lib/components/XInputTextarea.d.ts +18 -18
- package/lib/components/XInputTextarea.js +85 -85
- package/lib/components/XLazyDataTable.d.ts +78 -78
- package/lib/components/XLazyDataTable.js +899 -885
- package/lib/components/XLocale.d.ts +26 -26
- package/lib/components/XLocale.js +59 -59
- package/lib/components/XLoginDialog.d.ts +8 -8
- package/lib/components/XLoginDialog.js +21 -21
- package/lib/components/XLoginForm.d.ts +7 -7
- package/lib/components/XLoginForm.js +128 -128
- package/lib/components/XObject.d.ts +3 -3
- package/lib/components/XObject.js +2 -2
- package/lib/components/XResponseError.d.ts +11 -11
- package/lib/components/XResponseError.js +32 -32
- package/lib/components/XSearchButton.d.ts +26 -26
- package/lib/components/XSearchButton.js +225 -225
- package/lib/components/XSearchButtonDT.d.ts +12 -12
- package/lib/components/XSearchButtonDT.js +188 -188
- package/lib/components/XSearchButtonOld.d.ts +13 -13
- package/lib/components/XSearchButtonOld.js +212 -212
- package/lib/components/XToOneAssocButton.d.ts +8 -8
- package/lib/components/XToOneAssocButton.js +30 -30
- package/lib/components/XToken.d.ts +6 -6
- package/lib/components/XToken.js +2 -2
- package/lib/components/XUtils.d.ts +84 -74
- package/lib/components/XUtils.js +664 -627
- package/lib/components/XUtilsConversions.d.ts +15 -12
- package/lib/components/XUtilsConversions.js +177 -125
- package/lib/components/XUtilsMetadata.d.ts +39 -39
- package/lib/components/XUtilsMetadata.js +452 -452
- package/lib/components/locale/x-en.json +26 -26
- package/lib/components/useXToken.d.ts +2 -2
- package/lib/components/useXToken.js +44 -44
- package/lib/serverApi/ExportImportParam.d.ts +51 -51
- package/lib/serverApi/ExportImportParam.js +34 -34
- package/lib/serverApi/FindParam.d.ts +35 -34
- package/lib/serverApi/FindParam.js +30 -30
- package/lib/serverApi/FindResult.d.ts +8 -8
- package/lib/serverApi/FindResult.js +2 -2
- package/lib/serverApi/XBrowseMetadata.d.ts +19 -19
- package/lib/serverApi/XBrowseMetadata.js +2 -2
- package/lib/serverApi/XEntityMetadata.d.ts +35 -35
- package/lib/serverApi/XEntityMetadata.js +2 -2
- package/lib/serverApi/XFileJsonField.d.ts +6 -6
- package/lib/serverApi/XFileJsonField.js +2 -2
- package/lib/serverApi/XUser.d.ts +8 -7
- package/lib/serverApi/XUser.js +2 -2
- package/lib/serverApi/XUserAuthenticationIfc.d.ts +9 -9
- package/lib/serverApi/XUserAuthenticationIfc.js +2 -2
- package/lib/serverApi/XUtilsCommon.d.ts +14 -13
- package/lib/serverApi/XUtilsCommon.js +180 -110
- package/package.json +1 -1
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { XFormComponentDT, XFormComponentDTProps } from "./XFormComponentDT";
|
|
3
|
-
import { XAssoc } from "../serverApi/XEntityMetadata";
|
|
4
|
-
import { OperationType } from "./XUtils";
|
|
5
|
-
import { XError } from "./XErrors";
|
|
6
|
-
import { XTableFieldFilterProp } from "./XFormDataTable2";
|
|
7
|
-
export interface XAutoCompleteDTProps extends XFormComponentDTProps {
|
|
8
|
-
assocField: string;
|
|
9
|
-
displayField: string | ((suggestion: any) => string);
|
|
10
|
-
searchTable?: any;
|
|
11
|
-
assocForm?: any;
|
|
12
|
-
filter?: XTableFieldFilterProp;
|
|
13
|
-
}
|
|
14
|
-
export declare class XAutoCompleteDT extends XFormComponentDT<XAutoCompleteDTProps> {
|
|
15
|
-
protected xAssoc: XAssoc;
|
|
16
|
-
protected errorInBase: string | undefined;
|
|
17
|
-
state: {
|
|
18
|
-
suggestions: any[];
|
|
19
|
-
};
|
|
20
|
-
constructor(props: XAutoCompleteDTProps);
|
|
21
|
-
componentDidMount(): void;
|
|
22
|
-
readAndSetSuggestions(): Promise<void>;
|
|
23
|
-
getField(): string;
|
|
24
|
-
isNotNull(): boolean;
|
|
25
|
-
getValue(): any | null;
|
|
26
|
-
onChangeAutoCompleteBase(object: any, objectChange: OperationType): void;
|
|
27
|
-
onErrorChangeAutoCompleteBase(error: string | undefined): void;
|
|
28
|
-
validate(): {
|
|
29
|
-
field: string;
|
|
30
|
-
xError: XError;
|
|
31
|
-
} | undefined;
|
|
32
|
-
render(): JSX.Element;
|
|
33
|
-
}
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { XFormComponentDT, XFormComponentDTProps } from "./XFormComponentDT";
|
|
3
|
+
import { XAssoc } from "../serverApi/XEntityMetadata";
|
|
4
|
+
import { OperationType } from "./XUtils";
|
|
5
|
+
import { XError } from "./XErrors";
|
|
6
|
+
import { XTableFieldFilterProp } from "./XFormDataTable2";
|
|
7
|
+
export interface XAutoCompleteDTProps extends XFormComponentDTProps {
|
|
8
|
+
assocField: string;
|
|
9
|
+
displayField: string | ((suggestion: any) => string);
|
|
10
|
+
searchTable?: any;
|
|
11
|
+
assocForm?: any;
|
|
12
|
+
filter?: XTableFieldFilterProp;
|
|
13
|
+
}
|
|
14
|
+
export declare class XAutoCompleteDT extends XFormComponentDT<XAutoCompleteDTProps> {
|
|
15
|
+
protected xAssoc: XAssoc;
|
|
16
|
+
protected errorInBase: string | undefined;
|
|
17
|
+
state: {
|
|
18
|
+
suggestions: any[];
|
|
19
|
+
};
|
|
20
|
+
constructor(props: XAutoCompleteDTProps);
|
|
21
|
+
componentDidMount(): void;
|
|
22
|
+
readAndSetSuggestions(): Promise<void>;
|
|
23
|
+
getField(): string;
|
|
24
|
+
isNotNull(): boolean;
|
|
25
|
+
getValue(): any | null;
|
|
26
|
+
onChangeAutoCompleteBase(object: any, objectChange: OperationType): void;
|
|
27
|
+
onErrorChangeAutoCompleteBase(error: string | undefined): void;
|
|
28
|
+
validate(): {
|
|
29
|
+
field: string;
|
|
30
|
+
xError: XError;
|
|
31
|
+
} | undefined;
|
|
32
|
+
render(): JSX.Element;
|
|
33
|
+
}
|
|
@@ -1,140 +1,140 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
54
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
55
|
-
};
|
|
56
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
-
exports.XAutoCompleteDT = void 0;
|
|
58
|
-
var XUtilsMetadata_1 = require("./XUtilsMetadata");
|
|
59
|
-
var react_1 = __importDefault(require("react"));
|
|
60
|
-
var XFormComponentDT_1 = require("./XFormComponentDT");
|
|
61
|
-
var XUtils_1 = require("./XUtils");
|
|
62
|
-
var XAutoCompleteBase_1 = require("./XAutoCompleteBase");
|
|
63
|
-
var XAutoCompleteDT = /** @class */ (function (_super) {
|
|
64
|
-
__extends(XAutoCompleteDT, _super);
|
|
65
|
-
function XAutoCompleteDT(props) {
|
|
66
|
-
var _this = _super.call(this, props) || this;
|
|
67
|
-
_this.xAssoc = XUtilsMetadata_1.XUtilsMetadata.getXAssocToOne(XUtilsMetadata_1.XUtilsMetadata.getXEntity(props.entity), props.assocField);
|
|
68
|
-
_this.errorInBase = undefined;
|
|
69
|
-
_this.state = {
|
|
70
|
-
suggestions: []
|
|
71
|
-
};
|
|
72
|
-
_this.onChangeAutoCompleteBase = _this.onChangeAutoCompleteBase.bind(_this);
|
|
73
|
-
_this.onErrorChangeAutoCompleteBase = _this.onErrorChangeAutoCompleteBase.bind(_this);
|
|
74
|
-
return _this;
|
|
75
|
-
}
|
|
76
|
-
XAutoCompleteDT.prototype.componentDidMount = function () {
|
|
77
|
-
this.readAndSetSuggestions();
|
|
78
|
-
};
|
|
79
|
-
XAutoCompleteDT.prototype.readAndSetSuggestions = function () {
|
|
80
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
81
|
-
var suggestions;
|
|
82
|
-
return __generator(this, function (_a) {
|
|
83
|
-
switch (_a.label) {
|
|
84
|
-
case 0: return [4 /*yield*/, XUtils_1.XUtils.fetchRows(this.xAssoc.entityName, this.getFilterBase(this.props.filter), typeof this.props.displayField === 'string' ? this.props.displayField : undefined)];
|
|
85
|
-
case 1:
|
|
86
|
-
suggestions = _a.sent();
|
|
87
|
-
// ak mame funkciu, zosortujeme tu
|
|
88
|
-
if (typeof this.props.displayField === 'function') {
|
|
89
|
-
suggestions = XUtils_1.XUtils.arraySort(suggestions, this.props.displayField);
|
|
90
|
-
}
|
|
91
|
-
this.setState({ suggestions: suggestions });
|
|
92
|
-
return [2 /*return*/];
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
XAutoCompleteDT.prototype.getField = function () {
|
|
98
|
-
return this.props.assocField;
|
|
99
|
-
};
|
|
100
|
-
XAutoCompleteDT.prototype.isNotNull = function () {
|
|
101
|
-
return !this.xAssoc.isNullable;
|
|
102
|
-
};
|
|
103
|
-
XAutoCompleteDT.prototype.getValue = function () {
|
|
104
|
-
var assocObject = this.getValueFromRowData();
|
|
105
|
-
return assocObject;
|
|
106
|
-
};
|
|
107
|
-
XAutoCompleteDT.prototype.onChangeAutoCompleteBase = function (object, objectChange) {
|
|
108
|
-
this.onValueChangeBase(object, this.props.onChange, objectChange);
|
|
109
|
-
if (objectChange !== XUtils_1.OperationType.None) {
|
|
110
|
-
// zmenil sa zaznam dobrovolnika v DB
|
|
111
|
-
// zatial len refreshneme z DB
|
|
112
|
-
// ak by bol reqest pomaly, mozme pri inserte (nove id) / update (existujuce id) upravit zoznam a usetrime tym request do DB
|
|
113
|
-
// ak bol delete (dobrovolnik === null), treba urobit refresh do DB (alebo si poslat id-cko zmazaneho zaznamu)
|
|
114
|
-
this.readAndSetSuggestions();
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
XAutoCompleteDT.prototype.onErrorChangeAutoCompleteBase = function (error) {
|
|
118
|
-
this.errorInBase = error; // odlozime si error
|
|
119
|
-
};
|
|
120
|
-
// overrides method in XFormComponent
|
|
121
|
-
XAutoCompleteDT.prototype.validate = function () {
|
|
122
|
-
if (this.errorInBase) {
|
|
123
|
-
// error message dame na onChange, mohli by sme aj na onSet (predtym onBlur), je to jedno viac-menej
|
|
124
|
-
// TODO - fieldLabel
|
|
125
|
-
return { field: this.getField(), xError: { onChange: this.errorInBase, fieldLabel: undefined } };
|
|
126
|
-
}
|
|
127
|
-
// zavolame povodnu metodu
|
|
128
|
-
return _super.prototype.validate.call(this);
|
|
129
|
-
};
|
|
130
|
-
XAutoCompleteDT.prototype.render = function () {
|
|
131
|
-
var xEntityAssoc = XUtilsMetadata_1.XUtilsMetadata.getXEntity(this.xAssoc.entityName);
|
|
132
|
-
//const xDisplayField = XUtilsMetadata.getXFieldByPath(xEntityAssoc, this.props.displayField);
|
|
133
|
-
// TODO - size
|
|
134
|
-
//const size = this.props.size ?? xDisplayField.length;
|
|
135
|
-
// div className="col" nam zabezpeci aby XAutoCompleteBase nezaberal celu dlzku grid-u (ma nastaveny width=100% vdaka "formgroup-inline")
|
|
136
|
-
return (react_1.default.createElement(XAutoCompleteBase_1.XAutoCompleteBase, { value: this.getValue(), suggestions: this.state.suggestions, onChange: this.onChangeAutoCompleteBase, field: this.props.displayField, valueForm: this.props.assocForm, idField: xEntityAssoc.idField, readOnly: this.isReadOnly(), error: this.getError(), onErrorChange: this.onErrorChangeAutoCompleteBase }));
|
|
137
|
-
};
|
|
138
|
-
return XAutoCompleteDT;
|
|
139
|
-
}(XFormComponentDT_1.XFormComponentDT));
|
|
140
|
-
exports.XAutoCompleteDT = XAutoCompleteDT;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
54
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
55
|
+
};
|
|
56
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
+
exports.XAutoCompleteDT = void 0;
|
|
58
|
+
var XUtilsMetadata_1 = require("./XUtilsMetadata");
|
|
59
|
+
var react_1 = __importDefault(require("react"));
|
|
60
|
+
var XFormComponentDT_1 = require("./XFormComponentDT");
|
|
61
|
+
var XUtils_1 = require("./XUtils");
|
|
62
|
+
var XAutoCompleteBase_1 = require("./XAutoCompleteBase");
|
|
63
|
+
var XAutoCompleteDT = /** @class */ (function (_super) {
|
|
64
|
+
__extends(XAutoCompleteDT, _super);
|
|
65
|
+
function XAutoCompleteDT(props) {
|
|
66
|
+
var _this = _super.call(this, props) || this;
|
|
67
|
+
_this.xAssoc = XUtilsMetadata_1.XUtilsMetadata.getXAssocToOne(XUtilsMetadata_1.XUtilsMetadata.getXEntity(props.entity), props.assocField);
|
|
68
|
+
_this.errorInBase = undefined;
|
|
69
|
+
_this.state = {
|
|
70
|
+
suggestions: []
|
|
71
|
+
};
|
|
72
|
+
_this.onChangeAutoCompleteBase = _this.onChangeAutoCompleteBase.bind(_this);
|
|
73
|
+
_this.onErrorChangeAutoCompleteBase = _this.onErrorChangeAutoCompleteBase.bind(_this);
|
|
74
|
+
return _this;
|
|
75
|
+
}
|
|
76
|
+
XAutoCompleteDT.prototype.componentDidMount = function () {
|
|
77
|
+
this.readAndSetSuggestions();
|
|
78
|
+
};
|
|
79
|
+
XAutoCompleteDT.prototype.readAndSetSuggestions = function () {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
81
|
+
var suggestions;
|
|
82
|
+
return __generator(this, function (_a) {
|
|
83
|
+
switch (_a.label) {
|
|
84
|
+
case 0: return [4 /*yield*/, XUtils_1.XUtils.fetchRows(this.xAssoc.entityName, this.getFilterBase(this.props.filter), typeof this.props.displayField === 'string' ? this.props.displayField : undefined)];
|
|
85
|
+
case 1:
|
|
86
|
+
suggestions = _a.sent();
|
|
87
|
+
// ak mame funkciu, zosortujeme tu
|
|
88
|
+
if (typeof this.props.displayField === 'function') {
|
|
89
|
+
suggestions = XUtils_1.XUtils.arraySort(suggestions, this.props.displayField);
|
|
90
|
+
}
|
|
91
|
+
this.setState({ suggestions: suggestions });
|
|
92
|
+
return [2 /*return*/];
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
XAutoCompleteDT.prototype.getField = function () {
|
|
98
|
+
return this.props.assocField;
|
|
99
|
+
};
|
|
100
|
+
XAutoCompleteDT.prototype.isNotNull = function () {
|
|
101
|
+
return !this.xAssoc.isNullable;
|
|
102
|
+
};
|
|
103
|
+
XAutoCompleteDT.prototype.getValue = function () {
|
|
104
|
+
var assocObject = this.getValueFromRowData();
|
|
105
|
+
return assocObject;
|
|
106
|
+
};
|
|
107
|
+
XAutoCompleteDT.prototype.onChangeAutoCompleteBase = function (object, objectChange) {
|
|
108
|
+
this.onValueChangeBase(object, this.props.onChange, objectChange);
|
|
109
|
+
if (objectChange !== XUtils_1.OperationType.None) {
|
|
110
|
+
// zmenil sa zaznam dobrovolnika v DB
|
|
111
|
+
// zatial len refreshneme z DB
|
|
112
|
+
// ak by bol reqest pomaly, mozme pri inserte (nove id) / update (existujuce id) upravit zoznam a usetrime tym request do DB
|
|
113
|
+
// ak bol delete (dobrovolnik === null), treba urobit refresh do DB (alebo si poslat id-cko zmazaneho zaznamu)
|
|
114
|
+
this.readAndSetSuggestions();
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
XAutoCompleteDT.prototype.onErrorChangeAutoCompleteBase = function (error) {
|
|
118
|
+
this.errorInBase = error; // odlozime si error
|
|
119
|
+
};
|
|
120
|
+
// overrides method in XFormComponent
|
|
121
|
+
XAutoCompleteDT.prototype.validate = function () {
|
|
122
|
+
if (this.errorInBase) {
|
|
123
|
+
// error message dame na onChange, mohli by sme aj na onSet (predtym onBlur), je to jedno viac-menej
|
|
124
|
+
// TODO - fieldLabel
|
|
125
|
+
return { field: this.getField(), xError: { onChange: this.errorInBase, fieldLabel: undefined } };
|
|
126
|
+
}
|
|
127
|
+
// zavolame povodnu metodu
|
|
128
|
+
return _super.prototype.validate.call(this);
|
|
129
|
+
};
|
|
130
|
+
XAutoCompleteDT.prototype.render = function () {
|
|
131
|
+
var xEntityAssoc = XUtilsMetadata_1.XUtilsMetadata.getXEntity(this.xAssoc.entityName);
|
|
132
|
+
//const xDisplayField = XUtilsMetadata.getXFieldByPath(xEntityAssoc, this.props.displayField);
|
|
133
|
+
// TODO - size
|
|
134
|
+
//const size = this.props.size ?? xDisplayField.length;
|
|
135
|
+
// div className="col" nam zabezpeci aby XAutoCompleteBase nezaberal celu dlzku grid-u (ma nastaveny width=100% vdaka "formgroup-inline")
|
|
136
|
+
return (react_1.default.createElement(XAutoCompleteBase_1.XAutoCompleteBase, { value: this.getValue(), suggestions: this.state.suggestions, onChange: this.onChangeAutoCompleteBase, field: this.props.displayField, valueForm: this.props.assocForm, idField: xEntityAssoc.idField, readOnly: this.isReadOnly(), error: this.getError(), onErrorChange: this.onErrorChangeAutoCompleteBase }));
|
|
137
|
+
};
|
|
138
|
+
return XAutoCompleteDT;
|
|
139
|
+
}(XFormComponentDT_1.XFormComponentDT));
|
|
140
|
+
exports.XAutoCompleteDT = XAutoCompleteDT;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { Component } from "react";
|
|
2
|
-
import { XEditColumnDialogValues } from "./XEditColumnDialog";
|
|
3
|
-
import { XBrowseMeta } from "../serverApi/XBrowseMetadata";
|
|
4
|
-
export interface XBrowseProps {
|
|
5
|
-
entity: string;
|
|
6
|
-
browseId?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare class XBrowse extends Component<XBrowseProps> {
|
|
9
|
-
state: {
|
|
10
|
-
xBrowseMeta: XBrowseMeta;
|
|
11
|
-
editMode: boolean;
|
|
12
|
-
editColumnDialogOpened: boolean;
|
|
13
|
-
};
|
|
14
|
-
indexForAddColumn?: number;
|
|
15
|
-
addColumn: boolean;
|
|
16
|
-
xEditColumnDialogValues?: XEditColumnDialogValues;
|
|
17
|
-
constructor(props: XBrowseProps);
|
|
18
|
-
getXBrowseMeta(): XBrowseMeta;
|
|
19
|
-
createDefaultXBrowseMeta(): XBrowseMeta;
|
|
20
|
-
onEditModeStart(): void;
|
|
21
|
-
onEditModeSave(): Promise<void>;
|
|
22
|
-
onEditModeCancel(): void;
|
|
23
|
-
onAddColumn(field: string): void;
|
|
24
|
-
editColumnDialogOnHide(xEditColumnDialogValues: XEditColumnDialogValues | null): void;
|
|
25
|
-
onEditColumn(field: string): void;
|
|
26
|
-
onRemoveColumn(field: string): void;
|
|
27
|
-
onMoveColumnLeft(field: string): void;
|
|
28
|
-
onMoveColumnRight(field: string): void;
|
|
29
|
-
moveColumn(field: string, offset: -1 | 1): void;
|
|
30
|
-
getIndexForColumn(field: string): number | undefined;
|
|
31
|
-
onEdit(selectedRow: any): void;
|
|
32
|
-
render(): JSX.Element;
|
|
33
|
-
}
|
|
1
|
+
import { Component } from "react";
|
|
2
|
+
import { XEditColumnDialogValues } from "./XEditColumnDialog";
|
|
3
|
+
import { XBrowseMeta } from "../serverApi/XBrowseMetadata";
|
|
4
|
+
export interface XBrowseProps {
|
|
5
|
+
entity: string;
|
|
6
|
+
browseId?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class XBrowse extends Component<XBrowseProps> {
|
|
9
|
+
state: {
|
|
10
|
+
xBrowseMeta: XBrowseMeta;
|
|
11
|
+
editMode: boolean;
|
|
12
|
+
editColumnDialogOpened: boolean;
|
|
13
|
+
};
|
|
14
|
+
indexForAddColumn?: number;
|
|
15
|
+
addColumn: boolean;
|
|
16
|
+
xEditColumnDialogValues?: XEditColumnDialogValues;
|
|
17
|
+
constructor(props: XBrowseProps);
|
|
18
|
+
getXBrowseMeta(): XBrowseMeta;
|
|
19
|
+
createDefaultXBrowseMeta(): XBrowseMeta;
|
|
20
|
+
onEditModeStart(): void;
|
|
21
|
+
onEditModeSave(): Promise<void>;
|
|
22
|
+
onEditModeCancel(): void;
|
|
23
|
+
onAddColumn(field: string): void;
|
|
24
|
+
editColumnDialogOnHide(xEditColumnDialogValues: XEditColumnDialogValues | null): void;
|
|
25
|
+
onEditColumn(field: string): void;
|
|
26
|
+
onRemoveColumn(field: string): void;
|
|
27
|
+
onMoveColumnLeft(field: string): void;
|
|
28
|
+
onMoveColumnRight(field: string): void;
|
|
29
|
+
moveColumn(field: string, offset: -1 | 1): void;
|
|
30
|
+
getIndexForColumn(field: string): number | undefined;
|
|
31
|
+
onEdit(selectedRow: any): void;
|
|
32
|
+
render(): JSX.Element;
|
|
33
|
+
}
|