forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DevEnv: update frontend dependencies - rc (grafana#22977)
* DevEnv: updates rc-cascader 0.17.5 -> 1.0.1 * DevEnv: updates rc-cascader 0.17.5 -> 1.0.1 in grafana-ui package * DevEnv: updates rc-drawer 3.0.2 -> 3.1.3 in grafana-ui package * DevEnv: updates rc-time-picker 3.7.2 -> 3.7.3 in grafana-ui package * DevEnv: updates rc-slider 8.7.1 -> 9.2.3 in grafana-ui package * Fix option mappings * Some clean up of the code. * removed unused function. Co-authored-by: Tobias Skarhed <tobias.skarhed@gmail.com> Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
- Loading branch information
1 parent
e8efd17
commit bcad3fb
Showing
7 changed files
with
138 additions
and
59 deletions.
There are no files selected for viewing
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
29 changes: 29 additions & 0 deletions
29
packages/grafana-ui/src/components/Cascader/optionMappings.ts
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,29 @@ | ||
import { CascaderOption as RCCascaderOption } from 'rc-cascader/lib/Cascader'; | ||
import { CascaderOption } from './Cascader'; | ||
|
||
type onChangeType = ((values: string[], options: CascaderOption[]) => void) | undefined; | ||
|
||
export const onChangeCascader = (onChanged: onChangeType) => (values: string[], options: RCCascaderOption[]) => { | ||
if (onChanged) { | ||
onChanged(values, fromRCOptions(options)); | ||
} | ||
}; | ||
|
||
type onLoadDataType = ((options: CascaderOption[]) => void) | undefined; | ||
|
||
export const onLoadDataCascader = (onLoadData: onLoadDataType) => (options: RCCascaderOption[]) => { | ||
if (onLoadData) { | ||
onLoadData(fromRCOptions(options)); | ||
} | ||
}; | ||
|
||
const fromRCOptions = (options: RCCascaderOption[]): CascaderOption[] => { | ||
return options.map(fromRCOption); | ||
}; | ||
|
||
const fromRCOption = (option: RCCascaderOption): CascaderOption => { | ||
return { | ||
value: option.value ?? '', | ||
label: (option.label as unknown) as string, | ||
}; | ||
}; |
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