native-document 1.0.225 → 1.0.227
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "native-document",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.227",
|
|
4
4
|
"description": "A reactive JavaScript framework that preserves native DOM simplicity without sacrificing modern features",
|
|
5
5
|
"author": "AfroCodeur <https://github.com/afrocodeur>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -123,3 +123,26 @@ List.prototype.onItemSelect = function(handler) {
|
|
|
123
123
|
this.on('itemSelect', handler);
|
|
124
124
|
return this;
|
|
125
125
|
};
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* @param {*|Array<*>} value
|
|
129
|
+
* @return {this}
|
|
130
|
+
*/
|
|
131
|
+
List.prototype.setSelected = function(value) {
|
|
132
|
+
if(!Array.isArray(value)) {
|
|
133
|
+
value = [value];
|
|
134
|
+
}
|
|
135
|
+
this.$description.selectedValues.set(value);
|
|
136
|
+
return this;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* @return {*}
|
|
141
|
+
*/
|
|
142
|
+
List.prototype.selected = function() {
|
|
143
|
+
const values = this.$description.selectedValues.val();
|
|
144
|
+
if(this.$description.multiSelect.val()) {
|
|
145
|
+
return values;
|
|
146
|
+
}
|
|
147
|
+
return values[0];
|
|
148
|
+
};
|
|
@@ -43,6 +43,9 @@ export interface ListInterface {
|
|
|
43
43
|
onItemClick(handler: (item: ListItemInterface, event: MouseEvent) => void): this;
|
|
44
44
|
onItemSelect(handler: (item: ListItemInterface) => void): this;
|
|
45
45
|
|
|
46
|
+
setSelected(value: any): this;
|
|
47
|
+
selected(): any;
|
|
48
|
+
|
|
46
49
|
// HasEventEmitter
|
|
47
50
|
on(event: string, handler: (...args: unknown[]) => void): this;
|
|
48
51
|
emit(event: string, ...args: unknown[]): void;
|