cx 23.12.1 → 23.12.3

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
@@ -2770,6 +2770,7 @@ var Restate = /*#__PURE__*/ (function (_PureContainer) {
2770
2770
  onError: this.onError,
2771
2771
  deferredUntilIdle: instance.data.deferredUntilIdle,
2772
2772
  idleTimeout: instance.data.idleTimeout,
2773
+ immediate: this.immediate,
2773
2774
  },
2774
2775
  key
2775
2776
  );
@@ -2778,6 +2779,7 @@ var Restate = /*#__PURE__*/ (function (_PureContainer) {
2778
2779
  })(PureContainer);
2779
2780
  Restate.prototype.detached = false;
2780
2781
  Restate.prototype.waitForIdle = false;
2782
+ Restate.prototype.immediate = false;
2781
2783
  var PrivateStore = Restate;
2782
2784
  var RestateStore = /*#__PURE__*/ (function (_Store) {
2783
2785
  _inheritsLoose(RestateStore, _Store);
package/dist/widgets.js CHANGED
@@ -3266,15 +3266,14 @@ var OverlayComponent = /*#__PURE__*/ (function (_VDOM$Component2) {
3266
3266
  }),
3267
3267
  style: parseStyle(data.shadowStyle),
3268
3268
  children: [
3269
- widget.backdrop &&
3270
- /*#__PURE__*/ jsx(
3271
- "div",
3272
- {
3273
- className: CSS.element("overlay", "modal-backdrop"),
3274
- onClick: this.onBackdropClick.bind(this),
3275
- },
3276
- "backdrop"
3277
- ),
3269
+ /*#__PURE__*/ jsx(
3270
+ "div",
3271
+ {
3272
+ className: CSS.element("overlay", "modal-backdrop"),
3273
+ onClick: this.onBackdropClick.bind(this),
3274
+ },
3275
+ "backdrop"
3276
+ ),
3278
3277
  content,
3279
3278
  ],
3280
3279
  },
@@ -3365,6 +3364,8 @@ var OverlayComponent = /*#__PURE__*/ (function (_VDOM$Component2) {
3365
3364
  if (widget.onBackdropClick) instance.invoke("onBackdropClick", e, instance);
3366
3365
  if (widget.backdrop) {
3367
3366
  if (instance.dismiss) instance.dismiss();
3367
+ } else if (widget.modal) {
3368
+ FocusManager.focus(this.el);
3368
3369
  }
3369
3370
  };
3370
3371
  _proto3.onMouseUp = function onMouseUp(e) {
@@ -10748,14 +10749,16 @@ var MonthPicker = /*#__PURE__*/ (function (_Field) {
10748
10749
  );
10749
10750
  };
10750
10751
  _proto.handleSelect = function handleSelect(e, instance, date1, date2) {
10751
- var data = instance.data;
10752
+ var data = instance.data,
10753
+ widget = instance.widget;
10754
+ var encode = widget.encoding || Culture.getDefaultDateEncoding();
10752
10755
  if (data.disabled) return;
10753
10756
  if (!validationCheck(date1, data)) return;
10754
10757
  if (this.onBeforeSelect && instance.invoke("onBeforeSelect", e, instance, date1, date2) === false) return;
10755
10758
  if (this.range) {
10756
- instance.set("from", date1.toISOString());
10757
- instance.set("to", date2.toISOString());
10758
- } else instance.set("value", date1.toISOString());
10759
+ instance.set("from", encode(date1));
10760
+ instance.set("to", encode(date2));
10761
+ } else instance.set("value", encode(date1));
10759
10762
  if (this.onSelect) instance.invoke("onSelect", instance, date1, date2);
10760
10763
  };
10761
10764
  return MonthPicker;
@@ -12071,16 +12074,18 @@ var MonthField = /*#__PURE__*/ (function (_Field) {
12071
12074
  return date;
12072
12075
  };
12073
12076
  _proto.handleSelect = function handleSelect(instance, date1, date2) {
12077
+ var widget = instance.widget;
12078
+ var encode = widget.encoding || Culture.getDefaultDateEncoding();
12074
12079
  instance.setState({
12075
12080
  inputError: false,
12076
12081
  });
12077
12082
  if (this.range) {
12078
- var d1 = date1 ? date1.toISOString() : this.emptyValue;
12079
- var d2 = date2 ? date2.toISOString() : this.emptyValue;
12083
+ var d1 = date1 ? encode(date1) : this.emptyValue;
12084
+ var d2 = date2 ? encode(date2) : this.emptyValue;
12080
12085
  instance.set("from", d1);
12081
12086
  instance.set("to", d2);
12082
12087
  } else {
12083
- var value = date1 ? date1.toISOString() : this.emptyValue;
12088
+ var value = date1 ? encode(date1) : this.emptyValue;
12084
12089
  instance.set("value", value);
12085
12090
  }
12086
12091
  };
@@ -12143,6 +12148,7 @@ var MonthInput = /*#__PURE__*/ (function (_VDOM$Component) {
12143
12148
  ),
12144
12149
  {},
12145
12150
  {
12151
+ encoding: widget.encoding,
12146
12152
  autoFocus: true,
12147
12153
  onFocusOut: function onFocusOut(e) {
12148
12154
  _this2.closeDropdown(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cx",
3
- "version": "23.12.1",
3
+ "version": "23.12.3",
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,72 +1,71 @@
1
- import { VDOM } from "../ui/Widget";
2
- import { BoundedObject } from "../svg/BoundedObject";
3
- import { Rect } from "../svg/util/Rect";
4
- import { parseStyle } from "../util/parseStyle";
5
-
6
- export class PieLabel extends BoundedObject {
7
- init() {
8
- this.lineStyle = parseStyle(this.lineStyle);
9
- super.init();
10
- }
11
-
12
- declareData(...args) {
13
- super.declareData(...args, {
14
- distance: undefined,
15
- lineStyle: { structured: true },
16
- lineStroke: undefined,
17
- lineClass: { structured: true },
18
- lineColorIndex: undefined,
19
- });
20
- }
21
-
22
- calculateBounds(context, instance) {
23
- var { data } = instance;
24
- var bounds = Rect.add(Rect.add(Rect.multiply(instance.parentRect, data.anchors), data.offset), data.margin);
25
- instance.originalBounds = bounds;
26
- instance.actualBounds = context.placePieLabel(bounds, data.distance);
27
- return new Rect({ t: 0, r: bounds.width(), b: bounds.height(), l: 0 });
28
- }
29
-
30
- prepare(context, instance) {
31
- super.prepare(context, instance);
32
- if (!context.registerPieLabel)
33
- throw new Error("PieLabel components are allowed only within PieLabelsContainer components.");
34
- console.log(instance.actualBounds, instance.originalBounds, instance.parentRect);
35
- let right = instance.parentRect.r > instance.parentRect.l;
36
- context.push("textDirection", right ? "right" : "left");
37
- context.registerPieLabel(instance);
38
- }
39
-
40
- prepareCleanup(context, instance) {
41
- context.pop("textDirection");
42
- }
43
-
44
- render(context, instance, key) {
45
- let { originalBounds, actualBounds, data } = instance;
46
-
47
- return (
48
- <g key={key} className={data.classNames}>
49
- <line
50
- className={this.CSS.element(
51
- this.baseClass,
52
- "line",
53
- data.lineColorIndex != null && "color-" + data.lineColorIndex
54
- )}
55
- x1={actualBounds.l < originalBounds.l ? actualBounds.r : actualBounds.l}
56
- y1={(actualBounds.t + actualBounds.b) / 2}
57
- x2={(originalBounds.l + originalBounds.r) / 2}
58
- y2={(originalBounds.t + originalBounds.b) / 2}
59
- stroke={data.lineStroke}
60
- style={data.lineStyle}
61
- />
62
- <g transform={`translate(${instance.actualBounds.l} ${instance.actualBounds.t})`}>
63
- {this.renderChildren(context, instance)}
64
- </g>
65
- </g>
66
- );
67
- }
68
- }
69
-
70
- PieLabel.prototype.distance = 100;
71
- PieLabel.prototype.baseClass = "pielabel";
72
- PieLabel.prototype.styled = true;
1
+ import { VDOM } from "../ui/Widget";
2
+ import { BoundedObject } from "../svg/BoundedObject";
3
+ import { Rect } from "../svg/util/Rect";
4
+ import { parseStyle } from "../util/parseStyle";
5
+
6
+ export class PieLabel extends BoundedObject {
7
+ init() {
8
+ this.lineStyle = parseStyle(this.lineStyle);
9
+ super.init();
10
+ }
11
+
12
+ declareData(...args) {
13
+ super.declareData(...args, {
14
+ distance: undefined,
15
+ lineStyle: { structured: true },
16
+ lineStroke: undefined,
17
+ lineClass: { structured: true },
18
+ lineColorIndex: undefined,
19
+ });
20
+ }
21
+
22
+ calculateBounds(context, instance) {
23
+ var { data } = instance;
24
+ var bounds = Rect.add(Rect.add(Rect.multiply(instance.parentRect, data.anchors), data.offset), data.margin);
25
+ instance.originalBounds = bounds;
26
+ instance.actualBounds = context.placePieLabel(bounds, data.distance);
27
+ return new Rect({ t: 0, r: bounds.width(), b: bounds.height(), l: 0 });
28
+ }
29
+
30
+ prepare(context, instance) {
31
+ super.prepare(context, instance);
32
+ if (!context.registerPieLabel)
33
+ throw new Error("PieLabel components are allowed only within PieLabelsContainer components.");
34
+ let right = instance.parentRect.r > instance.parentRect.l;
35
+ context.push("textDirection", right ? "right" : "left");
36
+ context.registerPieLabel(instance);
37
+ }
38
+
39
+ prepareCleanup(context, instance) {
40
+ context.pop("textDirection");
41
+ }
42
+
43
+ render(context, instance, key) {
44
+ let { originalBounds, actualBounds, data } = instance;
45
+
46
+ return (
47
+ <g key={key} className={data.classNames}>
48
+ <line
49
+ className={this.CSS.element(
50
+ this.baseClass,
51
+ "line",
52
+ data.lineColorIndex != null && "color-" + data.lineColorIndex
53
+ )}
54
+ x1={actualBounds.l < originalBounds.l ? actualBounds.r : actualBounds.l}
55
+ y1={(actualBounds.t + actualBounds.b) / 2}
56
+ x2={(originalBounds.l + originalBounds.r) / 2}
57
+ y2={(originalBounds.t + originalBounds.b) / 2}
58
+ stroke={data.lineStroke}
59
+ style={data.lineStyle}
60
+ />
61
+ <g transform={`translate(${instance.actualBounds.l} ${instance.actualBounds.t})`}>
62
+ {this.renderChildren(context, instance)}
63
+ </g>
64
+ </g>
65
+ );
66
+ }
67
+ }
68
+
69
+ PieLabel.prototype.distance = 100;
70
+ PieLabel.prototype.baseClass = "pielabel";
71
+ PieLabel.prototype.styled = true;
@@ -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 {}