@michalrakus/x-react-web-lib 0.25.0 → 1.1.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/LICENSE.md +21 -0
- package/XEnvVars.d.ts +3 -0
- package/XEnvVars.js +5 -0
- package/XInputTextarea.d.ts +3 -0
- package/XInputTextarea.js +5 -0
- package/gulpfile.js +2 -0
- package/lib/administration/XBrowseMetaForm.js +1 -1
- package/lib/administration/XUserBrowse.js +5 -4
- package/lib/administration/XUserForm.js +40 -28
- package/lib/components/SourceCodeLinkEntity.js +1 -1
- package/lib/components/XAutoComplete.d.ts +3 -3
- package/lib/components/XAutoComplete.js +16 -37
- package/lib/components/XAutoCompleteBase.d.ts +1 -1
- package/lib/components/XAutoCompleteBase.js +23 -22
- package/lib/components/XBrowse.js +7 -3
- package/lib/components/XChangePasswordForm.js +9 -5
- package/lib/components/XCheckbox.d.ts +8 -9
- package/lib/components/XCheckbox.js +38 -30
- package/lib/components/XDataTable.js +11 -7
- package/lib/components/XDropdown.d.ts +4 -3
- package/lib/components/XDropdown.js +21 -44
- package/lib/components/XDropdownDT.js +7 -3
- package/lib/components/XDropdownDTFilter.js +9 -5
- package/lib/components/XDropdownFormDTFilter.js +9 -5
- package/lib/components/XEditColumnDialog.js +9 -5
- package/lib/components/XEnvVars.d.ts +12 -0
- package/lib/components/XEnvVars.js +20 -0
- package/lib/components/XErrors.d.ts +1 -0
- package/lib/components/XExportRowsDialog.js +12 -6
- package/lib/components/XFieldSelector.js +8 -4
- package/lib/components/XFormBase.d.ts +1 -0
- package/lib/components/XFormBase.js +47 -21
- package/lib/components/XFormComponent.d.ts +10 -6
- package/lib/components/XFormComponent.js +60 -48
- package/lib/components/XFormDataTable2.d.ts +8 -3
- package/lib/components/XFormDataTable2.js +106 -28
- package/lib/components/XFormNavigator3.js +14 -6
- package/lib/components/XInput.d.ts +13 -0
- package/lib/components/XInput.js +38 -0
- package/lib/components/XInputDate.js +1 -1
- package/lib/components/XInputDateDT.js +1 -1
- package/lib/components/XInputText.d.ts +6 -11
- package/lib/components/XInputText.js +14 -49
- package/lib/components/XInputTextDT.js +2 -3
- package/lib/components/XInputTextarea.d.ts +18 -0
- package/lib/components/XInputTextarea.js +85 -0
- package/lib/components/XLazyDataTable.d.ts +3 -0
- package/lib/components/XLazyDataTable.js +162 -77
- package/lib/components/XLoginForm.js +9 -5
- package/lib/components/XResponseError.js +1 -1
- package/lib/components/XSearchButton.d.ts +2 -3
- package/lib/components/XSearchButton.js +12 -35
- package/lib/components/XSearchButtonDT.js +10 -6
- package/lib/components/XSearchButtonOld.js +10 -6
- package/lib/components/XToken.d.ts +4 -3
- package/lib/components/XUtils.d.ts +13 -4
- package/lib/components/XUtils.js +90 -15
- package/lib/components/XUtilsConversions.js +10 -2
- package/lib/components/XUtilsMetadata.d.ts +1 -1
- package/lib/components/XUtilsMetadata.js +20 -11
- package/lib/components/useXToken.js +1 -1
- package/lib/serverApi/ExportImportParam.d.ts +3 -3
- package/lib/serverApi/FindParam.d.ts +3 -13
- package/lib/serverApi/FindParam.js +14 -0
- package/lib/serverApi/XUser.d.ts +1 -0
- package/lib/serverApi/XUtilsCommon.js +2 -2
- package/package.json +34 -32
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-2023 Michal Rakus
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/XEnvVars.d.ts
ADDED
package/XEnvVars.js
ADDED
package/gulpfile.js
CHANGED
|
@@ -21,6 +21,7 @@ function generateApi(cb) {
|
|
|
21
21
|
"./lib/components/XChangePasswordForm",
|
|
22
22
|
"./lib/components/XCheckbox",
|
|
23
23
|
"./lib/components/XDropdown",
|
|
24
|
+
"./lib/components/XEnvVars",
|
|
24
25
|
"./lib/components/XErrors",
|
|
25
26
|
"./lib/components/XFormBase",
|
|
26
27
|
"./lib/components/XFormBaseT",
|
|
@@ -31,6 +32,7 @@ function generateApi(cb) {
|
|
|
31
32
|
"./lib/components/XInputDate",
|
|
32
33
|
"./lib/components/XInputDecimal",
|
|
33
34
|
"./lib/components/XInputText",
|
|
35
|
+
"./lib/components/XInputTextarea",
|
|
34
36
|
"./lib/components/XLazyDataTable",
|
|
35
37
|
"./lib/components/XLoginDialog",
|
|
36
38
|
"./lib/components/XLoginForm",
|
|
@@ -56,7 +56,7 @@ var XBrowseMetaForm = /** @class */ (function (_super) {
|
|
|
56
56
|
react_1.default.createElement(XFormFooter_1.XFormFooter, { form: this })));
|
|
57
57
|
};
|
|
58
58
|
XBrowseMetaForm = __decorate([
|
|
59
|
-
XFormBase_1.Form("XBrowseMeta")
|
|
59
|
+
(0, XFormBase_1.Form)("XBrowseMeta")
|
|
60
60
|
], XBrowseMetaForm);
|
|
61
61
|
return XBrowseMetaForm;
|
|
62
62
|
}(XFormBase_1.XFormBase));
|
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
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;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -47,7 +47,7 @@ var XUtils_1 = require("../components/XUtils");
|
|
|
47
47
|
var XUserBrowse = function (props) {
|
|
48
48
|
var onAddRow = function () {
|
|
49
49
|
// openForm pridavame automaticky v XFormNavigator3 pri renderovani komponentu
|
|
50
|
-
props.openForm(react_1.default.createElement(XUserForm_1.XUserForm,
|
|
50
|
+
props.openForm(react_1.default.createElement(XUserForm_1.XUserForm, { object: { enabled: true } }));
|
|
51
51
|
};
|
|
52
52
|
var onEdit = function (selectedRow) {
|
|
53
53
|
// openForm pridavame automaticky v XFormNavigator3 pri renderovani komponentu
|
|
@@ -77,8 +77,9 @@ var XUserBrowse = function (props) {
|
|
|
77
77
|
}); };
|
|
78
78
|
return (react_1.default.createElement(XLazyDataTable_1.XLazyDataTable, { entity: "XUser", rows: 10, onAddRow: onAddRow, onEdit: onEdit, removeRow: onRemoveRow, displayed: props.displayed },
|
|
79
79
|
react_1.default.createElement(XLazyDataTable_1.XLazyColumn, { field: "idXUser", header: "ID" }),
|
|
80
|
-
react_1.default.createElement(XLazyDataTable_1.XLazyColumn, { field: "username", header: "Username", width: "
|
|
81
|
-
react_1.default.createElement(XLazyDataTable_1.XLazyColumn, { field: "name", header: "Name", width: "17rem" })
|
|
80
|
+
react_1.default.createElement(XLazyDataTable_1.XLazyColumn, { field: "username", header: "Username", width: "17rem" }),
|
|
81
|
+
react_1.default.createElement(XLazyDataTable_1.XLazyColumn, { field: "name", header: "Name", width: "17rem" }),
|
|
82
|
+
react_1.default.createElement(XLazyDataTable_1.XLazyColumn, { field: "enabled", header: "Enabled" })));
|
|
82
83
|
};
|
|
83
84
|
exports.XUserBrowse = XUserBrowse;
|
|
84
85
|
// zatial nepouzivane - prichystane do buducnosti
|
|
@@ -38,7 +38,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
39
39
|
function step(op) {
|
|
40
40
|
if (f) throw new TypeError("Generator is already executing.");
|
|
41
|
-
while (_) try {
|
|
41
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
42
42
|
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
43
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
44
44
|
switch (op[0]) {
|
|
@@ -71,11 +71,13 @@ var XInputDecimal_1 = require("../components/XInputDecimal");
|
|
|
71
71
|
var password_1 = require("primereact/password");
|
|
72
72
|
var XUtils_1 = require("../components/XUtils");
|
|
73
73
|
var XFormFooter_1 = require("../components/XFormFooter");
|
|
74
|
+
var XCheckbox_1 = require("../components/XCheckbox");
|
|
75
|
+
var XEnvVars_1 = require("../components/XEnvVars");
|
|
74
76
|
var XUserForm = /** @class */ (function (_super) {
|
|
75
77
|
__extends(XUserForm, _super);
|
|
76
78
|
function XUserForm(props) {
|
|
77
79
|
var _this = _super.call(this, props) || this;
|
|
78
|
-
_this.state.
|
|
80
|
+
_this.state.usernameEnabledReadOnly = false;
|
|
79
81
|
_this.state.passwordNew = '';
|
|
80
82
|
_this.state.passwordNewConfirm = '';
|
|
81
83
|
_this.onClickSave = _this.onClickSave.bind(_this);
|
|
@@ -91,7 +93,7 @@ var XUserForm = /** @class */ (function (_super) {
|
|
|
91
93
|
_a.sent();
|
|
92
94
|
username = this.getXObject().username;
|
|
93
95
|
if (username === XUtils_1.XUtils.getUsername() || (XUtils_1.XUtils.demo() && (username === 'jozko' || username === 'xman'))) {
|
|
94
|
-
this.setState({
|
|
96
|
+
this.setState({ usernameEnabledReadOnly: true });
|
|
95
97
|
}
|
|
96
98
|
return [2 /*return*/];
|
|
97
99
|
}
|
|
@@ -112,26 +114,29 @@ var XUserForm = /** @class */ (function (_super) {
|
|
|
112
114
|
alert("Users jozko, xman can not be changed.");
|
|
113
115
|
return [2 /*return*/];
|
|
114
116
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (this.state.passwordNew !== '' || this.state.passwordNewConfirm !== '') {
|
|
120
|
-
// nedovolime tuto zmenit heslo aktualne prihlasenemu uzivatelovi, lebo by sme museli upravit aj token
|
|
121
|
-
if (this.state.object.username === XUtils_1.XUtils.getUsername()) {
|
|
122
|
-
alert("Please, change your password via option Administration -> Change password.");
|
|
117
|
+
// password is used only by local authorization
|
|
118
|
+
if (XUtils_1.XUtils.getEnvVarValue(XEnvVars_1.XEnvVar.REACT_APP_AUTH) === XEnvVars_1.XReactAppAuth.LOCAL) {
|
|
119
|
+
if (this.isAddRow() && this.state.passwordNew === '') {
|
|
120
|
+
alert("Password is required.");
|
|
123
121
|
return [2 /*return*/];
|
|
124
122
|
}
|
|
125
|
-
if (this.state.passwordNew !== this.state.passwordNewConfirm) {
|
|
126
|
-
|
|
127
|
-
|
|
123
|
+
if (this.state.passwordNew !== '' || this.state.passwordNewConfirm !== '') {
|
|
124
|
+
// nedovolime tuto zmenit heslo aktualne prihlasenemu uzivatelovi, lebo by sme museli upravit aj token
|
|
125
|
+
if (this.state.object.username === XUtils_1.XUtils.getUsername()) {
|
|
126
|
+
alert("Please, change your password via option Administration -> Change password.");
|
|
127
|
+
return [2 /*return*/];
|
|
128
|
+
}
|
|
129
|
+
if (this.state.passwordNew !== this.state.passwordNewConfirm) {
|
|
130
|
+
alert("New password and confirmed new password are not equal.");
|
|
131
|
+
return [2 /*return*/];
|
|
132
|
+
}
|
|
133
|
+
// zapiseme nove heslo do objektu
|
|
134
|
+
this.state.object.password = this.state.passwordNew;
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
// nemenime heslo (atribut s hodnotou undefined sa nezapise do DB)
|
|
138
|
+
this.state.object.password = undefined;
|
|
128
139
|
}
|
|
129
|
-
// zapiseme nove heslo do objektu
|
|
130
|
-
this.state.object.password = this.state.passwordNew;
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
// nemenime heslo (atribut s hodnotou undefined sa nezapise do DB)
|
|
134
|
-
this.state.object.password = undefined;
|
|
135
140
|
}
|
|
136
141
|
_a.label = 1;
|
|
137
142
|
case 1:
|
|
@@ -154,22 +159,29 @@ var XUserForm = /** @class */ (function (_super) {
|
|
|
154
159
|
XUserForm.prototype.render = function () {
|
|
155
160
|
var _this = this;
|
|
156
161
|
// autoComplete="new-password" - bez tohto chrome predplna user/password, ak si user da ulozit user/password (pre danu url)
|
|
162
|
+
var passwordElems = [];
|
|
163
|
+
if (XUtils_1.XUtils.getEnvVarValue(XEnvVars_1.XEnvVar.REACT_APP_AUTH) === XEnvVars_1.XReactAppAuth.LOCAL) {
|
|
164
|
+
passwordElems = [
|
|
165
|
+
react_1.default.createElement("div", { className: "field grid" },
|
|
166
|
+
react_1.default.createElement("label", { className: "col-fixed", style: { width: '14rem' } }, "New password"),
|
|
167
|
+
react_1.default.createElement(password_1.Password, { value: this.state.passwordNew, onChange: function (e) { return _this.setState({ passwordNew: e.target.value }); }, feedback: false, maxLength: 64, size: 20, autoComplete: "new-password" })),
|
|
168
|
+
react_1.default.createElement("div", { className: "field grid" },
|
|
169
|
+
react_1.default.createElement("label", { className: "col-fixed", style: { width: '14rem', whiteSpace: 'nowrap' } }, "Confirm new password"),
|
|
170
|
+
react_1.default.createElement(password_1.Password, { value: this.state.passwordNewConfirm, onChange: function (e) { return _this.setState({ passwordNewConfirm: e.target.value }); }, feedback: false, maxLength: 64, size: 20, autoComplete: "new-password" }))
|
|
171
|
+
];
|
|
172
|
+
}
|
|
157
173
|
return (react_1.default.createElement("div", null,
|
|
158
174
|
react_1.default.createElement("div", { className: "x-form-row" },
|
|
159
175
|
react_1.default.createElement("div", { className: "x-form-col" },
|
|
160
176
|
react_1.default.createElement(XInputDecimal_1.XInputDecimal, { form: this, field: "idXUser", label: "ID", readOnly: true, labelStyle: { width: '14rem' } }),
|
|
161
|
-
react_1.default.createElement(XInputText_1.XInputText, { form: this, field: "username", label: "Username", size:
|
|
177
|
+
react_1.default.createElement(XInputText_1.XInputText, { form: this, field: "username", label: "Username", size: 30, labelStyle: { width: '14rem' }, readOnly: this.state.usernameEnabledReadOnly }),
|
|
162
178
|
react_1.default.createElement(XInputText_1.XInputText, { form: this, field: "name", label: "Name", size: 30, labelStyle: { width: '14rem' } }),
|
|
163
|
-
react_1.default.createElement(
|
|
164
|
-
|
|
165
|
-
react_1.default.createElement(password_1.Password, { value: this.state.passwordNew, onChange: function (e) { return _this.setState({ passwordNew: e.target.value }); }, feedback: false, maxLength: 64, size: 20, autoComplete: "new-password" })),
|
|
166
|
-
react_1.default.createElement("div", { className: "field grid" },
|
|
167
|
-
react_1.default.createElement("label", { className: "col-fixed", style: { width: '14rem', whiteSpace: 'nowrap' } }, "Confirm new password"),
|
|
168
|
-
react_1.default.createElement(password_1.Password, { value: this.state.passwordNewConfirm, onChange: function (e) { return _this.setState({ passwordNewConfirm: e.target.value }); }, feedback: false, maxLength: 64, size: 20, autoComplete: "new-password" })))),
|
|
179
|
+
react_1.default.createElement(XCheckbox_1.XCheckbox, { form: this, field: "enabled", label: "Enabled", labelStyle: { width: '14rem' }, readOnly: this.state.usernameEnabledReadOnly }),
|
|
180
|
+
passwordElems)),
|
|
169
181
|
react_1.default.createElement(XFormFooter_1.XFormFooter, { form: this })));
|
|
170
182
|
};
|
|
171
183
|
XUserForm = __decorate([
|
|
172
|
-
XFormBase_1.Form("XUser"),
|
|
184
|
+
(0, XFormBase_1.Form)("XUser"),
|
|
173
185
|
__metadata("design:paramtypes", [Object])
|
|
174
186
|
], XUserForm);
|
|
175
187
|
return XUserForm;
|
|
@@ -7,7 +7,7 @@ exports.SourceCodeLinkEntity = void 0;
|
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
8
|
var SourceCodeLinkEntity = function (props) {
|
|
9
9
|
return (react_1.default.createElement("div", { className: "flex justify-content-center" },
|
|
10
|
-
react_1.default.createElement("a", { className: "source-code-link", href: "https://github.com/michalrakus/demo-nest-server-app/blob/master/src/model/"
|
|
10
|
+
react_1.default.createElement("a", { className: "source-code-link", href: "https://github.com/michalrakus/demo-nest-server-app/blob/master/src/model/".concat(props.sourceCodeFile), target: "_blank", rel: "noopener noreferrer" },
|
|
11
11
|
"Source code entity: ",
|
|
12
12
|
props.sourceCodeFile)));
|
|
13
13
|
};
|
|
@@ -20,9 +20,9 @@ export declare class XAutoComplete extends XFormComponent<XAutoCompleteProps> {
|
|
|
20
20
|
constructor(props: XAutoCompleteProps);
|
|
21
21
|
componentDidMount(): void;
|
|
22
22
|
readAndSetSuggestions(): Promise<void>;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
getField(): string;
|
|
24
|
+
isNotNull(): boolean;
|
|
25
|
+
getValue(): any | null;
|
|
26
26
|
onChangeAutoCompleteBase(object: any, objectChange: OperationType): void;
|
|
27
27
|
onErrorChangeAutoCompleteBase(error: string | undefined): void;
|
|
28
28
|
validate(): {
|
|
@@ -29,7 +29,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
29
29
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
30
|
function step(op) {
|
|
31
31
|
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (_) try {
|
|
32
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
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
34
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
35
|
switch (op[0]) {
|
|
@@ -91,32 +91,18 @@ var XAutoComplete = /** @class */ (function (_super) {
|
|
|
91
91
|
});
|
|
92
92
|
});
|
|
93
93
|
};
|
|
94
|
-
XAutoComplete.prototype.
|
|
95
|
-
|
|
96
|
-
// TODO - zohladnit aj aktualny readOnly stav
|
|
97
|
-
var readOnly = (_a = this.props.readOnly) !== null && _a !== void 0 ? _a : false;
|
|
98
|
-
if (!readOnly) {
|
|
99
|
-
return this.props.assocField;
|
|
100
|
-
}
|
|
101
|
-
return undefined;
|
|
94
|
+
XAutoComplete.prototype.getField = function () {
|
|
95
|
+
return this.props.assocField;
|
|
102
96
|
};
|
|
103
|
-
XAutoComplete.prototype.
|
|
104
|
-
|
|
105
|
-
// TODO - zohladnit aj aktualny readOnly stav
|
|
106
|
-
return !this.xAssoc.isNullable && !((_a = this.props.readOnly) !== null && _a !== void 0 ? _a : false);
|
|
97
|
+
XAutoComplete.prototype.isNotNull = function () {
|
|
98
|
+
return !this.xAssoc.isNullable;
|
|
107
99
|
};
|
|
108
|
-
XAutoComplete.prototype.
|
|
109
|
-
var
|
|
110
|
-
var assocObject = object !== null ? object[this.props.assocField] : null;
|
|
111
|
-
// ak je undefined, pre istotu dame na null, null je standard
|
|
112
|
-
if (assocObject === undefined) {
|
|
113
|
-
assocObject = null;
|
|
114
|
-
}
|
|
100
|
+
XAutoComplete.prototype.getValue = function () {
|
|
101
|
+
var assocObject = this.getValueFromObject();
|
|
115
102
|
return assocObject;
|
|
116
103
|
};
|
|
117
104
|
XAutoComplete.prototype.onChangeAutoCompleteBase = function (object, objectChange) {
|
|
118
|
-
|
|
119
|
-
this.props.form.onFieldChange(this.props.assocField, object, error);
|
|
105
|
+
this.onValueChangeBase(object);
|
|
120
106
|
if (objectChange !== XUtils_1.OperationType.None) {
|
|
121
107
|
// zmenil sa zaznam dobrovolnika v DB
|
|
122
108
|
// zatial len refreshneme z DB
|
|
@@ -131,30 +117,23 @@ var XAutoComplete = /** @class */ (function (_super) {
|
|
|
131
117
|
// overrides method in XFormComponent
|
|
132
118
|
XAutoComplete.prototype.validate = function () {
|
|
133
119
|
if (this.errorInBase) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
// error message dame na onChange, mohli by sme aj na onSet (predtym onBlur), je to jedno viac-menej
|
|
137
|
-
return { field: field, xError: { onChange: this.errorInBase } };
|
|
138
|
-
}
|
|
120
|
+
// error message dame na onChange, mohli by sme aj na onSet (predtym onBlur), je to jedno viac-menej
|
|
121
|
+
return { field: this.getField(), xError: { onChange: this.errorInBase, fieldLabel: this.getLabel() } };
|
|
139
122
|
}
|
|
140
123
|
// zavolame povodnu metodu
|
|
141
124
|
return _super.prototype.validate.call(this);
|
|
142
125
|
};
|
|
143
126
|
XAutoComplete.prototype.render = function () {
|
|
144
|
-
var _a
|
|
127
|
+
var _a;
|
|
145
128
|
var xEntityAssoc = XUtilsMetadata_1.XUtilsMetadata.getXEntity(this.xAssoc.entityName);
|
|
146
129
|
var xDisplayField = XUtilsMetadata_1.XUtilsMetadata.getXFieldByPath(xEntityAssoc, this.props.displayField);
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
var readOnly = (_b = this.props.readOnly) !== null && _b !== void 0 ? _b : false;
|
|
152
|
-
var size = (_c = this.props.size) !== null && _c !== void 0 ? _c : xDisplayField.length;
|
|
153
|
-
var labelStyle = (_d = this.props.labelStyle) !== null && _d !== void 0 ? _d : { width: XUtils_1.XUtils.FIELD_LABEL_WIDTH };
|
|
130
|
+
// TODO - readOnly
|
|
131
|
+
// TODO - size
|
|
132
|
+
var size = (_a = this.props.size) !== null && _a !== void 0 ? _a : xDisplayField.length;
|
|
154
133
|
// div className="col" nam zabezpeci aby XAutoCompleteBase nezaberal celu dlzku grid-u (ma nastaveny width=100% vdaka "formgroup-inline")
|
|
155
134
|
return (react_1.default.createElement("div", { className: "field grid" },
|
|
156
|
-
react_1.default.createElement("label", { htmlFor: this.props.assocField, className: "col-fixed", style:
|
|
157
|
-
react_1.default.createElement(XAutoCompleteBase_1.XAutoCompleteBase, { value: this.
|
|
135
|
+
react_1.default.createElement("label", { htmlFor: this.props.assocField, className: "col-fixed", style: this.getLabelStyle() }, this.getLabel()),
|
|
136
|
+
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, error: this.getError(), onErrorChange: this.onErrorChangeAutoCompleteBase })));
|
|
158
137
|
};
|
|
159
138
|
return XAutoComplete;
|
|
160
139
|
}(XFormComponent_1.XFormComponent));
|
|
@@ -27,7 +27,11 @@ var __assign = (this && this.__assign) || function () {
|
|
|
27
27
|
};
|
|
28
28
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
29
29
|
if (k2 === undefined) k2 = k;
|
|
30
|
-
Object.
|
|
30
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
31
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
32
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
33
|
+
}
|
|
34
|
+
Object.defineProperty(o, k2, desc);
|
|
31
35
|
}) : (function(o, m, k, k2) {
|
|
32
36
|
if (k2 === undefined) k2 = k;
|
|
33
37
|
o[k2] = m[k];
|
|
@@ -60,10 +64,14 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
60
64
|
}
|
|
61
65
|
return ar;
|
|
62
66
|
};
|
|
63
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
64
|
-
for (var i = 0,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
68
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
69
|
+
if (ar || !(i in from)) {
|
|
70
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
71
|
+
ar[i] = from[i];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
67
75
|
};
|
|
68
76
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69
77
|
exports.XAutoCompleteBase = void 0;
|
|
@@ -101,7 +109,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
101
109
|
var _this = this;
|
|
102
110
|
var filteredSuggestions;
|
|
103
111
|
if (!event.query.trim().length) {
|
|
104
|
-
filteredSuggestions = __spreadArray([], __read(this.props.suggestions));
|
|
112
|
+
filteredSuggestions = __spreadArray([], __read(this.props.suggestions), false);
|
|
105
113
|
}
|
|
106
114
|
else {
|
|
107
115
|
var queryNormalized_1 = XUtils_1.XUtils.normalizeString(event.query);
|
|
@@ -163,7 +171,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
163
171
|
}
|
|
164
172
|
};
|
|
165
173
|
XAutoCompleteBase.prototype.createErrorMessage = function () {
|
|
166
|
-
return "Value \""
|
|
174
|
+
return "Value \"".concat(this.state.inputValueState, "\" was not found among valid values.");
|
|
167
175
|
};
|
|
168
176
|
/*
|
|
169
177
|
onBlurInvalidInput() {
|
|
@@ -189,18 +197,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
189
197
|
}
|
|
190
198
|
*/
|
|
191
199
|
XAutoCompleteBase.prototype.setFocusToInput = function () {
|
|
192
|
-
|
|
193
|
-
// funguje ak je XAutoCompleteBase priamo v projekte, tiez funguje ak sa pouziva lib-ka z npmjs.com
|
|
194
|
-
// nefunguje ak mame lib-ku priamo nalinkovanu na projekt (zmeny lib-ky pocas vyvoja)(minimalne next projekt kvm-next-web-app nefungoval)
|
|
195
|
-
this.autoCompleteRef.current.inputRef.current.focus();
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
// pozor! nefunguje ak sa lib-ka pouziva z npmjs.com,
|
|
199
|
-
// je tu koli tomu ked je lib-ka priamo nalinkovana na projekt
|
|
200
|
-
// je to hack ale neviem to lepsie vyriesit
|
|
201
|
-
console.log('Warning! this.autoCompleteRef.current.inputRef is undefined - we try to use this.autoCompleteRef.current.inputEl instead');
|
|
202
|
-
this.autoCompleteRef.current.inputEl.focus();
|
|
203
|
-
}
|
|
200
|
+
this.autoCompleteRef.current.focus();
|
|
204
201
|
};
|
|
205
202
|
XAutoCompleteBase.prototype.setObjectValue = function (object, objectChange) {
|
|
206
203
|
this.setState({ inputChanged: false, notValid: false });
|
|
@@ -263,7 +260,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
263
260
|
icon: 'pi pi-pencil',
|
|
264
261
|
command: function (e) {
|
|
265
262
|
if (_this.state.inputChanged) {
|
|
266
|
-
alert("Value \""
|
|
263
|
+
alert("Value \"".concat(_this.state.inputValueState, "\" was not found among valid values, please enter some valid value."));
|
|
267
264
|
_this.setFocusToInput();
|
|
268
265
|
}
|
|
269
266
|
else {
|
|
@@ -295,7 +292,11 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
295
292
|
command: function (e) {
|
|
296
293
|
// zobrazi cely suggestions list, zide sa ak chceme vidiet vsetky moznosti
|
|
297
294
|
// neprakticke ak mame vela poloziek v suggestions list
|
|
298
|
-
|
|
295
|
+
// krasne zobrazi cely objekt!
|
|
296
|
+
// this.autoCompleteRef.current je element <AutoComplete .../>, ktory vytvarame v render metode
|
|
297
|
+
//console.log(this.autoCompleteRef.current);
|
|
298
|
+
// otvori dropdown (search je metoda popisana v API, volanie sme skopcili zo zdrojakov primereact)
|
|
299
|
+
_this.autoCompleteRef.current.search(e, '', 'dropdown');
|
|
299
300
|
}
|
|
300
301
|
});
|
|
301
302
|
// vypocitame inputValue
|
|
@@ -312,7 +313,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
312
313
|
// <DobrovolnikForm id={this.formDialogObjectId} object={this.formDialogInitObjectForInsert} onSaveOrCancel={this.formDialogOnSaveOrCancel}/>
|
|
313
314
|
// formgroup-inline lepi SplitButton na autocomplete a zarovna jeho vysku
|
|
314
315
|
return (react_1.default.createElement("div", { className: "x-auto-complete-base" },
|
|
315
|
-
react_1.default.createElement(autocomplete_1.AutoComplete, __assign({ value: inputValue, suggestions: this.state.filteredSuggestions, completeMethod: this.completeMethod, field: this.props.field, onChange: this.onChange, onSelect: this.onSelect, onBlur: this.onBlur,
|
|
316
|
+
react_1.default.createElement(autocomplete_1.AutoComplete, __assign({ value: inputValue, suggestions: this.state.filteredSuggestions, completeMethod: this.completeMethod, field: this.props.field, onChange: this.onChange, onSelect: this.onSelect, onBlur: this.onBlur, maxLength: this.props.maxLength, ref: this.autoCompleteRef }, XUtils_1.XUtils.createErrorProps(error))),
|
|
316
317
|
react_1.default.createElement(splitbutton_1.SplitButton, { model: splitButtonItems, className: 'x-splitbutton-only-dropdown' + XUtils_1.XUtils.mobileCssSuffix(), menuClassName: 'x-splitbutton-only-dropdown-menu' + XUtils_1.XUtils.mobileCssSuffix() }),
|
|
317
318
|
this.props.valueForm != undefined ?
|
|
318
319
|
react_1.default.createElement(dialog_1.Dialog, { visible: this.state.formDialogOpened, onHide: this.formDialogOnHide, header: this.formDialogObjectId ? 'Modification' : 'New record' }, react_1.default.cloneElement(this.props.valueForm, {
|
|
@@ -16,7 +16,11 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
16
16
|
})();
|
|
17
17
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
18
|
if (k2 === undefined) k2 = k;
|
|
19
|
-
Object.
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
20
24
|
}) : (function(o, m, k, k2) {
|
|
21
25
|
if (k2 === undefined) k2 = k;
|
|
22
26
|
o[k2] = m[k];
|
|
@@ -48,7 +52,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
48
52
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49
53
|
function step(op) {
|
|
50
54
|
if (f) throw new TypeError("Generator is already executing.");
|
|
51
|
-
while (_) try {
|
|
55
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
52
56
|
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;
|
|
53
57
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
54
58
|
switch (op[0]) {
|
|
@@ -314,7 +318,7 @@ var XBrowse = /** @class */ (function (_super) {
|
|
|
314
318
|
this.props.openForm(formElementCloned);
|
|
315
319
|
}
|
|
316
320
|
else {
|
|
317
|
-
console.log("XBrowse entity = "
|
|
321
|
+
console.log("XBrowse entity = ".concat(this.props.entity, ": form not found/registered."));
|
|
318
322
|
}
|
|
319
323
|
};
|
|
320
324
|
XBrowse.prototype.render = function () {
|
|
@@ -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];
|
|
@@ -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]) {
|
|
@@ -79,9 +83,9 @@ var button_1 = require("primereact/button");
|
|
|
79
83
|
var inputtext_1 = require("primereact/inputtext");
|
|
80
84
|
var XChangePasswordForm = function (props) {
|
|
81
85
|
var _a;
|
|
82
|
-
var _b = __read(react_1.useState(""), 2), passwordCurrent = _b[0], setPasswordCurrent = _b[1];
|
|
83
|
-
var _c = __read(react_1.useState(""), 2), passwordNew = _c[0], setPasswordNew = _c[1];
|
|
84
|
-
var _d = __read(react_1.useState(""), 2), passwordNewConfirm = _d[0], setPasswordNewConfirm = _d[1];
|
|
86
|
+
var _b = __read((0, react_1.useState)(""), 2), passwordCurrent = _b[0], setPasswordCurrent = _b[1];
|
|
87
|
+
var _c = __read((0, react_1.useState)(""), 2), passwordNew = _c[0], setPasswordNew = _c[1];
|
|
88
|
+
var _d = __read((0, react_1.useState)(""), 2), passwordNewConfirm = _d[0], setPasswordNewConfirm = _d[1];
|
|
85
89
|
var onClickSave = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
86
90
|
var xToken, e_1;
|
|
87
91
|
return __generator(this, function (_a) {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
export declare
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}) => JSX.Element;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { XInput, XInputProps } from "./XInput";
|
|
3
|
+
export declare class XCheckbox extends XInput<XInputProps> {
|
|
4
|
+
constructor(props: XInputProps);
|
|
5
|
+
getValue(): boolean | null;
|
|
6
|
+
onValueChange(e: any): void;
|
|
7
|
+
render(): JSX.Element;
|
|
8
|
+
}
|
|
@@ -1,49 +1,57 @@
|
|
|
1
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
|
+
})();
|
|
2
17
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
18
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
19
|
};
|
|
5
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
21
|
exports.XCheckbox = void 0;
|
|
7
22
|
var react_1 = __importDefault(require("react"));
|
|
8
|
-
var XUtilsMetadata_1 = require("./XUtilsMetadata");
|
|
9
23
|
var tristatecheckbox_1 = require("primereact/tristatecheckbox");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var readOnly = XUtils_1.XUtils.isReadOnly(props.field, props.readOnly);
|
|
18
|
-
if (!xField.isNullable && !readOnly) {
|
|
19
|
-
label = XUtils_1.XUtils.markNotNull(label);
|
|
24
|
+
var XInput_1 = require("./XInput");
|
|
25
|
+
var XCheckbox = /** @class */ (function (_super) {
|
|
26
|
+
__extends(XCheckbox, _super);
|
|
27
|
+
function XCheckbox(props) {
|
|
28
|
+
var _this = _super.call(this, props) || this;
|
|
29
|
+
_this.onValueChange = _this.onValueChange.bind(_this);
|
|
30
|
+
return _this;
|
|
20
31
|
}
|
|
21
|
-
|
|
32
|
+
XCheckbox.prototype.getValue = function () {
|
|
33
|
+
// konvertovat null hodnotu na "" (vo funkcii stringAsUI) je dolezite aby sa prejavila zmena na null v modeli
|
|
34
|
+
var value = this.getValueFromObject();
|
|
35
|
+
return value;
|
|
36
|
+
};
|
|
37
|
+
XCheckbox.prototype.onValueChange = function (e) {
|
|
22
38
|
var newValue = e.value;
|
|
23
39
|
// pri klikani na TriStateCheckbox prichadza v newValue cyklicky: true -> false -> null
|
|
24
40
|
// ak mame not null atribut, tak pri null hodnote skocime rovno na true
|
|
25
|
-
if (
|
|
41
|
+
if (this.isNotNull()) {
|
|
26
42
|
if (newValue === null) {
|
|
27
43
|
newValue = true;
|
|
28
44
|
}
|
|
29
45
|
}
|
|
30
46
|
// zmenime hodnotu v modeli (odtial sa hodnota cita)
|
|
31
|
-
|
|
47
|
+
this.onValueChangeBase(newValue);
|
|
32
48
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// konvertovat null hodnotu na "" (vo funkcii stringAsUI) je dolezite aby sa prejavila zmena na null v modeli
|
|
42
|
-
fieldValue = objectValue;
|
|
43
|
-
}
|
|
44
|
-
// note: style overrides size (width of the input according to character count)
|
|
45
|
-
return (react_1.default.createElement("div", { className: "field grid" },
|
|
46
|
-
react_1.default.createElement("label", { htmlFor: props.field, className: "col-fixed", style: { width: XUtils_1.XUtils.FIELD_LABEL_WIDTH } }, label),
|
|
47
|
-
react_1.default.createElement(tristatecheckbox_1.TriStateCheckbox, { id: props.field, value: fieldValue, onChange: onValueChange, disabled: readOnly, style: props.inputStyle })));
|
|
48
|
-
};
|
|
49
|
+
XCheckbox.prototype.render = function () {
|
|
50
|
+
// note: style overrides size (width of the input according to character count)
|
|
51
|
+
return (react_1.default.createElement("div", { className: "field grid" },
|
|
52
|
+
react_1.default.createElement("label", { htmlFor: this.props.field, className: "col-fixed", style: this.getLabelStyle() }, this.getLabel()),
|
|
53
|
+
react_1.default.createElement(tristatecheckbox_1.TriStateCheckbox, { id: this.props.field, value: this.getValue(), onChange: this.onValueChange, disabled: this.isReadOnly(), style: this.props.inputStyle })));
|
|
54
|
+
};
|
|
55
|
+
return XCheckbox;
|
|
56
|
+
}(XInput_1.XInput));
|
|
49
57
|
exports.XCheckbox = XCheckbox;
|