@michalrakus/x-react-web-lib 1.16.0 → 1.18.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.
- package/XInputTextareaBase.d.ts +3 -0
- package/XInputTextareaBase.js +5 -0
- package/gulpfile.js +1 -0
- package/lib/components/XAutoCompleteBase.d.ts +1 -0
- package/lib/components/XAutoCompleteBase.js +35 -19
- package/lib/components/XCalendar.d.ts +1 -2
- package/lib/components/XCalendar.js +79 -10
- package/lib/components/XFormBase.js +5 -1
- package/lib/components/XFormComponent.js +9 -6
- package/lib/components/XFormDataTable2.d.ts +15 -1
- package/lib/components/XFormDataTable2.js +23 -3
- package/lib/components/XFormRowCol/XFormCol.d.ts +1 -0
- package/lib/components/XFormRowCol/XFormCol.js +1 -1
- package/lib/components/XFormRowCol/XFormInlineRow.d.ts +1 -0
- package/lib/components/XFormRowCol/XFormInlineRow.js +1 -1
- package/lib/components/XFormRowCol/XFormRow.d.ts +1 -0
- package/lib/components/XFormRowCol/XFormRow.js +1 -1
- package/lib/components/XFormRowCol/XFormRowCol.d.ts +1 -0
- package/lib/components/XFormRowCol/XFormRowCol.js +1 -1
- package/lib/components/XInputDate.d.ts +0 -1
- package/lib/components/XInputDate.js +4 -18
- package/lib/components/XInputDateDT.d.ts +9 -10
- package/lib/components/XInputDateDT.js +35 -39
- package/lib/components/XInputDecimal.js +1 -1
- package/lib/components/XInputTextarea.d.ts +4 -3
- package/lib/components/XInputTextarea.js +8 -20
- package/lib/components/XInputTextareaBase.d.ts +13 -0
- package/lib/components/XInputTextareaBase.js +92 -0
- package/lib/components/XInputTextareaDT.d.ts +12 -0
- package/lib/components/XInputTextareaDT.js +44 -0
- package/lib/components/XLazyDataTable.d.ts +2 -0
- package/lib/components/XLazyDataTable.js +22 -8
- package/lib/components/XUtilsMetadata.js +1 -1
- package/lib/serverApi/XUtilsCommon.d.ts +4 -0
- package/lib/serverApi/XUtilsCommon.js +32 -0
- package/lib/serverApi/XUtilsConversions.d.ts +2 -1
- package/lib/serverApi/XUtilsConversions.js +68 -5
- package/package.json +2 -2
package/gulpfile.js
CHANGED
|
@@ -55,6 +55,7 @@ function generateApi(cb) {
|
|
|
55
55
|
"./lib/components/XInputIntervalBase",
|
|
56
56
|
"./lib/components/XInputText",
|
|
57
57
|
"./lib/components/XInputTextarea",
|
|
58
|
+
"./lib/components/XInputTextareaBase",
|
|
58
59
|
"./lib/components/XLazyDataTable",
|
|
59
60
|
"./lib/components/XLocale",
|
|
60
61
|
"./lib/components/XLoginDialog",
|
|
@@ -54,6 +54,7 @@ export declare class XAutoCompleteBase extends Component<XAutoCompleteBaseProps>
|
|
|
54
54
|
createDropdownItem(splitButtonItems: MenuItem[]): void;
|
|
55
55
|
onOpenDropdown(e: any): void;
|
|
56
56
|
openDropdown(e: any): void;
|
|
57
|
+
onEditAssocValue(): void;
|
|
57
58
|
computeInputValue(): any;
|
|
58
59
|
createSearchBrowseParams(): XSearchBrowseParams;
|
|
59
60
|
render(): JSX.Element;
|
|
@@ -287,13 +287,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
287
287
|
alert('Please select some row.');
|
|
288
288
|
}
|
|
289
289
|
else {
|
|
290
|
-
|
|
291
|
-
if (_this.props.idField === undefined) {
|
|
292
|
-
throw "XAutoCompleteBase: property valueForm is defined but property idField is also needed for form editation.";
|
|
293
|
-
}
|
|
294
|
-
_this.formDialogObjectId = _this.props.value[_this.props.idField];
|
|
295
|
-
_this.formDialogInitValuesForInsert = undefined;
|
|
296
|
-
_this.setState({ formDialogOpened: true });
|
|
290
|
+
_this.onEditAssocValue();
|
|
297
291
|
}
|
|
298
292
|
}
|
|
299
293
|
}
|
|
@@ -349,6 +343,15 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
349
343
|
// otvori dropdown (search je metoda popisana v API, volanie sme skopcili zo zdrojakov primereact)
|
|
350
344
|
this.autoCompleteRef.current.search(e, '', 'dropdown');
|
|
351
345
|
};
|
|
346
|
+
XAutoCompleteBase.prototype.onEditAssocValue = function () {
|
|
347
|
+
// otvorime dialog na update
|
|
348
|
+
if (this.props.idField === undefined) {
|
|
349
|
+
throw "XAutoCompleteBase: property valueForm is defined but property idField is also needed for form editation.";
|
|
350
|
+
}
|
|
351
|
+
this.formDialogObjectId = this.props.value[this.props.idField];
|
|
352
|
+
this.formDialogInitValuesForInsert = undefined;
|
|
353
|
+
this.setState({ formDialogOpened: true });
|
|
354
|
+
};
|
|
352
355
|
// vracia objekt (ak inputChanged === false) alebo string (ak inputChanged === true)
|
|
353
356
|
XAutoCompleteBase.prototype.computeInputValue = function () {
|
|
354
357
|
var inputValue;
|
|
@@ -375,21 +378,34 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
375
378
|
var _a;
|
|
376
379
|
var readOnly = (_a = this.props.readOnly) !== null && _a !== void 0 ? _a : false;
|
|
377
380
|
var dropdownButton;
|
|
378
|
-
if (
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
this.
|
|
381
|
+
if (!readOnly) {
|
|
382
|
+
if (this.props.searchBrowse || this.props.valueForm) {
|
|
383
|
+
// mame searchBrowse alebo CRUD operacie, potrebujeme SplitButton
|
|
384
|
+
var splitButtonItems = [];
|
|
385
|
+
if (this.props.valueForm) {
|
|
386
|
+
this.createInsertUpdateItems(splitButtonItems);
|
|
387
|
+
}
|
|
388
|
+
if (this.props.searchBrowse && !readOnly) {
|
|
389
|
+
this.createSearchItem(splitButtonItems);
|
|
390
|
+
}
|
|
391
|
+
this.createDropdownItem(splitButtonItems);
|
|
392
|
+
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 });
|
|
383
393
|
}
|
|
384
|
-
|
|
385
|
-
|
|
394
|
+
else {
|
|
395
|
+
// mame len 1 operaciu - dame jednoduchy button
|
|
396
|
+
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() });
|
|
386
397
|
}
|
|
387
|
-
this.createDropdownItem(splitButtonItems);
|
|
388
|
-
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 });
|
|
389
398
|
}
|
|
390
399
|
else {
|
|
391
|
-
//
|
|
392
|
-
|
|
400
|
+
// readOnly
|
|
401
|
+
// ak mame valueForm a mame asociovany objekt, umoznime editovat asociovany objekt
|
|
402
|
+
if (this.props.valueForm && this.props.value !== null) {
|
|
403
|
+
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() });
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
// dame disablovany button (z estetickych dovodov, zachovame sirku)
|
|
407
|
+
dropdownButton = react_1.default.createElement(button_1.Button, { icon: "pi pi-chevron-down", className: 'x-dropdownbutton' + XUtils_1.XUtils.mobileCssSuffix(), disabled: true });
|
|
408
|
+
}
|
|
393
409
|
}
|
|
394
410
|
// vypocitame inputValue
|
|
395
411
|
var inputValue = this.computeInputValue();
|
|
@@ -407,7 +423,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
407
423
|
return (react_1.default.createElement("div", { className: "x-auto-complete-base", style: { width: this.props.width } },
|
|
408
424
|
react_1.default.createElement(autocomplete_1.AutoComplete, __assign({ value: inputValue, suggestions: this.state.filteredSuggestions, completeMethod: this.completeMethod, field: this.props.field, onChange: this.onChange, onSelect: this.onSelect, onBlur: this.onBlur, maxLength: this.props.maxLength, ref: this.autoCompleteRef, readOnly: readOnly, disabled: readOnly }, XUtils_1.XUtils.createErrorProps(error))),
|
|
409
425
|
dropdownButton,
|
|
410
|
-
this.props.valueForm != undefined
|
|
426
|
+
this.props.valueForm != undefined ?
|
|
411
427
|
react_1.default.createElement(dialog_1.Dialog, { visible: this.state.formDialogOpened, onHide: this.formDialogOnHide, header: this.formDialogObjectId ? 'Modification' : 'New row' }, react_1.default.cloneElement(this.props.valueForm, {
|
|
412
428
|
id: this.formDialogObjectId, initValues: this.formDialogInitValuesForInsert, onSaveOrCancel: this.formDialogOnSaveOrCancel
|
|
413
429
|
} /*, this.props.valueForm.children*/))
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
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
|
|
14
|
-
|
|
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 =
|
|
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
|
|
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
|
-
//
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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,
|
|
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
|
}
|
|
@@ -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;
|
|
@@ -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 =
|
|
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'
|
|
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 {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
+
}
|
|
@@ -1,48 +1,44 @@
|
|
|
1
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
|
+
})();
|
|
2
17
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
18
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
19
|
};
|
|
5
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
21
|
exports.XInputDateDT = void 0;
|
|
7
|
-
var XUtilsConversions_1 = require("../serverApi/XUtilsConversions");
|
|
8
|
-
var calendar_1 = require("primereact/calendar");
|
|
9
22
|
var react_1 = __importDefault(require("react"));
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// kedze "rowData" je sucastou "props.form.state.object", tak nam staci zavolat setState({object: object}), aby sa zmena prejavila
|
|
20
|
-
props.form.onObjectDataChange();
|
|
21
|
-
};
|
|
22
|
-
var fieldValue = undefined;
|
|
23
|
-
// test na undefined je tu koli insertu noveho riadku
|
|
24
|
-
if (props.rowData !== undefined && props.rowData !== null) {
|
|
25
|
-
var rowDataValue = XUtilsCommon_1.XUtilsCommon.getValueByPath(props.rowData, props.field);
|
|
26
|
-
// pre istotu dame na null, null je standard
|
|
27
|
-
//if (rowDataValue === undefined) {
|
|
28
|
-
// rowDataValue = null;
|
|
29
|
-
//}
|
|
30
|
-
// TODO - konvertovat null hodnotu na "" (vo funkcii stringAsUI) je dolezite aby sa prejavila zmena na null v modeli
|
|
31
|
-
// - otestovat ci zmena na null funguje dobre -
|
|
32
|
-
//fieldValue = stringAsUI(rowDataValue);
|
|
33
|
-
// tuto zatial hack, mal by prist Date
|
|
34
|
-
if (typeof rowDataValue === 'string') {
|
|
35
|
-
fieldValue = new Date(rowDataValue);
|
|
36
|
-
}
|
|
37
|
-
else if (typeof rowDataValue === 'object' && rowDataValue instanceof Date) {
|
|
38
|
-
fieldValue = rowDataValue;
|
|
39
|
-
}
|
|
40
|
-
// fieldValue zostalo undefined (konvertujeme null -> undefined) - Calendar pozaduje undefined, nechce null
|
|
23
|
+
var XInputDT_1 = require("./XInputDT");
|
|
24
|
+
var XCalendar_1 = require("./XCalendar");
|
|
25
|
+
var XUtilsConversions_1 = require("../serverApi/XUtilsConversions");
|
|
26
|
+
var XInputDateDT = /** @class */ (function (_super) {
|
|
27
|
+
__extends(XInputDateDT, _super);
|
|
28
|
+
function XInputDateDT(props) {
|
|
29
|
+
var _this = _super.call(this, props) || this;
|
|
30
|
+
_this.onValueChange = _this.onValueChange.bind(_this);
|
|
31
|
+
return _this;
|
|
41
32
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
};
|
|
33
|
+
XInputDateDT.prototype.getValue = function () {
|
|
34
|
+
return (0, XUtilsConversions_1.dateFromModel)(this.getValueFromRowData());
|
|
35
|
+
};
|
|
36
|
+
XInputDateDT.prototype.onValueChange = function (value) {
|
|
37
|
+
this.onValueChangeBase(value, this.props.onChange);
|
|
38
|
+
};
|
|
39
|
+
XInputDateDT.prototype.render = function () {
|
|
40
|
+
return (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' }));
|
|
41
|
+
};
|
|
42
|
+
return XInputDateDT;
|
|
43
|
+
}(XInputDT_1.XInputDT));
|
|
48
44
|
exports.XInputDateDT = XInputDateDT;
|
|
@@ -72,7 +72,7 @@ var XInputDecimal = /** @class */ (function (_super) {
|
|
|
72
72
|
var label = this.getLabel();
|
|
73
73
|
return (react_1.default.createElement("div", { className: "field grid" },
|
|
74
74
|
label !== undefined ? react_1.default.createElement("label", { htmlFor: this.props.field, className: "col-fixed", style: this.getLabelStyle() }, label) : null,
|
|
75
|
-
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, size: sizeInput,
|
|
75
|
+
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, size: sizeInput, inputStyle: this.props.inputStyle }, this.getClassNameTooltip(), { onBlur: this.onBlur }))));
|
|
76
76
|
};
|
|
77
77
|
return XInputDecimal;
|
|
78
78
|
}(XInput_1.XInput));
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { XInput, XInputProps } from "./XInput";
|
|
3
3
|
export interface XInputTextareaProps extends XInputProps<string> {
|
|
4
|
-
rows
|
|
4
|
+
rows?: number;
|
|
5
5
|
cols?: number | "full";
|
|
6
6
|
labelOnTop?: boolean;
|
|
7
|
+
autoResize?: boolean;
|
|
7
8
|
}
|
|
8
9
|
export declare class XInputTextarea extends XInput<string, XInputTextareaProps> {
|
|
9
10
|
static defaultProps: {
|
|
@@ -11,8 +12,8 @@ export declare class XInputTextarea extends XInput<string, XInputTextareaProps>
|
|
|
11
12
|
labelOnTop: boolean;
|
|
12
13
|
};
|
|
13
14
|
constructor(props: XInputTextareaProps);
|
|
14
|
-
getValue(): string;
|
|
15
|
-
onValueChange(
|
|
15
|
+
getValue(): string | null;
|
|
16
|
+
onValueChange(value: string | null): void;
|
|
16
17
|
getLabelStyle(): React.CSSProperties;
|
|
17
18
|
render(): JSX.Element;
|
|
18
19
|
}
|
|
@@ -14,27 +14,15 @@ 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 __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
17
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
18
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
19
|
};
|
|
31
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
21
|
exports.XInputTextarea = void 0;
|
|
33
22
|
var react_1 = __importDefault(require("react"));
|
|
34
|
-
var XUtilsConversions_1 = require("../serverApi/XUtilsConversions");
|
|
35
23
|
var XInput_1 = require("./XInput");
|
|
36
|
-
var inputtextarea_1 = require("primereact/inputtextarea");
|
|
37
24
|
var XUtils_1 = require("./XUtils");
|
|
25
|
+
var XInputTextareaBase_1 = require("./XInputTextareaBase");
|
|
38
26
|
var XInputTextarea = /** @class */ (function (_super) {
|
|
39
27
|
__extends(XInputTextarea, _super);
|
|
40
28
|
function XInputTextarea(props) {
|
|
@@ -43,13 +31,10 @@ var XInputTextarea = /** @class */ (function (_super) {
|
|
|
43
31
|
return _this;
|
|
44
32
|
}
|
|
45
33
|
XInputTextarea.prototype.getValue = function () {
|
|
46
|
-
|
|
47
|
-
var value = this.getValueFromObject();
|
|
48
|
-
return (0, XUtilsConversions_1.stringAsUI)(value);
|
|
34
|
+
return this.getValueFromObject();
|
|
49
35
|
};
|
|
50
|
-
XInputTextarea.prototype.onValueChange = function (
|
|
51
|
-
|
|
52
|
-
this.onValueChangeBase(value);
|
|
36
|
+
XInputTextarea.prototype.onValueChange = function (value) {
|
|
37
|
+
this.onValueChangeBase(value, this.props.onChange);
|
|
53
38
|
};
|
|
54
39
|
XInputTextarea.prototype.getLabelStyle = function () {
|
|
55
40
|
var _a;
|
|
@@ -72,9 +57,12 @@ var XInputTextarea = /** @class */ (function (_super) {
|
|
|
72
57
|
// aj tak sa asi vzdy bude pouzivat "full"
|
|
73
58
|
cols = this.props.cols;
|
|
74
59
|
}
|
|
60
|
+
// InputTextarea renderujeme az ked mame nacitany object, lebo inac pri autoResize sa nam nenastavi spravna velkost (hodnota nie je k dispozicii pri prvom renderingu)
|
|
75
61
|
return (react_1.default.createElement("div", { className: !this.props.labelOnTop ? 'field grid' : 'field grid x-inputtextarea-label-on-top' },
|
|
76
62
|
react_1.default.createElement("label", { htmlFor: this.props.field, className: !this.props.labelOnTop ? 'col-fixed' : undefined, style: this.getLabelStyle() }, this.getLabel()),
|
|
77
|
-
|
|
63
|
+
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() })
|
|
65
|
+
: null));
|
|
78
66
|
};
|
|
79
67
|
XInputTextarea.defaultProps = {
|
|
80
68
|
cols: "full",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare const XInputTextareaBase: (props: {
|
|
3
|
+
id?: string | undefined;
|
|
4
|
+
value: string | null;
|
|
5
|
+
onChange: (value: string | null) => void;
|
|
6
|
+
rows?: number | undefined;
|
|
7
|
+
cols?: number | undefined;
|
|
8
|
+
autoResize?: boolean | undefined;
|
|
9
|
+
readOnly?: boolean | undefined;
|
|
10
|
+
error?: string | undefined;
|
|
11
|
+
style?: React.CSSProperties | undefined;
|
|
12
|
+
maxLength?: number | undefined;
|
|
13
|
+
}) => JSX.Element;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
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;
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
exports.XInputTextareaBase = void 0;
|
|
54
|
+
var react_1 = __importStar(require("react"));
|
|
55
|
+
var XUtilsConversions_1 = require("../serverApi/XUtilsConversions");
|
|
56
|
+
var XUtils_1 = require("./XUtils");
|
|
57
|
+
var inputtextarea_1 = require("primereact/inputtextarea");
|
|
58
|
+
// koli optimalizacii - typovany text si zapisuje do svojej stavovej premennej a onChange zavola az z onBlur
|
|
59
|
+
// pri velkych formularoch je totiz volanie zmeny stavu this.setState({object: this.state.object, errorMap: this.state.errorMap}); pomale
|
|
60
|
+
var XInputTextareaBase = function (props) {
|
|
61
|
+
// true, ak uzivatel typuje hodnotu ale hodnota sa este neda skonvertovat na korektny interval (este nevieme vytvorit IPostgresInterval)
|
|
62
|
+
// false, ak uz mame v inpute korektnu hodnotu - vtedy zavolame props.onChange a posleme mu IPostgresInterval
|
|
63
|
+
var _a = __read((0, react_1.useState)(false), 2), inputChanged = _a[0], setInputChanged = _a[1];
|
|
64
|
+
// pouzivane, len ak inputChanged === true, je tu zapisana zmenena hodnota v inpute
|
|
65
|
+
var _b = __read((0, react_1.useState)(undefined), 2), inputValueState = _b[0], setInputValueState = _b[1];
|
|
66
|
+
var onChange = function (e) {
|
|
67
|
+
// conversion to IPostgresInterval will be done in onBlur
|
|
68
|
+
setInputChanged(true);
|
|
69
|
+
setInputValueState(e.target.value);
|
|
70
|
+
};
|
|
71
|
+
var onBlur = function (e) {
|
|
72
|
+
// optimalizacia - testujeme len ak inputChanged === true
|
|
73
|
+
if (inputChanged) {
|
|
74
|
+
var value = (0, XUtilsConversions_1.stringFromUI)(e.target.value);
|
|
75
|
+
props.onChange(value);
|
|
76
|
+
setInputChanged(false);
|
|
77
|
+
setInputValueState(undefined); // pre poriadok
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
var getInputValue = function () {
|
|
81
|
+
var inputValue;
|
|
82
|
+
if (inputChanged) {
|
|
83
|
+
inputValue = inputValueState;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
inputValue = (0, XUtilsConversions_1.stringAsUI)(props.value);
|
|
87
|
+
}
|
|
88
|
+
return inputValue;
|
|
89
|
+
};
|
|
90
|
+
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))));
|
|
91
|
+
};
|
|
92
|
+
exports.XInputTextareaBase = XInputTextareaBase;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { XInputDT, XInputDTProps } from "./XInputDT";
|
|
3
|
+
export interface XInputTextareaDTProps extends XInputDTProps {
|
|
4
|
+
rows: number;
|
|
5
|
+
autoResize?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare class XInputTextareaDT extends XInputDT<XInputTextareaDTProps> {
|
|
8
|
+
constructor(props: XInputTextareaDTProps);
|
|
9
|
+
getValue(): string | null;
|
|
10
|
+
onValueChange(value: string | null): void;
|
|
11
|
+
render(): JSX.Element;
|
|
12
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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.XInputTextareaDT = void 0;
|
|
22
|
+
var react_1 = __importDefault(require("react"));
|
|
23
|
+
var XInputDT_1 = require("./XInputDT");
|
|
24
|
+
var XInputTextareaBase_1 = require("./XInputTextareaBase");
|
|
25
|
+
var XInputTextareaDT = /** @class */ (function (_super) {
|
|
26
|
+
__extends(XInputTextareaDT, _super);
|
|
27
|
+
function XInputTextareaDT(props) {
|
|
28
|
+
var _this = _super.call(this, props) || this;
|
|
29
|
+
_this.onValueChange = _this.onValueChange.bind(_this);
|
|
30
|
+
return _this;
|
|
31
|
+
}
|
|
32
|
+
XInputTextareaDT.prototype.getValue = function () {
|
|
33
|
+
return this.getValueFromRowData();
|
|
34
|
+
};
|
|
35
|
+
XInputTextareaDT.prototype.onValueChange = function (value) {
|
|
36
|
+
this.onValueChangeBase(value, this.props.onChange);
|
|
37
|
+
};
|
|
38
|
+
// pouzivame cols = undefined, sirka je urcena sirkou stlpca (width: 100%)
|
|
39
|
+
XInputTextareaDT.prototype.render = function () {
|
|
40
|
+
return (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: { width: '100%' }, rows: this.props.rows, cols: undefined, autoResize: this.props.autoResize, error: this.getError() }));
|
|
41
|
+
};
|
|
42
|
+
return XInputTextareaDT;
|
|
43
|
+
}(XInputDT_1.XInputDT));
|
|
44
|
+
exports.XInputTextareaDT = XInputTextareaDT;
|
|
@@ -53,6 +53,7 @@ export interface XLazyDataTableProps {
|
|
|
53
53
|
customFilter?: XCustomFilter;
|
|
54
54
|
sortField?: string;
|
|
55
55
|
fullTextSearch: boolean | string[];
|
|
56
|
+
multiLineSwitch: boolean;
|
|
56
57
|
searchBrowseParams?: XSearchBrowseParams;
|
|
57
58
|
width?: string;
|
|
58
59
|
dataLoadedState?: [boolean, React.Dispatch<React.SetStateAction<boolean>>];
|
|
@@ -68,6 +69,7 @@ export declare const XLazyDataTable: {
|
|
|
68
69
|
rows: number;
|
|
69
70
|
filterDisplay: string;
|
|
70
71
|
fullTextSearch: boolean;
|
|
72
|
+
multiLineSwitch: boolean;
|
|
71
73
|
scrollable: boolean;
|
|
72
74
|
scrollWidth: string;
|
|
73
75
|
scrollHeight: string;
|
|
@@ -117,6 +117,7 @@ var XInputDecimalBase_1 = require("./XInputDecimalBase");
|
|
|
117
117
|
var XLocale_1 = require("./XLocale");
|
|
118
118
|
var XFtsInput_1 = require("./XFtsInput");
|
|
119
119
|
var XUtilsMetadataCommon_1 = require("../serverApi/XUtilsMetadataCommon");
|
|
120
|
+
var inputswitch_1 = require("primereact/inputswitch");
|
|
120
121
|
var XLazyDataTable = function (props) {
|
|
121
122
|
var _a;
|
|
122
123
|
// must be here, is used in createInitFilters()
|
|
@@ -226,13 +227,14 @@ var XLazyDataTable = function (props) {
|
|
|
226
227
|
var _f = __read((0, react_1.useState)(filtersInit), 2), filters = _f[0], setFilters = _f[1]; // filtrovanie na "controlled manner" (moze sa sem nainicializovat nejaka hodnota)
|
|
227
228
|
var initFtsInputValue = props.fullTextSearch ? createInitFtsInputValue() : undefined;
|
|
228
229
|
var _g = __read((0, react_1.useState)(initFtsInputValue), 2), ftsInputValue = _g[0], setFtsInputValue = _g[1];
|
|
229
|
-
var _h = __read((0, react_1.useState)(
|
|
230
|
-
var _j = __read((0, react_1.useState)(
|
|
231
|
-
var _k = __read((
|
|
232
|
-
var _l = __read((0, react_1.useState)(false), 2),
|
|
233
|
-
var _m = __read((0, react_1.useState)(), 2),
|
|
234
|
-
var _o = __read((0, react_1.useState)(
|
|
235
|
-
var _p = __read((0, react_1.useState)(
|
|
230
|
+
var _h = __read((0, react_1.useState)(true), 2), multiLineSwitchValue = _h[0], setMultiLineSwitchValue = _h[1];
|
|
231
|
+
var _j = __read((0, react_1.useState)(props.sortField ? [{ field: props.sortField, order: 1 }] : []), 2), multiSortMeta = _j[0], setMultiSortMeta = _j[1];
|
|
232
|
+
var _k = __read((0, react_1.useState)(null), 2), selectedRow = _k[0], setSelectedRow = _k[1];
|
|
233
|
+
var _l = __read((_a = props.dataLoadedState) !== null && _a !== void 0 ? _a : (0, react_1.useState)(false), 2), dataLoaded = _l[0], setDataLoaded = _l[1]; // priznak kde si zapiseme, ci uz sme nacitali data
|
|
234
|
+
var _m = __read((0, react_1.useState)(false), 2), exportRowsDialogOpened = _m[0], setExportRowsDialogOpened = _m[1];
|
|
235
|
+
var _o = __read((0, react_1.useState)(), 2), exportRowsDialogRowCount = _o[0], setExportRowsDialogRowCount = _o[1]; // param pre dialog
|
|
236
|
+
var _p = __read((0, react_1.useState)(filtersInit), 2), filtersAfterFiltering = _p[0], setFiltersAfterFiltering = _p[1]; // sem si odkladame stav filtra po kliknuti na button Filter (chceme exportovat presne to co vidno vyfiltrovane)
|
|
237
|
+
var _q = __read((0, react_1.useState)(initFtsInputValue), 2), ftsInputValueAfterFiltering = _q[0], setFtsInputValueAfterFiltering = _q[1]; // tak isto ako filtersAfterFiltering
|
|
236
238
|
// parameter [] zabezpeci ze sa metoda zavola len po prvom renderingu (a nie po kazdej zmene stavu (zavolani setNieco()))
|
|
237
239
|
(0, react_1.useEffect)(function () {
|
|
238
240
|
// jednoduchy sposob - nepouzivame parameter props.displayed a priznak dataLoaded
|
|
@@ -612,6 +614,16 @@ var XLazyDataTable = function (props) {
|
|
|
612
614
|
// ine typy - convertValue vrati string
|
|
613
615
|
// mame zapnutu konverziu fromModel, lebo z json-u nam prichadzaju objekty typu string (napr. pri datumoch)
|
|
614
616
|
valueResult = (0, XUtilsConversions_1.convertValue)(xField, value, true, XUtilsConversions_1.AsUIType.Form);
|
|
617
|
+
// ak mame viacriadkovy text a zapnuty multiLineSwitch (defaultne je zapnuty aj ked nie je zobrazeny)
|
|
618
|
+
if (multiLineSwitchValue) {
|
|
619
|
+
if (xField.type === "string" && typeof valueResult === "string" && valueResult) {
|
|
620
|
+
var lines = valueResult.split(XUtilsCommon_1.XUtilsCommon.newLine);
|
|
621
|
+
if (lines.length >= 2) {
|
|
622
|
+
var elemList = lines.map(function (value, index) { return react_1.default.createElement("div", { key: index }, value); });
|
|
623
|
+
valueResult = react_1.default.createElement("div", null, elemList);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
615
627
|
}
|
|
616
628
|
return valueResult;
|
|
617
629
|
};
|
|
@@ -872,7 +884,8 @@ var XLazyDataTable = function (props) {
|
|
|
872
884
|
react_1.default.createElement("div", { className: "flex justify-content-center align-items-center" },
|
|
873
885
|
ftsInputValue ? react_1.default.createElement(XFtsInput_1.XFtsInput, { value: ftsInputValue, onChange: function (value) { return setFtsInputValue(value); } }) : null,
|
|
874
886
|
react_1.default.createElement(XButton_1.XButton, { key: "filter", label: (0, XLocale_1.xLocaleOption)('filter'), onClick: onClickFilter }),
|
|
875
|
-
react_1.default.createElement(XButton_1.XButton, { key: "clearFilter", label: (0, XLocale_1.xLocaleOption)('clearFilter'), onClick: onClickClearFilter })
|
|
887
|
+
react_1.default.createElement(XButton_1.XButton, { key: "clearFilter", label: (0, XLocale_1.xLocaleOption)('clearFilter'), onClick: onClickClearFilter }),
|
|
888
|
+
props.multiLineSwitch ? react_1.default.createElement(inputswitch_1.InputSwitch, { checked: multiLineSwitchValue, onChange: function (e) { return setMultiLineSwitchValue(e.value); }, className: "m-1" }) : null),
|
|
876
889
|
react_1.default.createElement("div", { className: "flex justify-content-center" },
|
|
877
890
|
react_1.default.createElement(datatable_1.DataTable, { value: value.rowList, dataKey: dataKey, paginator: props.paginator, rows: rows, totalRecords: value.totalRecords, lazy: true, first: first, onPage: onPage, loading: loading, filterDisplay: props.filterDisplay, filters: filters, onFilter: onFilter, sortMode: "multiple", removableSort: true, multiSortMeta: multiSortMeta, onSort: onSort, selectionMode: "single", selection: selectedRow, onSelectionChange: onSelectionChange, onRowDoubleClick: onRowDoubleClick, ref: dataTableEl, className: "p-datatable-sm x-lazy-datatable", resizableColumns: true, columnResizeMode: "expand", tableStyle: tableStyle, paginatorLeft: paginatorLeft, paginatorRight: paginatorRight, scrollable: props.scrollable, scrollHeight: scrollHeight, style: style }, columnElemList)),
|
|
878
891
|
react_1.default.createElement("div", { className: "flex justify-content-center" },
|
|
@@ -891,6 +904,7 @@ exports.XLazyDataTable.defaultProps = {
|
|
|
891
904
|
rows: 10,
|
|
892
905
|
filterDisplay: "row",
|
|
893
906
|
fullTextSearch: true,
|
|
907
|
+
multiLineSwitch: false,
|
|
894
908
|
scrollable: true,
|
|
895
909
|
scrollWidth: 'viewport',
|
|
896
910
|
scrollHeight: 'viewport',
|
|
@@ -143,7 +143,7 @@ var XUtilsMetadata = /** @class */ (function () {
|
|
|
143
143
|
}
|
|
144
144
|
else {
|
|
145
145
|
// form datatable (formColumnType is defined)
|
|
146
|
-
if (formColumnType === "inputSimple") {
|
|
146
|
+
if (formColumnType === "inputSimple" || formColumnType === "textarea") {
|
|
147
147
|
var padding = 0.21 + 0.07 + 0.5; // padding is 2.94px + 1px border + 7px padding in input
|
|
148
148
|
if (xField.type === "string") {
|
|
149
149
|
width = XUtilsMetadata.computeColumnWidthBase(xField.length, padding + padding); // padding left + right
|
|
@@ -2,14 +2,18 @@ export declare class XUtilsCommon {
|
|
|
2
2
|
static newLine: string;
|
|
3
3
|
static getValueByPath(object: any, path: string): any;
|
|
4
4
|
static getValueOrValueListByPath(object: any, path: string): any | any[];
|
|
5
|
+
static setValueByPath(object: any, path: string, value: any): void;
|
|
5
6
|
static getFieldListForPath(path: string): string[];
|
|
6
7
|
static getFieldAndRestPath(path: string): [string, string | null];
|
|
7
8
|
static getPathToAssoc(path: string): string;
|
|
9
|
+
static getPathToAssocAndField(path: string): [string | null, string];
|
|
8
10
|
static isSingleField(path: string): boolean;
|
|
9
11
|
static objectAsJSON(value: any): string;
|
|
10
12
|
static getDayName(date: Date | null | undefined): string | undefined;
|
|
11
13
|
static dateAddDays(date: Date | null, days: number): Date | null;
|
|
12
14
|
static findFirstMatch(pattern: RegExp, value: string): string | null;
|
|
13
15
|
static sqlMaxDateIfNull(sqlExp: string): string;
|
|
16
|
+
static today(): Date;
|
|
17
|
+
static isInt(stringValue: string): boolean;
|
|
14
18
|
}
|
|
15
19
|
export declare const dateFormat: any;
|
|
@@ -108,6 +108,20 @@ var XUtilsCommon = /** @class */ (function () {
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
|
+
XUtilsCommon.setValueByPath = function (object, path, value) {
|
|
112
|
+
var _a = __read(XUtilsCommon.getPathToAssocAndField(path), 2), pathToAssoc = _a[0], field = _a[1];
|
|
113
|
+
if (pathToAssoc !== null) {
|
|
114
|
+
var assocObject = XUtilsCommon.getValueByPath(object, pathToAssoc);
|
|
115
|
+
// if null or undefined or is not object, then error
|
|
116
|
+
if (assocObject === null || assocObject === undefined || typeof assocObject !== 'object') {
|
|
117
|
+
console.log("XUtilsCommon.setValueByPath: could not set value ".concat(value, " into object property ").concat(path, ". Assoc object not found (found value: ").concat(assocObject, "). Main object:"));
|
|
118
|
+
console.log(object);
|
|
119
|
+
throw "setValueByPath: could not set value ".concat(value, " into object property ").concat(path, ". Assoc object not found. The main object can be seen in log.");
|
|
120
|
+
}
|
|
121
|
+
object = assocObject;
|
|
122
|
+
}
|
|
123
|
+
object[field] = value;
|
|
124
|
+
};
|
|
111
125
|
XUtilsCommon.getFieldListForPath = function (path) {
|
|
112
126
|
return path.split('.');
|
|
113
127
|
};
|
|
@@ -131,6 +145,15 @@ var XUtilsCommon = /** @class */ (function () {
|
|
|
131
145
|
return path.substring(0, posDot);
|
|
132
146
|
}
|
|
133
147
|
};
|
|
148
|
+
XUtilsCommon.getPathToAssocAndField = function (path) {
|
|
149
|
+
var posDot = path.lastIndexOf(".");
|
|
150
|
+
if (posDot === -1) {
|
|
151
|
+
return [null, path];
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
return [path.substring(0, posDot), path.substring(posDot + 1)];
|
|
155
|
+
}
|
|
156
|
+
};
|
|
134
157
|
XUtilsCommon.isSingleField = function (path) {
|
|
135
158
|
return path.indexOf(".") === -1;
|
|
136
159
|
};
|
|
@@ -176,6 +199,15 @@ var XUtilsCommon = /** @class */ (function () {
|
|
|
176
199
|
XUtilsCommon.sqlMaxDateIfNull = function (sqlExp) {
|
|
177
200
|
return "coalesce(".concat(sqlExp, ", '9999-12-31'::DATE)");
|
|
178
201
|
};
|
|
202
|
+
XUtilsCommon.today = function () {
|
|
203
|
+
var today = new Date();
|
|
204
|
+
today.setHours(0, 0, 0, 0);
|
|
205
|
+
return today;
|
|
206
|
+
};
|
|
207
|
+
// vrati true ak sa string sklada iba z cislic, moze mat + alebo - na zaciatku
|
|
208
|
+
XUtilsCommon.isInt = function (stringValue) {
|
|
209
|
+
return /^[-+]?\d+$/.test(stringValue);
|
|
210
|
+
};
|
|
179
211
|
XUtilsCommon.newLine = '\n';
|
|
180
212
|
return XUtilsCommon;
|
|
181
213
|
}());
|
|
@@ -3,10 +3,11 @@ import { XField } from "./XEntityMetadata";
|
|
|
3
3
|
export declare function stringFromUI(stringValue: string): string | null;
|
|
4
4
|
export declare function stringAsUI(value: string | null): string;
|
|
5
5
|
export declare function stringAsDB(value: string | null): string;
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function intFromUI(stringValue: string): number | null | undefined;
|
|
7
7
|
export declare function numberAsUI(value: number | null, fractionDigits?: number): string;
|
|
8
8
|
export declare function numberFromModel(value: any): number | null;
|
|
9
9
|
export declare function dateFromModel(value: any): Date | null;
|
|
10
|
+
export declare function dateFromUI(valueString: string): Date | null | undefined;
|
|
10
11
|
export declare function dateAsUI(value: Date | null): string;
|
|
11
12
|
export declare function datetimeAsUI(value: Date | null): string;
|
|
12
13
|
export declare function timeFromModel(value: any): Date | null;
|
|
@@ -27,7 +27,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
27
27
|
return ar;
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.convertValue = exports.convertObject = exports.AsUIType = exports.booleanAsUIText = exports.intervalAsUI = exports.intervalFromUI = exports.datetimeFormatUI = exports.dateFormatCalendar = exports.dateFormatUI = exports.timeFromModel = exports.datetimeAsUI = exports.dateAsUI = exports.dateFromModel = exports.numberFromModel = exports.numberAsUI = exports.
|
|
30
|
+
exports.convertValue = exports.convertObject = exports.AsUIType = exports.booleanAsUIText = exports.intervalAsUI = exports.intervalFromUI = exports.datetimeFormatUI = exports.dateFormatCalendar = exports.dateFormatUI = exports.timeFromModel = exports.datetimeAsUI = exports.dateAsUI = exports.dateFromUI = exports.dateFromModel = exports.numberFromModel = exports.numberAsUI = exports.intFromUI = exports.stringAsDB = exports.stringAsUI = exports.stringFromUI = void 0;
|
|
31
31
|
var XUtilsCommon_1 = require("./XUtilsCommon");
|
|
32
32
|
var XLocale_1 = require("../components/XLocale");
|
|
33
33
|
var XUtilsMetadataCommon_1 = require("./XUtilsMetadataCommon");
|
|
@@ -51,17 +51,25 @@ function stringAsDB(value) {
|
|
|
51
51
|
return value !== null ? "'".concat(value.replaceAll("'", "''"), "'") : "NULL";
|
|
52
52
|
}
|
|
53
53
|
exports.stringAsDB = stringAsDB;
|
|
54
|
-
function
|
|
55
|
-
|
|
54
|
+
function intFromUI(stringValue) {
|
|
55
|
+
// convert stringValue (e.g. 1234) into integer number
|
|
56
|
+
// if stringValue is invalid, returns undefined
|
|
57
|
+
var value = undefined;
|
|
56
58
|
if (stringValue === '') {
|
|
57
59
|
value = null;
|
|
58
60
|
}
|
|
59
61
|
else {
|
|
60
|
-
|
|
62
|
+
if (XUtilsCommon_1.XUtilsCommon.isInt(stringValue)) {
|
|
63
|
+
// 1234xxx vrati number 1234, preto sme spravili test isInt
|
|
64
|
+
value = parseInt(stringValue, 10);
|
|
65
|
+
if (isNaN(value)) {
|
|
66
|
+
value = undefined;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
61
69
|
}
|
|
62
70
|
return value;
|
|
63
71
|
}
|
|
64
|
-
exports.
|
|
72
|
+
exports.intFromUI = intFromUI;
|
|
65
73
|
function numberAsUI(value, fractionDigits) {
|
|
66
74
|
if (fractionDigits === undefined) {
|
|
67
75
|
fractionDigits = 2; // default
|
|
@@ -100,6 +108,61 @@ function dateFromModel(value) {
|
|
|
100
108
|
return dateValue;
|
|
101
109
|
}
|
|
102
110
|
exports.dateFromModel = dateFromModel;
|
|
111
|
+
function dateFromUI(valueString) {
|
|
112
|
+
// converts valueString (e.g. 21.2.2024) into Date
|
|
113
|
+
// if stringValue is invalid, returns undefined
|
|
114
|
+
var valueDate = undefined;
|
|
115
|
+
if (valueString === '') {
|
|
116
|
+
valueDate = null;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
// null znamena nezadane (doplni sa podla aktualneho datumu), undefined znamena zadana nekorektna hodnota
|
|
120
|
+
var day = void 0;
|
|
121
|
+
var month = null;
|
|
122
|
+
var year = null;
|
|
123
|
+
var posDot = valueString.indexOf('.');
|
|
124
|
+
if (posDot === -1) {
|
|
125
|
+
day = intFromUI(valueString);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
day = intFromUI(valueString.substring(0, posDot));
|
|
129
|
+
var rest = valueString.substring(posDot + 1);
|
|
130
|
+
var posDot2 = rest.indexOf('.');
|
|
131
|
+
if (posDot2 === -1) {
|
|
132
|
+
month = intFromUI(rest);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
month = intFromUI(rest.substring(0, posDot2));
|
|
136
|
+
year = intFromUI(rest.substring(posDot2 + 1));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// doplnime mesiac a rok ak uzivatel nezadal (ak mame undefined, tak umyselne nedoplname)
|
|
140
|
+
if (month === null) {
|
|
141
|
+
month = XUtilsCommon_1.XUtilsCommon.today().getMonth() + 1; // o 1 mesiac viac (januar je 0)
|
|
142
|
+
}
|
|
143
|
+
if (year === null) {
|
|
144
|
+
year = XUtilsCommon_1.XUtilsCommon.today().getFullYear();
|
|
145
|
+
}
|
|
146
|
+
// ak day alebo month alebo year zostal undefined, tak user zadal nekorektnu hodnotu - vratime undefined
|
|
147
|
+
if (day && month && year) {
|
|
148
|
+
var monthStr = month.toString();
|
|
149
|
+
if (monthStr.length < 2) {
|
|
150
|
+
monthStr = "0" + monthStr;
|
|
151
|
+
}
|
|
152
|
+
var dayStr = day.toString();
|
|
153
|
+
if (dayStr.length < 2) {
|
|
154
|
+
dayStr = "0" + dayStr;
|
|
155
|
+
}
|
|
156
|
+
valueDate = new Date("".concat(year, "-").concat(monthStr, "-").concat(dayStr));
|
|
157
|
+
if (isNaN(valueDate)) {
|
|
158
|
+
// ak je nekorektny datum (napr. 2024-13-01)
|
|
159
|
+
valueDate = undefined;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return valueDate;
|
|
164
|
+
}
|
|
165
|
+
exports.dateFromUI = dateFromUI;
|
|
103
166
|
function dateAsUI(value) {
|
|
104
167
|
if (value !== null) {
|
|
105
168
|
return (0, XUtilsCommon_1.dateFormat)(value, dateFormatUI());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@michalrakus/x-react-web-lib",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.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": "^6.0.1",
|
|
43
|
-
"primereact": "~
|
|
43
|
+
"primereact": "~10.4.0",
|
|
44
44
|
"react": "^18.2.0",
|
|
45
45
|
"react-dom": "^18.2.0",
|
|
46
46
|
"react-transition-group": "^4.4.5"
|