@michalrakus/x-react-web-lib 1.0.0 → 1.2.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.
- package/FindParam.d.ts +3 -0
- package/FindParam.js +5 -0
- package/LICENSE.md +21 -0
- package/XButtonIconNarrow.d.ts +3 -0
- package/XButtonIconNarrow.js +5 -0
- package/XButtonIconSmall.d.ts +3 -0
- package/XButtonIconSmall.js +5 -0
- package/XFieldChangeEvent.d.ts +3 -0
- package/XFieldChangeEvent.js +5 -0
- package/XInputTextarea.d.ts +3 -0
- package/XInputTextarea.js +5 -0
- package/gulpfile.js +5 -0
- package/lib/administration/XBrowseMetaBrowse.js +2 -1
- package/lib/administration/XBrowseMetaForm.js +4 -2
- package/lib/administration/XUserBrowse.js +3 -2
- package/lib/administration/XUserForm.js +5 -3
- package/lib/components/SearchTableParams.d.ts +8 -2
- package/lib/components/SourceCodeLinkEntity.js +3 -2
- package/lib/components/XAutoComplete.d.ts +10 -7
- package/lib/components/XAutoComplete.js +37 -41
- package/lib/components/XAutoCompleteBase.d.ts +8 -5
- package/lib/components/XAutoCompleteBase.js +86 -43
- package/lib/components/XAutoCompleteDT.d.ts +33 -0
- package/lib/components/XAutoCompleteDT.js +141 -0
- package/lib/components/XBrowse.js +11 -5
- package/lib/components/XButton.d.ts +3 -1
- package/lib/components/XButton.js +3 -2
- package/lib/components/XButtonIconNarrow.d.ts +10 -0
- package/lib/components/XButtonIconNarrow.js +25 -0
- package/lib/components/XButtonIconSmall.d.ts +3 -1
- package/lib/components/XButtonIconSmall.js +2 -1
- package/lib/components/XChangePasswordForm.js +12 -7
- package/lib/components/XCheckbox.d.ts +8 -10
- package/lib/components/XCheckbox.js +39 -31
- package/lib/components/XCheckboxDT.js +2 -1
- package/lib/components/XDataTable.js +16 -10
- package/lib/components/XDropdown.d.ts +7 -5
- package/lib/components/XDropdown.js +24 -45
- package/lib/components/XDropdownDT.js +10 -5
- package/lib/components/XDropdownDTFilter.js +12 -7
- package/lib/components/XDropdownFormDTFilter.js +12 -7
- package/lib/components/XEditColumnDialog.js +12 -7
- package/lib/components/XErrors.d.ts +1 -0
- package/lib/components/XExportRowsDialog.js +13 -8
- package/lib/components/XFieldChangeEvent.d.ts +11 -0
- package/lib/components/XFieldChangeEvent.js +2 -0
- package/lib/components/XFieldSelector.js +11 -6
- package/lib/components/XFormBase.d.ts +17 -8
- package/lib/components/XFormBase.js +127 -48
- package/lib/components/XFormBaseT.js +3 -1
- package/lib/components/XFormComponent.d.ts +19 -7
- package/lib/components/XFormComponent.js +89 -49
- package/lib/components/XFormComponentDT.d.ts +30 -0
- package/lib/components/XFormComponentDT.js +119 -0
- package/lib/components/XFormDataTable2.d.ts +53 -8
- package/lib/components/XFormDataTable2.js +270 -57
- package/lib/components/XFormFooter.js +2 -1
- package/lib/components/XFormNavigator3.js +18 -7
- package/lib/components/XHolders.js +4 -2
- package/lib/components/XInput.d.ts +13 -0
- package/lib/components/XInput.js +38 -0
- package/lib/components/XInputDT.d.ts +11 -0
- package/lib/components/XInputDT.js +37 -0
- package/lib/components/XInputDate.d.ts +2 -1
- package/lib/components/XInputDate.js +7 -4
- package/lib/components/XInputDateDT.js +3 -2
- package/lib/components/XInputDecimal.d.ts +9 -2
- package/lib/components/XInputDecimal.js +63 -45
- package/lib/components/XInputDecimalDT.d.ts +10 -8
- package/lib/components/XInputDecimalDT.js +59 -36
- package/lib/components/XInputText.d.ts +7 -11
- package/lib/components/XInputText.js +22 -49
- package/lib/components/XInputTextDT.js +4 -4
- package/lib/components/XInputTextarea.d.ts +18 -0
- package/lib/components/XInputTextarea.js +85 -0
- package/lib/components/XLazyDataTable.d.ts +8 -0
- package/lib/components/XLazyDataTable.js +187 -85
- package/lib/components/XLoginDialog.js +2 -1
- package/lib/components/XLoginForm.js +11 -6
- package/lib/components/XResponseError.js +4 -2
- package/lib/components/XSearchButton.d.ts +8 -7
- package/lib/components/XSearchButton.js +32 -51
- package/lib/components/XSearchButtonDT.js +15 -10
- package/lib/components/XSearchButtonOld.js +13 -8
- package/lib/components/XToOneAssocButton.js +2 -1
- package/lib/components/XUtils.d.ts +13 -1
- package/lib/components/XUtils.js +125 -5
- package/lib/components/XUtilsConversions.d.ts +1 -0
- package/lib/components/XUtilsConversions.js +24 -3
- package/lib/components/XUtilsMetadata.d.ts +4 -1
- package/lib/components/XUtilsMetadata.js +62 -14
- package/lib/components/useXToken.js +1 -1
- package/lib/serverApi/ExportImportParam.d.ts +3 -3
- package/lib/serverApi/FindParam.d.ts +12 -14
- package/lib/serverApi/FindParam.js +14 -0
- package/lib/serverApi/XUtilsCommon.d.ts +1 -0
- package/lib/serverApi/XUtilsCommon.js +6 -2
- package/package.json +24 -25
|
@@ -5,9 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.XHolder2 = exports.XHolder1 = void 0;
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
|
-
|
|
8
|
+
var XHolder1 = function (props) {
|
|
9
9
|
return react_1.default.createElement("div", null, props.element);
|
|
10
10
|
};
|
|
11
|
-
exports.
|
|
11
|
+
exports.XHolder1 = XHolder1;
|
|
12
|
+
var XHolder2 = function (props) {
|
|
12
13
|
return react_1.default.createElement("div", null, props.element);
|
|
13
14
|
};
|
|
15
|
+
exports.XHolder2 = XHolder2;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { XFormComponent, XFormComponentProps } from "./XFormComponent";
|
|
3
|
+
import { XField } from "../serverApi/XEntityMetadata";
|
|
4
|
+
export interface XInputProps<T> extends XFormComponentProps<T> {
|
|
5
|
+
field: string;
|
|
6
|
+
inputStyle?: React.CSSProperties;
|
|
7
|
+
}
|
|
8
|
+
export declare abstract class XInput<T, P extends XInputProps<T>> extends XFormComponent<T, P> {
|
|
9
|
+
protected xField: XField;
|
|
10
|
+
protected constructor(props: P);
|
|
11
|
+
getField(): string;
|
|
12
|
+
isNotNull(): boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.XInput = void 0;
|
|
19
|
+
var XUtilsMetadata_1 = require("./XUtilsMetadata");
|
|
20
|
+
var XFormComponent_1 = require("./XFormComponent");
|
|
21
|
+
// spolocna nadtrieda pre jednoduche inputy (nie asociacne)
|
|
22
|
+
var XInput = /** @class */ (function (_super) {
|
|
23
|
+
__extends(XInput, _super);
|
|
24
|
+
function XInput(props) {
|
|
25
|
+
var _this = _super.call(this, props) || this;
|
|
26
|
+
_this.xField = XUtilsMetadata_1.XUtilsMetadata.getXFieldByPathStr(props.form.getEntity(), props.field);
|
|
27
|
+
props.form.addField(props.field);
|
|
28
|
+
return _this;
|
|
29
|
+
}
|
|
30
|
+
XInput.prototype.getField = function () {
|
|
31
|
+
return this.props.field;
|
|
32
|
+
};
|
|
33
|
+
XInput.prototype.isNotNull = function () {
|
|
34
|
+
return !this.xField.isNullable;
|
|
35
|
+
};
|
|
36
|
+
return XInput;
|
|
37
|
+
}(XFormComponent_1.XFormComponent));
|
|
38
|
+
exports.XInput = XInput;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { XField } from "../serverApi/XEntityMetadata";
|
|
2
|
+
import { XFormComponentDT, XFormComponentDTProps } from "./XFormComponentDT";
|
|
3
|
+
export interface XInputDTProps extends XFormComponentDTProps {
|
|
4
|
+
field: string;
|
|
5
|
+
}
|
|
6
|
+
export declare abstract class XInputDT<P extends XInputDTProps> extends XFormComponentDT<P> {
|
|
7
|
+
protected xField: XField;
|
|
8
|
+
protected constructor(props: P);
|
|
9
|
+
getField(): string;
|
|
10
|
+
isNotNull(): boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.XInputDT = void 0;
|
|
19
|
+
var XUtilsMetadata_1 = require("./XUtilsMetadata");
|
|
20
|
+
var XFormComponentDT_1 = require("./XFormComponentDT");
|
|
21
|
+
// spolocna nadtrieda pre jednoduche inputy (nie asociacne)
|
|
22
|
+
var XInputDT = /** @class */ (function (_super) {
|
|
23
|
+
__extends(XInputDT, _super);
|
|
24
|
+
function XInputDT(props) {
|
|
25
|
+
var _this = _super.call(this, props) || this;
|
|
26
|
+
_this.xField = XUtilsMetadata_1.XUtilsMetadata.getXFieldByPathStr(props.entity, props.field);
|
|
27
|
+
return _this;
|
|
28
|
+
}
|
|
29
|
+
XInputDT.prototype.getField = function () {
|
|
30
|
+
return this.props.field;
|
|
31
|
+
};
|
|
32
|
+
XInputDT.prototype.isNotNull = function () {
|
|
33
|
+
return !this.xField.isNullable;
|
|
34
|
+
};
|
|
35
|
+
return XInputDT;
|
|
36
|
+
}(XFormComponentDT_1.XFormComponentDT));
|
|
37
|
+
exports.XInputDT = XInputDT;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { XFormBase } from "./XFormBase";
|
|
2
|
+
import React from "react";
|
|
3
3
|
export declare const XInputDate: (props: {
|
|
4
4
|
form: XFormBase;
|
|
5
5
|
field: string;
|
|
6
6
|
label?: string | undefined;
|
|
7
7
|
readOnly?: boolean | undefined;
|
|
8
|
+
labelStyle?: React.CSSProperties | undefined;
|
|
8
9
|
}) => JSX.Element;
|
|
@@ -10,8 +10,8 @@ var XUtilsConversions_1 = require("./XUtilsConversions");
|
|
|
10
10
|
var XUtilsMetadata_1 = require("./XUtilsMetadata");
|
|
11
11
|
var XUtilsCommon_1 = require("../serverApi/XUtilsCommon");
|
|
12
12
|
var XUtils_1 = require("./XUtils");
|
|
13
|
-
|
|
14
|
-
var _a;
|
|
13
|
+
var XInputDate = function (props) {
|
|
14
|
+
var _a, _b;
|
|
15
15
|
props.form.addField(props.field);
|
|
16
16
|
var xField = XUtilsMetadata_1.XUtilsMetadata.getXFieldByPathStr(props.form.getEntity(), props.field);
|
|
17
17
|
var showTime = (xField.type === 'datetime');
|
|
@@ -49,7 +49,10 @@ exports.XInputDate = function (props) {
|
|
|
49
49
|
}
|
|
50
50
|
// fieldValue zostalo undefined (konvertujeme null -> undefined) - Calendar pozaduje undefined, nechce null
|
|
51
51
|
}
|
|
52
|
+
var labelStyle = (_b = props.labelStyle) !== null && _b !== void 0 ? _b : {};
|
|
53
|
+
XUtils_1.XUtils.addCssPropIfNotExists(labelStyle, { width: XUtils_1.XUtils.FIELD_LABEL_WIDTH });
|
|
52
54
|
return (react_1.default.createElement("div", { className: "field grid" },
|
|
53
|
-
react_1.default.createElement("label", { htmlFor: props.field, className: "col-fixed", style:
|
|
54
|
-
react_1.default.createElement(calendar_1.Calendar, { id: props.field, value: fieldValue, onChange: onValueChange, disabled: readOnly, showIcon: true, dateFormat: XUtilsConversions_1.dateFormatCalendar(), showTime: showTime, showSeconds: showTime, inputClassName: cssClassName, showOnFocus: false })));
|
|
55
|
+
react_1.default.createElement("label", { htmlFor: props.field, className: "col-fixed", style: labelStyle }, label),
|
|
56
|
+
react_1.default.createElement(calendar_1.Calendar, { id: props.field, value: fieldValue, onChange: onValueChange, disabled: readOnly, showIcon: true, dateFormat: (0, XUtilsConversions_1.dateFormatCalendar)(), showTime: showTime, showSeconds: showTime, inputClassName: cssClassName, showOnFocus: false })));
|
|
55
57
|
};
|
|
58
|
+
exports.XInputDate = XInputDate;
|
|
@@ -8,7 +8,7 @@ var XUtilsConversions_1 = require("./XUtilsConversions");
|
|
|
8
8
|
var calendar_1 = require("primereact/calendar");
|
|
9
9
|
var react_1 = __importDefault(require("react"));
|
|
10
10
|
var XUtilsCommon_1 = require("../serverApi/XUtilsCommon");
|
|
11
|
-
|
|
11
|
+
var XInputDateDT = function (props) {
|
|
12
12
|
var showTime = (props.xField.type === 'datetime');
|
|
13
13
|
var cssClassName = showTime ? 'x-input-datetime' : 'x-input-date';
|
|
14
14
|
// ak mame path, field je vzdy readOnly
|
|
@@ -50,5 +50,6 @@ exports.XInputDateDT = function (props) {
|
|
|
50
50
|
// TODO - nefunguje dobre pridavanie noveho riadku - su tam stare neupdatnute hodnoty - este to asi neopravili https://github.com/primefaces/primereact/issues/1277
|
|
51
51
|
// test mame na TestovaciForm
|
|
52
52
|
// appendTo={document.body} appenduje overlay panel na element body - eliminuje problem s overflow (pozri poznamku v XDropdownDTFilter)
|
|
53
|
-
return (react_1.default.createElement(calendar_1.Calendar, { appendTo: document.body, id: props.field, value: fieldValue, onChange: function (e) { return onValueChange(props.field, props.rowData, e.value); }, disabled: readOnly, showIcon: true, dateFormat: XUtilsConversions_1.dateFormatCalendar(), showTime: showTime, showSeconds: showTime, inputClassName: cssClassName, showOnFocus: false }));
|
|
53
|
+
return (react_1.default.createElement(calendar_1.Calendar, { appendTo: document.body, id: props.field, value: fieldValue, onChange: function (e) { return onValueChange(props.field, props.rowData, e.value); }, disabled: readOnly, showIcon: true, dateFormat: (0, XUtilsConversions_1.dateFormatCalendar)(), showTime: showTime, showSeconds: showTime, inputClassName: cssClassName, showOnFocus: false }));
|
|
54
54
|
};
|
|
55
|
+
exports.XInputDateDT = XInputDateDT;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { XFormComponentProps } from "./XFormComponent";
|
|
3
|
-
|
|
3
|
+
import { XInput } from "./XInput";
|
|
4
|
+
export interface XInputDecimalProps extends XFormComponentProps<number> {
|
|
4
5
|
field: string;
|
|
5
6
|
size?: number;
|
|
6
7
|
inputStyle?: React.CSSProperties;
|
|
7
8
|
}
|
|
8
|
-
export declare
|
|
9
|
+
export declare class XInputDecimal extends XInput<number, XInputDecimalProps> {
|
|
10
|
+
constructor(props: XInputDecimalProps);
|
|
11
|
+
getValue(): number | undefined;
|
|
12
|
+
onValueChange(e: any): void;
|
|
13
|
+
onBlur(e: any): void;
|
|
14
|
+
render(): JSX.Element;
|
|
15
|
+
}
|
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
2
28
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
30
|
};
|
|
@@ -7,54 +33,46 @@ exports.XInputDecimal = void 0;
|
|
|
7
33
|
var react_1 = __importDefault(require("react"));
|
|
8
34
|
var inputnumber_1 = require("primereact/inputnumber");
|
|
9
35
|
var XUtilsMetadata_1 = require("./XUtilsMetadata");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var readOnly = XUtils_1.XUtils.isReadOnly(props.field, props.readOnly);
|
|
19
|
-
if (!xField.isNullable && !readOnly) {
|
|
20
|
-
label = XUtils_1.XUtils.markNotNull(label);
|
|
21
|
-
}
|
|
22
|
-
var sizeInput = props.size !== undefined ? props.size : size;
|
|
23
|
-
var inline = (_b = props.inline) !== null && _b !== void 0 ? _b : false;
|
|
24
|
-
var labelStyle = (_c = props.labelStyle) !== null && _c !== void 0 ? _c : {};
|
|
25
|
-
if (!inline) {
|
|
26
|
-
XUtils_1.XUtils.addCssPropIfNotExists(labelStyle, { width: XUtils_1.XUtils.FIELD_LABEL_WIDTH });
|
|
36
|
+
var XInput_1 = require("./XInput");
|
|
37
|
+
var XInputDecimal = /** @class */ (function (_super) {
|
|
38
|
+
__extends(XInputDecimal, _super);
|
|
39
|
+
function XInputDecimal(props) {
|
|
40
|
+
var _this = _super.call(this, props) || this;
|
|
41
|
+
_this.onValueChange = _this.onValueChange.bind(_this);
|
|
42
|
+
_this.onBlur = _this.onBlur.bind(_this);
|
|
43
|
+
return _this;
|
|
27
44
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
var onValueChange = function (e) {
|
|
33
|
-
// z InputNumber prichadza e.value - typ number alebo null
|
|
34
|
-
props.form.onFieldChange(props.field, e.value);
|
|
35
|
-
};
|
|
36
|
-
var fieldValue = undefined;
|
|
37
|
-
var object = props.form.state.object;
|
|
38
|
-
if (object !== null) {
|
|
39
|
-
var objectValue = XUtilsCommon_1.XUtilsCommon.getValueByPath(object, props.field);
|
|
40
|
-
// pre istotu dame na null, null je standard
|
|
41
|
-
//if (objectValue === undefined) {
|
|
42
|
-
// objectValue = null;
|
|
43
|
-
//}
|
|
44
|
-
// TODO - konvertovat null hodnotu na "" (vo funkcii stringAsUI) je dolezite aby sa prejavila zmena na null v modeli
|
|
45
|
-
// - otestovat ci zmena na null funguje dobre -
|
|
46
|
-
//fieldValue = stringAsUI(objectValue);
|
|
45
|
+
XInputDecimal.prototype.getValue = function () {
|
|
46
|
+
var value = undefined;
|
|
47
|
+
var objectValue = this.getValueFromObject();
|
|
47
48
|
// tuto zatial hack, mal by prist number
|
|
48
49
|
if (typeof objectValue === 'string') {
|
|
49
|
-
|
|
50
|
+
value = parseFloat(objectValue);
|
|
50
51
|
}
|
|
51
52
|
else if (typeof objectValue === 'number') {
|
|
52
|
-
|
|
53
|
+
value = objectValue;
|
|
53
54
|
}
|
|
54
|
-
//
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
55
|
+
// value zostalo undefined ak nebol vykonany ziaden if (konvertujeme null -> undefined) - InputNumber pozaduje undefined, nechce null
|
|
56
|
+
return value;
|
|
57
|
+
};
|
|
58
|
+
XInputDecimal.prototype.onValueChange = function (e) {
|
|
59
|
+
// z InputNumber prichadza e.value - typ number alebo null
|
|
60
|
+
this.onValueChangeBase(e.value);
|
|
61
|
+
};
|
|
62
|
+
// nedame do onChange inputu, lebo by sa nas onChange volal po kazdej zmene pismenka
|
|
63
|
+
// ak bude treba, mozme este dorobit metodu "onChange2", ktora sa bude volat po kazdej zmene pismenka (asi iba do XInputText)
|
|
64
|
+
XInputDecimal.prototype.onBlur = function (e) {
|
|
65
|
+
this.callOnChangeFromOnBlur();
|
|
66
|
+
};
|
|
67
|
+
XInputDecimal.prototype.render = function () {
|
|
68
|
+
var _a;
|
|
69
|
+
var _b = XUtilsMetadata_1.XUtilsMetadata.getParamsForInputNumber(this.xField), useGrouping = _b.useGrouping, fractionDigits = _b.fractionDigits, min = _b.min, max = _b.max, size = _b.size;
|
|
70
|
+
var sizeInput = (_a = this.props.size) !== null && _a !== void 0 ? _a : size;
|
|
71
|
+
// note: style overrides size (width of the input according to character count)
|
|
72
|
+
return (react_1.default.createElement("div", { className: "field grid" },
|
|
73
|
+
react_1.default.createElement("label", { htmlFor: this.props.field, className: "col-fixed", style: this.getLabelStyle() }, this.getLabel()),
|
|
74
|
+
react_1.default.createElement(inputnumber_1.InputNumber, __assign({ id: this.props.field, value: this.getValue(), onChange: this.onValueChange, readOnly: this.isReadOnly(), mode: "decimal", locale: "de-DE", useGrouping: useGrouping, minFractionDigits: fractionDigits, maxFractionDigits: fractionDigits, min: min, max: max, size: sizeInput, style: this.props.inputStyle }, this.getClassNameTooltip(), { onBlur: this.onBlur }))));
|
|
75
|
+
};
|
|
76
|
+
return XInputDecimal;
|
|
77
|
+
}(XInput_1.XInput));
|
|
78
|
+
exports.XInputDecimal = XInputDecimal;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { XInputDT, XInputDTProps } from "./XInputDT";
|
|
3
|
+
export interface XInputDecimalDTProps extends XInputDTProps {
|
|
4
|
+
}
|
|
5
|
+
export declare class XInputDecimalDT extends XInputDT<XInputDecimalDTProps> {
|
|
6
|
+
constructor(props: XInputDecimalDTProps);
|
|
7
|
+
getValue(): number | undefined;
|
|
8
|
+
onValueChange(e: any): void;
|
|
9
|
+
onBlur(e: any): void;
|
|
10
|
+
render(): JSX.Element;
|
|
11
|
+
}
|
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
2
28
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
30
|
};
|
|
@@ -7,45 +33,42 @@ exports.XInputDecimalDT = void 0;
|
|
|
7
33
|
var react_1 = __importDefault(require("react"));
|
|
8
34
|
var inputnumber_1 = require("primereact/inputnumber");
|
|
9
35
|
var XUtilsMetadata_1 = require("./XUtilsMetadata");
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
readOnly = props.readOnly !== undefined ? props.readOnly : false;
|
|
36
|
+
var XInputDT_1 = require("./XInputDT");
|
|
37
|
+
var XUtils_1 = require("./XUtils");
|
|
38
|
+
var XInputDecimalDT = /** @class */ (function (_super) {
|
|
39
|
+
__extends(XInputDecimalDT, _super);
|
|
40
|
+
function XInputDecimalDT(props) {
|
|
41
|
+
var _this = _super.call(this, props) || this;
|
|
42
|
+
_this.onValueChange = _this.onValueChange.bind(_this);
|
|
43
|
+
_this.onBlur = _this.onBlur.bind(_this);
|
|
44
|
+
return _this;
|
|
22
45
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
rowData[field] = newValue;
|
|
27
|
-
// kedze "rowData" je sucastou "props.form.state.object", tak nam staci zavolat setState({object: object}), aby sa zmena prejavila
|
|
28
|
-
props.form.onObjectDataChange();
|
|
29
|
-
};
|
|
30
|
-
var fieldValue = undefined;
|
|
31
|
-
// test na undefined je tu koli insertu noveho riadku
|
|
32
|
-
if (props.rowData !== undefined && props.rowData !== null) {
|
|
33
|
-
var rowDataValue = XUtilsCommon_1.XUtilsCommon.getValueByPath(props.rowData, props.field);
|
|
34
|
-
// pre istotu dame na null, null je standard
|
|
35
|
-
//if (rowDataValue === undefined) {
|
|
36
|
-
// rowDataValue = null;
|
|
37
|
-
//}
|
|
38
|
-
// TODO - konvertovat null hodnotu na "" (vo funkcii stringAsUI) je dolezite aby sa prejavila zmena na null v modeli
|
|
39
|
-
// - otestovat ci zmena na null funguje dobre -
|
|
40
|
-
//fieldValue = stringAsUI(rowDataValue);
|
|
46
|
+
XInputDecimalDT.prototype.getValue = function () {
|
|
47
|
+
var value = undefined;
|
|
48
|
+
var rowDataValue = this.getValueFromRowData();
|
|
41
49
|
// tuto zatial hack, mal by prist number
|
|
42
50
|
if (typeof rowDataValue === 'string') {
|
|
43
|
-
|
|
51
|
+
value = parseFloat(rowDataValue);
|
|
44
52
|
}
|
|
45
53
|
else if (typeof rowDataValue === 'number') {
|
|
46
|
-
|
|
54
|
+
value = rowDataValue;
|
|
47
55
|
}
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
// value zostalo undefined ak nebol vykonany ziaden if (konvertujeme null -> undefined) - InputNumber pozaduje undefined, nechce null
|
|
57
|
+
return value;
|
|
58
|
+
};
|
|
59
|
+
XInputDecimalDT.prototype.onValueChange = function (e) {
|
|
60
|
+
// z InputNumber prichadza e.value - typ number alebo null
|
|
61
|
+
this.onValueChangeBase(e.value);
|
|
62
|
+
};
|
|
63
|
+
// nedame do onChange inputu, lebo by sa nas onChange volal po kazdej zmene pismenka
|
|
64
|
+
// ak bude treba, mozme este dorobit metodu "onChange2", ktora sa bude volat po kazdej zmene pismenka (asi iba do XInputText)
|
|
65
|
+
XInputDecimalDT.prototype.onBlur = function (e) {
|
|
66
|
+
this.callOnChangeFromOnBlur();
|
|
67
|
+
};
|
|
68
|
+
XInputDecimalDT.prototype.render = function () {
|
|
69
|
+
var _a = XUtilsMetadata_1.XUtilsMetadata.getParamsForInputNumber(this.xField), useGrouping = _a.useGrouping, fractionDigits = _a.fractionDigits, min = _a.min, max = _a.max;
|
|
70
|
+
return (react_1.default.createElement(inputnumber_1.InputNumber, __assign({ id: this.props.field, value: this.getValue(), onChange: this.onValueChange, readOnly: this.isReadOnly(), mode: "decimal", locale: "de-DE", useGrouping: useGrouping, minFractionDigits: fractionDigits, maxFractionDigits: fractionDigits, min: min, max: max, onBlur: this.onBlur }, XUtils_1.XUtils.addClassName(XUtils_1.XUtils.createErrorProps(this.getError()), "x-input-to-resize"))));
|
|
71
|
+
};
|
|
72
|
+
return XInputDecimalDT;
|
|
73
|
+
}(XInputDT_1.XInputDT));
|
|
74
|
+
exports.XInputDecimalDT = XInputDecimalDT;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export interface XInputTextProps extends XFormComponentProps {
|
|
5
|
-
field: string;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { XInput, XInputProps } from "./XInput";
|
|
3
|
+
export interface XInputTextProps extends XInputProps<string> {
|
|
6
4
|
size?: number;
|
|
7
|
-
inputStyle?: React.CSSProperties;
|
|
8
5
|
}
|
|
9
|
-
export declare class XInputText extends
|
|
10
|
-
protected xField: XField;
|
|
6
|
+
export declare class XInputText extends XInput<string, XInputTextProps> {
|
|
11
7
|
constructor(props: XInputTextProps);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
getValue(): string;
|
|
9
|
+
onValueChange(e: any): void;
|
|
10
|
+
onBlur(e: any): void;
|
|
15
11
|
render(): JSX.Element;
|
|
16
12
|
}
|
|
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
3
3
|
var extendStatics = function (d, b) {
|
|
4
4
|
extendStatics = Object.setPrototypeOf ||
|
|
5
5
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
7
|
return extendStatics(d, b);
|
|
8
8
|
};
|
|
9
9
|
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
10
12
|
extendStatics(d, b);
|
|
11
13
|
function __() { this.constructor = d; }
|
|
12
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -29,68 +31,39 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
29
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
32
|
exports.XInputText = void 0;
|
|
31
33
|
var react_1 = __importDefault(require("react"));
|
|
32
|
-
var XUtilsMetadata_1 = require("./XUtilsMetadata");
|
|
33
|
-
var XUtils_1 = require("./XUtils");
|
|
34
34
|
var XUtilsConversions_1 = require("./XUtilsConversions");
|
|
35
|
-
var XUtilsCommon_1 = require("../serverApi/XUtilsCommon");
|
|
36
35
|
var inputtext_1 = require("primereact/inputtext");
|
|
37
|
-
var
|
|
36
|
+
var XInput_1 = require("./XInput");
|
|
38
37
|
var XInputText = /** @class */ (function (_super) {
|
|
39
38
|
__extends(XInputText, _super);
|
|
40
39
|
function XInputText(props) {
|
|
41
40
|
var _this = _super.call(this, props) || this;
|
|
42
|
-
_this.
|
|
43
|
-
|
|
41
|
+
_this.onValueChange = _this.onValueChange.bind(_this);
|
|
42
|
+
_this.onBlur = _this.onBlur.bind(_this);
|
|
44
43
|
return _this;
|
|
45
44
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return this.props.field;
|
|
51
|
-
}
|
|
52
|
-
return undefined;
|
|
45
|
+
XInputText.prototype.getValue = function () {
|
|
46
|
+
// konvertovat null hodnotu na "" (vo funkcii stringAsUI) je dolezite aby sa prejavila zmena na null v modeli
|
|
47
|
+
var value = this.getValueFromObject();
|
|
48
|
+
return (0, XUtilsConversions_1.stringAsUI)(value);
|
|
53
49
|
};
|
|
54
|
-
XInputText.prototype.
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
XInputText.prototype.onValueChange = function (e) {
|
|
51
|
+
var value = (0, XUtilsConversions_1.stringFromUI)(e.target.value);
|
|
52
|
+
this.onValueChangeBase(value);
|
|
57
53
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
objectValue = XUtilsCommon_1.XUtilsCommon.getValueByPath(object, this.props.field);
|
|
63
|
-
// pre istotu dame na null, null je standard
|
|
64
|
-
if (objectValue === undefined) {
|
|
65
|
-
objectValue = null;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return objectValue;
|
|
54
|
+
// nedame do onChange inputu, lebo by sa nas onChange volal po kazdej zmene pismenka
|
|
55
|
+
// ak bude treba, mozme este dorobit metodu "onChange2", ktora sa bude volat po kazdej zmene pismenka (asi iba do XInputText)
|
|
56
|
+
XInputText.prototype.onBlur = function (e) {
|
|
57
|
+
this.callOnChangeFromOnBlur();
|
|
69
58
|
};
|
|
70
59
|
XInputText.prototype.render = function () {
|
|
71
|
-
var
|
|
72
|
-
var _a
|
|
73
|
-
var props = this.props;
|
|
74
|
-
var xField = this.xField;
|
|
75
|
-
var label = (_a = props.label) !== null && _a !== void 0 ? _a : props.field;
|
|
76
|
-
if (this.checkNotNull()) {
|
|
77
|
-
label = XUtils_1.XUtils.markNotNull(label);
|
|
78
|
-
}
|
|
79
|
-
var readOnly = XUtils_1.XUtils.isReadOnly(props.field, props.readOnly);
|
|
80
|
-
var size = (_b = props.size) !== null && _b !== void 0 ? _b : xField.length;
|
|
81
|
-
var labelStyle = (_c = props.labelStyle) !== null && _c !== void 0 ? _c : { width: XUtils_1.XUtils.FIELD_LABEL_WIDTH };
|
|
82
|
-
var onValueChange = function (e) {
|
|
83
|
-
var value = XUtilsConversions_1.stringFromUI(e.target.value);
|
|
84
|
-
var error = _this.validateOnChange(value);
|
|
85
|
-
props.form.onFieldChange(props.field, value, error);
|
|
86
|
-
};
|
|
87
|
-
// konvertovat null hodnotu na "" (vo funkcii stringAsUI) je dolezite aby sa prejavila zmena na null v modeli
|
|
88
|
-
var fieldValue = XUtilsConversions_1.stringAsUI(this.getValueFromObject());
|
|
60
|
+
var _a;
|
|
61
|
+
var size = (_a = this.props.size) !== null && _a !== void 0 ? _a : this.xField.length;
|
|
89
62
|
// note: style overrides size (width of the input according to character count)
|
|
90
63
|
return (react_1.default.createElement("div", { className: "field grid" },
|
|
91
|
-
react_1.default.createElement("label", { htmlFor: props.field, className: "col-fixed", style:
|
|
92
|
-
react_1.default.createElement(inputtext_1.InputText, __assign({ id: props.field, value:
|
|
64
|
+
react_1.default.createElement("label", { htmlFor: this.props.field, className: "col-fixed", style: this.getLabelStyle() }, this.getLabel()),
|
|
65
|
+
react_1.default.createElement(inputtext_1.InputText, __assign({ id: this.props.field, value: this.getValue(), onChange: this.onValueChange, readOnly: this.isReadOnly(), maxLength: this.xField.length, size: size, style: this.props.inputStyle }, this.getClassNameTooltip(), { onBlur: this.onBlur }))));
|
|
93
66
|
};
|
|
94
67
|
return XInputText;
|
|
95
|
-
}(
|
|
68
|
+
}(XInput_1.XInput));
|
|
96
69
|
exports.XInputText = XInputText;
|
|
@@ -9,7 +9,7 @@ var inputtext_1 = require("primereact/inputtext");
|
|
|
9
9
|
var XUtilsConversions_1 = require("./XUtilsConversions");
|
|
10
10
|
var XUtilsMetadata_1 = require("./XUtilsMetadata");
|
|
11
11
|
var XUtilsCommon_1 = require("../serverApi/XUtilsCommon");
|
|
12
|
-
|
|
12
|
+
var XInputTextDT = function (props) {
|
|
13
13
|
var xField = XUtilsMetadata_1.XUtilsMetadata.getXFieldByPathStr(props.entity, props.field);
|
|
14
14
|
// ak mame path, field je vzdy readOnly
|
|
15
15
|
var readOnly;
|
|
@@ -21,9 +21,8 @@ exports.XInputTextDT = function (props) {
|
|
|
21
21
|
readOnly = props.readOnly !== undefined ? props.readOnly : false;
|
|
22
22
|
}
|
|
23
23
|
var onValueChange = function (field, rowData, newValue) {
|
|
24
|
-
//console.log("onBodyValueChange");
|
|
25
24
|
// zmenime hodnotu v modeli (odtial sa hodnota cita)
|
|
26
|
-
rowData[field] = XUtilsConversions_1.stringFromUI(newValue);
|
|
25
|
+
rowData[field] = (0, XUtilsConversions_1.stringFromUI)(newValue);
|
|
27
26
|
// kedze "rowData" je sucastou "props.form.state.object", tak nam staci zavolat setState({object: object}), aby sa zmena prejavila
|
|
28
27
|
props.form.onObjectDataChange();
|
|
29
28
|
};
|
|
@@ -36,7 +35,8 @@ exports.XInputTextDT = function (props) {
|
|
|
36
35
|
rowDataValue = null;
|
|
37
36
|
}
|
|
38
37
|
// konvertovat null hodnotu na "" (vo funkcii stringAsUI) je dolezite aby sa prejavila zmena na null v modeli (a tiez aby korektne pridal novy riadok)
|
|
39
|
-
fieldValue = XUtilsConversions_1.stringAsUI(rowDataValue);
|
|
38
|
+
fieldValue = (0, XUtilsConversions_1.stringAsUI)(rowDataValue);
|
|
40
39
|
}
|
|
41
40
|
return (react_1.default.createElement(inputtext_1.InputText, { id: props.field, value: fieldValue, onChange: function (e) { return onValueChange(props.field, props.rowData, e.target.value); }, readOnly: readOnly, maxLength: xField.length, className: "x-input-to-resize" }));
|
|
42
41
|
};
|
|
42
|
+
exports.XInputTextDT = XInputTextDT;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { XInput, XInputProps } from "./XInput";
|
|
3
|
+
export interface XInputTextareaProps extends XInputProps<string> {
|
|
4
|
+
rows: number;
|
|
5
|
+
cols?: number | "full";
|
|
6
|
+
labelOnTop?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class XInputTextarea extends XInput<string, XInputTextareaProps> {
|
|
9
|
+
static defaultProps: {
|
|
10
|
+
cols: string;
|
|
11
|
+
labelOnTop: boolean;
|
|
12
|
+
};
|
|
13
|
+
constructor(props: XInputTextareaProps);
|
|
14
|
+
getValue(): string;
|
|
15
|
+
onValueChange(e: any): void;
|
|
16
|
+
getLabelStyle(): React.CSSProperties;
|
|
17
|
+
render(): JSX.Element;
|
|
18
|
+
}
|