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.
Files changed (46) hide show
  1. package/build/data/AugmentedViewBase.d.ts.map +1 -1
  2. package/build/data/AugmentedViewBase.js +5 -4
  3. package/build/data/View.d.ts +0 -1
  4. package/build/data/View.d.ts.map +1 -1
  5. package/build/data/View.js +1 -3
  6. package/build/widgets/form/LookupField.js +2 -1
  7. package/dist/data.js +5 -4
  8. package/dist/manifest.js +756 -756
  9. package/dist/widgets.css +9 -3
  10. package/dist/widgets.js +5 -1
  11. package/package.json +1 -1
  12. package/src/charts/BarGraph.scss +31 -31
  13. package/src/charts/Legend.scss +57 -57
  14. package/src/charts/LegendEntry.scss +35 -35
  15. package/src/charts/LineGraph.scss +28 -28
  16. package/src/charts/helpers/SnapPointFinder.ts +136 -136
  17. package/src/charts/helpers/ValueAtFinder.ts +72 -72
  18. package/src/data/AugmentedViewBase.ts +89 -88
  19. package/src/data/View.ts +301 -346
  20. package/src/data/createAccessorModelProxy.ts +66 -66
  21. package/src/ui/DataProxy.ts +55 -55
  22. package/src/ui/Repeater.spec.tsx +181 -181
  23. package/src/ui/Rescope.ts +50 -50
  24. package/src/ui/adapter/ArrayAdapter.ts +229 -229
  25. package/src/ui/exprHelpers.ts +96 -96
  26. package/src/util/scss/include.scss +69 -69
  27. package/src/widgets/Button.maps.scss +103 -103
  28. package/src/widgets/Sandbox.ts +104 -104
  29. package/src/widgets/form/Calendar.tsx +772 -772
  30. package/src/widgets/form/ColorField.scss +112 -112
  31. package/src/widgets/form/DateTimeField.scss +111 -111
  32. package/src/widgets/form/LookupField.maps.scss +26 -26
  33. package/src/widgets/form/LookupField.scss +10 -3
  34. package/src/widgets/form/LookupField.tsx +4 -1
  35. package/src/widgets/form/MonthField.scss +113 -113
  36. package/src/widgets/form/NumberField.scss +72 -72
  37. package/src/widgets/form/Select.scss +104 -104
  38. package/src/widgets/form/TextField.scss +66 -66
  39. package/src/widgets/grid/Grid.scss +657 -657
  40. package/src/widgets/grid/variables.scss +47 -47
  41. package/src/widgets/index.ts +63 -63
  42. package/src/widgets/nav/MenuItem.scss +150 -150
  43. package/src/widgets/nav/MenuItem.tsx +525 -525
  44. package/src/widgets/nav/Tab.ts +122 -122
  45. package/src/widgets/overlay/Overlay.tsx +1029 -1029
  46. 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.cache.result = result;
23
- this.cache.parentStoreData = parentStoreData;
24
- this.cache.version = this.meta.version;
25
- this.meta = this.store.meta;
26
- return this.cache.result;
27
- }
28
-
29
- protected getBaseData(parentStoreData: any): any {
30
- if (this.sealed || this.immutable || this.store.sealed) return { ...parentStoreData };
31
- return parentStoreData;
32
- }
33
-
34
- protected embedAugmentData(result: any, parentStoreData: any): void {
35
- throw new Error("abstract");
36
- }
37
-
38
- protected isExtraKey(key: string): boolean {
39
- throw new Error("abstract");
40
- }
41
-
42
- // Stores which need to support nested aliases should override this method
43
- protected getExtraKeyBinding(key: string): any {
44
- let binding = Binding.get(key);
45
- return this.isExtraKey(binding.parts[0]) ? Binding.get(binding.parts[0]) : null;
46
- }
47
-
48
- protected setExtraKeyValue(key: string, value: any): boolean {
49
- throw new Error("abstract");
50
- }
51
-
52
- protected deleteExtraKeyValue(key: string): boolean {
53
- throw new Error("abstract");
54
- }
55
-
56
- setItem(path: string, value: any): boolean {
57
- let extraKeyBinding = this.getExtraKeyBinding(path);
58
- if (extraKeyBinding) {
59
- let binding = Binding.get(path);
60
- let newValue = value;
61
- if (binding.parts.length > extraKeyBinding.parts.length) {
62
- let data = {};
63
- this.embedAugmentData(data, this.store.getData());
64
- let binding = Binding.get(path);
65
- data = binding.set(data, value);
66
- newValue = extraKeyBinding.value(data);
67
- }
68
- return this.setExtraKeyValue(extraKeyBinding.path, newValue);
69
- }
70
- return super.setItem(path, value);
71
- }
72
-
73
- deleteItem(path: string): boolean {
74
- let extraKeyBinding = this.getExtraKeyBinding(path);
75
- if (extraKeyBinding) {
76
- if (path == extraKeyBinding.path) return this.deleteExtraKeyValue(extraKeyBinding.path);
77
- let data = {};
78
- this.embedAugmentData(data, this.store.getData());
79
- let binding = Binding.get(path);
80
- data = binding.delete(data);
81
- let newValue = extraKeyBinding.value(data);
82
- return this.setExtraKeyValue(extraKeyBinding.path, newValue);
83
- }
84
- return super.deleteItem(path);
85
- }
86
- }
87
-
88
- AugmentedViewBase.prototype.immutable = false;
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;