Skip to content

Commit 4487255

Browse files
committed
Fix after rebase
1 parent df6208d commit 4487255

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

lib/public/components/Filters/common/TagFilterModel.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export class TagFilterModel extends FilterModel {
2222
/**
2323
* Constructor
2424
*
25+
* @param {ObservableData<RemoteData<Tag[], ApiError>>} tags$ observable remote data of tags list
2526
* @param {SelectionOption[]} [operators] optionally the list of available operators for the filter
2627
* @constructor
2728
*/

lib/public/components/Filters/common/filters/ComparisonSelectionModel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* or submit itself to any jurisdiction.
1212
*/
1313

14-
import { SelectionDropdownModel } from '../../../common/selection/dropdown/SelectionDropdownModel.js';
14+
import { SelectionModel } from '../../../common/selection/SelectionModel.js';
1515

1616
const numericalComparisonOptions = Object.freeze([
1717
{ value: '<' },
@@ -24,7 +24,7 @@ const numericalComparisonOptions = Object.freeze([
2424
/**
2525
* Model storing state of a selection of comparison operator
2626
*/
27-
export class ComparisonSelectionModel extends SelectionDropdownModel {
27+
export class ComparisonSelectionModel extends SelectionModel {
2828
/**
2929
* Constructor
3030
*/

lib/public/components/Filters/common/filters/NumericalComparisonFilterModel.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export class NumericalComparisonFilterModel extends FilterModel {
4242
this._addSubmodel(this._operandInputModel);
4343

4444
this._operatorSelectionModel = new ComparisonSelectionModel();
45-
this._operatorSelectionModel.visualChange$.bubbleTo(this._visualChange$);
4645
this._operatorSelectionModel.observe(() => this._operandInputModel.raw ? this.notify() : this._visualChange$.notify());
4746
}
4847

lib/public/components/common/selection/FilterableRemoteSelectionModel.js

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ import { Observable, RemoteData } from '/js/src/index.js';
1414
import { SelectionModel } from './SelectionModel.js';
1515

1616
/**
17-
* @typedef SelectionOption A picker option, with the actual value and its string representation
18-
* @property {number|string} value The id of the object this is used to see if it is checked.
19-
* @property {Component} [label] The representation of the option (if null, value is used as label)
20-
* @property {string} [rawLabel] The string only representation of the option, useful if the label is not a string
21-
* @property {string} [selector] If the value of the option is not a valid CSS, this is used to define option's id
17+
* @typedef {SelectionModelConfiguration} FilterableRemoteSelectionModelConfiguration
18+
* @property {RemoteData<SelectionOption[], *>} [availableOptions=[]] the list of available options
2219
*/
2320

2421
/**
@@ -27,7 +24,7 @@ import { SelectionModel } from './SelectionModel.js';
2724
export class FilterableRemoteSelectionModel extends Observable {
2825
/**
2926
* Constructor
30-
* @param {SelectionModelConfiguration} [configuration] the model's configuration
27+
* @param {FilterableRemoteSelectionModelConfiguration} [configuration] the model's configuration
3128
*/
3229
constructor(configuration) {
3330
super();
@@ -144,8 +141,6 @@ export class FilterableRemoteSelectionModel extends Observable {
144141
/**
145142
* Return the **values** of the currently selected options
146143
*
147-
* Do not use this getter to modify the selected list but use the `selected` setter to define the new selected list and to notify observers
148-
*
149144
* @return {string[]|number[]} the values of the selected options
150145
*/
151146
get selected() {
@@ -156,16 +151,12 @@ export class FilterableRemoteSelectionModel extends Observable {
156151
}
157152

158153
/**
159-
* If the selection allows one and only one selection, current will return the currently selected option. In any other case it will throw an
160-
* error
161-
*
162-
* @return {string|number} the current selection
154+
* Return the list of available options
163155
*/
164-
get current() {
165-
if (this._allowEmpty || this._multiple) {
166-
throw new Error('"current" is available only in non-multiple select that do not allow empty value');
167-
}
168-
169-
return this.selected[0];
156+
get options() {
157+
return this.selectionModel.match({
158+
Success: (selectionModel) => selectionModel.options,
159+
Other: () => [],
160+
});
170161
}
171162
}

lib/public/components/common/selection/SelectionModel.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1+
import { Observable } from '/js/src/index.js';
2+
13
/**
24
* @typedef SelectionModelConfiguration
35
* @property {SelectionOption[]} [availableOptions=[]] the list of available options
46
* @property {SelectionOption[]} [defaultSelection=[]] the default selection
57
* @property {boolean} [multiple=true] if true, the selection can contain more than one element. Else, any selection will
68
* discard the previous one
7-
* @property {allowEmpty} [allowEmpty=true] if true, the selection can be empty. Else, deselect will be cancelled if it leads to
9+
* @property {boolean} [allowEmpty=true] if true, the selection can be empty. Else, deselect will be cancelled if it leads to
810
* empty selection
911
*/
10-
import { Observable } from '/js/src/index.js';
12+
13+
/**
14+
* @typedef SelectionOption A picker option, with the actual value and its string representation
15+
* @property {number|string} value The id of the object this is used to see if it is checked.
16+
* @property {Component} [label] The representation of the option (if null, value is used as label)
17+
* @property {string} [rawLabel] The string only representation of the option, useful if the label is not a string
18+
* @property {string} [selector] If the value of the option is not a valid CSS, this is used to define option's id
19+
*/
1120

1221
/**
1322
* Model to store any custom user selection of pre-defined options

0 commit comments

Comments
 (0)