cx 24.9.4 → 24.10.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.
Files changed (71) hide show
  1. package/dist/charts.css +19 -16
  2. package/dist/charts.js +127 -94
  3. package/dist/data.js +29 -26
  4. package/dist/manifest.js +692 -692
  5. package/dist/svg.js +56 -59
  6. package/dist/ui.js +52 -51
  7. package/dist/widgets.js +44 -40
  8. package/package.json +32 -32
  9. package/src/charts/Legend.js +49 -33
  10. package/src/charts/Legend.scss +40 -42
  11. package/src/charts/LegendEntry.js +120 -121
  12. package/src/charts/LegendEntry.scss +27 -31
  13. package/src/charts/PieLabel.js +71 -71
  14. package/src/charts/axis/NumericAxis.js +347 -347
  15. package/src/charts/axis/Stack.js +55 -55
  16. package/src/charts/helpers/PointReducer.js +43 -43
  17. package/src/charts/helpers/SnapPointFinder.js +69 -69
  18. package/src/data/Binding.spec.js +69 -69
  19. package/src/data/Expression.js +221 -221
  20. package/src/data/Expression.spec.js +184 -184
  21. package/src/data/StringTemplate.spec.js +105 -105
  22. package/src/data/getAccessor.spec.js +11 -11
  23. package/src/index.scss +6 -6
  24. package/src/svg/Text.d.ts +40 -40
  25. package/src/ui/Culture.d.ts +55 -55
  26. package/src/ui/Culture.js +139 -139
  27. package/src/ui/FocusManager.js +171 -171
  28. package/src/ui/Instance.d.ts +72 -72
  29. package/src/ui/VDOM.d.ts +12 -12
  30. package/src/ui/app/startAppLoop.js +58 -58
  31. package/src/ui/index.d.ts +42 -42
  32. package/src/ui/layout/LabelsTopLayout.js +134 -134
  33. package/src/util/Console.d.ts +4 -4
  34. package/src/util/index.d.ts +51 -51
  35. package/src/util/index.js +54 -54
  36. package/src/util/isValidIdentifierName.d.ts +1 -1
  37. package/src/util/isValidIdentifierName.js +5 -5
  38. package/src/util/isValidIdentifierName.spec.js +33 -33
  39. package/src/util/scss/add-rules.scss +38 -38
  40. package/src/widgets/CxCredit.scss +37 -37
  41. package/src/widgets/HighlightedSearchText.js +36 -36
  42. package/src/widgets/HighlightedSearchText.scss +18 -18
  43. package/src/widgets/List.scss +91 -91
  44. package/src/widgets/drag-drop/DropZone.js +214 -214
  45. package/src/widgets/form/Calendar.scss +196 -196
  46. package/src/widgets/form/ColorField.js +397 -397
  47. package/src/widgets/form/ColorPicker.scss +283 -283
  48. package/src/widgets/form/DateTimeField.js +573 -573
  49. package/src/widgets/form/LookupField.d.ts +179 -179
  50. package/src/widgets/form/MonthField.js +516 -516
  51. package/src/widgets/form/MonthPicker.scss +118 -118
  52. package/src/widgets/form/NumberField.js +459 -459
  53. package/src/widgets/form/NumberField.scss +61 -61
  54. package/src/widgets/form/Select.scss +99 -99
  55. package/src/widgets/form/Slider.scss +118 -118
  56. package/src/widgets/form/Switch.scss +140 -140
  57. package/src/widgets/form/TextArea.scss +43 -43
  58. package/src/widgets/form/TextField.js +290 -290
  59. package/src/widgets/form/TextField.scss +55 -55
  60. package/src/widgets/form/UploadButton.d.ts +34 -34
  61. package/src/widgets/form/variables.scss +353 -353
  62. package/src/widgets/grid/TreeNode.scss +88 -88
  63. package/src/widgets/grid/variables.scss +88 -88
  64. package/src/widgets/nav/Menu.scss +74 -74
  65. package/src/widgets/overlay/Dropdown.js +612 -612
  66. package/src/widgets/overlay/FlyweightTooltipTracker.js +39 -39
  67. package/src/widgets/overlay/Tooltip.js +300 -300
  68. package/src/widgets/overlay/Window.js +196 -196
  69. package/src/widgets/overlay/captureMouse.js +124 -124
  70. package/src/widgets/overlay/variables.scss +83 -83
  71. package/src/widgets/variables.scss +144 -144
@@ -1,42 +1,40 @@
1
-
2
- @mixin cx-legend(
3
- $name: 'legend',
4
- $besm: $cx-besm
5
- ) {
6
- $block: map-get($besm, block);
7
- $element: map-get($besm, element);
8
- $state: map-get($besm, state);
9
-
10
- .#{$block}#{$name} {
11
- text-align: center;
12
- }
13
-
14
- .#{$element}#{$name}-entry {
15
- display: inline-block;
16
- padding: 5px 5px 5px 30px;
17
- font-size: smaller;
18
- position: relative;
19
- margin: 5px;
20
- box-sizing: border-box;
21
- cursor: pointer;
22
-
23
- .#{$block}#{$name}.#{$state}vertical & {
24
- display: block;
25
- text-align: left;
26
- }
27
- }
28
-
29
- .#{$element}#{$name}-svg {
30
- position: absolute;
31
- left: 5px;
32
- top: 50%;
33
- }
34
-
35
- .#{$element}#{$name}-shape {
36
- fill: rgba(128, 128, 128, 0.1);
37
- }
38
- }
39
-
40
- @if (cx-should-include('cx/charts/Legend')) {
41
- @include cx-legend();
42
- }
1
+ @mixin cx-legend($name: "legend", $besm: $cx-besm) {
2
+ $block: map-get($besm, block);
3
+ $element: map-get($besm, element);
4
+ $state: map-get($besm, state);
5
+
6
+ .#{$block}#{$name} {
7
+ display: flex;
8
+ justify-content: center;
9
+ align-items: flex-start;
10
+ flex-wrap: wrap;
11
+ gap: 5px 10px;
12
+ }
13
+
14
+ .#{$block}#{$name}.#{$state}vertical {
15
+ flex-direction: column;
16
+ }
17
+
18
+ .#{$element}#{$name}-entry {
19
+ display: flex;
20
+ align-items: center;
21
+ padding: 5px;
22
+ gap: 5px;
23
+ font-size: smaller;
24
+ position: relative;
25
+ box-sizing: border-box;
26
+ cursor: pointer;
27
+ }
28
+
29
+ .#{$element}#{$name}-svg {
30
+ flex-shrink: 0;
31
+ }
32
+
33
+ .#{$element}#{$name}-shape {
34
+ fill: rgba(128, 128, 128, 0.1);
35
+ }
36
+ }
37
+
38
+ @if (cx-should-include("cx/charts/Legend")) {
39
+ @include cx-legend();
40
+ }
@@ -1,121 +1,120 @@
1
- import { Widget, VDOM } from "../ui/Widget";
2
- import { HtmlElement } from "../widgets/HtmlElement";
3
- import { getShape } from "./shapes";
4
- import { Selection } from "../ui/selection/Selection";
5
- import { stopPropagation } from "../util/eventCallbacks";
6
- import { isUndefined } from "../util/isUndefined";
7
-
8
- export class LegendEntry extends HtmlElement {
9
- init() {
10
- this.selection = Selection.create(this.selection);
11
- super.init();
12
- }
13
-
14
- declareData() {
15
- var selection = this.selection.configureWidget(this);
16
-
17
- super.declareData(...arguments, selection, {
18
- selected: undefined,
19
- shape: undefined,
20
- colorIndex: undefined,
21
- colorMap: undefined,
22
- colorName: undefined,
23
- name: undefined,
24
- active: true,
25
- size: undefined,
26
- rx: undefined,
27
- ry: undefined
28
- });
29
- }
30
-
31
- prepareData(context, instance) {
32
- let { data } = instance;
33
-
34
- if (data.name && !data.colorName) data.colorName = data.name;
35
-
36
- super.prepareData(context, instance);
37
- }
38
-
39
- explore(context, instance) {
40
- var { data } = instance;
41
- instance.colorMap = data.colorMap && context.getColorMap && context.getColorMap(data.colorMap);
42
- if (instance.colorMap && data.colorName) instance.colorMap.acknowledge(data.colorName);
43
- super.explore(context, instance);
44
- }
45
-
46
- prepare(context, instance) {
47
- var { data, colorMap } = instance;
48
-
49
- if (colorMap && data.colorName) {
50
- data.colorIndex = colorMap.map(data.colorName);
51
- if (instance.cache("colorIndex", data.colorIndex)) instance.markShouldUpdate(context);
52
- }
53
- }
54
-
55
- attachProps(context, instance, props) {
56
- var shape = this.renderShape(instance);
57
- props.children = [shape, props.children];
58
- props.onMouseDown = stopPropagation;
59
- props.onClick = (e) => {
60
- this.handleClick(e, instance);
61
- };
62
-
63
- delete props.active;
64
- delete props.selection;
65
- delete props.colorMap;
66
- delete props.colorIndex;
67
- delete props.shape;
68
- delete props.name;
69
- delete props.selected;
70
- delete props.svgSize;
71
- }
72
-
73
- handleClick(e, instance) {
74
- if (this.onClick && instance.invoke("onClick", e, instance) === false) return;
75
-
76
- e.stopPropagation();
77
-
78
- var any = this.legendAction == "auto";
79
-
80
- if (any || this.legendAction == "toggle") if (instance.set("active", !instance.data.active)) return;
81
-
82
- if ((any || this.legendAction == "select") && !this.selection.isDummy) this.selection.selectInstance(instance);
83
- }
84
-
85
- renderShape(instance) {
86
- var entry = instance.data;
87
- var className = this.CSS.element(this.baseClass, "shape", {
88
- disabled: entry.disabled,
89
- selected: entry.selected || this.selection.isInstanceSelected(instance),
90
- [`color-${entry.colorIndex}`]: entry.colorIndex != null && (isUndefined(entry.active) || entry.active),
91
- });
92
- var shape = getShape(entry.shape || "square");
93
-
94
- return (
95
- <svg
96
- key="svg"
97
- className={this.CSS.element(this.baseClass, "svg")}
98
- style={{
99
- width: `${this.svgSize}px`,
100
- height: `${this.svgSize}px`,
101
- marginTop: `${-this.svgSize / 2}px`,
102
- }}
103
- >
104
- {shape(this.svgSize / 2, this.svgSize / 2, entry.size, {
105
- style: entry.style,
106
- className: className,
107
- rx: entry.rx,
108
- ry: entry.ry
109
- })}
110
- </svg>
111
- );
112
- }
113
- }
114
-
115
- LegendEntry.prototype.baseClass = "legendentry";
116
- LegendEntry.prototype.shape = "square";
117
- LegendEntry.prototype.legendAction = "auto";
118
- LegendEntry.prototype.size = 18;
119
- LegendEntry.prototype.svgSize = 20;
120
-
121
- Widget.alias("legend-entry", LegendEntry);
1
+ import { Widget, VDOM } from "../ui/Widget";
2
+ import { getShape } from "./shapes";
3
+ import { Selection } from "../ui/selection/Selection";
4
+ import { stopPropagation } from "../util/eventCallbacks";
5
+ import { isUndefined } from "../util/isUndefined";
6
+ import { Container } from "../ui/Container";
7
+
8
+ export class LegendEntry extends Container {
9
+ init() {
10
+ this.selection = Selection.create(this.selection);
11
+ super.init();
12
+ }
13
+
14
+ declareData() {
15
+ var selection = this.selection.configureWidget(this);
16
+
17
+ super.declareData(...arguments, selection, {
18
+ selected: undefined,
19
+ shape: undefined,
20
+ colorIndex: undefined,
21
+ colorMap: undefined,
22
+ colorName: undefined,
23
+ name: undefined,
24
+ active: true,
25
+ size: undefined,
26
+ rx: undefined,
27
+ ry: undefined,
28
+ text: undefined,
29
+ });
30
+ }
31
+
32
+ prepareData(context, instance) {
33
+ let { data } = instance;
34
+
35
+ if (data.name && !data.colorName) data.colorName = data.name;
36
+
37
+ super.prepareData(context, instance);
38
+ }
39
+
40
+ explore(context, instance) {
41
+ var { data } = instance;
42
+ instance.colorMap = data.colorMap && context.getColorMap && context.getColorMap(data.colorMap);
43
+ if (instance.colorMap && data.colorName) instance.colorMap.acknowledge(data.colorName);
44
+ super.explore(context, instance);
45
+ }
46
+
47
+ prepare(context, instance) {
48
+ var { data, colorMap } = instance;
49
+
50
+ if (colorMap && data.colorName) {
51
+ data.colorIndex = colorMap.map(data.colorName);
52
+ if (instance.cache("colorIndex", data.colorIndex)) instance.markShouldUpdate(context);
53
+ }
54
+ }
55
+
56
+ handleClick(e, instance) {
57
+ if (this.onClick && instance.invoke("onClick", e, instance) === false) return;
58
+
59
+ e.stopPropagation();
60
+
61
+ var any = this.legendAction == "auto";
62
+
63
+ if (any || this.legendAction == "toggle") if (instance.set("active", !instance.data.active)) return;
64
+
65
+ if ((any || this.legendAction == "select") && !this.selection.isDummy) this.selection.selectInstance(instance);
66
+ }
67
+
68
+ render(context, instance, key) {
69
+ let { data } = instance;
70
+ let content = !isUndefined(this.text) ? data.text : this.renderChildren(context, instance);
71
+ return (
72
+ <div key={key} className={data.classNames} style={data.style}>
73
+ {this.renderShape(instance)}
74
+ {content != null && <div>{content}</div>}
75
+ </div>
76
+ );
77
+ }
78
+
79
+ renderShape(instance) {
80
+ var entry = instance.data;
81
+ var className = this.CSS.element(this.baseClass, "shape", {
82
+ disabled: entry.disabled,
83
+ selected: entry.selected || this.selection.isInstanceSelected(instance),
84
+ [`color-${entry.colorIndex}`]: entry.colorIndex != null && (isUndefined(entry.active) || entry.active),
85
+ });
86
+ var shape = getShape(entry.shape || "square");
87
+
88
+ // if the entry has a custom fill or stroke set, use it for both values
89
+ let style = { ...entry.style };
90
+ style.fill = style.fill ?? style.stroke;
91
+ style.stroke = style.stroke ?? style.fill;
92
+
93
+ return (
94
+ <svg
95
+ key="svg"
96
+ className={this.CSS.element(this.baseClass, "svg")}
97
+ style={{
98
+ width: `${this.svgSize}px`,
99
+ height: `${this.svgSize}px`,
100
+ }}
101
+ >
102
+ {shape(this.svgSize / 2, this.svgSize / 2, entry.size, {
103
+ style,
104
+ className,
105
+ rx: entry.rx,
106
+ ry: entry.ry,
107
+ })}
108
+ </svg>
109
+ );
110
+ }
111
+ }
112
+
113
+ LegendEntry.prototype.baseClass = "legendentry";
114
+ LegendEntry.prototype.shape = "square";
115
+ LegendEntry.prototype.legendAction = "auto";
116
+ LegendEntry.prototype.size = 18;
117
+ LegendEntry.prototype.svgSize = 20;
118
+ LegendEntry.prototype.styled = true;
119
+
120
+ Widget.alias("legend-entry", LegendEntry);
@@ -1,31 +1,27 @@
1
-
2
- @mixin cx-legendentry(
3
- $name: 'legendentry',
4
- $besm: $cx-besm
5
- ) {
6
- $block: map-get($besm, block);
7
- $element: map-get($besm, element);
8
- $state: map-get($besm, state);
9
-
10
- .#{$block}#{$name} {
11
- display: inline-block;
12
- padding: 5px 0 5px 30px;
13
- position: relative;
14
- box-sizing: border-box;
15
- cursor: pointer;
16
- }
17
-
18
- .#{$element}#{$name}-svg {
19
- position: absolute;
20
- left: 5px;
21
- top: 50%;
22
- }
23
-
24
- .#{$element}#{$name}-shape {
25
- fill: #eee;
26
- }
27
- }
28
-
29
- @if (cx-should-include('cx/charts/LegendEntry')) {
30
- @include cx-legendentry();
31
- }
1
+ @mixin cx-legendentry($name: "legendentry", $besm: $cx-besm) {
2
+ $block: map-get($besm, block);
3
+ $element: map-get($besm, element);
4
+ $state: map-get($besm, state);
5
+
6
+ .#{$block}#{$name} {
7
+ display: inline-flex;
8
+ align-items: center;
9
+ padding: 5px;
10
+ gap: 5px;
11
+ position: relative;
12
+ box-sizing: border-box;
13
+ cursor: pointer;
14
+ }
15
+
16
+ .#{$element}#{$name}-svg {
17
+ flex-shrink: 0;
18
+ }
19
+
20
+ .#{$element}#{$name}-shape {
21
+ fill: #eee;
22
+ }
23
+ }
24
+
25
+ @if (cx-should-include("cx/charts/LegendEntry")) {
26
+ @include cx-legendentry();
27
+ }
@@ -1,71 +1,71 @@
1
- import { VDOM } from "../ui/Widget";
2
- import { BoundedObject } from "../svg/BoundedObject";
3
- import { Rect } from "../svg/util/Rect";
4
- import { parseStyle } from "../util/parseStyle";
5
-
6
- export class PieLabel extends BoundedObject {
7
- init() {
8
- this.lineStyle = parseStyle(this.lineStyle);
9
- super.init();
10
- }
11
-
12
- declareData(...args) {
13
- super.declareData(...args, {
14
- distance: undefined,
15
- lineStyle: { structured: true },
16
- lineStroke: undefined,
17
- lineClass: { structured: true },
18
- lineColorIndex: undefined,
19
- });
20
- }
21
-
22
- calculateBounds(context, instance) {
23
- var { data } = instance;
24
- var bounds = Rect.add(Rect.add(Rect.multiply(instance.parentRect, data.anchors), data.offset), data.margin);
25
- instance.originalBounds = bounds;
26
- instance.actualBounds = context.placePieLabel(bounds, data.distance);
27
- return new Rect({ t: 0, r: bounds.width(), b: bounds.height(), l: 0 });
28
- }
29
-
30
- prepare(context, instance) {
31
- super.prepare(context, instance);
32
- if (!context.registerPieLabel)
33
- throw new Error("PieLabel components are allowed only within PieLabelsContainer components.");
34
- let right = instance.parentRect.r > instance.parentRect.l;
35
- context.push("textDirection", right ? "right" : "left");
36
- context.registerPieLabel(instance);
37
- }
38
-
39
- prepareCleanup(context, instance) {
40
- context.pop("textDirection");
41
- }
42
-
43
- render(context, instance, key) {
44
- let { originalBounds, actualBounds, data } = instance;
45
-
46
- return (
47
- <g key={key} className={data.classNames}>
48
- <line
49
- className={this.CSS.element(
50
- this.baseClass,
51
- "line",
52
- data.lineColorIndex != null && "color-" + data.lineColorIndex
53
- )}
54
- x1={actualBounds.l < originalBounds.l ? actualBounds.r : actualBounds.l}
55
- y1={(actualBounds.t + actualBounds.b) / 2}
56
- x2={(originalBounds.l + originalBounds.r) / 2}
57
- y2={(originalBounds.t + originalBounds.b) / 2}
58
- stroke={data.lineStroke}
59
- style={data.lineStyle}
60
- />
61
- <g transform={`translate(${instance.actualBounds.l} ${instance.actualBounds.t})`}>
62
- {this.renderChildren(context, instance)}
63
- </g>
64
- </g>
65
- );
66
- }
67
- }
68
-
69
- PieLabel.prototype.distance = 100;
70
- PieLabel.prototype.baseClass = "pielabel";
71
- PieLabel.prototype.styled = true;
1
+ import { VDOM } from "../ui/Widget";
2
+ import { BoundedObject } from "../svg/BoundedObject";
3
+ import { Rect } from "../svg/util/Rect";
4
+ import { parseStyle } from "../util/parseStyle";
5
+
6
+ export class PieLabel extends BoundedObject {
7
+ init() {
8
+ this.lineStyle = parseStyle(this.lineStyle);
9
+ super.init();
10
+ }
11
+
12
+ declareData(...args) {
13
+ super.declareData(...args, {
14
+ distance: undefined,
15
+ lineStyle: { structured: true },
16
+ lineStroke: undefined,
17
+ lineClass: { structured: true },
18
+ lineColorIndex: undefined,
19
+ });
20
+ }
21
+
22
+ calculateBounds(context, instance) {
23
+ var { data } = instance;
24
+ var bounds = Rect.add(Rect.add(Rect.multiply(instance.parentRect, data.anchors), data.offset), data.margin);
25
+ instance.originalBounds = bounds;
26
+ instance.actualBounds = context.placePieLabel(bounds, data.distance);
27
+ return new Rect({ t: 0, r: bounds.width(), b: bounds.height(), l: 0 });
28
+ }
29
+
30
+ prepare(context, instance) {
31
+ super.prepare(context, instance);
32
+ if (!context.registerPieLabel)
33
+ throw new Error("PieLabel components are allowed only within PieLabelsContainer components.");
34
+ let right = instance.parentRect.r > instance.parentRect.l;
35
+ context.push("textDirection", right ? "right" : "left");
36
+ context.registerPieLabel(instance);
37
+ }
38
+
39
+ prepareCleanup(context, instance) {
40
+ context.pop("textDirection");
41
+ }
42
+
43
+ render(context, instance, key) {
44
+ let { originalBounds, actualBounds, data } = instance;
45
+
46
+ return (
47
+ <g key={key} className={data.classNames}>
48
+ <line
49
+ className={this.CSS.element(
50
+ this.baseClass,
51
+ "line",
52
+ data.lineColorIndex != null && "color-" + data.lineColorIndex
53
+ )}
54
+ x1={actualBounds.l < originalBounds.l ? actualBounds.r : actualBounds.l}
55
+ y1={(actualBounds.t + actualBounds.b) / 2}
56
+ x2={(originalBounds.l + originalBounds.r) / 2}
57
+ y2={(originalBounds.t + originalBounds.b) / 2}
58
+ stroke={data.lineStroke}
59
+ style={data.lineStyle}
60
+ />
61
+ <g transform={`translate(${instance.actualBounds.l} ${instance.actualBounds.t})`}>
62
+ {this.renderChildren(context, instance)}
63
+ </g>
64
+ </g>
65
+ );
66
+ }
67
+ }
68
+
69
+ PieLabel.prototype.distance = 100;
70
+ PieLabel.prototype.baseClass = "pielabel";
71
+ PieLabel.prototype.styled = true;