@michalrakus/x-react-web-lib 1.22.0 → 1.24.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 (100) hide show
  1. package/XMultiSelect.d.ts +3 -0
  2. package/XMultiSelect.js +5 -0
  3. package/XMultiSelectBase.d.ts +3 -0
  4. package/XMultiSelectBase.js +5 -0
  5. package/gulpfile.js +2 -0
  6. package/lib/administration/XBrowseMetaBrowse.d.ts +2 -2
  7. package/lib/administration/XBrowseMetaForm.d.ts +2 -2
  8. package/lib/administration/XParamBrowse.d.ts +2 -2
  9. package/lib/administration/XParamForm.d.ts +2 -2
  10. package/lib/administration/XUserBrowse.d.ts +2 -2
  11. package/lib/administration/XUserForm.d.ts +2 -2
  12. package/lib/components/SourceCodeLinkEntity.d.ts +2 -2
  13. package/lib/components/XAutoComplete.d.ts +2 -1
  14. package/lib/components/XAutoComplete.js +2 -2
  15. package/lib/components/XAutoCompleteBase.d.ts +5 -11
  16. package/lib/components/XAutoCompleteBase.js +30 -13
  17. package/lib/components/XAutoCompleteDT.d.ts +1 -1
  18. package/lib/components/XButton.d.ts +1 -1
  19. package/lib/components/XButtonIconMedium.d.ts +1 -1
  20. package/lib/components/XButtonIconNarrow.d.ts +1 -1
  21. package/lib/components/XButtonIconSmall.d.ts +1 -1
  22. package/lib/components/XCalendar.d.ts +2 -2
  23. package/lib/components/XCalendar.js +1 -1
  24. package/lib/components/XChangePasswordForm.d.ts +2 -2
  25. package/lib/components/XCheckbox.js +1 -1
  26. package/lib/components/XCheckboxDT.d.ts +2 -2
  27. package/lib/components/XDataTable.d.ts +2 -2
  28. package/lib/components/XDropdown.d.ts +2 -2
  29. package/lib/components/XDropdown.js +1 -1
  30. package/lib/components/XDropdownDT.d.ts +2 -2
  31. package/lib/components/XDropdownDTFilter.d.ts +2 -2
  32. package/lib/components/XDropdownForEntity.d.ts +2 -2
  33. package/lib/components/XDropdownForEntity.js +1 -1
  34. package/lib/components/XDropdownFormDTFilter.d.ts +2 -2
  35. package/lib/components/XEditBrowse.d.ts +2 -2
  36. package/lib/components/XEditColumnDialog.d.ts +2 -2
  37. package/lib/components/XEditor.d.ts +1 -1
  38. package/lib/components/XEditorBase.d.ts +1 -1
  39. package/lib/components/XEditorBase.js +1 -1
  40. package/lib/components/XFieldSelector.d.ts +2 -2
  41. package/lib/components/XFormBase.d.ts +1 -0
  42. package/lib/components/XFormBase.js +4 -0
  43. package/lib/components/XFormComponent.d.ts +1 -0
  44. package/lib/components/XFormDataTable2.d.ts +1 -1
  45. package/lib/components/XFormFooter.d.ts +2 -2
  46. package/lib/components/XFormHeader.d.ts +4 -2
  47. package/lib/components/XFormHeader.js +3 -1
  48. package/lib/components/XFormNavigator3.d.ts +2 -2
  49. package/lib/components/XFormRowCol/XFormCol.d.ts +2 -1
  50. package/lib/components/XFormRowCol/XFormCol.js +1 -1
  51. package/lib/components/XFormRowCol/XFormInlineRow.d.ts +1 -1
  52. package/lib/components/XFormRowCol/XFormRow.d.ts +1 -1
  53. package/lib/components/XFormRowCol/XFormRowCol.d.ts +2 -1
  54. package/lib/components/XFormRowCol/XFormRowCol.js +8 -1
  55. package/lib/components/XFtsInput.d.ts +2 -2
  56. package/lib/components/XHolders.d.ts +3 -3
  57. package/lib/components/XInputDate.d.ts +2 -2
  58. package/lib/components/XInputDateDT.d.ts +2 -2
  59. package/lib/components/XInputDecimal.d.ts +1 -1
  60. package/lib/components/XInputDecimalBase.d.ts +2 -2
  61. package/lib/components/XInputDecimalDT.d.ts +2 -2
  62. package/lib/components/XInputDecimalDT.js +1 -1
  63. package/lib/components/XInputFileList.d.ts +2 -1
  64. package/lib/components/XInputInterval.d.ts +1 -1
  65. package/lib/components/XInputIntervalBase.d.ts +2 -2
  66. package/lib/components/XInputIntervalBase.js +1 -1
  67. package/lib/components/XInputIntervalDT.d.ts +2 -2
  68. package/lib/components/XInputText.d.ts +2 -2
  69. package/lib/components/XInputText.js +14 -3
  70. package/lib/components/XInputTextDT.d.ts +2 -2
  71. package/lib/components/XInputTextarea.d.ts +1 -1
  72. package/lib/components/XInputTextarea.js +31 -6
  73. package/lib/components/XInputTextareaBase.d.ts +3 -1
  74. package/lib/components/XInputTextareaBase.js +1 -1
  75. package/lib/components/XInputTextareaDT.d.ts +2 -2
  76. package/lib/components/XLazyDataTable/XExportRowsDialog.d.ts +2 -2
  77. package/lib/components/XLazyDataTable/XExportRowsDialog.js +5 -5
  78. package/lib/components/XLazyDataTable/XLazyDataTable.d.ts +1 -1
  79. package/lib/components/XLazyDataTable/XMultilineSwitch.d.ts +2 -2
  80. package/lib/components/XLazyDataTable/XOcfDropdown.d.ts +2 -2
  81. package/lib/components/XLoginDialog.d.ts +2 -2
  82. package/lib/components/XLoginForm.d.ts +2 -2
  83. package/lib/components/XMultiSelect.d.ts +25 -0
  84. package/lib/components/XMultiSelect.js +97 -0
  85. package/lib/components/XMultiSelectBase.d.ts +27 -0
  86. package/lib/components/XMultiSelectBase.js +145 -0
  87. package/lib/components/XSearchBrowseParams.d.ts +1 -1
  88. package/lib/components/XSearchButton.d.ts +1 -1
  89. package/lib/components/XSearchButton.js +1 -1
  90. package/lib/components/XSearchButtonDT.d.ts +2 -2
  91. package/lib/components/XSearchButtonDT.js +1 -1
  92. package/lib/components/XSearchButtonOld.d.ts +1 -1
  93. package/lib/components/XToOneAssocButton.d.ts +2 -2
  94. package/lib/components/XToken.d.ts +1 -1
  95. package/lib/components/XUtils.d.ts +11 -2
  96. package/lib/components/XUtils.js +45 -21
  97. package/lib/components/locale/x-en.json +1 -0
  98. package/lib/serverApi/XUtilsMetadataCommon.d.ts +3 -1
  99. package/lib/serverApi/XUtilsMetadataCommon.js +9 -3
  100. package/package.json +3 -3
@@ -2,8 +2,9 @@ import React from "react";
2
2
  import { XFormBase } from "../XFormBase";
3
3
  export interface XFormColProps {
4
4
  form?: XFormBase;
5
+ width?: string | "full";
5
6
  labelStyle?: React.CSSProperties;
6
7
  style?: React.CSSProperties;
7
8
  children: JSX.Element | JSX.Element[];
8
9
  }
9
- export declare const XFormCol: (props: XFormColProps) => JSX.Element;
10
+ export declare const XFormCol: (props: XFormColProps) => React.JSX.Element;
@@ -7,6 +7,6 @@ exports.XFormCol = void 0;
7
7
  var react_1 = __importDefault(require("react"));
8
8
  var XFormRowCol_1 = require("./XFormRowCol");
9
9
  var XFormCol = function (props) {
10
- return react_1.default.createElement(XFormRowCol_1.XFormRowCol, { className: "x-form-col", form: props.form, labelStyle: props.labelStyle, style: props.style, children: props.children });
10
+ return react_1.default.createElement(XFormRowCol_1.XFormRowCol, { className: "x-form-col", form: props.form, width: props.width, labelStyle: props.labelStyle, style: props.style, children: props.children });
11
11
  };
12
12
  exports.XFormCol = XFormCol;
@@ -6,4 +6,4 @@ export interface XFormInlineRowProps {
6
6
  style?: React.CSSProperties;
7
7
  children: JSX.Element | JSX.Element[];
8
8
  }
9
- export declare const XFormInlineRow: (props: XFormInlineRowProps) => JSX.Element;
9
+ export declare const XFormInlineRow: (props: XFormInlineRowProps) => React.JSX.Element;
@@ -6,4 +6,4 @@ export interface XFormRowProps {
6
6
  style?: React.CSSProperties;
7
7
  children: JSX.Element | JSX.Element[];
8
8
  }
9
- export declare const XFormRow: (props: XFormRowProps) => JSX.Element;
9
+ export declare const XFormRow: (props: XFormRowProps) => React.JSX.Element;
@@ -3,8 +3,9 @@ import { XFormBase } from "../XFormBase";
3
3
  export interface XFormRowColProps {
4
4
  className: "x-form-row" | "x-form-inline-row" | "x-form-col";
5
5
  form?: XFormBase;
6
+ width?: string | "full";
6
7
  labelStyle?: React.CSSProperties;
7
8
  style?: React.CSSProperties;
8
9
  children: JSX.Element | JSX.Element[];
9
10
  }
10
- export declare const XFormRowCol: (props: XFormRowColProps) => JSX.Element;
11
+ export declare const XFormRowCol: (props: XFormRowColProps) => React.JSX.Element;
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.XFormRowCol = void 0;
7
7
  var react_1 = __importDefault(require("react"));
8
+ var XUtils_1 = require("../XUtils");
8
9
  var XFormRowCol = function (props) {
9
10
  var childElemList;
10
11
  if (props.form || props.labelStyle) {
@@ -27,6 +28,12 @@ var XFormRowCol = function (props) {
27
28
  else {
28
29
  childElemList = props.children; // netreba klonovat - viac menej koli performance
29
30
  }
30
- return react_1.default.createElement("div", { className: props.className, style: props.style }, childElemList);
31
+ var style = props.style;
32
+ if (props.width) {
33
+ style = style !== null && style !== void 0 ? style : {};
34
+ var width = (props.width === 'full' ? '100%' : props.width);
35
+ XUtils_1.XUtils.addCssPropIfNotExists(style, { width: width }); // props.style ma vyssiu prioritu ako props.width
36
+ }
37
+ return react_1.default.createElement("div", { className: props.className, style: style }, childElemList);
31
38
  };
32
39
  exports.XFormRowCol = XFormRowCol;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  export interface XFtsInputValue {
3
3
  value: string | null;
4
4
  matchMode: 'startsWith' | 'contains' | 'endsWith' | 'equals';
@@ -6,4 +6,4 @@ export interface XFtsInputValue {
6
6
  export declare const XFtsInput: (props: {
7
7
  value: XFtsInputValue;
8
8
  onChange: (value: XFtsInputValue) => void;
9
- }) => JSX.Element;
9
+ }) => React.JSX.Element;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  export declare const XHolder1: (props: {
3
3
  element: any;
4
- }) => JSX.Element;
4
+ }) => React.JSX.Element;
5
5
  export declare const XHolder2: (props: {
6
6
  element: any;
7
- }) => JSX.Element;
7
+ }) => React.JSX.Element;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  import { XFormComponentProps } from "./XFormComponent";
3
3
  import { XInput } from "./XInput";
4
4
  export interface XInputDateProps extends XFormComponentProps<number> {
@@ -8,5 +8,5 @@ export declare class XInputDate extends XInput<Date, XInputDateProps> {
8
8
  constructor(props: XInputDateProps);
9
9
  getValue(): Date | null;
10
10
  onValueChange(value: Date | null): void;
11
- render(): JSX.Element;
11
+ render(): React.JSX.Element;
12
12
  }
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  import { XInputDT, XInputDTProps } from "./XInputDT";
3
3
  export interface XInputDateDTProps extends XInputDTProps {
4
4
  }
@@ -6,5 +6,5 @@ export declare class XInputDateDT extends XInputDT<XInputDateDTProps> {
6
6
  constructor(props: XInputDateDTProps);
7
7
  getValue(): Date | null;
8
8
  onValueChange(value: Date | null): void;
9
- render(): JSX.Element;
9
+ render(): React.JSX.Element;
10
10
  }
@@ -11,5 +11,5 @@ export declare class XInputDecimal extends XInput<number, XInputDecimalProps> {
11
11
  getValue(): number | undefined;
12
12
  onValueChange(e: any): void;
13
13
  onBlur(e: any): void;
14
- render(): JSX.Element;
14
+ render(): React.JSX.Element;
15
15
  }
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  export declare const XInputDecimalBase: (props: {
3
3
  id?: string | undefined;
4
4
  value: number | null;
@@ -10,4 +10,4 @@ export declare const XInputDecimalBase: (props: {
10
10
  max?: number | undefined;
11
11
  size?: number | undefined;
12
12
  className?: string | undefined;
13
- }) => JSX.Element;
13
+ }) => React.JSX.Element;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  import { XInputDT, XInputDTProps } from "./XInputDT";
3
3
  export interface XInputDecimalDTProps extends XInputDTProps {
4
4
  }
@@ -7,5 +7,5 @@ export declare class XInputDecimalDT extends XInputDT<XInputDecimalDTProps> {
7
7
  getValue(): number | undefined;
8
8
  onValueChange(e: any): void;
9
9
  onBlur(e: any): void;
10
- render(): JSX.Element;
10
+ render(): React.JSX.Element;
11
11
  }
@@ -67,7 +67,7 @@ var XInputDecimalDT = /** @class */ (function (_super) {
67
67
  };
68
68
  XInputDecimalDT.prototype.render = function () {
69
69
  var _a = XUtilsMetadata_1.XUtilsMetadata.getParamsForInputNumber(this.xField), useGrouping = _a.useGrouping, fractionDigits = _a.fractionDigits, min = _a.min, max = _a.max;
70
- return (react_1.default.createElement(inputnumber_1.InputNumber, __assign({ id: this.props.field, value: this.getValue(), onChange: this.onValueChange, readOnly: this.isReadOnly(), mode: "decimal", locale: "de-DE", useGrouping: useGrouping, minFractionDigits: fractionDigits, maxFractionDigits: fractionDigits, min: min, max: max, onBlur: this.onBlur }, XUtils_1.XUtils.addClassName(XUtils_1.XUtils.createErrorProps(this.getError()), "x-input-to-resize"))));
70
+ return (react_1.default.createElement(inputnumber_1.InputNumber, __assign({ id: this.props.field, value: this.getValue(), onChange: this.onValueChange, readOnly: this.isReadOnly(), mode: "decimal", locale: "de-DE", useGrouping: useGrouping, minFractionDigits: fractionDigits, maxFractionDigits: fractionDigits, min: min, max: max, onBlur: this.onBlur }, XUtils_1.XUtils.addClassName(XUtils_1.XUtils.createTooltipOrErrorProps(this.getError()), "x-input-to-resize"))));
71
71
  };
72
72
  return XInputDecimalDT;
73
73
  }(XInputDT_1.XInputDT));
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import { Component } from "react";
2
3
  import { FileUploadHandlerEvent } from "primereact/fileupload";
3
4
  import { XFormBase } from "./XFormBase";
@@ -31,6 +32,6 @@ export declare class XInputFileList extends Component<XInputFileListProps> {
31
32
  static sizeInMB(size: number): string;
32
33
  onDownloadFile(xFile: XFile): Promise<void>;
33
34
  onRemoveFile(fileItem: any): Promise<void>;
34
- render(): JSX.Element;
35
+ render(): React.JSX.Element;
35
36
  }
36
37
  export {};
@@ -10,5 +10,5 @@ export declare class XInputInterval extends XInput<number, XInputIntervalProps>
10
10
  constructor(props: XInputIntervalProps);
11
11
  getValue(): IPostgresInterval | null;
12
12
  onValueChange(value: IPostgresInterval | null): void;
13
- render(): JSX.Element;
13
+ render(): React.JSX.Element;
14
14
  }
@@ -1,4 +1,4 @@
1
- import { CSSProperties } from "react";
1
+ import React, { CSSProperties } from "react";
2
2
  import { IPostgresInterval } from "./XUtils";
3
3
  export declare const XInputIntervalBase: (props: {
4
4
  id?: string | undefined;
@@ -7,4 +7,4 @@ export declare const XInputIntervalBase: (props: {
7
7
  readOnly?: boolean | undefined;
8
8
  error?: string | undefined;
9
9
  style?: CSSProperties | undefined;
10
- }) => JSX.Element;
10
+ }) => React.JSX.Element;
@@ -92,6 +92,6 @@ var XInputIntervalBase = function (props) {
92
92
  return inputValue;
93
93
  };
94
94
  // remark - width:'3.5rem' is default, can be overriden by value from props.style, if needed
95
- return (react_1.default.createElement(inputtext_1.InputText, __assign({ id: props.id, value: getInputValue(), onChange: onChange, onBlur: onBlur, readOnly: props.readOnly }, XUtils_1.XUtils.createErrorProps(props.error), { style: __assign({ width: '3.5rem' }, props.style) })));
95
+ return (react_1.default.createElement(inputtext_1.InputText, __assign({ id: props.id, value: getInputValue(), onChange: onChange, onBlur: onBlur, readOnly: props.readOnly }, XUtils_1.XUtils.createTooltipOrErrorProps(props.error), { style: __assign({ width: '3.5rem' }, props.style) })));
96
96
  };
97
97
  exports.XInputIntervalBase = XInputIntervalBase;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  import { IPostgresInterval } from "./XUtils";
3
3
  import { XInputDT, XInputDTProps } from "./XInputDT";
4
4
  export interface XInputIntervalDTProps extends XInputDTProps {
@@ -7,5 +7,5 @@ export declare class XInputIntervalDT extends XInputDT<XInputIntervalDTProps> {
7
7
  constructor(props: XInputIntervalDTProps);
8
8
  getValue(): IPostgresInterval | null;
9
9
  onValueChange(value: IPostgresInterval | null): void;
10
- render(): JSX.Element;
10
+ render(): React.JSX.Element;
11
11
  }
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  import { XInput, XInputProps } from "./XInput";
3
3
  export interface XInputTextProps extends XInputProps<string> {
4
4
  size?: number;
@@ -8,5 +8,5 @@ export declare class XInputText extends XInput<string, XInputTextProps> {
8
8
  getValue(): string;
9
9
  onValueChange(e: any): void;
10
10
  onBlur(e: any): void;
11
- render(): JSX.Element;
11
+ render(): React.JSX.Element;
12
12
  }
@@ -34,6 +34,8 @@ var react_1 = __importDefault(require("react"));
34
34
  var XUtilsConversions_1 = require("../serverApi/XUtilsConversions");
35
35
  var inputtext_1 = require("primereact/inputtext");
36
36
  var XInput_1 = require("./XInput");
37
+ var XUtils_1 = require("./XUtils");
38
+ var tooltip_1 = require("primereact/tooltip");
37
39
  var XInputText = /** @class */ (function (_super) {
38
40
  __extends(XInputText, _super);
39
41
  function XInputText(props) {
@@ -57,13 +59,22 @@ var XInputText = /** @class */ (function (_super) {
57
59
  this.callOnChangeFromOnBlur();
58
60
  };
59
61
  XInputText.prototype.render = function () {
60
- var _a;
62
+ var _a, _b;
63
+ var value = this.getValue();
64
+ var labelTooltip = undefined;
65
+ var labelElemId = undefined;
66
+ if (value) {
67
+ // nevidno placeholder, tak zobrazime desc ako label tooltip
68
+ labelTooltip = this.props.desc;
69
+ labelElemId = "".concat(this.props.field, "_label_id");
70
+ }
61
71
  var size = (_a = this.props.size) !== null && _a !== void 0 ? _a : this.xField.length;
62
72
  // note: style overrides size (width of the input according to character count)
63
73
  var label = this.getLabel();
64
74
  return (react_1.default.createElement("div", { className: "field grid" },
65
- label !== undefined ? react_1.default.createElement("label", { htmlFor: this.props.field, className: "col-fixed", style: this.getLabelStyle() }, label) : null,
66
- react_1.default.createElement(inputtext_1.InputText, __assign({ id: this.props.field, value: this.getValue(), onChange: this.onValueChange, readOnly: this.isReadOnly(), maxLength: this.xField.length, size: size, style: this.props.inputStyle }, this.getClassNameTooltip(), { onBlur: this.onBlur, placeholder: this.props.placeholder }))));
75
+ label !== undefined ? react_1.default.createElement("label", { id: labelElemId, htmlFor: this.props.field, className: "col-fixed", style: this.getLabelStyle() }, label) : null,
76
+ labelTooltip ? react_1.default.createElement(tooltip_1.Tooltip, { target: "#".concat(labelElemId), content: labelTooltip }) : null,
77
+ react_1.default.createElement(inputtext_1.InputText, __assign({ id: this.props.field, value: value, onChange: this.onValueChange, onBlur: this.onBlur, readOnly: this.isReadOnly(), maxLength: this.xField.length, size: size, style: this.props.inputStyle }, XUtils_1.XUtils.createTooltipOrErrorProps(this.getError(), this.props.tooltip), { placeholder: (_b = this.props.placeholder) !== null && _b !== void 0 ? _b : this.props.desc }))));
67
78
  };
68
79
  return XInputText;
69
80
  }(XInput_1.XInput));
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { XFormBase } from "./XFormBase";
2
+ import React from "react";
3
3
  import { XTableFieldReadOnlyProp } from "./XFormDataTable2";
4
4
  export declare const XInputTextDT: (props: {
5
5
  form: XFormBase;
@@ -7,4 +7,4 @@ export declare const XInputTextDT: (props: {
7
7
  field: string;
8
8
  rowData: any;
9
9
  readOnly?: XTableFieldReadOnlyProp | undefined;
10
- }) => JSX.Element;
10
+ }) => React.JSX.Element;
@@ -15,5 +15,5 @@ export declare class XInputTextarea extends XInput<string, XInputTextareaProps>
15
15
  getValue(): string | null;
16
16
  onValueChange(value: string | null): void;
17
17
  getLabelStyle(): React.CSSProperties;
18
- render(): JSX.Element;
18
+ render(): React.JSX.Element;
19
19
  }
@@ -23,6 +23,7 @@ var react_1 = __importDefault(require("react"));
23
23
  var XInput_1 = require("./XInput");
24
24
  var XUtils_1 = require("./XUtils");
25
25
  var XInputTextareaBase_1 = require("./XInputTextareaBase");
26
+ var tooltip_1 = require("primereact/tooltip");
26
27
  var XInputTextarea = /** @class */ (function (_super) {
27
28
  __extends(XInputTextarea, _super);
28
29
  function XInputTextarea(props) {
@@ -41,14 +42,29 @@ var XInputTextarea = /** @class */ (function (_super) {
41
42
  return this.props.labelOnTop ? ((_a = this.props.labelStyle) !== null && _a !== void 0 ? _a : {}) : _super.prototype.getLabelStyle.call(this);
42
43
  };
43
44
  XInputTextarea.prototype.render = function () {
44
- var _a;
45
+ var _a, _b;
46
+ var fieldStyle = undefined;
47
+ var labelStyle = this.getLabelStyle();
45
48
  var inputStyle = (_a = this.props.inputStyle) !== null && _a !== void 0 ? _a : {};
46
49
  var cols;
47
50
  if (this.props.cols === "full") {
48
51
  cols = undefined;
49
52
  // pridame width:100%
50
- // ak nemame labelOnTop=true, musime odratat sirku labelu, inac sa label dostane nad input (koli flex-wrap: wrap)
51
- var widthValue = this.props.labelOnTop ? '100%' : "calc(100% - ".concat(XUtils_1.XUtils.FIELD_LABEL_WIDTH, ")");
53
+ //fieldStyle = {width: '100%'};
54
+ var widthValue = void 0;
55
+ if (this.props.labelOnTop) {
56
+ widthValue = '100%';
57
+ }
58
+ else {
59
+ // ak nemame labelOnTop=true, musime odratat sirku labelu, inac sa label dostane nad input (koli flex-wrap: wrap)
60
+ var labelStyleWidth = labelStyle.width;
61
+ if (labelStyleWidth) {
62
+ widthValue = "calc(100% - ".concat(labelStyleWidth, ")");
63
+ }
64
+ else {
65
+ widthValue = '100%';
66
+ }
67
+ }
52
68
  XUtils_1.XUtils.addCssPropIfNotExists(inputStyle, { width: widthValue });
53
69
  }
54
70
  else {
@@ -57,11 +73,20 @@ var XInputTextarea = /** @class */ (function (_super) {
57
73
  // aj tak sa asi vzdy bude pouzivat "full"
58
74
  cols = this.props.cols;
59
75
  }
76
+ var value = this.getValue();
77
+ var labelTooltip = undefined;
78
+ var labelElemId = undefined;
79
+ if (value !== null) {
80
+ // nevidno placeholder, tak zobrazime desc ako label tooltip
81
+ labelTooltip = this.props.desc;
82
+ labelElemId = "".concat(this.props.field, "_label_id");
83
+ }
60
84
  // InputTextarea renderujeme az ked mame nacitany object, lebo inac pri autoResize sa nam nenastavi spravna velkost (hodnota nie je k dispozicii pri prvom renderingu)
61
- return (react_1.default.createElement("div", { className: !this.props.labelOnTop ? 'field grid' : 'field grid x-inputtextarea-label-on-top' },
62
- react_1.default.createElement("label", { htmlFor: this.props.field, className: !this.props.labelOnTop ? 'col-fixed' : undefined, style: this.getLabelStyle() }, this.getLabel()),
85
+ return (react_1.default.createElement("div", { className: !this.props.labelOnTop ? 'field grid' : 'field grid x-inputtextarea-label-on-top', style: fieldStyle },
86
+ react_1.default.createElement("label", { id: labelElemId, htmlFor: this.props.field, className: !this.props.labelOnTop ? 'col-fixed' : undefined, style: labelStyle }, this.getLabel()),
87
+ labelTooltip ? react_1.default.createElement(tooltip_1.Tooltip, { target: "#".concat(labelElemId), content: labelTooltip }) : null,
63
88
  this.props.form.state.object ?
64
- react_1.default.createElement(XInputTextareaBase_1.XInputTextareaBase, { id: this.props.field, value: this.getValue(), onChange: this.onValueChange, readOnly: this.isReadOnly(), maxLength: this.xField.length, style: inputStyle, rows: this.props.rows, cols: cols, autoResize: this.props.autoResize, error: this.getError() })
89
+ react_1.default.createElement(XInputTextareaBase_1.XInputTextareaBase, { id: this.props.field, value: value, onChange: this.onValueChange, readOnly: this.isReadOnly(), maxLength: this.xField.length, style: inputStyle, rows: this.props.rows, cols: cols, autoResize: this.props.autoResize, error: this.getError(), tooltip: this.props.tooltip, placeholder: (_b = this.props.placeholder) !== null && _b !== void 0 ? _b : this.props.desc })
65
90
  : null));
66
91
  };
67
92
  XInputTextarea.defaultProps = {
@@ -10,4 +10,6 @@ export declare const XInputTextareaBase: (props: {
10
10
  error?: string | undefined;
11
11
  style?: React.CSSProperties | undefined;
12
12
  maxLength?: number | undefined;
13
- }) => JSX.Element;
13
+ tooltip?: string | undefined;
14
+ placeholder?: string | undefined;
15
+ }) => React.JSX.Element;
@@ -86,6 +86,6 @@ var XInputTextareaBase = function (props) {
86
86
  }
87
87
  return inputValue;
88
88
  };
89
- return (react_1.default.createElement(inputtextarea_1.InputTextarea, __assign({ id: props.id, value: getInputValue(), onChange: onChange, onBlur: onBlur, readOnly: props.readOnly, maxLength: props.maxLength, style: props.style, rows: props.rows, cols: props.cols, autoResize: props.autoResize }, XUtils_1.XUtils.createErrorProps(props.error))));
89
+ return (react_1.default.createElement(inputtextarea_1.InputTextarea, __assign({ id: props.id, value: getInputValue(), onChange: onChange, onBlur: onBlur, readOnly: props.readOnly, maxLength: props.maxLength, style: props.style, rows: props.rows, cols: props.cols, autoResize: props.autoResize }, XUtils_1.XUtils.createTooltipOrErrorProps(props.error, props.tooltip), { placeholder: props.placeholder })));
90
90
  };
91
91
  exports.XInputTextareaBase = XInputTextareaBase;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  import { XInputDT, XInputDTProps } from "./XInputDT";
3
3
  export interface XInputTextareaDTProps extends XInputDTProps {
4
4
  rows: number;
@@ -8,5 +8,5 @@ export declare class XInputTextareaDT extends XInputDT<XInputTextareaDTProps> {
8
8
  constructor(props: XInputTextareaDTProps);
9
9
  getValue(): string | null;
10
10
  onValueChange(value: string | null): void;
11
- render(): JSX.Element;
11
+ render(): React.JSX.Element;
12
12
  }
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { ExportType, LazyDataTableQueryParam } from "../../serverApi/ExportImportParam";
2
+ import React from "react";
3
3
  export interface XExportParams {
4
4
  rowCount: number;
5
5
  existsToManyAssoc: boolean;
@@ -17,4 +17,4 @@ export declare const XExportRowsDialog: (props: {
17
17
  dialogState: XExportRowsDialogState;
18
18
  hideDialog: () => void;
19
19
  exportTypeOptions?: ExportType[];
20
- }) => JSX.Element;
20
+ }) => React.JSX.Element;
@@ -185,20 +185,20 @@ var XExportRowsDialog = function (props) {
185
185
  if ((_a = props.dialogState.exportParams) === null || _a === void 0 ? void 0 : _a.existsToManyAssoc) {
186
186
  elem.push(react_1.default.createElement("div", { key: "expDetailRowsExport", className: "field grid" },
187
187
  react_1.default.createElement("label", { className: "col-fixed", style: { width: '12rem' } }, (0, XLocale_1.xLocaleOption)('expDetailRowsExport')),
188
- react_1.default.createElement(dropdown_1.Dropdown, { value: detailRowsExport, options: XUtils_1.XUtils.multilineExportTypeOptions, onChange: function (e) { return setDetailRowsExport(e.value); } })));
188
+ react_1.default.createElement(dropdown_1.Dropdown, { value: detailRowsExport, options: XUtils_1.XUtils.options(XUtils_1.XUtils.multilineExportTypeOptions), onChange: function (e) { return setDetailRowsExport(e.value); } })));
189
189
  }
190
190
  }
191
191
  if (exportType === ExportImportParam_1.ExportType.Csv) {
192
192
  elem.push([
193
193
  react_1.default.createElement("div", { key: "expCsvSeparator", className: "field grid" },
194
194
  react_1.default.createElement("label", { className: "col-fixed", style: { width: '12rem' } }, (0, XLocale_1.xLocaleOption)('expCsvSeparator')),
195
- react_1.default.createElement(dropdown_1.Dropdown, { value: csvSeparator, options: XUtils_1.XUtils.csvSeparatorOptions, onChange: function (e) { return setCsvSeparator(e.value); } })),
195
+ react_1.default.createElement(dropdown_1.Dropdown, { value: csvSeparator, options: XUtils_1.XUtils.options(XUtils_1.XUtils.csvSeparatorOptions), onChange: function (e) { return setCsvSeparator(e.value); } })),
196
196
  react_1.default.createElement("div", { key: "expDecimalFormat", className: "field grid" },
197
197
  react_1.default.createElement("label", { className: "col-fixed", style: { width: '12rem' } }, (0, XLocale_1.xLocaleOption)('expDecimalFormat')),
198
- react_1.default.createElement(dropdown_1.Dropdown, { value: decimalFormat, options: XUtils_1.XUtils.decimalFormatOptions, onChange: function (e) { return setDecimalFormat(e.value); } })),
198
+ react_1.default.createElement(dropdown_1.Dropdown, { value: decimalFormat, options: XUtils_1.XUtils.options(XUtils_1.XUtils.decimalFormatOptions), onChange: function (e) { return setDecimalFormat(e.value); } })),
199
199
  react_1.default.createElement("div", { key: "expEncoding", className: "field grid" },
200
200
  react_1.default.createElement("label", { className: "col-fixed", style: { width: '12rem' } }, (0, XLocale_1.xLocaleOption)('expEncoding')),
201
- react_1.default.createElement(dropdown_1.Dropdown, { value: csvEncoding, options: XUtils_1.XUtils.csvEncodingOptions, onChange: function (e) { return setCsvEncoding(e.value); } }))
201
+ react_1.default.createElement(dropdown_1.Dropdown, { value: csvEncoding, options: XUtils_1.XUtils.options(XUtils_1.XUtils.csvEncodingOptions), onChange: function (e) { return setCsvEncoding(e.value); } }))
202
202
  ]);
203
203
  }
204
204
  }
@@ -211,7 +211,7 @@ var XExportRowsDialog = function (props) {
211
211
  : null,
212
212
  react_1.default.createElement("div", { key: "expExportType", className: "field grid" },
213
213
  react_1.default.createElement("label", { className: "col-fixed", style: { width: '12rem' } }, (0, XLocale_1.xLocaleOption)('expExportType')),
214
- react_1.default.createElement(dropdown_1.Dropdown, { value: exportType, options: (_e = props.exportTypeOptions) !== null && _e !== void 0 ? _e : XUtils_1.XUtils.exportTypeOptions, onChange: function (e) { return setExportType(e.value); } })),
214
+ react_1.default.createElement(dropdown_1.Dropdown, { value: exportType, options: XUtils_1.XUtils.options((_e = props.exportTypeOptions) !== null && _e !== void 0 ? _e : XUtils_1.XUtils.exportTypeOptions), onChange: function (e) { return setExportType(e.value); } })),
215
215
  elem,
216
216
  react_1.default.createElement("div", { key: "exportRows", className: "flex justify-content-center" },
217
217
  react_1.default.createElement(XButton_1.XButton, { label: (0, XLocale_1.xLocaleOption)('exportRows'), onClick: onExport }))));
@@ -75,7 +75,7 @@ export interface XLazyDataTableProps {
75
75
  children: ReactChild[];
76
76
  }
77
77
  export declare const XLazyDataTable: {
78
- (props: XLazyDataTableProps): JSX.Element;
78
+ (props: XLazyDataTableProps): React.JSX.Element;
79
79
  defaultProps: {
80
80
  paginator: boolean;
81
81
  rows: number;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  import { XMultilineRenderType } from "./XLazyDataTable";
3
3
  export declare const XMultilineSwitch: (props: {
4
4
  value: XMultilineRenderType;
5
5
  onChange: (value: XMultilineRenderType) => void;
6
6
  className?: string | undefined;
7
- }) => JSX.Element;
7
+ }) => React.JSX.Element;
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  import { XOptionalCustomFilter } from "./XLazyDataTable";
3
3
  export declare const XOcfDropdown: (props: {
4
4
  optionalCustomFilters: XOptionalCustomFilter[];
5
5
  value: XOptionalCustomFilter | undefined;
6
6
  onChange: (value: XOptionalCustomFilter | undefined) => void;
7
7
  className?: string | undefined;
8
- }) => JSX.Element;
8
+ }) => React.JSX.Element;
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { XToken } from "./XToken";
3
3
  export declare const XLoginDialog: (props: {
4
4
  dialogOpened: boolean;
5
5
  setXToken: (xToken: XToken | null) => void;
6
6
  onHideDialog: (ok: boolean) => void;
7
7
  customUserService?: string | undefined;
8
- }) => JSX.Element;
8
+ }) => React.JSX.Element;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
2
1
  import { XToken } from "./XToken";
2
+ import React from "react";
3
3
  export declare const XLoginForm: (props: {
4
4
  setXToken: (xToken: XToken | null) => void;
5
5
  onLogin?: (() => void) | undefined;
6
6
  customUserService?: string | undefined;
7
- }) => JSX.Element;
7
+ }) => React.JSX.Element;
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import { XFilterProp, XFormComponent, XFormComponentProps } from "./XFormComponent";
3
+ import { XAssoc } from "../serverApi/XEntityMetadata";
4
+ import { XObject } from "./XObject";
5
+ import { DataTableSortMeta } from "primereact/datatable";
6
+ export interface XMultiSelectProps extends XFormComponentProps<XObject> {
7
+ assocToMany: string;
8
+ assocManyToOne?: string;
9
+ displayField: string;
10
+ filter?: XFilterProp;
11
+ sortField?: string | DataTableSortMeta[];
12
+ fields?: string[];
13
+ width?: string;
14
+ scrollHeight?: string;
15
+ }
16
+ export declare class XMultiSelect extends XFormComponent<XObject, XMultiSelectProps> {
17
+ protected xAssocToMany: XAssoc;
18
+ protected xAssocManyToOne?: XAssoc;
19
+ constructor(props: XMultiSelectProps);
20
+ getField(): string;
21
+ isNotNull(): boolean;
22
+ getValue(): any[];
23
+ onChange(value: any[]): void;
24
+ render(): React.JSX.Element;
25
+ }
@@ -0,0 +1,97 @@
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.XMultiSelect = void 0;
22
+ var react_1 = __importDefault(require("react"));
23
+ var XFormComponent_1 = require("./XFormComponent");
24
+ var XUtilsMetadataCommon_1 = require("../serverApi/XUtilsMetadataCommon");
25
+ var XMultiSelectBase_1 = require("./XMultiSelectBase");
26
+ var XUtilsCommon_1 = require("../serverApi/XUtilsCommon");
27
+ var XMultiSelect = /** @class */ (function (_super) {
28
+ __extends(XMultiSelect, _super);
29
+ function XMultiSelect(props) {
30
+ var _this = _super.call(this, props) || this;
31
+ _this.xAssocToMany = XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXAssocToManyByPath(XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXEntity(props.form.getEntity()), props.assocToMany);
32
+ if (props.assocManyToOne) {
33
+ _this.xAssocManyToOne = XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXAssocToOneByPath(XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXEntity(_this.xAssocToMany.entityName), props.assocManyToOne);
34
+ }
35
+ if (props.assocManyToOne) {
36
+ props.form.addField(props.assocToMany + '.' + props.assocManyToOne + '.' + props.displayField);
37
+ }
38
+ else {
39
+ props.form.addField(props.assocToMany + '.' + props.displayField);
40
+ }
41
+ _this.onChange = _this.onChange.bind(_this);
42
+ return _this;
43
+ }
44
+ XMultiSelect.prototype.getField = function () {
45
+ return this.props.assocToMany;
46
+ };
47
+ XMultiSelect.prototype.isNotNull = function () {
48
+ return !this.xAssocToMany.isNullable;
49
+ };
50
+ XMultiSelect.prototype.getValue = function () {
51
+ var _this = this;
52
+ var optionRowList;
53
+ var rowList = this.getValueFromObject();
54
+ if (this.props.assocManyToOne) {
55
+ // assoc "assocToMany" contains link rows - these link rows have to be transformed to option rows
56
+ if (rowList !== null) {
57
+ optionRowList = rowList.map(function (linkRow) { return XUtilsCommon_1.XUtilsCommon.getValueByPath(linkRow, _this.props.assocManyToOne); });
58
+ }
59
+ else {
60
+ // this.props.form.state.object was not initialised yet
61
+ optionRowList = [];
62
+ }
63
+ }
64
+ else {
65
+ // assoc "assocToMany" contains option rows - no transformation needed
66
+ optionRowList = rowList !== null && rowList !== void 0 ? rowList : [];
67
+ }
68
+ return optionRowList;
69
+ };
70
+ XMultiSelect.prototype.onChange = function (value) {
71
+ var _this = this;
72
+ // value coming from XMultiSelectBase is list of selected option rows
73
+ var rowList;
74
+ if (this.props.assocManyToOne) {
75
+ // assoc "assocToMany" expects link rows - we wrap options row into link rows, id is left undefined,
76
+ // during save will be all old links deleted and these new links will be inserted (because id is undefined)
77
+ rowList = value.map(function (optionRow) {
78
+ var linkRow = {};
79
+ linkRow[_this.props.assocManyToOne] = optionRow;
80
+ return linkRow;
81
+ });
82
+ }
83
+ else {
84
+ // assoc "assocToMany" expects option rows - no transformation needed
85
+ rowList = value;
86
+ }
87
+ this.onValueChangeBase(rowList, this.props.onChange);
88
+ };
89
+ XMultiSelect.prototype.render = function () {
90
+ var _this = this;
91
+ return (react_1.default.createElement("div", { className: "field grid" },
92
+ react_1.default.createElement("label", { htmlFor: this.props.assocToMany, className: "col-fixed", style: this.getLabelStyle() }, this.getLabel()),
93
+ react_1.default.createElement(XMultiSelectBase_1.XMultiSelectBase, { value: this.getValue(), onChange: this.onChange, displayField: this.props.displayField, optionsQuery: { entity: this.xAssocManyToOne ? this.xAssocManyToOne.entityName : this.xAssocToMany.entityName, filter: function () { return _this.getFilterBase(_this.props.filter); }, sortField: this.props.sortField, fields: this.props.fields }, width: this.props.width, scrollHeight: this.props.scrollHeight, readOnly: this.isReadOnly(), error: this.getError() })));
94
+ };
95
+ return XMultiSelect;
96
+ }(XFormComponent_1.XFormComponent));
97
+ exports.XMultiSelect = XMultiSelect;