cx 23.4.5 → 23.5.1
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 +16 -4
- package/dist/manifest.js +742 -742
- package/dist/ui.js +7 -2
- package/dist/widgets.js +9 -4
- package/package.json +1 -1
- package/src/charts/Legend.d.ts +13 -13
- package/src/charts/Legend.js +11 -5
- package/src/charts/PieChart.js +16 -18
- package/src/data/StringTemplate.spec.js +105 -95
- package/src/ui/FocusManager.js +171 -171
- package/src/widgets/form/DateTimeField.d.ts +86 -83
- package/src/widgets/form/DateTimeField.js +572 -571
- package/src/widgets/grid/Grid.js +3273 -3266
package/dist/ui.js
CHANGED
|
@@ -1403,14 +1403,19 @@ function unfocusElement(target, unfocusParentOverlay) {
|
|
|
1403
1403
|
if (!target) target = activeElement;
|
|
1404
1404
|
if (unfocusParentOverlay) {
|
|
1405
1405
|
var focusableOverlayContainer = closestParent(target, function (el) {
|
|
1406
|
-
|
|
1406
|
+
var _el$dataset;
|
|
1407
|
+
return (_el$dataset = el.dataset) == null ? void 0 : _el$dataset.focusableOverlayContainer;
|
|
1407
1408
|
});
|
|
1408
1409
|
if (focusableOverlayContainer) target = focusableOverlayContainer;
|
|
1409
1410
|
}
|
|
1410
1411
|
|
|
1411
1412
|
//find the closest focusable parent of the target element and focus it instead
|
|
1412
1413
|
var focusableParent = closestParent(target, function (el) {
|
|
1413
|
-
|
|
1414
|
+
var _el$dataset2;
|
|
1415
|
+
return (
|
|
1416
|
+
isFocusable(el) &&
|
|
1417
|
+
(!unfocusParentOverlay || ((_el$dataset2 = el.dataset) == null ? void 0 : _el$dataset2.focusableOverlayContainer))
|
|
1418
|
+
);
|
|
1414
1419
|
});
|
|
1415
1420
|
if (focusableParent && focusableParent !== document.body) focusableParent.focus();
|
|
1416
1421
|
else activeElement.blur();
|
package/dist/widgets.js
CHANGED
|
@@ -14589,6 +14589,7 @@ var DateTimeInput = /*#__PURE__*/ (function (_VDOM$Component) {
|
|
|
14589
14589
|
type: DateTimePicker,
|
|
14590
14590
|
segment: widget.segment,
|
|
14591
14591
|
encoding: widget.encoding,
|
|
14592
|
+
showSeconds: widget.showSeconds,
|
|
14592
14593
|
};
|
|
14593
14594
|
break;
|
|
14594
14595
|
}
|
|
@@ -17363,11 +17364,15 @@ var GridComponent = /*#__PURE__*/ (function (_VDOM$Component) {
|
|
|
17363
17364
|
var widget = instance.widget;
|
|
17364
17365
|
if (widget.scrollable)
|
|
17365
17366
|
this.offResize = ResizeManager.trackElement(this.dom.scroller, function () {
|
|
17367
|
+
//ignore changes if the element is not visible on the page
|
|
17368
|
+
if (_this10.dom.scroller.offsetWidth == 0) return;
|
|
17366
17369
|
//update fixed header/footer
|
|
17367
|
-
|
|
17368
|
-
|
|
17369
|
-
|
|
17370
|
-
|
|
17370
|
+
requestAnimationFrame(function () {
|
|
17371
|
+
_this10.componentDidUpdate();
|
|
17372
|
+
instance.setState({
|
|
17373
|
+
dimensionsVersion: instance.state.dimensionsVersion + 1,
|
|
17374
|
+
lockedColWidth: {},
|
|
17375
|
+
});
|
|
17371
17376
|
});
|
|
17372
17377
|
});
|
|
17373
17378
|
if (widget.pipeKeyDown) instance.invoke("pipeKeyDown", this.handleKeyDown.bind(this), instance);
|
package/package.json
CHANGED
package/src/charts/Legend.d.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import * as Cx from
|
|
1
|
+
import * as Cx from "../core";
|
|
2
2
|
|
|
3
3
|
interface LegendProps extends Cx.HtmlElementProps {
|
|
4
|
-
|
|
5
4
|
/** Name of the legend. Default is `legend`. */
|
|
6
|
-
name?: string
|
|
7
|
-
|
|
5
|
+
name?: string;
|
|
6
|
+
|
|
8
7
|
/** Base CSS class to be applied to the element. Defaults to `legend`. */
|
|
9
|
-
baseClass?: string
|
|
10
|
-
|
|
8
|
+
baseClass?: string;
|
|
9
|
+
|
|
11
10
|
/** Switch to vertical mode. */
|
|
12
|
-
vertical?: boolean
|
|
11
|
+
vertical?: boolean;
|
|
13
12
|
|
|
14
13
|
/** Size of the svg shape container in pixels. Default value is 20. */
|
|
15
|
-
svgSize?: number
|
|
14
|
+
svgSize?: number;
|
|
16
15
|
|
|
17
16
|
/** Shape size in pixels. Default value is 18. */
|
|
18
|
-
shapeSize?: number
|
|
17
|
+
shapeSize?: number;
|
|
18
|
+
|
|
19
|
+
/** Default shape that will be applied to the all legend items. */
|
|
20
|
+
shape?: Cx.StringProp;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
export class Legend extends Cx.Widget<LegendProps> {
|
|
22
|
-
static Scope()
|
|
24
|
+
static Scope(): any;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
export class LegendScope extends
|
|
26
|
-
|
|
27
|
-
}
|
|
27
|
+
export class LegendScope extends Cx.Widget<Cx.PureContainerProps> {}
|
package/src/charts/Legend.js
CHANGED
|
@@ -15,6 +15,12 @@ export class Legend extends HtmlElement {
|
|
|
15
15
|
super.prepareData(context, instance);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
declareData() {
|
|
19
|
+
super.declareData(...arguments, {
|
|
20
|
+
shape: undefined,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
18
24
|
isValidHtmlAttribute(attrName) {
|
|
19
25
|
switch (attrName) {
|
|
20
26
|
case "shapeSize":
|
|
@@ -74,7 +80,7 @@ export class Legend extends HtmlElement {
|
|
|
74
80
|
onMouseMove={onMouseMove}
|
|
75
81
|
onMouseLeave={onMouseLeave}
|
|
76
82
|
>
|
|
77
|
-
{this.renderShape(e)}
|
|
83
|
+
{this.renderShape(e, instance.data.shape)}
|
|
78
84
|
{e.name}
|
|
79
85
|
</div>
|
|
80
86
|
))
|
|
@@ -86,11 +92,11 @@ export class Legend extends HtmlElement {
|
|
|
86
92
|
return [list, super.renderChildren(context, instance)];
|
|
87
93
|
}
|
|
88
94
|
|
|
89
|
-
renderShape(entry) {
|
|
95
|
+
renderShape(entry, legendEntriesShape) {
|
|
90
96
|
const className = this.CSS.element(this.baseClass, "shape", {
|
|
91
97
|
[`color-${entry.colorIndex}`]: entry.colorIndex != null && (isUndefined(entry.active) || entry.active),
|
|
92
98
|
});
|
|
93
|
-
const shape = getShape(entry.shape || "square");
|
|
99
|
+
const shape = getShape(legendEntriesShape || entry.shape || "square");
|
|
94
100
|
|
|
95
101
|
return (
|
|
96
102
|
<svg
|
|
@@ -115,14 +121,14 @@ Legend.prototype.baseClass = "legend";
|
|
|
115
121
|
Legend.prototype.vertical = false;
|
|
116
122
|
Legend.prototype.memoize = false;
|
|
117
123
|
Legend.prototype.shapeSize = 18;
|
|
124
|
+
Legend.prototype.shape = null;
|
|
118
125
|
Legend.prototype.svgSize = 20;
|
|
119
126
|
|
|
120
127
|
Widget.alias("legend", Legend);
|
|
121
128
|
|
|
122
129
|
Legend.Scope = class extends PureContainer {
|
|
123
130
|
explore(context, instance) {
|
|
124
|
-
context.push("legends", (instance.legends = {
|
|
125
|
-
}));
|
|
131
|
+
context.push("legends", (instance.legends = {}));
|
|
126
132
|
super.explore(context, instance);
|
|
127
133
|
}
|
|
128
134
|
|
package/src/charts/PieChart.js
CHANGED
|
@@ -13,7 +13,7 @@ export class PieChart extends BoundedObject {
|
|
|
13
13
|
super.declareData(...arguments, {
|
|
14
14
|
angle: undefined,
|
|
15
15
|
startAngle: 0,
|
|
16
|
-
clockwise: undefined
|
|
16
|
+
clockwise: undefined,
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -42,7 +42,7 @@ export class PieChart extends BoundedObject {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
PieChart.prototype.anchors = "0 1 1 0";
|
|
46
46
|
|
|
47
47
|
class PieCalculator {
|
|
48
48
|
reset(angle, startAngle, clockwise) {
|
|
@@ -88,10 +88,8 @@ class PieCalculator {
|
|
|
88
88
|
var angle = value * s.angleFactor;
|
|
89
89
|
var startAngle = s.lastAngle;
|
|
90
90
|
|
|
91
|
-
if (!this.clockwise)
|
|
92
|
-
|
|
93
|
-
else
|
|
94
|
-
s.lastAngle -= angle;
|
|
91
|
+
if (!this.clockwise) s.lastAngle += angle;
|
|
92
|
+
else s.lastAngle -= angle;
|
|
95
93
|
|
|
96
94
|
return {
|
|
97
95
|
startAngle,
|
|
@@ -354,17 +352,17 @@ export class PieSlice extends Container {
|
|
|
354
352
|
}
|
|
355
353
|
}
|
|
356
354
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
355
|
+
PieSlice.prototype.offset = 0;
|
|
356
|
+
PieSlice.prototype.r0 = 0;
|
|
357
|
+
PieSlice.prototype.r = 50;
|
|
358
|
+
PieSlice.prototype.percentageRadius = true;
|
|
359
|
+
PieSlice.prototype.baseClass = "pieslice";
|
|
360
|
+
PieSlice.prototype.legend = "legend";
|
|
361
|
+
PieSlice.prototype.active = true;
|
|
362
|
+
PieSlice.prototype.stack = "stack";
|
|
363
|
+
PieSlice.prototype.legendAction = "auto";
|
|
364
|
+
PieSlice.prototype.legendShape = "circle";
|
|
365
|
+
PieSlice.prototype.hoverChannel = "default";
|
|
366
|
+
PieSlice.prototype.styled = true;
|
|
369
367
|
|
|
370
368
|
Widget.alias("pie-chart", PieChart);
|
|
@@ -1,95 +1,105 @@
|
|
|
1
|
-
import { StringTemplate } from "./StringTemplate";
|
|
2
|
-
import assert from "assert";
|
|
3
|
-
|
|
4
|
-
describe("StringTemplate", function () {
|
|
5
|
-
describe("#compile()", function () {
|
|
6
|
-
it("returns a selector", function () {
|
|
7
|
-
var e = StringTemplate.compile("Hello {person.name}");
|
|
8
|
-
var state = {
|
|
9
|
-
person: {
|
|
10
|
-
name: "Jim",
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
assert.equal(e(state), "Hello Jim");
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it("properly encodes ' and \"", function () {
|
|
17
|
-
var e = StringTemplate.compile('It\'s "working"!');
|
|
18
|
-
assert.equal(e({}), 'It\'s "working"!');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it("supports multi-line strings", function () {
|
|
22
|
-
var e = StringTemplate.compile("a\nb");
|
|
23
|
-
assert.equal(e(), "a\nb");
|
|
24
|
-
|
|
25
|
-
var e = StringTemplate.compile("a\r\nb");
|
|
26
|
-
assert.equal(e(), "a\r\nb");
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
describe("double brackets are used to escape brackets", function () {
|
|
31
|
-
it("double brackets are preserved", function () {
|
|
32
|
-
var e = StringTemplate.compile("Hello {{person.name}}");
|
|
33
|
-
var state = {
|
|
34
|
-
person: {
|
|
35
|
-
name: "Jim",
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
assert.equal(e(state), "Hello {person.name}");
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("triple brackets are converted to single brackets and a binding", function () {
|
|
42
|
-
var e = StringTemplate.compile("Hello {{{person.name}}}");
|
|
43
|
-
var state = {
|
|
44
|
-
person: {
|
|
45
|
-
name: "Jim",
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
assert.equal(e(state), "Hello {Jim}");
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
describe("supports formatting", function () {
|
|
53
|
-
it("with colon", function () {
|
|
54
|
-
var e = StringTemplate.compile("{str:suffix;kg}");
|
|
55
|
-
assert.equal(e({ str: "5" }), "5kg");
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it("with multiple formats", function () {
|
|
59
|
-
var e = StringTemplate.compile("{str:suffix;kg:wrap;(;)}");
|
|
60
|
-
assert.equal(e({ str: "5" }), "(5kg)");
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it("with null values", function () {
|
|
64
|
-
var e = StringTemplate.compile("{str:suffix;kg:|N/A}");
|
|
65
|
-
assert.equal(e({ str: null }), "N/A");
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it("of null values", function () {
|
|
69
|
-
var e = StringTemplate.compile("{str|N/A}");
|
|
70
|
-
assert.equal(e({ str: null }), "N/A");
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
describe("supports expressions", function () {
|
|
75
|
-
it("using []", function () {
|
|
76
|
-
var e = StringTemplate.compile("1 + 2 = {[1+2]}");
|
|
77
|
-
assert.equal(e(), "1 + 2 = 3");
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it("using %", function () {
|
|
81
|
-
var e = StringTemplate.compile("1 + 2 = %{1+2}");
|
|
82
|
-
assert.equal(e(), "1 + 2 = 3");
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it("with subexpressions", function () {
|
|
86
|
-
var e = StringTemplate.compile("1 + 2 = {[%{1+2}]}");
|
|
87
|
-
assert.equal(e(), "1 + 2 = 3");
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it("with a conditional operator", function () {
|
|
91
|
-
var e = StringTemplate.compile("1 + 2 = {[true ? 3 : 2]:s}");
|
|
92
|
-
assert.equal(e(), "1 + 2 = 3");
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
|
|
1
|
+
import { StringTemplate } from "./StringTemplate";
|
|
2
|
+
import assert from "assert";
|
|
3
|
+
|
|
4
|
+
describe("StringTemplate", function () {
|
|
5
|
+
describe("#compile()", function () {
|
|
6
|
+
it("returns a selector", function () {
|
|
7
|
+
var e = StringTemplate.compile("Hello {person.name}");
|
|
8
|
+
var state = {
|
|
9
|
+
person: {
|
|
10
|
+
name: "Jim",
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
assert.equal(e(state), "Hello Jim");
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("properly encodes ' and \"", function () {
|
|
17
|
+
var e = StringTemplate.compile('It\'s "working"!');
|
|
18
|
+
assert.equal(e({}), 'It\'s "working"!');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("supports multi-line strings", function () {
|
|
22
|
+
var e = StringTemplate.compile("a\nb");
|
|
23
|
+
assert.equal(e(), "a\nb");
|
|
24
|
+
|
|
25
|
+
var e = StringTemplate.compile("a\r\nb");
|
|
26
|
+
assert.equal(e(), "a\r\nb");
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe("double brackets are used to escape brackets", function () {
|
|
31
|
+
it("double brackets are preserved", function () {
|
|
32
|
+
var e = StringTemplate.compile("Hello {{person.name}}");
|
|
33
|
+
var state = {
|
|
34
|
+
person: {
|
|
35
|
+
name: "Jim",
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
assert.equal(e(state), "Hello {person.name}");
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("triple brackets are converted to single brackets and a binding", function () {
|
|
42
|
+
var e = StringTemplate.compile("Hello {{{person.name}}}");
|
|
43
|
+
var state = {
|
|
44
|
+
person: {
|
|
45
|
+
name: "Jim",
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
assert.equal(e(state), "Hello {Jim}");
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe("supports formatting", function () {
|
|
53
|
+
it("with colon", function () {
|
|
54
|
+
var e = StringTemplate.compile("{str:suffix;kg}");
|
|
55
|
+
assert.equal(e({ str: "5" }), "5kg");
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("with multiple formats", function () {
|
|
59
|
+
var e = StringTemplate.compile("{str:suffix;kg:wrap;(;)}");
|
|
60
|
+
assert.equal(e({ str: "5" }), "(5kg)");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("with null values", function () {
|
|
64
|
+
var e = StringTemplate.compile("{str:suffix;kg:|N/A}");
|
|
65
|
+
assert.equal(e({ str: null }), "N/A");
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("of null values", function () {
|
|
69
|
+
var e = StringTemplate.compile("{str|N/A}");
|
|
70
|
+
assert.equal(e({ str: null }), "N/A");
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe("supports expressions", function () {
|
|
75
|
+
it("using []", function () {
|
|
76
|
+
var e = StringTemplate.compile("1 + 2 = {[1+2]}");
|
|
77
|
+
assert.equal(e(), "1 + 2 = 3");
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it("using %", function () {
|
|
81
|
+
var e = StringTemplate.compile("1 + 2 = %{1+2}");
|
|
82
|
+
assert.equal(e(), "1 + 2 = 3");
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("with subexpressions", function () {
|
|
86
|
+
var e = StringTemplate.compile("1 + 2 = {[%{1+2}]}");
|
|
87
|
+
assert.equal(e(), "1 + 2 = 3");
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it("with a conditional operator", function () {
|
|
91
|
+
var e = StringTemplate.compile("1 + 2 = {[true ? 3 : 2]:s}");
|
|
92
|
+
assert.equal(e(), "1 + 2 = 3");
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it("with sub-expression formatting", function () {
|
|
96
|
+
var e = StringTemplate.compile("{[!!{person.age} ? {person.age:suffix; years old} : 'Age unknown']}");
|
|
97
|
+
var state = {
|
|
98
|
+
person: {
|
|
99
|
+
age: 32,
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
assert.equal(e(state), "32 years old");
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
});
|