@michalrakus/x-react-web-lib 1.17.0 → 1.19.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 (43) hide show
  1. package/lib/components/XAutoComplete.d.ts +9 -9
  2. package/lib/components/XAutoComplete.js +7 -78
  3. package/lib/components/XAutoCompleteBase.d.ts +39 -7
  4. package/lib/components/XAutoCompleteBase.js +351 -64
  5. package/lib/components/XAutoCompleteDT.d.ts +10 -6
  6. package/lib/components/XAutoCompleteDT.js +3 -69
  7. package/lib/components/XCalendar.d.ts +1 -2
  8. package/lib/components/XCalendar.js +79 -10
  9. package/lib/components/XFormBase.js +5 -1
  10. package/lib/components/XFormComponent.js +9 -6
  11. package/lib/components/XFormDataTable2.d.ts +15 -1
  12. package/lib/components/XFormDataTable2.js +24 -4
  13. package/lib/components/XFormRowCol/XFormCol.d.ts +1 -0
  14. package/lib/components/XFormRowCol/XFormCol.js +1 -1
  15. package/lib/components/XFormRowCol/XFormInlineRow.d.ts +1 -0
  16. package/lib/components/XFormRowCol/XFormInlineRow.js +1 -1
  17. package/lib/components/XFormRowCol/XFormRow.d.ts +1 -0
  18. package/lib/components/XFormRowCol/XFormRow.js +1 -1
  19. package/lib/components/XFormRowCol/XFormRowCol.d.ts +1 -0
  20. package/lib/components/XFormRowCol/XFormRowCol.js +1 -1
  21. package/lib/components/XInputDate.d.ts +0 -1
  22. package/lib/components/XInputDate.js +4 -18
  23. package/lib/components/XInputDateDT.d.ts +9 -10
  24. package/lib/components/XInputDateDT.js +35 -39
  25. package/lib/components/XInputDecimal.js +1 -1
  26. package/lib/components/XInputTextarea.js +1 -1
  27. package/lib/components/XInputTextareaDT.d.ts +12 -0
  28. package/lib/components/XInputTextareaDT.js +44 -0
  29. package/lib/components/XLazyDataTable.d.ts +4 -2
  30. package/lib/components/XLazyDataTable.js +17 -4
  31. package/lib/components/XSearchBrowseParams.d.ts +2 -2
  32. package/lib/components/XSearchButton.js +2 -2
  33. package/lib/components/XSearchButtonDT.js +2 -2
  34. package/lib/components/XUtils.d.ts +4 -0
  35. package/lib/components/XUtils.js +51 -11
  36. package/lib/components/XUtilsMetadata.js +1 -1
  37. package/lib/serverApi/FindParam.d.ts +12 -2
  38. package/lib/serverApi/FindParam.js +3 -2
  39. package/lib/serverApi/XUtilsCommon.d.ts +5 -0
  40. package/lib/serverApi/XUtilsCommon.js +43 -0
  41. package/lib/serverApi/XUtilsConversions.d.ts +1 -0
  42. package/lib/serverApi/XUtilsConversions.js +63 -5
  43. package/package.json +1 -1
@@ -14,42 +14,6 @@ var __extends = (this && this.__extends) || (function () {
14
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
15
  };
16
16
  })();
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
17
  var __importDefault = (this && this.__importDefault) || function (mod) {
54
18
  return (mod && mod.__esModule) ? mod : { "default": mod };
55
19
  };
@@ -57,7 +21,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
57
21
  exports.XAutoCompleteDT = void 0;
58
22
  var react_1 = __importDefault(require("react"));
59
23
  var XFormComponentDT_1 = require("./XFormComponentDT");
60
- var XUtils_1 = require("./XUtils");
61
24
  var XAutoCompleteBase_1 = require("./XAutoCompleteBase");
62
25
  var XUtilsMetadataCommon_1 = require("../serverApi/XUtilsMetadataCommon");
63
26
  var XAutoCompleteDT = /** @class */ (function (_super) {
@@ -66,33 +29,12 @@ var XAutoCompleteDT = /** @class */ (function (_super) {
66
29
  var _this = _super.call(this, props) || this;
67
30
  _this.xAssoc = XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXAssocToOne(XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXEntity(props.entity), props.assocField);
68
31
  _this.errorInBase = undefined;
69
- _this.state = {
70
- suggestions: []
71
- };
72
32
  _this.onChangeAutoCompleteBase = _this.onChangeAutoCompleteBase.bind(_this);
73
33
  _this.onErrorChangeAutoCompleteBase = _this.onErrorChangeAutoCompleteBase.bind(_this);
74
34
  return _this;
75
35
  }
76
- XAutoCompleteDT.prototype.componentDidMount = function () {
77
- this.readAndSetSuggestions();
78
- };
79
- XAutoCompleteDT.prototype.readAndSetSuggestions = function () {
80
- return __awaiter(this, void 0, void 0, function () {
81
- var suggestions;
82
- return __generator(this, function (_a) {
83
- switch (_a.label) {
84
- case 0:
85
- if (!(this.props.suggestions === undefined)) return [3 /*break*/, 2];
86
- return [4 /*yield*/, XUtils_1.XUtils.fetchRows(this.xAssoc.entityName, this.getFilterBase(this.props.filter), this.props.displayField)];
87
- case 1:
88
- suggestions = _a.sent();
89
- this.setState({ suggestions: suggestions });
90
- _a.label = 2;
91
- case 2: return [2 /*return*/];
92
- }
93
- });
94
- });
95
- };
36
+ // componentDidMount() {
37
+ // }
96
38
  XAutoCompleteDT.prototype.getField = function () {
97
39
  return this.props.assocField;
98
40
  };
@@ -105,13 +47,6 @@ var XAutoCompleteDT = /** @class */ (function (_super) {
105
47
  };
106
48
  XAutoCompleteDT.prototype.onChangeAutoCompleteBase = function (object, objectChange) {
107
49
  this.onValueChangeBase(object, this.props.onChange, objectChange);
108
- if (objectChange !== XUtils_1.OperationType.None) {
109
- // zmenil sa zaznam dobrovolnika v DB
110
- // zatial len refreshneme z DB
111
- // ak by bol reqest pomaly, mozme pri inserte (nove id) / update (existujuce id) upravit zoznam a usetrime tym request do DB
112
- // ak bol delete (dobrovolnik === null), treba urobit refresh do DB (alebo si poslat id-cko zmazaneho zaznamu)
113
- this.readAndSetSuggestions();
114
- }
115
50
  };
116
51
  XAutoCompleteDT.prototype.onErrorChangeAutoCompleteBase = function (error) {
117
52
  this.errorInBase = error; // odlozime si error
@@ -128,13 +63,12 @@ var XAutoCompleteDT = /** @class */ (function (_super) {
128
63
  };
129
64
  XAutoCompleteDT.prototype.render = function () {
130
65
  var _this = this;
131
- var _a;
132
66
  var xEntityAssoc = XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXEntity(this.xAssoc.entityName);
133
67
  //const xDisplayField = XUtilsMetadataCommon.getXFieldByPath(xEntityAssoc, this.props.displayField);
134
68
  // TODO - size
135
69
  //const size = this.props.size ?? xDisplayField.length;
136
70
  // div className="col" nam zabezpeci aby XAutoCompleteBase nezaberal celu dlzku grid-u (ma nastaveny width=100% vdaka "formgroup-inline")
137
- return (react_1.default.createElement(XAutoCompleteBase_1.XAutoCompleteBase, { value: this.getValue(), suggestions: (_a = this.props.suggestions) !== null && _a !== void 0 ? _a : this.state.suggestions, 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, customFilterFunction: function () { return _this.getFilterBase(_this.props.filter); } }));
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 } }));
138
72
  };
139
73
  return XAutoCompleteDT;
140
74
  }(XFormComponentDT_1.XFormComponentDT));
@@ -1,9 +1,8 @@
1
- import React from "react";
1
+ /// <reference types="react" />
2
2
  export declare const XCalendar: (props: {
3
3
  id?: string | undefined;
4
4
  value: Date | null;
5
5
  onChange: (value: Date | null) => void;
6
- onBlur?: ((event: React.FocusEvent<HTMLInputElement, Element>) => void) | undefined;
7
6
  readOnly?: boolean | undefined;
8
7
  error?: string | undefined;
9
8
  datetime?: boolean | undefined;
@@ -10,30 +10,99 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ var __read = (this && this.__read) || function (o, n) {
37
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
38
+ if (!m) return o;
39
+ var i = m.call(o), r, ar = [], e;
40
+ try {
41
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
42
+ }
43
+ catch (error) { e = { error: error }; }
44
+ finally {
45
+ try {
46
+ if (r && !r.done && (m = i["return"])) m.call(i);
47
+ }
48
+ finally { if (e) throw e.error; }
49
+ }
50
+ return ar;
15
51
  };
16
52
  Object.defineProperty(exports, "__esModule", { value: true });
17
53
  exports.XCalendar = void 0;
18
- var react_1 = __importDefault(require("react"));
54
+ var react_1 = __importStar(require("react"));
19
55
  var calendar_1 = require("primereact/calendar");
20
56
  var XUtilsConversions_1 = require("../serverApi/XUtilsConversions");
21
57
  var XUtils_1 = require("./XUtils");
22
58
  // wrapper for Calendar component, maybe better name would be XInputDateBase
59
+ // TODO - nefunguje rezim datetime pre zapis - dorobit konverziu!
23
60
  var XCalendar = function (props) {
24
61
  var _a;
62
+ // true, ak uzivatel typuje hodnotu
63
+ // false, ak uz uzivatel dotypoval (zavolal sa onBlur) - hodnotu berieme "z hora" (z prop.value)
64
+ var _b = __read((0, react_1.useState)(false), 2), inputChanged = _b[0], setInputChanged = _b[1];
65
+ // pouzivane, len ak inputChanged === true, je tu zapisana zmenena hodnota v inpute
66
+ var _c = __read((0, react_1.useState)(undefined), 2), inputValueState = _c[0], setInputValueState = _c[1];
25
67
  var onChange = function (e) {
26
- // z Calendar prichadza e.value - typ Date alebo null
68
+ // standardne prichadza z Calendar e.value - typ Date alebo null
27
69
  // typ Date prichadza ak uzivatel vyplnil validny datum, null (typeof e.value vracia "object") prichadza ak uzivatel vymazal datum
28
70
  // alebo je este datum nekompletny (uzivatel prave zadava datum)
29
- // ak nastavime keepInvalid={true}, tak bude chodit nevalidny string (typeof e.value vracia "string")
30
- //console.log(typeof e.value);
31
- //console.log(e.value instanceof Date);
32
- if (e.value instanceof Date || e.value === null) {
33
- props.onChange(e.value);
71
+ // nastavili sme keepInvalid={true} -> bude chodit nevalidny string (typeof e.value vracia "string")
72
+ // naviac sme vypli parsovanie na datum (metoda parseDateTime), takze vzdy chodi "string" a konverziu robime v onBlur
73
+ setInputChanged(true);
74
+ setInputValueState(e.value); // vzdycky string
75
+ };
76
+ var onSelect = function (e) {
77
+ // musime tu zavolat props.onChange lebo event select zavola aj onChange ale my umyselne v onChange nevolame props.onChange
78
+ // (cakame na event blur, ktory po selecte nepride)
79
+ props.onChange(e.value); // vzdycky Date
80
+ // pre poriadok resetneme stav
81
+ setInputChanged(false);
82
+ setInputValueState(undefined);
83
+ };
84
+ var onBlur = function (e) {
85
+ if (inputChanged) {
86
+ // poznamka: e.target.value aj inputValueState obsahuju tu istu string hodnotu
87
+ var value = (0, XUtilsConversions_1.dateFromUI)(e.target.value);
88
+ props.onChange(value !== null && value !== void 0 ? value : null); // nekorektnu hodnotu reprezentovanu cez undefined budeme riesit akokeby user zadal null (field sa vyprazdni)
89
+ setInputChanged(false);
90
+ setInputValueState(undefined); // pre poriadok
91
+ }
92
+ };
93
+ var getInputValue = function () {
94
+ var inputValue;
95
+ if (inputChanged) {
96
+ inputValue = inputValueState; // vzdycky string
97
+ }
98
+ else {
99
+ inputValue = (0, XUtilsConversions_1.dateFromModel)(props.value);
34
100
  }
101
+ return inputValue;
35
102
  };
36
103
  var datetime = (_a = props.datetime) !== null && _a !== void 0 ? _a : false;
37
- return (react_1.default.createElement(calendar_1.Calendar, __assign({ id: props.id, value: props.value, onChange: onChange, disabled: props.readOnly, showIcon: true, showOnFocus: false, dateFormat: (0, XUtilsConversions_1.dateFormatCalendar)(), showTime: datetime, showSeconds: datetime, inputClassName: datetime ? 'x-input-datetime' : 'x-input-date', onBlur: props.onBlur }, XUtils_1.XUtils.createErrorProps(props.error))));
104
+ // poznamka: parseDateTime nerobi ziadny parse, nechceme aby Calendar "rusil" uzivatela pri typovani datumu
105
+ // konverzia (a volanie props.onChange) sa robi az pri onBlur
106
+ return (react_1.default.createElement(calendar_1.Calendar, __assign({ id: props.id, value: getInputValue(), onChange: onChange, disabled: props.readOnly, showIcon: true, showOnFocus: false, dateFormat: (0, XUtilsConversions_1.dateFormatCalendar)(), keepInvalid: true, parseDateTime: function (text) { return text; }, showTime: datetime, showSeconds: datetime, inputClassName: datetime ? 'x-input-datetime' : 'x-input-date', onSelect: onSelect, onBlur: onBlur }, XUtils_1.XUtils.createErrorProps(props.error))));
38
107
  };
39
108
  exports.XCalendar = XCalendar;
@@ -92,6 +92,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
92
92
  exports.XFormBase = exports.Form = void 0;
93
93
  var react_1 = require("react");
94
94
  var XUtils_1 = require("./XUtils");
95
+ var XUtilsCommon_1 = require("../serverApi/XUtilsCommon");
95
96
  // class decorator ktory nastavuje property entity (dalo by sa to nastavovat v konstruktore ale decorator je menej ukecany)
96
97
  // ma sa pouzivat len na triedach odvodenych od XFormBase - obmedzenie som vsak nevedel nakodit
97
98
  // property sa nastavi az po zbehnuti konstruktora
@@ -217,8 +218,11 @@ var XFormBase = /** @class */ (function (_super) {
217
218
  return this.props.id === undefined;
218
219
  };
219
220
  XFormBase.prototype.onFieldChange = function (field, value, error, onChange, assocObjectChange) {
221
+ // field moze byt aj na asociovanom objekte (field length > 1, napr.: <assocX>.<fieldY>)
222
+ // v takom pripade sa do errorMap zapise ako key cely field <assocX>.<fieldY>
223
+ // (zlozitejsie riesenie by bolo zapisovat errors do specialneho technickeho atributu asociovaneho objektu ale zatial to nechame takto jednoducho)
220
224
  var object = this.getXObject();
221
- object[field] = value;
225
+ XUtilsCommon_1.XUtilsCommon.setValueByPath(object, field, value);
222
226
  var errorMap = this.state.errorMap;
223
227
  errorMap[field] = __assign(__assign({}, errorMap[field]), { onChange: error });
224
228
  // tu zavolame onChange komponentu - object uz ma zapisanu zmenenu hodnotu, onChange nasledne zmeni dalsie hodnoty a nasledne sa zavola setState
@@ -51,13 +51,9 @@ var XFormComponent = /** @class */ (function (_super) {
51
51
  };
52
52
  XFormComponent.prototype.isReadOnly = function () {
53
53
  var readOnly;
54
- if (!XUtilsCommon_1.XUtilsCommon.isSingleField(this.getField())) {
55
- // if the length of field is 2 or more, then readOnly
56
- readOnly = true;
57
- }
58
54
  // the purpose of formReadOnly is to put the whole form to read only mode,
59
55
  // that's why the formReadOnly has higher prio then property this.props.readOnly
60
- else if (this.props.form.formReadOnlyBase(this.getField())) {
56
+ if (this.props.form.formReadOnlyBase(this.getField())) {
61
57
  readOnly = true;
62
58
  }
63
59
  else if (typeof this.props.readOnly === 'boolean') {
@@ -75,7 +71,14 @@ var XFormComponent = /** @class */ (function (_super) {
75
71
  }
76
72
  else {
77
73
  // readOnly is undefined
78
- readOnly = false;
74
+ if (!XUtilsCommon_1.XUtilsCommon.isSingleField(this.getField())) {
75
+ // if the length of field is 2 or more, then readOnly
76
+ readOnly = true;
77
+ }
78
+ else {
79
+ // length of field is 1, default readOnly = false
80
+ readOnly = false;
81
+ }
79
82
  }
80
83
  return readOnly;
81
84
  };
@@ -92,7 +92,7 @@ export type XTableFieldOnChange = (e: XTableFieldChangeEvent<any, any>) => void;
92
92
  export type XTableFieldReadOnlyProp = boolean | ((object: any, tableRow: any) => boolean);
93
93
  export type XTableFieldFilterProp = XCustomFilter | ((object: any, rowData: any) => XCustomFilter | undefined);
94
94
  export interface XFormColumnBaseProps {
95
- type: "inputSimple" | "dropdown" | "autoComplete" | "searchButton" | "custom";
95
+ type: "inputSimple" | "dropdown" | "autoComplete" | "searchButton" | "textarea" | "custom";
96
96
  header?: any;
97
97
  readOnly?: XTableFieldReadOnlyProp;
98
98
  dropdownInFilter?: boolean;
@@ -123,6 +123,11 @@ export interface XFormSearchButtonColumnProps extends XFormColumnBaseProps {
123
123
  displayField: string;
124
124
  searchBrowse: JSX.Element;
125
125
  }
126
+ export interface XFormTextareaColumnProps extends XFormColumnBaseProps {
127
+ field: string;
128
+ rows: number;
129
+ autoResize?: boolean;
130
+ }
126
131
  export interface XFormCustomColumnProps extends XFormColumnBaseProps {
127
132
  body: React.ReactNode | ((data: any, options: ColumnBodyOptions) => React.ReactNode);
128
133
  field?: string;
@@ -155,6 +160,15 @@ export declare const XFormSearchButtonColumn: {
155
160
  columnViewStatus: boolean;
156
161
  };
157
162
  };
163
+ export declare const XFormTextareaColumn: {
164
+ (props: XFormTextareaColumnProps): null;
165
+ defaultProps: {
166
+ type: string;
167
+ rows: number;
168
+ autoResize: boolean;
169
+ columnViewStatus: boolean;
170
+ };
171
+ };
158
172
  export declare const XFormCustomColumn: {
159
173
  (props: XFormCustomColumnProps): null;
160
174
  defaultProps: {
@@ -60,7 +60,7 @@ var __values = (this && this.__values) || function(o) {
60
60
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
61
61
  };
62
62
  Object.defineProperty(exports, "__esModule", { value: true });
63
- exports.XFormCustomColumn = exports.XFormSearchButtonColumn = exports.XFormAutoCompleteColumn = exports.XFormDropdownColumn = exports.XFormColumn = exports.XFormDataTable2 = void 0;
63
+ exports.XFormCustomColumn = exports.XFormTextareaColumn = exports.XFormSearchButtonColumn = exports.XFormAutoCompleteColumn = exports.XFormDropdownColumn = exports.XFormColumn = exports.XFormDataTable2 = void 0;
64
64
  var XFormBase_1 = require("./XFormBase");
65
65
  var react_1 = __importStar(require("react"));
66
66
  var XDropdownDT_1 = require("./XDropdownDT");
@@ -83,6 +83,7 @@ var XUtilsCommon_1 = require("../serverApi/XUtilsCommon");
83
83
  var XLocale_1 = require("./XLocale");
84
84
  var XInputIntervalDT_1 = require("./XInputIntervalDT");
85
85
  var XUtilsMetadataCommon_1 = require("../serverApi/XUtilsMetadataCommon");
86
+ var XInputTextareaDT_1 = require("./XInputTextareaDT");
86
87
  var XFormDataTable2 = /** @class */ (function (_super) {
87
88
  __extends(XFormDataTable2, _super);
88
89
  function XFormDataTable2(props) {
@@ -150,6 +151,10 @@ var XFormDataTable2 = /** @class */ (function (_super) {
150
151
  var columnPropsSearchButton = columnProps;
151
152
  return columnPropsSearchButton.assocField + '.' + columnPropsSearchButton.displayField;
152
153
  }
154
+ else if (columnProps.type === "textarea") {
155
+ var columnPropsTextarea = columnProps;
156
+ return columnPropsTextarea.field;
157
+ }
153
158
  else {
154
159
  throw "Unknown prop type = " + columnProps.type;
155
160
  }
@@ -183,6 +188,11 @@ var XFormDataTable2 = /** @class */ (function (_super) {
183
188
  isNullable = xAssoc.isNullable;
184
189
  readOnly = XFormDataTable2.isReadOnlyHeader(undefined, columnProps.readOnly);
185
190
  }
191
+ else if (columnProps.type === "textarea") {
192
+ var columnPropsTextarea = columnProps;
193
+ isNullable = xField.isNullable;
194
+ readOnly = XFormDataTable2.isReadOnlyHeader(columnPropsTextarea.field, columnProps.readOnly);
195
+ }
186
196
  else {
187
197
  throw "Unknown prop type = " + columnProps.type;
188
198
  }
@@ -375,10 +385,10 @@ var XFormDataTable2 = /** @class */ (function (_super) {
375
385
  body = react_1.default.createElement(XInputDecimalDT_1.XInputDecimalDT, { form: this.props.form, entity: this.getEntity(), field: columnPropsInputSimple.field, rowData: rowData, readOnly: readOnly, onChange: columnPropsInputSimple.onChange });
376
386
  }
377
387
  else if (xField.type === "date" || xField.type === "datetime") {
378
- body = react_1.default.createElement(XInputDateDT_1.XInputDateDT, { form: this.props.form, xField: xField, field: columnPropsInputSimple.field, rowData: rowData, readOnly: readOnly });
388
+ body = react_1.default.createElement(XInputDateDT_1.XInputDateDT, { form: this.props.form, entity: this.getEntity(), field: columnPropsInputSimple.field, rowData: rowData, readOnly: readOnly, onChange: columnPropsInputSimple.onChange });
379
389
  }
380
390
  else if (xField.type === "interval") {
381
- body = react_1.default.createElement(XInputIntervalDT_1.XInputIntervalDT, { form: this.props.form, entity: this.getEntity(), field: columnPropsInputSimple.field, rowData: rowData, readOnly: readOnly });
391
+ body = react_1.default.createElement(XInputIntervalDT_1.XInputIntervalDT, { form: this.props.form, entity: this.getEntity(), field: columnPropsInputSimple.field, rowData: rowData, readOnly: readOnly, onChange: columnPropsInputSimple.onChange });
382
392
  }
383
393
  else if (xField.type === "boolean") {
384
394
  body = react_1.default.createElement(XCheckboxDT_1.XCheckboxDT, { form: this.props.form, xField: xField, field: columnPropsInputSimple.field, rowData: rowData, readOnly: readOnly });
@@ -400,6 +410,10 @@ var XFormDataTable2 = /** @class */ (function (_super) {
400
410
  var columnPropsSearchButton = columnProps;
401
411
  body = react_1.default.createElement(XSearchButtonDT_1.XSearchButtonDT, { form: this.props.form, entity: this.getEntity(), assocField: columnPropsSearchButton.assocField, displayField: columnPropsSearchButton.displayField, searchBrowse: columnPropsSearchButton.searchBrowse, rowData: rowData, readOnly: columnPropsSearchButton.readOnly });
402
412
  }
413
+ else if (columnProps.type === "textarea") {
414
+ var columnPropsTextarea = columnProps;
415
+ body = react_1.default.createElement(XInputTextareaDT_1.XInputTextareaDT, { form: this.props.form, entity: this.getEntity(), field: columnPropsTextarea.field, rows: columnPropsTextarea.rows, autoResize: columnPropsTextarea.autoResize, rowData: rowData, readOnly: columnPropsTextarea.readOnly });
416
+ }
403
417
  else {
404
418
  throw "Unknown prop type = " + columnProps.type;
405
419
  }
@@ -527,7 +541,7 @@ var XFormDataTable2 = /** @class */ (function (_super) {
527
541
  }
528
542
  var filterDisplay = this.props.filterDisplay !== "none" ? this.props.filterDisplay : undefined;
529
543
  // default sortovanie - ak mame insert tak nesortujeme (drzime poradie v akom user zaznam vytvoril), ak mame update tak podla id zosortujeme (nech je to zobrazene vzdy rovnako)
530
- var sortField = ((_a = this.props.sortField) !== null && _a !== void 0 ? _a : this.props.form.isAddRow()) ? undefined : xEntity.idField;
544
+ var sortField = (_a = this.props.sortField) !== null && _a !== void 0 ? _a : (this.props.form.isAddRow() ? undefined : xEntity.idField);
531
545
  var label = this.props.label !== undefined ? this.props.label : this.props.assocField;
532
546
  var readOnly = this.isReadOnly();
533
547
  // v bloku function (child) nejde pouzit priamo this, thisLocal uz ide pouzit
@@ -723,6 +737,12 @@ var XFormSearchButtonColumn = function (props) {
723
737
  };
724
738
  exports.XFormSearchButtonColumn = XFormSearchButtonColumn;
725
739
  exports.XFormSearchButtonColumn.defaultProps = __assign(__assign({}, XFormColumnBase_defaultProps), { type: "searchButton" });
740
+ var XFormTextareaColumn = function (props) {
741
+ // nevadi ze tu nic nevraciame, field a header vieme precitat a zvysok by sme aj tak zahodili lebo vytvarame novy element
742
+ return (null);
743
+ };
744
+ exports.XFormTextareaColumn = XFormTextareaColumn;
745
+ exports.XFormTextareaColumn.defaultProps = __assign(__assign({}, XFormColumnBase_defaultProps), { type: "textarea", rows: 1, autoResize: true });
726
746
  var XFormCustomColumn = function (props) {
727
747
  // nevadi ze tu nic nevraciame, field a header vieme precitat a zvysok by sme aj tak zahodili lebo vytvarame novy element
728
748
  return (null);
@@ -3,6 +3,7 @@ import { XFormBase } from "../XFormBase";
3
3
  export interface XFormColProps {
4
4
  form?: XFormBase;
5
5
  labelStyle?: React.CSSProperties;
6
+ style?: React.CSSProperties;
6
7
  children: JSX.Element | JSX.Element[];
7
8
  }
8
9
  export declare const XFormCol: (props: XFormColProps) => 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, children: props.children });
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 });
11
11
  };
12
12
  exports.XFormCol = XFormCol;
@@ -3,6 +3,7 @@ import { XFormBase } from "../XFormBase";
3
3
  export interface XFormInlineRowProps {
4
4
  form?: XFormBase;
5
5
  labelStyle?: React.CSSProperties;
6
+ style?: React.CSSProperties;
6
7
  children: JSX.Element | JSX.Element[];
7
8
  }
8
9
  export declare const XFormInlineRow: (props: XFormInlineRowProps) => JSX.Element;
@@ -7,6 +7,6 @@ exports.XFormInlineRow = void 0;
7
7
  var react_1 = __importDefault(require("react"));
8
8
  var XFormRowCol_1 = require("./XFormRowCol");
9
9
  var XFormInlineRow = function (props) {
10
- return react_1.default.createElement(XFormRowCol_1.XFormRowCol, { className: "x-form-inline-row", form: props.form, labelStyle: props.labelStyle, children: props.children });
10
+ return react_1.default.createElement(XFormRowCol_1.XFormRowCol, { className: "x-form-inline-row", form: props.form, labelStyle: props.labelStyle, style: props.style, children: props.children });
11
11
  };
12
12
  exports.XFormInlineRow = XFormInlineRow;
@@ -3,6 +3,7 @@ import { XFormBase } from "../XFormBase";
3
3
  export interface XFormRowProps {
4
4
  form?: XFormBase;
5
5
  labelStyle?: React.CSSProperties;
6
+ style?: React.CSSProperties;
6
7
  children: JSX.Element | JSX.Element[];
7
8
  }
8
9
  export declare const XFormRow: (props: XFormRowProps) => JSX.Element;
@@ -7,6 +7,6 @@ exports.XFormRow = void 0;
7
7
  var react_1 = __importDefault(require("react"));
8
8
  var XFormRowCol_1 = require("./XFormRowCol");
9
9
  var XFormRow = function (props) {
10
- return react_1.default.createElement(XFormRowCol_1.XFormRowCol, { className: "x-form-row", form: props.form, labelStyle: props.labelStyle, children: props.children });
10
+ return react_1.default.createElement(XFormRowCol_1.XFormRowCol, { className: "x-form-row", form: props.form, labelStyle: props.labelStyle, style: props.style, children: props.children });
11
11
  };
12
12
  exports.XFormRow = XFormRow;
@@ -4,6 +4,7 @@ export interface XFormRowColProps {
4
4
  className: "x-form-row" | "x-form-inline-row" | "x-form-col";
5
5
  form?: XFormBase;
6
6
  labelStyle?: React.CSSProperties;
7
+ style?: React.CSSProperties;
7
8
  children: JSX.Element | JSX.Element[];
8
9
  }
9
10
  export declare const XFormRowCol: (props: XFormRowColProps) => JSX.Element;
@@ -27,6 +27,6 @@ var XFormRowCol = function (props) {
27
27
  else {
28
28
  childElemList = props.children; // netreba klonovat - viac menej koli performance
29
29
  }
30
- return react_1.default.createElement("div", { className: props.className }, childElemList);
30
+ return react_1.default.createElement("div", { className: props.className, style: props.style }, childElemList);
31
31
  };
32
32
  exports.XFormRowCol = XFormRowCol;
@@ -8,6 +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
- onBlur(e: any): void;
12
11
  render(): JSX.Element;
13
12
  }
@@ -22,41 +22,27 @@ exports.XInputDate = void 0;
22
22
  var react_1 = __importDefault(require("react"));
23
23
  var XCalendar_1 = require("./XCalendar");
24
24
  var XInput_1 = require("./XInput");
25
+ var XUtilsConversions_1 = require("../serverApi/XUtilsConversions");
25
26
  var XInputDate = /** @class */ (function (_super) {
26
27
  __extends(XInputDate, _super);
27
28
  function XInputDate(props) {
28
29
  var _this = _super.call(this, props) || this;
29
30
  _this.onValueChange = _this.onValueChange.bind(_this);
30
- _this.onBlur = _this.onBlur.bind(_this);
31
31
  return _this;
32
32
  }
33
33
  XInputDate.prototype.getValue = function () {
34
- var value = null;
35
- var objectValue = this.getValueFromObject();
36
- // tuto zatial hack, mal by prist Date
37
- if (typeof objectValue === 'string') {
38
- value = new Date(objectValue);
39
- }
40
- else if (typeof objectValue === 'object' && objectValue instanceof Date) {
41
- value = objectValue;
42
- }
43
- // value zostalo null ak nebol vykonany ziaden if
34
+ var value = (0, XUtilsConversions_1.dateFromModel)(this.getValueFromObject());
44
35
  return value;
45
36
  };
46
37
  XInputDate.prototype.onValueChange = function (value) {
47
38
  // z XCalendar prichadza value - typ Date alebo null
48
- this.onValueChangeBase(value);
49
- };
50
- // nedame do onChange inputu, lebo by sa nas onChange volal po kazdej zmene pismenka
51
- // ak bude treba, mozme este dorobit metodu "onChange2", ktora sa bude volat po kazdej zmene pismenka (asi iba do XInputText)
52
- XInputDate.prototype.onBlur = function (e) {
53
- this.callOnChangeFromOnBlur();
39
+ this.onValueChangeBase(value, this.props.onChange);
54
40
  };
55
41
  XInputDate.prototype.render = function () {
56
42
  // note: style overrides size (width of the input according to character count)
57
43
  return (react_1.default.createElement("div", { className: "field grid" },
58
44
  react_1.default.createElement("label", { htmlFor: this.props.field, className: "col-fixed", style: this.getLabelStyle() }, this.getLabel()),
59
- react_1.default.createElement(XCalendar_1.XCalendar, { id: this.props.field, value: this.getValue(), onChange: this.onValueChange, readOnly: this.isReadOnly(), error: this.getError(), datetime: this.xField.type === 'datetime', onBlur: this.onBlur })));
45
+ react_1.default.createElement(XCalendar_1.XCalendar, { id: this.props.field, value: this.getValue(), onChange: this.onValueChange, readOnly: this.isReadOnly(), error: this.getError(), datetime: this.xField.type === 'datetime' })));
60
46
  };
61
47
  return XInputDate;
62
48
  }(XInput_1.XInput));
@@ -1,11 +1,10 @@
1
1
  /// <reference types="react" />
2
- import { XFormBase } from "./XFormBase";
3
- import { XField } from "../serverApi/XEntityMetadata";
4
- import { XTableFieldReadOnlyProp } from "./XFormDataTable2";
5
- export declare const XInputDateDT: (props: {
6
- form: XFormBase;
7
- xField: XField;
8
- field: string;
9
- rowData: any;
10
- readOnly?: XTableFieldReadOnlyProp | undefined;
11
- }) => JSX.Element;
2
+ import { XInputDT, XInputDTProps } from "./XInputDT";
3
+ export interface XInputDateDTProps extends XInputDTProps {
4
+ }
5
+ export declare class XInputDateDT extends XInputDT<XInputDateDTProps> {
6
+ constructor(props: XInputDateDTProps);
7
+ getValue(): Date | null;
8
+ onValueChange(value: Date | null): void;
9
+ render(): JSX.Element;
10
+ }