@michalrakus/x-react-web-lib 1.2.0 → 1.3.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.
@@ -9,6 +9,7 @@ export interface XAutoCompleteBaseProps {
9
9
  valueForm?: any;
10
10
  idField?: string;
11
11
  maxLength?: number;
12
+ readOnly?: boolean;
12
13
  error?: string;
13
14
  onErrorChange: (error: string | undefined) => void;
14
15
  setFocusOnCreate?: boolean;
@@ -265,6 +265,8 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
265
265
  };
266
266
  XAutoCompleteBase.prototype.render = function () {
267
267
  var _this = this;
268
+ var _a;
269
+ var readOnly = (_a = this.props.readOnly) !== null && _a !== void 0 ? _a : false;
268
270
  var dropdownButton;
269
271
  if (this.props.valueForm) {
270
272
  // mame CRUD operacie, potrebujeme SplitButton
@@ -324,11 +326,11 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
324
326
  _this.autoCompleteRef.current.search(e, '', 'dropdown');
325
327
  }
326
328
  });
327
- dropdownButton = react_1.default.createElement(splitbutton_1.SplitButton, { model: splitButtonItems, className: 'x-splitbutton-only-dropdown' + XUtils_1.XUtils.mobileCssSuffix(), menuClassName: 'x-splitbutton-only-dropdown-menu' + XUtils_1.XUtils.mobileCssSuffix() });
329
+ dropdownButton = react_1.default.createElement(splitbutton_1.SplitButton, { model: splitButtonItems, className: 'x-splitbutton-only-dropdown' + XUtils_1.XUtils.mobileCssSuffix(), menuClassName: 'x-splitbutton-only-dropdown-menu' + XUtils_1.XUtils.mobileCssSuffix(), disabled: readOnly });
328
330
  }
329
331
  else {
330
332
  // mame len 1 operaciu - dame jednoduchy button
331
- dropdownButton = react_1.default.createElement(button_1.Button, { icon: "pi pi-chevron-down", onClick: function (e) { return _this.autoCompleteRef.current.search(e, '', 'dropdown'); }, className: 'x-dropdownbutton' + XUtils_1.XUtils.mobileCssSuffix() });
333
+ dropdownButton = react_1.default.createElement(button_1.Button, { icon: "pi pi-chevron-down", onClick: function (e) { return _this.autoCompleteRef.current.search(e, '', 'dropdown'); }, className: 'x-dropdownbutton' + XUtils_1.XUtils.mobileCssSuffix(), disabled: readOnly });
332
334
  }
333
335
  // vypocitame inputValue
334
336
  var inputValue = this.computeInputValue();
@@ -352,9 +354,9 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
352
354
  // <DobrovolnikForm id={this.formDialogObjectId} object={this.formDialogInitObjectForInsert} onSaveOrCancel={this.formDialogOnSaveOrCancel}/>
353
355
  // formgroup-inline lepi SplitButton na autocomplete a zarovna jeho vysku
354
356
  return (react_1.default.createElement("div", { className: "x-auto-complete-base" },
355
- react_1.default.createElement(autocomplete_1.AutoComplete, __assign({ value: inputValue, suggestions: this.state.filteredSuggestions, completeMethod: this.completeMethod }, fieldOrItemTemplate, { onChange: this.onChange, onSelect: this.onSelect, onBlur: this.onBlur, maxLength: this.props.maxLength, ref: this.autoCompleteRef }, XUtils_1.XUtils.createErrorProps(error))),
357
+ react_1.default.createElement(autocomplete_1.AutoComplete, __assign({ value: inputValue, suggestions: this.state.filteredSuggestions, completeMethod: this.completeMethod }, fieldOrItemTemplate, { 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))),
356
358
  dropdownButton,
357
- this.props.valueForm != undefined ?
359
+ this.props.valueForm != undefined && !readOnly ?
358
360
  react_1.default.createElement(dialog_1.Dialog, { visible: this.state.formDialogOpened, onHide: this.formDialogOnHide, header: this.formDialogObjectId ? 'Modification' : 'New record' }, react_1.default.cloneElement(this.props.valueForm, {
359
361
  id: this.formDialogObjectId, object: this.formDialogInitObjectForInsert, onSaveOrCancel: this.formDialogOnSaveOrCancel
360
362
  }, this.props.valueForm.children))
@@ -130,11 +130,10 @@ var XAutoCompleteDT = /** @class */ (function (_super) {
130
130
  XAutoCompleteDT.prototype.render = function () {
131
131
  var xEntityAssoc = XUtilsMetadata_1.XUtilsMetadata.getXEntity(this.xAssoc.entityName);
132
132
  //const xDisplayField = XUtilsMetadata.getXFieldByPath(xEntityAssoc, this.props.displayField);
133
- // TODO - readOnly
134
133
  // TODO - size
135
134
  //const size = this.props.size ?? xDisplayField.length;
136
135
  // div className="col" nam zabezpeci aby XAutoCompleteBase nezaberal celu dlzku grid-u (ma nastaveny width=100% vdaka "formgroup-inline")
137
- return (react_1.default.createElement(XAutoCompleteBase_1.XAutoCompleteBase, { value: this.getValue(), suggestions: this.state.suggestions, onChange: this.onChangeAutoCompleteBase, field: this.props.displayField, valueForm: this.props.assocForm, idField: xEntityAssoc.idField, error: this.getError(), onErrorChange: this.onErrorChangeAutoCompleteBase }));
136
+ return (react_1.default.createElement(XAutoCompleteBase_1.XAutoCompleteBase, { value: this.getValue(), suggestions: this.state.suggestions, onChange: this.onChangeAutoCompleteBase, field: this.props.displayField, valueForm: this.props.assocForm, idField: xEntityAssoc.idField, readOnly: this.isReadOnly(), error: this.getError(), onErrorChange: this.onErrorChangeAutoCompleteBase }));
138
137
  };
139
138
  return XAutoCompleteDT;
140
139
  }(XFormComponentDT_1.XFormComponentDT));
@@ -125,12 +125,14 @@ var XDropdown = /** @class */ (function (_super) {
125
125
  XDropdown.prototype.render = function () {
126
126
  // TODO - pridat cez generikum typ objektu v Dropdown-e (ak sa da)
127
127
  var options = this.state.options;
128
- // TODO - readOnly implementovat
128
+ // TODO - mozno by nebolo od veci pouzivat InputText ak readOnly === true (chybala by len sipka (rozbalovac)) a dalo by sa copy-paste-ovat
129
+ // propertiesy na Dropdown-e: readOnly vyseduje, disabled znemoznuje vyber polozky
130
+ var readOnly = this.isReadOnly();
129
131
  // Dropdown setuje do atributu object.assocField asociovany objekt zo zoznamu objektov ktore ziskame podla asociacie
130
132
  // appendTo={document.body} appenduje overlay panel na element body - eliminuje "skakanie" formularu na mobile pri kliknuti na dropdown
131
133
  return (react_1.default.createElement("div", { className: "field grid" },
132
134
  react_1.default.createElement("label", { htmlFor: this.props.assocField, className: "col-fixed", style: this.getLabelStyle() }, this.getLabel()),
133
- react_1.default.createElement(dropdown_1.Dropdown, __assign({ appendTo: document.body, id: this.props.assocField, optionLabel: this.props.displayField, value: this.getValue(), options: options, onChange: this.onValueChange }, this.getClassNameTooltip()))));
135
+ react_1.default.createElement(dropdown_1.Dropdown, __assign({ appendTo: document.body, id: this.props.assocField, optionLabel: this.props.displayField, value: this.getValue(), options: options, onChange: this.onValueChange, readOnly: readOnly, disabled: readOnly }, this.getClassNameTooltip()))));
134
136
  };
135
137
  return XDropdown;
136
138
  }(XFormComponent_1.XFormComponent));
@@ -52,13 +52,13 @@ var XUtilsConversions_1 = require("./XUtilsConversions");
52
52
  var XExportRowsDialog = function (props) {
53
53
  var _a;
54
54
  var _b = __read((0, react_1.useState)(ExportImportParam_1.ExportType.Csv), 2), exportType = _b[0], setExportType = _b[1];
55
- var _c = __read((0, react_1.useState)(false), 2), createHeaderLine = _c[0], setCreateHeaderLine = _c[1];
55
+ var _c = __read((0, react_1.useState)(true), 2), createHeaderLine = _c[0], setCreateHeaderLine = _c[1];
56
56
  var _d = __read((0, react_1.useState)(ExportImportParam_1.CsvSeparator.Semicolon), 2), csvSeparator = _d[0], setCsvSeparator = _d[1];
57
57
  var _e = __read((0, react_1.useState)(ExportImportParam_1.CsvDecimalFormat.Comma), 2), decimalFormat = _e[0], setDecimalFormat = _e[1];
58
58
  // bez tejto metody by pri opetovnom otvoreni dialogu ponechal povodne hodnoty
59
59
  var onShow = function () {
60
60
  setExportType(ExportImportParam_1.ExportType.Csv);
61
- setCreateHeaderLine(false); // excel hadze hlasky koli prvemu riadku header-ov
61
+ setCreateHeaderLine(true); // excel hadze hlasky koli prvemu riadku header-ov
62
62
  setCsvSeparator(ExportImportParam_1.CsvSeparator.Semicolon);
63
63
  setDecimalFormat(ExportImportParam_1.CsvDecimalFormat.Comma);
64
64
  };
@@ -45,11 +45,13 @@ export declare abstract class XFormBase extends Component<FormProps> {
45
45
  addXFormComponent(xFormComponent: XFormComponent<any, any>): void;
46
46
  findXFormComponent(field: string): XFormComponent<any, any> | undefined;
47
47
  addXFormDataTable(xFormDataTable: XFormDataTable2): void;
48
+ formReadOnlyBase(field: string): boolean;
48
49
  onClickSave(): Promise<void>;
49
50
  onClickCancel(): void;
50
51
  validateSave(): boolean;
51
52
  validateForm(): XErrorMap;
52
53
  fieldValidation(): XErrorMap;
54
+ formReadOnly(object: XObject, field: string): boolean;
53
55
  preInitForm(object: XObject, operationType: OperationType.Insert | OperationType.Update): void;
54
56
  validate(object: XObject): XErrors;
55
57
  preSave(object: XObject): void;
@@ -345,6 +345,10 @@ var XFormBase = /** @class */ (function (_super) {
345
345
  XFormBase.prototype.addXFormDataTable = function (xFormDataTable) {
346
346
  this.xFormDataTableList.push(xFormDataTable);
347
347
  };
348
+ XFormBase.prototype.formReadOnlyBase = function (field) {
349
+ // TODO - bude this.state.object vzdycky !== undefined?
350
+ return this.formReadOnly(this.state.object, field);
351
+ };
348
352
  XFormBase.prototype.onClickSave = function () {
349
353
  return __awaiter(this, void 0, void 0, function () {
350
354
  var isAddRow, object, e_3;
@@ -493,6 +497,12 @@ var XFormBase = /** @class */ (function (_super) {
493
497
  }
494
498
  return xErrorMap;
495
499
  };
500
+ // this method can be overriden in subclass if needed
501
+ // (the purpose is to put the whole form to read only mode (maybe with exception a few fields))
502
+ // if returns true for the param "field", then the field is read only, otherwise the property readOnly of the XInput* is processed
503
+ XFormBase.prototype.formReadOnly = function (object, field) {
504
+ return false;
505
+ };
496
506
  // this method can be overriden in subclass if needed (to modify/save object after read from DB and before set into the form)
497
507
  XFormBase.prototype.preInitForm = function (object, operationType) {
498
508
  };
@@ -5,11 +5,12 @@ import { OperationType } from "./XUtils";
5
5
  import { XFieldChangeEvent } from "./XFieldChangeEvent";
6
6
  import { XCustomFilter } from "../serverApi/FindParam";
7
7
  export type FieldOnChange = (e: XFieldChangeEvent<any>) => void;
8
+ export type XReadOnlyProp = boolean | ((object: any) => boolean);
8
9
  export type XFilterProp = XCustomFilter | ((object: any) => XCustomFilter | undefined);
9
10
  export interface XFormComponentProps<T> {
10
11
  form: XFormBase;
11
12
  label?: string;
12
- readOnly?: boolean;
13
+ readOnly?: XReadOnlyProp;
13
14
  labelStyle?: React.CSSProperties;
14
15
  inline?: boolean;
15
16
  onChange?: FieldOnChange;
@@ -47,8 +47,34 @@ var XFormComponent = /** @class */ (function (_super) {
47
47
  this.props.form.onFieldChange(this.getField(), value, error, onChange, assocObjectChange);
48
48
  };
49
49
  XFormComponent.prototype.isReadOnly = function () {
50
- // tuto do buducna planujeme pridat aj dynamicky readOnly, bude ho treba ukladat do form.state podobne ako sa ukladaju errory do form.state.errorMap
51
- return XUtils_1.XUtils.isReadOnly(this.getField(), this.props.readOnly);
50
+ var readOnly;
51
+ if (!XUtilsCommon_1.XUtilsCommon.isSingleField(this.getField())) {
52
+ // if the length of field is 2 or more, then readOnly
53
+ readOnly = true;
54
+ }
55
+ // the purpose of formReadOnly is to put the whole form to read only mode,
56
+ // that's why the formReadOnly has higher prio then property this.props.readOnly
57
+ else if (this.props.form.formReadOnlyBase(this.getField())) {
58
+ readOnly = true;
59
+ }
60
+ else if (typeof this.props.readOnly === 'boolean') {
61
+ readOnly = this.props.readOnly;
62
+ }
63
+ else if (typeof this.props.readOnly === 'function') {
64
+ // TODO - tazko povedat ci niekedy bude object === null (asi ano vid metodu getFilterBase)
65
+ var object = this.props.form.state.object;
66
+ if (object) {
67
+ readOnly = this.props.readOnly(this.props.form.getXObject());
68
+ }
69
+ else {
70
+ readOnly = true;
71
+ }
72
+ }
73
+ else {
74
+ // readOnly is undefined
75
+ readOnly = false;
76
+ }
77
+ return readOnly;
52
78
  };
53
79
  XFormComponent.prototype.getLabel = function () {
54
80
  var _a;
@@ -48,8 +48,34 @@ var XFormComponentDT = /** @class */ (function (_super) {
48
48
  this.props.form.onTableFieldChange(this.props.rowData, this.getField(), value, error, onChange, assocObjectChange);
49
49
  };
50
50
  XFormComponentDT.prototype.isReadOnly = function () {
51
- // tuto do buducna planujeme pridat aj dynamicky readOnly, bude ho treba ukladat do form.state podobne ako sa ukladaju errory do form.state.errorMap
52
- return XUtils_1.XUtils.isReadOnly(this.getField(), this.props.readOnly);
51
+ var readOnly;
52
+ if (!XUtilsCommon_1.XUtilsCommon.isSingleField(this.getField())) {
53
+ // if the length of field is 2 or more, then readOnly
54
+ readOnly = true;
55
+ }
56
+ // formReadOnlyBase is called on the level XFormDataTable2
57
+ // else if (this.props.form.formReadOnlyBase("xxx")) {
58
+ // readOnly = true;
59
+ // }
60
+ else if (typeof this.props.readOnly === 'boolean') {
61
+ readOnly = this.props.readOnly;
62
+ }
63
+ // else if (typeof this.props.readOnly === 'function') {
64
+ // // TODO - tazko povedat ci niekedy bude object === null (asi ano vid metodu getFilterBase)
65
+ // TODO - use also this.props.rowData
66
+ // const object: XObject = this.props.form.state.object;
67
+ // if (object) {
68
+ // readOnly = this.props.readOnly(this.props.form.getXObject());
69
+ // }
70
+ // else {
71
+ // readOnly = true;
72
+ // }
73
+ // }
74
+ else {
75
+ // readOnly is undefined
76
+ readOnly = false;
77
+ }
78
+ return readOnly;
53
79
  };
54
80
  // *********** validation support ************
55
81
  // volane po kliknuti na Save
@@ -75,12 +75,13 @@ export declare class XFormDataTable2 extends Component<XFormDataTableProps> {
75
75
  getCheckboxFilterValue(field: string): boolean | null;
76
76
  onDropdownFilterChange(field: string, displayValue: any): void;
77
77
  getDropdownFilterValue(field: string): any;
78
- bodyTemplate(columnProps: XFormColumnProps, rowData: any, xEntity: XEntity): any;
78
+ bodyTemplate(columnProps: XFormColumnProps, tableReadOnly: boolean, rowData: any, xEntity: XEntity): any;
79
79
  onClickAddRow(): void;
80
80
  onClickRemoveRowBySelection(): void;
81
81
  removeRow(row: any): void;
82
82
  validate(): void;
83
83
  getErrorMessages(): string;
84
+ isReadOnly(): boolean;
84
85
  render(): JSX.Element;
85
86
  }
86
87
  export type TableFieldOnChange = (e: XTableFieldChangeEvent<any, any>) => void;
@@ -334,23 +334,26 @@ var XFormDataTable2 = /** @class */ (function (_super) {
334
334
  }
335
335
  */
336
336
  // body={(rowData: any) => bodyTemplate(childColumn.props.field, rowData)}
337
- XFormDataTable2.prototype.bodyTemplate = function (columnProps, rowData, xEntity) {
337
+ XFormDataTable2.prototype.bodyTemplate = function (columnProps, tableReadOnly, rowData, xEntity) {
338
+ var _a, _b;
338
339
  var body;
339
340
  if (columnProps.type === "inputSimple") {
340
341
  var columnPropsInputSimple = columnProps;
342
+ // tableReadOnly has higher prio then property readOnly
343
+ var readOnly = tableReadOnly || ((_a = columnPropsInputSimple.readOnly) !== null && _a !== void 0 ? _a : false);
341
344
  var xField = XUtilsMetadata_1.XUtilsMetadata.getXFieldByPath(xEntity, columnPropsInputSimple.field);
342
345
  if (xField.type === "decimal" || xField.type === "number") {
343
- body = react_1.default.createElement(XInputDecimalDT_1.XInputDecimalDT, { form: this.props.form, entity: this.getEntity(), field: columnPropsInputSimple.field, rowData: rowData, readOnly: columnPropsInputSimple.readOnly, onChange: columnPropsInputSimple.onChange });
346
+ body = react_1.default.createElement(XInputDecimalDT_1.XInputDecimalDT, { form: this.props.form, entity: this.getEntity(), field: columnPropsInputSimple.field, rowData: rowData, readOnly: readOnly, onChange: columnPropsInputSimple.onChange });
344
347
  }
345
348
  else if (xField.type === "date" || xField.type === "datetime") {
346
- body = react_1.default.createElement(XInputDateDT_1.XInputDateDT, { form: this.props.form, xField: xField, field: columnPropsInputSimple.field, rowData: rowData, readOnly: columnPropsInputSimple.readOnly });
349
+ body = react_1.default.createElement(XInputDateDT_1.XInputDateDT, { form: this.props.form, xField: xField, field: columnPropsInputSimple.field, rowData: rowData, readOnly: readOnly });
347
350
  }
348
351
  else if (xField.type === "boolean") {
349
- body = react_1.default.createElement(XCheckboxDT_1.XCheckboxDT, { form: this.props.form, xField: xField, field: columnPropsInputSimple.field, rowData: rowData, readOnly: columnPropsInputSimple.readOnly });
352
+ body = react_1.default.createElement(XCheckboxDT_1.XCheckboxDT, { form: this.props.form, xField: xField, field: columnPropsInputSimple.field, rowData: rowData, readOnly: readOnly });
350
353
  }
351
354
  else {
352
355
  // xField.type === "string", pripadne ine jednoduche typy
353
- body = react_1.default.createElement(XInputTextDT_1.XInputTextDT, { form: this.props.form, entity: this.getEntity(), field: columnPropsInputSimple.field, rowData: rowData, readOnly: columnPropsInputSimple.readOnly });
356
+ body = react_1.default.createElement(XInputTextDT_1.XInputTextDT, { form: this.props.form, entity: this.getEntity(), field: columnPropsInputSimple.field, rowData: rowData, readOnly: readOnly });
354
357
  }
355
358
  }
356
359
  else if (columnProps.type === "dropdown") {
@@ -359,7 +362,9 @@ var XFormDataTable2 = /** @class */ (function (_super) {
359
362
  }
360
363
  else if (columnProps.type === "autoComplete") {
361
364
  var columnPropsAutoComplete = columnProps;
362
- body = react_1.default.createElement(XAutoCompleteDT_1.XAutoCompleteDT, { form: this.props.form, entity: this.getEntity(), assocField: columnPropsAutoComplete.assocField, displayField: columnPropsAutoComplete.displayField, searchTable: columnPropsAutoComplete.searchTable, assocForm: columnPropsAutoComplete.assocForm, filter: columnPropsAutoComplete.filter, rowData: rowData });
365
+ // tableReadOnly has higher prio then property readOnly
366
+ var readOnly = tableReadOnly || ((_b = columnPropsAutoComplete.readOnly) !== null && _b !== void 0 ? _b : false);
367
+ body = react_1.default.createElement(XAutoCompleteDT_1.XAutoCompleteDT, { form: this.props.form, entity: this.getEntity(), assocField: columnPropsAutoComplete.assocField, displayField: columnPropsAutoComplete.displayField, searchTable: columnPropsAutoComplete.searchTable, assocForm: columnPropsAutoComplete.assocForm, filter: columnPropsAutoComplete.filter, rowData: rowData, readOnly: readOnly });
363
368
  }
364
369
  else if (columnProps.type === "searchButton") {
365
370
  var columnPropsSearchButton = columnProps;
@@ -459,6 +464,34 @@ var XFormDataTable2 = /** @class */ (function (_super) {
459
464
  }
460
465
  return msg;
461
466
  };
467
+ // TODO - velmi podobna funkcia ako XFormComponent.isReadOnly() - zjednotit ak sa da
468
+ XFormDataTable2.prototype.isReadOnly = function () {
469
+ var readOnly;
470
+ // the purpose of formReadOnly is to put the whole form to read only mode,
471
+ // that's why the formReadOnly has higher prio then property this.props.readOnly
472
+ if (this.props.form.formReadOnlyBase(this.props.assocField)) {
473
+ readOnly = true;
474
+ }
475
+ else if (typeof this.props.readOnly === 'boolean') {
476
+ readOnly = this.props.readOnly;
477
+ }
478
+ // TODO
479
+ // else if (typeof this.props.readOnly === 'function') {
480
+ // // TODO - tazko povedat ci niekedy bude object === null (asi ano vid metodu getFilterBase)
481
+ // const object: XObject = this.props.form.state.object;
482
+ // if (object) {
483
+ // readOnly = this.props.readOnly(this.props.form.getXObject());
484
+ // }
485
+ // else {
486
+ // readOnly = true;
487
+ // }
488
+ // }
489
+ else {
490
+ // readOnly is undefined
491
+ readOnly = false;
492
+ }
493
+ return readOnly;
494
+ };
462
495
  XFormDataTable2.prototype.render = function () {
463
496
  var _this = this;
464
497
  var paginator = this.props.paginator !== undefined ? this.props.paginator : false;
@@ -473,7 +506,7 @@ var XFormDataTable2 = /** @class */ (function (_super) {
473
506
  }
474
507
  var filterDisplay = this.props.filterDisplay !== "none" ? this.props.filterDisplay : undefined;
475
508
  var label = this.props.label !== undefined ? this.props.label : this.props.assocField;
476
- var readOnly = this.props.readOnly !== undefined ? this.props.readOnly : false;
509
+ var readOnly = this.isReadOnly();
477
510
  // v bloku function (child) nejde pouzit priamo this, thisLocal uz ide pouzit
478
511
  var thisLocal = this;
479
512
  var object = this.props.form.state.object;
@@ -577,11 +610,11 @@ var XFormDataTable2 = /** @class */ (function (_super) {
577
610
  align = "center";
578
611
  }
579
612
  // }
580
- 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, rowData, xEntity); } });
613
+ 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); } });
581
614
  });
582
615
  if (this.props.removeButtonInRow) {
583
616
  // je dolezite nastavit sirku header-a, lebo inac ma stlpec sirku 0 a nevidno ho
584
- columnElemList.push(react_1.default.createElement(column_1.Column, { key: "removeButton", headerStyle: { width: '2rem' }, body: function (rowData) { return react_1.default.createElement(XButtonIconNarrow_1.XButtonIconNarrow, { icon: "pi pi-times", onClick: function () { return _this.removeRow(rowData); }, addMargin: false }); } }));
617
+ columnElemList.push(react_1.default.createElement(column_1.Column, { key: "removeButton", headerStyle: { width: '2rem' }, body: function (rowData) { return react_1.default.createElement(XButtonIconNarrow_1.XButtonIconNarrow, { icon: "pi pi-times", onClick: function () { return _this.removeRow(rowData); }, disabled: readOnly, addMargin: false }); } }));
585
618
  }
586
619
  return (react_1.default.createElement("div", null,
587
620
  react_1.default.createElement("div", { className: "flex justify-content-center" },
@@ -589,8 +622,8 @@ var XFormDataTable2 = /** @class */ (function (_super) {
589
622
  react_1.default.createElement("div", { className: "flex justify-content-center" },
590
623
  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, 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)),
591
624
  react_1.default.createElement("div", { className: "flex justify-content-center" },
592
- react_1.default.createElement(XButton_1.XButton, { icon: this.props.addRowIcon, label: this.props.addRowLabel, onClick: this.onClickAddRow }),
593
- this.props.removeButtonInRow ? undefined : react_1.default.createElement(XButton_1.XButton, { icon: this.props.removeRowIcon, label: this.props.removeRowLabel, onClick: this.onClickRemoveRowBySelection }))));
625
+ react_1.default.createElement(XButton_1.XButton, { icon: this.props.addRowIcon, label: this.props.addRowLabel, onClick: this.onClickAddRow, disabled: readOnly }),
626
+ this.props.removeButtonInRow ? undefined : react_1.default.createElement(XButton_1.XButton, { icon: this.props.removeRowIcon, label: this.props.removeRowLabel, onClick: this.onClickRemoveRowBySelection, disabled: readOnly }))));
594
627
  };
595
628
  XFormDataTable2.defaultProps = {
596
629
  filterDisplay: "row",
@@ -17,7 +17,7 @@ var XInputDate = function (props) {
17
17
  var showTime = (xField.type === 'datetime');
18
18
  var cssClassName = showTime ? 'x-input-datetime' : 'x-input-date';
19
19
  var label = (_a = props.label) !== null && _a !== void 0 ? _a : props.field;
20
- var readOnly = XUtils_1.XUtils.isReadOnly(props.field, props.readOnly);
20
+ var readOnly = XUtils_1.XUtils.isReadOnly(props.field, props.readOnly) || props.form.formReadOnlyBase(props.field);
21
21
  if (!xField.isNullable && !readOnly) {
22
22
  label = XUtils_1.XUtils.markNotNull(label);
23
23
  }
@@ -438,7 +438,7 @@ var XLazyDataTable = function (props) {
438
438
  if (csvParam && csvParam.useHeaderLine) {
439
439
  csvParam.headers = getHeaders();
440
440
  }
441
- exportParam = { exportType: exportType, filters: filtersAfterFiltering, multiSortMeta: multiSortMeta, entity: props.entity, fields: getFields(), csvParam: csvParam };
441
+ exportParam = { exportType: exportType, filters: filtersAfterFiltering, customFilter: customFilter, multiSortMeta: multiSortMeta, entity: props.entity, fields: getFields(), csvParam: csvParam };
442
442
  _a.label = 1;
443
443
  case 1:
444
444
  _a.trys.push([1, 3, , 4]);
@@ -1,4 +1,5 @@
1
1
  import { DataTableFilterMeta, DataTableSortMeta } from "primereact/datatable";
2
+ import { XCustomFilter } from "./FindParam";
2
3
  export declare enum ExportType {
3
4
  Csv = "csv",
4
5
  Json = "json"
@@ -6,6 +7,7 @@ export declare enum ExportType {
6
7
  export interface ExportParam {
7
8
  exportType: ExportType;
8
9
  filters: DataTableFilterMeta;
10
+ customFilter?: XCustomFilter;
9
11
  multiSortMeta?: DataTableSortMeta[];
10
12
  entity: string;
11
13
  fields: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michalrakus/x-react-web-lib",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "clean": "rimraf lib",