cx 25.5.1 → 25.6.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 +40 -21
- package/dist/manifest.js +771 -771
- package/dist/ui.js +0 -15
- package/dist/widgets.js +34 -25
- package/package.json +1 -1
- package/src/charts/LineGraph.js +1 -1
- package/src/charts/axis/NumericAxis.d.ts +46 -46
- package/src/charts/helpers/PointReducer.d.ts +9 -0
- package/src/charts/helpers/PointReducer.js +36 -22
- package/src/data/AugmentedViewBase.js +77 -77
- package/src/data/ExposedRecordView.js +75 -75
- package/src/data/ExposedValueView.js +73 -73
- package/src/data/Ref.d.ts +24 -24
- package/src/data/Ref.spec.js +79 -79
- package/src/data/StoreRef.spec.js +24 -24
- package/src/data/StructuredDataAccessor.d.ts +7 -7
- package/src/data/SubscribableView.js +54 -54
- package/src/ui/Container.js +154 -154
- package/src/ui/DataProxy.js +31 -45
- package/src/ui/DetachedScope.js +98 -98
- package/src/ui/Instance.d.ts +72 -72
- package/src/ui/Instance.js +623 -623
- package/src/ui/IsolatedScope.js +30 -30
- package/src/ui/Repeater.js +109 -109
- package/src/ui/Rescope.js +35 -35
- package/src/ui/Restate.js +167 -167
- package/src/ui/Widget.js +184 -184
- package/src/ui/adapter/ArrayAdapter.js +152 -152
- package/src/ui/adapter/TreeAdapter.js +101 -101
- package/src/ui/createFunctionalComponent.d.ts +1 -1
- package/src/ui/index.d.ts +42 -42
- package/src/ui/layout/exploreChildren.d.ts +12 -12
- package/src/ui/layout/exploreChildren.js +27 -27
- package/src/util/debounce.js +18 -18
- package/src/util/validatedDebounce.js +19 -19
- package/src/widgets/Button.js +118 -118
- package/src/widgets/List.js +594 -594
- package/src/widgets/form/Calendar.d.ts +86 -86
- package/src/widgets/form/Checkbox.js +5 -2
- package/src/widgets/form/MonthField.d.ts +5 -0
- package/src/widgets/form/MonthField.js +1 -0
- package/src/widgets/form/MonthPicker.d.ts +13 -0
- package/src/widgets/form/MonthPicker.js +25 -21
- package/src/widgets/grid/Grid.js +3421 -3421
- package/src/widgets/nav/Route.js +102 -102
package/src/widgets/Button.js
CHANGED
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
import { Widget, VDOM, getContentArray } from "../ui/Widget";
|
|
2
|
-
import { HtmlElement } from "./HtmlElement";
|
|
3
|
-
import { yesNo } from "./overlay/alerts";
|
|
4
|
-
import { Icon } from "./Icon";
|
|
5
|
-
import { preventFocus } from "../ui/FocusManager";
|
|
6
|
-
import { isFunction } from "../util/isFunction";
|
|
7
|
-
import { isDefined } from "../util/isDefined";
|
|
8
|
-
import { coalesce } from "../util/coalesce";
|
|
9
|
-
|
|
10
|
-
export class Button extends HtmlElement {
|
|
11
|
-
declareData() {
|
|
12
|
-
super.declareData(...arguments, {
|
|
13
|
-
confirm: { structured: true },
|
|
14
|
-
pressed: undefined,
|
|
15
|
-
icon: undefined,
|
|
16
|
-
disabled: undefined,
|
|
17
|
-
enabled: undefined,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
prepareData(context, instance) {
|
|
22
|
-
let { data } = instance;
|
|
23
|
-
data.stateMods = {
|
|
24
|
-
...data.stateMods,
|
|
25
|
-
pressed: data.pressed,
|
|
26
|
-
};
|
|
27
|
-
if (isDefined(data.enabled)) data.disabled = !data.enabled;
|
|
28
|
-
|
|
29
|
-
super.prepareData(context, instance);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
explore(context, instance) {
|
|
33
|
-
instance.data.parentDisabled = context.parentDisabled;
|
|
34
|
-
instance.data.parentStrict = context.parentStrict;
|
|
35
|
-
|
|
36
|
-
if (instance.cache("parentDisabled", context.parentDisabled)) instance.markShouldUpdate(context);
|
|
37
|
-
if (instance.cache("parentStrict", context.parentStrict)) instance.markShouldUpdate(context);
|
|
38
|
-
|
|
39
|
-
super.explore(context, instance);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
attachProps(context, instance, props) {
|
|
43
|
-
super.attachProps(context, instance, props);
|
|
44
|
-
|
|
45
|
-
if (!this.focusOnMouseDown) {
|
|
46
|
-
props.onMouseDown = (e) => {
|
|
47
|
-
if (this.onMouseDown && instance.invoke("onMouseDown", e, instance) == false) return;
|
|
48
|
-
preventFocus(e);
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (this.dismiss) {
|
|
53
|
-
let { onClick } = props;
|
|
54
|
-
|
|
55
|
-
props.onClick = (...args) => {
|
|
56
|
-
if (onClick && onClick(...args) === false) return;
|
|
57
|
-
|
|
58
|
-
if (instance.parentOptions && isFunction(instance.parentOptions.dismiss)) instance.parentOptions.dismiss();
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (this.tag === "button") props.type = this.submit ? "submit" : "button";
|
|
63
|
-
|
|
64
|
-
delete props.confirm;
|
|
65
|
-
delete props.dismiss;
|
|
66
|
-
delete props.pressed;
|
|
67
|
-
delete props.submit;
|
|
68
|
-
delete props.focusOnMouseDown;
|
|
69
|
-
delete props.icon;
|
|
70
|
-
delete props.enabled;
|
|
71
|
-
|
|
72
|
-
let oldOnClick,
|
|
73
|
-
{ data } = instance;
|
|
74
|
-
|
|
75
|
-
props.disabled = coalesce(data.parentStrict ? data.parentDisabled : null, data.disabled, data.parentDisabled);
|
|
76
|
-
|
|
77
|
-
if (data.confirm) {
|
|
78
|
-
oldOnClick = props.onClick;
|
|
79
|
-
props.onClick = () => {
|
|
80
|
-
yesNo(data.confirm).then((btn) => {
|
|
81
|
-
if (btn == "yes") oldOnClick.call(this, null, instance);
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
let icon, children;
|
|
87
|
-
|
|
88
|
-
if (data.icon) {
|
|
89
|
-
icon = Icon.render(data.icon, {
|
|
90
|
-
key: "icon",
|
|
91
|
-
className: this.CSS.element(this.baseClass, "icon"),
|
|
92
|
-
});
|
|
93
|
-
children = getContentArray(props.children);
|
|
94
|
-
props.children = [icon, ...children];
|
|
95
|
-
props.className = this.CSS.expand(
|
|
96
|
-
props.className,
|
|
97
|
-
this.CSS.state("icon"),
|
|
98
|
-
children.length == 0 && this.CSS.state("empty")
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
if (children.length == 0) {
|
|
102
|
-
props.children.push(
|
|
103
|
-
<span key="baseline" className={this.CSS.element(this.baseClass, "baseline")}>
|
|
104
|
-
|
|
105
|
-
</span>
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
Button.prototype.tag = "button";
|
|
113
|
-
Button.prototype.baseClass = "button";
|
|
114
|
-
Button.prototype.icon = false;
|
|
115
|
-
Button.prototype.focusOnMouseDown = false;
|
|
116
|
-
Button.prototype.submit = false;
|
|
117
|
-
|
|
118
|
-
Widget.alias("button", Button);
|
|
1
|
+
import { Widget, VDOM, getContentArray } from "../ui/Widget";
|
|
2
|
+
import { HtmlElement } from "./HtmlElement";
|
|
3
|
+
import { yesNo } from "./overlay/alerts";
|
|
4
|
+
import { Icon } from "./Icon";
|
|
5
|
+
import { preventFocus } from "../ui/FocusManager";
|
|
6
|
+
import { isFunction } from "../util/isFunction";
|
|
7
|
+
import { isDefined } from "../util/isDefined";
|
|
8
|
+
import { coalesce } from "../util/coalesce";
|
|
9
|
+
|
|
10
|
+
export class Button extends HtmlElement {
|
|
11
|
+
declareData() {
|
|
12
|
+
super.declareData(...arguments, {
|
|
13
|
+
confirm: { structured: true },
|
|
14
|
+
pressed: undefined,
|
|
15
|
+
icon: undefined,
|
|
16
|
+
disabled: undefined,
|
|
17
|
+
enabled: undefined,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
prepareData(context, instance) {
|
|
22
|
+
let { data } = instance;
|
|
23
|
+
data.stateMods = {
|
|
24
|
+
...data.stateMods,
|
|
25
|
+
pressed: data.pressed,
|
|
26
|
+
};
|
|
27
|
+
if (isDefined(data.enabled)) data.disabled = !data.enabled;
|
|
28
|
+
|
|
29
|
+
super.prepareData(context, instance);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
explore(context, instance) {
|
|
33
|
+
instance.data.parentDisabled = context.parentDisabled;
|
|
34
|
+
instance.data.parentStrict = context.parentStrict;
|
|
35
|
+
|
|
36
|
+
if (instance.cache("parentDisabled", context.parentDisabled)) instance.markShouldUpdate(context);
|
|
37
|
+
if (instance.cache("parentStrict", context.parentStrict)) instance.markShouldUpdate(context);
|
|
38
|
+
|
|
39
|
+
super.explore(context, instance);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
attachProps(context, instance, props) {
|
|
43
|
+
super.attachProps(context, instance, props);
|
|
44
|
+
|
|
45
|
+
if (!this.focusOnMouseDown) {
|
|
46
|
+
props.onMouseDown = (e) => {
|
|
47
|
+
if (this.onMouseDown && instance.invoke("onMouseDown", e, instance) == false) return;
|
|
48
|
+
preventFocus(e);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (this.dismiss) {
|
|
53
|
+
let { onClick } = props;
|
|
54
|
+
|
|
55
|
+
props.onClick = (...args) => {
|
|
56
|
+
if (onClick && onClick(...args) === false) return;
|
|
57
|
+
|
|
58
|
+
if (instance.parentOptions && isFunction(instance.parentOptions.dismiss)) instance.parentOptions.dismiss();
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (this.tag === "button") props.type = this.submit ? "submit" : "button";
|
|
63
|
+
|
|
64
|
+
delete props.confirm;
|
|
65
|
+
delete props.dismiss;
|
|
66
|
+
delete props.pressed;
|
|
67
|
+
delete props.submit;
|
|
68
|
+
delete props.focusOnMouseDown;
|
|
69
|
+
delete props.icon;
|
|
70
|
+
delete props.enabled;
|
|
71
|
+
|
|
72
|
+
let oldOnClick,
|
|
73
|
+
{ data } = instance;
|
|
74
|
+
|
|
75
|
+
props.disabled = coalesce(data.parentStrict ? data.parentDisabled : null, data.disabled, data.parentDisabled);
|
|
76
|
+
|
|
77
|
+
if (data.confirm) {
|
|
78
|
+
oldOnClick = props.onClick;
|
|
79
|
+
props.onClick = () => {
|
|
80
|
+
yesNo(data.confirm).then((btn) => {
|
|
81
|
+
if (btn == "yes") oldOnClick.call(this, null, instance);
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
let icon, children;
|
|
87
|
+
|
|
88
|
+
if (data.icon) {
|
|
89
|
+
icon = Icon.render(data.icon, {
|
|
90
|
+
key: "icon",
|
|
91
|
+
className: this.CSS.element(this.baseClass, "icon"),
|
|
92
|
+
});
|
|
93
|
+
children = getContentArray(props.children);
|
|
94
|
+
props.children = [icon, ...children];
|
|
95
|
+
props.className = this.CSS.expand(
|
|
96
|
+
props.className,
|
|
97
|
+
this.CSS.state("icon"),
|
|
98
|
+
children.length == 0 && this.CSS.state("empty")
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
if (children.length == 0) {
|
|
102
|
+
props.children.push(
|
|
103
|
+
<span key="baseline" className={this.CSS.element(this.baseClass, "baseline")}>
|
|
104
|
+
|
|
105
|
+
</span>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
Button.prototype.tag = "button";
|
|
113
|
+
Button.prototype.baseClass = "button";
|
|
114
|
+
Button.prototype.icon = false;
|
|
115
|
+
Button.prototype.focusOnMouseDown = false;
|
|
116
|
+
Button.prototype.submit = false;
|
|
117
|
+
|
|
118
|
+
Widget.alias("button", Button);
|