@michalrakus/x-react-web-lib 1.34.0 → 1.35.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/XDocTemplateButton.d.ts +3 -0
- package/XDocTemplateButton.js +5 -0
- package/gulpfile.js +3 -0
- package/lib/administration/x-enum-enum.d.ts +12 -0
- package/lib/administration/x-enum-enum.js +2 -0
- package/lib/administration/x-enum.d.ts +10 -0
- package/lib/administration/x-enum.js +2 -0
- package/lib/components/XAutoComplete.d.ts +1 -0
- package/lib/components/XAutoComplete.js +1 -1
- package/lib/components/XAutoCompleteBase.d.ts +4 -4
- package/lib/components/XAutoCompleteBase.js +17 -24
- package/lib/components/XAutoCompleteDT.d.ts +1 -0
- package/lib/components/XAutoCompleteDT.js +1 -1
- package/lib/components/XFormDialog.d.ts +12 -0
- package/lib/components/XFormDialog.js +20 -0
- package/lib/components/XFormFooter.d.ts +4 -0
- package/lib/components/XFormFooter.js +20 -1
- package/lib/components/XInputFileList.js +6 -27
- package/lib/components/XLazyDataTable/XExportRowsDialog.js +37 -59
- package/lib/components/XLazyDataTable/XLazyDataTable.d.ts +33 -36
- package/lib/components/XLazyDataTable/XLazyDataTable.js +206 -144
- package/lib/components/XUtils.d.ts +1 -0
- package/lib/components/XUtils.js +21 -8
- package/lib/modules/docTemplates/XDocTemplateButton.d.ts +7 -0
- package/lib/modules/docTemplates/XDocTemplateButton.js +150 -0
- package/lib/modules/docTemplates/xt-doc-template-field-to-join.d.ts +6 -0
- package/lib/modules/docTemplates/xt-doc-template-field-to-join.js +2 -0
- package/lib/modules/docTemplates/xt-doc-template.d.ts +18 -0
- package/lib/modules/docTemplates/xt-doc-template.js +2 -0
- package/lib/modules/files/x-file.d.ts +8 -0
- package/lib/modules/files/x-file.js +2 -0
- package/lib/serverApi/FindParam.d.ts +2 -1
- package/lib/serverApi/FindParam.js +1 -0
- package/lib/serverApi/x-lib-api.d.ts +6 -0
- package/lib/serverApi/x-lib-api.js +0 -1
- package/package.json +1 -1
- package/xt-doc-template.d.ts +3 -0
- package/xt-doc-template.js +5 -0
package/gulpfile.js
CHANGED
|
@@ -78,6 +78,9 @@ function generateApi(cb) {
|
|
|
78
78
|
"./lib/components/XUtils",
|
|
79
79
|
"./lib/components/XUtilsMetadata",
|
|
80
80
|
|
|
81
|
+
"./lib/modules/docTemplates/XDocTemplateButton",
|
|
82
|
+
"./lib/modules/docTemplates/xt-doc-template",
|
|
83
|
+
|
|
81
84
|
"./lib/serverApi/ExportImportParam",
|
|
82
85
|
"./lib/serverApi/FindParam",
|
|
83
86
|
"./lib/serverApi/XUtilsCommon",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { XUser } from "../serverApi/XUser";
|
|
2
|
+
import { XEnum } from "./x-enum";
|
|
3
|
+
export interface XEnumEnum {
|
|
4
|
+
id: number;
|
|
5
|
+
code: string;
|
|
6
|
+
name: string;
|
|
7
|
+
readOnly: boolean;
|
|
8
|
+
xEnumList: XEnum[];
|
|
9
|
+
modifDate: Date;
|
|
10
|
+
modifXUser: XUser;
|
|
11
|
+
version: number;
|
|
12
|
+
}
|
|
@@ -12,6 +12,7 @@ export interface XAutoCompleteProps extends XFormComponentProps<XObject> {
|
|
|
12
12
|
itemTemplate?: (suggestion: any, index: number, createStringValue: boolean, defaultValue: (suggestion: any) => string) => React.ReactNode;
|
|
13
13
|
searchBrowse?: JSX.Element;
|
|
14
14
|
assocForm?: JSX.Element;
|
|
15
|
+
dropdownButtonEnabled?: boolean;
|
|
15
16
|
suggestions?: any[];
|
|
16
17
|
suggestionsLoad?: XSuggestionsLoadProp;
|
|
17
18
|
lazyLoadMaxRows?: number;
|
|
@@ -70,7 +70,7 @@ var XAutoComplete = /** @class */ (function (_super) {
|
|
|
70
70
|
// div className="col" nam zabezpeci aby XAutoCompleteBase nezaberal celu dlzku grid-u (ma nastaveny width=100% vdaka "formgroup-inline")
|
|
71
71
|
return (react_1.default.createElement("div", { className: "field grid" },
|
|
72
72
|
react_1.default.createElement("label", { htmlFor: this.props.assocField, className: "col-fixed", style: this.getLabelStyle() }, this.getLabel()),
|
|
73
|
-
react_1.default.createElement(XAutoCompleteBase_1.XAutoCompleteBase, { value: this.getValue(), onChange: this.onChangeAutoCompleteBase, field: this.props.displayField, itemTemplate: this.props.itemTemplate, searchBrowse: this.props.searchBrowse, valueForm: this.props.assocForm, idField: xEntityAssoc.idField, readOnly: this.isReadOnly(), error: this.getError(), onErrorChange: this.onErrorChangeAutoCompleteBase, width: this.props.width, scrollHeight: this.props.scrollHeight, suggestions: this.props.suggestions, suggestionsLoad: this.props.suggestionsLoad, lazyLoadMaxRows: this.props.lazyLoadMaxRows, splitQueryValue: this.props.splitQueryValue, minLength: this.props.minLength, suggestionsQuery: { entity: this.xAssoc.entityName, filter: function () { return _this.getFilterBase(_this.props.filter); }, sortField: this.props.sortField, fields: this.props.fields }, inputClassName: this.props.inputClassName, setFocusOnCreate: this.props.setFocusOnCreate })));
|
|
73
|
+
react_1.default.createElement(XAutoCompleteBase_1.XAutoCompleteBase, { value: this.getValue(), onChange: this.onChangeAutoCompleteBase, field: this.props.displayField, itemTemplate: this.props.itemTemplate, searchBrowse: this.props.searchBrowse, valueForm: this.props.assocForm, dropdownButtonEnabled: this.props.dropdownButtonEnabled, idField: xEntityAssoc.idField, readOnly: this.isReadOnly(), error: this.getError(), onErrorChange: this.onErrorChangeAutoCompleteBase, width: this.props.width, scrollHeight: this.props.scrollHeight, suggestions: this.props.suggestions, suggestionsLoad: this.props.suggestionsLoad, lazyLoadMaxRows: this.props.lazyLoadMaxRows, splitQueryValue: this.props.splitQueryValue, minLength: this.props.minLength, suggestionsQuery: { entity: this.xAssoc.entityName, filter: function () { return _this.getFilterBase(_this.props.filter); }, sortField: this.props.sortField, fields: this.props.fields }, inputClassName: this.props.inputClassName, setFocusOnCreate: this.props.setFocusOnCreate })));
|
|
74
74
|
};
|
|
75
75
|
return XAutoComplete;
|
|
76
76
|
}(XFormComponent_1.XFormComponent));
|
|
@@ -5,6 +5,7 @@ import { MenuItemCommandEvent } from "primereact/menuitem";
|
|
|
5
5
|
import { XSearchBrowseParams } from "./XSearchBrowseParams";
|
|
6
6
|
import { DataTableSortMeta } from "primereact/datatable";
|
|
7
7
|
import { XEntity } from "../serverApi/XEntityMetadata";
|
|
8
|
+
import { XFormDialogState } from "./XFormDialog";
|
|
8
9
|
interface XButtonItem {
|
|
9
10
|
icon: any | undefined;
|
|
10
11
|
tooltip?: string;
|
|
@@ -28,6 +29,7 @@ export interface XAutoCompleteBaseProps {
|
|
|
28
29
|
idField?: string;
|
|
29
30
|
addRowEnabled: boolean;
|
|
30
31
|
onAddRow?: (inputValue: string) => void;
|
|
32
|
+
dropdownButtonEnabled: boolean;
|
|
31
33
|
insertButtonTooltip?: string;
|
|
32
34
|
updateButtonTooltip?: string;
|
|
33
35
|
searchButtonTooltip?: string;
|
|
@@ -48,6 +50,7 @@ export declare class XAutoCompleteBase extends Component<XAutoCompleteBaseProps>
|
|
|
48
50
|
lazyLoadMaxRows: number;
|
|
49
51
|
splitQueryValue: boolean;
|
|
50
52
|
addRowEnabled: boolean;
|
|
53
|
+
dropdownButtonEnabled: boolean;
|
|
51
54
|
minLength: number;
|
|
52
55
|
buttonsLayout: string;
|
|
53
56
|
scrollHeight: string;
|
|
@@ -60,14 +63,12 @@ export declare class XAutoCompleteBase extends Component<XAutoCompleteBaseProps>
|
|
|
60
63
|
notValid: boolean;
|
|
61
64
|
suggestions: any[] | undefined;
|
|
62
65
|
filteredSuggestions: any[] | undefined;
|
|
63
|
-
|
|
66
|
+
formDialogState: XFormDialogState;
|
|
64
67
|
searchDialogOpened: boolean;
|
|
65
68
|
};
|
|
66
69
|
suggestionsLoadedForOSS: boolean;
|
|
67
70
|
wasOnChangeCalled: boolean;
|
|
68
71
|
xEntity: XEntity | undefined;
|
|
69
|
-
formDialogObjectId: number | undefined;
|
|
70
|
-
formDialogInitValuesForInsert: any | undefined;
|
|
71
72
|
constructor(props: XAutoCompleteBaseProps);
|
|
72
73
|
getXSuggestionsLoadType(): XSuggestionsLoadType;
|
|
73
74
|
getFields(): string[];
|
|
@@ -87,7 +88,6 @@ export declare class XAutoCompleteBase extends Component<XAutoCompleteBaseProps>
|
|
|
87
88
|
removeFocusFromInput(): void;
|
|
88
89
|
setObjectValue(object: any, objectChange: OperationType): void;
|
|
89
90
|
formDialogOnSaveOrCancel(object: any | null, objectChange: OperationType): void;
|
|
90
|
-
formDialogOnHide(): void;
|
|
91
91
|
searchDialogOnChoose(chosenRow: any): void;
|
|
92
92
|
searchDialogOnHide(): void;
|
|
93
93
|
createInsertItem(buttonItems: XButtonItem[]): void;
|
|
@@ -130,6 +130,7 @@ var XUtils_1 = require("./XUtils");
|
|
|
130
130
|
var button_1 = require("primereact/button");
|
|
131
131
|
var XUtilsCommon_1 = require("../serverApi/XUtilsCommon");
|
|
132
132
|
var XUtilsMetadataCommon_1 = require("../serverApi/XUtilsMetadataCommon");
|
|
133
|
+
var XFormDialog_1 = require("./XFormDialog");
|
|
133
134
|
var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
134
135
|
__extends(XAutoCompleteBase, _super);
|
|
135
136
|
function XAutoCompleteBase(props) {
|
|
@@ -142,7 +143,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
142
143
|
notValid: false,
|
|
143
144
|
suggestions: undefined,
|
|
144
145
|
filteredSuggestions: undefined,
|
|
145
|
-
|
|
146
|
+
formDialogState: { opened: false },
|
|
146
147
|
searchDialogOpened: false
|
|
147
148
|
};
|
|
148
149
|
_this.suggestionsLoadedForOSS = false;
|
|
@@ -169,7 +170,6 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
169
170
|
_this.itemTemplateString = _this.itemTemplateString.bind(_this);
|
|
170
171
|
_this.computeDefaultDisplayValue = _this.computeDefaultDisplayValue.bind(_this);
|
|
171
172
|
_this.formDialogOnSaveOrCancel = _this.formDialogOnSaveOrCancel.bind(_this);
|
|
172
|
-
_this.formDialogOnHide = _this.formDialogOnHide.bind(_this);
|
|
173
173
|
_this.searchDialogOnChoose = _this.searchDialogOnChoose.bind(_this);
|
|
174
174
|
_this.searchDialogOnHide = _this.searchDialogOnHide.bind(_this);
|
|
175
175
|
return _this;
|
|
@@ -494,14 +494,8 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
494
494
|
this.setFocusToInput();
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
XAutoCompleteBase.prototype.formDialogOnHide = function () {
|
|
500
|
-
this.setState({ formDialogOpened: false });
|
|
501
|
-
// ak mame v inpute neplatnu hodnotu, vratime kurzor na input
|
|
502
|
-
if (this.state.inputChanged) {
|
|
503
|
-
this.setFocusToInput();
|
|
504
|
-
}
|
|
497
|
+
var formDialogState = { opened: false };
|
|
498
|
+
this.setState({ formDialogState: formDialogState });
|
|
505
499
|
};
|
|
506
500
|
XAutoCompleteBase.prototype.searchDialogOnChoose = function (chosenRow) {
|
|
507
501
|
this.setState({ searchDialogOpened: false });
|
|
@@ -532,13 +526,13 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
532
526
|
}
|
|
533
527
|
else {
|
|
534
528
|
// otvorime dialog na insert
|
|
535
|
-
|
|
536
|
-
_this.formDialogInitValuesForInsert = {};
|
|
529
|
+
var initValues = {};
|
|
537
530
|
// ak mame nevalidnu hodnotu, tak ju predplnime (snaha o user friendly)
|
|
538
531
|
if (_this.state.inputChanged) {
|
|
539
|
-
|
|
532
|
+
initValues[_this.getFirstField()] = _this.state.inputValueState;
|
|
540
533
|
}
|
|
541
|
-
|
|
534
|
+
var formDialogState = { opened: true, id: undefined, initValues: initValues };
|
|
535
|
+
_this.setState({ formDialogState: formDialogState });
|
|
542
536
|
}
|
|
543
537
|
}
|
|
544
538
|
});
|
|
@@ -614,9 +608,8 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
614
608
|
if (this.props.idField === undefined) {
|
|
615
609
|
throw "XAutoCompleteBase: property valueForm is defined but property idField is also needed for form editation.";
|
|
616
610
|
}
|
|
617
|
-
|
|
618
|
-
this.
|
|
619
|
-
this.setState({ formDialogOpened: true });
|
|
611
|
+
var formDialogState = { opened: true, id: this.props.value[this.props.idField], initValues: undefined };
|
|
612
|
+
this.setState({ formDialogState: formDialogState });
|
|
620
613
|
};
|
|
621
614
|
// vracia objekt (ak inputChanged === false) alebo string (ak inputChanged === true)
|
|
622
615
|
XAutoCompleteBase.prototype.computeInputValue = function () {
|
|
@@ -688,6 +681,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
688
681
|
var buttons;
|
|
689
682
|
if (!readOnly) {
|
|
690
683
|
var createInsertItem = (this.props.addRowEnabled && (this.props.valueForm !== undefined || this.props.onAddRow !== undefined));
|
|
684
|
+
// TODO - upratat koli split layuot-u (ak dropdownButtonEnabled = false tak moze vzniknut split button s jednym buttonom)
|
|
691
685
|
if (createInsertItem || this.props.valueForm || this.props.searchBrowse) {
|
|
692
686
|
// mame searchBrowse alebo CRUD operacie, potrebujeme viac buttonov alebo SplitButton
|
|
693
687
|
var buttonItems = [];
|
|
@@ -700,7 +694,9 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
700
694
|
if (this.props.searchBrowse) {
|
|
701
695
|
this.createSearchItem(buttonItems);
|
|
702
696
|
}
|
|
703
|
-
this.
|
|
697
|
+
if (this.props.dropdownButtonEnabled) {
|
|
698
|
+
this.createDropdownItem(buttonItems);
|
|
699
|
+
}
|
|
704
700
|
if (this.props.buttonsLayout === "buttons") {
|
|
705
701
|
buttons = buttonItems.map(function (value, index) { return react_1.default.createElement(button_1.Button, { key: "button".concat(index), icon: value.icon, tooltip: value.tooltip, tooltipOptions: { position: 'top' }, onClick: function (e) { return value.command(e); }, className: 'x-dropdownbutton' + XUtils_1.XUtils.mobileCssSuffix() }); });
|
|
706
702
|
}
|
|
@@ -713,7 +709,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
713
709
|
}
|
|
714
710
|
else {
|
|
715
711
|
// mame len 1 operaciu - dame jednoduchy button
|
|
716
|
-
buttons = [react_1.default.createElement(button_1.Button, { icon: "pi pi-chevron-down", onClick: function (e) { return _this.onOpenDropdown(e); }, className: 'x-dropdownbutton' + XUtils_1.XUtils.mobileCssSuffix() })];
|
|
712
|
+
buttons = [react_1.default.createElement(button_1.Button, { icon: "pi pi-chevron-down", onClick: function (e) { return _this.onOpenDropdown(e); }, className: 'x-dropdownbutton' + XUtils_1.XUtils.mobileCssSuffix(), disabled: !this.props.dropdownButtonEnabled })];
|
|
717
713
|
}
|
|
718
714
|
}
|
|
719
715
|
else {
|
|
@@ -737,13 +733,9 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
737
733
|
else {
|
|
738
734
|
error = this.props.error;
|
|
739
735
|
}
|
|
740
|
-
// Dialog pre konkretny form:
|
|
741
|
-
// <DobrovolnikForm id={this.formDialogObjectId} object={this.formDialogInitValuesForInsert} onSaveOrCancel={this.formDialogOnSaveOrCancel}/>
|
|
742
736
|
// formgroup-inline lepi SplitButton na autocomplete a zarovna jeho vysku
|
|
743
737
|
return (react_1.default.createElement.apply(react_1.default, __spreadArray(__spreadArray(["div", { className: "x-auto-complete-base", style: { width: this.props.width, maxWidth: this.props.maxWidth } }, 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, inputRef: this.autoCompleteInputRef, readOnly: readOnly, disabled: readOnly }, XUtils_1.XUtils.createTooltipOrErrorProps(error), { inputClassName: this.props.inputClassName, showEmptyMessage: true }))], __read(buttons), false), [this.props.valueForm != undefined ?
|
|
744
|
-
react_1.default.createElement(
|
|
745
|
-
id: this.formDialogObjectId, initValues: this.formDialogInitValuesForInsert, onSaveOrCancel: this.formDialogOnSaveOrCancel
|
|
746
|
-
} /*, this.props.valueForm.children*/))
|
|
738
|
+
react_1.default.createElement(XFormDialog_1.XFormDialog, { key: "dialog-form", dialogState: this.state.formDialogState, form: this.props.valueForm, onSaveOrCancel: this.formDialogOnSaveOrCancel })
|
|
747
739
|
: undefined, this.props.searchBrowse != undefined && !readOnly ?
|
|
748
740
|
react_1.default.createElement(dialog_1.Dialog, { key: "dialog-browse", 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*/))
|
|
749
741
|
: undefined], false)));
|
|
@@ -753,6 +745,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
753
745
|
lazyLoadMaxRows: 10,
|
|
754
746
|
splitQueryValue: true,
|
|
755
747
|
addRowEnabled: true,
|
|
748
|
+
dropdownButtonEnabled: true,
|
|
756
749
|
minLength: 1,
|
|
757
750
|
buttonsLayout: "buttons",
|
|
758
751
|
scrollHeight: '15rem' // primereact has 200px
|
|
@@ -12,6 +12,7 @@ export interface XAutoCompleteDTProps extends XFormComponentDTProps {
|
|
|
12
12
|
itemTemplate?: (suggestion: any, index: number, createStringValue: boolean, defaultValue: (suggestion: any) => string) => React.ReactNode;
|
|
13
13
|
searchBrowse?: JSX.Element;
|
|
14
14
|
assocForm?: JSX.Element;
|
|
15
|
+
dropdownButtonEnabled?: boolean;
|
|
15
16
|
suggestions?: any[];
|
|
16
17
|
suggestionsLoad?: XSuggestionsLoadProp;
|
|
17
18
|
lazyLoadMaxRows?: number;
|
|
@@ -68,7 +68,7 @@ var XAutoCompleteDT = /** @class */ (function (_super) {
|
|
|
68
68
|
// TODO - size
|
|
69
69
|
//const size = this.props.size ?? xDisplayField.length;
|
|
70
70
|
// div className="col" nam zabezpeci aby XAutoCompleteBase nezaberal celu dlzku grid-u (ma nastaveny width=100% vdaka "formgroup-inline")
|
|
71
|
-
return (react_1.default.createElement(XAutoCompleteBase_1.XAutoCompleteBase, { value: this.getValue(), onChange: this.onChangeAutoCompleteBase, field: this.props.displayField, itemTemplate: this.props.itemTemplate, searchBrowse: this.props.searchBrowse, valueForm: this.props.assocForm, idField: xEntityAssoc.idField, readOnly: this.isReadOnly(), error: this.getError(), onErrorChange: this.onErrorChangeAutoCompleteBase, suggestions: this.props.suggestions, suggestionsLoad: this.props.suggestionsLoad, lazyLoadMaxRows: this.props.lazyLoadMaxRows, splitQueryValue: this.props.splitQueryValue, addRowEnabled: this.props.addRowEnabled, minLength: this.props.minLength, scrollHeight: this.props.scrollHeight, suggestionsQuery: { entity: this.xAssoc.entityName, filter: function () { return _this.getFilterBase(_this.props.filter); }, sortField: this.props.sortField, fields: this.props.fields }, inputClassName: this.props.inputClassName }));
|
|
71
|
+
return (react_1.default.createElement(XAutoCompleteBase_1.XAutoCompleteBase, { value: this.getValue(), onChange: this.onChangeAutoCompleteBase, field: this.props.displayField, itemTemplate: this.props.itemTemplate, searchBrowse: this.props.searchBrowse, valueForm: this.props.assocForm, dropdownButtonEnabled: this.props.dropdownButtonEnabled, idField: xEntityAssoc.idField, readOnly: this.isReadOnly(), error: this.getError(), onErrorChange: this.onErrorChangeAutoCompleteBase, suggestions: this.props.suggestions, suggestionsLoad: this.props.suggestionsLoad, lazyLoadMaxRows: this.props.lazyLoadMaxRows, splitQueryValue: this.props.splitQueryValue, addRowEnabled: this.props.addRowEnabled, minLength: this.props.minLength, scrollHeight: this.props.scrollHeight, suggestionsQuery: { entity: this.xAssoc.entityName, filter: function () { return _this.getFilterBase(_this.props.filter); }, sortField: this.props.sortField, fields: this.props.fields }, inputClassName: this.props.inputClassName }));
|
|
72
72
|
};
|
|
73
73
|
return XAutoCompleteDT;
|
|
74
74
|
}(XFormComponentDT_1.XFormComponentDT));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { XOnSaveOrCancelProp } from "./XFormBase";
|
|
3
|
+
export interface XFormDialogState {
|
|
4
|
+
opened: boolean;
|
|
5
|
+
id?: number;
|
|
6
|
+
initValues?: object;
|
|
7
|
+
}
|
|
8
|
+
export declare const XFormDialog: (props: {
|
|
9
|
+
dialogState: XFormDialogState;
|
|
10
|
+
form: JSX.Element;
|
|
11
|
+
onSaveOrCancel: XOnSaveOrCancelProp;
|
|
12
|
+
}) => React.JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
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.XFormDialog = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var dialog_1 = require("primereact/dialog");
|
|
9
|
+
var XUtils_1 = require("./XUtils");
|
|
10
|
+
var XFormDialog = function (props) {
|
|
11
|
+
var onHide = function () {
|
|
12
|
+
if (props.onSaveOrCancel) {
|
|
13
|
+
props.onSaveOrCancel(null, XUtils_1.OperationType.None);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
return (react_1.default.createElement(dialog_1.Dialog, { key: "dialog-form", className: "x-dialog-without-header", visible: props.dialogState.opened, onHide: onHide }, react_1.default.cloneElement(props.form, {
|
|
17
|
+
id: props.dialogState.id, initValues: props.dialogState.initValues, onSaveOrCancel: props.onSaveOrCancel
|
|
18
|
+
} /*, this.props.valueForm.children*/)));
|
|
19
|
+
};
|
|
20
|
+
exports.XFormDialog = XFormDialog;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { XFormBase } from "./XFormBase";
|
|
3
|
+
import { XtDocTemplate } from "../modules/docTemplates/xt-doc-template";
|
|
3
4
|
export declare const xSaveButtonId: string;
|
|
4
5
|
export declare const XFormFooter: (props: {
|
|
5
6
|
form: XFormBase;
|
|
7
|
+
docTemplates?: true | ((entity: string) => Promise<XtDocTemplate[]>) | undefined;
|
|
8
|
+
bodyRight?: React.ReactNode;
|
|
9
|
+
indentWidth?: string | undefined;
|
|
6
10
|
}) => React.JSX.Element;
|
|
@@ -7,13 +7,32 @@ exports.XFormFooter = exports.xSaveButtonId = void 0;
|
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
8
|
var XButton_1 = require("./XButton");
|
|
9
9
|
var XLocale_1 = require("./XLocale");
|
|
10
|
+
var XDocTemplateButton_1 = require("../modules/docTemplates/XDocTemplateButton");
|
|
11
|
+
var XUtils_1 = require("./XUtils");
|
|
10
12
|
// constant to be used in method formReadOnly to identify save button
|
|
11
13
|
exports.xSaveButtonId = "x-save-button-id";
|
|
12
14
|
// helper wrapper
|
|
13
15
|
var XFormFooter = function (props) {
|
|
14
16
|
var readOnly = props.form.formReadOnlyBase(exports.xSaveButtonId);
|
|
17
|
+
var leftCompensationElem = null;
|
|
18
|
+
var rightNodeList = [];
|
|
19
|
+
// template button is rendered only for update (id !== undefined; row must exist in DB), not for insert
|
|
20
|
+
if (props.docTemplates && !XUtils_1.XUtils.isMobile() && props.form.props.id !== undefined) {
|
|
21
|
+
rightNodeList.push(react_1.default.createElement(XDocTemplateButton_1.XDocTemplateButton, { key: "docTemplates", entity: props.form.getEntity(), rowId: props.form.props.id, docTemplates: typeof props.docTemplates === 'function' ? props.docTemplates : undefined }));
|
|
22
|
+
}
|
|
23
|
+
if (props.bodyRight) {
|
|
24
|
+
rightNodeList.push(props.bodyRight);
|
|
25
|
+
}
|
|
26
|
+
if (props.indentWidth && rightNodeList.length > 0) {
|
|
27
|
+
// used only to create some distance between buttons Cancel and XDocTemplateButton (all content is centered), because Cancel is frequently used
|
|
28
|
+
leftCompensationElem = react_1.default.createElement("div", { style: { width: props.indentWidth } });
|
|
29
|
+
rightNodeList =
|
|
30
|
+
[react_1.default.createElement("div", { className: "flex justify-content-end", style: { width: props.indentWidth } }, rightNodeList)];
|
|
31
|
+
}
|
|
15
32
|
return (react_1.default.createElement("div", { className: "flex justify-content-center" },
|
|
33
|
+
leftCompensationElem,
|
|
16
34
|
react_1.default.createElement(XButton_1.XButton, { icon: "pi pi-save", label: (0, XLocale_1.xLocaleOption)('save'), onClick: props.form.onClickSave, disabled: readOnly }),
|
|
17
|
-
react_1.default.createElement(XButton_1.XButton, { icon: "pi pi-times", label: (0, XLocale_1.xLocaleOption)('cancel'), onClick: props.form.onClickCancel })
|
|
35
|
+
react_1.default.createElement(XButton_1.XButton, { icon: "pi pi-times", label: (0, XLocale_1.xLocaleOption)('cancel'), onClick: props.form.onClickCancel }),
|
|
36
|
+
rightNodeList));
|
|
18
37
|
};
|
|
19
38
|
exports.XFormFooter = XFormFooter;
|
|
@@ -75,6 +75,7 @@ var XButtonIconNarrow_1 = require("./XButtonIconNarrow");
|
|
|
75
75
|
var XUtilsConversions_1 = require("../serverApi/XUtilsConversions");
|
|
76
76
|
var XLocale_1 = require("./XLocale");
|
|
77
77
|
var XUtilsMetadataCommon_1 = require("../serverApi/XUtilsMetadataCommon");
|
|
78
|
+
// notice: in skch there is new version XInputFileList2 and that version don´t use fetch api because fetch api does not support progress bar
|
|
78
79
|
var XInputFileList = /** @class */ (function (_super) {
|
|
79
80
|
__extends(XInputFileList, _super);
|
|
80
81
|
function XInputFileList(props) {
|
|
@@ -168,31 +169,9 @@ var XInputFileList = /** @class */ (function (_super) {
|
|
|
168
169
|
};
|
|
169
170
|
XInputFileList.prototype.onDownloadFile = function (xFile) {
|
|
170
171
|
return __awaiter(this, void 0, void 0, function () {
|
|
171
|
-
var response, e_3, fileName, respBlob, url, a;
|
|
172
172
|
return __generator(this, function (_a) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
_a.trys.push([0, 2, , 3]);
|
|
176
|
-
return [4 /*yield*/, XUtils_1.XUtils.fetchBasicJson('x-download-file', { xFileId: xFile.id })];
|
|
177
|
-
case 1:
|
|
178
|
-
response = _a.sent();
|
|
179
|
-
return [3 /*break*/, 3];
|
|
180
|
-
case 2:
|
|
181
|
-
e_3 = _a.sent();
|
|
182
|
-
XUtils_1.XUtils.showErrorMessage((0, XLocale_1.xLocaleOption)('fileDownloadFailed'), e_3);
|
|
183
|
-
return [2 /*return*/];
|
|
184
|
-
case 3:
|
|
185
|
-
fileName = xFile.name;
|
|
186
|
-
return [4 /*yield*/, response.blob()];
|
|
187
|
-
case 4:
|
|
188
|
-
respBlob = _a.sent();
|
|
189
|
-
url = window.URL.createObjectURL(respBlob);
|
|
190
|
-
a = document.createElement('a');
|
|
191
|
-
a.href = url;
|
|
192
|
-
a.download = fileName;
|
|
193
|
-
a.click();
|
|
194
|
-
return [2 /*return*/];
|
|
195
|
-
}
|
|
173
|
+
XUtils_1.XUtils.downloadFile('x-download-file', { xFileId: xFile.id }, xFile.name);
|
|
174
|
+
return [2 /*return*/];
|
|
196
175
|
});
|
|
197
176
|
});
|
|
198
177
|
};
|
|
@@ -207,7 +186,7 @@ var XInputFileList = /** @class */ (function (_super) {
|
|
|
207
186
|
});
|
|
208
187
|
};
|
|
209
188
|
XInputFileList.prototype.render = function () {
|
|
210
|
-
var
|
|
189
|
+
var e_3, _a;
|
|
211
190
|
var _this = this;
|
|
212
191
|
var _b, _c, _d;
|
|
213
192
|
var label = (_b = this.props.label) !== null && _b !== void 0 ? _b : this.props.assocField;
|
|
@@ -230,12 +209,12 @@ var XInputFileList = /** @class */ (function (_super) {
|
|
|
230
209
|
_loop_1(fileItem);
|
|
231
210
|
}
|
|
232
211
|
}
|
|
233
|
-
catch (
|
|
212
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
234
213
|
finally {
|
|
235
214
|
try {
|
|
236
215
|
if (fileItemList_1_1 && !fileItemList_1_1.done && (_a = fileItemList_1.return)) _a.call(fileItemList_1);
|
|
237
216
|
}
|
|
238
|
-
finally { if (
|
|
217
|
+
finally { if (e_3) throw e_3.error; }
|
|
239
218
|
}
|
|
240
219
|
// vrchny div uklada child elementy pod seba (standardny display:block), zarovnane su dolava
|
|
241
220
|
return (react_1.default.createElement("div", null,
|
|
@@ -104,68 +104,46 @@ var XExportRowsDialog = function (props) {
|
|
|
104
104
|
setCsvEncoding(ExportImportParam_1.CsvEncoding.Win1250);
|
|
105
105
|
};
|
|
106
106
|
var onExport = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
107
|
-
var exportParams, apiPath, requestPayload, exportExcelParam, exportCsvParam, exportJsonParam,
|
|
107
|
+
var exportParams, apiPath, requestPayload, exportExcelParam, exportCsvParam, exportJsonParam, fileExt, fileName;
|
|
108
108
|
return __generator(this, function (_a) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
csvParam: {
|
|
130
|
-
csvSeparator: csvSeparator, csvDecimalFormat: decimalFormat, csvEncoding: csvEncoding
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
requestPayload = exportCsvParam;
|
|
134
|
-
}
|
|
135
|
-
else if (exportType === ExportImportParam_1.ExportType.Json) {
|
|
136
|
-
apiPath = "x-lazy-data-table-export-json";
|
|
137
|
-
exportJsonParam = {
|
|
138
|
-
queryParam: exportParams.queryParam
|
|
139
|
-
};
|
|
140
|
-
requestPayload = exportJsonParam;
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
throw "Unimplemented exportType = ".concat(exportType);
|
|
109
|
+
// export vykoname az po zatvoreni dialogu - moze dlho trvat a pobezi asynchronne (user zatial moze pracovat s aplikaciou)
|
|
110
|
+
// zavrieme dialog
|
|
111
|
+
props.hideDialog();
|
|
112
|
+
exportParams = props.dialogState.exportParams;
|
|
113
|
+
if (exportType === ExportImportParam_1.ExportType.Excel) {
|
|
114
|
+
apiPath = "x-lazy-data-table-export-excel";
|
|
115
|
+
exportExcelParam = {
|
|
116
|
+
queryParam: exportParams.queryParam,
|
|
117
|
+
excelCsvParam: createExcelCsvParam(exportParams),
|
|
118
|
+
widths: exportParams.widths
|
|
119
|
+
};
|
|
120
|
+
requestPayload = exportExcelParam;
|
|
121
|
+
}
|
|
122
|
+
else if (exportType === ExportImportParam_1.ExportType.Csv) {
|
|
123
|
+
apiPath = "x-lazy-data-table-export-csv";
|
|
124
|
+
exportCsvParam = {
|
|
125
|
+
queryParam: exportParams.queryParam,
|
|
126
|
+
excelCsvParam: createExcelCsvParam(exportParams),
|
|
127
|
+
csvParam: {
|
|
128
|
+
csvSeparator: csvSeparator, csvDecimalFormat: decimalFormat, csvEncoding: csvEncoding
|
|
144
129
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
fileExt = exportType === ExportImportParam_1.ExportType.Excel ? "xlsx" : exportType;
|
|
158
|
-
fileName = "".concat(exportParams.fileName, ".").concat(fileExt);
|
|
159
|
-
return [4 /*yield*/, response.blob()];
|
|
160
|
-
case 5:
|
|
161
|
-
respBlob = _a.sent();
|
|
162
|
-
url = window.URL.createObjectURL(respBlob);
|
|
163
|
-
a = document.createElement('a');
|
|
164
|
-
a.href = url;
|
|
165
|
-
a.download = fileName;
|
|
166
|
-
a.click();
|
|
167
|
-
return [2 /*return*/];
|
|
130
|
+
};
|
|
131
|
+
requestPayload = exportCsvParam;
|
|
132
|
+
}
|
|
133
|
+
else if (exportType === ExportImportParam_1.ExportType.Json) {
|
|
134
|
+
apiPath = "x-lazy-data-table-export-json";
|
|
135
|
+
exportJsonParam = {
|
|
136
|
+
queryParam: exportParams.queryParam
|
|
137
|
+
};
|
|
138
|
+
requestPayload = exportJsonParam;
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
throw "Unimplemented exportType = ".concat(exportType);
|
|
168
142
|
}
|
|
143
|
+
fileExt = exportType === ExportImportParam_1.ExportType.Excel ? "xlsx" : exportType;
|
|
144
|
+
fileName = "".concat(exportParams.fileName, ".").concat(fileExt);
|
|
145
|
+
XUtils_1.XUtils.downloadFile(apiPath, requestPayload, fileName);
|
|
146
|
+
return [2 /*return*/];
|
|
169
147
|
});
|
|
170
148
|
}); };
|
|
171
149
|
var createExcelCsvParam = function (exportParams) {
|