@michalrakus/x-react-web-lib 1.25.0 → 1.27.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.
@@ -1,15 +1,22 @@
1
1
  import React, { Component } from "react";
2
2
  import { AutoCompleteChangeEvent } from "primereact/autocomplete";
3
3
  import { OperationType, XQuery } from "./XUtils";
4
- import { MenuItem } from "primereact/menuitem";
4
+ import { MenuItemCommandEvent } from "primereact/menuitem";
5
5
  import { XSearchBrowseParams } from "./XSearchBrowseParams";
6
6
  import { DataTableSortMeta } from "primereact/datatable";
7
+ import { XEntity } from "../serverApi/XEntityMetadata";
8
+ interface XButtonItem {
9
+ icon: any | undefined;
10
+ tooltip?: string;
11
+ command(event: MenuItemCommandEvent): void;
12
+ }
7
13
  export type XSuggestionsLoadProp = "eager" | "onSearchStart" | "lazy";
8
14
  export type XSuggestionsLoadType = "suggestions" | XSuggestionsLoadProp;
9
15
  export interface XAutoCompleteBaseProps {
10
16
  value: any;
11
17
  onChange: (object: any, objectChange: OperationType) => void;
12
18
  suggestions?: any[];
19
+ suggestionsEntity?: string;
13
20
  suggestionsLoad?: XSuggestionsLoadProp;
14
21
  suggestionsQuery?: XQuery;
15
22
  lazyLoadMaxRows: number;
@@ -19,9 +26,15 @@ export interface XAutoCompleteBaseProps {
19
26
  searchBrowse?: JSX.Element;
20
27
  valueForm?: JSX.Element;
21
28
  idField?: string;
29
+ addRowEnabled: boolean;
22
30
  onAddRow?: (inputValue: string) => void;
31
+ insertButtonTooltip?: string;
32
+ updateButtonTooltip?: string;
33
+ searchButtonTooltip?: string;
23
34
  minLength?: number;
35
+ buttonsLayout: "splitButton" | "buttons";
24
36
  width?: string;
37
+ maxWidth?: string;
25
38
  scrollHeight?: string;
26
39
  inputClassName?: string;
27
40
  readOnly?: boolean;
@@ -34,7 +47,9 @@ export declare class XAutoCompleteBase extends Component<XAutoCompleteBaseProps>
34
47
  static defaultProps: {
35
48
  lazyLoadMaxRows: number;
36
49
  splitQueryValue: boolean;
50
+ addRowEnabled: boolean;
37
51
  minLength: number;
52
+ buttonsLayout: string;
38
53
  scrollHeight: string;
39
54
  };
40
55
  autoCompleteRef: any;
@@ -49,6 +64,7 @@ export declare class XAutoCompleteBase extends Component<XAutoCompleteBaseProps>
49
64
  };
50
65
  suggestionsLoadedForOSS: boolean;
51
66
  wasOnChangeCalled: boolean;
67
+ xEntity: XEntity | undefined;
52
68
  formDialogObjectId: number | undefined;
53
69
  formDialogInitValuesForInsert: any | undefined;
54
70
  constructor(props: XAutoCompleteBaseProps);
@@ -72,10 +88,10 @@ export declare class XAutoCompleteBase extends Component<XAutoCompleteBaseProps>
72
88
  formDialogOnHide(): void;
73
89
  searchDialogOnChoose(chosenRow: any): void;
74
90
  searchDialogOnHide(): void;
75
- createInsertItem(splitButtonItems: MenuItem[]): void;
76
- createUpdateItem(splitButtonItems: MenuItem[]): void;
77
- createSearchItem(splitButtonItems: MenuItem[]): void;
78
- createDropdownItem(splitButtonItems: MenuItem[]): void;
91
+ createInsertItem(buttonItems: XButtonItem[]): void;
92
+ createUpdateItem(buttonItems: XButtonItem[]): void;
93
+ createSearchItem(buttonItems: XButtonItem[]): void;
94
+ createDropdownItem(buttonItems: XButtonItem[]): void;
79
95
  onOpenDropdown(e: any): void;
80
96
  openDropdown(e: any): void;
81
97
  onEditAssocValue(): void;
@@ -88,3 +104,4 @@ export declare class XAutoCompleteBase extends Component<XAutoCompleteBaseProps>
88
104
  createSearchBrowseParams(): XSearchBrowseParams;
89
105
  render(): React.JSX.Element;
90
106
  }
107
+ export {};
@@ -129,6 +129,7 @@ var dialog_1 = require("primereact/dialog");
129
129
  var XUtils_1 = require("./XUtils");
130
130
  var button_1 = require("primereact/button");
131
131
  var XUtilsCommon_1 = require("../serverApi/XUtilsCommon");
132
+ var XUtilsMetadataCommon_1 = require("../serverApi/XUtilsMetadataCommon");
132
133
  var XAutoCompleteBase = /** @class */ (function (_super) {
133
134
  __extends(XAutoCompleteBase, _super);
134
135
  function XAutoCompleteBase(props) {
@@ -145,6 +146,20 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
145
146
  };
146
147
  _this.suggestionsLoadedForOSS = false;
147
148
  _this.wasOnChangeCalled = false;
149
+ var entity;
150
+ if (_this.getXSuggestionsLoadType() === "suggestions") {
151
+ // if (this.props.suggestionsEntity === undefined) {
152
+ // throw "If prop suggestions is used, then also prop suggestionsEntity must be defined.";
153
+ // }
154
+ entity = _this.props.suggestionsEntity;
155
+ }
156
+ else {
157
+ if (_this.props.suggestionsQuery === undefined) {
158
+ throw "prop suggestionsQuery must be defined. (prop suggestions is not used)";
159
+ }
160
+ entity = _this.props.suggestionsQuery.entity;
161
+ }
162
+ _this.xEntity = entity ? XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXEntity(entity) : undefined;
148
163
  _this.completeMethod = _this.completeMethod.bind(_this);
149
164
  _this.onChange = _this.onChange.bind(_this);
150
165
  _this.onSelect = _this.onSelect.bind(_this);
@@ -487,10 +502,11 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
487
502
  this.setFocusToInput();
488
503
  }
489
504
  };
490
- XAutoCompleteBase.prototype.createInsertItem = function (splitButtonItems) {
505
+ XAutoCompleteBase.prototype.createInsertItem = function (buttonItems) {
491
506
  var _this = this;
492
- splitButtonItems.push({
507
+ buttonItems.push({
493
508
  icon: 'pi pi-plus',
509
+ tooltip: this.props.insertButtonTooltip,
494
510
  command: function (e) {
495
511
  if (_this.props.onAddRow) {
496
512
  // mame custom handler pre "plus" button
@@ -514,10 +530,11 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
514
530
  }
515
531
  });
516
532
  };
517
- XAutoCompleteBase.prototype.createUpdateItem = function (splitButtonItems) {
533
+ XAutoCompleteBase.prototype.createUpdateItem = function (buttonItems) {
518
534
  var _this = this;
519
- splitButtonItems.push({
535
+ buttonItems.push({
520
536
  icon: 'pi pi-pencil',
537
+ tooltip: this.props.updateButtonTooltip,
521
538
  command: function (e) {
522
539
  if (_this.state.inputChanged) {
523
540
  alert("Value \"".concat(_this.state.inputValueState, "\" was not found among valid values, please enter some valid value."));
@@ -541,18 +558,19 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
541
558
  // }
542
559
  // },
543
560
  };
544
- XAutoCompleteBase.prototype.createSearchItem = function (splitButtonItems) {
561
+ XAutoCompleteBase.prototype.createSearchItem = function (buttonItems) {
545
562
  var _this = this;
546
- splitButtonItems.push({
563
+ buttonItems.push({
547
564
  icon: 'pi pi-search',
565
+ tooltip: this.props.searchButtonTooltip,
548
566
  command: function (e) {
549
567
  _this.setState({ searchDialogOpened: true });
550
568
  }
551
569
  });
552
570
  };
553
- XAutoCompleteBase.prototype.createDropdownItem = function (splitButtonItems) {
571
+ XAutoCompleteBase.prototype.createDropdownItem = function (buttonItems) {
554
572
  var _this = this;
555
- splitButtonItems.push({
573
+ buttonItems.push({
556
574
  icon: 'pi pi-chevron-down',
557
575
  command: function (e) {
558
576
  // zobrazi cely suggestions list, zide sa ak chceme vidiet vsetky moznosti
@@ -633,7 +651,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
633
651
  displayValue = suggestion;
634
652
  }
635
653
  else {
636
- displayValue = XUtilsCommon_1.XUtilsCommon.createDisplayValue(suggestion, this.getFields());
654
+ displayValue = XUtilsCommon_1.XUtilsCommon.createDisplayValue(suggestion, this.xEntity, this.getFields());
637
655
  }
638
656
  return displayValue;
639
657
  };
@@ -654,37 +672,46 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
654
672
  var _this = this;
655
673
  var _a;
656
674
  var readOnly = (_a = this.props.readOnly) !== null && _a !== void 0 ? _a : false;
657
- var dropdownButton;
675
+ var buttons;
658
676
  if (!readOnly) {
659
- if (this.props.searchBrowse || this.props.valueForm || this.props.onAddRow) {
660
- // mame searchBrowse alebo CRUD operacie, potrebujeme SplitButton
661
- var splitButtonItems = [];
662
- if (this.props.valueForm || this.props.onAddRow) {
663
- this.createInsertItem(splitButtonItems);
677
+ var createInsertItem = (this.props.addRowEnabled && (this.props.valueForm !== undefined || this.props.onAddRow !== undefined));
678
+ if (createInsertItem || this.props.valueForm || this.props.searchBrowse) {
679
+ // mame searchBrowse alebo CRUD operacie, potrebujeme viac buttonov alebo SplitButton
680
+ var buttonItems = [];
681
+ if (createInsertItem) {
682
+ this.createInsertItem(buttonItems);
664
683
  }
665
684
  if (this.props.valueForm) {
666
- this.createUpdateItem(splitButtonItems);
685
+ this.createUpdateItem(buttonItems);
667
686
  }
668
- if (this.props.searchBrowse && !readOnly) {
669
- this.createSearchItem(splitButtonItems);
687
+ if (this.props.searchBrowse) {
688
+ this.createSearchItem(buttonItems);
689
+ }
690
+ this.createDropdownItem(buttonItems);
691
+ if (this.props.buttonsLayout === "buttons") {
692
+ buttons = buttonItems.map(function (value) { return react_1.default.createElement(button_1.Button, { icon: value.icon, tooltip: value.tooltip, tooltipOptions: { position: 'top' }, onClick: function (e) { return value.command(e); }, className: 'x-dropdownbutton' + XUtils_1.XUtils.mobileCssSuffix() }); });
693
+ }
694
+ else {
695
+ // buttonsLayout === "splitButton"
696
+ // tooltip-y by trebalo pridat...
697
+ var splitButtonItems = buttonItems.map(function (value) { return { icon: value.icon, command: value.command }; });
698
+ buttons = [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(), disabled: readOnly })];
670
699
  }
671
- this.createDropdownItem(splitButtonItems);
672
- dropdownButton = 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(), disabled: readOnly });
673
700
  }
674
701
  else {
675
702
  // mame len 1 operaciu - dame jednoduchy button
676
- dropdownButton = react_1.default.createElement(button_1.Button, { icon: "pi pi-chevron-down", onClick: function (e) { return _this.onOpenDropdown(e); }, className: 'x-dropdownbutton' + XUtils_1.XUtils.mobileCssSuffix() });
703
+ buttons = [react_1.default.createElement(button_1.Button, { icon: "pi pi-chevron-down", onClick: function (e) { return _this.onOpenDropdown(e); }, className: 'x-dropdownbutton' + XUtils_1.XUtils.mobileCssSuffix() })];
677
704
  }
678
705
  }
679
706
  else {
680
707
  // readOnly
681
708
  // ak mame valueForm a mame asociovany objekt, umoznime editovat asociovany objekt
682
709
  if (this.props.valueForm && this.props.value !== null) {
683
- dropdownButton = react_1.default.createElement(button_1.Button, { icon: "pi pi-pencil", onClick: function (e) { return _this.onEditAssocValue(); }, className: 'x-dropdownbutton' + XUtils_1.XUtils.mobileCssSuffix() });
710
+ buttons = [react_1.default.createElement(button_1.Button, { icon: "pi pi-pencil", tooltip: this.props.updateButtonTooltip, tooltipOptions: { position: 'top' }, onClick: function (e) { return _this.onEditAssocValue(); }, className: 'x-dropdownbutton' + XUtils_1.XUtils.mobileCssSuffix() })];
684
711
  }
685
712
  else {
686
713
  // dame disablovany button (z estetickych dovodov, zachovame sirku)
687
- dropdownButton = react_1.default.createElement(button_1.Button, { icon: "pi pi-chevron-down", className: 'x-dropdownbutton' + XUtils_1.XUtils.mobileCssSuffix(), disabled: true });
714
+ buttons = [react_1.default.createElement(button_1.Button, { icon: "pi pi-chevron-down", className: 'x-dropdownbutton' + XUtils_1.XUtils.mobileCssSuffix(), disabled: true })];
688
715
  }
689
716
  }
690
717
  // vypocitame inputValue
@@ -700,9 +727,9 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
700
727
  // Dialog pre konkretny form:
701
728
  // <DobrovolnikForm id={this.formDialogObjectId} object={this.formDialogInitValuesForInsert} onSaveOrCancel={this.formDialogOnSaveOrCancel}/>
702
729
  // formgroup-inline lepi SplitButton na autocomplete a zarovna jeho vysku
703
- return (react_1.default.createElement("div", { className: "x-auto-complete-base", style: { width: this.props.width } },
704
- 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.createTooltipOrErrorProps(error), { inputClassName: this.props.inputClassName })),
705
- dropdownButton,
730
+ return (react_1.default.createElement("div", { className: "x-auto-complete-base", style: { width: this.props.width, maxWidth: this.props.maxWidth } },
731
+ 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.createTooltipOrErrorProps(error), { inputClassName: this.props.inputClassName, showEmptyMessage: true })),
732
+ buttons,
706
733
  this.props.valueForm != undefined ?
707
734
  react_1.default.createElement(dialog_1.Dialog, { className: "x-dialog-without-header", visible: this.state.formDialogOpened, onHide: this.formDialogOnHide }, react_1.default.cloneElement(this.props.valueForm, {
708
735
  id: this.formDialogObjectId, initValues: this.formDialogInitValuesForInsert, onSaveOrCancel: this.formDialogOnSaveOrCancel
@@ -716,7 +743,9 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
716
743
  XAutoCompleteBase.defaultProps = {
717
744
  lazyLoadMaxRows: 10,
718
745
  splitQueryValue: true,
746
+ addRowEnabled: true,
719
747
  minLength: 1,
748
+ buttonsLayout: "buttons",
720
749
  scrollHeight: '15rem' // primereact has 200px
721
750
  };
722
751
  return XAutoCompleteBase;
@@ -5,6 +5,7 @@ export declare const XFormHeader: {
5
5
  form?: XFormBase;
6
6
  label: string;
7
7
  appendNewRow: boolean;
8
+ style?: React.CSSProperties;
8
9
  }): React.JSX.Element;
9
10
  defaultProps: {
10
11
  appendNewRow: boolean;
@@ -8,7 +8,7 @@ var react_1 = __importDefault(require("react"));
8
8
  var XLocale_1 = require("./XLocale");
9
9
  var XFormHeader = function (props) {
10
10
  var _a;
11
- return (react_1.default.createElement("div", { className: "x-form-header" }, props.label + (props.appendNewRow && ((_a = props.form) === null || _a === void 0 ? void 0 : _a.isAddRow()) ? " - " + (0, XLocale_1.xLocaleOption)('newRow') : "")));
11
+ return (react_1.default.createElement("div", { className: "x-form-header", style: props.style }, props.label + (props.appendNewRow && ((_a = props.form) === null || _a === void 0 ? void 0 : _a.isAddRow()) ? " - " + (0, XLocale_1.xLocaleOption)('newRow') : "")));
12
12
  };
13
13
  exports.XFormHeader = XFormHeader;
14
14
  exports.XFormHeader.defaultProps = {
@@ -15,9 +15,9 @@ export declare enum OperationType {
15
15
  Remove = 3
16
16
  }
17
17
  export declare enum XViewStatus {
18
- ReadWrite = 0,
19
- ReadOnly = 1,
20
- Hidden = 2
18
+ ReadWrite = "readWrite",
19
+ ReadOnly = "readOnly",
20
+ Hidden = "hidden"
21
21
  }
22
22
  export type XViewStatusOrBoolean = XViewStatus | boolean;
23
23
  export interface IPostgresInterval {
@@ -99,9 +99,9 @@ var OperationType;
99
99
  })(OperationType = exports.OperationType || (exports.OperationType = {}));
100
100
  var XViewStatus;
101
101
  (function (XViewStatus) {
102
- XViewStatus[XViewStatus["ReadWrite"] = 0] = "ReadWrite";
103
- XViewStatus[XViewStatus["ReadOnly"] = 1] = "ReadOnly";
104
- XViewStatus[XViewStatus["Hidden"] = 2] = "Hidden";
102
+ XViewStatus["ReadWrite"] = "readWrite";
103
+ XViewStatus["ReadOnly"] = "readOnly";
104
+ XViewStatus["Hidden"] = "hidden";
105
105
  })(XViewStatus = exports.XViewStatus || (exports.XViewStatus = {}));
106
106
  var XUtils = /** @class */ (function () {
107
107
  function XUtils() {
@@ -652,8 +652,12 @@ var XUtils = /** @class */ (function () {
652
652
  XUtils.showErrorMessage = function (message, e) {
653
653
  var msg = message + XUtilsCommon_1.XUtilsCommon.newLine;
654
654
  if (e instanceof XResponseError_1.XResponseError) {
655
- // better error message for optimistic locking
656
- if (e.xResponseErrorBody.exceptionName === 'OptimisticLockVersionMismatchError') {
655
+ if (e.xResponseErrorBody.exceptionName === 'XAppError') {
656
+ // app error from backend, we show only the error message
657
+ msg += e.xResponseErrorBody.message;
658
+ }
659
+ else if (e.xResponseErrorBody.exceptionName === 'OptimisticLockVersionMismatchError') {
660
+ // better error message for optimistic locking
657
661
  msg += "The optimistic lock failed, someone else has changed the row during the editation. Sorry, you have to cancel the editation and start the editation again.";
658
662
  }
659
663
  else {
@@ -1,3 +1,4 @@
1
+ import { XEntity, XField } from "./XEntityMetadata";
1
2
  export declare class XUtilsCommon {
2
3
  static newLine: string;
3
4
  static getValueByPath(object: any, path: string): any;
@@ -9,7 +10,9 @@ export declare class XUtilsCommon {
9
10
  static getPathToAssocAndField(path: string): [string | null, string];
10
11
  static isSingleField(path: string): boolean;
11
12
  static getPrefixAndField(path: string): [string | null, string];
12
- static createDisplayValue(object: any, fields: string[]): string;
13
+ static createDisplayValue(object: any, xEntity: XEntity | undefined, fields: string[]): string;
14
+ static createDisplayValueForField(object: any, xEntity: XEntity | undefined, field: string): string;
15
+ static displayValueAsUI(prefix: string | null, value: any, xField: XField | undefined): string;
13
16
  static objectAsJSON(value: any): string;
14
17
  static arrayCreateMap<ID, T>(array: T[], idField: string): Map<ID, T>;
15
18
  static getDayName(date: Date | null | undefined): string | undefined;
@@ -37,6 +37,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.dateFormat = exports.XUtilsCommon = void 0;
40
+ var XUtilsMetadataCommon_1 = require("./XUtilsMetadataCommon");
41
+ var XUtilsConversions_1 = require("./XUtilsConversions");
40
42
  // funkcie spolocne pre Web i pre Server
41
43
  var XUtilsCommon = /** @class */ (function () {
42
44
  function XUtilsCommon() {
@@ -168,26 +170,18 @@ var XUtilsCommon = /** @class */ (function () {
168
170
  return [prefix, pathOnly];
169
171
  }
170
172
  };
171
- XUtilsCommon.createDisplayValue = function (object, fields) {
173
+ XUtilsCommon.createDisplayValue = function (object, xEntity, fields) {
172
174
  var e_2, _a;
173
175
  var displayValue = "";
174
176
  try {
175
177
  for (var fields_1 = __values(fields), fields_1_1 = fields_1.next(); !fields_1_1.done; fields_1_1 = fields_1.next()) {
176
178
  var field = fields_1_1.value;
177
- // TODO - konverzie na spravny typ/string
178
- var _b = __read(XUtilsCommon.getPrefixAndField(field), 2), prefix = _b[0], fieldOnly = _b[1];
179
- var value = XUtilsCommon.getValueByPath(object, fieldOnly);
180
- if (value !== null && value !== undefined) {
181
- var valueStr = value.toString(); // TODO - spravnu konverziu
182
- if (valueStr !== "") {
183
- if (displayValue !== "") {
184
- displayValue += " ";
185
- }
186
- if (prefix) {
187
- displayValue += prefix;
188
- }
189
- displayValue += valueStr;
179
+ var valueStr = XUtilsCommon.createDisplayValueForField(object, xEntity, field);
180
+ if (valueStr !== "") {
181
+ if (displayValue !== "") {
182
+ displayValue += " ";
190
183
  }
184
+ displayValue += valueStr;
191
185
  }
192
186
  }
193
187
  }
@@ -200,6 +194,62 @@ var XUtilsCommon = /** @class */ (function () {
200
194
  }
201
195
  return displayValue;
202
196
  };
197
+ XUtilsCommon.createDisplayValueForField = function (object, xEntity, field) {
198
+ var e_3, _a;
199
+ // pouziva sa podobny algoritmus ako v XLazyDataTable - metoda bodyTemplate
200
+ // (ale nie je to take komplexne ako v XLazyDataTable - nevie renderovat napr. html (rich text))
201
+ var _b = __read(XUtilsCommon.getPrefixAndField(field), 2), prefix = _b[0], fieldOnly = _b[1];
202
+ var xField = undefined;
203
+ if (xEntity) {
204
+ xField = XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXFieldByPath(xEntity, fieldOnly);
205
+ }
206
+ var displayValue;
207
+ var valueOrValueList = XUtilsCommon.getValueOrValueListByPath(object, fieldOnly);
208
+ if (Array.isArray(valueOrValueList)) {
209
+ // zatial je zoznam hodnot OneToMany asociacie oddeleny " ", nedat zoznam napr. do zatvoriek [<zoznam>] ?
210
+ displayValue = "";
211
+ try {
212
+ for (var valueOrValueList_1 = __values(valueOrValueList), valueOrValueList_1_1 = valueOrValueList_1.next(); !valueOrValueList_1_1.done; valueOrValueList_1_1 = valueOrValueList_1.next()) {
213
+ var value = valueOrValueList_1_1.value;
214
+ var valueAsUI = XUtilsCommon.displayValueAsUI(prefix, value, xField);
215
+ if (valueAsUI !== "") {
216
+ if (displayValue !== "") {
217
+ displayValue += " ";
218
+ }
219
+ displayValue += valueAsUI;
220
+ }
221
+ }
222
+ }
223
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
224
+ finally {
225
+ try {
226
+ if (valueOrValueList_1_1 && !valueOrValueList_1_1.done && (_a = valueOrValueList_1.return)) _a.call(valueOrValueList_1);
227
+ }
228
+ finally { if (e_3) throw e_3.error; }
229
+ }
230
+ }
231
+ else {
232
+ displayValue = XUtilsCommon.displayValueAsUI(prefix, valueOrValueList, xField);
233
+ }
234
+ return displayValue;
235
+ };
236
+ XUtilsCommon.displayValueAsUI = function (prefix, value, xField) {
237
+ var displayValue;
238
+ if (xField) {
239
+ // null hodnoty konvertuje na ""
240
+ displayValue = (0, XUtilsConversions_1.convertValue)(xField, value, true, XUtilsConversions_1.AsUIType.Text); // Text - boolean sa konvertuje na ano/nie
241
+ }
242
+ else {
243
+ // nemame entity, nevieme spravne konvertovat (ale casto nam staci aj takato jednoducha konverzia)
244
+ displayValue = (value !== null && value !== undefined) ? value.toString() : "";
245
+ }
246
+ if (displayValue !== "") {
247
+ if (prefix) {
248
+ displayValue = prefix + displayValue;
249
+ }
250
+ }
251
+ return displayValue;
252
+ };
203
253
  XUtilsCommon.objectAsJSON = function (value) {
204
254
  // sem treba dat nejaku pre nas vhodnu serializaciu
205
255
  // zatial provizorne robene cez antipatern - modifikaciu prototype funcii primitivnych typov
@@ -223,7 +273,7 @@ var XUtilsCommon = /** @class */ (function () {
223
273
  return json;
224
274
  };
225
275
  XUtilsCommon.arrayCreateMap = function (array, idField) {
226
- var e_3, _a;
276
+ var e_4, _a;
227
277
  var idRowMap = new Map();
228
278
  try {
229
279
  for (var array_1 = __values(array), array_1_1 = array_1.next(); !array_1_1.done; array_1_1 = array_1.next()) {
@@ -233,12 +283,12 @@ var XUtilsCommon = /** @class */ (function () {
233
283
  }
234
284
  }
235
285
  }
236
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
286
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
237
287
  finally {
238
288
  try {
239
289
  if (array_1_1 && !array_1_1.done && (_a = array_1.return)) _a.call(array_1);
240
290
  }
241
- finally { if (e_3) throw e_3.error; }
291
+ finally { if (e_4) throw e_4.error; }
242
292
  }
243
293
  return idRowMap;
244
294
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michalrakus/x-react-web-lib",
3
- "version": "1.25.0",
3
+ "version": "1.27.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "clean": "rimraf lib",
@@ -40,7 +40,7 @@
40
40
  "peerDependencies": {
41
41
  "primeflex": "^3.3.1",
42
42
  "primeicons": "^7.0.0",
43
- "primereact": "~10.6.5",
43
+ "primereact": "~10.4.0",
44
44
  "quill": "^1.3.7",
45
45
  "react": "^18.2.0",
46
46
  "react-dom": "^18.2.0",