cx 26.0.11 → 26.0.12
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/build/ui/selection/KeySelection.d.ts +0 -8
- package/build/ui/selection/Selection.d.ts +9 -3
- package/build/widgets/HtmlElement.d.ts +2 -0
- package/dist/manifest.js +784 -784
- package/package.json +1 -1
- package/src/ui/selection/KeySelection.ts +153 -165
- package/src/ui/selection/PropertySelection.ts +87 -87
- package/src/ui/selection/Selection.ts +128 -118
- package/src/widgets/HtmlElement.tsx +5 -1
|
@@ -1,118 +1,128 @@
|
|
|
1
|
-
import { Component } from "../../util/Component";
|
|
2
|
-
import { View } from "../../data/View";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return this.
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
selectMultiple(): void {
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
1
|
+
import { Component } from "../../util/Component";
|
|
2
|
+
import { View } from "../../data/View";
|
|
3
|
+
import { AccessorChain } from "../../data/createAccessorModelProxy";
|
|
4
|
+
import { Prop } from "../Prop";
|
|
5
|
+
|
|
6
|
+
export interface SelectionOptions {
|
|
7
|
+
toggle?: boolean;
|
|
8
|
+
add?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface SelectionConfig {
|
|
12
|
+
/** Binding path for selection state. */
|
|
13
|
+
bind?: string | AccessorChain<any>;
|
|
14
|
+
|
|
15
|
+
/** Record binding. */
|
|
16
|
+
record?: Prop<any>;
|
|
17
|
+
|
|
18
|
+
/** Index binding. */
|
|
19
|
+
index?: Prop<number>;
|
|
20
|
+
|
|
21
|
+
toggle?: boolean;
|
|
22
|
+
|
|
23
|
+
/** Set to `true` to allow multiple selection. */
|
|
24
|
+
multiple?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export class Selection extends Component {
|
|
28
|
+
declare bind?: string;
|
|
29
|
+
declare record?: any;
|
|
30
|
+
declare index?: any;
|
|
31
|
+
declare toggle: boolean;
|
|
32
|
+
declare isDummy: boolean;
|
|
33
|
+
declare multiple: boolean;
|
|
34
|
+
|
|
35
|
+
constructor(config?: SelectionConfig) {
|
|
36
|
+
super(config);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
isSelected(store: View, record: any, index: any): boolean {
|
|
40
|
+
return !!this.bind && store.get(this.bind) === record;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
getIsSelectedDelegate(store: View): (record: any, index: any) => boolean {
|
|
44
|
+
return (record, index) => this.isSelected(store, record, index);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
select(store: View, record: any, index: any, options?: SelectionOptions): any {
|
|
48
|
+
this.selectMultiple(store, [record], [index], options);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
selectMultiple(store: View, records: any[], indexes: any[], options?: SelectionOptions): any {
|
|
52
|
+
//abstract
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
declareData(...args: any[]): any {
|
|
56
|
+
var declaration = {
|
|
57
|
+
$selection: { structured: true },
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return Object.assign(declaration, ...args);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
configureWidget(widget: any): any {
|
|
64
|
+
if (this.record || this.index) {
|
|
65
|
+
widget.$selection = Object.assign(widget.$selection || {}, {
|
|
66
|
+
record: this.record,
|
|
67
|
+
index: this.index,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return this.declareData();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
selectInstance(instance: any, options?: SelectionOptions): any {
|
|
75
|
+
var { store, data } = instance;
|
|
76
|
+
if (!data.$selection)
|
|
77
|
+
throw new Error(
|
|
78
|
+
"Selection model not properly configured. Using the selectInstance method without specified record and index bindings.",
|
|
79
|
+
);
|
|
80
|
+
return this.select(store, data.$selection.record, data.$selection.index, options);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
isInstanceSelected(instance: any): boolean {
|
|
84
|
+
var { store, data } = instance;
|
|
85
|
+
return data.$selection && this.isSelected(store, data.$selection.record, data.$selection.index);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
Selection.prototype.toggle = false;
|
|
90
|
+
|
|
91
|
+
Selection.namespace = "ui.selection.";
|
|
92
|
+
|
|
93
|
+
export class SimpleSelection extends Selection {
|
|
94
|
+
isSelected(store: View, record: any, index: any): boolean {
|
|
95
|
+
return this.getIsSelectedDelegate(store)(record, index);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
getIsSelectedDelegate(store: View): (record: any, index: any) => boolean {
|
|
99
|
+
var selection = this.bind && store.get(this.bind);
|
|
100
|
+
return (record, index) => record === selection;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
selectMultiple(store: View, records: any[], index: any[]): void {
|
|
104
|
+
if (this.bind) store.set(this.bind, records[0]);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
class DummySelection extends Selection {
|
|
109
|
+
isSelected(store: View, record: any, index: any): boolean {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
selectMultiple(): void {
|
|
114
|
+
//dummy
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
selectInstance(): void {
|
|
118
|
+
//dummy
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
DummySelection.prototype.isDummy = true;
|
|
123
|
+
|
|
124
|
+
Selection.factory = (name: any): Selection => {
|
|
125
|
+
if (typeof name == "object") return new SimpleSelection(name);
|
|
126
|
+
|
|
127
|
+
return new DummySelection();
|
|
128
|
+
};
|
|
@@ -39,6 +39,9 @@ export interface HtmlElementConfig extends StyledContainerConfig {
|
|
|
39
39
|
/** Inner text contents. */
|
|
40
40
|
text?: StringProp | NumberProp;
|
|
41
41
|
|
|
42
|
+
/** Inner html contents. */
|
|
43
|
+
html?: StringProp;
|
|
44
|
+
|
|
42
45
|
/** Tooltip configuration. */
|
|
43
46
|
tooltip?: StringProp | TooltipConfig;
|
|
44
47
|
}
|
|
@@ -165,7 +168,8 @@ export class HtmlElement<
|
|
|
165
168
|
case "vdomKey":
|
|
166
169
|
return false;
|
|
167
170
|
|
|
168
|
-
default:
|
|
171
|
+
default:
|
|
172
|
+
if (isDataAttribute(attrName)) return false;
|
|
169
173
|
break;
|
|
170
174
|
}
|
|
171
175
|
|