-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### What problem does this PR solve? feat: add file icon to table of FileManager #345 fix: modify datasetDescription ### Type of change - [x] New Feature (non-breaking change which adds functionality)
- Loading branch information
Showing
19 changed files
with
318 additions
and
155 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import isObject from 'lodash/isObject'; | ||
import { DvaModel } from 'umi'; | ||
import { BaseState } from './interfaces/common'; | ||
|
||
type State = Record<string, any>; | ||
type DvaModelKey<T> = keyof DvaModel<T>; | ||
|
||
export const modelExtend = <T>( | ||
baseModel: Partial<DvaModel<any>>, | ||
extendModel: DvaModel<any>, | ||
): DvaModel<T> => { | ||
return Object.keys(extendModel).reduce<DvaModel<T>>((pre, cur) => { | ||
const baseValue = baseModel[cur as DvaModelKey<State>]; | ||
const value = extendModel[cur as DvaModelKey<State>]; | ||
|
||
if (isObject(value) && isObject(baseValue) && typeof value !== 'string') { | ||
const key = cur as Exclude<DvaModelKey<State>, 'namespace'>; | ||
|
||
pre[key] = { | ||
...baseValue, | ||
...value, | ||
} as any; | ||
} else { | ||
pre[cur as DvaModelKey<State>] = value as any; | ||
} | ||
|
||
return pre; | ||
}, {} as DvaModel<T>); | ||
}; | ||
|
||
export const paginationModel: Partial<DvaModel<BaseState>> = { | ||
state: { | ||
searchString: '', | ||
pagination: { | ||
total: 0, | ||
current: 1, | ||
pageSize: 10, | ||
}, | ||
}, | ||
reducers: { | ||
setSearchString(state, { payload }) { | ||
return { ...state, searchString: payload }; | ||
}, | ||
setPagination(state, { payload }) { | ||
return { ...state, pagination: { ...state.pagination, ...payload } }; | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
export interface Pagination { | ||
current: number; | ||
pageSize: number; | ||
total: number; | ||
} | ||
|
||
export interface BaseState { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.