@sheinx/hooks 3.6.0-beta.3 → 3.6.0-beta.30
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/cjs/common/use-filter/use-filter.d.ts.map +1 -1
- package/cjs/common/use-pagination-list/index.d.ts.map +1 -1
- package/cjs/common/use-pagination-list/index.js +6 -1
- package/cjs/common/use-position-style/check-border.d.ts +6 -0
- package/cjs/common/use-position-style/check-border.d.ts.map +1 -0
- package/cjs/common/use-position-style/check-border.js +35 -0
- package/cjs/common/use-position-style/get-position-style.d.ts +1 -0
- package/cjs/common/use-position-style/get-position-style.d.ts.map +1 -1
- package/cjs/common/use-position-style/get-position-style.js +14 -8
- package/cjs/common/use-position-style/index.d.ts +1 -0
- package/cjs/common/use-position-style/index.d.ts.map +1 -1
- package/cjs/common/use-position-style/index.js +21 -10
- package/cjs/components/use-cascader/use-cascader.d.ts.map +1 -1
- package/cjs/components/use-cascader/use-cascader.type.d.ts +2 -1
- package/cjs/components/use-cascader/use-cascader.type.d.ts.map +1 -1
- package/cjs/components/use-check/use-check.d.ts +1 -1
- package/cjs/components/use-check/use-check.d.ts.map +1 -1
- package/cjs/components/use-check/use-check.js +10 -3
- package/cjs/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
- package/cjs/components/use-datepicker/use-datepicker-format.js +4 -0
- package/cjs/components/use-datepicker/use-datepicker-format.type.d.ts +1 -1
- package/cjs/components/use-datepicker/use-datepicker-format.type.d.ts.map +1 -1
- package/cjs/components/use-form/Provider.d.ts +1 -2
- package/cjs/components/use-form/Provider.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-control/use-form-control.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-fieldset/fieldset-context.d.ts +1 -1
- package/cjs/components/use-form/use-form-fieldset/fieldset-context.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-fieldset/fieldset-context.js +3 -2
- package/cjs/components/use-form/use-form-fieldset/index.d.ts +1 -0
- package/cjs/components/use-form/use-form-fieldset/index.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-fieldset/index.js +6 -0
- package/cjs/components/use-form/use-form.d.ts +1 -2
- package/cjs/components/use-form/use-form.d.ts.map +1 -1
- package/cjs/components/use-form/use-form.js +19 -9
- package/cjs/components/use-form/use-form.type.d.ts +3 -1
- package/cjs/components/use-form/use-form.type.d.ts.map +1 -1
- package/cjs/components/use-input/use-input-format.d.ts +1 -1
- package/cjs/components/use-input/use-input-format.d.ts.map +1 -1
- package/cjs/components/use-input/use-input-format.js +12 -4
- package/cjs/components/use-input/use-input-number.d.ts +1 -1
- package/cjs/components/use-input/use-input-number.d.ts.map +1 -1
- package/cjs/components/use-input/use-input-number.js +1 -0
- package/cjs/components/use-popup/use-popup.d.ts.map +1 -1
- package/cjs/components/use-popup/use-popup.js +5 -0
- package/cjs/components/use-table/index.d.ts +2 -1
- package/cjs/components/use-table/index.d.ts.map +1 -1
- package/cjs/components/use-table/index.js +7 -0
- package/cjs/components/use-table/use-table-filter.d.ts +19 -0
- package/cjs/components/use-table/use-table-filter.d.ts.map +1 -0
- package/cjs/components/use-table/use-table-filter.js +96 -0
- package/cjs/components/use-table/use-table-tree.d.ts +13 -0
- package/cjs/components/use-table/use-table-tree.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-tree.js +68 -1
- package/cjs/components/use-table/use-table-virtual.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-virtual.js +6 -4
- package/cjs/components/use-table/use-table.type.d.ts +93 -0
- package/cjs/components/use-table/use-table.type.d.ts.map +1 -1
- package/cjs/components/use-tabs/context.d.ts +1 -1
- package/cjs/components/use-tabs/context.d.ts.map +1 -1
- package/cjs/components/use-tabs/use-tabs.d.ts +1 -1
- package/cjs/components/use-tree/index.d.ts +3 -2
- package/cjs/components/use-tree/index.d.ts.map +1 -1
- package/cjs/components/use-tree/index.js +18 -2
- package/cjs/components/use-tree/use-tree-node.d.ts.map +1 -1
- package/cjs/components/use-tree/use-tree-node.js +1 -5
- package/cjs/components/use-tree/use-tree-node.type.d.ts +18 -0
- package/cjs/components/use-tree/use-tree-node.type.d.ts.map +1 -1
- package/cjs/components/use-tree/use-tree-virtual-node.d.ts +13 -0
- package/cjs/components/use-tree/use-tree-virtual-node.d.ts.map +1 -0
- package/cjs/components/use-tree/use-tree-virtual-node.js +92 -0
- package/cjs/components/use-tree/use-tree.d.ts.map +1 -1
- package/cjs/components/use-tree/use-tree.js +236 -18
- package/cjs/components/use-tree/use-tree.type.d.ts +35 -1
- package/cjs/components/use-tree/use-tree.type.d.ts.map +1 -1
- package/cjs/components/use-treeselect/use-tiled.d.ts +1 -1
- package/cjs/utils/dom/element.d.ts +1 -1
- package/cjs/utils/dom/element.d.ts.map +1 -1
- package/cjs/utils/dom/element.js +5 -3
- package/cjs/utils/is.d.ts +2 -0
- package/cjs/utils/is.d.ts.map +1 -1
- package/cjs/utils/is.js +5 -2
- package/cjs/utils/lazyload.d.ts.map +1 -1
- package/cjs/utils/lazyload.js +2 -2
- package/cjs/utils/object.d.ts.map +1 -1
- package/cjs/utils/object.js +6 -1
- package/cjs/utils/warning.js +5 -5
- package/esm/common/use-filter/use-filter.d.ts.map +1 -1
- package/esm/common/use-pagination-list/index.d.ts.map +1 -1
- package/esm/common/use-pagination-list/index.js +6 -1
- package/esm/common/use-position-style/check-border.d.ts +6 -0
- package/esm/common/use-position-style/check-border.d.ts.map +1 -0
- package/esm/common/use-position-style/check-border.js +29 -0
- package/esm/common/use-position-style/get-position-style.d.ts +1 -0
- package/esm/common/use-position-style/get-position-style.d.ts.map +1 -1
- package/esm/common/use-position-style/get-position-style.js +14 -8
- package/esm/common/use-position-style/index.d.ts +1 -0
- package/esm/common/use-position-style/index.d.ts.map +1 -1
- package/esm/common/use-position-style/index.js +21 -10
- package/esm/components/use-cascader/use-cascader.d.ts.map +1 -1
- package/esm/components/use-cascader/use-cascader.type.d.ts +2 -1
- package/esm/components/use-cascader/use-cascader.type.d.ts.map +1 -1
- package/esm/components/use-check/use-check.d.ts +1 -1
- package/esm/components/use-check/use-check.d.ts.map +1 -1
- package/esm/components/use-check/use-check.js +10 -3
- package/esm/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
- package/esm/components/use-datepicker/use-datepicker-format.js +4 -0
- package/esm/components/use-datepicker/use-datepicker-format.type.d.ts +1 -1
- package/esm/components/use-datepicker/use-datepicker-format.type.d.ts.map +1 -1
- package/esm/components/use-form/Provider.d.ts +1 -2
- package/esm/components/use-form/Provider.d.ts.map +1 -1
- package/esm/components/use-form/use-form-control/use-form-control.d.ts.map +1 -1
- package/esm/components/use-form/use-form-fieldset/fieldset-context.d.ts +1 -1
- package/esm/components/use-form/use-form-fieldset/fieldset-context.d.ts.map +1 -1
- package/esm/components/use-form/use-form-fieldset/fieldset-context.js +2 -1
- package/esm/components/use-form/use-form-fieldset/index.d.ts +1 -0
- package/esm/components/use-form/use-form-fieldset/index.d.ts.map +1 -1
- package/esm/components/use-form/use-form-fieldset/index.js +2 -1
- package/esm/components/use-form/use-form.d.ts +1 -2
- package/esm/components/use-form/use-form.d.ts.map +1 -1
- package/esm/components/use-form/use-form.js +19 -9
- package/esm/components/use-form/use-form.type.d.ts +3 -1
- package/esm/components/use-form/use-form.type.d.ts.map +1 -1
- package/esm/components/use-input/use-input-format.d.ts +1 -1
- package/esm/components/use-input/use-input-format.d.ts.map +1 -1
- package/esm/components/use-input/use-input-format.js +12 -4
- package/esm/components/use-input/use-input-number.d.ts +1 -1
- package/esm/components/use-input/use-input-number.d.ts.map +1 -1
- package/esm/components/use-input/use-input-number.js +1 -0
- package/esm/components/use-popup/use-popup.d.ts.map +1 -1
- package/esm/components/use-popup/use-popup.js +5 -0
- package/esm/components/use-table/index.d.ts +2 -1
- package/esm/components/use-table/index.d.ts.map +1 -1
- package/esm/components/use-table/index.js +1 -0
- package/esm/components/use-table/use-table-filter.d.ts +19 -0
- package/esm/components/use-table/use-table-filter.d.ts.map +1 -0
- package/esm/components/use-table/use-table-filter.js +89 -0
- package/esm/components/use-table/use-table-tree.d.ts +13 -0
- package/esm/components/use-table/use-table-tree.d.ts.map +1 -1
- package/esm/components/use-table/use-table-tree.js +67 -0
- package/esm/components/use-table/use-table-virtual.d.ts.map +1 -1
- package/esm/components/use-table/use-table-virtual.js +6 -4
- package/esm/components/use-table/use-table.type.d.ts +93 -0
- package/esm/components/use-table/use-table.type.d.ts.map +1 -1
- package/esm/components/use-tabs/context.d.ts +1 -1
- package/esm/components/use-tabs/context.d.ts.map +1 -1
- package/esm/components/use-tabs/use-tabs.d.ts +1 -1
- package/esm/components/use-tree/index.d.ts +3 -2
- package/esm/components/use-tree/index.d.ts.map +1 -1
- package/esm/components/use-tree/index.js +3 -2
- package/esm/components/use-tree/use-tree-node.d.ts.map +1 -1
- package/esm/components/use-tree/use-tree-node.js +1 -5
- package/esm/components/use-tree/use-tree-node.type.d.ts +18 -0
- package/esm/components/use-tree/use-tree-node.type.d.ts.map +1 -1
- package/esm/components/use-tree/use-tree-virtual-node.d.ts +13 -0
- package/esm/components/use-tree/use-tree-virtual-node.d.ts.map +1 -0
- package/esm/components/use-tree/use-tree-virtual-node.js +85 -0
- package/esm/components/use-tree/use-tree.d.ts.map +1 -1
- package/esm/components/use-tree/use-tree.js +238 -20
- package/esm/components/use-tree/use-tree.type.d.ts +35 -1
- package/esm/components/use-tree/use-tree.type.d.ts.map +1 -1
- package/esm/components/use-treeselect/use-tiled.d.ts +1 -1
- package/esm/utils/dom/element.d.ts +1 -1
- package/esm/utils/dom/element.d.ts.map +1 -1
- package/esm/utils/dom/element.js +4 -2
- package/esm/utils/is.d.ts +2 -0
- package/esm/utils/is.d.ts.map +1 -1
- package/esm/utils/is.js +4 -1
- package/esm/utils/lazyload.d.ts.map +1 -1
- package/esm/utils/lazyload.js +3 -3
- package/esm/utils/object.d.ts.map +1 -1
- package/esm/utils/object.js +6 -1
- package/esm/utils/warning.js +5 -5
- package/package.json +1 -1
@@ -139,6 +139,93 @@ export interface TableColumnSorter {
|
|
139
139
|
export interface ColumnRenderFunc<DataItem> {
|
140
140
|
(data: DataItem, index: number, checkInstance?: React.ReactComponentElement<any>): React.ReactNode | (() => React.ReactNode);
|
141
141
|
}
|
142
|
+
export interface TableColumnFilterBase<DataItem> {
|
143
|
+
/**
|
144
|
+
* @cn 筛选模式: search 搜索模式, select 选择模式
|
145
|
+
* @en Filter mode: search search mode, select select mode
|
146
|
+
*/
|
147
|
+
mode: 'search' | 'select';
|
148
|
+
/**
|
149
|
+
* @cn 筛选数据的函数
|
150
|
+
* @en Filter data function
|
151
|
+
* @param value 筛选值
|
152
|
+
* @param row 行数据
|
153
|
+
* @returns 是否通过筛选
|
154
|
+
*/
|
155
|
+
onFilter: (value: any, row: DataItem) => boolean;
|
156
|
+
/**
|
157
|
+
* @cn 自定义的筛选项图标
|
158
|
+
* @en Custom filter icon
|
159
|
+
*/
|
160
|
+
icon?: React.ReactNode;
|
161
|
+
}
|
162
|
+
export type TableFilterData = {
|
163
|
+
label: string;
|
164
|
+
value: any;
|
165
|
+
icon?: React.ReactNode;
|
166
|
+
[key: string]: any;
|
167
|
+
children?: TableFilterData[];
|
168
|
+
};
|
169
|
+
export interface SelectModeColumnFilter<DataItem> extends TableColumnFilterBase<DataItem> {
|
170
|
+
/**
|
171
|
+
* @cn 筛选模式为 select 时
|
172
|
+
* @en Filter mode is select
|
173
|
+
*/
|
174
|
+
mode: 'select';
|
175
|
+
/**
|
176
|
+
* 必填的 `config` 字段
|
177
|
+
*/
|
178
|
+
config: {
|
179
|
+
/**
|
180
|
+
* @cn 筛选项数据
|
181
|
+
* @en Filter item data
|
182
|
+
*/
|
183
|
+
data: Array<TableFilterData>;
|
184
|
+
/**
|
185
|
+
* @cn 自定义渲染筛选项
|
186
|
+
* @en Custom rendering filter options
|
187
|
+
* @default (data) => data.label
|
188
|
+
*/
|
189
|
+
renderItem?: ((item: TableFilterData) => React.ReactNode) | ObjectKey<TableFilterData>;
|
190
|
+
/**
|
191
|
+
* @cn 是否多选
|
192
|
+
* @en Whether to multiple select
|
193
|
+
*/
|
194
|
+
multiple?: boolean;
|
195
|
+
/**
|
196
|
+
* @cn 是否开启顶部的搜索框
|
197
|
+
* @en Whether to open the top search box
|
198
|
+
*/
|
199
|
+
search?: boolean;
|
200
|
+
/**
|
201
|
+
* @cn 是否高亮命中的关键词,仅当 search 为 true 时有效
|
202
|
+
* @en Whether to highlight the hit keywords
|
203
|
+
*/
|
204
|
+
highlight?: boolean;
|
205
|
+
};
|
206
|
+
/**
|
207
|
+
* @cn 筛选数据的函数
|
208
|
+
* @en Filter data function
|
209
|
+
* @param value 筛选值,单选时为单个值,多选时为数组
|
210
|
+
* @param row 行数据
|
211
|
+
* @returns 是否通过筛选
|
212
|
+
*/
|
213
|
+
onFilter: (value: any, row: DataItem) => boolean;
|
214
|
+
}
|
215
|
+
export interface SearchModeColumnFilter<DataItem> extends TableColumnFilterBase<DataItem> {
|
216
|
+
/**
|
217
|
+
* 筛选模式为 search 时
|
218
|
+
*/
|
219
|
+
mode: 'search';
|
220
|
+
/**
|
221
|
+
* 此时不允许传 `config`
|
222
|
+
*/
|
223
|
+
config?: never;
|
224
|
+
}
|
225
|
+
/**
|
226
|
+
* 最终的联合类型
|
227
|
+
*/
|
228
|
+
export type TableColumnFilter<DataItem> = SelectModeColumnFilter<DataItem> | SearchModeColumnFilter<DataItem>;
|
142
229
|
/**
|
143
230
|
* @title TableColumn
|
144
231
|
*/
|
@@ -227,6 +314,12 @@ export interface TableColumnItem<DataItem> {
|
|
227
314
|
* @version 3.5.0
|
228
315
|
*/
|
229
316
|
sortDirections?: ('asc' | 'desc')[];
|
317
|
+
/**
|
318
|
+
* @cn 列的筛选配置
|
319
|
+
* @en Column filter configuration
|
320
|
+
* @version 3.6.0
|
321
|
+
*/
|
322
|
+
filter?: TableColumnFilter<DataItem>;
|
230
323
|
/**
|
231
324
|
* @en The content of the header
|
232
325
|
* @cn 表头显示内容
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-table.type.d.ts","sourceR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AC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { TabsProviderProps, TabsContextProps } from './context.type';
|
3
3
|
export declare const TabsContext: React.Context<TabsContextProps<any>>;
|
4
|
-
export declare const Provider: <TabData>(props: TabsProviderProps<TabData>) => JSX.Element;
|
4
|
+
export declare const Provider: <TabData>(props: TabsProviderProps<TabData>) => import("react/jsx-runtime").JSX.Element;
|
5
5
|
export declare const useTabsContext: <TabData>() => TabsContextProps<TabData>;
|
6
6
|
//# sourceMappingURL=context.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAErE,eAAO,MAAM,WAAW,sCAA8E,CAAC;AAEvG,eAAO,MAAM,QAAQ,
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAErE,eAAO,MAAM,WAAW,sCAA8E,CAAC;AAEvG,eAAO,MAAM,QAAQ,yFAGpB,CAAC;AAEF,eAAO,MAAM,cAAc,0CAA8E,CAAC"}
|
@@ -5,7 +5,7 @@ declare const useTabs: <TabData = any>(props: BaseTabsProps) => {
|
|
5
5
|
onChange: (key: string | number) => void;
|
6
6
|
tabs: TabData[];
|
7
7
|
setTabs: import("react").Dispatch<import("react").SetStateAction<TabData[]>>;
|
8
|
-
Provider: <TabData_1>(props: import("./context.type").TabsProviderProps<TabData_1>) => JSX.Element;
|
8
|
+
Provider: <TabData_1>(props: import("./context.type").TabsProviderProps<TabData_1>) => import("react/jsx-runtime").JSX.Element;
|
9
9
|
};
|
10
10
|
export default useTabs;
|
11
11
|
//# sourceMappingURL=use-tabs.d.ts.map
|
@@ -1,5 +1,6 @@
|
|
1
|
-
export { default, default as useTree } from './use-tree';
|
2
|
-
export type { BaseTreeProps, UpdateFunc, TreePathType, TreeModeType } from './use-tree.type';
|
1
|
+
export { default, default as useTree, MODE } from './use-tree';
|
2
|
+
export type { BaseTreeProps, UpdateFunc, TreePathType, TreeModeType, DisabledOption, FlatNodeType, } from './use-tree.type';
|
3
3
|
export { default as useTreeNode } from './use-tree-node';
|
4
|
+
export { default as useTreeVirtualNode } from './use-tree-virtual-node';
|
4
5
|
export type { BaseTreeNodeProps, UpdateType } from './use-tree-node.type';
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAC/D,YAAY,EACV,aAAa,EACb,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,YAAY,GACb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACxE,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC"}
|
@@ -1,3 +1,4 @@
|
|
1
1
|
"use client";
|
2
|
-
export { default, default as useTree } from "./use-tree";
|
3
|
-
export { default as useTreeNode } from "./use-tree-node";
|
2
|
+
export { default, default as useTree, MODE } from "./use-tree";
|
3
|
+
export { default as useTreeNode } from "./use-tree-node";
|
4
|
+
export { default as useTreeVirtualNode } from "./use-tree-virtual-node";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-tree-node.d.ts","sourceRoot":"","sources":["use-tree-node.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,QAAA,MAAM,WAAW;kBAMmB,MAAM,SAAS,OAAO;;;;;;;;
|
1
|
+
{"version":3,"file":"use-tree-node.d.ts","sourceRoot":"","sources":["use-tree-node.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,QAAA,MAAM,WAAW;kBAMmB,MAAM,SAAS,OAAO;;;;;;;;CA+CzD,CAAC;AACF,eAAe,WAAW,CAAC"}
|
@@ -41,11 +41,7 @@ var useTreeNode = function useTreeNode(props) {
|
|
41
41
|
break;
|
42
42
|
}
|
43
43
|
});
|
44
|
-
var handleToggle = function handleToggle() {
|
45
|
-
// const newExpand = !expanded;
|
46
|
-
// setExpanded(newExpand);
|
47
|
-
// if (onToggle) onToggle(id, newExpand);
|
48
|
-
};
|
44
|
+
var handleToggle = function handleToggle() {};
|
49
45
|
var isLeaf = function isLeaf() {
|
50
46
|
var children = data[childrenKey];
|
51
47
|
if (children && children.length > 0) return false;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { KeygenResult } from '../../common/type';
|
3
|
+
import { TreeDatum } from './use-tree.type';
|
3
4
|
export type UpdateType = 'active' | 'expanded' | 'fetching';
|
4
5
|
export type UpdateFunc = (name: string, active: boolean) => void;
|
5
6
|
export interface NodeState {
|
@@ -12,8 +13,25 @@ export interface BaseTreeNodeProps<DataItem, Value> {
|
|
12
13
|
data: DataItem;
|
13
14
|
childrenKey: keyof DataItem;
|
14
15
|
element: React.RefObject<HTMLDivElement>;
|
16
|
+
dragImageStyle?: React.CSSProperties;
|
15
17
|
dragImageSelector: (data?: DataItem) => string | undefined;
|
18
|
+
bindNode: (id: KeygenResult, update: UpdateFunc, data: DataItem) => {
|
19
|
+
expanded: boolean;
|
20
|
+
active: boolean;
|
21
|
+
};
|
22
|
+
content: HTMLDivElement | null;
|
23
|
+
loader?: (key: KeygenResult, data: DataItem) => void;
|
24
|
+
onToggle?: (id: Value, expanded: boolean) => void;
|
25
|
+
onDrop?: (data: DataItem[], key: KeygenResult, targetKey: KeygenResult, position: number) => void;
|
26
|
+
}
|
27
|
+
export interface BaseTreeVirtualNodeProps<DataItem, Value> {
|
28
|
+
id: KeygenResult;
|
29
|
+
data: DataItem;
|
30
|
+
expanded?: boolean;
|
31
|
+
childrenKey: keyof DataItem;
|
32
|
+
element: React.RefObject<HTMLDivElement>;
|
16
33
|
dragImageStyle?: React.CSSProperties;
|
34
|
+
datum?: TreeDatum<DataItem>;
|
17
35
|
bindNode: (id: KeygenResult, update: UpdateFunc, data: DataItem) => {
|
18
36
|
expanded: boolean;
|
19
37
|
active: boolean;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-tree-node.type.d.ts","sourceRoot":"","sources":["use-tree-node.type.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
1
|
+
{"version":3,"file":"use-tree-node.type.d.ts","sourceRoot":"","sources":["use-tree-node.type.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;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AQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,MAAM,QAAQ,CAAC;IAC5B,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACzC,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,KAAK,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC5B,QAAQ,EAAE,CACR,EAAE,EAAE,YAAY,EAChB,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,QAAQ,KACX;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC;IAC5C,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACrD,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACnG"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { BaseTreeVirtualNodeProps } from './use-tree-node.type';
|
2
|
+
declare const useTreeVirtualNode: <DataItem, Value>(props: BaseTreeVirtualNodeProps<DataItem, Value>) => {
|
3
|
+
update: (key: string, value: boolean) => void;
|
4
|
+
active: boolean;
|
5
|
+
expanded: boolean;
|
6
|
+
fetching: boolean;
|
7
|
+
isLeaf: () => boolean;
|
8
|
+
setFetching: (v: boolean) => void;
|
9
|
+
setExpanded: (v: boolean) => void;
|
10
|
+
onToggle: () => void;
|
11
|
+
};
|
12
|
+
export default useTreeVirtualNode;
|
13
|
+
//# sourceMappingURL=use-tree-virtual-node.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"use-tree-virtual-node.d.ts","sourceRoot":"","sources":["use-tree-virtual-node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAGhE,QAAA,MAAM,kBAAkB;kBAMY,MAAM,SAAS,OAAO;;;;;qBAoB1B,OAAO;qBASP,OAAO;;CAkCtC,CAAC;AACF,eAAe,kBAAkB,CAAC"}
|
@@ -0,0 +1,85 @@
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
7
|
+
import { useEffect, useState } from 'react';
|
8
|
+
import usePersistFn from "../../common/use-persist-fn";
|
9
|
+
var useTreeVirtualNode = function useTreeVirtualNode(props) {
|
10
|
+
var _datum$dataFlatStatus, _datum$dataFlatStatus2, _datum$dataFlatStatus3;
|
11
|
+
var id = props.id,
|
12
|
+
data = props.data,
|
13
|
+
childrenKey = props.childrenKey,
|
14
|
+
bindNode = props.bindNode,
|
15
|
+
loader = props.loader,
|
16
|
+
datum = props.datum;
|
17
|
+
var _useState = useState((datum === null || datum === void 0 || (_datum$dataFlatStatus = datum.dataFlatStatusMap.get(id)) === null || _datum$dataFlatStatus === void 0 ? void 0 : _datum$dataFlatStatus.active) || false),
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
19
|
+
active = _useState2[0],
|
20
|
+
setActive = _useState2[1];
|
21
|
+
var _useState3 = useState((datum === null || datum === void 0 || (_datum$dataFlatStatus2 = datum.dataFlatStatusMap.get(id)) === null || _datum$dataFlatStatus2 === void 0 ? void 0 : _datum$dataFlatStatus2.expanded) || false),
|
22
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
23
|
+
expanded = _useState4[0],
|
24
|
+
setExpanded = _useState4[1];
|
25
|
+
var _useState5 = useState((datum === null || datum === void 0 || (_datum$dataFlatStatus3 = datum.dataFlatStatusMap.get(id)) === null || _datum$dataFlatStatus3 === void 0 ? void 0 : _datum$dataFlatStatus3.fetching) || false),
|
26
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
27
|
+
fetching = _useState6[0],
|
28
|
+
setFetching = _useState6[1];
|
29
|
+
var update = usePersistFn(function (key, value) {
|
30
|
+
switch (key) {
|
31
|
+
case 'active':
|
32
|
+
if (value !== active) {
|
33
|
+
setActive(value);
|
34
|
+
}
|
35
|
+
break;
|
36
|
+
case 'expanded':
|
37
|
+
setExpanded(value);
|
38
|
+
break;
|
39
|
+
case 'fetching':
|
40
|
+
if (value !== fetching) {
|
41
|
+
setFetching(value);
|
42
|
+
}
|
43
|
+
break;
|
44
|
+
}
|
45
|
+
});
|
46
|
+
var handleToggle = function handleToggle() {};
|
47
|
+
var handleSetFetchind = function handleSetFetchind(v) {
|
48
|
+
datum === null || datum === void 0 || datum.dataFlatStatusMap.set(id, {
|
49
|
+
active: active,
|
50
|
+
expanded: expanded,
|
51
|
+
fetching: v
|
52
|
+
});
|
53
|
+
setFetching(v);
|
54
|
+
};
|
55
|
+
var handleSetExpanded = function handleSetExpanded(v) {
|
56
|
+
datum === null || datum === void 0 || datum.dataFlatStatusMap.set(id, {
|
57
|
+
active: active,
|
58
|
+
expanded: v,
|
59
|
+
fetching: fetching
|
60
|
+
});
|
61
|
+
setExpanded(v);
|
62
|
+
};
|
63
|
+
var isLeaf = function isLeaf() {
|
64
|
+
var children = data[childrenKey];
|
65
|
+
if (children && children.length > 0) return false;
|
66
|
+
if (Array.isArray(children) || children === null) return true;
|
67
|
+
if (fetching && !children) return false;
|
68
|
+
if (loader && !fetching) return false;
|
69
|
+
return true;
|
70
|
+
};
|
71
|
+
useEffect(function () {
|
72
|
+
bindNode(id, update, data);
|
73
|
+
}, []);
|
74
|
+
return {
|
75
|
+
update: update,
|
76
|
+
active: active,
|
77
|
+
expanded: expanded,
|
78
|
+
fetching: fetching,
|
79
|
+
isLeaf: isLeaf,
|
80
|
+
setFetching: handleSetFetchind,
|
81
|
+
setExpanded: handleSetExpanded,
|
82
|
+
onToggle: handleToggle
|
83
|
+
};
|
84
|
+
};
|
85
|
+
export default useTreeVirtualNode;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["use-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAKb,SAAS,
|
1
|
+
{"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["use-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAKb,SAAS,EAGV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAiBjD,eAAO,MAAM,IAAI;IACf;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEJ,CAAC;AAEF,QAAA,MAAM,OAAO;;;;;CAurBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
|