cx 24.10.6 → 24.10.8
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 +22 -7
- package/dist/manifest.js +691 -691
- package/dist/ui.js +44 -7
- package/package.json +1 -1
- package/src/charts/axis/TimeAxis.js +15 -6
- package/src/charts/helpers/PointReducer.js +5 -1
- package/src/ui/Instance.js +614 -610
- package/src/ui/layout/ContentPlaceholder.d.ts +19 -18
- package/src/ui/layout/ContentPlaceholder.js +105 -80
- package/src/ui/layout/ContentPlaceholder.spec.js +579 -368
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import * as Cx from
|
|
2
|
-
import {RenderingContext} from
|
|
3
|
-
|
|
4
|
-
interface ContentPlaceholderProps extends Cx.PureContainerProps {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import * as Cx from "../../core";
|
|
2
|
+
import { RenderingContext } from "../RenderingContext";
|
|
3
|
+
|
|
4
|
+
interface ContentPlaceholderProps extends Cx.PureContainerProps {
|
|
5
|
+
name?: Cx.StringProp;
|
|
6
|
+
|
|
7
|
+
scoped?: boolean;
|
|
8
|
+
|
|
9
|
+
/* Set to true to allow all registered content elements to render inside the placeholder. Otherwise only one element is rendered. */
|
|
10
|
+
allowMultiple?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class ContentPlaceholder extends Cx.Widget<ContentPlaceholderProps> {}
|
|
14
|
+
|
|
15
|
+
interface ContentPlaceholderScopeProps extends Cx.PureContainerProps {
|
|
16
|
+
name?: string | string[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class ContentPlaceholderScope extends Cx.Widget<ContentPlaceholderScopeProps> {}
|
|
@@ -1,80 +1,105 @@
|
|
|
1
|
-
import {Widget} from
|
|
2
|
-
import {PureContainer} from
|
|
3
|
-
import {isString} from "../../util/isString";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
declareData() {
|
|
8
|
-
super.declareData(...arguments, {
|
|
9
|
-
name: undefined
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
explore(context, instance) {
|
|
14
|
-
instance.content = null;
|
|
15
|
-
let {data} = instance;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (
|
|
36
|
-
instance.
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
1
|
+
import { Widget } from "../Widget";
|
|
2
|
+
import { PureContainer } from "../PureContainer";
|
|
3
|
+
import { isString } from "../../util/isString";
|
|
4
|
+
import { isNonEmptyArray } from "../../util/isNonEmptyArray";
|
|
5
|
+
|
|
6
|
+
export class ContentPlaceholder extends PureContainer {
|
|
7
|
+
declareData() {
|
|
8
|
+
super.declareData(...arguments, {
|
|
9
|
+
name: undefined,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
explore(context, instance) {
|
|
14
|
+
instance.content = null;
|
|
15
|
+
let { data } = instance;
|
|
16
|
+
|
|
17
|
+
if (this.allowMultiple) {
|
|
18
|
+
const contentList = context.contentList && context.contentList[data.name];
|
|
19
|
+
if (isNonEmptyArray(contentList) && !this.scoped)
|
|
20
|
+
for (let i = 0; i < contentList.length; i++) this.setContent(context, instance, contentList[i]);
|
|
21
|
+
|
|
22
|
+
// in multi mode register a callback to allow for more entries to be added
|
|
23
|
+
context.pushNamedValue("contentPlaceholder", data.name, (content) => {
|
|
24
|
+
this.setContent(context, instance, content);
|
|
25
|
+
});
|
|
26
|
+
} else {
|
|
27
|
+
const content = context.content && context.content[data.name];
|
|
28
|
+
if (content && !this.scoped) this.setContent(context, instance, content);
|
|
29
|
+
else
|
|
30
|
+
context.pushNamedValue("contentPlaceholder", data.name, (content) => {
|
|
31
|
+
this.setContent(context, instance, content);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (this.scoped)
|
|
36
|
+
instance.unregisterContentPlaceholder = () => {
|
|
37
|
+
context.popNamedValue("contentPlaceholder", data.name);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
super.explore(context, instance);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
prepare(context, instance) {
|
|
44
|
+
let { content } = instance;
|
|
45
|
+
if (this.allowMultiple) {
|
|
46
|
+
let contentId = "";
|
|
47
|
+
let shouldUpdate = false;
|
|
48
|
+
if (content) {
|
|
49
|
+
for (let i = 0; i < content.length; i++) {
|
|
50
|
+
let c = content[i];
|
|
51
|
+
contentId += c.id + "+";
|
|
52
|
+
shouldUpdate = shouldUpdate || c.shouldUpdate;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (instance.cache("content", contentId) || shouldUpdate) instance.markShouldUpdate(context);
|
|
56
|
+
} else if (instance.cache("content", content) || (content && content.shouldUpdate))
|
|
57
|
+
instance.markShouldUpdate(context);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
setContent(context, instance, content) {
|
|
61
|
+
if (this.allowMultiple) {
|
|
62
|
+
if (instance.content == null) instance.content = [];
|
|
63
|
+
instance.content.push(content);
|
|
64
|
+
} else instance.content = content;
|
|
65
|
+
content.contentPlaceholder = instance;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
render(context, instance, key) {
|
|
69
|
+
const { content } = instance;
|
|
70
|
+
if (!content) return super.render(context, instance, key);
|
|
71
|
+
if (this.allowMultiple) return content.map((x) => x.contentVDOM);
|
|
72
|
+
return content.contentVDOM;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
ContentPlaceholder.prototype.name = "body";
|
|
77
|
+
ContentPlaceholder.prototype.scoped = false;
|
|
78
|
+
ContentPlaceholder.prototype.allowMultiple = false;
|
|
79
|
+
|
|
80
|
+
Widget.alias("content-placeholder", ContentPlaceholder);
|
|
81
|
+
|
|
82
|
+
export class ContentPlaceholderScope extends PureContainer {
|
|
83
|
+
init() {
|
|
84
|
+
super.init();
|
|
85
|
+
|
|
86
|
+
if (isString(this.name)) this.name = [this.name];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
explore(context, instance) {
|
|
90
|
+
this.name.forEach((name) => {
|
|
91
|
+
context.pushNamedValue("contentPlaceholder", name, null);
|
|
92
|
+
context.pushNamedValue("content", name, null);
|
|
93
|
+
context.pushNamedValue("contentList", name, []);
|
|
94
|
+
});
|
|
95
|
+
super.explore(context, instance);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
exploreCleanup(context, instance) {
|
|
99
|
+
this.name.forEach((name) => {
|
|
100
|
+
context.popNamedValue("contentPlaceholder", name);
|
|
101
|
+
context.popNamedValue("content", name);
|
|
102
|
+
context.popNamedValue("contentList", name);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|