@limetech/lime-elements 37.65.8 → 37.65.10
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/CHANGELOG.md +16 -0
- package/dist/cjs/limel-icon_2.cjs.entry.js +2 -2
- package/dist/cjs/limel-icon_2.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-table.cjs.entry.js +1 -1
- package/dist/cjs/limel-table.cjs.entry.js.map +1 -1
- package/dist/collection/components/portal/portal.js +2 -2
- package/dist/collection/components/portal/portal.js.map +1 -1
- package/dist/collection/components/table/table.css +2 -2
- package/dist/esm/limel-icon_2.entry.js +2 -2
- package/dist/esm/limel-icon_2.entry.js.map +1 -1
- package/dist/esm/limel-table.entry.js +1 -1
- package/dist/esm/limel-table.entry.js.map +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-9cc9d83e.entry.js → p-634a3b1a.entry.js} +2 -2
- package/dist/lime-elements/{p-9cc9d83e.entry.js.map → p-634a3b1a.entry.js.map} +1 -1
- package/dist/lime-elements/{p-d687c11f.entry.js → p-e78fcffb.entry.js} +2 -2
- package/dist/lime-elements/{p-d687c11f.entry.js.map → p-e78fcffb.entry.js.map} +1 -1
- package/package.json +4 -4
|
@@ -88,13 +88,13 @@ export class Portal {
|
|
|
88
88
|
this.showContainer();
|
|
89
89
|
}
|
|
90
90
|
if ('ResizeObserver' in window) {
|
|
91
|
-
|
|
91
|
+
this.observer = new ResizeObserver(() => {
|
|
92
92
|
if (this.popperInstance) {
|
|
93
93
|
this.styleContainer();
|
|
94
94
|
this.popperInstance.update();
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
|
-
observer.observe(this.container);
|
|
97
|
+
this.observer.observe(this.container);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
render() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal.js","sourceRoot":"","sources":["../../../src/components/portal/portal.tsx"],"names":[],"mappings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,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC;IAChE,MAAM,kBAAkB,GAAG,EAAE,CAAC;IAC9B,MAAM,SAAS,GACX,IAAI,CAAC,GAAG,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;MACxD,kBAAkB,CAAC;IAEvB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,GAAG,GAAG,SAAS,IAAI,CAAC;EACtD,CAAC;EAED,+EAA+E;EAC/E,oDAAoD;EAC5C,SAAS;IACb,IAAI,OAAO,GAAwB,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC;IAE5D,OAAO,OAAO,EAAE;MACZ,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;MACxD,IAAI,MAAM,EAAE;QACR,OAAO,MAAM,CAAC;OACjB;MAED,OAAO,GAAI,OAAO,CAAC,WAAW,EAAiB,CAAC,IAAI,CAAC;KACxD;IAED,OAAO,QAAQ,CAAC,IAAI,CAAC;EACzB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, Element, h, Prop, Watch } from '@stencil/core';\nimport { OpenDirection } from '../menu/menu.types';\nimport {\n createPopper,\n Instance,\n OptionsGeneric,\n Placement,\n} from '@popperjs/core';\nimport { FlipModifier } from '@popperjs/core/lib/modifiers/flip';\n\nconst IS_VISIBLE_CLASS = 'is-visible';\nconst IS_HIDING_CLASS = 'is-hiding';\nconst hideAnimationDuration = 300;\n\n/**\n * The portal component provides a way to render children into a DOM node that\n * exist outside the DOM hierarchy of the parent component.\n *\n * When the limel-portal component is used, it creates a new DOM node (a div element)\n * and appends it to a parent element (by default, the body of the document).\n * The child elements of the limel-portal are then moved from\n * their original location in the DOM to this new div element.\n *\n * This technique is often used to overcome CSS stacking context issues,\n * or to render UI elements like modals, dropdowns, tooltips, etc.,\n * that need to visually \"break out\" of their container.\n *\n * Using this component, we ensure that the content is always rendered in the\n * correct position, and never covers its own trigger, or another component\n * that is opened in the stacking layer. This way, we don't need to worry about\n * z-indexes, or other stacking context issues.\n *\n * :::important\n * There are some caveats when using this component\n *\n * 1. Events might not bubble up as expected since the content is moved out to\n * another DOM node.\n * 2. Any styling that is applied to content from the parent will be lost, if the\n * content is just another web-component it will work without any issues.\n * Alternatively, use the `style=\"\"` html attribute.\n * 3. Any component that is placed inside the container must have a style of\n * `max-height: inherit`. This ensures that its placement is calculated\n * correctly in relation to the trigger, and that it never covers its own\n * trigger.\n * 4. When the node is moved in the DOM, `disconnectedCallback` and\n * `connectedCallback` will be invoked, so if `disconnectedCallback` is used\n * to do any tear-down, the appropriate setup will have to be done again on\n * `connectedCallback`.\n * :::\n *\n * @slot - Content to put inside the portal\n * @private\n * @exampleComponent limel-example-portal-basic\n */\n@Component({\n tag: 'limel-portal',\n shadow: true,\n styleUrl: 'portal.scss',\n})\nexport class Portal {\n /**\n * Decides which direction the portal content should open.\n */\n @Prop({ reflect: true })\n public openDirection: OpenDirection = 'bottom';\n\n /**\n * Position of the content.\n */\n @Prop({ reflect: true })\n public position: 'fixed' | 'absolute' = 'absolute';\n\n /**\n * A unique ID.\n */\n @Prop({ reflect: true })\n public containerId: string;\n\n /**\n * Dynamic styling that can be applied to the container holding the content.\n */\n @Prop()\n public containerStyle: object = {};\n\n /**\n * Used to make a dropdown have the same width as the trigger, for example\n * in `limel-picker`.\n */\n @Prop({ reflect: true })\n public inheritParentWidth = false;\n\n /**\n * True if the content within the portal should be visible.\n *\n * If the content is from within a dialog for instance, this can be set to\n * true from false when the dialog opens to position the content properly.\n */\n @Prop({ reflect: true })\n public visible = false;\n\n /**\n * The element that the content should be positioned relative to.\n * Defaults to the limel-portal element.\n */\n @Prop()\n public anchor?: HTMLElement = null;\n\n @Element()\n private host: HTMLLimelPortalElement;\n\n private parents: WeakMap<HTMLElement, HTMLElement>;\n private container: HTMLElement;\n private popperInstance: Instance;\n private loaded = false;\n private observer: ResizeObserver;\n\n constructor() {\n this.parents = new WeakMap();\n }\n\n public disconnectedCallback() {\n this.removeContainer();\n this.destroyPopper();\n if (this.observer && this.container) {\n this.observer.unobserve(this.container);\n }\n\n this.container = null;\n }\n\n public connectedCallback() {\n if (!this.loaded) {\n return;\n }\n\n if (this.visible) {\n this.init();\n }\n }\n\n public componentDidLoad() {\n this.loaded = true;\n this.connectedCallback();\n }\n\n private init() {\n if (!this.host.isConnected) {\n return;\n }\n\n this.createContainer();\n this.hideContainer();\n this.attachContainer();\n this.styleContainer();\n\n if (this.visible) {\n this.createPopper();\n this.showContainer();\n }\n\n if ('ResizeObserver' in window) {\n const observer = new ResizeObserver(() => {\n if (this.popperInstance) {\n this.styleContainer();\n this.popperInstance.update();\n }\n });\n observer.observe(this.container);\n }\n }\n\n public render() {\n return <slot />;\n }\n\n @Watch('visible')\n protected onVisible() {\n if (!this.container && this.visible) {\n this.init();\n\n return;\n }\n\n if (!this.visible) {\n this.animateHideAndCleanup();\n\n return;\n }\n\n this.styleContainer();\n this.createPopper();\n requestAnimationFrame(() => {\n this.showContainer();\n });\n }\n\n private createContainer() {\n const slot: HTMLSlotElement =\n this.host.shadowRoot.querySelector('slot');\n const content =\n (slot.assignedElements && slot.assignedElements()) || [];\n\n this.container = document.createElement('div');\n this.container.setAttribute('id', this.containerId);\n this.container.setAttribute('class', 'limel-portal--container');\n Object.assign(this.container, {\n portalSource: this.host,\n });\n\n content.forEach((element: HTMLElement) => {\n this.parents.set(element, element.parentElement);\n this.container.appendChild(element);\n });\n }\n\n private attachContainer() {\n this.getParent().appendChild(this.container);\n }\n\n private removeContainer() {\n if (!this.container) {\n return;\n }\n\n Array.from(this.container.children).forEach((element: HTMLElement) => {\n const parent = this.parents.get(element);\n if (!parent) {\n return;\n }\n\n parent.appendChild(element);\n });\n\n this.container.parentElement.removeChild(this.container);\n }\n\n private hideContainer() {\n if (!this.container) {\n return;\n }\n\n this.container.classList.remove(IS_VISIBLE_CLASS);\n }\n\n private showContainer() {\n this.container.classList.add(IS_VISIBLE_CLASS);\n }\n\n private animateHideAndCleanup() {\n if (!this.container) {\n return;\n }\n\n this.container.classList.add(IS_HIDING_CLASS);\n this.styleContainer();\n\n setTimeout(() => {\n this.container.classList.remove(IS_HIDING_CLASS);\n if (!this.visible) {\n this.container.classList.remove(IS_VISIBLE_CLASS);\n this.destroyPopper();\n }\n }, hideAnimationDuration);\n }\n\n private styleContainer() {\n this.setContainerWidth();\n this.setContainerHeight();\n this.setContainerStyles();\n }\n\n private setContainerWidth() {\n const hostWidth = this.host.getBoundingClientRect().width;\n\n if (this.inheritParentWidth) {\n const containerWidth = this.getContentWidth(this.container);\n let width = containerWidth;\n if (hostWidth > 0) {\n width = hostWidth;\n }\n\n this.container.style.width = `${width}px`;\n }\n }\n\n private getContentWidth(element: HTMLElement | Element) {\n if (!element) {\n return null;\n }\n\n const width = element.getBoundingClientRect().width;\n if (width !== 0) {\n return width;\n }\n\n const elementContent = element.querySelector('*');\n\n return this.getContentWidth(elementContent);\n }\n\n private setContainerStyles() {\n Object.keys(this.containerStyle).forEach((property) => {\n this.container.style[property] = this.containerStyle[property];\n });\n }\n\n private createPopper() {\n const config = this.createPopperConfig();\n\n this.popperInstance = createPopper(\n this.anchor || this.host,\n this.container,\n config,\n );\n }\n\n private destroyPopper() {\n this.popperInstance?.destroy();\n this.popperInstance = null;\n }\n\n private createPopperConfig(): Partial<\n OptionsGeneric<Partial<FlipModifier>>\n > {\n const placement = this.getPlacement(this.openDirection);\n const flipPlacement = this.getFlipPlacement(this.openDirection);\n\n return {\n strategy: this.position,\n placement: placement,\n modifiers: [\n {\n name: 'flip',\n options: {\n fallbackPlacements: [flipPlacement],\n },\n },\n ],\n };\n }\n\n private getPlacement(direction: OpenDirection): Placement {\n const placements: Record<OpenDirection, Placement> = {\n 'left-start': 'left-start',\n left: 'left',\n 'left-end': 'left-end',\n 'right-start': 'right-start',\n right: 'right',\n 'right-end': 'right-end',\n 'top-start': 'top-start',\n top: 'top',\n 'top-end': 'top-end',\n 'bottom-start': 'bottom-start',\n bottom: 'bottom',\n 'bottom-end': 'bottom-end',\n };\n\n return placements[direction];\n }\n\n private getFlipPlacement(direction: OpenDirection): Placement {\n const flipPlacements: Record<OpenDirection, Placement> = {\n 'left-start': 'right-start',\n left: 'right',\n 'left-end': 'right-end',\n 'right-start': 'left-start',\n right: 'left',\n 'right-end': 'left-end',\n 'top-start': 'bottom-start',\n top: 'bottom',\n 'top-end': 'bottom-end',\n 'bottom-start': 'top-start',\n bottom: 'top',\n 'bottom-end': 'top-end',\n };\n\n return flipPlacements[direction];\n }\n\n private setContainerHeight() {\n const viewHeight = Math.max(\n document.documentElement.clientHeight || 0,\n window.innerHeight || 0,\n );\n\n const { top, bottom } = this.host.getBoundingClientRect();\n const spaceAboveTopOfSurface = Math.max(top, 0);\n const spaceBelowTopOfSurface = Math.max(viewHeight - bottom, 0);\n const extraCosmeticSpace = 16;\n const maxHeight =\n Math.max(spaceAboveTopOfSurface, spaceBelowTopOfSurface) -\n extraCosmeticSpace;\n\n this.container.style.maxHeight = `${maxHeight}px`;\n }\n\n // Returns the parent element where the content of the portal will be moved to.\n // It needs to have styling of the portal container.\n private getParent() {\n let element: Element | undefined = this.anchor || this.host;\n\n while (element) {\n const parent = element.closest('.limel-portal--parent');\n if (parent) {\n return parent;\n }\n\n element = (element.getRootNode() as ShadowRoot).host;\n }\n\n return document.body;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"portal.js","sourceRoot":"","sources":["../../../src/components/portal/portal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EACH,YAAY,GAIf,MAAM,gBAAgB,CAAC;AAGxB,MAAM,gBAAg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C;MACxD,kBAAkB,CAAC;IAEvB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,GAAG,GAAG,SAAS,IAAI,CAAC;EACtD,CAAC;EAED,+EAA+E;EAC/E,oDAAoD;EAC5C,SAAS;IACb,IAAI,OAAO,GAAwB,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC;IAE5D,OAAO,OAAO,EAAE;MACZ,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;MACxD,IAAI,MAAM,EAAE;QACR,OAAO,MAAM,CAAC;OACjB;MAED,OAAO,GAAI,OAAO,CAAC,WAAW,EAAiB,CAAC,IAAI,CAAC;KACxD;IAED,OAAO,QAAQ,CAAC,IAAI,CAAC;EACzB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, Element, h, Prop, Watch } from '@stencil/core';\nimport { OpenDirection } from '../menu/menu.types';\nimport {\n createPopper,\n Instance,\n OptionsGeneric,\n Placement,\n} from '@popperjs/core';\nimport { FlipModifier } from '@popperjs/core/lib/modifiers/flip';\n\nconst IS_VISIBLE_CLASS = 'is-visible';\nconst IS_HIDING_CLASS = 'is-hiding';\nconst hideAnimationDuration = 300;\n\n/**\n * The portal component provides a way to render children into a DOM node that\n * exist outside the DOM hierarchy of the parent component.\n *\n * When the limel-portal component is used, it creates a new DOM node (a div element)\n * and appends it to a parent element (by default, the body of the document).\n * The child elements of the limel-portal are then moved from\n * their original location in the DOM to this new div element.\n *\n * This technique is often used to overcome CSS stacking context issues,\n * or to render UI elements like modals, dropdowns, tooltips, etc.,\n * that need to visually \"break out\" of their container.\n *\n * Using this component, we ensure that the content is always rendered in the\n * correct position, and never covers its own trigger, or another component\n * that is opened in the stacking layer. This way, we don't need to worry about\n * z-indexes, or other stacking context issues.\n *\n * :::important\n * There are some caveats when using this component\n *\n * 1. Events might not bubble up as expected since the content is moved out to\n * another DOM node.\n * 2. Any styling that is applied to content from the parent will be lost, if the\n * content is just another web-component it will work without any issues.\n * Alternatively, use the `style=\"\"` html attribute.\n * 3. Any component that is placed inside the container must have a style of\n * `max-height: inherit`. This ensures that its placement is calculated\n * correctly in relation to the trigger, and that it never covers its own\n * trigger.\n * 4. When the node is moved in the DOM, `disconnectedCallback` and\n * `connectedCallback` will be invoked, so if `disconnectedCallback` is used\n * to do any tear-down, the appropriate setup will have to be done again on\n * `connectedCallback`.\n * :::\n *\n * @slot - Content to put inside the portal\n * @private\n * @exampleComponent limel-example-portal-basic\n */\n@Component({\n tag: 'limel-portal',\n shadow: true,\n styleUrl: 'portal.scss',\n})\nexport class Portal {\n /**\n * Decides which direction the portal content should open.\n */\n @Prop({ reflect: true })\n public openDirection: OpenDirection = 'bottom';\n\n /**\n * Position of the content.\n */\n @Prop({ reflect: true })\n public position: 'fixed' | 'absolute' = 'absolute';\n\n /**\n * A unique ID.\n */\n @Prop({ reflect: true })\n public containerId: string;\n\n /**\n * Dynamic styling that can be applied to the container holding the content.\n */\n @Prop()\n public containerStyle: object = {};\n\n /**\n * Used to make a dropdown have the same width as the trigger, for example\n * in `limel-picker`.\n */\n @Prop({ reflect: true })\n public inheritParentWidth = false;\n\n /**\n * True if the content within the portal should be visible.\n *\n * If the content is from within a dialog for instance, this can be set to\n * true from false when the dialog opens to position the content properly.\n */\n @Prop({ reflect: true })\n public visible = false;\n\n /**\n * The element that the content should be positioned relative to.\n * Defaults to the limel-portal element.\n */\n @Prop()\n public anchor?: HTMLElement = null;\n\n @Element()\n private host: HTMLLimelPortalElement;\n\n private parents: WeakMap<HTMLElement, HTMLElement>;\n private container: HTMLElement;\n private popperInstance: Instance;\n private loaded = false;\n private observer: ResizeObserver;\n\n constructor() {\n this.parents = new WeakMap();\n }\n\n public disconnectedCallback() {\n this.removeContainer();\n this.destroyPopper();\n if (this.observer && this.container) {\n this.observer.unobserve(this.container);\n }\n\n this.container = null;\n }\n\n public connectedCallback() {\n if (!this.loaded) {\n return;\n }\n\n if (this.visible) {\n this.init();\n }\n }\n\n public componentDidLoad() {\n this.loaded = true;\n this.connectedCallback();\n }\n\n private init() {\n if (!this.host.isConnected) {\n return;\n }\n\n this.createContainer();\n this.hideContainer();\n this.attachContainer();\n this.styleContainer();\n\n if (this.visible) {\n this.createPopper();\n this.showContainer();\n }\n\n if ('ResizeObserver' in window) {\n this.observer = new ResizeObserver(() => {\n if (this.popperInstance) {\n this.styleContainer();\n this.popperInstance.update();\n }\n });\n this.observer.observe(this.container);\n }\n }\n\n public render() {\n return <slot />;\n }\n\n @Watch('visible')\n protected onVisible() {\n if (!this.container && this.visible) {\n this.init();\n\n return;\n }\n\n if (!this.visible) {\n this.animateHideAndCleanup();\n\n return;\n }\n\n this.styleContainer();\n this.createPopper();\n requestAnimationFrame(() => {\n this.showContainer();\n });\n }\n\n private createContainer() {\n const slot: HTMLSlotElement =\n this.host.shadowRoot.querySelector('slot');\n const content =\n (slot.assignedElements && slot.assignedElements()) || [];\n\n this.container = document.createElement('div');\n this.container.setAttribute('id', this.containerId);\n this.container.setAttribute('class', 'limel-portal--container');\n Object.assign(this.container, {\n portalSource: this.host,\n });\n\n content.forEach((element: HTMLElement) => {\n this.parents.set(element, element.parentElement);\n this.container.appendChild(element);\n });\n }\n\n private attachContainer() {\n this.getParent().appendChild(this.container);\n }\n\n private removeContainer() {\n if (!this.container) {\n return;\n }\n\n Array.from(this.container.children).forEach((element: HTMLElement) => {\n const parent = this.parents.get(element);\n if (!parent) {\n return;\n }\n\n parent.appendChild(element);\n });\n\n this.container.parentElement.removeChild(this.container);\n }\n\n private hideContainer() {\n if (!this.container) {\n return;\n }\n\n this.container.classList.remove(IS_VISIBLE_CLASS);\n }\n\n private showContainer() {\n this.container.classList.add(IS_VISIBLE_CLASS);\n }\n\n private animateHideAndCleanup() {\n if (!this.container) {\n return;\n }\n\n this.container.classList.add(IS_HIDING_CLASS);\n this.styleContainer();\n\n setTimeout(() => {\n this.container.classList.remove(IS_HIDING_CLASS);\n if (!this.visible) {\n this.container.classList.remove(IS_VISIBLE_CLASS);\n this.destroyPopper();\n }\n }, hideAnimationDuration);\n }\n\n private styleContainer() {\n this.setContainerWidth();\n this.setContainerHeight();\n this.setContainerStyles();\n }\n\n private setContainerWidth() {\n const hostWidth = this.host.getBoundingClientRect().width;\n\n if (this.inheritParentWidth) {\n const containerWidth = this.getContentWidth(this.container);\n let width = containerWidth;\n if (hostWidth > 0) {\n width = hostWidth;\n }\n\n this.container.style.width = `${width}px`;\n }\n }\n\n private getContentWidth(element: HTMLElement | Element) {\n if (!element) {\n return null;\n }\n\n const width = element.getBoundingClientRect().width;\n if (width !== 0) {\n return width;\n }\n\n const elementContent = element.querySelector('*');\n\n return this.getContentWidth(elementContent);\n }\n\n private setContainerStyles() {\n Object.keys(this.containerStyle).forEach((property) => {\n this.container.style[property] = this.containerStyle[property];\n });\n }\n\n private createPopper() {\n const config = this.createPopperConfig();\n\n this.popperInstance = createPopper(\n this.anchor || this.host,\n this.container,\n config,\n );\n }\n\n private destroyPopper() {\n this.popperInstance?.destroy();\n this.popperInstance = null;\n }\n\n private createPopperConfig(): Partial<\n OptionsGeneric<Partial<FlipModifier>>\n > {\n const placement = this.getPlacement(this.openDirection);\n const flipPlacement = this.getFlipPlacement(this.openDirection);\n\n return {\n strategy: this.position,\n placement: placement,\n modifiers: [\n {\n name: 'flip',\n options: {\n fallbackPlacements: [flipPlacement],\n },\n },\n ],\n };\n }\n\n private getPlacement(direction: OpenDirection): Placement {\n const placements: Record<OpenDirection, Placement> = {\n 'left-start': 'left-start',\n left: 'left',\n 'left-end': 'left-end',\n 'right-start': 'right-start',\n right: 'right',\n 'right-end': 'right-end',\n 'top-start': 'top-start',\n top: 'top',\n 'top-end': 'top-end',\n 'bottom-start': 'bottom-start',\n bottom: 'bottom',\n 'bottom-end': 'bottom-end',\n };\n\n return placements[direction];\n }\n\n private getFlipPlacement(direction: OpenDirection): Placement {\n const flipPlacements: Record<OpenDirection, Placement> = {\n 'left-start': 'right-start',\n left: 'right',\n 'left-end': 'right-end',\n 'right-start': 'left-start',\n right: 'left',\n 'right-end': 'left-end',\n 'top-start': 'bottom-start',\n top: 'bottom',\n 'top-end': 'bottom-end',\n 'bottom-start': 'top-start',\n bottom: 'top',\n 'bottom-end': 'top-end',\n };\n\n return flipPlacements[direction];\n }\n\n private setContainerHeight() {\n const viewHeight = Math.max(\n document.documentElement.clientHeight || 0,\n window.innerHeight || 0,\n );\n\n const { top, bottom } = this.host.getBoundingClientRect();\n const spaceAboveTopOfSurface = Math.max(top, 0);\n const spaceBelowTopOfSurface = Math.max(viewHeight - bottom, 0);\n const extraCosmeticSpace = 16;\n const maxHeight =\n Math.max(spaceAboveTopOfSurface, spaceBelowTopOfSurface) -\n extraCosmeticSpace;\n\n this.container.style.maxHeight = `${maxHeight}px`;\n }\n\n // Returns the parent element where the content of the portal will be moved to.\n // It needs to have styling of the portal container.\n private getParent() {\n let element: Element | undefined = this.anchor || this.host;\n\n while (element) {\n const parent = element.closest('.limel-portal--parent');\n if (parent) {\n return parent;\n }\n\n element = (element.getRootNode() as ShadowRoot).host;\n }\n\n return document.body;\n }\n}\n"]}
|
|
@@ -1200,14 +1200,14 @@ body.tabulator-print-fullscreen-hide > *:not(.tabulator-print-fullscreen) {
|
|
|
1200
1200
|
}
|
|
1201
1201
|
.tabulator#tabulator-table .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=desc] .tabulator-arrow {
|
|
1202
1202
|
height: 0;
|
|
1203
|
-
transform: translate3d(0, 0.2rem, 0);
|
|
1203
|
+
transform: translate3d(0, -0.2rem, 0) rotate(180deg);
|
|
1204
1204
|
border-top-width: 0.25rem;
|
|
1205
1205
|
border-bottom-width: 0;
|
|
1206
1206
|
border-top-color: var(--table-arrow-color--active);
|
|
1207
1207
|
}
|
|
1208
1208
|
.tabulator#tabulator-table .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=asc] .tabulator-arrow {
|
|
1209
1209
|
height: 0;
|
|
1210
|
-
transform: translate3d(0,
|
|
1210
|
+
transform: translate3d(0, 0.2rem, 0) rotate(180deg);
|
|
1211
1211
|
border-top-width: 0;
|
|
1212
1212
|
border-bottom-width: 0.25rem;
|
|
1213
1213
|
border-bottom-color: var(--table-arrow-color--active);
|
|
@@ -2041,13 +2041,13 @@ const Portal = class {
|
|
|
2041
2041
|
this.showContainer();
|
|
2042
2042
|
}
|
|
2043
2043
|
if ('ResizeObserver' in window) {
|
|
2044
|
-
|
|
2044
|
+
this.observer = new ResizeObserver(() => {
|
|
2045
2045
|
if (this.popperInstance) {
|
|
2046
2046
|
this.styleContainer();
|
|
2047
2047
|
this.popperInstance.update();
|
|
2048
2048
|
}
|
|
2049
2049
|
});
|
|
2050
|
-
observer.observe(this.container);
|
|
2050
|
+
this.observer.observe(this.container);
|
|
2051
2051
|
}
|
|
2052
2052
|
}
|
|
2053
2053
|
render() {
|