cx 23.4.4 → 23.5.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 +16 -4
- package/dist/data.js +2 -9
- package/dist/manifest.js +709 -709
- package/dist/widgets.js +33 -11
- 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/Binding.js +2 -12
- package/src/data/Binding.spec.js +48 -38
- package/src/data/createAccessorModelProxy.spec.tsx +6 -0
- package/src/ui/Restate.js +158 -158
- package/src/widgets/form/DateTimeField.d.ts +86 -83
- package/src/widgets/form/DateTimeField.js +572 -571
- package/src/widgets/grid/Grid.js +22 -11
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
|
}
|
|
@@ -15849,12 +15850,19 @@ var Grid = /*#__PURE__*/ (function (_Container) {
|
|
|
15849
15850
|
onClick: function onClick(e) {
|
|
15850
15851
|
e.stopPropagation();
|
|
15851
15852
|
},
|
|
15853
|
+
"data-unique-col-id": hdwidget.uniqueColumnId,
|
|
15852
15854
|
onMouseDown: function onMouseDown(e) {
|
|
15853
15855
|
if (e.buttons != 1) return;
|
|
15854
15856
|
var resizeOverlayEl = document.createElement("div");
|
|
15855
|
-
var
|
|
15856
|
-
|
|
15857
|
-
var
|
|
15857
|
+
var headerTBody = e.target.parentElement.parentElement.parentElement;
|
|
15858
|
+
var uniqueColId = e.currentTarget.dataset.uniqueColId;
|
|
15859
|
+
var headerCell = findFirstChild(headerTBody, function (el) {
|
|
15860
|
+
var _el$dataset;
|
|
15861
|
+
return (
|
|
15862
|
+
el.tagName == "TH" && ((_el$dataset = el.dataset) == null ? void 0 : _el$dataset.uniqueColId) == uniqueColId
|
|
15863
|
+
);
|
|
15864
|
+
});
|
|
15865
|
+
var scrollAreaEl = headerTBody.parentElement.parentElement;
|
|
15858
15866
|
var gridEl = scrollAreaEl.parentElement;
|
|
15859
15867
|
var initialWidth = headerCell.offsetWidth;
|
|
15860
15868
|
var initialPosition = getCursorPos(e);
|
|
@@ -15978,15 +15986,16 @@ var Grid = /*#__PURE__*/ (function (_Container) {
|
|
|
15978
15986
|
});
|
|
15979
15987
|
}
|
|
15980
15988
|
}
|
|
15989
|
+
var uniqueColumnId = header.data.colSpan > 1 ? null : hdwidget.uniqueColumnId;
|
|
15981
15990
|
style = header.data.style;
|
|
15982
15991
|
var customWidth =
|
|
15983
15992
|
header.data.width ||
|
|
15984
|
-
instance.state.colWidth[
|
|
15993
|
+
instance.state.colWidth[uniqueColumnId] ||
|
|
15985
15994
|
header.data.defaultWidth ||
|
|
15986
|
-
instance.state.lockedColWidth[
|
|
15995
|
+
instance.state.lockedColWidth[uniqueColumnId];
|
|
15987
15996
|
if (customWidth) {
|
|
15988
|
-
if (instance.state.colWidth[
|
|
15989
|
-
instance.state.colWidth[
|
|
15997
|
+
if (instance.state.colWidth[uniqueColumnId] != customWidth)
|
|
15998
|
+
instance.state.colWidth[uniqueColumnId] = customWidth;
|
|
15990
15999
|
var s = customWidth + "px";
|
|
15991
16000
|
style = _objectSpread2(
|
|
15992
16001
|
_objectSpread2({}, style),
|
|
@@ -16018,11 +16027,24 @@ var Grid = /*#__PURE__*/ (function (_Container) {
|
|
|
16018
16027
|
resizer = _this3.renderResizer(instance, hdinst, header, colIndex);
|
|
16019
16028
|
}
|
|
16020
16029
|
if (colIndex > 0) {
|
|
16030
|
+
var _headerPrev, _headerPrev$data, _headerPrev2, _headerPrev2$data;
|
|
16021
16031
|
var hdinstPrev = line.children[colIndex - 1];
|
|
16022
|
-
var
|
|
16032
|
+
var prevLine = 3;
|
|
16033
|
+
var headerPrev;
|
|
16034
|
+
while (!headerPrev && prevLine >= 0) {
|
|
16035
|
+
headerPrev = hdinstPrev.components["header" + (prevLine + 1)];
|
|
16036
|
+
prevLine--;
|
|
16037
|
+
}
|
|
16023
16038
|
if (
|
|
16024
|
-
(hdinstPrev.widget.resizable ||
|
|
16025
|
-
|
|
16039
|
+
(hdinstPrev.widget.resizable ||
|
|
16040
|
+
((_headerPrev = headerPrev) != null &&
|
|
16041
|
+
(_headerPrev$data = _headerPrev.data) != null &&
|
|
16042
|
+
_headerPrev$data.resizable)) &&
|
|
16043
|
+
((_headerPrev2 = headerPrev) == null
|
|
16044
|
+
? void 0
|
|
16045
|
+
: (_headerPrev2$data = _headerPrev2.data) == null
|
|
16046
|
+
? void 0
|
|
16047
|
+
: _headerPrev2$data.colSpan) < 2
|
|
16026
16048
|
) {
|
|
16027
16049
|
prevColumnResizer = _this3.renderResizer(instance, hdinstPrev, headerPrev, colIndex - 1, true);
|
|
16028
16050
|
}
|
|
@@ -16053,7 +16075,7 @@ var Grid = /*#__PURE__*/ (function (_Container) {
|
|
|
16053
16075
|
return _this3.onHeaderClick(e, hdwidget, instance, l);
|
|
16054
16076
|
},
|
|
16055
16077
|
onContextMenu: onContextMenu,
|
|
16056
|
-
"data-unique-col-id": hdwidget.uniqueColumnId,
|
|
16078
|
+
"data-unique-col-id": colSpan > 1 ? null : hdwidget.uniqueColumnId,
|
|
16057
16079
|
children: [getContent(content), sortIcon, tool, prevColumnResizer, resizer],
|
|
16058
16080
|
},
|
|
16059
16081
|
colIndex
|
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);
|
package/src/data/Binding.js
CHANGED
|
@@ -7,18 +7,8 @@ export class Binding {
|
|
|
7
7
|
constructor(path) {
|
|
8
8
|
this.path = path;
|
|
9
9
|
this.parts = path.split(".");
|
|
10
|
-
let body = "return
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
for (let i = 0; i < this.parts.length; i++) {
|
|
14
|
-
if (this.parts[i][0] >= "0" && this.parts[i][0] <= "9") selector += "[" + this.parts[i] + "]";
|
|
15
|
-
else selector += "." + this.parts[i];
|
|
16
|
-
|
|
17
|
-
if (i + 1 < this.parts.length) body += " && " + selector;
|
|
18
|
-
else body += " ? " + selector + " : undefined";
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
body += ")";
|
|
10
|
+
let body = "return x";
|
|
11
|
+
for (let i = 0; i < this.parts.length; i++) body += '?.["' + this.parts[i] + '"]';
|
|
22
12
|
this.value = new Function("x", body);
|
|
23
13
|
}
|
|
24
14
|
|
package/src/data/Binding.spec.js
CHANGED
|
@@ -1,49 +1,59 @@
|
|
|
1
|
-
import {Binding} from
|
|
2
|
-
import assert from
|
|
3
|
-
|
|
4
|
-
describe(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
});
|
|
12
|
-
});
|
|
1
|
+
import { Binding } from "./Binding";
|
|
2
|
+
import assert from "assert";
|
|
3
|
+
|
|
4
|
+
describe("Binding", function () {
|
|
5
|
+
describe("#get()", function () {
|
|
6
|
+
it("should get value if value is defined", function () {
|
|
7
|
+
var state = { person: { name: "Joe" } };
|
|
8
|
+
var b = Binding.get("person.name");
|
|
9
|
+
assert.equal(b.value(state), "Joe");
|
|
10
|
+
});
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
it("allows non-standard property identifiers", function () {
|
|
13
|
+
var state = { person: { "@schema": "Person" } };
|
|
14
|
+
var b = Binding.get("person.@schema");
|
|
15
|
+
assert.equal(b.value(state), "Person");
|
|
16
|
+
});
|
|
17
|
+
});
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
describe("#set()", function () {
|
|
20
|
+
it("produces new objects along the binding path", function () {
|
|
21
|
+
var state = { person: { name: "Joe" } };
|
|
22
|
+
var b = Binding.get("person.name");
|
|
23
|
+
var ns = b.set(state, "Jack");
|
|
24
|
+
assert.equal(ns.person.name, "Jack");
|
|
25
|
+
assert.notEqual(state, ns);
|
|
26
|
+
assert.notEqual(state.person, ns.person);
|
|
27
|
+
assert.notEqual(state.person.name, ns.person.name);
|
|
28
|
+
});
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
});
|
|
30
|
+
it("returns same state object if value does not change", function () {
|
|
31
|
+
var state = { person: { name: "Joe" } };
|
|
32
|
+
var b = Binding.get("person.name");
|
|
33
|
+
var ns = b.set(state, "Joe");
|
|
34
|
+
assert.equal(state, ns);
|
|
35
|
+
});
|
|
33
36
|
|
|
34
|
-
|
|
37
|
+
it("allows non-standard property identifiers", function () {
|
|
38
|
+
var state = { person: { "@schema": "Person" } };
|
|
39
|
+
var b = Binding.get("person.@schema");
|
|
40
|
+
var ns = b.set(state, "Test");
|
|
41
|
+
assert.equal(ns.person["@schema"], "Test");
|
|
42
|
+
});
|
|
43
|
+
});
|
|
35
44
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var
|
|
45
|
+
describe(".delete()", function () {
|
|
46
|
+
it("correctly removes pointed properties", function () {
|
|
47
|
+
var state = { person: { name: "Joe" } };
|
|
48
|
+
var b = Binding.get("person.name");
|
|
39
49
|
var ns = b.delete(state);
|
|
40
|
-
assert(
|
|
41
|
-
assert(!(
|
|
50
|
+
assert("person" in ns);
|
|
51
|
+
assert(!("name" in ns.person));
|
|
42
52
|
});
|
|
43
53
|
|
|
44
|
-
it(
|
|
45
|
-
var state = {person: {name:
|
|
46
|
-
var b = Binding.get(
|
|
54
|
+
it("does not change state if property is non-existent", function () {
|
|
55
|
+
var state = { person: { name: "Joe" } };
|
|
56
|
+
var b = Binding.get("person.name2");
|
|
47
57
|
var ns = b.delete(state);
|
|
48
58
|
assert(ns == state);
|
|
49
59
|
});
|
|
@@ -7,6 +7,7 @@ interface Model {
|
|
|
7
7
|
city: string;
|
|
8
8
|
streetNumber: number;
|
|
9
9
|
};
|
|
10
|
+
"@crazy": string;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
describe("createAccessorModelProxy", () => {
|
|
@@ -35,4 +36,9 @@ describe("createAccessorModelProxy", () => {
|
|
|
35
36
|
assert.strictEqual(streetNumber.nameOf(), "streetNumber");
|
|
36
37
|
assert.strictEqual(city.nameOf(), "city");
|
|
37
38
|
});
|
|
39
|
+
|
|
40
|
+
it("allows non-standard property identifiers ", () => {
|
|
41
|
+
let model = createAccessorModelProxy<Model>();
|
|
42
|
+
assert.strictEqual(model["@crazy"].nameOf(), "@crazy");
|
|
43
|
+
});
|
|
38
44
|
});
|