diff --git a/netbox/project-static/dist/config.js b/netbox/project-static/dist/config.js index 5c80270d6..feeaacd2f 100644 Binary files a/netbox/project-static/dist/config.js and b/netbox/project-static/dist/config.js differ diff --git a/netbox/project-static/dist/config.js.map b/netbox/project-static/dist/config.js.map index a955a3759..672c0d7a7 100644 Binary files a/netbox/project-static/dist/config.js.map and b/netbox/project-static/dist/config.js.map differ diff --git a/netbox/project-static/dist/jobs.js.map b/netbox/project-static/dist/jobs.js.map index 1dc717dfb..4013840f9 100644 Binary files a/netbox/project-static/dist/jobs.js.map and b/netbox/project-static/dist/jobs.js.map differ diff --git a/netbox/project-static/dist/lldp.js.map b/netbox/project-static/dist/lldp.js.map index 615a15440..44d85ee92 100644 Binary files a/netbox/project-static/dist/lldp.js.map and b/netbox/project-static/dist/lldp.js.map differ diff --git a/netbox/project-static/dist/netbox.js b/netbox/project-static/dist/netbox.js index b2d9f32ed..9ee643578 100644 Binary files a/netbox/project-static/dist/netbox.js and b/netbox/project-static/dist/netbox.js differ diff --git a/netbox/project-static/dist/netbox.js.map b/netbox/project-static/dist/netbox.js.map index 6c7dc5fd0..28146bcfd 100644 Binary files a/netbox/project-static/dist/netbox.js.map and b/netbox/project-static/dist/netbox.js.map differ diff --git a/netbox/project-static/dist/status.js b/netbox/project-static/dist/status.js index a376aefce..5d1bcd298 100644 Binary files a/netbox/project-static/dist/status.js and b/netbox/project-static/dist/status.js differ diff --git a/netbox/project-static/dist/status.js.map b/netbox/project-static/dist/status.js.map index 864a28efa..801f473e5 100644 Binary files a/netbox/project-static/dist/status.js.map and b/netbox/project-static/dist/status.js.map differ diff --git a/netbox/project-static/src/global.d.ts b/netbox/project-static/src/global.d.ts index e0a52735a..3bb06ff43 100644 --- a/netbox/project-static/src/global.d.ts +++ b/netbox/project-static/src/global.d.ts @@ -40,6 +40,8 @@ type APIAnswer = { results: T[]; }; +type APIAnswerWithNext = Exclude, 'next'> & { next: string }; + type ErrorBase = { error: string; }; diff --git a/netbox/project-static/src/select/api.ts b/netbox/project-static/src/select/api.ts index dc1a9f1a5..3c8af1cf9 100644 --- a/netbox/project-static/src/select/api.ts +++ b/netbox/project-static/src/select/api.ts @@ -1,16 +1,19 @@ import queryString from 'query-string'; +import debounce from 'just-debounce-it'; import { readableColor } from 'color2k'; import SlimSelect from 'slim-select'; import { createToast } from '../bs'; import { hasUrl, hasExclusions, isTrigger } from './util'; import { isTruthy, + hasMore, hasError, getElement, getApiData, isApiError, getElements, createElement, + uniqueByProperty, findFirstAdjacent, } from '../util'; @@ -88,6 +91,12 @@ class APISelect { */ private readonly loadEvent: InstanceType; + /** + * Event to be dispatched when the scroll position of this element's optinos list is at the + * bottom. + */ + private readonly bottomEvent: InstanceType; + /** * SlimSelect instance for this element. */ @@ -132,6 +141,17 @@ class APISelect { */ private queryUrl: string = ''; + /** + * Scroll position of options is at the bottom of the list, or not. Used to determine if + * additional options should be fetched from the API. + */ + private atBottom: boolean = false; + + /** + * API URL for additional options, if applicable. `null` indicates no options remain. + */ + private more: Nullable = null; + /** * This element's options come from the server pre-sorted and should not be sorted client-side. * Determined by the existence of the `pre-sorted` attribute on the base `