cx 24.2.0 → 24.3.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 +104 -34
- package/dist/manifest.js +536 -536
- package/dist/widgets.js +32 -24
- package/package.json +1 -1
- package/src/charts/PieChart.d.ts +3 -0
- package/src/charts/PieChart.js +115 -36
- package/src/charts/axis/Axis.d.ts +96 -96
- package/src/charts/axis/Axis.js +252 -252
- package/src/data/StringTemplate.spec.js +105 -105
- package/src/ui/Controller.d.ts +182 -182
- package/src/ui/Cx.d.ts +3 -3
- package/src/ui/FocusManager.js +171 -171
- package/src/ui/Instance.d.ts +72 -72
- package/src/ui/app/startAppLoop.js +3 -3
- package/src/widgets/form/Label.js +88 -88
- package/src/widgets/form/UploadButton.d.ts +34 -34
- package/src/widgets/grid/Grid.js +6 -8
- package/src/widgets/overlay/captureMouse.js +124 -133
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import * as Cx from "../../core";
|
|
2
|
-
import { FieldProps } from "./Field";
|
|
3
|
-
|
|
4
|
-
interface UploadButtonProps extends FieldProps {
|
|
5
|
-
/** Text description. */
|
|
6
|
-
text?: Cx.StringProp;
|
|
7
|
-
|
|
8
|
-
url?: Cx.StringProp;
|
|
9
|
-
|
|
10
|
-
/** Base CSS class to be applied to the element. Default is 'uploadbutton'. */
|
|
11
|
-
baseClass?: string;
|
|
12
|
-
|
|
13
|
-
/** Defaults to `false`. Set to `true` to enable multiple selection. */
|
|
14
|
-
multiple?: boolean;
|
|
15
|
-
|
|
16
|
-
method?: string;
|
|
17
|
-
uploadInProgressText?: string;
|
|
18
|
-
|
|
19
|
-
/** Defaults to `false`. Set to `true` to abort uploads if the button is destroyed (unmounted). */
|
|
20
|
-
abortOnDestroy?: boolean;
|
|
21
|
-
|
|
22
|
-
/** Defines file types that are accepted for upload. */
|
|
23
|
-
accept?: Cx.StringProp;
|
|
24
|
-
|
|
25
|
-
/** Name of the icon to be put on the left side of the button. */
|
|
26
|
-
icon?: Cx.StringProp;
|
|
27
|
-
|
|
28
|
-
onUploadStarting?: ((xhr: XMLHttpRequest, instance: any, file: File, formData: FormData) => boolean) | string;
|
|
29
|
-
onUploadComplete?: ((xhr: XMLHttpRequest, instance: any, file: File, formData: FormData) => void) | string;
|
|
30
|
-
onUploadProgress?: ((event: ProgressEvent, instance: any, file: File, formData: FormData) => void) | string;
|
|
31
|
-
onUploadError?: ((event: ProgressEvent, instance: any, file: File, formData: FormData) => void) | string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export class UploadButton extends Cx.Widget<UploadButtonProps> {}
|
|
1
|
+
import * as Cx from "../../core";
|
|
2
|
+
import { FieldProps } from "./Field";
|
|
3
|
+
|
|
4
|
+
interface UploadButtonProps extends FieldProps {
|
|
5
|
+
/** Text description. */
|
|
6
|
+
text?: Cx.StringProp;
|
|
7
|
+
|
|
8
|
+
url?: Cx.StringProp;
|
|
9
|
+
|
|
10
|
+
/** Base CSS class to be applied to the element. Default is 'uploadbutton'. */
|
|
11
|
+
baseClass?: string;
|
|
12
|
+
|
|
13
|
+
/** Defaults to `false`. Set to `true` to enable multiple selection. */
|
|
14
|
+
multiple?: boolean;
|
|
15
|
+
|
|
16
|
+
method?: string;
|
|
17
|
+
uploadInProgressText?: string;
|
|
18
|
+
|
|
19
|
+
/** Defaults to `false`. Set to `true` to abort uploads if the button is destroyed (unmounted). */
|
|
20
|
+
abortOnDestroy?: boolean;
|
|
21
|
+
|
|
22
|
+
/** Defines file types that are accepted for upload. */
|
|
23
|
+
accept?: Cx.StringProp;
|
|
24
|
+
|
|
25
|
+
/** Name of the icon to be put on the left side of the button. */
|
|
26
|
+
icon?: Cx.StringProp;
|
|
27
|
+
|
|
28
|
+
onUploadStarting?: ((xhr: XMLHttpRequest, instance: any, file: File, formData: FormData) => boolean) | string;
|
|
29
|
+
onUploadComplete?: ((xhr: XMLHttpRequest, instance: any, file: File, formData: FormData) => void) | string;
|
|
30
|
+
onUploadProgress?: ((event: ProgressEvent, instance: any, file: File, formData: FormData) => void) | string;
|
|
31
|
+
onUploadError?: ((event: ProgressEvent, instance: any, file: File, formData: FormData) => void) | string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class UploadButton extends Cx.Widget<UploadButtonProps> {}
|
package/src/widgets/grid/Grid.js
CHANGED
|
@@ -752,19 +752,17 @@ export class Grid extends Container {
|
|
|
752
752
|
);
|
|
753
753
|
}
|
|
754
754
|
|
|
755
|
-
headerRows.push(
|
|
756
|
-
<tbody key={"h" + key + lineIndex} className={CSS.element(baseClass, "header")}>
|
|
757
|
-
{result.map((h, i) => (
|
|
758
|
-
<tr key={i}>{h}</tr>
|
|
759
|
-
))}
|
|
760
|
-
</tbody>,
|
|
761
|
-
);
|
|
755
|
+
headerRows.push(...result.map((h, i) => <tr key={`${lineIndex}-${i}`}>{h}</tr>));
|
|
762
756
|
}
|
|
763
757
|
});
|
|
764
758
|
|
|
765
759
|
if (headerRows.length == 0) return null;
|
|
766
760
|
|
|
767
|
-
return
|
|
761
|
+
return (
|
|
762
|
+
<tbody key={"h" + key} className={CSS.element(baseClass, "header")}>
|
|
763
|
+
{headerRows}
|
|
764
|
+
</tbody>
|
|
765
|
+
);
|
|
768
766
|
}
|
|
769
767
|
|
|
770
768
|
onHeaderMouseMove(e, column, columnInstance, gridInstance, headerLine) {
|
|
@@ -1,133 +1,124 @@
|
|
|
1
|
-
import { batchUpdates } from
|
|
2
|
-
import { getParentFrameBoundingClientRect } from
|
|
3
|
-
|
|
4
|
-
export function captureMouse2(e, { onMouseMove, onMouseUp, onDblClick, captureData, cursor }) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
surface.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
e.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
if (onMouseUp)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export function getCursorPos(e) {
|
|
127
|
-
let p = (e.touches && e.touches[0]) || e;
|
|
128
|
-
let offset = getParentFrameBoundingClientRect(e.target);
|
|
129
|
-
return {
|
|
130
|
-
clientX: p.clientX + offset.left,
|
|
131
|
-
clientY: p.clientY + offset.top
|
|
132
|
-
}
|
|
133
|
-
}
|
|
1
|
+
import { batchUpdates } from "../../ui/batchUpdates";
|
|
2
|
+
import { getParentFrameBoundingClientRect } from "../../util/getParentFrameBoundingClientRect";
|
|
3
|
+
|
|
4
|
+
export function captureMouse2(e, { onMouseMove, onMouseUp, onDblClick, captureData, cursor }) {
|
|
5
|
+
let surface = document.createElement("div");
|
|
6
|
+
surface.className = "cxb-mousecapture";
|
|
7
|
+
surface.style.cursor = cursor || getComputedStyle(e.currentTarget).cursor;
|
|
8
|
+
|
|
9
|
+
document.body.appendChild(surface);
|
|
10
|
+
|
|
11
|
+
// In case when the event originates from an iframe,
|
|
12
|
+
// we use that document as events do not bubble up. //
|
|
13
|
+
let parentDocument = e.target.ownerDocument;
|
|
14
|
+
let options = { capture: true };
|
|
15
|
+
|
|
16
|
+
let active = true;
|
|
17
|
+
parentDocument.addEventListener("mousemove", move, options);
|
|
18
|
+
parentDocument.addEventListener("mouseup", end, options);
|
|
19
|
+
if (onDblClick) parentDocument.addEventListener("dblclick", doubleClick), options;
|
|
20
|
+
|
|
21
|
+
function tear() {
|
|
22
|
+
if (surface == null) return;
|
|
23
|
+
parentDocument.removeEventListener("mousemove", move, options);
|
|
24
|
+
parentDocument.removeEventListener("mouseup", end, options);
|
|
25
|
+
if (onDblClick) parentDocument.removeEventListener("dblclick", onDblClick, options);
|
|
26
|
+
document.body.removeChild(surface);
|
|
27
|
+
surface = null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function doubleClick(e) {
|
|
31
|
+
try {
|
|
32
|
+
onDblClick(e);
|
|
33
|
+
} finally {
|
|
34
|
+
tear();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
e.stopPropagation();
|
|
39
|
+
|
|
40
|
+
function move(e) {
|
|
41
|
+
if (!active) {
|
|
42
|
+
tear();
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
//if mouse moves double clicking is off
|
|
47
|
+
onDblClick = null;
|
|
48
|
+
|
|
49
|
+
batchUpdates(() => {
|
|
50
|
+
if (onMouseMove) onMouseMove(e, captureData);
|
|
51
|
+
e.stopPropagation();
|
|
52
|
+
e.preventDefault(); //disable text selection
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function end(e) {
|
|
57
|
+
active = false;
|
|
58
|
+
batchUpdates(() => {
|
|
59
|
+
// if (surface.releaseCapture)
|
|
60
|
+
// surface.releaseCapture();
|
|
61
|
+
|
|
62
|
+
if (!onDblClick) surface.style.display = "none";
|
|
63
|
+
try {
|
|
64
|
+
if (onMouseUp) onMouseUp(e, captureData);
|
|
65
|
+
} finally {
|
|
66
|
+
if (onDblClick) {
|
|
67
|
+
//keep the surface a little longer to detect double clicks
|
|
68
|
+
setTimeout(tear, 1500);
|
|
69
|
+
} else tear();
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function captureMouseOrTouch2(e, { onMouseMove, onMouseUp, onDblClick, captureData, cursor }) {
|
|
76
|
+
if (e.type.indexOf("touch") == 0) {
|
|
77
|
+
let el = e.currentTarget;
|
|
78
|
+
|
|
79
|
+
let move = (e) => {
|
|
80
|
+
batchUpdates(() => {
|
|
81
|
+
if (onMouseMove) onMouseMove(e, captureData);
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
let end = (e) => {
|
|
87
|
+
batchUpdates(() => {
|
|
88
|
+
el.removeEventListener("touchmove", move);
|
|
89
|
+
el.removeEventListener("touchend", end);
|
|
90
|
+
|
|
91
|
+
if (onMouseUp) onMouseUp(e);
|
|
92
|
+
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
el.addEventListener("touchmove", move);
|
|
98
|
+
el.addEventListener("touchend", end);
|
|
99
|
+
|
|
100
|
+
e.stopPropagation();
|
|
101
|
+
} else captureMouse2(e, { onMouseMove, onMouseUp, captureData, onDblClick, cursor });
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function captureMouse(e, onMouseMove, onMouseUp, captureData, cursor) {
|
|
105
|
+
captureMouse2(e, {
|
|
106
|
+
onMouseMove,
|
|
107
|
+
onMouseUp,
|
|
108
|
+
captureData,
|
|
109
|
+
cursor,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function captureMouseOrTouch(e, onMouseMove, onMouseUp, captureData, cursor) {
|
|
114
|
+
captureMouseOrTouch2(e, { onMouseMove, onMouseUp, captureData, cursor });
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function getCursorPos(e) {
|
|
118
|
+
let p = (e.touches && e.touches[0]) || e;
|
|
119
|
+
let offset = getParentFrameBoundingClientRect(e.target);
|
|
120
|
+
return {
|
|
121
|
+
clientX: p.clientX + offset.left,
|
|
122
|
+
clientY: p.clientY + offset.top,
|
|
123
|
+
};
|
|
124
|
+
}
|