@michalrakus/x-react-web-lib 1.35.2 → 1.36.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/gulpfile.js +2 -0
- package/lib/administration/XBrowseMetaForm.js +1 -2
- package/lib/administration/XParamForm.js +1 -2
- package/lib/administration/XUserForm.js +1 -2
- package/lib/components/XAutoCompleteBase.js +1 -2
- package/lib/components/XEditor.js +1 -2
- package/lib/components/XEnvVars.js +2 -2
- package/lib/components/XFieldSet/XFieldSetBase.js +3 -3
- package/lib/components/XFormBase.d.ts +1 -0
- package/lib/components/XFormBase.js +2 -1
- package/lib/components/XFormDataTable2.js +1 -2
- package/lib/components/XFormDialog.js +1 -1
- package/lib/components/XInputFileList.js +1 -2
- package/lib/components/XInputTextarea.js +1 -2
- package/lib/components/XLazyDataTable/XLazyDataTable.d.ts +2 -1
- package/lib/components/XLazyDataTable/XLazyDataTable.js +30 -30
- package/lib/components/XMultiSelectBase.js +1 -2
- package/lib/components/XUtils.d.ts +5 -4
- package/lib/components/XUtils.js +35 -14
- package/lib/components/XUtilsMetadata.js +1 -2
- package/lib/components/useXStateLocal.d.ts +2 -0
- package/lib/components/useXStateLocal.js +9 -0
- package/lib/components/useXStateSession.js +2 -3
- package/lib/components/useXStateStorage.d.ts +3 -0
- package/lib/components/useXStateStorage.js +10 -0
- package/lib/components/useXStateStorageBase.d.ts +3 -0
- package/lib/components/{useXStateSessionBase.js → useXStateStorageBase.js} +5 -5
- package/lib/serverApi/ExportImportParam.js +6 -6
- package/lib/serverApi/FindParam.js +3 -3
- package/lib/serverApi/XUtilsCommon.d.ts +0 -1
- package/lib/serverApi/XUtilsCommon.js +15 -16
- package/lib/serverApi/XUtilsConversions.d.ts +2 -0
- package/lib/serverApi/XUtilsConversions.js +41 -17
- package/package.json +16 -15
- package/useXStateLocal.d.ts +3 -0
- package/useXStateLocal.js +5 -0
- package/useXStateStorage.d.ts +3 -0
- package/useXStateStorage.js +5 -0
- package/lib/components/useXStateSessionBase.d.ts +0 -2
package/gulpfile.js
CHANGED
|
@@ -30,7 +30,9 @@ function generateApi(cb) {
|
|
|
30
30
|
"./lib/components/XLazyDataTable/XLazyDataTable",
|
|
31
31
|
"./lib/components/XLazyDataTable/XMultilineRenderer",
|
|
32
32
|
|
|
33
|
+
"./lib/components/useXStateLocal",
|
|
33
34
|
"./lib/components/useXStateSession",
|
|
35
|
+
"./lib/components/useXStateStorage",
|
|
34
36
|
"./lib/components/useXToken",
|
|
35
37
|
"./lib/components/XAutoComplete",
|
|
36
38
|
"./lib/components/XAutoCompleteBase",
|
|
@@ -31,7 +31,7 @@ var XInputText_1 = require("../components/XInputText");
|
|
|
31
31
|
var react_1 = __importDefault(require("react"));
|
|
32
32
|
var XFormDataTable2_1 = require("../components/XFormDataTable2");
|
|
33
33
|
var XFormFooter_1 = require("../components/XFormFooter");
|
|
34
|
-
var XBrowseMetaForm = /** @class */ (function (_super) {
|
|
34
|
+
var XBrowseMetaForm = exports.XBrowseMetaForm = /** @class */ (function (_super) {
|
|
35
35
|
__extends(XBrowseMetaForm, _super);
|
|
36
36
|
function XBrowseMetaForm() {
|
|
37
37
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
@@ -60,4 +60,3 @@ var XBrowseMetaForm = /** @class */ (function (_super) {
|
|
|
60
60
|
], XBrowseMetaForm);
|
|
61
61
|
return XBrowseMetaForm;
|
|
62
62
|
}(XFormBase_1.XFormBase));
|
|
63
|
-
exports.XBrowseMetaForm = XBrowseMetaForm;
|
|
@@ -33,7 +33,7 @@ var XInputDate_1 = require("../components/XInputDate");
|
|
|
33
33
|
var XInputText_1 = require("../components/XInputText");
|
|
34
34
|
var XFormFooter_1 = require("../components/XFormFooter");
|
|
35
35
|
var XFormHeader_1 = require("../components/XFormHeader");
|
|
36
|
-
var XParamForm = /** @class */ (function (_super) {
|
|
36
|
+
var XParamForm = exports.XParamForm = /** @class */ (function (_super) {
|
|
37
37
|
__extends(XParamForm, _super);
|
|
38
38
|
function XParamForm() {
|
|
39
39
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
@@ -59,4 +59,3 @@ var XParamForm = /** @class */ (function (_super) {
|
|
|
59
59
|
], XParamForm);
|
|
60
60
|
return XParamForm;
|
|
61
61
|
}(XFormBaseModif_1.XFormBaseModif));
|
|
62
|
-
exports.XParamForm = XParamForm;
|
|
@@ -76,7 +76,7 @@ var XEnvVars_1 = require("../components/XEnvVars");
|
|
|
76
76
|
var XFormBaseModif_1 = require("../components/XFormBaseModif");
|
|
77
77
|
var XInputDate_1 = require("../components/XInputDate");
|
|
78
78
|
var XFormHeader_1 = require("../components/XFormHeader");
|
|
79
|
-
var XUserForm = /** @class */ (function (_super) {
|
|
79
|
+
var XUserForm = exports.XUserForm = /** @class */ (function (_super) {
|
|
80
80
|
__extends(XUserForm, _super);
|
|
81
81
|
function XUserForm(props) {
|
|
82
82
|
var _this = _super.call(this, props) || this;
|
|
@@ -188,4 +188,3 @@ var XUserForm = /** @class */ (function (_super) {
|
|
|
188
188
|
], XUserForm);
|
|
189
189
|
return XUserForm;
|
|
190
190
|
}(XFormBaseModif_1.XFormBaseModif));
|
|
191
|
-
exports.XUserForm = XUserForm;
|
|
@@ -131,7 +131,7 @@ var button_1 = require("primereact/button");
|
|
|
131
131
|
var XUtilsCommon_1 = require("../serverApi/XUtilsCommon");
|
|
132
132
|
var XUtilsMetadataCommon_1 = require("../serverApi/XUtilsMetadataCommon");
|
|
133
133
|
var XFormDialog_1 = require("./XFormDialog");
|
|
134
|
-
var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
134
|
+
var XAutoCompleteBase = exports.XAutoCompleteBase = /** @class */ (function (_super) {
|
|
135
135
|
__extends(XAutoCompleteBase, _super);
|
|
136
136
|
function XAutoCompleteBase(props) {
|
|
137
137
|
var _this = _super.call(this, props) || this;
|
|
@@ -762,4 +762,3 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
762
762
|
};
|
|
763
763
|
return XAutoCompleteBase;
|
|
764
764
|
}(react_1.Component));
|
|
765
|
-
exports.XAutoCompleteBase = XAutoCompleteBase;
|
|
@@ -23,7 +23,7 @@ var react_1 = __importDefault(require("react"));
|
|
|
23
23
|
var XInput_1 = require("./XInput");
|
|
24
24
|
var XUtils_1 = require("./XUtils");
|
|
25
25
|
var XEditorBase_1 = require("./XEditorBase");
|
|
26
|
-
var XEditor = /** @class */ (function (_super) {
|
|
26
|
+
var XEditor = exports.XEditor = /** @class */ (function (_super) {
|
|
27
27
|
__extends(XEditor, _super);
|
|
28
28
|
function XEditor(props) {
|
|
29
29
|
var _this = _super.call(this, props) || this;
|
|
@@ -61,4 +61,3 @@ var XEditor = /** @class */ (function (_super) {
|
|
|
61
61
|
};
|
|
62
62
|
return XEditor;
|
|
63
63
|
}(XInput_1.XInput));
|
|
64
|
-
exports.XEditor = XEditor;
|
|
@@ -14,7 +14,7 @@ var XEnvVar;
|
|
|
14
14
|
XEnvVar["REACT_APP_MS_ENTRA_ID_TENANT_ID"] = "REACT_APP_MS_ENTRA_ID_TENANT_ID";
|
|
15
15
|
XEnvVar["REACT_APP_MS_ENTRA_ID_CLIENT_ID"] = "REACT_APP_MS_ENTRA_ID_CLIENT_ID";
|
|
16
16
|
XEnvVar["REACT_APP_MS_ENTRA_ID_BACKEND_SCOPE"] = "REACT_APP_MS_ENTRA_ID_BACKEND_SCOPE";
|
|
17
|
-
})(XEnvVar
|
|
17
|
+
})(XEnvVar || (exports.XEnvVar = XEnvVar = {}));
|
|
18
18
|
// enum for values of the environment variable REACT_APP_AUTH
|
|
19
19
|
var XReactAppAuth;
|
|
20
20
|
(function (XReactAppAuth) {
|
|
@@ -22,4 +22,4 @@ var XReactAppAuth;
|
|
|
22
22
|
XReactAppAuth["LOCAL"] = "LOCAL";
|
|
23
23
|
XReactAppAuth["AUTH0"] = "AUTH0";
|
|
24
24
|
XReactAppAuth["MS_ENTRA_ID"] = "MS_ENTRA_ID";
|
|
25
|
-
})(XReactAppAuth
|
|
25
|
+
})(XReactAppAuth || (exports.XReactAppAuth = XReactAppAuth = {}));
|
|
@@ -38,7 +38,7 @@ var XFieldType;
|
|
|
38
38
|
XFieldType["checkboxNullable"] = "checkboxNullable";
|
|
39
39
|
XFieldType["inputText"] = "inputText";
|
|
40
40
|
XFieldType["inputDecimal"] = "inputDecimal";
|
|
41
|
-
})(XFieldType
|
|
41
|
+
})(XFieldType || (exports.XFieldType = XFieldType = {}));
|
|
42
42
|
// children layout sa da nastavit len na type, ktory ma children - rootField, fieldGroup
|
|
43
43
|
var XChildrenLayout;
|
|
44
44
|
(function (XChildrenLayout) {
|
|
@@ -46,7 +46,7 @@ var XChildrenLayout;
|
|
|
46
46
|
XChildrenLayout["row"] = "row";
|
|
47
47
|
XChildrenLayout["tabView"] = "tabView";
|
|
48
48
|
XChildrenLayout["tabViewWithHeaderGroup"] = "tabViewWithHeaderGroup"; // to iste co tabView ale prvy fieldGroup (0-ty tab) zobrazi nad tabView (aby bol vzdy pristupny)
|
|
49
|
-
})(XChildrenLayout
|
|
49
|
+
})(XChildrenLayout || (exports.XChildrenLayout = XChildrenLayout = {}));
|
|
50
50
|
// poznamka - tabView a tabViewWithHeaderGroup odignoruju bezne simple children - ak take budu existovat, zobrazi sa uzivatelovi warning pri nastaveni tabView
|
|
51
51
|
// pouzijeme len checkbox supressFieldGroupPanel
|
|
52
52
|
// pouziva sa len pre typ fieldGroup a len v pripade ak dany fieldGroup nie je vyrenderovany v nejakej tab-ke (jeho parent ma nastaveny layout tabView*)
|
|
@@ -58,7 +58,7 @@ var XFieldPropValuesFrom;
|
|
|
58
58
|
(function (XFieldPropValuesFrom) {
|
|
59
59
|
XFieldPropValuesFrom["parent"] = "parent";
|
|
60
60
|
XFieldPropValuesFrom["this"] = "this"; // field prop values preberame z current fieldu
|
|
61
|
-
})(XFieldPropValuesFrom
|
|
61
|
+
})(XFieldPropValuesFrom || (exports.XFieldPropValuesFrom = XFieldPropValuesFrom = {}));
|
|
62
62
|
// zatial provizorne len na staticke metody
|
|
63
63
|
var XFieldSetBase = /** @class */ (function () {
|
|
64
64
|
function XFieldSetBase() {
|
|
@@ -10,6 +10,7 @@ export interface XFormProps {
|
|
|
10
10
|
id?: number;
|
|
11
11
|
initValues?: object;
|
|
12
12
|
onSaveOrCancel?: XOnSaveOrCancelProp;
|
|
13
|
+
isInDialog?: boolean;
|
|
13
14
|
}
|
|
14
15
|
export declare function Form(entity: string): <T extends new (...args: any[]) => {}>(constructor: T) => {
|
|
15
16
|
new (...args: any[]): {
|
|
@@ -235,7 +235,8 @@ var XFormBase = /** @class */ (function (_super) {
|
|
|
235
235
|
};
|
|
236
236
|
// helper method
|
|
237
237
|
XFormBase.prototype.isInDialog = function () {
|
|
238
|
-
|
|
238
|
+
var _a;
|
|
239
|
+
return (_a = this.props.isInDialog) !== null && _a !== void 0 ? _a : false;
|
|
239
240
|
};
|
|
240
241
|
// helper method
|
|
241
242
|
XFormBase.prototype.isTabViewUsed = function () {
|
|
@@ -84,7 +84,7 @@ var XLocale_1 = require("./XLocale");
|
|
|
84
84
|
var XInputIntervalDT_1 = require("./XInputIntervalDT");
|
|
85
85
|
var XUtilsMetadataCommon_1 = require("../serverApi/XUtilsMetadataCommon");
|
|
86
86
|
var XInputTextareaDT_1 = require("./XInputTextareaDT");
|
|
87
|
-
var XFormDataTable2 = /** @class */ (function (_super) {
|
|
87
|
+
var XFormDataTable2 = exports.XFormDataTable2 = /** @class */ (function (_super) {
|
|
88
88
|
__extends(XFormDataTable2, _super);
|
|
89
89
|
function XFormDataTable2(props) {
|
|
90
90
|
var e_1, _a;
|
|
@@ -728,7 +728,6 @@ var XFormDataTable2 = /** @class */ (function (_super) {
|
|
|
728
728
|
};
|
|
729
729
|
return XFormDataTable2;
|
|
730
730
|
}(react_1.Component));
|
|
731
|
-
exports.XFormDataTable2 = XFormDataTable2;
|
|
732
731
|
// default props for XFormColumnBaseProps
|
|
733
732
|
var XFormColumnBase_defaultProps = {
|
|
734
733
|
columnViewStatus: true
|
|
@@ -16,7 +16,7 @@ var XFormDialog = function (props) {
|
|
|
16
16
|
};
|
|
17
17
|
var form = (_a = props.dialogState.form) !== null && _a !== void 0 ? _a : props.form;
|
|
18
18
|
return (react_1.default.createElement(dialog_1.Dialog, { key: "dialog-form", className: "x-dialog-without-header", visible: props.dialogState.opened, onHide: onHide }, form ? react_1.default.cloneElement(form, {
|
|
19
|
-
id: props.dialogState.id, initValues: props.dialogState.initValues, onSaveOrCancel: props.dialogState.onSaveOrCancel
|
|
19
|
+
id: props.dialogState.id, initValues: props.dialogState.initValues, onSaveOrCancel: props.dialogState.onSaveOrCancel, isInDialog: true
|
|
20
20
|
} /*, props.form.children*/) : null));
|
|
21
21
|
};
|
|
22
22
|
exports.XFormDialog = XFormDialog;
|
|
@@ -76,7 +76,7 @@ var XUtilsConversions_1 = require("../serverApi/XUtilsConversions");
|
|
|
76
76
|
var XLocale_1 = require("./XLocale");
|
|
77
77
|
var XUtilsMetadataCommon_1 = require("../serverApi/XUtilsMetadataCommon");
|
|
78
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
|
|
79
|
-
var XInputFileList = /** @class */ (function (_super) {
|
|
79
|
+
var XInputFileList = exports.XInputFileList = /** @class */ (function (_super) {
|
|
80
80
|
__extends(XInputFileList, _super);
|
|
81
81
|
function XInputFileList(props) {
|
|
82
82
|
var _this = _super.call(this, props) || this;
|
|
@@ -227,4 +227,3 @@ var XInputFileList = /** @class */ (function (_super) {
|
|
|
227
227
|
};
|
|
228
228
|
return XInputFileList;
|
|
229
229
|
}(react_2.Component));
|
|
230
|
-
exports.XInputFileList = XInputFileList;
|
|
@@ -24,7 +24,7 @@ var XInput_1 = require("./XInput");
|
|
|
24
24
|
var XUtils_1 = require("./XUtils");
|
|
25
25
|
var XInputTextareaBase_1 = require("./XInputTextareaBase");
|
|
26
26
|
var tooltip_1 = require("primereact/tooltip");
|
|
27
|
-
var XInputTextarea = /** @class */ (function (_super) {
|
|
27
|
+
var XInputTextarea = exports.XInputTextarea = /** @class */ (function (_super) {
|
|
28
28
|
__extends(XInputTextarea, _super);
|
|
29
29
|
function XInputTextarea(props) {
|
|
30
30
|
var _this = _super.call(this, props) || this;
|
|
@@ -107,4 +107,3 @@ var XInputTextarea = /** @class */ (function (_super) {
|
|
|
107
107
|
};
|
|
108
108
|
return XInputTextarea;
|
|
109
109
|
}(XInput_1.XInput));
|
|
110
|
-
exports.XInputTextarea = XInputTextarea;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ReactChild } from 'react';
|
|
2
2
|
import { DataTableFilterMeta, DataTableFilterMetaData, DataTableOperatorFilterMetaData, DataTableRowExpansionTemplate, DataTableSortMeta } from 'primereact/datatable';
|
|
3
3
|
import { ColumnBodyOptions, ColumnFilterElementTemplateOptions } from 'primereact/column';
|
|
4
|
-
import { XViewStatusOrBoolean } from "../XUtils";
|
|
4
|
+
import { XStorageType, XViewStatusOrBoolean } from "../XUtils";
|
|
5
5
|
import { XSearchBrowseParams } from "../XSearchBrowseParams";
|
|
6
6
|
import { XAggregateFunction, XCustomFilter } from "../../serverApi/FindParam";
|
|
7
7
|
import { XOnSaveOrCancelProp } from "../XFormBase";
|
|
@@ -58,6 +58,7 @@ export interface XLazyDataTableRef {
|
|
|
58
58
|
}
|
|
59
59
|
export interface XLazyDataTableProps {
|
|
60
60
|
entity: string;
|
|
61
|
+
stateStorage?: XStorageType;
|
|
61
62
|
stateKey?: string;
|
|
62
63
|
label?: string;
|
|
63
64
|
labelStyle?: React.CSSProperties;
|
|
@@ -145,8 +145,8 @@ var XOcfDropdown_1 = require("./XOcfDropdown");
|
|
|
145
145
|
var XFieldSetBase_1 = require("../XFieldSet/XFieldSetBase");
|
|
146
146
|
var XAutoCompleteBase_1 = require("../XAutoCompleteBase");
|
|
147
147
|
var XInputTextBase_1 = require("../XInputTextBase");
|
|
148
|
-
var
|
|
149
|
-
var
|
|
148
|
+
var useXStateStorage_1 = require("../useXStateStorage");
|
|
149
|
+
var useXStateStorageBase_1 = require("../useXStateStorageBase");
|
|
150
150
|
var _ = __importStar(require("lodash"));
|
|
151
151
|
var XDocTemplateButton_1 = require("../../modules/docTemplates/XDocTemplateButton");
|
|
152
152
|
var XFormDialog_1 = require("../XFormDialog");
|
|
@@ -159,15 +159,15 @@ var XStateKeySuffix;
|
|
|
159
159
|
XStateKeySuffix["pagingFirst"] = "paging-first";
|
|
160
160
|
XStateKeySuffix["selectedRow"] = "selected-row";
|
|
161
161
|
XStateKeySuffix["multilineSwitchValue"] = "multiline-switch-value";
|
|
162
|
-
})(XStateKeySuffix
|
|
162
|
+
})(XStateKeySuffix || (exports.XStateKeySuffix = XStateKeySuffix = {}));
|
|
163
163
|
exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
164
164
|
var _b;
|
|
165
|
-
var _c = _a.
|
|
166
|
-
|
|
167
|
-
scrollHeight =
|
|
168
|
-
|
|
169
|
-
shrinkWidth =
|
|
170
|
-
var props = __assign({ paginator: paginator, rows: rows, filterDisplay: filterDisplay, autoFilter: autoFilter, showFilterButtons: showFilterButtons, fullTextSearch: fullTextSearch, multilineSwitch: multilineSwitch, multilineSwitchInitValue: multilineSwitchInitValue, multilineSwitchFewLinesCount: multilineSwitchFewLinesCount, scrollable: scrollable, scrollWidth: scrollWidth, scrollHeight: scrollHeight, shrinkWidth: shrinkWidth }, propsRest);
|
|
165
|
+
var _c = _a.stateStorage, stateStorage = _c === void 0 ? "session" : _c, _d = _a.paginator, paginator = _d === void 0 ? true : _d, _e = _a.rows, rows = _e === void 0 ? 30 : _e, _f = _a.filterDisplay, filterDisplay = _f === void 0 ? "row" : _f, _g = _a.autoFilter, autoFilter = _g === void 0 ? false : _g, _h = _a.showFilterButtons, showFilterButtons = _h === void 0 ? true : _h, _j = _a.fullTextSearch, fullTextSearch = _j === void 0 ? true : _j, _k = _a.multilineSwitch, multilineSwitch = _k === void 0 ? false : _k, _l = _a.multilineSwitchInitValue, multilineSwitchInitValue = _l === void 0 ? "allLines" : _l, _m = _a.multilineSwitchFewLinesCount, multilineSwitchFewLinesCount = _m === void 0 ? 2 : _m, _o = _a.scrollable, scrollable = _o === void 0 ? true : _o, _p = _a.scrollWidth, scrollWidth = _p === void 0 ? 'viewport' : _p, // nastavi sirku tabulky na (100vw - nieco) (ak bude obsah sirsi, zapne horizontalny scrollbar)
|
|
166
|
+
_q = _a.scrollHeight, // nastavi sirku tabulky na (100vw - nieco) (ak bude obsah sirsi, zapne horizontalny scrollbar)
|
|
167
|
+
scrollHeight = _q === void 0 ? 'viewport' : _q, // nastavi vysku tabulky na (100vh - nieco) (ak bude obsah vecsi, zapne vertikalny scrollbar)
|
|
168
|
+
_r = _a.shrinkWidth, // nastavi vysku tabulky na (100vh - nieco) (ak bude obsah vecsi, zapne vertikalny scrollbar)
|
|
169
|
+
shrinkWidth = _r === void 0 ? true : _r, propsRest = __rest(_a, ["stateStorage", "paginator", "rows", "filterDisplay", "autoFilter", "showFilterButtons", "fullTextSearch", "multilineSwitch", "multilineSwitchInitValue", "multilineSwitchFewLinesCount", "scrollable", "scrollWidth", "scrollHeight", "shrinkWidth"]);
|
|
170
|
+
var props = __assign({ stateStorage: stateStorage, paginator: paginator, rows: rows, filterDisplay: filterDisplay, autoFilter: autoFilter, showFilterButtons: showFilterButtons, fullTextSearch: fullTextSearch, multilineSwitch: multilineSwitch, multilineSwitchInitValue: multilineSwitchInitValue, multilineSwitchFewLinesCount: multilineSwitchFewLinesCount, scrollable: scrollable, scrollWidth: scrollWidth, scrollHeight: scrollHeight, shrinkWidth: shrinkWidth }, propsRest);
|
|
171
171
|
// must be here, is used in createFiltersInit()
|
|
172
172
|
var xEntity = XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXEntity(props.entity);
|
|
173
173
|
var createAggregateItems = function () {
|
|
@@ -320,7 +320,7 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
320
320
|
return "x-ldt-state-".concat((_a = props.stateKey) !== null && _a !== void 0 ? _a : props.entity, "-").concat(stateKeySuffix);
|
|
321
321
|
};
|
|
322
322
|
var removePagingFromStorage = function () {
|
|
323
|
-
XUtils_1.XUtils.removeValueFromStorage(getStateKey(XStateKeySuffix.pagingFirst));
|
|
323
|
+
XUtils_1.XUtils.removeValueFromStorage(props.stateStorage, getStateKey(XStateKeySuffix.pagingFirst));
|
|
324
324
|
};
|
|
325
325
|
// premenne platne pre cely component (obdoba member premennych v class-e)
|
|
326
326
|
var primeReactContext = react_1.default.useContext(api_1.PrimeReactContext); // probably does not work and deprecated PrimeReact.filterMatchModeOptions is used
|
|
@@ -338,15 +338,15 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
338
338
|
// ak mame fieldSet stlpce (stlpce ktore maju zadany fieldSetId a zobrazuju hodnoty podla fieldSet-u),
|
|
339
339
|
// tak sem nacitame mapy umoznujuce ziskanie labelov zakliknutych field-ov
|
|
340
340
|
// poznamka: uz by sa zislo mat vytvorene objekty (instancie) pre stlpce a do nich zapisovat pripadny XFieldSetMap, filter (teraz je vo "filters")
|
|
341
|
-
var
|
|
342
|
-
var
|
|
343
|
-
var
|
|
344
|
-
var
|
|
345
|
-
var
|
|
346
|
-
var
|
|
341
|
+
var _s = __read((0, react_1.useState)({}), 2), xFieldSetMaps = _s[0], setXFieldSetMaps = _s[1];
|
|
342
|
+
var _t = __read((0, react_1.useState)({ rowList: [], totalRecords: 0, aggregateValues: [] }), 2), value = _t[0], setValue = _t[1];
|
|
343
|
+
var _u = __read((0, react_1.useState)(undefined), 2), expandedRows = _u[0], setExpandedRows = _u[1];
|
|
344
|
+
var _v = __read((0, react_1.useState)(false), 2), loading = _v[0], setLoading = _v[1];
|
|
345
|
+
var _w = __read((0, useXStateStorage_1.useXStateStorage)(props.stateStorage, getStateKey(XStateKeySuffix.pagingFirst), 0), 2), first = _w[0], setFirst = _w[1];
|
|
346
|
+
var _x = __read((0, react_1.useState)(props.paginator ? props.rows : undefined), 2), rowsLocal = _x[0], setRowsLocal = _x[1];
|
|
347
347
|
// "filters" have special initialState function different from that used in useXStateSession
|
|
348
348
|
var filtersInitialStateFunction = function () {
|
|
349
|
-
var filtersInit = XUtils_1.XUtils.getValueFromStorage(getStateKey(XStateKeySuffix.filters), null);
|
|
349
|
+
var filtersInit = XUtils_1.XUtils.getValueFromStorage(props.stateStorage, getStateKey(XStateKeySuffix.filters), null);
|
|
350
350
|
if (filtersInit != null) {
|
|
351
351
|
// we have filters from session - if we have props.filters, we always override the values from session (values from props.filters have higher priority)
|
|
352
352
|
filtersInit = overrideFilters(filtersInit, props.filters);
|
|
@@ -357,23 +357,23 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
357
357
|
}
|
|
358
358
|
return filtersInit;
|
|
359
359
|
};
|
|
360
|
-
var
|
|
360
|
+
var _y = __read((0, useXStateStorageBase_1.useXStateStorageBase)(props.stateStorage, getStateKey(XStateKeySuffix.filters), filtersInitialStateFunction), 2), filters = _y[0], setFilters = _y[1]; // filtrovanie na "controlled manner" (moze sa sem nainicializovat nejaka hodnota)
|
|
361
361
|
var initFtsInputValue = props.fullTextSearch ? createInitFtsInputValue() : undefined;
|
|
362
|
-
var
|
|
363
|
-
var
|
|
364
|
-
var
|
|
365
|
-
var
|
|
366
|
-
var
|
|
362
|
+
var _z = __read((0, useXStateStorage_1.useXStateStorage)(props.stateStorage, getStateKey(XStateKeySuffix.ftsInputValue), initFtsInputValue), 2), ftsInputValue = _z[0], setFtsInputValue = _z[1];
|
|
363
|
+
var _0 = __read((0, useXStateStorage_1.useXStateStorage)(props.stateStorage, getStateKey(XStateKeySuffix.optionalCustomFilter), undefined), 2), optionalCustomFilter = _0[0], setOptionalCustomFilter = _0[1];
|
|
364
|
+
var _1 = __read((_b = props.multilineSwitchValue) !== null && _b !== void 0 ? _b : (0, useXStateStorage_1.useXStateStorage)(props.stateStorage, getStateKey(XStateKeySuffix.multilineSwitchValue), props.multilineSwitchInitValue), 2), multilineSwitchValue = _1[0], setMultilineSwitchValue = _1[1];
|
|
365
|
+
var _2 = __read((0, useXStateStorage_1.useXStateStorage)(props.stateStorage, getStateKey(XStateKeySuffix.multiSortMeta), XUtilsCommon_1.XUtilsCommon.createMultiSortMeta(props.sortField)), 2), multiSortMeta = _2[0], setMultiSortMeta = _2[1];
|
|
366
|
+
var _3 = __read((0, useXStateStorage_1.useXStateStorage)(props.stateStorage, getStateKey(XStateKeySuffix.selectedRow), null), 2), selectedRow = _3[0], setSelectedRow = _3[1];
|
|
367
367
|
/**
|
|
368
368
|
* @deprecated was used to reread data after save/cancel of the form when using XFormNavigator (deprecated)
|
|
369
369
|
*/
|
|
370
|
-
var
|
|
371
|
-
var
|
|
370
|
+
var _4 = __read((0, react_1.useState)(false), 2), dataLoaded = _4[0], setDataLoaded = _4[1]; // priznak kde si zapiseme, ci uz sme nacitali data
|
|
371
|
+
var _5 = __read((0, react_1.useState)({ dialogOpened: false }), 2), exportRowsDialogState = _5[0], setExportRowsDialogState = _5[1];
|
|
372
372
|
//const [exportRowsDialogRowCount, setExportRowsDialogRowCount] = useState<number>(); // param pre dialog
|
|
373
|
-
var
|
|
374
|
-
var
|
|
375
|
-
var
|
|
376
|
-
var
|
|
373
|
+
var _6 = __read((0, react_1.useState)(filters), 2), filtersAfterFiltering = _6[0], setFiltersAfterFiltering = _6[1]; // sem si odkladame stav filtra po kliknuti na button Filter (chceme exportovat presne to co vidno vyfiltrovane)
|
|
374
|
+
var _7 = __read((0, react_1.useState)(ftsInputValue), 2), ftsInputValueAfterFiltering = _7[0], setFtsInputValueAfterFiltering = _7[1]; // tak isto ako filtersAfterFiltering
|
|
375
|
+
var _8 = __read((0, react_1.useState)(optionalCustomFilter), 2), optionalCustomFilterAfterFiltering = _8[0], setOptionalCustomFilterAfterFiltering = _8[1]; // tak isto ako filtersAfterFiltering
|
|
376
|
+
var _9 = __read((0, react_1.useState)({ opened: false }), 2), formDialogState = _9[0], setFormDialogState = _9[1];
|
|
377
377
|
// parameter [] zabezpeci ze sa metoda zavola len po prvom renderingu (a nie po kazdej zmene stavu (zavolani setNieco()))
|
|
378
378
|
(0, react_1.useEffect)(function () {
|
|
379
379
|
// jednoduchy sposob - nepouzivame parameter props.displayed a priznak dataLoaded
|
|
@@ -1470,7 +1470,7 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
1470
1470
|
exportRows ? react_1.default.createElement(XButton_1.XButton, { key: "exportRows", icon: "pi pi-file-export", label: (0, XLocale_1.xLocaleOption)('exportRows'), onClick: onClickExport }) : null,
|
|
1471
1471
|
props.docTemplates && !isMobile && props.searchBrowseParams === undefined ? react_1.default.createElement(XDocTemplateButton_1.XDocTemplateButton, { key: "docTemplates", entity: props.entity, rowId: selectedRow ? selectedRow[dataKey] : undefined, docTemplates: typeof props.docTemplates === 'function' ? props.docTemplates : undefined }) : null,
|
|
1472
1472
|
props.appButtonsForRow && props.searchBrowseParams === undefined ? 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,
|
|
1473
|
-
props.
|
|
1473
|
+
props.searchBrowseParams === undefined ? props.appButtons : null,
|
|
1474
1474
|
props.searchBrowseParams !== undefined ? react_1.default.createElement(XButton_1.XButton, { key: "choose", label: (0, XLocale_1.xLocaleOption)('chooseRow'), onClick: onClickChoose }) : null,
|
|
1475
1475
|
props.editForm != undefined ? react_1.default.createElement(XFormDialog_1.XFormDialog, { key: "formDialog", dialogState: formDialogState }) : null,
|
|
1476
1476
|
exportRows ? react_1.default.createElement(XExportRowsDialog_1.XExportRowsDialog, { key: "exportRowsDialog", dialogState: exportRowsDialogState, hideDialog: function () { return setExportRowsDialogState({ dialogOpened: false }); } }) : null),
|
|
@@ -90,7 +90,7 @@ var react_1 = __importStar(require("react"));
|
|
|
90
90
|
var XUtils_1 = require("./XUtils");
|
|
91
91
|
var XUtilsMetadataCommon_1 = require("../serverApi/XUtilsMetadataCommon");
|
|
92
92
|
var multiselect_1 = require("primereact/multiselect");
|
|
93
|
-
var XMultiSelectBase = /** @class */ (function (_super) {
|
|
93
|
+
var XMultiSelectBase = exports.XMultiSelectBase = /** @class */ (function (_super) {
|
|
94
94
|
__extends(XMultiSelectBase, _super);
|
|
95
95
|
function XMultiSelectBase(props) {
|
|
96
96
|
var _this = _super.call(this, props) || this;
|
|
@@ -142,4 +142,3 @@ var XMultiSelectBase = /** @class */ (function (_super) {
|
|
|
142
142
|
};
|
|
143
143
|
return XMultiSelectBase;
|
|
144
144
|
}(react_1.Component));
|
|
145
|
-
exports.XMultiSelectBase = XMultiSelectBase;
|
|
@@ -22,6 +22,7 @@ export declare enum XViewStatus {
|
|
|
22
22
|
Hidden = "hidden"
|
|
23
23
|
}
|
|
24
24
|
export type XViewStatusOrBoolean = XViewStatus | boolean;
|
|
25
|
+
export type XStorageType = "none" | "session" | "local";
|
|
25
26
|
export interface IPostgresInterval {
|
|
26
27
|
years?: number;
|
|
27
28
|
months?: number;
|
|
@@ -110,10 +111,10 @@ export declare class XUtils {
|
|
|
110
111
|
static isTableRowInserted(tableRow: any): boolean;
|
|
111
112
|
static xViewStatus(xViewStatusOrBoolean: XViewStatusOrBoolean): XViewStatus;
|
|
112
113
|
static options(valueStringList: string[]): SelectItem[];
|
|
113
|
-
static saveValueIntoStorage(key: string, value: any): void;
|
|
114
|
-
static getValueFromStorage(key: string, initValue: any): any;
|
|
115
|
-
static removeValueFromStorage(key: string): void;
|
|
116
|
-
static clearStorage(): void;
|
|
114
|
+
static saveValueIntoStorage(xStorageType: XStorageType, key: string, value: any): void;
|
|
115
|
+
static getValueFromStorage(xStorageType: XStorageType, key: string, initValue: any): any;
|
|
116
|
+
static removeValueFromStorage(xStorageType: XStorageType, key: string): void;
|
|
117
|
+
static clearStorage(xStorageType: XStorageType): void;
|
|
117
118
|
static reloadIfNewVersion(): void;
|
|
118
119
|
static reloadIfNewVersionNow(): Promise<void>;
|
|
119
120
|
static isLocalhost(): boolean;
|
package/lib/components/XUtils.js
CHANGED
|
@@ -88,14 +88,14 @@ var OperationType;
|
|
|
88
88
|
OperationType[OperationType["Insert"] = 1] = "Insert";
|
|
89
89
|
OperationType[OperationType["Update"] = 2] = "Update";
|
|
90
90
|
OperationType[OperationType["Remove"] = 3] = "Remove";
|
|
91
|
-
})(OperationType
|
|
91
|
+
})(OperationType || (exports.OperationType = OperationType = {}));
|
|
92
92
|
var XViewStatus;
|
|
93
93
|
(function (XViewStatus) {
|
|
94
94
|
XViewStatus["ReadWrite"] = "readWrite";
|
|
95
95
|
XViewStatus["ReadOnly"] = "readOnly";
|
|
96
96
|
XViewStatus["Hidden"] = "hidden";
|
|
97
|
-
})(XViewStatus
|
|
98
|
-
var XUtils = /** @class */ (function () {
|
|
97
|
+
})(XViewStatus || (exports.XViewStatus = XViewStatus = {}));
|
|
98
|
+
var XUtils = exports.XUtils = /** @class */ (function () {
|
|
99
99
|
function XUtils() {
|
|
100
100
|
}
|
|
101
101
|
XUtils.demo = function () {
|
|
@@ -713,7 +713,7 @@ var XUtils = /** @class */ (function () {
|
|
|
713
713
|
XUtils.options = function (valueStringList) {
|
|
714
714
|
return valueStringList.map(function (valueString) { return { value: valueString, label: valueString }; });
|
|
715
715
|
};
|
|
716
|
-
XUtils.saveValueIntoStorage = function (key, value) {
|
|
716
|
+
XUtils.saveValueIntoStorage = function (xStorageType, key, value) {
|
|
717
717
|
// value can be also string or null or undefined
|
|
718
718
|
// if we don't have object that can be serialised to json, we create special object
|
|
719
719
|
var valueObject;
|
|
@@ -727,12 +727,23 @@ var XUtils = /** @class */ (function () {
|
|
|
727
727
|
// value is null or string or boolean or number or Date...
|
|
728
728
|
valueObject = { _xValue: value };
|
|
729
729
|
}
|
|
730
|
-
|
|
730
|
+
if (xStorageType === "session") {
|
|
731
|
+
sessionStorage.setItem(key, XUtilsCommon_1.XUtilsCommon.objectAsJSON(valueObject));
|
|
732
|
+
}
|
|
733
|
+
else if (xStorageType === "local") {
|
|
734
|
+
localStorage.setItem(key, XUtilsCommon_1.XUtilsCommon.objectAsJSON(valueObject));
|
|
735
|
+
}
|
|
731
736
|
};
|
|
732
|
-
XUtils.getValueFromStorage = function (key, initValue) {
|
|
737
|
+
XUtils.getValueFromStorage = function (xStorageType, key, initValue) {
|
|
733
738
|
// if the value is not found in storage, initValue is returned
|
|
734
739
|
var value;
|
|
735
|
-
var item =
|
|
740
|
+
var item = null;
|
|
741
|
+
if (xStorageType === "session") {
|
|
742
|
+
item = sessionStorage.getItem(key);
|
|
743
|
+
}
|
|
744
|
+
else if (xStorageType === "local") {
|
|
745
|
+
item = localStorage.getItem(key);
|
|
746
|
+
}
|
|
736
747
|
if (item !== null) {
|
|
737
748
|
try {
|
|
738
749
|
var valueObject = JSON.parse(item);
|
|
@@ -750,7 +761,7 @@ var XUtils = /** @class */ (function () {
|
|
|
750
761
|
}
|
|
751
762
|
catch (e) {
|
|
752
763
|
// exception should not happen
|
|
753
|
-
console.log("XUtils.getValueFromStorage: Could not parse/process item from
|
|
764
|
+
console.log("XUtils.getValueFromStorage: Could not parse/process item from storage \"".concat(xStorageType, "\". key = ").concat(key, ", item = ").concat(item, ". Error: ").concat(e));
|
|
754
765
|
value = initValue;
|
|
755
766
|
}
|
|
756
767
|
}
|
|
@@ -759,11 +770,21 @@ var XUtils = /** @class */ (function () {
|
|
|
759
770
|
}
|
|
760
771
|
return value;
|
|
761
772
|
};
|
|
762
|
-
XUtils.removeValueFromStorage = function (key) {
|
|
763
|
-
|
|
773
|
+
XUtils.removeValueFromStorage = function (xStorageType, key) {
|
|
774
|
+
if (xStorageType === "session") {
|
|
775
|
+
sessionStorage.removeItem(key);
|
|
776
|
+
}
|
|
777
|
+
else if (xStorageType === "local") {
|
|
778
|
+
localStorage.removeItem(key);
|
|
779
|
+
}
|
|
764
780
|
};
|
|
765
|
-
XUtils.clearStorage = function () {
|
|
766
|
-
|
|
781
|
+
XUtils.clearStorage = function (xStorageType) {
|
|
782
|
+
if (xStorageType === "session") {
|
|
783
|
+
sessionStorage.clear();
|
|
784
|
+
}
|
|
785
|
+
else if (xStorageType === "local") {
|
|
786
|
+
localStorage.clear();
|
|
787
|
+
}
|
|
767
788
|
};
|
|
768
789
|
// hleper method used for items of XLazyDataTable (shortcut ldt)
|
|
769
790
|
// static getValueFromStorageLdt(entity: string, stateKeySuffix: XStateKeySuffix, initValue: any): any {
|
|
@@ -863,7 +884,8 @@ var XUtils = /** @class */ (function () {
|
|
|
863
884
|
// data in session may not correspond with new structures in new version
|
|
864
885
|
// e.g. if we add new column to XLazyDataTable, filter operator/value for this column new column is missing in data from session and application will crash
|
|
865
886
|
// simple solution is to clear session
|
|
866
|
-
XUtils.clearStorage();
|
|
887
|
+
XUtils.clearStorage("session");
|
|
888
|
+
XUtils.clearStorage("local");
|
|
867
889
|
// page reload (like pressing F5 or Enter on url bar)
|
|
868
890
|
// warning - if user has typed some data in form, the data will be lost
|
|
869
891
|
window.location.reload();
|
|
@@ -903,4 +925,3 @@ var XUtils = /** @class */ (function () {
|
|
|
903
925
|
XUtils.VERSION_CHECK_PERIOD = 10 * 60 * 1000; // 10 minutes in milliseconds
|
|
904
926
|
return XUtils;
|
|
905
927
|
}());
|
|
906
|
-
exports.XUtils = XUtils;
|
|
@@ -42,7 +42,7 @@ var XUtilsMetadataCommon_1 = require("../serverApi/XUtilsMetadataCommon");
|
|
|
42
42
|
// idelany nazov: UtilsEntityMetadata - ale strasne dlhy
|
|
43
43
|
// tato funkcionalita by mala ist bud do tried XEntity, XField alebo lepsie do nejakeho servisu
|
|
44
44
|
// ekvivalentna funkcionalita sa nachadza aj na servri v servise XEntityMetadataService.ts (TODO - v buducnosti spravit spolocnu triedu/servis)
|
|
45
|
-
var XUtilsMetadata = /** @class */ (function () {
|
|
45
|
+
var XUtilsMetadata = exports.XUtilsMetadata = /** @class */ (function () {
|
|
46
46
|
function XUtilsMetadata() {
|
|
47
47
|
}
|
|
48
48
|
XUtilsMetadata.fetchAndSetXEntityMap = function () {
|
|
@@ -275,4 +275,3 @@ var XUtilsMetadata = /** @class */ (function () {
|
|
|
275
275
|
XUtilsMetadata.CHAR_SIZE = 0.5; // 0.5rem (7px) - skusime
|
|
276
276
|
return XUtilsMetadata;
|
|
277
277
|
}());
|
|
278
|
-
exports.XUtilsMetadata = XUtilsMetadata;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useXStateLocal = void 0;
|
|
4
|
+
var useXStateStorage_1 = require("./useXStateStorage");
|
|
5
|
+
// TODO - initialState sholud be value | function returning T, and the function should be called in function "initialStateFunction"
|
|
6
|
+
function useXStateLocal(key, initialState) {
|
|
7
|
+
return (0, useXStateStorage_1.useXStateStorage)("local", key, initialState);
|
|
8
|
+
}
|
|
9
|
+
exports.useXStateLocal = useXStateLocal;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useXStateSession = void 0;
|
|
4
|
-
var
|
|
5
|
-
var useXStateSessionBase_1 = require("./useXStateSessionBase");
|
|
4
|
+
var useXStateStorage_1 = require("./useXStateStorage");
|
|
6
5
|
// TODO - initialState sholud be value | function returning T, and the function should be called in function "initialStateFunction"
|
|
7
6
|
function useXStateSession(key, initialState) {
|
|
8
|
-
return (0,
|
|
7
|
+
return (0, useXStateStorage_1.useXStateStorage)("session", key, initialState);
|
|
9
8
|
}
|
|
10
9
|
exports.useXStateSession = useXStateSession;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useXStateStorage = void 0;
|
|
4
|
+
var XUtils_1 = require("./XUtils");
|
|
5
|
+
var useXStateStorageBase_1 = require("./useXStateStorageBase");
|
|
6
|
+
// TODO - initialState sholud be value | function returning T, and the function should be called in function "initialStateFunction"
|
|
7
|
+
function useXStateStorage(xStorageType, key, initialState) {
|
|
8
|
+
return (0, useXStateStorageBase_1.useXStateStorageBase)(xStorageType, key, function () { return XUtils_1.XUtils.getValueFromStorage(xStorageType, key, initialState); });
|
|
9
|
+
}
|
|
10
|
+
exports.useXStateStorage = useXStateStorage;
|
|
@@ -16,17 +16,17 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
16
16
|
return ar;
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
19
|
+
exports.useXStateStorageBase = void 0;
|
|
20
20
|
var react_1 = require("react");
|
|
21
21
|
var XUtils_1 = require("./XUtils");
|
|
22
22
|
// this base version enables to use custom version of function that computes initialState
|
|
23
|
-
// (in usual case
|
|
24
|
-
function
|
|
23
|
+
// (in usual case useXStateStorage shoud be used)
|
|
24
|
+
function useXStateStorageBase(xStorageType, key, initialStateFunction) {
|
|
25
25
|
var _a = __read((0, react_1.useState)(initialStateFunction), 2), value = _a[0], setValue = _a[1];
|
|
26
26
|
var setValueIntoSession = function (value) {
|
|
27
27
|
setValue(value);
|
|
28
|
-
XUtils_1.XUtils.saveValueIntoStorage(key, value);
|
|
28
|
+
XUtils_1.XUtils.saveValueIntoStorage(xStorageType, key, value);
|
|
29
29
|
};
|
|
30
30
|
return [value, setValueIntoSession];
|
|
31
31
|
}
|
|
32
|
-
exports.
|
|
32
|
+
exports.useXStateStorageBase = useXStateStorageBase;
|
|
@@ -7,27 +7,27 @@ var ExportType;
|
|
|
7
7
|
ExportType["Excel"] = "excel";
|
|
8
8
|
ExportType["Csv"] = "csv";
|
|
9
9
|
ExportType["Json"] = "json";
|
|
10
|
-
})(ExportType
|
|
10
|
+
})(ExportType || (exports.ExportType = ExportType = {}));
|
|
11
11
|
// exportovanie hodnot z toMany asociacii, pripadne viacriadkovych textov
|
|
12
12
|
var XMultilineExportType;
|
|
13
13
|
(function (XMultilineExportType) {
|
|
14
14
|
XMultilineExportType["Singleline"] = "singleline";
|
|
15
15
|
XMultilineExportType["Multiline"] = "multiline";
|
|
16
16
|
XMultilineExportType["Off"] = "off"; // stlpce obsahujuce viac hodnot/riadkov sa vynechaju z exportu
|
|
17
|
-
})(XMultilineExportType
|
|
17
|
+
})(XMultilineExportType || (exports.XMultilineExportType = XMultilineExportType = {}));
|
|
18
18
|
// vo windowse zavisi od regionalnych nastaveni, default nastavenie je ";" a preto vecsinou aj excel produkuje csv s ";" (menej sa to bije s decimalmi)
|
|
19
19
|
// takze primarne pouzivame ";" a sekundarne "," napr. pri generickom exporte do csv davame uzivatelovi na vyber
|
|
20
20
|
var CsvSeparator;
|
|
21
21
|
(function (CsvSeparator) {
|
|
22
22
|
CsvSeparator["Semicolon"] = ";";
|
|
23
23
|
CsvSeparator["Comma"] = ",";
|
|
24
|
-
})(CsvSeparator
|
|
24
|
+
})(CsvSeparator || (exports.CsvSeparator = CsvSeparator = {}));
|
|
25
25
|
// decimal format pouzivany pri exporte do csv
|
|
26
26
|
var CsvDecimalFormat;
|
|
27
27
|
(function (CsvDecimalFormat) {
|
|
28
28
|
CsvDecimalFormat["Comma"] = "123456,78";
|
|
29
29
|
CsvDecimalFormat["Dot"] = "123456.78";
|
|
30
|
-
})(CsvDecimalFormat
|
|
30
|
+
})(CsvDecimalFormat || (exports.CsvDecimalFormat = CsvDecimalFormat = {}));
|
|
31
31
|
// zatial len tieto 2, ak bude treba, tak pridat napr. win1252 (Western Europe)
|
|
32
32
|
// win1250 pouzivame ako default, lebo Excel automaticky predpoklada kodovanie win1250
|
|
33
33
|
// konstanty sa pouzivaju priamo v kniznici iconv-lite
|
|
@@ -35,10 +35,10 @@ var CsvEncoding;
|
|
|
35
35
|
(function (CsvEncoding) {
|
|
36
36
|
CsvEncoding["Utf8"] = "utf-8";
|
|
37
37
|
CsvEncoding["Win1250"] = "win1250";
|
|
38
|
-
})(CsvEncoding
|
|
38
|
+
})(CsvEncoding || (exports.CsvEncoding = CsvEncoding = {}));
|
|
39
39
|
// ************** import ***************
|
|
40
40
|
var ImportType;
|
|
41
41
|
(function (ImportType) {
|
|
42
42
|
ImportType["Csv"] = "csv";
|
|
43
43
|
ImportType["Json"] = "json";
|
|
44
|
-
})(ImportType
|
|
44
|
+
})(ImportType || (exports.ImportType = ImportType = {}));
|
|
@@ -7,17 +7,17 @@ var ResultType;
|
|
|
7
7
|
ResultType[ResultType["OnlyPagedRows"] = 1] = "OnlyPagedRows";
|
|
8
8
|
ResultType[ResultType["RowCountAndPagedRows"] = 2] = "RowCountAndPagedRows";
|
|
9
9
|
ResultType[ResultType["AllRows"] = 3] = "AllRows";
|
|
10
|
-
})(ResultType
|
|
10
|
+
})(ResultType || (exports.ResultType = ResultType = {}));
|
|
11
11
|
// additional match modes (extension to primereact enum FilterMatchMode)
|
|
12
12
|
var XFilterMatchMode;
|
|
13
13
|
(function (XFilterMatchMode) {
|
|
14
14
|
XFilterMatchMode["X_AUTO_COMPLETE"] = "xAutoComplete";
|
|
15
15
|
XFilterMatchMode["X_FILTER_ELEMENT"] = "xFilterElement"; // custom filter element (defined in filterElement property)
|
|
16
|
-
})(XFilterMatchMode
|
|
16
|
+
})(XFilterMatchMode || (exports.XFilterMatchMode = XFilterMatchMode = {}));
|
|
17
17
|
var XAggregateFunction;
|
|
18
18
|
(function (XAggregateFunction) {
|
|
19
19
|
XAggregateFunction["Min"] = "MIN";
|
|
20
20
|
XAggregateFunction["Max"] = "MAX";
|
|
21
21
|
XAggregateFunction["Sum"] = "SUM";
|
|
22
22
|
XAggregateFunction["Avg"] = "AVG";
|
|
23
|
-
})(XAggregateFunction
|
|
23
|
+
})(XAggregateFunction || (exports.XAggregateFunction = XAggregateFunction = {}));
|
|
@@ -36,16 +36,17 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
36
36
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.XUtilsCommon = void 0;
|
|
40
40
|
var XUtilsMetadataCommon_1 = require("./XUtilsMetadataCommon");
|
|
41
41
|
var XUtilsConversions_1 = require("./XUtilsConversions");
|
|
42
|
-
//
|
|
43
|
-
var XUtilsCommon = /** @class */ (function () {
|
|
42
|
+
// common functions for frontend and backend
|
|
43
|
+
var XUtilsCommon = exports.XUtilsCommon = /** @class */ (function () {
|
|
44
44
|
function XUtilsCommon() {
|
|
45
45
|
}
|
|
46
46
|
// TODO - toto by sme mohli doplnit o kontrolu ak programator urobil preklep
|
|
47
47
|
XUtilsCommon.getValueByPath = function (object, path) {
|
|
48
|
-
var _a
|
|
48
|
+
var _a;
|
|
49
|
+
var field = (_a = __read(XUtilsCommon.getFieldAndRestPath(path), 2), _a[0]), restPath = _a[1];
|
|
49
50
|
if (restPath === null) {
|
|
50
51
|
return object[field];
|
|
51
52
|
}
|
|
@@ -63,8 +64,8 @@ var XUtilsCommon = /** @class */ (function () {
|
|
|
63
64
|
// vseobecnejsia verzia, ktora funguje aj pre *toMany asociacie
|
|
64
65
|
// TODO - toto by sme mohli doplnit o kontrolu ak programator urobil preklep
|
|
65
66
|
XUtilsCommon.getValueOrValueListByPath = function (object, path) {
|
|
66
|
-
var e_1,
|
|
67
|
-
var
|
|
67
|
+
var _a, e_1, _b;
|
|
68
|
+
var field = (_a = __read(XUtilsCommon.getFieldAndRestPath(path), 2), _a[0]), restPath = _a[1];
|
|
68
69
|
if (restPath === null) {
|
|
69
70
|
return object[field];
|
|
70
71
|
}
|
|
@@ -93,7 +94,7 @@ var XUtilsCommon = /** @class */ (function () {
|
|
|
93
94
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
94
95
|
finally {
|
|
95
96
|
try {
|
|
96
|
-
if (assocObject_1_1 && !assocObject_1_1.done && (
|
|
97
|
+
if (assocObject_1_1 && !assocObject_1_1.done && (_b = assocObject_1.return)) _b.call(assocObject_1);
|
|
97
98
|
}
|
|
98
99
|
finally { if (e_1) throw e_1.error; }
|
|
99
100
|
}
|
|
@@ -111,7 +112,8 @@ var XUtilsCommon = /** @class */ (function () {
|
|
|
111
112
|
}
|
|
112
113
|
};
|
|
113
114
|
XUtilsCommon.setValueByPath = function (object, path, value) {
|
|
114
|
-
var _a
|
|
115
|
+
var _a;
|
|
116
|
+
var pathToAssoc = (_a = __read(XUtilsCommon.getPathToAssocAndField(path), 2), _a[0]), field = _a[1];
|
|
115
117
|
if (pathToAssoc !== null) {
|
|
116
118
|
var assocObject = XUtilsCommon.getValueByPath(object, pathToAssoc);
|
|
117
119
|
// if null or undefined or is not object, then error
|
|
@@ -195,10 +197,10 @@ var XUtilsCommon = /** @class */ (function () {
|
|
|
195
197
|
return displayValue;
|
|
196
198
|
};
|
|
197
199
|
XUtilsCommon.createDisplayValueForField = function (object, xEntity, field) {
|
|
198
|
-
var e_3,
|
|
200
|
+
var _a, e_3, _b;
|
|
199
201
|
// pouziva sa podobny algoritmus ako v XLazyDataTable - metoda bodyTemplate
|
|
200
202
|
// (ale nie je to take komplexne ako v XLazyDataTable - nevie renderovat napr. html (rich text))
|
|
201
|
-
var
|
|
203
|
+
var prefix = (_a = __read(XUtilsCommon.getPrefixAndField(field), 2), _a[0]), fieldOnly = _a[1];
|
|
202
204
|
var xField = undefined;
|
|
203
205
|
if (xEntity) {
|
|
204
206
|
xField = XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXFieldByPath(xEntity, fieldOnly);
|
|
@@ -223,7 +225,7 @@ var XUtilsCommon = /** @class */ (function () {
|
|
|
223
225
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
224
226
|
finally {
|
|
225
227
|
try {
|
|
226
|
-
if (valueOrValueList_1_1 && !valueOrValueList_1_1.done && (
|
|
228
|
+
if (valueOrValueList_1_1 && !valueOrValueList_1_1.done && (_b = valueOrValueList_1.return)) _b.call(valueOrValueList_1);
|
|
227
229
|
}
|
|
228
230
|
finally { if (e_3) throw e_3.error; }
|
|
229
231
|
}
|
|
@@ -259,11 +261,11 @@ var XUtilsCommon = /** @class */ (function () {
|
|
|
259
261
|
// TODO - ak pre datetime nastavime vsetky zlozky casu na 00:00:00, tak sformatuje hodnotu ako datum a spravi chybu pri zapise do DB - zapise 1:00:00
|
|
260
262
|
var dateStr;
|
|
261
263
|
if (this.getHours() === 0 && this.getMinutes() === 0 && this.getSeconds() === 0) {
|
|
262
|
-
dateStr = (0,
|
|
264
|
+
dateStr = (0, XUtilsConversions_1.dateFormat)(this, 'yyyy-MM-dd');
|
|
263
265
|
}
|
|
264
266
|
else {
|
|
265
267
|
// jedna sa o datetime
|
|
266
|
-
dateStr = (0,
|
|
268
|
+
dateStr = (0, XUtilsConversions_1.datetimeFormat)(this, 'yyyy-MM-dd HH:mm:ss');
|
|
267
269
|
}
|
|
268
270
|
return dateStr;
|
|
269
271
|
};
|
|
@@ -558,6 +560,3 @@ var XUtilsCommon = /** @class */ (function () {
|
|
|
558
560
|
XUtilsCommon.newLine = '\n';
|
|
559
561
|
return XUtilsCommon;
|
|
560
562
|
}());
|
|
561
|
-
exports.XUtilsCommon = XUtilsCommon;
|
|
562
|
-
// nevedel som importnut dateFormat, tak som to dal sem aby som nemusel vsade pouzivat require("dateformat")
|
|
563
|
-
exports.dateFormat = require("dateformat");
|
|
@@ -17,7 +17,9 @@ export declare function dateFromUI(valueString: string, dateScale?: XDateScale):
|
|
|
17
17
|
export declare function dateAsUI(value: Date | null, dateScale?: XDateScale): string;
|
|
18
18
|
export declare function dateAsYYYY_MM_DD(date: Date): string;
|
|
19
19
|
export declare function dateAsDB(date: Date | null): string;
|
|
20
|
+
export declare function dateFormat(date: Date, format: string): string;
|
|
20
21
|
export declare function datetimeAsUI(value: Date | null): string;
|
|
22
|
+
export declare function datetimeFormat(date: Date, format: string): string;
|
|
21
23
|
export declare function timeFromModel(value: any): Date | null;
|
|
22
24
|
export declare function dateFormatUI(dateScale?: XDateScale): string;
|
|
23
25
|
export declare function dateFormatCalendar(dateScale?: XDateScale): string;
|
|
@@ -27,7 +27,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
27
27
|
return ar;
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.convertValueBase = exports.convertValue = exports.convertObject = exports.AsUIType = exports.booleanAsUIText = exports.intervalAsUI = exports.intervalFromUI = exports.datetimeFormatUI = exports.dateFormatCalendar = exports.dateFormatUI = exports.timeFromModel = exports.datetimeAsUI = exports.dateAsDB = exports.dateAsYYYY_MM_DD = exports.dateAsUI = exports.dateFromUI = exports.dateFromModel = exports.XDateScale = exports.numberFromString = exports.numberFromModel = exports.numberAsUI = exports.intFromUI = exports.stringAsDB = exports.stringAsUI = exports.stringFromUI = void 0;
|
|
30
|
+
exports.convertValueBase = exports.convertValue = exports.convertObject = exports.AsUIType = exports.booleanAsUIText = exports.intervalAsUI = exports.intervalFromUI = exports.datetimeFormatUI = exports.dateFormatCalendar = exports.dateFormatUI = exports.timeFromModel = exports.datetimeFormat = exports.datetimeAsUI = exports.dateFormat = exports.dateAsDB = exports.dateAsYYYY_MM_DD = exports.dateAsUI = exports.dateFromUI = exports.dateFromModel = exports.XDateScale = exports.numberFromString = exports.numberFromModel = exports.numberAsUI = exports.intFromUI = exports.stringAsDB = exports.stringAsUI = exports.stringFromUI = void 0;
|
|
31
31
|
var XUtilsCommon_1 = require("./XUtilsCommon");
|
|
32
32
|
var XLocale_1 = require("../components/XLocale");
|
|
33
33
|
var XUtilsMetadataCommon_1 = require("./XUtilsMetadataCommon");
|
|
@@ -110,7 +110,7 @@ var XDateScale;
|
|
|
110
110
|
XDateScale[XDateScale["Date"] = 1] = "Date";
|
|
111
111
|
XDateScale[XDateScale["Month"] = 2] = "Month";
|
|
112
112
|
XDateScale[XDateScale["Year"] = 3] = "Year"; // yyyy
|
|
113
|
-
})(XDateScale
|
|
113
|
+
})(XDateScale || (exports.XDateScale = XDateScale = {}));
|
|
114
114
|
//export type XDateType = "month" | "year" | "date";
|
|
115
115
|
// v modeli na klientovi by mal byt vzdy Date, teraz je tam niekedy string (z json-u zo servera) a niekedy Date (z komponentu)
|
|
116
116
|
// provizorne zatial takato konverzia
|
|
@@ -208,7 +208,7 @@ exports.dateFromUI = dateFromUI;
|
|
|
208
208
|
function dateAsUI(value, dateScale) {
|
|
209
209
|
if (dateScale === void 0) { dateScale = XDateScale.Date; }
|
|
210
210
|
if (value !== null) {
|
|
211
|
-
return
|
|
211
|
+
return dateFormat(value, dateFormatUI(dateScale));
|
|
212
212
|
}
|
|
213
213
|
else {
|
|
214
214
|
return "";
|
|
@@ -217,30 +217,54 @@ function dateAsUI(value, dateScale) {
|
|
|
217
217
|
exports.dateAsUI = dateAsUI;
|
|
218
218
|
// specialna funkcia - konvertuje Date na string YYYY-MM-DD
|
|
219
219
|
function dateAsYYYY_MM_DD(date) {
|
|
220
|
-
|
|
221
|
-
if (monthStr.length < 2) {
|
|
222
|
-
monthStr = "0" + monthStr;
|
|
223
|
-
}
|
|
224
|
-
var dayStr = date.getDate().toString();
|
|
225
|
-
if (dayStr.length < 2) {
|
|
226
|
-
dayStr = "0" + dayStr;
|
|
227
|
-
}
|
|
228
|
-
return "".concat(date.getFullYear(), "-").concat(monthStr, "-").concat(dayStr);
|
|
220
|
+
return dateFormat(date, 'yyyy-MM-dd');
|
|
229
221
|
}
|
|
230
222
|
exports.dateAsYYYY_MM_DD = dateAsYYYY_MM_DD;
|
|
231
223
|
function dateAsDB(date) {
|
|
232
224
|
return date !== null ? "'".concat(dateAsYYYY_MM_DD(date), "'::DATE") : "NULL::DATE";
|
|
233
225
|
}
|
|
234
226
|
exports.dateAsDB = dateAsDB;
|
|
227
|
+
// the same like function format(this, 'yyyy-MM-dd');
|
|
228
|
+
function dateFormat(date, format) {
|
|
229
|
+
var pad = function (num) { return num.toString().padStart(2, '0'); };
|
|
230
|
+
var year = date.getFullYear();
|
|
231
|
+
var month = pad(date.getMonth() + 1); // Months are zero-based
|
|
232
|
+
var day = pad(date.getDate());
|
|
233
|
+
var value = format;
|
|
234
|
+
value = value.replace('yyyy', "".concat(year));
|
|
235
|
+
value = value.replace('MM', month);
|
|
236
|
+
value = value.replace('dd', day);
|
|
237
|
+
return value;
|
|
238
|
+
}
|
|
239
|
+
exports.dateFormat = dateFormat;
|
|
235
240
|
function datetimeAsUI(value) {
|
|
236
241
|
if (value !== null) {
|
|
237
|
-
return (
|
|
242
|
+
return datetimeFormat(value, datetimeFormatUI());
|
|
238
243
|
}
|
|
239
244
|
else {
|
|
240
245
|
return "";
|
|
241
246
|
}
|
|
242
247
|
}
|
|
243
248
|
exports.datetimeAsUI = datetimeAsUI;
|
|
249
|
+
// the same like function format(this, 'yyyy-MM-dd HH:mm:ss');
|
|
250
|
+
function datetimeFormat(date, format) {
|
|
251
|
+
var pad = function (num) { return num.toString().padStart(2, '0'); };
|
|
252
|
+
var year = date.getFullYear();
|
|
253
|
+
var month = pad(date.getMonth() + 1); // Months are zero-based
|
|
254
|
+
var day = pad(date.getDate());
|
|
255
|
+
var hours = pad(date.getHours());
|
|
256
|
+
var minutes = pad(date.getMinutes());
|
|
257
|
+
var seconds = pad(date.getSeconds());
|
|
258
|
+
var value = format;
|
|
259
|
+
value = value.replace('yyyy', "".concat(year));
|
|
260
|
+
value = value.replace('MM', month);
|
|
261
|
+
value = value.replace('dd', day);
|
|
262
|
+
value = value.replace('HH', hours);
|
|
263
|
+
value = value.replace('mm', minutes);
|
|
264
|
+
value = value.replace('ss', seconds);
|
|
265
|
+
return value;
|
|
266
|
+
}
|
|
267
|
+
exports.datetimeFormat = datetimeFormat;
|
|
244
268
|
// provizorne zatial takato konverzia
|
|
245
269
|
function timeFromModel(value) {
|
|
246
270
|
var timeValue = null;
|
|
@@ -272,10 +296,10 @@ function dateFormatUI(dateScale) {
|
|
|
272
296
|
if (dateScale === void 0) { dateScale = XDateScale.Date; }
|
|
273
297
|
var format;
|
|
274
298
|
if (dateScale === XDateScale.Date) {
|
|
275
|
-
format = "dd.
|
|
299
|
+
format = "dd.MM.yyyy";
|
|
276
300
|
}
|
|
277
301
|
else if (dateScale === XDateScale.Month) {
|
|
278
|
-
format = "
|
|
302
|
+
format = "MM.yyyy";
|
|
279
303
|
}
|
|
280
304
|
else if (dateScale === XDateScale.Year) {
|
|
281
305
|
format = "yyyy";
|
|
@@ -305,7 +329,7 @@ function dateFormatCalendar(dateScale) {
|
|
|
305
329
|
}
|
|
306
330
|
exports.dateFormatCalendar = dateFormatCalendar;
|
|
307
331
|
function datetimeFormatUI() {
|
|
308
|
-
return "dd.
|
|
332
|
+
return "dd.MM.yyyy HH:mm:ss";
|
|
309
333
|
}
|
|
310
334
|
exports.datetimeFormatUI = datetimeFormatUI;
|
|
311
335
|
function intervalFromUI(valueString) {
|
|
@@ -374,7 +398,7 @@ var AsUIType;
|
|
|
374
398
|
AsUIType[AsUIType["Form"] = 1] = "Form";
|
|
375
399
|
AsUIType[AsUIType["Text"] = 2] = "Text";
|
|
376
400
|
AsUIType[AsUIType["Excel"] = 3] = "Excel"; // excel - nie vsetko konvertujeme do string-u, vecsinou zostavame pri typoch number, Date
|
|
377
|
-
})(AsUIType
|
|
401
|
+
})(AsUIType || (exports.AsUIType = AsUIType = {}));
|
|
378
402
|
/**
|
|
379
403
|
* converts values of object
|
|
380
404
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@michalrakus/x-react-web-lib",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.36.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rimraf lib",
|
|
@@ -19,28 +19,29 @@
|
|
|
19
19
|
},
|
|
20
20
|
"author": "Michal Rakus",
|
|
21
21
|
"license": "MIT",
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=20"
|
|
24
|
+
},
|
|
22
25
|
"dependencies": {
|
|
23
|
-
"dateformat": "^4.6.3",
|
|
24
26
|
"lodash": "^4.17.21"
|
|
25
27
|
},
|
|
26
28
|
"devDependencies": {
|
|
27
|
-
"@testing-library/jest-dom": "^
|
|
28
|
-
"@testing-library/react": "^14.
|
|
29
|
-
"@testing-library/user-event": "^14.
|
|
30
|
-
"@types/
|
|
31
|
-
"@types/
|
|
32
|
-
"@types/
|
|
33
|
-
"@types/react": "^18.3.
|
|
34
|
-
"@types/react-
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"typescript": "^4.9.5"
|
|
29
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
30
|
+
"@testing-library/react": "^14.1.2",
|
|
31
|
+
"@testing-library/user-event": "^14.5.2",
|
|
32
|
+
"@types/lodash": "^4.17.16",
|
|
33
|
+
"@types/node": "^22.7.4",
|
|
34
|
+
"@types/react": "^18.3.12",
|
|
35
|
+
"@types/react-dom": "^18.3.0",
|
|
36
|
+
"@types/react-transition-group": "^4.4.11",
|
|
37
|
+
"gulp": "^5.0.0",
|
|
38
|
+
"rimraf": "^6.0.1",
|
|
39
|
+
"typescript": "5.1.6"
|
|
39
40
|
},
|
|
40
41
|
"peerDependencies": {
|
|
41
42
|
"primeflex": "^3.3.1",
|
|
42
43
|
"primeicons": "^7.0.0",
|
|
43
|
-
"primereact": "10.
|
|
44
|
+
"primereact": "10.9.4",
|
|
44
45
|
"quill": "^2.0.3",
|
|
45
46
|
"react": "^18.3.1",
|
|
46
47
|
"react-dom": "^18.3.1",
|