MCPcopy Create free account
hub / github.com/microsoft/SandDance / Selection1

Function Selection1

docs/app/js/sanddance-app.js:25893–25915  ·  view source on GitHub ↗

* Create a new Selection. If `TItem` does not have a `key` property, you must provide an options * object with a `getKey` implementation. Providing options is optional otherwise. * (At most one `options` object is accepted.)

()

Source from the content-addressed store, hash-verified

25891 * object with a `getKey` implementation. Providing options is optional otherwise.
25892 * (At most one `options` object is accepted.)
25893 */ function Selection1() {
25894 var options = []; // Otherwise, arguments require options with `getKey`.
25895 for(var _i = 0 // Otherwise, arguments require options with `getKey`.
25896 ; _i < arguments.length // Otherwise, arguments require options with `getKey`.
25897 ; _i++ // Otherwise, arguments require options with `getKey`.
25898 )options[_i] = arguments[_i]; // Otherwise, arguments require options with `getKey`.
25899 var _a = options[0] || {}, onSelectionChanged = _a.onSelectionChanged, onItemsChanged = _a.onItemsChanged, getKey = _a.getKey, _b = _a.canSelectItem, canSelectItem = _b === void 0 ? function() {
25900 return true;
25901 } : _b, items = _a.items, _c = _a.selectionMode, selectionMode = _c === void 0 ? (0, _selectionTypes.SelectionMode).multiple : _c;
25902 this.mode = selectionMode;
25903 this._getKey = getKey || defaultGetKey;
25904 this._changeEventSuppressionCount = 0;
25905 this._exemptedCount = 0;
25906 this._anchoredIndex = 0;
25907 this._unselectableCount = 0;
25908 this._onSelectionChanged = onSelectionChanged;
25909 this._onItemsChanged = onItemsChanged;
25910 this._canSelectItem = canSelectItem;
25911 this._keyToIndexMap = {};
25912 this._isModal = false;
25913 this.setItems(items || [], true);
25914 this.count = this.getSelectedCount();
25915 }
25916 Selection1.prototype.canSelectItem = function(item, index) {
25917 if (typeof index === "number" && index < 0) return false;
25918 return this._canSelectItem(item, index);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected