mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Discover] Discover Classic View Filter In/Out placement when truncate:maxHeight
is set to 0 (#129942)
* Change global injected CSS for truncating height * Optimize CSS code * Add requiresPageReload for TRUNCATE_MAX_HEIGHT
This commit is contained in:
parent
4835a5d7d1
commit
1f05cd606d
3 changed files with 13 additions and 12 deletions
|
@ -124,3 +124,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dscTruncateByHeight {
|
||||
display: inline-block;
|
||||
}
|
||||
|
|
|
@ -18,12 +18,19 @@ const TRUNCATE_GRADIENT_HEIGHT = 15;
|
|||
const globalThemeCache = createCache({ key: 'truncation' });
|
||||
|
||||
const buildStylesheet = (maxHeight: number) => {
|
||||
if (!maxHeight) {
|
||||
return [
|
||||
`
|
||||
.dscTruncateByHeight {
|
||||
max-height: none;
|
||||
}`,
|
||||
];
|
||||
}
|
||||
return [
|
||||
`
|
||||
.dscTruncateByHeight {
|
||||
overflow: hidden;
|
||||
max-height: ${maxHeight}px !important;
|
||||
display: inline-block;
|
||||
}
|
||||
.dscTruncateByHeight:before {
|
||||
top: ${maxHeight - TRUNCATE_GRADIENT_HEIGHT}px;
|
||||
|
@ -32,18 +39,7 @@ const buildStylesheet = (maxHeight: number) => {
|
|||
];
|
||||
};
|
||||
|
||||
const flushThemedGlobals = () => {
|
||||
globalThemeCache.sheet.flush();
|
||||
globalThemeCache.inserted = {};
|
||||
globalThemeCache.registered = {};
|
||||
};
|
||||
|
||||
export const injectTruncateStyles = (maxHeight: number) => {
|
||||
if (maxHeight <= 0) {
|
||||
flushThemedGlobals();
|
||||
return;
|
||||
}
|
||||
|
||||
const serialized = serializeStyles(buildStylesheet(maxHeight), cache.registered);
|
||||
if (!globalThemeCache.inserted[serialized.name]) {
|
||||
globalThemeCache.insert('', serialized, globalThemeCache.sheet, true);
|
||||
|
|
|
@ -286,5 +286,6 @@ export const getUiSettings: (docLinks: DocLinksServiceSetup) => Record<string, U
|
|||
'The maximum height that a cell in a table should occupy. Set to 0 to disable truncation.',
|
||||
}),
|
||||
schema: schema.number({ min: 0 }),
|
||||
requiresPageReload: true,
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue