@michalrakus/x-react-web-lib 1.32.3 → 1.32.4
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/XButton.d.ts +1 -0
- package/lib/components/XButton.js +1 -1
- package/lib/components/XFormBase.d.ts +3 -0
- package/lib/components/XFormBase.js +8 -0
- package/lib/components/XFormDataTable2.js +6 -1
- package/lib/components/XInputTextarea.d.ts +1 -1
- package/lib/components/XInputTextarea.js +11 -6
- package/lib/components/XLazyDataTable/XLazyDataTable.d.ts +1 -0
- package/lib/components/XLazyDataTable/XLazyDataTable.js +3 -2
- package/package.json +1 -1
|
@@ -8,6 +8,6 @@ var react_1 = __importDefault(require("react"));
|
|
|
8
8
|
var button_1 = require("primereact/button");
|
|
9
9
|
var XButton = function (props) {
|
|
10
10
|
// zatial iba pridany class x-button, aby sme vedeli nastavit margin "m-1" (0.25rem)
|
|
11
|
-
return (react_1.default.createElement(button_1.Button, { label: props.label, icon: props.icon, onClick: props.onClick, disabled: props.disabled, className: "m-1" }));
|
|
11
|
+
return (react_1.default.createElement(button_1.Button, { label: props.label, icon: props.icon, onClick: props.onClick, disabled: props.disabled, className: "m-1", style: props.style }));
|
|
12
12
|
};
|
|
13
13
|
exports.XButton = XButton;
|
|
@@ -31,6 +31,7 @@ export declare abstract class XFormBase extends Component<XFormProps> {
|
|
|
31
31
|
assoc: string;
|
|
32
32
|
sortField: string;
|
|
33
33
|
}>;
|
|
34
|
+
tabViewUsed: boolean;
|
|
34
35
|
constructor(props: XFormProps);
|
|
35
36
|
componentDidMount(): Promise<void>;
|
|
36
37
|
getEntity(): string;
|
|
@@ -38,6 +39,8 @@ export declare abstract class XFormBase extends Component<XFormProps> {
|
|
|
38
39
|
getObject(): any;
|
|
39
40
|
isAddRow(): boolean;
|
|
40
41
|
isInDialog(): boolean;
|
|
42
|
+
isTabViewUsed(): boolean;
|
|
43
|
+
setTabViewUsed(tabViewUsed: boolean): void;
|
|
41
44
|
onFieldChange(field: string, value: any, error?: string | undefined, onChange?: XFieldOnChange, assocObjectChange?: OperationType): void;
|
|
42
45
|
onTableFieldChange(rowData: any, field: string, value: any, error?: string | undefined, onChange?: XTableFieldOnChange, assocObjectChange?: OperationType): void;
|
|
43
46
|
/**
|
|
@@ -141,6 +141,7 @@ var XFormBase = /** @class */ (function (_super) {
|
|
|
141
141
|
_this.xFormDataTableList = [];
|
|
142
142
|
_this.assocToValidateList = [];
|
|
143
143
|
_this.assocToSortList = [];
|
|
144
|
+
_this.tabViewUsed = false; // default
|
|
144
145
|
_this.onClickSave = _this.onClickSave.bind(_this);
|
|
145
146
|
_this.onClickCancel = _this.onClickCancel.bind(_this);
|
|
146
147
|
return _this;
|
|
@@ -236,6 +237,13 @@ var XFormBase = /** @class */ (function (_super) {
|
|
|
236
237
|
XFormBase.prototype.isInDialog = function () {
|
|
237
238
|
return this.props.onSaveOrCancel !== undefined;
|
|
238
239
|
};
|
|
240
|
+
// helper method
|
|
241
|
+
XFormBase.prototype.isTabViewUsed = function () {
|
|
242
|
+
return this.tabViewUsed;
|
|
243
|
+
};
|
|
244
|
+
XFormBase.prototype.setTabViewUsed = function (tabViewUsed) {
|
|
245
|
+
this.tabViewUsed = tabViewUsed;
|
|
246
|
+
};
|
|
239
247
|
XFormBase.prototype.onFieldChange = function (field, value, error, onChange, assocObjectChange) {
|
|
240
248
|
// field moze byt aj na asociovanom objekte (field length > 1, napr.: <assocX>.<fieldY>)
|
|
241
249
|
// v takom pripade sa do errorMap zapise ako key cely field <assocX>.<fieldY>
|
|
@@ -559,7 +559,12 @@ var XFormDataTable2 = /** @class */ (function (_super) {
|
|
|
559
559
|
if (this.props.scrollWidth !== "none") {
|
|
560
560
|
scrollWidth = this.props.scrollWidth;
|
|
561
561
|
if (scrollWidth === "viewport") {
|
|
562
|
-
|
|
562
|
+
var marginsWidth = XUtils_1.XUtils.isMobile() ? 1.2 : 2.2; // desktop - povodne bolo 1.4rem (20px okraje) namiesto 2.2 ale pri vela stlpcoch vznikal horizontalny scrollbar
|
|
563
|
+
// mobil - padding 0.5rem body element, ale este bola tabulka moc siroka, tak sme dali 1.2
|
|
564
|
+
if (this.props.form.isTabViewUsed()) {
|
|
565
|
+
marginsWidth += 1; // TabPanel has padding 0.5rem (in css file) -> 1rem both margins
|
|
566
|
+
}
|
|
567
|
+
scrollWidth = "calc(100vw - ".concat(marginsWidth, "rem)");
|
|
563
568
|
}
|
|
564
569
|
}
|
|
565
570
|
if (this.props.scrollHeight !== "none") {
|
|
@@ -10,9 +10,9 @@ export interface XInputTextareaProps extends XInputProps<string> {
|
|
|
10
10
|
export declare class XInputTextarea extends XInput<string, XInputTextareaProps> {
|
|
11
11
|
static defaultProps: {
|
|
12
12
|
cols: string;
|
|
13
|
-
labelOnTop: boolean;
|
|
14
13
|
};
|
|
15
14
|
xInputTextareaBaseRef: any;
|
|
15
|
+
labelOnTop: boolean;
|
|
16
16
|
constructor(props: XInputTextareaProps);
|
|
17
17
|
getValue(): string | null;
|
|
18
18
|
onValueChange(value: string | null): void;
|
|
@@ -29,6 +29,12 @@ var XInputTextarea = /** @class */ (function (_super) {
|
|
|
29
29
|
function XInputTextarea(props) {
|
|
30
30
|
var _this = _super.call(this, props) || this;
|
|
31
31
|
_this.xInputTextareaBaseRef = react_1.default.createRef();
|
|
32
|
+
if (props.labelOnTop !== undefined) {
|
|
33
|
+
_this.labelOnTop = props.labelOnTop;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
_this.labelOnTop = XUtils_1.XUtils.isMobile();
|
|
37
|
+
}
|
|
32
38
|
_this.onValueChange = _this.onValueChange.bind(_this);
|
|
33
39
|
return _this;
|
|
34
40
|
}
|
|
@@ -40,7 +46,7 @@ var XInputTextarea = /** @class */ (function (_super) {
|
|
|
40
46
|
};
|
|
41
47
|
XInputTextarea.prototype.getLabelStyle = function () {
|
|
42
48
|
var _a;
|
|
43
|
-
return this.
|
|
49
|
+
return this.labelOnTop ? ((_a = this.props.labelStyle) !== null && _a !== void 0 ? _a : {}) : _super.prototype.getLabelStyle.call(this);
|
|
44
50
|
};
|
|
45
51
|
// api method - can be called through "ref" from parent if needed to adjust the height of the input textarea according to the (changed) content
|
|
46
52
|
XInputTextarea.prototype.autoResize = function () {
|
|
@@ -59,7 +65,7 @@ var XInputTextarea = /** @class */ (function (_super) {
|
|
|
59
65
|
// pridame width:100%
|
|
60
66
|
//fieldStyle = {width: '100%'};
|
|
61
67
|
var widthValue = void 0;
|
|
62
|
-
if (this.
|
|
68
|
+
if (this.labelOnTop) {
|
|
63
69
|
widthValue = '100%';
|
|
64
70
|
}
|
|
65
71
|
else {
|
|
@@ -89,16 +95,15 @@ var XInputTextarea = /** @class */ (function (_super) {
|
|
|
89
95
|
labelElemId = "".concat(this.props.field, "_label_id");
|
|
90
96
|
}
|
|
91
97
|
// InputTextarea renderujeme az ked mame nacitany object, lebo inac pri autoResize sa nam nenastavi spravna velkost (hodnota nie je k dispozicii pri prvom renderingu)
|
|
92
|
-
return (react_1.default.createElement("div", { className: !this.
|
|
93
|
-
react_1.default.createElement("label", { id: labelElemId, htmlFor: this.props.field, className: !this.
|
|
98
|
+
return (react_1.default.createElement("div", { className: !this.labelOnTop ? 'field grid' : 'field grid x-inputtextarea-label-on-top', style: fieldStyle },
|
|
99
|
+
react_1.default.createElement("label", { id: labelElemId, htmlFor: this.props.field, className: !this.labelOnTop ? 'col-fixed' : undefined, style: labelStyle }, this.getLabel()),
|
|
94
100
|
labelTooltip ? react_1.default.createElement(tooltip_1.Tooltip, { target: "#".concat(labelElemId), content: labelTooltip }) : null,
|
|
95
101
|
this.props.form.state.object ?
|
|
96
102
|
react_1.default.createElement(XInputTextareaBase_1.XInputTextareaBase, { ref: this.xInputTextareaBaseRef, id: this.props.field, value: value, 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(), tooltip: this.props.tooltip, placeholder: (_b = this.props.placeholder) !== null && _b !== void 0 ? _b : this.props.desc })
|
|
97
103
|
: null));
|
|
98
104
|
};
|
|
99
105
|
XInputTextarea.defaultProps = {
|
|
100
|
-
cols: "full"
|
|
101
|
-
labelOnTop: false
|
|
106
|
+
cols: "full"
|
|
102
107
|
};
|
|
103
108
|
return XInputTextarea;
|
|
104
109
|
}(XInput_1.XInput));
|
|
@@ -903,7 +903,8 @@ var XLazyDataTable = function (props) {
|
|
|
903
903
|
if (props.scrollWidth !== "none") {
|
|
904
904
|
scrollWidth = props.scrollWidth;
|
|
905
905
|
if (scrollWidth === "viewport") {
|
|
906
|
-
scrollWidth = "calc(100vw - ".concat(isMobile ? 1
|
|
906
|
+
scrollWidth = "calc(100vw - ".concat(isMobile ? 1 : 2.2, "rem)"); // desktop - povodne bolo 1.4rem (20px okraje) namiesto 2.2 ale pri vela stlpcoch vznikal horizontalny scrollbar
|
|
907
|
+
// mobil - padding 0.5rem body element
|
|
907
908
|
}
|
|
908
909
|
}
|
|
909
910
|
if (props.scrollHeight !== "none") {
|
|
@@ -1229,7 +1230,7 @@ var XLazyDataTable = function (props) {
|
|
|
1229
1230
|
props.onEdit !== undefined && props.searchBrowseParams === undefined ? react_1.default.createElement(XButton_1.XButton, { key: "editRow", icon: "pi pi-pencil", label: (0, XLocale_1.xLocaleOption)('editRow'), onClick: onClickEdit }) : null,
|
|
1230
1231
|
props.removeRow !== undefined && props.removeRow !== false && props.searchBrowseParams === undefined ? react_1.default.createElement(XButton_1.XButton, { key: "removeRow", icon: "pi pi-times", label: (0, XLocale_1.xLocaleOption)('removeRow'), onClick: onClickRemoveRow }) : null,
|
|
1231
1232
|
exportRows ? react_1.default.createElement(XButton_1.XButton, { key: "exportRows", icon: "pi pi-file-export", label: (0, XLocale_1.xLocaleOption)('exportRows'), onClick: onClickExport }) : null,
|
|
1232
|
-
props.appButtonsForRow ? props.appButtonsForRow.map(function (xAppButton) { return react_1.default.createElement(XButton_1.XButton, { key: xAppButton.key, icon: xAppButton.icon, label: xAppButton.label, onClick: function () { return onClickAppButtonForRow(xAppButton.onClick); } }); }) : null,
|
|
1233
|
+
props.appButtonsForRow ? props.appButtonsForRow.map(function (xAppButton) { return react_1.default.createElement(XButton_1.XButton, { key: xAppButton.key, icon: xAppButton.icon, label: xAppButton.label, onClick: function () { return onClickAppButtonForRow(xAppButton.onClick); }, style: xAppButton.style }); }) : null,
|
|
1233
1234
|
props.appButtons,
|
|
1234
1235
|
props.searchBrowseParams !== undefined ? react_1.default.createElement(XButton_1.XButton, { key: "choose", label: (0, XLocale_1.xLocaleOption)('chooseRow'), onClick: onClickChoose }) : null,
|
|
1235
1236
|
exportRows ? react_1.default.createElement(XExportRowsDialog_1.XExportRowsDialog, { key: "exportRowsDialog", dialogState: exportRowsDialogState, hideDialog: function () { return setExportRowsDialogState({ dialogOpened: false }); } }) : null),
|