@uifabric/utilities
Advanced tools
Comparing version 7.33.5 to 7.34.0
# Change Log - @uifabric/utilities | ||
This log was last generated on Thu, 11 Feb 2021 12:25:26 GMT and should not be manually modified. | ||
This log was last generated on Wed, 30 Mar 2022 12:23:45 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## [7.34.0](https://github.com/microsoft/fluentui/tree/@uifabric/utilities_v7.34.0) | ||
Wed, 30 Mar 2022 12:23:45 GMT | ||
[Compare changes](https://github.com/microsoft/fluentui/compare/@uifabric/utilities_v7.33.4..@uifabric/utilities_v7.34.0) | ||
### Minor changes | ||
- Improve Selection with more micro-management capabilities (#21970) ([PR #22039](https://github.com/microsoft/fluentui/pull/22039) by tmichon@microsoft.com) | ||
## [7.33.4](https://github.com/microsoft/fluentui/tree/@uifabric/utilities_v7.33.4) | ||
@@ -8,0 +17,0 @@ |
@@ -695,2 +695,4 @@ ## API Report File for "@uifabric/utilities" | ||
// (undocumented) | ||
getItemIndex?(key: string): number; | ||
// (undocumented) | ||
getItems(): TItem[]; | ||
@@ -749,2 +751,4 @@ // (undocumented) | ||
// (undocumented) | ||
onItemsChanged?: () => void; | ||
// (undocumented) | ||
onSelectionChanged?: () => void; | ||
@@ -1060,2 +1064,4 @@ // (undocumented) | ||
// (undocumented) | ||
getItemIndex(key: string): number; | ||
// (undocumented) | ||
getItems(): TItem[]; | ||
@@ -1111,2 +1117,5 @@ // (undocumented) | ||
// @public (undocumented) | ||
export const SELECTION_ITEMS_CHANGE = "items-change"; | ||
// @public (undocumented) | ||
export enum SelectionDirection { | ||
@@ -1113,0 +1122,0 @@ // (undocumented) |
@@ -7,2 +7,3 @@ import { IObjectWithKey, ISelection, SelectionMode } from './Selection.types'; | ||
onSelectionChanged?: () => void; | ||
onItemsChanged?: () => void; | ||
/** Custom logic to generate item keys. Required if `TItem` does not have a `key` property. */ | ||
@@ -38,2 +39,3 @@ getKey?: (item: TItem, index?: number) => string | number; | ||
private _onSelectionChanged; | ||
private _onItemsChanged; | ||
private _hasChanged; | ||
@@ -65,2 +67,3 @@ private _unselectableIndices; | ||
getSelectedIndices(): number[]; | ||
getItemIndex(key: string): number; | ||
isRangeSelected(fromIndex: number, count: number): boolean; | ||
@@ -67,0 +70,0 @@ isAllSelected(): boolean; |
@@ -21,3 +21,3 @@ define(["require", "exports", "./Selection.types", "../EventGroup"], function (require, exports, Selection_types_1, EventGroup_1) { | ||
} | ||
var _a = options[0] || {}, onSelectionChanged = _a.onSelectionChanged, getKey = _a.getKey, _b = _a.canSelectItem, canSelectItem = _b === void 0 ? function () { return true; } : _b, items = _a.items, _c = _a.selectionMode, selectionMode = _c === void 0 ? Selection_types_1.SelectionMode.multiple : _c; | ||
var _a = options[0] || {}, onSelectionChanged = _a.onSelectionChanged, onItemsChanged = _a.onItemsChanged, getKey = _a.getKey, _b = _a.canSelectItem, canSelectItem = _b === void 0 ? function () { return true; } : _b, items = _a.items, _c = _a.selectionMode, selectionMode = _c === void 0 ? Selection_types_1.SelectionMode.multiple : _c; | ||
this.mode = selectionMode; | ||
@@ -30,3 +30,5 @@ this._getKey = getKey || defaultGetKey; | ||
this._onSelectionChanged = onSelectionChanged; | ||
this._onItemsChanged = onItemsChanged; | ||
this._canSelectItem = canSelectItem; | ||
this._keyToIndexMap = {}; | ||
this._isModal = false; | ||
@@ -83,2 +85,3 @@ this.setItems(items || [], true); | ||
this._unselectableCount = 0; | ||
var haveItemsChanged = false; | ||
// Build lookup table for quick selection evaluation. | ||
@@ -90,2 +93,5 @@ for (var i = 0; i < items.length; i++) { | ||
if (key) { | ||
if (!haveItemsChanged && (!(key in this._keyToIndexMap) || this._keyToIndexMap[key] !== i)) { | ||
haveItemsChanged = true; | ||
} | ||
newKeyToIndexMap[key] = i; | ||
@@ -127,2 +133,11 @@ } | ||
} | ||
if (!haveItemsChanged) { | ||
for (var _i = 0, _a = Object.keys(this._keyToIndexMap); _i < _a.length; _i++) { | ||
var key = _a[_i]; | ||
if (!(key in newKeyToIndexMap)) { | ||
haveItemsChanged = true; | ||
break; | ||
} | ||
} | ||
} | ||
this._exemptedIndices = newExemptedIndicies; | ||
@@ -136,2 +151,10 @@ this._exemptedCount = newExemptedCount; | ||
this._updateCount(); | ||
} | ||
if (haveItemsChanged) { | ||
EventGroup_1.EventGroup.raise(this, Selection_types_1.SELECTION_ITEMS_CHANGE); | ||
if (this._onItemsChanged) { | ||
this._onItemsChanged(); | ||
} | ||
} | ||
if (hasSelectionChanged) { | ||
this._change(); | ||
@@ -177,2 +200,6 @@ } | ||
}; | ||
Selection.prototype.getItemIndex = function (key) { | ||
var index = this._keyToIndexMap[key]; | ||
return (index !== null && index !== void 0 ? index : -1); | ||
}; | ||
Selection.prototype.isRangeSelected = function (fromIndex, count) { | ||
@@ -179,0 +206,0 @@ if (count === 0) { |
@@ -8,2 +8,3 @@ /** | ||
export declare const SELECTION_CHANGE = "change"; | ||
export declare const SELECTION_ITEMS_CHANGE = "items-change"; | ||
/** | ||
@@ -27,2 +28,3 @@ * {@docCategory Selection} | ||
getItems(): TItem[]; | ||
getItemIndex?(key: string): number; | ||
getSelection(): TItem[]; | ||
@@ -29,0 +31,0 @@ getSelectedIndices(): number[]; |
@@ -5,2 +5,3 @@ define(["require", "exports"], function (require, exports) { | ||
exports.SELECTION_CHANGE = 'change'; | ||
exports.SELECTION_ITEMS_CHANGE = 'items-change'; | ||
/** | ||
@@ -7,0 +8,0 @@ * {@docCategory Selection} |
define(["require", "exports", "@uifabric/set-version"], function (require, exports, set_version_1) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
set_version_1.setVersion('@uifabric/utilities', '7.33.4'); | ||
set_version_1.setVersion('@uifabric/utilities', '7.33.5'); | ||
}); | ||
//# sourceMappingURL=version.js.map |
@@ -7,2 +7,3 @@ import { IObjectWithKey, ISelection, SelectionMode } from './Selection.types'; | ||
onSelectionChanged?: () => void; | ||
onItemsChanged?: () => void; | ||
/** Custom logic to generate item keys. Required if `TItem` does not have a `key` property. */ | ||
@@ -38,2 +39,3 @@ getKey?: (item: TItem, index?: number) => string | number; | ||
private _onSelectionChanged; | ||
private _onItemsChanged; | ||
private _hasChanged; | ||
@@ -65,2 +67,3 @@ private _unselectableIndices; | ||
getSelectedIndices(): number[]; | ||
getItemIndex(key: string): number; | ||
isRangeSelected(fromIndex: number, count: number): boolean; | ||
@@ -67,0 +70,0 @@ isAllSelected(): boolean; |
@@ -22,3 +22,3 @@ "use strict"; | ||
} | ||
var _a = options[0] || {}, onSelectionChanged = _a.onSelectionChanged, getKey = _a.getKey, _b = _a.canSelectItem, canSelectItem = _b === void 0 ? function () { return true; } : _b, items = _a.items, _c = _a.selectionMode, selectionMode = _c === void 0 ? Selection_types_1.SelectionMode.multiple : _c; | ||
var _a = options[0] || {}, onSelectionChanged = _a.onSelectionChanged, onItemsChanged = _a.onItemsChanged, getKey = _a.getKey, _b = _a.canSelectItem, canSelectItem = _b === void 0 ? function () { return true; } : _b, items = _a.items, _c = _a.selectionMode, selectionMode = _c === void 0 ? Selection_types_1.SelectionMode.multiple : _c; | ||
this.mode = selectionMode; | ||
@@ -31,3 +31,5 @@ this._getKey = getKey || defaultGetKey; | ||
this._onSelectionChanged = onSelectionChanged; | ||
this._onItemsChanged = onItemsChanged; | ||
this._canSelectItem = canSelectItem; | ||
this._keyToIndexMap = {}; | ||
this._isModal = false; | ||
@@ -84,2 +86,3 @@ this.setItems(items || [], true); | ||
this._unselectableCount = 0; | ||
var haveItemsChanged = false; | ||
// Build lookup table for quick selection evaluation. | ||
@@ -91,2 +94,5 @@ for (var i = 0; i < items.length; i++) { | ||
if (key) { | ||
if (!haveItemsChanged && (!(key in this._keyToIndexMap) || this._keyToIndexMap[key] !== i)) { | ||
haveItemsChanged = true; | ||
} | ||
newKeyToIndexMap[key] = i; | ||
@@ -128,2 +134,11 @@ } | ||
} | ||
if (!haveItemsChanged) { | ||
for (var _i = 0, _a = Object.keys(this._keyToIndexMap); _i < _a.length; _i++) { | ||
var key = _a[_i]; | ||
if (!(key in newKeyToIndexMap)) { | ||
haveItemsChanged = true; | ||
break; | ||
} | ||
} | ||
} | ||
this._exemptedIndices = newExemptedIndicies; | ||
@@ -137,2 +152,10 @@ this._exemptedCount = newExemptedCount; | ||
this._updateCount(); | ||
} | ||
if (haveItemsChanged) { | ||
EventGroup_1.EventGroup.raise(this, Selection_types_1.SELECTION_ITEMS_CHANGE); | ||
if (this._onItemsChanged) { | ||
this._onItemsChanged(); | ||
} | ||
} | ||
if (hasSelectionChanged) { | ||
this._change(); | ||
@@ -178,2 +201,6 @@ } | ||
}; | ||
Selection.prototype.getItemIndex = function (key) { | ||
var index = this._keyToIndexMap[key]; | ||
return (index !== null && index !== void 0 ? index : -1); | ||
}; | ||
Selection.prototype.isRangeSelected = function (fromIndex, count) { | ||
@@ -180,0 +207,0 @@ if (count === 0) { |
@@ -8,2 +8,3 @@ /** | ||
export declare const SELECTION_CHANGE = "change"; | ||
export declare const SELECTION_ITEMS_CHANGE = "items-change"; | ||
/** | ||
@@ -27,2 +28,3 @@ * {@docCategory Selection} | ||
getItems(): TItem[]; | ||
getItemIndex?(key: string): number; | ||
getSelection(): TItem[]; | ||
@@ -29,0 +31,0 @@ getSelectedIndices(): number[]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SELECTION_CHANGE = 'change'; | ||
exports.SELECTION_ITEMS_CHANGE = 'items-change'; | ||
/** | ||
@@ -5,0 +6,0 @@ * {@docCategory Selection} |
@@ -6,3 +6,3 @@ "use strict"; | ||
var set_version_1 = require("@uifabric/set-version"); | ||
set_version_1.setVersion('@uifabric/utilities', '7.33.4'); | ||
set_version_1.setVersion('@uifabric/utilities', '7.33.5'); | ||
//# sourceMappingURL=version.js.map |
@@ -7,2 +7,3 @@ import { IObjectWithKey, ISelection, SelectionMode } from './Selection.types'; | ||
onSelectionChanged?: () => void; | ||
onItemsChanged?: () => void; | ||
/** Custom logic to generate item keys. Required if `TItem` does not have a `key` property. */ | ||
@@ -38,2 +39,3 @@ getKey?: (item: TItem, index?: number) => string | number; | ||
private _onSelectionChanged; | ||
private _onItemsChanged; | ||
private _hasChanged; | ||
@@ -65,2 +67,3 @@ private _unselectableIndices; | ||
getSelectedIndices(): number[]; | ||
getItemIndex(key: string): number; | ||
isRangeSelected(fromIndex: number, count: number): boolean; | ||
@@ -67,0 +70,0 @@ isAllSelected(): boolean; |
@@ -1,2 +0,2 @@ | ||
import { SELECTION_CHANGE, SelectionMode } from './Selection.types'; | ||
import { SELECTION_CHANGE, SELECTION_ITEMS_CHANGE, SelectionMode } from './Selection.types'; | ||
import { EventGroup } from '../EventGroup'; | ||
@@ -20,3 +20,3 @@ /** | ||
} | ||
var _a = options[0] || {}, onSelectionChanged = _a.onSelectionChanged, getKey = _a.getKey, _b = _a.canSelectItem, canSelectItem = _b === void 0 ? function () { return true; } : _b, items = _a.items, _c = _a.selectionMode, selectionMode = _c === void 0 ? SelectionMode.multiple : _c; | ||
var _a = options[0] || {}, onSelectionChanged = _a.onSelectionChanged, onItemsChanged = _a.onItemsChanged, getKey = _a.getKey, _b = _a.canSelectItem, canSelectItem = _b === void 0 ? function () { return true; } : _b, items = _a.items, _c = _a.selectionMode, selectionMode = _c === void 0 ? SelectionMode.multiple : _c; | ||
this.mode = selectionMode; | ||
@@ -29,3 +29,5 @@ this._getKey = getKey || defaultGetKey; | ||
this._onSelectionChanged = onSelectionChanged; | ||
this._onItemsChanged = onItemsChanged; | ||
this._canSelectItem = canSelectItem; | ||
this._keyToIndexMap = {}; | ||
this._isModal = false; | ||
@@ -82,2 +84,3 @@ this.setItems(items || [], true); | ||
this._unselectableCount = 0; | ||
var haveItemsChanged = false; | ||
// Build lookup table for quick selection evaluation. | ||
@@ -89,2 +92,5 @@ for (var i = 0; i < items.length; i++) { | ||
if (key) { | ||
if (!haveItemsChanged && (!(key in this._keyToIndexMap) || this._keyToIndexMap[key] !== i)) { | ||
haveItemsChanged = true; | ||
} | ||
newKeyToIndexMap[key] = i; | ||
@@ -126,2 +132,11 @@ } | ||
} | ||
if (!haveItemsChanged) { | ||
for (var _i = 0, _a = Object.keys(this._keyToIndexMap); _i < _a.length; _i++) { | ||
var key = _a[_i]; | ||
if (!(key in newKeyToIndexMap)) { | ||
haveItemsChanged = true; | ||
break; | ||
} | ||
} | ||
} | ||
this._exemptedIndices = newExemptedIndicies; | ||
@@ -135,2 +150,10 @@ this._exemptedCount = newExemptedCount; | ||
this._updateCount(); | ||
} | ||
if (haveItemsChanged) { | ||
EventGroup.raise(this, SELECTION_ITEMS_CHANGE); | ||
if (this._onItemsChanged) { | ||
this._onItemsChanged(); | ||
} | ||
} | ||
if (hasSelectionChanged) { | ||
this._change(); | ||
@@ -176,2 +199,6 @@ } | ||
}; | ||
Selection.prototype.getItemIndex = function (key) { | ||
var index = this._keyToIndexMap[key]; | ||
return (index !== null && index !== void 0 ? index : -1); | ||
}; | ||
Selection.prototype.isRangeSelected = function (fromIndex, count) { | ||
@@ -178,0 +205,0 @@ if (count === 0) { |
@@ -8,2 +8,3 @@ /** | ||
export declare const SELECTION_CHANGE = "change"; | ||
export declare const SELECTION_ITEMS_CHANGE = "items-change"; | ||
/** | ||
@@ -27,2 +28,3 @@ * {@docCategory Selection} | ||
getItems(): TItem[]; | ||
getItemIndex?(key: string): number; | ||
getSelection(): TItem[]; | ||
@@ -29,0 +31,0 @@ getSelectedIndices(): number[]; |
export var SELECTION_CHANGE = 'change'; | ||
export var SELECTION_ITEMS_CHANGE = 'items-change'; | ||
/** | ||
@@ -3,0 +4,0 @@ * {@docCategory Selection} |
// Do not modify this file; it is generated as part of publish. | ||
// The checked in version is a placeholder only and will not be updated. | ||
import { setVersion } from '@uifabric/set-version'; | ||
setVersion('@uifabric/utilities', '7.33.4'); | ||
setVersion('@uifabric/utilities', '7.33.5'); | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@uifabric/utilities", | ||
"version": "7.33.5", | ||
"version": "7.34.0", | ||
"description": "Fluent UI React utilities for building components.", | ||
@@ -5,0 +5,0 @@ "main": "lib-commonjs/index.js", |
@@ -9,2 +9,3 @@ /** | ||
export const SELECTION_CHANGE = 'change'; | ||
export const SELECTION_ITEMS_CHANGE = 'items-change'; | ||
@@ -37,2 +38,5 @@ /** | ||
// Item utility methods. | ||
getItemIndex?(key: string): number; | ||
// Read selection methods. | ||
@@ -39,0 +43,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2303526
29726