cx 23.5.1 → 23.6.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/dist/charts.js +39 -24
- package/dist/manifest.js +608 -608
- package/dist/widgets.js +6 -2
- package/package.json +1 -1
- package/src/charts/axis/Axis.d.ts +96 -82
- package/src/charts/axis/Axis.js +252 -222
- package/src/data/Grouper.spec.js +34 -15
- package/src/widgets/form/Field.js +15 -8
- package/src/widgets/form/Label.js +88 -86
- package/src/widgets/form/ValidationGroup.d.ts +3 -0
- package/src/widgets/form/ValidationGroup.js +3 -0
|
@@ -1,86 +1,88 @@
|
|
|
1
|
-
import { Widget, VDOM } from "../../ui/Widget";
|
|
2
|
-
import { HtmlElement } from "../HtmlElement";
|
|
3
|
-
import { FocusManager } from "../../ui/FocusManager";
|
|
4
|
-
import { isArray } from "../../util/isArray";
|
|
5
|
-
import { coalesce } from "../../util/coalesce";
|
|
6
|
-
|
|
7
|
-
export class Label extends HtmlElement {
|
|
8
|
-
declareData() {
|
|
9
|
-
super.declareData(...arguments, {
|
|
10
|
-
required: undefined,
|
|
11
|
-
disabled: undefined,
|
|
12
|
-
htmlFor: undefined,
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
prepareData(context, instance) {
|
|
17
|
-
let { data } = instance;
|
|
18
|
-
data.stateMods = {
|
|
19
|
-
...data.stateMods,
|
|
20
|
-
disabled: data.disabled,
|
|
21
|
-
};
|
|
22
|
-
data._disabled = data.disabled;
|
|
23
|
-
super.prepareData(context, instance);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
explore(context, instance) {
|
|
27
|
-
let { data } = instance;
|
|
28
|
-
|
|
29
|
-
if (!data.htmlFor) data.htmlFor = context.lastFieldId;
|
|
30
|
-
|
|
31
|
-
data.disabled = data.stateMods.disabled = coalesce(
|
|
32
|
-
context.parentStrict ? context.parentDisabled : null,
|
|
33
|
-
data._disabled,
|
|
34
|
-
context.parentDisabled
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
props.children.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
Label.prototype.
|
|
1
|
+
import { Widget, VDOM } from "../../ui/Widget";
|
|
2
|
+
import { HtmlElement } from "../HtmlElement";
|
|
3
|
+
import { FocusManager } from "../../ui/FocusManager";
|
|
4
|
+
import { isArray } from "../../util/isArray";
|
|
5
|
+
import { coalesce } from "../../util/coalesce";
|
|
6
|
+
|
|
7
|
+
export class Label extends HtmlElement {
|
|
8
|
+
declareData() {
|
|
9
|
+
super.declareData(...arguments, {
|
|
10
|
+
required: undefined,
|
|
11
|
+
disabled: undefined,
|
|
12
|
+
htmlFor: undefined,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
prepareData(context, instance) {
|
|
17
|
+
let { data } = instance;
|
|
18
|
+
data.stateMods = {
|
|
19
|
+
...data.stateMods,
|
|
20
|
+
disabled: data.disabled,
|
|
21
|
+
};
|
|
22
|
+
data._disabled = data.disabled;
|
|
23
|
+
super.prepareData(context, instance);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
explore(context, instance) {
|
|
27
|
+
let { data } = instance;
|
|
28
|
+
|
|
29
|
+
if (!data.htmlFor) data.htmlFor = context.lastFieldId;
|
|
30
|
+
|
|
31
|
+
data.disabled = data.stateMods.disabled = coalesce(
|
|
32
|
+
context.parentStrict ? context.parentDisabled : null,
|
|
33
|
+
data._disabled,
|
|
34
|
+
context.parentDisabled
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
data.asterisk = context.parentAsterisk || this.asterisk;
|
|
38
|
+
|
|
39
|
+
if (instance.cache("disabled", data.disabled) || instance.cache("asterisk", data.asterisk)) {
|
|
40
|
+
instance.markShouldUpdate(context);
|
|
41
|
+
this.prepareCSS(context, instance);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
super.explore(context, instance);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
isValidHtmlAttribute(attrName) {
|
|
48
|
+
switch (attrName) {
|
|
49
|
+
case "asterisk":
|
|
50
|
+
case "required":
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
return super.isValidHtmlAttribute(attrName);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
attachProps(context, instance, props) {
|
|
57
|
+
super.attachProps(context, instance, props);
|
|
58
|
+
|
|
59
|
+
let { data } = instance;
|
|
60
|
+
|
|
61
|
+
if (data.htmlFor) {
|
|
62
|
+
props.htmlFor = data.htmlFor;
|
|
63
|
+
|
|
64
|
+
if (!props.onClick)
|
|
65
|
+
props.onClick = () => {
|
|
66
|
+
//additional focus for LookupFields which are not input based
|
|
67
|
+
let el = document.getElementById(instance.data.htmlFor);
|
|
68
|
+
if (el) FocusManager.focusFirst(el);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!props.id && data.htmlFor) props.id = `${data.htmlFor}-label`;
|
|
73
|
+
|
|
74
|
+
if (data.required && data.asterisk) {
|
|
75
|
+
if (!isArray(props.children)) props.children = [props.children];
|
|
76
|
+
props.children.push(" ");
|
|
77
|
+
props.children.push(
|
|
78
|
+
<span key="asterisk" className={this.CSS.element(this.baseClass, "asterisk")}>
|
|
79
|
+
*
|
|
80
|
+
</span>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
Label.prototype.baseClass = "label";
|
|
87
|
+
Label.prototype.tag = "label";
|
|
88
|
+
Label.prototype.asterisk = false;
|
|
@@ -33,6 +33,9 @@ export interface ValidationGroupProps extends Cx.PureContainerProps {
|
|
|
33
33
|
|
|
34
34
|
/** Set to `true` to force children to respect disabled, readOnly, viewMode and visited flags set on the group level. */
|
|
35
35
|
strict?: Cx.BooleanProp;
|
|
36
|
+
|
|
37
|
+
/** Set to `true` to add red asterisk for all required fields inside the group. */
|
|
38
|
+
asterisk?: boolean;
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
export class ValidationGroup extends Cx.Widget<ValidationGroupProps> {}
|
|
@@ -18,6 +18,7 @@ export class ValidationGroup extends PureContainer {
|
|
|
18
18
|
isolated: undefined,
|
|
19
19
|
visited: undefined,
|
|
20
20
|
strict: undefined,
|
|
21
|
+
asterisk: undefined,
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -34,6 +35,7 @@ export class ValidationGroup extends PureContainer {
|
|
|
34
35
|
context.push("parentViewMode", coalesce(instance.data.viewMode, context.parentViewMode));
|
|
35
36
|
context.push("parentTabOnEnterKey", coalesce(instance.data.tabOnEnterKey, context.parentTabOnEnterKey));
|
|
36
37
|
context.push("parentVisited", coalesce(instance.data.visited, context.parentVisited));
|
|
38
|
+
context.push("parentAsterisk", coalesce(instance.data.asterisk, context.parentAsterisk));
|
|
37
39
|
context.push("validation", instance.validation);
|
|
38
40
|
|
|
39
41
|
super.explore(context, instance);
|
|
@@ -47,6 +49,7 @@ export class ValidationGroup extends PureContainer {
|
|
|
47
49
|
context.pop("parentViewMode");
|
|
48
50
|
context.pop("parentTabOnEnterKey");
|
|
49
51
|
context.pop("parentStrict");
|
|
52
|
+
context.pop("parentAsterisk");
|
|
50
53
|
|
|
51
54
|
instance.valid = instance.validation.errors.length == 0;
|
|
52
55
|
if (!instance.valid && !this.isolated && context.validation)
|