cx 22.6.0 → 22.6.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/widgets.js CHANGED
@@ -1901,9 +1901,9 @@ var ListComponent = /*#__PURE__*/ (function(_VDOM$Component) {
1901
1901
  for (var i = 0; i < items.length; i++) {
1902
1902
  var item = items[i];
1903
1903
 
1904
- if (isItemSelectable(item)) {
1904
+ if (isDataItem(item)) {
1905
1905
  index++;
1906
- if (firstValid == -1) firstValid = index;
1906
+ if (!isItemDisabled(item) && firstValid == -1) firstValid = index;
1907
1907
 
1908
1908
  if (item.instance.selected) {
1909
1909
  firstSelected = index;
@@ -2045,7 +2045,15 @@ var ListItem = /*#__PURE__*/ (function(_Container) {
2045
2045
  })(Container);
2046
2046
 
2047
2047
  function isItemSelectable(item) {
2048
- return item && item.type == "data" && !item.instance.data.disabled;
2048
+ return isDataItem(item) && !isItemDisabled(item);
2049
+ }
2050
+
2051
+ function isDataItem(item) {
2052
+ return (item == null ? void 0 : item.type) == "data";
2053
+ }
2054
+
2055
+ function isItemDisabled(item) {
2056
+ return item == null ? void 0 : item.instance.data.disabled;
2049
2057
  }
2050
2058
 
2051
2059
  var Sandbox = /*#__PURE__*/ (function(_PureContainer) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cx",
3
- "version": "22.6.0",
3
+ "version": "22.6.1",
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,52 +1,56 @@
1
- import * as Cx from '../core';
2
- import * as React from 'react';
3
- import {Instance} from "../ui/Instance";
1
+ import * as Cx from "../core";
2
+ import * as React from "react";
3
+ import { Instance } from "../ui/Instance";
4
4
 
5
5
  export interface ButtonProps extends Cx.HtmlElementProps {
6
-
7
6
  /** Confirmation text or configuration object. See MsgBox.yesNo for more details. */
8
- confirm?: Cx.Prop<string | Cx.Config>,
7
+ confirm?: Cx.Prop<string | Cx.Config>;
9
8
 
10
9
  /** If true button appears in pressed state. Useful for implementing toggle buttons. */
11
- pressed?: Cx.BooleanProp,
10
+ pressed?: Cx.BooleanProp;
12
11
 
13
12
  /** Name of the icon to be put on the left side of the button. */
14
- icon?: Cx.StringProp,
15
-
13
+ icon?: Cx.StringProp;
14
+
16
15
  /** HTML tag to be used. Default is `button`. */
17
- tag?: string,
16
+ tag?: string;
18
17
 
19
18
  /** Base CSS class to be applied to the element. Default is 'button'. */
20
- baseClass?: string,
19
+ baseClass?: string;
21
20
 
22
- /**
23
- * Determines if button should receive focus on mousedown event.
24
- * Default is `false`, which means that focus can be set only using the keyboard `Tab` key.
21
+ /**
22
+ * Determines if button should receive focus on mousedown event.
23
+ * Default is `false`, which means that focus can be set only using the keyboard `Tab` key.
25
24
  */
26
- focusOnMouseDown?: boolean,
25
+ focusOnMouseDown?: boolean;
27
26
 
28
27
  /** Add type="submit" to the button. */
29
- submit?: boolean,
28
+ submit?: boolean;
30
29
 
31
30
  /** Set to `true` to disable the button. */
32
- disabled?: Cx.BooleanProp,
31
+ disabled?: Cx.BooleanProp;
33
32
 
34
33
  /** Set to `false` to disable the button. */
35
- enabled?: Cx.BooleanProp,
34
+ enabled?: Cx.BooleanProp;
36
35
 
37
- /**
36
+ /**
38
37
  * Click handler.
39
38
  *
40
39
  * @param e - Event.
41
- * @param instance - Cx widget instance that fired the event.
40
+ * @param instance - Cx widget instance that fired the event.
42
41
  */
43
- onClick?: string | ((e: React.SyntheticEvent<any>, instance: Instance) => void),
42
+ onClick?: string | ((e: React.SyntheticEvent<any>, instance: Instance) => void);
44
43
 
45
44
  /** Button type. */
46
- type?: 'submit' | 'button',
45
+ type?: "submit" | "button";
47
46
 
48
47
  /** If set to `true`, the Button will cause its parent Overlay (if one exists) to close. This, however, can be prevented if `onClick` explicitly returns `false`. */
49
- dismiss?: boolean
48
+ dismiss?: boolean;
49
+
50
+ /** The form attribute specifies the form the button belongs to.
51
+ * The value of this attribute must be equal to the `id` attribute of a `<form>` element in the same document.
52
+ */
53
+ form?: Cx.StringProp;
50
54
  }
51
55
 
52
56
  export class Button extends Cx.Widget<ButtonProps> {}
@@ -462,9 +462,10 @@ class ListComponent extends VDOM.Component {
462
462
  firstValid = -1;
463
463
  for (let i = 0; i < items.length; i++) {
464
464
  let item = items[i];
465
- if (isItemSelectable(item)) {
465
+ if (isDataItem(item)) {
466
466
  index++;
467
- if (firstValid == -1) firstValid = index;
467
+
468
+ if (!isItemDisabled(item) && firstValid == -1) firstValid = index;
468
469
  if (item.instance.selected) {
469
470
  firstSelected = index;
470
471
  break;
@@ -576,5 +577,13 @@ class ListItem extends Container {
576
577
  }
577
578
 
578
579
  function isItemSelectable(item) {
579
- return item && item.type == "data" && !item.instance.data.disabled;
580
+ return isDataItem(item) && !isItemDisabled(item);
581
+ }
582
+
583
+ function isDataItem(item) {
584
+ return item?.type == "data";
585
+ }
586
+
587
+ function isItemDisabled(item) {
588
+ return item?.instance.data.disabled;
580
589
  }
@@ -1,38 +1,39 @@
1
- import * as Cx from '../../core';
2
- import { OverlayProps } from './Overlay';
1
+ import * as Cx from "../../core";
2
+ import { OverlayProps } from "./Overlay";
3
3
 
4
4
  interface WindowProps extends OverlayProps {
5
-
6
5
  /** Text to be displayed in the header. */
7
- title?: Cx.StringProp,
6
+ title?: Cx.StringProp;
8
7
 
9
8
  /** Controls the close button visibility. Defaults to `true`. */
10
- closable?: Cx.BooleanProp,
9
+ closable?: Cx.BooleanProp;
11
10
 
12
11
  /** A custom style which will be applied to the body. */
13
- bodyStyle?: Cx.StyleProp,
12
+ bodyStyle?: Cx.StyleProp;
14
13
 
15
14
  /** A custom style which will be applied to the header. */
16
- headerStyle?: Cx.StyleProp,
15
+ headerStyle?: Cx.StyleProp;
17
16
 
18
17
  /** A custom style which will be applied to the footer. */
19
- footerStyle?: Cx.StyleProp
18
+ footerStyle?: Cx.StyleProp;
20
19
 
21
20
  /** Base CSS class to be applied to the field. Defaults to `window`. */
22
- baseClass?: string,
21
+ baseClass?: string;
22
+
23
+ /** Additional CSS class to be applied to the section body. */
24
+ bodyClass?: Cx.ClassProp;
23
25
 
24
26
  /** Set to `true` to enable resizing. */
25
- resizable?: boolean,
27
+ resizable?: boolean;
26
28
 
27
29
  /** Set to `true` to automatically focus the field, after it renders for the first time. */
28
- autoFocus?: boolean,
30
+ autoFocus?: boolean;
29
31
 
30
32
  /** Set to `false` to prevent the window itself to be focusable. Default value is true.*/
31
- focusable?: boolean,
33
+ focusable?: boolean;
32
34
 
33
35
  /** Set to `true` to disable moving the window by dragging the header. */
34
- fixed?: boolean,
35
-
36
+ fixed?: boolean;
36
37
  }
37
38
 
38
39
  export class Window extends Cx.Widget<WindowProps> {}