cx 24.0.2 → 24.2.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/data.js +15 -26
- package/dist/manifest.js +525 -522
- package/dist/ui.js +1 -1
- package/dist/widgets.js +162 -77
- package/locale/de-de.js +6 -1
- package/locale/en-us.js +5 -1
- package/locale/es-es.js +6 -1
- package/locale/fr-fr.js +7 -2
- package/locale/nl-nl.js +4 -5
- package/locale/pt-pt.js +12 -1
- package/locale/sr-latn-ba.js +6 -2
- package/package.json +1 -1
- package/src/charts/ColorMap.js +4 -6
- package/src/charts/axis/Axis.d.ts +96 -96
- package/src/charts/axis/Axis.js +252 -252
- package/src/data/Expression.js +212 -212
- package/src/data/Expression.spec.js +174 -174
- package/src/data/StringTemplate.spec.js +105 -105
- package/src/data/StructuredSelector.d.ts +1 -1
- package/src/data/ops/updateTree.js +1 -1
- package/src/data/ops/updateTree.spec.js +16 -14
- package/src/ui/Controller.d.ts +182 -182
- package/src/ui/Culture.d.ts +0 -3
- package/src/ui/DataProxy.d.ts +1 -0
- package/src/ui/DataProxy.js +2 -2
- package/src/ui/FocusManager.js +171 -171
- package/src/ui/Format.js +87 -87
- package/src/ui/Instance.d.ts +72 -72
- package/src/ui/Localization.js +0 -2
- package/src/ui/Rescope.js +2 -2
- package/src/ui/Text.js +2 -4
- package/src/ui/adapter/DataAdapter.js +7 -12
- package/src/ui/adapter/GroupAdapter.d.ts +22 -3
- package/src/ui/adapter/TreeAdapter.d.ts +23 -3
- package/src/ui/keyboardShortcuts.js +4 -5
- package/src/ui/selection/KeySelection.d.ts +1 -1
- package/src/ui/selection/PropertySelection.d.ts +1 -1
- package/src/ui/selection/PropertySelection.js +2 -4
- package/src/ui/selection/Selection.d.ts +1 -1
- package/src/widgets/form/ColorField.js +14 -9
- package/src/widgets/form/ColorPicker.scss +275 -275
- package/src/widgets/form/ColorPicker.variables.scss +22 -22
- package/src/widgets/form/DateTimeField.d.ts +86 -86
- package/src/widgets/form/DateTimeField.js +573 -572
- package/src/widgets/form/Field.js +24 -9
- package/src/widgets/form/FieldIcon.js +42 -0
- package/src/widgets/form/Label.js +88 -88
- package/src/widgets/form/LookupField.d.ts +173 -174
- package/src/widgets/form/LookupField.js +1130 -1131
- package/src/widgets/form/MonthField.d.ts +37 -38
- package/src/widgets/form/MonthField.js +16 -15
- package/src/widgets/form/NumberField.d.ts +2 -2
- package/src/widgets/form/NumberField.js +13 -13
- package/src/widgets/form/Select.d.ts +31 -35
- package/src/widgets/form/Select.js +7 -12
- package/src/widgets/form/TextArea.js +10 -6
- package/src/widgets/form/TextField.d.ts +2 -2
- package/src/widgets/form/TextField.js +17 -14
- package/src/widgets/form/UploadButton.d.ts +34 -34
- package/src/widgets/form/index.js +1 -2
- package/src/widgets/grid/Grid.d.ts +5 -2
- package/src/widgets/overlay/Dropdown.d.ts +1 -0
|
@@ -15,6 +15,7 @@ import { Localization } from "../../ui/Localization";
|
|
|
15
15
|
import ClearIcon from "../icons/clear";
|
|
16
16
|
import { autoFocus } from "../autoFocus";
|
|
17
17
|
import { isString } from "../../util/isString";
|
|
18
|
+
import { getActiveElement } from "../../util/getActiveElement";
|
|
18
19
|
|
|
19
20
|
export class TextField extends Field {
|
|
20
21
|
init() {
|
|
@@ -39,7 +40,7 @@ export class TextField extends Field {
|
|
|
39
40
|
icon: undefined,
|
|
40
41
|
trim: undefined,
|
|
41
42
|
},
|
|
42
|
-
...arguments
|
|
43
|
+
...arguments,
|
|
43
44
|
);
|
|
44
45
|
}
|
|
45
46
|
|
|
@@ -51,6 +52,7 @@ export class TextField extends Field {
|
|
|
51
52
|
data={instance.data}
|
|
52
53
|
label={this.labelPlacement && getContent(this.renderLabel(context, instance, "label"))}
|
|
53
54
|
help={this.helpPlacement && getContent(this.renderHelp(context, instance, "help"))}
|
|
55
|
+
icon={this.renderIcon(context, instance, "icon")}
|
|
54
56
|
/>
|
|
55
57
|
);
|
|
56
58
|
}
|
|
@@ -95,17 +97,17 @@ class Input extends VDOM.Component {
|
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
render() {
|
|
98
|
-
let { instance, data, label, help } = this.props;
|
|
100
|
+
let { instance, data, label, help, icon: iconVDOM } = this.props;
|
|
99
101
|
let { widget, state } = instance;
|
|
100
102
|
let { CSS, baseClass, suppressErrorsUntilVisited } = widget;
|
|
101
103
|
|
|
102
|
-
let icon =
|
|
104
|
+
let icon = iconVDOM && (
|
|
103
105
|
<div
|
|
104
106
|
className={CSS.element(baseClass, "left-icon")}
|
|
105
107
|
onMouseDown={preventDefault}
|
|
106
|
-
onClick={(e) => this.onChange(e, "enter")}
|
|
108
|
+
onClick={(e) => this.onChange(e.target.value, "enter")}
|
|
107
109
|
>
|
|
108
|
-
{
|
|
110
|
+
{iconVDOM}
|
|
109
111
|
</div>
|
|
110
112
|
);
|
|
111
113
|
|
|
@@ -141,7 +143,7 @@ class Input extends VDOM.Component {
|
|
|
141
143
|
clear: insideButton != null,
|
|
142
144
|
empty: empty && !data.placeholder,
|
|
143
145
|
error: data.error && (state.visited || !suppressErrorsUntilVisited || !empty),
|
|
144
|
-
})
|
|
146
|
+
}),
|
|
145
147
|
)}
|
|
146
148
|
style={data.style}
|
|
147
149
|
onMouseDown={stopPropagation}
|
|
@@ -163,8 +165,8 @@ class Input extends VDOM.Component {
|
|
|
163
165
|
{...data.inputAttrs}
|
|
164
166
|
onMouseMove={this.onMouseMove.bind(this)}
|
|
165
167
|
onMouseLeave={this.onMouseLeave.bind(this)}
|
|
166
|
-
onInput={(e) => this.onChange(e, "input")}
|
|
167
|
-
onChange={(e) => this.onChange(e, "change")}
|
|
168
|
+
onInput={(e) => this.onChange(e.target.value, "input")}
|
|
169
|
+
onChange={(e) => this.onChange(e.target.value, "change")}
|
|
168
170
|
onKeyDown={this.onKeyDown.bind(this)}
|
|
169
171
|
onFocus={this.onFocus.bind(this)}
|
|
170
172
|
onBlur={this.onBlur.bind(this)}
|
|
@@ -197,7 +199,7 @@ class Input extends VDOM.Component {
|
|
|
197
199
|
});
|
|
198
200
|
this.props.instance.set("focused", false);
|
|
199
201
|
}
|
|
200
|
-
this.onChange(e, "blur");
|
|
202
|
+
this.onChange(e.target.value, "blur");
|
|
201
203
|
}
|
|
202
204
|
|
|
203
205
|
onClearClick(e) {
|
|
@@ -222,6 +224,7 @@ class Input extends VDOM.Component {
|
|
|
222
224
|
}
|
|
223
225
|
|
|
224
226
|
componentWillUnmount() {
|
|
227
|
+
if (this.input == getActiveElement()) this.onChange(this.input.value, "blur");
|
|
225
228
|
tooltipParentWillUnmount(this.props.instance);
|
|
226
229
|
}
|
|
227
230
|
|
|
@@ -231,7 +234,7 @@ class Input extends VDOM.Component {
|
|
|
231
234
|
|
|
232
235
|
switch (e.keyCode) {
|
|
233
236
|
case KeyCode.enter:
|
|
234
|
-
this.onChange(e, "enter");
|
|
237
|
+
this.onChange(e.target.value, "enter");
|
|
235
238
|
break;
|
|
236
239
|
|
|
237
240
|
case KeyCode.left:
|
|
@@ -243,13 +246,13 @@ class Input extends VDOM.Component {
|
|
|
243
246
|
|
|
244
247
|
UNSAFE_componentWillReceiveProps(props) {
|
|
245
248
|
let { data } = props;
|
|
246
|
-
//
|
|
247
|
-
//and update may be caused by some other property, i.e. visited
|
|
249
|
+
// The second check is required for debouncing, sometimes the value in the store lags after the input
|
|
250
|
+
// and update may be caused by some other property, i.e. visited
|
|
248
251
|
if (data.value != this.input.value && data.value != this.props.data.value) this.input.value = data.value || "";
|
|
249
252
|
tooltipParentWillReceiveProps(this.input, ...getFieldTooltip(props.instance));
|
|
250
253
|
}
|
|
251
254
|
|
|
252
|
-
onChange(
|
|
255
|
+
onChange(textValue, change) {
|
|
253
256
|
let { instance, data } = this.props;
|
|
254
257
|
|
|
255
258
|
let immediate = change == "blur" || change == "enter";
|
|
@@ -261,7 +264,7 @@ class Input extends VDOM.Component {
|
|
|
261
264
|
let { widget } = instance;
|
|
262
265
|
|
|
263
266
|
if (widget.reactOn.indexOf(change) != -1) {
|
|
264
|
-
let text = this.trimmed(
|
|
267
|
+
let text = this.trimmed(textValue);
|
|
265
268
|
if (data.maxLength != null && text.length > data.maxLength) {
|
|
266
269
|
text = text.substring(0, data.maxLength);
|
|
267
270
|
this.input.value = text;
|
|
@@ -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> {}
|
|
@@ -298,6 +298,9 @@ interface GridProps<T = unknown> extends StyledContainerProps {
|
|
|
298
298
|
/** Parameters that affect filtering. */
|
|
299
299
|
filterParams?: StructuredProp;
|
|
300
300
|
|
|
301
|
+
/** Callback function to be executed when a row is right-clicked. */
|
|
302
|
+
onRowContextMenu?: string | ((e: React.SyntheticEvent<any>, instance: Instance) => void);
|
|
303
|
+
|
|
301
304
|
/** Callback to create a filter function for given filter params. */
|
|
302
305
|
onCreateFilter?: (filterParams: any, instance?: Instance) => (record: T) => boolean;
|
|
303
306
|
|
|
@@ -316,7 +319,7 @@ interface GridProps<T = unknown> extends StyledContainerProps {
|
|
|
316
319
|
sortField?: string;
|
|
317
320
|
sortDirection?: string;
|
|
318
321
|
},
|
|
319
|
-
instance?: Instance
|
|
322
|
+
instance?: Instance,
|
|
320
323
|
) => FetchRecordsResult | Promise<FetchRecordsResult>;
|
|
321
324
|
|
|
322
325
|
/** Callback function to be executed when a row is double-clicked. */
|
|
@@ -349,7 +352,7 @@ interface GridProps<T = unknown> extends StyledContainerProps {
|
|
|
349
352
|
/** Callback to create a function that can be used to check whether a record is selectable. */
|
|
350
353
|
onCreateIsRecordSelectable?: (
|
|
351
354
|
params: any,
|
|
352
|
-
instance: Instance
|
|
355
|
+
instance: Instance,
|
|
353
356
|
) => (record: T, options?: { range?: boolean; toggle?: boolean }) => boolean;
|
|
354
357
|
|
|
355
358
|
/** Parameters whose change will cause scroll to be reset. */
|