cx 24.4.5 → 24.4.6

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.
@@ -1,72 +1,72 @@
1
- import { Record } from "../core";
2
- import { RenderingContext } from "./RenderingContext";
3
- import { View } from "../data/View";
4
- import { Widget } from "./Widget";
5
-
6
- export class Instance<ViewModel = any, Controller = any> {
7
- store: View<ViewModel>;
8
- data: Record;
9
- widget: Widget;
10
- key: number;
11
- id: string;
12
- controller: Controller;
13
- parentOptions: any;
14
- children?: Instance[];
15
-
16
- constructor(widget: Widget, key: string | number, parent?: Instance, store?: View);
17
-
18
- setStore(store: View): void;
19
-
20
- init(context: RenderingContext): void;
21
-
22
- explore(context: RenderingContext): boolean;
23
-
24
- prepare(context: RenderingContext): void;
25
-
26
- cleanup(context: RenderingContext): void;
27
-
28
- render(context: RenderingContext, keyPrefix?: string): JSX.Element | void;
29
-
30
- setState(state: Cx.Record): void;
31
-
32
- set(prop: string, value: any, internal?: boolean);
33
-
34
- definePropertySetter(prop: string, setter: (value: any) => void): boolean;
35
-
36
- /**
37
- * @protected
38
- * @param prop
39
- * @param value
40
- * @returns {boolean}
41
- */
42
- protected doSet(prop: string, value: any): boolean;
43
-
44
- replaceState(state: Cx.Config);
45
-
46
- getInstanceCache(): InstanceCache;
47
-
48
- clearChildrenCache();
49
-
50
- getChild(context: RenderingContext | null, widget: Widget, keyPrefix?: string, store?: View): Instance;
51
-
52
- getDetachedChild(widget: Widget, key: number | string, store?: View): Instance;
53
-
54
- // TODO: check return type
55
- prepareRenderCleanupChild(widget: Widget, store?: View, keyPrefix?: string, options?: object): JSX.Element | void;
56
-
57
- getJsxEventProps(): Cx.Config;
58
-
59
- nestedDataSet(key: string, value: any, dataConfig: Cx.Config): boolean;
60
-
61
- invokeControllerMethod(methodName: string, ...args: any[]);
62
- }
63
-
64
- export class InstanceCache {
65
- constructor(parent: Instance);
66
-
67
- getChild(widget: Widget, store: View, keyPrefix?: string): Instance;
68
-
69
- mark();
70
-
71
- sweep();
72
- }
1
+ import { Record } from "../core";
2
+ import { RenderingContext } from "./RenderingContext";
3
+ import { View } from "../data/View";
4
+ import { Widget } from "./Widget";
5
+
6
+ export class Instance<ViewModel = any, Controller = any> {
7
+ store: View<ViewModel>;
8
+ data: Record;
9
+ widget: Widget;
10
+ key: number;
11
+ id: string;
12
+ controller: Controller;
13
+ parentOptions: any;
14
+ children?: Instance[];
15
+
16
+ constructor(widget: Widget, key: string | number, parent?: Instance, store?: View);
17
+
18
+ setStore(store: View): void;
19
+
20
+ init(context: RenderingContext): void;
21
+
22
+ explore(context: RenderingContext): boolean;
23
+
24
+ prepare(context: RenderingContext): void;
25
+
26
+ cleanup(context: RenderingContext): void;
27
+
28
+ render(context: RenderingContext, keyPrefix?: string): JSX.Element | void;
29
+
30
+ setState(state: Cx.Record): void;
31
+
32
+ set(prop: string, value: any, internal?: boolean);
33
+
34
+ definePropertySetter(prop: string, setter: (value: any) => void): boolean;
35
+
36
+ /**
37
+ * @protected
38
+ * @param prop
39
+ * @param value
40
+ * @returns {boolean}
41
+ */
42
+ protected doSet(prop: string, value: any): boolean;
43
+
44
+ replaceState(state: Cx.Config);
45
+
46
+ getInstanceCache(): InstanceCache;
47
+
48
+ clearChildrenCache();
49
+
50
+ getChild(context: RenderingContext | null, widget: Widget, keyPrefix?: string, store?: View): Instance;
51
+
52
+ getDetachedChild(widget: Widget, key: number | string, store?: View): Instance;
53
+
54
+ // TODO: check return type
55
+ prepareRenderCleanupChild(widget: Widget, store?: View, keyPrefix?: string, options?: object): JSX.Element | void;
56
+
57
+ getJsxEventProps(): Cx.Config;
58
+
59
+ nestedDataSet(key: string, value: any, dataConfig: Cx.Config): boolean;
60
+
61
+ invokeControllerMethod(methodName: string, ...args: any[]);
62
+ }
63
+
64
+ export class InstanceCache {
65
+ constructor(parent: Instance);
66
+
67
+ getChild(widget: Widget, store: View, keyPrefix?: string): Instance;
68
+
69
+ mark();
70
+
71
+ sweep();
72
+ }
package/src/ui/index.d.ts CHANGED
@@ -1,42 +1,42 @@
1
- export * from "./Controller";
2
- export * from "./Widget";
3
- export * from "./Container";
4
- export * from "./PureContainer";
5
- export * from "./Repeater";
6
- export * from "./Rescope";
7
- export * from "./StaticText";
8
- export * from "./Text";
9
- export * from "./CSS";
10
- export * from "./CSSHelper";
11
- export * from "./FocusManager";
12
- export * from "./ResizeManager";
13
- export * from "./ZIndexManager";
14
- export * from "./Format";
15
- export * from "./Culture";
16
- export * from "./Localization";
17
- export * from "./Cx";
18
- export * from "./Instance";
19
- export * from "./RenderingContext";
20
- export * from "./ContentResolver";
21
- export * from "./batchUpdates";
22
- export * from "./IsolatedScope";
23
- export * from "./DetachedScope";
24
- export * from "./Restate";
25
- export * from "./DataProxy";
26
- export * from "./keyboardShortcuts";
27
- export * from "./createFunctionalComponent";
28
- export * from "./StructuredInstanceDataAccessor";
29
- export * from "./HoverSync";
30
-
31
- export * from "./selection/index";
32
- export * from "./layout/index";
33
- export * from "./app/index";
34
- export * from "./adapter/index";
35
-
36
- export * from "./bind";
37
- export * from "./tpl";
38
- export * from "./expr";
39
-
40
- //re-export computable here
41
- import { computable } from "../data/computable";
42
- export { computable };
1
+ export * from "./Controller";
2
+ export * from "./Widget";
3
+ export * from "./Container";
4
+ export * from "./PureContainer";
5
+ export * from "./Repeater";
6
+ export * from "./Rescope";
7
+ export * from "./StaticText";
8
+ export * from "./Text";
9
+ export * from "./CSS";
10
+ export * from "./CSSHelper";
11
+ export * from "./FocusManager";
12
+ export * from "./ResizeManager";
13
+ export * from "./ZIndexManager";
14
+ export * from "./Format";
15
+ export * from "./Culture";
16
+ export * from "./Localization";
17
+ export * from "./Cx";
18
+ export * from "./Instance";
19
+ export * from "./RenderingContext";
20
+ export * from "./ContentResolver";
21
+ export * from "./batchUpdates";
22
+ export * from "./IsolatedScope";
23
+ export * from "./DetachedScope";
24
+ export * from "./Restate";
25
+ export * from "./DataProxy";
26
+ export * from "./keyboardShortcuts";
27
+ export * from "./createFunctionalComponent";
28
+ export * from "./StructuredInstanceDataAccessor";
29
+ export * from "./HoverSync";
30
+
31
+ export * from "./selection/index";
32
+ export * from "./layout/index";
33
+ export * from "./app/index";
34
+ export * from "./adapter/index";
35
+
36
+ export * from "./bind";
37
+ export * from "./tpl";
38
+ export * from "./expr";
39
+
40
+ //re-export computable here
41
+ import { computable } from "../data/computable";
42
+ export { computable };
@@ -1,4 +1,4 @@
1
- export class Console {
2
- static log(...args: unknown[]): void;
3
- static warn(...args: unknown[]): void;
4
- }
1
+ export class Console {
2
+ static log(...args: unknown[]): void;
3
+ static warn(...args: unknown[]): void;
4
+ }
@@ -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> {}
@@ -96,6 +96,24 @@ interface GridColumnHeaderConfig {
96
96
  resizable?: boolean;
97
97
  }
98
98
 
99
+ interface GridColumnFooterConfig {
100
+ value?: Prop<any>;
101
+ format?: StringProp;
102
+ style?: StyleProp;
103
+ class?: StyleProp;
104
+ expand?: boolean;
105
+ }
106
+
107
+ interface GridColumnCaptionConfig {
108
+ value?: Prop<any>;
109
+ format?: StringProp;
110
+ style?: StyleProp;
111
+ class?: StyleProp;
112
+ children?: React.ReactNode;
113
+ items?: React.ReactNode;
114
+ expand?: boolean;
115
+ }
116
+
99
117
  interface GridColumnConfig {
100
118
  align?: GridColumnAlignment;
101
119
  field?: string;
@@ -110,13 +128,13 @@ interface GridColumnConfig {
110
128
  aggregateAlias?: string;
111
129
  aggregateField?: string;
112
130
  aggregateValue?: UnknownProp;
113
- caption?: StringProp;
131
+ caption?: GridColumnCaptionConfig | StringProp | false;
114
132
  class?: ClassProp;
115
133
  className?: ClassProp;
116
134
  draggable?: boolean;
117
135
  editable?: boolean;
118
136
  editor?: React.ReactNode;
119
- footer?: StringProp | false;
137
+ footer?: GridColumnFooterConfig | StringProp | false;
120
138
  items?: React.ReactNode;
121
139
  children?: React.ReactNode;
122
140
  key?: string;
@@ -323,7 +341,7 @@ interface GridProps<T = unknown> extends StyledContainerProps {
323
341
  sortField?: string;
324
342
  sortDirection?: string;
325
343
  },
326
- instance?: Instance,
344
+ instance?: Instance
327
345
  ) => FetchRecordsResult | Promise<FetchRecordsResult>;
328
346
 
329
347
  /** Callback function to be executed when a row is double-clicked. */
@@ -356,7 +374,7 @@ interface GridProps<T = unknown> extends StyledContainerProps {
356
374
  /** Callback to create a function that can be used to check whether a record is selectable. */
357
375
  onCreateIsRecordSelectable?: (
358
376
  params: any,
359
- instance: Instance,
377
+ instance: Instance
360
378
  ) => (record: T, options?: { range?: boolean; toggle?: boolean }) => boolean;
361
379
 
362
380
  /** Parameters whose change will cause scroll to be reset. */
@@ -1,88 +1,88 @@
1
- // GRID
2
- $cx-default-grid-font-size: $cx-default-box-font-size !default;
3
- $cx-default-grid-border-color: $cx-default-border-color !default;
4
- $cx-default-grid-border-radius: null !default;
5
- $cx-default-grid-box-shadow: null !default;
6
-
7
- // header
8
- $cx-default-grid-header-font-size: $cx-default-box-font-size !default;
9
- $cx-default-grid-header-font-weight: normal !default;
10
- $cx-default-grid-header-line-height: null !default;
11
- $cx-default-grid-header-color: $cx-default-color !default;
12
- $cx-default-grid-header-background-color: #eee !default;
13
- $cx-default-grid-header-border-color: $cx-default-border-color !default;
14
- $cx-default-grid-header-box-shadow: null !default;
15
- $cx-default-grid-header-padding: null !default;
16
-
17
- $cx-grid-header-state-style-map: (
18
- default: (
19
- font-size: $cx-default-grid-header-font-size,
20
- font-weight: $cx-default-grid-header-font-weight,
21
- line-height: $cx-default-grid-header-line-height,
22
- color: $cx-default-grid-header-color,
23
- background-color: $cx-default-grid-header-background-color,
24
- border-color: $cx-default-grid-header-border-color,
25
- background-clip: border-box,
26
- padding: $cx-default-grid-header-padding,
27
- ),
28
- hover: (
29
- background-color: darken($cx-default-grid-header-background-color, 2),
30
- ),
31
- sorted: (
32
- background-color: darken($cx-default-grid-header-background-color, 7),
33
- ),
34
- sorted-hover: (
35
- background-color: darken($cx-default-grid-header-background-color, 5),
36
- ),
37
- ) !default;
38
-
39
- // data
40
- $cx-default-grid-data-font-size: null !default;
41
- $cx-default-grid-data-font-weight: null !default;
42
- $cx-default-grid-data-line-height: null !default;
43
- $cx-default-grid-data-background-color: transparent !default;
44
- $cx-default-grid-data-alternate-background-color: null !default;
45
- $cx-default-grid-data-border-color: $cx-default-grid-border-color !default;
46
- $cx-default-grid-data-padding: 5px !default;
47
-
48
- $cx-grid-data-state-style-map: cx-deep-map-merge(
49
- $cx-list-item,
50
- (
51
- default: (
52
- font-size: $cx-default-grid-data-font-size,
53
- line-height: $cx-default-grid-data-line-height,
54
- font-weight: $cx-default-grid-data-font-weight,
55
- background-color: $cx-default-grid-data-background-color,
56
- border-color: $cx-default-grid-data-border-color,
57
- padding: $cx-default-grid-data-padding,
58
- ),
59
- alternate: (
60
- background-color: $cx-default-grid-data-alternate-background-color,
61
- ),
62
- )
63
- ) !default;
64
-
65
- // pagination
66
- $cx-grid-pagination-default-border-width: $cx-default-border-width !default;
67
- $cx-grid-pagination-default-border-color: $cx-default-border-color !default;
68
- $cx-grid-pagination-default-border-radius: null !default;
69
- $cx-grid-pagination-default-outer-border-radius: $cx-default-border-radius !default;
70
- $cx-grid-pagination-default-padding: cx-top($cx-default-box-padding) 2 * cx-top($cx-default-box-padding) !default;
71
-
72
- $cx-grid-pagination-state-style-map: cx-deep-map-merge($cx-list-item, ()) !default;
73
-
74
- $cx-grid-cell-cursor-style: (
75
- left: -1px,
76
- top: -1px,
77
- right: -1px,
78
- bottom: -1px,
79
- background: rgba(green, 0.1),
80
- border: 2px solid rgba(green, 1),
81
- );
82
-
83
- $cx-dependencies: map-merge(
84
- $cx-dependencies,
85
- (
86
- "cx/widgets/Grid": "cx/widgets/DragClone",
87
- )
88
- );
1
+ // GRID
2
+ $cx-default-grid-font-size: $cx-default-box-font-size !default;
3
+ $cx-default-grid-border-color: $cx-default-border-color !default;
4
+ $cx-default-grid-border-radius: null !default;
5
+ $cx-default-grid-box-shadow: null !default;
6
+
7
+ // header
8
+ $cx-default-grid-header-font-size: $cx-default-box-font-size !default;
9
+ $cx-default-grid-header-font-weight: normal !default;
10
+ $cx-default-grid-header-line-height: null !default;
11
+ $cx-default-grid-header-color: $cx-default-color !default;
12
+ $cx-default-grid-header-background-color: #eee !default;
13
+ $cx-default-grid-header-border-color: $cx-default-border-color !default;
14
+ $cx-default-grid-header-box-shadow: null !default;
15
+ $cx-default-grid-header-padding: null !default;
16
+
17
+ $cx-grid-header-state-style-map: (
18
+ default: (
19
+ font-size: $cx-default-grid-header-font-size,
20
+ font-weight: $cx-default-grid-header-font-weight,
21
+ line-height: $cx-default-grid-header-line-height,
22
+ color: $cx-default-grid-header-color,
23
+ background-color: $cx-default-grid-header-background-color,
24
+ border-color: $cx-default-grid-header-border-color,
25
+ background-clip: border-box,
26
+ padding: $cx-default-grid-header-padding,
27
+ ),
28
+ hover: (
29
+ background-color: darken($cx-default-grid-header-background-color, 2),
30
+ ),
31
+ sorted: (
32
+ background-color: darken($cx-default-grid-header-background-color, 7),
33
+ ),
34
+ sorted-hover: (
35
+ background-color: darken($cx-default-grid-header-background-color, 5),
36
+ ),
37
+ ) !default;
38
+
39
+ // data
40
+ $cx-default-grid-data-font-size: null !default;
41
+ $cx-default-grid-data-font-weight: null !default;
42
+ $cx-default-grid-data-line-height: null !default;
43
+ $cx-default-grid-data-background-color: transparent !default;
44
+ $cx-default-grid-data-alternate-background-color: null !default;
45
+ $cx-default-grid-data-border-color: $cx-default-grid-border-color !default;
46
+ $cx-default-grid-data-padding: 5px !default;
47
+
48
+ $cx-grid-data-state-style-map: cx-deep-map-merge(
49
+ $cx-list-item,
50
+ (
51
+ default: (
52
+ font-size: $cx-default-grid-data-font-size,
53
+ line-height: $cx-default-grid-data-line-height,
54
+ font-weight: $cx-default-grid-data-font-weight,
55
+ background-color: $cx-default-grid-data-background-color,
56
+ border-color: $cx-default-grid-data-border-color,
57
+ padding: $cx-default-grid-data-padding,
58
+ ),
59
+ alternate: (
60
+ background-color: $cx-default-grid-data-alternate-background-color,
61
+ ),
62
+ )
63
+ ) !default;
64
+
65
+ // pagination
66
+ $cx-grid-pagination-default-border-width: $cx-default-border-width !default;
67
+ $cx-grid-pagination-default-border-color: $cx-default-border-color !default;
68
+ $cx-grid-pagination-default-border-radius: null !default;
69
+ $cx-grid-pagination-default-outer-border-radius: $cx-default-border-radius !default;
70
+ $cx-grid-pagination-default-padding: cx-top($cx-default-box-padding) 2 * cx-top($cx-default-box-padding) !default;
71
+
72
+ $cx-grid-pagination-state-style-map: cx-deep-map-merge($cx-list-item, ()) !default;
73
+
74
+ $cx-grid-cell-cursor-style: (
75
+ left: -1px,
76
+ top: -1px,
77
+ right: -1px,
78
+ bottom: -1px,
79
+ background: rgba(green, 0.1),
80
+ border: 2px solid rgba(green, 1),
81
+ );
82
+
83
+ $cx-dependencies: map-merge(
84
+ $cx-dependencies,
85
+ (
86
+ "cx/widgets/Grid": "cx/widgets/DragClone",
87
+ )
88
+ );