@michalrakus/x-react-web-lib 0.25.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/LICENSE.md +21 -0
  2. package/XEnvVars.d.ts +3 -0
  3. package/XEnvVars.js +5 -0
  4. package/XInputTextarea.d.ts +3 -0
  5. package/XInputTextarea.js +5 -0
  6. package/gulpfile.js +2 -0
  7. package/lib/administration/XBrowseMetaForm.js +1 -1
  8. package/lib/administration/XUserBrowse.js +5 -4
  9. package/lib/administration/XUserForm.js +40 -28
  10. package/lib/components/SourceCodeLinkEntity.js +1 -1
  11. package/lib/components/XAutoComplete.d.ts +3 -3
  12. package/lib/components/XAutoComplete.js +16 -37
  13. package/lib/components/XAutoCompleteBase.d.ts +1 -1
  14. package/lib/components/XAutoCompleteBase.js +23 -22
  15. package/lib/components/XBrowse.js +7 -3
  16. package/lib/components/XChangePasswordForm.js +9 -5
  17. package/lib/components/XCheckbox.d.ts +8 -9
  18. package/lib/components/XCheckbox.js +38 -30
  19. package/lib/components/XDataTable.js +11 -7
  20. package/lib/components/XDropdown.d.ts +4 -3
  21. package/lib/components/XDropdown.js +21 -44
  22. package/lib/components/XDropdownDT.js +7 -3
  23. package/lib/components/XDropdownDTFilter.js +9 -5
  24. package/lib/components/XDropdownFormDTFilter.js +9 -5
  25. package/lib/components/XEditColumnDialog.js +9 -5
  26. package/lib/components/XEnvVars.d.ts +12 -0
  27. package/lib/components/XEnvVars.js +20 -0
  28. package/lib/components/XErrors.d.ts +1 -0
  29. package/lib/components/XExportRowsDialog.js +12 -6
  30. package/lib/components/XFieldSelector.js +8 -4
  31. package/lib/components/XFormBase.d.ts +1 -0
  32. package/lib/components/XFormBase.js +47 -21
  33. package/lib/components/XFormComponent.d.ts +10 -6
  34. package/lib/components/XFormComponent.js +60 -48
  35. package/lib/components/XFormDataTable2.d.ts +8 -3
  36. package/lib/components/XFormDataTable2.js +106 -28
  37. package/lib/components/XFormNavigator3.js +14 -6
  38. package/lib/components/XInput.d.ts +13 -0
  39. package/lib/components/XInput.js +38 -0
  40. package/lib/components/XInputDate.js +1 -1
  41. package/lib/components/XInputDateDT.js +1 -1
  42. package/lib/components/XInputText.d.ts +6 -11
  43. package/lib/components/XInputText.js +14 -49
  44. package/lib/components/XInputTextDT.js +2 -3
  45. package/lib/components/XInputTextarea.d.ts +18 -0
  46. package/lib/components/XInputTextarea.js +85 -0
  47. package/lib/components/XLazyDataTable.d.ts +3 -0
  48. package/lib/components/XLazyDataTable.js +162 -77
  49. package/lib/components/XLoginForm.js +9 -5
  50. package/lib/components/XResponseError.js +1 -1
  51. package/lib/components/XSearchButton.d.ts +2 -3
  52. package/lib/components/XSearchButton.js +12 -35
  53. package/lib/components/XSearchButtonDT.js +10 -6
  54. package/lib/components/XSearchButtonOld.js +10 -6
  55. package/lib/components/XToken.d.ts +4 -3
  56. package/lib/components/XUtils.d.ts +13 -4
  57. package/lib/components/XUtils.js +90 -15
  58. package/lib/components/XUtilsConversions.js +10 -2
  59. package/lib/components/XUtilsMetadata.d.ts +1 -1
  60. package/lib/components/XUtilsMetadata.js +20 -11
  61. package/lib/components/useXToken.js +1 -1
  62. package/lib/serverApi/ExportImportParam.d.ts +3 -3
  63. package/lib/serverApi/FindParam.d.ts +3 -13
  64. package/lib/serverApi/FindParam.js +14 -0
  65. package/lib/serverApi/XUser.d.ts +1 -0
  66. package/lib/serverApi/XUtilsCommon.js +2 -2
  67. package/package.json +34 -32
@@ -31,68 +31,33 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
32
  exports.XInputText = void 0;
33
33
  var react_1 = __importDefault(require("react"));
34
- var XUtilsMetadata_1 = require("./XUtilsMetadata");
35
- var XUtils_1 = require("./XUtils");
36
34
  var XUtilsConversions_1 = require("./XUtilsConversions");
37
- var XUtilsCommon_1 = require("../serverApi/XUtilsCommon");
38
35
  var inputtext_1 = require("primereact/inputtext");
39
- var XFormComponent_1 = require("./XFormComponent");
36
+ var XInput_1 = require("./XInput");
40
37
  var XInputText = /** @class */ (function (_super) {
41
38
  __extends(XInputText, _super);
42
39
  function XInputText(props) {
43
40
  var _this = _super.call(this, props) || this;
44
- _this.xField = XUtilsMetadata_1.XUtilsMetadata.getXFieldByPathStr(props.form.getEntity(), props.field);
45
- props.form.addField(props.field);
41
+ _this.onValueChange = _this.onValueChange.bind(_this);
46
42
  return _this;
47
43
  }
48
- // TODO - prerobit - len field nech vracia
49
- XInputText.prototype.getFieldForEdit = function () {
50
- // TODO - zohladnit aj aktualny readOnly stav
51
- if (!XUtils_1.XUtils.isReadOnly(this.props.field, this.props.readOnly)) {
52
- return this.props.field;
53
- }
54
- return undefined;
55
- };
56
- XInputText.prototype.checkNotNull = function () {
57
- // TODO - zohladnit aj aktualny readOnly stav
58
- return !this.xField.isNullable && !XUtils_1.XUtils.isReadOnly(this.props.field, this.props.readOnly);
44
+ XInputText.prototype.getValue = function () {
45
+ // konvertovat null hodnotu na "" (vo funkcii stringAsUI) je dolezite aby sa prejavila zmena na null v modeli
46
+ var value = this.getValueFromObject();
47
+ return (0, XUtilsConversions_1.stringAsUI)(value);
59
48
  };
60
- XInputText.prototype.getValueFromObject = function () {
61
- var objectValue = null;
62
- var object = this.props.form.state.object;
63
- if (object !== null) {
64
- objectValue = XUtilsCommon_1.XUtilsCommon.getValueByPath(object, this.props.field);
65
- // pre istotu dame na null, null je standard
66
- if (objectValue === undefined) {
67
- objectValue = null;
68
- }
69
- }
70
- return objectValue;
49
+ XInputText.prototype.onValueChange = function (e) {
50
+ var value = (0, XUtilsConversions_1.stringFromUI)(e.target.value);
51
+ this.onValueChangeBase(value);
71
52
  };
72
53
  XInputText.prototype.render = function () {
73
- var _this = this;
74
- var _a, _b, _c;
75
- var props = this.props;
76
- var xField = this.xField;
77
- var label = (_a = props.label) !== null && _a !== void 0 ? _a : props.field;
78
- if (this.checkNotNull()) {
79
- label = XUtils_1.XUtils.markNotNull(label);
80
- }
81
- var readOnly = XUtils_1.XUtils.isReadOnly(props.field, props.readOnly);
82
- var size = (_b = props.size) !== null && _b !== void 0 ? _b : xField.length;
83
- var labelStyle = (_c = props.labelStyle) !== null && _c !== void 0 ? _c : { width: XUtils_1.XUtils.FIELD_LABEL_WIDTH };
84
- var onValueChange = function (e) {
85
- var value = XUtilsConversions_1.stringFromUI(e.target.value);
86
- var error = _this.validateOnChange(value);
87
- props.form.onFieldChange(props.field, value, error);
88
- };
89
- // konvertovat null hodnotu na "" (vo funkcii stringAsUI) je dolezite aby sa prejavila zmena na null v modeli
90
- var fieldValue = XUtilsConversions_1.stringAsUI(this.getValueFromObject());
54
+ var _a;
55
+ var size = (_a = this.props.size) !== null && _a !== void 0 ? _a : this.xField.length;
91
56
  // note: style overrides size (width of the input according to character count)
92
57
  return (react_1.default.createElement("div", { className: "field grid" },
93
- react_1.default.createElement("label", { htmlFor: props.field, className: "col-fixed", style: labelStyle }, label),
94
- react_1.default.createElement(inputtext_1.InputText, __assign({ id: props.field, value: fieldValue, onChange: onValueChange, readOnly: readOnly, maxLength: xField.length, size: size, style: props.inputStyle }, this.getClassNameTooltip()))));
58
+ react_1.default.createElement("label", { htmlFor: this.props.field, className: "col-fixed", style: this.getLabelStyle() }, this.getLabel()),
59
+ 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()))));
95
60
  };
96
61
  return XInputText;
97
- }(XFormComponent_1.XFormComponent));
62
+ }(XInput_1.XInput));
98
63
  exports.XInputText = XInputText;
@@ -21,9 +21,8 @@ var XInputTextDT = function (props) {
21
21
  readOnly = props.readOnly !== undefined ? props.readOnly : false;
22
22
  }
23
23
  var onValueChange = function (field, rowData, newValue) {
24
- //console.log("onBodyValueChange");
25
24
  // zmenime hodnotu v modeli (odtial sa hodnota cita)
26
- rowData[field] = XUtilsConversions_1.stringFromUI(newValue);
25
+ rowData[field] = (0, XUtilsConversions_1.stringFromUI)(newValue);
27
26
  // kedze "rowData" je sucastou "props.form.state.object", tak nam staci zavolat setState({object: object}), aby sa zmena prejavila
28
27
  props.form.onObjectDataChange();
29
28
  };
@@ -36,7 +35,7 @@ var XInputTextDT = function (props) {
36
35
  rowDataValue = null;
37
36
  }
38
37
  // konvertovat null hodnotu na "" (vo funkcii stringAsUI) je dolezite aby sa prejavila zmena na null v modeli (a tiez aby korektne pridal novy riadok)
39
- fieldValue = XUtilsConversions_1.stringAsUI(rowDataValue);
38
+ fieldValue = (0, XUtilsConversions_1.stringAsUI)(rowDataValue);
40
39
  }
41
40
  return (react_1.default.createElement(inputtext_1.InputText, { id: props.field, value: fieldValue, onChange: function (e) { return onValueChange(props.field, props.rowData, e.target.value); }, readOnly: readOnly, maxLength: xField.length, className: "x-input-to-resize" }));
42
41
  };
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import { XInput, XInputProps } from "./XInput";
3
+ export interface XInputTextareaProps extends XInputProps {
4
+ rows: number;
5
+ cols?: number | "full";
6
+ labelOnTop?: boolean;
7
+ }
8
+ export declare class XInputTextarea extends XInput<XInputTextareaProps> {
9
+ static defaultProps: {
10
+ cols: string;
11
+ labelOnTop: boolean;
12
+ };
13
+ constructor(props: XInputTextareaProps);
14
+ getValue(): string;
15
+ onValueChange(e: any): void;
16
+ getLabelStyle(): React.CSSProperties;
17
+ render(): JSX.Element;
18
+ }
@@ -0,0 +1,85 @@
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 __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
28
+ var __importDefault = (this && this.__importDefault) || function (mod) {
29
+ return (mod && mod.__esModule) ? mod : { "default": mod };
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.XInputTextarea = void 0;
33
+ var react_1 = __importDefault(require("react"));
34
+ var XUtilsConversions_1 = require("./XUtilsConversions");
35
+ var XInput_1 = require("./XInput");
36
+ var inputtextarea_1 = require("primereact/inputtextarea");
37
+ var XUtils_1 = require("./XUtils");
38
+ var XInputTextarea = /** @class */ (function (_super) {
39
+ __extends(XInputTextarea, _super);
40
+ function XInputTextarea(props) {
41
+ var _this = _super.call(this, props) || this;
42
+ _this.onValueChange = _this.onValueChange.bind(_this);
43
+ return _this;
44
+ }
45
+ XInputTextarea.prototype.getValue = function () {
46
+ // konvertovat null hodnotu na "" (vo funkcii stringAsUI) je dolezite aby sa prejavila zmena na null v modeli
47
+ var value = this.getValueFromObject();
48
+ return (0, XUtilsConversions_1.stringAsUI)(value);
49
+ };
50
+ XInputTextarea.prototype.onValueChange = function (e) {
51
+ var value = (0, XUtilsConversions_1.stringFromUI)(e.target.value);
52
+ this.onValueChangeBase(value);
53
+ };
54
+ XInputTextarea.prototype.getLabelStyle = function () {
55
+ var _a;
56
+ return this.props.labelOnTop ? ((_a = this.props.labelStyle) !== null && _a !== void 0 ? _a : {}) : _super.prototype.getLabelStyle.call(this);
57
+ };
58
+ XInputTextarea.prototype.render = function () {
59
+ var _a;
60
+ var inputStyle = (_a = this.props.inputStyle) !== null && _a !== void 0 ? _a : {};
61
+ var cols;
62
+ if (this.props.cols === "full") {
63
+ cols = undefined;
64
+ // pridame width:100%
65
+ // ak nemame labelOnTop=true, musime odratat sirku labelu, inac sa label dostane nad input (koli flex-wrap: wrap)
66
+ var widthValue = this.props.labelOnTop ? '100%' : "calc(100% - ".concat(XUtils_1.XUtils.FIELD_LABEL_WIDTH, ")");
67
+ XUtils_1.XUtils.addCssPropIfNotExists(inputStyle, { width: widthValue });
68
+ }
69
+ else {
70
+ // TODO - nastavenie cols nefunguje ak labelOnTop=true - vtedy je input roztiahnuty na 100%
71
+ // roztiahnutie na 100% sposobuje .x-inputtextarea-label-on-top {flex-direction: column;}
72
+ // aj tak sa asi vzdy bude pouzivat "full"
73
+ cols = this.props.cols;
74
+ }
75
+ return (react_1.default.createElement("div", { className: !this.props.labelOnTop ? 'field grid' : 'field grid x-inputtextarea-label-on-top' },
76
+ react_1.default.createElement("label", { htmlFor: this.props.field, className: !this.props.labelOnTop ? 'col-fixed' : undefined, style: this.getLabelStyle() }, this.getLabel()),
77
+ react_1.default.createElement(inputtextarea_1.InputTextarea, __assign({ 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 }, this.getClassNameTooltip()))));
78
+ };
79
+ XInputTextarea.defaultProps = {
80
+ cols: "full",
81
+ labelOnTop: false
82
+ };
83
+ return XInputTextarea;
84
+ }(XInput_1.XInput));
85
+ exports.XInputTextarea = XInputTextarea;
@@ -15,6 +15,7 @@ export interface XLazyDataTableProps {
15
15
  dataKey?: string;
16
16
  paginator: boolean;
17
17
  rows: number;
18
+ filterDisplay: "menu" | "row";
18
19
  scrollable: boolean;
19
20
  scrollWidth: string;
20
21
  scrollHeight: string;
@@ -36,6 +37,7 @@ export declare const XLazyDataTable: {
36
37
  defaultProps: {
37
38
  paginator: boolean;
38
39
  rows: number;
40
+ filterDisplay: string;
39
41
  scrollable: boolean;
40
42
  scrollWidth: string;
41
43
  scrollHeight: string;
@@ -47,6 +49,7 @@ export interface XLazyColumnProps {
47
49
  header?: any;
48
50
  align?: "left" | "center" | "right";
49
51
  dropdownInFilter?: boolean;
52
+ showFilterMenu?: boolean;
50
53
  width?: string;
51
54
  }
52
55
  export declare const XLazyColumn: (props: XLazyColumnProps) => null;