@hero-design/rn 8.100.0 → 8.100.1
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/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +6 -0
- package/es/index.js +4 -1
- package/lib/index.js +4 -1
- package/package.json +1 -1
- package/src/components/Select/MultiSelect/__tests__/utils.spec.ts +21 -0
- package/src/components/Select/MultiSelect/utils.ts +13 -3
- package/stats/8.100.0/rn-stats.html +1 -1
- package/stats/8.100.1/rn-stats.html +4844 -0
- package/types/components/Select/MultiSelect/utils.d.ts +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(node:
|
|
1
|
+
(node:3221) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
|
|
2
2
|
(Use `node --trace-warnings ...` to show where the warning was created)
|
|
3
3
|
[36m
|
|
4
4
|
[1msrc/index.ts[22m → [1mlib/index.js, es/index.js[22m...[39m
|
|
@@ -15,9 +15,9 @@ node_modules/d3-selection/src/selection/index.js -> node_modules/d3-selection/sr
|
|
|
15
15
|
[7m [0m [91m ~~~~~~~~~~~~~~~~~~~[0m
|
|
16
16
|
[39m
|
|
17
17
|
[1m[33m(!) [plugin node-resolve] preferring built-in module 'events' over local alternative at '/home/runner/work/hero-design/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning.or passing a function to 'preferBuiltins' to provide more fine-grained control over which built-in modules to prefer.[39m[22m
|
|
18
|
-
[32mcreated [1mlib/index.js, es/index.js[22m in [1m1m
|
|
18
|
+
[32mcreated [1mlib/index.js, es/index.js[22m in [1m1m 9.2s[22m[39m
|
|
19
19
|
[36m
|
|
20
20
|
[1m/home/runner/work/hero-design/hero-design/packages/rn/src/locales/en_AU.ts, /home/runner/work/hero-design/hero-design/packages/rn/src/locales/en_CA.ts, /home/runner/work/hero-design/hero-design/packages/rn/src/locales/index.ts, /home/runner/work/hero-design/hero-design/packages/rn/src/locales/types.ts[22m → [1m., .[22m...[39m
|
|
21
21
|
[1m[33m(!) Generated empty chunks[39m[22m
|
|
22
22
|
"locales/types" and "locales/types"
|
|
23
|
-
[32mcreated [1m., .[22m in [
|
|
23
|
+
[32mcreated [1m., .[22m in [1m20.1s[22m[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @hero-design/rn
|
|
2
2
|
|
|
3
|
+
## 8.100.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#3914](https://github.com/Thinkei/hero-design/pull/3914) [`e89cfb49ca75f9b2104e72b630bfb20bfa896e6f`](https://github.com/Thinkei/hero-design/commit/e89cfb49ca75f9b2104e72b630bfb20bfa896e6f) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [Select.Multi] Fix crash issue when value is falsy
|
|
8
|
+
|
|
3
9
|
## 8.100.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/es/index.js
CHANGED
|
@@ -24884,7 +24884,10 @@ var Option$2 = function Option(_ref) {
|
|
|
24884
24884
|
};
|
|
24885
24885
|
|
|
24886
24886
|
var isOptionSelected = function isOptionSelected(value, option) {
|
|
24887
|
-
if (
|
|
24887
|
+
if (!value || !option || option.value === null || option.value === undefined) {
|
|
24888
|
+
return false;
|
|
24889
|
+
}
|
|
24890
|
+
if (_typeof$1(option.value) !== 'object') {
|
|
24888
24891
|
return value.includes(option.value);
|
|
24889
24892
|
}
|
|
24890
24893
|
return value.some(function (v) {
|
package/lib/index.js
CHANGED
|
@@ -24913,7 +24913,10 @@ var Option$2 = function Option(_ref) {
|
|
|
24913
24913
|
};
|
|
24914
24914
|
|
|
24915
24915
|
var isOptionSelected = function isOptionSelected(value, option) {
|
|
24916
|
-
if (
|
|
24916
|
+
if (!value || !option || option.value === null || option.value === undefined) {
|
|
24917
|
+
return false;
|
|
24918
|
+
}
|
|
24919
|
+
if (_typeof$1(option.value) !== 'object') {
|
|
24917
24920
|
return value.includes(option.value);
|
|
24918
24921
|
}
|
|
24919
24922
|
return value.some(function (v) {
|
package/package.json
CHANGED
|
@@ -28,4 +28,25 @@ describe('isOptionSelected', () => {
|
|
|
28
28
|
|
|
29
29
|
expect(isOptionSelected(selectedValues, option)).toBe(false);
|
|
30
30
|
});
|
|
31
|
+
|
|
32
|
+
it('should return false when value is falsy', () => {
|
|
33
|
+
const selectedValues = undefined;
|
|
34
|
+
const option = { value: 'option1', text: 'Option 1' };
|
|
35
|
+
|
|
36
|
+
expect(isOptionSelected(selectedValues, option)).toBe(false);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should return false when option is falsy', () => {
|
|
40
|
+
const selectedValues = ['option1', 'option2'];
|
|
41
|
+
const option = undefined;
|
|
42
|
+
|
|
43
|
+
expect(isOptionSelected(selectedValues, option)).toBe(false);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('should work with boolean value', () => {
|
|
47
|
+
const selectedValues = [true, false];
|
|
48
|
+
const option = { value: true, text: 'Option 1' };
|
|
49
|
+
|
|
50
|
+
expect(isOptionSelected(selectedValues, option)).toBe(true);
|
|
51
|
+
});
|
|
31
52
|
});
|
|
@@ -2,11 +2,21 @@ import { deepCompareValue } from '../../../utils/helpers';
|
|
|
2
2
|
import { OptionType } from '../types';
|
|
3
3
|
|
|
4
4
|
export const isOptionSelected = <V, T extends OptionType<V>>(
|
|
5
|
-
value
|
|
6
|
-
option
|
|
5
|
+
value?: V[],
|
|
6
|
+
option?: T
|
|
7
7
|
): boolean => {
|
|
8
|
-
if (
|
|
8
|
+
if (
|
|
9
|
+
!value ||
|
|
10
|
+
!option ||
|
|
11
|
+
option.value === null ||
|
|
12
|
+
option.value === undefined
|
|
13
|
+
) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (typeof option.value !== 'object') {
|
|
9
18
|
return value.includes(option.value);
|
|
10
19
|
}
|
|
20
|
+
|
|
11
21
|
return value.some((v) => deepCompareValue(v, option.value));
|
|
12
22
|
};
|