@gingkoo/pandora-explorer 0.0.1-alpha.0

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.
Files changed (47) hide show
  1. package/README.md +93 -0
  2. package/lib/es/components/Dropdown/index.d.ts +20 -0
  3. package/lib/es/components/columns/index.d.ts +16 -0
  4. package/lib/es/components/icons/index.d.ts +17 -0
  5. package/lib/es/components/menu/index.d.ts +15 -0
  6. package/lib/es/components/menu/menulist.d.ts +3 -0
  7. package/lib/es/components/modal/index.d.ts +18 -0
  8. package/lib/es/components/modal/modal-tab.d.ts +14 -0
  9. package/lib/es/components/select-box/index.d.ts +19 -0
  10. package/lib/es/components/tile/index.d.ts +11 -0
  11. package/lib/es/components/tree/components/DropIndicator.d.ts +5 -0
  12. package/lib/es/components/tree/components/Indent.d.ts +10 -0
  13. package/lib/es/components/tree/components/MotionTreeNode.d.ts +14 -0
  14. package/lib/es/components/tree/components/NodeList.d.ts +14 -0
  15. package/lib/es/components/tree/components/Tree.d.ts +253 -0
  16. package/lib/es/components/tree/components/TreeNode.d.ts +12 -0
  17. package/lib/es/components/tree/components/contextTypes.d.ts +64 -0
  18. package/lib/es/components/tree/components/index.d.ts +7 -0
  19. package/lib/es/components/tree/components/interface.d.ts +123 -0
  20. package/lib/es/components/tree/components/useUnmount.d.ts +4 -0
  21. package/lib/es/components/tree/components/util.d.ts +54 -0
  22. package/lib/es/components/tree/components/utils/conductUtil.d.ts +17 -0
  23. package/lib/es/components/tree/components/utils/diffUtil.d.ts +7 -0
  24. package/lib/es/components/tree/components/utils/keyUtil.d.ts +2 -0
  25. package/lib/es/components/tree/components/utils/treeUtil.d.ts +86 -0
  26. package/lib/es/components/tree/index.d.ts +39 -0
  27. package/lib/es/components/tree/tree-item-table.d.ts +1 -0
  28. package/lib/es/components/tree/tree-item.d.ts +3 -0
  29. package/lib/es/components/virtualScroll/index.d.ts +7 -0
  30. package/lib/es/css.d.ts +10 -0
  31. package/lib/es/enum.d.ts +11 -0
  32. package/lib/es/explorer.d.ts +7 -0
  33. package/lib/es/index.d.ts +5 -0
  34. package/lib/es/index.js +6853 -0
  35. package/lib/es/index.js.map +1 -0
  36. package/lib/es/layout/components/explorer-head/index.d.ts +3 -0
  37. package/lib/es/layout/components/explorer-info/index.d.ts +3 -0
  38. package/lib/es/layout/components/explorer-main/index.d.ts +3 -0
  39. package/lib/es/layout/components/explorer-menu/index.d.ts +3 -0
  40. package/lib/es/layout/index.d.ts +4 -0
  41. package/lib/es/store.d.ts +28 -0
  42. package/lib/es/types.d.ts +80 -0
  43. package/lib/umd/index.js +7174 -0
  44. package/lib/umd/index.js.map +1 -0
  45. package/lib/umd/index.min.js +2 -0
  46. package/lib/umd/index.min.js.map +1 -0
  47. package/package.json +67 -0
@@ -0,0 +1,123 @@
1
+ import * as React from 'react';
2
+ export type { ScrollTo } from 'rc-virtual-list/lib/List';
3
+ export interface TreeNodeProps<TreeDataType extends BasicDataNode = DataNode> {
4
+ eventKey?: Key;
5
+ prefixCls?: string;
6
+ className?: string;
7
+ style?: React.CSSProperties;
8
+ id?: string;
9
+ expanded?: boolean;
10
+ selected?: boolean;
11
+ checked?: boolean;
12
+ loaded?: boolean;
13
+ loading?: boolean;
14
+ halfChecked?: boolean;
15
+ title?: React.ReactNode | ((data: TreeDataType) => React.ReactNode);
16
+ dragOver?: boolean;
17
+ dragOverGapTop?: boolean;
18
+ dragOverGapBottom?: boolean;
19
+ pos?: string;
20
+ domRef?: React.Ref<HTMLDivElement>;
21
+ /** New added in Tree for easy data access */
22
+ data?: TreeDataType;
23
+ isStart?: boolean[];
24
+ isEnd?: boolean[];
25
+ active?: boolean;
26
+ onMouseMove?: React.MouseEventHandler<HTMLDivElement>;
27
+ indentWidth?: number;
28
+ isLeaf?: boolean;
29
+ checkable?: boolean;
30
+ selectable?: boolean;
31
+ disabled?: boolean;
32
+ disableCheckbox?: boolean;
33
+ icon?: IconType;
34
+ switcherIcon?: IconType;
35
+ children?: React.ReactNode;
36
+ }
37
+ /** For fieldNames, we provides a abstract interface */
38
+ export interface BasicDataNode {
39
+ checkable?: boolean;
40
+ disabled?: boolean;
41
+ disableCheckbox?: boolean;
42
+ icon?: IconType;
43
+ isLeaf?: boolean;
44
+ selectable?: boolean;
45
+ switcherIcon?: IconType;
46
+ /** Set style of TreeNode. This is not recommend if you don't have any force requirement */
47
+ className?: string;
48
+ style?: React.CSSProperties;
49
+ }
50
+ /** Provide a wrap type define for developer to wrap with customize fieldNames data type */
51
+ export type FieldDataNode<T, ChildFieldName extends string = 'children'> = BasicDataNode & T & Partial<Record<ChildFieldName, FieldDataNode<T, ChildFieldName>[]>>;
52
+ export type Key = React.Key;
53
+ /**
54
+ * Typescript not support `bigint` as index type yet.
55
+ * We use this to mark the `bigint` type is for `Key` usage.
56
+ * It's safe to remove this when typescript fix:
57
+ * https://github.com/microsoft/TypeScript/issues/50217
58
+ */
59
+ export type SafeKey = Exclude<Key, bigint>;
60
+ export type KeyEntities<DateType extends BasicDataNode = any> = Record<SafeKey, DataEntity<DateType>>;
61
+ export type DataNode = FieldDataNode<{
62
+ key: Key;
63
+ title?: React.ReactNode | ((data: DataNode) => React.ReactNode);
64
+ }>;
65
+ export type EventDataNode<TreeDataType> = {
66
+ key: Key;
67
+ expanded: boolean;
68
+ selected: boolean;
69
+ checked: boolean;
70
+ loaded: boolean;
71
+ loading: boolean;
72
+ halfChecked: boolean;
73
+ dragOver: boolean;
74
+ dragOverGapTop: boolean;
75
+ dragOverGapBottom: boolean;
76
+ pos: string;
77
+ active: boolean;
78
+ } & TreeDataType & BasicDataNode;
79
+ export type IconType = React.ReactNode | ((props: TreeNodeProps) => React.ReactNode);
80
+ export type NodeElement = React.ReactElement<TreeNodeProps> & {
81
+ selectHandle?: HTMLSpanElement;
82
+ type: {
83
+ isTreeNode: boolean;
84
+ };
85
+ };
86
+ export type NodeInstance<TreeDataType extends BasicDataNode = DataNode> = React.Component<TreeNodeProps<TreeDataType>> & {
87
+ selectHandle?: HTMLSpanElement;
88
+ };
89
+ export interface Entity {
90
+ node: NodeElement;
91
+ index: number;
92
+ key: Key;
93
+ pos: string;
94
+ parent?: Entity;
95
+ children?: Entity[];
96
+ }
97
+ export interface DataEntity<TreeDataType extends BasicDataNode = DataNode> extends Omit<Entity, 'node' | 'parent' | 'children'> {
98
+ node: TreeDataType;
99
+ nodes: TreeDataType[];
100
+ parent?: DataEntity<TreeDataType>;
101
+ children?: DataEntity<TreeDataType>[];
102
+ level: number;
103
+ }
104
+ export interface FlattenNode<TreeDataType extends BasicDataNode = DataNode> {
105
+ parent: FlattenNode<TreeDataType> | null;
106
+ children: FlattenNode<TreeDataType>[];
107
+ pos: string;
108
+ data: TreeDataType;
109
+ title: React.ReactNode;
110
+ key: Key;
111
+ isStart: boolean[];
112
+ isEnd: boolean[];
113
+ }
114
+ export type GetKey<RecordType> = (record: RecordType, index?: number) => Key;
115
+ export type GetCheckDisabled<RecordType> = (record: RecordType) => boolean;
116
+ export type Direction = 'ltr' | 'rtl' | undefined;
117
+ export interface FieldNames {
118
+ title?: string;
119
+ /** @private Internal usage for `rc-tree-select`, safe to remove if no need */
120
+ _title?: string[];
121
+ key?: string;
122
+ children?: string;
123
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Trigger only when component unmount
3
+ */
4
+ export default function useUnmount(triggerStart: VoidFunction, triggerEnd: VoidFunction): void;
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Legacy code. Should avoid to use if you are new to import these code.
3
+ */
4
+ import React from 'react';
5
+ import { BasicDataNode, DataEntity, DataNode, Direction, FlattenNode, Key, KeyEntities, NodeElement, NodeInstance } from './interface';
6
+ import { AllowDrop, TreeProps } from './Tree';
7
+ export { getPosition, isTreeNode } from './utils/treeUtil';
8
+ export declare function arrDel(list: Key[], value: Key): React.Key[];
9
+ export declare function arrAdd(list: Key[], value: Key): React.Key[];
10
+ export declare function posToArr(pos: string): string[];
11
+ export declare function getDragChildrenKeys<TreeDataType extends BasicDataNode = DataNode>(dragNodeKey: Key, keyEntities: KeyEntities<TreeDataType>): Key[];
12
+ export declare function isLastChild<TreeDataType extends BasicDataNode = DataNode>(treeNodeEntity: DataEntity<TreeDataType>): boolean;
13
+ export declare function isFirstChild<TreeDataType extends BasicDataNode = DataNode>(treeNodeEntity: DataEntity<TreeDataType>): boolean;
14
+ export declare function calcDropPosition<TreeDataType extends BasicDataNode = DataNode>(event: React.MouseEvent, dragNode: NodeInstance<TreeDataType>, targetNode: NodeInstance<TreeDataType>, indent: number, startMousePosition: {
15
+ x: number;
16
+ y: number;
17
+ }, allowDrop: AllowDrop<TreeDataType>, flattenedNodes: FlattenNode<TreeDataType>[], keyEntities: KeyEntities<TreeDataType>, expandKeys: Key[], direction: Direction): {
18
+ dropPosition: -1 | 0 | 1;
19
+ dropLevelOffset: number;
20
+ dropTargetKey: Key;
21
+ dropTargetPos: string;
22
+ dropContainerKey: Key;
23
+ dragOverNodeKey: Key;
24
+ dropAllowed: boolean;
25
+ };
26
+ /**
27
+ * Return selectedKeys according with multiple prop
28
+ * @param selectedKeys
29
+ * @param props
30
+ * @returns [string]
31
+ */
32
+ export declare function calcSelectedKeys(selectedKeys: Key[], props: TreeProps): React.Key[] | undefined;
33
+ export declare function convertDataToTree(treeData: DataNode[], processor?: {
34
+ processProps: (prop: DataNode) => any;
35
+ }): NodeElement[];
36
+ /**
37
+ * Parse `checkedKeys` to { checkedKeys, halfCheckedKeys } style
38
+ */
39
+ export declare function parseCheckedKeys(keys: Key[] | {
40
+ checked: Key[];
41
+ halfChecked: Key[];
42
+ }): {
43
+ checkedKeys: React.Key[];
44
+ halfCheckedKeys: undefined;
45
+ } | {
46
+ checkedKeys: React.Key[];
47
+ halfCheckedKeys: React.Key[];
48
+ } | null;
49
+ /**
50
+ * If user use `autoExpandParent` we should get the list of parent node
51
+ * @param keyList
52
+ * @param keyEntities
53
+ */
54
+ export declare function conductExpandParent(keyList: Key[], keyEntities: KeyEntities): Key[];
@@ -0,0 +1,17 @@
1
+ import { BasicDataNode, DataNode, GetCheckDisabled, Key, KeyEntities } from '../interface';
2
+ interface ConductReturnType {
3
+ checkedKeys: Key[];
4
+ halfCheckedKeys: Key[];
5
+ }
6
+ export declare function isCheckDisabled<TreeDataType>(node: TreeDataType): boolean;
7
+ /**
8
+ * Conduct with keys.
9
+ * @param keyList current key list
10
+ * @param keyEntities key - dataEntity map
11
+ * @param mode `fill` to fill missing key, `clean` to remove useless key
12
+ */
13
+ export declare function conductCheck<TreeDataType extends BasicDataNode = DataNode>(keyList: Key[], checked: true | {
14
+ checked: false;
15
+ halfCheckedKeys: Key[];
16
+ }, keyEntities: KeyEntities<TreeDataType>, getCheckDisabled?: GetCheckDisabled<TreeDataType>): ConductReturnType;
17
+ export {};
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { Key, FlattenNode } from '../interface';
3
+ export declare function findExpandedKeys(prev?: Key[], next?: Key[]): {
4
+ add: boolean;
5
+ key: import("react").Key | null;
6
+ };
7
+ export declare function getExpandRange(shorter: FlattenNode[], longer: FlattenNode[], key: Key): FlattenNode<import("../interface").DataNode>[];
@@ -0,0 +1,2 @@
1
+ import type { Key, KeyEntities } from '../interface';
2
+ export default function getEntity<T = any>(keyEntities: KeyEntities<T>, key: Key): import("../interface").DataEntity<T>;
@@ -0,0 +1,86 @@
1
+ import * as React from 'react';
2
+ import { BasicDataNode, DataEntity, DataNode, EventDataNode, FieldNames, FlattenNode, GetKey, Key, KeyEntities, NodeElement, TreeNodeProps } from '../interface';
3
+ export declare function getPosition(level: string | number, index: number): string;
4
+ export declare function isTreeNode(node: NodeElement): boolean;
5
+ export declare function getKey(key: Key, pos: string): React.Key;
6
+ export declare function fillFieldNames(fieldNames?: FieldNames): Required<FieldNames>;
7
+ /**
8
+ * Warning if TreeNode do not provides key
9
+ */
10
+ export declare function warningWithoutKey(treeData: DataNode[], fieldNames: FieldNames): void;
11
+ /**
12
+ * Convert `children` of Tree into `treeData` structure.
13
+ */
14
+ export declare function convertTreeToData(rootNodes: React.ReactNode): DataNode[];
15
+ /**
16
+ * Flat nest tree data into flatten list. This is used for virtual list render.
17
+ * @param treeNodeList Origin data node list
18
+ * @param expandedKeys
19
+ * need expanded keys, provides `true` means all expanded (used in `rc-tree-select`).
20
+ */
21
+ export declare function flattenTreeData<TreeDataType extends BasicDataNode = DataNode>(treeNodeList: TreeDataType[], expandedKeys: Key[] | true, fieldNames: FieldNames): FlattenNode<TreeDataType>[];
22
+ type ExternalGetKey = GetKey<DataNode> | string;
23
+ interface TraverseDataNodesConfig {
24
+ childrenPropName?: string;
25
+ externalGetKey?: ExternalGetKey;
26
+ fieldNames?: FieldNames;
27
+ }
28
+ /**
29
+ * Traverse all the data by `treeData`.
30
+ * Please not use it out of the `rc-tree` since we may refactor this code.
31
+ */
32
+ export declare function traverseDataNodes(dataNodes: DataNode[], callback: (data: {
33
+ node: DataNode;
34
+ index: number;
35
+ pos: string;
36
+ key: Key;
37
+ parentPos: string | number;
38
+ level: number;
39
+ nodes: DataNode[];
40
+ }) => void, config?: TraverseDataNodesConfig | string): void;
41
+ interface Wrapper {
42
+ posEntities: Record<string, DataEntity>;
43
+ keyEntities: KeyEntities;
44
+ }
45
+ /**
46
+ * Convert `treeData` into entity records.
47
+ */
48
+ export declare function convertDataToEntities(dataNodes: DataNode[], { initWrapper, processEntity, onProcessFinished, externalGetKey, childrenPropName, fieldNames, }?: {
49
+ initWrapper?: (wrapper: Wrapper) => Wrapper;
50
+ processEntity?: (entity: DataEntity, wrapper: Wrapper) => void;
51
+ onProcessFinished?: (wrapper: Wrapper) => void;
52
+ externalGetKey?: ExternalGetKey;
53
+ childrenPropName?: string;
54
+ fieldNames?: FieldNames;
55
+ },
56
+ /** @deprecated Use `config.externalGetKey` instead */
57
+ legacyExternalGetKey?: ExternalGetKey): Wrapper;
58
+ export interface TreeNodeRequiredProps<TreeDataType extends BasicDataNode = DataNode> {
59
+ expandedKeys: Key[];
60
+ selectedKeys: Key[];
61
+ loadedKeys: Key[];
62
+ loadingKeys: Key[];
63
+ checkedKeys: Key[];
64
+ halfCheckedKeys: Key[];
65
+ dragOverNodeKey: Key;
66
+ dropPosition: number;
67
+ keyEntities: KeyEntities<TreeDataType>;
68
+ }
69
+ /**
70
+ * Get TreeNode props with Tree props.
71
+ */
72
+ export declare function getTreeNodeProps<TreeDataType extends BasicDataNode = DataNode>(key: Key, { expandedKeys, selectedKeys, loadedKeys, loadingKeys, checkedKeys, halfCheckedKeys, dragOverNodeKey, dropPosition, keyEntities, }: TreeNodeRequiredProps<TreeDataType>): {
73
+ eventKey: React.Key;
74
+ expanded: boolean;
75
+ selected: boolean;
76
+ loaded: boolean;
77
+ loading: boolean;
78
+ checked: boolean;
79
+ halfChecked: boolean;
80
+ pos: string;
81
+ dragOver: boolean;
82
+ dragOverGapTop: boolean;
83
+ dragOverGapBottom: boolean;
84
+ };
85
+ export declare function convertNodePropsToEventData<TreeDataType extends BasicDataNode = DataNode>(props: TreeNodeProps<TreeDataType>): EventDataNode<TreeDataType>;
86
+ export {};
@@ -0,0 +1,39 @@
1
+ import './index.less';
2
+ import { ReactNode } from 'react';
3
+ import { MenuItem } from '../menu';
4
+ export interface TreeItem {
5
+ key: string;
6
+ title: string;
7
+ icon?: boolean;
8
+ suffix?: string;
9
+ api?: boolean;
10
+ level?: string;
11
+ menu?: string | (string | MenuItem)[];
12
+ children?: TreeItem[];
13
+ isLeaf?: boolean;
14
+ [key: string]: any;
15
+ }
16
+ export interface TreeProps {
17
+ type?: 'tree' | 'table';
18
+ treeData: TreeItem[];
19
+ showLine?: boolean;
20
+ height?: number | null;
21
+ isload?: boolean;
22
+ animation?: boolean;
23
+ defaultmenu?: 'basis' | 'file';
24
+ defaultExpandedKeys?: string[];
25
+ autoExpandParent?: boolean;
26
+ columns?: any[];
27
+ checks?: string[];
28
+ icon?: (v: any, className: string) => ReactNode;
29
+ onChecks?: (checks: string[], param?: TreeItem[]) => void;
30
+ onSelect?: (key: string) => any;
31
+ onChange?: (data: TreeItem[]) => void;
32
+ titleRender?: (props: any) => any;
33
+ onMenuClick?: (key: string, props: any) => void;
34
+ loadData?: (key: string) => Promise<TreeItem[]> | TreeItem[];
35
+ onRename?: (key: string, value: string, props?: TreeItem) => boolean | void;
36
+ [key: string]: any;
37
+ }
38
+ declare const _default: (props: TreeProps) => import("react/jsx-runtime").JSX.Element;
39
+ export default _default;
@@ -0,0 +1 @@
1
+ export default function TableItem(props: any): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { TreeItem } from '.';
2
+ declare const _default: (props: TreeItem) => import("react/jsx-runtime").JSX.Element;
3
+ export default _default;
@@ -0,0 +1,7 @@
1
+ declare const VirtualScroll: ({ className, item, itemHeight, renderItem, }: {
2
+ className: string;
3
+ item: any[];
4
+ itemHeight: number;
5
+ renderItem: (v: any, i: number, end: boolean) => any;
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
+ export default VirtualScroll;
@@ -0,0 +1,10 @@
1
+ export declare const flush: () => void, hydrate: (ids: string[]) => void, cx: (...classNames: import("@emotion/css/create-instance").ClassNamesArg[]) => string, merge: (className: string) => string, getRegisteredStyles: (registeredStyles: string[], className: string) => string, injectGlobal: {
2
+ (template: TemplateStringsArray, ...args: import("@emotion/serialize").CSSInterpolation[]): void;
3
+ (...args: import("@emotion/serialize").CSSInterpolation[]): void;
4
+ }, keyframes: {
5
+ (template: TemplateStringsArray, ...args: import("@emotion/serialize").CSSInterpolation[]): string;
6
+ (...args: import("@emotion/serialize").CSSInterpolation[]): string;
7
+ }, css: {
8
+ (template: TemplateStringsArray, ...args: import("@emotion/serialize").CSSInterpolation[]): string;
9
+ (...args: import("@emotion/serialize").CSSInterpolation[]): string;
10
+ }, sheet: import("@emotion/css/create-instance").CSSStyleSheet, cache: import("@emotion/utils").EmotionCache;
@@ -0,0 +1,11 @@
1
+ export declare const enum fileType {
2
+ 'folder' = "folder",
3
+ 'file' = "file"
4
+ }
5
+ export declare enum ApiStatusEnum {
6
+ READY = 1,
7
+ LOADING = 2,
8
+ ERROR = 3,
9
+ EMPTY = 4,
10
+ SUCCESS = 5
11
+ }
@@ -0,0 +1,7 @@
1
+ import './index.less';
2
+ import './components/tree/css/index.less';
3
+ import './static/css/index.css';
4
+ import { FC } from 'react';
5
+ import { ExplorerProps } from './types';
6
+ declare const Explorer: FC<ExplorerProps>;
7
+ export default Explorer;
@@ -0,0 +1,5 @@
1
+ import Explorer from './explorer';
2
+ export { registerMenu } from './components/menu/menulist';
3
+ export * from './types';
4
+ export * from './enum';
5
+ export default Explorer;