@michalrakus/x-react-web-lib 1.13.0 → 1.15.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/XFormCol.d.ts +3 -0
- package/XFormCol.js +5 -0
- package/XFormInlineRow.d.ts +3 -0
- package/XFormInlineRow.js +5 -0
- package/XFormRow.d.ts +3 -0
- package/XFormRow.js +5 -0
- package/XFormRowCol.d.ts +3 -0
- package/XFormRowCol.js +5 -0
- package/gulpfile.js +5 -0
- package/lib/components/XAutoComplete.d.ts +1 -1
- package/lib/components/XAutoComplete.js +1 -5
- package/lib/components/XAutoCompleteBase.d.ts +1 -0
- package/lib/components/XAutoCompleteBase.js +1 -1
- package/lib/components/XCheckbox.d.ts +3 -1
- package/lib/components/XCheckbox.js +19 -5
- package/lib/components/XDropdownDTFilter.d.ts +3 -0
- package/lib/components/XDropdownDTFilter.js +5 -4
- package/lib/components/XFormComponent.d.ts +4 -1
- package/lib/components/XFormComponent.js +12 -6
- package/lib/components/XFormComponentDT.d.ts +1 -0
- package/lib/components/XFormComponentDT.js +4 -1
- package/lib/components/XFormDataTable2.d.ts +29 -11
- package/lib/components/XFormDataTable2.js +135 -92
- package/lib/components/XFormRowCol/XFormCol.d.ts +8 -0
- package/lib/components/XFormRowCol/XFormCol.js +12 -0
- package/lib/components/XFormRowCol/XFormInlineRow.d.ts +8 -0
- package/lib/components/XFormRowCol/XFormInlineRow.js +12 -0
- package/lib/components/XFormRowCol/XFormRow.d.ts +8 -0
- package/lib/components/XFormRowCol/XFormRow.js +12 -0
- package/lib/components/XFormRowCol/XFormRowCol.d.ts +9 -0
- package/lib/components/XFormRowCol/XFormRowCol.js +30 -0
- package/lib/components/XInputDecimal.js +2 -1
- package/lib/components/XInputDecimalBase.d.ts +1 -0
- package/lib/components/XInputDecimalBase.js +1 -1
- package/lib/components/XInputText.js +2 -1
- package/lib/components/XLazyDataTable.d.ts +10 -1
- package/lib/components/XLazyDataTable.js +6 -3
- package/lib/components/XUtils.d.ts +8 -0
- package/lib/components/XUtils.js +23 -1
- package/package.json +1 -1
package/XFormCol.d.ts
ADDED
package/XFormCol.js
ADDED
package/XFormRow.d.ts
ADDED
package/XFormRow.js
ADDED
package/XFormRowCol.d.ts
ADDED
package/XFormRowCol.js
ADDED
package/gulpfile.js
CHANGED
|
@@ -18,6 +18,11 @@ function generateApi(cb) {
|
|
|
18
18
|
"./lib/administration/XBrowseMetaBrowse",
|
|
19
19
|
"./lib/administration/XBrowseMetaForm",
|
|
20
20
|
|
|
21
|
+
"./lib/components/XFormRowCol/XFormCol",
|
|
22
|
+
"./lib/components/XFormRowCol/XFormInlineRow",
|
|
23
|
+
"./lib/components/XFormRowCol/XFormRow",
|
|
24
|
+
"./lib/components/XFormRowCol/XFormRowCol",
|
|
25
|
+
|
|
21
26
|
"./lib/components/useXToken",
|
|
22
27
|
"./lib/components/XAutoComplete",
|
|
23
28
|
"./lib/components/XAutoCompleteBase",
|
|
@@ -14,7 +14,7 @@ export interface XAutoCompleteProps extends XFormComponentProps<XObject> {
|
|
|
14
14
|
sortField?: string | DataTableSortMeta[];
|
|
15
15
|
suggestions?: any[];
|
|
16
16
|
lazy?: boolean;
|
|
17
|
-
|
|
17
|
+
width?: string;
|
|
18
18
|
inputStyle?: React.CSSProperties;
|
|
19
19
|
}
|
|
20
20
|
export declare class XAutoComplete extends XFormComponent<XObject, XAutoCompleteProps> {
|
|
@@ -138,14 +138,10 @@ var XAutoComplete = /** @class */ (function (_super) {
|
|
|
138
138
|
var _this = this;
|
|
139
139
|
var _a;
|
|
140
140
|
var xEntityAssoc = XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXEntity(this.xAssoc.entityName);
|
|
141
|
-
//const xDisplayField = XUtilsMetadataCommon.getXFieldByPath(xEntityAssoc, this.props.displayField);
|
|
142
|
-
// TODO - readOnly
|
|
143
|
-
// TODO - size
|
|
144
|
-
//const size = this.props.size ?? xDisplayField.length;
|
|
145
141
|
// div className="col" nam zabezpeci aby XAutoCompleteBase nezaberal celu dlzku grid-u (ma nastaveny width=100% vdaka "formgroup-inline")
|
|
146
142
|
return (react_1.default.createElement("div", { className: "field grid" },
|
|
147
143
|
react_1.default.createElement("label", { htmlFor: this.props.assocField, className: "col-fixed", style: this.getLabelStyle() }, this.getLabel()),
|
|
148
|
-
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); }, onSearchStart: this.props.lazy ? this.onSearchStart : undefined })));
|
|
144
|
+
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, width: this.props.width, customFilterFunction: function () { return _this.getFilterBase(_this.props.filter); }, onSearchStart: this.props.lazy ? this.onSearchStart : undefined })));
|
|
149
145
|
};
|
|
150
146
|
return XAutoComplete;
|
|
151
147
|
}(XFormComponent_1.XFormComponent));
|
|
@@ -404,7 +404,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
404
404
|
// Dialog pre konkretny form:
|
|
405
405
|
// <DobrovolnikForm id={this.formDialogObjectId} object={this.formDialogInitValuesForInsert} onSaveOrCancel={this.formDialogOnSaveOrCancel}/>
|
|
406
406
|
// formgroup-inline lepi SplitButton na autocomplete a zarovna jeho vysku
|
|
407
|
-
return (react_1.default.createElement("div", { className: "x-auto-complete-base" },
|
|
407
|
+
return (react_1.default.createElement("div", { className: "x-auto-complete-base", style: { width: this.props.width } },
|
|
408
408
|
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
409
|
dropdownButton,
|
|
410
410
|
this.props.valueForm != undefined && !readOnly ?
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { XInput, XInputProps } from "./XInput";
|
|
3
|
+
import { CheckboxChangeEvent } from "primereact/checkbox";
|
|
3
4
|
export declare class XCheckbox extends XInput<boolean, XInputProps<boolean>> {
|
|
4
5
|
constructor(props: XInputProps<boolean>);
|
|
5
6
|
getValue(): boolean | null;
|
|
6
|
-
|
|
7
|
+
checkboxOnValueChange(e: CheckboxChangeEvent): void;
|
|
8
|
+
triStateCheckboxOnValueChange(e: any): void;
|
|
7
9
|
render(): JSX.Element;
|
|
8
10
|
}
|
|
@@ -22,11 +22,13 @@ exports.XCheckbox = void 0;
|
|
|
22
22
|
var react_1 = __importDefault(require("react"));
|
|
23
23
|
var tristatecheckbox_1 = require("primereact/tristatecheckbox");
|
|
24
24
|
var XInput_1 = require("./XInput");
|
|
25
|
+
var checkbox_1 = require("primereact/checkbox");
|
|
25
26
|
var XCheckbox = /** @class */ (function (_super) {
|
|
26
27
|
__extends(XCheckbox, _super);
|
|
27
28
|
function XCheckbox(props) {
|
|
28
29
|
var _this = _super.call(this, props) || this;
|
|
29
|
-
_this.
|
|
30
|
+
_this.checkboxOnValueChange = _this.checkboxOnValueChange.bind(_this);
|
|
31
|
+
_this.triStateCheckboxOnValueChange = _this.triStateCheckboxOnValueChange.bind(_this);
|
|
30
32
|
return _this;
|
|
31
33
|
}
|
|
32
34
|
XCheckbox.prototype.getValue = function () {
|
|
@@ -34,7 +36,10 @@ var XCheckbox = /** @class */ (function (_super) {
|
|
|
34
36
|
var value = this.getValueFromObject();
|
|
35
37
|
return value;
|
|
36
38
|
};
|
|
37
|
-
XCheckbox.prototype.
|
|
39
|
+
XCheckbox.prototype.checkboxOnValueChange = function (e) {
|
|
40
|
+
this.onValueChangeBase(e.checked, this.props.onChange);
|
|
41
|
+
};
|
|
42
|
+
XCheckbox.prototype.triStateCheckboxOnValueChange = function (e) {
|
|
38
43
|
var newValue = e.value;
|
|
39
44
|
// pri klikani na TriStateCheckbox prichadza v newValue cyklicky: true -> false -> null
|
|
40
45
|
// ak mame not null atribut, tak pri null hodnote skocime rovno na true
|
|
@@ -47,10 +52,19 @@ var XCheckbox = /** @class */ (function (_super) {
|
|
|
47
52
|
this.onValueChangeBase(newValue, this.props.onChange);
|
|
48
53
|
};
|
|
49
54
|
XCheckbox.prototype.render = function () {
|
|
55
|
+
var _a;
|
|
50
56
|
// note: style overrides size (width of the input according to character count)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
react_1.default.createElement(
|
|
57
|
+
// pre not null atributy pouzijeme standardny checkbox aby sme pre false mali prazdny biely checkbox - TODO - pomenit ikonky na TriStateCheckbox aby to pekne sedelo
|
|
58
|
+
var element = this.isNotNull()
|
|
59
|
+
? react_1.default.createElement(checkbox_1.Checkbox, { id: this.props.field, checked: (_a = this.getValue()) !== null && _a !== void 0 ? _a : false, onChange: this.checkboxOnValueChange, disabled: this.isReadOnly(), style: this.props.inputStyle, tooltip: this.props.tooltip })
|
|
60
|
+
: react_1.default.createElement(tristatecheckbox_1.TriStateCheckbox, { id: this.props.field, value: this.getValue(), onChange: this.triStateCheckboxOnValueChange, disabled: this.isReadOnly(), style: this.props.inputStyle, tooltip: this.props.tooltip });
|
|
61
|
+
if (!this.props.onlyInput) {
|
|
62
|
+
var label = this.getLabel();
|
|
63
|
+
element = react_1.default.createElement("div", { className: "field grid" },
|
|
64
|
+
label !== undefined ? react_1.default.createElement("label", { htmlFor: this.props.field, className: "col-fixed", style: this.getLabelStyle() }, label) : null,
|
|
65
|
+
element);
|
|
66
|
+
}
|
|
67
|
+
return element;
|
|
54
68
|
};
|
|
55
69
|
return XCheckbox;
|
|
56
70
|
}(XInput_1.XInput));
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { XCustomFilter } from "../serverApi/FindParam";
|
|
2
3
|
export declare const XDropdownDTFilter: (props: {
|
|
3
4
|
entity: string;
|
|
4
5
|
path: string;
|
|
5
6
|
value: any;
|
|
6
7
|
onValueChange: (field: string, displayValue: any) => void;
|
|
8
|
+
filter?: XCustomFilter | undefined;
|
|
9
|
+
sortField?: string | undefined;
|
|
7
10
|
}) => JSX.Element;
|
|
@@ -98,13 +98,14 @@ var XDropdownDTFilter = function (props) {
|
|
|
98
98
|
};
|
|
99
99
|
var findOptions = function (entity, path, displayField) { return __awaiter(void 0, void 0, void 0, function () {
|
|
100
100
|
var xAssoc, options, emptyOption;
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
var _a;
|
|
102
|
+
return __generator(this, function (_b) {
|
|
103
|
+
switch (_b.label) {
|
|
103
104
|
case 0:
|
|
104
105
|
xAssoc = XUtilsMetadataCommon_1.XUtilsMetadataCommon.getLastXAssocByPath(XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXEntity(entity), path);
|
|
105
|
-
return [4 /*yield*/, XUtils_1.XUtils.fetchRows(xAssoc.entityName,
|
|
106
|
+
return [4 /*yield*/, XUtils_1.XUtils.fetchRows(xAssoc.entityName, props.filter, (_a = props.sortField) !== null && _a !== void 0 ? _a : displayField)];
|
|
106
107
|
case 1:
|
|
107
|
-
options =
|
|
108
|
+
options = _b.sent();
|
|
108
109
|
emptyOption = {};
|
|
109
110
|
emptyOption[displayField] = XUtils_1.XUtils.dropdownEmptyOptionValue;
|
|
110
111
|
options.splice(0, 0, emptyOption); // null polozka (nepridavat pre not null atributy)
|
|
@@ -10,19 +10,22 @@ export type XFilterProp = XCustomFilter | ((object: any) => XCustomFilter | unde
|
|
|
10
10
|
export interface XFormComponentProps<T> {
|
|
11
11
|
form: XFormBase;
|
|
12
12
|
label?: string;
|
|
13
|
+
tooltip?: string;
|
|
13
14
|
readOnly?: XReadOnlyProp;
|
|
14
15
|
labelStyle?: React.CSSProperties;
|
|
15
16
|
inline?: boolean;
|
|
16
17
|
onChange?: XFieldOnChange;
|
|
18
|
+
onlyInput?: boolean;
|
|
17
19
|
}
|
|
18
20
|
export declare abstract class XFormComponent<T, P extends XFormComponentProps<T>> extends Component<P> {
|
|
21
|
+
private valueChanged;
|
|
19
22
|
protected constructor(props: P);
|
|
20
23
|
abstract getField(): string;
|
|
21
24
|
getValueFromObject(): any;
|
|
22
25
|
onValueChangeBase(value: any, onChange?: XFieldOnChange, assocObjectChange?: OperationType): void;
|
|
23
26
|
abstract isNotNull(): boolean;
|
|
24
27
|
isReadOnly(): boolean;
|
|
25
|
-
getLabel(): string;
|
|
28
|
+
getLabel(): string | undefined;
|
|
26
29
|
getLabelStyle(): React.CSSProperties;
|
|
27
30
|
validate(): {
|
|
28
31
|
field: string;
|
|
@@ -21,8 +21,10 @@ var XUtilsCommon_1 = require("../serverApi/XUtilsCommon");
|
|
|
21
21
|
var XUtils_1 = require("./XUtils");
|
|
22
22
|
var XFormComponent = /** @class */ (function (_super) {
|
|
23
23
|
__extends(XFormComponent, _super);
|
|
24
|
+
// mali sme problem ze aplikacny onChange sa volal aj ked uzivatel iba klikol do inputu a odisiel z neho
|
|
24
25
|
function XFormComponent(props) {
|
|
25
26
|
var _this = _super.call(this, props) || this;
|
|
27
|
+
_this.valueChanged = false;
|
|
26
28
|
props.form.addXFormComponent(_this);
|
|
27
29
|
return _this;
|
|
28
30
|
}
|
|
@@ -45,6 +47,7 @@ var XFormComponent = /** @class */ (function (_super) {
|
|
|
45
47
|
XFormComponent.prototype.onValueChangeBase = function (value, onChange, assocObjectChange) {
|
|
46
48
|
var error = this.validateOnChange(value);
|
|
47
49
|
this.props.form.onFieldChange(this.getField(), value, error, onChange, assocObjectChange);
|
|
50
|
+
this.valueChanged = true;
|
|
48
51
|
};
|
|
49
52
|
XFormComponent.prototype.isReadOnly = function () {
|
|
50
53
|
var readOnly;
|
|
@@ -76,12 +79,14 @@ var XFormComponent = /** @class */ (function (_super) {
|
|
|
76
79
|
}
|
|
77
80
|
return readOnly;
|
|
78
81
|
};
|
|
82
|
+
// ak je label undefined, label element sa nevykresli
|
|
79
83
|
XFormComponent.prototype.getLabel = function () {
|
|
80
|
-
var
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
var label = this.props.label;
|
|
85
|
+
if (label !== undefined) {
|
|
86
|
+
// test na readOnly je tu hlavne koli tomu aby sme nemali * pri ID atribute, ktory sa pri inserte generuje az pri zapise do DB
|
|
87
|
+
if (this.isNotNull() && !this.isReadOnly()) {
|
|
88
|
+
label = XUtils_1.XUtils.markNotNull(label);
|
|
89
|
+
}
|
|
85
90
|
}
|
|
86
91
|
return label;
|
|
87
92
|
};
|
|
@@ -147,12 +152,13 @@ var XFormComponent = /** @class */ (function (_super) {
|
|
|
147
152
|
return error ? XUtils_1.XUtils.getErrorMessage(error) : undefined;
|
|
148
153
|
};
|
|
149
154
|
XFormComponent.prototype.callOnChangeFromOnBlur = function () {
|
|
150
|
-
if (this.props.onChange) {
|
|
155
|
+
if (this.valueChanged && this.props.onChange) {
|
|
151
156
|
var object = this.props.form.getXObject();
|
|
152
157
|
// developer v onChange nastavi atributy na object-e
|
|
153
158
|
this.props.onChange({ object: object });
|
|
154
159
|
// rovno zavolame form.setState({...}), nech to nemusi robit developer
|
|
155
160
|
this.props.form.setStateXForm();
|
|
161
|
+
this.valueChanged = false; // resetneme na false (dalsi onChange volame az ked user zmeni hodnotu)
|
|
156
162
|
}
|
|
157
163
|
};
|
|
158
164
|
// len pre assoc fieldy sa pouziva
|
|
@@ -12,6 +12,7 @@ export interface XFormComponentDTProps {
|
|
|
12
12
|
onChange?: XTableFieldOnChange;
|
|
13
13
|
}
|
|
14
14
|
export declare abstract class XFormComponentDT<P extends XFormComponentDTProps> extends Component<P> {
|
|
15
|
+
private valueChanged;
|
|
15
16
|
protected constructor(props: P);
|
|
16
17
|
abstract getField(): string;
|
|
17
18
|
getValueFromRowData(): any;
|
|
@@ -24,6 +24,7 @@ var XFormComponentDT = /** @class */ (function (_super) {
|
|
|
24
24
|
__extends(XFormComponentDT, _super);
|
|
25
25
|
function XFormComponentDT(props) {
|
|
26
26
|
var _this = _super.call(this, props) || this;
|
|
27
|
+
_this.valueChanged = false;
|
|
27
28
|
XFormBase_1.XFormBase.getXRowTechData(props.rowData).xFormComponentDTList.push(_this);
|
|
28
29
|
return _this;
|
|
29
30
|
}
|
|
@@ -46,6 +47,7 @@ var XFormComponentDT = /** @class */ (function (_super) {
|
|
|
46
47
|
XFormComponentDT.prototype.onValueChangeBase = function (value, onChange, assocObjectChange) {
|
|
47
48
|
var error = this.validateOnChange(value);
|
|
48
49
|
this.props.form.onTableFieldChange(this.props.rowData, this.getField(), value, error, onChange, assocObjectChange);
|
|
50
|
+
this.valueChanged = true;
|
|
49
51
|
};
|
|
50
52
|
XFormComponentDT.prototype.isReadOnly = function () {
|
|
51
53
|
var readOnly;
|
|
@@ -114,12 +116,13 @@ var XFormComponentDT = /** @class */ (function (_super) {
|
|
|
114
116
|
return error ? XUtils_1.XUtils.getErrorMessage(error) : undefined;
|
|
115
117
|
};
|
|
116
118
|
XFormComponentDT.prototype.callOnChangeFromOnBlur = function () {
|
|
117
|
-
if (this.props.onChange) {
|
|
119
|
+
if (this.valueChanged && this.props.onChange) {
|
|
118
120
|
var object = this.props.form.getXObject();
|
|
119
121
|
// developer v onChange nastavi atributy na object-e
|
|
120
122
|
this.props.onChange({ object: object, tableRow: this.props.rowData, assocObjectChange: undefined });
|
|
121
123
|
// rovno zavolame form.setState({...}), nech to nemusi robit developer
|
|
122
124
|
this.props.form.setStateXForm();
|
|
125
|
+
this.valueChanged = false; // resetneme na false (dalsi onChange volame az ked user zmeni hodnotu)
|
|
123
126
|
}
|
|
124
127
|
};
|
|
125
128
|
// len pre assoc fieldy sa pouziva, aj to nie pre vsetky
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { XFormBase } from "./XFormBase";
|
|
2
|
-
import { Component, ReactChild } from "react";
|
|
2
|
+
import React, { Component, ReactChild } from "react";
|
|
3
3
|
import { DataTableFilterMeta } from "primereact/datatable";
|
|
4
|
+
import { ColumnBodyOptions } from "primereact/column";
|
|
4
5
|
import { XEntity, XField } from "../serverApi/XEntityMetadata";
|
|
6
|
+
import { XViewStatusOrBoolean } from "./XUtils";
|
|
5
7
|
import { FilterMatchMode } from "primereact/api";
|
|
6
8
|
import { XTableFieldChangeEvent } from "./XFieldChangeEvent";
|
|
7
9
|
import { XCustomFilter } from "../serverApi/FindParam";
|
|
@@ -65,8 +67,8 @@ export declare class XFormDataTable2 extends Component<XFormDataTableProps> {
|
|
|
65
67
|
filters: DataTableFilterMeta;
|
|
66
68
|
};
|
|
67
69
|
constructor(props: XFormDataTableProps);
|
|
68
|
-
getPathForColumn(columnProps:
|
|
69
|
-
static getHeader(columnProps:
|
|
70
|
+
getPathForColumn(columnProps: XFormColumnBaseProps): string;
|
|
71
|
+
static getHeader(columnProps: XFormColumnBaseProps, xEntity: XEntity, field: string, xField: XField): string;
|
|
70
72
|
static isReadOnlyHeader(path: string | undefined, readOnly: XTableFieldReadOnlyProp | undefined): boolean;
|
|
71
73
|
getEntity(): string;
|
|
72
74
|
createInitFilters(): DataTableFilterMeta;
|
|
@@ -78,7 +80,7 @@ export declare class XFormDataTable2 extends Component<XFormDataTableProps> {
|
|
|
78
80
|
getCheckboxFilterValue(field: string): boolean | null;
|
|
79
81
|
onDropdownFilterChange(field: string, displayValue: any): void;
|
|
80
82
|
getDropdownFilterValue(field: string): any;
|
|
81
|
-
bodyTemplate(columnProps:
|
|
83
|
+
bodyTemplate(columnProps: XFormColumnBaseProps, tableReadOnly: boolean, rowData: any, xEntity: XEntity): any;
|
|
82
84
|
onClickAddRow(): void;
|
|
83
85
|
onClickRemoveRowBySelection(): void;
|
|
84
86
|
removeRow(row: any): void;
|
|
@@ -89,25 +91,26 @@ export declare class XFormDataTable2 extends Component<XFormDataTableProps> {
|
|
|
89
91
|
export type XTableFieldOnChange = (e: XTableFieldChangeEvent<any, any>) => void;
|
|
90
92
|
export type XTableFieldReadOnlyProp = boolean | ((object: any, tableRow: any) => boolean);
|
|
91
93
|
export type XTableFieldFilterProp = XCustomFilter | ((object: any, rowData: any) => XCustomFilter | undefined);
|
|
92
|
-
export interface
|
|
93
|
-
type: "inputSimple" | "dropdown" | "autoComplete" | "searchButton";
|
|
94
|
+
export interface XFormColumnBaseProps {
|
|
95
|
+
type: "inputSimple" | "dropdown" | "autoComplete" | "searchButton" | "custom";
|
|
94
96
|
header?: any;
|
|
95
97
|
readOnly?: XTableFieldReadOnlyProp;
|
|
96
98
|
dropdownInFilter?: boolean;
|
|
97
99
|
showFilterMenu?: boolean;
|
|
98
100
|
width?: string;
|
|
99
101
|
onChange?: XTableFieldOnChange;
|
|
102
|
+
columnViewStatus: XViewStatusOrBoolean;
|
|
100
103
|
}
|
|
101
|
-
export interface
|
|
104
|
+
export interface XFormColumnProps extends XFormColumnBaseProps {
|
|
102
105
|
field: string;
|
|
103
106
|
}
|
|
104
|
-
export interface XFormDropdownColumnProps extends
|
|
107
|
+
export interface XFormDropdownColumnProps extends XFormColumnBaseProps {
|
|
105
108
|
assocField: string;
|
|
106
109
|
displayField: string;
|
|
107
110
|
sortField?: string;
|
|
108
111
|
filter?: XCustomFilter;
|
|
109
112
|
}
|
|
110
|
-
export interface XFormAutoCompleteColumnProps extends
|
|
113
|
+
export interface XFormAutoCompleteColumnProps extends XFormColumnBaseProps {
|
|
111
114
|
assocField: string;
|
|
112
115
|
displayField: string;
|
|
113
116
|
searchBrowse?: JSX.Element;
|
|
@@ -115,32 +118,47 @@ export interface XFormAutoCompleteColumnProps extends XFormColumnProps {
|
|
|
115
118
|
filter?: XTableFieldFilterProp;
|
|
116
119
|
suggestions?: any[];
|
|
117
120
|
}
|
|
118
|
-
export interface XFormSearchButtonColumnProps extends
|
|
121
|
+
export interface XFormSearchButtonColumnProps extends XFormColumnBaseProps {
|
|
119
122
|
assocField: string;
|
|
120
123
|
displayField: string;
|
|
121
124
|
searchBrowse: JSX.Element;
|
|
122
125
|
}
|
|
126
|
+
export interface XFormCustomColumnProps extends XFormColumnBaseProps {
|
|
127
|
+
body: React.ReactNode | ((data: any, options: ColumnBodyOptions) => React.ReactNode);
|
|
128
|
+
field?: string;
|
|
129
|
+
}
|
|
123
130
|
export declare const XFormColumn: {
|
|
124
|
-
(props:
|
|
131
|
+
(props: XFormColumnProps): null;
|
|
125
132
|
defaultProps: {
|
|
126
133
|
type: string;
|
|
134
|
+
columnViewStatus: boolean;
|
|
127
135
|
};
|
|
128
136
|
};
|
|
129
137
|
export declare const XFormDropdownColumn: {
|
|
130
138
|
(props: XFormDropdownColumnProps): null;
|
|
131
139
|
defaultProps: {
|
|
132
140
|
type: string;
|
|
141
|
+
columnViewStatus: boolean;
|
|
133
142
|
};
|
|
134
143
|
};
|
|
135
144
|
export declare const XFormAutoCompleteColumn: {
|
|
136
145
|
(props: XFormAutoCompleteColumnProps): null;
|
|
137
146
|
defaultProps: {
|
|
138
147
|
type: string;
|
|
148
|
+
columnViewStatus: boolean;
|
|
139
149
|
};
|
|
140
150
|
};
|
|
141
151
|
export declare const XFormSearchButtonColumn: {
|
|
142
152
|
(props: XFormSearchButtonColumnProps): null;
|
|
143
153
|
defaultProps: {
|
|
144
154
|
type: string;
|
|
155
|
+
columnViewStatus: boolean;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
export declare const XFormCustomColumn: {
|
|
159
|
+
(props: XFormCustomColumnProps): null;
|
|
160
|
+
defaultProps: {
|
|
161
|
+
type: string;
|
|
162
|
+
columnViewStatus: boolean;
|
|
145
163
|
};
|
|
146
164
|
};
|
|
@@ -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.XFormSearchButtonColumn = exports.XFormAutoCompleteColumn = exports.XFormDropdownColumn = exports.XFormColumn = exports.XFormDataTable2 = void 0;
|
|
63
|
+
exports.XFormCustomColumn = 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");
|
|
@@ -118,8 +118,10 @@ var XFormDataTable2 = /** @class */ (function (_super) {
|
|
|
118
118
|
for (var _b = __values(props.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
119
119
|
var child = _c.value;
|
|
120
120
|
var childColumn = child; // nevedel som to krajsie...
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
if (childColumn.props.type !== "custom") {
|
|
122
|
+
var field = props.assocField + '.' + _this.getPathForColumn(childColumn.props);
|
|
123
|
+
props.form.addField(field);
|
|
124
|
+
}
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
127
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
@@ -231,24 +233,27 @@ var XFormDataTable2 = /** @class */ (function (_super) {
|
|
|
231
233
|
for (var _b = __values(this.props.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
232
234
|
var child = _c.value;
|
|
233
235
|
var childColumn = child; // nevedel som to krajsie...
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
236
|
+
// zatial nepodporujeme filter pre custom stlpce
|
|
237
|
+
if (childColumn.props.type !== "custom") {
|
|
238
|
+
var field = this.getPathForColumn(childColumn.props);
|
|
239
|
+
var xField = XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXFieldByPath(xEntity, field);
|
|
240
|
+
// TODO column.props.dropdownInFilter - pre "menu" by bolo fajn mat zoznam "enumov"
|
|
241
|
+
var filterMatchMode = this.getFilterMatchMode(xField);
|
|
242
|
+
var filterItem = void 0;
|
|
243
|
+
if (this.props.filterDisplay === "menu") {
|
|
244
|
+
// DataTableOperatorFilterMetaData: operator + filter values
|
|
245
|
+
filterItem = {
|
|
246
|
+
operator: api_1.FilterOperator.OR,
|
|
247
|
+
constraints: [{ value: null, matchMode: filterMatchMode }]
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
// props.filterDisplay === "row"
|
|
252
|
+
// DataTableFilterMetaData: filter value
|
|
253
|
+
filterItem = { value: null, matchMode: filterMatchMode };
|
|
254
|
+
}
|
|
255
|
+
initFilters[field] = filterItem;
|
|
250
256
|
}
|
|
251
|
-
initFilters[field] = filterItem;
|
|
252
257
|
}
|
|
253
258
|
}
|
|
254
259
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
@@ -350,8 +355,19 @@ var XFormDataTable2 = /** @class */ (function (_super) {
|
|
|
350
355
|
// body={(rowData: any) => bodyTemplate(childColumn.props.field, rowData)}
|
|
351
356
|
XFormDataTable2.prototype.bodyTemplate = function (columnProps, tableReadOnly, rowData, xEntity) {
|
|
352
357
|
var body;
|
|
358
|
+
// columnProps.columnViewStatus "ReadOnly" has higher prio then tableReadOnly
|
|
353
359
|
// tableReadOnly has higher prio then property readOnly
|
|
354
|
-
|
|
360
|
+
// (viewStatus "Hidden" - column is not rendered (bodyTemplate not called), viewStatus "ReadWrite" (default) - tableReadOnly/columnProps.readOnly is applied)
|
|
361
|
+
var readOnly;
|
|
362
|
+
if (XUtils_1.XUtils.xViewStatus(columnProps.columnViewStatus) === XUtils_1.XViewStatus.ReadOnly) {
|
|
363
|
+
readOnly = true;
|
|
364
|
+
}
|
|
365
|
+
else if (tableReadOnly) {
|
|
366
|
+
readOnly = true;
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
readOnly = columnProps.readOnly;
|
|
370
|
+
}
|
|
355
371
|
if (columnProps.type === "inputSimple") {
|
|
356
372
|
var columnPropsInputSimple = columnProps;
|
|
357
373
|
var xField = XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXFieldByPath(xEntity, columnPropsInputSimple.field);
|
|
@@ -497,7 +513,8 @@ var XFormDataTable2 = /** @class */ (function (_super) {
|
|
|
497
513
|
};
|
|
498
514
|
XFormDataTable2.prototype.render = function () {
|
|
499
515
|
var _this = this;
|
|
500
|
-
var _a, _b;
|
|
516
|
+
var _a, _b, _c;
|
|
517
|
+
var xEntity = XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXEntity(this.getEntity());
|
|
501
518
|
var paginator = this.props.paginator !== undefined ? this.props.paginator : false;
|
|
502
519
|
var rows = undefined;
|
|
503
520
|
if (paginator) {
|
|
@@ -509,13 +526,14 @@ var XFormDataTable2 = /** @class */ (function (_super) {
|
|
|
509
526
|
}
|
|
510
527
|
}
|
|
511
528
|
var filterDisplay = this.props.filterDisplay !== "none" ? this.props.filterDisplay : undefined;
|
|
529
|
+
// 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;
|
|
512
531
|
var label = this.props.label !== undefined ? this.props.label : this.props.assocField;
|
|
513
532
|
var readOnly = this.isReadOnly();
|
|
514
533
|
// v bloku function (child) nejde pouzit priamo this, thisLocal uz ide pouzit
|
|
515
534
|
var thisLocal = this;
|
|
516
535
|
var object = this.props.form.state.object;
|
|
517
536
|
var valueList = object !== null ? object[this.props.assocField] : [];
|
|
518
|
-
var xEntity = XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXEntity(this.getEntity());
|
|
519
537
|
var scrollWidth = undefined; // vypnute horizontalne scrollovanie
|
|
520
538
|
var scrollHeight = undefined; // vypnute vertikalne scrollovanie
|
|
521
539
|
if (this.props.scrollable) {
|
|
@@ -543,78 +561,101 @@ var XFormDataTable2 = /** @class */ (function (_super) {
|
|
|
543
561
|
tableStyle = __assign(__assign({}, tableStyle), { width: width });
|
|
544
562
|
}
|
|
545
563
|
// pre lepsiu citatelnost vytvarame stlpce uz tu
|
|
546
|
-
var columnElemList = react_1.default.Children.map(this.props.children, function (child) {
|
|
564
|
+
var columnElemList = react_1.default.Children.map(this.props.children.filter(function (child) { return XUtils_1.XUtils.xViewStatus(child.props.columnViewStatus) !== XUtils_1.XViewStatus.Hidden; }), function (child) {
|
|
547
565
|
// ak chceme zmenit child element, tak treba bud vytvorit novy alebo vyklonovat
|
|
548
566
|
// priklad je na https://soshace.com/building-react-components-using-children-props-and-context-api/
|
|
549
567
|
// (vzdy musime robit manipulacie so stlpcom, lebo potrebujeme pridat filter={true} sortable={true}
|
|
550
568
|
var childColumn = child; // nevedel som to krajsie...
|
|
551
569
|
var childColumnProps = childColumn.props;
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
var field = thisLocal.getPathForColumn(childColumnProps);
|
|
555
|
-
// TODO - toto by sa mohlo vytiahnut vyssie, aj v bodyTemplate sa vola metoda XUtilsMetadata.getXFieldByPath
|
|
556
|
-
var xField = XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXFieldByPath(xEntity, field);
|
|
557
|
-
// *********** header ***********
|
|
558
|
-
var header = XFormDataTable2.getHeader(childColumnProps, xEntity, field, xField);
|
|
559
|
-
// *********** filterElement ***********
|
|
570
|
+
var fieldParam;
|
|
571
|
+
var header;
|
|
560
572
|
var filterElement;
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
573
|
+
var showFilterMenu;
|
|
574
|
+
var width;
|
|
575
|
+
var align;
|
|
576
|
+
var body;
|
|
577
|
+
if (childColumnProps.type === "custom") {
|
|
578
|
+
// len jednoduche hodnoty, zatial nebude takmer ziadna podpora
|
|
579
|
+
var columnPropsCustom = childColumnProps;
|
|
580
|
+
fieldParam = columnPropsCustom.field;
|
|
581
|
+
header = columnPropsCustom.header;
|
|
582
|
+
filterElement = undefined;
|
|
583
|
+
showFilterMenu = false;
|
|
584
|
+
width = XUtils_1.XUtils.processPropWidth(columnPropsCustom.width);
|
|
585
|
+
align = undefined;
|
|
586
|
+
body = columnPropsCustom.body;
|
|
570
587
|
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
588
|
+
else {
|
|
589
|
+
// fieldy ktore su v modeli (existuje xField)
|
|
590
|
+
// je dolezite, aby field obsahoval cely path az po zobrazovany atribut, lebo podla neho sa vykonava filtrovanie a sortovanie
|
|
591
|
+
// (aj ked, da sa to prebit na stlpcoch (na elemente Column), su na to atributy)
|
|
592
|
+
var field_1 = thisLocal.getPathForColumn(childColumnProps);
|
|
593
|
+
// TODO - toto by sa mohlo vytiahnut vyssie, aj v bodyTemplate sa vola metoda XUtilsMetadata.getXFieldByPath
|
|
594
|
+
var xField = XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXFieldByPath(xEntity, field_1);
|
|
595
|
+
// *********** header ***********
|
|
596
|
+
header = XFormDataTable2.getHeader(childColumnProps, xEntity, field_1, xField);
|
|
597
|
+
// *********** filterElement ***********
|
|
598
|
+
if (thisLocal.props.filterDisplay !== "none") {
|
|
599
|
+
if (xField.type === "boolean") {
|
|
600
|
+
var checkboxValue = thisLocal.getCheckboxFilterValue(field_1);
|
|
601
|
+
filterElement = react_1.default.createElement(tristatecheckbox_1.TriStateCheckbox, { value: checkboxValue, onChange: function (e) { return thisLocal.onCheckboxFilterChange(field_1, e.value); } });
|
|
602
|
+
}
|
|
603
|
+
else if (childColumnProps.dropdownInFilter) {
|
|
604
|
+
var dropdownValue = thisLocal.getDropdownFilterValue(field_1);
|
|
605
|
+
filterElement = react_1.default.createElement(XDropdownDTFilter_1.XDropdownDTFilter, { entity: thisLocal.getEntity(), path: field_1, value: dropdownValue, onValueChange: thisLocal.onDropdownFilterChange });
|
|
606
|
+
}
|
|
576
607
|
}
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
608
|
+
// *********** showFilterMenu ***********
|
|
609
|
+
showFilterMenu = false;
|
|
610
|
+
if (thisLocal.props.filterDisplay !== "none") {
|
|
611
|
+
if (childColumnProps.showFilterMenu !== undefined) {
|
|
612
|
+
showFilterMenu = childColumnProps.showFilterMenu;
|
|
613
|
+
}
|
|
614
|
+
else {
|
|
615
|
+
showFilterMenu = true; // default
|
|
616
|
+
if (thisLocal.props.filterDisplay === "row") {
|
|
617
|
+
if (xField.type === "boolean" || childColumnProps.dropdownInFilter) {
|
|
618
|
+
showFilterMenu = false;
|
|
619
|
+
}
|
|
582
620
|
}
|
|
583
621
|
}
|
|
584
622
|
}
|
|
623
|
+
// *********** width/headerStyle ***********
|
|
624
|
+
width = XUtils_1.XUtils.processPropWidth(childColumn.props.width);
|
|
625
|
+
if (width === undefined || width === "default") {
|
|
626
|
+
var filterMenuInFilterRow = thisLocal.props.filterDisplay === "row" && showFilterMenu;
|
|
627
|
+
var sortableButtonInHeader = thisLocal.props.sortable;
|
|
628
|
+
var filterButtonInHeader = thisLocal.props.filterDisplay === "menu";
|
|
629
|
+
width = XUtilsMetadata_1.XUtilsMetadata.computeColumnWidth(xField, undefined, filterMenuInFilterRow, childColumnProps.type, header, sortableButtonInHeader, filterButtonInHeader);
|
|
630
|
+
}
|
|
631
|
+
// *********** align ***********
|
|
632
|
+
align = undefined; // default undefined (left)
|
|
633
|
+
// do buducna
|
|
634
|
+
// if (childColumnProps.align !== undefined) {
|
|
635
|
+
// align = childColumnProps.align;
|
|
636
|
+
// }
|
|
637
|
+
// else {
|
|
638
|
+
// decimal defaultne zarovnavame doprava
|
|
639
|
+
// if (xField.type === "decimal") {
|
|
640
|
+
// align = "right";
|
|
641
|
+
// }
|
|
642
|
+
// else
|
|
643
|
+
if (xField.type === "boolean") {
|
|
644
|
+
align = "center";
|
|
645
|
+
}
|
|
646
|
+
// }
|
|
647
|
+
// *********** body ***********
|
|
648
|
+
body = function (rowData) { return thisLocal.bodyTemplate(childColumnProps, readOnly, rowData, xEntity); };
|
|
649
|
+
fieldParam = field_1;
|
|
585
650
|
}
|
|
586
651
|
// *********** showClearButton ***********
|
|
587
652
|
// pre filterDisplay = "row" nechceme clear button, chceme setrit miesto
|
|
588
653
|
var showClearButton = thisLocal.props.filterDisplay === "menu";
|
|
589
|
-
// *********** width/headerStyle ***********
|
|
590
|
-
var width = XUtils_1.XUtils.processPropWidth(childColumn.props.width);
|
|
591
|
-
if (width === undefined || width === "default") {
|
|
592
|
-
var filterMenuInFilterRow = thisLocal.props.filterDisplay === "row" && showFilterMenu;
|
|
593
|
-
var sortableButtonInHeader = thisLocal.props.sortable;
|
|
594
|
-
var filterButtonInHeader = thisLocal.props.filterDisplay === "menu";
|
|
595
|
-
width = XUtilsMetadata_1.XUtilsMetadata.computeColumnWidth(xField, undefined, filterMenuInFilterRow, childColumnProps.type, header, sortableButtonInHeader, filterButtonInHeader);
|
|
596
|
-
}
|
|
597
654
|
var headerStyle = {};
|
|
598
655
|
if (width !== undefined) {
|
|
599
656
|
headerStyle = { width: width };
|
|
600
657
|
}
|
|
601
|
-
|
|
602
|
-
var align = undefined; // default undefined (left)
|
|
603
|
-
// do buducna
|
|
604
|
-
// if (childColumnProps.align !== undefined) {
|
|
605
|
-
// align = childColumnProps.align;
|
|
606
|
-
// }
|
|
607
|
-
// else {
|
|
608
|
-
// decimal defaultne zarovnavame doprava
|
|
609
|
-
// if (xField.type === "decimal") {
|
|
610
|
-
// align = "right";
|
|
611
|
-
// }
|
|
612
|
-
// else
|
|
613
|
-
if (xField.type === "boolean") {
|
|
614
|
-
align = "center";
|
|
615
|
-
}
|
|
616
|
-
// }
|
|
617
|
-
return react_1.default.createElement(column_1.Column, { field: field, header: header, filter: thisLocal.props.filterDisplay !== "none", sortable: thisLocal.props.sortable, filterElement: filterElement, showFilterMenu: showFilterMenu, showClearButton: showClearButton, headerStyle: headerStyle, align: align, body: function (rowData) { return thisLocal.bodyTemplate(childColumnProps, readOnly, rowData, xEntity); } });
|
|
658
|
+
return react_1.default.createElement(column_1.Column, { field: fieldParam, header: header, filter: thisLocal.props.filterDisplay !== "none", sortable: thisLocal.props.sortable, filterElement: filterElement, showFilterMenu: showFilterMenu, showClearButton: showClearButton, headerStyle: headerStyle, align: align, body: body });
|
|
618
659
|
});
|
|
619
660
|
if (this.props.showAddRemoveButtons && this.props.removeButtonInRow) {
|
|
620
661
|
// je dolezite nastavit sirku header-a, lebo inac ma stlpec sirku 0 a nevidno ho
|
|
@@ -624,14 +665,14 @@ var XFormDataTable2 = /** @class */ (function (_super) {
|
|
|
624
665
|
var removeRowLabel = undefined;
|
|
625
666
|
if (this.props.showAddRemoveButtons) {
|
|
626
667
|
// calling xLocaleOption does not work in standard default values initialisation place (public static defaultProps)
|
|
627
|
-
addRowLabel = (
|
|
628
|
-
removeRowLabel = (
|
|
668
|
+
addRowLabel = (_b = this.props.addRowLabel) !== null && _b !== void 0 ? _b : (0, XLocale_1.xLocaleOption)('addRow');
|
|
669
|
+
removeRowLabel = (_c = this.props.removeRowLabel) !== null && _c !== void 0 ? _c : (0, XLocale_1.xLocaleOption)('removeRow');
|
|
629
670
|
}
|
|
630
671
|
return (react_1.default.createElement("div", null,
|
|
631
672
|
react_1.default.createElement("div", { className: "flex justify-content-center" },
|
|
632
673
|
react_1.default.createElement("label", null, label)),
|
|
633
674
|
react_1.default.createElement("div", { className: "flex justify-content-center" },
|
|
634
|
-
react_1.default.createElement(datatable_1.DataTable, { ref: function (el) { return _this.dt = el; }, value: valueList, dataKey: this.dataKey, paginator: paginator, rows: rows, totalRecords: valueList.length, filterDisplay: filterDisplay, filters: this.state.filters, onFilter: this.onFilter, sortMode: "multiple", removableSort: true, multiSortMeta:
|
|
675
|
+
react_1.default.createElement(datatable_1.DataTable, { ref: function (el) { return _this.dt = el; }, value: valueList, dataKey: this.dataKey, paginator: paginator, rows: rows, totalRecords: valueList.length, filterDisplay: filterDisplay, filters: this.state.filters, onFilter: this.onFilter, sortMode: "multiple", removableSort: true, multiSortMeta: sortField !== undefined ? [{ field: sortField, order: 1 }] : undefined, selectionMode: "single", selection: this.state.selectedRow, onSelectionChange: this.onSelectionChange, className: "p-datatable-sm x-form-datatable", resizableColumns: true, columnResizeMode: "expand", tableStyle: tableStyle, scrollable: this.props.scrollable, scrollHeight: scrollHeight, style: style }, columnElemList)),
|
|
635
676
|
this.props.showAddRemoveButtons ?
|
|
636
677
|
react_1.default.createElement("div", { className: "flex justify-content-center" },
|
|
637
678
|
react_1.default.createElement(XButton_1.XButton, { icon: this.props.addRowIcon, label: addRowLabel, onClick: this.onClickAddRow, disabled: readOnly }),
|
|
@@ -639,8 +680,8 @@ var XFormDataTable2 = /** @class */ (function (_super) {
|
|
|
639
680
|
: undefined));
|
|
640
681
|
};
|
|
641
682
|
XFormDataTable2.defaultProps = {
|
|
642
|
-
filterDisplay: "
|
|
643
|
-
sortable:
|
|
683
|
+
filterDisplay: "none",
|
|
684
|
+
sortable: false,
|
|
644
685
|
scrollable: true,
|
|
645
686
|
scrollWidth: '100%',
|
|
646
687
|
scrollHeight: '200vh',
|
|
@@ -654,35 +695,37 @@ var XFormDataTable2 = /** @class */ (function (_super) {
|
|
|
654
695
|
return XFormDataTable2;
|
|
655
696
|
}(react_1.Component));
|
|
656
697
|
exports.XFormDataTable2 = XFormDataTable2;
|
|
698
|
+
// default props for XFormColumnBaseProps
|
|
699
|
+
var XFormColumnBase_defaultProps = {
|
|
700
|
+
columnViewStatus: true
|
|
701
|
+
};
|
|
657
702
|
var XFormColumn = function (props) {
|
|
658
703
|
// nevadi ze tu nic nevraciame, field a header vieme precitat a zvysok by sme aj tak zahodili lebo vytvarame novy element
|
|
659
704
|
return (null);
|
|
660
705
|
};
|
|
661
706
|
exports.XFormColumn = XFormColumn;
|
|
662
|
-
exports.XFormColumn.defaultProps = {
|
|
663
|
-
type: "inputSimple"
|
|
664
|
-
};
|
|
707
|
+
exports.XFormColumn.defaultProps = __assign(__assign({}, XFormColumnBase_defaultProps), { type: "inputSimple" });
|
|
665
708
|
var XFormDropdownColumn = function (props) {
|
|
666
709
|
// nevadi ze tu nic nevraciame, field a header vieme precitat a zvysok by sme aj tak zahodili lebo vytvarame novy element
|
|
667
710
|
return (null);
|
|
668
711
|
};
|
|
669
712
|
exports.XFormDropdownColumn = XFormDropdownColumn;
|
|
670
|
-
exports.XFormDropdownColumn.defaultProps = {
|
|
671
|
-
type: "dropdown"
|
|
672
|
-
};
|
|
713
|
+
exports.XFormDropdownColumn.defaultProps = __assign(__assign({}, XFormColumnBase_defaultProps), { type: "dropdown" });
|
|
673
714
|
var XFormAutoCompleteColumn = function (props) {
|
|
674
715
|
// nevadi ze tu nic nevraciame, field a header vieme precitat a zvysok by sme aj tak zahodili lebo vytvarame novy element
|
|
675
716
|
return (null);
|
|
676
717
|
};
|
|
677
718
|
exports.XFormAutoCompleteColumn = XFormAutoCompleteColumn;
|
|
678
|
-
exports.XFormAutoCompleteColumn.defaultProps = {
|
|
679
|
-
type: "autoComplete"
|
|
680
|
-
};
|
|
719
|
+
exports.XFormAutoCompleteColumn.defaultProps = __assign(__assign({}, XFormColumnBase_defaultProps), { type: "autoComplete" });
|
|
681
720
|
var XFormSearchButtonColumn = function (props) {
|
|
682
721
|
// nevadi ze tu nic nevraciame, field a header vieme precitat a zvysok by sme aj tak zahodili lebo vytvarame novy element
|
|
683
722
|
return (null);
|
|
684
723
|
};
|
|
685
724
|
exports.XFormSearchButtonColumn = XFormSearchButtonColumn;
|
|
686
|
-
exports.XFormSearchButtonColumn.defaultProps = {
|
|
687
|
-
|
|
725
|
+
exports.XFormSearchButtonColumn.defaultProps = __assign(__assign({}, XFormColumnBase_defaultProps), { type: "searchButton" });
|
|
726
|
+
var XFormCustomColumn = function (props) {
|
|
727
|
+
// nevadi ze tu nic nevraciame, field a header vieme precitat a zvysok by sme aj tak zahodili lebo vytvarame novy element
|
|
728
|
+
return (null);
|
|
688
729
|
};
|
|
730
|
+
exports.XFormCustomColumn = XFormCustomColumn;
|
|
731
|
+
exports.XFormCustomColumn.defaultProps = __assign(__assign({}, XFormColumnBase_defaultProps), { type: "custom" });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { XFormBase } from "../XFormBase";
|
|
3
|
+
export interface XFormColProps {
|
|
4
|
+
form?: XFormBase;
|
|
5
|
+
labelStyle?: React.CSSProperties;
|
|
6
|
+
children: JSX.Element | JSX.Element[];
|
|
7
|
+
}
|
|
8
|
+
export declare const XFormCol: (props: XFormColProps) => JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.XFormCol = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var XFormRowCol_1 = require("./XFormRowCol");
|
|
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 });
|
|
11
|
+
};
|
|
12
|
+
exports.XFormCol = XFormCol;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { XFormBase } from "../XFormBase";
|
|
3
|
+
export interface XFormInlineRowProps {
|
|
4
|
+
form?: XFormBase;
|
|
5
|
+
labelStyle?: React.CSSProperties;
|
|
6
|
+
children: JSX.Element | JSX.Element[];
|
|
7
|
+
}
|
|
8
|
+
export declare const XFormInlineRow: (props: XFormInlineRowProps) => JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.XFormInlineRow = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var XFormRowCol_1 = require("./XFormRowCol");
|
|
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 });
|
|
11
|
+
};
|
|
12
|
+
exports.XFormInlineRow = XFormInlineRow;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { XFormBase } from "../XFormBase";
|
|
3
|
+
export interface XFormRowProps {
|
|
4
|
+
form?: XFormBase;
|
|
5
|
+
labelStyle?: React.CSSProperties;
|
|
6
|
+
children: JSX.Element | JSX.Element[];
|
|
7
|
+
}
|
|
8
|
+
export declare const XFormRow: (props: XFormRowProps) => JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.XFormRow = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var XFormRowCol_1 = require("./XFormRowCol");
|
|
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 });
|
|
11
|
+
};
|
|
12
|
+
exports.XFormRow = XFormRow;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { XFormBase } from "../XFormBase";
|
|
3
|
+
export interface XFormRowColProps {
|
|
4
|
+
className: "x-form-row" | "x-form-inline-row" | "x-form-col";
|
|
5
|
+
form?: XFormBase;
|
|
6
|
+
labelStyle?: React.CSSProperties;
|
|
7
|
+
children: JSX.Element | JSX.Element[];
|
|
8
|
+
}
|
|
9
|
+
export declare const XFormRowCol: (props: XFormRowColProps) => JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.XFormRowCol = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var XFormRowCol = function (props) {
|
|
9
|
+
var childElemList;
|
|
10
|
+
if (props.form || props.labelStyle) {
|
|
11
|
+
// ak chceme zmenit child element, tak treba bud vytvorit novy alebo vyklonovat
|
|
12
|
+
// priklad je na https://soshace.com/building-react-components-using-children-props-and-context-api/
|
|
13
|
+
childElemList = react_1.default.Children.map(props.children, function (child) {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
// klonujeme len nase X* komponenty (napr. XInputText), child.type.name vracia nazov komponenty (napr. XInputText)
|
|
16
|
+
// ak vyklonujeme cudziu komponentu, funguje, ale prida do nej property labelstyle=[object Object]
|
|
17
|
+
if (child.type.name && child.type.name.startsWith("X")) {
|
|
18
|
+
return react_1.default.cloneElement(child, { form: (_a = child.props.form) !== null && _a !== void 0 ? _a : props.form, labelStyle: (_b = child.props.labelStyle) !== null && _b !== void 0 ? _b : props.labelStyle });
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
return child;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
childElemList = props.children; // netreba klonovat - viac menej koli performance
|
|
27
|
+
}
|
|
28
|
+
return react_1.default.createElement("div", { className: props.className }, childElemList);
|
|
29
|
+
};
|
|
30
|
+
exports.XFormRowCol = XFormRowCol;
|
|
@@ -69,8 +69,9 @@ var XInputDecimal = /** @class */ (function (_super) {
|
|
|
69
69
|
var _b = XUtilsMetadata_1.XUtilsMetadata.getParamsForInputNumber(this.xField), useGrouping = _b.useGrouping, fractionDigits = _b.fractionDigits, min = _b.min, max = _b.max, size = _b.size;
|
|
70
70
|
var sizeInput = (_a = this.props.size) !== null && _a !== void 0 ? _a : size;
|
|
71
71
|
// note: style overrides size (width of the input according to character count)
|
|
72
|
+
var label = this.getLabel();
|
|
72
73
|
return (react_1.default.createElement("div", { className: "field grid" },
|
|
73
|
-
react_1.default.createElement("label", { htmlFor: this.props.field, className: "col-fixed", style: this.getLabelStyle() },
|
|
74
|
+
label !== undefined ? react_1.default.createElement("label", { htmlFor: this.props.field, className: "col-fixed", style: this.getLabelStyle() }, label) : null,
|
|
74
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, style: this.props.inputStyle }, this.getClassNameTooltip(), { onBlur: this.onBlur }))));
|
|
75
76
|
};
|
|
76
77
|
return XInputDecimal;
|
|
@@ -13,6 +13,6 @@ var XInputDecimalBase = function (props) {
|
|
|
13
13
|
props.onChange(e.value);
|
|
14
14
|
};
|
|
15
15
|
// null konvertujeme na undefined (zevraj InputNumber nechce null)
|
|
16
|
-
return (react_1.default.createElement(inputnumber_1.InputNumber, { id: props.id, value: props.value !== null ? props.value : undefined, onChange: onChange, readOnly: props.readOnly, mode: "decimal", locale: "de-DE", useGrouping: props.useGrouping, minFractionDigits: props.fractionDigits, maxFractionDigits: props.fractionDigits, min: props.min, max: props.max, size: props.size }));
|
|
16
|
+
return (react_1.default.createElement(inputnumber_1.InputNumber, { id: props.id, value: props.value !== null ? props.value : undefined, onChange: onChange, readOnly: props.readOnly, mode: "decimal", locale: "de-DE", useGrouping: props.useGrouping, minFractionDigits: props.fractionDigits, maxFractionDigits: props.fractionDigits, min: props.min, max: props.max, size: props.size, className: props.className }));
|
|
17
17
|
};
|
|
18
18
|
exports.XInputDecimalBase = XInputDecimalBase;
|
|
@@ -60,8 +60,9 @@ var XInputText = /** @class */ (function (_super) {
|
|
|
60
60
|
var _a;
|
|
61
61
|
var size = (_a = this.props.size) !== null && _a !== void 0 ? _a : this.xField.length;
|
|
62
62
|
// note: style overrides size (width of the input according to character count)
|
|
63
|
+
var label = this.getLabel();
|
|
63
64
|
return (react_1.default.createElement("div", { className: "field grid" },
|
|
64
|
-
react_1.default.createElement("label", { htmlFor: this.props.field, className: "col-fixed", style: this.getLabelStyle() },
|
|
65
|
+
label !== undefined ? react_1.default.createElement("label", { htmlFor: this.props.field, className: "col-fixed", style: this.getLabelStyle() }, label) : null,
|
|
65
66
|
react_1.default.createElement(inputtext_1.InputText, __assign({ id: this.props.field, value: this.getValue(), onChange: this.onValueChange, readOnly: this.isReadOnly(), maxLength: this.xField.length, size: size, style: this.props.inputStyle }, this.getClassNameTooltip(), { onBlur: this.onBlur }))));
|
|
66
67
|
};
|
|
67
68
|
return XInputText;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { ReactChild } from 'react';
|
|
2
2
|
import { DataTableFilterMeta, DataTableFilterMetaData, DataTableOperatorFilterMetaData } from 'primereact/datatable';
|
|
3
3
|
import { ColumnBodyOptions, ColumnFilterElementTemplateOptions } from 'primereact/column';
|
|
4
|
+
import { XViewStatusOrBoolean } from "./XUtils";
|
|
4
5
|
import { XSearchBrowseParams } from "./XSearchBrowseParams";
|
|
5
6
|
import { XAggregateType, XCustomFilter } from "../serverApi/FindParam";
|
|
6
7
|
import { XOnSaveOrCancelProp } from "./XFormBase";
|
|
@@ -86,11 +87,19 @@ export interface XLazyColumnProps {
|
|
|
86
87
|
header?: any;
|
|
87
88
|
align?: "left" | "center" | "right";
|
|
88
89
|
dropdownInFilter?: boolean;
|
|
90
|
+
dropdownFilter?: XCustomFilter;
|
|
91
|
+
dropdownSortField?: string;
|
|
89
92
|
showFilterMenu?: boolean;
|
|
90
93
|
betweenFilter?: XBetweenFilterProp | "noBetween";
|
|
91
94
|
width?: string;
|
|
92
95
|
aggregateType?: XAggregateType;
|
|
96
|
+
columnViewStatus: XViewStatusOrBoolean;
|
|
93
97
|
filterElement?: XFilterElementProp;
|
|
94
98
|
body?: React.ReactNode | ((data: any, options: ColumnBodyOptions) => React.ReactNode);
|
|
95
99
|
}
|
|
96
|
-
export declare const XLazyColumn:
|
|
100
|
+
export declare const XLazyColumn: {
|
|
101
|
+
(props: XLazyColumnProps): null;
|
|
102
|
+
defaultProps: {
|
|
103
|
+
columnViewStatus: boolean;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
@@ -634,7 +634,7 @@ var XLazyDataTable = function (props) {
|
|
|
634
634
|
if (props.scrollWidth !== "none") {
|
|
635
635
|
scrollWidth = props.scrollWidth;
|
|
636
636
|
if (scrollWidth === "viewport") {
|
|
637
|
-
scrollWidth = 'calc(100vw -
|
|
637
|
+
scrollWidth = 'calc(100vw - 2.2rem)'; // povodne bolo 1.4rem (20px okraje) ale pri vela stlpcoch vznikal horizontalny scrollbar
|
|
638
638
|
}
|
|
639
639
|
}
|
|
640
640
|
if (props.scrollHeight !== "none") {
|
|
@@ -720,7 +720,7 @@ var XLazyDataTable = function (props) {
|
|
|
720
720
|
// export pre search button-y zatial vypneme
|
|
721
721
|
var exportRows = (props.searchBrowseParams === undefined);
|
|
722
722
|
// pre lepsiu citatelnost vytvarame stlpce uz tu
|
|
723
|
-
var columnElemList = react_1.default.Children.map(props.children, function (child) {
|
|
723
|
+
var columnElemList = react_1.default.Children.map(props.children.filter(function (child) { return XUtils_1.XUtils.xViewStatus(child.props.columnViewStatus) !== XUtils_1.XViewStatus.Hidden; }), function (child) {
|
|
724
724
|
// ak chceme zmenit child element, tak treba bud vytvorit novy alebo vyklonovat
|
|
725
725
|
// priklad je na https://soshace.com/building-react-components-using-children-props-and-context-api/
|
|
726
726
|
// (vzdy musime robit manipulacie so stlpcom, lebo potrebujeme pridat filter={true} sortable={true}
|
|
@@ -759,7 +759,7 @@ var XLazyDataTable = function (props) {
|
|
|
759
759
|
}
|
|
760
760
|
else if (childColumn.props.dropdownInFilter) {
|
|
761
761
|
var dropdownValue = getDropdownFilterValue(childColumn.props.field);
|
|
762
|
-
filterElement = react_1.default.createElement(XDropdownDTFilter_1.XDropdownDTFilter, { entity: props.entity, path: childColumn.props.field, value: dropdownValue, onValueChange: onDropdownFilterChange });
|
|
762
|
+
filterElement = react_1.default.createElement(XDropdownDTFilter_1.XDropdownDTFilter, { entity: props.entity, path: childColumn.props.field, value: dropdownValue, onValueChange: onDropdownFilterChange, filter: childColumn.props.dropdownFilter, sortField: childColumn.props.dropdownSortField });
|
|
763
763
|
}
|
|
764
764
|
else if (xField.type === "date" || xField.type === "datetime") {
|
|
765
765
|
betweenFilter = getBetweenFilter(childColumn.props.betweenFilter, props.betweenFilter);
|
|
@@ -902,3 +902,6 @@ var XLazyColumn = function (props) {
|
|
|
902
902
|
return (null);
|
|
903
903
|
};
|
|
904
904
|
exports.XLazyColumn = XLazyColumn;
|
|
905
|
+
exports.XLazyColumn.defaultProps = {
|
|
906
|
+
columnViewStatus: true // XViewStatus.ReadWrite
|
|
907
|
+
};
|
|
@@ -13,6 +13,12 @@ export declare enum OperationType {
|
|
|
13
13
|
Update = 2,
|
|
14
14
|
Remove = 3
|
|
15
15
|
}
|
|
16
|
+
export declare enum XViewStatus {
|
|
17
|
+
ReadWrite = 0,
|
|
18
|
+
ReadOnly = 1,
|
|
19
|
+
Hidden = 2
|
|
20
|
+
}
|
|
21
|
+
export type XViewStatusOrBoolean = XViewStatus | boolean;
|
|
16
22
|
export interface IPostgresInterval {
|
|
17
23
|
years?: number;
|
|
18
24
|
months?: number;
|
|
@@ -103,5 +109,7 @@ export declare class XUtils {
|
|
|
103
109
|
static normalizeString(value: string): string;
|
|
104
110
|
static createCustomFilterItems(customFilter: XCustomFilter | undefined): XCustomFilterItem[] | undefined;
|
|
105
111
|
static filterAnd(...filters: (XCustomFilter | undefined)[]): XCustomFilterItem[] | undefined;
|
|
112
|
+
static filterIdIn(idField: string, idList: number[]): XCustomFilter;
|
|
106
113
|
static isTableRowInserted(tableRow: any): boolean;
|
|
114
|
+
static xViewStatus(xViewStatusOrBoolean: XViewStatusOrBoolean): XViewStatus;
|
|
107
115
|
}
|
package/lib/components/XUtils.js
CHANGED
|
@@ -83,7 +83,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
83
83
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
84
84
|
};
|
|
85
85
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
86
|
-
exports.XUtils = exports.OperationType = void 0;
|
|
86
|
+
exports.XUtils = exports.XViewStatus = exports.OperationType = void 0;
|
|
87
87
|
var XUtilsMetadata_1 = require("./XUtilsMetadata");
|
|
88
88
|
var XUtilsCommon_1 = require("../serverApi/XUtilsCommon");
|
|
89
89
|
var ExportImportParam_1 = require("../serverApi/ExportImportParam");
|
|
@@ -97,6 +97,12 @@ var OperationType;
|
|
|
97
97
|
OperationType[OperationType["Update"] = 2] = "Update";
|
|
98
98
|
OperationType[OperationType["Remove"] = 3] = "Remove";
|
|
99
99
|
})(OperationType = exports.OperationType || (exports.OperationType = {}));
|
|
100
|
+
var XViewStatus;
|
|
101
|
+
(function (XViewStatus) {
|
|
102
|
+
XViewStatus[XViewStatus["ReadWrite"] = 0] = "ReadWrite";
|
|
103
|
+
XViewStatus[XViewStatus["ReadOnly"] = 1] = "ReadOnly";
|
|
104
|
+
XViewStatus[XViewStatus["Hidden"] = 2] = "Hidden";
|
|
105
|
+
})(XViewStatus = exports.XViewStatus || (exports.XViewStatus = {}));
|
|
100
106
|
var XUtils = /** @class */ (function () {
|
|
101
107
|
function XUtils() {
|
|
102
108
|
}
|
|
@@ -725,10 +731,26 @@ var XUtils = /** @class */ (function () {
|
|
|
725
731
|
return customFilterItemsResult;
|
|
726
732
|
};
|
|
727
733
|
// pomocna metodka
|
|
734
|
+
// ak je idList prazdny, vytvori podmienku id IN (0) a nevrati ziadne zaznamy
|
|
735
|
+
XUtils.filterIdIn = function (idField, idList) {
|
|
736
|
+
return { where: "[".concat(idField, "] IN (:...idList)"), params: { "idList": idList.length > 0 ? idList : [0] } };
|
|
737
|
+
};
|
|
738
|
+
// pomocna metodka
|
|
728
739
|
XUtils.isTableRowInserted = function (tableRow) {
|
|
729
740
|
var _a;
|
|
730
741
|
return (_a = tableRow.__x_generatedRowId) !== null && _a !== void 0 ? _a : false; // specialny priznak, ze sme vygenerovali id-cko
|
|
731
742
|
};
|
|
743
|
+
// pomocna metodka
|
|
744
|
+
XUtils.xViewStatus = function (xViewStatusOrBoolean) {
|
|
745
|
+
var xViewStatus;
|
|
746
|
+
if (typeof xViewStatusOrBoolean === "boolean") {
|
|
747
|
+
xViewStatus = xViewStatusOrBoolean ? XViewStatus.ReadWrite : XViewStatus.Hidden;
|
|
748
|
+
}
|
|
749
|
+
else {
|
|
750
|
+
xViewStatus = xViewStatusOrBoolean;
|
|
751
|
+
}
|
|
752
|
+
return xViewStatus;
|
|
753
|
+
};
|
|
732
754
|
XUtils.dropdownEmptyOptionValue = " ";
|
|
733
755
|
XUtils.xBackendUrl = undefined;
|
|
734
756
|
// nacachovany XToken - na rozlicnych miestach potrebujeme vediet uzivatela
|