@michalrakus/x-react-web-lib 1.30.0 → 1.31.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/lib/components/XFieldSet/XFieldSetBase.d.ts +1 -1
- package/lib/components/XFieldSet/XFieldSetBase.js +14 -5
- package/lib/components/XFormComponentDT.d.ts +8 -1
- package/lib/components/XFormComponentDT.js +19 -0
- package/lib/components/XInputDT.d.ts +2 -0
- package/lib/components/XInputDate.js +0 -1
- package/lib/components/locale/x-en.json +1 -0
- package/package.json +1 -1
|
@@ -73,7 +73,7 @@ export interface XFieldSetValues {
|
|
|
73
73
|
}
|
|
74
74
|
export type XFieldXFieldMetaMap = Map<string, XFieldMeta>;
|
|
75
75
|
export declare class XFieldSetBase {
|
|
76
|
-
static createXFieldXFieldMetaMap(xFieldSetMeta: XFieldSetMeta): XFieldXFieldMetaMap;
|
|
76
|
+
static createXFieldXFieldMetaMap(xFieldSetMeta: XFieldSetMeta, filterFromParent?: string): XFieldXFieldMetaMap;
|
|
77
77
|
static xFieldSetValuesAsUI(xFieldSetValues: XFieldSetValues, xFieldXFieldMetaMap: XFieldXFieldMetaMap): string;
|
|
78
78
|
private static createMapForXFieldMeta;
|
|
79
79
|
}
|
|
@@ -64,9 +64,11 @@ var XFieldSetBase = /** @class */ (function () {
|
|
|
64
64
|
function XFieldSetBase() {
|
|
65
65
|
}
|
|
66
66
|
// api metoda na vytvorenie Map instancie, ktora sluzi na rychle najdenie prislusneho XFieldMeta podla nazvu fieldu
|
|
67
|
-
|
|
67
|
+
// ak je zadany filterFromParent, tak vracia len children/subchildren/... fieldu s field = filterFromParent
|
|
68
|
+
// (filterFromParent je casto groupField)
|
|
69
|
+
XFieldSetBase.createXFieldXFieldMetaMap = function (xFieldSetMeta, filterFromParent) {
|
|
68
70
|
var xFieldXFieldMetaMap = new Map();
|
|
69
|
-
XFieldSetBase.createMapForXFieldMeta(xFieldSetMeta.xFieldMetaRoot, xFieldXFieldMetaMap);
|
|
71
|
+
XFieldSetBase.createMapForXFieldMeta(xFieldSetMeta.xFieldMetaRoot, filterFromParent, xFieldXFieldMetaMap);
|
|
70
72
|
return xFieldXFieldMetaMap;
|
|
71
73
|
};
|
|
72
74
|
// api metoda na vyrenderovanie field set atributu
|
|
@@ -111,14 +113,21 @@ var XFieldSetBase = /** @class */ (function () {
|
|
|
111
113
|
}
|
|
112
114
|
return valueUIList.join(", ");
|
|
113
115
|
};
|
|
114
|
-
XFieldSetBase.createMapForXFieldMeta = function (xFieldMeta, xFieldXFieldMetaMap) {
|
|
116
|
+
XFieldSetBase.createMapForXFieldMeta = function (xFieldMeta, filterFromParent, xFieldXFieldMetaMap) {
|
|
115
117
|
var e_2, _a;
|
|
116
|
-
|
|
118
|
+
if (filterFromParent === undefined) {
|
|
119
|
+
// no filter is used
|
|
120
|
+
xFieldXFieldMetaMap.set(xFieldMeta.field, xFieldMeta);
|
|
121
|
+
}
|
|
122
|
+
else if (filterFromParent === xFieldMeta.field) {
|
|
123
|
+
// the searched parent field has been found, all his children/subchildren/... will be added to the list (we remove the filter)
|
|
124
|
+
filterFromParent = undefined;
|
|
125
|
+
}
|
|
117
126
|
if (xFieldMeta.xFieldMetaList) {
|
|
118
127
|
try {
|
|
119
128
|
for (var _b = __values(xFieldMeta.xFieldMetaList), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
120
129
|
var insideXFieldMeta = _c.value;
|
|
121
|
-
XFieldSetBase.createMapForXFieldMeta(insideXFieldMeta, xFieldXFieldMetaMap);
|
|
130
|
+
XFieldSetBase.createMapForXFieldMeta(insideXFieldMeta, filterFromParent, xFieldXFieldMetaMap);
|
|
122
131
|
}
|
|
123
132
|
}
|
|
124
133
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { XFormBase } from "./XFormBase";
|
|
2
|
-
import { Component } from "react";
|
|
2
|
+
import React, { Component } from "react";
|
|
3
3
|
import { OperationType } from "./XUtils";
|
|
4
4
|
import { XError } from "./XErrors";
|
|
5
5
|
import { XCustomFilter } from "../serverApi/FindParam";
|
|
@@ -10,6 +10,11 @@ export interface XFormComponentDTProps {
|
|
|
10
10
|
rowData: any;
|
|
11
11
|
readOnly?: XTableFieldReadOnlyProp;
|
|
12
12
|
onChange?: XTableFieldOnChange;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
label?: string;
|
|
15
|
+
tooltip?: string;
|
|
16
|
+
desc?: string;
|
|
17
|
+
labelStyle?: React.CSSProperties;
|
|
13
18
|
}
|
|
14
19
|
export declare abstract class XFormComponentDT<P extends XFormComponentDTProps> extends Component<P> {
|
|
15
20
|
private valueChanged;
|
|
@@ -19,6 +24,8 @@ export declare abstract class XFormComponentDT<P extends XFormComponentDTProps>
|
|
|
19
24
|
onValueChangeBase(value: any, onChange?: XTableFieldOnChange, assocObjectChange?: OperationType): void;
|
|
20
25
|
abstract isNotNull(): boolean;
|
|
21
26
|
isReadOnly(): boolean;
|
|
27
|
+
getLabel(): string | undefined;
|
|
28
|
+
getLabelStyle(): React.CSSProperties;
|
|
22
29
|
validate(): {
|
|
23
30
|
field: string;
|
|
24
31
|
xError: XError;
|
|
@@ -78,6 +78,25 @@ var XFormComponentDT = /** @class */ (function (_super) {
|
|
|
78
78
|
}
|
|
79
79
|
return readOnly;
|
|
80
80
|
};
|
|
81
|
+
// *********** label support - len pre ne-DT componenty pouzivany ************
|
|
82
|
+
// ak je label undefined, label element sa nevykresli
|
|
83
|
+
XFormComponentDT.prototype.getLabel = function () {
|
|
84
|
+
var label = this.props.label;
|
|
85
|
+
if (label !== undefined) {
|
|
86
|
+
// test na readOnly je tu hlavne koli tomu aby sme nemali * pri ID atribute, ktory sa pri inserte generuje az pri zapise do DB
|
|
87
|
+
if (this.isNotNull() && !this.isReadOnly()) {
|
|
88
|
+
label = XUtils_1.XUtils.markNotNull(label);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return label;
|
|
92
|
+
};
|
|
93
|
+
XFormComponentDT.prototype.getLabelStyle = function () {
|
|
94
|
+
var _a;
|
|
95
|
+
var labelStyle = (_a = this.props.labelStyle) !== null && _a !== void 0 ? _a : {};
|
|
96
|
+
// this.props.inline nepouzivame, lebo je to asi zombie
|
|
97
|
+
XUtils_1.XUtils.addCssPropIfNotExists(labelStyle, { width: XUtils_1.XUtils.FIELD_LABEL_WIDTH });
|
|
98
|
+
return labelStyle;
|
|
99
|
+
};
|
|
81
100
|
// *********** validation support ************
|
|
82
101
|
// volane po kliknuti na Save
|
|
83
102
|
// vrati (field, XError) ak nezbehne "field validacia", ak zbehne, vrati undefined
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { XField } from "../serverApi/XEntityMetadata";
|
|
2
2
|
import { XFormComponentDT, XFormComponentDTProps } from "./XFormComponentDT";
|
|
3
|
+
import React from "react";
|
|
3
4
|
export interface XInputDTProps extends XFormComponentDTProps {
|
|
4
5
|
field: string;
|
|
6
|
+
inputStyle?: React.CSSProperties;
|
|
5
7
|
}
|
|
6
8
|
export declare abstract class XInputDT<P extends XInputDTProps> extends XFormComponentDT<P> {
|
|
7
9
|
protected xField: XField;
|
|
@@ -40,7 +40,6 @@ var XInputDate = /** @class */ (function (_super) {
|
|
|
40
40
|
};
|
|
41
41
|
XInputDate.prototype.render = function () {
|
|
42
42
|
var _a;
|
|
43
|
-
// note: style overrides size (width of the input according to character count)
|
|
44
43
|
return (react_1.default.createElement("div", { className: "field grid" },
|
|
45
44
|
react_1.default.createElement("label", { htmlFor: this.props.field, className: "col-fixed", style: this.getLabelStyle() }, this.getLabel()),
|
|
46
45
|
react_1.default.createElement(XCalendar_1.XCalendar, { id: this.props.field, value: this.getValue(), onChange: this.onValueChange, readOnly: this.isReadOnly(), error: this.getError(), scale: (_a = this.props.scale) !== null && _a !== void 0 ? _a : this.xField.scale, datetime: this.xField.type === 'datetime' })));
|