@michalrakus/x-react-web-lib 1.8.0 → 1.9.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/gulpfile.js +82 -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 +8 -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 +13 -13
- package/lib/components/XDropdownDT.js +128 -128
- package/lib/components/XDropdownDTFilter.d.ts +7 -7
- package/lib/components/XDropdownDTFilter.js +121 -121
- package/lib/components/XDropdownForEntity.d.ts +25 -25
- package/lib/components/XDropdownForEntity.js +149 -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 +59 -59
- package/lib/components/XFormBase.js +526 -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 +143 -143
- package/lib/components/XFormDataTable2.js +686 -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/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 +885 -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 +74 -74
- package/lib/components/XUtils.js +627 -627
- package/lib/components/XUtilsConversions.d.ts +12 -12
- package/lib/components/XUtilsConversions.js +125 -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 +34 -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 +13 -13
- package/lib/serverApi/XUtilsCommon.js +110 -110
- package/package.json +1 -1
|
@@ -1,194 +1,195 @@
|
|
|
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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
-
};
|
|
26
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
27
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
29
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
30
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
31
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
32
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
36
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
37
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
38
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
39
|
-
function step(op) {
|
|
40
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
41
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
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
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
44
|
-
switch (op[0]) {
|
|
45
|
-
case 0: case 1: t = op; break;
|
|
46
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
47
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
48
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
49
|
-
default:
|
|
50
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
51
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
52
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
53
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
54
|
-
if (t[2]) _.ops.pop();
|
|
55
|
-
_.trys.pop(); continue;
|
|
56
|
-
}
|
|
57
|
-
op = body.call(thisArg, _);
|
|
58
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
59
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
63
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
64
|
-
};
|
|
65
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66
|
-
exports.XUserForm = void 0;
|
|
67
|
-
var XFormBase_1 = require("../components/XFormBase");
|
|
68
|
-
var XInputText_1 = require("../components/XInputText");
|
|
69
|
-
var react_1 = __importDefault(require("react"));
|
|
70
|
-
var XInputDecimal_1 = require("../components/XInputDecimal");
|
|
71
|
-
var password_1 = require("primereact/password");
|
|
72
|
-
var XUtils_1 = require("../components/XUtils");
|
|
73
|
-
var XFormFooter_1 = require("../components/XFormFooter");
|
|
74
|
-
var XCheckbox_1 = require("../components/XCheckbox");
|
|
75
|
-
var XEnvVars_1 = require("../components/XEnvVars");
|
|
76
|
-
var XFormBaseModif_1 = require("../components/XFormBaseModif");
|
|
77
|
-
var XInputDate_1 = require("../components/XInputDate");
|
|
78
|
-
var XUserForm = /** @class */ (function (_super) {
|
|
79
|
-
__extends(XUserForm, _super);
|
|
80
|
-
function XUserForm(props) {
|
|
81
|
-
var _this = _super.call(this, props) || this;
|
|
82
|
-
_this.state.usernameEnabledReadOnly = false;
|
|
83
|
-
_this.state.passwordNew = '';
|
|
84
|
-
_this.state.passwordNewConfirm = '';
|
|
85
|
-
_this.onClickSave = _this.onClickSave.bind(_this);
|
|
86
|
-
return _this;
|
|
87
|
-
}
|
|
88
|
-
XUserForm.prototype.componentDidMount = function () {
|
|
89
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
90
|
-
var username;
|
|
91
|
-
return __generator(this, function (_a) {
|
|
92
|
-
switch (_a.label) {
|
|
93
|
-
case 0: return [4 /*yield*/, _super.prototype.componentDidMount.call(this)];
|
|
94
|
-
case 1:
|
|
95
|
-
_a.sent();
|
|
96
|
-
username = this.getXObject().username;
|
|
97
|
-
if (username === XUtils_1.XUtils.getUsername() || (XUtils_1.XUtils.demo() && (username === 'jozko' || username === 'xman'))) {
|
|
98
|
-
this.setState({ usernameEnabledReadOnly: true });
|
|
99
|
-
}
|
|
100
|
-
return [2 /*return*/];
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
XUserForm.prototype.onClickSave = function () {
|
|
106
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
107
|
-
var e_1;
|
|
108
|
-
return __generator(this, function (_a) {
|
|
109
|
-
switch (_a.label) {
|
|
110
|
-
case 0:
|
|
111
|
-
if (!this.validateSave()) {
|
|
112
|
-
return [2 /*return*/];
|
|
113
|
-
}
|
|
114
|
-
// v deme nedovolime zmenit uzivatelov ktori sa pouzivaju na skusanie dema
|
|
115
|
-
if (XUtils_1.XUtils.demo() && (this.state.object.username === 'jozko' || this.state.object.username === 'xman')) {
|
|
116
|
-
alert("Users jozko, xman can not be changed.");
|
|
117
|
-
return [2 /*return*/];
|
|
118
|
-
}
|
|
119
|
-
// password is used only by local authorization
|
|
120
|
-
if (XUtils_1.XUtils.getEnvVarValue(XEnvVars_1.XEnvVar.REACT_APP_AUTH) === XEnvVars_1.XReactAppAuth.LOCAL) {
|
|
121
|
-
if (this.isAddRow() && this.state.passwordNew === '') {
|
|
122
|
-
alert("Password is required.");
|
|
123
|
-
return [2 /*return*/];
|
|
124
|
-
}
|
|
125
|
-
if (this.state.passwordNew !== '' || this.state.passwordNewConfirm !== '') {
|
|
126
|
-
// nedovolime tuto zmenit heslo aktualne prihlasenemu uzivatelovi, lebo by sme museli upravit aj token
|
|
127
|
-
if (this.state.object.username === XUtils_1.XUtils.getUsername()) {
|
|
128
|
-
alert("Please, change your password via option Administration -> Change password.");
|
|
129
|
-
return [2 /*return*/];
|
|
130
|
-
}
|
|
131
|
-
if (this.state.passwordNew !== this.state.passwordNewConfirm) {
|
|
132
|
-
alert("New password and confirmed new password are not equal.");
|
|
133
|
-
return [2 /*return*/];
|
|
134
|
-
}
|
|
135
|
-
// zapiseme nove heslo do objektu
|
|
136
|
-
this.state.object.password = this.state.passwordNew;
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
// nemenime heslo (atribut s hodnotou undefined sa nezapise do DB)
|
|
140
|
-
this.state.object.password = undefined;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
this.preSave(this.state.object);
|
|
144
|
-
_a.label = 1;
|
|
145
|
-
case 1:
|
|
146
|
-
_a.trys.push([1, 3, , 4]);
|
|
147
|
-
return [4 /*yield*/, XUtils_1.XUtils.post('userSaveRow', { entity: this.getEntity(), object: this.state.object })];
|
|
148
|
-
case 2:
|
|
149
|
-
_a.sent();
|
|
150
|
-
return [3 /*break*/, 4];
|
|
151
|
-
case 3:
|
|
152
|
-
e_1 = _a.sent();
|
|
153
|
-
XUtils_1.XUtils.showErrorMessage("Save row failed.", e_1);
|
|
154
|
-
return [2 /*return*/]; // zostavame vo formulari
|
|
155
|
-
case 4:
|
|
156
|
-
this.props.openForm(null); // save zbehol, ideme naspet do browsu
|
|
157
|
-
return [2 /*return*/];
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
};
|
|
162
|
-
XUserForm.prototype.render = function () {
|
|
163
|
-
var _this = this;
|
|
164
|
-
// autoComplete="new-password" - bez tohto chrome predplna user/password, ak si user da ulozit user/password (pre danu url)
|
|
165
|
-
var passwordElems = [];
|
|
166
|
-
if (XUtils_1.XUtils.getEnvVarValue(XEnvVars_1.XEnvVar.REACT_APP_AUTH) === XEnvVars_1.XReactAppAuth.LOCAL) {
|
|
167
|
-
passwordElems = [
|
|
168
|
-
react_1.default.createElement("div", { className: "field grid" },
|
|
169
|
-
react_1.default.createElement("label", { className: "col-fixed", style: { width: '14rem' } }, "New password"),
|
|
170
|
-
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" })),
|
|
171
|
-
react_1.default.createElement("div", { className: "field grid" },
|
|
172
|
-
react_1.default.createElement("label", { className: "col-fixed", style: { width: '14rem', whiteSpace: 'nowrap' } }, "Confirm new password"),
|
|
173
|
-
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" }))
|
|
174
|
-
];
|
|
175
|
-
}
|
|
176
|
-
return (react_1.default.createElement("div", null,
|
|
177
|
-
react_1.default.createElement("div", { className: "x-form-row" },
|
|
178
|
-
react_1.default.createElement("div", { className: "x-form-col" },
|
|
179
|
-
react_1.default.createElement(XInputDecimal_1.XInputDecimal, { form: this, field: "
|
|
180
|
-
react_1.default.createElement(XInputText_1.XInputText, { form: this, field: "username", label: "Username", size: 30, labelStyle: { width: '14rem' }, readOnly: this.state.usernameEnabledReadOnly }),
|
|
181
|
-
react_1.default.createElement(XInputText_1.XInputText, { form: this, field: "name", label: "Name", size: 30, labelStyle: { width: '14rem' } }),
|
|
182
|
-
react_1.default.createElement(XCheckbox_1.XCheckbox, { form: this, field: "enabled", label: "Enabled", labelStyle: { width: '14rem' }, readOnly: this.state.usernameEnabledReadOnly }),
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
react_1.default.createElement(
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
27
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
29
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
30
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
31
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
32
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
36
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
37
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
38
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
39
|
+
function step(op) {
|
|
40
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
41
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
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
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
44
|
+
switch (op[0]) {
|
|
45
|
+
case 0: case 1: t = op; break;
|
|
46
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
47
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
48
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
49
|
+
default:
|
|
50
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
51
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
52
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
53
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
54
|
+
if (t[2]) _.ops.pop();
|
|
55
|
+
_.trys.pop(); continue;
|
|
56
|
+
}
|
|
57
|
+
op = body.call(thisArg, _);
|
|
58
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
59
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
63
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
64
|
+
};
|
|
65
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66
|
+
exports.XUserForm = void 0;
|
|
67
|
+
var XFormBase_1 = require("../components/XFormBase");
|
|
68
|
+
var XInputText_1 = require("../components/XInputText");
|
|
69
|
+
var react_1 = __importDefault(require("react"));
|
|
70
|
+
var XInputDecimal_1 = require("../components/XInputDecimal");
|
|
71
|
+
var password_1 = require("primereact/password");
|
|
72
|
+
var XUtils_1 = require("../components/XUtils");
|
|
73
|
+
var XFormFooter_1 = require("../components/XFormFooter");
|
|
74
|
+
var XCheckbox_1 = require("../components/XCheckbox");
|
|
75
|
+
var XEnvVars_1 = require("../components/XEnvVars");
|
|
76
|
+
var XFormBaseModif_1 = require("../components/XFormBaseModif");
|
|
77
|
+
var XInputDate_1 = require("../components/XInputDate");
|
|
78
|
+
var XUserForm = /** @class */ (function (_super) {
|
|
79
|
+
__extends(XUserForm, _super);
|
|
80
|
+
function XUserForm(props) {
|
|
81
|
+
var _this = _super.call(this, props) || this;
|
|
82
|
+
_this.state.usernameEnabledReadOnly = false;
|
|
83
|
+
_this.state.passwordNew = '';
|
|
84
|
+
_this.state.passwordNewConfirm = '';
|
|
85
|
+
_this.onClickSave = _this.onClickSave.bind(_this);
|
|
86
|
+
return _this;
|
|
87
|
+
}
|
|
88
|
+
XUserForm.prototype.componentDidMount = function () {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
90
|
+
var username;
|
|
91
|
+
return __generator(this, function (_a) {
|
|
92
|
+
switch (_a.label) {
|
|
93
|
+
case 0: return [4 /*yield*/, _super.prototype.componentDidMount.call(this)];
|
|
94
|
+
case 1:
|
|
95
|
+
_a.sent();
|
|
96
|
+
username = this.getXObject().username;
|
|
97
|
+
if (username === XUtils_1.XUtils.getUsername() || (XUtils_1.XUtils.demo() && (username === 'jozko' || username === 'xman'))) {
|
|
98
|
+
this.setState({ usernameEnabledReadOnly: true });
|
|
99
|
+
}
|
|
100
|
+
return [2 /*return*/];
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
XUserForm.prototype.onClickSave = function () {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
107
|
+
var e_1;
|
|
108
|
+
return __generator(this, function (_a) {
|
|
109
|
+
switch (_a.label) {
|
|
110
|
+
case 0:
|
|
111
|
+
if (!this.validateSave()) {
|
|
112
|
+
return [2 /*return*/];
|
|
113
|
+
}
|
|
114
|
+
// v deme nedovolime zmenit uzivatelov ktori sa pouzivaju na skusanie dema
|
|
115
|
+
if (XUtils_1.XUtils.demo() && (this.state.object.username === 'jozko' || this.state.object.username === 'xman')) {
|
|
116
|
+
alert("Users jozko, xman can not be changed.");
|
|
117
|
+
return [2 /*return*/];
|
|
118
|
+
}
|
|
119
|
+
// password is used only by local authorization
|
|
120
|
+
if (XUtils_1.XUtils.getEnvVarValue(XEnvVars_1.XEnvVar.REACT_APP_AUTH) === XEnvVars_1.XReactAppAuth.LOCAL) {
|
|
121
|
+
if (this.isAddRow() && this.state.passwordNew === '') {
|
|
122
|
+
alert("Password is required.");
|
|
123
|
+
return [2 /*return*/];
|
|
124
|
+
}
|
|
125
|
+
if (this.state.passwordNew !== '' || this.state.passwordNewConfirm !== '') {
|
|
126
|
+
// nedovolime tuto zmenit heslo aktualne prihlasenemu uzivatelovi, lebo by sme museli upravit aj token
|
|
127
|
+
if (this.state.object.username === XUtils_1.XUtils.getUsername()) {
|
|
128
|
+
alert("Please, change your password via option Administration -> Change password.");
|
|
129
|
+
return [2 /*return*/];
|
|
130
|
+
}
|
|
131
|
+
if (this.state.passwordNew !== this.state.passwordNewConfirm) {
|
|
132
|
+
alert("New password and confirmed new password are not equal.");
|
|
133
|
+
return [2 /*return*/];
|
|
134
|
+
}
|
|
135
|
+
// zapiseme nove heslo do objektu
|
|
136
|
+
this.state.object.password = this.state.passwordNew;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
// nemenime heslo (atribut s hodnotou undefined sa nezapise do DB)
|
|
140
|
+
this.state.object.password = undefined;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
this.preSave(this.state.object);
|
|
144
|
+
_a.label = 1;
|
|
145
|
+
case 1:
|
|
146
|
+
_a.trys.push([1, 3, , 4]);
|
|
147
|
+
return [4 /*yield*/, XUtils_1.XUtils.post('userSaveRow', { entity: this.getEntity(), object: this.state.object })];
|
|
148
|
+
case 2:
|
|
149
|
+
_a.sent();
|
|
150
|
+
return [3 /*break*/, 4];
|
|
151
|
+
case 3:
|
|
152
|
+
e_1 = _a.sent();
|
|
153
|
+
XUtils_1.XUtils.showErrorMessage("Save row failed.", e_1);
|
|
154
|
+
return [2 /*return*/]; // zostavame vo formulari
|
|
155
|
+
case 4:
|
|
156
|
+
this.props.openForm(null); // save zbehol, ideme naspet do browsu
|
|
157
|
+
return [2 /*return*/];
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
XUserForm.prototype.render = function () {
|
|
163
|
+
var _this = this;
|
|
164
|
+
// autoComplete="new-password" - bez tohto chrome predplna user/password, ak si user da ulozit user/password (pre danu url)
|
|
165
|
+
var passwordElems = [];
|
|
166
|
+
if (XUtils_1.XUtils.getEnvVarValue(XEnvVars_1.XEnvVar.REACT_APP_AUTH) === XEnvVars_1.XReactAppAuth.LOCAL) {
|
|
167
|
+
passwordElems = [
|
|
168
|
+
react_1.default.createElement("div", { className: "field grid" },
|
|
169
|
+
react_1.default.createElement("label", { className: "col-fixed", style: { width: '14rem' } }, "New password"),
|
|
170
|
+
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" })),
|
|
171
|
+
react_1.default.createElement("div", { className: "field grid" },
|
|
172
|
+
react_1.default.createElement("label", { className: "col-fixed", style: { width: '14rem', whiteSpace: 'nowrap' } }, "Confirm new password"),
|
|
173
|
+
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" }))
|
|
174
|
+
];
|
|
175
|
+
}
|
|
176
|
+
return (react_1.default.createElement("div", null,
|
|
177
|
+
react_1.default.createElement("div", { className: "x-form-row" },
|
|
178
|
+
react_1.default.createElement("div", { className: "x-form-col" },
|
|
179
|
+
react_1.default.createElement(XInputDecimal_1.XInputDecimal, { form: this, field: "id", label: "ID", readOnly: true, labelStyle: { width: '14rem' } }),
|
|
180
|
+
react_1.default.createElement(XInputText_1.XInputText, { form: this, field: "username", label: "Username", size: 30, labelStyle: { width: '14rem' }, readOnly: this.state.usernameEnabledReadOnly }),
|
|
181
|
+
react_1.default.createElement(XInputText_1.XInputText, { form: this, field: "name", label: "Name", size: 30, labelStyle: { width: '14rem' } }),
|
|
182
|
+
react_1.default.createElement(XCheckbox_1.XCheckbox, { form: this, field: "enabled", label: "Enabled", labelStyle: { width: '14rem' }, readOnly: this.state.usernameEnabledReadOnly }),
|
|
183
|
+
react_1.default.createElement(XCheckbox_1.XCheckbox, { form: this, field: "admin", label: "Admin", labelStyle: { width: '14rem' }, readOnly: this.state.usernameEnabledReadOnly }),
|
|
184
|
+
passwordElems,
|
|
185
|
+
react_1.default.createElement(XInputDate_1.XInputDate, { form: this, field: "modifDate", label: "Modified at", readOnly: true, labelStyle: { width: '14rem' } }),
|
|
186
|
+
react_1.default.createElement(XInputText_1.XInputText, { form: this, field: "modifXUser.name", label: "Modified by", size: 20, labelStyle: { width: '14rem' } }))),
|
|
187
|
+
react_1.default.createElement(XFormFooter_1.XFormFooter, { form: this })));
|
|
188
|
+
};
|
|
189
|
+
XUserForm = __decorate([
|
|
190
|
+
(0, XFormBase_1.Form)("XUser"),
|
|
191
|
+
__metadata("design:paramtypes", [Object])
|
|
192
|
+
], XUserForm);
|
|
193
|
+
return XUserForm;
|
|
194
|
+
}(XFormBaseModif_1.XFormBaseModif));
|
|
195
|
+
exports.XUserForm = XUserForm;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { DataTableFilterMetaData } from "primereact/datatable";
|
|
2
|
-
import { XCustomFilter } from "../serverApi/FindParam";
|
|
3
|
-
export interface XFieldFilter {
|
|
4
|
-
field: string;
|
|
5
|
-
constraint: DataTableFilterMetaData;
|
|
6
|
-
}
|
|
7
|
-
export interface SearchTableParams {
|
|
8
|
-
onChoose: (chosenRow: any) => void;
|
|
9
|
-
displayFieldFilter?: XFieldFilter;
|
|
10
|
-
customFilter?: XCustomFilter;
|
|
11
|
-
}
|
|
1
|
+
import { DataTableFilterMetaData } from "primereact/datatable";
|
|
2
|
+
import { XCustomFilter } from "../serverApi/FindParam";
|
|
3
|
+
export interface XFieldFilter {
|
|
4
|
+
field: string;
|
|
5
|
+
constraint: DataTableFilterMetaData;
|
|
6
|
+
}
|
|
7
|
+
export interface SearchTableParams {
|
|
8
|
+
onChoose: (chosenRow: any) => void;
|
|
9
|
+
displayFieldFilter?: XFieldFilter;
|
|
10
|
+
customFilter?: XCustomFilter;
|
|
11
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare const SourceCodeLinkEntity: (props: {
|
|
3
|
-
sourceCodeFile: string;
|
|
4
|
-
}) => JSX.Element;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const SourceCodeLinkEntity: (props: {
|
|
3
|
+
sourceCodeFile: string;
|
|
4
|
+
}) => JSX.Element;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SourceCodeLinkEntity = void 0;
|
|
7
|
-
var react_1 = __importDefault(require("react"));
|
|
8
|
-
var SourceCodeLinkEntity = function (props) {
|
|
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/".concat(props.sourceCodeFile), target: "_blank", rel: "noopener noreferrer" },
|
|
11
|
-
"Source code entity: ",
|
|
12
|
-
props.sourceCodeFile)));
|
|
13
|
-
};
|
|
14
|
-
exports.SourceCodeLinkEntity = SourceCodeLinkEntity;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SourceCodeLinkEntity = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var SourceCodeLinkEntity = function (props) {
|
|
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/".concat(props.sourceCodeFile), target: "_blank", rel: "noopener noreferrer" },
|
|
11
|
+
"Source code entity: ",
|
|
12
|
+
props.sourceCodeFile)));
|
|
13
|
+
};
|
|
14
|
+
exports.SourceCodeLinkEntity = SourceCodeLinkEntity;
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { XFilterProp, XFormComponent, XFormComponentProps } from "./XFormComponent";
|
|
3
|
-
import { XAssoc } from "../serverApi/XEntityMetadata";
|
|
4
|
-
import { OperationType } from "./XUtils";
|
|
5
|
-
import { XError } from "./XErrors";
|
|
6
|
-
import { XObject } from "./XObject";
|
|
7
|
-
export interface XAutoCompleteProps extends XFormComponentProps<XObject> {
|
|
8
|
-
assocField: string;
|
|
9
|
-
displayField: string | ((suggestion: any) => string);
|
|
10
|
-
searchTable?: any;
|
|
11
|
-
assocForm?: any;
|
|
12
|
-
filter?: XFilterProp;
|
|
13
|
-
size?: number;
|
|
14
|
-
inputStyle?: React.CSSProperties;
|
|
15
|
-
}
|
|
16
|
-
export declare class XAutoComplete extends XFormComponent<XObject, XAutoCompleteProps> {
|
|
17
|
-
protected xAssoc: XAssoc;
|
|
18
|
-
protected errorInBase: string | undefined;
|
|
19
|
-
state: {
|
|
20
|
-
suggestions: any[];
|
|
21
|
-
};
|
|
22
|
-
constructor(props: XAutoCompleteProps);
|
|
23
|
-
getDisplayFieldOrId(): string;
|
|
24
|
-
componentDidMount(): void;
|
|
25
|
-
readAndSetSuggestions(): Promise<void>;
|
|
26
|
-
getField(): string;
|
|
27
|
-
isNotNull(): boolean;
|
|
28
|
-
getValue(): any | null;
|
|
29
|
-
onChangeAutoCompleteBase(object: any, objectChange: OperationType): void;
|
|
30
|
-
onErrorChangeAutoCompleteBase(error: string | undefined): void;
|
|
31
|
-
validate(): {
|
|
32
|
-
field: string;
|
|
33
|
-
xError: XError;
|
|
34
|
-
} | undefined;
|
|
35
|
-
render(): JSX.Element;
|
|
36
|
-
}
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { XFilterProp, XFormComponent, XFormComponentProps } from "./XFormComponent";
|
|
3
|
+
import { XAssoc } from "../serverApi/XEntityMetadata";
|
|
4
|
+
import { OperationType } from "./XUtils";
|
|
5
|
+
import { XError } from "./XErrors";
|
|
6
|
+
import { XObject } from "./XObject";
|
|
7
|
+
export interface XAutoCompleteProps extends XFormComponentProps<XObject> {
|
|
8
|
+
assocField: string;
|
|
9
|
+
displayField: string | ((suggestion: any) => string);
|
|
10
|
+
searchTable?: any;
|
|
11
|
+
assocForm?: any;
|
|
12
|
+
filter?: XFilterProp;
|
|
13
|
+
size?: number;
|
|
14
|
+
inputStyle?: React.CSSProperties;
|
|
15
|
+
}
|
|
16
|
+
export declare class XAutoComplete extends XFormComponent<XObject, XAutoCompleteProps> {
|
|
17
|
+
protected xAssoc: XAssoc;
|
|
18
|
+
protected errorInBase: string | undefined;
|
|
19
|
+
state: {
|
|
20
|
+
suggestions: any[];
|
|
21
|
+
};
|
|
22
|
+
constructor(props: XAutoCompleteProps);
|
|
23
|
+
getDisplayFieldOrId(): string;
|
|
24
|
+
componentDidMount(): void;
|
|
25
|
+
readAndSetSuggestions(): Promise<void>;
|
|
26
|
+
getField(): string;
|
|
27
|
+
isNotNull(): boolean;
|
|
28
|
+
getValue(): any | null;
|
|
29
|
+
onChangeAutoCompleteBase(object: any, objectChange: OperationType): void;
|
|
30
|
+
onErrorChangeAutoCompleteBase(error: string | undefined): void;
|
|
31
|
+
validate(): {
|
|
32
|
+
field: string;
|
|
33
|
+
xError: XError;
|
|
34
|
+
} | undefined;
|
|
35
|
+
render(): JSX.Element;
|
|
36
|
+
}
|