@antscorp/antsomi-ui 1.3.5-beta.722 → 1.3.5-beta.723

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.
@@ -1,2 +1,92 @@
1
1
  import { MatchesAnyItem } from './types';
2
- export declare const getSelectedTreeData: (items: MatchesAnyItem<any>[], selectedItems: MatchesAnyItem<any>[], selectedTreeData?: MatchesAnyItem<any>[]) => any;
2
+ export declare const getSelectedTreeData: (items: MatchesAnyItem<any>[], selectedItems: MatchesAnyItem<any>[], selectedTreeData?: MatchesAnyItem<any>[]) => {
3
+ toString: () => string;
4
+ charAt: (pos: number) => string;
5
+ charCodeAt: (index: number) => number;
6
+ concat: (...strings: string[]) => string;
7
+ indexOf: (searchString: string, position?: number | undefined) => number;
8
+ lastIndexOf: (searchString: string, position?: number | undefined) => number;
9
+ localeCompare: {
10
+ (that: string): number;
11
+ (that: string, locales?: string | string[] | undefined, options?: Intl.CollatorOptions | undefined): number;
12
+ (that: string, locales?: Intl.LocalesArgument, options?: Intl.CollatorOptions | undefined): number;
13
+ };
14
+ match: {
15
+ (regexp: string | RegExp): RegExpMatchArray | null;
16
+ (matcher: {
17
+ [Symbol.match](string: string): RegExpMatchArray | null;
18
+ }): RegExpMatchArray | null;
19
+ };
20
+ replace: {
21
+ (searchValue: string | RegExp, replaceValue: string): string;
22
+ (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string;
23
+ (searchValue: {
24
+ [Symbol.replace](string: string, replaceValue: string): string;
25
+ }, replaceValue: string): string;
26
+ (searchValue: {
27
+ [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string;
28
+ }, replacer: (substring: string, ...args: any[]) => string): string;
29
+ };
30
+ search: {
31
+ (regexp: string | RegExp): number;
32
+ (searcher: {
33
+ [Symbol.search](string: string): number;
34
+ }): number;
35
+ };
36
+ slice: (start?: number | undefined, end?: number | undefined) => string;
37
+ split: {
38
+ (separator: string | RegExp, limit?: number | undefined): string[];
39
+ (splitter: {
40
+ [Symbol.split](string: string, limit?: number | undefined): string[];
41
+ }, limit?: number | undefined): string[];
42
+ };
43
+ substring: (start: number, end?: number | undefined) => string;
44
+ toLowerCase: () => string;
45
+ toLocaleLowerCase: {
46
+ (locales?: string | string[] | undefined): string;
47
+ (locales?: Intl.LocalesArgument): string;
48
+ };
49
+ toUpperCase: () => string;
50
+ toLocaleUpperCase: {
51
+ (locales?: string | string[] | undefined): string;
52
+ (locales?: Intl.LocalesArgument): string;
53
+ };
54
+ trim: () => string;
55
+ readonly length: number;
56
+ substr: (from: number, length?: number | undefined) => string;
57
+ valueOf: () => string;
58
+ codePointAt: (pos: number) => number | undefined;
59
+ includes: (searchString: string, position?: number | undefined) => boolean;
60
+ endsWith: (searchString: string, endPosition?: number | undefined) => boolean;
61
+ normalize: {
62
+ (form: "NFC" | "NFD" | "NFKC" | "NFKD"): string;
63
+ (form?: string | undefined): string;
64
+ };
65
+ repeat: (count: number) => string;
66
+ startsWith: (searchString: string, position?: number | undefined) => boolean;
67
+ anchor: (name: string) => string;
68
+ big: () => string;
69
+ blink: () => string;
70
+ bold: () => string;
71
+ fixed: () => string;
72
+ fontcolor: (color: string) => string;
73
+ fontsize: {
74
+ (size: number): string;
75
+ (size: string): string;
76
+ };
77
+ italics: () => string;
78
+ link: (url: string) => string;
79
+ small: () => string;
80
+ strike: () => string;
81
+ sub: () => string;
82
+ sup: () => string;
83
+ padStart: (maxLength: number, fillString?: string | undefined) => string;
84
+ padEnd: (maxLength: number, fillString?: string | undefined) => string;
85
+ trimEnd: () => string;
86
+ trimStart: () => string;
87
+ trimLeft: () => string;
88
+ trimRight: () => string;
89
+ matchAll: (regexp: RegExp) => IterableIterator<RegExpExecArray>;
90
+ [Symbol.iterator]: () => IterableIterator<string>;
91
+ at: (index: number) => string | undefined;
92
+ }[];
@@ -1,5 +1,6 @@
1
1
  // Libraries
2
2
  import deepmerge from 'deepmerge';
3
+ import { isEmpty, unionBy } from 'lodash';
3
4
  // Utils
4
5
  import { flatTree } from '@antscorp/antsomi-ui/es/utils';
5
6
  const customMergeTreeData = (key) => (target, source) => {
@@ -17,7 +18,7 @@ export const getSelectedTreeData = (items, selectedItems, selectedTreeData = [])
17
18
  const notExtendValueSelectedItems = (selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.filter(item => !item.isExtendValue)) || [];
18
19
  const extendValueSelectedItems = (selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.filter(item => item.isExtendValue)) || [];
19
20
  // If all of item not have children then filter item is not found in list but has selected for display
20
- const notFoundItems = !items.some(item => !!item.children)
21
+ const notFoundItems = !items.some(item => !isEmpty(item.children))
21
22
  ? notExtendValueSelectedItems === null || notExtendValueSelectedItems === void 0 ? void 0 : notExtendValueSelectedItems.filter(item => !(items === null || items === void 0 ? void 0 : items.some(i => i.key === item.key)))
22
23
  : [];
23
24
  const serializeTreeData = (list) => {
@@ -42,5 +43,9 @@ export const getSelectedTreeData = (items, selectedItems, selectedTreeData = [])
42
43
  const mergeItems = deepmerge(selectedTreeData || [], items || [], {
43
44
  arrayMerge: customMergeTreeData('key'),
44
45
  });
45
- return serializeTreeData(mergeItems).concat([...notFoundItems, ...extendValueSelectedItems]);
46
+ const treeData = serializeTreeData(mergeItems).concat([
47
+ ...notFoundItems,
48
+ ...extendValueSelectedItems,
49
+ ]);
50
+ return unionBy(treeData, 'key');
46
51
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.722",
3
+ "version": "1.3.5-beta.723",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",