cx 26.4.3 → 26.4.4
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/build/data/AugmentedViewBase.d.ts.map +1 -1
- package/build/data/AugmentedViewBase.js +5 -4
- package/build/data/View.d.ts +0 -1
- package/build/data/View.d.ts.map +1 -1
- package/build/data/View.js +1 -3
- package/build/widgets/form/LookupField.js +2 -1
- package/dist/data.js +5 -4
- package/dist/manifest.js +756 -756
- package/dist/widgets.css +9 -3
- package/dist/widgets.js +5 -1
- package/package.json +1 -1
- package/src/charts/BarGraph.scss +31 -31
- package/src/charts/Legend.scss +57 -57
- package/src/charts/LegendEntry.scss +35 -35
- package/src/charts/LineGraph.scss +28 -28
- package/src/charts/helpers/SnapPointFinder.ts +136 -136
- package/src/charts/helpers/ValueAtFinder.ts +72 -72
- package/src/data/AugmentedViewBase.ts +89 -88
- package/src/data/View.ts +301 -346
- package/src/data/createAccessorModelProxy.ts +66 -66
- package/src/ui/DataProxy.ts +55 -55
- package/src/ui/Repeater.spec.tsx +181 -181
- package/src/ui/Rescope.ts +50 -50
- package/src/ui/adapter/ArrayAdapter.ts +229 -229
- package/src/ui/exprHelpers.ts +96 -96
- package/src/util/scss/include.scss +69 -69
- package/src/widgets/Button.maps.scss +103 -103
- package/src/widgets/Sandbox.ts +104 -104
- package/src/widgets/form/Calendar.tsx +772 -772
- package/src/widgets/form/ColorField.scss +112 -112
- package/src/widgets/form/DateTimeField.scss +111 -111
- package/src/widgets/form/LookupField.maps.scss +26 -26
- package/src/widgets/form/LookupField.scss +10 -3
- package/src/widgets/form/LookupField.tsx +4 -1
- package/src/widgets/form/MonthField.scss +113 -113
- package/src/widgets/form/NumberField.scss +72 -72
- package/src/widgets/form/Select.scss +104 -104
- package/src/widgets/form/TextField.scss +66 -66
- package/src/widgets/grid/Grid.scss +657 -657
- package/src/widgets/grid/variables.scss +47 -47
- package/src/widgets/index.ts +63 -63
- package/src/widgets/nav/MenuItem.scss +150 -150
- package/src/widgets/nav/MenuItem.tsx +525 -525
- package/src/widgets/nav/Tab.ts +122 -122
- package/src/widgets/overlay/Overlay.tsx +1029 -1029
- package/src/widgets/variables.scss +61 -61
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { AccessorChain } from "../../data/createAccessorModelProxy";
|
|
2
|
-
import { Bind, Prop } from "../../ui/Prop";
|
|
3
|
-
import { PointReducer, PointReducerAccumulator, PointReducerConfig, PointReducerInstance } from "./PointReducer";
|
|
4
|
-
|
|
5
|
-
export interface ValueAtAccumulator extends PointReducerAccumulator {
|
|
6
|
-
at: number;
|
|
7
|
-
left?: { x: number; y: number; d: number };
|
|
8
|
-
right?: { x: number; y: number; d: number };
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface ValueAtFinderConfig extends PointReducerConfig {
|
|
12
|
-
/** X axis probe value. */
|
|
13
|
-
at?: Prop<string | number | null | undefined>;
|
|
14
|
-
|
|
15
|
-
/** A binding used to receive the measured y axis value */
|
|
16
|
-
value?: Bind | AccessorChain<number | null | undefined>;
|
|
17
|
-
|
|
18
|
-
/** A function used to convert x values into numeric format. Commonly used with dates. */
|
|
19
|
-
convert?: (value: number | string) => number;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/** Calculate value at a given point on the graph */
|
|
23
|
-
export class ValueAtFinder extends PointReducer<ValueAtAccumulator> {
|
|
24
|
-
declare convert: (value: any) => number;
|
|
25
|
-
|
|
26
|
-
constructor(config?: ValueAtFinderConfig) {
|
|
27
|
-
super(config);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
declareData(...args: any[]) {
|
|
31
|
-
super.declareData(...args, {
|
|
32
|
-
at: undefined,
|
|
33
|
-
value: undefined,
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
onInitAccumulator = (acc: ValueAtAccumulator, { data }: PointReducerInstance<ValueAtAccumulator>) => {
|
|
38
|
-
acc.at = this.convert((data as any).at);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
onMap = (acc: ValueAtAccumulator, x: any, y: any, name: string) => {
|
|
42
|
-
let cx = this.convert(x);
|
|
43
|
-
let d = cx - acc.at;
|
|
44
|
-
if (d <= 0 && (!acc.left || acc.left.d < d)) {
|
|
45
|
-
acc.left = {
|
|
46
|
-
x: cx,
|
|
47
|
-
y,
|
|
48
|
-
d,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
if (d >= 0 && (!acc.right || acc.right.d > d)) {
|
|
52
|
-
acc.right = {
|
|
53
|
-
x: cx,
|
|
54
|
-
y,
|
|
55
|
-
d,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
onReduce = (acc: ValueAtAccumulator, instance: PointReducerInstance<ValueAtAccumulator>) => {
|
|
61
|
-
let y: number | null = null;
|
|
62
|
-
if (acc.left && acc.right) {
|
|
63
|
-
if (acc.left.x == acc.right.x) y = acc.left.y;
|
|
64
|
-
else if (acc.left.y != null && acc.right.y != null) {
|
|
65
|
-
y = acc.left.y + ((acc.right.y - acc.left.y) * (acc.at - acc.left.x)) / (acc.right.x - acc.left.x);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
instance.set("value", y);
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
ValueAtFinder.prototype.convert = (x) => x;
|
|
1
|
+
import { AccessorChain } from "../../data/createAccessorModelProxy";
|
|
2
|
+
import { Bind, Prop } from "../../ui/Prop";
|
|
3
|
+
import { PointReducer, PointReducerAccumulator, PointReducerConfig, PointReducerInstance } from "./PointReducer";
|
|
4
|
+
|
|
5
|
+
export interface ValueAtAccumulator extends PointReducerAccumulator {
|
|
6
|
+
at: number;
|
|
7
|
+
left?: { x: number; y: number; d: number };
|
|
8
|
+
right?: { x: number; y: number; d: number };
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ValueAtFinderConfig extends PointReducerConfig {
|
|
12
|
+
/** X axis probe value. */
|
|
13
|
+
at?: Prop<string | number | null | undefined>;
|
|
14
|
+
|
|
15
|
+
/** A binding used to receive the measured y axis value */
|
|
16
|
+
value?: Bind | AccessorChain<number | null | undefined>;
|
|
17
|
+
|
|
18
|
+
/** A function used to convert x values into numeric format. Commonly used with dates. */
|
|
19
|
+
convert?: (value: number | string) => number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Calculate value at a given point on the graph */
|
|
23
|
+
export class ValueAtFinder extends PointReducer<ValueAtAccumulator> {
|
|
24
|
+
declare convert: (value: any) => number;
|
|
25
|
+
|
|
26
|
+
constructor(config?: ValueAtFinderConfig) {
|
|
27
|
+
super(config);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declareData(...args: any[]) {
|
|
31
|
+
super.declareData(...args, {
|
|
32
|
+
at: undefined,
|
|
33
|
+
value: undefined,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
onInitAccumulator = (acc: ValueAtAccumulator, { data }: PointReducerInstance<ValueAtAccumulator>) => {
|
|
38
|
+
acc.at = this.convert((data as any).at);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
onMap = (acc: ValueAtAccumulator, x: any, y: any, name: string) => {
|
|
42
|
+
let cx = this.convert(x);
|
|
43
|
+
let d = cx - acc.at;
|
|
44
|
+
if (d <= 0 && (!acc.left || acc.left.d < d)) {
|
|
45
|
+
acc.left = {
|
|
46
|
+
x: cx,
|
|
47
|
+
y,
|
|
48
|
+
d,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (d >= 0 && (!acc.right || acc.right.d > d)) {
|
|
52
|
+
acc.right = {
|
|
53
|
+
x: cx,
|
|
54
|
+
y,
|
|
55
|
+
d,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
onReduce = (acc: ValueAtAccumulator, instance: PointReducerInstance<ValueAtAccumulator>) => {
|
|
61
|
+
let y: number | null = null;
|
|
62
|
+
if (acc.left && acc.right) {
|
|
63
|
+
if (acc.left.x == acc.right.x) y = acc.left.y;
|
|
64
|
+
else if (acc.left.y != null && acc.right.y != null) {
|
|
65
|
+
y = acc.left.y + ((acc.right.y - acc.left.y) * (acc.at - acc.left.x)) / (acc.right.x - acc.left.x);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
instance.set("value", y);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
ValueAtFinder.prototype.convert = (x) => x;
|
|
@@ -1,88 +1,89 @@
|
|
|
1
|
-
import { View, ViewConfig } from "./View";
|
|
2
|
-
import { Binding } from "./Binding";
|
|
3
|
-
|
|
4
|
-
export interface AugmentedViewBaseConfig extends ViewConfig {
|
|
5
|
-
store: View<any>;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export class AugmentedViewBase<D = any> extends View<D> {
|
|
9
|
-
declare immutable: boolean;
|
|
10
|
-
declare store: View;
|
|
11
|
-
|
|
12
|
-
constructor(config: AugmentedViewBaseConfig) {
|
|
13
|
-
super(config);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
getData() {
|
|
17
|
-
if (this.sealed && this.meta.version === this.cache.version && this.meta === this.store.meta)
|
|
18
|
-
return this.cache.result;
|
|
19
|
-
let parentStoreData = this.store.getData();
|
|
20
|
-
let result = this.getBaseData(parentStoreData);
|
|
21
|
-
this.embedAugmentData(result, parentStoreData);
|
|
22
|
-
this.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return parentStoreData;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
let
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
1
|
+
import { View, ViewConfig } from "./View";
|
|
2
|
+
import { Binding } from "./Binding";
|
|
3
|
+
|
|
4
|
+
export interface AugmentedViewBaseConfig extends ViewConfig {
|
|
5
|
+
store: View<any>;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export class AugmentedViewBase<D = any> extends View<D> {
|
|
9
|
+
declare immutable: boolean;
|
|
10
|
+
declare store: View;
|
|
11
|
+
|
|
12
|
+
constructor(config: AugmentedViewBaseConfig) {
|
|
13
|
+
super(config);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
getData() {
|
|
17
|
+
if (this.sealed && this.meta.version === this.cache.version && this.meta === this.store.meta)
|
|
18
|
+
return this.cache.result;
|
|
19
|
+
let parentStoreData = this.store.getData();
|
|
20
|
+
let result = this.getBaseData(parentStoreData);
|
|
21
|
+
this.embedAugmentData(result, parentStoreData);
|
|
22
|
+
if (this.sealed) {
|
|
23
|
+
this.cache.result = result;
|
|
24
|
+
this.cache.version = this.meta.version;
|
|
25
|
+
}
|
|
26
|
+
this.meta = this.store.meta;
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
protected getBaseData(parentStoreData: any): any {
|
|
31
|
+
if (this.sealed || this.immutable || this.store.sealed) return { ...parentStoreData };
|
|
32
|
+
return parentStoreData;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
protected embedAugmentData(result: any, parentStoreData: any): void {
|
|
36
|
+
throw new Error("abstract");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
protected isExtraKey(key: string): boolean {
|
|
40
|
+
throw new Error("abstract");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Stores which need to support nested aliases should override this method
|
|
44
|
+
protected getExtraKeyBinding(key: string): any {
|
|
45
|
+
let binding = Binding.get(key);
|
|
46
|
+
return this.isExtraKey(binding.parts[0]) ? Binding.get(binding.parts[0]) : null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
protected setExtraKeyValue(key: string, value: any): boolean {
|
|
50
|
+
throw new Error("abstract");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
protected deleteExtraKeyValue(key: string): boolean {
|
|
54
|
+
throw new Error("abstract");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
setItem(path: string, value: any): boolean {
|
|
58
|
+
let extraKeyBinding = this.getExtraKeyBinding(path);
|
|
59
|
+
if (extraKeyBinding) {
|
|
60
|
+
let binding = Binding.get(path);
|
|
61
|
+
let newValue = value;
|
|
62
|
+
if (binding.parts.length > extraKeyBinding.parts.length) {
|
|
63
|
+
let data = {};
|
|
64
|
+
this.embedAugmentData(data, this.store.getData());
|
|
65
|
+
let binding = Binding.get(path);
|
|
66
|
+
data = binding.set(data, value);
|
|
67
|
+
newValue = extraKeyBinding.value(data);
|
|
68
|
+
}
|
|
69
|
+
return this.setExtraKeyValue(extraKeyBinding.path, newValue);
|
|
70
|
+
}
|
|
71
|
+
return super.setItem(path, value);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
deleteItem(path: string): boolean {
|
|
75
|
+
let extraKeyBinding = this.getExtraKeyBinding(path);
|
|
76
|
+
if (extraKeyBinding) {
|
|
77
|
+
if (path == extraKeyBinding.path) return this.deleteExtraKeyValue(extraKeyBinding.path);
|
|
78
|
+
let data = {};
|
|
79
|
+
this.embedAugmentData(data, this.store.getData());
|
|
80
|
+
let binding = Binding.get(path);
|
|
81
|
+
data = binding.delete(data);
|
|
82
|
+
let newValue = extraKeyBinding.value(data);
|
|
83
|
+
return this.setExtraKeyValue(extraKeyBinding.path, newValue);
|
|
84
|
+
}
|
|
85
|
+
return super.deleteItem(path);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
AugmentedViewBase.prototype.immutable = false;
|