@michalrakus/x-react-web-lib 1.23.0 → 1.24.1
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.js +1 -1
- package/lib/components/XFormBase.d.ts +1 -0
- package/lib/components/XFormBase.js +4 -0
- package/lib/components/XFormHeader.d.ts +11 -3
- package/lib/components/XFormHeader.js +6 -1
- package/lib/components/XFormRowCol/XFormCol.d.ts +1 -0
- package/lib/components/XFormRowCol/XFormCol.js +1 -1
- package/lib/components/XFormRowCol/XFormRowCol.d.ts +1 -0
- package/lib/components/XFormRowCol/XFormRowCol.js +8 -1
- package/lib/components/XInputTextarea.js +19 -4
- package/lib/components/XLazyDataTable/XExportRowsDialog.js +5 -5
- package/lib/components/XSearchButton.js +1 -1
- package/lib/components/XSearchButtonDT.js +1 -1
- package/lib/components/XUtils.d.ts +2 -0
- package/lib/components/XUtils.js +4 -0
- package/lib/components/locale/x-en.json +1 -0
- package/package.json +1 -1
|
@@ -704,12 +704,12 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
704
704
|
react_1.default.createElement(autocomplete_1.AutoComplete, __assign({ value: inputValue, suggestions: this.state.filteredSuggestions, completeMethod: this.completeMethod, itemTemplate: this.itemTemplate, onChange: this.onChange, onSelect: this.onSelect, onBlur: this.onBlur, minLength: this.props.minLength, scrollHeight: this.props.scrollHeight, ref: this.autoCompleteRef, readOnly: readOnly, disabled: readOnly }, XUtils_1.XUtils.createTooltipOrErrorProps(error), { inputClassName: this.props.inputClassName })),
|
|
705
705
|
dropdownButton,
|
|
706
706
|
this.props.valueForm != undefined ?
|
|
707
|
-
react_1.default.createElement(dialog_1.Dialog, { visible: this.state.formDialogOpened, onHide: this.formDialogOnHide
|
|
707
|
+
react_1.default.createElement(dialog_1.Dialog, { className: "x-dialog-without-header", visible: this.state.formDialogOpened, onHide: this.formDialogOnHide }, react_1.default.cloneElement(this.props.valueForm, {
|
|
708
708
|
id: this.formDialogObjectId, initValues: this.formDialogInitValuesForInsert, onSaveOrCancel: this.formDialogOnSaveOrCancel
|
|
709
709
|
} /*, this.props.valueForm.children*/))
|
|
710
710
|
: undefined,
|
|
711
711
|
this.props.searchBrowse != undefined && !readOnly ?
|
|
712
|
-
react_1.default.createElement(dialog_1.Dialog, { visible: this.state.searchDialogOpened, onHide: this.searchDialogOnHide }, react_1.default.cloneElement(this.props.searchBrowse, { searchBrowseParams: this.createSearchBrowseParams() } /*, props.searchBrowse.children*/))
|
|
712
|
+
react_1.default.createElement(dialog_1.Dialog, { className: "x-dialog-without-header", visible: this.state.searchDialogOpened, onHide: this.searchDialogOnHide }, react_1.default.cloneElement(this.props.searchBrowse, { searchBrowseParams: this.createSearchBrowseParams() } /*, props.searchBrowse.children*/))
|
|
713
713
|
: undefined));
|
|
714
714
|
};
|
|
715
715
|
XAutoCompleteBase.valueMoreSuggestions = "...";
|
|
@@ -59,7 +59,7 @@ var XCheckbox = /** @class */ (function (_super) {
|
|
|
59
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
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
61
|
if (!this.props.onlyInput) {
|
|
62
|
-
var label = this.
|
|
62
|
+
var label = this.props.label; // nepridavame * ani ak je atribut not null (kedze sa pouziva jednoduchy checkbox, nie je mozne zadat null hodnotu)
|
|
63
63
|
element = react_1.default.createElement("div", { className: "field grid" },
|
|
64
64
|
label !== undefined ? react_1.default.createElement("label", { htmlFor: this.props.field, className: "col-fixed", style: this.getLabelStyle() }, label) : null,
|
|
65
65
|
element);
|
|
@@ -35,6 +35,7 @@ export declare abstract class XFormBase extends Component<XFormProps> {
|
|
|
35
35
|
getXObject(): XObject;
|
|
36
36
|
getObject(): any;
|
|
37
37
|
isAddRow(): any;
|
|
38
|
+
isInDialog(): boolean;
|
|
38
39
|
onFieldChange(field: string, value: any, error?: string | undefined, onChange?: XFieldOnChange, assocObjectChange?: OperationType): void;
|
|
39
40
|
onTableFieldChange(rowData: any, field: string, value: any, error?: string | undefined, onChange?: XTableFieldOnChange, assocObjectChange?: OperationType): void;
|
|
40
41
|
/**
|
|
@@ -223,6 +223,10 @@ var XFormBase = /** @class */ (function (_super) {
|
|
|
223
223
|
XFormBase.prototype.isAddRow = function () {
|
|
224
224
|
return this.props.id === undefined;
|
|
225
225
|
};
|
|
226
|
+
// helper method
|
|
227
|
+
XFormBase.prototype.isInDialog = function () {
|
|
228
|
+
return this.props.onSaveOrCancel !== undefined;
|
|
229
|
+
};
|
|
226
230
|
XFormBase.prototype.onFieldChange = function (field, value, error, onChange, assocObjectChange) {
|
|
227
231
|
// field moze byt aj na asociovanom objekte (field length > 1, napr.: <assocX>.<fieldY>)
|
|
228
232
|
// v takom pripade sa do errorMap zapise ako key cely field <assocX>.<fieldY>
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { XFormBase } from "./XFormBase";
|
|
3
|
+
export declare const XFormHeader: {
|
|
4
|
+
(props: {
|
|
5
|
+
form?: XFormBase;
|
|
6
|
+
label: string;
|
|
7
|
+
appendNewRow: boolean;
|
|
8
|
+
}): React.JSX.Element;
|
|
9
|
+
defaultProps: {
|
|
10
|
+
appendNewRow: boolean;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -5,7 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.XFormHeader = void 0;
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var XLocale_1 = require("./XLocale");
|
|
8
9
|
var XFormHeader = function (props) {
|
|
9
|
-
|
|
10
|
+
var _a;
|
|
11
|
+
return (react_1.default.createElement("div", { className: "x-form-header" }, props.label + (props.appendNewRow && ((_a = props.form) === null || _a === void 0 ? void 0 : _a.isAddRow()) ? " - " + (0, XLocale_1.xLocaleOption)('newRow') : "")));
|
|
10
12
|
};
|
|
11
13
|
exports.XFormHeader = XFormHeader;
|
|
14
|
+
exports.XFormHeader.defaultProps = {
|
|
15
|
+
appendNewRow: true
|
|
16
|
+
};
|
|
@@ -7,6 +7,6 @@ exports.XFormCol = void 0;
|
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
8
|
var XFormRowCol_1 = require("./XFormRowCol");
|
|
9
9
|
var XFormCol = function (props) {
|
|
10
|
-
return react_1.default.createElement(XFormRowCol_1.XFormRowCol, { className: "x-form-col", form: props.form, labelStyle: props.labelStyle, style: props.style, children: props.children });
|
|
10
|
+
return react_1.default.createElement(XFormRowCol_1.XFormRowCol, { className: "x-form-col", form: props.form, width: props.width, labelStyle: props.labelStyle, style: props.style, children: props.children });
|
|
11
11
|
};
|
|
12
12
|
exports.XFormCol = XFormCol;
|
|
@@ -3,6 +3,7 @@ import { XFormBase } from "../XFormBase";
|
|
|
3
3
|
export interface XFormRowColProps {
|
|
4
4
|
className: "x-form-row" | "x-form-inline-row" | "x-form-col";
|
|
5
5
|
form?: XFormBase;
|
|
6
|
+
width?: string | "full";
|
|
6
7
|
labelStyle?: React.CSSProperties;
|
|
7
8
|
style?: React.CSSProperties;
|
|
8
9
|
children: JSX.Element | JSX.Element[];
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.XFormRowCol = void 0;
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var XUtils_1 = require("../XUtils");
|
|
8
9
|
var XFormRowCol = function (props) {
|
|
9
10
|
var childElemList;
|
|
10
11
|
if (props.form || props.labelStyle) {
|
|
@@ -27,6 +28,12 @@ var XFormRowCol = function (props) {
|
|
|
27
28
|
else {
|
|
28
29
|
childElemList = props.children; // netreba klonovat - viac menej koli performance
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
+
var style = props.style;
|
|
32
|
+
if (props.width) {
|
|
33
|
+
style = style !== null && style !== void 0 ? style : {};
|
|
34
|
+
var width = (props.width === 'full' ? '100%' : props.width);
|
|
35
|
+
XUtils_1.XUtils.addCssPropIfNotExists(style, { width: width }); // props.style ma vyssiu prioritu ako props.width
|
|
36
|
+
}
|
|
37
|
+
return react_1.default.createElement("div", { className: props.className, style: style }, childElemList);
|
|
31
38
|
};
|
|
32
39
|
exports.XFormRowCol = XFormRowCol;
|
|
@@ -43,13 +43,28 @@ var XInputTextarea = /** @class */ (function (_super) {
|
|
|
43
43
|
};
|
|
44
44
|
XInputTextarea.prototype.render = function () {
|
|
45
45
|
var _a, _b;
|
|
46
|
+
var fieldStyle = undefined;
|
|
47
|
+
var labelStyle = this.getLabelStyle();
|
|
46
48
|
var inputStyle = (_a = this.props.inputStyle) !== null && _a !== void 0 ? _a : {};
|
|
47
49
|
var cols;
|
|
48
50
|
if (this.props.cols === "full") {
|
|
49
51
|
cols = undefined;
|
|
50
52
|
// pridame width:100%
|
|
51
|
-
//
|
|
52
|
-
var widthValue =
|
|
53
|
+
//fieldStyle = {width: '100%'};
|
|
54
|
+
var widthValue = void 0;
|
|
55
|
+
if (this.props.labelOnTop) {
|
|
56
|
+
widthValue = '100%';
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
// ak nemame labelOnTop=true, musime odratat sirku labelu, inac sa label dostane nad input (koli flex-wrap: wrap)
|
|
60
|
+
var labelStyleWidth = labelStyle.width;
|
|
61
|
+
if (labelStyleWidth) {
|
|
62
|
+
widthValue = "calc(100% - ".concat(labelStyleWidth, ")");
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
widthValue = '100%';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
53
68
|
XUtils_1.XUtils.addCssPropIfNotExists(inputStyle, { width: widthValue });
|
|
54
69
|
}
|
|
55
70
|
else {
|
|
@@ -67,8 +82,8 @@ var XInputTextarea = /** @class */ (function (_super) {
|
|
|
67
82
|
labelElemId = "".concat(this.props.field, "_label_id");
|
|
68
83
|
}
|
|
69
84
|
// InputTextarea renderujeme az ked mame nacitany object, lebo inac pri autoResize sa nam nenastavi spravna velkost (hodnota nie je k dispozicii pri prvom renderingu)
|
|
70
|
-
return (react_1.default.createElement("div", { className: !this.props.labelOnTop ? 'field grid' : 'field grid x-inputtextarea-label-on-top' },
|
|
71
|
-
react_1.default.createElement("label", { id: labelElemId, htmlFor: this.props.field, className: !this.props.labelOnTop ? 'col-fixed' : undefined, style:
|
|
85
|
+
return (react_1.default.createElement("div", { className: !this.props.labelOnTop ? 'field grid' : 'field grid x-inputtextarea-label-on-top', style: fieldStyle },
|
|
86
|
+
react_1.default.createElement("label", { id: labelElemId, htmlFor: this.props.field, className: !this.props.labelOnTop ? 'col-fixed' : undefined, style: labelStyle }, this.getLabel()),
|
|
72
87
|
labelTooltip ? react_1.default.createElement(tooltip_1.Tooltip, { target: "#".concat(labelElemId), content: labelTooltip }) : null,
|
|
73
88
|
this.props.form.state.object ?
|
|
74
89
|
react_1.default.createElement(XInputTextareaBase_1.XInputTextareaBase, { 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 })
|
|
@@ -185,20 +185,20 @@ var XExportRowsDialog = function (props) {
|
|
|
185
185
|
if ((_a = props.dialogState.exportParams) === null || _a === void 0 ? void 0 : _a.existsToManyAssoc) {
|
|
186
186
|
elem.push(react_1.default.createElement("div", { key: "expDetailRowsExport", className: "field grid" },
|
|
187
187
|
react_1.default.createElement("label", { className: "col-fixed", style: { width: '12rem' } }, (0, XLocale_1.xLocaleOption)('expDetailRowsExport')),
|
|
188
|
-
react_1.default.createElement(dropdown_1.Dropdown, { value: detailRowsExport, options: XUtils_1.XUtils.multilineExportTypeOptions, onChange: function (e) { return setDetailRowsExport(e.value); } })));
|
|
188
|
+
react_1.default.createElement(dropdown_1.Dropdown, { value: detailRowsExport, options: XUtils_1.XUtils.options(XUtils_1.XUtils.multilineExportTypeOptions), onChange: function (e) { return setDetailRowsExport(e.value); } })));
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
if (exportType === ExportImportParam_1.ExportType.Csv) {
|
|
192
192
|
elem.push([
|
|
193
193
|
react_1.default.createElement("div", { key: "expCsvSeparator", className: "field grid" },
|
|
194
194
|
react_1.default.createElement("label", { className: "col-fixed", style: { width: '12rem' } }, (0, XLocale_1.xLocaleOption)('expCsvSeparator')),
|
|
195
|
-
react_1.default.createElement(dropdown_1.Dropdown, { value: csvSeparator, options: XUtils_1.XUtils.csvSeparatorOptions, onChange: function (e) { return setCsvSeparator(e.value); } })),
|
|
195
|
+
react_1.default.createElement(dropdown_1.Dropdown, { value: csvSeparator, options: XUtils_1.XUtils.options(XUtils_1.XUtils.csvSeparatorOptions), onChange: function (e) { return setCsvSeparator(e.value); } })),
|
|
196
196
|
react_1.default.createElement("div", { key: "expDecimalFormat", className: "field grid" },
|
|
197
197
|
react_1.default.createElement("label", { className: "col-fixed", style: { width: '12rem' } }, (0, XLocale_1.xLocaleOption)('expDecimalFormat')),
|
|
198
|
-
react_1.default.createElement(dropdown_1.Dropdown, { value: decimalFormat, options: XUtils_1.XUtils.decimalFormatOptions, onChange: function (e) { return setDecimalFormat(e.value); } })),
|
|
198
|
+
react_1.default.createElement(dropdown_1.Dropdown, { value: decimalFormat, options: XUtils_1.XUtils.options(XUtils_1.XUtils.decimalFormatOptions), onChange: function (e) { return setDecimalFormat(e.value); } })),
|
|
199
199
|
react_1.default.createElement("div", { key: "expEncoding", className: "field grid" },
|
|
200
200
|
react_1.default.createElement("label", { className: "col-fixed", style: { width: '12rem' } }, (0, XLocale_1.xLocaleOption)('expEncoding')),
|
|
201
|
-
react_1.default.createElement(dropdown_1.Dropdown, { value: csvEncoding, options: XUtils_1.XUtils.csvEncodingOptions, onChange: function (e) { return setCsvEncoding(e.value); } }))
|
|
201
|
+
react_1.default.createElement(dropdown_1.Dropdown, { value: csvEncoding, options: XUtils_1.XUtils.options(XUtils_1.XUtils.csvEncodingOptions), onChange: function (e) { return setCsvEncoding(e.value); } }))
|
|
202
202
|
]);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
@@ -211,7 +211,7 @@ var XExportRowsDialog = function (props) {
|
|
|
211
211
|
: null,
|
|
212
212
|
react_1.default.createElement("div", { key: "expExportType", className: "field grid" },
|
|
213
213
|
react_1.default.createElement("label", { className: "col-fixed", style: { width: '12rem' } }, (0, XLocale_1.xLocaleOption)('expExportType')),
|
|
214
|
-
react_1.default.createElement(dropdown_1.Dropdown, { value: exportType, options: (_e = props.exportTypeOptions) !== null && _e !== void 0 ? _e : XUtils_1.XUtils.exportTypeOptions, onChange: function (e) { return setExportType(e.value); } })),
|
|
214
|
+
react_1.default.createElement(dropdown_1.Dropdown, { value: exportType, options: XUtils_1.XUtils.options((_e = props.exportTypeOptions) !== null && _e !== void 0 ? _e : XUtils_1.XUtils.exportTypeOptions), onChange: function (e) { return setExportType(e.value); } })),
|
|
215
215
|
elem,
|
|
216
216
|
react_1.default.createElement("div", { key: "exportRows", className: "flex justify-content-center" },
|
|
217
217
|
react_1.default.createElement(XButton_1.XButton, { label: (0, XLocale_1.xLocaleOption)('exportRows'), onClick: onExport }))));
|
|
@@ -214,7 +214,7 @@ var XSearchButton = /** @class */ (function (_super) {
|
|
|
214
214
|
react_1.default.createElement("div", { className: "x-search-button-base" },
|
|
215
215
|
react_1.default.createElement(inputtext_1.InputText, __assign({ id: props.assocField, value: inputValue, onChange: onInputValueChange, onBlur: onInputBlur, readOnly: this.isReadOnly(), ref: this.inputTextRef, maxLength: xDisplayField.length, size: size, style: props.inputStyle }, this.getClassNameTooltip())),
|
|
216
216
|
react_1.default.createElement(button_1.Button, { icon: "pi pi-search", onClick: onClickSearch })),
|
|
217
|
-
react_1.default.createElement(dialog_1.Dialog, { visible: dialogOpened, onHide: onHide }, react_1.default.cloneElement(props.searchBrowse, { searchBrowseParams: createSearchBrowseParams() } /*, props.searchBrowse.children*/))));
|
|
217
|
+
react_1.default.createElement(dialog_1.Dialog, { className: "x-dialog-without-header", visible: dialogOpened, onHide: onHide }, react_1.default.cloneElement(props.searchBrowse, { searchBrowseParams: createSearchBrowseParams() } /*, props.searchBrowse.children*/))));
|
|
218
218
|
};
|
|
219
219
|
return XSearchButton;
|
|
220
220
|
}(XFormComponent_1.XFormComponent));
|
|
@@ -181,7 +181,7 @@ var XSearchButtonDT = function (props) {
|
|
|
181
181
|
react_1.default.createElement("div", { className: "x-search-button-base" },
|
|
182
182
|
react_1.default.createElement(inputtext_1.InputText, { id: props.assocField, value: inputValue, onChange: onInputValueChange, onBlur: onInputBlur, readOnly: readOnly, ref: inputTextRef }),
|
|
183
183
|
react_1.default.createElement(button_1.Button, { icon: "pi pi-search", onClick: onClickSearch })),
|
|
184
|
-
react_1.default.createElement(dialog_1.Dialog, { visible: dialogOpened, onHide: onHide }, react_1.default.cloneElement(props.searchBrowse, {
|
|
184
|
+
react_1.default.createElement(dialog_1.Dialog, { className: "x-dialog-without-header", visible: dialogOpened, onHide: onHide }, react_1.default.cloneElement(props.searchBrowse, {
|
|
185
185
|
searchBrowseParams: {
|
|
186
186
|
onChoose: onChoose,
|
|
187
187
|
displayFieldFilter: (inputChanged ? { field: props.displayField, constraint: { value: inputValueState, matchMode: "contains" } } : undefined),
|
|
@@ -7,6 +7,7 @@ import { XCustomFilter, XCustomFilterItem } from "../serverApi/FindParam";
|
|
|
7
7
|
import { DataTableSortMeta } from "primereact/datatable";
|
|
8
8
|
import { XObject } from "./XObject";
|
|
9
9
|
import { XTableFieldReadOnlyProp } from "./XFormDataTable2";
|
|
10
|
+
import { SelectItem } from "primereact/selectitem";
|
|
10
11
|
export declare enum OperationType {
|
|
11
12
|
None = 0,
|
|
12
13
|
Insert = 1,
|
|
@@ -125,4 +126,5 @@ export declare class XUtils {
|
|
|
125
126
|
static evalFilter(filter: XFilterOrFunction | undefined): XCustomFilter | undefined;
|
|
126
127
|
static isTableRowInserted(tableRow: any): boolean;
|
|
127
128
|
static xViewStatus(xViewStatusOrBoolean: XViewStatusOrBoolean): XViewStatus;
|
|
129
|
+
static options(valueStringList: string[]): SelectItem[];
|
|
128
130
|
}
|
package/lib/components/XUtils.js
CHANGED
|
@@ -841,6 +841,10 @@ var XUtils = /** @class */ (function () {
|
|
|
841
841
|
}
|
|
842
842
|
return xViewStatus;
|
|
843
843
|
};
|
|
844
|
+
// plain string does not work in Dropdown, bug in Primereact?
|
|
845
|
+
XUtils.options = function (valueStringList) {
|
|
846
|
+
return valueStringList.map(function (valueString) { return { value: valueString, label: valueString }; });
|
|
847
|
+
};
|
|
844
848
|
XUtils.dropdownEmptyOptionValue = " ";
|
|
845
849
|
XUtils.xBackendUrl = undefined;
|
|
846
850
|
// nacachovany XToken - na rozlicnych miestach potrebujeme vediet uzivatela
|