@michalrakus/x-react-web-lib 1.14.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/lib/components/XAutoCompleteBase.js +2 -2
- package/lib/components/XCheckbox.d.ts +3 -1
- package/lib/components/XCheckbox.js +19 -5
- 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 +14 -2
- package/lib/components/XFormDataTable2.js +106 -72
- 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.js +1 -1
- package/package.json +1 -1
|
@@ -404,8 +404,8 @@ 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" },
|
|
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)
|
|
407
|
+
return (react_1.default.createElement("div", { className: "x-auto-complete-base", style: { width: this.props.width } },
|
|
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 ?
|
|
411
411
|
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, {
|
|
@@ -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));
|
|
@@ -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,6 +1,7 @@
|
|
|
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";
|
|
5
6
|
import { XViewStatusOrBoolean } from "./XUtils";
|
|
6
7
|
import { FilterMatchMode } from "primereact/api";
|
|
@@ -91,7 +92,7 @@ export type XTableFieldOnChange = (e: XTableFieldChangeEvent<any, any>) => void;
|
|
|
91
92
|
export type XTableFieldReadOnlyProp = boolean | ((object: any, tableRow: any) => boolean);
|
|
92
93
|
export type XTableFieldFilterProp = XCustomFilter | ((object: any, rowData: any) => XCustomFilter | undefined);
|
|
93
94
|
export interface XFormColumnBaseProps {
|
|
94
|
-
type: "inputSimple" | "dropdown" | "autoComplete" | "searchButton";
|
|
95
|
+
type: "inputSimple" | "dropdown" | "autoComplete" | "searchButton" | "custom";
|
|
95
96
|
header?: any;
|
|
96
97
|
readOnly?: XTableFieldReadOnlyProp;
|
|
97
98
|
dropdownInFilter?: boolean;
|
|
@@ -122,6 +123,10 @@ export interface XFormSearchButtonColumnProps extends XFormColumnBaseProps {
|
|
|
122
123
|
displayField: string;
|
|
123
124
|
searchBrowse: JSX.Element;
|
|
124
125
|
}
|
|
126
|
+
export interface XFormCustomColumnProps extends XFormColumnBaseProps {
|
|
127
|
+
body: React.ReactNode | ((data: any, options: ColumnBodyOptions) => React.ReactNode);
|
|
128
|
+
field?: string;
|
|
129
|
+
}
|
|
125
130
|
export declare const XFormColumn: {
|
|
126
131
|
(props: XFormColumnProps): null;
|
|
127
132
|
defaultProps: {
|
|
@@ -150,3 +155,10 @@ export declare const XFormSearchButtonColumn: {
|
|
|
150
155
|
columnViewStatus: boolean;
|
|
151
156
|
};
|
|
152
157
|
};
|
|
158
|
+
export declare const XFormCustomColumn: {
|
|
159
|
+
(props: XFormCustomColumnProps): null;
|
|
160
|
+
defaultProps: {
|
|
161
|
+
type: string;
|
|
162
|
+
columnViewStatus: boolean;
|
|
163
|
+
};
|
|
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 }; }
|
|
@@ -562,72 +567,95 @@ var XFormDataTable2 = /** @class */ (function (_super) {
|
|
|
562
567
|
// (vzdy musime robit manipulacie so stlpcom, lebo potrebujeme pridat filter={true} sortable={true}
|
|
563
568
|
var childColumn = child; // nevedel som to krajsie...
|
|
564
569
|
var childColumnProps = childColumn.props;
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
var field = thisLocal.getPathForColumn(childColumnProps);
|
|
568
|
-
// TODO - toto by sa mohlo vytiahnut vyssie, aj v bodyTemplate sa vola metoda XUtilsMetadata.getXFieldByPath
|
|
569
|
-
var xField = XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXFieldByPath(xEntity, field);
|
|
570
|
-
// *********** header ***********
|
|
571
|
-
var header = XFormDataTable2.getHeader(childColumnProps, xEntity, field, xField);
|
|
572
|
-
// *********** filterElement ***********
|
|
570
|
+
var fieldParam;
|
|
571
|
+
var header;
|
|
573
572
|
var filterElement;
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
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;
|
|
583
587
|
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
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
|
+
}
|
|
589
607
|
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
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
|
+
}
|
|
595
620
|
}
|
|
596
621
|
}
|
|
597
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;
|
|
598
650
|
}
|
|
599
651
|
// *********** showClearButton ***********
|
|
600
652
|
// pre filterDisplay = "row" nechceme clear button, chceme setrit miesto
|
|
601
653
|
var showClearButton = thisLocal.props.filterDisplay === "menu";
|
|
602
|
-
// *********** width/headerStyle ***********
|
|
603
|
-
var width = XUtils_1.XUtils.processPropWidth(childColumn.props.width);
|
|
604
|
-
if (width === undefined || width === "default") {
|
|
605
|
-
var filterMenuInFilterRow = thisLocal.props.filterDisplay === "row" && showFilterMenu;
|
|
606
|
-
var sortableButtonInHeader = thisLocal.props.sortable;
|
|
607
|
-
var filterButtonInHeader = thisLocal.props.filterDisplay === "menu";
|
|
608
|
-
width = XUtilsMetadata_1.XUtilsMetadata.computeColumnWidth(xField, undefined, filterMenuInFilterRow, childColumnProps.type, header, sortableButtonInHeader, filterButtonInHeader);
|
|
609
|
-
}
|
|
610
654
|
var headerStyle = {};
|
|
611
655
|
if (width !== undefined) {
|
|
612
656
|
headerStyle = { width: width };
|
|
613
657
|
}
|
|
614
|
-
|
|
615
|
-
var align = undefined; // default undefined (left)
|
|
616
|
-
// do buducna
|
|
617
|
-
// if (childColumnProps.align !== undefined) {
|
|
618
|
-
// align = childColumnProps.align;
|
|
619
|
-
// }
|
|
620
|
-
// else {
|
|
621
|
-
// decimal defaultne zarovnavame doprava
|
|
622
|
-
// if (xField.type === "decimal") {
|
|
623
|
-
// align = "right";
|
|
624
|
-
// }
|
|
625
|
-
// else
|
|
626
|
-
if (xField.type === "boolean") {
|
|
627
|
-
align = "center";
|
|
628
|
-
}
|
|
629
|
-
// }
|
|
630
|
-
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 });
|
|
631
659
|
});
|
|
632
660
|
if (this.props.showAddRemoveButtons && this.props.removeButtonInRow) {
|
|
633
661
|
// je dolezite nastavit sirku header-a, lebo inac ma stlpec sirku 0 a nevidno ho
|
|
@@ -695,3 +723,9 @@ var XFormSearchButtonColumn = function (props) {
|
|
|
695
723
|
};
|
|
696
724
|
exports.XFormSearchButtonColumn = XFormSearchButtonColumn;
|
|
697
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);
|
|
729
|
+
};
|
|
730
|
+
exports.XFormCustomColumn = XFormCustomColumn;
|
|
731
|
+
exports.XFormCustomColumn.defaultProps = __assign(__assign({}, XFormColumnBase_defaultProps), { type: "custom" });
|
|
@@ -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;
|
|
@@ -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") {
|