@michalrakus/x-react-web-lib 1.19.0 → 1.21.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 (64) hide show
  1. package/XEditor.d.ts +3 -0
  2. package/XEditor.js +5 -0
  3. package/XEditorBase.d.ts +3 -0
  4. package/XEditorBase.js +5 -0
  5. package/XExportRowsDialog.d.ts +1 -1
  6. package/XExportRowsDialog.js +1 -1
  7. package/XHtmlRenderer.d.ts +3 -0
  8. package/XHtmlRenderer.js +5 -0
  9. package/XLazyDataTable.d.ts +1 -1
  10. package/XLazyDataTable.js +1 -1
  11. package/XMultilineRenderer.d.ts +3 -0
  12. package/XMultilineRenderer.js +5 -0
  13. package/XParamBrowse.d.ts +3 -0
  14. package/XParamBrowse.js +5 -0
  15. package/XParamForm.d.ts +3 -0
  16. package/XParamForm.js +5 -0
  17. package/gulpfile.js +11 -4
  18. package/lib/administration/XBrowseMetaBrowse.d.ts +1 -1
  19. package/lib/administration/XBrowseMetaBrowse.js +1 -1
  20. package/lib/administration/XParamBrowse.d.ts +6 -0
  21. package/lib/administration/XParamBrowse.js +25 -0
  22. package/lib/administration/XParamForm.d.ts +7 -0
  23. package/lib/administration/XParamForm.js +60 -0
  24. package/lib/administration/XUserBrowse.d.ts +1 -1
  25. package/lib/administration/XUserBrowse.js +1 -1
  26. package/lib/components/XAutoComplete.d.ts +2 -0
  27. package/lib/components/XAutoComplete.js +1 -1
  28. package/lib/components/XAutoCompleteBase.d.ts +5 -1
  29. package/lib/components/XAutoCompleteBase.js +35 -36
  30. package/lib/components/XAutoCompleteDT.d.ts +4 -2
  31. package/lib/components/XAutoCompleteDT.js +1 -1
  32. package/lib/components/XEditBrowse.js +1 -1
  33. package/lib/components/XEditor.d.ts +15 -0
  34. package/lib/components/XEditor.js +64 -0
  35. package/lib/components/XEditorBase.d.ts +9 -0
  36. package/lib/components/XEditorBase.js +91 -0
  37. package/lib/components/XFormBase.d.ts +1 -0
  38. package/lib/components/XFormBase.js +19 -4
  39. package/lib/components/XFormComponent.d.ts +1 -0
  40. package/lib/components/XInputText.js +1 -1
  41. package/lib/components/XInputTextareaBase.js +3 -4
  42. package/lib/components/{XExportRowsDialog.d.ts → XLazyDataTable/XExportRowsDialog.d.ts} +1 -1
  43. package/lib/components/{XExportRowsDialog.js → XLazyDataTable/XExportRowsDialog.js} +5 -5
  44. package/lib/components/XLazyDataTable/XHtmlRenderer.d.ts +7 -0
  45. package/lib/components/XLazyDataTable/XHtmlRenderer.js +78 -0
  46. package/lib/components/{XLazyDataTable.d.ts → XLazyDataTable/XLazyDataTable.d.ts} +22 -6
  47. package/lib/components/{XLazyDataTable.js → XLazyDataTable/XLazyDataTable.js} +112 -48
  48. package/lib/components/XLazyDataTable/XMultilineRenderer.d.ts +8 -0
  49. package/lib/components/XLazyDataTable/XMultilineRenderer.js +80 -0
  50. package/lib/components/XLazyDataTable/XMultilineSwitch.d.ts +7 -0
  51. package/lib/components/XLazyDataTable/XMultilineSwitch.js +20 -0
  52. package/lib/components/XLazyDataTable/XOcfDropdown.d.ts +8 -0
  53. package/lib/components/XLazyDataTable/XOcfDropdown.js +52 -0
  54. package/lib/components/XUtilsMetadata.d.ts +1 -1
  55. package/lib/serverApi/ExportImportParam.d.ts +1 -0
  56. package/lib/serverApi/XUtilsCommon.d.ts +5 -0
  57. package/lib/serverApi/XUtilsCommon.js +101 -1
  58. package/lib/serverApi/XUtilsConversions.d.ts +3 -1
  59. package/lib/serverApi/XUtilsConversions.js +19 -14
  60. package/lib/serverApi/XUtilsMetadataCommon.d.ts +1 -0
  61. package/lib/serverApi/XUtilsMetadataCommon.js +16 -0
  62. package/lib/serverApi/x-lib-api.d.ts +6 -0
  63. package/lib/serverApi/x-lib-api.js +3 -0
  64. package/package.json +2 -1
package/XEditor.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ // generated by gulp
2
+
3
+ export * from './lib/components/XEditor';
package/XEditor.js ADDED
@@ -0,0 +1,5 @@
1
+ // generated by gulp
2
+
3
+ 'use strict';
4
+
5
+ module.exports = require('./lib/components/XEditor.js');
@@ -0,0 +1,3 @@
1
+ // generated by gulp
2
+
3
+ export * from './lib/components/XEditorBase';
package/XEditorBase.js ADDED
@@ -0,0 +1,5 @@
1
+ // generated by gulp
2
+
3
+ 'use strict';
4
+
5
+ module.exports = require('./lib/components/XEditorBase.js');
@@ -1,3 +1,3 @@
1
1
  // generated by gulp
2
2
 
3
- export * from './lib/components/XExportRowsDialog';
3
+ export * from './lib/components/XLazyDataTable/XExportRowsDialog';
@@ -2,4 +2,4 @@
2
2
 
3
3
  'use strict';
4
4
 
5
- module.exports = require('./lib/components/XExportRowsDialog.js');
5
+ module.exports = require('./lib/components/XLazyDataTable/XExportRowsDialog.js');
@@ -0,0 +1,3 @@
1
+ // generated by gulp
2
+
3
+ export * from './lib/components/XLazyDataTable/XHtmlRenderer';
@@ -0,0 +1,5 @@
1
+ // generated by gulp
2
+
3
+ 'use strict';
4
+
5
+ module.exports = require('./lib/components/XLazyDataTable/XHtmlRenderer.js');
@@ -1,3 +1,3 @@
1
1
  // generated by gulp
2
2
 
3
- export * from './lib/components/XLazyDataTable';
3
+ export * from './lib/components/XLazyDataTable/XLazyDataTable';
package/XLazyDataTable.js CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  'use strict';
4
4
 
5
- module.exports = require('./lib/components/XLazyDataTable.js');
5
+ module.exports = require('./lib/components/XLazyDataTable/XLazyDataTable.js');
@@ -0,0 +1,3 @@
1
+ // generated by gulp
2
+
3
+ export * from './lib/components/XLazyDataTable/XMultilineRenderer';
@@ -0,0 +1,5 @@
1
+ // generated by gulp
2
+
3
+ 'use strict';
4
+
5
+ module.exports = require('./lib/components/XLazyDataTable/XMultilineRenderer.js');
@@ -0,0 +1,3 @@
1
+ // generated by gulp
2
+
3
+ export * from './lib/administration/XParamBrowse';
@@ -0,0 +1,5 @@
1
+ // generated by gulp
2
+
3
+ 'use strict';
4
+
5
+ module.exports = require('./lib/administration/XParamBrowse.js');
@@ -0,0 +1,3 @@
1
+ // generated by gulp
2
+
3
+ export * from './lib/administration/XParamForm';
package/XParamForm.js ADDED
@@ -0,0 +1,5 @@
1
+ // generated by gulp
2
+
3
+ 'use strict';
4
+
5
+ module.exports = require('./lib/administration/XParamForm.js');
package/gulpfile.js CHANGED
@@ -13,16 +13,23 @@ function generateApi(cb) {
13
13
  const fs = require('fs');
14
14
 
15
15
  const apiFileList = [
16
- "./lib/administration/XUserBrowse",
17
- "./lib/administration/XUserForm",
18
16
  "./lib/administration/XBrowseMetaBrowse",
19
17
  "./lib/administration/XBrowseMetaForm",
18
+ "./lib/administration/XParamBrowse",
19
+ "./lib/administration/XParamForm",
20
+ "./lib/administration/XUserBrowse",
21
+ "./lib/administration/XUserForm",
20
22
 
21
23
  "./lib/components/XFormRowCol/XFormCol",
22
24
  "./lib/components/XFormRowCol/XFormInlineRow",
23
25
  "./lib/components/XFormRowCol/XFormRow",
24
26
  "./lib/components/XFormRowCol/XFormRowCol",
25
27
 
28
+ "./lib/components/XLazyDataTable/XExportRowsDialog",
29
+ "./lib/components/XLazyDataTable/XHtmlRenderer",
30
+ "./lib/components/XLazyDataTable/XLazyDataTable",
31
+ "./lib/components/XLazyDataTable/XMultilineRenderer",
32
+
26
33
  "./lib/components/useXToken",
27
34
  "./lib/components/XAutoComplete",
28
35
  "./lib/components/XAutoCompleteBase",
@@ -36,9 +43,10 @@ function generateApi(cb) {
36
43
  "./lib/components/XDropdown",
37
44
  "./lib/components/XDropdownForEntity",
38
45
  "./lib/components/XEditBrowse",
46
+ "./lib/components/XEditor",
47
+ "./lib/components/XEditorBase",
39
48
  "./lib/components/XEnvVars",
40
49
  "./lib/components/XErrors",
41
- "./lib/components/XExportRowsDialog",
42
50
  "./lib/components/XFieldChangeEvent",
43
51
  "./lib/components/XFormBase",
44
52
  "./lib/components/XFormBaseModif",
@@ -56,7 +64,6 @@ function generateApi(cb) {
56
64
  "./lib/components/XInputText",
57
65
  "./lib/components/XInputTextarea",
58
66
  "./lib/components/XInputTextareaBase",
59
- "./lib/components/XLazyDataTable",
60
67
  "./lib/components/XLocale",
61
68
  "./lib/components/XLoginDialog",
62
69
  "./lib/components/XLoginForm",
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- import { XBrowseProps } from "../components/XLazyDataTable";
2
+ import { XBrowseProps } from "../components/XLazyDataTable/XLazyDataTable";
3
3
  export declare const XBrowseMetaBrowse: (props: XBrowseProps) => JSX.Element;
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.XBrowseMetaBrowse = void 0;
7
- var XLazyDataTable_1 = require("../components/XLazyDataTable");
7
+ var XLazyDataTable_1 = require("../components/XLazyDataTable/XLazyDataTable");
8
8
  var react_1 = __importDefault(require("react"));
9
9
  var XBrowseMetaForm_1 = require("./XBrowseMetaForm");
10
10
  var XBrowseMetaBrowse = function (props) {
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { XBrowseProps } from "../components/XLazyDataTable/XLazyDataTable";
3
+ import { XCustomFilter } from "../serverApi/FindParam";
4
+ export declare const XParamBrowse: (props: XBrowseProps & {
5
+ customFilter?: XCustomFilter;
6
+ }) => JSX.Element;
@@ -0,0 +1,25 @@
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.XParamBrowse = void 0;
7
+ var react_1 = __importDefault(require("react"));
8
+ var XLazyDataTable_1 = require("../components/XLazyDataTable/XLazyDataTable");
9
+ var XParamForm_1 = require("./XParamForm");
10
+ var XParamBrowse = function (props) {
11
+ var onAddRow = function () {
12
+ // openForm pridavame automaticky v XFormNavigator3 pri renderovani komponentu
13
+ props.openForm(react_1.default.createElement(XParamForm_1.XParamForm, null));
14
+ };
15
+ var onEdit = function (selectedRow) {
16
+ // openForm pridavame automaticky v XFormNavigator3 pri renderovani komponentu
17
+ props.openForm(react_1.default.createElement(XParamForm_1.XParamForm, { id: selectedRow.id }));
18
+ };
19
+ return (react_1.default.createElement(XLazyDataTable_1.XLazyDataTable, { entity: "XParam", sortField: "id", rows: 30, customFilter: props.customFilter, onAddRow: onAddRow, onEdit: onEdit, removeRow: true, displayed: props.displayed },
20
+ react_1.default.createElement(XLazyDataTable_1.XLazyColumn, { field: "id", header: "ID", width: "8rem" }),
21
+ react_1.default.createElement(XLazyDataTable_1.XLazyColumn, { field: "code", header: "Code", width: "16rem" }),
22
+ react_1.default.createElement(XLazyDataTable_1.XLazyColumn, { field: "name", header: "Name", width: "45rem" }),
23
+ react_1.default.createElement(XLazyDataTable_1.XLazyColumn, { field: "value", header: "Value", width: "16rem" })));
24
+ };
25
+ exports.XParamBrowse = XParamBrowse;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { XFormBaseModif } from "../components/XFormBaseModif";
3
+ import { XObject } from "../components/XObject";
4
+ export declare class XParamForm extends XFormBaseModif {
5
+ createNewObject(): XObject;
6
+ render(): JSX.Element;
7
+ }
@@ -0,0 +1,60 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
24
+ return (mod && mod.__esModule) ? mod : { "default": mod };
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.XParamForm = void 0;
28
+ var react_1 = __importDefault(require("react"));
29
+ var XFormBaseModif_1 = require("../components/XFormBaseModif");
30
+ var XFormBase_1 = require("../components/XFormBase");
31
+ var XInputDecimal_1 = require("../components/XInputDecimal");
32
+ var XInputDate_1 = require("../components/XInputDate");
33
+ var XInputText_1 = require("../components/XInputText");
34
+ var XFormFooter_1 = require("../components/XFormFooter");
35
+ var XParamForm = /** @class */ (function (_super) {
36
+ __extends(XParamForm, _super);
37
+ function XParamForm() {
38
+ return _super !== null && _super.apply(this, arguments) || this;
39
+ }
40
+ XParamForm.prototype.createNewObject = function () {
41
+ return { version: 0 };
42
+ };
43
+ XParamForm.prototype.render = function () {
44
+ return (react_1.default.createElement("div", null,
45
+ react_1.default.createElement("div", { className: "x-form-row" },
46
+ react_1.default.createElement("div", { className: "x-form-col" },
47
+ react_1.default.createElement(XInputDecimal_1.XInputDecimal, { form: this, field: "id", label: "ID", readOnly: true }),
48
+ react_1.default.createElement(XInputDate_1.XInputDate, { form: this, field: "modifDate", label: "Modified at", readOnly: true }),
49
+ react_1.default.createElement(XInputText_1.XInputText, { form: this, field: "modifXUser.name", label: "Modified by", inputStyle: { width: '12.5rem' } }),
50
+ react_1.default.createElement(XInputText_1.XInputText, { form: this, field: "code", label: "Code", inputStyle: { width: '16rem' } }),
51
+ react_1.default.createElement(XInputText_1.XInputText, { form: this, field: "name", label: "Name", inputStyle: { width: '45rem' } }),
52
+ react_1.default.createElement(XInputText_1.XInputText, { form: this, field: "value", label: "Value", inputStyle: { width: '45rem' } }))),
53
+ react_1.default.createElement(XFormFooter_1.XFormFooter, { form: this })));
54
+ };
55
+ XParamForm = __decorate([
56
+ (0, XFormBase_1.Form)("XParam")
57
+ ], XParamForm);
58
+ return XParamForm;
59
+ }(XFormBaseModif_1.XFormBaseModif));
60
+ exports.XParamForm = XParamForm;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- import { XBrowseProps } from "../components/XLazyDataTable";
2
+ import { XBrowseProps } from "../components/XLazyDataTable/XLazyDataTable";
3
3
  export declare const XUserBrowse: (props: XBrowseProps) => JSX.Element;
@@ -40,7 +40,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
40
40
  };
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
42
  exports.XUserBrowse = void 0;
43
- var XLazyDataTable_1 = require("../components/XLazyDataTable");
43
+ var XLazyDataTable_1 = require("../components/XLazyDataTable/XLazyDataTable");
44
44
  var react_1 = __importDefault(require("react"));
45
45
  var XUserForm_1 = require("./XUserForm");
46
46
  var XUtils_1 = require("../components/XUtils");
@@ -9,6 +9,7 @@ import { DataTableSortMeta } from "primereact/datatable";
9
9
  export interface XAutoCompleteProps extends XFormComponentProps<XObject> {
10
10
  assocField: string;
11
11
  displayField: string | string[];
12
+ itemTemplate?: (suggestion: any, index: number, createStringValue: boolean, defaultValue: (suggestion: any) => string) => React.ReactNode;
12
13
  searchBrowse?: JSX.Element;
13
14
  assocForm?: JSX.Element;
14
15
  suggestions?: any[];
@@ -21,6 +22,7 @@ export interface XAutoCompleteProps extends XFormComponentProps<XObject> {
21
22
  fields?: string[];
22
23
  width?: string;
23
24
  scrollHeight?: string;
25
+ inputClassName?: string;
24
26
  inputStyle?: React.CSSProperties;
25
27
  }
26
28
  export declare class XAutoComplete extends XFormComponent<XObject, XAutoCompleteProps> {
@@ -70,7 +70,7 @@ var XAutoComplete = /** @class */ (function (_super) {
70
70
  // div className="col" nam zabezpeci aby XAutoCompleteBase nezaberal celu dlzku grid-u (ma nastaveny width=100% vdaka "formgroup-inline")
71
71
  return (react_1.default.createElement("div", { className: "field grid" },
72
72
  react_1.default.createElement("label", { htmlFor: this.props.assocField, className: "col-fixed", style: this.getLabelStyle() }, this.getLabel()),
73
- react_1.default.createElement(XAutoCompleteBase_1.XAutoCompleteBase, { value: this.getValue(), onChange: this.onChangeAutoCompleteBase, field: this.props.displayField, searchBrowse: this.props.searchBrowse, valueForm: this.props.assocForm, idField: xEntityAssoc.idField, readOnly: this.isReadOnly(), error: this.getError(), onErrorChange: this.onErrorChangeAutoCompleteBase, width: this.props.width, scrollHeight: this.props.scrollHeight, suggestions: this.props.suggestions, suggestionsLoad: this.props.suggestionsLoad, lazyLoadMaxRows: this.props.lazyLoadMaxRows, splitQueryValue: this.props.splitQueryValue, minLength: this.props.minLength, suggestionsQuery: { entity: this.xAssoc.entityName, filter: function () { return _this.getFilterBase(_this.props.filter); }, sortField: this.props.sortField, fields: this.props.fields } })));
73
+ react_1.default.createElement(XAutoCompleteBase_1.XAutoCompleteBase, { value: this.getValue(), onChange: this.onChangeAutoCompleteBase, field: this.props.displayField, itemTemplate: this.props.itemTemplate, searchBrowse: this.props.searchBrowse, valueForm: this.props.assocForm, idField: xEntityAssoc.idField, readOnly: this.isReadOnly(), error: this.getError(), onErrorChange: this.onErrorChangeAutoCompleteBase, width: this.props.width, scrollHeight: this.props.scrollHeight, suggestions: this.props.suggestions, suggestionsLoad: this.props.suggestionsLoad, lazyLoadMaxRows: this.props.lazyLoadMaxRows, splitQueryValue: this.props.splitQueryValue, minLength: this.props.minLength, suggestionsQuery: { entity: this.xAssoc.entityName, filter: function () { return _this.getFilterBase(_this.props.filter); }, sortField: this.props.sortField, fields: this.props.fields }, inputClassName: this.props.inputClassName })));
74
74
  };
75
75
  return XAutoComplete;
76
76
  }(XFormComponent_1.XFormComponent));
@@ -22,6 +22,7 @@ export interface XAutoCompleteBaseProps {
22
22
  suggestionsQuery?: XQuery;
23
23
  lazyLoadMaxRows: number;
24
24
  field: string | string[];
25
+ itemTemplate?: (suggestion: any, index: number, createStringValue: boolean, defaultValue: (suggestion: any) => string) => React.ReactNode;
25
26
  splitQueryValue: boolean;
26
27
  searchBrowse?: JSX.Element;
27
28
  valueForm?: JSX.Element;
@@ -29,6 +30,7 @@ export interface XAutoCompleteBaseProps {
29
30
  minLength?: number;
30
31
  width?: string;
31
32
  scrollHeight?: string;
33
+ inputClassName?: string;
32
34
  readOnly?: boolean;
33
35
  error?: string;
34
36
  onErrorChange: (error: string | undefined) => void;
@@ -85,7 +87,9 @@ export declare class XAutoCompleteBase extends Component<XAutoCompleteBaseProps>
85
87
  onEditAssocValue(): void;
86
88
  computeInputValue(): any;
87
89
  itemTemplate(suggestion: any, index: number): React.ReactNode;
88
- computeDisplayValue(suggestion: any): string;
90
+ itemTemplateString(suggestion: any): string;
91
+ computeItemTemplate(suggestion: any, index: number, createStringValue: boolean): React.ReactNode;
92
+ computeDefaultDisplayValue(suggestion: any): string;
89
93
  static isMoreSuggestions(suggestion: any): boolean;
90
94
  createSearchBrowseParams(): XSearchBrowseParams;
91
95
  render(): JSX.Element;
@@ -150,7 +150,8 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
150
150
  _this.onSelect = _this.onSelect.bind(_this);
151
151
  _this.onBlur = _this.onBlur.bind(_this);
152
152
  _this.itemTemplate = _this.itemTemplate.bind(_this);
153
- _this.computeDisplayValue = _this.computeDisplayValue.bind(_this);
153
+ _this.itemTemplateString = _this.itemTemplateString.bind(_this);
154
+ _this.computeDefaultDisplayValue = _this.computeDefaultDisplayValue.bind(_this);
154
155
  _this.formDialogOnSaveOrCancel = _this.formDialogOnSaveOrCancel.bind(_this);
155
156
  _this.formDialogOnHide = _this.formDialogOnHide.bind(_this);
156
157
  _this.searchDialogOnChoose = _this.searchDialogOnChoose.bind(_this);
@@ -269,7 +270,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
269
270
  }
270
271
  filteredSuggestions = suggestions.filter(function (suggestion) {
271
272
  var e_1, _a;
272
- var fieldValue = _this.computeDisplayValue(suggestion);
273
+ var fieldValue = _this.itemTemplateString(suggestion);
273
274
  // specialna null polozka (prazdny objekt) - test dame az za test fieldValue na undefined - koli performance
274
275
  if (fieldValue === undefined && Object.keys(suggestion).length === 0) {
275
276
  return false;
@@ -328,11 +329,12 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
328
329
  findResult = _a.sent();
329
330
  filteredSuggestions = findResult.rowList;
330
331
  // ak sme nesortovali v DB (co je draha operacia) tak zosortujeme teraz
331
- // (computeDisplayValue sa vola duplicitne ale pre tych cca 20 zaznamov je to ok)
332
+ // (itemTemplateString sa vola duplicitne ale pre tych cca 20 zaznamov je to ok)
332
333
  if (this.props.suggestionsQuery.sortField === undefined) {
333
- filteredSuggestions = XUtils_1.XUtils.arraySort(filteredSuggestions, this.computeDisplayValue);
334
+ filteredSuggestions = XUtils_1.XUtils.arraySort(filteredSuggestions, this.itemTemplateString);
334
335
  }
335
336
  // ak mame o 1 zaznam viac ako je lazyLoadMaxRows, zmenime posledny zaznam na ...
337
+ // TODO - lepsie by bolo posledny zaznam vyhodit a popisok ... zobrazit do footer-a (odpadnu problemy z pripadnou selekciou pseudozaznamu ...)
336
338
  if (filteredSuggestions.length > this.props.lazyLoadMaxRows) {
337
339
  filteredSuggestions[filteredSuggestions.length - 1] = XAutoCompleteBase.valueMoreSuggestions; // zatial priamo string
338
340
  }
@@ -577,7 +579,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
577
579
  if (!this.state.inputChanged) {
578
580
  // poznamka: ak object === null tak treba do inputu zapisovat prazdny retazec, ak by sme pouzili null, neprejavila by sa zmena v modeli na null
579
581
  var object = this.props.value;
580
- inputValue = (object !== null) ? this.computeDisplayValue(object) : ""; // TODO - je "" ok?
582
+ inputValue = (object !== null) ? this.computeItemTemplate(object, -1, true) : ""; // TODO - je "" ok?
581
583
  }
582
584
  else {
583
585
  inputValue = this.state.inputValueState;
@@ -585,43 +587,40 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
585
587
  return inputValue;
586
588
  };
587
589
  XAutoCompleteBase.prototype.itemTemplate = function (suggestion, index) {
588
- return this.computeDisplayValue(suggestion);
590
+ return this.computeItemTemplate(suggestion, index, false);
589
591
  };
590
- XAutoCompleteBase.prototype.computeDisplayValue = function (suggestion) {
591
- var e_2, _a;
592
- var displayValue = "";
592
+ // pouziva sa na vytvorenie hodnoty do inputu (vyselectovany zaznam) a tiez na pripadne sortovanie a filtrovanie na frontende (ak nepouzivame lazy nacitavanie)
593
+ XAutoCompleteBase.prototype.itemTemplateString = function (suggestion) {
594
+ var itemValue = this.computeItemTemplate(suggestion, -1, true);
595
+ if (typeof itemValue !== "string") {
596
+ throw "XAutoCompleteBase: function of the property itemTemplate created non-string value for suggestion. Please create string value if parameter createStringValue = true.";
597
+ }
598
+ return itemValue;
599
+ };
600
+ XAutoCompleteBase.prototype.computeItemTemplate = function (suggestion, index, createStringValue) {
601
+ var itemTemplate;
602
+ // osetrenie specialnej polozky ... dame sem, nech sa to nemusi inde riesit
593
603
  if (XAutoCompleteBase.isMoreSuggestions(suggestion)) {
594
- displayValue = suggestion;
604
+ itemTemplate = suggestion;
595
605
  }
596
606
  else {
597
- try {
598
- for (var _b = __values(this.getFields()), _c = _b.next(); !_c.done; _c = _b.next()) {
599
- var field = _c.value;
600
- // TODO - konverzie na spravny typ/string
601
- var _d = __read(XUtilsCommon_1.XUtilsCommon.getPrefixAndField(field), 2), prefix = _d[0], fieldOnly = _d[1];
602
- var value = XUtilsCommon_1.XUtilsCommon.getValueByPath(suggestion, fieldOnly);
603
- if (value !== null && value !== undefined) {
604
- var valueStr = value.toString(); // TODO - spravnu konverziu
605
- if (valueStr !== "") {
606
- if (displayValue !== "") {
607
- displayValue += " ";
608
- }
609
- if (prefix) {
610
- displayValue += prefix;
611
- }
612
- displayValue += valueStr;
613
- }
614
- }
615
- }
607
+ if (this.props.itemTemplate) {
608
+ itemTemplate = this.props.itemTemplate(suggestion, index, createStringValue, this.computeDefaultDisplayValue);
616
609
  }
617
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
618
- finally {
619
- try {
620
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
621
- }
622
- finally { if (e_2) throw e_2.error; }
610
+ else {
611
+ itemTemplate = this.computeDefaultDisplayValue(suggestion);
623
612
  }
624
613
  }
614
+ return itemTemplate;
615
+ };
616
+ XAutoCompleteBase.prototype.computeDefaultDisplayValue = function (suggestion) {
617
+ var displayValue;
618
+ if (XAutoCompleteBase.isMoreSuggestions(suggestion)) {
619
+ displayValue = suggestion;
620
+ }
621
+ else {
622
+ displayValue = XUtilsCommon_1.XUtilsCommon.createDisplayValue(suggestion, this.getFields());
623
+ }
625
624
  return displayValue;
626
625
  };
627
626
  // vrati true ak sa jedna o specialny typ XAutoCompleteBase.valueMoreSuggestions
@@ -685,7 +684,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
685
684
  // <DobrovolnikForm id={this.formDialogObjectId} object={this.formDialogInitValuesForInsert} onSaveOrCancel={this.formDialogOnSaveOrCancel}/>
686
685
  // formgroup-inline lepi SplitButton na autocomplete a zarovna jeho vysku
687
686
  return (react_1.default.createElement("div", { className: "x-auto-complete-base", style: { width: this.props.width } },
688
- react_1.default.createElement(autocomplete_1.AutoComplete, __assign({ value: inputValue, suggestions: this.state.filteredSuggestions, completeMethod: this.completeMethod, itemTemplate: this.itemTemplate, onChange: this.onChange, onSelect: this.onSelect, onBlur: this.onBlur, minLength: this.props.minLength, scrollHeight: this.props.scrollHeight, ref: this.autoCompleteRef, readOnly: readOnly, disabled: readOnly }, XUtils_1.XUtils.createErrorProps(error))),
687
+ react_1.default.createElement(autocomplete_1.AutoComplete, __assign({ value: inputValue, suggestions: this.state.filteredSuggestions, completeMethod: this.completeMethod, itemTemplate: this.itemTemplate, onChange: this.onChange, onSelect: this.onSelect, onBlur: this.onBlur, minLength: this.props.minLength, scrollHeight: this.props.scrollHeight, ref: this.autoCompleteRef, readOnly: readOnly, disabled: readOnly }, XUtils_1.XUtils.createErrorProps(error), { inputClassName: this.props.inputClassName })),
689
688
  dropdownButton,
690
689
  this.props.valueForm != undefined ?
691
690
  react_1.default.createElement(dialog_1.Dialog, { visible: this.state.formDialogOpened, onHide: this.formDialogOnHide, header: this.formDialogObjectId ? 'Modification' : 'New row' }, react_1.default.cloneElement(this.props.valueForm, {
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  import { XFormComponentDT, XFormComponentDTProps } from "./XFormComponentDT";
3
3
  import { XAssoc } from "../serverApi/XEntityMetadata";
4
4
  import { OperationType } from "./XUtils";
@@ -8,7 +8,8 @@ import { XTableFieldFilterProp } from "./XFormDataTable2";
8
8
  import { DataTableSortMeta } from "primereact/datatable";
9
9
  export interface XAutoCompleteDTProps extends XFormComponentDTProps {
10
10
  assocField: string;
11
- displayField: string;
11
+ displayField: string | string[];
12
+ itemTemplate?: (suggestion: any, index: number, createStringValue: boolean, defaultValue: (suggestion: any) => string) => React.ReactNode;
12
13
  searchBrowse?: JSX.Element;
13
14
  assocForm?: JSX.Element;
14
15
  suggestions?: any[];
@@ -20,6 +21,7 @@ export interface XAutoCompleteDTProps extends XFormComponentDTProps {
20
21
  sortField?: string | DataTableSortMeta[];
21
22
  fields?: string[];
22
23
  scrollHeight?: string;
24
+ inputClassName?: string;
23
25
  }
24
26
  export declare class XAutoCompleteDT extends XFormComponentDT<XAutoCompleteDTProps> {
25
27
  protected xAssoc: XAssoc;
@@ -68,7 +68,7 @@ var XAutoCompleteDT = /** @class */ (function (_super) {
68
68
  // TODO - size
69
69
  //const size = this.props.size ?? xDisplayField.length;
70
70
  // div className="col" nam zabezpeci aby XAutoCompleteBase nezaberal celu dlzku grid-u (ma nastaveny width=100% vdaka "formgroup-inline")
71
- return (react_1.default.createElement(XAutoCompleteBase_1.XAutoCompleteBase, { value: this.getValue(), onChange: this.onChangeAutoCompleteBase, field: this.props.displayField, searchBrowse: this.props.searchBrowse, valueForm: this.props.assocForm, idField: xEntityAssoc.idField, readOnly: this.isReadOnly(), error: this.getError(), onErrorChange: this.onErrorChangeAutoCompleteBase, suggestions: this.props.suggestions, suggestionsLoad: this.props.suggestionsLoad, lazyLoadMaxRows: this.props.lazyLoadMaxRows, splitQueryValue: this.props.splitQueryValue, minLength: this.props.minLength, scrollHeight: this.props.scrollHeight, suggestionsQuery: { entity: this.xAssoc.entityName, filter: function () { return _this.getFilterBase(_this.props.filter); }, sortField: this.props.sortField, fields: this.props.fields } }));
71
+ return (react_1.default.createElement(XAutoCompleteBase_1.XAutoCompleteBase, { value: this.getValue(), onChange: this.onChangeAutoCompleteBase, field: this.props.displayField, itemTemplate: this.props.itemTemplate, searchBrowse: this.props.searchBrowse, valueForm: this.props.assocForm, idField: xEntityAssoc.idField, readOnly: this.isReadOnly(), error: this.getError(), onErrorChange: this.onErrorChangeAutoCompleteBase, suggestions: this.props.suggestions, suggestionsLoad: this.props.suggestionsLoad, lazyLoadMaxRows: this.props.lazyLoadMaxRows, splitQueryValue: this.props.splitQueryValue, minLength: this.props.minLength, scrollHeight: this.props.scrollHeight, suggestionsQuery: { entity: this.xAssoc.entityName, filter: function () { return _this.getFilterBase(_this.props.filter); }, sortField: this.props.sortField, fields: this.props.fields }, inputClassName: this.props.inputClassName }));
72
72
  };
73
73
  return XAutoCompleteDT;
74
74
  }(XFormComponentDT_1.XFormComponentDT));
@@ -108,7 +108,7 @@ var XEditColumnDialog_1 = require("./XEditColumnDialog");
108
108
  var _ = __importStar(require("lodash"));
109
109
  var XUtilsMetadata_1 = require("./XUtilsMetadata");
110
110
  var XUtils_1 = require("./XUtils");
111
- var XLazyDataTable_1 = require("./XLazyDataTable");
111
+ var XLazyDataTable_1 = require("./XLazyDataTable/XLazyDataTable");
112
112
  var XUtilsMetadataCommon_1 = require("../serverApi/XUtilsMetadataCommon");
113
113
  // TODO - pouzit extends XEditBrowseBase, ako je tomu pri CarForm?
114
114
  var XEditBrowse = /** @class */ (function (_super) {
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import { XInput, XInputProps } from "./XInput";
3
+ export interface XEditorProps extends XInputProps<string> {
4
+ labelOnTop: boolean;
5
+ }
6
+ export declare class XEditor extends XInput<string, XEditorProps> {
7
+ static defaultProps: {
8
+ labelOnTop: boolean;
9
+ };
10
+ constructor(props: XEditorProps);
11
+ getValue(): string | null;
12
+ onValueChange(value: string | null): void;
13
+ getLabelStyle(): React.CSSProperties;
14
+ render(): JSX.Element;
15
+ }
@@ -0,0 +1,64 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.XEditor = void 0;
22
+ var react_1 = __importDefault(require("react"));
23
+ var XInput_1 = require("./XInput");
24
+ var XUtils_1 = require("./XUtils");
25
+ var XEditorBase_1 = require("./XEditorBase");
26
+ var XEditor = /** @class */ (function (_super) {
27
+ __extends(XEditor, _super);
28
+ function XEditor(props) {
29
+ var _this = _super.call(this, props) || this;
30
+ _this.onValueChange = _this.onValueChange.bind(_this);
31
+ return _this;
32
+ }
33
+ XEditor.prototype.getValue = function () {
34
+ return this.getValueFromObject();
35
+ };
36
+ XEditor.prototype.onValueChange = function (value) {
37
+ this.onValueChangeBase(value, this.props.onChange);
38
+ };
39
+ XEditor.prototype.getLabelStyle = function () {
40
+ var _a;
41
+ return this.props.labelOnTop ? ((_a = this.props.labelStyle) !== null && _a !== void 0 ? _a : {}) : _super.prototype.getLabelStyle.call(this);
42
+ };
43
+ XEditor.prototype.render = function () {
44
+ // TODO - neni to otestovane
45
+ var _a;
46
+ var style = (_a = this.props.inputStyle) !== null && _a !== void 0 ? _a : {};
47
+ // defaultne pridame width:100%
48
+ // ak nemame labelOnTop=true, musime odratat sirku labelu, inac sa label dostane nad input (koli flex-wrap: wrap)
49
+ var widthValue = this.props.labelOnTop ? '100%' : "calc(100% - ".concat(XUtils_1.XUtils.FIELD_LABEL_WIDTH, ")");
50
+ XUtils_1.XUtils.addCssPropIfNotExists(style, { width: widthValue });
51
+ // x-editor-label-on-top - nastavuje orientation: column, aby boli label a XEditorBase pod sebou (robene podla XInputTextarea)
52
+ // XEditorBase renderujeme az ked mame nacitany object, lebo inac sa nam nenastavi spravna velkost (hodnota nie je k dispozicii pri prvom renderingu) (robene podla XInputTextarea)
53
+ return (react_1.default.createElement("div", { className: !this.props.labelOnTop ? 'field grid' : 'field grid x-editor-label-on-top' },
54
+ react_1.default.createElement("label", { htmlFor: this.props.field, className: !this.props.labelOnTop ? 'col-fixed' : undefined, style: this.getLabelStyle() }, this.getLabel()),
55
+ this.props.form.state.object ?
56
+ react_1.default.createElement(XEditorBase_1.XEditorBase, { id: this.props.field, value: this.getValue(), onChange: this.onValueChange, readOnly: this.isReadOnly(), style: style, error: this.getError() })
57
+ : null));
58
+ };
59
+ XEditor.defaultProps = {
60
+ labelOnTop: false
61
+ };
62
+ return XEditor;
63
+ }(XInput_1.XInput));
64
+ exports.XEditor = XEditor;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ export declare const XEditorBase: (props: {
3
+ id?: string | undefined;
4
+ value: string | null;
5
+ onChange: (value: string | null) => void;
6
+ readOnly?: boolean | undefined;
7
+ error?: string | undefined;
8
+ style?: React.CSSProperties | undefined;
9
+ }) => JSX.Element;