cx 24.0.3 → 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/ui.js CHANGED
@@ -2895,7 +2895,7 @@ var subscribers$1,
2895
2895
  eventBan = 0;
2896
2896
  function executeKeyboardShortcuts(e) {
2897
2897
  if (Date.now() < eventBan) return;
2898
- //Avoid duplicate executions as event.stopPropagation() for React events does not stop native events
2898
+ // Avoid duplicate executions as event.stopPropagation() for React events does not stop native events
2899
2899
  eventBan = Date.now() + 5;
2900
2900
  subscribers$1 && subscribers$1.notify(e);
2901
2901
  }
package/dist/widgets.js CHANGED
@@ -6974,7 +6974,7 @@ var Input$2 = /*#__PURE__*/ (function (_VDOM$Component) {
6974
6974
  className: CSS.element(baseClass, "left-icon"),
6975
6975
  onMouseDown: preventDefault,
6976
6976
  onClick: function onClick(e) {
6977
- return _this2.onChange(e, "enter");
6977
+ return _this2.onChange(e.target.value, "enter");
6978
6978
  },
6979
6979
  children: iconVDOM,
6980
6980
  });
@@ -7038,10 +7038,10 @@ var Input$2 = /*#__PURE__*/ (function (_VDOM$Component) {
7038
7038
  onMouseMove: this.onMouseMove.bind(this),
7039
7039
  onMouseLeave: this.onMouseLeave.bind(this),
7040
7040
  onInput: function onInput(e) {
7041
- return _this2.onChange(e, "input");
7041
+ return _this2.onChange(e.target.value, "input");
7042
7042
  },
7043
7043
  onChange: function onChange(e) {
7044
- return _this2.onChange(e, "change");
7044
+ return _this2.onChange(e.target.value, "change");
7045
7045
  },
7046
7046
  onKeyDown: this.onKeyDown.bind(this),
7047
7047
  onFocus: this.onFocus.bind(this),
@@ -7080,7 +7080,7 @@ var Input$2 = /*#__PURE__*/ (function (_VDOM$Component) {
7080
7080
  });
7081
7081
  this.props.instance.set("focused", false);
7082
7082
  }
7083
- this.onChange(e, "blur");
7083
+ this.onChange(e.target.value, "blur");
7084
7084
  };
7085
7085
  _proto2.onClearClick = function onClearClick(e) {
7086
7086
  this.props.instance.set("value", this.props.instance.widget.emptyValue, {
@@ -7101,6 +7101,7 @@ var Input$2 = /*#__PURE__*/ (function (_VDOM$Component) {
7101
7101
  autoFocus(this.input, this);
7102
7102
  };
7103
7103
  _proto2.componentWillUnmount = function componentWillUnmount() {
7104
+ if (this.input == getActiveElement()) this.onChange(this.input.value, "blur");
7104
7105
  tooltipParentWillUnmount$1(this.props.instance);
7105
7106
  };
7106
7107
  _proto2.onKeyDown = function onKeyDown(e) {
@@ -7108,7 +7109,7 @@ var Input$2 = /*#__PURE__*/ (function (_VDOM$Component) {
7108
7109
  if (instance.widget.handleKeyDown(e, instance) === false) return;
7109
7110
  switch (e.keyCode) {
7110
7111
  case KeyCode.enter:
7111
- this.onChange(e, "enter");
7112
+ this.onChange(e.target.value, "enter");
7112
7113
  break;
7113
7114
  case KeyCode.left:
7114
7115
  case KeyCode.right:
@@ -7118,12 +7119,12 @@ var Input$2 = /*#__PURE__*/ (function (_VDOM$Component) {
7118
7119
  };
7119
7120
  _proto2.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(props) {
7120
7121
  var data = props.data;
7121
- //the second check is required for debouncing, sometimes the value in the store lags after the input
7122
- //and update may be caused by some other property, i.e. visited
7122
+ // The second check is required for debouncing, sometimes the value in the store lags after the input
7123
+ // and update may be caused by some other property, i.e. visited
7123
7124
  if (data.value != this.input.value && data.value != this.props.data.value) this.input.value = data.value || "";
7124
7125
  tooltipParentWillReceiveProps$1.apply(void 0, [this.input].concat(getFieldTooltip(props.instance)));
7125
7126
  };
7126
- _proto2.onChange = function onChange(e, change) {
7127
+ _proto2.onChange = function onChange(textValue, change) {
7127
7128
  var _this$props3 = this.props,
7128
7129
  instance = _this$props3.instance,
7129
7130
  data = _this$props3.data;
@@ -7135,7 +7136,7 @@ var Input$2 = /*#__PURE__*/ (function (_VDOM$Component) {
7135
7136
  }
7136
7137
  var widget = instance.widget;
7137
7138
  if (widget.reactOn.indexOf(change) != -1) {
7138
- var text = this.trimmed(e.target.value);
7139
+ var text = this.trimmed(textValue);
7139
7140
  if (data.maxLength != null && text.length > data.maxLength) {
7140
7141
  text = text.substring(0, data.maxLength);
7141
7142
  this.input.value = text;
@@ -10000,6 +10001,16 @@ var Input$1 = /*#__PURE__*/ (function (_VDOM$Component) {
10000
10001
  autoFocus(this.input, this);
10001
10002
  };
10002
10003
  _proto2.componentWillUnmount = function componentWillUnmount() {
10004
+ if (this.input == getActiveElement()) {
10005
+ this.onChange(
10006
+ {
10007
+ target: {
10008
+ value: this.input.value,
10009
+ },
10010
+ },
10011
+ "blur",
10012
+ );
10013
+ }
10003
10014
  tooltipParentWillUnmount$1(this.props.instance);
10004
10015
  };
10005
10016
  _proto2.getPreCursorDigits = function getPreCursorDigits(text, cursor, decimalSeparator) {
@@ -10143,12 +10154,12 @@ var Input$1 = /*#__PURE__*/ (function (_VDOM$Component) {
10143
10154
  var fmt = data.format;
10144
10155
  var decimalSeparator = this.getDecimalSeparator(fmt) || Format.value(1.1, "n;1")[1];
10145
10156
  var formatted = Format.value(value, fmt);
10146
- //re-parse to avoid differences between formatted value and value in the store
10157
+ // Re-parse to avoid differences between formatted value and value in the store
10147
10158
 
10148
10159
  value = widget.parseValue(formatted, instance) * data.scale + data.offset;
10149
10160
 
10150
- //allow users to type numbers like 100.0003 or -0.05 without interruptions
10151
- //if the last typed in character is zero or dot (decimal separator) skip processing it
10161
+ // Allow users to type numbers like 100.0003 or -0.05 without interruptions
10162
+ // If the last typed character is zero or dot (decimal separator), skip processing it
10152
10163
  if (
10153
10164
  change == "change" &&
10154
10165
  this.input.selectionStart == this.input.selectionEnd &&
@@ -10159,7 +10170,7 @@ var Input$1 = /*#__PURE__*/ (function (_VDOM$Component) {
10159
10170
  )
10160
10171
  return;
10161
10172
  if (change != "blur") {
10162
- //format, but keep the correct cursor position
10173
+ // Format, but keep the correct cursor position
10163
10174
  var preCursorText = this.getPreCursorDigits(this.input.value, this.input.selectionStart, decimalSeparator);
10164
10175
  this.input.value = formatted;
10165
10176
  this.updateCursorPosition(preCursorText);
@@ -10290,13 +10301,13 @@ var Input = /*#__PURE__*/ (function (_VDOM$Component) {
10290
10301
  data.inputAttrs,
10291
10302
  {
10292
10303
  onInput: function onInput(e) {
10293
- return _this2.onChange(e, "input");
10304
+ return _this2.onChange(e.target.value, "input");
10294
10305
  },
10295
10306
  onChange: function onChange(e) {
10296
- return _this2.onChange(e, "change");
10307
+ return _this2.onChange(e.target.value, "change");
10297
10308
  },
10298
10309
  onBlur: function onBlur(e) {
10299
- _this2.onChange(e, "blur");
10310
+ _this2.onChange(e.target.value, "blur");
10300
10311
  },
10301
10312
  onFocus: function onFocus(e) {
10302
10313
  return _this2.onFocus();
@@ -10320,6 +10331,9 @@ var Input = /*#__PURE__*/ (function (_VDOM$Component) {
10320
10331
  });
10321
10332
  };
10322
10333
  _proto2.componentWillUnmount = function componentWillUnmount() {
10334
+ if (this.input == getActiveElement()) {
10335
+ this.onChange(this.input.value, "blur");
10336
+ }
10323
10337
  tooltipParentWillUnmount$1(this.props.instance);
10324
10338
  };
10325
10339
  _proto2.componentDidMount = function componentDidMount() {
@@ -10349,7 +10363,7 @@ var Input = /*#__PURE__*/ (function (_VDOM$Component) {
10349
10363
  }
10350
10364
  tooltipParentWillReceiveProps$1.apply(void 0, [this.input].concat(getFieldTooltip(instance)));
10351
10365
  };
10352
- _proto2.onChange = function onChange(e, change) {
10366
+ _proto2.onChange = function onChange(inputValue, change) {
10353
10367
  var _this$props2 = this.props,
10354
10368
  instance = _this$props2.instance,
10355
10369
  data = _this$props2.data;
@@ -10365,11 +10379,11 @@ var Input = /*#__PURE__*/ (function (_VDOM$Component) {
10365
10379
  }
10366
10380
  if (data.required) {
10367
10381
  instance.setState({
10368
- empty: !e.target.value,
10382
+ empty: !inputValue,
10369
10383
  });
10370
10384
  }
10371
10385
  if (instance.widget.reactOn.indexOf(change) != -1) {
10372
- var value = e.target.value || widget.emptyValue;
10386
+ var value = inputValue || widget.emptyValue;
10373
10387
  instance.set("value", value);
10374
10388
  }
10375
10389
  };
@@ -12111,10 +12125,10 @@ var MonthInput = /*#__PURE__*/ (function (_VDOM$Component) {
12111
12125
  tabIndex: data.tabIndex,
12112
12126
  placeholder: data.placeholder,
12113
12127
  onInput: function onInput(e) {
12114
- return _this3.onChange(e, "input");
12128
+ return _this3.onChange(e.target.value, "input");
12115
12129
  },
12116
12130
  onChange: function onChange(e) {
12117
- return _this3.onChange(e, "change");
12131
+ return _this3.onChange(e.target.value, "change");
12118
12132
  },
12119
12133
  onKeyDown: function onKeyDown(e) {
12120
12134
  return _this3.onKeyDown(e);
@@ -12171,7 +12185,7 @@ var MonthInput = /*#__PURE__*/ (function (_VDOM$Component) {
12171
12185
  switch (e.keyCode) {
12172
12186
  case KeyCode.enter:
12173
12187
  e.stopPropagation();
12174
- this.onChange(e, "enter");
12188
+ this.onChange(e.target.value, "enter");
12175
12189
  break;
12176
12190
  case KeyCode.esc:
12177
12191
  if (this.state.dropdownOpen) {
@@ -12201,7 +12215,7 @@ var MonthInput = /*#__PURE__*/ (function (_VDOM$Component) {
12201
12215
  this.setState({
12202
12216
  focus: false,
12203
12217
  });
12204
- this.onChange(e, "blur");
12218
+ this.onChange(e.target.value, "blur");
12205
12219
  };
12206
12220
  _proto2.closeDropdown = function closeDropdown(e, callback) {
12207
12221
  var _this5 = this;
@@ -12257,13 +12271,16 @@ var MonthInput = /*#__PURE__*/ (function (_VDOM$Component) {
12257
12271
  autoFocus(this.input, this);
12258
12272
  };
12259
12273
  _proto2.componentWillUnmount = function componentWillUnmount() {
12274
+ if (this.input == getActiveElement()) {
12275
+ this.onChange(this.input.value, "blur");
12276
+ }
12260
12277
  tooltipParentWillUnmount$1(this.props.instance);
12261
12278
  };
12262
- _proto2.onChange = function onChange(e, eventType) {
12279
+ _proto2.onChange = function onChange(inputValue, eventType) {
12263
12280
  var instance = this.props.instance;
12264
12281
  var widget = instance.widget;
12265
12282
  if (widget.reactOn.indexOf(eventType) == -1) return;
12266
- var parts = e.target.value.split("-");
12283
+ var parts = inputValue.split("-");
12267
12284
  var date1 = widget.parseDate(parts[0]);
12268
12285
  var date2 = widget.parseDate(parts[1]) || date1;
12269
12286
  if ((date1 != null && isNaN(date1)) || (date2 != null && isNaN(date2))) {
@@ -12503,10 +12520,10 @@ var ColorInput = /*#__PURE__*/ (function (_VDOM$Component) {
12503
12520
  data.inputAttrs,
12504
12521
  {
12505
12522
  onInput: function onInput(e) {
12506
- return _this3.onChange(e, "input");
12523
+ return _this3.onChange(e.target.value, "input");
12507
12524
  },
12508
12525
  onChange: function onChange(e) {
12509
- return _this3.onChange(e, "change");
12526
+ return _this3.onChange(e.target.value, "change");
12510
12527
  },
12511
12528
  onKeyDown: function onKeyDown(e) {
12512
12529
  return _this3.onKeyDown(e);
@@ -12565,7 +12582,7 @@ var ColorInput = /*#__PURE__*/ (function (_VDOM$Component) {
12565
12582
  switch (e.keyCode) {
12566
12583
  case KeyCode.enter:
12567
12584
  e.stopPropagation();
12568
- this.onChange(e, "enter");
12585
+ this.onChange(e.target.value, "enter");
12569
12586
  break;
12570
12587
  case KeyCode.esc:
12571
12588
  if (this.state.dropdownOpen) {
@@ -12591,7 +12608,7 @@ var ColorInput = /*#__PURE__*/ (function (_VDOM$Component) {
12591
12608
  this.setState({
12592
12609
  focus: false,
12593
12610
  });
12594
- this.onChange(e, "blur");
12611
+ this.onChange(e.target.value, "blur");
12595
12612
  };
12596
12613
  _proto2.closeDropdown = function closeDropdown(e, callback) {
12597
12614
  var _this5 = this;
@@ -12639,6 +12656,9 @@ var ColorInput = /*#__PURE__*/ (function (_VDOM$Component) {
12639
12656
  if (this.props.instance.widget.autoFocus && !isTouchDevice()) this.input.focus();
12640
12657
  };
12641
12658
  _proto2.componentWillUnmount = function componentWillUnmount() {
12659
+ if (this.input == getActiveElement()) {
12660
+ this.onChange(this.input.value, "blur");
12661
+ }
12642
12662
  tooltipParentWillUnmount$1(this.props.instance);
12643
12663
  };
12644
12664
  _proto2.onClearClick = function onClearClick(e) {
@@ -12650,25 +12670,25 @@ var ColorInput = /*#__PURE__*/ (function (_VDOM$Component) {
12650
12670
  e.stopPropagation();
12651
12671
  e.preventDefault();
12652
12672
  };
12653
- _proto2.onChange = function onChange(e, eventType) {
12673
+ _proto2.onChange = function onChange(inputValue, eventType) {
12654
12674
  var _this$props2 = this.props,
12655
12675
  instance = _this$props2.instance,
12656
12676
  data = _this$props2.data;
12657
12677
  var widget = instance.widget;
12658
- if (eventType == "blur")
12678
+ if (eventType == "blur") {
12659
12679
  instance.setState({
12660
12680
  visited: true,
12661
12681
  });
12662
- var text = e.target.value;
12682
+ }
12663
12683
  var isValid;
12664
12684
  try {
12665
- parseColor(text);
12685
+ parseColor(inputValue);
12666
12686
  isValid = true;
12667
12687
  } catch (e) {
12668
12688
  isValid = false;
12669
12689
  }
12670
12690
  if (eventType == "blur" || eventType == "enter") {
12671
- var value = text || widget.emptyValue;
12691
+ var value = inputValue || widget.emptyValue;
12672
12692
  if (isValid && value !== data.value) instance.set("value", value);
12673
12693
  instance.setState({
12674
12694
  inputError: !isValid && "Invalid color entered.",
@@ -14631,10 +14651,10 @@ var DateTimeInput = /*#__PURE__*/ (function (_VDOM$Component) {
14631
14651
  data.inputAttrs,
14632
14652
  {
14633
14653
  onInput: function onInput(e) {
14634
- return _this3.onChange(e, "input");
14654
+ return _this3.onChange(e.target.value, "input");
14635
14655
  },
14636
14656
  onChange: function onChange(e) {
14637
- return _this3.onChange(e, "change");
14657
+ return _this3.onChange(e.target.value, "change");
14638
14658
  },
14639
14659
  onKeyDown: function onKeyDown(e) {
14640
14660
  return _this3.onKeyDown(e);
@@ -14696,7 +14716,7 @@ var DateTimeInput = /*#__PURE__*/ (function (_VDOM$Component) {
14696
14716
  if (instance.widget.handleKeyDown(e, instance) === false) return;
14697
14717
  switch (e.keyCode) {
14698
14718
  case KeyCode.enter:
14699
- this.onChange(e, "enter");
14719
+ this.onChange(e.target.value, "enter");
14700
14720
  break;
14701
14721
  case KeyCode.esc:
14702
14722
  if (this.state.dropdownOpen) {
@@ -14727,7 +14747,7 @@ var DateTimeInput = /*#__PURE__*/ (function (_VDOM$Component) {
14727
14747
  this.setState({
14728
14748
  focus: false,
14729
14749
  });
14730
- this.onChange(e, "blur");
14750
+ this.onChange(e.target.value, "blur");
14731
14751
  };
14732
14752
  _proto2.closeDropdown = function closeDropdown(e, callback) {
14733
14753
  var _this5 = this;
@@ -14783,9 +14803,12 @@ var DateTimeInput = /*#__PURE__*/ (function (_VDOM$Component) {
14783
14803
  autoFocus(this.input, this);
14784
14804
  };
14785
14805
  _proto2.componentWillUnmount = function componentWillUnmount() {
14806
+ if (this.input == getActiveElement()) {
14807
+ this.onChange(this.input.value, "blur");
14808
+ }
14786
14809
  tooltipParentWillUnmount$1(this.props.instance);
14787
14810
  };
14788
- _proto2.onChange = function onChange(e, eventType) {
14811
+ _proto2.onChange = function onChange(inputValue, eventType) {
14789
14812
  var _this$props2 = this.props,
14790
14813
  instance = _this$props2.instance,
14791
14814
  data = _this$props2.data;
@@ -14796,7 +14819,7 @@ var DateTimeInput = /*#__PURE__*/ (function (_VDOM$Component) {
14796
14819
  instance.setState({
14797
14820
  visited: true,
14798
14821
  });
14799
- this.setValue(e.target.value, data.value);
14822
+ this.setValue(inputValue, data.value);
14800
14823
  };
14801
14824
  _proto2.setValue = function setValue(text, baseValue) {
14802
14825
  var _this$props3 = this.props,
@@ -19218,6 +19241,7 @@ export {
19218
19241
  HighlightedSearchText,
19219
19242
  HtmlElement,
19220
19243
  Icon,
19244
+ Label,
19221
19245
  LabeledContainer,
19222
19246
  Link,
19223
19247
  LinkButton,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cx",
3
- "version": "24.0.3",
3
+ "version": "24.2.0",
4
4
  "description": "Advanced JavaScript UI framework for admin and dashboard applications with ready to use grid, form and chart components.",
5
5
  "main": "index.js",
6
6
  "jsnext:main": "src/index.js",
@@ -1,5 +1,5 @@
1
- import {Widget} from '../ui/Widget';
2
- import {PureContainer} from '../ui/PureContainer';
1
+ import { Widget } from '../ui/Widget';
2
+ import { PureContainer } from '../ui/PureContainer';
3
3
 
4
4
  export class ColorMap extends Widget {
5
5
  declareData() {
@@ -21,7 +21,7 @@ export class ColorMap extends Widget {
21
21
  let cache = this.onGetCache ? instance.invoke("onGetCache") : {};
22
22
  map = cache[colorMap];
23
23
  if (!map) {
24
- let {data} = instance;
24
+ let { data } = instance;
25
25
  map = context.colorMaps[colorMap] = cache[colorMap] = new ColorIndex({
26
26
  offset: data.offset,
27
27
  step: data.step,
@@ -67,7 +67,7 @@ ColorMap.Scope = ColorMapScope;
67
67
  Widget.alias('color-map', ColorMap);
68
68
 
69
69
  export class ColorIndex {
70
- constructor({offset, step, size}) {
70
+ constructor({ offset, step, size }) {
71
71
  this.colorMap = {};
72
72
  this.dirty = true;
73
73
  this.offset = offset;
@@ -83,7 +83,6 @@ export class ColorIndex {
83
83
  }
84
84
 
85
85
  map(name) {
86
-
87
86
  if (this.dirty) {
88
87
  this.dirty = false;
89
88
  if (!this.step) {
@@ -94,6 +93,5 @@ export class ColorIndex {
94
93
 
95
94
  let index = this.colorMap[name] || 0;
96
95
  return Math.round(this.offset + this.step * index + this.size) % this.size;
97
-
98
96
  }
99
97
  }
@@ -1,96 +1,96 @@
1
- import { Instance } from "./../../ui/Instance.d";
2
- import * as Cx from "../../core";
3
- import { BoundedObject, BoundedObjectProps } from "../../svg/BoundedObject";
4
-
5
- export interface AxisProps extends BoundedObjectProps {
6
- /** Set to `true` for vertical axes. */
7
- vertical?: boolean;
8
-
9
- /** Used as a secondary axis. Displayed at the top/right. */
10
- secondary?: boolean;
11
-
12
- /** When set to `true`, the values are displayed in descending order. */
13
- inverted?: Cx.BooleanProp;
14
-
15
- /** When set to `true`, rendering of visual elements of the axis, such as ticks and labels, is skipped, but their function is preserved. */
16
- hidden?: boolean;
17
-
18
- tickSize?: number;
19
- minTickDistance?: number;
20
- minLabelDistanceVertical?: number;
21
- minLabelDistanceHorizontal?: number;
22
-
23
- /** Distance between labels and the axis. */
24
- labelOffset?: number | string;
25
-
26
- /** Label rotation angle in degrees. */
27
- labelRotation?: Cx.Prop<number | string>;
28
-
29
- /** Label text-anchor value. Allowed values are start, end and middle. Default value is set based on the value of vertical and secondary flags. */
30
- labelAnchor?: "start" | "end" | "middle" | "auto";
31
-
32
- /** Horizontal text offset. */
33
- labelDx?: number | string;
34
-
35
- /** Vertical text offset which can be used for vertical alignment. */
36
- labelDy?: number | string;
37
-
38
- /** Set to `true` to break long labels into multiple lines. Default value is `false`. Text is split at space characters. See also `labelMaxLineLength` and `labelLineCountDyFactor`. */
39
- labelWrap?: boolean;
40
-
41
- /**
42
- * Used for vertical adjustment of multi-line labels. Default value is `auto` which means
43
- * that value is initialized based on axis configuration. Value `0` means that label will grow towards
44
- * the bottom of the screen. Value `-1` will make labels to grow towards the top of the screen.
45
- * `-0.5` will make labels vertically centered.
46
- */
47
- labelLineCountDyFactor?: number | string;
48
-
49
- /**
50
- * Used for vertical adjustment of multi-line labels. Default value is 1 which means
51
- * that labels are stacked without any space between them. Value of 1.4 will add 40% of the label height as a space between labels.
52
- */
53
- labelLineHeight?: number | string;
54
-
55
- /** If `labelWrap` is on, this number is used as a measure to split labels into multiple lines. Default value is `10`. */
56
- labelMaxLineLength?: number;
57
-
58
- /** Set to true to hide the axis labels. */
59
- hideLabels?: boolean;
60
-
61
- /** Set to true to hide the axis line. */
62
- hideLine?: boolean;
63
-
64
- /** Set to true to hide the axis ticks. */
65
- hideTicks?: boolean;
66
-
67
- /** Additional CSS style to be applied to the axis line. */
68
- lineStyle?: Cx.StyleProp;
69
-
70
- /** Additional CSS style to be applied to the axis ticks. */
71
- tickStyle?: Cx.StyleProp;
72
-
73
- /** Additional CSS style to be applied to the axis labels. */
74
- labelStyle?: Cx.StyleProp;
75
-
76
- /** Additional CSS class to be applied to the axis line. */
77
- lineClass?: Cx.ClassProp;
78
-
79
- /** Additional CSS class to be applied to the axis ticks. */
80
- tickClass?: Cx.ClassProp;
81
-
82
- /** Additional CSS class to be applied to the axis labels. */
83
- labelClass?: Cx.ClassProp;
84
-
85
- onMeasured?: (info: any, instance: Instance) => void;
86
-
87
- /** A function used to create a formatter function for axis labels. See Complex Labels example in the CxJS documentation for more info. */
88
- onCreateLabelFormatter?:
89
- | string
90
- | ((
91
- context: any,
92
- instance: Instance
93
- ) => (formattedValue: string, value: any) => { text: string; style?: any; className?: string }[]);
94
- }
95
-
96
- export class Axis extends BoundedObject {}
1
+ import { Instance } from "./../../ui/Instance.d";
2
+ import * as Cx from "../../core";
3
+ import { BoundedObject, BoundedObjectProps } from "../../svg/BoundedObject";
4
+
5
+ export interface AxisProps extends BoundedObjectProps {
6
+ /** Set to `true` for vertical axes. */
7
+ vertical?: boolean;
8
+
9
+ /** Used as a secondary axis. Displayed at the top/right. */
10
+ secondary?: boolean;
11
+
12
+ /** When set to `true`, the values are displayed in descending order. */
13
+ inverted?: Cx.BooleanProp;
14
+
15
+ /** When set to `true`, rendering of visual elements of the axis, such as ticks and labels, is skipped, but their function is preserved. */
16
+ hidden?: boolean;
17
+
18
+ tickSize?: number;
19
+ minTickDistance?: number;
20
+ minLabelDistanceVertical?: number;
21
+ minLabelDistanceHorizontal?: number;
22
+
23
+ /** Distance between labels and the axis. */
24
+ labelOffset?: number | string;
25
+
26
+ /** Label rotation angle in degrees. */
27
+ labelRotation?: Cx.Prop<number | string>;
28
+
29
+ /** Label text-anchor value. Allowed values are start, end and middle. Default value is set based on the value of vertical and secondary flags. */
30
+ labelAnchor?: "start" | "end" | "middle" | "auto";
31
+
32
+ /** Horizontal text offset. */
33
+ labelDx?: number | string;
34
+
35
+ /** Vertical text offset which can be used for vertical alignment. */
36
+ labelDy?: number | string;
37
+
38
+ /** Set to `true` to break long labels into multiple lines. Default value is `false`. Text is split at space characters. See also `labelMaxLineLength` and `labelLineCountDyFactor`. */
39
+ labelWrap?: boolean;
40
+
41
+ /**
42
+ * Used for vertical adjustment of multi-line labels. Default value is `auto` which means
43
+ * that value is initialized based on axis configuration. Value `0` means that label will grow towards
44
+ * the bottom of the screen. Value `-1` will make labels to grow towards the top of the screen.
45
+ * `-0.5` will make labels vertically centered.
46
+ */
47
+ labelLineCountDyFactor?: number | string;
48
+
49
+ /**
50
+ * Used for vertical adjustment of multi-line labels. Default value is 1 which means
51
+ * that labels are stacked without any space between them. Value of 1.4 will add 40% of the label height as a space between labels.
52
+ */
53
+ labelLineHeight?: number | string;
54
+
55
+ /** If `labelWrap` is on, this number is used as a measure to split labels into multiple lines. Default value is `10`. */
56
+ labelMaxLineLength?: number;
57
+
58
+ /** Set to true to hide the axis labels. */
59
+ hideLabels?: boolean;
60
+
61
+ /** Set to true to hide the axis line. */
62
+ hideLine?: boolean;
63
+
64
+ /** Set to true to hide the axis ticks. */
65
+ hideTicks?: boolean;
66
+
67
+ /** Additional CSS style to be applied to the axis line. */
68
+ lineStyle?: Cx.StyleProp;
69
+
70
+ /** Additional CSS style to be applied to the axis ticks. */
71
+ tickStyle?: Cx.StyleProp;
72
+
73
+ /** Additional CSS style to be applied to the axis labels. */
74
+ labelStyle?: Cx.StyleProp;
75
+
76
+ /** Additional CSS class to be applied to the axis line. */
77
+ lineClass?: Cx.ClassProp;
78
+
79
+ /** Additional CSS class to be applied to the axis ticks. */
80
+ tickClass?: Cx.ClassProp;
81
+
82
+ /** Additional CSS class to be applied to the axis labels. */
83
+ labelClass?: Cx.ClassProp;
84
+
85
+ onMeasured?: (info: any, instance: Instance) => void;
86
+
87
+ /** A function used to create a formatter function for axis labels. See Complex Labels example in the CxJS documentation for more info. */
88
+ onCreateLabelFormatter?:
89
+ | string
90
+ | ((
91
+ context: any,
92
+ instance: Instance
93
+ ) => (formattedValue: string, value: any) => { text: string; style?: any; className?: string }[]);
94
+ }
95
+
96
+ export class Axis extends BoundedObject {}