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.
Files changed (62) hide show
  1. package/dist/data.js +15 -26
  2. package/dist/manifest.js +525 -522
  3. package/dist/ui.js +1 -1
  4. package/dist/widgets.js +162 -77
  5. package/locale/de-de.js +6 -1
  6. package/locale/en-us.js +5 -1
  7. package/locale/es-es.js +6 -1
  8. package/locale/fr-fr.js +7 -2
  9. package/locale/nl-nl.js +4 -5
  10. package/locale/pt-pt.js +12 -1
  11. package/locale/sr-latn-ba.js +6 -2
  12. package/package.json +1 -1
  13. package/src/charts/ColorMap.js +4 -6
  14. package/src/charts/axis/Axis.d.ts +96 -96
  15. package/src/charts/axis/Axis.js +252 -252
  16. package/src/data/Expression.js +212 -212
  17. package/src/data/Expression.spec.js +174 -174
  18. package/src/data/StringTemplate.spec.js +105 -105
  19. package/src/data/StructuredSelector.d.ts +1 -1
  20. package/src/data/ops/updateTree.js +1 -1
  21. package/src/data/ops/updateTree.spec.js +16 -14
  22. package/src/ui/Controller.d.ts +182 -182
  23. package/src/ui/Culture.d.ts +0 -3
  24. package/src/ui/DataProxy.d.ts +1 -0
  25. package/src/ui/DataProxy.js +2 -2
  26. package/src/ui/FocusManager.js +171 -171
  27. package/src/ui/Format.js +87 -87
  28. package/src/ui/Instance.d.ts +72 -72
  29. package/src/ui/Localization.js +0 -2
  30. package/src/ui/Rescope.js +2 -2
  31. package/src/ui/Text.js +2 -4
  32. package/src/ui/adapter/DataAdapter.js +7 -12
  33. package/src/ui/adapter/GroupAdapter.d.ts +22 -3
  34. package/src/ui/adapter/TreeAdapter.d.ts +23 -3
  35. package/src/ui/keyboardShortcuts.js +4 -5
  36. package/src/ui/selection/KeySelection.d.ts +1 -1
  37. package/src/ui/selection/PropertySelection.d.ts +1 -1
  38. package/src/ui/selection/PropertySelection.js +2 -4
  39. package/src/ui/selection/Selection.d.ts +1 -1
  40. package/src/widgets/form/ColorField.js +14 -9
  41. package/src/widgets/form/ColorPicker.scss +275 -275
  42. package/src/widgets/form/ColorPicker.variables.scss +22 -22
  43. package/src/widgets/form/DateTimeField.d.ts +86 -86
  44. package/src/widgets/form/DateTimeField.js +573 -572
  45. package/src/widgets/form/Field.js +24 -9
  46. package/src/widgets/form/FieldIcon.js +42 -0
  47. package/src/widgets/form/Label.js +88 -88
  48. package/src/widgets/form/LookupField.d.ts +173 -174
  49. package/src/widgets/form/LookupField.js +1130 -1131
  50. package/src/widgets/form/MonthField.d.ts +37 -38
  51. package/src/widgets/form/MonthField.js +16 -15
  52. package/src/widgets/form/NumberField.d.ts +2 -2
  53. package/src/widgets/form/NumberField.js +13 -13
  54. package/src/widgets/form/Select.d.ts +31 -35
  55. package/src/widgets/form/Select.js +7 -12
  56. package/src/widgets/form/TextArea.js +10 -6
  57. package/src/widgets/form/TextField.d.ts +2 -2
  58. package/src/widgets/form/TextField.js +17 -14
  59. package/src/widgets/form/UploadButton.d.ts +34 -34
  60. package/src/widgets/form/index.js +1 -2
  61. package/src/widgets/grid/Grid.d.ts +5 -2
  62. package/src/widgets/overlay/Dropdown.d.ts +1 -0
package/src/ui/Rescope.js CHANGED
@@ -25,7 +25,7 @@ export class Rescope extends PureContainer {
25
25
  }
26
26
  }
27
27
 
28
- Rescope.prototype.bind = "$page";
29
- Rescope.prototype.rootName = "$root";
28
+ Rescope.prototype.bind = "$page";
29
+ Rescope.prototype.rootName = "$root";
30
30
 
31
31
  Widget.alias("rescope", Rescope);
package/src/ui/Text.js CHANGED
@@ -1,4 +1,4 @@
1
- import {Widget} from './Widget';
1
+ import { Widget } from './Widget';
2
2
 
3
3
  export class Text extends Widget {
4
4
  init() {
@@ -17,11 +17,9 @@ export class Text extends Widget {
17
17
  }, ...arguments);
18
18
  }
19
19
 
20
- render(context, {data}, key) {
20
+ render(context, { data }, key) {
21
21
  return data.value != null ? data.value : '';
22
22
  }
23
-
24
-
25
23
  }
26
24
 
27
25
  Widget.alias('text', Text)
@@ -1,20 +1,15 @@
1
- import {Component} from '../../util/Component';
1
+ import { Component } from "../../util/Component";
2
2
 
3
3
  export class DataAdapter extends Component {
4
-
5
4
  getRecords() {
6
- throw new Error('Abstract method');
5
+ throw new Error("Abstract method");
7
6
  }
8
7
 
9
- setFilter() {
10
-
11
- }
8
+ setFilter() {}
12
9
 
13
- sort() {
14
-
15
- }
10
+ sort() {}
16
11
  }
17
12
 
18
- DataAdapter.prototype.recordName = '$record';
19
- DataAdapter.prototype.indexName = '$index';
20
- DataAdapter.prototype.immutable = false;
13
+ DataAdapter.prototype.recordName = "$record";
14
+ DataAdapter.prototype.indexName = "$index";
15
+ DataAdapter.prototype.immutable = false;
@@ -1,4 +1,23 @@
1
- import * as Cx from '../../core';
2
- import {ArrayAdapter} from './ArrayAdapter';
1
+ import { ArrayAdapter } from './ArrayAdapter';
2
+ import { AccessorChain, Prop, CollatorOptions, StructuredProp } from "../../core";
3
+ import { Accessor } from "../../data/getAccessor";
3
4
 
4
- export class GroupAdapter extends ArrayAdapter {}
5
+ interface GroupAdapterConfig {
6
+ immutable?: boolean;
7
+ sealed?: boolean;
8
+ recordsBinding?: Prop<any[]>;
9
+ recordsAccessor?: Accessor;
10
+ recordName: string | AccessorChain<any>;
11
+ indexName: string | AccessorChain<any>;
12
+ keyField?: string;
13
+ aggregates?: StructuredProp;
14
+ groupRecordsAlias?: string;
15
+ groupRecordsName?: string;
16
+ groupings?: any[] | null;
17
+ groupName?: string;
18
+ sortOptions?: CollatorOptions;
19
+ }
20
+
21
+ export class GroupAdapter extends ArrayAdapter {
22
+ constructor(config: GroupAdapterConfig);
23
+ }
@@ -1,4 +1,24 @@
1
- import * as Cx from '../../core';
2
- import {ArrayAdapter} from './ArrayAdapter';
1
+ import { Prop, StringProp } from "../../core";
2
+ import { ArrayAdapter } from "./ArrayAdapter";
3
3
 
4
- export class TreeAdapter extends ArrayAdapter {}
4
+ interface TreeAdapterConfig {
5
+ immutable?: boolean;
6
+ sealed?: boolean;
7
+ recordsBinding?: Prop<any[]>;
8
+ recordName?: StringProp;
9
+ indexName?: StringProp;
10
+ keyField?: string;
11
+ childrenField?: string;
12
+ expandedField?: string;
13
+ leafField?: string;
14
+ loadingField?: string;
15
+ loadedField?: string;
16
+ onLoadError?: (response: any) => void;
17
+ foldersFirst?: boolean;
18
+ hideRootNodes?: boolean;
19
+ restoreExpandedNodesOnLoad?: boolean;
20
+ }
21
+
22
+ export class TreeAdapter extends ArrayAdapter {
23
+ constructor(config: TreeAdapterConfig);
24
+ }
@@ -1,12 +1,11 @@
1
- import {SubscriberList} from "../util/SubscriberList";
2
- import {isObject} from "../util/isObject";
1
+ import { SubscriberList } from "../util/SubscriberList";
2
+ import { isObject } from "../util/isObject";
3
3
 
4
4
  let subscribers, eventBan = 0;
5
5
 
6
6
  export function executeKeyboardShortcuts(e) {
7
- if (Date.now() < eventBan)
8
- return;
9
- //Avoid duplicate executions as event.stopPropagation() for React events does not stop native events
7
+ if (Date.now() < eventBan) return;
8
+ // Avoid duplicate executions as event.stopPropagation() for React events does not stop native events
10
9
  eventBan = Date.now() + 5;
11
10
  subscribers && subscribers.notify(e);
12
11
  }
@@ -1,6 +1,6 @@
1
1
  import * as Cx from '../../core';
2
2
 
3
- import {Selection} from './Selection'
3
+ import { Selection } from './Selection'
4
4
 
5
5
  interface KeySelectionConfig {
6
6
  bind?: string;
@@ -1,6 +1,6 @@
1
1
  import * as Cx from '../../core';
2
2
 
3
- import {Selection} from './Selection'
3
+ import { Selection } from './Selection'
4
4
 
5
5
  interface PropertySelectionConfig {
6
6
  selectedField?: string
@@ -1,9 +1,7 @@
1
- import {Selection} from './Selection';
1
+ import { Selection } from './Selection';
2
2
 
3
3
  export class PropertySelection extends Selection {
4
-
5
- selectMultiple(store, records, indexes, {toggle, add} = {}) {
6
-
4
+ selectMultiple(store, records, indexes, { toggle, add } = {}) {
7
5
  if (this.toggle)
8
6
  toggle = true;
9
7
 
@@ -24,4 +24,4 @@ export class Selection extends Component {
24
24
  isInstanceSelected(instance: Instance): boolean;
25
25
  }
26
26
 
27
- export class SimpleSelection extends Selection {}
27
+ export class SimpleSelection extends Selection { }
@@ -21,6 +21,7 @@ import DropdownIcon from "../icons/drop-down";
21
21
  import ClearIcon from "../icons/clear";
22
22
  import { Localization } from "../../ui/Localization";
23
23
  import { isDefined } from "../../util/isDefined";
24
+ import { getActiveElement } from "../../util/getActiveElement";
24
25
 
25
26
  export class ColorField extends Field {
26
27
  declareData() {
@@ -219,8 +220,8 @@ class ColorInput extends VDOM.Component {
219
220
  tabIndex={data.tabIndex}
220
221
  placeholder={data.placeholder}
221
222
  {...data.inputAttrs}
222
- onInput={(e) => this.onChange(e, "input")}
223
- onChange={(e) => this.onChange(e, "change")}
223
+ onInput={(e) => this.onChange(e.target.value, "input")}
224
+ onChange={(e) => this.onChange(e.target.value, "change")}
224
225
  onKeyDown={(e) => this.onKeyDown(e)}
225
226
  onBlur={(e) => {
226
227
  this.onBlur(e);
@@ -274,7 +275,7 @@ class ColorInput extends VDOM.Component {
274
275
  switch (e.keyCode) {
275
276
  case KeyCode.enter:
276
277
  e.stopPropagation();
277
- this.onChange(e, "enter");
278
+ this.onChange(e.target.value, "enter");
278
279
  break;
279
280
 
280
281
  case KeyCode.esc:
@@ -304,7 +305,7 @@ class ColorInput extends VDOM.Component {
304
305
  this.setState({
305
306
  focus: false,
306
307
  });
307
- this.onChange(e, "blur");
308
+ this.onChange(e.target.value, "blur");
308
309
  }
309
310
 
310
311
  closeDropdown(e, callback) {
@@ -352,6 +353,9 @@ class ColorInput extends VDOM.Component {
352
353
  }
353
354
 
354
355
  componentWillUnmount() {
356
+ if (this.input == getActiveElement()) {
357
+ this.onChange(this.input.value, "blur");
358
+ }
355
359
  tooltipParentWillUnmount(this.props.instance);
356
360
  }
357
361
 
@@ -365,23 +369,24 @@ class ColorInput extends VDOM.Component {
365
369
  e.preventDefault();
366
370
  }
367
371
 
368
- onChange(e, eventType) {
372
+ onChange(inputValue, eventType) {
369
373
  let { instance, data } = this.props;
370
374
  let { widget } = instance;
371
375
 
372
- if (eventType == "blur") instance.setState({ visited: true });
376
+ if (eventType == "blur") {
377
+ instance.setState({ visited: true });
378
+ }
373
379
 
374
- let text = e.target.value;
375
380
  let isValid;
376
381
  try {
377
- parseColor(text);
382
+ parseColor(inputValue);
378
383
  isValid = true;
379
384
  } catch (e) {
380
385
  isValid = false;
381
386
  }
382
387
 
383
388
  if (eventType == "blur" || eventType == "enter") {
384
- let value = text || widget.emptyValue;
389
+ let value = inputValue || widget.emptyValue;
385
390
  if (isValid && value !== data.value) instance.set("value", value);
386
391
 
387
392
  instance.setState({