@finema/core 1.4.158 → 1.4.159
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/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -7,6 +7,7 @@ export interface IUseTable<T = object> {
|
|
|
7
7
|
repo: IUsePageLoader<T> | Store<any, any>;
|
|
8
8
|
columns: () => IColumn[];
|
|
9
9
|
options?: (() => Partial<ITableOptions<T>>) | Partial<ITableOptions<T>>;
|
|
10
|
+
transformItems?: (items: T[]) => T[];
|
|
10
11
|
}
|
|
11
12
|
export interface IUseTableSimple<T = object> {
|
|
12
13
|
items: () => T[];
|
|
@@ -16,4 +17,4 @@ export interface IUseTableSimple<T = object> {
|
|
|
16
17
|
}
|
|
17
18
|
export declare const useTable: <T = object>(options: IUseTable<T>) => ComputedRef<ITableOptions<T>>;
|
|
18
19
|
export declare const useTableSimple: <T = object>(options: IUseTableSimple<T>) => ComputedRef<ISimpleTableOptions<T>>;
|
|
19
|
-
export declare const createTableOptions: <T = object>(repo: IUsePageLoader<T>, columns: IColumn[], options: Partial<ITableOptions<T
|
|
20
|
+
export declare const createTableOptions: <T = object>(repo: IUsePageLoader<T>, columns: IColumn[], options: Partial<ITableOptions<T>>, transformItems?: ((items: T[]) => T[]) | undefined) => ITableOptions<T>;
|
|
@@ -5,7 +5,8 @@ export const useTable = (options) => computed(() => {
|
|
|
5
5
|
return createTableOptions(
|
|
6
6
|
options.repo,
|
|
7
7
|
options.columns(),
|
|
8
|
-
typeof options.options === "function" ? options.options() : options.options ?? {}
|
|
8
|
+
typeof options.options === "function" ? options.options() : options.options ?? {},
|
|
9
|
+
options.transformItems
|
|
9
10
|
);
|
|
10
11
|
});
|
|
11
12
|
export const useTableSimple = (options) => computed(() => {
|
|
@@ -19,10 +20,10 @@ export const useTableSimple = (options) => computed(() => {
|
|
|
19
20
|
...typeof options.options === "function" ? options.options() : options.options ?? {}
|
|
20
21
|
};
|
|
21
22
|
});
|
|
22
|
-
export const createTableOptions = (repo, columns, options) => {
|
|
23
|
+
export const createTableOptions = (repo, columns, options, transformItems) => {
|
|
23
24
|
const config = useCoreConfig();
|
|
24
25
|
return {
|
|
25
|
-
rawData: get(repo.fetchItems),
|
|
26
|
+
rawData: transformItems ? transformItems(get(repo.fetchItems)) : get(repo.fetchItems),
|
|
26
27
|
pageOptions: get(repo.fetchOptions),
|
|
27
28
|
columns,
|
|
28
29
|
status: get(repo.fetchStatus),
|