Chore: remove popper preventOverflow fix (#9306)

This commit is contained in:
shamoon 2025-03-05 12:47:21 -08:00 committed by GitHub
parent f8aaa5cb32
commit bed82215a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 13 additions and 19 deletions

View File

@ -34,7 +34,7 @@ import {
CustomFieldQueryElement, CustomFieldQueryElement,
CustomFieldQueryExpression, CustomFieldQueryExpression,
} from 'src/app/utils/custom-field-query-element' } from 'src/app/utils/custom-field-query-element'
import { popperOptionsReenablePreventOverflow } from 'src/app/utils/popper-options' import { pngxPopperOptions } from 'src/app/utils/popper-options'
import { LoadingComponentWithPermissions } from '../../loading-component/loading.component' import { LoadingComponentWithPermissions } from '../../loading-component/loading.component'
import { ClearableBadgeComponent } from '../clearable-badge/clearable-badge.component' import { ClearableBadgeComponent } from '../clearable-badge/clearable-badge.component'
import { DocumentLinkComponent } from '../input/document-link/document-link.component' import { DocumentLinkComponent } from '../input/document-link/document-link.component'
@ -183,7 +183,7 @@ export class CustomFieldsQueryDropdownComponent extends LoadingComponentWithPerm
public CustomFieldDataType = CustomFieldDataType public CustomFieldDataType = CustomFieldDataType
public CUSTOM_FIELD_QUERY_MAX_DEPTH = CUSTOM_FIELD_QUERY_MAX_DEPTH public CUSTOM_FIELD_QUERY_MAX_DEPTH = CUSTOM_FIELD_QUERY_MAX_DEPTH
public CUSTOM_FIELD_QUERY_MAX_ATOMS = CUSTOM_FIELD_QUERY_MAX_ATOMS public CUSTOM_FIELD_QUERY_MAX_ATOMS = CUSTOM_FIELD_QUERY_MAX_ATOMS
public popperOptions = popperOptionsReenablePreventOverflow public popperOptions = pngxPopperOptions
@Input() @Input()
title: string title: string

View File

@ -19,7 +19,7 @@ import { debounceTime } from 'rxjs/operators'
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe' import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
import { SettingsService } from 'src/app/services/settings.service' import { SettingsService } from 'src/app/services/settings.service'
import { ISODateAdapter } from 'src/app/utils/ngb-iso-date-adapter' import { ISODateAdapter } from 'src/app/utils/ngb-iso-date-adapter'
import { popperOptionsReenablePreventOverflow } from 'src/app/utils/popper-options' import { pngxPopperOptions } from 'src/app/utils/popper-options'
import { ClearableBadgeComponent } from '../clearable-badge/clearable-badge.component' import { ClearableBadgeComponent } from '../clearable-badge/clearable-badge.component'
export interface DateSelection { export interface DateSelection {
@ -55,7 +55,7 @@ export enum RelativeDate {
], ],
}) })
export class DatesDropdownComponent implements OnInit, OnDestroy { export class DatesDropdownComponent implements OnInit, OnDestroy {
public popperOptions = popperOptionsReenablePreventOverflow public popperOptions = pngxPopperOptions
constructor(settings: SettingsService) { constructor(settings: SettingsService) {
this.datePlaceHolder = settings.getLocalizedDateInputFormat() this.datePlaceHolder = settings.getLocalizedDateInputFormat()

View File

@ -17,7 +17,7 @@ import { ObjectWithPermissions } from 'src/app/data/object-with-permissions'
import { FilterPipe } from 'src/app/pipes/filter.pipe' import { FilterPipe } from 'src/app/pipes/filter.pipe'
import { HotKeyService } from 'src/app/services/hot-key.service' import { HotKeyService } from 'src/app/services/hot-key.service'
import { SelectionDataItem } from 'src/app/services/rest/document.service' import { SelectionDataItem } from 'src/app/services/rest/document.service'
import { popperOptionsReenablePreventOverflow } from 'src/app/utils/popper-options' import { pngxPopperOptions } from 'src/app/utils/popper-options'
import { LoadingComponentWithPermissions } from '../../loading-component/loading.component' import { LoadingComponentWithPermissions } from '../../loading-component/loading.component'
import { ClearableBadgeComponent } from '../clearable-badge/clearable-badge.component' import { ClearableBadgeComponent } from '../clearable-badge/clearable-badge.component'
import { import {
@ -380,7 +380,7 @@ export class FilterableDropdownComponent
@ViewChild('dropdown') dropdown: NgbDropdown @ViewChild('dropdown') dropdown: NgbDropdown
@ViewChild('buttonItems') buttonItems: ElementRef @ViewChild('buttonItems') buttonItems: ElementRef
public popperOptions = popperOptionsReenablePreventOverflow public popperOptions = pngxPopperOptions
filterText: string filterText: string

View File

@ -1,11 +1,10 @@
import { Options } from '@popperjs/core' import { Options } from '@popperjs/core'
import { popperOptionsReenablePreventOverflow } from './popper-options' import { pngxPopperOptions } from './popper-options'
describe('popperOptionsReenablePreventOverflow', () => { describe('popperOptionsReenablePreventOverflow', () => {
it('should return the config without the empty fun preventOverflow, add padding to other', () => { it('should return the config with add padding', () => {
const config: Partial<Options> = { const config: Partial<Options> = {
modifiers: [ modifiers: [
{ name: 'preventOverflow', fn: function () {} },
{ {
name: 'preventOverflow', name: 'preventOverflow',
fn: function (arg0) { fn: function (arg0) {
@ -15,7 +14,7 @@ describe('popperOptionsReenablePreventOverflow', () => {
], ],
} }
const result = popperOptionsReenablePreventOverflow(config) const result = pngxPopperOptions(config)
expect(result.modifiers.length).toBe(1) expect(result.modifiers.length).toBe(1)
expect(result.modifiers[0].name).toBe('preventOverflow') expect(result.modifiers[0].name).toBe('preventOverflow')

View File

@ -1,16 +1,11 @@
import { Options } from '@popperjs/core' import { Options } from '@popperjs/core'
export function popperOptionsReenablePreventOverflow( export function pngxPopperOptions(config: Partial<Options>): Partial<Options> {
config: Partial<Options> const preventOverflowModifier = config.modifiers.find(
): Partial<Options> {
config.modifiers = config.modifiers?.filter(
(m) => !(m.name === 'preventOverflow' && m.fn?.length === 0)
)
const ogPreventOverflowModifier = config.modifiers.find(
(m) => m.name === 'preventOverflow' (m) => m.name === 'preventOverflow'
) )
if (ogPreventOverflowModifier) { if (preventOverflowModifier) {
ogPreventOverflowModifier.options = { preventOverflowModifier.options = {
padding: 10, padding: 10,
} }
} }