-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UnifiedFieldList] Lazy load some modules
- Loading branch information
Showing
15 changed files
with
198 additions
and
35 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
10 changes: 10 additions & 0 deletions
10
...ns/unified_field_list/public/components/field_icon/__snapshots__/field_icon.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
21 changes: 21 additions & 0 deletions
21
src/plugins/unified_field_list/public/components/field_icon/get_field_icon_props.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,21 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { type DataViewField } from '@kbn/data-views-plugin/common'; | ||
import { FieldListItem } from '../../types'; | ||
import { getFieldIconType } from '../../utils/field_types'; | ||
import { type FieldIconProps } from './field_icon'; | ||
|
||
export function getFieldIconProps<T extends FieldListItem = DataViewField>( | ||
field: T | ||
): FieldIconProps { | ||
return { | ||
type: getFieldIconType(field), | ||
scripted: field.scripted, | ||
}; | ||
} |
9 changes: 0 additions & 9 deletions
9
src/plugins/unified_field_list/public/components/field_icon/index.ts
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
src/plugins/unified_field_list/public/components/field_icon/index.tsx
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,28 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React, { Fragment } from 'react'; | ||
import { type DataViewField } from '@kbn/data-views-plugin/common'; | ||
import type { FieldIconProps, GenericFieldIcon } from './field_icon'; | ||
import { type FieldListItem } from '../../types'; | ||
|
||
const Fallback = () => <Fragment />; | ||
|
||
const LazyFieldIcon = React.lazy(() => import('./field_icon')) as GenericFieldIcon; | ||
|
||
function WrappedFieldIcon<T extends FieldListItem = DataViewField>(props: FieldIconProps) { | ||
return ( | ||
<React.Suspense fallback={<Fallback />}> | ||
<LazyFieldIcon {...props} /> | ||
</React.Suspense> | ||
); | ||
} | ||
|
||
export const FieldIcon = WrappedFieldIcon; | ||
export type { FieldIconProps }; | ||
export { getFieldIconProps } from './get_field_icon_props'; |
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
9 changes: 0 additions & 9 deletions
9
src/plugins/unified_field_list/public/components/field_list_filters/index.ts
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
src/plugins/unified_field_list/public/components/field_list_filters/index.tsx
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,31 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React, { Fragment } from 'react'; | ||
import { type DataViewField } from '@kbn/data-views-plugin/common'; | ||
import type { FieldListFiltersProps, GenericFieldListFilters } from './field_list_filters'; | ||
import { type FieldListItem } from '../../types'; | ||
|
||
const Fallback = () => <Fragment />; | ||
|
||
const LazyFieldListFilters = React.lazy( | ||
() => import('./field_list_filters') | ||
) as GenericFieldListFilters; | ||
|
||
function WrappedFieldListFilters<T extends FieldListItem = DataViewField>( | ||
props: FieldListFiltersProps<T> | ||
) { | ||
return ( | ||
<React.Suspense fallback={<Fallback />}> | ||
<LazyFieldListFilters<T> {...props} /> | ||
</React.Suspense> | ||
); | ||
} | ||
|
||
export const FieldListFilters = WrappedFieldListFilters; | ||
export type { FieldListFiltersProps }; |
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