@fluentui/react-tree 9.7.6 → 9.7.8
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/CHANGELOG.md +21 -2
- package/dist/index.d.ts +58 -86
- package/lib/components/FlatTree/useFlatControllableCheckedItems.js +15 -13
- package/lib/components/FlatTree/useFlatControllableCheckedItems.js.map +1 -1
- package/lib/components/FlatTree/useHeadlessFlatTree.js +4 -2
- package/lib/components/FlatTree/useHeadlessFlatTree.js.map +1 -1
- package/lib/components/Tree/Tree.types.js.map +1 -1
- package/lib/components/Tree/renderTree.js +3 -3
- package/lib/components/Tree/renderTree.js.map +1 -1
- package/lib/components/Tree/useNestedControllableCheckedItems.js +1 -1
- package/lib/components/Tree/useNestedControllableCheckedItems.js.map +1 -1
- package/lib/components/Tree/useTree.js +4 -2
- package/lib/components/Tree/useTree.js.map +1 -1
- package/lib/components/TreeItemChevron.js +5 -1
- package/lib/components/TreeItemChevron.js.map +1 -1
- package/lib/hooks/useControllableOpenItems.js +3 -12
- package/lib/hooks/useControllableOpenItems.js.map +1 -1
- package/lib/hooks/useRootTree.js +14 -6
- package/lib/hooks/useRootTree.js.map +1 -1
- package/lib/hooks/useSubtree.js +15 -1
- package/lib/hooks/useSubtree.js.map +1 -1
- package/lib/utils/ImmutableMap.js +71 -40
- package/lib/utils/ImmutableMap.js.map +1 -1
- package/lib/utils/ImmutableSet.js +65 -44
- package/lib/utils/ImmutableSet.js.map +1 -1
- package/lib/utils/createCheckedItems.js +5 -17
- package/lib/utils/createCheckedItems.js.map +1 -1
- package/lib-commonjs/components/FlatTree/useFlatControllableCheckedItems.js +15 -13
- package/lib-commonjs/components/FlatTree/useFlatControllableCheckedItems.js.map +1 -1
- package/lib-commonjs/components/FlatTree/useHeadlessFlatTree.js +4 -2
- package/lib-commonjs/components/FlatTree/useHeadlessFlatTree.js.map +1 -1
- package/lib-commonjs/components/Tree/Tree.types.js.map +1 -1
- package/lib-commonjs/components/Tree/renderTree.js +3 -3
- package/lib-commonjs/components/Tree/renderTree.js.map +1 -1
- package/lib-commonjs/components/Tree/useNestedControllableCheckedItems.js +1 -1
- package/lib-commonjs/components/Tree/useNestedControllableCheckedItems.js.map +1 -1
- package/lib-commonjs/components/Tree/useTree.js +4 -2
- package/lib-commonjs/components/Tree/useTree.js.map +1 -1
- package/lib-commonjs/components/TreeItemChevron.js +5 -1
- package/lib-commonjs/components/TreeItemChevron.js.map +1 -1
- package/lib-commonjs/hooks/useControllableOpenItems.js +3 -12
- package/lib-commonjs/hooks/useControllableOpenItems.js.map +1 -1
- package/lib-commonjs/hooks/useRootTree.js +14 -6
- package/lib-commonjs/hooks/useRootTree.js.map +1 -1
- package/lib-commonjs/hooks/useSubtree.js +15 -1
- package/lib-commonjs/hooks/useSubtree.js.map +1 -1
- package/lib-commonjs/utils/ImmutableMap.js +71 -40
- package/lib-commonjs/utils/ImmutableMap.js.map +1 -1
- package/lib-commonjs/utils/ImmutableSet.js +61 -45
- package/lib-commonjs/utils/ImmutableSet.js.map +1 -1
- package/lib-commonjs/utils/createCheckedItems.js +5 -17
- package/lib-commonjs/utils/createCheckedItems.js.map +1 -1
- package/package.json +4 -2
- package/lib/utils/createOpenItems.js +0 -10
- package/lib/utils/createOpenItems.js.map +0 -1
- package/lib-commonjs/utils/createOpenItems.js +0 -20
- package/lib-commonjs/utils/createOpenItems.js.map +0 -1
|
@@ -8,44 +8,75 @@ Object.defineProperty(exports, "ImmutableMap", {
|
|
|
8
8
|
return ImmutableMap;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
11
|
+
const _define_property = require("@swc/helpers/_/_define_property");
|
|
12
|
+
const internalMapSymbol = Symbol('#internalMap');
|
|
13
|
+
let _internalMapSymbol = internalMapSymbol, _Symbol_hasInstance = Symbol.hasInstance, _Symbol_iterator = Symbol.iterator;
|
|
14
|
+
class ImmutableMap {
|
|
15
|
+
static dangerouslyGetInternalMap(immutableMap) {
|
|
16
|
+
return immutableMap[internalMapSymbol];
|
|
17
|
+
}
|
|
18
|
+
static copy(immutableMap) {
|
|
19
|
+
return this.from(immutableMap[internalMapSymbol]);
|
|
20
|
+
}
|
|
21
|
+
static from(iterable, mapFn) {
|
|
22
|
+
if (iterable === undefined) {
|
|
23
|
+
return this.empty;
|
|
24
|
+
}
|
|
25
|
+
if (!mapFn) {
|
|
26
|
+
if (iterable instanceof this) {
|
|
27
|
+
return iterable;
|
|
28
|
+
}
|
|
29
|
+
// casting here is ok, as the function overload ensures that the iterable is
|
|
30
|
+
// Iterable<[unknown, unknown]>
|
|
31
|
+
// if mapFn is not provided
|
|
32
|
+
const iterableAsTuple = iterable;
|
|
33
|
+
return new this(new Map(iterableAsTuple));
|
|
34
|
+
}
|
|
35
|
+
const map = new Map();
|
|
36
|
+
for (const value of iterable){
|
|
37
|
+
map.set(...mapFn(value));
|
|
38
|
+
}
|
|
39
|
+
return new this(map);
|
|
40
|
+
}
|
|
41
|
+
static [_Symbol_hasInstance](instance) {
|
|
42
|
+
return Boolean(typeof instance === 'object' && instance && internalMapSymbol in instance);
|
|
43
|
+
}
|
|
44
|
+
delete(key) {
|
|
45
|
+
if (!this.has(key)) {
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
const copy = ImmutableMap.copy(this);
|
|
49
|
+
copy[internalMapSymbol].delete(key);
|
|
50
|
+
return copy;
|
|
51
|
+
}
|
|
52
|
+
get(key) {
|
|
53
|
+
return this[internalMapSymbol].get(key);
|
|
54
|
+
}
|
|
55
|
+
has(key) {
|
|
56
|
+
return this[internalMapSymbol].has(key);
|
|
57
|
+
}
|
|
58
|
+
set(key, value) {
|
|
59
|
+
if (this.get(key) === value) {
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
const copy = ImmutableMap.copy(this);
|
|
63
|
+
copy[internalMapSymbol].set(key, value);
|
|
64
|
+
return copy;
|
|
65
|
+
}
|
|
66
|
+
[_Symbol_iterator]() {
|
|
67
|
+
return this[internalMapSymbol].entries();
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Do not use this constructor directly, use {@link ImmutableMap.from} instead.
|
|
71
|
+
* {@link ImmutableMap.from} handles instance verification (which might be problematic on {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms | multiple realms}),
|
|
72
|
+
* avoid unnecessary copies, supports iterables and ensures that the internal map is never exposed.
|
|
73
|
+
*
|
|
74
|
+
*⚠️⚠️ _By using this constructor directly, you might end up with a mutable map, as it is not guaranteed that the internal map is not exposed._ ⚠️⚠️
|
|
75
|
+
*/ constructor(internalMap){
|
|
76
|
+
(0, _define_property._)(this, "size", void 0);
|
|
77
|
+
(0, _define_property._)(this, _internalMapSymbol, void 0);
|
|
78
|
+
this[internalMapSymbol] = internalMap;
|
|
79
|
+
this.size = this[internalMapSymbol].size;
|
|
80
|
+
}
|
|
44
81
|
}
|
|
45
|
-
|
|
46
|
-
empty: emptyImmutableMap,
|
|
47
|
-
create: createImmutableMap,
|
|
48
|
-
isImmutableMap,
|
|
49
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
50
|
-
dangerouslyCreate_unstable: dangerouslyCreateImmutableMap
|
|
51
|
-
};
|
|
82
|
+
(0, _define_property._)(ImmutableMap, "empty", new ImmutableMap(new Map()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ImmutableMap.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["ImmutableMap.ts"],"sourcesContent":["const internalMapSymbol = Symbol('#internalMap');\n\nexport class ImmutableMap<Key, Value> implements Iterable<[Key, Value]> {\n public static empty: ImmutableMap<never, never> = new ImmutableMap(new Map<never, never>());\n public readonly size: number;\n\n private [internalMapSymbol]: Map<Key, Value>;\n\n public static dangerouslyGetInternalMap<Key, Value>(immutableMap: ImmutableMap<Key, Value>): Map<Key, Value> {\n return immutableMap[internalMapSymbol];\n }\n\n public static copy<Key, Value>(immutableMap: ImmutableMap<Key, Value>): ImmutableMap<Key, Value> {\n return this.from(immutableMap[internalMapSymbol]);\n }\n\n /**\n * Creates a new {@link ImmutableMap} from an iterable.\n * If the iterable is undefined, {@link ImmutableMap.empty} will be returned.\n * If the iterable is already an {@link ImmutableMap}, it will be returned as is no copy will be made.\n */\n public static from<T extends [unknown, unknown]>(iterable?: Iterable<T>): ImmutableMap<T[0], T[1]>;\n /**\n * Creates a new {@link ImmutableMap} from an iterable with an auxiliary map function to modify the iterable.\n * If the iterable is undefined, {@link ImmutableMap.empty} will be returned.\n * If the iterable is already an {@link ImmutableMap}, it will be returned as is no copy will be made.\n * The map function will be called for each element in the iterable.\n */\n public static from<T, U extends [unknown, unknown]>(\n iterable: Iterable<T> | undefined,\n mapFn: (value: T) => U,\n ): ImmutableMap<U[0], U[1]>;\n public static from(\n iterable?: Iterable<unknown>,\n mapFn?: (value: unknown) => [unknown, unknown],\n ): ImmutableMap<unknown, unknown> {\n if (iterable === undefined) {\n return this.empty;\n }\n if (!mapFn) {\n if (iterable instanceof this) {\n return iterable;\n }\n // casting here is ok, as the function overload ensures that the iterable is\n // Iterable<[unknown, unknown]>\n // if mapFn is not provided\n const iterableAsTuple = iterable as Iterable<[unknown, unknown]>;\n return new this(new Map(iterableAsTuple));\n }\n const map = new Map<unknown, unknown>();\n for (const value of iterable) {\n map.set(...mapFn(value));\n }\n return new this(map);\n }\n\n public static [Symbol.hasInstance](instance: unknown): boolean {\n return Boolean(typeof instance === 'object' && instance && internalMapSymbol in instance);\n }\n\n /**\n * Do not use this constructor directly, use {@link ImmutableMap.from} instead.\n * {@link ImmutableMap.from} handles instance verification (which might be problematic on {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms | multiple realms}),\n * avoid unnecessary copies, supports iterables and ensures that the internal map is never exposed.\n *\n *⚠️⚠️ _By using this constructor directly, you might end up with a mutable map, as it is not guaranteed that the internal map is not exposed._ ⚠️⚠️\n */\n constructor(internalMap: Map<Key, Value>) {\n this[internalMapSymbol] = internalMap;\n this.size = this[internalMapSymbol].size;\n }\n\n public delete(key: Key): ImmutableMap<Key, Value> {\n if (!this.has(key)) {\n return this;\n }\n const copy = ImmutableMap.copy(this);\n copy[internalMapSymbol].delete(key);\n return copy;\n }\n public get(key: Key): Value | undefined {\n return this[internalMapSymbol].get(key);\n }\n public has(key: Key): boolean {\n return this[internalMapSymbol].has(key);\n }\n public set(key: Key, value: Value): ImmutableMap<Key, Value> {\n if (this.get(key) === value) {\n return this;\n }\n const copy = ImmutableMap.copy(this);\n copy[internalMapSymbol].set(key, value);\n return copy;\n }\n public [Symbol.iterator](): Iterator<[Key, Value]> {\n return this[internalMapSymbol].entries();\n }\n}\n"],"names":["ImmutableMap","internalMapSymbol","Symbol","hasInstance","iterator","dangerouslyGetInternalMap","immutableMap","copy","from","iterable","mapFn","undefined","empty","iterableAsTuple","Map","map","value","set","instance","Boolean","delete","key","has","get","entries","constructor","internalMap","_define_property","size"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAEaA;;;eAAAA;;;;AAFb,MAAMC,oBAAoBC,OAAO;IAMtBD,qBAAAA,mBAkDMC,sBAAAA,OAAOC,WAAW,EAsCzBD,mBAAAA,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;YAC3B,OAAO,IAAI;QACb;QACA,MAAMT,OAAOP,aAAaO,IAAI,CAAC,IAAI;QACnCA,IAAI,CAACN,kBAAkB,CAACgB,GAAG,CAACI,KAAKL;QACjC,OAAOT;IACT;IACO,CAACL,iBAAgB,GAA2B;QACjD,OAAO,IAAI,CAACD,kBAAkB,CAACuB,OAAO;IACxC;IApCA;;;;;;GAMC,GACDC,YAAYC,WAA4B,CAAE;QA/D1CC,IAAAA,kBAAA,EAAA,IAAA,EAAgBC,QAAhB,KAAA;QAEAD,IAAAA,kBAAA,EAAA,IAAA,EAAS1B,oBAAT,KAAA;QA8DE,IAAI,CAACA,kBAAkB,GAAGyB;QAC1B,IAAI,CAACE,IAAI,GAAG,IAAI,CAAC3B,kBAAkB,CAAC2B,IAAI;IAC1C;AA2BF;AA9FED,IAAAA,kBAAA,EADW3B,cACGY,SAAoC,IAAIZ,aAAa,IAAIc"}
|
|
@@ -8,49 +8,65 @@ Object.defineProperty(exports, "ImmutableSet", {
|
|
|
8
8
|
return ImmutableSet;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const
|
|
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
|
-
|
|
11
|
+
const _define_property = require("@swc/helpers/_/_define_property");
|
|
12
|
+
const internalSetSymbol = Symbol('#internalSet');
|
|
13
|
+
let _internalSetSymbol = internalSetSymbol, _Symbol_hasInstance = Symbol.hasInstance, _Symbol_iterator = Symbol.iterator;
|
|
14
|
+
class ImmutableSet {
|
|
15
|
+
static dangerouslyGetInternalSet(set) {
|
|
16
|
+
return set[internalSetSymbol];
|
|
17
|
+
}
|
|
18
|
+
static copy(immutableSet) {
|
|
19
|
+
return new ImmutableSet(new Set(immutableSet[internalSetSymbol]));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new {@link ImmutableSet} from an iterable.
|
|
23
|
+
* If the iterable is undefined, {@link ImmutableSet.empty} will be returned.
|
|
24
|
+
* If the iterable is already an {@link ImmutableSet}, it will be returned as is no copy will be made.
|
|
25
|
+
*/ static from(iterable) {
|
|
26
|
+
if (iterable === undefined) {
|
|
27
|
+
return this.empty;
|
|
28
|
+
}
|
|
29
|
+
if (iterable instanceof this) {
|
|
30
|
+
return iterable;
|
|
31
|
+
}
|
|
32
|
+
return new this(new Set(iterable));
|
|
33
|
+
}
|
|
34
|
+
static [_Symbol_hasInstance](instance) {
|
|
35
|
+
return Boolean(typeof instance === 'object' && instance && internalSetSymbol in instance);
|
|
36
|
+
}
|
|
37
|
+
add(value) {
|
|
38
|
+
if (this.has(value)) {
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
const copy = ImmutableSet.copy(this);
|
|
42
|
+
copy[internalSetSymbol].add(value);
|
|
43
|
+
return copy;
|
|
44
|
+
}
|
|
45
|
+
delete(value) {
|
|
46
|
+
if (!this.has(value)) {
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
const copy = ImmutableSet.copy(this);
|
|
50
|
+
copy[internalSetSymbol].delete(value);
|
|
51
|
+
return copy;
|
|
52
|
+
}
|
|
53
|
+
has(value) {
|
|
54
|
+
return this[internalSetSymbol].has(value);
|
|
55
|
+
}
|
|
56
|
+
[_Symbol_iterator]() {
|
|
57
|
+
return this[internalSetSymbol].values();
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Do not use this constructor directly, use {@link ImmutableSet.from} instead.
|
|
61
|
+
* {@link ImmutableSet.from} handles instance verification (which might be problematic on {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms | multiple realms}),
|
|
62
|
+
* avoid unnecessary copies, supports iterables and ensures that the internal set is never exposed.
|
|
63
|
+
*
|
|
64
|
+
*⚠️⚠️ _By using this constructor directly, you might end up with a mutable set, as it is not guaranteed that the internal set is not exposed._ ⚠️⚠️
|
|
65
|
+
*/ constructor(internalSet){
|
|
66
|
+
(0, _define_property._)(this, "size", void 0);
|
|
67
|
+
(0, _define_property._)(this, _internalSetSymbol, void 0);
|
|
68
|
+
this[internalSetSymbol] = internalSet;
|
|
69
|
+
this.size = this[internalSetSymbol].size;
|
|
70
|
+
}
|
|
49
71
|
}
|
|
50
|
-
|
|
51
|
-
empty: emptyImmutableSet,
|
|
52
|
-
create: createImmutableSet,
|
|
53
|
-
isImmutableSet,
|
|
54
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
55
|
-
dangerouslyCreate_unstable: dangerouslyCreateImmutableSet
|
|
56
|
-
};
|
|
72
|
+
(0, _define_property._)(ImmutableSet, "empty", new ImmutableSet(new Set()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ImmutableSet.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["ImmutableSet.ts"],"sourcesContent":["const internalSetSymbol = Symbol('#internalSet');\n\n/**\n * @public\n *\n * Small immutable wrapper around the native Set implementation.\n * Every operation that would modify the set returns a new copy instance.\n */\nexport class ImmutableSet<T> implements Iterable<T> {\n public static empty: ImmutableSet<never> = new ImmutableSet(new Set());\n public readonly size: number;\n\n private [internalSetSymbol]: Set<T>;\n\n public static dangerouslyGetInternalSet<Value>(set: ImmutableSet<Value>): Set<Value> {\n return set[internalSetSymbol];\n }\n\n public static copy<T>(immutableSet: ImmutableSet<T>): ImmutableSet<T> {\n return new ImmutableSet(new Set(immutableSet[internalSetSymbol]));\n }\n\n /**\n * Creates a new {@link ImmutableSet} from an iterable.\n * If the iterable is undefined, {@link ImmutableSet.empty} will be returned.\n * If the iterable is already an {@link ImmutableSet}, it will be returned as is no copy will be made.\n */\n public static from<Value>(iterable?: Iterable<Value>): ImmutableSet<Value> {\n if (iterable === undefined) {\n return this.empty;\n }\n if (iterable instanceof this) {\n return iterable;\n }\n return new this(new Set(iterable));\n }\n\n public static [Symbol.hasInstance](instance: unknown): boolean {\n return Boolean(typeof instance === 'object' && instance && internalSetSymbol in instance);\n }\n\n /**\n * Do not use this constructor directly, use {@link ImmutableSet.from} instead.\n * {@link ImmutableSet.from} handles instance verification (which might be problematic on {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms | multiple realms}),\n * avoid unnecessary copies, supports iterables and ensures that the internal set is never exposed.\n *\n *⚠️⚠️ _By using this constructor directly, you might end up with a mutable set, as it is not guaranteed that the internal set is not exposed._ ⚠️⚠️\n */\n constructor(internalSet: Set<T>) {\n this[internalSetSymbol] = internalSet;\n this.size = this[internalSetSymbol].size;\n }\n\n public add(value: T): ImmutableSet<T> {\n if (this.has(value)) {\n return this;\n }\n const copy = ImmutableSet.copy(this);\n copy[internalSetSymbol].add(value);\n return copy;\n }\n\n public delete(value: T): ImmutableSet<T> {\n if (!this.has(value)) {\n return this;\n }\n const copy = ImmutableSet.copy(this);\n copy[internalSetSymbol].delete(value);\n return copy;\n }\n\n public has(value: T): boolean {\n return this[internalSetSymbol].has(value);\n }\n\n public [Symbol.iterator](): Iterator<T> {\n return this[internalSetSymbol].values();\n }\n}\n"],"names":["ImmutableSet","internalSetSymbol","Symbol","hasInstance","iterator","dangerouslyGetInternalSet","set","copy","immutableSet","Set","from","iterable","undefined","empty","instance","Boolean","add","value","has","delete","values","constructor","internalSet","_define_property","size"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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I,CAACD,kBAAkB,CAACmB,MAAM;IACvC;IApCA;;;;;;GAMC,GACDC,YAAYC,WAAmB,CAAE;QAtCjCC,IAAAA,kBAAA,EAAA,IAAA,EAAgBC,QAAhB,KAAA;QAEAD,IAAAA,kBAAA,EAAA,IAAA,EAAStB,oBAAT,KAAA;QAqCE,IAAI,CAACA,kBAAkB,GAAGqB;QAC1B,IAAI,CAACE,IAAI,GAAG,IAAI,CAACvB,kBAAkB,CAACuB,IAAI;IAC1C;AA2BF;AArEED,IAAAA,kBAAA,EADWvB,cACGa,SAA6B,IAAIb,aAAa,IAAIS"}
|
|
@@ -9,20 +9,8 @@ Object.defineProperty(exports, "createCheckedItems", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _ImmutableMap = require("./ImmutableMap");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return iterable;
|
|
18
|
-
}
|
|
19
|
-
const internalMap = new Map();
|
|
20
|
-
for (const item of iterable){
|
|
21
|
-
if (Array.isArray(item)) {
|
|
22
|
-
internalMap.set(item[0], item[1]);
|
|
23
|
-
} else {
|
|
24
|
-
internalMap.set(item, true);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return _ImmutableMap.ImmutableMap.dangerouslyCreate_unstable(internalMap);
|
|
28
|
-
}
|
|
12
|
+
const tuplifyCheckedItem = (value)=>Array.isArray(value) ? value : [
|
|
13
|
+
value,
|
|
14
|
+
true
|
|
15
|
+
];
|
|
16
|
+
const createCheckedItems = (iterable)=>_ImmutableMap.ImmutableMap.from(iterable, tuplifyCheckedItem);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["createCheckedItems.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["createCheckedItems.ts"],"sourcesContent":["import type { TreeSelectionValue } from '../Tree';\nimport type { TreeItemValue } from '../TreeItem';\nimport { ImmutableMap } from './ImmutableMap';\n\nconst tuplifyCheckedItem = (\n value: TreeItemValue | [TreeItemValue, TreeSelectionValue],\n): [TreeItemValue, TreeSelectionValue] => (Array.isArray(value) ? value : [value, true]);\n\nexport const createCheckedItems = (\n iterable?: Iterable<TreeItemValue | [TreeItemValue, TreeSelectionValue]>,\n): ImmutableMap<TreeItemValue, TreeSelectionValue> => ImmutableMap.from(iterable, tuplifyCheckedItem);\n"],"names":["createCheckedItems","tuplifyCheckedItem","value","Array","isArray","iterable","ImmutableMap","from"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;8BANgB;AAE7B,MAAMC,qBAAqB,CACzBC,QACyCC,MAAMC,OAAO,CAACF,SAASA,QAAQ;QAACA;QAAO;KAAK;AAEhF,MAAMF,qBAAqB,CAChCK,WACoDC,0BAAAA,CAAaC,IAAI,CAACF,UAAUJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-tree",
|
|
3
|
-
"version": "9.7.
|
|
3
|
+
"version": "9.7.8",
|
|
4
4
|
"description": "Tree component for Fluent UI React",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -35,11 +35,13 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@fluentui/keyboard-keys": "^9.0.7",
|
|
37
37
|
"@fluentui/react-aria": "^9.13.2",
|
|
38
|
-
"@fluentui/react-avatar": "^9.6.
|
|
38
|
+
"@fluentui/react-avatar": "^9.6.35",
|
|
39
39
|
"@fluentui/react-button": "^9.3.87",
|
|
40
40
|
"@fluentui/react-checkbox": "^9.2.33",
|
|
41
41
|
"@fluentui/react-context-selector": "^9.1.65",
|
|
42
42
|
"@fluentui/react-icons": "^2.0.245",
|
|
43
|
+
"@fluentui/react-motion-components-preview": "^0.1.1",
|
|
44
|
+
"@fluentui/react-motion": "^9.4.0",
|
|
43
45
|
"@fluentui/react-radio": "^9.2.28",
|
|
44
46
|
"@fluentui/react-shared-contexts": "^9.20.0",
|
|
45
47
|
"@fluentui/react-tabster": "^9.22.3",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ImmutableSet } from './ImmutableSet';
|
|
2
|
-
export function createOpenItems(iterable) {
|
|
3
|
-
if (iterable === undefined) {
|
|
4
|
-
return ImmutableSet.empty;
|
|
5
|
-
}
|
|
6
|
-
if (ImmutableSet.isImmutableSet(iterable)) {
|
|
7
|
-
return iterable;
|
|
8
|
-
}
|
|
9
|
-
return ImmutableSet.create(iterable);
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["createOpenItems.ts"],"sourcesContent":["import { ImmutableSet } from './ImmutableSet';\nimport type { TreeItemValue } from '../TreeItem';\n\nexport function createOpenItems(iterable?: Iterable<TreeItemValue>) {\n if (iterable === undefined) {\n return ImmutableSet.empty;\n }\n if (ImmutableSet.isImmutableSet<TreeItemValue>(iterable)) {\n return iterable;\n }\n return ImmutableSet.create(iterable);\n}\n"],"names":["ImmutableSet","createOpenItems","iterable","undefined","empty","isImmutableSet","create"],"rangeMappings":";;;;;;;;;","mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAG9C,OAAO,SAASC,gBAAgBC,QAAkC;IAChE,IAAIA,aAAaC,WAAW;QAC1B,OAAOH,aAAaI,KAAK;IAC3B;IACA,IAAIJ,aAAaK,cAAc,CAAgBH,WAAW;QACxD,OAAOA;IACT;IACA,OAAOF,aAAaM,MAAM,CAACJ;AAC7B"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "createOpenItems", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return createOpenItems;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _ImmutableSet = require("./ImmutableSet");
|
|
12
|
-
function createOpenItems(iterable) {
|
|
13
|
-
if (iterable === undefined) {
|
|
14
|
-
return _ImmutableSet.ImmutableSet.empty;
|
|
15
|
-
}
|
|
16
|
-
if (_ImmutableSet.ImmutableSet.isImmutableSet(iterable)) {
|
|
17
|
-
return iterable;
|
|
18
|
-
}
|
|
19
|
-
return _ImmutableSet.ImmutableSet.create(iterable);
|
|
20
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["createOpenItems.ts"],"sourcesContent":["import { ImmutableSet } from './ImmutableSet';\nimport type { TreeItemValue } from '../TreeItem';\n\nexport function createOpenItems(iterable?: Iterable<TreeItemValue>) {\n if (iterable === undefined) {\n return ImmutableSet.empty;\n }\n if (ImmutableSet.isImmutableSet<TreeItemValue>(iterable)) {\n return iterable;\n }\n return ImmutableSet.create(iterable);\n}\n"],"names":["createOpenItems","iterable","undefined","ImmutableSet","empty","isImmutableSet","create"],"rangeMappings":";;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAGgBA;;;eAAAA;;;8BAHa;AAGtB,SAASA,gBAAgBC,QAAkC;IAChE,IAAIA,aAAaC,WAAW;QAC1B,OAAOC,0BAAAA,CAAaC,KAAK;IAC3B;IACA,IAAID,0BAAAA,CAAaE,cAAc,CAAgBJ,WAAW;QACxD,OAAOA;IACT;IACA,OAAOE,0BAAAA,CAAaG,MAAM,CAACL;AAC7B"}
|