@michalrakus/x-react-web-lib 1.0.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.
Files changed (72) hide show
  1. package/LICENSE.md +21 -0
  2. package/XInputTextarea.d.ts +3 -0
  3. package/XInputTextarea.js +5 -0
  4. package/gulpfile.js +1 -0
  5. package/lib/administration/XBrowseMetaBrowse.js +2 -1
  6. package/lib/administration/XBrowseMetaForm.js +4 -2
  7. package/lib/administration/XUserBrowse.js +3 -2
  8. package/lib/administration/XUserForm.js +5 -3
  9. package/lib/components/SourceCodeLinkEntity.js +3 -2
  10. package/lib/components/XAutoComplete.d.ts +3 -3
  11. package/lib/components/XAutoComplete.js +19 -38
  12. package/lib/components/XAutoCompleteBase.d.ts +1 -1
  13. package/lib/components/XAutoCompleteBase.js +27 -23
  14. package/lib/components/XBrowse.js +11 -5
  15. package/lib/components/XButton.js +2 -1
  16. package/lib/components/XButtonIconSmall.js +2 -1
  17. package/lib/components/XChangePasswordForm.js +12 -7
  18. package/lib/components/XCheckbox.d.ts +8 -10
  19. package/lib/components/XCheckbox.js +39 -31
  20. package/lib/components/XCheckboxDT.js +2 -1
  21. package/lib/components/XDataTable.js +16 -10
  22. package/lib/components/XDropdown.d.ts +4 -3
  23. package/lib/components/XDropdown.js +24 -45
  24. package/lib/components/XDropdownDT.js +10 -5
  25. package/lib/components/XDropdownDTFilter.js +12 -7
  26. package/lib/components/XDropdownFormDTFilter.js +12 -7
  27. package/lib/components/XEditColumnDialog.js +12 -7
  28. package/lib/components/XErrors.d.ts +1 -0
  29. package/lib/components/XExportRowsDialog.js +13 -8
  30. package/lib/components/XFieldSelector.js +11 -6
  31. package/lib/components/XFormBase.d.ts +1 -0
  32. package/lib/components/XFormBase.js +50 -22
  33. package/lib/components/XFormBaseT.js +3 -1
  34. package/lib/components/XFormComponent.d.ts +10 -6
  35. package/lib/components/XFormComponent.js +63 -49
  36. package/lib/components/XFormDataTable2.d.ts +8 -3
  37. package/lib/components/XFormDataTable2.js +115 -32
  38. package/lib/components/XFormFooter.js +2 -1
  39. package/lib/components/XFormNavigator3.js +18 -7
  40. package/lib/components/XHolders.js +4 -2
  41. package/lib/components/XInput.d.ts +13 -0
  42. package/lib/components/XInput.js +38 -0
  43. package/lib/components/XInputDate.js +3 -2
  44. package/lib/components/XInputDateDT.js +3 -2
  45. package/lib/components/XInputDecimal.js +2 -1
  46. package/lib/components/XInputDecimalDT.js +2 -1
  47. package/lib/components/XInputText.d.ts +6 -11
  48. package/lib/components/XInputText.js +17 -50
  49. package/lib/components/XInputTextDT.js +4 -4
  50. package/lib/components/XInputTextarea.d.ts +18 -0
  51. package/lib/components/XInputTextarea.js +85 -0
  52. package/lib/components/XLazyDataTable.d.ts +3 -0
  53. package/lib/components/XLazyDataTable.js +166 -79
  54. package/lib/components/XLoginDialog.js +2 -1
  55. package/lib/components/XLoginForm.js +11 -6
  56. package/lib/components/XResponseError.js +4 -2
  57. package/lib/components/XSearchButton.d.ts +2 -3
  58. package/lib/components/XSearchButton.js +15 -36
  59. package/lib/components/XSearchButtonDT.js +13 -8
  60. package/lib/components/XSearchButtonOld.js +13 -8
  61. package/lib/components/XToOneAssocButton.js +2 -1
  62. package/lib/components/XUtils.d.ts +3 -1
  63. package/lib/components/XUtils.js +32 -5
  64. package/lib/components/XUtilsConversions.js +10 -2
  65. package/lib/components/XUtilsMetadata.d.ts +1 -1
  66. package/lib/components/XUtilsMetadata.js +20 -11
  67. package/lib/components/useXToken.js +1 -1
  68. package/lib/serverApi/ExportImportParam.d.ts +3 -3
  69. package/lib/serverApi/FindParam.d.ts +3 -13
  70. package/lib/serverApi/FindParam.js +14 -0
  71. package/lib/serverApi/XUtilsCommon.js +2 -2
  72. package/package.json +24 -25
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.
@@ -0,0 +1,3 @@
1
+ // generated by gulp
2
+
3
+ export * from './lib/components/XInputTextarea';
@@ -0,0 +1,5 @@
1
+ // generated by gulp
2
+
3
+ 'use strict';
4
+
5
+ module.exports = require('./lib/components/XInputTextarea.js');
package/gulpfile.js CHANGED
@@ -32,6 +32,7 @@ function generateApi(cb) {
32
32
  "./lib/components/XInputDate",
33
33
  "./lib/components/XInputDecimal",
34
34
  "./lib/components/XInputText",
35
+ "./lib/components/XInputTextarea",
35
36
  "./lib/components/XLazyDataTable",
36
37
  "./lib/components/XLoginDialog",
37
38
  "./lib/components/XLoginForm",
@@ -7,7 +7,7 @@ exports.XBrowseMetaBrowse = void 0;
7
7
  var XLazyDataTable_1 = require("../components/XLazyDataTable");
8
8
  var react_1 = __importDefault(require("react"));
9
9
  var XBrowseMetaForm_1 = require("./XBrowseMetaForm");
10
- exports.XBrowseMetaBrowse = function (props) {
10
+ var XBrowseMetaBrowse = function (props) {
11
11
  var onEdit = function (selectedRow) {
12
12
  // openForm pridavame automaticky v XFormNavigator3 pri renderovani komponentu
13
13
  props.openForm(react_1.default.createElement(XBrowseMetaForm_1.XBrowseMetaForm, { id: selectedRow.idXBrowseMeta }));
@@ -18,3 +18,4 @@ exports.XBrowseMetaBrowse = function (props) {
18
18
  react_1.default.createElement(XLazyDataTable_1.XLazyColumn, { field: "browseId", header: "Browse ID", width: "17rem" }),
19
19
  react_1.default.createElement(XLazyDataTable_1.XLazyColumn, { field: "rows", header: "Rows" })));
20
20
  };
21
+ exports.XBrowseMetaBrowse = XBrowseMetaBrowse;
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -54,7 +56,7 @@ var XBrowseMetaForm = /** @class */ (function (_super) {
54
56
  react_1.default.createElement(XFormFooter_1.XFormFooter, { form: this })));
55
57
  };
56
58
  XBrowseMetaForm = __decorate([
57
- XFormBase_1.Form("XBrowseMeta")
59
+ (0, XFormBase_1.Form)("XBrowseMeta")
58
60
  ], XBrowseMetaForm);
59
61
  return XBrowseMetaForm;
60
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]) {
@@ -44,7 +44,7 @@ var XLazyDataTable_1 = require("../components/XLazyDataTable");
44
44
  var react_1 = __importDefault(require("react"));
45
45
  var XUserForm_1 = require("./XUserForm");
46
46
  var XUtils_1 = require("../components/XUtils");
47
- exports.XUserBrowse = function (props) {
47
+ var XUserBrowse = function (props) {
48
48
  var onAddRow = function () {
49
49
  // openForm pridavame automaticky v XFormNavigator3 pri renderovani komponentu
50
50
  props.openForm(react_1.default.createElement(XUserForm_1.XUserForm, { object: { enabled: true } }));
@@ -81,6 +81,7 @@ exports.XUserBrowse = function (props) {
81
81
  react_1.default.createElement(XLazyDataTable_1.XLazyColumn, { field: "name", header: "Name", width: "17rem" }),
82
82
  react_1.default.createElement(XLazyDataTable_1.XLazyColumn, { field: "enabled", header: "Enabled" })));
83
83
  };
84
+ exports.XUserBrowse = XUserBrowse;
84
85
  // zatial nepouzivane - prichystane do buducnosti
85
86
  // ak by sme mali class komponenty, dal by sa pouzit decorator, pri formularoch mame class komponenty
86
87
  XUtils_1.XUtils.registerAppBrowse(react_1.default.createElement(exports.XUserBrowse, null), "XUser");
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -36,7 +38,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
38
  function verb(n) { return function (v) { return step([n, v]); }; }
37
39
  function step(op) {
38
40
  if (f) throw new TypeError("Generator is already executing.");
39
- while (_) try {
41
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
40
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;
41
43
  if (y = 0, t) op = [op[0] & 2, t.value];
42
44
  switch (op[0]) {
@@ -179,7 +181,7 @@ var XUserForm = /** @class */ (function (_super) {
179
181
  react_1.default.createElement(XFormFooter_1.XFormFooter, { form: this })));
180
182
  };
181
183
  XUserForm = __decorate([
182
- XFormBase_1.Form("XUser"),
184
+ (0, XFormBase_1.Form)("XUser"),
183
185
  __metadata("design:paramtypes", [Object])
184
186
  ], XUserForm);
185
187
  return XUserForm;
@@ -5,9 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.SourceCodeLinkEntity = void 0;
7
7
  var react_1 = __importDefault(require("react"));
8
- exports.SourceCodeLinkEntity = function (props) {
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/" + props.sourceCodeFile, target: "_blank", rel: "noopener noreferrer" },
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
  };
14
+ exports.SourceCodeLinkEntity = SourceCodeLinkEntity;
@@ -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
- getFieldForEdit(): string | undefined;
24
- checkNotNull(): boolean;
25
- getValueFromObject(): any;
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(): {
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -27,7 +29,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
27
29
  function verb(n) { return function (v) { return step([n, v]); }; }
28
30
  function step(op) {
29
31
  if (f) throw new TypeError("Generator is already executing.");
30
- while (_) try {
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
31
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;
32
34
  if (y = 0, t) op = [op[0] & 2, t.value];
33
35
  switch (op[0]) {
@@ -89,32 +91,18 @@ var XAutoComplete = /** @class */ (function (_super) {
89
91
  });
90
92
  });
91
93
  };
92
- XAutoComplete.prototype.getFieldForEdit = function () {
93
- var _a;
94
- // TODO - zohladnit aj aktualny readOnly stav
95
- var readOnly = (_a = this.props.readOnly) !== null && _a !== void 0 ? _a : false;
96
- if (!readOnly) {
97
- return this.props.assocField;
98
- }
99
- return undefined;
94
+ XAutoComplete.prototype.getField = function () {
95
+ return this.props.assocField;
100
96
  };
101
- XAutoComplete.prototype.checkNotNull = function () {
102
- var _a;
103
- // TODO - zohladnit aj aktualny readOnly stav
104
- return !this.xAssoc.isNullable && !((_a = this.props.readOnly) !== null && _a !== void 0 ? _a : false);
97
+ XAutoComplete.prototype.isNotNull = function () {
98
+ return !this.xAssoc.isNullable;
105
99
  };
106
- XAutoComplete.prototype.getValueFromObject = function () {
107
- var object = this.props.form.state.object;
108
- var assocObject = object !== null ? object[this.props.assocField] : null;
109
- // ak je undefined, pre istotu dame na null, null je standard
110
- if (assocObject === undefined) {
111
- assocObject = null;
112
- }
100
+ XAutoComplete.prototype.getValue = function () {
101
+ var assocObject = this.getValueFromObject();
113
102
  return assocObject;
114
103
  };
115
104
  XAutoComplete.prototype.onChangeAutoCompleteBase = function (object, objectChange) {
116
- var error = this.validateOnChange(object);
117
- this.props.form.onFieldChange(this.props.assocField, object, error);
105
+ this.onValueChangeBase(object);
118
106
  if (objectChange !== XUtils_1.OperationType.None) {
119
107
  // zmenil sa zaznam dobrovolnika v DB
120
108
  // zatial len refreshneme z DB
@@ -129,30 +117,23 @@ var XAutoComplete = /** @class */ (function (_super) {
129
117
  // overrides method in XFormComponent
130
118
  XAutoComplete.prototype.validate = function () {
131
119
  if (this.errorInBase) {
132
- var field = this.getFieldForEdit();
133
- if (field) {
134
- // error message dame na onChange, mohli by sme aj na onSet (predtym onBlur), je to jedno viac-menej
135
- return { field: field, xError: { onChange: this.errorInBase } };
136
- }
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() } };
137
122
  }
138
123
  // zavolame povodnu metodu
139
124
  return _super.prototype.validate.call(this);
140
125
  };
141
126
  XAutoComplete.prototype.render = function () {
142
- var _a, _b, _c, _d;
127
+ var _a;
143
128
  var xEntityAssoc = XUtilsMetadata_1.XUtilsMetadata.getXEntity(this.xAssoc.entityName);
144
129
  var xDisplayField = XUtilsMetadata_1.XUtilsMetadata.getXFieldByPath(xEntityAssoc, this.props.displayField);
145
- var label = (_a = this.props.label) !== null && _a !== void 0 ? _a : this.props.assocField;
146
- if (this.checkNotNull()) {
147
- label = XUtils_1.XUtils.markNotNull(label);
148
- }
149
- var readOnly = (_b = this.props.readOnly) !== null && _b !== void 0 ? _b : false;
150
- var size = (_c = this.props.size) !== null && _c !== void 0 ? _c : xDisplayField.length;
151
- 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;
152
133
  // div className="col" nam zabezpeci aby XAutoCompleteBase nezaberal celu dlzku grid-u (ma nastaveny width=100% vdaka "formgroup-inline")
153
134
  return (react_1.default.createElement("div", { className: "field grid" },
154
- react_1.default.createElement("label", { htmlFor: this.props.assocField, className: "col-fixed", style: labelStyle }, label),
155
- react_1.default.createElement(XAutoCompleteBase_1.XAutoCompleteBase, { value: this.getValueFromObject(), suggestions: this.state.suggestions, onChange: this.onChangeAutoCompleteBase, field: this.props.displayField, valueForm: this.props.assocForm, idField: xEntityAssoc.idField, error: this.getError(), onErrorChange: this.onErrorChangeAutoCompleteBase })));
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 })));
156
137
  };
157
138
  return XAutoComplete;
158
139
  }(XFormComponent_1.XFormComponent));
@@ -7,7 +7,7 @@ export interface XAutoCompleteBaseProps {
7
7
  field: string;
8
8
  valueForm?: any;
9
9
  idField?: string;
10
- maxlength?: number;
10
+ maxLength?: number;
11
11
  error?: string;
12
12
  onErrorChange: (error: string | undefined) => void;
13
13
  setFocusOnCreate?: boolean;
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -25,7 +27,11 @@ var __assign = (this && this.__assign) || function () {
25
27
  };
26
28
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
27
29
  if (k2 === undefined) k2 = k;
28
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
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);
29
35
  }) : (function(o, m, k, k2) {
30
36
  if (k2 === undefined) k2 = k;
31
37
  o[k2] = m[k];
@@ -38,7 +44,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
38
44
  var __importStar = (this && this.__importStar) || function (mod) {
39
45
  if (mod && mod.__esModule) return mod;
40
46
  var result = {};
41
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
47
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
42
48
  __setModuleDefault(result, mod);
43
49
  return result;
44
50
  };
@@ -58,9 +64,14 @@ var __read = (this && this.__read) || function (o, n) {
58
64
  }
59
65
  return ar;
60
66
  };
61
- var __spread = (this && this.__spread) || function () {
62
- for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
63
- return ar;
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));
64
75
  };
65
76
  Object.defineProperty(exports, "__esModule", { value: true });
66
77
  exports.XAutoCompleteBase = void 0;
@@ -98,7 +109,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
98
109
  var _this = this;
99
110
  var filteredSuggestions;
100
111
  if (!event.query.trim().length) {
101
- filteredSuggestions = __spread(this.props.suggestions);
112
+ filteredSuggestions = __spreadArray([], __read(this.props.suggestions), false);
102
113
  }
103
114
  else {
104
115
  var queryNormalized_1 = XUtils_1.XUtils.normalizeString(event.query);
@@ -160,7 +171,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
160
171
  }
161
172
  };
162
173
  XAutoCompleteBase.prototype.createErrorMessage = function () {
163
- return "Value \"" + this.state.inputValueState + "\" was not found among valid values.";
174
+ return "Value \"".concat(this.state.inputValueState, "\" was not found among valid values.");
164
175
  };
165
176
  /*
166
177
  onBlurInvalidInput() {
@@ -186,18 +197,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
186
197
  }
187
198
  */
188
199
  XAutoCompleteBase.prototype.setFocusToInput = function () {
189
- if (this.autoCompleteRef.current.inputRef !== undefined) {
190
- // funguje ak je XAutoCompleteBase priamo v projekte, tiez funguje ak sa pouziva lib-ka z npmjs.com
191
- // nefunguje ak mame lib-ku priamo nalinkovanu na projekt (zmeny lib-ky pocas vyvoja)(minimalne next projekt kvm-next-web-app nefungoval)
192
- this.autoCompleteRef.current.inputRef.current.focus();
193
- }
194
- else {
195
- // pozor! nefunguje ak sa lib-ka pouziva z npmjs.com,
196
- // je tu koli tomu ked je lib-ka priamo nalinkovana na projekt
197
- // je to hack ale neviem to lepsie vyriesit
198
- console.log('Warning! this.autoCompleteRef.current.inputRef is undefined - we try to use this.autoCompleteRef.current.inputEl instead');
199
- this.autoCompleteRef.current.inputEl.focus();
200
- }
200
+ this.autoCompleteRef.current.focus();
201
201
  };
202
202
  XAutoCompleteBase.prototype.setObjectValue = function (object, objectChange) {
203
203
  this.setState({ inputChanged: false, notValid: false });
@@ -260,7 +260,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
260
260
  icon: 'pi pi-pencil',
261
261
  command: function (e) {
262
262
  if (_this.state.inputChanged) {
263
- alert("Value \"" + _this.state.inputValueState + "\" was not found among valid values, please enter some valid value.");
263
+ alert("Value \"".concat(_this.state.inputValueState, "\" was not found among valid values, please enter some valid value."));
264
264
  _this.setFocusToInput();
265
265
  }
266
266
  else {
@@ -292,7 +292,11 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
292
292
  command: function (e) {
293
293
  // zobrazi cely suggestions list, zide sa ak chceme vidiet vsetky moznosti
294
294
  // neprakticke ak mame vela poloziek v suggestions list
295
- _this.autoCompleteRef.current.onDropdownClick();
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');
296
300
  }
297
301
  });
298
302
  // vypocitame inputValue
@@ -309,7 +313,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
309
313
  // <DobrovolnikForm id={this.formDialogObjectId} object={this.formDialogInitObjectForInsert} onSaveOrCancel={this.formDialogOnSaveOrCancel}/>
310
314
  // formgroup-inline lepi SplitButton na autocomplete a zarovna jeho vysku
311
315
  return (react_1.default.createElement("div", { className: "x-auto-complete-base" },
312
- 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
+ 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))),
313
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() }),
314
318
  this.props.valueForm != undefined ?
315
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, {
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -14,7 +16,11 @@ var __extends = (this && this.__extends) || (function () {
14
16
  })();
15
17
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
18
  if (k2 === undefined) k2 = k;
17
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
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);
18
24
  }) : (function(o, m, k, k2) {
19
25
  if (k2 === undefined) k2 = k;
20
26
  o[k2] = m[k];
@@ -27,7 +33,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
27
33
  var __importStar = (this && this.__importStar) || function (mod) {
28
34
  if (mod && mod.__esModule) return mod;
29
35
  var result = {};
30
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
36
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
31
37
  __setModuleDefault(result, mod);
32
38
  return result;
33
39
  };
@@ -46,7 +52,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
46
52
  function verb(n) { return function (v) { return step([n, v]); }; }
47
53
  function step(op) {
48
54
  if (f) throw new TypeError("Generator is already executing.");
49
- while (_) try {
55
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
50
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;
51
57
  if (y = 0, t) op = [op[0] & 2, t.value];
52
58
  switch (op[0]) {
@@ -312,7 +318,7 @@ var XBrowse = /** @class */ (function (_super) {
312
318
  this.props.openForm(formElementCloned);
313
319
  }
314
320
  else {
315
- console.log("XBrowse entity = " + this.props.entity + ": form not found/registered.");
321
+ console.log("XBrowse entity = ".concat(this.props.entity, ": form not found/registered."));
316
322
  }
317
323
  };
318
324
  XBrowse.prototype.render = function () {
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.XButton = void 0;
7
7
  var react_1 = __importDefault(require("react"));
8
8
  var button_1 = require("primereact/button");
9
- exports.XButton = function (props) {
9
+ var XButton = function (props) {
10
10
  // zatial iba pridany class x-button, aby sme vedeli nastavit margin "m-1" (1rem)
11
11
  return (react_1.default.createElement(button_1.Button, { label: props.label, icon: props.icon, onClick: props.onClick, disabled: props.disabled, className: "m-1" }));
12
12
  };
13
+ exports.XButton = XButton;
@@ -7,6 +7,7 @@ exports.XButtonIconSmall = void 0;
7
7
  var react_1 = __importDefault(require("react"));
8
8
  var button_1 = require("primereact/button");
9
9
  var XUtils_1 = require("./XUtils");
10
- exports.XButtonIconSmall = function (props) {
10
+ var XButtonIconSmall = function (props) {
11
11
  return (react_1.default.createElement(button_1.Button, { icon: props.icon, onClick: props.onClick, disabled: props.disabled, className: XUtils_1.XUtils.isMobile() ? undefined : 'x-button-icon-small p-button-sm', tooltip: props.tooltip }));
12
12
  };
13
+ exports.XButtonIconSmall = XButtonIconSmall;
@@ -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.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
14
18
  var __importStar = (this && this.__importStar) || function (mod) {
15
19
  if (mod && mod.__esModule) return mod;
16
20
  var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
22
  __setModuleDefault(result, mod);
19
23
  return result;
20
24
  };
@@ -33,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
33
37
  function verb(n) { return function (v) { return step([n, v]); }; }
34
38
  function step(op) {
35
39
  if (f) throw new TypeError("Generator is already executing.");
36
- while (_) try {
40
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
37
41
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
38
42
  if (y = 0, t) op = [op[0] & 2, t.value];
39
43
  switch (op[0]) {
@@ -77,11 +81,11 @@ var XUtils_1 = require("./XUtils");
77
81
  var password_1 = require("primereact/password");
78
82
  var button_1 = require("primereact/button");
79
83
  var inputtext_1 = require("primereact/inputtext");
80
- exports.XChangePasswordForm = function (props) {
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) {
@@ -153,3 +157,4 @@ exports.XChangePasswordForm = function (props) {
153
157
  react_1.default.createElement("div", { className: "flex justify-content-center" },
154
158
  react_1.default.createElement(button_1.Button, { label: "Save", onClick: onClickSave }))));
155
159
  };
160
+ exports.XChangePasswordForm = XChangePasswordForm;
@@ -1,10 +1,8 @@
1
- import React from "react";
2
- import { XFormBase } from "./XFormBase";
3
- export declare const XCheckbox: (props: {
4
- form: XFormBase;
5
- field: string;
6
- label?: string | undefined;
7
- readOnly?: boolean | undefined;
8
- inputStyle?: React.CSSProperties | undefined;
9
- labelStyle?: React.CSSProperties | undefined;
10
- }) => 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
+ }