@evergis/uilib-gl 1.0.76 → 1.0.78

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.
@@ -5,5 +5,6 @@ export interface IIconProps {
5
5
  secondary?: boolean;
6
6
  error?: boolean;
7
7
  disabled?: boolean;
8
+ size?: string;
8
9
  }
9
10
  export declare type IconPosition = "iconBefore" | "iconAfter";
@@ -1,4 +1,3 @@
1
1
  export * from "./Input";
2
- export * from "./Label";
3
2
  export * from "./MaskedComponent";
4
3
  export * from "./types";
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { IBaseOption } from "./types";
2
3
  export declare const OptionContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, IBaseOption, never>;
3
4
  export declare const OptionIcon: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
@@ -10,3 +11,7 @@ export declare const OptionValueWrapper: import("styled-components").StyledCompo
10
11
  export declare const OptionValueContainer: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
11
12
  disabled?: boolean | undefined;
12
13
  }, never>;
14
+ export declare const OptionToggler: import("styled-components").StyledComponent<import("react").FC<import("../..").IIconButtonProps>, import("styled-components").DefaultTheme, {
15
+ toggled?: boolean | undefined;
16
+ color?: string | undefined;
17
+ }, never>;
@@ -1,4 +1,4 @@
1
- import { CSSProperties, ReactNode, ReactChild, ReactFragment, ReactPortal, PropsWithChildren } from "react";
1
+ import { CSSProperties, PropsWithChildren, ReactChild, ReactFragment, ReactNode, ReactPortal } from "react";
2
2
  import { IconTypesKeys } from "../../atoms/Icon";
3
3
  export declare type ComplexOptionText = ReactNode | ReactChild | ReactFragment | ReactPortal | string;
4
4
  export interface IBaseOption {
@@ -19,6 +19,8 @@ export interface IOption<Text = string> {
19
19
  disabled?: boolean;
20
20
  description?: string;
21
21
  heading?: boolean;
22
+ title?: boolean;
23
+ opened?: boolean;
22
24
  primary?: boolean;
23
25
  indeterminate?: boolean;
24
26
  prefix?: ReactNode;
@@ -1,3 +1,2 @@
1
1
  export * from "./RangeNumberInput";
2
- export * from "./styled";
3
2
  export * from "./types";
@@ -0,0 +1,16 @@
1
+ import { TreeItemProps, TreeId } from "./types";
2
+ /**
3
+ * Рекурсивно находит элемент дерева по id
4
+ * @param items - массив элементов дерева
5
+ * @param id - id искомого элемента
6
+ * @returns найденный элемент или undefined, если элемент не найден
7
+ */
8
+ export declare const findTreeItemById: <T = any>(items: TreeItemProps<T>[], id: TreeId) => TreeItemProps<T> | undefined;
9
+ /**
10
+ * Рекурсивно заменяет элемент дерева по id
11
+ * @param items - массив элементов дерева
12
+ * @param id - id элемента для замены
13
+ * @param newItem - новый элемент или функция для обновления элемента
14
+ * @returns новый массив элементов дерева с замененным элементом
15
+ */
16
+ export declare const replaceTreeItemById: <T = any>(items: TreeItemProps<T>[], id: TreeId, newItem: TreeItemProps<T> | ((item: TreeItemProps<T>) => TreeItemProps<T>)) => TreeItemProps<T>[];
@@ -1,3 +1,5 @@
1
1
  export * from "./Tree";
2
+ export * from "./TreeItem";
3
+ export * from "./helpers";
2
4
  export * from "./styled";
3
5
  export * from "./types";
@@ -2,20 +2,23 @@ export declare const TreeContainer: import("styled-components").StyledComponent<
2
2
  export declare const TreeItems: import("styled-components").StyledComponent<"ul", import("styled-components").DefaultTheme, {
3
3
  isExpanded?: boolean | undefined;
4
4
  }, never>;
5
- export declare const TreeItem: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, {}, never>;
5
+ export declare const TreeItemWrapper: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, {}, never>;
6
6
  export declare const TreeRow: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("../../atoms/Grid").FlexProps & {
7
7
  disabled?: boolean | undefined;
8
8
  hasChildren?: boolean | undefined;
9
9
  }, never>;
10
- declare type ExpandButtonProps = {
10
+ declare type TreeExpandProps = {
11
11
  isExpanded?: boolean;
12
12
  hasChildren?: boolean;
13
13
  };
14
- export declare const ExpandButton: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, import("../../atoms/Icon").IIconProps & ExpandButtonProps, never>;
14
+ export declare const TreeExpand: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, import("../../atoms/Icon").IIconProps & TreeExpandProps, never>;
15
15
  export declare const TreeContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("../../atoms/Grid").FlexProps, never>;
16
- export declare const ItemIcon: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, import("../../atoms/Icon").IIconProps, never>;
17
- export declare const TreeText: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
16
+ export declare const TreeText: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
17
+ isLeaf?: boolean | undefined;
18
+ }, never>;
18
19
  export declare const TreeDescription: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
19
20
  isFolder?: boolean | undefined;
20
21
  }, never>;
22
+ export declare const LoadMoreButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
23
+ export declare const LoadingContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("../../atoms/Grid").FlexProps, never>;
21
24
  export {};
@@ -1,4 +1,4 @@
1
- import { FC, ReactNode } from "react";
1
+ import { Dispatch, FC, ReactNode, SetStateAction } from "react";
2
2
  import { IconTypesKeys } from "../../atoms/Icon";
3
3
  export declare type TreeId = string | number;
4
4
  export declare type TreeItemProps<T = any> = {
@@ -7,45 +7,55 @@ export declare type TreeItemProps<T = any> = {
7
7
  text: string;
8
8
  description?: string;
9
9
  className?: string;
10
- icon?: ReactNode | IconTypesKeys;
11
- customIcon?: boolean;
12
- chip?: string | number;
10
+ icon?: IconTypesKeys;
11
+ customIcon?: ReactNode;
13
12
  disabled?: boolean;
14
13
  selectable?: boolean;
15
14
  withTooltip?: boolean;
15
+ isLeaf?: boolean;
16
+ loading?: boolean;
17
+ totalCount?: number;
16
18
  children?: TreeItemProps[];
17
19
  additionalInfo?: ReactNode;
18
20
  onClick?: VoidFunction;
19
21
  };
20
22
  export interface TreeItemComponentProps<T = any> {
21
23
  item: TreeItemProps<T>;
22
- hasChildren: boolean;
23
- isChildExpanded?: boolean;
24
+ parentItem?: TreeItemProps<T>;
25
+ loadMoreText?: string;
26
+ isExpanded?: boolean;
24
27
  isIndeterminate?: boolean;
25
28
  isSelected?: boolean;
26
29
  isDisabled?: boolean;
27
- chipValue?: string;
28
30
  selectable?: boolean;
29
- expandIcon?: string;
30
- collapseIcon?: string;
31
- childIcon?: string;
32
- renderTree: (children?: TreeItemProps<T>[], isChildExpanded?: boolean) => ReactNode;
33
- onChange: (item: TreeItemProps<T>) => void;
34
- onClick: (id: TreeId, hasChildren: boolean) => void;
31
+ renderTree: (children?: TreeItemProps<T>[], isExpanded?: boolean, parentItem?: TreeItemProps<T>) => ReactNode;
32
+ withLoadMore?: boolean;
33
+ onLoadMore?: (item: TreeItemProps<T>) => Promisable<void>;
34
+ onExpand: (item: TreeItemProps<T>, isExpanded: boolean, onlyReload?: boolean) => Promisable<void>;
35
+ onSelect?: (item: TreeItemProps<T>) => void;
36
+ onItemClick?: (item: TreeItemProps<T>) => void;
37
+ onItemUpdate?: (id: TreeId, updateFn: (item: TreeItemProps<T>) => TreeItemProps<T>) => Promisable<void>;
38
+ setData?: Dispatch<SetStateAction<TreeItemProps<T>[]>>;
35
39
  }
36
- export declare type TreeProps = {
40
+ export interface PartialLoadData<T> {
41
+ children: TreeItemProps<T>[];
42
+ totalCount?: number;
43
+ }
44
+ export declare type TreeProps<T = any> = {
37
45
  className?: string;
38
- data: TreeItemProps[];
46
+ loadMoreText?: string;
47
+ data: TreeItemProps<T>[];
48
+ setData?: Dispatch<SetStateAction<TreeItemProps<T>[]>>;
49
+ loadNode?: (item: TreeItemProps<T>, offset?: number) => Promisable<PartialLoadData<T>>;
50
+ withLoadMore?: boolean;
39
51
  expanded?: TreeId[];
40
52
  allExpanded?: boolean;
41
53
  allSelected?: boolean;
42
54
  selectable?: boolean;
43
55
  selected?: TreeId[];
44
- expandIcon?: IconTypesKeys;
45
- collapseIcon?: IconTypesKeys;
46
- childIcon?: IconTypesKeys;
47
56
  setExpanded?: (ids: TreeId[]) => void;
48
57
  setSelected?: (ids: TreeId[]) => void;
49
- customChip?: boolean;
58
+ onExpand?: (item: TreeItemProps<T>, isExpanded: boolean, onlyReload?: boolean) => Promisable<void>;
59
+ onItemClick?: (item: TreeItemProps<T>) => void;
50
60
  Item?: FC<TreeItemComponentProps>;
51
61
  };