diff --git a/netbox/project-static/dist/netbox.js.map b/netbox/project-static/dist/netbox.js.map index f65842504..b750759cc 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/package.json b/netbox/project-static/package.json index d99434544..e29d639fe 100644 --- a/netbox/project-static/package.json +++ b/netbox/project-static/package.json @@ -40,6 +40,7 @@ "devDependencies": { "@types/bootstrap": "5.2.10", "@types/cookie": "^0.5.1", + "@types/node": "^20.11.16", "@typescript-eslint/eslint-plugin": "^5.39.0", "@typescript-eslint/parser": "^5.39.0", "esbuild": "^0.13.15", diff --git a/netbox/project-static/src/select/dynamic.ts b/netbox/project-static/src/select/dynamic.ts index 360077c11..3b210d411 100644 --- a/netbox/project-static/src/select/dynamic.ts +++ b/netbox/project-static/src/select/dynamic.ts @@ -1,14 +1,14 @@ +import { TomOption } from 'tom-select/src/types'; +import { escape_html } from 'tom-select/src/utils'; +import { DynamicTomSelect } from './classes/dynamicTomSelect'; import { getElements } from '../util'; -import { DynamicTomSelect } from './classes/dynamicTomSelect' const VALUE_FIELD = 'id'; const LABEL_FIELD = 'display'; const MAX_OPTIONS = 100; - // Render the HTML for a dropdown option -function renderOption(data: any, escape: Function) { - +function renderOption(data: TomOption, escape: typeof escape_html) { // If the option has a `_depth` property, indent its label if (typeof data._depth === 'number' && data._depth > 0) { return `
${'─'.repeat(data._depth)} ${escape(data[LABEL_FIELD])}
`; @@ -17,10 +17,8 @@ function renderOption(data: any, escape: Function) { return `
${escape(data[LABEL_FIELD])}
`; } - // Initialize elements with statically-defined options export function initStaticSelects(): void { - - for (const select of getElements('select:not(.api-select):not(.color-select)')) { + for (const select of getElements( + 'select:not(.api-select):not(.color-select)', + )) { new TomSelect(select, { - plugins: ['clear_button'] + plugins: ['clear_button'], }); } - } // Initialize color selection fields export function initColorSelects(): void { - for (const select of getElements('select.color-select')) { new TomSelect(select, { render: { - option: function(item: TomOption, escape: Function) { + option: function (item: TomOption, escape: typeof escape_html) { return `
${escape(item.text)}
`; - } - } + }, + }, }); } - -} \ No newline at end of file +} diff --git a/netbox/project-static/tsconfig.json b/netbox/project-static/tsconfig.json index 69b4bb664..aed225c35 100644 --- a/netbox/project-static/tsconfig.json +++ b/netbox/project-static/tsconfig.json @@ -3,7 +3,7 @@ "forceConsistentCasingInFileNames": true, "allowSyntheticDefaultImports": true, "moduleResolution": "node", - "noUnusedParameters": true, + "noUnusedParameters": false, "esModuleInterop": true, "isolatedModules": true, "noUnusedLocals": true, diff --git a/netbox/project-static/yarn.lock b/netbox/project-static/yarn.lock index 97a82ce96..9aa66d10c 100644 --- a/netbox/project-static/yarn.lock +++ b/netbox/project-static/yarn.lock @@ -150,6 +150,13 @@ resolved "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz" integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= +"@types/node@^20.11.16": + version "20.11.16" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.16.tgz#4411f79411514eb8e2926f036c86c9f0e4ec6708" + integrity sha512-gKb0enTmRCzXSSUJDq6/sPcqrfCv2mkkG6Jt/clpn5eiCbKTY+SgZUxo+p8ZKMof5dCp9vHQUAB7wOUTod22wQ== + dependencies: + undici-types "~5.26.4" + "@typescript-eslint/eslint-plugin@^5.39.0": version "5.39.0" resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.39.0.tgz" @@ -2233,6 +2240,11 @@ unbox-primitive@^1.0.2: has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== + uri-js@^4.2.2: version "4.4.1" resolved "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz"