From 92fee3e0a09565ab62836cd6c82b4829efbc36e1 Mon Sep 17 00:00:00 2001 From: salam Date: Mon, 18 Aug 2025 07:22:05 +0200 Subject: [PATCH] wip --- app/Providers/AppServiceProvider.php | 2 + bin/build.js | 71 + composer.lock | 12 +- package-lock.json | 179 +- package.json | 1 + resources/js/dist/components/tabulator.js | 24898 ++++++++++++++++ .../views/filament/pages/monitor.blade.php | 42 + 7 files changed, 25110 insertions(+), 95 deletions(-) create mode 100644 bin/build.js create mode 100644 resources/js/dist/components/tabulator.js diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index b6a93d54..7ca028ca 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,6 +2,7 @@ namespace App\Providers; +use Filament\Support\Assets\AlpineComponent; use Filament\Support\Assets\Css; use Filament\Support\Facades\FilamentAsset; use Illuminate\Support\ServiceProvider; @@ -23,6 +24,7 @@ class AppServiceProvider extends ServiceProvider { FilamentAsset::register([ Css::make('tabulator-stylesheet', __DIR__.'/../../node_modules/tabulator-tables/dist/css/tabulator.min.css')->loadedOnRequest(), + AlpineComponent::make('tabulator', __DIR__.'/../../resources/js/dist/components/tabulator.js'), ]); } } diff --git a/bin/build.js b/bin/build.js new file mode 100644 index 00000000..18723ce3 --- /dev/null +++ b/bin/build.js @@ -0,0 +1,71 @@ +import * as esbuild from "esbuild"; + +const isDev = process.argv.includes("--dev"); + +async function compile(options) { + const context = await esbuild.context(options); + + if (isDev) { + await context.watch(); + } else { + await context.rebuild(); + await context.dispose(); + } +} + +const defaultOptions = { + define: { + "process.env.NODE_ENV": isDev ? `'development'` : `'production'`, + }, + bundle: true, + mainFields: ["module", "main"], + platform: "neutral", + sourcemap: isDev ? "inline" : false, + sourcesContent: isDev, + treeShaking: true, + target: ["es2020"], + minify: !isDev, + plugins: [ + { + name: "watchPlugin", + setup(build) { + build.onStart(() => { + console.log( + `Build started at ${new Date( + Date.now() + ).toLocaleTimeString()}: ${ + build.initialOptions.outfile + }` + ); + }); + + build.onEnd((result) => { + if (result.errors.length > 0) { + console.log( + `Build failed at ${new Date( + Date.now() + ).toLocaleTimeString()}: ${ + build.initialOptions.outfile + }`, + result.errors + ); + } else { + console.log( + `Build finished at ${new Date( + Date.now() + ).toLocaleTimeString()}: ${ + build.initialOptions.outfile + }` + ); + } + }); + }, + }, + ], +}; + +compile({ + ...defaultOptions, + entryPoints: ["./node_modules/tabulator-tables/dist/js/tabulator.min.js"], + outfile: "./resources/js/dist/components/tabulator.js", +}); diff --git a/composer.lock b/composer.lock index 7bfe3501..e7a34aa2 100644 --- a/composer.lock +++ b/composer.lock @@ -10542,16 +10542,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.6.2", + "version": "5.6.3", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "92dde6a5919e34835c506ac8c523ef095a95ed62" + "reference": "94f8051919d1b0369a6bcc7931d679a511c03fe9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/92dde6a5919e34835c506ac8c523ef095a95ed62", - "reference": "92dde6a5919e34835c506ac8c523ef095a95ed62", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94f8051919d1b0369a6bcc7931d679a511c03fe9", + "reference": "94f8051919d1b0369a6bcc7931d679a511c03fe9", "shasum": "" }, "require": { @@ -10600,9 +10600,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.2" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.3" }, - "time": "2025-04-13T19:20:35+00:00" + "time": "2025-08-01T19:43:32+00:00" }, { "name": "phpdocumentor/type-resolver", diff --git a/package-lock.json b/package-lock.json index fce49b7f..cdd76850 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,25 +11,12 @@ "@tailwindcss/vite": "^4.1.11", "axios": "^1.11.0", "concurrently": "^9.0.1", + "esbuild": "^0.25.9", "laravel-vite-plugin": "^2.0.0", "tailwindcss": "^4.1.11", "vite": "^7.0.4" } }, - "node_modules/@ampproject/remapping": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", - "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.24" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/@esbuild/aix-ppc64": { "version": "0.25.9", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.9.tgz", @@ -496,6 +483,17 @@ "@jridgewell/trace-mapping": "^0.3.24" } }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, "node_modules/@jridgewell/resolve-uri": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", @@ -805,25 +803,25 @@ ] }, "node_modules/@tailwindcss/node": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.1.11.tgz", - "integrity": "sha512-yzhzuGRmv5QyU9qLNg4GTlYI6STedBWRE7NjxP45CsFYYq9taI0zJXZBMqIC/c8fViNLhmrbpSFS57EoxUmD6Q==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.1.12.tgz", + "integrity": "sha512-3hm9brwvQkZFe++SBt+oLjo4OLDtkvlE8q2WalaD/7QWaeM7KEJbAiY/LJZUaCs7Xa8aUu4xy3uoyX4q54UVdQ==", "dev": true, "license": "MIT", "dependencies": { - "@ampproject/remapping": "^2.3.0", - "enhanced-resolve": "^5.18.1", - "jiti": "^2.4.2", + "@jridgewell/remapping": "^2.3.4", + "enhanced-resolve": "^5.18.3", + "jiti": "^2.5.1", "lightningcss": "1.30.1", "magic-string": "^0.30.17", "source-map-js": "^1.2.1", - "tailwindcss": "4.1.11" + "tailwindcss": "4.1.12" } }, "node_modules/@tailwindcss/oxide": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.1.11.tgz", - "integrity": "sha512-Q69XzrtAhuyfHo+5/HMgr1lAiPP/G40OMFAnws7xcFEYqcypZmdW8eGXaOUIeOl1dzPJBPENXgbjsOyhg2nkrg==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.1.12.tgz", + "integrity": "sha512-gM5EoKHW/ukmlEtphNwaGx45fGoEmP10v51t9unv55voWh6WrOL19hfuIdo2FjxIaZzw776/BUQg7Pck++cIVw==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -835,24 +833,24 @@ "node": ">= 10" }, "optionalDependencies": { - "@tailwindcss/oxide-android-arm64": "4.1.11", - "@tailwindcss/oxide-darwin-arm64": "4.1.11", - "@tailwindcss/oxide-darwin-x64": "4.1.11", - "@tailwindcss/oxide-freebsd-x64": "4.1.11", - "@tailwindcss/oxide-linux-arm-gnueabihf": "4.1.11", - "@tailwindcss/oxide-linux-arm64-gnu": "4.1.11", - "@tailwindcss/oxide-linux-arm64-musl": "4.1.11", - "@tailwindcss/oxide-linux-x64-gnu": "4.1.11", - "@tailwindcss/oxide-linux-x64-musl": "4.1.11", - "@tailwindcss/oxide-wasm32-wasi": "4.1.11", - "@tailwindcss/oxide-win32-arm64-msvc": "4.1.11", - "@tailwindcss/oxide-win32-x64-msvc": "4.1.11" + "@tailwindcss/oxide-android-arm64": "4.1.12", + "@tailwindcss/oxide-darwin-arm64": "4.1.12", + "@tailwindcss/oxide-darwin-x64": "4.1.12", + "@tailwindcss/oxide-freebsd-x64": "4.1.12", + "@tailwindcss/oxide-linux-arm-gnueabihf": "4.1.12", + "@tailwindcss/oxide-linux-arm64-gnu": "4.1.12", + "@tailwindcss/oxide-linux-arm64-musl": "4.1.12", + "@tailwindcss/oxide-linux-x64-gnu": "4.1.12", + "@tailwindcss/oxide-linux-x64-musl": "4.1.12", + "@tailwindcss/oxide-wasm32-wasi": "4.1.12", + "@tailwindcss/oxide-win32-arm64-msvc": "4.1.12", + "@tailwindcss/oxide-win32-x64-msvc": "4.1.12" } }, "node_modules/@tailwindcss/oxide-android-arm64": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.1.11.tgz", - "integrity": "sha512-3IfFuATVRUMZZprEIx9OGDjG3Ou3jG4xQzNTvjDoKmU9JdmoCohQJ83MYd0GPnQIu89YoJqvMM0G3uqLRFtetg==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.1.12.tgz", + "integrity": "sha512-oNY5pq+1gc4T6QVTsZKwZaGpBb2N1H1fsc1GD4o7yinFySqIuRZ2E4NvGasWc6PhYJwGK2+5YT1f9Tp80zUQZQ==", "cpu": [ "arm64" ], @@ -867,9 +865,9 @@ } }, "node_modules/@tailwindcss/oxide-darwin-arm64": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.1.11.tgz", - "integrity": "sha512-ESgStEOEsyg8J5YcMb1xl8WFOXfeBmrhAwGsFxxB2CxY9evy63+AtpbDLAyRkJnxLy2WsD1qF13E97uQyP1lfQ==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.1.12.tgz", + "integrity": "sha512-cq1qmq2HEtDV9HvZlTtrj671mCdGB93bVY6J29mwCyaMYCP/JaUBXxrQQQm7Qn33AXXASPUb2HFZlWiiHWFytw==", "cpu": [ "arm64" ], @@ -884,9 +882,9 @@ } }, "node_modules/@tailwindcss/oxide-darwin-x64": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.1.11.tgz", - "integrity": "sha512-EgnK8kRchgmgzG6jE10UQNaH9Mwi2n+yw1jWmof9Vyg2lpKNX2ioe7CJdf9M5f8V9uaQxInenZkOxnTVL3fhAw==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.1.12.tgz", + "integrity": "sha512-6UCsIeFUcBfpangqlXay9Ffty9XhFH1QuUFn0WV83W8lGdX8cD5/+2ONLluALJD5+yJ7k8mVtwy3zMZmzEfbLg==", "cpu": [ "x64" ], @@ -901,9 +899,9 @@ } }, "node_modules/@tailwindcss/oxide-freebsd-x64": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.1.11.tgz", - "integrity": "sha512-xdqKtbpHs7pQhIKmqVpxStnY1skuNh4CtbcyOHeX1YBE0hArj2romsFGb6yUmzkq/6M24nkxDqU8GYrKrz+UcA==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.1.12.tgz", + "integrity": "sha512-JOH/f7j6+nYXIrHobRYCtoArJdMJh5zy5lr0FV0Qu47MID/vqJAY3r/OElPzx1C/wdT1uS7cPq+xdYYelny1ww==", "cpu": [ "x64" ], @@ -918,9 +916,9 @@ } }, "node_modules/@tailwindcss/oxide-linux-arm-gnueabihf": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.1.11.tgz", - "integrity": "sha512-ryHQK2eyDYYMwB5wZL46uoxz2zzDZsFBwfjssgB7pzytAeCCa6glsiJGjhTEddq/4OsIjsLNMAiMlHNYnkEEeg==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.1.12.tgz", + "integrity": "sha512-v4Ghvi9AU1SYgGr3/j38PD8PEe6bRfTnNSUE3YCMIRrrNigCFtHZ2TCm8142X8fcSqHBZBceDx+JlFJEfNg5zQ==", "cpu": [ "arm" ], @@ -935,9 +933,9 @@ } }, "node_modules/@tailwindcss/oxide-linux-arm64-gnu": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.1.11.tgz", - "integrity": "sha512-mYwqheq4BXF83j/w75ewkPJmPZIqqP1nhoghS9D57CLjsh3Nfq0m4ftTotRYtGnZd3eCztgbSPJ9QhfC91gDZQ==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.1.12.tgz", + "integrity": "sha512-YP5s1LmetL9UsvVAKusHSyPlzSRqYyRB0f+Kl/xcYQSPLEw/BvGfxzbH+ihUciePDjiXwHh+p+qbSP3SlJw+6g==", "cpu": [ "arm64" ], @@ -952,9 +950,9 @@ } }, "node_modules/@tailwindcss/oxide-linux-arm64-musl": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.1.11.tgz", - "integrity": "sha512-m/NVRFNGlEHJrNVk3O6I9ggVuNjXHIPoD6bqay/pubtYC9QIdAMpS+cswZQPBLvVvEF6GtSNONbDkZrjWZXYNQ==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.1.12.tgz", + "integrity": "sha512-V8pAM3s8gsrXcCv6kCHSuwyb/gPsd863iT+v1PGXC4fSL/OJqsKhfK//v8P+w9ThKIoqNbEnsZqNy+WDnwQqCA==", "cpu": [ "arm64" ], @@ -969,9 +967,9 @@ } }, "node_modules/@tailwindcss/oxide-linux-x64-gnu": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.1.11.tgz", - "integrity": "sha512-YW6sblI7xukSD2TdbbaeQVDysIm/UPJtObHJHKxDEcW2exAtY47j52f8jZXkqE1krdnkhCMGqP3dbniu1Te2Fg==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.1.12.tgz", + "integrity": "sha512-xYfqYLjvm2UQ3TZggTGrwxjYaLB62b1Wiysw/YE3Yqbh86sOMoTn0feF98PonP7LtjsWOWcXEbGqDL7zv0uW8Q==", "cpu": [ "x64" ], @@ -986,9 +984,9 @@ } }, "node_modules/@tailwindcss/oxide-linux-x64-musl": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.1.11.tgz", - "integrity": "sha512-e3C/RRhGunWYNC3aSF7exsQkdXzQ/M+aYuZHKnw4U7KQwTJotnWsGOIVih0s2qQzmEzOFIJ3+xt7iq67K/p56Q==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.1.12.tgz", + "integrity": "sha512-ha0pHPamN+fWZY7GCzz5rKunlv9L5R8kdh+YNvP5awe3LtuXb5nRi/H27GeL2U+TdhDOptU7T6Is7mdwh5Ar3A==", "cpu": [ "x64" ], @@ -1003,9 +1001,9 @@ } }, "node_modules/@tailwindcss/oxide-wasm32-wasi": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.1.11.tgz", - "integrity": "sha512-Xo1+/GU0JEN/C/dvcammKHzeM6NqKovG+6921MR6oadee5XPBaKOumrJCXvopJ/Qb5TH7LX/UAywbqrP4lax0g==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.1.12.tgz", + "integrity": "sha512-4tSyu3dW+ktzdEpuk6g49KdEangu3eCYoqPhWNsZgUhyegEda3M9rG0/j1GV/JjVVsj+lG7jWAyrTlLzd/WEBg==", "bundleDependencies": [ "@napi-rs/wasm-runtime", "@emnapi/core", @@ -1021,11 +1019,11 @@ "license": "MIT", "optional": true, "dependencies": { - "@emnapi/core": "^1.4.3", - "@emnapi/runtime": "^1.4.3", - "@emnapi/wasi-threads": "^1.0.2", - "@napi-rs/wasm-runtime": "^0.2.11", - "@tybys/wasm-util": "^0.9.0", + "@emnapi/core": "^1.4.5", + "@emnapi/runtime": "^1.4.5", + "@emnapi/wasi-threads": "^1.0.4", + "@napi-rs/wasm-runtime": "^0.2.12", + "@tybys/wasm-util": "^0.10.0", "tslib": "^2.8.0" }, "engines": { @@ -1033,9 +1031,9 @@ } }, "node_modules/@tailwindcss/oxide-win32-arm64-msvc": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.1.11.tgz", - "integrity": "sha512-UgKYx5PwEKrac3GPNPf6HVMNhUIGuUh4wlDFR2jYYdkX6pL/rn73zTq/4pzUm8fOjAn5L8zDeHp9iXmUGOXZ+w==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.1.12.tgz", + "integrity": "sha512-iGLyD/cVP724+FGtMWslhcFyg4xyYyM+5F4hGvKA7eifPkXHRAUDFaimu53fpNg9X8dfP75pXx/zFt/jlNF+lg==", "cpu": [ "arm64" ], @@ -1050,9 +1048,9 @@ } }, "node_modules/@tailwindcss/oxide-win32-x64-msvc": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.1.11.tgz", - "integrity": "sha512-YfHoggn1j0LK7wR82TOucWc5LDCguHnoS879idHekmmiR7g9HUtMw9MI0NHatS28u/Xlkfi9w5RJWgz2Dl+5Qg==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.1.12.tgz", + "integrity": "sha512-NKIh5rzw6CpEodv/++r0hGLlfgT/gFN+5WNdZtvh6wpU2BpGNgdjvj6H2oFc8nCM839QM1YOhjpgbAONUb4IxA==", "cpu": [ "x64" ], @@ -1067,15 +1065,15 @@ } }, "node_modules/@tailwindcss/vite": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@tailwindcss/vite/-/vite-4.1.11.tgz", - "integrity": "sha512-RHYhrR3hku0MJFRV+fN2gNbDNEh3dwKvY8XJvTxCSXeMOsCRSr+uKvDWQcbizrHgjML6ZmTE5OwMrl5wKcujCw==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@tailwindcss/vite/-/vite-4.1.12.tgz", + "integrity": "sha512-4pt0AMFDx7gzIrAOIYgYP0KCBuKWqyW8ayrdiLEjoJTT4pKTjrzG/e4uzWtTLDziC+66R9wbUqZBccJalSE5vQ==", "dev": true, "license": "MIT", "dependencies": { - "@tailwindcss/node": "4.1.11", - "@tailwindcss/oxide": "4.1.11", - "tailwindcss": "4.1.11" + "@tailwindcss/node": "4.1.12", + "@tailwindcss/oxide": "4.1.12", + "tailwindcss": "4.1.12" }, "peerDependencies": { "vite": "^5.2.0 || ^6 || ^7" @@ -1419,11 +1417,14 @@ } }, "node_modules/fdir": { - "version": "6.4.6", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.6.tgz", - "integrity": "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", "dev": true, "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, "peerDependencies": { "picomatch": "^3 || ^4" }, @@ -2194,9 +2195,9 @@ "license": "MIT" }, "node_modules/tailwindcss": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.11.tgz", - "integrity": "sha512-2E9TBm6MDD/xKYe+dvJZAmg3yxIEDNRc0jwlNyDg/4Fil2QcSLjFKGVff0lAf1jjeaArlG/M75Ey/EYr/OJtBA==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.12.tgz", + "integrity": "sha512-DzFtxOi+7NsFf7DBtI3BJsynR+0Yp6etH+nRPTbpWnS2pZBaSksv/JGctNwSWzbFjp0vxSqknaUylseZqMDGrA==", "dev": true, "license": "MIT" }, diff --git a/package.json b/package.json index 0100784c..cb9358d2 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "@tailwindcss/vite": "^4.1.11", "axios": "^1.11.0", "concurrently": "^9.0.1", + "esbuild": "^0.25.9", "laravel-vite-plugin": "^2.0.0", "tailwindcss": "^4.1.11", "vite": "^7.0.4" diff --git a/resources/js/dist/components/tabulator.js b/resources/js/dist/components/tabulator.js new file mode 100644 index 00000000..e12b52c6 --- /dev/null +++ b/resources/js/dist/components/tabulator.js @@ -0,0 +1,24898 @@ +var yi = Object.defineProperty; +var Ri = (P, C, j) => + C in P + ? yi(P, C, { enumerable: !0, configurable: !0, writable: !0, value: j }) + : (P[C] = j); +var xi = (P, C) => () => (C || P((C = { exports: {} }).exports, C), C.exports); +var b = (P, C, j) => Ri(P, typeof C != "symbol" ? C + "" : C, j); +var Ti = xi((oe, ne) => { + (function (P, C) { + typeof oe == "object" && typeof ne < "u" + ? (ne.exports = C()) + : typeof define == "function" && define.amd + ? define(C) + : ((P = + typeof globalThis < "u" ? globalThis : P || self).Tabulator = + C()); + })(oe, function () { + "use strict"; + var It, + Nt, + Wt, + jt, + Gt, + Ut, + Jt, + qt, + Xt, + Kt, + Yt, + Qt, + Zt, + $t, + te, + ct, + at, + ut, + ee, + ie; + var P = { + debugEventsExternal: !1, + debugEventsInternal: !1, + debugInvalidOptions: !0, + debugInvalidComponentFuncs: !0, + debugInitialization: !0, + debugDeprecation: !0, + height: !1, + minHeight: !1, + maxHeight: !1, + columnHeaderVertAlign: "top", + popupContainer: !1, + columns: [], + columnDefaults: {}, + rowHeader: !1, + data: !1, + autoColumns: !1, + autoColumnsDefinitions: !1, + nestedFieldSeparator: ".", + footerElement: !1, + index: "id", + textDirection: "auto", + addRowPos: "bottom", + headerVisible: !0, + renderVertical: "virtual", + renderHorizontal: "basic", + renderVerticalBuffer: 0, + scrollToRowPosition: "top", + scrollToRowIfVisible: !0, + scrollToColumnPosition: "left", + scrollToColumnIfVisible: !0, + rowFormatter: !1, + rowFormatterPrint: null, + rowFormatterClipboard: null, + rowFormatterHtmlOutput: null, + rowHeight: null, + placeholder: !1, + dataLoader: !0, + dataLoaderLoading: !1, + dataLoaderError: !1, + dataLoaderErrorTimeout: 3e3, + dataSendParams: {}, + dataReceiveParams: {}, + dependencies: {}, + }; + class C { + constructor(t) { + this.table = t; + } + reloadData(t, e, i) { + return this.table.dataLoader.load( + t, + void 0, + void 0, + void 0, + e, + i + ); + } + langText() { + return this.table.modules.localize.getText(...arguments); + } + langBind() { + return this.table.modules.localize.bind(...arguments); + } + langLocale() { + return this.table.modules.localize.getLocale(...arguments); + } + commsConnections() { + return this.table.modules.comms.getConnections(...arguments); + } + commsSend() { + return this.table.modules.comms.send(...arguments); + } + layoutMode() { + return this.table.modules.layout.getMode(); + } + layoutRefresh(t) { + return this.table.modules.layout.layout(t); + } + subscribe() { + return this.table.eventBus.subscribe(...arguments); + } + unsubscribe() { + return this.table.eventBus.unsubscribe(...arguments); + } + subscribed(t) { + return this.table.eventBus.subscribed(t); + } + subscriptionChange() { + return this.table.eventBus.subscriptionChange(...arguments); + } + dispatch() { + return this.table.eventBus.dispatch(...arguments); + } + chain() { + return this.table.eventBus.chain(...arguments); + } + confirm() { + return this.table.eventBus.confirm(...arguments); + } + dispatchExternal() { + return this.table.externalEvents.dispatch(...arguments); + } + subscribedExternal(t) { + return this.table.externalEvents.subscribed(t); + } + subscriptionChangeExternal() { + return this.table.externalEvents.subscriptionChange( + ...arguments + ); + } + options(t) { + return this.table.options[t]; + } + setOption(t, e) { + return ( + e !== void 0 && (this.table.options[t] = e), + this.table.options[t] + ); + } + deprecationCheck(t, e, i) { + return this.table.deprecationAdvisor.check(t, e, i); + } + deprecationCheckMsg(t, e) { + return this.table.deprecationAdvisor.checkMsg(t, e); + } + deprecationMsg(t) { + return this.table.deprecationAdvisor.msg(t); + } + module(t) { + return this.table.module(t); + } + } + class j { + constructor(t) { + return ( + (this._column = t), + (this.type = "ColumnComponent"), + new Proxy(this, { + get: function (e, i, o) { + return e[i] !== void 0 + ? e[i] + : e._column.table.componentFunctionBinder.handle( + "column", + e._column, + i + ); + }, + }) + ); + } + getElement() { + return this._column.getElement(); + } + getDefinition() { + return this._column.getDefinition(); + } + getField() { + return this._column.getField(); + } + getTitleDownload() { + return this._column.getTitleDownload(); + } + getCells() { + var t = []; + return ( + this._column.cells.forEach(function (e) { + t.push(e.getComponent()); + }), + t + ); + } + isVisible() { + return this._column.visible; + } + show() { + this._column.isGroup + ? this._column.columns.forEach(function (t) { + t.show(); + }) + : this._column.show(); + } + hide() { + this._column.isGroup + ? this._column.columns.forEach(function (t) { + t.hide(); + }) + : this._column.hide(); + } + toggle() { + this._column.visible ? this.hide() : this.show(); + } + delete() { + return this._column.delete(); + } + getSubColumns() { + var t = []; + return ( + this._column.columns.length && + this._column.columns.forEach(function (e) { + t.push(e.getComponent()); + }), + t + ); + } + getParentColumn() { + return this._column.getParentComponent(); + } + _getSelf() { + return this._column; + } + scrollTo(t, e) { + return this._column.table.columnManager.scrollToColumn( + this._column, + t, + e + ); + } + getTable() { + return this._column.table; + } + move(t, e) { + var i = this._column.table.columnManager.findColumn(t); + i + ? this._column.table.columnManager.moveColumn( + this._column, + i, + e + ) + : console.warn("Move Error - No matching column found:", i); + } + getNextColumn() { + var t = this._column.nextColumn(); + return !!t && t.getComponent(); + } + getPrevColumn() { + var t = this._column.prevColumn(); + return !!t && t.getComponent(); + } + updateDefinition(t) { + return this._column.updateDefinition(t); + } + getWidth() { + return this._column.getWidth(); + } + setWidth(t) { + var e; + return ( + (e = + t === !0 + ? this._column.reinitializeWidth(!0) + : this._column.setWidth(t)), + this._column.table.columnManager.rerenderColumns(!0), + e + ); + } + } + var re = { + title: void 0, + field: void 0, + columns: void 0, + visible: void 0, + hozAlign: void 0, + vertAlign: void 0, + width: void 0, + minWidth: 40, + maxWidth: void 0, + maxInitialWidth: void 0, + cssClass: void 0, + variableHeight: void 0, + headerVertical: void 0, + headerHozAlign: void 0, + headerWordWrap: !1, + editableTitle: void 0, + }; + class ae { + constructor(t) { + return ( + (this._cell = t), + new Proxy(this, { + get: function (e, i, o) { + return e[i] !== void 0 + ? e[i] + : e._cell.table.componentFunctionBinder.handle( + "cell", + e._cell, + i + ); + }, + }) + ); + } + getValue() { + return this._cell.getValue(); + } + getOldValue() { + return this._cell.getOldValue(); + } + getInitialValue() { + return this._cell.initialValue; + } + getElement() { + return this._cell.getElement(); + } + getRow() { + return this._cell.row.getComponent(); + } + getData(t) { + return this._cell.row.getData(t); + } + getType() { + return "cell"; + } + getField() { + return this._cell.column.getField(); + } + getColumn() { + return this._cell.column.getComponent(); + } + setValue(t, e) { + e === void 0 && (e = !0), this._cell.setValue(t, e); + } + restoreOldValue() { + this._cell.setValueActual(this._cell.getOldValue()); + } + restoreInitialValue() { + this._cell.setValueActual(this._cell.initialValue); + } + checkHeight() { + this._cell.checkHeight(); + } + getTable() { + return this._cell.table; + } + _getSelf() { + return this._cell; + } + } + class et extends C { + constructor(t, e) { + super(t.table), + (this.table = t.table), + (this.column = t), + (this.row = e), + (this.element = null), + (this.value = null), + this.initialValue, + (this.oldValue = null), + (this.modules = {}), + (this.height = null), + (this.width = null), + (this.minWidth = null), + (this.component = null), + (this.loaded = !1), + this.build(); + } + build() { + this.generateElement(), + this.setWidth(), + this._configureCell(), + this.setValueActual( + this.column.getFieldValue(this.row.data) + ), + (this.initialValue = this.value); + } + generateElement() { + (this.element = document.createElement("div")), + (this.element.className = "tabulator-cell"), + this.element.setAttribute("role", "gridcell"), + this.column.isRowHeader && + this.element.classList.add("tabulator-row-header"); + } + _configureCell() { + var t = this.element, + e = this.column.getField(); + (t.style.textAlign = this.column.hozAlign), + this.column.vertAlign && + ((t.style.display = "inline-flex"), + (t.style.alignItems = + { + top: "flex-start", + bottom: "flex-end", + middle: "center", + }[this.column.vertAlign] || ""), + this.column.hozAlign && + (t.style.justifyContent = + { + left: "flex-start", + right: "flex-end", + center: "center", + }[this.column.hozAlign] || "")), + e && t.setAttribute("tabulator-field", e), + this.column.definition.cssClass && + this.column.definition.cssClass + .split(" ") + .forEach((i) => { + t.classList.add(i); + }), + this.dispatch("cell-init", this), + this.column.visible || this.hide(); + } + _generateContents() { + var t; + switch ( + typeof (t = this.chain( + "cell-format", + this, + null, + () => (this.element.innerHTML = this.value) + )) + ) { + case "object": + if (t instanceof Node) { + for (; this.element.firstChild; ) + this.element.removeChild( + this.element.firstChild + ); + this.element.appendChild(t); + } else (this.element.innerHTML = ""), t != null && console.warn("Format Error - Formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:", t); + break; + case "undefined": + this.element.innerHTML = ""; + break; + default: + this.element.innerHTML = t; + } + } + cellRendered() { + this.dispatch("cell-rendered", this); + } + getElement(t) { + return ( + this.loaded || + ((this.loaded = !0), t || this.layoutElement()), + this.element + ); + } + getValue() { + return this.value; + } + getOldValue() { + return this.oldValue; + } + setValue(t, e, i) { + this.setValueProcessData(t, e, i) && + (this.dispatch("cell-value-updated", this), + this.cellRendered(), + this.column.definition.cellEdited && + this.column.definition.cellEdited.call( + this.table, + this.getComponent() + ), + this.dispatchExternal("cellEdited", this.getComponent()), + this.subscribedExternal("dataChanged") && + this.dispatchExternal( + "dataChanged", + this.table.rowManager.getData() + )); + } + setValueProcessData(t, e, i) { + var o = !1; + return ( + (this.value !== t || i) && + ((o = !0), + e && + (t = this.chain( + "cell-value-changing", + [this, t], + null, + t + ))), + this.setValueActual(t), + o && this.dispatch("cell-value-changed", this), + o + ); + } + setValueActual(t) { + (this.oldValue = this.value), + (this.value = t), + this.dispatch("cell-value-save-before", this), + this.column.setFieldValue(this.row.data, t), + this.dispatch("cell-value-save-after", this), + this.loaded && this.layoutElement(); + } + layoutElement() { + this._generateContents(), this.dispatch("cell-layout", this); + } + setWidth() { + (this.width = this.column.width), + (this.element.style.width = this.column.widthStyled); + } + clearWidth() { + (this.width = ""), (this.element.style.width = ""); + } + getWidth() { + return this.width || this.element.offsetWidth; + } + setMinWidth() { + (this.minWidth = this.column.minWidth), + (this.element.style.minWidth = this.column.minWidthStyled); + } + setMaxWidth() { + (this.maxWidth = this.column.maxWidth), + (this.element.style.maxWidth = this.column.maxWidthStyled); + } + checkHeight() { + this.row.reinitializeHeight(); + } + clearHeight() { + (this.element.style.height = ""), + (this.height = null), + this.dispatch("cell-height", this, ""); + } + setHeight() { + (this.height = this.row.height), + (this.element.style.height = this.row.heightStyled), + this.dispatch("cell-height", this, this.row.heightStyled); + } + getHeight() { + return this.height || this.element.offsetHeight; + } + show() { + this.element.style.display = this.column.vertAlign + ? "inline-flex" + : ""; + } + hide() { + this.element.style.display = "none"; + } + delete() { + this.dispatch("cell-delete", this), + !this.table.rowManager.redrawBlock && + this.element.parentNode && + this.element.parentNode.removeChild(this.element), + (this.element = !1), + this.column.deleteCell(this), + this.row.deleteCell(this), + (this.calcs = {}); + } + getIndex() { + return this.row.getCellIndex(this); + } + getComponent() { + return ( + this.component || (this.component = new ae(this)), + this.component + ); + } + } + let J = class J extends C { + constructor(t, e, i) { + super(e.table), + (this.definition = t), + (this.parent = e), + (this.type = "column"), + (this.columns = []), + (this.cells = []), + (this.isGroup = !1), + (this.isRowHeader = i), + (this.element = this.createElement()), + (this.contentElement = !1), + (this.titleHolderElement = !1), + (this.titleElement = !1), + (this.groupElement = this.createGroupElement()), + (this.hozAlign = ""), + (this.vertAlign = ""), + (this.field = ""), + (this.fieldStructure = ""), + (this.getFieldValue = ""), + (this.setFieldValue = ""), + (this.titleDownload = null), + (this.titleFormatterRendered = !1), + this.mapDefinitions(), + this.setField(this.definition.field), + (this.modules = {}), + (this.width = null), + (this.widthStyled = ""), + (this.maxWidth = null), + (this.maxWidthStyled = ""), + (this.maxInitialWidth = null), + (this.minWidth = null), + (this.minWidthStyled = ""), + (this.widthFixed = !1), + (this.visible = !0), + (this.component = null), + this.definition.columns + ? ((this.isGroup = !0), + this.definition.columns.forEach((o, n) => { + var r = new J(o, this); + this.attachColumn(r); + }), + this.checkColumnVisibility()) + : e.registerColumnField(this), + this._initialize(); + } + createElement() { + var t = document.createElement("div"); + switch ( + (t.classList.add("tabulator-col"), + t.setAttribute("role", "columnheader"), + t.setAttribute("aria-sort", "none"), + this.isRowHeader && t.classList.add("tabulator-row-header"), + this.table.options.columnHeaderVertAlign) + ) { + case "middle": + t.style.justifyContent = "center"; + break; + case "bottom": + t.style.justifyContent = "flex-end"; + } + return t; + } + createGroupElement() { + var t = document.createElement("div"); + return t.classList.add("tabulator-col-group-cols"), t; + } + mapDefinitions() { + var t = this.table.options.columnDefaults; + if (t) + for (let e in t) + this.definition[e] === void 0 && + (this.definition[e] = t[e]); + this.definition = this.table.columnManager.optionsList.generate( + J.defaultOptionList, + this.definition + ); + } + checkDefinition() { + Object.keys(this.definition).forEach((t) => { + J.defaultOptionList.indexOf(t) === -1 && + console.warn( + "Invalid column definition option in '" + + (this.field || this.definition.title) + + "' column:", + t + ); + }); + } + setField(t) { + (this.field = t), + (this.fieldStructure = t + ? this.table.options.nestedFieldSeparator + ? t.split(this.table.options.nestedFieldSeparator) + : [t] + : []), + (this.getFieldValue = + this.fieldStructure.length > 1 + ? this._getNestedData + : this._getFlatData), + (this.setFieldValue = + this.fieldStructure.length > 1 + ? this._setNestedData + : this._setFlatData); + } + registerColumnPosition(t) { + this.parent.registerColumnPosition(t); + } + registerColumnField(t) { + this.parent.registerColumnField(t); + } + reRegisterPosition() { + this.isGroup + ? this.columns.forEach(function (t) { + t.reRegisterPosition(); + }) + : this.registerColumnPosition(this); + } + _initialize() { + for (var t = this.definition; this.element.firstChild; ) + this.element.removeChild(this.element.firstChild); + t.headerVertical && + (this.element.classList.add("tabulator-col-vertical"), + t.headerVertical === "flip" && + this.element.classList.add( + "tabulator-col-vertical-flip" + )), + (this.contentElement = this._buildColumnHeaderContent()), + this.element.appendChild(this.contentElement), + this.isGroup + ? this._buildGroupHeader() + : this._buildColumnHeader(), + this.dispatch("column-init", this); + } + _buildColumnHeader() { + var t = this.definition; + this.dispatch("column-layout", this), + t.visible !== void 0 && + (t.visible ? this.show(!0) : this.hide(!0)), + t.cssClass && + t.cssClass.split(" ").forEach((e) => { + this.element.classList.add(e); + }), + t.field && + this.element.setAttribute("tabulator-field", t.field), + this.setMinWidth(parseInt(t.minWidth)), + t.maxInitialWidth && + (this.maxInitialWidth = parseInt(t.maxInitialWidth)), + t.maxWidth && this.setMaxWidth(parseInt(t.maxWidth)), + this.reinitializeWidth(), + (this.hozAlign = this.definition.hozAlign), + (this.vertAlign = this.definition.vertAlign), + (this.titleElement.style.textAlign = + this.definition.headerHozAlign); + } + _buildColumnHeaderContent() { + var t = document.createElement("div"); + return ( + t.classList.add("tabulator-col-content"), + (this.titleHolderElement = document.createElement("div")), + this.titleHolderElement.classList.add( + "tabulator-col-title-holder" + ), + t.appendChild(this.titleHolderElement), + (this.titleElement = this._buildColumnHeaderTitle()), + this.titleHolderElement.appendChild(this.titleElement), + t + ); + } + _buildColumnHeaderTitle() { + var t = this.definition, + e = document.createElement("div"); + if ( + (e.classList.add("tabulator-col-title"), + t.headerWordWrap && + e.classList.add("tabulator-col-title-wrap"), + t.editableTitle) + ) { + var i = document.createElement("input"); + i.classList.add("tabulator-title-editor"), + i.addEventListener("click", (o) => { + o.stopPropagation(), i.focus(); + }), + i.addEventListener("mousedown", (o) => { + o.stopPropagation(); + }), + i.addEventListener("change", () => { + (t.title = i.value), + this.dispatchExternal( + "columnTitleChanged", + this.getComponent() + ); + }), + e.appendChild(i), + t.field + ? this.langBind("columns|" + t.field, (o) => { + i.value = o || t.title || " "; + }) + : (i.value = t.title || " "); + } else + t.field + ? this.langBind("columns|" + t.field, (o) => { + this._formatColumnHeaderTitle( + e, + o || t.title || " " + ); + }) + : this._formatColumnHeaderTitle(e, t.title || " "); + return e; + } + _formatColumnHeaderTitle(t, e) { + var i = this.chain( + "column-format", + [this, e, t], + null, + () => e + ); + switch (typeof i) { + case "object": + i instanceof Node + ? t.appendChild(i) + : ((t.innerHTML = ""), + console.warn( + "Format Error - Title formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:", + i + )); + break; + case "undefined": + t.innerHTML = ""; + break; + default: + t.innerHTML = i; + } + } + _buildGroupHeader() { + this.element.classList.add("tabulator-col-group"), + this.element.setAttribute("role", "columngroup"), + this.element.setAttribute( + "aria-title", + this.definition.title + ), + this.definition.cssClass && + this.definition.cssClass.split(" ").forEach((t) => { + this.element.classList.add(t); + }), + (this.titleElement.style.textAlign = + this.definition.headerHozAlign), + this.element.appendChild(this.groupElement); + } + _getFlatData(t) { + return t[this.field]; + } + _getNestedData(t) { + var e, + i = t, + o = this.fieldStructure, + n = o.length; + for (let r = 0; r < n && ((e = i = i[o[r]]), i); r++); + return e; + } + _setFlatData(t, e) { + this.field && (t[this.field] = e); + } + _setNestedData(t, e) { + var i = t, + o = this.fieldStructure, + n = o.length; + for (let r = 0; r < n; r++) + if (r == n - 1) i[o[r]] = e; + else { + if (!i[o[r]]) { + if (e === void 0) break; + i[o[r]] = {}; + } + i = i[o[r]]; + } + } + attachColumn(t) { + this.groupElement + ? (this.columns.push(t), + this.groupElement.appendChild(t.getElement()), + t.columnRendered()) + : console.warn( + "Column Warning - Column being attached to another column instead of column group" + ); + } + verticalAlign(t, e) { + var i = this.parent.isGroup + ? this.parent.getGroupElement().clientHeight + : e || this.parent.getHeadersElement().clientHeight; + (this.element.style.height = i + "px"), + this.dispatch( + "column-height", + this, + this.element.style.height + ), + this.isGroup && + (this.groupElement.style.minHeight = + i - this.contentElement.offsetHeight + "px"), + this.columns.forEach(function (o) { + o.verticalAlign(t); + }); + } + clearVerticalAlign() { + (this.element.style.paddingTop = ""), + (this.element.style.height = ""), + (this.element.style.minHeight = ""), + (this.groupElement.style.minHeight = ""), + this.columns.forEach(function (t) { + t.clearVerticalAlign(); + }), + this.dispatch("column-height", this, ""); + } + getElement() { + return this.element; + } + getGroupElement() { + return this.groupElement; + } + getField() { + return this.field; + } + getTitleDownload() { + return this.titleDownload; + } + getFirstColumn() { + return this.isGroup + ? !!this.columns.length && this.columns[0].getFirstColumn() + : this; + } + getLastColumn() { + return this.isGroup + ? !!this.columns.length && + this.columns[this.columns.length - 1].getLastColumn() + : this; + } + getColumns(t) { + var e = []; + return ( + t + ? this.columns.forEach((i) => { + e.push(i), (e = e.concat(i.getColumns(!0))); + }) + : (e = this.columns), + e + ); + } + getCells() { + return this.cells; + } + getTopColumn() { + return this.parent.isGroup ? this.parent.getTopColumn() : this; + } + getDefinition(t) { + var e = []; + return ( + this.isGroup && + t && + (this.columns.forEach(function (i) { + e.push(i.getDefinition(!0)); + }), + (this.definition.columns = e)), + this.definition + ); + } + checkColumnVisibility() { + var t = !1; + this.columns.forEach(function (e) { + e.visible && (t = !0); + }), + t + ? (this.show(), + this.dispatchExternal( + "columnVisibilityChanged", + this.getComponent(), + !1 + )) + : this.hide(); + } + show(t, e) { + this.visible || + ((this.visible = !0), + (this.element.style.display = ""), + this.parent.isGroup && this.parent.checkColumnVisibility(), + this.cells.forEach(function (i) { + i.show(); + }), + this.isGroup || + this.width !== null || + this.reinitializeWidth(), + this.table.columnManager.verticalAlignHeaders(), + this.dispatch("column-show", this, e), + t || + this.dispatchExternal( + "columnVisibilityChanged", + this.getComponent(), + !0 + ), + this.parent.isGroup && this.parent.matchChildWidths(), + this.silent || this.table.columnManager.rerenderColumns()); + } + hide(t, e) { + this.visible && + ((this.visible = !1), + (this.element.style.display = "none"), + this.table.columnManager.verticalAlignHeaders(), + this.parent.isGroup && this.parent.checkColumnVisibility(), + this.cells.forEach(function (i) { + i.hide(); + }), + this.dispatch("column-hide", this, e), + t || + this.dispatchExternal( + "columnVisibilityChanged", + this.getComponent(), + !1 + ), + this.parent.isGroup && this.parent.matchChildWidths(), + this.silent || this.table.columnManager.rerenderColumns()); + } + matchChildWidths() { + var t = 0; + this.contentElement && + this.columns.length && + (this.columns.forEach(function (e) { + e.visible && (t += e.getWidth()); + }), + (this.contentElement.style.maxWidth = t - 1 + "px"), + this.table.initialized && + (this.element.style.width = t + "px"), + this.parent.isGroup && this.parent.matchChildWidths()); + } + removeChild(t) { + var e = this.columns.indexOf(t); + e > -1 && this.columns.splice(e, 1), + this.columns.length || this.delete(); + } + setWidth(t) { + (this.widthFixed = !0), this.setWidthActual(t); + } + setWidthActual(t) { + isNaN(t) && + (t = Math.floor( + (this.table.element.clientWidth / 100) * parseInt(t) + )), + (t = Math.max(this.minWidth, t)), + this.maxWidth && (t = Math.min(this.maxWidth, t)), + (this.width = t), + (this.widthStyled = t ? t + "px" : ""), + (this.element.style.width = this.widthStyled), + this.isGroup || + this.cells.forEach(function (e) { + e.setWidth(); + }), + this.parent.isGroup && this.parent.matchChildWidths(), + this.dispatch("column-width", this), + this.subscribedExternal("columnWidth") && + this.dispatchExternal( + "columnWidth", + this.getComponent() + ); + } + checkCellHeights() { + var t = []; + this.cells.forEach(function (e) { + e.row.heightInitialized && + (e.row.getElement().offsetParent !== null + ? (t.push(e.row), e.row.clearCellHeight()) + : (e.row.heightInitialized = !1)); + }), + t.forEach(function (e) { + e.calcHeight(); + }), + t.forEach(function (e) { + e.setCellHeight(); + }); + } + getWidth() { + var t = 0; + return ( + this.isGroup + ? this.columns.forEach(function (e) { + e.visible && (t += e.getWidth()); + }) + : (t = this.width), + t + ); + } + getLeftOffset() { + var t = this.element.offsetLeft; + return ( + this.parent.isGroup && (t += this.parent.getLeftOffset()), t + ); + } + getHeight() { + return Math.ceil(this.element.getBoundingClientRect().height); + } + setMinWidth(t) { + this.maxWidth && + t > this.maxWidth && + ((t = this.maxWidth), + console.warn( + "the minWidth (" + + t + + "px) for column '" + + this.field + + "' cannot be bigger that its maxWidth (" + + this.maxWidthStyled + + ")" + )), + (this.minWidth = t), + (this.minWidthStyled = t ? t + "px" : ""), + (this.element.style.minWidth = this.minWidthStyled), + this.cells.forEach(function (e) { + e.setMinWidth(); + }); + } + setMaxWidth(t) { + this.minWidth && + t < this.minWidth && + ((t = this.minWidth), + console.warn( + "the maxWidth (" + + t + + "px) for column '" + + this.field + + "' cannot be smaller that its minWidth (" + + this.minWidthStyled + + ")" + )), + (this.maxWidth = t), + (this.maxWidthStyled = t ? t + "px" : ""), + (this.element.style.maxWidth = this.maxWidthStyled), + this.cells.forEach(function (e) { + e.setMaxWidth(); + }); + } + delete() { + return new Promise((t, e) => { + this.isGroup && + this.columns.forEach(function (o) { + o.delete(); + }), + this.dispatch("column-delete", this); + var i = this.cells.length; + for (let o = 0; o < i; o++) this.cells[0].delete(); + this.element.parentNode && + this.element.parentNode.removeChild(this.element), + (this.element = !1), + (this.contentElement = !1), + (this.titleElement = !1), + (this.groupElement = !1), + this.parent.isGroup && this.parent.removeChild(this), + this.table.columnManager.deregisterColumn(this), + this.table.columnManager.rerenderColumns(!0), + this.dispatch("column-deleted", this), + t(); + }); + } + columnRendered() { + this.titleFormatterRendered && this.titleFormatterRendered(), + this.dispatch("column-rendered", this); + } + generateCell(t) { + var e = new et(this, t); + return this.cells.push(e), e; + } + nextColumn() { + var t = this.table.columnManager.findColumnIndex(this); + return t > -1 && this._nextVisibleColumn(t + 1); + } + _nextVisibleColumn(t) { + var e = this.table.columnManager.getColumnByIndex(t); + return !e || e.visible ? e : this._nextVisibleColumn(t + 1); + } + prevColumn() { + var t = this.table.columnManager.findColumnIndex(this); + return t > -1 && this._prevVisibleColumn(t - 1); + } + _prevVisibleColumn(t) { + var e = this.table.columnManager.getColumnByIndex(t); + return !e || e.visible ? e : this._prevVisibleColumn(t - 1); + } + reinitializeWidth(t) { + (this.widthFixed = !1), + this.definition.width === void 0 || + t || + this.setWidth(this.definition.width), + this.dispatch("column-width-fit-before", this), + this.fitToData(t), + this.dispatch("column-width-fit-after", this); + } + fitToData(t) { + if (!this.isGroup) { + this.widthFixed || + ((this.element.style.width = ""), + this.cells.forEach((o) => { + o.clearWidth(); + })); + var e = this.element.offsetWidth; + if ( + (!this.width || !this.widthFixed) && + (this.cells.forEach((o) => { + var n = o.getWidth(); + n > e && (e = n); + }), + e) + ) { + var i = e + 1; + t + ? this.setWidth(i) + : (this.maxInitialWidth && + !t && + (i = Math.min(i, this.maxInitialWidth)), + this.setWidthActual(i)); + } + } + } + updateDefinition(t) { + var e; + return this.isGroup || this.parent.isGroup + ? (console.error( + "Column Update Error - The updateDefinition function is only available on ungrouped columns" + ), + Promise.reject( + "Column Update Error - The updateDefinition function is only available on columns, not column groups" + )) + : ((e = Object.assign({}, this.getDefinition())), + (e = Object.assign(e, t)), + this.table.columnManager + .addColumn(e, !1, this) + .then( + (i) => ( + e.field == this.field && (this.field = !1), + this.delete().then(() => i.getComponent()) + ) + )); + } + deleteCell(t) { + var e = this.cells.indexOf(t); + e > -1 && this.cells.splice(e, 1); + } + getComponent() { + return ( + this.component || (this.component = new j(this)), + this.component + ); + } + getPosition() { + return ( + this.table.columnManager + .getVisibleColumnsByIndex() + .indexOf(this) + 1 + ); + } + getParentComponent() { + return this.parent instanceof J && this.parent.getComponent(); + } + }; + b(J, "defaultOptionList", re); + let G = J; + class x { + static elVisible(t) { + return !(t.offsetWidth <= 0 && t.offsetHeight <= 0); + } + static elOffset(t) { + var e = t.getBoundingClientRect(); + return { + top: + e.top + + window.pageYOffset - + document.documentElement.clientTop, + left: + e.left + + window.pageXOffset - + document.documentElement.clientLeft, + }; + } + static retrieveNestedData(t, e, i) { + var o, + n = t ? e.split(t) : [e], + r = n.length; + for (let a = 0; a < r && ((o = i = i[n[a]]), i); a++); + return o; + } + static deepClone(t, e, i = []) { + var o = {}.__proto__, + n = [].__proto__; + for (var r in (e || + (e = Object.assign(Array.isArray(t) ? [] : {}, t)), + t)) { + let a, + l, + h = t[r]; + h == null || + typeof h != "object" || + (h.__proto__ !== o && h.__proto__ !== n) || + ((a = i.findIndex((d) => d.subject === h)), + a > -1 + ? (e[r] = i[a].copy) + : ((l = Object.assign( + Array.isArray(h) ? [] : {}, + h + )), + i.unshift({ subject: h, copy: l }), + (e[r] = this.deepClone(h, l, i)))); + } + return e; + } + } + class le { + constructor(t, e, i = {}) { + (this.table = t), + (this.msgType = e), + (this.registeredDefaults = Object.assign({}, i)); + } + register(t, e) { + this.registeredDefaults[t] = e; + } + generate(t, e = {}) { + var i = Object.assign({}, this.registeredDefaults), + o = + this.table.options.debugInvalidOptions || + e.debugInvalidOptions === !0; + Object.assign(i, t); + for (let n in e) + i.hasOwnProperty(n) || + (o && + console.warn( + "Invalid " + this.msgType + " option:", + n + ), + (i[n] = e.key)); + for (let n in i) + n in e + ? (i[n] = e[n]) + : Array.isArray(i[n]) + ? (i[n] = Object.assign([], i[n])) + : typeof i[n] == "object" && i[n] !== null + ? (i[n] = Object.assign({}, i[n])) + : i[n] === void 0 && delete i[n]; + return i; + } + } + class lt extends C { + constructor(t) { + super(t), + (this.elementVertical = t.rowManager.element), + (this.elementHorizontal = t.columnManager.element), + (this.tableElement = t.rowManager.tableElement), + (this.verticalFillMode = "fit"); + } + initialize() {} + clearRows() {} + clearColumns() {} + reinitializeColumnWidths(t) {} + renderRows() {} + renderColumns() {} + rerenderRows(t) { + t && t(); + } + rerenderColumns(t, e) {} + renderRowCells(t) {} + rerenderRowCells(t, e) {} + scrollColumns(t, e) {} + scrollRows(t, e) {} + resize() {} + scrollToRow(t) {} + scrollToRowNearestTop(t) {} + visibleRows(t) { + return []; + } + rows() { + return this.table.rowManager.getDisplayRows(); + } + styleRow(t, e) { + var i = t.getElement(); + e % 2 + ? (i.classList.add("tabulator-row-even"), + i.classList.remove("tabulator-row-odd")) + : (i.classList.add("tabulator-row-odd"), + i.classList.remove("tabulator-row-even")); + } + clear() { + this.clearRows(), this.clearColumns(); + } + render() { + this.renderRows(), this.renderColumns(); + } + rerender(t) { + this.rerenderRows(), this.rerenderColumns(); + } + scrollToRowPosition(t, e, i) { + var o = this.rows().indexOf(t), + n = t.getElement(), + r = 0; + return new Promise((a, l) => { + if (o > -1) { + if ( + (i === void 0 && + (i = this.table.options.scrollToRowIfVisible), + !i && + x.elVisible(n) && + (r = + x.elOffset(n).top - + x.elOffset(this.elementVertical).top) > 0 && + r < + this.elementVertical.clientHeight - + n.offsetHeight) + ) + return a(), !1; + switch ( + (e === void 0 && + (e = this.table.options.scrollToRowPosition), + e === "nearest" && + (e = this.scrollToRowNearestTop(t) + ? "top" + : "bottom"), + this.scrollToRow(t), + e) + ) { + case "middle": + case "center": + this.elementVertical.scrollHeight - + this.elementVertical.scrollTop == + this.elementVertical.clientHeight + ? (this.elementVertical.scrollTop = + this.elementVertical.scrollTop + + (n.offsetTop - + this.elementVertical.scrollTop) - + (this.elementVertical.scrollHeight - + n.offsetTop) / + 2) + : (this.elementVertical.scrollTop = + this.elementVertical.scrollTop - + this.elementVertical.clientHeight / + 2); + break; + case "bottom": + this.elementVertical.scrollHeight - + this.elementVertical.scrollTop == + this.elementVertical.clientHeight + ? (this.elementVertical.scrollTop = + this.elementVertical.scrollTop - + (this.elementVertical.scrollHeight - + n.offsetTop) + + n.offsetHeight) + : (this.elementVertical.scrollTop = + this.elementVertical.scrollTop - + this.elementVertical.clientHeight + + n.offsetHeight); + break; + case "top": + this.elementVertical.scrollTop = n.offsetTop; + } + a(); + } else + console.warn("Scroll Error - Row not visible"), + l("Scroll Error - Row not visible"); + }); + } + } + class ve extends lt { + constructor(t) { + super(t); + } + renderRowCells(t, e) { + let i = document.createDocumentFragment(); + t.cells.forEach((o) => { + i.appendChild(o.getElement()); + }), + t.element.appendChild(i), + e || + t.cells.forEach((o) => { + o.cellRendered(); + }); + } + reinitializeColumnWidths(t) { + t.forEach(function (e) { + e.reinitializeWidth(); + }); + } + } + class we extends lt { + constructor(t) { + super(t), + (this.leftCol = 0), + (this.rightCol = 0), + (this.scrollLeft = 0), + (this.vDomScrollPosLeft = 0), + (this.vDomScrollPosRight = 0), + (this.vDomPadLeft = 0), + (this.vDomPadRight = 0), + (this.fitDataColAvg = 0), + (this.windowBuffer = 200), + (this.visibleRows = null), + (this.initialized = !1), + (this.isFitData = !1), + (this.columns = []); + } + initialize() { + this.compatibilityCheck(), + this.layoutCheck(), + this.vertScrollListen(); + } + compatibilityCheck() { + this.options("layout") == "fitDataTable" && + console.warn( + "Horizontal Virtual DOM is not compatible with fitDataTable layout mode" + ), + this.options("responsiveLayout") && + console.warn( + "Horizontal Virtual DOM is not compatible with responsive columns" + ), + this.options("rtl") && + console.warn( + "Horizontal Virtual DOM is not currently compatible with RTL text direction" + ); + } + layoutCheck() { + this.isFitData = this.options("layout").startsWith("fitData"); + } + vertScrollListen() { + this.subscribe( + "scroll-vertical", + this.clearVisRowCache.bind(this) + ), + this.subscribe( + "data-refreshed", + this.clearVisRowCache.bind(this) + ); + } + clearVisRowCache() { + this.visibleRows = null; + } + renderColumns(t, e) { + this.dataChange(); + } + scrollColumns(t, e) { + this.scrollLeft != t && + ((this.scrollLeft = t), + this.scroll( + t - (this.vDomScrollPosLeft + this.windowBuffer) + )); + } + calcWindowBuffer() { + var t = this.elementVertical.clientWidth; + this.table.columnManager.columnsByIndex.forEach((e) => { + if (e.visible) { + var i = e.getWidth(); + i > t && (t = i); + } + }), + (this.windowBuffer = 2 * t); + } + rerenderColumns(t, e) { + var i = { + cols: this.columns, + leftCol: this.leftCol, + rightCol: this.rightCol, + }, + o = 0; + (t && !this.initialized) || + (this.clear(), + this.calcWindowBuffer(), + (this.scrollLeft = this.elementVertical.scrollLeft), + (this.vDomScrollPosLeft = + this.scrollLeft - this.windowBuffer), + (this.vDomScrollPosRight = + this.scrollLeft + + this.elementVertical.clientWidth + + this.windowBuffer), + this.table.columnManager.columnsByIndex.forEach((n) => { + var r, + a = {}; + n.visible && + (n.modules.frozen || + ((r = n.getWidth()), + (a.leftPos = o), + (a.rightPos = o + r), + (a.width = r), + this.isFitData && + (a.fitDataCheck = + !n.modules.vdomHoz || + n.modules.vdomHoz.fitDataCheck), + o + r > this.vDomScrollPosLeft && + o < this.vDomScrollPosRight + ? (this.leftCol == -1 && + ((this.leftCol = this.columns.length), + (this.vDomPadLeft = o)), + (this.rightCol = this.columns.length)) + : this.leftCol !== -1 && + (this.vDomPadRight += r), + this.columns.push(n), + (n.modules.vdomHoz = a), + (o += r))); + }), + (this.tableElement.style.paddingLeft = + this.vDomPadLeft + "px"), + (this.tableElement.style.paddingRight = + this.vDomPadRight + "px"), + (this.initialized = !0), + e || + (t && !this.reinitChanged(i)) || + this.reinitializeRows(), + (this.elementVertical.scrollLeft = this.scrollLeft)); + } + renderRowCells(t) { + if (this.initialized) this.initializeRow(t); + else { + let e = document.createDocumentFragment(); + t.cells.forEach((i) => { + e.appendChild(i.getElement()); + }), + t.element.appendChild(e), + t.cells.forEach((i) => { + i.cellRendered(); + }); + } + } + rerenderRowCells(t, e) { + this.reinitializeRow(t, e); + } + reinitializeColumnWidths(t) { + for (let e = this.leftCol; e <= this.rightCol; e++) { + let i = this.columns[e]; + i && i.reinitializeWidth(); + } + } + deinitialize() { + this.initialized = !1; + } + clear() { + (this.columns = []), + (this.leftCol = -1), + (this.rightCol = 0), + (this.vDomScrollPosLeft = 0), + (this.vDomScrollPosRight = 0), + (this.vDomPadLeft = 0), + (this.vDomPadRight = 0); + } + dataChange() { + var t, + e, + i = !1; + if (this.isFitData) { + if ( + (this.table.columnManager.columnsByIndex.forEach( + (o) => { + !o.definition.width && o.visible && (i = !0); + } + ), + i && + this.table.rowManager.getDisplayRows().length && + ((this.vDomScrollPosRight = + this.scrollLeft + + this.elementVertical.clientWidth + + this.windowBuffer), + (t = this.chain("rows-sample", [1], [], () => + this.table.rowManager.getDisplayRows() + )[0]))) + ) { + (e = t.getElement()), + t.generateCells(), + this.tableElement.appendChild(e); + for (let o = 0; o < t.cells.length; o++) { + let n = t.cells[o]; + e.appendChild(n.getElement()), + n.column.reinitializeWidth(); + } + e.parentNode.removeChild(e), + this.rerenderColumns(!1, !0); + } + } else this.options("layout") === "fitColumns" && (this.layoutRefresh(), this.rerenderColumns(!1, !0)); + } + reinitChanged(t) { + var e = !0; + return ( + t.cols.length !== this.columns.length || + t.leftCol !== this.leftCol || + t.rightCol !== this.rightCol || + (t.cols.forEach((i, o) => { + i !== this.columns[o] && (e = !1); + }), + !e) + ); + } + reinitializeRows() { + var t = this.getVisibleRows(), + e = this.table.rowManager + .getRows() + .filter((i) => !t.includes(i)); + t.forEach((i) => { + this.reinitializeRow(i, !0); + }), + e.forEach((i) => { + i.deinitialize(); + }); + } + getVisibleRows() { + return ( + this.visibleRows || + (this.visibleRows = + this.table.rowManager.getVisibleRows()), + this.visibleRows + ); + } + scroll(t) { + (this.vDomScrollPosLeft += t), + (this.vDomScrollPosRight += t), + Math.abs(t) > this.windowBuffer / 2 + ? this.rerenderColumns() + : t > 0 + ? (this.addColRight(), this.removeColLeft()) + : (this.addColLeft(), this.removeColRight()); + } + colPositionAdjust(t, e, i) { + for (let o = t; o < e; o++) { + let n = this.columns[o]; + (n.modules.vdomHoz.leftPos += i), + (n.modules.vdomHoz.rightPos += i); + } + } + addColRight() { + for (var t = !1, e = !0; e; ) { + let i = this.columns[this.rightCol + 1]; + i && i.modules.vdomHoz.leftPos <= this.vDomScrollPosRight + ? ((t = !0), + this.getVisibleRows().forEach((o) => { + if (o.type !== "group") { + var n = o.getCell(i); + o + .getElement() + .insertBefore( + n.getElement(), + o + .getCell( + this.columns[this.rightCol] + ) + .getElement().nextSibling + ), + n.cellRendered(); + } + }), + this.fitDataColActualWidthCheck(i), + this.rightCol++, + this.getVisibleRows().forEach((o) => { + o.type !== "group" && + (o.modules.vdomHoz.rightCol = this.rightCol); + }), + this.rightCol >= this.columns.length - 1 + ? (this.vDomPadRight = 0) + : (this.vDomPadRight -= i.getWidth())) + : (e = !1); + } + t && + (this.tableElement.style.paddingRight = + this.vDomPadRight + "px"); + } + addColLeft() { + for (var t = !1, e = !0; e; ) { + let i = this.columns[this.leftCol - 1]; + if (i) + if ( + i.modules.vdomHoz.rightPos >= this.vDomScrollPosLeft + ) { + (t = !0), + this.getVisibleRows().forEach((n) => { + if (n.type !== "group") { + var r = n.getCell(i); + n + .getElement() + .insertBefore( + r.getElement(), + n + .getCell( + this.columns[ + this.leftCol + ] + ) + .getElement() + ), + r.cellRendered(); + } + }), + this.leftCol--, + this.getVisibleRows().forEach((n) => { + n.type !== "group" && + (n.modules.vdomHoz.leftCol = + this.leftCol); + }), + this.leftCol <= 0 + ? (this.vDomPadLeft = 0) + : (this.vDomPadLeft -= i.getWidth()); + let o = this.fitDataColActualWidthCheck(i); + o && + ((this.scrollLeft = + this.elementVertical.scrollLeft = + this.elementVertical.scrollLeft + o), + (this.vDomPadRight -= o)); + } else e = !1; + else e = !1; + } + t && + (this.tableElement.style.paddingLeft = + this.vDomPadLeft + "px"); + } + removeColRight() { + for (var t = !1, e = !0; e; ) { + let i = this.columns[this.rightCol]; + i && i.modules.vdomHoz.leftPos > this.vDomScrollPosRight + ? ((t = !0), + this.getVisibleRows().forEach((o) => { + if (o.type !== "group") { + var n = o.getCell(i); + try { + o.getElement().removeChild( + n.getElement() + ); + } catch (r) { + console.warn( + "Could not removeColRight", + r.message + ); + } + } + }), + (this.vDomPadRight += i.getWidth()), + this.rightCol--, + this.getVisibleRows().forEach((o) => { + o.type !== "group" && + (o.modules.vdomHoz.rightCol = this.rightCol); + })) + : (e = !1); + } + t && + (this.tableElement.style.paddingRight = + this.vDomPadRight + "px"); + } + removeColLeft() { + for (var t = !1, e = !0; e; ) { + let i = this.columns[this.leftCol]; + i && i.modules.vdomHoz.rightPos < this.vDomScrollPosLeft + ? ((t = !0), + this.getVisibleRows().forEach((o) => { + if (o.type !== "group") { + var n = o.getCell(i); + try { + o.getElement().removeChild( + n.getElement() + ); + } catch (r) { + console.warn( + "Could not removeColLeft", + r.message + ); + } + } + }), + (this.vDomPadLeft += i.getWidth()), + this.leftCol++, + this.getVisibleRows().forEach((o) => { + o.type !== "group" && + (o.modules.vdomHoz.leftCol = this.leftCol); + })) + : (e = !1); + } + t && + (this.tableElement.style.paddingLeft = + this.vDomPadLeft + "px"); + } + fitDataColActualWidthCheck(t) { + var e, i; + return ( + t.modules.vdomHoz.fitDataCheck && + (t.reinitializeWidth(), + (i = (e = t.getWidth()) - t.modules.vdomHoz.width) && + ((t.modules.vdomHoz.rightPos += i), + (t.modules.vdomHoz.width = e), + this.colPositionAdjust( + this.columns.indexOf(t) + 1, + this.columns.length, + i + )), + (t.modules.vdomHoz.fitDataCheck = !1)), + i + ); + } + initializeRow(t) { + if (t.type !== "group") { + (t.modules.vdomHoz = { + leftCol: this.leftCol, + rightCol: this.rightCol, + }), + this.table.modules.frozenColumns && + this.table.modules.frozenColumns.leftColumns.forEach( + (e) => { + this.appendCell(t, e); + } + ); + for (let e = this.leftCol; e <= this.rightCol; e++) + this.appendCell(t, this.columns[e]); + this.table.modules.frozenColumns && + this.table.modules.frozenColumns.rightColumns.forEach( + (e) => { + this.appendCell(t, e); + } + ); + } + } + appendCell(t, e) { + if (e && e.visible) { + let i = t.getCell(e); + t.getElement().appendChild(i.getElement()), + i.cellRendered(); + } + } + reinitializeRow(t, e) { + if ( + t.type !== "group" && + (e || + !t.modules.vdomHoz || + t.modules.vdomHoz.leftCol !== this.leftCol || + t.modules.vdomHoz.rightCol !== this.rightCol) + ) { + for (var i = t.getElement(); i.firstChild; ) + i.removeChild(i.firstChild); + this.initializeRow(t); + } + } + } + class Ce extends C { + constructor(t) { + super(t), + (this.blockHozScrollEvent = !1), + (this.headersElement = null), + (this.contentsElement = null), + (this.rowHeader = null), + (this.element = null), + (this.columns = []), + (this.columnsByIndex = []), + (this.columnsByField = {}), + (this.scrollLeft = 0), + (this.optionsList = new le( + this.table, + "column definition", + re + )), + (this.redrawBlock = !1), + (this.redrawBlockUpdate = null), + (this.renderer = null); + } + initialize() { + this.initializeRenderer(), + (this.headersElement = this.createHeadersElement()), + (this.contentsElement = this.createHeaderContentsElement()), + (this.element = this.createHeaderElement()), + this.contentsElement.insertBefore( + this.headersElement, + this.contentsElement.firstChild + ), + this.element.insertBefore( + this.contentsElement, + this.element.firstChild + ), + this.initializeScrollWheelWatcher(), + this.subscribe( + "scroll-horizontal", + this.scrollHorizontal.bind(this) + ), + this.subscribe( + "scrollbar-vertical", + this.padVerticalScrollbar.bind(this) + ); + } + padVerticalScrollbar(t) { + this.table.rtl + ? (this.headersElement.style.marginLeft = t + "px") + : (this.headersElement.style.marginRight = t + "px"); + } + initializeRenderer() { + var t, + e = { virtual: we, basic: ve }; + (t = + typeof this.table.options.renderHorizontal == "string" + ? e[this.table.options.renderHorizontal] + : this.table.options.renderHorizontal) + ? ((this.renderer = new t( + this.table, + this.element, + this.tableElement + )), + this.renderer.initialize()) + : console.error( + "Unable to find matching renderer:", + this.table.options.renderHorizontal + ); + } + createHeadersElement() { + var t = document.createElement("div"); + return ( + t.classList.add("tabulator-headers"), + t.setAttribute("role", "row"), + t + ); + } + createHeaderContentsElement() { + var t = document.createElement("div"); + return ( + t.classList.add("tabulator-header-contents"), + t.setAttribute("role", "rowgroup"), + t + ); + } + createHeaderElement() { + var t = document.createElement("div"); + return ( + t.classList.add("tabulator-header"), + t.setAttribute("role", "rowgroup"), + this.table.options.headerVisible || + t.classList.add("tabulator-header-hidden"), + t + ); + } + getElement() { + return this.element; + } + getContentsElement() { + return this.contentsElement; + } + getHeadersElement() { + return this.headersElement; + } + scrollHorizontal(t) { + (this.contentsElement.scrollLeft = t), + (this.scrollLeft = t), + this.renderer.scrollColumns(t); + } + initializeScrollWheelWatcher() { + this.contentsElement.addEventListener("wheel", (t) => { + var e; + t.deltaX && + ((e = this.contentsElement.scrollLeft + t.deltaX), + this.table.rowManager.scrollHorizontal(e), + this.table.columnManager.scrollHorizontal(e)); + }); + } + generateColumnsFromRowData(t) { + var e = [], + i = {}, + o = this.table.options.autoColumns === "full" ? t : [t[0]], + n = this.table.options.autoColumnsDefinitions; + if (t && t.length) { + if ( + (o.forEach((r) => { + Object.keys(r).forEach((a, l) => { + let h, + d = r[a]; + i[a] + ? i[a] !== !0 && + d !== void 0 && + ((i[a].sorter = + this.calculateSorterFromValue(d)), + (i[a] = !0)) + : ((h = { + field: a, + title: a, + sorter: this.calculateSorterFromValue( + d + ), + }), + e.splice(l, 0, h), + (i[a] = d !== void 0 || h)); + }); + }), + n) + ) + switch (typeof n) { + case "function": + this.table.options.columns = n.call( + this.table, + e + ); + break; + case "object": + Array.isArray(n) + ? e.forEach((r) => { + var a = n.find( + (l) => l.field === r.field + ); + a && Object.assign(r, a); + }) + : e.forEach((r) => { + n[r.field] && + Object.assign(r, n[r.field]); + }), + (this.table.options.columns = e); + } + else this.table.options.columns = e; + this.setColumns(this.table.options.columns); + } + } + calculateSorterFromValue(t) { + var e; + switch (typeof t) { + case "undefined": + e = "string"; + break; + case "boolean": + e = "boolean"; + break; + case "number": + e = "number"; + break; + case "object": + e = Array.isArray(t) ? "array" : "string"; + break; + default: + e = + isNaN(t) || t === "" + ? t.match( + /((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i + ) + ? "alphanum" + : "string" + : "number"; + } + return e; + } + setColumns(t, e) { + for (; this.headersElement.firstChild; ) + this.headersElement.removeChild( + this.headersElement.firstChild + ); + (this.columns = []), + (this.columnsByIndex = []), + (this.columnsByField = {}), + this.dispatch("columns-loading"), + this.dispatchExternal("columnsLoading"), + this.table.options.rowHeader && + ((this.rowHeader = new G( + this.table.options.rowHeader === !0 + ? {} + : this.table.options.rowHeader, + this, + !0 + )), + this.columns.push(this.rowHeader), + this.headersElement.appendChild( + this.rowHeader.getElement() + ), + this.rowHeader.columnRendered()), + t.forEach((i, o) => { + this._addColumn(i); + }), + this._reIndexColumns(), + this.dispatch("columns-loaded"), + this.subscribedExternal("columnsLoaded") && + this.dispatchExternal( + "columnsLoaded", + this.getComponents() + ), + this.rerenderColumns(!1, !0), + this.redraw(!0); + } + _addColumn(t, e, i) { + var o = new G(t, this), + n = o.getElement(), + r = i && this.findColumnIndex(i); + if ( + (!e || + !this.rowHeader || + (i && i !== this.rowHeader) || + ((e = !1), (i = this.rowHeader), (r = 0)), + i && r > -1) + ) { + var a = i.getTopColumn(), + l = this.columns.indexOf(a), + h = a.getElement(); + e + ? (this.columns.splice(l, 0, o), + h.parentNode.insertBefore(n, h)) + : (this.columns.splice(l + 1, 0, o), + h.parentNode.insertBefore(n, h.nextSibling)); + } else e ? (this.columns.unshift(o), this.headersElement.insertBefore(o.getElement(), this.headersElement.firstChild)) : (this.columns.push(o), this.headersElement.appendChild(o.getElement())); + return o.columnRendered(), o; + } + registerColumnField(t) { + t.definition.field && + (this.columnsByField[t.definition.field] = t); + } + registerColumnPosition(t) { + this.columnsByIndex.push(t); + } + _reIndexColumns() { + (this.columnsByIndex = []), + this.columns.forEach(function (t) { + t.reRegisterPosition(); + }); + } + verticalAlignHeaders() { + var t = 0; + this.redrawBlock || + ((this.headersElement.style.height = ""), + this.columns.forEach((e) => { + e.clearVerticalAlign(); + }), + this.columns.forEach((e) => { + var i = e.getHeight(); + i > t && (t = i); + }), + (this.headersElement.style.height = t + "px"), + this.columns.forEach((e) => { + e.verticalAlign( + this.table.options.columnHeaderVertAlign, + t + ); + }), + this.table.rowManager.adjustTableSize()); + } + findColumn(t) { + var e; + return typeof t != "object" + ? this.columnsByField[t] || !1 + : t instanceof G + ? t + : t instanceof j + ? t._getSelf() || !1 + : typeof HTMLElement < "u" && t instanceof HTMLElement + ? ((e = []), + this.columns.forEach((i) => { + e.push(i), (e = e.concat(i.getColumns(!0))); + }), + e.find((i) => i.element === t) || !1) + : !1; + } + getColumnByField(t) { + return this.columnsByField[t]; + } + getColumnsByFieldRoot(t) { + var e = []; + return ( + Object.keys(this.columnsByField).forEach((i) => { + (this.table.options.nestedFieldSeparator + ? i.split( + this.table.options.nestedFieldSeparator + )[0] + : i) === t && e.push(this.columnsByField[i]); + }), + e + ); + } + getColumnByIndex(t) { + return this.columnsByIndex[t]; + } + getFirstVisibleColumn() { + var t = this.columnsByIndex.findIndex((e) => e.visible); + return t > -1 && this.columnsByIndex[t]; + } + getVisibleColumnsByIndex() { + return this.columnsByIndex.filter((t) => t.visible); + } + getColumns() { + return this.columns; + } + findColumnIndex(t) { + return this.columnsByIndex.findIndex((e) => t === e); + } + getRealColumns() { + return this.columnsByIndex; + } + traverse(t) { + this.columnsByIndex.forEach((e, i) => { + t(e, i); + }); + } + getDefinitions(t) { + var e = []; + return ( + this.columnsByIndex.forEach((i) => { + (!t || (t && i.visible)) && e.push(i.getDefinition()); + }), + e + ); + } + getDefinitionTree() { + var t = []; + return ( + this.columns.forEach((e) => { + t.push(e.getDefinition(!0)); + }), + t + ); + } + getComponents(t) { + var e = []; + return ( + (t ? this.columns : this.columnsByIndex).forEach((i) => { + e.push(i.getComponent()); + }), + e + ); + } + getWidth() { + var t = 0; + return ( + this.columnsByIndex.forEach((e) => { + e.visible && (t += e.getWidth()); + }), + t + ); + } + moveColumn(t, e, i) { + e.element.parentNode.insertBefore(t.element, e.element), + i && + e.element.parentNode.insertBefore(e.element, t.element), + this.moveColumnActual(t, e, i), + this.verticalAlignHeaders(), + this.table.rowManager.reinitialize(); + } + moveColumnActual(t, e, i) { + t.parent.isGroup + ? this._moveColumnInArray(t.parent.columns, t, e, i) + : this._moveColumnInArray(this.columns, t, e, i), + this._moveColumnInArray(this.columnsByIndex, t, e, i, !0), + this.rerenderColumns(!0), + this.dispatch("column-moved", t, e, i), + this.subscribedExternal("columnMoved") && + this.dispatchExternal( + "columnMoved", + t.getComponent(), + this.table.columnManager.getComponents() + ); + } + _moveColumnInArray(t, e, i, o, n) { + var r, + a = t.indexOf(e); + a > -1 && + (t.splice(a, 1), + (r = t.indexOf(i)) > -1 ? o && (r += 1) : (r = a), + t.splice(r, 0, e), + n && + ( + this.chain( + "column-moving-rows", + [e, i, o], + null, + [] + ) || [] + ) + .concat(this.table.rowManager.rows) + .forEach(function (l) { + if (l.cells.length) { + var h = l.cells.splice(a, 1)[0]; + l.cells.splice(r, 0, h); + } + })); + } + scrollToColumn(t, e, i) { + var o = 0, + n = t.getLeftOffset(), + r = 0, + a = t.getElement(); + return new Promise((l, h) => { + if ( + (e === void 0 && + (e = this.table.options.scrollToColumnPosition), + i === void 0 && + (i = this.table.options.scrollToColumnIfVisible), + t.visible) + ) { + switch (e) { + case "middle": + case "center": + r = -this.element.clientWidth / 2; + break; + case "right": + r = + a.clientWidth - + this.headersElement.clientWidth; + } + if ( + !i && + n > 0 && + n + a.offsetWidth < this.element.clientWidth + ) + return !1; + (o = n + r), + (o = Math.max( + Math.min( + o, + this.table.rowManager.element.scrollWidth - + this.table.rowManager.element + .clientWidth + ), + 0 + )), + this.table.rowManager.scrollHorizontal(o), + this.scrollHorizontal(o), + l(); + } else + console.warn("Scroll Error - Column not visible"), + h("Scroll Error - Column not visible"); + }); + } + generateCells(t) { + var e = []; + return ( + this.columnsByIndex.forEach((i) => { + e.push(i.generateCell(t)); + }), + e + ); + } + getFlexBaseWidth() { + var t = this.table.element.clientWidth, + e = 0; + return ( + this.table.rowManager.element.scrollHeight > + this.table.rowManager.element.clientHeight && + (t -= + this.table.rowManager.element.offsetWidth - + this.table.rowManager.element.clientWidth), + this.columnsByIndex.forEach(function (i) { + var o, n, r; + i.visible && + ((o = i.definition.width || 0), + (n = parseInt(i.minWidth)), + (r = + typeof o == "string" + ? o.indexOf("%") > -1 + ? (t / 100) * parseInt(o) + : parseInt(o) + : o), + (e += r > n ? r : n)); + }), + e + ); + } + addColumn(t, e, i) { + return new Promise((o, n) => { + var r = this._addColumn(t, e, i); + this._reIndexColumns(), + this.dispatch("column-add", t, e, i), + this.layoutMode() != "fitColumns" && + r.reinitializeWidth(), + this.redraw(!0), + this.table.rowManager.reinitialize(), + this.rerenderColumns(), + o(r); + }); + } + deregisterColumn(t) { + var e, + i = t.getField(); + i && delete this.columnsByField[i], + (e = this.columnsByIndex.indexOf(t)) > -1 && + this.columnsByIndex.splice(e, 1), + (e = this.columns.indexOf(t)) > -1 && + this.columns.splice(e, 1), + this.verticalAlignHeaders(), + this.redraw(); + } + rerenderColumns(t, e) { + this.redrawBlock + ? (t === !1 || + (t === !0 && this.redrawBlockUpdate === null)) && + (this.redrawBlockUpdate = t) + : this.renderer.rerenderColumns(t, e); + } + blockRedraw() { + (this.redrawBlock = !0), (this.redrawBlockUpdate = null); + } + restoreRedraw() { + (this.redrawBlock = !1), + this.verticalAlignHeaders(), + this.renderer.rerenderColumns(this.redrawBlockUpdate); + } + redraw(t) { + x.elVisible(this.element) && this.verticalAlignHeaders(), + t && + (this.table.rowManager.resetScroll(), + this.table.rowManager.reinitialize()), + this.confirm("table-redrawing", t) || this.layoutRefresh(t), + this.dispatch("table-redraw", t), + this.table.footerManager.redraw(); + } + } + class ht { + constructor(t) { + return ( + (this._row = t), + new Proxy(this, { + get: function (e, i, o) { + return e[i] !== void 0 + ? e[i] + : e._row.table.componentFunctionBinder.handle( + "row", + e._row, + i + ); + }, + }) + ); + } + getData(t) { + return this._row.getData(t); + } + getElement() { + return this._row.getElement(); + } + getCells() { + var t = []; + return ( + this._row.getCells().forEach(function (e) { + t.push(e.getComponent()); + }), + t + ); + } + getCell(t) { + var e = this._row.getCell(t); + return !!e && e.getComponent(); + } + getIndex() { + return this._row.getData("data")[this._row.table.options.index]; + } + getPosition() { + return this._row.getPosition(); + } + watchPosition(t) { + return this._row.watchPosition(t); + } + delete() { + return this._row.delete(); + } + scrollTo(t, e) { + return this._row.table.rowManager.scrollToRow(this._row, t, e); + } + move(t, e) { + this._row.moveToRow(t, e); + } + update(t) { + return this._row.updateData(t); + } + normalizeHeight() { + this._row.normalizeHeight(!0); + } + _getSelf() { + return this._row; + } + reformat() { + return this._row.reinitialize(); + } + getTable() { + return this._row.table; + } + getNextRow() { + var t = this._row.nextRow(); + return t && t.getComponent(); + } + getPrevRow() { + var t = this._row.prevRow(); + return t && t.getComponent(); + } + } + class k extends C { + constructor(t, e, i = "row") { + super(e.table), + (this.parent = e), + (this.data = {}), + (this.type = i), + (this.element = !1), + (this.modules = {}), + (this.cells = []), + (this.height = 0), + (this.heightStyled = ""), + (this.manualHeight = !1), + (this.outerHeight = 0), + (this.initialized = !1), + (this.heightInitialized = !1), + (this.position = 0), + (this.positionWatchers = []), + (this.component = null), + (this.created = !1), + this.setData(t); + } + create() { + this.created || ((this.created = !0), this.generateElement()); + } + createElement() { + var t = document.createElement("div"); + t.classList.add("tabulator-row"), + t.setAttribute("role", "row"), + (this.element = t); + } + getElement() { + return this.create(), this.element; + } + detachElement() { + this.element && + this.element.parentNode && + this.element.parentNode.removeChild(this.element); + } + generateElement() { + this.createElement(), this.dispatch("row-init", this); + } + generateCells() { + this.cells = this.table.columnManager.generateCells(this); + } + initialize(t, e) { + if ((this.create(), !this.initialized || t)) { + for (this.deleteCells(); this.element.firstChild; ) + this.element.removeChild(this.element.firstChild); + this.dispatch("row-layout-before", this), + this.generateCells(), + (this.initialized = !0), + this.table.columnManager.renderer.renderRowCells( + this, + e + ), + t && this.normalizeHeight(), + this.dispatch("row-layout", this), + this.table.options.rowFormatter && + this.table.options.rowFormatter( + this.getComponent() + ), + this.dispatch("row-layout-after", this); + } else this.table.columnManager.renderer.rerenderRowCells(this, e); + } + rendered() { + this.cells.forEach((t) => { + t.cellRendered(); + }); + } + reinitializeHeight() { + (this.heightInitialized = !1), + this.element && + this.element.offsetParent !== null && + this.normalizeHeight(!0); + } + deinitialize() { + this.initialized = !1; + } + deinitializeHeight() { + this.heightInitialized = !1; + } + reinitialize(t) { + (this.initialized = !1), + (this.heightInitialized = !1), + this.manualHeight || + ((this.height = 0), (this.heightStyled = "")), + this.element && + this.element.offsetParent !== null && + this.initialize(!0), + this.dispatch("row-relayout", this); + } + calcHeight(t) { + var e = 0, + i = 0; + this.table.options.rowHeight + ? (this.height = this.table.options.rowHeight) + : ((i = this.calcMinHeight()), + (e = this.calcMaxHeight()), + (this.height = t + ? Math.max(e, i) + : this.manualHeight + ? this.height + : Math.max(e, i))), + (this.heightStyled = this.height ? this.height + "px" : ""), + (this.outerHeight = this.element.offsetHeight); + } + calcMinHeight() { + return this.table.options.resizableRows + ? this.element.clientHeight + : 0; + } + calcMaxHeight() { + var t = 0; + return ( + this.cells.forEach(function (e) { + var i = e.getHeight(); + i > t && (t = i); + }), + t + ); + } + setCellHeight() { + this.cells.forEach(function (t) { + t.setHeight(); + }), + (this.heightInitialized = !0); + } + clearCellHeight() { + this.cells.forEach(function (t) { + t.clearHeight(); + }); + } + normalizeHeight(t) { + t && !this.table.options.rowHeight && this.clearCellHeight(), + this.calcHeight(t), + this.setCellHeight(); + } + setHeight(t, e) { + (this.height != t || e) && + ((this.manualHeight = !0), + (this.height = t), + (this.heightStyled = t ? t + "px" : ""), + this.setCellHeight(), + (this.outerHeight = this.element.offsetHeight), + this.subscribedExternal("rowHeight") && + this.dispatchExternal( + "rowHeight", + this.getComponent() + )); + } + getHeight() { + return this.outerHeight; + } + getWidth() { + return this.element.offsetWidth; + } + deleteCell(t) { + var e = this.cells.indexOf(t); + e > -1 && this.cells.splice(e, 1); + } + setData(t) { + (this.data = this.chain( + "row-data-init-before", + [this, t], + void 0, + t + )), + this.dispatch("row-data-init-after", this); + } + updateData(t) { + var e, + i = this.element && x.elVisible(this.element), + o = {}; + return new Promise((n, r) => { + typeof t == "string" && (t = JSON.parse(t)), + this.dispatch("row-data-save-before", this), + this.subscribed("row-data-changing") && + ((o = Object.assign(o, this.data)), + (o = Object.assign(o, t))), + (e = this.chain( + "row-data-changing", + [this, o, t], + null, + t + )); + for (let a in e) this.data[a] = e[a]; + this.dispatch("row-data-save-after", this); + for (let a in t) + this.table.columnManager + .getColumnsByFieldRoot(a) + .forEach((l) => { + let h = this.getCell(l.getField()); + if (h) { + let d = l.getFieldValue(e); + h.getValue() !== d && + (h.setValueProcessData(d), + i && h.cellRendered()); + } + }); + i + ? (this.normalizeHeight(!0), + this.table.options.rowFormatter && + this.table.options.rowFormatter( + this.getComponent() + )) + : ((this.initialized = !1), + (this.height = 0), + (this.heightStyled = "")), + this.dispatch("row-data-changed", this, i, t), + this.dispatchExternal( + "rowUpdated", + this.getComponent() + ), + this.subscribedExternal("dataChanged") && + this.dispatchExternal( + "dataChanged", + this.table.rowManager.getData() + ), + n(); + }); + } + getData(t) { + return t + ? this.chain( + "row-data-retrieve", + [this, t], + null, + this.data + ) + : this.data; + } + getCell(t) { + return ( + (t = this.table.columnManager.findColumn(t)), + this.initialized || + this.cells.length !== 0 || + this.generateCells(), + this.cells.find(function (e) { + return e.column === t; + }) + ); + } + getCellIndex(t) { + return this.cells.findIndex(function (e) { + return e === t; + }); + } + findCell(t) { + return this.cells.find((e) => e.element === t); + } + getCells() { + return ( + this.initialized || + this.cells.length !== 0 || + this.generateCells(), + this.cells + ); + } + nextRow() { + return this.table.rowManager.nextDisplayRow(this, !0) || !1; + } + prevRow() { + return this.table.rowManager.prevDisplayRow(this, !0) || !1; + } + moveToRow(t, e) { + var i = this.table.rowManager.findRow(t); + i + ? (this.table.rowManager.moveRowActual(this, i, !e), + this.table.rowManager.refreshActiveData( + "display", + !1, + !0 + )) + : console.warn("Move Error - No matching row found:", t); + } + delete() { + return ( + this.dispatch("row-delete", this), + this.deleteActual(), + Promise.resolve() + ); + } + deleteActual(t) { + this.detachModules(), + this.table.rowManager.deleteRow(this, t), + this.deleteCells(), + (this.initialized = !1), + (this.heightInitialized = !1), + (this.element = !1), + this.dispatch("row-deleted", this); + } + detachModules() { + this.dispatch("row-deleting", this); + } + deleteCells() { + var t = this.cells.length; + for (let e = 0; e < t; e++) this.cells[0].delete(); + } + wipe() { + if ((this.detachModules(), this.deleteCells(), this.element)) { + for (; this.element.firstChild; ) + this.element.removeChild(this.element.firstChild); + this.element.parentNode && + this.element.parentNode.removeChild(this.element); + } + (this.element = !1), (this.modules = {}); + } + isDisplayed() { + return this.table.rowManager.getDisplayRows().includes(this); + } + getPosition() { + return !!this.isDisplayed() && this.position; + } + setPosition(t) { + t != this.position && + ((this.position = t), + this.positionWatchers.forEach((e) => { + e(this.position); + })); + } + watchPosition(t) { + this.positionWatchers.push(t), t(this.position); + } + getGroup() { + return this.modules.group || !1; + } + getComponent() { + return ( + this.component || (this.component = new ht(this)), + this.component + ); + } + } + class Ee extends lt { + constructor(t) { + super(t), + (this.verticalFillMode = "fill"), + (this.scrollTop = 0), + (this.scrollLeft = 0), + (this.scrollTop = 0), + (this.scrollLeft = 0); + } + clearRows() { + for (var t = this.tableElement; t.firstChild; ) + t.removeChild(t.firstChild); + (t.scrollTop = 0), + (t.scrollLeft = 0), + (t.style.minWidth = ""), + (t.style.minHeight = ""), + (t.style.display = ""), + (t.style.visibility = ""); + } + renderRows() { + var t = this.tableElement, + e = !0, + i = document.createDocumentFragment(), + o = this.rows(); + o.forEach((n, r) => { + this.styleRow(n, r), + n.initialize(!1, !0), + n.type !== "group" && (e = !1), + i.appendChild(n.getElement()); + }), + t.appendChild(i), + o.forEach((n) => { + n.rendered(), n.heightInitialized || n.calcHeight(!0); + }), + o.forEach((n) => { + n.heightInitialized || n.setCellHeight(); + }), + (t.style.minWidth = e + ? this.table.columnManager.getWidth() + "px" + : ""); + } + rerenderRows(t) { + this.clearRows(), + t && t(), + this.renderRows(), + this.rows().length || this.table.rowManager.tableEmpty(); + } + scrollToRowNearestTop(t) { + var e = x.elOffset(t.getElement()).top; + return !( + Math.abs(this.elementVertical.scrollTop - e) > + Math.abs( + this.elementVertical.scrollTop + + this.elementVertical.clientHeight - + e + ) + ); + } + scrollToRow(t) { + var e = t.getElement(); + this.elementVertical.scrollTop = + x.elOffset(e).top - + x.elOffset(this.elementVertical).top + + this.elementVertical.scrollTop; + } + visibleRows(t) { + return this.rows(); + } + } + class ye extends lt { + constructor(t) { + super(t), + (this.verticalFillMode = "fill"), + (this.scrollTop = 0), + (this.scrollLeft = 0), + (this.vDomRowHeight = 20), + (this.vDomTop = 0), + (this.vDomBottom = 0), + (this.vDomScrollPosTop = 0), + (this.vDomScrollPosBottom = 0), + (this.vDomTopPad = 0), + (this.vDomBottomPad = 0), + (this.vDomMaxRenderChain = 90), + (this.vDomWindowBuffer = 0), + (this.vDomWindowMinTotalRows = 20), + (this.vDomWindowMinMarginRows = 5), + (this.vDomTopNewRows = []), + (this.vDomBottomNewRows = []); + } + clearRows() { + for (var t = this.tableElement; t.firstChild; ) + t.removeChild(t.firstChild); + (t.style.paddingTop = ""), + (t.style.paddingBottom = ""), + (t.style.minHeight = ""), + (t.style.display = ""), + (t.style.visibility = ""), + (this.elementVertical.scrollTop = 0), + (this.elementVertical.scrollLeft = 0), + (this.scrollTop = 0), + (this.scrollLeft = 0), + (this.vDomTop = 0), + (this.vDomBottom = 0), + (this.vDomTopPad = 0), + (this.vDomBottomPad = 0), + (this.vDomScrollPosTop = 0), + (this.vDomScrollPosBottom = 0); + } + renderRows() { + this._virtualRenderFill(); + } + rerenderRows(t) { + for ( + var e = this.elementVertical.scrollTop, + i = !1, + o = !1, + n = this.table.rowManager.scrollLeft, + r = this.rows(), + a = this.vDomTop; + a <= this.vDomBottom; + a++ + ) + if (r[a]) { + var l = e - r[a].getElement().offsetTop; + if (!(o === !1 || Math.abs(l) < o)) break; + (o = l), (i = a); + } + r.forEach((h) => { + h.deinitializeHeight(); + }), + t && t(), + this.rows().length + ? this._virtualRenderFill( + i === !1 ? this.rows.length - 1 : i, + !0, + o || 0 + ) + : (this.clear(), this.table.rowManager.tableEmpty()), + this.scrollColumns(n); + } + scrollColumns(t) { + this.table.rowManager.scrollHorizontal(t); + } + scrollRows(t, e) { + var i = t - this.vDomScrollPosTop, + o = t - this.vDomScrollPosBottom, + n = 2 * this.vDomWindowBuffer, + r = this.rows(); + if (((this.scrollTop = t), -i > n || o > n)) { + var a = this.table.rowManager.scrollLeft; + this._virtualRenderFill( + Math.floor( + (this.elementVertical.scrollTop / + this.elementVertical.scrollHeight) * + r.length + ) + ), + this.scrollColumns(a); + } else e ? (i < 0 && this._addTopRow(r, -i), o < 0 && (this.vDomScrollHeight - this.scrollTop > this.vDomWindowBuffer ? this._removeBottomRow(r, -o) : (this.vDomScrollPosBottom = this.scrollTop))) : (o >= 0 && this._addBottomRow(r, o), i >= 0 && (this.scrollTop > this.vDomWindowBuffer ? this._removeTopRow(r, i) : (this.vDomScrollPosTop = this.scrollTop))); + } + resize() { + this.vDomWindowBuffer = + this.table.options.renderVerticalBuffer || + this.elementVertical.clientHeight; + } + scrollToRowNearestTop(t) { + var e = this.rows().indexOf(t); + return !( + Math.abs(this.vDomTop - e) > Math.abs(this.vDomBottom - e) + ); + } + scrollToRow(t) { + var e = this.rows().indexOf(t); + e > -1 && this._virtualRenderFill(e, !0); + } + visibleRows(t) { + var e = this.elementVertical.scrollTop, + i = this.elementVertical.clientHeight + e, + o = !1, + n = 0, + r = 0, + a = this.rows(); + if (t) (n = this.vDomTop), (r = this.vDomBottom); + else + for (var l = this.vDomTop; l <= this.vDomBottom; l++) + if (a[l]) + if (o) { + if (!(i - a[l].getElement().offsetTop >= 0)) + break; + r = l; + } else if (e - a[l].getElement().offsetTop >= 0) + n = l; + else { + if ( + ((o = !0), + !(i - a[l].getElement().offsetTop >= 0)) + ) + break; + r = l; + } + return a.slice(n, r + 1); + } + _virtualRenderFill(t, e, i) { + var o, + n, + r = this.tableElement, + a = this.elementVertical, + l = 0, + h = 0, + d = 0, + c = 0, + u = 0, + m = 0, + p = this.rows(), + g = p.length, + f = 0, + v = [], + E = 0, + T = 0, + M = this.table.rowManager.fixedHeight, + z = this.elementVertical.clientHeight, + A = this.table.options.rowHeight, + tt = !0; + if (((i = i || 0), (t = t || 0))) { + for (; r.firstChild; ) r.removeChild(r.firstChild); + (c = (g - t + 1) * this.vDomRowHeight) < z && + (t -= Math.ceil((z - c) / this.vDomRowHeight)) < 0 && + (t = 0), + (t -= l = + Math.min( + Math.max( + Math.floor( + this.vDomWindowBuffer / + this.vDomRowHeight + ), + this.vDomWindowMinMarginRows + ), + t + )); + } else this.clear(); + if (g && x.elVisible(this.elementVertical)) { + for ( + this.vDomTop = t, + this.vDomBottom = t - 1, + M || this.table.options.maxHeight + ? (A && (T = z / A + this.vDomWindowBuffer / A), + (T = Math.max( + this.vDomWindowMinTotalRows, + Math.ceil(T) + ))) + : (T = g); + (T == g || + h <= z + this.vDomWindowBuffer || + E < this.vDomWindowMinTotalRows) && + this.vDomBottom < g - 1; + + ) { + for ( + v = [], + n = document.createDocumentFragment(), + m = 0; + m < T && this.vDomBottom < g - 1; + + ) + (o = p[(f = this.vDomBottom + 1)]), + this.styleRow(o, f), + o.initialize(!1, !0), + o.heightInitialized || + this.table.options.rowHeight || + o.clearCellHeight(), + n.appendChild(o.getElement()), + v.push(o), + this.vDomBottom++, + m++; + if (!v.length) break; + r.appendChild(n), + v.forEach((L) => { + L.rendered(), + L.heightInitialized || L.calcHeight(!0); + }), + v.forEach((L) => { + L.heightInitialized || L.setCellHeight(); + }), + v.forEach((L) => { + (d = L.getHeight()), + E < l ? (u += d) : (h += d), + d > this.vDomWindowBuffer && + (this.vDomWindowBuffer = 2 * d), + E++; + }), + (tt = this.table.rowManager.adjustTableSize()), + (z = this.elementVertical.clientHeight), + tt && + (M || this.table.options.maxHeight) && + ((A = h / E), + (T = Math.max( + this.vDomWindowMinTotalRows, + Math.ceil(z / A + this.vDomWindowBuffer / A) + ))); + } + t + ? ((this.vDomTopPad = e + ? this.vDomRowHeight * this.vDomTop + i + : this.scrollTop - u), + (this.vDomBottomPad = + this.vDomBottom == g - 1 + ? 0 + : Math.max( + this.vDomScrollHeight - + this.vDomTopPad - + h - + u, + 0 + ))) + : ((this.vDomTopPad = 0), + (this.vDomRowHeight = Math.floor((h + u) / E)), + (this.vDomBottomPad = + this.vDomRowHeight * (g - this.vDomBottom - 1)), + (this.vDomScrollHeight = + u + h + this.vDomBottomPad - z)), + (r.style.paddingTop = this.vDomTopPad + "px"), + (r.style.paddingBottom = this.vDomBottomPad + "px"), + e && + (this.scrollTop = + this.vDomTopPad + + u + + i - + (this.elementVertical.scrollWidth > + this.elementVertical.clientWidth + ? this.elementVertical.offsetHeight - z + : 0)), + (this.scrollTop = Math.min( + this.scrollTop, + this.elementVertical.scrollHeight - z + )), + this.elementVertical.scrollWidth > + this.elementVertical.clientWidth && + e && + (this.scrollTop += + this.elementVertical.offsetHeight - z), + (this.vDomScrollPosTop = this.scrollTop), + (this.vDomScrollPosBottom = this.scrollTop), + (a.scrollTop = this.scrollTop), + this.dispatch("render-virtual-fill"); + } + } + _addTopRow(t, e) { + for ( + var i = this.tableElement, + o = [], + n = 0, + r = this.vDomTop - 1, + a = 0, + l = !0; + l; + + ) + if (this.vDomTop) { + let h, + d, + c = t[r]; + c && a < this.vDomMaxRenderChain + ? ((h = c.getHeight() || this.vDomRowHeight), + (d = c.initialized), + e >= h + ? (this.styleRow(c, r), + i.insertBefore( + c.getElement(), + i.firstChild + ), + (c.initialized && c.heightInitialized) || + o.push(c), + c.initialize(), + d || + ((h = c.getElement().offsetHeight), + h > this.vDomWindowBuffer && + (this.vDomWindowBuffer = 2 * h)), + (e -= h), + (n += h), + this.vDomTop--, + r--, + a++) + : (l = !1)) + : (l = !1); + } else l = !1; + for (let h of o) h.clearCellHeight(); + this._quickNormalizeRowHeight(o), + n && + ((this.vDomTopPad -= n), + this.vDomTopPad < 0 && + (this.vDomTopPad = r * this.vDomRowHeight), + r < 1 && (this.vDomTopPad = 0), + (i.style.paddingTop = this.vDomTopPad + "px"), + (this.vDomScrollPosTop -= n)); + } + _removeTopRow(t, e) { + for (var i = [], o = 0, n = 0, r = !0; r; ) { + let a, + l = t[this.vDomTop]; + l && n < this.vDomMaxRenderChain + ? ((a = l.getHeight() || this.vDomRowHeight), + e >= a + ? (this.vDomTop++, + (e -= a), + (o += a), + i.push(l), + n++) + : (r = !1)) + : (r = !1); + } + for (let a of i) { + let l = a.getElement(); + l.parentNode && l.parentNode.removeChild(l); + } + o && + ((this.vDomTopPad += o), + (this.tableElement.style.paddingTop = + this.vDomTopPad + "px"), + (this.vDomScrollPosTop += this.vDomTop + ? o + : o + this.vDomWindowBuffer)); + } + _addBottomRow(t, e) { + for ( + var i = this.tableElement, + o = [], + n = 0, + r = this.vDomBottom + 1, + a = 0, + l = !0; + l; + + ) { + let h, + d, + c = t[r]; + c && a < this.vDomMaxRenderChain + ? ((h = c.getHeight() || this.vDomRowHeight), + (d = c.initialized), + e >= h + ? (this.styleRow(c, r), + i.appendChild(c.getElement()), + (c.initialized && c.heightInitialized) || + o.push(c), + c.initialize(), + d || + ((h = c.getElement().offsetHeight), + h > this.vDomWindowBuffer && + (this.vDomWindowBuffer = 2 * h)), + (e -= h), + (n += h), + this.vDomBottom++, + r++, + a++) + : (l = !1)) + : (l = !1); + } + for (let h of o) h.clearCellHeight(); + this._quickNormalizeRowHeight(o), + n && + ((this.vDomBottomPad -= n), + (this.vDomBottomPad < 0 || r == t.length - 1) && + (this.vDomBottomPad = 0), + (i.style.paddingBottom = this.vDomBottomPad + "px"), + (this.vDomScrollPosBottom += n)); + } + _removeBottomRow(t, e) { + for (var i = [], o = 0, n = 0, r = !0; r; ) { + let a, + l = t[this.vDomBottom]; + l && n < this.vDomMaxRenderChain + ? ((a = l.getHeight() || this.vDomRowHeight), + e >= a + ? (this.vDomBottom--, + (e -= a), + (o += a), + i.push(l), + n++) + : (r = !1)) + : (r = !1); + } + for (let a of i) { + let l = a.getElement(); + l.parentNode && l.parentNode.removeChild(l); + } + o && + ((this.vDomBottomPad += o), + this.vDomBottomPad < 0 && (this.vDomBottomPad = 0), + (this.tableElement.style.paddingBottom = + this.vDomBottomPad + "px"), + (this.vDomScrollPosBottom -= o)); + } + _quickNormalizeRowHeight(t) { + for (let e of t) e.calcHeight(); + for (let e of t) e.setCellHeight(); + } + } + class Re extends C { + constructor(t) { + super(t), + (this.element = this.createHolderElement()), + (this.tableElement = this.createTableElement()), + (this.heightFixer = this.createTableElement()), + (this.placeholder = null), + (this.placeholderContents = null), + (this.firstRender = !1), + (this.renderMode = "virtual"), + (this.fixedHeight = !1), + (this.rows = []), + (this.activeRowsPipeline = []), + (this.activeRows = []), + (this.activeRowsCount = 0), + (this.displayRows = []), + (this.displayRowsCount = 0), + (this.scrollTop = 0), + (this.scrollLeft = 0), + (this.redrawBlock = !1), + (this.redrawBlockRestoreConfig = !1), + (this.redrawBlockRenderInPosition = !1), + (this.dataPipeline = []), + (this.displayPipeline = []), + (this.scrollbarWidth = 0), + (this.renderer = null); + } + createHolderElement() { + var t = document.createElement("div"); + return ( + t.classList.add("tabulator-tableholder"), + t.setAttribute("tabindex", 0), + t + ); + } + createTableElement() { + var t = document.createElement("div"); + return ( + t.classList.add("tabulator-table"), + t.setAttribute("role", "rowgroup"), + t + ); + } + initializePlaceholder() { + var t = this.table.options.placeholder; + if ( + (typeof t == "function" && (t = t.call(this.table)), + (t = this.chain("placeholder", [t], t, t) || t)) + ) { + let e = document.createElement("div"); + if ( + (e.classList.add("tabulator-placeholder"), + typeof t == "string") + ) { + let i = document.createElement("div"); + i.classList.add("tabulator-placeholder-contents"), + (i.innerHTML = t), + e.appendChild(i), + (this.placeholderContents = i); + } else + typeof HTMLElement < "u" && t instanceof HTMLElement + ? (e.appendChild(t), (this.placeholderContents = t)) + : (console.warn( + "Invalid placeholder provided, must be string or HTML Element", + t + ), + (this.el = null)); + this.placeholder = e; + } + } + getElement() { + return this.element; + } + getTableElement() { + return this.tableElement; + } + initialize() { + this.initializePlaceholder(), + this.initializeRenderer(), + this.element.appendChild(this.tableElement), + (this.firstRender = !0), + this.element.addEventListener("scroll", () => { + var t = this.element.scrollLeft, + e = this.scrollLeft > t, + i = this.element.scrollTop, + o = this.scrollTop > i; + this.scrollLeft != t && + ((this.scrollLeft = t), + this.dispatch("scroll-horizontal", t, e), + this.dispatchExternal("scrollHorizontal", t, e), + this._positionPlaceholder()), + this.scrollTop != i && + ((this.scrollTop = i), + this.renderer.scrollRows(i, o), + this.dispatch("scroll-vertical", i, o), + this.dispatchExternal("scrollVertical", i, o)); + }); + } + findRow(t) { + return typeof t != "object" + ? t === void 0 + ? !1 + : this.rows.find( + (e) => e.data[this.table.options.index] == t + ) || !1 + : t instanceof k + ? t + : t instanceof ht + ? t._getSelf() || !1 + : (typeof HTMLElement < "u" && + t instanceof HTMLElement && + this.rows.find((e) => e.getElement() === t)) || + !1; + } + getRowFromDataObject(t) { + return this.rows.find((e) => e.data === t) || !1; + } + getRowFromPosition(t) { + return this.getDisplayRows().find( + (e) => + e.type === "row" && + e.getPosition() === t && + e.isDisplayed() + ); + } + scrollToRow(t, e, i) { + return this.renderer.scrollToRowPosition(t, e, i); + } + setData(t, e, i) { + return new Promise((o, n) => { + e && this.getDisplayRows().length + ? this.table.options.pagination + ? this._setDataActual(t, !0) + : this.reRenderInPosition(() => { + this._setDataActual(t); + }) + : (this.table.options.autoColumns && + i && + this.table.initialized && + this.table.columnManager.generateColumnsFromRowData( + t + ), + this.resetScroll(), + this._setDataActual(t)), + o(); + }); + } + _setDataActual(t, e) { + this.dispatchExternal("dataProcessing", t), + this._wipeElements(), + Array.isArray(t) + ? (this.dispatch("data-processing", t), + t.forEach((i, o) => { + if (i && typeof i == "object") { + var n = new k(i, this); + this.rows.push(n); + } else + console.warn( + "Data Loading Warning - Invalid row data detected and ignored, expecting object but received:", + i + ); + }), + this.refreshActiveData(!1, !1, e), + this.dispatch("data-processed", t), + this.dispatchExternal("dataProcessed", t)) + : console.error( + `Data Loading Error - Unable to process data due to invalid data type +Expecting: array +Received: `, + typeof t, + ` +Data: `, + t + ); + } + _wipeElements() { + this.dispatch("rows-wipe"), + this.destroy(), + this.adjustTableSize(), + this.dispatch("rows-wiped"); + } + destroy() { + this.rows.forEach((t) => { + t.wipe(); + }), + (this.rows = []), + (this.activeRows = []), + (this.activeRowsPipeline = []), + (this.activeRowsCount = 0), + (this.displayRows = []), + (this.displayRowsCount = 0); + } + deleteRow(t, e) { + var i = this.rows.indexOf(t), + o = this.activeRows.indexOf(t); + o > -1 && this.activeRows.splice(o, 1), + i > -1 && this.rows.splice(i, 1), + this.setActiveRows(this.activeRows), + this.displayRowIterator((n) => { + var r = n.indexOf(t); + r > -1 && n.splice(r, 1); + }), + e || this.reRenderInPosition(), + this.regenerateRowPositions(), + this.dispatchExternal("rowDeleted", t.getComponent()), + this.displayRowsCount || this.tableEmpty(), + this.subscribedExternal("dataChanged") && + this.dispatchExternal("dataChanged", this.getData()); + } + addRow(t, e, i, o) { + return this.addRowActual(t, e, i, o); + } + addRows(t, e, i, o) { + var n = []; + return new Promise((r, a) => { + (e = this.findAddRowPos(e)), + Array.isArray(t) || (t = [t]), + ((i === void 0 && e) || (i !== void 0 && !e)) && + t.reverse(), + t.forEach((l, h) => { + var d = this.addRow(l, e, i, !0); + n.push(d), this.dispatch("row-added", d, l, e, i); + }), + this.refreshActiveData( + !!o && "displayPipeline", + !1, + !0 + ), + this.regenerateRowPositions(), + this.displayRowsCount && this._clearPlaceholder(), + r(n); + }); + } + findAddRowPos(t) { + return ( + t === void 0 && (t = this.table.options.addRowPos), + t === "pos" && (t = !0), + t === "bottom" && (t = !1), + t + ); + } + addRowActual(t, e, i, o) { + var n, + r, + a = t instanceof k ? t : new k(t || {}, this), + l = this.findAddRowPos(e), + h = -1; + return ( + i || + ((r = this.chain("row-adding-position", [a, l], null, { + index: i, + top: l, + })), + (i = r.index), + (l = r.top)), + i !== void 0 && (i = this.findRow(i)), + (i = this.chain("row-adding-index", [a, i, l], null, i)) && + (h = this.rows.indexOf(i)), + i && h > -1 + ? ((n = this.activeRows.indexOf(i)), + this.displayRowIterator(function (d) { + var c = d.indexOf(i); + c > -1 && d.splice(l ? c : c + 1, 0, a); + }), + n > -1 && this.activeRows.splice(l ? n : n + 1, 0, a), + this.rows.splice(l ? h : h + 1, 0, a)) + : l + ? (this.displayRowIterator(function (d) { + d.unshift(a); + }), + this.activeRows.unshift(a), + this.rows.unshift(a)) + : (this.displayRowIterator(function (d) { + d.push(a); + }), + this.activeRows.push(a), + this.rows.push(a)), + this.setActiveRows(this.activeRows), + this.dispatchExternal("rowAdded", a.getComponent()), + this.subscribedExternal("dataChanged") && + this.dispatchExternal( + "dataChanged", + this.table.rowManager.getData() + ), + o || this.reRenderInPosition(), + a + ); + } + moveRow(t, e, i) { + this.dispatch("row-move", t, e, i), + this.moveRowActual(t, e, i), + this.regenerateRowPositions(), + this.dispatch("row-moved", t, e, i), + this.dispatchExternal("rowMoved", t.getComponent()); + } + moveRowActual(t, e, i) { + this.moveRowInArray(this.rows, t, e, i), + this.moveRowInArray(this.activeRows, t, e, i), + this.displayRowIterator((o) => { + this.moveRowInArray(o, t, e, i); + }), + this.dispatch("row-moving", t, e, i); + } + moveRowInArray(t, e, i, o) { + var n, r, a; + if ( + e !== i && + ((n = t.indexOf(e)) > -1 && + (t.splice(n, 1), + (r = t.indexOf(i)) > -1 + ? o + ? t.splice(r + 1, 0, e) + : t.splice(r, 0, e) + : t.splice(n, 0, e)), + t === this.getDisplayRows()) + ) { + a = r > n ? r : n + 1; + for (let l = n < r ? n : r; l <= a; l++) + t[l] && this.styleRow(t[l], l); + } + } + clearData() { + this.setData([]); + } + getRowIndex(t) { + return this.findRowIndex(t, this.rows); + } + getDisplayRowIndex(t) { + var e = this.getDisplayRows().indexOf(t); + return e > -1 && e; + } + nextDisplayRow(t, e) { + var i = this.getDisplayRowIndex(t), + o = !1; + return ( + i !== !1 && + i < this.displayRowsCount - 1 && + (o = this.getDisplayRows()[i + 1]), + !o || (o instanceof k && o.type == "row") + ? o + : this.nextDisplayRow(o, e) + ); + } + prevDisplayRow(t, e) { + var i = this.getDisplayRowIndex(t), + o = !1; + return ( + i && (o = this.getDisplayRows()[i - 1]), + !e || !o || (o instanceof k && o.type == "row") + ? o + : this.prevDisplayRow(o, e) + ); + } + findRowIndex(t, e) { + var i; + return ( + !!((t = this.findRow(t)) && (i = e.indexOf(t)) > -1) && i + ); + } + getData(t, e) { + var i = []; + return ( + this.getRows(t).forEach(function (o) { + o.type == "row" && i.push(o.getData(e || "data")); + }), + i + ); + } + getComponents(t) { + var e = []; + return ( + this.getRows(t).forEach(function (i) { + e.push(i.getComponent()); + }), + e + ); + } + getDataCount(t) { + return this.getRows(t).length; + } + scrollHorizontal(t) { + (this.scrollLeft = t), + (this.element.scrollLeft = t), + this.dispatch("scroll-horizontal", t); + } + registerDataPipelineHandler(t, e) { + e !== void 0 + ? (this.dataPipeline.push({ handler: t, priority: e }), + this.dataPipeline.sort((i, o) => i.priority - o.priority)) + : console.error( + "Data pipeline handlers must have a priority in order to be registered" + ); + } + registerDisplayPipelineHandler(t, e) { + e !== void 0 + ? (this.displayPipeline.push({ handler: t, priority: e }), + this.displayPipeline.sort( + (i, o) => i.priority - o.priority + )) + : console.error( + "Display pipeline handlers must have a priority in order to be registered" + ); + } + refreshActiveData(t, e, i) { + var o = this.table, + n = "", + r = 0, + a = [ + "all", + "dataPipeline", + "display", + "displayPipeline", + "end", + ]; + if (!this.table.destroyed) { + if (typeof t == "function") + if ( + (r = this.dataPipeline.findIndex( + (l) => l.handler === t + )) > -1 + ) + (n = "dataPipeline"), + e && + (r == this.dataPipeline.length - 1 + ? (n = "display") + : r++); + else { + if ( + !( + (r = this.displayPipeline.findIndex( + (l) => l.handler === t + )) > -1 + ) + ) + return void console.error( + "Unable to refresh data, invalid handler provided", + t + ); + (n = "displayPipeline"), + e && + (r == this.displayPipeline.length - 1 + ? (n = "end") + : r++); + } + else (n = t || "all"), (r = 0); + if (this.redrawBlock) + return void ( + (!this.redrawBlockRestoreConfig || + (this.redrawBlockRestoreConfig && + ((this.redrawBlockRestoreConfig.stage === + n && + r < + this.redrawBlockRestoreConfig + .index) || + a.indexOf(n) < + a.indexOf( + this.redrawBlockRestoreConfig + .stage + )))) && + (this.redrawBlockRestoreConfig = { + handler: t, + skipStage: e, + renderInPosition: i, + stage: n, + index: r, + }) + ); + x.elVisible(this.element) + ? i + ? this.reRenderInPosition( + this.refreshPipelines.bind(this, t, n, r, i) + ) + : (this.refreshPipelines(t, n, r, i), + t || + this.table.columnManager.renderer.renderColumns(), + this.renderTable(), + o.options.layoutColumnsOnNewData && + this.table.columnManager.redraw(!0)) + : this.refreshPipelines(t, n, r, i), + this.dispatch("data-refreshed"); + } + } + refreshPipelines(t, e, i, o) { + switch ( + (this.dispatch("data-refreshing"), + (t && this.activeRowsPipeline[0]) || + (this.activeRowsPipeline[0] = this.rows.slice(0)), + e) + ) { + case "all": + case "dataPipeline": + for (let n = i; n < this.dataPipeline.length; n++) { + let r = this.dataPipeline[n].handler( + this.activeRowsPipeline[n].slice(0) + ); + this.activeRowsPipeline[n + 1] = + r || this.activeRowsPipeline[n].slice(0); + } + this.setActiveRows( + this.activeRowsPipeline[this.dataPipeline.length] + ); + case "display": + (i = 0), this.resetDisplayRows(); + case "displayPipeline": + for (let n = i; n < this.displayPipeline.length; n++) { + let r = this.displayPipeline[n].handler( + (n + ? this.getDisplayRows(n - 1) + : this.activeRows + ).slice(0), + o + ); + this.setDisplayRows( + r || this.getDisplayRows(n - 1).slice(0), + n + ); + } + case "end": + this.regenerateRowPositions(); + } + this.getDisplayRows().length && this._clearPlaceholder(); + } + regenerateRowPositions() { + var t = this.getDisplayRows(), + e = 1; + t.forEach((i) => { + i.type === "row" && (i.setPosition(e), e++); + }); + } + setActiveRows(t) { + (this.activeRows = this.activeRows = Object.assign([], t)), + (this.activeRowsCount = this.activeRows.length); + } + resetDisplayRows() { + (this.displayRows = []), + this.displayRows.push(this.activeRows.slice(0)), + (this.displayRowsCount = this.displayRows[0].length); + } + setDisplayRows(t, e) { + (this.displayRows[e] = t), + e == this.displayRows.length - 1 && + (this.displayRowsCount = + this.displayRows[ + this.displayRows.length - 1 + ].length); + } + getDisplayRows(t) { + return t === void 0 + ? this.displayRows.length + ? this.displayRows[this.displayRows.length - 1] + : [] + : this.displayRows[t] || []; + } + getVisibleRows(t, e) { + var i = Object.assign([], this.renderer.visibleRows(!e)); + return t && (i = this.chain("rows-visible", [e], i, i)), i; + } + displayRowIterator(t) { + this.activeRowsPipeline.forEach(t), + this.displayRows.forEach(t), + (this.displayRowsCount = + this.displayRows[this.displayRows.length - 1].length); + } + getRows(t) { + var e = []; + switch (t) { + case "active": + e = this.activeRows; + break; + case "display": + e = this.table.rowManager.getDisplayRows(); + break; + case "visible": + e = this.getVisibleRows(!1, !0); + break; + default: + e = + this.chain("rows-retrieve", t, null, this.rows) || + this.rows; + } + return e; + } + reRenderInPosition(t) { + this.redrawBlock + ? t + ? t() + : (this.redrawBlockRenderInPosition = !0) + : (this.dispatchExternal("renderStarted"), + this.renderer.rerenderRows(t), + this.fixedHeight || this.adjustTableSize(), + this.scrollBarCheck(), + this.dispatchExternal("renderComplete")); + } + scrollBarCheck() { + var t = 0; + this.element.scrollHeight > this.element.clientHeight && + (t = this.element.offsetWidth - this.element.clientWidth), + t !== this.scrollbarWidth && + ((this.scrollbarWidth = t), + this.dispatch("scrollbar-vertical", t)); + } + initializeRenderer() { + var t, + e = { virtual: ye, basic: Ee }; + (t = + typeof this.table.options.renderVertical == "string" + ? e[this.table.options.renderVertical] + : this.table.options.renderVertical) + ? ((this.renderMode = this.table.options.renderVertical), + (this.renderer = new t( + this.table, + this.element, + this.tableElement + )), + this.renderer.initialize(), + (!this.table.element.clientHeight && + !this.table.options.height) || + (this.table.options.minHeight && + this.table.options.maxHeight) + ? (this.fixedHeight = !1) + : (this.fixedHeight = !0)) + : console.error( + "Unable to find matching renderer:", + this.table.options.renderVertical + ); + } + getRenderMode() { + return this.renderMode; + } + renderTable() { + this.dispatchExternal("renderStarted"), + (this.element.scrollTop = 0), + this._clearTable(), + this.displayRowsCount + ? (this.renderer.renderRows(), + this.firstRender && + ((this.firstRender = !1), + this.fixedHeight || this.adjustTableSize(), + this.layoutRefresh(!0))) + : this.renderEmptyScroll(), + this.fixedHeight || this.adjustTableSize(), + this.dispatch("table-layout"), + this.displayRowsCount || this._showPlaceholder(), + this.scrollBarCheck(), + this.dispatchExternal("renderComplete"); + } + renderEmptyScroll() { + this.placeholder + ? (this.tableElement.style.display = "none") + : (this.tableElement.style.minWidth = + this.table.columnManager.getWidth() + "px"); + } + _clearTable() { + this._clearPlaceholder(), + (this.scrollTop = 0), + (this.scrollLeft = 0), + this.renderer.clearRows(); + } + tableEmpty() { + this.renderEmptyScroll(), this._showPlaceholder(); + } + checkPlaceholder() { + this.displayRowsCount + ? this._clearPlaceholder() + : this.tableEmpty(); + } + _showPlaceholder() { + this.placeholder && + (this.placeholder && + this.placeholder.parentNode && + this.placeholder.parentNode.removeChild( + this.placeholder + ), + this.initializePlaceholder(), + this.placeholder.setAttribute( + "tabulator-render-mode", + this.renderMode + ), + this.getElement().appendChild(this.placeholder), + this._positionPlaceholder(), + this.adjustTableSize()); + } + _clearPlaceholder() { + this.placeholder && + this.placeholder.parentNode && + this.placeholder.parentNode.removeChild(this.placeholder), + (this.tableElement.style.minWidth = ""), + (this.tableElement.style.display = ""); + } + _positionPlaceholder() { + this.placeholder && + this.placeholder.parentNode && + ((this.placeholder.style.width = + this.table.columnManager.getWidth() + "px"), + (this.placeholderContents.style.width = + this.table.rowManager.element.clientWidth + "px"), + (this.placeholderContents.style.marginLeft = + this.scrollLeft + "px")); + } + styleRow(t, e) { + var i = t.getElement(); + e % 2 + ? (i.classList.add("tabulator-row-even"), + i.classList.remove("tabulator-row-odd")) + : (i.classList.add("tabulator-row-odd"), + i.classList.remove("tabulator-row-even")); + } + normalizeHeight(t) { + this.activeRows.forEach(function (e) { + e.normalizeHeight(t); + }); + } + adjustTableSize() { + let t, + e = this.element.clientHeight, + i = !1; + if (this.renderer.verticalFillMode === "fill") { + let o = Math.floor( + this.table.columnManager + .getElement() + .getBoundingClientRect().height + + (this.table.footerManager && + this.table.footerManager.active && + !this.table.footerManager.external + ? this.table.footerManager + .getElement() + .getBoundingClientRect().height + : 0) + ); + if (this.fixedHeight) { + t = isNaN(this.table.options.minHeight) + ? this.table.options.minHeight + : this.table.options.minHeight + "px"; + let n = "calc(100% - " + o + "px)"; + (this.element.style.minHeight = + t || "calc(100% - " + o + "px)"), + (this.element.style.height = n), + (this.element.style.maxHeight = n); + } else + (this.element.style.height = ""), + (this.element.style.height = + this.table.element.clientHeight - o + "px"), + (this.element.scrollTop = this.scrollTop); + this.renderer.resize(), + this.fixedHeight || + e == this.element.clientHeight || + ((i = !0), + this.subscribed("table-resize") + ? this.dispatch("table-resize") + : this.redraw()), + this.scrollBarCheck(); + } + return this._positionPlaceholder(), i; + } + reinitialize() { + this.rows.forEach(function (t) { + t.reinitialize(!0); + }); + } + blockRedraw() { + (this.redrawBlock = !0), (this.redrawBlockRestoreConfig = !1); + } + restoreRedraw() { + (this.redrawBlock = !1), + this.redrawBlockRestoreConfig + ? (this.refreshActiveData( + this.redrawBlockRestoreConfig.handler, + this.redrawBlockRestoreConfig.skipStage, + this.redrawBlockRestoreConfig.renderInPosition + ), + (this.redrawBlockRestoreConfig = !1)) + : this.redrawBlockRenderInPosition && + this.reRenderInPosition(), + (this.redrawBlockRenderInPosition = !1); + } + redraw(t) { + this.adjustTableSize(), + (this.table.tableWidth = this.table.element.clientWidth), + t + ? this.renderTable() + : (this.reRenderInPosition(), + this.scrollHorizontal(this.scrollLeft)); + } + resetScroll() { + if ( + ((this.element.scrollLeft = 0), + (this.element.scrollTop = 0), + this.table.browser === "ie") + ) { + var t = document.createEvent("Event"); + t.initEvent("scroll", !1, !0), + this.element.dispatchEvent(t); + } else this.element.dispatchEvent(new Event("scroll")); + } + } + class xe extends C { + constructor(t) { + super(t), + (this.active = !1), + (this.element = this.createElement()), + (this.containerElement = this.createContainerElement()), + (this.external = !1); + } + initialize() { + this.initializeElement(); + } + createElement() { + var t = document.createElement("div"); + return t.classList.add("tabulator-footer"), t; + } + createContainerElement() { + var t = document.createElement("div"); + return ( + t.classList.add("tabulator-footer-contents"), + this.element.appendChild(t), + t + ); + } + initializeElement() { + this.table.options.footerElement && + (typeof this.table.options.footerElement == "string" + ? this.table.options.footerElement[0] === "<" + ? (this.containerElement.innerHTML = + this.table.options.footerElement) + : ((this.external = !0), + (this.containerElement = document.querySelector( + this.table.options.footerElement + ))) + : (this.element = this.table.options.footerElement)); + } + getElement() { + return this.element; + } + append(t) { + this.activate(), + this.containerElement.appendChild(t), + this.table.rowManager.adjustTableSize(); + } + prepend(t) { + this.activate(), + this.element.insertBefore(t, this.element.firstChild), + this.table.rowManager.adjustTableSize(); + } + remove(t) { + t.parentNode.removeChild(t), this.deactivate(); + } + deactivate(t) { + (this.element.firstChild && !t) || + (this.external || + this.element.parentNode.removeChild(this.element), + (this.active = !1)); + } + activate() { + this.active || + ((this.active = !0), + this.external || + (this.table.element.appendChild(this.getElement()), + (this.table.element.style.display = ""))); + } + redraw() { + this.dispatch("footer-redraw"); + } + } + class Te extends C { + constructor(t) { + super(t), + (this.el = null), + (this.abortClasses = [ + "tabulator-headers", + "tabulator-table", + ]), + (this.previousTargets = {}), + (this.listeners = [ + "click", + "dblclick", + "contextmenu", + "mouseenter", + "mouseleave", + "mouseover", + "mouseout", + "mousemove", + "mouseup", + "mousedown", + "touchstart", + "touchend", + ]), + (this.componentMap = { + "tabulator-cell": "cell", + "tabulator-row": "row", + "tabulator-group": "group", + "tabulator-col": "column", + }), + (this.pseudoTrackers = { + row: { subscriber: null, target: null }, + cell: { subscriber: null, target: null }, + group: { subscriber: null, target: null }, + column: { subscriber: null, target: null }, + }), + (this.pseudoTracking = !1); + } + initialize() { + (this.el = this.table.element), + this.buildListenerMap(), + this.bindSubscriptionWatchers(); + } + buildListenerMap() { + var t = {}; + this.listeners.forEach((e) => { + t[e] = { handler: null, components: [] }; + }), + (this.listeners = t); + } + bindPseudoEvents() { + Object.keys(this.pseudoTrackers).forEach((t) => { + (this.pseudoTrackers[t].subscriber = + this.pseudoMouseEnter.bind(this, t)), + this.subscribe( + t + "-mouseover", + this.pseudoTrackers[t].subscriber + ); + }), + (this.pseudoTracking = !0); + } + pseudoMouseEnter(t, e, i) { + this.pseudoTrackers[t].target !== i && + (this.pseudoTrackers[t].target && + this.dispatch( + t + "-mouseleave", + e, + this.pseudoTrackers[t].target + ), + this.pseudoMouseLeave(t, e), + (this.pseudoTrackers[t].target = i), + this.dispatch(t + "-mouseenter", e, i)); + } + pseudoMouseLeave(t, e) { + var i = Object.keys(this.pseudoTrackers), + o = { row: ["cell"], cell: ["row"] }; + (i = i.filter((n) => { + var r = o[t]; + return n !== t && (!r || (r && !r.includes(n))); + })).forEach((n) => { + var r = this.pseudoTrackers[n].target; + this.pseudoTrackers[n].target && + (this.dispatch(n + "-mouseleave", e, r), + (this.pseudoTrackers[n].target = null)); + }); + } + bindSubscriptionWatchers() { + var t = Object.keys(this.listeners), + e = Object.values(this.componentMap); + for (let i of e) + for (let o of t) { + let n = i + "-" + o; + this.subscriptionChange( + n, + this.subscriptionChanged.bind(this, i, o) + ); + } + this.subscribe("table-destroy", this.clearWatchers.bind(this)); + } + subscriptionChanged(t, e, i) { + var o = this.listeners[e].components, + n = o.indexOf(t), + r = !1; + i + ? n === -1 && (o.push(t), (r = !0)) + : this.subscribed(t + "-" + e) || + (n > -1 && (o.splice(n, 1), (r = !0))), + (e !== "mouseenter" && e !== "mouseleave") || + this.pseudoTracking || + this.bindPseudoEvents(), + r && this.updateEventListeners(); + } + updateEventListeners() { + for (let t in this.listeners) { + let e = this.listeners[t]; + e.components.length + ? e.handler || + ((e.handler = this.track.bind(this, t)), + this.el.addEventListener(t, e.handler)) + : e.handler && + (this.el.removeEventListener(t, e.handler), + (e.handler = null)); + } + } + track(t, e) { + var i = (e.composedPath && e.composedPath()) || e.path, + o = this.findTargets(i); + (o = this.bindComponents(t, o)), + this.triggerEvents(t, e, o), + !this.pseudoTracking || + (t != "mouseover" && t != "mouseleave") || + Object.keys(o).length || + this.pseudoMouseLeave("none", e); + } + findTargets(t) { + var e = {}; + let i = Object.keys(this.componentMap); + for (let o of t) { + let n = o.classList ? [...o.classList] : []; + if (n.filter((a) => this.abortClasses.includes(a)).length) + break; + let r = n.filter((a) => i.includes(a)); + for (let a of r) + e[this.componentMap[a]] || + (e[this.componentMap[a]] = o); + } + return e.group && e.group === e.row && delete e.row, e; + } + bindComponents(t, e) { + var i = Object.keys(e).reverse(), + o = this.listeners[t], + n = {}, + r = {}, + a = {}; + for (let l of i) { + let h, + d = e[l], + c = this.previousTargets[l]; + if (c && c.target === d) h = c.component; + else + switch (l) { + case "row": + case "group": + (o.components.includes("row") || + o.components.includes("cell") || + o.components.includes("group")) && + ((h = this.table.rowManager + .getVisibleRows(!0) + .find((u) => u.getElement() === d)), + e.row && + e.row.parentNode && + e.row.parentNode.closest( + ".tabulator-row" + ) && + (e[l] = !1)); + break; + case "column": + o.components.includes("column") && + (h = + this.table.columnManager.findColumn(d)); + break; + case "cell": + o.components.includes("cell") && + (n.row instanceof k + ? (h = n.row.findCell(d)) + : e.row && + console.warn( + "Event Target Lookup Error - The row this cell is attached to cannot be found, has the table been reinitialized without being destroyed first?" + )); + } + h && ((n[l] = h), (a[l] = { target: d, component: h })); + } + return ( + (this.previousTargets = a), + Object.keys(e).forEach((l) => { + let h = n[l]; + r[l] = h; + }), + r + ); + } + triggerEvents(t, e, i) { + var o = this.listeners[t]; + for (let n in i) + i[n] && + o.components.includes(n) && + this.dispatch(n + "-" + t, e, i[n]); + } + clearWatchers() { + for (let t in this.listeners) { + let e = this.listeners[t]; + e.handler && + (this.el.removeEventListener(t, e.handler), + (e.handler = null)); + } + } + } + class ke { + constructor(t) { + (this.table = t), (this.bindings = {}); + } + bind(t, e, i) { + this.bindings[t] || (this.bindings[t] = {}), + this.bindings[t][e] + ? console.warn( + "Unable to bind component handler, a matching function name is already bound", + t, + e, + i + ) + : (this.bindings[t][e] = i); + } + handle(t, e, i) { + if ( + this.bindings[t] && + this.bindings[t][i] && + typeof this.bindings[t][i].bind == "function" + ) + return this.bindings[t][i].bind(null, e); + i === "then" || + typeof i != "string" || + i.startsWith("_") || + (this.table.options.debugInvalidComponentFuncs && + console.error( + "The " + + t + + " component does not have a " + + i + + " function, have you checked that you have the correct Tabulator module installed?" + )); + } + } + class Me extends C { + constructor(t) { + super(t), (this.requestOrder = 0), (this.loading = !1); + } + initialize() {} + load(t, e, i, o, n, r) { + var a = ++this.requestOrder; + return this.table.destroyed + ? Promise.resolve() + : (this.dispatchExternal("dataLoading", t), + !t || + (t.indexOf("{") != 0 && t.indexOf("[") != 0) || + (t = JSON.parse(t)), + this.confirm("data-loading", [t, e, i, n]) + ? ((this.loading = !0), + n || this.alertLoader(), + (e = this.chain( + "data-params", + [t, i, n], + e || {}, + e || {} + )), + (e = this.mapParams( + e, + this.table.options.dataSendParams + )), + this.chain( + "data-load", + [t, e, i, n], + !1, + Promise.resolve([]) + ) + .then((l) => { + if (this.table.destroyed) + console.warn( + "Data Load Response Blocked - Table has been destroyed" + ); + else { + Array.isArray(l) || + typeof l != "object" || + (l = this.mapParams( + l, + this.objectInvert( + this.table.options + .dataReceiveParams + ) + )); + var h = this.chain( + "data-loaded", + [l], + null, + l + ); + a == this.requestOrder + ? (this.clearAlert(), + h !== !1 && + (this.dispatchExternal( + "dataLoaded", + h + ), + this.table.rowManager.setData( + h, + o, + r === void 0 ? !o : r + ))) + : console.warn( + "Data Load Response Blocked - An active data load request was blocked by an attempt to change table data while the request was being made" + ); + } + }) + .catch((l) => { + console.error("Data Load Error: ", l), + this.dispatchExternal( + "dataLoadError", + l + ), + n || this.alertError(), + setTimeout(() => { + this.clearAlert(); + }, this.table.options.dataLoaderErrorTimeout); + }) + .finally(() => { + this.loading = !1; + })) + : (this.dispatchExternal("dataLoaded", t), + t || (t = []), + this.table.rowManager.setData( + t, + o, + r === void 0 ? !o : r + ), + Promise.resolve())); + } + mapParams(t, e) { + var i = {}; + for (let o in t) i[e.hasOwnProperty(o) ? e[o] : o] = t[o]; + return i; + } + objectInvert(t) { + var e = {}; + for (let i in t) e[t[i]] = i; + return e; + } + blockActiveLoad() { + this.requestOrder++; + } + alertLoader() { + (typeof this.table.options.dataLoader == "function" + ? this.table.options.dataLoader() + : this.table.options.dataLoader) && + this.table.alertManager.alert( + this.table.options.dataLoaderLoading || + this.langText("data|loading") + ); + } + alertError() { + this.table.alertManager.alert( + this.table.options.dataLoaderError || + this.langText("data|error"), + "error" + ); + } + clearAlert() { + this.table.alertManager.clear(); + } + } + class Le { + constructor(t, e, i) { + (this.table = t), + (this.events = {}), + (this.optionsList = e || {}), + (this.subscriptionNotifiers = {}), + (this.dispatch = i + ? this._debugDispatch.bind(this) + : this._dispatch.bind(this)), + (this.debug = i); + } + subscriptionChange(t, e) { + this.subscriptionNotifiers[t] || + (this.subscriptionNotifiers[t] = []), + this.subscriptionNotifiers[t].push(e), + this.subscribed(t) && this._notifySubscriptionChange(t, !0); + } + subscribe(t, e) { + this.events[t] || (this.events[t] = []), + this.events[t].push(e), + this._notifySubscriptionChange(t, !0); + } + unsubscribe(t, e) { + var i; + if (this.events[t]) { + if (e) { + if ( + !( + (i = this.events[t].findIndex((o) => o === e)) > + -1 + ) + ) + return void console.warn( + "Cannot remove event, no matching event found:", + t, + e + ); + this.events[t].splice(i, 1); + } else delete this.events[t]; + this._notifySubscriptionChange(t, !1); + } else console.warn("Cannot remove event, no events set on:", t); + } + subscribed(t) { + return this.events[t] && this.events[t].length; + } + _notifySubscriptionChange(t, e) { + var i = this.subscriptionNotifiers[t]; + i && + i.forEach((o) => { + o(e); + }); + } + _dispatch() { + var t, + e = Array.from(arguments), + i = e.shift(); + return ( + this.events[i] && + this.events[i].forEach((o, n) => { + let r = o.apply(this.table, e); + n || (t = r); + }), + t + ); + } + _debugDispatch() { + var t = Array.from(arguments), + e = t[0]; + return ( + (t[0] = "ExternalEvent:" + t[0]), + (this.debug === !0 || this.debug.includes(e)) && + console.log(...t), + this._dispatch(...arguments) + ); + } + } + class Se { + constructor(t) { + (this.events = {}), + (this.subscriptionNotifiers = {}), + (this.dispatch = t + ? this._debugDispatch.bind(this) + : this._dispatch.bind(this)), + (this.chain = t + ? this._debugChain.bind(this) + : this._chain.bind(this)), + (this.confirm = t + ? this._debugConfirm.bind(this) + : this._confirm.bind(this)), + (this.debug = t); + } + subscriptionChange(t, e) { + this.subscriptionNotifiers[t] || + (this.subscriptionNotifiers[t] = []), + this.subscriptionNotifiers[t].push(e), + this.subscribed(t) && this._notifySubscriptionChange(t, !0); + } + subscribe(t, e, i = 1e4) { + this.events[t] || (this.events[t] = []), + this.events[t].push({ callback: e, priority: i }), + this.events[t].sort((o, n) => o.priority - n.priority), + this._notifySubscriptionChange(t, !0); + } + unsubscribe(t, e) { + var i; + if (this.events[t]) { + if (e) { + if ( + !( + (i = this.events[t].findIndex( + (o) => o.callback === e + )) > -1 + ) + ) + return void console.warn( + "Cannot remove event, no matching event found:", + t, + e + ); + this.events[t].splice(i, 1); + } + this._notifySubscriptionChange(t, !1); + } else console.warn("Cannot remove event, no events set on:", t); + } + subscribed(t) { + return this.events[t] && this.events[t].length; + } + _chain(t, e, i, o) { + var n = i; + return ( + Array.isArray(e) || (e = [e]), + this.subscribed(t) + ? (this.events[t].forEach((r, a) => { + n = r.callback.apply(this, e.concat([n])); + }), + n) + : typeof o == "function" + ? o() + : o + ); + } + _confirm(t, e) { + var i = !1; + return ( + Array.isArray(e) || (e = [e]), + this.subscribed(t) && + this.events[t].forEach((o, n) => { + o.callback.apply(this, e) && (i = !0); + }), + i + ); + } + _notifySubscriptionChange(t, e) { + var i = this.subscriptionNotifiers[t]; + i && + i.forEach((o) => { + o(e); + }); + } + _dispatch() { + var t = Array.from(arguments), + e = t.shift(); + this.events[e] && + this.events[e].forEach((i) => { + i.callback.apply(this, t); + }); + } + _debugDispatch() { + var t = Array.from(arguments), + e = t[0]; + return ( + (t[0] = "InternalEvent:" + e), + (this.debug === !0 || this.debug.includes(e)) && + console.log(...t), + this._dispatch(...arguments) + ); + } + _debugChain() { + var t = Array.from(arguments), + e = t[0]; + return ( + (t[0] = "InternalEvent:" + e), + (this.debug === !0 || this.debug.includes(e)) && + console.log(...t), + this._chain(...arguments) + ); + } + _debugConfirm() { + var t = Array.from(arguments), + e = t[0]; + return ( + (t[0] = "InternalEvent:" + e), + (this.debug === !0 || this.debug.includes(e)) && + console.log(...t), + this._confirm(...arguments) + ); + } + } + class De extends C { + constructor(t) { + super(t); + } + _warnUser() { + this.options("debugDeprecation") && console.warn(...arguments); + } + check(t, e, i) { + var o = ""; + return ( + this.options(t) === void 0 || + ((o = + "Deprecated Setup Option - Use of the %c" + + t + + "%c option is now deprecated"), + e + ? ((o = + o + + ", Please use the %c" + + e + + "%c option instead"), + this._warnUser( + o, + "font-weight: bold;", + "font-weight: normal;", + "font-weight: bold;", + "font-weight: normal;" + ), + i && (this.table.options[e] = this.table.options[t])) + : this._warnUser( + o, + "font-weight: bold;", + "font-weight: normal;" + ), + !1) + ); + } + checkMsg(t, e) { + return ( + this.options(t) === void 0 || + (this._warnUser( + "%cDeprecated Setup Option - Use of the %c" + + t + + " %c option is now deprecated, " + + e, + "font-weight: normal;", + "font-weight: bold;", + "font-weight: normal;" + ), + !1) + ); + } + msg(t) { + this._warnUser(t); + } + } + class ze extends C { + constructor(t) { + super(t), (this.deps = {}), (this.props = {}); + } + initialize() { + this.deps = Object.assign({}, this.options("dependencies")); + } + lookup(t, e, i) { + if (!Array.isArray(t)) + return e ? this.lookupProp(t, e, i) : this.lookupKey(t, i); + for (let n of t) { + var o = this.lookup(n, e, !0); + if (o) break; + } + if (o) return o; + this.error(t); + } + lookupProp(t, e, i) { + var o; + return this.props[t] && this.props[t][e] + ? this.props[t][e] + : (o = this.lookupKey(t, i)) + ? (this.props[t] || (this.props[t] = {}), + (this.props[t][e] = o[e] || o), + this.props[t][e]) + : void 0; + } + lookupKey(t, e) { + var i; + return ( + this.deps[t] + ? (i = this.deps[t]) + : window[t] + ? ((this.deps[t] = window[t]), (i = this.deps[t])) + : e || this.error(t), + i + ); + } + error(t) { + console.error( + "Unable to find dependency", + t, + "Please check documentation and ensure you have imported the required library into your project" + ); + } + } + let Pe = class fe extends C { + constructor(t, e, i) { + super(t), + (this.element = e), + (this.container = this._lookupContainer()), + (this.parent = i), + (this.reversedX = !1), + (this.childPopup = null), + (this.blurable = !1), + (this.blurCallback = null), + (this.blurEventsBound = !1), + (this.renderedCallback = null), + (this.visible = !1), + (this.hideable = !0), + this.element.classList.add("tabulator-popup-container"), + (this.blurEvent = this.hide.bind(this, !1)), + (this.escEvent = this._escapeCheck.bind(this)), + (this.destroyBinding = this.tableDestroyed.bind(this)), + (this.destroyed = !1); + } + tableDestroyed() { + (this.destroyed = !0), this.hide(!0); + } + _lookupContainer() { + var t = this.table.options.popupContainer; + return ( + typeof t == "string" + ? (t = document.querySelector(t)) || + console.warn( + "Menu Error - no container element found matching selector:", + this.table.options.popupContainer, + "(defaulting to document body)" + ) + : t === !0 && (t = this.table.element), + t && + !this._checkContainerIsParent(t) && + ((t = !1), + console.warn( + "Menu Error - container element does not contain this table:", + this.table.options.popupContainer, + "(defaulting to document body)" + )), + t || (t = document.body), + t + ); + } + _checkContainerIsParent(t, e = this.table.element) { + return ( + t === e || + (!!e.parentNode && + this._checkContainerIsParent(t, e.parentNode)) + ); + } + renderCallback(t) { + this.renderedCallback = t; + } + containerEventCoords(t) { + var e = !(t instanceof MouseEvent), + i = e ? t.touches[0].pageX : t.pageX, + o = e ? t.touches[0].pageY : t.pageY; + if (this.container !== document.body) { + let n = x.elOffset(this.container); + (i -= n.left), (o -= n.top); + } + return { x: i, y: o }; + } + elementPositionCoords(t, e = "right") { + var i, + o, + n, + r = x.elOffset(t); + switch ( + (this.container !== document.body && + ((i = x.elOffset(this.container)), + (r.left -= i.left), + (r.top -= i.top)), + e) + ) { + case "right": + (o = r.left + t.offsetWidth), (n = r.top - 1); + break; + case "bottom": + (o = r.left), (n = r.top + t.offsetHeight); + break; + case "left": + (o = r.left), (n = r.top - 1); + break; + case "top": + (o = r.left), (n = r.top); + break; + case "center": + (o = r.left + t.offsetWidth / 2), + (n = r.top + t.offsetHeight / 2); + } + return { x: o, y: n, offset: r }; + } + show(t, e) { + var i, o, n, r, a; + return ( + this.destroyed || + this.table.destroyed || + (t instanceof HTMLElement + ? ((n = t), + (r = (a = this.elementPositionCoords(t, e)) + .offset), + (i = a.x), + (o = a.y)) + : typeof t == "number" + ? ((r = { top: 0, left: 0 }), (i = t), (o = e)) + : ((i = (a = this.containerEventCoords(t)).x), + (o = a.y), + (this.reversedX = !1)), + (this.element.style.top = o + "px"), + (this.element.style.left = i + "px"), + this.container.appendChild(this.element), + typeof this.renderedCallback == "function" && + this.renderedCallback(), + this._fitToScreen(i, o, n, r, e), + (this.visible = !0), + this.subscribe("table-destroy", this.destroyBinding), + this.element.addEventListener("mousedown", (l) => { + l.stopPropagation(); + })), + this + ); + } + _fitToScreen(t, e, i, o, n) { + var r = + this.container === document.body + ? document.documentElement.scrollTop + : this.container.scrollTop; + (t + this.element.offsetWidth >= this.container.offsetWidth || + this.reversedX) && + ((this.element.style.left = ""), + (this.element.style.right = i + ? this.container.offsetWidth - o.left + "px" + : this.container.offsetWidth - t + "px"), + (this.reversedX = !0)); + let a = Math.max( + this.container.offsetHeight, + r ? this.container.scrollHeight : 0 + ); + e + this.element.offsetHeight > a && + (i + ? n === "bottom" + ? (this.element.style.top = + parseInt(this.element.style.top) - + this.element.offsetHeight - + i.offsetHeight - + 1 + + "px") + : (this.element.style.top = + parseInt(this.element.style.top) - + this.element.offsetHeight + + i.offsetHeight + + 1 + + "px") + : (this.element.style.height = a + "px")); + } + isVisible() { + return this.visible; + } + hideOnBlur(t) { + return ( + (this.blurable = !0), + this.visible && + (setTimeout(() => { + this.visible && + (this.table.rowManager.element.addEventListener( + "scroll", + this.blurEvent + ), + this.subscribe("cell-editing", this.blurEvent), + document.body.addEventListener( + "click", + this.blurEvent + ), + document.body.addEventListener( + "contextmenu", + this.blurEvent + ), + document.body.addEventListener( + "mousedown", + this.blurEvent + ), + window.addEventListener( + "resize", + this.blurEvent + ), + document.body.addEventListener( + "keydown", + this.escEvent + ), + (this.blurEventsBound = !0)); + }, 100), + (this.blurCallback = t)), + this + ); + } + _escapeCheck(t) { + t.keyCode == 27 && this.hide(); + } + blockHide() { + this.hideable = !1; + } + restoreHide() { + this.hideable = !0; + } + hide(t = !1) { + return ( + this.visible && + this.hideable && + (this.blurable && + this.blurEventsBound && + (document.body.removeEventListener( + "keydown", + this.escEvent + ), + document.body.removeEventListener( + "click", + this.blurEvent + ), + document.body.removeEventListener( + "contextmenu", + this.blurEvent + ), + document.body.removeEventListener( + "mousedown", + this.blurEvent + ), + window.removeEventListener( + "resize", + this.blurEvent + ), + this.table.rowManager.element.removeEventListener( + "scroll", + this.blurEvent + ), + this.unsubscribe("cell-editing", this.blurEvent), + (this.blurEventsBound = !1)), + this.childPopup && this.childPopup.hide(), + this.parent && (this.parent.childPopup = null), + this.element.parentNode && + this.element.parentNode.removeChild(this.element), + (this.visible = !1), + this.blurCallback && !t && this.blurCallback(), + this.unsubscribe("table-destroy", this.destroyBinding)), + this + ); + } + child(t) { + return ( + this.childPopup && this.childPopup.hide(), + (this.childPopup = new fe(this.table, t, this)), + this.childPopup + ); + } + }; + class w extends C { + constructor(t, e) { + super(t), (this._handler = null); + } + initialize() {} + registerTableOption(t, e) { + this.table.optionsList.register(t, e); + } + registerColumnOption(t, e) { + this.table.columnManager.optionsList.register(t, e); + } + registerTableFunction(t, e) { + this.table[t] === void 0 + ? (this.table[t] = (...i) => ( + this.table.initGuard(t), e(...i) + )) + : console.warn( + "Unable to bind table function, name already in use", + t + ); + } + registerComponentFunction(t, e, i) { + return this.table.componentFunctionBinder.bind(t, e, i); + } + registerDataHandler(t, e) { + this.table.rowManager.registerDataPipelineHandler(t, e), + (this._handler = t); + } + registerDisplayHandler(t, e) { + this.table.rowManager.registerDisplayPipelineHandler(t, e), + (this._handler = t); + } + displayRows(t) { + var e, + i = this.table.rowManager.displayRows.length - 1; + if ( + (this._handler && + (e = this.table.rowManager.displayPipeline.findIndex( + (o) => o.handler === this._handler + )) > -1 && + (i = e), + t && (i += t), + this._handler) + ) + return i > -1 + ? this.table.rowManager.getDisplayRows(i) + : this.activeRows(); + } + activeRows() { + return this.table.rowManager.activeRows; + } + refreshData(t, e) { + e || (e = this._handler), + e && this.table.rowManager.refreshActiveData(e, !1, t); + } + footerAppend(t) { + return this.table.footerManager.append(t); + } + footerPrepend(t) { + return this.table.footerManager.prepend(t); + } + footerRemove(t) { + return this.table.footerManager.remove(t); + } + popup(t, e) { + return new Pe(this.table, t, e); + } + alert(t, e) { + return this.table.alertManager.alert(t, e); + } + clearAlert() { + return this.table.alertManager.clear(); + } + } + function he(s, t) { + s.forEach(function (e) { + e.reinitializeWidth(); + }), + this.table.options.responsiveLayout && + this.table.modExists("responsiveLayout", !0) && + this.table.modules.responsiveLayout.update(); + } + var Fe = { + fitData: function (s, t) { + t && + this.table.columnManager.renderer.reinitializeColumnWidths( + s + ), + this.table.options.responsiveLayout && + this.table.modExists("responsiveLayout", !0) && + this.table.modules.responsiveLayout.update(); + }, + fitDataFill: he, + fitDataTable: he, + fitDataStretch: function (s, t) { + var e = 0, + i = this.table.rowManager.element.clientWidth, + o = 0, + n = !1; + s.forEach((r, a) => { + r.widthFixed || r.reinitializeWidth(), + (this.table.options.responsiveLayout + ? r.modules.responsive.visible + : r.visible) && (n = r), + r.visible && (e += r.getWidth()); + }), + n + ? ((o = i - e + n.getWidth()), + this.table.options.responsiveLayout && + this.table.modExists("responsiveLayout", !0) && + (n.setWidth(0), + this.table.modules.responsiveLayout.update()), + o > 0 ? n.setWidth(o) : n.reinitializeWidth()) + : this.table.options.responsiveLayout && + this.table.modExists("responsiveLayout", !0) && + this.table.modules.responsiveLayout.update(); + }, + fitColumns: function (s, t) { + var e, + i, + o = + this.table.rowManager.element.getBoundingClientRect() + .width, + n = 0, + r = 0, + a = 0, + l = [], + h = [], + d = 0, + c = 0; + function u(p) { + return typeof p == "string" + ? p.indexOf("%") > -1 + ? (o / 100) * parseInt(p) + : parseInt(p) + : p; + } + function m(p, g, f, v) { + var E = [], + T = 0, + M = 0, + z = 0, + A = a, + tt = 0, + L = 0, + se = []; + function pe(y) { + return f * (y.column.definition.widthGrow || 1); + } + function ge(y) { + return ( + u(y.width) - + f * (y.column.definition.widthShrink || 0) + ); + } + return ( + p.forEach(function (y, ki) { + var be = v ? ge(y) : pe(y); + y.column.minWidth >= be + ? E.push(y) + : y.column.maxWidth && y.column.maxWidth < be + ? ((y.width = y.column.maxWidth), + (g -= y.column.maxWidth), + (A -= v + ? y.column.definition.widthShrink || 1 + : y.column.definition.widthGrow || 1) && + (f = Math.floor(g / A))) + : (se.push(y), + (L += v + ? y.column.definition.widthShrink || 1 + : y.column.definition.widthGrow || 1)); + }), + E.length + ? (E.forEach(function (y) { + (T += v + ? y.width - y.column.minWidth + : y.column.minWidth), + (y.width = y.column.minWidth); + }), + (M = g - T), + (z = L ? Math.floor(M / L) : M), + (tt = m(se, M, z, v))) + : ((tt = L ? g - Math.floor(g / L) * L : g), + se.forEach(function (y) { + y.width = v ? ge(y) : pe(y); + })), + tt + ); + } + this.table.options.responsiveLayout && + this.table.modExists("responsiveLayout", !0) && + this.table.modules.responsiveLayout.update(), + this.table.rowManager.element.scrollHeight > + this.table.rowManager.element.clientHeight && + (o -= + this.table.rowManager.element.offsetWidth - + this.table.rowManager.element.clientWidth), + s.forEach(function (p) { + var g, f, v; + p.visible && + ((g = p.definition.width), + (f = parseInt(p.minWidth)), + g + ? ((v = u(g)), + (n += v > f ? v : f), + p.definition.widthShrink && + (h.push({ + column: p, + width: v > f ? v : f, + }), + (d += p.definition.widthShrink))) + : (l.push({ column: p, width: 0 }), + (a += p.definition.widthGrow || 1))); + }), + (r = o - n), + (e = Math.floor(r / a)), + (c = m(l, r, e, !1)), + l.length && c > 0 && (l[l.length - 1].width += c), + l.forEach(function (p) { + r -= p.width; + }), + (i = Math.abs(c) + r) > 0 && + d && + (c = m(h, i, Math.floor(i / d), !0)), + c && h.length && (h[h.length - 1].width -= c), + l.forEach(function (p) { + p.column.setWidth(p.width); + }), + h.forEach(function (p) { + p.column.setWidth(p.width); + }); + }, + }; + let Y = class Y extends w { + constructor(t) { + super(t, "layout"), + (this.mode = null), + this.registerTableOption("layout", "fitData"), + this.registerTableOption("layoutColumnsOnNewData", !1), + this.registerColumnOption("widthGrow"), + this.registerColumnOption("widthShrink"); + } + initialize() { + var t = this.table.options.layout; + Y.modes[t] + ? (this.mode = t) + : (console.warn( + "Layout Error - invalid mode set, defaulting to 'fitData' : " + + t + ), + (this.mode = "fitData")), + this.table.element.setAttribute( + "tabulator-layout", + this.mode + ), + this.subscribe( + "column-init", + this.initializeColumn.bind(this) + ); + } + initializeColumn(t) { + t.definition.widthGrow && + (t.definition.widthGrow = Number(t.definition.widthGrow)), + t.definition.widthShrink && + (t.definition.widthShrink = Number( + t.definition.widthShrink + )); + } + getMode() { + return this.mode; + } + layout(t) { + var e = this.table.columnManager.columnsByIndex.find( + (i) => + i.definition.variableHeight || + i.definition.formatter === "textarea" + ); + this.dispatch("layout-refreshing"), + Y.modes[this.mode].call( + this, + this.table.columnManager.columnsByIndex, + t + ), + e && this.table.rowManager.normalizeHeight(!0), + this.dispatch("layout-refreshed"); + } + }; + b(Y, "moduleName", "layout"), b(Y, "modes", Fe); + let mt = Y; + var He = { + default: { + groups: { item: "item", items: "items" }, + columns: {}, + data: { loading: "Loading", error: "Error" }, + pagination: { + page_size: "Page Size", + page_title: "Show Page", + first: "First", + first_title: "First Page", + last: "Last", + last_title: "Last Page", + prev: "Prev", + prev_title: "Prev Page", + next: "Next", + next_title: "Next Page", + all: "All", + counter: { + showing: "Showing", + of: "of", + rows: "rows", + pages: "pages", + }, + }, + headerFilters: { default: "filter column...", columns: {} }, + }, + }; + let it = class it extends w { + constructor(t) { + super(t), + (this.locale = "default"), + (this.lang = !1), + (this.bindings = {}), + (this.langList = {}), + this.registerTableOption("locale", !1), + this.registerTableOption("langs", {}); + } + initialize() { + (this.langList = x.deepClone(it.langs)), + this.table.options.columnDefaults + .headerFilterPlaceholder !== !1 && + this.setHeaderFilterPlaceholder( + this.table.options.columnDefaults + .headerFilterPlaceholder + ); + for (let t in this.table.options.langs) + this.installLang(t, this.table.options.langs[t]); + this.setLocale(this.table.options.locale), + this.registerTableFunction( + "setLocale", + this.setLocale.bind(this) + ), + this.registerTableFunction( + "getLocale", + this.getLocale.bind(this) + ), + this.registerTableFunction( + "getLang", + this.getLang.bind(this) + ); + } + setHeaderFilterPlaceholder(t) { + this.langList.default.headerFilters.default = t; + } + installLang(t, e) { + this.langList[t] + ? this._setLangProp(this.langList[t], e) + : (this.langList[t] = e); + } + _setLangProp(t, e) { + for (let i in e) + t[i] && typeof t[i] == "object" + ? this._setLangProp(t[i], e[i]) + : (t[i] = e[i]); + } + setLocale(t) { + if ( + ((t = t || "default") === !0 && + navigator.language && + (t = navigator.language.toLowerCase()), + t && !this.langList[t]) + ) { + let e = t.split("-")[0]; + this.langList[e] + ? (console.warn( + "Localization Error - Exact matching locale not found, using closest match: ", + t, + e + ), + (t = e)) + : (console.warn( + "Localization Error - Matching locale not found, using default: ", + t + ), + (t = "default")); + } + (this.locale = t), + (this.lang = x.deepClone(this.langList.default || {})), + t != "default" && + (function e(i, o) { + for (var n in i) + typeof i[n] == "object" + ? (o[n] || (o[n] = {}), e(i[n], o[n])) + : (o[n] = i[n]); + })(this.langList[t], this.lang), + this.dispatchExternal("localized", this.locale, this.lang), + this._executeBindings(); + } + getLocale(t) { + return this.locale; + } + getLang(t) { + return t ? this.langList[t] : this.lang; + } + getText(t, e) { + var i = (e ? t + "|" + e : t).split("|"); + return this._getLangElement(i, this.locale) || ""; + } + _getLangElement(t, e) { + var i = this.lang; + return ( + t.forEach(function (o) { + var n; + i && ((n = i[o]), (i = n !== void 0 && n)); + }), + i + ); + } + bind(t, e) { + this.bindings[t] || (this.bindings[t] = []), + this.bindings[t].push(e), + e(this.getText(t), this.lang); + } + _executeBindings() { + for (let t in this.bindings) + this.bindings[t].forEach((e) => { + e(this.getText(t), this.lang); + }); + } + }; + b(it, "moduleName", "localize"), b(it, "langs", He); + let pt = it; + var Oe = Object.freeze({ + __proto__: null, + CommsModule: + ((It = class extends w { + constructor(s) { + super(s); + } + initialize() { + this.registerTableFunction( + "tableComms", + this.receive.bind(this) + ); + } + getConnections(s) { + var t = []; + return ( + this.table.constructor.registry + .lookupTable(s) + .forEach((e) => { + this.table !== e && t.push(e); + }), + t + ); + } + send(s, t, e, i) { + var o = this.getConnections(s); + o.forEach((n) => { + n.tableComms(this.table.element, t, e, i); + }), + !o.length && + s && + console.warn( + "Table Connection Error - No tables matching selector found", + s + ); + } + receive(s, t, e, i) { + if (this.table.modExists(t)) + return this.table.modules[t].commsReceived(s, e, i); + console.warn( + "Inter-table Comms Error - no such module:", + t + ); + } + }), + b(It, "moduleName", "comms"), + It), + LayoutModule: mt, + LocalizeModule: pt, + }); + let D = class D { + static findTable(t) { + var e = D.registry.lookupTable(t, !0); + return !(Array.isArray(e) && !e.length) && e; + } + }; + b(D, "registry", { + tables: [], + register(t) { + D.registry.tables.push(t); + }, + deregister(t) { + var e = D.registry.tables.indexOf(t); + e > -1 && D.registry.tables.splice(e, 1); + }, + lookupTable(t, e) { + var i, + o, + n = []; + if (typeof t == "string") { + if ((i = document.querySelectorAll(t)).length) + for (var r = 0; r < i.length; r++) + (o = D.registry.matchElement(i[r])) && n.push(o); + } else + (typeof HTMLElement < "u" && t instanceof HTMLElement) || + t instanceof D + ? (o = D.registry.matchElement(t)) && n.push(o) + : Array.isArray(t) + ? t.forEach(function (a) { + n = n.concat(D.registry.lookupTable(a)); + }) + : e || + console.warn( + "Table Connection Error - Invalid Selector", + t + ); + return n; + }, + matchElement: (t) => + D.registry.tables.find(function (e) { + return t instanceof D ? e === t : e.element === t; + }), + }); + let gt = D, + R = class R extends gt { + constructor() { + super(); + } + static initializeModuleBinder(t) { + R.modulesRegistered || + ((R.modulesRegistered = !0), + R._registerModules(Oe, !0), + t && R._registerModules(t)); + } + static _extendModule(t, e, i) { + if (R.moduleBindings[t]) { + var o = R.moduleBindings[t][e]; + if (o) + if (typeof i == "object") + for (let n in i) o[n] = i[n]; + else + console.warn( + "Module Error - Invalid value type, it must be an object" + ); + else + console.warn( + "Module Error - property does not exist:", + e + ); + } else + console.warn( + "Module Error - module does not exist:", + t + ); + } + static _registerModules(t, e) { + var i = Object.values(t); + e && + i.forEach((o) => { + o.prototype.moduleCore = !0; + }), + R._registerModule(i); + } + static _registerModule(t) { + Array.isArray(t) || (t = [t]), + t.forEach((e) => { + R._registerModuleBinding(e), + R._registerModuleExtensions(e); + }); + } + static _registerModuleBinding(t) { + t.moduleName + ? (R.moduleBindings[t.moduleName] = t) + : console.error( + "Unable to bind module, no moduleName defined", + t.moduleName + ); + } + static _registerModuleExtensions(t) { + var e = t.moduleExtensions; + if (t.moduleExtensions) + for (let i in e) { + let o = e[i]; + if (R.moduleBindings[i]) + for (let n in o) R._extendModule(i, n, o[n]); + else { + R.moduleExtensions[i] || + (R.moduleExtensions[i] = {}); + for (let n in o) + R.moduleExtensions[i][n] || + (R.moduleExtensions[i][n] = {}), + Object.assign( + R.moduleExtensions[i][n], + o[n] + ); + } + } + R._extendModuleFromQueue(t); + } + static _extendModuleFromQueue(t) { + var e = R.moduleExtensions[t.moduleName]; + if (e) + for (let i in e) R._extendModule(t.moduleName, i, e[i]); + } + _bindModules() { + var t = [], + e = [], + i = []; + for (var o in ((this.modules = {}), R.moduleBindings)) { + let n = R.moduleBindings[o], + r = new n(this); + (this.modules[o] = r), + n.prototype.moduleCore + ? this.modulesCore.push(r) + : n.moduleInitOrder + ? n.moduleInitOrder < 0 + ? t.push(r) + : e.push(r) + : i.push(r); + } + t.sort((n, r) => + n.moduleInitOrder > r.moduleInitOrder ? 1 : -1 + ), + e.sort((n, r) => + n.moduleInitOrder > r.moduleInitOrder ? 1 : -1 + ), + (this.modulesRegular = t.concat(i.concat(e))); + } + }; + b(R, "moduleBindings", {}), + b(R, "moduleExtensions", {}), + b(R, "modulesRegistered", !1), + b(R, "defaultModules", !1); + let bt = R; + class Ae extends C { + constructor(t) { + super(t), + (this.element = this._createAlertElement()), + (this.msgElement = this._createMsgElement()), + (this.type = null), + this.element.appendChild(this.msgElement); + } + _createAlertElement() { + var t = document.createElement("div"); + return t.classList.add("tabulator-alert"), t; + } + _createMsgElement() { + var t = document.createElement("div"); + return ( + t.classList.add("tabulator-alert-msg"), + t.setAttribute("role", "alert"), + t + ); + } + _typeClass() { + return "tabulator-alert-state-" + this.type; + } + alert(t, e = "msg") { + if (t) { + for ( + this.clear(), + this.dispatch("alert-show", e), + this.type = e; + this.msgElement.firstChild; + + ) + this.msgElement.removeChild(this.msgElement.firstChild); + this.msgElement.classList.add(this._typeClass()), + typeof t == "function" && (t = t()), + t instanceof HTMLElement + ? this.msgElement.appendChild(t) + : (this.msgElement.innerHTML = t), + this.table.element.appendChild(this.element); + } + } + clear() { + this.dispatch("alert-hide", this.type), + this.element.parentNode && + this.element.parentNode.removeChild(this.element), + this.msgElement.classList.remove(this._typeClass()); + } + } + let H = class H extends bt { + static extendModule() { + H.initializeModuleBinder(), H._extendModule(...arguments); + } + static registerModule() { + H.initializeModuleBinder(), H._registerModule(...arguments); + } + constructor(t, e, i) { + super(), + H.initializeModuleBinder(i), + (this.options = {}), + (this.columnManager = null), + (this.rowManager = null), + (this.footerManager = null), + (this.alertManager = null), + (this.vdomHoz = null), + (this.externalEvents = null), + (this.eventBus = null), + (this.interactionMonitor = !1), + (this.browser = ""), + (this.browserSlow = !1), + (this.browserMobile = !1), + (this.rtl = !1), + (this.originalElement = null), + (this.componentFunctionBinder = new ke(this)), + (this.dataLoader = !1), + (this.modules = {}), + (this.modulesCore = []), + (this.modulesRegular = []), + (this.deprecationAdvisor = new De(this)), + (this.optionsList = new le(this, "table constructor")), + (this.dependencyRegistry = new ze(this)), + (this.initialized = !1), + (this.destroyed = !1), + this.initializeElement(t) && + (this.initializeCoreSystems(e), + setTimeout(() => { + this._create(); + })), + this.constructor.registry.register(this); + } + initializeElement(t) { + return typeof HTMLElement < "u" && t instanceof HTMLElement + ? ((this.element = t), !0) + : typeof t == "string" + ? ((this.element = document.querySelector(t)), + !!this.element || + (console.error( + "Tabulator Creation Error - no element found matching selector: ", + t + ), + !1)) + : (console.error( + "Tabulator Creation Error - Invalid element provided:", + t + ), + !1); + } + initializeCoreSystems(t) { + (this.columnManager = new Ce(this)), + (this.rowManager = new Re(this)), + (this.footerManager = new xe(this)), + (this.dataLoader = new Me(this)), + (this.alertManager = new Ae(this)), + this._bindModules(), + (this.options = this.optionsList.generate( + H.defaultOptions, + t + )), + this._clearObjectPointers(), + this._mapDeprecatedFunctionality(), + (this.externalEvents = new Le( + this, + this.options, + this.options.debugEventsExternal + )), + (this.eventBus = new Se(this.options.debugEventsInternal)), + (this.interactionMonitor = new Te(this)), + this.dataLoader.initialize(), + this.footerManager.initialize(), + this.dependencyRegistry.initialize(); + } + _mapDeprecatedFunctionality() {} + _clearSelection() { + this.element.classList.add("tabulator-block-select"), + window.getSelection + ? window.getSelection().empty + ? window.getSelection().empty() + : window.getSelection().removeAllRanges && + window.getSelection().removeAllRanges() + : document.selection && document.selection.empty(), + this.element.classList.remove("tabulator-block-select"); + } + _create() { + this.externalEvents.dispatch("tableBuilding"), + this.eventBus.dispatch("table-building"), + this._rtlCheck(), + this._buildElement(), + this._initializeTable(), + (this.initialized = !0), + this._loadInitialData().finally(() => { + this.eventBus.dispatch("table-initialized"), + this.externalEvents.dispatch("tableBuilt"); + }); + } + _rtlCheck() { + var t = window.getComputedStyle(this.element); + switch (this.options.textDirection) { + case "auto": + if (t.direction !== "rtl") break; + case "rtl": + this.element.classList.add("tabulator-rtl"), + (this.rtl = !0); + break; + case "ltr": + this.element.classList.add("tabulator-ltr"); + default: + this.rtl = !1; + } + } + _clearObjectPointers() { + (this.options.columns = this.options.columns.slice(0)), + Array.isArray(this.options.data) && + !this.options.reactiveData && + (this.options.data = this.options.data.slice(0)); + } + _buildElement() { + var t, + e = this.element, + i = this.options; + if (e.tagName === "TABLE") { + (this.originalElement = this.element), + (t = document.createElement("div")); + var o = e.attributes; + for (var n in o) + typeof o[n] == "object" && + t.setAttribute(o[n].name, o[n].value); + e.parentNode.replaceChild(t, e), (this.element = e = t); + } + for ( + e.classList.add("tabulator"), + e.setAttribute("role", "grid"); + e.firstChild; + + ) + e.removeChild(e.firstChild); + i.height && + ((i.height = isNaN(i.height) ? i.height : i.height + "px"), + (e.style.height = i.height)), + i.minHeight !== !1 && + ((i.minHeight = isNaN(i.minHeight) + ? i.minHeight + : i.minHeight + "px"), + (e.style.minHeight = i.minHeight)), + i.maxHeight !== !1 && + ((i.maxHeight = isNaN(i.maxHeight) + ? i.maxHeight + : i.maxHeight + "px"), + (e.style.maxHeight = i.maxHeight)); + } + _initializeTable() { + var t = this.element, + e = this.options; + this.interactionMonitor.initialize(), + this.columnManager.initialize(), + this.rowManager.initialize(), + this._detectBrowser(), + this.modulesCore.forEach((i) => { + i.initialize(); + }), + t.appendChild(this.columnManager.getElement()), + t.appendChild(this.rowManager.getElement()), + e.footerElement && this.footerManager.activate(), + e.autoColumns && + e.data && + this.columnManager.generateColumnsFromRowData( + this.options.data + ), + this.modulesRegular.forEach((i) => { + i.initialize(); + }), + this.columnManager.setColumns(e.columns), + this.eventBus.dispatch("table-built"); + } + _loadInitialData() { + return this.dataLoader.load(this.options.data).finally(() => { + this.columnManager.verticalAlignHeaders(); + }); + } + destroy() { + var t = this.element; + for ( + this.destroyed = !0, + this.constructor.registry.deregister(this), + this.eventBus.dispatch("table-destroy"), + this.rowManager.destroy(); + t.firstChild; + + ) + t.removeChild(t.firstChild); + t.classList.remove("tabulator"), + this.externalEvents.dispatch("tableDestroyed"); + } + _detectBrowser() { + var t = navigator.userAgent || navigator.vendor || window.opera; + t.indexOf("Trident") > -1 + ? ((this.browser = "ie"), (this.browserSlow = !0)) + : t.indexOf("Edge") > -1 + ? ((this.browser = "edge"), (this.browserSlow = !0)) + : t.indexOf("Firefox") > -1 + ? ((this.browser = "firefox"), (this.browserSlow = !1)) + : t.indexOf("Mac OS") > -1 + ? ((this.browser = "safari"), (this.browserSlow = !1)) + : ((this.browser = "other"), (this.browserSlow = !1)), + (this.browserMobile = + /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test( + t + ) || + /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test( + t.slice(0, 4) + )); + } + initGuard(t, e) { + var i, o; + return ( + this.options.debugInitialization && + !this.initialized && + (t || + (t = + (o = + (i = new Error().stack.split(` +`))[0] == "Error" + ? i[2] + : i[1])[0] == " " + ? o.trim().split(" ")[1].split(".")[1] + : o.trim().split("@")[0]), + console.warn( + "Table Not Initialized - Calling the " + + t + + " function before the table is initialized may result in inconsistent behavior, Please wait for the `tableBuilt` event before calling this function." + + (e ? " " + e : "") + )), + this.initialized + ); + } + blockRedraw() { + this.initGuard(), + this.eventBus.dispatch("redraw-blocking"), + this.rowManager.blockRedraw(), + this.columnManager.blockRedraw(), + this.eventBus.dispatch("redraw-blocked"); + } + restoreRedraw() { + this.initGuard(), + this.eventBus.dispatch("redraw-restoring"), + this.rowManager.restoreRedraw(), + this.columnManager.restoreRedraw(), + this.eventBus.dispatch("redraw-restored"); + } + setData(t, e, i) { + return ( + this.initGuard( + !1, + "To set initial data please use the 'data' property in the table constructor." + ), + this.dataLoader.load(t, e, i, !1) + ); + } + clearData() { + this.initGuard(), + this.dataLoader.blockActiveLoad(), + this.rowManager.clearData(); + } + getData(t) { + return this.rowManager.getData(t); + } + getDataCount(t) { + return this.rowManager.getDataCount(t); + } + replaceData(t, e, i) { + return this.initGuard(), this.dataLoader.load(t, e, i, !0, !0); + } + updateData(t) { + var e = 0; + return ( + this.initGuard(), + new Promise((i, o) => { + this.dataLoader.blockActiveLoad(), + typeof t == "string" && (t = JSON.parse(t)), + t && t.length > 0 + ? t.forEach((n) => { + var r = this.rowManager.findRow( + n[this.options.index] + ); + r + ? (e++, + r + .updateData(n) + .then(() => { + --e || i(); + }) + .catch((a) => { + o( + "Update Error - Unable to update row", + n, + a + ); + })) + : o( + "Update Error - Unable to find row", + n + ); + }) + : (console.warn( + "Update Error - No data provided" + ), + o("Update Error - No data provided")); + }) + ); + } + addData(t, e, i) { + return ( + this.initGuard(), + new Promise((o, n) => { + this.dataLoader.blockActiveLoad(), + typeof t == "string" && (t = JSON.parse(t)), + t + ? this.rowManager.addRows(t, e, i).then((r) => { + var a = []; + r.forEach(function (l) { + a.push(l.getComponent()); + }), + o(a); + }) + : (console.warn( + "Update Error - No data provided" + ), + n("Update Error - No data provided")); + }) + ); + } + updateOrAddData(t) { + var e = [], + i = 0; + return ( + this.initGuard(), + new Promise((o, n) => { + this.dataLoader.blockActiveLoad(), + typeof t == "string" && (t = JSON.parse(t)), + t && t.length > 0 + ? t.forEach((r) => { + var a = this.rowManager.findRow( + r[this.options.index] + ); + i++, + a + ? a.updateData(r).then(() => { + i--, + e.push( + a.getComponent() + ), + i || o(e); + }) + : this.rowManager + .addRows(r) + .then((l) => { + i--, + e.push( + l[0].getComponent() + ), + i || o(e); + }); + }) + : (console.warn( + "Update Error - No data provided" + ), + n("Update Error - No data provided")); + }) + ); + } + getRow(t) { + var e = this.rowManager.findRow(t); + return e + ? e.getComponent() + : (console.warn("Find Error - No matching row found:", t), + !1); + } + getRowFromPosition(t) { + var e = this.rowManager.getRowFromPosition(t); + return e + ? e.getComponent() + : (console.warn("Find Error - No matching row found:", t), + !1); + } + deleteRow(t) { + var e = []; + this.initGuard(), Array.isArray(t) || (t = [t]); + for (let i of t) { + let o = this.rowManager.findRow(i, !0); + if (!o) + return ( + console.error( + "Delete Error - No matching row found:", + i + ), + Promise.reject( + "Delete Error - No matching row found" + ) + ); + e.push(o); + } + return ( + e.sort((i, o) => + this.rowManager.rows.indexOf(i) > + this.rowManager.rows.indexOf(o) + ? 1 + : -1 + ), + e.forEach((i) => { + i.delete(); + }), + this.rowManager.reRenderInPosition(), + Promise.resolve() + ); + } + addRow(t, e, i) { + return ( + this.initGuard(), + typeof t == "string" && (t = JSON.parse(t)), + this.rowManager + .addRows(t, e, i, !0) + .then((o) => o[0].getComponent()) + ); + } + updateOrAddRow(t, e) { + var i = this.rowManager.findRow(t); + return ( + this.initGuard(), + typeof e == "string" && (e = JSON.parse(e)), + i + ? i.updateData(e).then(() => i.getComponent()) + : this.rowManager + .addRows(e) + .then((o) => o[0].getComponent()) + ); + } + updateRow(t, e) { + var i = this.rowManager.findRow(t); + return ( + this.initGuard(), + typeof e == "string" && (e = JSON.parse(e)), + i + ? i + .updateData(e) + .then(() => Promise.resolve(i.getComponent())) + : (console.warn( + "Update Error - No matching row found:", + t + ), + Promise.reject( + "Update Error - No matching row found" + )) + ); + } + scrollToRow(t, e, i) { + var o = this.rowManager.findRow(t); + return o + ? this.rowManager.scrollToRow(o, e, i) + : (console.warn("Scroll Error - No matching row found:", t), + Promise.reject("Scroll Error - No matching row found")); + } + moveRow(t, e, i) { + var o = this.rowManager.findRow(t); + this.initGuard(), + o + ? o.moveToRow(e, i) + : console.warn( + "Move Error - No matching row found:", + t + ); + } + getRows(t) { + return this.rowManager.getComponents(t); + } + getRowPosition(t) { + var e = this.rowManager.findRow(t); + return e + ? e.getPosition() + : (console.warn( + "Position Error - No matching row found:", + t + ), + !1); + } + setColumns(t) { + this.initGuard( + !1, + "To set initial columns please use the 'columns' property in the table constructor" + ), + this.columnManager.setColumns(t); + } + getColumns(t) { + return this.columnManager.getComponents(t); + } + getColumn(t) { + var e = this.columnManager.findColumn(t); + return e + ? e.getComponent() + : (console.warn( + "Find Error - No matching column found:", + t + ), + !1); + } + getColumnDefinitions() { + return this.columnManager.getDefinitionTree(); + } + showColumn(t) { + var e = this.columnManager.findColumn(t); + if ((this.initGuard(), !e)) + return ( + console.warn( + "Column Show Error - No matching column found:", + t + ), + !1 + ); + e.show(); + } + hideColumn(t) { + var e = this.columnManager.findColumn(t); + if ((this.initGuard(), !e)) + return ( + console.warn( + "Column Hide Error - No matching column found:", + t + ), + !1 + ); + e.hide(); + } + toggleColumn(t) { + var e = this.columnManager.findColumn(t); + if ((this.initGuard(), !e)) + return ( + console.warn( + "Column Visibility Toggle Error - No matching column found:", + t + ), + !1 + ); + e.visible ? e.hide() : e.show(); + } + addColumn(t, e, i) { + var o = this.columnManager.findColumn(i); + return ( + this.initGuard(), + this.columnManager + .addColumn(t, e, o) + .then((n) => n.getComponent()) + ); + } + deleteColumn(t) { + var e = this.columnManager.findColumn(t); + return ( + this.initGuard(), + e + ? e.delete() + : (console.warn( + "Column Delete Error - No matching column found:", + t + ), + Promise.reject()) + ); + } + updateColumnDefinition(t, e) { + var i = this.columnManager.findColumn(t); + return ( + this.initGuard(), + i + ? i.updateDefinition(e) + : (console.warn( + "Column Update Error - No matching column found:", + t + ), + Promise.reject()) + ); + } + moveColumn(t, e, i) { + var o = this.columnManager.findColumn(t), + n = this.columnManager.findColumn(e); + this.initGuard(), + o + ? n + ? this.columnManager.moveColumn(o, n, i) + : console.warn( + "Move Error - No matching column found:", + n + ) + : console.warn( + "Move Error - No matching column found:", + t + ); + } + scrollToColumn(t, e, i) { + return new Promise((o, n) => { + var r = this.columnManager.findColumn(t); + return r + ? this.columnManager.scrollToColumn(r, e, i) + : (console.warn( + "Scroll Error - No matching column found:", + t + ), + Promise.reject( + "Scroll Error - No matching column found" + )); + }); + } + redraw(t) { + this.initGuard(), + this.columnManager.redraw(t), + this.rowManager.redraw(t); + } + setHeight(t) { + (this.options.height = isNaN(t) ? t : t + "px"), + (this.element.style.height = this.options.height), + this.rowManager.initializeRenderer(), + this.rowManager.redraw(!0); + } + on(t, e) { + this.externalEvents.subscribe(t, e); + } + off(t, e) { + this.externalEvents.unsubscribe(t, e); + } + dispatchEvent() { + Array.from(arguments).shift(), + this.externalEvents.dispatch(...arguments); + } + alert(t, e) { + this.initGuard(), this.alertManager.alert(t, e); + } + clearAlert() { + this.initGuard(), this.alertManager.clear(); + } + modExists(t, e) { + return ( + !!this.modules[t] || + (e && console.error("Tabulator Module Not Installed: " + t), + !1) + ); + } + module(t) { + var e = this.modules[t]; + return ( + e || console.error("Tabulator module not installed: " + t), + e + ); + } + }; + b(H, "defaultOptions", P); + let U = H; + var Be = { + rownum: function (s, t, e, i, o, n) { + return n.getPosition(); + }, + }; + let Q = class Q extends w { + constructor(t) { + super(t), + (this.allowedTypes = [ + "", + "data", + "download", + "clipboard", + "print", + "htmlOutput", + ]), + this.registerColumnOption("accessor"), + this.registerColumnOption("accessorParams"), + this.registerColumnOption("accessorData"), + this.registerColumnOption("accessorDataParams"), + this.registerColumnOption("accessorDownload"), + this.registerColumnOption("accessorDownloadParams"), + this.registerColumnOption("accessorClipboard"), + this.registerColumnOption("accessorClipboardParams"), + this.registerColumnOption("accessorPrint"), + this.registerColumnOption("accessorPrintParams"), + this.registerColumnOption("accessorHtmlOutput"), + this.registerColumnOption("accessorHtmlOutputParams"); + } + initialize() { + this.subscribe( + "column-layout", + this.initializeColumn.bind(this) + ), + this.subscribe( + "row-data-retrieve", + this.transformRow.bind(this) + ); + } + initializeColumn(t) { + var e = !1, + i = {}; + this.allowedTypes.forEach((o) => { + var n, + r = + "accessor" + + (o.charAt(0).toUpperCase() + o.slice(1)); + t.definition[r] && + (n = this.lookupAccessor(t.definition[r])) && + ((e = !0), + (i[r] = { + accessor: n, + params: t.definition[r + "Params"] || {}, + })); + }), + e && (t.modules.accessor = i); + } + lookupAccessor(t) { + var e = !1; + switch (typeof t) { + case "string": + Q.accessors[t] + ? (e = Q.accessors[t]) + : console.warn( + "Accessor Error - No such accessor found, ignoring: ", + t + ); + break; + case "function": + e = t; + } + return e; + } + transformRow(t, e) { + var i = "accessor" + (e.charAt(0).toUpperCase() + e.slice(1)), + o = t.getComponent(), + n = x.deepClone(t.data || {}); + return ( + this.table.columnManager.traverse(function (r) { + var a, l, h, d; + r.modules.accessor && + (l = + r.modules.accessor[i] || + r.modules.accessor.accessor || + !1) && + (a = r.getFieldValue(n)) != "undefined" && + ((d = r.getComponent()), + (h = + typeof l.params == "function" + ? l.params(a, n, e, d, o) + : l.params), + r.setFieldValue(n, l.accessor(a, n, e, h, d, o))); + }), + n + ); + } + }; + b(Q, "moduleName", "accessor"), b(Q, "accessors", Be); + let ft = Q; + var _e = { method: "GET" }; + function vt(s, t) { + var e = []; + if (((t = t || ""), Array.isArray(s))) + s.forEach((o, n) => { + e = e.concat(vt(o, t ? t + "[" + n + "]" : n)); + }); + else if (typeof s == "object") + for (var i in s) + e = e.concat(vt(s[i], t ? t + "[" + i + "]" : i)); + else e.push({ key: t, value: s }); + return e; + } + function Ve(s) { + var t = vt(s), + e = []; + return ( + t.forEach(function (i) { + e.push( + encodeURIComponent(i.key) + + "=" + + encodeURIComponent(i.value) + ); + }), + e.join("&") + ); + } + function de(s, t, e) { + return ( + s && + e && + Object.keys(e).length && + ((t.method && t.method.toLowerCase() != "get") || + ((t.method = "get"), + (s += (s.includes("?") ? "&" : "?") + Ve(e)))), + s + ); + } + function Ie(s, t, e) { + var i; + return new Promise((o, n) => { + if ( + ((s = this.urlGenerator.call(this.table, s, t, e)), + t.method.toUpperCase() != "GET") + ) + if ( + (i = + typeof this.table.options.ajaxContentType == + "object" + ? this.table.options.ajaxContentType + : this.contentTypeFormatters[ + this.table.options.ajaxContentType + ]) + ) { + for (var r in i.headers) + t.headers || (t.headers = {}), + t.headers[r] === void 0 && + (t.headers[r] = i.headers[r]); + t.body = i.body.call(this, s, t, e); + } else + console.warn( + "Ajax Error - Invalid ajaxContentType value:", + this.table.options.ajaxContentType + ); + s + ? (t.headers === void 0 && (t.headers = {}), + t.headers.Accept === void 0 && + (t.headers.Accept = "application/json"), + t.headers["X-Requested-With"] === void 0 && + (t.headers["X-Requested-With"] = "XMLHttpRequest"), + t.mode === void 0 && (t.mode = "cors"), + t.mode == "cors" + ? (t.headers.Origin === void 0 && + (t.headers.Origin = window.location.origin), + t.credentials === void 0 && + (t.credentials = "same-origin")) + : t.credentials === void 0 && + (t.credentials = "include"), + fetch(s, t) + .then((a) => { + a.ok + ? a + .json() + .then((l) => { + o(l); + }) + .catch((l) => { + n(l), + console.warn( + "Ajax Load Error - Invalid JSON returned", + l + ); + }) + : (console.error( + "Ajax Load Error - Connection Error: " + + a.status, + a.statusText + ), + n(a)); + }) + .catch((a) => { + console.error( + "Ajax Load Error - Connection Error: ", + a + ), + n(a); + })) + : (console.warn("Ajax Load Error - No URL Set"), o([])); + }); + } + function wt(s, t) { + var e = []; + if (((t = t || ""), Array.isArray(s))) + s.forEach((o, n) => { + e = e.concat(wt(o, t ? t + "[" + n + "]" : n)); + }); + else if (typeof s == "object") + for (var i in s) + e = e.concat(wt(s[i], t ? t + "[" + i + "]" : i)); + else e.push({ key: t, value: s }); + return e; + } + var Ne = { + json: { + headers: { "Content-Type": "application/json" }, + body: function (s, t, e) { + return JSON.stringify(e); + }, + }, + form: { + headers: {}, + body: function (s, t, e) { + var i = wt(e), + o = new FormData(); + return ( + i.forEach(function (n) { + o.append(n.key, n.value); + }), + o + ); + }, + }, + }; + let F = class F extends w { + constructor(t) { + super(t), + (this.config = {}), + (this.url = ""), + (this.urlGenerator = !1), + (this.params = !1), + (this.loaderPromise = !1), + this.registerTableOption("ajaxURL", !1), + this.registerTableOption("ajaxURLGenerator", !1), + this.registerTableOption("ajaxParams", {}), + this.registerTableOption("ajaxConfig", "get"), + this.registerTableOption("ajaxContentType", "form"), + this.registerTableOption("ajaxRequestFunc", !1), + this.registerTableOption("ajaxRequesting", function () {}), + this.registerTableOption("ajaxResponse", !1), + (this.contentTypeFormatters = F.contentTypeFormatters); + } + initialize() { + (this.loaderPromise = + this.table.options.ajaxRequestFunc || + F.defaultLoaderPromise), + (this.urlGenerator = + this.table.options.ajaxURLGenerator || + F.defaultURLGenerator), + this.table.options.ajaxURL && + this.setUrl(this.table.options.ajaxURL), + this.setDefaultConfig(this.table.options.ajaxConfig), + this.registerTableFunction( + "getAjaxUrl", + this.getUrl.bind(this) + ), + this.subscribe( + "data-loading", + this.requestDataCheck.bind(this) + ), + this.subscribe( + "data-params", + this.requestParams.bind(this) + ), + this.subscribe("data-load", this.requestData.bind(this)); + } + requestParams(t, e, i, o) { + var n = this.table.options.ajaxParams; + return ( + n && + (typeof n == "function" && (n = n.call(this.table)), + (o = Object.assign(Object.assign({}, n), o))), + o + ); + } + requestDataCheck(t, e, i, o) { + return !((t || !this.url) && typeof t != "string"); + } + requestData(t, e, i, o, n) { + var r; + return !n && this.requestDataCheck(t) + ? (t && this.setUrl(t), + (r = this.generateConfig(i)), + this.sendRequest(this.url, e, r)) + : n; + } + setDefaultConfig(t = {}) { + (this.config = Object.assign({}, F.defaultConfig)), + typeof t == "string" + ? (this.config.method = t) + : Object.assign(this.config, t); + } + generateConfig(t = {}) { + var e = Object.assign({}, this.config); + return ( + typeof t == "string" ? (e.method = t) : Object.assign(e, t), + e + ); + } + setUrl(t) { + this.url = t; + } + getUrl() { + return this.url; + } + sendRequest(t, e, i) { + return this.table.options.ajaxRequesting.call( + this.table, + t, + e + ) !== !1 + ? this.loaderPromise(t, i, e).then( + (o) => ( + this.table.options.ajaxResponse && + (o = this.table.options.ajaxResponse.call( + this.table, + t, + e, + o + )), + o + ) + ) + : Promise.reject(); + } + }; + b(F, "moduleName", "ajax"), + b(F, "defaultConfig", _e), + b(F, "defaultURLGenerator", de), + b(F, "defaultLoaderPromise", Ie), + b(F, "contentTypeFormatters", Ne); + let Ct = F; + var We = { + replace: function (s) { + return this.table.setData(s); + }, + update: function (s) { + return this.table.updateOrAddData(s); + }, + insert: function (s) { + return this.table.addData(s); + }, + }, + je = { + table: function (s) { + var t = [], + e = !0, + i = this.table.columnManager.columns, + o = [], + n = []; + return ( + (s = s.split(` +`)).forEach(function (r) { + t.push(r.split(" ")); + }), + !(!t.length || (t.length === 1 && t[0].length < 2)) && + (t[0].forEach(function (r) { + var a = i.find(function (l) { + return ( + r && + l.definition.title && + r.trim() && + l.definition.title.trim() === r.trim() + ); + }); + a ? o.push(a) : (e = !1); + }), + e || + ((e = !0), + (o = []), + t[0].forEach(function (r) { + var a = i.find(function (l) { + return ( + r && + l.field && + r.trim() && + l.field.trim() === r.trim() + ); + }); + a ? o.push(a) : (e = !1); + }), + e || + (o = + this.table.columnManager + .columnsByIndex)), + e && t.shift(), + t.forEach(function (r) { + var a = {}; + r.forEach(function (l, h) { + o[h] && (a[o[h].field] = l); + }), + n.push(a); + }), + n) + ); + }, + }, + Ge = { + keybindings: { + bindings: { copyToClipboard: ["ctrl + 67", "meta + 67"] }, + actions: { + copyToClipboard: function (s) { + this.table.modules.edit.currentCell || + (this.table.modExists("clipboard", !0) && + this.table.modules.clipboard.copy(!1, !0)); + }, + }, + }, + }; + let B = class B extends w { + constructor(t) { + super(t), + (this.mode = !0), + (this.pasteParser = function () {}), + (this.pasteAction = function () {}), + (this.customSelection = !1), + (this.rowRange = !1), + (this.blocked = !0), + this.registerTableOption("clipboard", !1), + this.registerTableOption("clipboardCopyStyled", !0), + this.registerTableOption("clipboardCopyConfig", !1), + this.registerTableOption("clipboardCopyFormatter", !1), + this.registerTableOption("clipboardCopyRowRange", "active"), + this.registerTableOption("clipboardPasteParser", "table"), + this.registerTableOption("clipboardPasteAction", "insert"), + this.registerColumnOption("clipboard"), + this.registerColumnOption("titleClipboard"); + } + initialize() { + (this.mode = this.table.options.clipboard), + (this.rowRange = this.table.options.clipboardCopyRowRange), + (this.mode !== !0 && this.mode !== "copy") || + this.table.element.addEventListener("copy", (t) => { + var e, i, o; + this.blocked || + (t.preventDefault(), + this.customSelection + ? ((e = this.customSelection), + this.table.options + .clipboardCopyFormatter && + (e = + this.table.options.clipboardCopyFormatter( + "plain", + e + ))) + : ((o = + this.table.modules.export.generateExportList( + this.table.options + .clipboardCopyConfig, + this.table.options + .clipboardCopyStyled, + this.rowRange, + "clipboard" + )), + (e = (i = + this.table.modules.export.generateHTMLTable( + o + )) + ? this.generatePlainContent(o) + : ""), + this.table.options + .clipboardCopyFormatter && + ((e = + this.table.options.clipboardCopyFormatter( + "plain", + e + )), + (i = + this.table.options.clipboardCopyFormatter( + "html", + i + )))), + window.clipboardData && + window.clipboardData.setData + ? window.clipboardData.setData("Text", e) + : t.clipboardData && t.clipboardData.setData + ? (t.clipboardData.setData("text/plain", e), + i && + t.clipboardData.setData( + "text/html", + i + )) + : t.originalEvent && + t.originalEvent.clipboardData.setData && + (t.originalEvent.clipboardData.setData( + "text/plain", + e + ), + i && + t.originalEvent.clipboardData.setData( + "text/html", + i + )), + this.dispatchExternal("clipboardCopied", e, i), + this.reset()); + }), + (this.mode !== !0 && this.mode !== "paste") || + this.table.element.addEventListener("paste", (t) => { + this.paste(t); + }), + this.setPasteParser( + this.table.options.clipboardPasteParser + ), + this.setPasteAction( + this.table.options.clipboardPasteAction + ), + this.registerTableFunction( + "copyToClipboard", + this.copy.bind(this) + ); + } + reset() { + (this.blocked = !0), (this.customSelection = !1); + } + generatePlainContent(t) { + var e = []; + return ( + t.forEach((i) => { + var o = []; + i.columns.forEach((n) => { + var r = ""; + if (n) + if ( + (i.type === "group" && + (n.value = n.component.getKey()), + n.value === null) + ) + r = ""; + else + switch (typeof n.value) { + case "object": + r = JSON.stringify(n.value); + break; + case "undefined": + r = ""; + break; + default: + r = n.value; + } + o.push(r); + }), + e.push(o.join(" ")); + }), + e.join(` +`) + ); + } + copy(t, e) { + var i, o; + (this.blocked = !1), + (this.customSelection = !1), + (this.mode !== !0 && this.mode !== "copy") || + ((this.rowRange = + t || this.table.options.clipboardCopyRowRange), + window.getSelection !== void 0 && + document.createRange !== void 0 + ? ((t = document.createRange()).selectNodeContents( + this.table.element + ), + (i = window.getSelection()).toString() && + e && + (this.customSelection = i.toString()), + i.removeAllRanges(), + i.addRange(t)) + : document.selection !== void 0 && + document.body.createTextRange !== void 0 && + ((o = + document.body.createTextRange()).moveToElementText( + this.table.element + ), + o.select()), + document.execCommand("copy"), + i && i.removeAllRanges()); + } + setPasteAction(t) { + switch (typeof t) { + case "string": + (this.pasteAction = B.pasteActions[t]), + this.pasteAction || + console.warn( + "Clipboard Error - No such paste action found:", + t + ); + break; + case "function": + this.pasteAction = t; + } + } + setPasteParser(t) { + switch (typeof t) { + case "string": + (this.pasteParser = B.pasteParsers[t]), + this.pasteParser || + console.warn( + "Clipboard Error - No such paste parser found:", + t + ); + break; + case "function": + this.pasteParser = t; + } + } + paste(t) { + var e, i, o; + this.checkPasteOrigin(t) && + ((e = this.getPasteData(t)), + (i = this.pasteParser.call(this, e)) + ? (t.preventDefault(), + this.table.modExists("mutator") && + (i = this.mutateData(i)), + (o = this.pasteAction.call(this, i)), + this.dispatchExternal("clipboardPasted", e, i, o)) + : this.dispatchExternal("clipboardPasteError", e)); + } + mutateData(t) { + var e = []; + return ( + Array.isArray(t) + ? t.forEach((i) => { + e.push( + this.table.modules.mutator.transformRow( + i, + "clipboard" + ) + ); + }) + : (e = t), + e + ); + } + checkPasteOrigin(t) { + var e = !0; + return ( + (!this.confirm("clipboard-paste", [t]) && + ["DIV", "SPAN"].includes(t.target.tagName)) || + (e = !1), + e + ); + } + getPasteData(t) { + var e; + return ( + window.clipboardData && window.clipboardData.getData + ? (e = window.clipboardData.getData("Text")) + : t.clipboardData && t.clipboardData.getData + ? (e = t.clipboardData.getData("text/plain")) + : t.originalEvent && + t.originalEvent.clipboardData.getData && + (e = + t.originalEvent.clipboardData.getData( + "text/plain" + )), + e + ); + } + }; + b(B, "moduleName", "clipboard"), + b(B, "moduleExtensions", Ge), + b(B, "pasteActions", We), + b(B, "pasteParsers", je); + let Et = B; + class Ue { + constructor(t) { + return ( + (this._row = t), + new Proxy(this, { + get: function (e, i, o) { + return e[i] !== void 0 + ? e[i] + : e._row.table.componentFunctionBinder.handle( + "row", + e._row, + i + ); + }, + }) + ); + } + getData(t) { + return this._row.getData(t); + } + getElement() { + return this._row.getElement(); + } + getTable() { + return this._row.table; + } + getCells() { + var t = []; + return ( + this._row.getCells().forEach(function (e) { + t.push(e.getComponent()); + }), + t + ); + } + getCell(t) { + var e = this._row.getCell(t); + return !!e && e.getComponent(); + } + _getSelf() { + return this._row; + } + } + var Je = { + avg: function (s, t, e) { + var i = 0, + o = e.precision !== void 0 ? e.precision : 2; + return ( + s.length && + ((i = s.reduce(function (n, r) { + return Number(n) + Number(r); + })), + (i /= s.length), + (i = o !== !1 ? i.toFixed(o) : i)), + parseFloat(i).toString() + ); + }, + max: function (s, t, e) { + var i = null, + o = e.precision !== void 0 && e.precision; + return ( + s.forEach(function (n) { + ((n = Number(n)) > i || i === null) && (i = n); + }), + i !== null ? (o !== !1 ? i.toFixed(o) : i) : "" + ); + }, + min: function (s, t, e) { + var i = null, + o = e.precision !== void 0 && e.precision; + return ( + s.forEach(function (n) { + ((n = Number(n)) < i || i === null) && (i = n); + }), + i !== null ? (o !== !1 ? i.toFixed(o) : i) : "" + ); + }, + sum: function (s, t, e) { + var i = 0, + o = e.precision !== void 0 && e.precision; + return ( + s.length && + s.forEach(function (n) { + (n = Number(n)), (i += isNaN(n) ? 0 : Number(n)); + }), + o !== !1 ? i.toFixed(o) : i + ); + }, + concat: function (s, t, e) { + var i = 0; + return ( + s.length && + (i = s.reduce(function (o, n) { + return String(o) + String(n); + })), + i + ); + }, + count: function (s, t, e) { + var i = 0; + return ( + s.length && + s.forEach(function (o) { + o && i++; + }), + i + ); + }, + unique: function (s, t, e) { + return s.filter((i, o) => (s || i === 0) && s.indexOf(i) === o) + .length; + }, + }; + let _ = class _ extends w { + constructor(t) { + super(t), + (this.topCalcs = []), + (this.botCalcs = []), + (this.genColumn = !1), + (this.topElement = this.createElement()), + (this.botElement = this.createElement()), + (this.topRow = !1), + (this.botRow = !1), + (this.topInitialized = !1), + (this.botInitialized = !1), + (this.blocked = !1), + (this.recalcAfterBlock = !1), + this.registerTableOption("columnCalcs", !0), + this.registerColumnOption("topCalc"), + this.registerColumnOption("topCalcParams"), + this.registerColumnOption("topCalcFormatter"), + this.registerColumnOption("topCalcFormatterParams"), + this.registerColumnOption("bottomCalc"), + this.registerColumnOption("bottomCalcParams"), + this.registerColumnOption("bottomCalcFormatter"), + this.registerColumnOption("bottomCalcFormatterParams"); + } + createElement() { + var t = document.createElement("div"); + return t.classList.add("tabulator-calcs-holder"), t; + } + initialize() { + (this.genColumn = new G({ field: "value" }, this)), + this.subscribe( + "cell-value-changed", + this.cellValueChanged.bind(this) + ), + this.subscribe( + "column-init", + this.initializeColumnCheck.bind(this) + ), + this.subscribe("row-deleted", this.rowsUpdated.bind(this)), + this.subscribe( + "scroll-horizontal", + this.scrollHorizontal.bind(this) + ), + this.subscribe("row-added", this.rowsUpdated.bind(this)), + this.subscribe( + "column-moved", + this.recalcActiveRows.bind(this) + ), + this.subscribe( + "column-add", + this.recalcActiveRows.bind(this) + ), + this.subscribe( + "data-refreshed", + this.recalcActiveRowsRefresh.bind(this) + ), + this.subscribe("table-redraw", this.tableRedraw.bind(this)), + this.subscribe("rows-visible", this.visibleRows.bind(this)), + this.subscribe( + "scrollbar-vertical", + this.adjustForScrollbar.bind(this) + ), + this.subscribe( + "redraw-blocked", + this.blockRedraw.bind(this) + ), + this.subscribe( + "redraw-restored", + this.restoreRedraw.bind(this) + ), + this.subscribe( + "table-redrawing", + this.resizeHolderWidth.bind(this) + ), + this.subscribe( + "column-resized", + this.resizeHolderWidth.bind(this) + ), + this.subscribe( + "column-show", + this.resizeHolderWidth.bind(this) + ), + this.subscribe( + "column-hide", + this.resizeHolderWidth.bind(this) + ), + this.registerTableFunction( + "getCalcResults", + this.getResults.bind(this) + ), + this.registerTableFunction( + "recalc", + this.userRecalc.bind(this) + ), + this.resizeHolderWidth(); + } + resizeHolderWidth() { + this.topElement.style.minWidth = + this.table.columnManager.headersElement.offsetWidth + "px"; + } + tableRedraw(t) { + this.recalc(this.table.rowManager.activeRows), + t && this.redraw(); + } + blockRedraw() { + (this.blocked = !0), (this.recalcAfterBlock = !1); + } + restoreRedraw() { + (this.blocked = !1), + this.recalcAfterBlock && + ((this.recalcAfterBlock = !1), + this.recalcActiveRowsRefresh()); + } + userRecalc() { + this.recalc(this.table.rowManager.activeRows); + } + blockCheck() { + return ( + this.blocked && (this.recalcAfterBlock = !0), this.blocked + ); + } + visibleRows(t, e) { + return ( + this.topRow && e.unshift(this.topRow), + this.botRow && e.push(this.botRow), + e + ); + } + rowsUpdated(t) { + this.table.options.groupBy + ? this.recalcRowGroup(t) + : this.recalcActiveRows(); + } + recalcActiveRowsRefresh() { + this.table.options.groupBy && + this.table.options.dataTreeStartExpanded && + this.table.options.dataTree + ? this.recalcAll() + : this.recalcActiveRows(); + } + recalcActiveRows() { + this.recalc(this.table.rowManager.activeRows); + } + cellValueChanged(t) { + (t.column.definition.topCalc || + t.column.definition.bottomCalc) && + (this.table.options.groupBy + ? ((this.table.options.columnCalcs != "table" && + this.table.options.columnCalcs != "both") || + this.recalcActiveRows(), + this.table.options.columnCalcs != "table" && + this.recalcRowGroup(t.row)) + : this.recalcActiveRows()); + } + initializeColumnCheck(t) { + (t.definition.topCalc || t.definition.bottomCalc) && + this.initializeColumn(t); + } + initializeColumn(t) { + var e = t.definition, + i = { + topCalcParams: e.topCalcParams || {}, + botCalcParams: e.bottomCalcParams || {}, + }; + if (e.topCalc) { + switch (typeof e.topCalc) { + case "string": + _.calculations[e.topCalc] + ? (i.topCalc = _.calculations[e.topCalc]) + : console.warn( + "Column Calc Error - No such calculation found, ignoring: ", + e.topCalc + ); + break; + case "function": + i.topCalc = e.topCalc; + } + i.topCalc && + ((t.modules.columnCalcs = i), + this.topCalcs.push(t), + this.table.options.columnCalcs != "group" && + this.initializeTopRow()); + } + if (e.bottomCalc) { + switch (typeof e.bottomCalc) { + case "string": + _.calculations[e.bottomCalc] + ? (i.botCalc = _.calculations[e.bottomCalc]) + : console.warn( + "Column Calc Error - No such calculation found, ignoring: ", + e.bottomCalc + ); + break; + case "function": + i.botCalc = e.bottomCalc; + } + i.botCalc && + ((t.modules.columnCalcs = i), + this.botCalcs.push(t), + this.table.options.columnCalcs != "group" && + this.initializeBottomRow()); + } + } + registerColumnField() {} + removeCalcs() { + var t = !1; + this.topInitialized && + ((this.topInitialized = !1), + this.topElement.parentNode.removeChild(this.topElement), + (t = !0)), + this.botInitialized && + ((this.botInitialized = !1), + this.footerRemove(this.botElement), + (t = !0)), + t && this.table.rowManager.adjustTableSize(); + } + reinitializeCalcs() { + this.topCalcs.length && this.initializeTopRow(), + this.botCalcs.length && this.initializeBottomRow(); + } + initializeTopRow() { + var t = document.createDocumentFragment(); + this.topInitialized || + (t.appendChild(document.createElement("br")), + t.appendChild(this.topElement), + this.table.columnManager + .getContentsElement() + .insertBefore( + t, + this.table.columnManager.headersElement.nextSibling + ), + (this.topInitialized = !0)); + } + initializeBottomRow() { + this.botInitialized || + (this.footerPrepend(this.botElement), + (this.botInitialized = !0)); + } + scrollHorizontal(t) { + this.botInitialized && + this.botRow && + (this.botElement.scrollLeft = t); + } + recalc(t) { + var e, i; + if ( + !this.blockCheck() && + (this.topInitialized || this.botInitialized) + ) { + if (((e = this.rowsToData(t)), this.topInitialized)) { + for ( + this.topRow && this.topRow.deleteCells(), + i = this.generateRow("top", e), + this.topRow = i; + this.topElement.firstChild; + + ) + this.topElement.removeChild( + this.topElement.firstChild + ); + this.topElement.appendChild(i.getElement()), + i.initialize(!0); + } + if (this.botInitialized) { + for ( + this.botRow && this.botRow.deleteCells(), + i = this.generateRow("bottom", e), + this.botRow = i; + this.botElement.firstChild; + + ) + this.botElement.removeChild( + this.botElement.firstChild + ); + this.botElement.appendChild(i.getElement()), + i.initialize(!0); + } + this.table.rowManager.adjustTableSize(), + this.table.modExists("frozenColumns") && + this.table.modules.frozenColumns.layout(); + } + } + recalcRowGroup(t) { + this.recalcGroup(this.table.modules.groupRows.getRowGroup(t)); + } + recalcAll() { + (this.topCalcs.length || this.botCalcs.length) && + (this.table.options.columnCalcs !== "group" && + this.recalcActiveRows(), + this.table.options.groupBy && + this.table.options.columnCalcs !== "table" && + this.table.modules.groupRows + .getChildGroups() + .forEach((t) => { + this.recalcGroup(t); + })); + } + recalcGroup(t) { + var e, i; + this.blockCheck() || + (t && + t.calcs && + (t.calcs.bottom && + ((e = this.rowsToData(t.rows)), + (i = this.generateRowData("bottom", e)), + t.calcs.bottom.updateData(i), + t.calcs.bottom.reinitialize()), + t.calcs.top && + ((e = this.rowsToData(t.rows)), + (i = this.generateRowData("top", e)), + t.calcs.top.updateData(i), + t.calcs.top.reinitialize()))); + } + generateTopRow(t) { + return this.generateRow("top", this.rowsToData(t)); + } + generateBottomRow(t) { + return this.generateRow("bottom", this.rowsToData(t)); + } + rowsToData(t) { + var e = [], + i = + this.table.options.dataTree && + this.table.options.dataTreeChildColumnCalcs, + o = this.table.modules.dataTree; + return ( + t.forEach((n) => { + e.push(n.getData()), + i && + n.modules.dataTree?.open && + this.rowsToData( + o.getFilteredTreeChildren(n) + ).forEach((r) => { + e.push(n); + }); + }), + e + ); + } + generateRow(t, e) { + var i, + o = this.generateRowData(t, e); + return ( + this.table.modExists("mutator") && + this.table.modules.mutator.disable(), + (i = new k(o, this, "calc")), + this.table.modExists("mutator") && + this.table.modules.mutator.enable(), + i + .getElement() + .classList.add( + "tabulator-calcs", + "tabulator-calcs-" + t + ), + (i.component = !1), + (i.getComponent = () => ( + i.component || (i.component = new Ue(i)), i.component + )), + (i.generateCells = () => { + var n = []; + this.table.columnManager.columnsByIndex.forEach((r) => { + this.genColumn.setField(r.getField()), + (this.genColumn.hozAlign = r.hozAlign), + r.definition[t + "CalcFormatter"] && + this.table.modExists("format") + ? (this.genColumn.modules.format = { + formatter: + this.table.modules.format.lookupFormatter( + r.definition[ + t + "CalcFormatter" + ] + ), + params: + r.definition[ + t + "CalcFormatterParams" + ] || {}, + }) + : (this.genColumn.modules.format = { + formatter: + this.table.modules.format.lookupFormatter( + "plaintext" + ), + params: {}, + }), + (this.genColumn.definition.cssClass = + r.definition.cssClass); + var a = new et(this.genColumn, i); + a.getElement(), + (a.column = r), + a.setWidth(), + r.cells.push(a), + n.push(a), + r.visible || a.hide(); + }), + (i.cells = n); + }), + i + ); + } + generateRowData(t, e) { + var i, + o, + n = {}, + r = t == "top" ? this.topCalcs : this.botCalcs, + a = t == "top" ? "topCalc" : "botCalc"; + return ( + r.forEach(function (l) { + var h = []; + l.modules.columnCalcs && + l.modules.columnCalcs[a] && + (e.forEach(function (d) { + h.push(l.getFieldValue(d)); + }), + (o = a + "Params"), + (i = + typeof l.modules.columnCalcs[o] == "function" + ? l.modules.columnCalcs[o](h, e) + : l.modules.columnCalcs[o]), + l.setFieldValue( + n, + l.modules.columnCalcs[a](h, e, i) + )); + }), + n + ); + } + hasTopCalcs() { + return !!this.topCalcs.length; + } + hasBottomCalcs() { + return !!this.botCalcs.length; + } + redraw() { + this.topRow && this.topRow.normalizeHeight(!0), + this.botRow && this.botRow.normalizeHeight(!0); + } + getResults() { + var t = {}; + return ( + this.table.options.groupBy && + this.table.modExists("groupRows") + ? this.table.modules.groupRows + .getGroups(!0) + .forEach((e) => { + t[e.getKey()] = this.getGroupResults(e); + }) + : (t = { + top: this.topRow ? this.topRow.getData() : {}, + bottom: this.botRow ? this.botRow.getData() : {}, + }), + t + ); + } + getGroupResults(t) { + var e = t._getSelf(), + i = t.getSubGroups(), + o = {}; + return ( + i.forEach((n) => { + o[n.getKey()] = this.getGroupResults(n); + }), + { + top: e.calcs.top ? e.calcs.top.getData() : {}, + bottom: e.calcs.bottom ? e.calcs.bottom.getData() : {}, + groups: o, + } + ); + } + adjustForScrollbar(t) { + this.botRow && + (this.table.rtl + ? (this.botElement.style.paddingLeft = t + "px") + : (this.botElement.style.paddingRight = t + "px")); + } + }; + b(_, "moduleName", "columnCalcs"), b(_, "calculations", Je); + let yt = _; + var qe = { + csv: function (s, t = {}, e) { + var i = t.delimiter ? t.delimiter : ",", + o = [], + n = []; + s.forEach((r) => { + var a = []; + switch (r.type) { + case "group": + console.warn( + "Download Warning - CSV downloader cannot process row groups" + ); + break; + case "calc": + console.warn( + "Download Warning - CSV downloader cannot process column calculations" + ); + break; + case "header": + r.columns.forEach((l, h) => { + l && + l.depth === 1 && + (n[h] = + l.value === void 0 || l.value === null + ? "" + : '"' + + String(l.value) + .split('"') + .join('""') + + '"'); + }); + break; + case "row": + r.columns.forEach((l) => { + if (l) { + switch (typeof l.value) { + case "object": + l.value = + l.value !== null + ? JSON.stringify(l.value) + : ""; + break; + case "undefined": + l.value = ""; + } + a.push( + '"' + + String(l.value) + .split('"') + .join('""') + + '"' + ); + } + }), + o.push(a.join(i)); + } + }), + n.length && o.unshift(n.join(i)), + (o = o.join(` +`)), + t.bom && (o = "\uFEFF" + o), + e(o, "text/csv"); + }, + json: function (s, t, e) { + var i = []; + s.forEach((o) => { + var n = {}; + switch (o.type) { + case "header": + break; + case "group": + console.warn( + "Download Warning - JSON downloader cannot process row groups" + ); + break; + case "calc": + console.warn( + "Download Warning - JSON downloader cannot process column calculations" + ); + break; + case "row": + o.columns.forEach((r) => { + r && + (n[ + r.component.getTitleDownload() || + r.component.getField() + ] = r.value); + }), + i.push(n); + } + }), + e((i = JSON.stringify(i, null, " ")), "application/json"); + }, + jsonLines: function (s, t, e) { + let i = []; + s.forEach((o) => { + let n = {}; + switch (o.type) { + case "header": + break; + case "group": + console.warn( + "Download Warning - JSON downloader cannot process row groups" + ); + break; + case "calc": + console.warn( + "Download Warning - JSON downloader cannot process column calculations" + ); + break; + case "row": + o.columns.forEach((r) => { + r && + (n[ + r.component.getTitleDownload() || + r.component.getField() + ] = r.value); + }), + i.push(JSON.stringify(n)); + } + }), + e( + i.join(` +`), + "application/x-ndjson" + ); + }, + pdf: function (s, t = {}, e) { + var i, + o, + n = [], + r = [], + a = {}, + l = t.rowGroupStyles || { + fontStyle: "bold", + fontSize: 12, + cellPadding: 6, + fillColor: 220, + }, + h = t.rowCalcStyles || { + fontStyle: "bold", + fontSize: 10, + cellPadding: 4, + fillColor: 232, + }, + d = t.jsPDF || {}, + c = t.title ? t.title : ""; + function u(m, p) { + var g = []; + return ( + m.columns.forEach((f) => { + var v; + if (f) { + switch (typeof f.value) { + case "object": + f.value = + f.value !== null + ? JSON.stringify(f.value) + : ""; + break; + case "undefined": + f.value = ""; + } + (v = { + content: f.value, + colSpan: f.width, + rowSpan: f.height, + }), + p && (v.styles = p), + g.push(v); + } + }), + g + ); + } + d.orientation || (d.orientation = t.orientation || "landscape"), + d.unit || (d.unit = "pt"), + s.forEach((m) => { + switch (m.type) { + case "header": + n.push(u(m)); + break; + case "group": + r.push(u(m, l)); + break; + case "calc": + r.push(u(m, h)); + break; + case "row": + r.push(u(m)); + } + }), + (i = this.dependencyRegistry.lookup("jspdf", "jsPDF")), + (o = new i(d)), + t.autoTable && + (a = + typeof t.autoTable == "function" + ? t.autoTable(o) || {} + : t.autoTable), + c && + (a.didDrawPage = function (m) { + o.text(c, 40, 30); + }), + (a.head = n), + (a.body = r), + o.autoTable(a), + t.documentProcessing && t.documentProcessing(o), + e(o.output("arraybuffer"), "application/pdf"); + }, + xlsx: function (s, t, e) { + var i = t.sheetName || "Sheet1", + o = this.dependencyRegistry.lookup("XLSX"), + n = o.utils.book_new(), + r = new C(this), + a = !("compress" in t) || t.compress, + l = t.writeOptions || { + bookType: "xlsx", + bookSST: !0, + compression: a, + }; + function h() { + var c = [], + u = [], + m = {}, + p = { + s: { c: 0, r: 0 }, + e: { + c: s[0] + ? s[0].columns.reduce( + (g, f) => + g + (f && f.width ? f.width : 1), + 0 + ) + : 0, + r: s.length, + }, + }; + return ( + s.forEach((g, f) => { + var v = []; + g.columns.forEach(function (E, T) { + E + ? (v.push( + E.value instanceof Date || + typeof E.value != "object" + ? E.value + : JSON.stringify(E.value) + ), + (E.width > 1 || E.height > -1) && + (E.height > 1 || E.width > 1) && + u.push({ + s: { r: f, c: T }, + e: { + r: f + E.height - 1, + c: T + E.width - 1, + }, + })) + : v.push(""); + }), + c.push(v); + }), + o.utils.sheet_add_aoa(m, c), + (m["!ref"] = o.utils.encode_range(p)), + u.length && (m["!merges"] = u), + m + ); + } + if ( + ((l.type = "binary"), + (n.SheetNames = []), + (n.Sheets = {}), + t.sheetOnly) + ) + e(h()); + else { + if (t.sheets) + for (var d in t.sheets) + t.sheets[d] === !0 + ? (n.SheetNames.push(d), (n.Sheets[d] = h())) + : (n.SheetNames.push(d), + r.commsSend( + t.sheets[d], + "download", + "intercept", + { + type: "xlsx", + options: { sheetOnly: !0 }, + active: this.active, + intercept: function (c) { + n.Sheets[d] = c; + }, + } + )); + else n.SheetNames.push(i), (n.Sheets[i] = h()); + t.documentProcessing && (n = t.documentProcessing(n)), + e( + (function (c) { + for ( + var u = new ArrayBuffer(c.length), + m = new Uint8Array(u), + p = 0; + p != c.length; + ++p + ) + m[p] = 255 & c.charCodeAt(p); + return u; + })(o.write(n, l)), + "application/octet-stream" + ); + } + }, + html: function (s, t, e) { + this.modExists("export", !0) && + e(this.modules.export.generateHTMLTable(s), "text/html"); + }, + }; + let Z = class Z extends w { + constructor(t) { + super(t), + this.registerTableOption( + "downloadEncoder", + function (e, i) { + return new Blob([e], { type: i }); + } + ), + this.registerTableOption("downloadConfig", {}), + this.registerTableOption("downloadRowRange", "active"), + this.registerColumnOption("download"), + this.registerColumnOption("titleDownload"); + } + initialize() { + this.deprecatedOptionsCheck(), + this.registerTableFunction( + "download", + this.download.bind(this) + ), + this.registerTableFunction( + "downloadToTab", + this.downloadToTab.bind(this) + ); + } + deprecatedOptionsCheck() {} + downloadToTab(t, e, i, o) { + this.download(t, e, i, o, !0); + } + download(t, e, i, o, n) { + var r = !1; + if ( + (typeof t == "function" + ? (r = t) + : Z.downloaders[t] + ? (r = Z.downloaders[t]) + : console.warn( + "Download Error - No such download type found: ", + t + ), + r) + ) { + var a = this.generateExportList(o); + r.call( + this.table, + a, + i || {}, + function (l, h) { + n + ? n === !0 + ? this.triggerDownload(l, h, t, e, !0) + : n(l) + : this.triggerDownload(l, h, t, e); + }.bind(this) + ); + } + } + generateExportList(t) { + var e = this.table.modules.export.generateExportList( + this.table.options.downloadConfig, + !1, + t || this.table.options.downloadRowRange, + "download" + ), + i = this.table.options.groupHeaderDownload; + return ( + i && !Array.isArray(i) && (i = [i]), + e.forEach((o) => { + var n; + o.type === "group" && + ((n = o.columns[0]), + i && + i[o.indent] && + (n.value = i[o.indent]( + n.value, + o.component._group.getRowCount(), + o.component._group.getData(), + o.component + ))); + }), + e + ); + } + triggerDownload(t, e, i, o, n) { + var r = document.createElement("a"), + a = this.table.options.downloadEncoder(t, e); + a && + (n + ? window.open(window.URL.createObjectURL(a)) + : ((o = + o || + "Tabulator." + + (typeof i == "function" ? "txt" : i)), + navigator.msSaveOrOpenBlob + ? navigator.msSaveOrOpenBlob(a, o) + : (r.setAttribute( + "href", + window.URL.createObjectURL(a) + ), + r.setAttribute("download", o), + (r.style.display = "none"), + document.body.appendChild(r), + r.click(), + document.body.removeChild(r))), + this.dispatchExternal("downloadComplete")); + } + commsReceived(t, e, i) { + e === "intercept" && + this.download(i.type, "", i.options, i.active, i.intercept); + } + }; + b(Z, "moduleName", "download"), b(Z, "downloaders", qe); + let Rt = Z; + function dt(s, t) { + var e = t.mask, + i = t.maskLetterChar !== void 0 ? t.maskLetterChar : "A", + o = t.maskNumberChar !== void 0 ? t.maskNumberChar : "9", + n = t.maskWildcardChar !== void 0 ? t.maskWildcardChar : "*"; + function r(a) { + var l = e[a]; + l !== void 0 && + l !== n && + l !== i && + l !== o && + ((s.value = s.value + "" + l), r(a + 1)); + } + s.addEventListener("keydown", (a) => { + var l = s.value.length, + h = a.key; + if (a.keyCode > 46 && !a.ctrlKey && !a.metaKey) { + if (l >= e.length) + return a.preventDefault(), a.stopPropagation(), !1; + switch (e[l]) { + case i: + if (h.toUpperCase() == h.toLowerCase()) + return ( + a.preventDefault(), a.stopPropagation(), !1 + ); + break; + case o: + if (isNaN(h)) + return ( + a.preventDefault(), a.stopPropagation(), !1 + ); + break; + case n: + break; + default: + if (h !== e[l]) + return ( + a.preventDefault(), a.stopPropagation(), !1 + ); + } + } + }), + s.addEventListener("keyup", (a) => { + a.keyCode > 46 && t.maskAutoFill && r(s.value.length); + }), + s.placeholder || (s.placeholder = e), + t.maskAutoFill && r(s.value.length); + } + let Xe = class { + constructor(s, t, e, i, o, n) { + (this.edit = s), + (this.table = s.table), + (this.cell = t), + (this.params = this._initializeParams(n)), + (this.data = []), + (this.displayItems = []), + (this.currentItems = []), + (this.focusedItem = null), + (this.input = this._createInputElement()), + (this.listEl = this._createListElement()), + (this.initialValues = null), + (this.isFilter = t.getType() === "header"), + (this.filterTimeout = null), + (this.filtered = !1), + (this.typing = !1), + (this.values = []), + (this.popup = null), + (this.listIteration = 0), + (this.lastAction = ""), + (this.filterTerm = ""), + (this.blurable = !0), + (this.actions = { success: i, cancel: o }), + this._deprecatedOptionsCheck(), + this._initializeValue(), + e(this._onRendered.bind(this)); + } + _deprecatedOptionsCheck() {} + _initializeValue() { + var s = this.cell.getValue(); + s === void 0 && + this.params.defaultValue !== void 0 && + (s = this.params.defaultValue), + (this.initialValues = this.params.multiselect ? s : [s]), + this.isFilter && + ((this.input.value = this.initialValues + ? this.initialValues.join(",") + : ""), + this.headerFilterInitialListGen()); + } + _onRendered() { + var s = this.cell.getElement(); + function t(e) { + e.stopPropagation(); + } + this.isFilter || + ((this.input.style.height = "100%"), + this.input.focus({ preventScroll: !0 })), + s.addEventListener("click", t), + setTimeout(() => { + s.removeEventListener("click", t); + }, 1e3), + this.input.addEventListener( + "mousedown", + this._preventPopupBlur.bind(this) + ); + } + _createListElement() { + var s = document.createElement("div"); + return ( + s.classList.add("tabulator-edit-list"), + s.addEventListener( + "mousedown", + this._preventBlur.bind(this) + ), + s.addEventListener( + "keydown", + this._inputKeyDown.bind(this) + ), + s + ); + } + _setListWidth() { + var s = this.isFilter ? this.input : this.cell.getElement(); + (this.listEl.style.minWidth = s.offsetWidth + "px"), + this.params.maxWidth && + (this.params.maxWidth === !0 + ? (this.listEl.style.maxWidth = + s.offsetWidth + "px") + : typeof this.params.maxWidth == "number" + ? (this.listEl.style.maxWidth = + this.params.maxWidth + "px") + : (this.listEl.style.maxWidth = + this.params.maxWidth)); + } + _createInputElement() { + var s = this.params.elementAttributes, + t = document.createElement("input"); + if ( + (t.setAttribute( + "type", + this.params.clearable ? "search" : "text" + ), + (t.style.padding = "4px"), + (t.style.width = "100%"), + (t.style.boxSizing = "border-box"), + this.params.autocomplete || + ((t.style.cursor = "default"), + (t.style.caretColor = "transparent")), + s && typeof s == "object") + ) + for (let e in s) + e.charAt(0) == "+" + ? ((e = e.slice(1)), + t.setAttribute(e, t.getAttribute(e) + s["+" + e])) + : t.setAttribute(e, s[e]); + return ( + this.params.mask && dt(t, this.params), + this._bindInputEvents(t), + t + ); + } + _initializeParams(s) { + var t, + e = ["values", "valuesURL", "valuesLookup"]; + return ( + ((s = Object.assign({}, s)).verticalNavigation = + s.verticalNavigation || "editor"), + (s.placeholderLoading = + s.placeholderLoading === void 0 + ? "Searching ..." + : s.placeholderLoading), + (s.placeholderEmpty = + s.placeholderEmpty === void 0 + ? "No Results Found" + : s.placeholderEmpty), + (s.filterDelay = + s.filterDelay === void 0 ? 300 : s.filterDelay), + (s.emptyValue = Object.keys(s).includes("emptyValue") + ? s.emptyValue + : ""), + (t = Object.keys(s).filter((i) => e.includes(i)).length) + ? t > 1 && + console.warn( + "list editor config error - only one of the values, valuesURL, or valuesLookup options can be set on the same editor" + ) + : console.warn( + "list editor config error - either the values, valuesURL, or valuesLookup option must be set" + ), + s.autocomplete + ? s.multiselect && + ((s.multiselect = !1), + console.warn( + "list editor config error - multiselect option is not available when autocomplete is enabled" + )) + : (s.freetext && + ((s.freetext = !1), + console.warn( + "list editor config error - freetext option is only available when autocomplete is enabled" + )), + s.filterFunc && + ((s.filterFunc = !1), + console.warn( + "list editor config error - filterFunc option is only available when autocomplete is enabled" + )), + s.filterRemote && + ((s.filterRemote = !1), + console.warn( + "list editor config error - filterRemote option is only available when autocomplete is enabled" + )), + s.mask && + ((s.mask = !1), + console.warn( + "list editor config error - mask option is only available when autocomplete is enabled" + )), + s.allowEmpty && + ((s.allowEmpty = !1), + console.warn( + "list editor config error - allowEmpty option is only available when autocomplete is enabled" + )), + s.listOnEmpty && + ((s.listOnEmpty = !1), + console.warn( + "list editor config error - listOnEmpty option is only available when autocomplete is enabled" + ))), + s.filterRemote && + typeof s.valuesLookup != "function" && + !s.valuesURL && + ((s.filterRemote = !1), + console.warn( + "list editor config error - filterRemote option should only be used when values list is populated from a remote source" + )), + s + ); + } + _bindInputEvents(s) { + s.addEventListener("focus", this._inputFocus.bind(this)), + s.addEventListener("click", this._inputClick.bind(this)), + s.addEventListener("blur", this._inputBlur.bind(this)), + s.addEventListener( + "keydown", + this._inputKeyDown.bind(this) + ), + s.addEventListener("search", this._inputSearch.bind(this)), + this.params.autocomplete && + s.addEventListener( + "keyup", + this._inputKeyUp.bind(this) + ); + } + _inputFocus(s) { + this.rebuildOptionsList(); + } + _filter() { + this.params.filterRemote + ? (clearTimeout(this.filterTimeout), + (this.filterTimeout = setTimeout(() => { + this.rebuildOptionsList(); + }, this.params.filterDelay))) + : this._filterList(); + } + _inputClick(s) { + s.stopPropagation(); + } + _inputBlur(s) { + this.blurable && + (this.popup ? this.popup.hide() : this._resolveValue(!0)); + } + _inputSearch() { + this._clearChoices(); + } + _inputKeyDown(s) { + switch (s.keyCode) { + case 38: + this._keyUp(s); + break; + case 40: + this._keyDown(s); + break; + case 37: + case 39: + this._keySide(s); + break; + case 13: + this._keyEnter(); + break; + case 27: + this._keyEsc(); + break; + case 36: + case 35: + this._keyHomeEnd(s); + break; + case 9: + this._keyTab(s); + break; + default: + this._keySelectLetter(s); + } + } + _inputKeyUp(s) { + switch (s.keyCode) { + case 38: + case 37: + case 39: + case 40: + case 13: + case 27: + break; + default: + this._keyAutoCompLetter(s); + } + } + _preventPopupBlur() { + this.popup && this.popup.blockHide(), + setTimeout(() => { + this.popup && this.popup.restoreHide(); + }, 10); + } + _preventBlur() { + (this.blurable = !1), + setTimeout(() => { + this.blurable = !0; + }, 10); + } + _keyTab(s) { + this.params.autocomplete && this.lastAction === "typing" + ? this._resolveValue(!0) + : this.focusedItem && + this._chooseItem(this.focusedItem, !0); + } + _keyUp(s) { + var t = this.displayItems.indexOf(this.focusedItem); + (this.params.verticalNavigation == "editor" || + (this.params.verticalNavigation == "hybrid" && t)) && + (s.stopImmediatePropagation(), + s.stopPropagation(), + s.preventDefault(), + t > 0 && this._focusItem(this.displayItems[t - 1])); + } + _keyDown(s) { + var t = this.displayItems.indexOf(this.focusedItem); + (this.params.verticalNavigation == "editor" || + (this.params.verticalNavigation == "hybrid" && + t < this.displayItems.length - 1)) && + (s.stopImmediatePropagation(), + s.stopPropagation(), + s.preventDefault(), + t < this.displayItems.length - 1 && + (t == -1 + ? this._focusItem(this.displayItems[0]) + : this._focusItem(this.displayItems[t + 1]))); + } + _keySide(s) { + this.params.autocomplete || + (s.stopImmediatePropagation(), + s.stopPropagation(), + s.preventDefault()); + } + _keyEnter(s) { + this.params.autocomplete && this.lastAction === "typing" + ? this._resolveValue(!0) + : this.focusedItem && this._chooseItem(this.focusedItem); + } + _keyEsc(s) { + this._cancel(); + } + _keyHomeEnd(s) { + this.params.autocomplete && s.stopImmediatePropagation(); + } + _keySelectLetter(s) { + this.params.autocomplete || + (s.preventDefault(), + s.keyCode >= 38 && + s.keyCode <= 90 && + this._scrollToValue(s.keyCode)); + } + _keyAutoCompLetter(s) { + this._filter(), + (this.lastAction = "typing"), + (this.typing = !0); + } + _scrollToValue(s) { + clearTimeout(this.filterTimeout); + var t = String.fromCharCode(s).toLowerCase(); + this.filterTerm += t.toLowerCase(); + var e = this.displayItems.find( + (i) => + i.label !== void 0 && + i.label.toLowerCase().startsWith(this.filterTerm) + ); + e && this._focusItem(e), + (this.filterTimeout = setTimeout(() => { + this.filterTerm = ""; + }, 800)); + } + _focusItem(s) { + (this.lastAction = "focus"), + this.focusedItem && + this.focusedItem.element && + this.focusedItem.element.classList.remove("focused"), + (this.focusedItem = s), + s && + s.element && + (s.element.classList.add("focused"), + s.element.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "start", + })); + } + headerFilterInitialListGen() { + this._generateOptions(!0); + } + rebuildOptionsList() { + this._generateOptions() + .then(this._sortOptions.bind(this)) + .then(this._buildList.bind(this)) + .then(this._showList.bind(this)) + .catch((s) => { + Number.isInteger(s) || + console.error("List generation error", s); + }); + } + _filterList() { + this._buildList(this._filterOptions()), this._showList(); + } + _generateOptions(s) { + var t = [], + e = ++this.listIteration; + return ( + (this.filtered = !1), + this.params.values + ? (t = this.params.values) + : this.params.valuesURL + ? (t = this._ajaxRequest( + this.params.valuesURL, + this.input.value + )) + : typeof this.params.valuesLookup == "function" + ? (t = this.params.valuesLookup( + this.cell, + this.input.value + )) + : this.params.valuesLookup && + (t = this._uniqueColumnValues( + this.params.valuesLookupField + )), + t instanceof Promise + ? (s || + this._addPlaceholder( + this.params.placeholderLoading + ), + t + .then() + .then((i) => + this.listIteration === e + ? this._parseList(i) + : Promise.reject(e) + )) + : Promise.resolve(this._parseList(t)) + ); + } + _addPlaceholder(s) { + var t = document.createElement("div"); + typeof s == "function" && + (s = s(this.cell.getComponent(), this.listEl)), + s && + (this._clearList(), + s instanceof HTMLElement + ? (t = s) + : (t.classList.add( + "tabulator-edit-list-placeholder" + ), + (t.innerHTML = s)), + this.listEl.appendChild(t), + this._showList()); + } + _ajaxRequest(s, t) { + return ( + (s = de( + s, + {}, + this.params.filterRemote ? { term: t } : {} + )), + fetch(s) + .then((e) => + e.ok + ? e + .json() + .catch( + (i) => ( + console.warn( + "List Ajax Load Error - Invalid JSON returned", + i + ), + Promise.reject(i) + ) + ) + : (console.error( + "List Ajax Load Error - Connection Error: " + + e.status, + e.statusText + ), + Promise.reject(e)) + ) + .catch( + (e) => ( + console.error( + "List Ajax Load Error - Connection Error: ", + e + ), + Promise.reject(e) + ) + ) + ); + } + _uniqueColumnValues(s) { + var t, + e = {}, + i = this.table.getData(this.params.valuesLookup); + return ( + (t = s + ? this.table.columnManager.getColumnByField(s) + : this.cell.getColumn()._getSelf()) + ? i.forEach((o) => { + var n = t.getFieldValue(o); + this._emptyValueCheck(n) || + (this.params.multiselect && Array.isArray(n) + ? n.forEach((r) => { + this._emptyValueCheck(r) || + (e[r] = !0); + }) + : (e[n] = !0)); + }) + : (console.warn( + "unable to find matching column to create select lookup list:", + s + ), + (e = [])), + Object.keys(e) + ); + } + _emptyValueCheck(s) { + return s == null || s === ""; + } + _parseList(s) { + var t = []; + return ( + Array.isArray(s) || + (s = Object.entries(s).map(([e, i]) => ({ + label: i, + value: e, + }))), + s.forEach((e) => { + typeof e != "object" && (e = { label: e, value: e }), + this._parseListItem(e, t, 0); + }), + !this.currentItems.length && + this.params.freetext && + ((this.input.value = this.initialValues), + (this.typing = !0), + (this.lastAction = "typing")), + (this.data = t), + t + ); + } + _parseListItem(s, t, e) { + var i = {}; + s.options + ? (i = this._parseListGroup(s, e + 1)) + : ((i = { + label: s.label, + value: s.value, + itemParams: s.itemParams, + elementAttributes: s.elementAttributes, + element: !1, + selected: !1, + visible: !0, + level: e, + original: s, + }), + this.initialValues && + this.initialValues.indexOf(s.value) > -1 && + this._chooseItem(i, !0)), + t.push(i); + } + _parseListGroup(s, t) { + var e = { + label: s.label, + group: !0, + itemParams: s.itemParams, + elementAttributes: s.elementAttributes, + element: !1, + visible: !0, + level: t, + options: [], + original: s, + }; + return ( + s.options.forEach((i) => { + this._parseListItem(i, e.options, t); + }), + e + ); + } + _sortOptions(s) { + var t; + return ( + this.params.sort && + ((t = + typeof this.params.sort == "function" + ? this.params.sort + : this._defaultSortFunction.bind(this)), + this._sortGroup(t, s)), + s + ); + } + _sortGroup(s, t) { + t.sort((e, i) => + s( + e.label, + i.label, + e.value, + i.value, + e.original, + i.original + ) + ), + t.forEach((e) => { + e.group && this._sortGroup(s, e.options); + }); + } + _defaultSortFunction(s, t) { + var e, + i, + o, + n, + r, + a = 0, + l = /(\d+)|(\D+)/g, + h = /\d/, + d = 0; + if ( + (this.params.sort === "desc" && ([s, t] = [t, s]), + s || s === 0) + ) { + if (t || t === 0) { + if (isFinite(s) && isFinite(t)) return s - t; + if ( + (e = String(s).toLowerCase()) === + (i = String(t).toLowerCase()) + ) + return 0; + if (!h.test(e) || !h.test(i)) return e > i ? 1 : -1; + for ( + e = e.match(l), + i = i.match(l), + r = e.length > i.length ? i.length : e.length; + a < r; + + ) + if ((o = e[a]) !== (n = i[a++])) + return isFinite(o) && isFinite(n) + ? (o.charAt(0) === "0" && (o = "." + o), + n.charAt(0) === "0" && (n = "." + n), + o - n) + : o > n + ? 1 + : -1; + return e.length > i.length; + } + d = 1; + } else d = t || t === 0 ? -1 : 0; + return d; + } + _filterOptions() { + var s = this.params.filterFunc || this._defaultFilterFunc, + t = this.input.value; + return ( + t + ? ((this.filtered = !0), + this.data.forEach((e) => { + this._filterItem(s, t, e); + })) + : (this.filtered = !1), + this.data + ); + } + _filterItem(s, t, e) { + var i = !1; + return ( + e.group + ? (e.options.forEach((o) => { + this._filterItem(s, t, o) && (i = !0); + }), + (e.visible = i)) + : (e.visible = s(t, e.label, e.value, e.original)), + e.visible + ); + } + _defaultFilterFunc(s, t, e, i) { + return ( + (s = String(s).toLowerCase()), + t != null && + (String(t).toLowerCase().indexOf(s) > -1 || + String(e).toLowerCase().indexOf(s) > -1) + ); + } + _clearList() { + for (; this.listEl.firstChild; ) + this.listEl.removeChild(this.listEl.firstChild); + this.displayItems = []; + } + _buildList(s) { + this._clearList(), + s.forEach((t) => { + this._buildItem(t); + }), + this.displayItems.length || + this._addPlaceholder(this.params.placeholderEmpty); + } + _buildItem(s) { + var t, + e = s.element; + if (!this.filtered || s.visible) { + if (!e) { + if ( + (((e = document.createElement("div")).tabIndex = 0), + (t = this.params.itemFormatter + ? this.params.itemFormatter( + s.label, + s.value, + s.original, + e + ) + : s.label) instanceof HTMLElement + ? e.appendChild(t) + : (e.innerHTML = t), + s.group + ? e.classList.add("tabulator-edit-list-group") + : e.classList.add("tabulator-edit-list-item"), + e.classList.add( + "tabulator-edit-list-group-level-" + s.level + ), + s.elementAttributes && + typeof s.elementAttributes == "object") + ) + for (let i in s.elementAttributes) + i.charAt(0) == "+" + ? ((i = i.slice(1)), + e.setAttribute( + i, + this.input.getAttribute(i) + + s.elementAttributes["+" + i] + )) + : e.setAttribute(i, s.elementAttributes[i]); + s.group + ? e.addEventListener( + "click", + this._groupClick.bind(this, s) + ) + : e.addEventListener( + "click", + this._itemClick.bind(this, s) + ), + e.addEventListener( + "mousedown", + this._preventBlur.bind(this) + ), + (s.element = e); + } + this._styleItem(s), + this.listEl.appendChild(e), + s.group + ? s.options.forEach((i) => { + this._buildItem(i); + }) + : this.displayItems.push(s); + } + } + _showList() { + var s = this.popup && this.popup.isVisible(); + if (this.input.parentNode) { + if ( + this.params.autocomplete && + this.input.value === "" && + !this.params.listOnEmpty + ) + return void (this.popup && this.popup.hide(!0)); + this._setListWidth(), + this.popup || + (this.popup = this.edit.popup(this.listEl)), + this.popup.show(this.cell.getElement(), "bottom"), + s || + setTimeout(() => { + this.popup.hideOnBlur( + this._resolveValue.bind(this, !0) + ); + }, 10); + } + } + _styleItem(s) { + s && + s.element && + (s.selected + ? s.element.classList.add("active") + : s.element.classList.remove("active")); + } + _itemClick(s, t) { + t.stopPropagation(), this._chooseItem(s); + } + _groupClick(s, t) { + t.stopPropagation(); + } + _cancel() { + this.popup.hide(!0), this.actions.cancel(); + } + _clearChoices() { + (this.typing = !0), + this.currentItems.forEach((s) => { + (s.selected = !1), this._styleItem(s); + }), + (this.currentItems = []), + (this.focusedItem = null); + } + _chooseItem(s, t) { + var e; + (this.typing = !1), + this.params.multiselect + ? ((e = this.currentItems.indexOf(s)) > -1 + ? (this.currentItems.splice(e, 1), + (s.selected = !1)) + : (this.currentItems.push(s), (s.selected = !0)), + (this.input.value = this.currentItems + .map((i) => i.label) + .join(",")), + this._styleItem(s)) + : ((this.currentItems = [s]), + (s.selected = !0), + (this.input.value = s.label), + this._styleItem(s), + t || this._resolveValue()), + this._focusItem(s); + } + _resolveValue(s) { + var t, e; + if ( + (this.popup && this.popup.hide(!0), this.params.multiselect) + ) + t = this.currentItems.map((i) => i.value); + else if (s && this.params.autocomplete && this.typing) { + if ( + !( + this.params.freetext || + (this.params.allowEmpty && this.input.value === "") + ) + ) + return void this.actions.cancel(); + t = this.input.value; + } else + t = this.currentItems[0] + ? this.currentItems[0].value + : (e = Array.isArray(this.initialValues) + ? this.initialValues[0] + : this.initialValues) == null || e === "" + ? e + : this.params.emptyValue; + t === "" && (t = this.params.emptyValue), + this.actions.success(t), + this.isFilter && + ((this.initialValues = + t && !Array.isArray(t) ? [t] : t), + (this.currentItems = [])); + } + }; + var Ke = { + input: function (s, t, e, i, o) { + var n = s.getValue(), + r = document.createElement("input"); + if ( + (r.setAttribute("type", o.search ? "search" : "text"), + (r.style.padding = "4px"), + (r.style.width = "100%"), + (r.style.boxSizing = "border-box"), + o.elementAttributes && + typeof o.elementAttributes == "object") + ) + for (let l in o.elementAttributes) + l.charAt(0) == "+" + ? ((l = l.slice(1)), + r.setAttribute( + l, + r.getAttribute(l) + + o.elementAttributes["+" + l] + )) + : r.setAttribute(l, o.elementAttributes[l]); + function a(l) { + (n == null && r.value !== "") || r.value !== n + ? e(r.value) && (n = r.value) + : i(); + } + return ( + (r.value = n !== void 0 ? n : ""), + t(function () { + s.getType() === "cell" && + (r.focus({ preventScroll: !0 }), + (r.style.height = "100%"), + o.selectContents && r.select()); + }), + r.addEventListener("change", a), + r.addEventListener("blur", a), + r.addEventListener("keydown", function (l) { + switch (l.keyCode) { + case 13: + a(); + break; + case 27: + i(); + break; + case 35: + case 36: + l.stopPropagation(); + } + }), + o.mask && dt(r, o), + r + ); + }, + textarea: function (s, t, e, i, o) { + var n = s.getValue(), + r = o.verticalNavigation || "hybrid", + a = String(n ?? ""), + l = document.createElement("textarea"), + h = 0; + if ( + ((l.style.display = "block"), + (l.style.padding = "2px"), + (l.style.height = "100%"), + (l.style.width = "100%"), + (l.style.boxSizing = "border-box"), + (l.style.whiteSpace = "pre-wrap"), + (l.style.resize = "none"), + o.elementAttributes && + typeof o.elementAttributes == "object") + ) + for (let c in o.elementAttributes) + c.charAt(0) == "+" + ? ((c = c.slice(1)), + l.setAttribute( + c, + l.getAttribute(c) + + o.elementAttributes["+" + c] + )) + : l.setAttribute(c, o.elementAttributes[c]); + function d(c) { + (n == null && l.value !== "") || l.value !== n + ? (e(l.value) && (n = l.value), + setTimeout(function () { + s.getRow().normalizeHeight(); + }, 300)) + : i(); + } + return ( + (l.value = a), + t(function () { + s.getType() === "cell" && + (l.focus({ preventScroll: !0 }), + (l.style.height = "100%"), + l.scrollHeight, + (l.style.height = l.scrollHeight + "px"), + s.getRow().normalizeHeight(), + o.selectContents && l.select()); + }), + l.addEventListener("change", d), + l.addEventListener("blur", d), + l.addEventListener("keyup", function () { + l.style.height = ""; + var c = l.scrollHeight; + (l.style.height = c + "px"), + c != h && ((h = c), s.getRow().normalizeHeight()); + }), + l.addEventListener("keydown", function (c) { + switch (c.keyCode) { + case 13: + c.shiftKey && o.shiftEnterSubmit && d(); + break; + case 27: + i(); + break; + case 38: + (r == "editor" || + (r == "hybrid" && l.selectionStart)) && + (c.stopImmediatePropagation(), + c.stopPropagation()); + break; + case 40: + (r == "editor" || + (r == "hybrid" && + l.selectionStart !== l.value.length)) && + (c.stopImmediatePropagation(), + c.stopPropagation()); + break; + case 35: + case 36: + c.stopPropagation(); + } + }), + o.mask && dt(l, o), + l + ); + }, + number: function (s, t, e, i, o) { + var n = s.getValue(), + r = o.verticalNavigation || "editor", + a = document.createElement("input"); + if ( + (a.setAttribute("type", "number"), + o.max !== void 0 && a.setAttribute("max", o.max), + o.min !== void 0 && a.setAttribute("min", o.min), + o.step !== void 0 && a.setAttribute("step", o.step), + (a.style.padding = "4px"), + (a.style.width = "100%"), + (a.style.boxSizing = "border-box"), + o.elementAttributes && + typeof o.elementAttributes == "object") + ) + for (let d in o.elementAttributes) + d.charAt(0) == "+" + ? ((d = d.slice(1)), + a.setAttribute( + d, + a.getAttribute(d) + + o.elementAttributes["+" + d] + )) + : a.setAttribute(d, o.elementAttributes[d]); + a.value = n; + var l = function (d) { + h(); + }; + function h() { + var d = a.value; + isNaN(d) || d === "" || (d = Number(d)), + d !== n ? e(d) && (n = d) : i(); + } + return ( + t(function () { + s.getType() === "cell" && + (a.removeEventListener("blur", l), + a.focus({ preventScroll: !0 }), + (a.style.height = "100%"), + a.addEventListener("blur", l), + o.selectContents && a.select()); + }), + a.addEventListener("keydown", function (d) { + switch (d.keyCode) { + case 13: + h(); + break; + case 27: + i(); + break; + case 38: + case 40: + r == "editor" && + (d.stopImmediatePropagation(), + d.stopPropagation()); + break; + case 35: + case 36: + d.stopPropagation(); + } + }), + o.mask && dt(a, o), + a + ); + }, + range: function (s, t, e, i, o) { + var n = s.getValue(), + r = document.createElement("input"); + if ( + (r.setAttribute("type", "range"), + o.max !== void 0 && r.setAttribute("max", o.max), + o.min !== void 0 && r.setAttribute("min", o.min), + o.step !== void 0 && r.setAttribute("step", o.step), + (r.style.padding = "4px"), + (r.style.width = "100%"), + (r.style.boxSizing = "border-box"), + o.elementAttributes && + typeof o.elementAttributes == "object") + ) + for (let l in o.elementAttributes) + l.charAt(0) == "+" + ? ((l = l.slice(1)), + r.setAttribute( + l, + r.getAttribute(l) + + o.elementAttributes["+" + l] + )) + : r.setAttribute(l, o.elementAttributes[l]); + function a() { + var l = r.value; + isNaN(l) || l === "" || (l = Number(l)), + l != n ? e(l) && (n = l) : i(); + } + return ( + (r.value = n), + t(function () { + s.getType() === "cell" && + (r.focus({ preventScroll: !0 }), + (r.style.height = "100%")); + }), + r.addEventListener("blur", function (l) { + a(); + }), + r.addEventListener("keydown", function (l) { + switch (l.keyCode) { + case 13: + a(); + break; + case 27: + i(); + } + }), + r + ); + }, + date: function (s, t, e, i, o) { + var n = o.format, + r = o.verticalNavigation || "editor", + a = n ? window.DateTime || luxon.DateTime : null, + l = s.getValue(), + h = document.createElement("input"); + function d(u) { + return ( + a.isDateTime(u) + ? u + : n === "iso" + ? a.fromISO(String(u)) + : a.fromFormat(String(u), n) + ).toFormat("yyyy-MM-dd"); + } + if ( + ((h.type = "date"), + (h.style.padding = "4px"), + (h.style.width = "100%"), + (h.style.boxSizing = "border-box"), + o.max && h.setAttribute("max", n ? d(o.max) : o.max), + o.min && h.setAttribute("min", n ? d(o.min) : o.min), + o.elementAttributes && + typeof o.elementAttributes == "object") + ) + for (let u in o.elementAttributes) + u.charAt(0) == "+" + ? ((u = u.slice(1)), + h.setAttribute( + u, + h.getAttribute(u) + + o.elementAttributes["+" + u] + )) + : h.setAttribute(u, o.elementAttributes[u]); + function c() { + var u, + m = h.value; + if ((l == null && m !== "") || m !== l) { + if (m && n) + switch ( + ((u = a.fromFormat(String(m), "yyyy-MM-dd")), n) + ) { + case !0: + m = u; + break; + case "iso": + m = u.toISO(); + break; + default: + m = u.toFormat(n); + } + e(m) && (l = h.value); + } else i(); + } + return ( + (l = l !== void 0 ? l : ""), + n && + (a + ? (l = d(l)) + : console.error( + "Editor Error - 'date' editor 'format' param is dependant on luxon.js" + )), + (h.value = l), + t(function () { + s.getType() === "cell" && + (h.focus({ preventScroll: !0 }), + (h.style.height = "100%"), + o.selectContents && h.select()); + }), + h.addEventListener("blur", function (u) { + (u.relatedTarget || + u.rangeParent || + u.explicitOriginalTarget !== h) && + c(); + }), + h.addEventListener("keydown", function (u) { + switch (u.keyCode) { + case 13: + c(); + break; + case 27: + i(); + break; + case 35: + case 36: + u.stopPropagation(); + break; + case 38: + case 40: + r == "editor" && + (u.stopImmediatePropagation(), + u.stopPropagation()); + } + }), + h + ); + }, + time: function (s, t, e, i, o) { + var n, + r = o.format, + a = o.verticalNavigation || "editor", + l = r ? window.DateTime || luxon.DateTime : null, + h = s.getValue(), + d = document.createElement("input"); + if ( + ((d.type = "time"), + (d.style.padding = "4px"), + (d.style.width = "100%"), + (d.style.boxSizing = "border-box"), + o.elementAttributes && + typeof o.elementAttributes == "object") + ) + for (let u in o.elementAttributes) + u.charAt(0) == "+" + ? ((u = u.slice(1)), + d.setAttribute( + u, + d.getAttribute(u) + + o.elementAttributes["+" + u] + )) + : d.setAttribute(u, o.elementAttributes[u]); + function c() { + var u, + m = d.value; + if ((h == null && m !== "") || m !== h) { + if (m && r) + switch ( + ((u = l.fromFormat(String(m), "hh:mm")), r) + ) { + case !0: + m = u; + break; + case "iso": + m = u.toISO(); + break; + default: + m = u.toFormat(r); + } + e(m) && (h = d.value); + } else i(); + } + return ( + (h = h !== void 0 ? h : ""), + r && + (l + ? ((n = l.isDateTime(h) + ? h + : r === "iso" + ? l.fromISO(String(h)) + : l.fromFormat(String(h), r)), + (h = n.toFormat("HH:mm"))) + : console.error( + "Editor Error - 'date' editor 'format' param is dependant on luxon.js" + )), + (d.value = h), + t(function () { + s.getType() == "cell" && + (d.focus({ preventScroll: !0 }), + (d.style.height = "100%"), + o.selectContents && d.select()); + }), + d.addEventListener("blur", function (u) { + (u.relatedTarget || + u.rangeParent || + u.explicitOriginalTarget !== d) && + c(); + }), + d.addEventListener("keydown", function (u) { + switch (u.keyCode) { + case 13: + c(); + break; + case 27: + i(); + break; + case 35: + case 36: + u.stopPropagation(); + break; + case 38: + case 40: + a == "editor" && + (u.stopImmediatePropagation(), + u.stopPropagation()); + } + }), + d + ); + }, + datetime: function (s, t, e, i, o) { + var n, + r = o.format, + a = o.verticalNavigation || "editor", + l = r + ? this.table.dependencyRegistry.lookup( + ["luxon", "DateTime"], + "DateTime" + ) + : null, + h = s.getValue(), + d = document.createElement("input"); + if ( + ((d.type = "datetime-local"), + (d.style.padding = "4px"), + (d.style.width = "100%"), + (d.style.boxSizing = "border-box"), + o.elementAttributes && + typeof o.elementAttributes == "object") + ) + for (let u in o.elementAttributes) + u.charAt(0) == "+" + ? ((u = u.slice(1)), + d.setAttribute( + u, + d.getAttribute(u) + + o.elementAttributes["+" + u] + )) + : d.setAttribute(u, o.elementAttributes[u]); + function c() { + var u, + m = d.value; + if ((h == null && m !== "") || m !== h) { + if (m && r) + switch (((u = l.fromISO(String(m))), r)) { + case !0: + m = u; + break; + case "iso": + m = u.toISO(); + break; + default: + m = u.toFormat(r); + } + e(m) && (h = d.value); + } else i(); + } + return ( + (h = h !== void 0 ? h : ""), + r && + (l + ? ((n = l.isDateTime(h) + ? h + : r === "iso" + ? l.fromISO(String(h)) + : l.fromFormat(String(h), r)), + (h = + n.toFormat("yyyy-MM-dd") + + "T" + + n.toFormat("HH:mm"))) + : console.error( + "Editor Error - 'date' editor 'format' param is dependant on luxon.js" + )), + (d.value = h), + t(function () { + s.getType() === "cell" && + (d.focus({ preventScroll: !0 }), + (d.style.height = "100%"), + o.selectContents && d.select()); + }), + d.addEventListener("blur", function (u) { + (u.relatedTarget || + u.rangeParent || + u.explicitOriginalTarget !== d) && + c(); + }), + d.addEventListener("keydown", function (u) { + switch (u.keyCode) { + case 13: + c(); + break; + case 27: + i(); + break; + case 35: + case 36: + u.stopPropagation(); + break; + case 38: + case 40: + a == "editor" && + (u.stopImmediatePropagation(), + u.stopPropagation()); + } + }), + d + ); + }, + list: function (s, t, e, i, o) { + return new Xe(this, s, t, e, i, o).input; + }, + star: function (s, t, e, i, o) { + var n = this, + r = s.getElement(), + a = s.getValue(), + l = r.getElementsByTagName("svg").length || 5, + h = r.getElementsByTagName("svg")[0] + ? r.getElementsByTagName("svg")[0].getAttribute("width") + : 14, + d = [], + c = document.createElement("div"), + u = document.createElementNS( + "http://www.w3.org/2000/svg", + "svg" + ); + function m(v) { + d.forEach(function (E, T) { + T < v + ? (n.table.browser == "ie" + ? E.setAttribute( + "class", + "tabulator-star-active" + ) + : E.classList.replace( + "tabulator-star-inactive", + "tabulator-star-active" + ), + (E.innerHTML = + '')) + : (n.table.browser == "ie" + ? E.setAttribute( + "class", + "tabulator-star-inactive" + ) + : E.classList.replace( + "tabulator-star-active", + "tabulator-star-inactive" + ), + (E.innerHTML = + '')); + }); + } + function p(v) { + var E = document.createElement("span"), + T = u.cloneNode(!0); + d.push(T), + E.addEventListener("mouseenter", function (M) { + M.stopPropagation(), + M.stopImmediatePropagation(), + m(v); + }), + E.addEventListener("mousemove", function (M) { + M.stopPropagation(), M.stopImmediatePropagation(); + }), + E.addEventListener("click", function (M) { + M.stopPropagation(), + M.stopImmediatePropagation(), + e(v), + r.blur(); + }), + E.appendChild(T), + c.appendChild(E); + } + function g(v) { + (a = v), m(v); + } + if ( + ((r.style.whiteSpace = "nowrap"), + (r.style.overflow = "hidden"), + (r.style.textOverflow = "ellipsis"), + (c.style.verticalAlign = "middle"), + (c.style.display = "inline-block"), + (c.style.padding = "4px"), + u.setAttribute("width", h), + u.setAttribute("height", h), + u.setAttribute("viewBox", "0 0 512 512"), + u.setAttribute("xml:space", "preserve"), + (u.style.padding = "0 1px"), + o.elementAttributes && + typeof o.elementAttributes == "object") + ) + for (let v in o.elementAttributes) + v.charAt(0) == "+" + ? ((v = v.slice(1)), + c.setAttribute( + v, + c.getAttribute(v) + + o.elementAttributes["+" + v] + )) + : c.setAttribute(v, o.elementAttributes[v]); + for (var f = 1; f <= l; f++) p(f); + return ( + m((a = Math.min(parseInt(a), l))), + c.addEventListener("mousemove", function (v) { + m(0); + }), + c.addEventListener("click", function (v) { + e(0); + }), + r.addEventListener("blur", function (v) { + i(); + }), + r.addEventListener("keydown", function (v) { + switch (v.keyCode) { + case 39: + g(a + 1); + break; + case 37: + g(a - 1); + break; + case 13: + e(a); + break; + case 27: + i(); + } + }), + c + ); + }, + progress: function (s, t, e, i, o) { + var n, + r, + a = s.getElement(), + l = + o.max === void 0 + ? (a.getElementsByTagName("div")[0] && + a + .getElementsByTagName("div")[0] + .getAttribute("max")) || + 100 + : o.max, + h = + o.min === void 0 + ? (a.getElementsByTagName("div")[0] && + a + .getElementsByTagName("div")[0] + .getAttribute("min")) || + 0 + : o.min, + d = (l - h) / 100, + c = s.getValue() || 0, + u = document.createElement("div"), + m = document.createElement("div"); + function p() { + var g = window.getComputedStyle(a, null), + f = + d * + Math.round( + m.offsetWidth / + ((a.clientWidth - + parseInt( + g.getPropertyValue( + "padding-left" + ) + ) - + parseInt( + g.getPropertyValue( + "padding-right" + ) + )) / + 100) + ) + + h; + e(f), + a.setAttribute("aria-valuenow", f), + a.setAttribute("aria-label", c); + } + if ( + ((u.style.position = "absolute"), + (u.style.right = "0"), + (u.style.top = "0"), + (u.style.bottom = "0"), + (u.style.width = "5px"), + u.classList.add("tabulator-progress-handle"), + (m.style.display = "inline-block"), + (m.style.position = "relative"), + (m.style.height = "100%"), + (m.style.backgroundColor = "#488CE9"), + (m.style.maxWidth = "100%"), + (m.style.minWidth = "0%"), + o.elementAttributes && + typeof o.elementAttributes == "object") + ) + for (let g in o.elementAttributes) + g.charAt(0) == "+" + ? ((g = g.slice(1)), + m.setAttribute( + g, + m.getAttribute(g) + + o.elementAttributes["+" + g] + )) + : m.setAttribute(g, o.elementAttributes[g]); + return ( + (a.style.padding = "4px 4px"), + (c = Math.min(parseFloat(c), l)), + (c = Math.max(parseFloat(c), h)), + (c = Math.round((c - h) / d)), + (m.style.width = c + "%"), + a.setAttribute("aria-valuemin", h), + a.setAttribute("aria-valuemax", l), + m.appendChild(u), + u.addEventListener("mousedown", function (g) { + (n = g.screenX), (r = m.offsetWidth); + }), + u.addEventListener("mouseover", function () { + u.style.cursor = "ew-resize"; + }), + a.addEventListener("mousemove", function (g) { + n && (m.style.width = r + g.screenX - n + "px"); + }), + a.addEventListener("mouseup", function (g) { + n && + (g.stopPropagation(), + g.stopImmediatePropagation(), + (n = !1), + (r = !1), + p()); + }), + a.addEventListener("keydown", function (g) { + switch (g.keyCode) { + case 39: + g.preventDefault(), + (m.style.width = + m.clientWidth + + a.clientWidth / 100 + + "px"); + break; + case 37: + g.preventDefault(), + (m.style.width = + m.clientWidth - + a.clientWidth / 100 + + "px"); + break; + case 9: + case 13: + p(); + break; + case 27: + i(); + } + }), + a.addEventListener("blur", function () { + i(); + }), + m + ); + }, + tickCross: function (s, t, e, i, o) { + var n = s.getValue(), + r = document.createElement("input"), + a = o.tristate, + l = + o.indeterminateValue === void 0 + ? null + : o.indeterminateValue, + h = !1, + d = Object.keys(o).includes("trueValue"), + c = Object.keys(o).includes("falseValue"); + if ( + (r.setAttribute("type", "checkbox"), + (r.style.marginTop = "5px"), + (r.style.boxSizing = "border-box"), + o.elementAttributes && + typeof o.elementAttributes == "object") + ) + for (let m in o.elementAttributes) + m.charAt(0) == "+" + ? ((m = m.slice(1)), + r.setAttribute( + m, + r.getAttribute(m) + + o.elementAttributes["+" + m] + )) + : r.setAttribute(m, o.elementAttributes[m]); + function u(m) { + var p = r.checked; + return ( + d && p + ? (p = o.trueValue) + : c && !p && (p = o.falseValue), + a + ? m + ? h + ? l + : p + : r.checked && !h + ? ((r.checked = !1), + (r.indeterminate = !0), + (h = !0), + l) + : ((h = !1), p) + : p + ); + } + return ( + (r.value = n), + !a || + (n !== void 0 && n !== l && n !== "") || + ((h = !0), (r.indeterminate = !0)), + this.table.browser != "firefox" && + this.table.browser != "safari" && + t(function () { + s.getType() === "cell" && + r.focus({ preventScroll: !0 }); + }), + (r.checked = d + ? n === o.trueValue + : n === !0 || n === "true" || n === "True" || n === 1), + r.addEventListener("change", function (m) { + e(u()); + }), + r.addEventListener("blur", function (m) { + e(u(!0)); + }), + r.addEventListener("keydown", function (m) { + m.keyCode == 13 && e(u()), m.keyCode == 27 && i(); + }), + r + ); + }, + adaptable: function (s, t, e, i, o) { + var n, + r, + a = s._getSelf().column; + return ( + (n = o.editorLookup + ? o.editorLookup(s) + : (function (l) { + var h = l.getValue(), + d = "input"; + switch (typeof h) { + case "number": + d = "number"; + break; + case "boolean": + d = "tickCross"; + break; + case "string": + h.includes(` +`) && (d = "textarea"); + } + return d; + })(s)), + o.paramsLookup && + (r = + typeof o.paramsLookup == "function" + ? o.paramsLookup(n, s) + : o.paramsLookup[n]), + this.table.modules.edit + .lookupEditor(n, a) + .call(this, s, t, e, i, r || {}) + ); + }, + }; + let st = class st extends w { + constructor(t) { + super(t), + (this.currentCell = !1), + (this.mouseClick = !1), + (this.recursionBlock = !1), + (this.invalidEdit = !1), + (this.editedCells = []), + (this.convertEmptyValues = !1), + (this.editors = st.editors), + this.registerTableOption("editTriggerEvent", "focus"), + this.registerTableOption("editorEmptyValue"), + this.registerTableOption( + "editorEmptyValueFunc", + this.emptyValueCheck.bind(this) + ), + this.registerColumnOption("editable"), + this.registerColumnOption("editor"), + this.registerColumnOption("editorParams"), + this.registerColumnOption("editorEmptyValue"), + this.registerColumnOption("editorEmptyValueFunc"), + this.registerColumnOption("cellEditing"), + this.registerColumnOption("cellEdited"), + this.registerColumnOption("cellEditCancelled"), + this.registerTableFunction( + "getEditedCells", + this.getEditedCells.bind(this) + ), + this.registerTableFunction( + "clearCellEdited", + this.clearCellEdited.bind(this) + ), + this.registerTableFunction( + "navigatePrev", + this.navigatePrev.bind(this) + ), + this.registerTableFunction( + "navigateNext", + this.navigateNext.bind(this) + ), + this.registerTableFunction( + "navigateLeft", + this.navigateLeft.bind(this) + ), + this.registerTableFunction( + "navigateRight", + this.navigateRight.bind(this) + ), + this.registerTableFunction( + "navigateUp", + this.navigateUp.bind(this) + ), + this.registerTableFunction( + "navigateDown", + this.navigateDown.bind(this) + ), + this.registerComponentFunction( + "cell", + "isEdited", + this.cellIsEdited.bind(this) + ), + this.registerComponentFunction( + "cell", + "clearEdited", + this.clearEdited.bind(this) + ), + this.registerComponentFunction( + "cell", + "edit", + this.editCell.bind(this) + ), + this.registerComponentFunction( + "cell", + "cancelEdit", + this.cellCancelEdit.bind(this) + ), + this.registerComponentFunction( + "cell", + "navigatePrev", + this.navigatePrev.bind(this) + ), + this.registerComponentFunction( + "cell", + "navigateNext", + this.navigateNext.bind(this) + ), + this.registerComponentFunction( + "cell", + "navigateLeft", + this.navigateLeft.bind(this) + ), + this.registerComponentFunction( + "cell", + "navigateRight", + this.navigateRight.bind(this) + ), + this.registerComponentFunction( + "cell", + "navigateUp", + this.navigateUp.bind(this) + ), + this.registerComponentFunction( + "cell", + "navigateDown", + this.navigateDown.bind(this) + ); + } + initialize() { + this.subscribe("cell-init", this.bindEditor.bind(this)), + this.subscribe("cell-delete", this.clearEdited.bind(this)), + this.subscribe( + "cell-value-changed", + this.updateCellClass.bind(this) + ), + this.subscribe( + "column-layout", + this.initializeColumnCheck.bind(this) + ), + this.subscribe( + "column-delete", + this.columnDeleteCheck.bind(this) + ), + this.subscribe( + "row-deleting", + this.rowDeleteCheck.bind(this) + ), + this.subscribe( + "row-layout", + this.rowEditableCheck.bind(this) + ), + this.subscribe( + "data-refreshing", + this.cancelEdit.bind(this) + ), + this.subscribe( + "clipboard-paste", + this.pasteBlocker.bind(this) + ), + this.subscribe( + "keybinding-nav-prev", + this.navigatePrev.bind(this, void 0) + ), + this.subscribe( + "keybinding-nav-next", + this.keybindingNavigateNext.bind(this) + ), + this.subscribe( + "keybinding-nav-up", + this.navigateUp.bind(this, void 0) + ), + this.subscribe( + "keybinding-nav-down", + this.navigateDown.bind(this, void 0) + ), + Object.keys(this.table.options).includes( + "editorEmptyValue" + ) && (this.convertEmptyValues = !0); + } + pasteBlocker(t) { + if (this.currentCell) return !0; + } + keybindingNavigateNext(t) { + var e = this.currentCell, + i = this.options("tabEndNewRow"); + e && + (this.navigateNext(e, t) || + (i && + (e.getElement().firstChild.blur(), + this.invalidEdit || + (i = + i === !0 + ? this.table.addRow({}) + : typeof i == "function" + ? this.table.addRow( + i(e.row.getComponent()) + ) + : this.table.addRow( + Object.assign({}, i) + )).then(() => { + setTimeout(() => { + e.getComponent().navigateNext(); + }); + })))); + } + cellIsEdited(t) { + return !!t.modules.edit && t.modules.edit.edited; + } + cellCancelEdit(t) { + t === this.currentCell + ? this.table.modules.edit.cancelEdit() + : console.warn( + "Cancel Editor Error - This cell is not currently being edited " + ); + } + updateCellClass(t) { + this.allowEdit(t) + ? t.getElement().classList.add("tabulator-editable") + : t.getElement().classList.remove("tabulator-editable"); + } + clearCellEdited(t) { + t || (t = this.table.modules.edit.getEditedCells()), + Array.isArray(t) || (t = [t]), + t.forEach((e) => { + this.table.modules.edit.clearEdited(e._getSelf()); + }); + } + navigatePrev(t = this.currentCell, e) { + var i, o; + if (t) { + if ((e && e.preventDefault(), (i = this.navigateLeft()))) + return !0; + if ( + (o = this.table.rowManager.prevDisplayRow(t.row, !0)) && + (i = this.findPrevEditableCell(o, o.cells.length)) + ) + return i.getComponent().edit(), !0; + } + return !1; + } + navigateNext(t = this.currentCell, e) { + var i, o; + if (t) { + if ((e && e.preventDefault(), (i = this.navigateRight()))) + return !0; + if ( + (o = this.table.rowManager.nextDisplayRow(t.row, !0)) && + (i = this.findNextEditableCell(o, -1)) + ) + return i.getComponent().edit(), !0; + } + return !1; + } + navigateLeft(t = this.currentCell, e) { + var i, o; + return ( + !!( + t && + (e && e.preventDefault(), + (i = t.getIndex()), + (o = this.findPrevEditableCell(t.row, i))) + ) && (o.getComponent().edit(), !0) + ); + } + navigateRight(t = this.currentCell, e) { + var i, o; + return ( + !!( + t && + (e && e.preventDefault(), + (i = t.getIndex()), + (o = this.findNextEditableCell(t.row, i))) + ) && (o.getComponent().edit(), !0) + ); + } + navigateUp(t = this.currentCell, e) { + var i, o; + return ( + !!( + t && + (e && e.preventDefault(), + (i = t.getIndex()), + (o = this.table.rowManager.prevDisplayRow(t.row, !0))) + ) && (o.cells[i].getComponent().edit(), !0) + ); + } + navigateDown(t = this.currentCell, e) { + var i, o; + return ( + !!( + t && + (e && e.preventDefault(), + (i = t.getIndex()), + (o = this.table.rowManager.nextDisplayRow(t.row, !0))) + ) && (o.cells[i].getComponent().edit(), !0) + ); + } + findNextEditableCell(t, e) { + var i = !1; + if (e < t.cells.length - 1) + for (var o = e + 1; o < t.cells.length; o++) { + let n = t.cells[o]; + if ( + n.column.modules.edit && + x.elVisible(n.getElement()) && + this.allowEdit(n) + ) { + i = n; + break; + } + } + return i; + } + findPrevEditableCell(t, e) { + var i = !1; + if (e > 0) + for (var o = e - 1; o >= 0; o--) { + let n = t.cells[o]; + if ( + n.column.modules.edit && + x.elVisible(n.getElement()) && + this.allowEdit(n) + ) { + i = n; + break; + } + } + return i; + } + initializeColumnCheck(t) { + t.definition.editor !== void 0 && this.initializeColumn(t); + } + columnDeleteCheck(t) { + this.currentCell && + this.currentCell.column === t && + this.cancelEdit(); + } + rowDeleteCheck(t) { + this.currentCell && + this.currentCell.row === t && + this.cancelEdit(); + } + rowEditableCheck(t) { + t.getCells().forEach((e) => { + e.column.modules.edit && + typeof e.column.modules.edit.check == "function" && + this.updateCellClass(e); + }); + } + initializeColumn(t) { + var e = Object.keys(t.definition).includes("editorEmptyValue"), + i = { + editor: !1, + blocked: !1, + check: t.definition.editable, + params: t.definition.editorParams || {}, + convertEmptyValues: e, + editorEmptyValue: t.definition.editorEmptyValue, + editorEmptyValueFunc: t.definition.editorEmptyValueFunc, + }; + (i.editor = this.lookupEditor(t.definition.editor, t)), + i.editor && (t.modules.edit = i); + } + lookupEditor(t, e) { + var i; + switch (typeof t) { + case "string": + this.editors[t] + ? (i = this.editors[t]) + : console.warn( + "Editor Error - No such editor found: ", + t + ); + break; + case "function": + i = t; + break; + case "boolean": + t === !0 && + (typeof e.definition.formatter != "function" + ? (i = this.editors[e.definition.formatter] + ? this.editors[e.definition.formatter] + : this.editors.input) + : console.warn( + "Editor Error - Cannot auto lookup editor for a custom formatter: ", + e.definition.formatter + )); + } + return i; + } + getCurrentCell() { + return !!this.currentCell && this.currentCell.getComponent(); + } + clearEditor(t) { + var e, + i = this.currentCell; + if (((this.invalidEdit = !1), i)) { + for ( + this.currentCell = !1, + e = i.getElement(), + this.dispatch("edit-editor-clear", i, t), + e.classList.remove("tabulator-editing"); + e.firstChild; + + ) + e.removeChild(e.firstChild); + i.row.getElement().classList.remove("tabulator-editing"), + i.table.element.classList.remove("tabulator-editing"); + } + } + cancelEdit() { + if (this.currentCell) { + var t = this.currentCell, + e = this.currentCell.getComponent(); + this.clearEditor(!0), + t.setValueActual(t.getValue()), + t.cellRendered(), + (t.column.definition.editor == "textarea" || + t.column.definition.variableHeight) && + t.row.normalizeHeight(!0), + t.column.definition.cellEditCancelled && + t.column.definition.cellEditCancelled.call( + this.table, + e + ), + this.dispatch("edit-cancelled", t), + this.dispatchExternal("cellEditCancelled", e); + } + } + bindEditor(t) { + if (t.column.modules.edit) { + var e = this, + i = t.getElement(!0); + this.updateCellClass(t), + i.setAttribute("tabindex", 0), + i.addEventListener("mousedown", function (o) { + o.button === 2 + ? o.preventDefault() + : (e.mouseClick = !0); + }), + this.options("editTriggerEvent") === "dblclick" && + i.addEventListener("dblclick", function (o) { + i.classList.contains("tabulator-editing") || + (i.focus({ preventScroll: !0 }), + e.edit(t, o, !1)); + }), + (this.options("editTriggerEvent") !== "focus" && + this.options("editTriggerEvent") !== "click") || + i.addEventListener("click", function (o) { + i.classList.contains("tabulator-editing") || + (i.focus({ preventScroll: !0 }), + e.edit(t, o, !1)); + }), + this.options("editTriggerEvent") === "focus" && + i.addEventListener("focus", function (o) { + e.recursionBlock || e.edit(t, o, !1); + }); + } + } + focusCellNoEvent(t, e) { + (this.recursionBlock = !0), + (e && this.table.browser === "ie") || + t.getElement().focus({ preventScroll: !0 }), + (this.recursionBlock = !1); + } + editCell(t, e) { + this.focusCellNoEvent(t), this.edit(t, !1, e); + } + focusScrollAdjust(t) { + if (this.table.rowManager.getRenderMode() == "virtual") { + var e = this.table.rowManager.element.scrollTop, + i = + this.table.rowManager.element.clientHeight + + this.table.rowManager.element.scrollTop, + o = t.row.getElement(); + o.offsetTop < e + ? (this.table.rowManager.element.scrollTop -= + e - o.offsetTop) + : o.offsetTop + o.offsetHeight > i && + (this.table.rowManager.element.scrollTop += + o.offsetTop + o.offsetHeight - i); + var n = this.table.rowManager.element.scrollLeft, + r = + this.table.rowManager.element.clientWidth + + this.table.rowManager.element.scrollLeft, + a = t.getElement(); + this.table.modExists("frozenColumns") && + ((n += parseInt( + this.table.modules.frozenColumns.leftMargin || 0 + )), + (r -= parseInt( + this.table.modules.frozenColumns.rightMargin || 0 + ))), + this.table.options.renderHorizontal === "virtual" && + ((n -= parseInt( + this.table.columnManager.renderer.vDomPadLeft + )), + (r -= parseInt( + this.table.columnManager.renderer.vDomPadLeft + ))), + a.offsetLeft < n + ? (this.table.rowManager.element.scrollLeft -= + n - a.offsetLeft) + : a.offsetLeft + a.offsetWidth > r && + (this.table.rowManager.element.scrollLeft += + a.offsetLeft + a.offsetWidth - r); + } + } + allowEdit(t) { + var e = !!t.column.modules.edit; + if (t.column.modules.edit) + switch (typeof t.column.modules.edit.check) { + case "function": + t.row.initialized && + (e = t.column.modules.edit.check( + t.getComponent() + )); + break; + case "string": + e = !!t.row.data[t.column.modules.edit.check]; + break; + case "boolean": + e = t.column.modules.edit.check; + } + return e; + } + edit(t, e, i) { + var o, + n, + r, + a = this, + l = function () {}, + h = t.getElement(), + d = !1; + if (!this.currentCell) { + if (t.column.modules.edit.blocked) + return (this.mouseClick = !1), this.blur(h), !1; + if ((e && e.stopPropagation(), this.allowEdit(t) || i)) { + if ( + (a.cancelEdit(), + (a.currentCell = t), + this.focusScrollAdjust(t), + (n = t.getComponent()), + this.mouseClick && + ((this.mouseClick = !1), + t.column.definition.cellClick && + t.column.definition.cellClick.call( + this.table, + e, + n + )), + t.column.definition.cellEditing && + t.column.definition.cellEditing.call( + this.table, + n + ), + this.dispatch("cell-editing", t), + this.dispatchExternal("cellEditing", n), + (r = + typeof t.column.modules.edit.params == + "function" + ? t.column.modules.edit.params(n) + : t.column.modules.edit.params), + (o = t.column.modules.edit.editor.call( + a, + n, + function (m) { + l = m; + }, + function (m) { + if (a.currentCell === t && !d) { + var p = a.chain( + "edit-success", + [t, m], + !0, + !0 + ); + return p === !0 || + a.table.options.validationMode === + "highlight" + ? ((d = !0), + a.clearEditor(), + t.modules.edit || + (t.modules.edit = {}), + (t.modules.edit.edited = !0), + a.editedCells.indexOf(t) == -1 && + a.editedCells.push(t), + (m = a.transformEmptyValues( + m, + t + )), + t.setValue(m, !0), + p === !0) + : ((d = !0), + (a.invalidEdit = !0), + a.focusCellNoEvent(t, !0), + l(), + setTimeout(() => { + d = !1; + }, 10), + !1); + } + }, + function () { + a.currentCell !== t || d || a.cancelEdit(); + }, + r + )), + !this.currentCell || o === !1) + ) + return this.blur(h), !1; + if (!(o instanceof Node)) + return ( + console.warn( + "Edit Error - Editor should return an instance of Node, the editor returned:", + o + ), + this.blur(h), + !1 + ); + for ( + h.classList.add("tabulator-editing"), + t.row + .getElement() + .classList.add("tabulator-editing"), + t.table.element.classList.add( + "tabulator-editing" + ); + h.firstChild; + + ) + h.removeChild(h.firstChild); + h.appendChild(o), l(); + for (var c = h.children, u = 0; u < c.length; u++) + c[u].addEventListener("click", function (m) { + m.stopPropagation(); + }); + return !0; + } + return (this.mouseClick = !1), this.blur(h), !1; + } + this.invalidEdit || this.currentCell === t || this.cancelEdit(); + } + emptyValueCheck(t) { + return t === "" || t == null; + } + transformEmptyValues(t, e) { + var i, + o = e.column.modules.edit; + return ( + (o.convertEmptyValues || this.convertEmptyValues) && + (i = + o.editorEmptyValueFunc || + this.options("editorEmptyValueFunc")) && + i(t) && + (t = o.convertEmptyValues + ? o.editorEmptyValue + : this.options("editorEmptyValue")), + t + ); + } + blur(t) { + this.confirm("edit-blur", [t]) || t.blur(); + } + getEditedCells() { + var t = []; + return ( + this.editedCells.forEach((e) => { + t.push(e.getComponent()); + }), + t + ); + } + clearEdited(t) { + var e; + t.modules.edit && + t.modules.edit.edited && + ((t.modules.edit.edited = !1), + this.dispatch("edit-edited-clear", t)), + (e = this.editedCells.indexOf(t)) > -1 && + this.editedCells.splice(e, 1); + } + }; + b(st, "moduleName", "edit"), b(st, "editors", Ke); + let xt = st; + class ce { + constructor(t, e, i, o) { + (this.type = t), + (this.columns = e), + (this.component = i || !1), + (this.indent = o || 0); + } + } + class Tt { + constructor(t, e, i, o, n) { + (this.value = t), + (this.component = e || !1), + (this.width = i), + (this.height = o), + (this.depth = n); + } + } + var Ye = {}, + Qe = { + visible: function () { + return this.rowManager.getVisibleRows(!1, !0); + }, + all: function () { + return this.rowManager.rows; + }, + selected: function () { + return this.modules.selectRow.selectedRows; + }, + active: function () { + return this.options.pagination + ? this.rowManager.getDisplayRows( + this.rowManager.displayRows.length - 2 + ) + : this.rowManager.getDisplayRows(); + }, + }; + let V = class V extends w { + constructor(t) { + super(t), + (this.config = {}), + (this.cloneTableStyle = !0), + (this.colVisProp = ""), + (this.colVisPropAttach = ""), + this.registerTableOption("htmlOutputConfig", !1), + this.registerColumnOption("htmlOutput"), + this.registerColumnOption("titleHtmlOutput"); + } + initialize() { + this.registerTableFunction("getHtml", this.getHtml.bind(this)); + } + generateExportList(t, e, i, o) { + var n, r, a, l; + return ( + (this.cloneTableStyle = e), + (this.config = t || {}), + (this.colVisProp = o), + (this.colVisPropAttach = + this.colVisProp.charAt(0).toUpperCase() + + this.colVisProp.slice(1)), + (l = V.columnLookups[i]) && + (a = (a = l.call(this.table)).filter((h) => + this.columnVisCheck(h) + )), + (n = + this.config.columnHeaders !== !1 + ? this.headersToExportRows( + this.generateColumnGroupHeaders(a) + ) + : []), + a && (a = a.map((h) => h.getComponent())), + (r = this.bodyToExportRows(this.rowLookup(i), a)), + n.concat(r) + ); + } + generateTable(t, e, i, o) { + var n = this.generateExportList(t, e, i, o); + return this.generateTableElement(n); + } + rowLookup(t) { + var e, + i = []; + return ( + typeof t == "function" + ? t.call(this.table).forEach((o) => { + (o = this.table.rowManager.findRow(o)) && + i.push(o); + }) + : ((e = V.rowLookups[t] || V.rowLookups.active), + (i = e.call(this.table))), + Object.assign([], i) + ); + } + generateColumnGroupHeaders(t) { + var e = []; + return ( + t || + (t = + this.config.columnGroups !== !1 + ? this.table.columnManager.columns + : this.table.columnManager.columnsByIndex), + t.forEach((i) => { + var o = this.processColumnGroup(i); + o && e.push(o); + }), + e + ); + } + processColumnGroup(t) { + var e = t.columns, + i = 0, + o = { + title: + t.definition["title" + this.colVisPropAttach] || + t.definition.title, + column: t, + depth: 1, + }; + if (e.length) { + if ( + ((o.subGroups = []), + (o.width = 0), + e.forEach((n) => { + var r = this.processColumnGroup(n); + r && + ((o.width += r.width), + o.subGroups.push(r), + r.depth > i && (i = r.depth)); + }), + (o.depth += i), + !o.width) + ) + return !1; + } else { + if (!this.columnVisCheck(t)) return !1; + o.width = 1; + } + return o; + } + columnVisCheck(t) { + var e = t.definition[this.colVisProp]; + return ( + (this.config.rowHeaders !== !1 || !t.isRowHeader) && + (typeof e == "function" && + (e = e.call(this.table, t.getComponent())), + e === !1 || e === !0 ? e : t.visible && t.field) + ); + } + headersToExportRows(t) { + var e = [], + i = 0, + o = []; + function n(r, a) { + var l = i - a; + if ( + (e[a] === void 0 && (e[a] = []), + (r.height = r.subGroups ? 1 : l - r.depth + 1), + e[a].push(r), + r.height > 1) + ) + for (let h = 1; h < r.height; h++) + e[a + h] === void 0 && (e[a + h] = []), + e[a + h].push(!1); + if (r.width > 1) + for (let h = 1; h < r.width; h++) e[a].push(!1); + r.subGroups && + r.subGroups.forEach(function (h) { + n(h, a + 1); + }); + } + return ( + t.forEach(function (r) { + r.depth > i && (i = r.depth); + }), + t.forEach(function (r) { + n(r, 0); + }), + e.forEach((r) => { + var a = []; + r.forEach((l) => { + if (l) { + let h = l.title === void 0 ? "" : l.title; + a.push( + new Tt( + h, + l.column.getComponent(), + l.width, + l.height, + l.depth + ) + ); + } else a.push(null); + }), + o.push(new ce("header", a)); + }), + o + ); + } + bodyToExportRows(t, e = []) { + var i = []; + return ( + e.length === 0 && + this.table.columnManager.columnsByIndex.forEach((o) => { + this.columnVisCheck(o) && e.push(o.getComponent()); + }), + this.config.columnCalcs !== !1 && + this.table.modExists("columnCalcs") && + (this.table.modules.columnCalcs.topInitialized && + t.unshift(this.table.modules.columnCalcs.topRow), + this.table.modules.columnCalcs.botInitialized && + t.push(this.table.modules.columnCalcs.botRow)), + (t = t.filter((o) => { + switch (o.type) { + case "group": + return this.config.rowGroups !== !1; + case "calc": + return this.config.columnCalcs !== !1; + case "row": + return !( + this.table.options.dataTree && + this.config.dataTree === !1 && + o.modules.dataTree.parent + ); + } + return !0; + })).forEach((o, n) => { + var r = o.getData(this.colVisProp), + a = [], + l = 0; + switch (o.type) { + case "group": + (l = o.level), + a.push( + new Tt( + o.key, + o.getComponent(), + e.length, + 1 + ) + ); + break; + case "calc": + case "row": + e.forEach((h) => { + a.push( + new Tt( + h._column.getFieldValue(r), + h, + 1, + 1 + ) + ); + }), + this.table.options.dataTree && + this.config.dataTree !== !1 && + (l = o.modules.dataTree.index); + } + i.push(new ce(o.type, a, o.getComponent(), l)); + }), + i + ); + } + generateTableElement(t) { + var e = document.createElement("table"), + i = document.createElement("thead"), + o = document.createElement("tbody"), + n = this.lookupTableStyles(), + r = + this.table.options[ + "rowFormatter" + this.colVisPropAttach + ], + a = {}; + return ( + (a.rowFormatter = + r !== null ? r : this.table.options.rowFormatter), + this.table.options.dataTree && + this.config.dataTree !== !1 && + this.table.modExists("columnCalcs") && + (a.treeElementField = + this.table.modules.dataTree.elementField), + (a.groupHeader = + this.table.options[ + "groupHeader" + this.colVisPropAttach + ]), + a.groupHeader && + !Array.isArray(a.groupHeader) && + (a.groupHeader = [a.groupHeader]), + e.classList.add("tabulator-print-table"), + this.mapElementStyles( + this.table.columnManager.getHeadersElement(), + i, + [ + "border-top", + "border-left", + "border-right", + "border-bottom", + "background-color", + "color", + "font-weight", + "font-family", + "font-size", + ] + ), + t.length > 1e3 && + console.warn( + "It may take a long time to render an HTML table with more than 1000 rows" + ), + t.forEach((l, h) => { + let d; + switch (l.type) { + case "header": + i.appendChild( + this.generateHeaderElement(l, a, n) + ); + break; + case "group": + o.appendChild( + this.generateGroupElement(l, a, n) + ); + break; + case "calc": + o.appendChild( + this.generateCalcElement(l, a, n) + ); + break; + case "row": + (d = this.generateRowElement(l, a, n)), + this.mapElementStyles( + h % 2 && n.evenRow + ? n.evenRow + : n.oddRow, + d, + [ + "border-top", + "border-left", + "border-right", + "border-bottom", + "color", + "font-weight", + "font-family", + "font-size", + "background-color", + ] + ), + o.appendChild(d); + } + }), + i.innerHTML && e.appendChild(i), + e.appendChild(o), + this.mapElementStyles(this.table.element, e, [ + "border-top", + "border-left", + "border-right", + "border-bottom", + ]), + e + ); + } + lookupTableStyles() { + var t = {}; + return ( + this.cloneTableStyle && + window.getComputedStyle && + ((t.oddRow = this.table.element.querySelector( + ".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)" + )), + (t.evenRow = this.table.element.querySelector( + ".tabulator-row-even:not(.tabulator-group):not(.tabulator-calcs)" + )), + (t.calcRow = this.table.element.querySelector( + ".tabulator-row.tabulator-calcs" + )), + (t.firstRow = this.table.element.querySelector( + ".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)" + )), + (t.firstGroup = + this.table.element.getElementsByClassName( + "tabulator-group" + )[0]), + t.firstRow && + ((t.styleCells = + t.firstRow.getElementsByClassName( + "tabulator-cell" + )), + (t.styleRowHeader = + t.firstRow.getElementsByClassName( + "tabulator-row-header" + )[0]), + (t.firstCell = t.styleCells[0]), + (t.lastCell = + t.styleCells[t.styleCells.length - 1]))), + t + ); + } + generateHeaderElement(t, e, i) { + var o = document.createElement("tr"); + return ( + t.columns.forEach((n) => { + if (n) { + var r = document.createElement("th"), + a = n.component._column.definition.cssClass + ? n.component._column.definition.cssClass.split( + " " + ) + : []; + (r.colSpan = n.width), + (r.rowSpan = n.height), + (r.innerHTML = n.value), + this.cloneTableStyle && + (r.style.boxSizing = "border-box"), + a.forEach(function (l) { + r.classList.add(l); + }), + this.mapElementStyles( + n.component.getElement(), + r, + [ + "text-align", + "border-left", + "border-right", + "background-color", + "color", + "font-weight", + "font-family", + "font-size", + ] + ), + this.mapElementStyles( + n.component._column.contentElement, + r, + [ + "padding-top", + "padding-left", + "padding-right", + "padding-bottom", + ] + ), + n.component._column.visible + ? this.mapElementStyles( + n.component.getElement(), + r, + ["width"] + ) + : n.component._column.definition.width && + (r.style.width = + n.component._column.definition.width + + "px"), + n.component._column.parent && + n.component._column.parent.isGroup + ? this.mapElementStyles( + n.component._column.parent + .groupElement, + r, + ["border-top"] + ) + : this.mapElementStyles( + n.component.getElement(), + r, + ["border-top"] + ), + n.component._column.isGroup + ? this.mapElementStyles( + n.component.getElement(), + r, + ["border-bottom"] + ) + : this.mapElementStyles( + this.table.columnManager.getElement(), + r, + ["border-bottom"] + ), + o.appendChild(r); + } + }), + o + ); + } + generateGroupElement(t, e, i) { + var o = document.createElement("tr"), + n = document.createElement("td"), + r = t.columns[0]; + return ( + o.classList.add("tabulator-print-table-row"), + e.groupHeader && e.groupHeader[t.indent] + ? (r.value = e.groupHeader[t.indent]( + r.value, + t.component._group.getRowCount(), + t.component._group.getData(), + t.component + )) + : e.groupHeader !== !1 && + (r.value = t.component._group.generator( + r.value, + t.component._group.getRowCount(), + t.component._group.getData(), + t.component + )), + (n.colSpan = r.width), + (n.innerHTML = r.value), + o.classList.add("tabulator-print-table-group"), + o.classList.add("tabulator-group-level-" + t.indent), + r.component.isVisible() && + o.classList.add("tabulator-group-visible"), + this.mapElementStyles(i.firstGroup, o, [ + "border-top", + "border-left", + "border-right", + "border-bottom", + "color", + "font-weight", + "font-family", + "font-size", + "background-color", + ]), + this.mapElementStyles(i.firstGroup, n, [ + "padding-top", + "padding-left", + "padding-right", + "padding-bottom", + ]), + o.appendChild(n), + o + ); + } + generateCalcElement(t, e, i) { + var o = this.generateRowElement(t, e, i); + return ( + o.classList.add("tabulator-print-table-calcs"), + this.mapElementStyles(i.calcRow, o, [ + "border-top", + "border-left", + "border-right", + "border-bottom", + "color", + "font-weight", + "font-family", + "font-size", + "background-color", + ]), + o + ); + } + generateRowElement(t, e, i) { + var o = document.createElement("tr"); + return ( + o.classList.add("tabulator-print-table-row"), + t.columns.forEach((n, r) => { + if (n) { + var a, + l, + h = document.createElement("td"), + d = n.component._column, + c = this.table, + u = c.columnManager.findColumnIndex(d), + m = n.value, + p = { + modules: {}, + getValue: function () { + return m; + }, + getField: function () { + return d.definition.field; + }, + getElement: function () { + return h; + }, + getType: function () { + return "cell"; + }, + getColumn: function () { + return d.getComponent(); + }, + getData: function () { + return t.component.getData(); + }, + getRow: function () { + return t.component; + }, + getTable: function () { + return c; + }, + getComponent: function () { + return p; + }, + column: d, + }; + if ( + ((d.definition.cssClass + ? d.definition.cssClass.split(" ") + : [] + ).forEach(function (g) { + h.classList.add(g); + }), + this.table.modExists("format") && + this.config.formatCells !== !1) + ) + m = this.table.modules.format.formatExportValue( + p, + this.colVisProp + ); + else + switch (typeof m) { + case "object": + m = m !== null ? JSON.stringify(m) : ""; + break; + case "undefined": + m = ""; + } + m instanceof Node + ? h.appendChild(m) + : (h.innerHTML = m), + (l = [ + "padding-top", + "padding-left", + "padding-right", + "padding-bottom", + "border-top", + "border-left", + "border-right", + "border-bottom", + "color", + "font-weight", + "font-family", + "font-size", + "text-align", + ]), + d.isRowHeader + ? ((a = i.styleRowHeader), + l.push("background-color")) + : (a = + i.styleCells && i.styleCells[u] + ? i.styleCells[u] + : i.firstCell), + a && + (this.mapElementStyles(a, h, l), + d.definition.align && + (h.style.textAlign = + d.definition.align)), + this.table.options.dataTree && + this.config.dataTree !== !1 && + ((e.treeElementField && + e.treeElementField == d.field) || + (!e.treeElementField && r == 0)) && + (t.component._row.modules.dataTree + .controlEl && + h.insertBefore( + t.component._row.modules.dataTree.controlEl.cloneNode( + !0 + ), + h.firstChild + ), + t.component._row.modules.dataTree + .branchEl && + h.insertBefore( + t.component._row.modules.dataTree.branchEl.cloneNode( + !0 + ), + h.firstChild + )), + o.appendChild(h), + p.modules.format && + p.modules.format.renderedCallback && + p.modules.format.renderedCallback(); + } + }), + e.rowFormatter && + t.type === "row" && + this.config.formatCells !== !1 && + ((Object.assign(t.component).getElement = function () { + return o; + }), + e.rowFormatter(t.component)), + o + ); + } + generateHTMLTable(t) { + var e = document.createElement("div"); + return e.appendChild(this.generateTableElement(t)), e.innerHTML; + } + getHtml(t, e, i, o) { + var n = this.generateExportList( + i || this.table.options.htmlOutputConfig, + e, + t, + o || "htmlOutput" + ); + return this.generateHTMLTable(n); + } + mapElementStyles(t, e, i) { + if (this.cloneTableStyle && t && e) { + var o = { + "background-color": "backgroundColor", + color: "fontColor", + width: "width", + "font-weight": "fontWeight", + "font-family": "fontFamily", + "font-size": "fontSize", + "text-align": "textAlign", + "border-top": "borderTop", + "border-left": "borderLeft", + "border-right": "borderRight", + "border-bottom": "borderBottom", + "padding-top": "paddingTop", + "padding-left": "paddingLeft", + "padding-right": "paddingRight", + "padding-bottom": "paddingBottom", + }; + if (window.getComputedStyle) { + var n = window.getComputedStyle(t); + i.forEach(function (r) { + e.style[o[r]] || + (e.style[o[r]] = n.getPropertyValue(r)); + }); + } + } + } + }; + b(V, "moduleName", "export"), + b(V, "columnLookups", Ye), + b(V, "rowLookups", Qe); + let kt = V; + var Ze = { + "=": function (s, t, e, i) { + return t == s; + }, + "<": function (s, t, e, i) { + return t < s; + }, + "<=": function (s, t, e, i) { + return t <= s; + }, + ">": function (s, t, e, i) { + return t > s; + }, + ">=": function (s, t, e, i) { + return t >= s; + }, + "!=": function (s, t, e, i) { + return t != s; + }, + regex: function (s, t, e, i) { + return typeof s == "string" && (s = new RegExp(s)), s.test(t); + }, + like: function (s, t, e, i) { + return s == null + ? t === s + : t != null && + String(t).toLowerCase().indexOf(s.toLowerCase()) > -1; + }, + keywords: function (s, t, e, i) { + var o = s + .toLowerCase() + .split(i.separator === void 0 ? " " : i.separator), + n = String(t ?? "").toLowerCase(), + r = []; + return ( + o.forEach((a) => { + n.includes(a) && r.push(!0); + }), + i.matchAll ? r.length === o.length : !!r.length + ); + }, + starts: function (s, t, e, i) { + return s == null + ? t === s + : t != null && + String(t).toLowerCase().startsWith(s.toLowerCase()); + }, + ends: function (s, t, e, i) { + return s == null + ? t === s + : t != null && + String(t).toLowerCase().endsWith(s.toLowerCase()); + }, + in: function (s, t, e, i) { + return Array.isArray(s) + ? !s.length || s.indexOf(t) > -1 + : (console.warn( + "Filter Error - filter value is not an array:", + s + ), + !1); + }, + }; + let O = class O extends w { + constructor(t) { + super(t), + (this.filterList = []), + (this.headerFilters = {}), + (this.headerFilterColumns = []), + (this.prevHeaderFilterChangeCheck = ""), + (this.prevHeaderFilterChangeCheck = "{}"), + (this.changed = !1), + (this.tableInitialized = !1), + this.registerTableOption("filterMode", "local"), + this.registerTableOption("initialFilter", !1), + this.registerTableOption("initialHeaderFilter", !1), + this.registerTableOption( + "headerFilterLiveFilterDelay", + 300 + ), + this.registerTableOption("placeholderHeaderFilter", !1), + this.registerColumnOption("headerFilter"), + this.registerColumnOption("headerFilterPlaceholder"), + this.registerColumnOption("headerFilterParams"), + this.registerColumnOption("headerFilterEmptyCheck"), + this.registerColumnOption("headerFilterFunc"), + this.registerColumnOption("headerFilterFuncParams"), + this.registerColumnOption("headerFilterLiveFilter"), + this.registerTableFunction( + "searchRows", + this.searchRows.bind(this) + ), + this.registerTableFunction( + "searchData", + this.searchData.bind(this) + ), + this.registerTableFunction( + "setFilter", + this.userSetFilter.bind(this) + ), + this.registerTableFunction( + "refreshFilter", + this.userRefreshFilter.bind(this) + ), + this.registerTableFunction( + "addFilter", + this.userAddFilter.bind(this) + ), + this.registerTableFunction( + "getFilters", + this.getFilters.bind(this) + ), + this.registerTableFunction( + "setHeaderFilterFocus", + this.userSetHeaderFilterFocus.bind(this) + ), + this.registerTableFunction( + "getHeaderFilterValue", + this.userGetHeaderFilterValue.bind(this) + ), + this.registerTableFunction( + "setHeaderFilterValue", + this.userSetHeaderFilterValue.bind(this) + ), + this.registerTableFunction( + "getHeaderFilters", + this.getHeaderFilters.bind(this) + ), + this.registerTableFunction( + "removeFilter", + this.userRemoveFilter.bind(this) + ), + this.registerTableFunction( + "clearFilter", + this.userClearFilter.bind(this) + ), + this.registerTableFunction( + "clearHeaderFilter", + this.userClearHeaderFilter.bind(this) + ), + this.registerComponentFunction( + "column", + "headerFilterFocus", + this.setHeaderFilterFocus.bind(this) + ), + this.registerComponentFunction( + "column", + "reloadHeaderFilter", + this.reloadHeaderFilter.bind(this) + ), + this.registerComponentFunction( + "column", + "getHeaderFilterValue", + this.getHeaderFilterValue.bind(this) + ), + this.registerComponentFunction( + "column", + "setHeaderFilterValue", + this.setHeaderFilterValue.bind(this) + ); + } + initialize() { + this.subscribe( + "column-init", + this.initializeColumnHeaderFilter.bind(this) + ), + this.subscribe( + "column-width-fit-before", + this.hideHeaderFilterElements.bind(this) + ), + this.subscribe( + "column-width-fit-after", + this.showHeaderFilterElements.bind(this) + ), + this.subscribe("table-built", this.tableBuilt.bind(this)), + this.subscribe( + "placeholder", + this.generatePlaceholder.bind(this) + ), + this.table.options.filterMode === "remote" && + this.subscribe( + "data-params", + this.remoteFilterParams.bind(this) + ), + this.registerDataHandler(this.filter.bind(this), 10); + } + tableBuilt() { + this.table.options.initialFilter && + this.setFilter(this.table.options.initialFilter), + this.table.options.initialHeaderFilter && + this.table.options.initialHeaderFilter.forEach((t) => { + var e = this.table.columnManager.findColumn( + t.field + ); + if (!e) + return ( + console.warn( + "Column Filter Error - No matching column found:", + t.field + ), + !1 + ); + this.setHeaderFilterValue(e, t.value); + }), + (this.tableInitialized = !0); + } + remoteFilterParams(t, e, i, o) { + return (o.filter = this.getFilters(!0, !0)), o; + } + generatePlaceholder(t) { + if ( + this.table.options.placeholderHeaderFilter && + Object.keys(this.headerFilters).length + ) + return this.table.options.placeholderHeaderFilter; + } + userSetFilter(t, e, i, o) { + this.setFilter(t, e, i, o), this.refreshFilter(); + } + userRefreshFilter() { + this.refreshFilter(); + } + userAddFilter(t, e, i, o) { + this.addFilter(t, e, i, o), this.refreshFilter(); + } + userSetHeaderFilterFocus(t) { + var e = this.table.columnManager.findColumn(t); + if (!e) + return ( + console.warn( + "Column Filter Focus Error - No matching column found:", + t + ), + !1 + ); + this.setHeaderFilterFocus(e); + } + userGetHeaderFilterValue(t) { + var e = this.table.columnManager.findColumn(t); + if (e) return this.getHeaderFilterValue(e); + console.warn( + "Column Filter Error - No matching column found:", + t + ); + } + userSetHeaderFilterValue(t, e) { + var i = this.table.columnManager.findColumn(t); + if (!i) + return ( + console.warn( + "Column Filter Error - No matching column found:", + t + ), + !1 + ); + this.setHeaderFilterValue(i, e); + } + userRemoveFilter(t, e, i) { + this.removeFilter(t, e, i), this.refreshFilter(); + } + userClearFilter(t) { + this.clearFilter(t), this.refreshFilter(); + } + userClearHeaderFilter() { + this.clearHeaderFilter(), this.refreshFilter(); + } + searchRows(t, e, i) { + return this.search("rows", t, e, i); + } + searchData(t, e, i) { + return this.search("data", t, e, i); + } + initializeColumnHeaderFilter(t) { + t.definition.headerFilter && this.initializeColumn(t); + } + initializeColumn(t, e) { + var i = this, + o = t.getField(); + (t.modules.filter = { + success: function (n) { + var r, + a = + (t.modules.filter.tagType == "input" && + t.modules.filter.attrType == "text") || + t.modules.filter.tagType == "textarea" + ? "partial" + : "match", + l = "", + h = ""; + if ( + t.modules.filter.prevSuccess === void 0 || + t.modules.filter.prevSuccess !== n + ) { + if ( + ((t.modules.filter.prevSuccess = n), + t.modules.filter.emptyFunc(n)) + ) + delete i.headerFilters[o]; + else { + switch ( + ((t.modules.filter.value = n), + typeof t.definition.headerFilterFunc) + ) { + case "string": + O.filters[t.definition.headerFilterFunc] + ? ((l = + t.definition + .headerFilterFunc), + (r = function (d) { + var c = + t.definition + .headerFilterFuncParams || + {}, + u = t.getFieldValue(d); + return ( + (c = + typeof c == "function" + ? c(n, u, d) + : c), + O.filters[ + t.definition + .headerFilterFunc + ](n, u, d, c) + ); + })) + : console.warn( + "Header Filter Error - Matching filter function not found: ", + t.definition.headerFilterFunc + ); + break; + case "function": + l = r = function (d) { + var c = + t.definition + .headerFilterFuncParams || + {}, + u = t.getFieldValue(d); + return ( + (c = + typeof c == "function" + ? c(n, u, d) + : c), + t.definition.headerFilterFunc( + n, + u, + d, + c + ) + ); + }; + } + r || + (a === "partial" + ? ((r = function (d) { + var c = t.getFieldValue(d); + return ( + c != null && + String(c) + .toLowerCase() + .indexOf( + String( + n + ).toLowerCase() + ) > -1 + ); + }), + (l = "like")) + : ((r = function (d) { + return t.getFieldValue(d) == n; + }), + (l = "="))), + (i.headerFilters[o] = { + value: n, + func: r, + type: l, + }); + } + (t.modules.filter.value = n), + (h = JSON.stringify(i.headerFilters)), + i.prevHeaderFilterChangeCheck !== h && + ((i.prevHeaderFilterChangeCheck = h), + i.trackChanges(), + i.refreshFilter()); + } + return !0; + }, + attrType: !1, + tagType: !1, + emptyFunc: !1, + }), + this.generateHeaderFilterElement(t); + } + generateHeaderFilterElement(t, e, i) { + var o, + n, + r, + a, + l, + h, + d, + c, + u = this, + m = t.modules.filter.success, + p = t.getField(); + if ( + ((t.modules.filter.value = e), + t.modules.filter.headerElement && + t.modules.filter.headerElement.parentNode && + t.contentElement.removeChild( + t.modules.filter.headerElement.parentNode + ), + p) + ) { + switch ( + ((t.modules.filter.emptyFunc = + t.definition.headerFilterEmptyCheck || + function (g) { + return !g && g !== 0; + }), + (o = document.createElement("div")).classList.add( + "tabulator-header-filter" + ), + typeof t.definition.headerFilter) + ) { + case "string": + u.table.modules.edit.editors[ + t.definition.headerFilter + ] + ? ((n = + u.table.modules.edit.editors[ + t.definition.headerFilter + ]), + (t.definition.headerFilter !== "tick" && + t.definition.headerFilter !== + "tickCross") || + t.definition.headerFilterEmptyCheck || + (t.modules.filter.emptyFunc = function ( + g + ) { + return g !== !0 && g !== !1; + })) + : console.warn( + "Filter Error - Cannot build header filter, No such editor found: ", + t.definition.editor + ); + break; + case "function": + n = t.definition.headerFilter; + break; + case "boolean": + t.modules.edit && t.modules.edit.editor + ? (n = t.modules.edit.editor) + : t.definition.formatter && + u.table.modules.edit.editors[ + t.definition.formatter + ] + ? ((n = + u.table.modules.edit.editors[ + t.definition.formatter + ]), + (t.definition.formatter !== "tick" && + t.definition.formatter !== "tickCross") || + t.definition.headerFilterEmptyCheck || + (t.modules.filter.emptyFunc = function ( + g + ) { + return g !== !0 && g !== !1; + })) + : (n = u.table.modules.edit.editors.input); + } + if (n) { + if ( + ((a = { + getValue: function () { + return e !== void 0 ? e : ""; + }, + getField: function () { + return t.definition.field; + }, + getElement: function () { + return o; + }, + getColumn: function () { + return t.getComponent(); + }, + getTable: () => this.table, + getType: () => "header", + getRow: function () { + return { normalizeHeight: function () {} }; + }, + }), + (d = + typeof (d = + t.definition.headerFilterParams || {}) == + "function" + ? d.call(u.table, a) + : d), + !(r = n.call( + this.table.modules.edit, + a, + function (g) { + c = g; + }, + m, + function () {}, + d + ))) + ) + return void console.warn( + "Filter Error - Cannot add filter to " + + p + + " column, editor returned a value of false" + ); + if (!(r instanceof Node)) + return void console.warn( + "Filter Error - Cannot add filter to " + + p + + " column, editor should return an instance of Node, the editor returned:", + r + ); + u.langBind( + "headerFilters|columns|" + t.definition.field, + function (g) { + r.setAttribute( + "placeholder", + g !== void 0 && g + ? g + : t.definition + .headerFilterPlaceholder || + u.langText( + "headerFilters|default" + ) + ); + } + ), + r.addEventListener("click", function (g) { + g.stopPropagation(), r.focus(); + }), + r.addEventListener("focus", (g) => { + var f = + this.table.columnManager.contentsElement + .scrollLeft; + f !== + this.table.rowManager.element.scrollLeft && + (this.table.rowManager.scrollHorizontal(f), + this.table.columnManager.scrollHorizontal( + f + )); + }), + (l = !1), + (h = function (g) { + l && clearTimeout(l), + (l = setTimeout(function () { + m(r.value); + }, u + .table.options.headerFilterLiveFilterDelay)); + }), + (t.modules.filter.headerElement = r), + (t.modules.filter.attrType = r.hasAttribute("type") + ? r.getAttribute("type").toLowerCase() + : ""), + (t.modules.filter.tagType = + r.tagName.toLowerCase()), + t.definition.headerFilterLiveFilter !== !1 && + (t.definition.headerFilter !== "autocomplete" && + t.definition.headerFilter !== "tickCross" && + ((t.definition.editor !== "autocomplete" && + t.definition.editor !== "tickCross") || + t.definition.headerFilter !== !0) && + (r.addEventListener("keyup", h), + r.addEventListener("search", h), + t.modules.filter.attrType == "number" && + r.addEventListener( + "change", + function (g) { + m(r.value); + } + ), + t.modules.filter.attrType == "text" && + this.table.browser !== "ie" && + r.setAttribute("type", "search")), + (t.modules.filter.tagType != "input" && + t.modules.filter.tagType != "select" && + t.modules.filter.tagType != "textarea") || + r.addEventListener( + "mousedown", + function (g) { + g.stopPropagation(); + } + )), + o.appendChild(r), + t.contentElement.appendChild(o), + i || u.headerFilterColumns.push(t), + c && c(); + } + } else + console.warn( + "Filter Error - Cannot add header filter, column has no field set:", + t.definition.title + ); + } + hideHeaderFilterElements() { + this.headerFilterColumns.forEach(function (t) { + t.modules.filter && + t.modules.filter.headerElement && + (t.modules.filter.headerElement.style.display = "none"); + }); + } + showHeaderFilterElements() { + this.headerFilterColumns.forEach(function (t) { + t.modules.filter && + t.modules.filter.headerElement && + (t.modules.filter.headerElement.style.display = ""); + }); + } + setHeaderFilterFocus(t) { + t.modules.filter && t.modules.filter.headerElement + ? t.modules.filter.headerElement.focus() + : console.warn( + "Column Filter Focus Error - No header filter set on column:", + t.getField() + ); + } + getHeaderFilterValue(t) { + if (t.modules.filter && t.modules.filter.headerElement) + return t.modules.filter.value; + console.warn( + "Column Filter Error - No header filter set on column:", + t.getField() + ); + } + setHeaderFilterValue(t, e) { + t && + (t.modules.filter && t.modules.filter.headerElement + ? (this.generateHeaderFilterElement(t, e, !0), + t.modules.filter.success(e)) + : console.warn( + "Column Filter Error - No header filter set on column:", + t.getField() + )); + } + reloadHeaderFilter(t) { + t && + (t.modules.filter && t.modules.filter.headerElement + ? this.generateHeaderFilterElement( + t, + t.modules.filter.value, + !0 + ) + : console.warn( + "Column Filter Error - No header filter set on column:", + t.getField() + )); + } + refreshFilter() { + this.tableInitialized && + (this.table.options.filterMode === "remote" + ? this.reloadData(null, !1, !1) + : this.refreshData(!0)); + } + trackChanges() { + (this.changed = !0), this.dispatch("filter-changed"); + } + hasChanged() { + var t = this.changed; + return (this.changed = !1), t; + } + setFilter(t, e, i, o) { + (this.filterList = []), + Array.isArray(t) || + (t = [{ field: t, type: e, value: i, params: o }]), + this.addFilter(t); + } + addFilter(t, e, i, o) { + var n = !1; + Array.isArray(t) || + (t = [{ field: t, type: e, value: i, params: o }]), + t.forEach((r) => { + (r = this.findFilter(r)) && + (this.filterList.push(r), (n = !0)); + }), + n && this.trackChanges(); + } + findFilter(t) { + var e; + if (Array.isArray(t)) return this.findSubFilters(t); + var i = !1; + return ( + typeof t.field == "function" + ? (i = function (o) { + return t.field(o, t.type || {}); + }) + : O.filters[t.type] + ? (i = (e = this.table.columnManager.getColumnByField( + t.field + )) + ? function (o) { + return O.filters[t.type]( + t.value, + e.getFieldValue(o), + o, + t.params || {} + ); + } + : function (o) { + return O.filters[t.type]( + t.value, + o[t.field], + o, + t.params || {} + ); + }) + : console.warn( + "Filter Error - No such filter type found, ignoring: ", + t.type + ), + (t.func = i), + !!t.func && t + ); + } + findSubFilters(t) { + var e = []; + return ( + t.forEach((i) => { + (i = this.findFilter(i)) && e.push(i); + }), + !!e.length && e + ); + } + getFilters(t, e) { + var i = []; + return ( + t && (i = this.getHeaderFilters()), + e && + i.forEach(function (o) { + typeof o.type == "function" && + (o.type = "function"); + }), + (i = i.concat(this.filtersToArray(this.filterList, e))) + ); + } + filtersToArray(t, e) { + var i = []; + return ( + t.forEach((o) => { + var n; + Array.isArray(o) + ? i.push(this.filtersToArray(o, e)) + : ((n = { + field: o.field, + type: o.type, + value: o.value, + }), + e && + typeof n.type == "function" && + (n.type = "function"), + i.push(n)); + }), + i + ); + } + getHeaderFilters() { + var t = []; + for (var e in this.headerFilters) + t.push({ + field: e, + type: this.headerFilters[e].type, + value: this.headerFilters[e].value, + }); + return t; + } + removeFilter(t, e, i) { + Array.isArray(t) || (t = [{ field: t, type: e, value: i }]), + t.forEach((o) => { + var n = -1; + (n = + typeof o.field == "object" + ? this.filterList.findIndex((r) => o === r) + : this.filterList.findIndex( + (r) => + o.field === r.field && + o.type === r.type && + o.value === r.value + )) > -1 + ? this.filterList.splice(n, 1) + : console.warn( + "Filter Error - No matching filter type found, ignoring: ", + o.type + ); + }), + this.trackChanges(); + } + clearFilter(t) { + (this.filterList = []), + t && this.clearHeaderFilter(), + this.trackChanges(); + } + clearHeaderFilter() { + (this.headerFilters = {}), + (this.prevHeaderFilterChangeCheck = "{}"), + this.headerFilterColumns.forEach((t) => { + t.modules.filter.value !== void 0 && + delete t.modules.filter.value, + (t.modules.filter.prevSuccess = void 0), + this.reloadHeaderFilter(t); + }), + this.trackChanges(); + } + search(t, e, i, o) { + var n = [], + r = []; + return ( + Array.isArray(e) || (e = [{ field: e, type: i, value: o }]), + e.forEach((a) => { + (a = this.findFilter(a)) && r.push(a); + }), + this.table.rowManager.rows.forEach((a) => { + var l = !0; + r.forEach((h) => { + this.filterRecurse(h, a.getData()) || (l = !1); + }), + l && + n.push( + t === "data" + ? a.getData("data") + : a.getComponent() + ); + }), + n + ); + } + filter(t, e) { + var i = [], + o = []; + return ( + this.subscribedExternal("dataFiltering") && + this.dispatchExternal( + "dataFiltering", + this.getFilters(!0) + ), + this.table.options.filterMode !== "remote" && + (this.filterList.length || + Object.keys(this.headerFilters).length) + ? t.forEach((n) => { + this.filterRow(n) && i.push(n); + }) + : (i = t.slice(0)), + this.subscribedExternal("dataFiltered") && + (i.forEach((n) => { + o.push(n.getComponent()); + }), + this.dispatchExternal( + "dataFiltered", + this.getFilters(!0), + o + )), + i + ); + } + filterRow(t, e) { + var i = !0, + o = t.getData(); + for (var n in (this.filterList.forEach((r) => { + this.filterRecurse(r, o) || (i = !1); + }), + this.headerFilters)) + this.headerFilters[n].func(o) || (i = !1); + return i; + } + filterRecurse(t, e) { + var i = !1; + return ( + Array.isArray(t) + ? t.forEach((o) => { + this.filterRecurse(o, e) && (i = !0); + }) + : (i = t.func(e)), + i + ); + } + }; + b(O, "moduleName", "filter"), b(O, "filters", Ze); + let Mt = O; + var $e = { + plaintext: function (s, t, e) { + return this.emptyToSpace(this.sanitizeHTML(s.getValue())); + }, + html: function (s, t, e) { + return s.getValue(); + }, + textarea: function (s, t, e) { + return ( + (s.getElement().style.whiteSpace = "pre-wrap"), + this.emptyToSpace(this.sanitizeHTML(s.getValue())) + ); + }, + money: function (s, t, e) { + var i, + o, + n, + r, + a, + l = parseFloat(s.getValue()), + h = "", + d = t.decimal || ".", + c = t.thousand || ",", + u = t.negativeSign || "-", + m = t.symbol || "", + p = !!t.symbolAfter, + g = t.precision !== void 0 ? t.precision : 2; + if (isNaN(l)) + return this.emptyToSpace(this.sanitizeHTML(s.getValue())); + if ( + (l < 0 && ((l = Math.abs(l)), (h = u)), + (i = g !== !1 ? l.toFixed(g) : l), + (o = (i = String(i).split("."))[0]), + (n = i.length > 1 ? d + i[1] : ""), + t.thousand !== !1) + ) + for (r = /(\d+)(\d{3})/; r.test(o); ) + o = o.replace(r, "$1" + c + "$2"); + return ( + (a = o + n), + h === !0 + ? ((a = "(" + a + ")"), p ? a + m : m + a) + : p + ? h + a + m + : h + m + a + ); + }, + link: function (s, t, e) { + var i, + o = s.getValue(), + n = t.urlPrefix || "", + r = t.download, + a = o, + l = document.createElement("a"); + if ( + (t.labelField && + ((i = s.getData()), + (a = (function h(d, c) { + var u = c[d.shift()]; + return d.length && typeof u == "object" + ? h(d, u) + : u; + })( + t.labelField.split( + this.table.options.nestedFieldSeparator + ), + i + ))), + t.label) + ) + switch (typeof t.label) { + case "string": + a = t.label; + break; + case "function": + a = t.label(s); + } + if (a) { + if ( + (t.urlField && + ((i = s.getData()), + (o = x.retrieveNestedData( + this.table.options.nestedFieldSeparator, + t.urlField, + i + ))), + t.url) + ) + switch (typeof t.url) { + case "string": + o = t.url; + break; + case "function": + o = t.url(s); + } + return ( + l.setAttribute("href", n + o), + t.target && l.setAttribute("target", t.target), + t.download && + ((r = + typeof r == "function" + ? r(s) + : r === !0 + ? "" + : r), + l.setAttribute("download", r)), + (l.innerHTML = this.emptyToSpace(this.sanitizeHTML(a))), + l + ); + } + return " "; + }, + image: function (s, t, e) { + var i = document.createElement("img"), + o = s.getValue(); + switch ( + (t.urlPrefix && (o = t.urlPrefix + s.getValue()), + t.urlSuffix && (o += t.urlSuffix), + i.setAttribute("src", o), + typeof t.height) + ) { + case "number": + i.style.height = t.height + "px"; + break; + case "string": + i.style.height = t.height; + } + switch (typeof t.width) { + case "number": + i.style.width = t.width + "px"; + break; + case "string": + i.style.width = t.width; + } + return ( + i.addEventListener("load", function () { + s.getRow().normalizeHeight(); + }), + i + ); + }, + tickCross: function (s, t, e) { + var i = s.getValue(), + o = s.getElement(), + n = t.allowEmpty, + r = t.allowTruthy, + a = Object.keys(t).includes("trueValue"), + l = + t.tickElement !== void 0 + ? t.tickElement + : '', + h = + t.crossElement !== void 0 + ? t.crossElement + : ''; + return (a && i === t.trueValue) || + (!a && + ((r && i) || + i === !0 || + i === "true" || + i === "True" || + i === 1 || + i === "1")) + ? (o.setAttribute("aria-checked", !0), l || "") + : !n || (i !== "null" && i !== "" && i != null) + ? (o.setAttribute("aria-checked", !1), h || "") + : (o.setAttribute("aria-checked", "mixed"), ""); + }, + datetime: function (s, t, e) { + var i, + o = this.table.dependencyRegistry.lookup( + ["luxon", "DateTime"], + "DateTime" + ), + n = t.inputFormat || "yyyy-MM-dd HH:mm:ss", + r = t.outputFormat || "dd/MM/yyyy HH:mm:ss", + a = + t.invalidPlaceholder !== void 0 + ? t.invalidPlaceholder + : "", + l = s.getValue(); + if (o !== void 0) + return (i = o.isDateTime(l) + ? l + : n === "iso" + ? o.fromISO(String(l)) + : o.fromFormat(String(l), n)).isValid + ? (t.timezone && (i = i.setZone(t.timezone)), + i.toFormat(r)) + : a !== !0 && l + ? typeof a == "function" + ? a(l) + : a + : l; + console.error( + "Format Error - 'datetime' formatter is dependant on luxon.js" + ); + }, + datetimediff: function (s, t, e) { + var i, + o = this.table.dependencyRegistry.lookup( + ["luxon", "DateTime"], + "DateTime" + ), + n = t.inputFormat || "yyyy-MM-dd HH:mm:ss", + r = + t.invalidPlaceholder !== void 0 + ? t.invalidPlaceholder + : "", + a = t.suffix !== void 0 && t.suffix, + l = t.unit !== void 0 ? t.unit : "days", + h = t.humanize !== void 0 && t.humanize, + d = t.date !== void 0 ? t.date : o.now(), + c = s.getValue(); + if (o !== void 0) + return (i = o.isDateTime(c) + ? c + : n === "iso" + ? o.fromISO(String(c)) + : o.fromFormat(String(c), n)).isValid + ? h + ? i.diff(d, l).toHuman() + (a ? " " + a : "") + : parseInt(i.diff(d, l)[l]) + (a ? " " + a : "") + : r === !0 + ? c + : typeof r == "function" + ? r(c) + : r; + console.error( + "Format Error - 'datetimediff' formatter is dependant on luxon.js" + ); + }, + lookup: function (s, t, e) { + var i = s.getValue(); + return t[i] === void 0 + ? (console.warn("Missing display value for " + i), i) + : t[i]; + }, + star: function (s, t, e) { + var i = s.getValue(), + o = s.getElement(), + n = t && t.stars ? t.stars : 5, + r = document.createElement("span"), + a = document.createElementNS( + "http://www.w3.org/2000/svg", + "svg" + ); + (r.style.verticalAlign = "middle"), + a.setAttribute("width", "14"), + a.setAttribute("height", "14"), + a.setAttribute("viewBox", "0 0 512 512"), + a.setAttribute("xml:space", "preserve"), + (a.style.padding = "0 1px"), + (i = i && !isNaN(i) ? parseInt(i) : 0), + (i = Math.max(0, Math.min(i, n))); + for (var l = 1; l <= n; l++) { + var h = a.cloneNode(!0); + (h.innerHTML = + l <= i + ? '' + : ''), + r.appendChild(h); + } + return ( + (o.style.whiteSpace = "nowrap"), + (o.style.overflow = "hidden"), + (o.style.textOverflow = "ellipsis"), + o.setAttribute("aria-label", i), + r + ); + }, + traffic: function (s, t, e) { + var i, + o, + n = this.sanitizeHTML(s.getValue()) || 0, + r = document.createElement("span"), + a = t && t.max ? t.max : 100, + l = t && t.min ? t.min : 0, + h = + t && t.color !== void 0 + ? t.color + : ["red", "orange", "green"], + d = "#666666"; + if (!isNaN(n) && s.getValue() !== void 0) { + switch ( + (r.classList.add("tabulator-traffic-light"), + (o = parseFloat(n) <= a ? parseFloat(n) : a), + (o = parseFloat(o) >= l ? parseFloat(o) : l), + (i = (a - l) / 100), + (o = Math.round((o - l) / i)), + typeof h) + ) { + case "string": + d = h; + break; + case "function": + d = h(n); + break; + case "object": + if (Array.isArray(h)) { + var c = 100 / h.length, + u = Math.floor(o / c); + (u = Math.min(u, h.length - 1)), + (d = h[(u = Math.max(u, 0))]); + break; + } + } + return (r.style.backgroundColor = d), r; + } + }, + progress: function (s, t = {}, e) { + var i, + o, + n, + r, + a, + l = this.sanitizeHTML(s.getValue()) || 0, + h = s.getElement(), + d = t.max ? t.max : 100, + c = t.min ? t.min : 0, + u = t.legendAlign ? t.legendAlign : "center"; + switch ( + ((o = parseFloat(l) <= d ? parseFloat(l) : d), + (o = parseFloat(o) >= c ? parseFloat(o) : c), + (i = (d - c) / 100), + (o = Math.round((o - c) / i)), + typeof t.color) + ) { + case "string": + n = t.color; + break; + case "function": + n = t.color(l); + break; + case "object": + if (Array.isArray(t.color)) { + let f = 100 / t.color.length, + v = Math.floor(o / f); + (v = Math.min(v, t.color.length - 1)), + (v = Math.max(v, 0)), + (n = t.color[v]); + break; + } + default: + n = "#2DC214"; + } + switch (typeof t.legend) { + case "string": + r = t.legend; + break; + case "function": + r = t.legend(l); + break; + case "boolean": + r = l; + break; + default: + r = !1; + } + switch (typeof t.legendColor) { + case "string": + a = t.legendColor; + break; + case "function": + a = t.legendColor(l); + break; + case "object": + if (Array.isArray(t.legendColor)) { + let f = 100 / t.legendColor.length, + v = Math.floor(o / f); + (v = Math.min(v, t.legendColor.length - 1)), + (v = Math.max(v, 0)), + (a = t.legendColor[v]); + } + break; + default: + a = "#000"; + } + (h.style.minWidth = "30px"), + (h.style.position = "relative"), + h.setAttribute("aria-label", o); + var m = document.createElement("div"); + (m.style.display = "inline-block"), + (m.style.width = o + "%"), + (m.style.backgroundColor = n), + (m.style.height = "100%"), + m.setAttribute("data-max", d), + m.setAttribute("data-min", c); + var p = document.createElement("div"); + if ( + ((p.style.position = "relative"), + (p.style.width = "100%"), + (p.style.height = "100%"), + r) + ) { + var g = document.createElement("div"); + (g.style.position = "absolute"), + (g.style.top = 0), + (g.style.left = 0), + (g.style.textAlign = u), + (g.style.width = "100%"), + (g.style.color = a), + (g.innerHTML = r); + } + return ( + e(function () { + if (!(s instanceof ae)) { + var f = document.createElement("div"); + (f.style.position = "absolute"), + (f.style.top = "4px"), + (f.style.bottom = "4px"), + (f.style.left = "4px"), + (f.style.right = "4px"), + h.appendChild(f), + (h = f); + } + h.appendChild(p), + p.appendChild(m), + r && p.appendChild(g); + }), + "" + ); + }, + color: function (s, t, e) { + return ( + (s.getElement().style.backgroundColor = this.sanitizeHTML( + s.getValue() + )), + "" + ); + }, + buttonTick: function (s, t, e) { + return ''; + }, + buttonCross: function (s, t, e) { + return ''; + }, + toggle: function (s, t, e) { + var i, + o, + n = s.getValue(), + r = t.size || 15, + a = r + "px", + l = !t.hasOwnProperty("onValue") || t.onValue, + h = !!t.hasOwnProperty("offValue") && t.offValue, + d = t.onTruthy ? n : n === l; + return ( + (i = document.createElement("div")).classList.add( + "tabulator-toggle" + ), + d + ? (i.classList.add("tabulator-toggle-on"), + (i.style.flexDirection = "row-reverse"), + t.onColor && (i.style.background = t.onColor)) + : t.offColor && (i.style.background = t.offColor), + (i.style.width = 2.5 * r + "px"), + (i.style.borderRadius = a), + t.clickable && + i.addEventListener("click", (c) => { + s.setValue(d ? h : l); + }), + (o = document.createElement("div")).classList.add( + "tabulator-toggle-switch" + ), + (o.style.height = a), + (o.style.width = a), + (o.style.borderRadius = a), + i.appendChild(o), + i + ); + }, + rownum: function (s, t, e) { + var i = document.createElement("span"), + o = s.getRow(), + n = s.getTable(); + return ( + o.watchPosition((r) => { + t.relativeToPage && + (r += + n.modules.page.getPageSize() * + (n.modules.page.getPage() - 1)), + (i.innerText = r); + }), + i + ); + }, + handle: function (s, t, e) { + return ( + s.getElement().classList.add("tabulator-row-handle"), + "
" + ); + }, + adaptable: function (s, t, e) { + var i, o; + return ( + (i = t.formatterLookup + ? t.formatterLookup(s) + : (function (n) { + var r = n.getValue(), + a = "plaintext"; + switch (typeof r) { + case "boolean": + a = "tickCross"; + break; + case "string": + r.includes(` +`) && (a = "textarea"); + } + return a; + })(s)), + t.paramsLookup && + (o = + typeof t.paramsLookup == "function" + ? t.paramsLookup(i, s) + : t.paramsLookup[i]), + this.table.modules.format + .lookupFormatter(i) + .call(this, s, o || {}, e) + ); + }, + array: function (s, t, e) { + var i, + o = t.delimiter || ",", + n = s.getValue(), + r = this.table; + return ( + t.valueMap && + (i = + typeof t.valueMap == "string" + ? function (a) { + return a.map((l) => + x.retrieveNestedData( + r.options.nestedFieldSeparator, + t.valueMap, + l + ) + ); + } + : t.valueMap), + Array.isArray(n) ? (i && (n = i(n)), n.join(o)) : n + ); + }, + json: function (s, t, e) { + var i = t.indent || " ", + o = t.multiline === void 0 || t.multiline, + n = t.replacer || null, + r = s.getValue(); + return ( + o && (s.getElement().style.whiteSpace = "pre-wrap"), + JSON.stringify(r, n, i) + ); + }, + }; + let I = class I extends w { + constructor(t) { + super(t), + this.registerColumnOption("formatter"), + this.registerColumnOption("formatterParams"), + this.registerColumnOption("formatterPrint"), + this.registerColumnOption("formatterPrintParams"), + this.registerColumnOption("formatterClipboard"), + this.registerColumnOption("formatterClipboardParams"), + this.registerColumnOption("formatterHtmlOutput"), + this.registerColumnOption("formatterHtmlOutputParams"), + this.registerColumnOption("titleFormatter"), + this.registerColumnOption("titleFormatterParams"); + } + initialize() { + this.subscribe("cell-format", this.formatValue.bind(this)), + this.subscribe( + "cell-rendered", + this.cellRendered.bind(this) + ), + this.subscribe( + "column-layout", + this.initializeColumn.bind(this) + ), + this.subscribe( + "column-format", + this.formatHeader.bind(this) + ); + } + initializeColumn(t) { + (t.modules.format = this.lookupTypeFormatter(t, "")), + t.definition.formatterPrint !== void 0 && + (t.modules.format.print = this.lookupTypeFormatter( + t, + "Print" + )), + t.definition.formatterClipboard !== void 0 && + (t.modules.format.clipboard = this.lookupTypeFormatter( + t, + "Clipboard" + )), + t.definition.formatterHtmlOutput !== void 0 && + (t.modules.format.htmlOutput = this.lookupTypeFormatter( + t, + "HtmlOutput" + )); + } + lookupTypeFormatter(t, e) { + var i = { + params: t.definition["formatter" + e + "Params"] || {}, + }, + o = t.definition["formatter" + e]; + return (i.formatter = this.lookupFormatter(o)), i; + } + lookupFormatter(t) { + var e; + switch (typeof t) { + case "string": + I.formatters[t] + ? (e = I.formatters[t]) + : (console.warn( + "Formatter Error - No such formatter found: ", + t + ), + (e = I.formatters.plaintext)); + break; + case "function": + e = t; + break; + default: + e = I.formatters.plaintext; + } + return e; + } + cellRendered(t) { + t.modules.format && + t.modules.format.renderedCallback && + !t.modules.format.rendered && + (t.modules.format.renderedCallback(), + (t.modules.format.rendered = !0)); + } + formatHeader(t, e, i) { + var o, n, r, a; + return t.definition.titleFormatter + ? ((o = this.lookupFormatter(t.definition.titleFormatter)), + (r = (l) => { + t.titleFormatterRendered = l; + }), + (a = { + getValue: function () { + return e; + }, + getElement: function () { + return i; + }, + getType: function () { + return "header"; + }, + getColumn: function () { + return t.getComponent(); + }, + getTable: () => this.table, + }), + (n = + typeof (n = + t.definition.titleFormatterParams || {}) == + "function" + ? n() + : n), + o.call(this, a, n, r)) + : e; + } + formatValue(t) { + var e = t.getComponent(), + i = + typeof t.column.modules.format.params == "function" + ? t.column.modules.format.params(e) + : t.column.modules.format.params; + return t.column.modules.format.formatter.call( + this, + e, + i, + function (o) { + t.modules.format || (t.modules.format = {}), + (t.modules.format.renderedCallback = o), + (t.modules.format.rendered = !1); + } + ); + } + formatExportValue(t, e) { + var i, + o = t.column.modules.format[e]; + if (o) { + let n = function (r) { + t.modules.format || (t.modules.format = {}), + (t.modules.format.renderedCallback = r), + (t.modules.format.rendered = !1); + }; + return ( + (i = + typeof o.params == "function" + ? o.params(t.getComponent()) + : o.params), + o.formatter.call(this, t.getComponent(), i, n) + ); + } + return this.formatValue(t); + } + sanitizeHTML(t) { + if (t) { + var e = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'", + "/": "/", + "`": "`", + "=": "=", + }; + return String(t).replace(/[&<>"'`=/]/g, function (i) { + return e[i]; + }); + } + return t; + } + emptyToSpace(t) { + return t == null || t === "" ? " " : t; + } + }; + b(I, "moduleName", "format"), b(I, "formatters", $e); + let Lt = I; + class ti { + constructor(t) { + return ( + (this._group = t), + (this.type = "GroupComponent"), + new Proxy(this, { + get: function (e, i, o) { + return e[i] !== void 0 + ? e[i] + : e._group.groupManager.table.componentFunctionBinder.handle( + "group", + e._group, + i + ); + }, + }) + ); + } + getKey() { + return this._group.key; + } + getField() { + return this._group.field; + } + getElement() { + return this._group.element; + } + getRows() { + return this._group.getRows(!0); + } + getSubGroups() { + return this._group.getSubGroups(!0); + } + getParentGroup() { + return ( + !!this._group.parent && this._group.parent.getComponent() + ); + } + isVisible() { + return this._group.visible; + } + show() { + this._group.show(); + } + hide() { + this._group.hide(); + } + toggle() { + this._group.toggleVisibility(); + } + scrollTo(t, e) { + return this._group.groupManager.table.rowManager.scrollToRow( + this._group, + t, + e + ); + } + _getSelf() { + return this._group; + } + getTable() { + return this._group.groupManager.table; + } + } + class K { + constructor(t, e, i, o, n, r, a) { + (this.groupManager = t), + (this.parent = e), + (this.key = o), + (this.level = i), + (this.field = n), + (this.hasSubGroups = i < t.groupIDLookups.length - 1), + (this.addRow = this.hasSubGroups + ? this._addRowToGroup + : this._addRow), + (this.type = "group"), + (this.old = a), + (this.rows = []), + (this.groups = []), + (this.groupList = []), + (this.generator = r), + (this.element = !1), + (this.elementContents = !1), + (this.height = 0), + (this.outerHeight = 0), + (this.initialized = !1), + (this.calcs = {}), + (this.initialized = !1), + (this.modules = {}), + (this.arrowElement = !1), + (this.visible = a + ? a.visible + : t.startOpen[i] !== void 0 + ? t.startOpen[i] + : t.startOpen[0]), + (this.component = null), + this.createElements(), + this.addBindings(), + this.createValueGroups(); + } + wipe(t) { + t || + (this.groupList.length + ? this.groupList.forEach(function (e) { + e.wipe(); + }) + : this.rows.forEach((e) => { + e.modules && delete e.modules.group; + })), + (this.element = !1), + (this.arrowElement = !1), + (this.elementContents = !1); + } + createElements() { + var t = document.createElement("div"); + t.classList.add("tabulator-arrow"), + (this.element = document.createElement("div")), + this.element.classList.add("tabulator-row"), + this.element.classList.add("tabulator-group"), + this.element.classList.add( + "tabulator-group-level-" + this.level + ), + this.element.setAttribute("role", "rowgroup"), + (this.arrowElement = document.createElement("div")), + this.arrowElement.classList.add("tabulator-group-toggle"), + this.arrowElement.appendChild(t), + this.groupManager.table.options.movableRows !== !1 && + this.groupManager.table.modExists("moveRow") && + this.groupManager.table.modules.moveRow.initializeGroupHeader( + this + ); + } + createValueGroups() { + var t = this.level + 1; + this.groupManager.allowedValues && + this.groupManager.allowedValues[t] && + this.groupManager.allowedValues[t].forEach((e) => { + this._createGroup(e, t); + }); + } + addBindings() { + this.groupManager.table.options.groupToggleElement && + (this.groupManager.table.options.groupToggleElement == + "arrow" + ? this.arrowElement + : this.element + ).addEventListener("click", (t) => { + this.groupManager.table.options.groupToggleElement === + "arrow" && + (t.stopPropagation(), t.stopImmediatePropagation()), + setTimeout(() => { + this.toggleVisibility(); + }); + }); + } + _createGroup(t, e) { + var i = e + "_" + t, + o = new K( + this.groupManager, + this, + e, + t, + this.groupManager.groupIDLookups[e].field, + this.groupManager.headerGenerator[e] || + this.groupManager.headerGenerator[0], + !!this.old && this.old.groups[i] + ); + (this.groups[i] = o), this.groupList.push(o); + } + _addRowToGroup(t) { + var e = this.level + 1; + if (this.hasSubGroups) { + var i = this.groupManager.groupIDLookups[e].func( + t.getData() + ), + o = e + "_" + i; + this.groupManager.allowedValues && + this.groupManager.allowedValues[e] + ? this.groups[o] && this.groups[o].addRow(t) + : (this.groups[o] || this._createGroup(i, e), + this.groups[o].addRow(t)); + } + } + _addRow(t) { + this.rows.push(t), (t.modules.group = this); + } + insertRow(t, e, i) { + var o = this.conformRowData({}); + t.updateData(o); + var n = this.rows.indexOf(e); + n > -1 + ? i + ? this.rows.splice(n + 1, 0, t) + : this.rows.splice(n, 0, t) + : i + ? this.rows.push(t) + : this.rows.unshift(t), + (t.modules.group = this), + this.groupManager.table.modExists("columnCalcs") && + this.groupManager.table.options.columnCalcs != + "table" && + this.groupManager.table.modules.columnCalcs.recalcGroup( + this + ), + this.groupManager.updateGroupRows(!0); + } + scrollHeader(t) { + this.arrowElement && + ((this.arrowElement.style.marginLeft = t), + this.groupList.forEach(function (e) { + e.scrollHeader(t); + })); + } + getRowIndex(t) {} + conformRowData(t) { + return ( + this.field + ? (t[this.field] = this.key) + : console.warn( + "Data Conforming Error - Cannot conform row data to match new group as groupBy is a function" + ), + this.parent && (t = this.parent.conformRowData(t)), + t + ); + } + removeRow(t) { + var e = this.rows.indexOf(t), + i = t.getElement(); + e > -1 && this.rows.splice(e, 1), + this.groupManager.table.options.groupValues || + this.rows.length + ? (i.parentNode && i.parentNode.removeChild(i), + this.groupManager.blockRedraw || + (this.generateGroupHeaderContents(), + this.groupManager.table.modExists( + "columnCalcs" + ) && + this.groupManager.table.options.columnCalcs != + "table" && + this.groupManager.table.modules.columnCalcs.recalcGroup( + this + ))) + : (this.parent + ? this.parent.removeGroup(this) + : this.groupManager.removeGroup(this), + this.groupManager.updateGroupRows(!0)); + } + removeGroup(t) { + var e, + i = t.level + "_" + t.key; + this.groups[i] && + (delete this.groups[i], + (e = this.groupList.indexOf(t)) > -1 && + this.groupList.splice(e, 1), + this.groupList.length || + (this.parent + ? this.parent.removeGroup(this) + : this.groupManager.removeGroup(this))); + } + getHeadersAndRows() { + var t = []; + return ( + t.push(this), + this._visSet(), + this.calcs.top && + (this.calcs.top.detachElement(), + this.calcs.top.deleteCells()), + this.calcs.bottom && + (this.calcs.bottom.detachElement(), + this.calcs.bottom.deleteCells()), + this.visible + ? this.groupList.length + ? this.groupList.forEach(function (e) { + t = t.concat(e.getHeadersAndRows()); + }) + : (this.groupManager.table.options.columnCalcs != + "table" && + this.groupManager.table.modExists( + "columnCalcs" + ) && + this.groupManager.table.modules.columnCalcs.hasTopCalcs() && + ((this.calcs.top = + this.groupManager.table.modules.columnCalcs.generateTopRow( + this.rows + )), + t.push(this.calcs.top)), + (t = t.concat(this.rows)), + this.groupManager.table.options.columnCalcs != + "table" && + this.groupManager.table.modExists( + "columnCalcs" + ) && + this.groupManager.table.modules.columnCalcs.hasBottomCalcs() && + ((this.calcs.bottom = + this.groupManager.table.modules.columnCalcs.generateBottomRow( + this.rows + )), + t.push(this.calcs.bottom))) + : this.groupList.length || + this.groupManager.table.options.columnCalcs == + "table" || + (this.groupManager.table.modExists("columnCalcs") && + (this.groupManager.table.modules.columnCalcs.hasTopCalcs() && + this.groupManager.table.options + .groupClosedShowCalcs && + ((this.calcs.top = + this.groupManager.table.modules.columnCalcs.generateTopRow( + this.rows + )), + t.push(this.calcs.top)), + this.groupManager.table.modules.columnCalcs.hasBottomCalcs() && + this.groupManager.table.options + .groupClosedShowCalcs && + ((this.calcs.bottom = + this.groupManager.table.modules.columnCalcs.generateBottomRow( + this.rows + )), + t.push(this.calcs.bottom)))), + t + ); + } + getData(t, e) { + var i = []; + return ( + this._visSet(), + (!t || (t && this.visible)) && + this.rows.forEach((o) => { + i.push(o.getData(e || "data")); + }), + i + ); + } + getRowCount() { + var t = 0; + return ( + this.groupList.length + ? this.groupList.forEach((e) => { + t += e.getRowCount(); + }) + : (t = this.rows.length), + t + ); + } + toggleVisibility() { + this.visible ? this.hide() : this.show(); + } + hide() { + (this.visible = !1), + this.groupManager.table.rowManager.getRenderMode() != + "basic" || + this.groupManager.table.options.pagination || + (this.element.classList.remove( + "tabulator-group-visible" + ), + this.groupList.length + ? this.groupList.forEach((t) => { + t.getHeadersAndRows().forEach((e) => { + e.detachElement(); + }); + }) + : this.rows.forEach((t) => { + var e = t.getElement(); + e.parentNode.removeChild(e); + })), + this.groupManager.updateGroupRows(!0), + this.groupManager.table.externalEvents.dispatch( + "groupVisibilityChanged", + this.getComponent(), + !1 + ); + } + show() { + if ( + ((this.visible = !0), + this.groupManager.table.rowManager.getRenderMode() != + "basic" || this.groupManager.table.options.pagination) + ) + this.groupManager.updateGroupRows(!0); + else { + this.element.classList.add("tabulator-group-visible"); + var t = this.generateElement(); + this.groupList.length + ? this.groupList.forEach((e) => { + e.getHeadersAndRows().forEach((i) => { + var o = i.getElement(); + t.parentNode.insertBefore(o, t.nextSibling), + i.initialize(), + (t = o); + }); + }) + : this.rows.forEach((e) => { + var i = e.getElement(); + t.parentNode.insertBefore(i, t.nextSibling), + e.initialize(), + (t = i); + }), + this.groupManager.updateGroupRows(!0); + } + this.groupManager.table.externalEvents.dispatch( + "groupVisibilityChanged", + this.getComponent(), + !0 + ); + } + _visSet() { + var t = []; + typeof this.visible == "function" && + (this.rows.forEach(function (e) { + t.push(e.getData()); + }), + (this.visible = this.visible( + this.key, + this.getRowCount(), + t, + this.getComponent() + ))); + } + getRowGroup(t) { + var e = !1; + return ( + this.groupList.length + ? this.groupList.forEach(function (i) { + var o = i.getRowGroup(t); + o && (e = o); + }) + : this.rows.find(function (i) { + return i === t; + }) && (e = this), + e + ); + } + getSubGroups(t) { + var e = []; + return ( + this.groupList.forEach(function (i) { + e.push(t ? i.getComponent() : i); + }), + e + ); + } + getRows(t, e) { + var i = []; + return ( + e && this.groupList.length + ? this.groupList.forEach((o) => { + i = i.concat(o.getRows(t, e)); + }) + : this.rows.forEach(function (o) { + i.push(t ? o.getComponent() : o); + }), + i + ); + } + generateGroupHeaderContents() { + var t = []; + for ( + this.getRows(!1, !0).forEach(function (e) { + t.push(e.getData()); + }), + this.elementContents = this.generator( + this.key, + this.getRowCount(), + t, + this.getComponent() + ); + this.element.firstChild; + + ) + this.element.removeChild(this.element.firstChild); + typeof this.elementContents == "string" + ? (this.element.innerHTML = this.elementContents) + : this.element.appendChild(this.elementContents), + this.element.insertBefore( + this.arrowElement, + this.element.firstChild + ); + } + getPath(t = []) { + return ( + t.unshift(this.key), + this.parent && this.parent.getPath(t), + t + ); + } + getElement() { + return this.elementContents + ? this.element + : this.generateElement(); + } + generateElement() { + (this.addBindings = !1), + this._visSet(), + this.visible + ? this.element.classList.add("tabulator-group-visible") + : this.element.classList.remove( + "tabulator-group-visible" + ); + for (var t = 0; t < this.element.childNodes.length; ++t) + this.element.childNodes[t].parentNode.removeChild( + this.element.childNodes[t] + ); + return this.generateGroupHeaderContents(), this.element; + } + detachElement() { + this.element && + this.element.parentNode && + this.element.parentNode.removeChild(this.element); + } + normalizeHeight() { + this.setHeight(this.element.clientHeight); + } + initialize(t) { + (this.initialized && !t) || + (this.normalizeHeight(), (this.initialized = !0)); + } + reinitialize() { + (this.initialized = !1), + (this.height = 0), + x.elVisible(this.element) && this.initialize(!0); + } + setHeight(t) { + this.height != t && + ((this.height = t), + (this.outerHeight = this.element.offsetHeight)); + } + getHeight() { + return this.outerHeight; + } + getGroup() { + return this; + } + reinitializeHeight() {} + calcHeight() {} + setCellHeight() {} + clearCellHeight() {} + deinitializeHeight() {} + rendered() {} + getComponent() { + return ( + this.component || (this.component = new ti(this)), + this.component + ); + } + } + var ei = { + cellEdit: function (s) { + s.component.setValueProcessData(s.data.oldValue), + s.component.cellRendered(); + }, + rowAdd: function (s) { + s.component.deleteActual(), + this.table.rowManager.checkPlaceholder(); + }, + rowDelete: function (s) { + var t = this.table.rowManager.addRowActual( + s.data.data, + s.data.pos, + s.data.index + ); + this.table.options.groupBy && + this.table.modExists("groupRows") && + this.table.modules.groupRows.updateGroupRows(!0), + this._rebindRow(s.component, t), + this.table.rowManager.checkPlaceholder(); + }, + rowMove: function (s) { + var t = s.data.posFrom - s.data.posTo > 0; + this.table.rowManager.moveRowActual( + s.component, + this.table.rowManager.getRowFromPosition( + s.data.posFrom + ), + t + ), + this.table.rowManager.regenerateRowPositions(), + this.table.rowManager.reRenderInPosition(); + }, + }, + ii = { + cellEdit: function (s) { + s.component.setValueProcessData(s.data.newValue), + s.component.cellRendered(); + }, + rowAdd: function (s) { + var t = this.table.rowManager.addRowActual( + s.data.data, + s.data.pos, + s.data.index + ); + this.table.options.groupBy && + this.table.modExists("groupRows") && + this.table.modules.groupRows.updateGroupRows(!0), + this._rebindRow(s.component, t), + this.table.rowManager.checkPlaceholder(); + }, + rowDelete: function (s) { + s.component.deleteActual(), + this.table.rowManager.checkPlaceholder(); + }, + rowMove: function (s) { + this.table.rowManager.moveRowActual( + s.component, + this.table.rowManager.getRowFromPosition(s.data.posTo), + s.data.after + ), + this.table.rowManager.regenerateRowPositions(), + this.table.rowManager.reRenderInPosition(); + }, + }, + si = { + keybindings: { + bindings: { + undo: ["ctrl + 90", "meta + 90"], + redo: ["ctrl + 89", "meta + 89"], + }, + actions: { + undo: function (s) { + this.table.options.history && + this.table.modExists("history") && + this.table.modExists("edit") && + (this.table.modules.edit.currentCell || + (s.preventDefault(), + this.table.modules.history.undo())); + }, + redo: function (s) { + this.table.options.history && + this.table.modExists("history") && + this.table.modExists("edit") && + (this.table.modules.edit.currentCell || + (s.preventDefault(), + this.table.modules.history.redo())); + }, + }, + }, + }; + let N = class N extends w { + constructor(t) { + super(t), + (this.history = []), + (this.index = -1), + this.registerTableOption("history", !1); + } + initialize() { + this.table.options.history && + (this.subscribe( + "cell-value-updated", + this.cellUpdated.bind(this) + ), + this.subscribe( + "cell-delete", + this.clearComponentHistory.bind(this) + ), + this.subscribe("row-delete", this.rowDeleted.bind(this)), + this.subscribe("rows-wipe", this.clear.bind(this)), + this.subscribe("row-added", this.rowAdded.bind(this)), + this.subscribe("row-move", this.rowMoved.bind(this))), + this.registerTableFunction("undo", this.undo.bind(this)), + this.registerTableFunction("redo", this.redo.bind(this)), + this.registerTableFunction( + "getHistoryUndoSize", + this.getHistoryUndoSize.bind(this) + ), + this.registerTableFunction( + "getHistoryRedoSize", + this.getHistoryRedoSize.bind(this) + ), + this.registerTableFunction( + "clearHistory", + this.clear.bind(this) + ); + } + rowMoved(t, e, i) { + this.action("rowMove", t, { + posFrom: t.getPosition(), + posTo: e.getPosition(), + to: e, + after: i, + }); + } + rowAdded(t, e, i, o) { + this.action("rowAdd", t, { data: e, pos: i, index: o }); + } + rowDeleted(t) { + var e, i; + this.table.options.groupBy + ? (e = (i = t + .getComponent() + .getGroup() + ._getSelf().rows).indexOf(t)) && (e = i[e - 1]) + : (e = t.table.rowManager.getRowIndex(t)) && + (e = t.table.rowManager.rows[e - 1]), + this.action("rowDelete", t, { + data: t.getData(), + pos: !e, + index: e, + }); + } + cellUpdated(t) { + this.action("cellEdit", t, { + oldValue: t.oldValue, + newValue: t.value, + }); + } + clear() { + (this.history = []), (this.index = -1); + } + action(t, e, i) { + (this.history = this.history.slice(0, this.index + 1)), + this.history.push({ type: t, component: e, data: i }), + this.index++; + } + getHistoryUndoSize() { + return this.index + 1; + } + getHistoryRedoSize() { + return this.history.length - (this.index + 1); + } + clearComponentHistory(t) { + var e = this.history.findIndex(function (i) { + return i.component === t; + }); + e > -1 && + (this.history.splice(e, 1), + e <= this.index && this.index--, + this.clearComponentHistory(t)); + } + undo() { + if (this.index > -1) { + let t = this.history[this.index]; + return ( + N.undoers[t.type].call(this, t), + this.index--, + this.dispatchExternal( + "historyUndo", + t.type, + t.component.getComponent(), + t.data + ), + !0 + ); + } + return ( + console.warn( + this.options("history") + ? "History Undo Error - No more history to undo" + : "History module not enabled" + ), + !1 + ); + } + redo() { + if (this.history.length - 1 > this.index) { + this.index++; + let t = this.history[this.index]; + return ( + N.redoers[t.type].call(this, t), + this.dispatchExternal( + "historyRedo", + t.type, + t.component.getComponent(), + t.data + ), + !0 + ); + } + return ( + console.warn( + this.options("history") + ? "History Redo Error - No more history to redo" + : "History module not enabled" + ), + !1 + ); + } + _rebindRow(t, e) { + this.history.forEach(function (i) { + if (i.component instanceof k) + i.component === t && (i.component = e); + else if ( + i.component instanceof et && + i.component.row === t + ) { + var o = i.component.column.getField(); + o && (i.component = e.getCell(o)); + } + }); + } + }; + b(N, "moduleName", "history"), + b(N, "moduleExtensions", si), + b(N, "undoers", ei), + b(N, "redoers", ii); + let St = N; + var oi = { + csv: function (s) { + var t = [], + e = 0, + i = 0, + o = !1; + for (let n = 0; n < s.length; n++) { + let r = s[n], + a = s[n + 1]; + t[e] || (t[e] = []), + t[e][i] || (t[e][i] = ""), + r == '"' && o && a == '"' + ? ((t[e][i] += r), n++) + : r != '"' + ? r != "," || o + ? r != "\r" || + a != + ` +` || + o + ? (r != "\r" && + r != + ` +`) || + o + ? (t[e][i] += r) + : ((i = 0), e++) + : ((i = 0), e++, n++) + : i++ + : (o = !o); + } + return t; + }, + json: function (s) { + try { + return JSON.parse(s); + } catch (t) { + return ( + console.warn( + "JSON Import Error - File contents is invalid JSON", + t + ), + Promise.reject() + ); + } + }, + array: function (s) { + return s; + }, + xlsx: function (s) { + var t = this.dependencyRegistry.lookup("XLSX"), + e = t.read(s), + i = e.Sheets[e.SheetNames[0]]; + return t.utils.sheet_to_json(i, { header: 1 }); + }, + }; + let ot = class ot extends w { + constructor(t) { + super(t), + this.registerTableOption("importFormat"), + this.registerTableOption("importReader", "text"), + this.registerTableOption("importHeaderTransform"), + this.registerTableOption("importValueTransform"), + this.registerTableOption("importDataValidator"), + this.registerTableOption("importFileValidator"); + } + initialize() { + this.registerTableFunction( + "import", + this.importFromFile.bind(this) + ), + this.table.options.importFormat && + (this.subscribe( + "data-loading", + this.loadDataCheck.bind(this), + 10 + ), + this.subscribe( + "data-load", + this.loadData.bind(this), + 10 + )); + } + loadDataCheck(t) { + return ( + this.table.options.importFormat && + (typeof t == "string" || + (Array.isArray(t) && t.length && Array.isArray(t))) + ); + } + loadData(t, e, i, o, n) { + return this.importData(this.lookupImporter(), t) + .then(this.structureData.bind(this)) + .catch( + (r) => ( + console.error( + "Import Error:", + r || "Unable to import data" + ), + Promise.reject(r) + ) + ); + } + lookupImporter(t) { + var e; + return ( + t || (t = this.table.options.importFormat), + (e = typeof t == "string" ? ot.importers[t] : t) || + console.error("Import Error - Importer not found:", t), + e + ); + } + importFromFile(t, e, i) { + var o = this.lookupImporter(t); + if (o) + return this.pickFile(e, i) + .then(this.importData.bind(this, o)) + .then(this.structureData.bind(this)) + .then(this.mutateData.bind(this)) + .then(this.validateData.bind(this)) + .then(this.setData.bind(this)) + .catch( + (n) => ( + this.dispatch("import-error", n), + this.dispatchExternal("importError", n), + console.error( + "Import Error:", + n || "Unable to import file" + ), + this.table.dataLoader.alertError(), + setTimeout(() => { + this.table.dataLoader.clearAlert(); + }, 3e3), + Promise.reject(n) + ) + ); + } + pickFile(t, e) { + return new Promise((i, o) => { + var n = document.createElement("input"); + (n.type = "file"), + (n.accept = t), + n.addEventListener("change", (r) => { + var a = n.files[0], + l = new FileReader(), + h = this.validateFile(a); + if (h === !0) { + switch ( + (this.dispatch("import-importing", n.files), + this.dispatchExternal( + "importImporting", + n.files + ), + e || this.table.options.importReader) + ) { + case "buffer": + l.readAsArrayBuffer(a); + break; + case "binary": + l.readAsBinaryString(a); + break; + case "url": + l.readAsDataURL(a); + break; + default: + l.readAsText(a); + } + (l.onload = (d) => { + i(l.result); + }), + (l.onerror = (d) => { + console.warn( + "File Load Error - Unable to read file" + ), + o(d); + }); + } else o(h); + }), + this.dispatch("import-choose"), + this.dispatchExternal("importChoose"), + n.click(); + }); + } + importData(t, e) { + var i; + return ( + this.table.dataLoader.alertLoader(), + new Promise((o, n) => { + setTimeout(() => { + (i = t.call(this.table, e)) instanceof Promise || i + ? o(i) + : n(); + }, 10); + }) + ); + } + structureData(t) { + return Array.isArray(t) && t.length && Array.isArray(t[0]) + ? this.table.options.autoColumns + ? this.structureArrayToObject(t) + : this.structureArrayToColumns(t) + : t; + } + mutateData(t) { + var e = []; + return ( + Array.isArray(t) + ? t.forEach((i) => { + e.push( + this.table.modules.mutator.transformRow( + i, + "import" + ) + ); + }) + : (e = t), + e + ); + } + transformHeader(t) { + var e = []; + return this.table.options.importHeaderTransform + ? (t.forEach((i) => { + e.push( + this.table.options.importHeaderTransform.call( + this.table, + i, + t + ) + ); + }), + e) + : t; + } + transformData(t) { + var e = []; + return this.table.options.importValueTransform + ? (t.forEach((i) => { + e.push( + this.table.options.importValueTransform.call( + this.table, + i, + t + ) + ); + }), + e) + : t; + } + structureArrayToObject(t) { + var e = this.transformHeader(t.shift()); + return t.map((i) => { + var o = {}; + return ( + (i = this.transformData(i)), + e.forEach((n, r) => { + o[n] = i[r]; + }), + o + ); + }); + } + structureArrayToColumns(t) { + var e = [], + i = this.transformHeader(t[0]), + o = this.table.getColumns(); + return ( + o[0] && + i[0] && + o[0].getDefinition().title === i[0] && + t.shift(), + t.forEach((n) => { + var r = {}; + (n = this.transformData(n)).forEach((a, l) => { + var h = o[l]; + h && (r[h.getField()] = a); + }), + e.push(r); + }), + e + ); + } + validateFile(t) { + return ( + !this.table.options.importFileValidator || + this.table.options.importFileValidator.call(this.table, t) + ); + } + validateData(t) { + var e; + return this.table.options.importDataValidator + ? (e = this.table.options.importDataValidator.call( + this.table, + t + )) === !0 + ? t + : Promise.reject(e) + : t; + } + setData(t) { + return ( + this.dispatch("import-imported", t), + this.dispatchExternal("importImported", t), + this.table.dataLoader.clearAlert(), + this.table.setData(t) + ); + } + }; + b(ot, "moduleName", "import"), b(ot, "importers", oi); + let Dt = ot; + var ni = { + navPrev: "shift + 9", + navNext: 9, + navUp: 38, + navDown: 40, + navLeft: 37, + navRight: 39, + scrollPageUp: 33, + scrollPageDown: 34, + scrollToStart: 36, + scrollToEnd: 35, + }, + ri = { + keyBlock: function (s) { + s.stopPropagation(), s.preventDefault(); + }, + scrollPageUp: function (s) { + var t = this.table.rowManager, + e = t.scrollTop - t.element.clientHeight; + s.preventDefault(), + t.displayRowsCount && + (e >= 0 + ? (t.element.scrollTop = e) + : t.scrollToRow(t.getDisplayRows()[0])), + this.table.element.focus(); + }, + scrollPageDown: function (s) { + var t = this.table.rowManager, + e = t.scrollTop + t.element.clientHeight, + i = t.element.scrollHeight; + s.preventDefault(), + t.displayRowsCount && + (e <= i + ? (t.element.scrollTop = e) + : t.scrollToRow( + t.getDisplayRows()[t.displayRowsCount - 1] + )), + this.table.element.focus(); + }, + scrollToStart: function (s) { + var t = this.table.rowManager; + s.preventDefault(), + t.displayRowsCount && + t.scrollToRow(t.getDisplayRows()[0]), + this.table.element.focus(); + }, + scrollToEnd: function (s) { + var t = this.table.rowManager; + s.preventDefault(), + t.displayRowsCount && + t.scrollToRow( + t.getDisplayRows()[t.displayRowsCount - 1] + ), + this.table.element.focus(); + }, + navPrev: function (s) { + this.dispatch("keybinding-nav-prev", s); + }, + navNext: function (s) { + this.dispatch("keybinding-nav-next", s); + }, + navLeft: function (s) { + this.dispatch("keybinding-nav-left", s); + }, + navRight: function (s) { + this.dispatch("keybinding-nav-right", s); + }, + navUp: function (s) { + this.dispatch("keybinding-nav-up", s); + }, + navDown: function (s) { + this.dispatch("keybinding-nav-down", s); + }, + }; + let W = class W extends w { + constructor(t) { + super(t), + (this.watchKeys = null), + (this.pressedKeys = null), + (this.keyupBinding = !1), + (this.keydownBinding = !1), + this.registerTableOption("keybindings", {}), + this.registerTableOption("tabEndNewRow", !1); + } + initialize() { + var t = this.table.options.keybindings, + e = {}; + (this.watchKeys = {}), + (this.pressedKeys = []), + t !== !1 && + (Object.assign(e, W.bindings), + Object.assign(e, t), + this.mapBindings(e), + this.bindEvents()), + this.subscribe( + "table-destroy", + this.clearBindings.bind(this) + ); + } + mapBindings(t) { + for (let e in t) + W.actions[e] + ? t[e] && + (typeof t[e] != "object" && (t[e] = [t[e]]), + t[e].forEach((i) => { + (Array.isArray(i) ? i : [i]).forEach((o) => { + this.mapBinding(e, o); + }); + })) + : console.warn( + "Key Binding Error - no such action:", + e + ); + } + mapBinding(t, e) { + var i = { + action: W.actions[t], + keys: [], + ctrl: !1, + shift: !1, + meta: !1, + }; + e.toString() + .toLowerCase() + .split(" ") + .join("") + .split("+") + .forEach((o) => { + switch (o) { + case "ctrl": + i.ctrl = !0; + break; + case "shift": + i.shift = !0; + break; + case "meta": + i.meta = !0; + break; + default: + (o = isNaN(o) + ? o.toUpperCase().charCodeAt(0) + : parseInt(o)), + i.keys.push(o), + this.watchKeys[o] || + (this.watchKeys[o] = []), + this.watchKeys[o].push(i); + } + }); + } + bindEvents() { + var t = this; + (this.keyupBinding = function (e) { + var i = e.keyCode, + o = t.watchKeys[i]; + o && + (t.pressedKeys.push(i), + o.forEach(function (n) { + t.checkBinding(e, n); + })); + }), + (this.keydownBinding = function (e) { + var i = e.keyCode; + if (t.watchKeys[i]) { + var o = t.pressedKeys.indexOf(i); + o > -1 && t.pressedKeys.splice(o, 1); + } + }), + this.table.element.addEventListener( + "keydown", + this.keyupBinding + ), + this.table.element.addEventListener( + "keyup", + this.keydownBinding + ); + } + clearBindings() { + this.keyupBinding && + this.table.element.removeEventListener( + "keydown", + this.keyupBinding + ), + this.keydownBinding && + this.table.element.removeEventListener( + "keyup", + this.keydownBinding + ); + } + checkBinding(t, e) { + var i = !0; + return ( + t.ctrlKey == e.ctrl && + t.shiftKey == e.shift && + t.metaKey == e.meta && + (e.keys.forEach((o) => { + this.pressedKeys.indexOf(o) == -1 && (i = !1); + }), + i && e.action.call(this, t), + !0) + ); + } + }; + b(W, "moduleName", "keybindings"), + b(W, "bindings", ni), + b(W, "actions", ri); + let zt = W; + var ai = { + delete: function (s, t, e) { + s.delete(); + }, + }, + li = { + insert: function (s, t, e) { + return this.table.addRow(s.getData(), void 0, t), !0; + }, + add: function (s, t, e) { + return this.table.addRow(s.getData()), !0; + }, + update: function (s, t, e) { + return !!t && (t.update(s.getData()), !0); + }, + replace: function (s, t, e) { + return ( + !!t && + (this.table.addRow(s.getData(), void 0, t), + t.delete(), + !0) + ); + }, + }; + let q = class q extends w { + constructor(t) { + super(t), + (this.placeholderElement = this.createPlaceholderElement()), + (this.hoverElement = !1), + (this.checkTimeout = !1), + (this.checkPeriod = 150), + (this.moving = !1), + (this.toRow = !1), + (this.toRowAfter = !1), + (this.hasHandle = !1), + (this.startY = 0), + (this.startX = 0), + (this.moveHover = this.moveHover.bind(this)), + (this.endMove = this.endMove.bind(this)), + (this.tableRowDropEvent = !1), + (this.touchMove = !1), + (this.connection = !1), + (this.connectionSelectorsTables = !1), + (this.connectionSelectorsElements = !1), + (this.connectionElements = []), + (this.connections = []), + (this.connectedTable = !1), + (this.connectedRow = !1), + this.registerTableOption("movableRows", !1), + this.registerTableOption("movableRowsConnectedTables", !1), + this.registerTableOption( + "movableRowsConnectedElements", + !1 + ), + this.registerTableOption("movableRowsSender", !1), + this.registerTableOption("movableRowsReceiver", "insert"), + this.registerColumnOption("rowHandle"); + } + createPlaceholderElement() { + var t = document.createElement("div"); + return ( + t.classList.add("tabulator-row"), + t.classList.add("tabulator-row-placeholder"), + t + ); + } + initialize() { + this.table.options.movableRows && + ((this.connectionSelectorsTables = + this.table.options.movableRowsConnectedTables), + (this.connectionSelectorsElements = + this.table.options.movableRowsConnectedElements), + (this.connection = + this.connectionSelectorsTables || + this.connectionSelectorsElements), + this.subscribe("cell-init", this.initializeCell.bind(this)), + this.subscribe( + "column-init", + this.initializeColumn.bind(this) + ), + this.subscribe("row-init", this.initializeRow.bind(this))); + } + initializeGroupHeader(t) { + var e = this, + i = {}; + (i.mouseup = function (o) { + e.tableRowDrop(o, t); + }.bind(e)), + (i.mousemove = function (o) { + var n; + o.pageY - + x.elOffset(t.element).top + + e.table.rowManager.element.scrollTop > + t.getHeight() / 2 + ? (e.toRow === t && e.toRowAfter) || + ((n = t.getElement()).parentNode.insertBefore( + e.placeholderElement, + n.nextSibling + ), + e.moveRow(t, !0)) + : (e.toRow !== t || e.toRowAfter) && + (n = t.getElement()).previousSibling && + (n.parentNode.insertBefore( + e.placeholderElement, + n + ), + e.moveRow(t, !1)); + }.bind(e)), + (t.modules.moveRow = i); + } + initializeRow(t) { + var e, + i = this, + o = {}; + (o.mouseup = function (n) { + i.tableRowDrop(n, t); + }.bind(i)), + (o.mousemove = function (n) { + var r = t.getElement(); + n.pageY - + x.elOffset(r).top + + i.table.rowManager.element.scrollTop > + t.getHeight() / 2 + ? (i.toRow === t && i.toRowAfter) || + (r.parentNode.insertBefore( + i.placeholderElement, + r.nextSibling + ), + i.moveRow(t, !0)) + : (i.toRow !== t || i.toRowAfter) && + (r.parentNode.insertBefore( + i.placeholderElement, + r + ), + i.moveRow(t, !1)); + }.bind(i)), + this.hasHandle || + ((e = t.getElement()).addEventListener( + "mousedown", + function (n) { + n.which === 1 && + (i.checkTimeout = setTimeout(function () { + i.startMove(n, t); + }, i.checkPeriod)); + } + ), + e.addEventListener("mouseup", function (n) { + n.which === 1 && + i.checkTimeout && + clearTimeout(i.checkTimeout); + }), + this.bindTouchEvents(t, t.getElement())), + (t.modules.moveRow = o); + } + initializeColumn(t) { + t.definition.rowHandle && + this.table.options.movableRows !== !1 && + (this.hasHandle = !0); + } + initializeCell(t) { + if ( + t.column.definition.rowHandle && + this.table.options.movableRows !== !1 + ) { + var e = this, + i = t.getElement(!0); + i.addEventListener("mousedown", function (o) { + o.which === 1 && + (e.checkTimeout = setTimeout(function () { + e.startMove(o, t.row); + }, e.checkPeriod)); + }), + i.addEventListener("mouseup", function (o) { + o.which === 1 && + e.checkTimeout && + clearTimeout(e.checkTimeout); + }), + this.bindTouchEvents(t.row, i); + } + } + bindTouchEvents(t, e) { + var i, + o, + n, + r, + a, + l, + h = !1; + e.addEventListener( + "touchstart", + (d) => { + this.checkTimeout = setTimeout(() => { + (this.touchMove = !0), + (i = t.nextRow()), + (n = i ? i.getHeight() / 2 : 0), + (o = t.prevRow()), + (r = o ? o.getHeight() / 2 : 0), + (a = 0), + (l = 0), + (h = !1), + this.startMove(d, t); + }, this.checkPeriod); + }, + { passive: !0 } + ), + this.moving, + this.toRow, + this.toRowAfter, + e.addEventListener("touchmove", (d) => { + var c, u; + this.moving && + (d.preventDefault(), + this.moveHover(d), + h || (h = d.touches[0].pageY), + (c = d.touches[0].pageY - h) > 0 + ? i && + c - a > n && + (u = i) !== t && + ((h = d.touches[0].pageY), + u + .getElement() + .parentNode.insertBefore( + this.placeholderElement, + u.getElement().nextSibling + ), + this.moveRow(u, !0)) + : o && + -c - l > r && + (u = o) !== t && + ((h = d.touches[0].pageY), + u + .getElement() + .parentNode.insertBefore( + this.placeholderElement, + u.getElement() + ), + this.moveRow(u, !1)), + u && + ((i = u.nextRow()), + (a = n), + (n = i ? i.getHeight() / 2 : 0), + (o = u.prevRow()), + (l = r), + (r = o ? o.getHeight() / 2 : 0))); + }), + e.addEventListener("touchend", (d) => { + this.checkTimeout && clearTimeout(this.checkTimeout), + this.moving && + (this.endMove(d), (this.touchMove = !1)); + }); + } + _bindMouseMove() { + this.table.rowManager.getDisplayRows().forEach((t) => { + (t.type === "row" || t.type === "group") && + t.modules.moveRow && + t.modules.moveRow.mousemove && + t + .getElement() + .addEventListener( + "mousemove", + t.modules.moveRow.mousemove + ); + }); + } + _unbindMouseMove() { + this.table.rowManager.getDisplayRows().forEach((t) => { + (t.type === "row" || t.type === "group") && + t.modules.moveRow && + t.modules.moveRow.mousemove && + t + .getElement() + .removeEventListener( + "mousemove", + t.modules.moveRow.mousemove + ); + }); + } + startMove(t, e) { + var i = e.getElement(); + this.setStartPosition(t, e), + (this.moving = e), + this.table.element.classList.add("tabulator-block-select"), + (this.placeholderElement.style.width = e.getWidth() + "px"), + (this.placeholderElement.style.height = + e.getHeight() + "px"), + this.connection + ? (this.table.element.classList.add( + "tabulator-movingrow-sending" + ), + this.connectToTables(e)) + : (i.parentNode.insertBefore( + this.placeholderElement, + i + ), + i.parentNode.removeChild(i)), + (this.hoverElement = i.cloneNode(!0)), + this.hoverElement.classList.add("tabulator-moving"), + this.connection + ? (document.body.appendChild(this.hoverElement), + (this.hoverElement.style.left = "0"), + (this.hoverElement.style.top = "0"), + (this.hoverElement.style.width = + this.table.element.clientWidth + "px"), + (this.hoverElement.style.whiteSpace = "nowrap"), + (this.hoverElement.style.overflow = "hidden"), + (this.hoverElement.style.pointerEvents = "none")) + : (this.table.rowManager + .getTableElement() + .appendChild(this.hoverElement), + (this.hoverElement.style.left = "0"), + (this.hoverElement.style.top = "0"), + this._bindMouseMove()), + document.body.addEventListener("mousemove", this.moveHover), + document.body.addEventListener("mouseup", this.endMove), + this.dispatchExternal("rowMoving", e.getComponent()), + this.moveHover(t); + } + setStartPosition(t, e) { + var i, + o, + n = this.touchMove ? t.touches[0].pageX : t.pageX, + r = this.touchMove ? t.touches[0].pageY : t.pageY; + (i = e.getElement()), + this.connection + ? ((o = i.getBoundingClientRect()), + (this.startX = o.left - n + window.pageXOffset), + (this.startY = o.top - r + window.pageYOffset)) + : (this.startY = r - i.getBoundingClientRect().top); + } + endMove(t) { + (t && t.which !== 1 && !this.touchMove) || + (this._unbindMouseMove(), + this.connection || + (this.placeholderElement.parentNode.insertBefore( + this.moving.getElement(), + this.placeholderElement.nextSibling + ), + this.placeholderElement.parentNode.removeChild( + this.placeholderElement + )), + this.hoverElement.parentNode.removeChild(this.hoverElement), + this.table.element.classList.remove( + "tabulator-block-select" + ), + this.toRow + ? this.table.rowManager.moveRow( + this.moving, + this.toRow, + this.toRowAfter + ) + : this.dispatchExternal( + "rowMoveCancelled", + this.moving.getComponent() + ), + (this.moving = !1), + (this.toRow = !1), + (this.toRowAfter = !1), + document.body.removeEventListener( + "mousemove", + this.moveHover + ), + document.body.removeEventListener("mouseup", this.endMove), + this.connection && + (this.table.element.classList.remove( + "tabulator-movingrow-sending" + ), + this.disconnectFromTables())); + } + moveRow(t, e) { + (this.toRow = t), (this.toRowAfter = e); + } + moveHover(t) { + this.connection + ? this.moveHoverConnections.call(this, t) + : this.moveHoverTable.call(this, t); + } + moveHoverTable(t) { + var e = this.table.rowManager.getElement(), + i = e.scrollTop, + o = + (this.touchMove ? t.touches[0].pageY : t.pageY) - + e.getBoundingClientRect().top + + i; + this.hoverElement.style.top = + Math.min( + o - this.startY, + this.table.rowManager.element.scrollHeight - + this.hoverElement.offsetHeight + ) + "px"; + } + moveHoverConnections(t) { + (this.hoverElement.style.left = + this.startX + + (this.touchMove ? t.touches[0].pageX : t.pageX) + + "px"), + (this.hoverElement.style.top = + this.startY + + (this.touchMove ? t.touches[0].pageY : t.pageY) + + "px"); + } + elementRowDrop(t, e, i) { + this.dispatchExternal( + "movableRowsElementDrop", + t, + e, + !!i && i.getComponent() + ); + } + connectToTables(t) { + var e; + this.connectionSelectorsTables && + ((e = this.commsConnections( + this.connectionSelectorsTables + )), + this.dispatchExternal("movableRowsSendingStart", e), + this.commsSend( + this.connectionSelectorsTables, + "moveRow", + "connect", + { row: t } + )), + this.connectionSelectorsElements && + ((this.connectionElements = []), + Array.isArray(this.connectionSelectorsElements) || + (this.connectionSelectorsElements = [ + this.connectionSelectorsElements, + ]), + this.connectionSelectorsElements.forEach((i) => { + typeof i == "string" + ? (this.connectionElements = + this.connectionElements.concat( + Array.prototype.slice.call( + document.querySelectorAll(i) + ) + )) + : this.connectionElements.push(i); + }), + this.connectionElements.forEach((i) => { + var o = (n) => { + this.elementRowDrop(n, i, this.moving); + }; + i.addEventListener("mouseup", o), + (i.tabulatorElementDropEvent = o), + i.classList.add( + "tabulator-movingrow-receiving" + ); + })); + } + disconnectFromTables() { + var t; + this.connectionSelectorsTables && + ((t = this.commsConnections( + this.connectionSelectorsTables + )), + this.dispatchExternal("movableRowsSendingStop", t), + this.commsSend( + this.connectionSelectorsTables, + "moveRow", + "disconnect" + )), + this.connectionElements.forEach((e) => { + e.classList.remove("tabulator-movingrow-receiving"), + e.removeEventListener( + "mouseup", + e.tabulatorElementDropEvent + ), + delete e.tabulatorElementDropEvent; + }); + } + connect(t, e) { + return this.connectedTable + ? (console.warn( + "Move Row Error - Table cannot accept connection, already connected to table:", + this.connectedTable + ), + !1) + : ((this.connectedTable = t), + (this.connectedRow = e), + this.table.element.classList.add( + "tabulator-movingrow-receiving" + ), + this.table.rowManager.getDisplayRows().forEach((i) => { + i.type === "row" && + i.modules.moveRow && + i.modules.moveRow.mouseup && + i + .getElement() + .addEventListener( + "mouseup", + i.modules.moveRow.mouseup + ); + }), + (this.tableRowDropEvent = this.tableRowDrop.bind(this)), + this.table.element.addEventListener( + "mouseup", + this.tableRowDropEvent + ), + this.dispatchExternal("movableRowsReceivingStart", e, t), + !0); + } + disconnect(t) { + t === this.connectedTable + ? ((this.connectedTable = !1), + (this.connectedRow = !1), + this.table.element.classList.remove( + "tabulator-movingrow-receiving" + ), + this.table.rowManager.getDisplayRows().forEach((e) => { + e.type === "row" && + e.modules.moveRow && + e.modules.moveRow.mouseup && + e + .getElement() + .removeEventListener( + "mouseup", + e.modules.moveRow.mouseup + ); + }), + this.table.element.removeEventListener( + "mouseup", + this.tableRowDropEvent + ), + this.dispatchExternal("movableRowsReceivingStop", t)) + : console.warn( + "Move Row Error - trying to disconnect from non connected table" + ); + } + dropComplete(t, e, i) { + var o = !1; + if (i) { + switch (typeof this.table.options.movableRowsSender) { + case "string": + o = q.senders[this.table.options.movableRowsSender]; + break; + case "function": + o = this.table.options.movableRowsSender; + } + o + ? o.call( + this, + this.moving ? this.moving.getComponent() : void 0, + e ? e.getComponent() : void 0, + t + ) + : this.table.options.movableRowsSender && + console.warn( + "Mover Row Error - no matching sender found:", + this.table.options.movableRowsSender + ), + this.dispatchExternal( + "movableRowsSent", + this.moving.getComponent(), + e ? e.getComponent() : void 0, + t + ); + } else + this.dispatchExternal( + "movableRowsSentFailed", + this.moving.getComponent(), + e ? e.getComponent() : void 0, + t + ); + this.endMove(); + } + tableRowDrop(t, e) { + var i = !1, + o = !1; + switch ( + (t.stopImmediatePropagation(), + typeof this.table.options.movableRowsReceiver) + ) { + case "string": + i = q.receivers[this.table.options.movableRowsReceiver]; + break; + case "function": + i = this.table.options.movableRowsReceiver; + } + i + ? (o = i.call( + this, + this.connectedRow.getComponent(), + e ? e.getComponent() : void 0, + this.connectedTable + )) + : console.warn( + "Mover Row Error - no matching receiver found:", + this.table.options.movableRowsReceiver + ), + o + ? this.dispatchExternal( + "movableRowsReceived", + this.connectedRow.getComponent(), + e ? e.getComponent() : void 0, + this.connectedTable + ) + : this.dispatchExternal( + "movableRowsReceivedFailed", + this.connectedRow.getComponent(), + e ? e.getComponent() : void 0, + this.connectedTable + ), + this.commsSend( + this.connectedTable, + "moveRow", + "dropcomplete", + { row: e, success: o } + ); + } + commsReceived(t, e, i) { + switch (e) { + case "connect": + return this.connect(t, i.row); + case "disconnect": + return this.disconnect(t); + case "dropcomplete": + return this.dropComplete(t, i.row, i.success); + } + } + }; + b(q, "moduleName", "moveRow"), + b(q, "senders", ai), + b(q, "receivers", li); + let Pt = q; + var hi = {}; + let $ = class $ extends w { + constructor(t) { + super(t), + (this.allowedTypes = [ + "", + "data", + "edit", + "clipboard", + "import", + ]), + (this.enabled = !0), + this.registerColumnOption("mutator"), + this.registerColumnOption("mutatorParams"), + this.registerColumnOption("mutatorData"), + this.registerColumnOption("mutatorDataParams"), + this.registerColumnOption("mutatorEdit"), + this.registerColumnOption("mutatorEditParams"), + this.registerColumnOption("mutatorClipboard"), + this.registerColumnOption("mutatorClipboardParams"), + this.registerColumnOption("mutatorImport"), + this.registerColumnOption("mutatorImportParams"), + this.registerColumnOption("mutateLink"); + } + initialize() { + this.subscribe( + "cell-value-changing", + this.transformCell.bind(this) + ), + this.subscribe( + "cell-value-changed", + this.mutateLink.bind(this) + ), + this.subscribe( + "column-layout", + this.initializeColumn.bind(this) + ), + this.subscribe( + "row-data-init-before", + this.rowDataChanged.bind(this) + ), + this.subscribe( + "row-data-changing", + this.rowDataChanged.bind(this) + ); + } + rowDataChanged(t, e, i) { + return this.transformRow(e, "data", i); + } + initializeColumn(t) { + var e = !1, + i = {}; + this.allowedTypes.forEach((o) => { + var n, + r = + "mutator" + + (o.charAt(0).toUpperCase() + o.slice(1)); + t.definition[r] && + (n = this.lookupMutator(t.definition[r])) && + ((e = !0), + (i[r] = { + mutator: n, + params: t.definition[r + "Params"] || {}, + })); + }), + e && (t.modules.mutate = i); + } + lookupMutator(t) { + var e = !1; + switch (typeof t) { + case "string": + $.mutators[t] + ? (e = $.mutators[t]) + : console.warn( + "Mutator Error - No such mutator found, ignoring: ", + t + ); + break; + case "function": + e = t; + } + return e; + } + transformRow(t, e, i) { + var o, + n = "mutator" + (e.charAt(0).toUpperCase() + e.slice(1)); + return ( + this.enabled && + this.table.columnManager.traverse((r) => { + var a, l, h; + r.modules.mutate && + (a = + r.modules.mutate[n] || + r.modules.mutate.mutator || + !1) && + ((o = r.getFieldValue(i !== void 0 ? i : t)), + ((e == "data" && !i) || o !== void 0) && + ((h = r.getComponent()), + (l = + typeof a.params == "function" + ? a.params(o, t, e, h) + : a.params), + r.setFieldValue( + t, + a.mutator(o, t, e, l, h) + ))); + }), + t + ); + } + transformCell(t, e) { + if (t.column.modules.mutate) { + var i = + t.column.modules.mutate.mutatorEdit || + t.column.modules.mutate.mutator || + !1, + o = {}; + if (i) + return ( + (o = Object.assign(o, t.row.getData())), + t.column.setFieldValue(o, e), + i.mutator(e, o, "edit", i.params, t.getComponent()) + ); + } + return e; + } + mutateLink(t) { + var e = t.column.definition.mutateLink; + e && + (Array.isArray(e) || (e = [e]), + e.forEach((i) => { + var o = t.row.getCell(i); + o && o.setValue(o.getValue(), !0, !0); + })); + } + enable() { + this.enabled = !0; + } + disable() { + this.enabled = !1; + } + }; + b($, "moduleName", "mutator"), b($, "mutators", hi); + let Ft = $; + var di = { + rows: function (s, t, e, i, o) { + var n = document.createElement("span"), + r = document.createElement("span"), + a = document.createElement("span"), + l = document.createElement("span"), + h = document.createElement("span"), + d = document.createElement("span"); + return ( + this.table.modules.localize.langBind( + "pagination|counter|showing", + (c) => { + r.innerHTML = c; + } + ), + this.table.modules.localize.langBind( + "pagination|counter|of", + (c) => { + l.innerHTML = c; + } + ), + this.table.modules.localize.langBind( + "pagination|counter|rows", + (c) => { + d.innerHTML = c; + } + ), + i + ? ((a.innerHTML = + " " + t + "-" + Math.min(t + s - 1, i) + " "), + (h.innerHTML = " " + i + " "), + n.appendChild(r), + n.appendChild(a), + n.appendChild(l), + n.appendChild(h), + n.appendChild(d)) + : ((a.innerHTML = " 0 "), + n.appendChild(r), + n.appendChild(a), + n.appendChild(d)), + n + ); + }, + pages: function (s, t, e, i, o) { + var n = document.createElement("span"), + r = document.createElement("span"), + a = document.createElement("span"), + l = document.createElement("span"), + h = document.createElement("span"), + d = document.createElement("span"); + return ( + this.table.modules.localize.langBind( + "pagination|counter|showing", + (c) => { + r.innerHTML = c; + } + ), + (a.innerHTML = " " + e + " "), + this.table.modules.localize.langBind( + "pagination|counter|of", + (c) => { + l.innerHTML = c; + } + ), + (h.innerHTML = " " + o + " "), + this.table.modules.localize.langBind( + "pagination|counter|pages", + (c) => { + d.innerHTML = c; + } + ), + n.appendChild(r), + n.appendChild(a), + n.appendChild(l), + n.appendChild(h), + n.appendChild(d), + n + ); + }, + }; + let nt = class nt extends w { + constructor(t) { + super(t), + (this.mode = "local"), + (this.progressiveLoad = !1), + (this.element = null), + (this.pageCounterElement = null), + (this.pageCounter = null), + (this.size = 0), + (this.page = 1), + (this.count = 5), + (this.max = 1), + (this.remoteRowCountEstimate = null), + (this.initialLoad = !0), + (this.dataChanging = !1), + (this.pageSizes = []), + this.registerTableOption("pagination", !1), + this.registerTableOption("paginationMode", "local"), + this.registerTableOption("paginationSize", !1), + this.registerTableOption("paginationInitialPage", 1), + this.registerTableOption("paginationCounter", !1), + this.registerTableOption("paginationCounterElement", !1), + this.registerTableOption("paginationButtonCount", 5), + this.registerTableOption("paginationSizeSelector", !1), + this.registerTableOption("paginationElement", !1), + this.registerTableOption("paginationAddRow", "page"), + this.registerTableOption("paginationOutOfRange", !1), + this.registerTableOption("progressiveLoad", !1), + this.registerTableOption("progressiveLoadDelay", 0), + this.registerTableOption("progressiveLoadScrollMargin", 0), + this.registerTableFunction( + "setMaxPage", + this.setMaxPage.bind(this) + ), + this.registerTableFunction( + "setPage", + this.setPage.bind(this) + ), + this.registerTableFunction( + "setPageToRow", + this.userSetPageToRow.bind(this) + ), + this.registerTableFunction( + "setPageSize", + this.userSetPageSize.bind(this) + ), + this.registerTableFunction( + "getPageSize", + this.getPageSize.bind(this) + ), + this.registerTableFunction( + "previousPage", + this.previousPage.bind(this) + ), + this.registerTableFunction( + "nextPage", + this.nextPage.bind(this) + ), + this.registerTableFunction( + "getPage", + this.getPage.bind(this) + ), + this.registerTableFunction( + "getPageMax", + this.getPageMax.bind(this) + ), + this.registerComponentFunction( + "row", + "pageTo", + this.setPageToRow.bind(this) + ); + } + initialize() { + this.table.options.pagination + ? (this.subscribe( + "row-deleted", + this.rowsUpdated.bind(this) + ), + this.subscribe("row-added", this.rowsUpdated.bind(this)), + this.subscribe( + "data-processed", + this.initialLoadComplete.bind(this) + ), + this.subscribe( + "table-built", + this.calculatePageSizes.bind(this) + ), + this.subscribe( + "footer-redraw", + this.footerRedraw.bind(this) + ), + this.table.options.paginationAddRow == "page" && + this.subscribe( + "row-adding-position", + this.rowAddingPosition.bind(this) + ), + this.table.options.paginationMode === "remote" && + (this.subscribe( + "data-params", + this.remotePageParams.bind(this) + ), + this.subscribe( + "data-loaded", + this._parseRemoteData.bind(this) + )), + this.table.options.progressiveLoad && + console.error( + "Progressive Load Error - Pagination and progressive load cannot be used at the same time" + ), + this.registerDisplayHandler( + this.restOnRenderBefore.bind(this), + 40 + ), + this.registerDisplayHandler(this.getRows.bind(this), 50), + this.createElements(), + this.initializePageCounter(), + this.initializePaginator()) + : this.table.options.progressiveLoad && + (this.subscribe( + "data-params", + this.remotePageParams.bind(this) + ), + this.subscribe( + "data-loaded", + this._parseRemoteData.bind(this) + ), + this.subscribe( + "table-built", + this.calculatePageSizes.bind(this) + ), + this.subscribe( + "data-processed", + this.initialLoadComplete.bind(this) + ), + this.initializeProgressive( + this.table.options.progressiveLoad + ), + this.table.options.progressiveLoad === "scroll" && + this.subscribe( + "scroll-vertical", + this.scrollVertical.bind(this) + )); + } + rowAddingPosition(t, e) { + var i, + o = this.table.rowManager, + n = o.getDisplayRows(); + return ( + e + ? n.length + ? (i = n[0]) + : o.activeRows.length && + ((i = o.activeRows[o.activeRows.length - 1]), + (e = !1)) + : n.length && + ((i = n[n.length - 1]), + (e = !(n.length < this.size))), + { index: i, top: e } + ); + } + calculatePageSizes() { + var t, e; + this.table.options.paginationSize + ? (this.size = this.table.options.paginationSize) + : ((t = document.createElement("div")).classList.add( + "tabulator-row" + ), + (t.style.visibility = "hidden"), + (e = document.createElement("div")).classList.add( + "tabulator-cell" + ), + (e.innerHTML = "Page Row Test"), + t.appendChild(e), + this.table.rowManager.getTableElement().appendChild(t), + (this.size = Math.floor( + this.table.rowManager.getElement().clientHeight / + t.offsetHeight + )), + this.table.rowManager.getTableElement().removeChild(t)), + this.dispatchExternal("pageSizeChanged", this.size), + this.generatePageSizeSelectList(); + } + initialLoadComplete() { + this.initialLoad = !1; + } + remotePageParams(t, e, i, o) { + return ( + this.initialLoad || + (((this.progressiveLoad && !i) || + (!this.progressiveLoad && !this.dataChanging)) && + this.reset(!0)), + (o.page = this.page), + this.size && (o.size = this.size), + o + ); + } + userSetPageToRow(t) { + return this.table.options.pagination && + (t = this.table.rowManager.findRow(t)) + ? this.setPageToRow(t) + : Promise.reject(); + } + userSetPageSize(t) { + return ( + !!this.table.options.pagination && + (this.setPageSize(t), this.setPage(1)) + ); + } + scrollVertical(t, e) { + var i; + e || + this.table.dataLoader.loading || + ((i = this.table.rowManager.getElement()).scrollHeight - + i.clientHeight - + t < + (this.table.options.progressiveLoadScrollMargin || + 2 * i.clientHeight) && + this.nextPage().catch(() => {})); + } + restOnRenderBefore(t, e) { + return e || (this.mode === "local" && this.reset()), t; + } + rowsUpdated() { + this.refreshData(!0, "all"); + } + createElements() { + var t; + (this.element = document.createElement("span")), + this.element.classList.add("tabulator-paginator"), + (this.pagesElement = document.createElement("span")), + this.pagesElement.classList.add("tabulator-pages"), + (t = document.createElement("button")).classList.add( + "tabulator-page" + ), + t.setAttribute("type", "button"), + t.setAttribute("role", "button"), + t.setAttribute("aria-label", ""), + t.setAttribute("title", ""), + (this.firstBut = t.cloneNode(!0)), + this.firstBut.setAttribute("data-page", "first"), + (this.prevBut = t.cloneNode(!0)), + this.prevBut.setAttribute("data-page", "prev"), + (this.nextBut = t.cloneNode(!0)), + this.nextBut.setAttribute("data-page", "next"), + (this.lastBut = t.cloneNode(!0)), + this.lastBut.setAttribute("data-page", "last"), + this.table.options.paginationSizeSelector && + ((this.pageSizeSelect = + document.createElement("select")), + this.pageSizeSelect.classList.add( + "tabulator-page-size" + )); + } + generatePageSizeSelectList() { + var t = []; + if (this.pageSizeSelect) { + if ( + Array.isArray(this.table.options.paginationSizeSelector) + ) + (t = this.table.options.paginationSizeSelector), + (this.pageSizes = t), + this.pageSizes.indexOf(this.size) == -1 && + t.unshift(this.size); + else if (this.pageSizes.indexOf(this.size) == -1) { + t = []; + for (let e = 1; e < 5; e++) t.push(this.size * e); + this.pageSizes = t; + } else t = this.pageSizes; + for (; this.pageSizeSelect.firstChild; ) + this.pageSizeSelect.removeChild( + this.pageSizeSelect.firstChild + ); + t.forEach((e) => { + var i = document.createElement("option"); + (i.value = e), + e === !0 + ? this.langBind("pagination|all", function (o) { + i.innerHTML = o; + }) + : (i.innerHTML = e), + this.pageSizeSelect.appendChild(i); + }), + (this.pageSizeSelect.value = this.size); + } + } + initializePageCounter() { + var t = this.table.options.paginationCounter, + e = null; + t && + ((e = typeof t == "function" ? t : nt.pageCounters[t]) + ? ((this.pageCounter = e), + (this.pageCounterElement = + document.createElement("span")), + this.pageCounterElement.classList.add( + "tabulator-page-counter" + )) + : console.warn( + "Pagination Error - No such page counter found: ", + t + )); + } + initializePaginator(t) { + var e, i; + t || + (this.langBind("pagination|first", (o) => { + this.firstBut.innerHTML = o; + }), + this.langBind("pagination|first_title", (o) => { + this.firstBut.setAttribute("aria-label", o), + this.firstBut.setAttribute("title", o); + }), + this.langBind("pagination|prev", (o) => { + this.prevBut.innerHTML = o; + }), + this.langBind("pagination|prev_title", (o) => { + this.prevBut.setAttribute("aria-label", o), + this.prevBut.setAttribute("title", o); + }), + this.langBind("pagination|next", (o) => { + this.nextBut.innerHTML = o; + }), + this.langBind("pagination|next_title", (o) => { + this.nextBut.setAttribute("aria-label", o), + this.nextBut.setAttribute("title", o); + }), + this.langBind("pagination|last", (o) => { + this.lastBut.innerHTML = o; + }), + this.langBind("pagination|last_title", (o) => { + this.lastBut.setAttribute("aria-label", o), + this.lastBut.setAttribute("title", o); + }), + this.firstBut.addEventListener("click", () => { + this.setPage(1); + }), + this.prevBut.addEventListener("click", () => { + this.previousPage(); + }), + this.nextBut.addEventListener("click", () => { + this.nextPage(); + }), + this.lastBut.addEventListener("click", () => { + this.setPage(this.max); + }), + this.table.options.paginationElement && + (this.element = this.table.options.paginationElement), + this.pageSizeSelect && + ((e = document.createElement("label")), + this.langBind("pagination|page_size", (o) => { + this.pageSizeSelect.setAttribute("aria-label", o), + this.pageSizeSelect.setAttribute("title", o), + (e.innerHTML = o); + }), + this.element.appendChild(e), + this.element.appendChild(this.pageSizeSelect), + this.pageSizeSelect.addEventListener("change", (o) => { + this.setPageSize( + this.pageSizeSelect.value == "true" || + this.pageSizeSelect.value + ), + this.setPage(1); + })), + this.element.appendChild(this.firstBut), + this.element.appendChild(this.prevBut), + this.element.appendChild(this.pagesElement), + this.element.appendChild(this.nextBut), + this.element.appendChild(this.lastBut), + this.table.options.paginationElement || + (this.table.options.paginationCounter && + (this.table.options.paginationCounterElement + ? this.table.options + .paginationCounterElement instanceof + HTMLElement + ? this.table.options.paginationCounterElement.appendChild( + this.pageCounterElement + ) + : typeof this.table.options + .paginationCounterElement == + "string" && + ((i = document.querySelector( + this.table.options + .paginationCounterElement + )) + ? i.appendChild( + this.pageCounterElement + ) + : console.warn( + "Pagination Error - Unable to find element matching paginationCounterElement selector:", + this.table.options + .paginationCounterElement + )) + : this.footerAppend(this.pageCounterElement)), + this.footerAppend(this.element)), + (this.page = this.table.options.paginationInitialPage), + (this.count = this.table.options.paginationButtonCount)), + (this.mode = this.table.options.paginationMode); + } + initializeProgressive(t) { + this.initializePaginator(!0), + (this.mode = "progressive_" + t), + (this.progressiveLoad = !0); + } + trackChanges() { + this.dispatch("page-changed"); + } + setMaxRows(t) { + (this.max = t + ? this.size === !0 + ? 1 + : Math.ceil(t / this.size) + : 1), + this.page > this.max && (this.page = this.max); + } + reset(t) { + this.initialLoad || + ((this.mode == "local" || t) && + ((this.page = 1), this.trackChanges())); + } + setMaxPage(t) { + (t = parseInt(t)), + (this.max = t || 1), + this.page > this.max && + ((this.page = this.max), this.trigger()); + } + setPage(t) { + switch (t) { + case "first": + return this.setPage(1); + case "prev": + return this.previousPage(); + case "next": + return this.nextPage(); + case "last": + return this.setPage(this.max); + } + return ((t = parseInt(t)) > 0 && t <= this.max) || + this.mode !== "local" + ? ((this.page = t), this.trackChanges(), this.trigger()) + : (console.warn( + "Pagination Error - Requested page is out of range of 1 - " + + this.max + + ":", + t + ), + Promise.reject()); + } + setPageToRow(t) { + var e = this.displayRows(-1).indexOf(t); + if (e > -1) { + var i = + this.size === !0 ? 1 : Math.ceil((e + 1) / this.size); + return this.setPage(i); + } + return ( + console.warn( + "Pagination Error - Requested row is not visible" + ), + Promise.reject() + ); + } + setPageSize(t) { + t !== !0 && (t = parseInt(t)), + t > 0 && + ((this.size = t), + this.dispatchExternal("pageSizeChanged", t)), + this.pageSizeSelect && this.generatePageSizeSelectList(), + this.trackChanges(); + } + _setPageCounter(t, e, i) { + var o; + if (this.pageCounter) + switch ( + (this.mode === "remote" && + ((e = this.size), + (i = (this.page - 1) * this.size + 1), + (t = this.remoteRowCountEstimate)), + typeof (o = this.pageCounter.call( + this, + e, + i, + this.page, + t, + this.max + ))) + ) { + case "object": + if (o instanceof Node) { + for (; this.pageCounterElement.firstChild; ) + this.pageCounterElement.removeChild( + this.pageCounterElement.firstChild + ); + this.pageCounterElement.appendChild(o); + } else + (this.pageCounterElement.innerHTML = ""), + o != null && + console.warn( + "Page Counter Error - Page Counter has returned a type of object, the only valid page counter object return is an instance of Node, the page counter returned:", + o + ); + break; + case "undefined": + this.pageCounterElement.innerHTML = ""; + break; + default: + this.pageCounterElement.innerHTML = o; + } + } + _setPageButtons() { + let t = Math.floor((this.count - 1) / 2), + e = Math.ceil((this.count - 1) / 2), + i = + this.max - this.page + t + 1 < this.count + ? this.max - this.count + 1 + : Math.max(this.page - t, 1), + o = + this.page <= e + ? Math.min(this.count, this.max) + : Math.min(this.page + e, this.max); + for (; this.pagesElement.firstChild; ) + this.pagesElement.removeChild(this.pagesElement.firstChild); + this.page == 1 + ? ((this.firstBut.disabled = !0), + (this.prevBut.disabled = !0)) + : ((this.firstBut.disabled = !1), + (this.prevBut.disabled = !1)), + this.page == this.max + ? ((this.lastBut.disabled = !0), + (this.nextBut.disabled = !0)) + : ((this.lastBut.disabled = !1), + (this.nextBut.disabled = !1)); + for (let n = i; n <= o; n++) + n > 0 && + n <= this.max && + this.pagesElement.appendChild( + this._generatePageButton(n) + ); + this.footerRedraw(); + } + _generatePageButton(t) { + var e = document.createElement("button"); + return ( + e.classList.add("tabulator-page"), + t == this.page && e.classList.add("active"), + e.setAttribute("type", "button"), + e.setAttribute("role", "button"), + this.langBind("pagination|page_title", (i) => { + e.setAttribute("aria-label", i + " " + t), + e.setAttribute("title", i + " " + t); + }), + e.setAttribute("data-page", t), + (e.textContent = t), + e.addEventListener("click", (i) => { + this.setPage(t); + }), + e + ); + } + previousPage() { + return this.page > 1 + ? (this.page--, this.trackChanges(), this.trigger()) + : (console.warn( + "Pagination Error - Previous page would be less than page 1:", + 0 + ), + Promise.reject()); + } + nextPage() { + return this.page < this.max + ? (this.page++, this.trackChanges(), this.trigger()) + : (this.progressiveLoad || + console.warn( + "Pagination Error - Next page would be greater than maximum page of " + + this.max + + ":", + this.max + 1 + ), + Promise.reject()); + } + getPage() { + return this.page; + } + getPageMax() { + return this.max; + } + getPageSize(t) { + return this.size; + } + getMode() { + return this.mode; + } + getRows(t) { + var e, + i, + o, + n, + r = 0, + a = t.filter((l) => l.type === "row"); + if (this.mode == "local") { + (e = []), + this.setMaxRows(t.length), + this.size === !0 + ? ((i = 0), (o = t.length)) + : (o = + (i = this.size * (this.page - 1)) + + parseInt(this.size)), + this._setPageButtons(); + for (let l = i; l < o; l++) { + let h = t[l]; + h && + (e.push(h), + h.type === "row" && (n || (n = h), r++)); + } + return ( + this._setPageCounter( + a.length, + r, + n ? a.indexOf(n) + 1 : 0 + ), + e + ); + } + return ( + this._setPageButtons(), + this._setPageCounter(a.length), + t.slice(0) + ); + } + trigger() { + var t; + switch (this.mode) { + case "local": + return ( + (t = this.table.rowManager.scrollLeft), + this.refreshData(), + this.table.rowManager.scrollHorizontal(t), + this.dispatchExternal("pageLoaded", this.getPage()), + Promise.resolve() + ); + case "remote": + return ( + (this.dataChanging = !0), + this.reloadData(null).finally(() => { + this.dataChanging = !1; + }) + ); + case "progressive_load": + case "progressive_scroll": + return this.reloadData(null, !0); + default: + return ( + console.warn( + "Pagination Error - no such pagination mode:", + this.mode + ), + Promise.reject() + ); + } + } + _parseRemoteData(t) { + var e, i; + if ( + (t.last_page === void 0 && + console.warn( + "Remote Pagination Error - Server response missing '" + + (this.options("dataReceiveParams").last_page || + "last_page") + + "' property" + ), + t.data) + ) { + if ( + ((this.max = parseInt(t.last_page) || 1), + (this.remoteRowCountEstimate = + t.last_row !== void 0 + ? t.last_row + : t.last_page * this.size - + (this.page == t.last_page + ? this.size - t.data.length + : 0)), + this.progressiveLoad) + ) { + switch (this.mode) { + case "progressive_load": + this.page == 1 + ? this.table.rowManager.setData( + t.data, + !1, + this.page == 1 + ) + : this.table.rowManager.addRows(t.data), + this.page < this.max && + setTimeout(() => { + this.nextPage(); + }, this.table.options.progressiveLoadDelay); + break; + case "progressive_scroll": + (t = + this.page === 1 + ? t.data + : this.table.rowManager + .getData() + .concat(t.data)), + this.table.rowManager.setData( + t, + this.page !== 1, + this.page == 1 + ), + (e = + this.table.options + .progressiveLoadScrollMargin || + 2 * + this.table.rowManager.element + .clientHeight), + this.table.rowManager.element + .scrollHeight <= + this.table.rowManager.element + .clientHeight + + e && + this.page < this.max && + setTimeout(() => { + this.nextPage(); + }); + } + return !1; + } + if ( + this.page > this.max && + (console.warn( + "Remote Pagination Error - Server returned last page value lower than the current page" + ), + (i = this.options("paginationOutOfRange"))) + ) + return this.setPage( + typeof i == "function" + ? i.call(this, this.page, this.max) + : i + ); + this.dispatchExternal("pageLoaded", this.getPage()); + } else + console.warn( + "Remote Pagination Error - Server response missing '" + + (this.options("dataReceiveParams").data || "data") + + "' property" + ); + return t.data; + } + footerRedraw() { + var t = this.table.footerManager.containerElement; + Math.ceil(t.clientWidth) - t.scrollWidth < 0 + ? (this.pagesElement.style.display = "none") + : ((this.pagesElement.style.display = ""), + Math.ceil(t.clientWidth) - t.scrollWidth < 0 && + (this.pagesElement.style.display = "none")); + } + }; + b(nt, "moduleName", "page"), b(nt, "pageCounters", di); + let Ht = nt; + var ci = { + local: function (s, t) { + var e = localStorage.getItem(s + "-" + t); + return !!e && JSON.parse(e); + }, + cookie: function (s, t) { + var e, + i, + o = document.cookie, + n = s + "-" + t, + r = o.indexOf(n + "="); + return ( + r > -1 && + ((e = (o = o.slice(r)).indexOf(";")) > -1 && + (o = o.slice(0, e)), + (i = o.replace(n + "=", ""))), + !!i && JSON.parse(i) + ); + }, + }, + ui = { + local: function (s, t, e) { + localStorage.setItem(s + "-" + t, JSON.stringify(e)); + }, + cookie: function (s, t, e) { + var i = new Date(); + i.setDate(i.getDate() + 1e4), + (document.cookie = + s + + "-" + + t + + "=" + + JSON.stringify(e) + + "; expires=" + + i.toUTCString()); + }, + }; + let S = class S extends w { + constructor(t) { + super(t), + (this.mode = ""), + (this.id = ""), + (this.defWatcherBlock = !1), + (this.config = {}), + (this.readFunc = !1), + (this.writeFunc = !1), + this.registerTableOption("persistence", !1), + this.registerTableOption("persistenceID", ""), + this.registerTableOption("persistenceMode", !0), + this.registerTableOption("persistenceReaderFunc", !1), + this.registerTableOption("persistenceWriterFunc", !1); + } + localStorageTest() { + var t = "_tabulator_test"; + try { + return ( + window.localStorage.setItem(t, t), + window.localStorage.removeItem(t), + !0 + ); + } catch { + return !1; + } + } + initialize() { + if (this.table.options.persistence) { + var t, + e = this.table.options.persistenceMode, + i = this.table.options.persistenceID; + (this.mode = + e !== !0 + ? e + : this.localStorageTest() + ? "local" + : "cookie"), + this.table.options.persistenceReaderFunc + ? typeof this.table.options.persistenceReaderFunc == + "function" + ? (this.readFunc = + this.table.options.persistenceReaderFunc) + : S.readers[ + this.table.options.persistenceReaderFunc + ] + ? (this.readFunc = + S.readers[ + this.table.options.persistenceReaderFunc + ]) + : console.warn( + "Persistence Read Error - invalid reader set", + this.table.options.persistenceReaderFunc + ) + : S.readers[this.mode] + ? (this.readFunc = S.readers[this.mode]) + : console.warn( + "Persistence Read Error - invalid reader set", + this.mode + ), + this.table.options.persistenceWriterFunc + ? typeof this.table.options.persistenceWriterFunc == + "function" + ? (this.writeFunc = + this.table.options.persistenceWriterFunc) + : S.writers[ + this.table.options.persistenceWriterFunc + ] + ? (this.writeFunc = + S.writers[ + this.table.options.persistenceWriterFunc + ]) + : console.warn( + "Persistence Write Error - invalid reader set", + this.table.options.persistenceWriterFunc + ) + : S.writers[this.mode] + ? (this.writeFunc = S.writers[this.mode]) + : console.warn( + "Persistence Write Error - invalid writer set", + this.mode + ), + (this.id = + "tabulator-" + + (i || this.table.element.getAttribute("id") || "")), + (this.config = { + sort: + this.table.options.persistence === !0 || + this.table.options.persistence.sort, + filter: + this.table.options.persistence === !0 || + this.table.options.persistence.filter, + headerFilter: + this.table.options.persistence === !0 || + this.table.options.persistence.headerFilter, + group: + this.table.options.persistence === !0 || + this.table.options.persistence.group, + page: + this.table.options.persistence === !0 || + this.table.options.persistence.page, + columns: + this.table.options.persistence === !0 + ? ["title", "width", "visible"] + : this.table.options.persistence.columns, + }), + this.config.page && + (t = this.retrieveData("page")) && + (t.paginationSize === void 0 || + (this.config.page !== !0 && + !this.config.page.size) || + (this.table.options.paginationSize = + t.paginationSize), + t.paginationInitialPage === void 0 || + (this.config.page !== !0 && + !this.config.page.page) || + (this.table.options.paginationInitialPage = + t.paginationInitialPage)), + this.config.group && + (t = this.retrieveData("group")) && + (t.groupBy === void 0 || + (this.config.group !== !0 && + !this.config.group.groupBy) || + (this.table.options.groupBy = t.groupBy), + t.groupStartOpen === void 0 || + (this.config.group !== !0 && + !this.config.group.groupStartOpen) || + (this.table.options.groupStartOpen = + t.groupStartOpen), + t.groupHeader === void 0 || + (this.config.group !== !0 && + !this.config.group.groupHeader) || + (this.table.options.groupHeader = + t.groupHeader)), + this.config.columns && + ((this.table.options.columns = this.load( + "columns", + this.table.options.columns + )), + this.subscribe( + "column-init", + this.initializeColumn.bind(this) + ), + this.subscribe( + "column-show", + this.save.bind(this, "columns") + ), + this.subscribe( + "column-hide", + this.save.bind(this, "columns") + ), + this.subscribe( + "column-moved", + this.save.bind(this, "columns") + )), + this.subscribe( + "table-built", + this.tableBuilt.bind(this), + 0 + ), + this.subscribe( + "table-redraw", + this.tableRedraw.bind(this) + ), + this.subscribe( + "filter-changed", + this.eventSave.bind(this, "filter") + ), + this.subscribe( + "filter-changed", + this.eventSave.bind(this, "headerFilter") + ), + this.subscribe( + "sort-changed", + this.eventSave.bind(this, "sort") + ), + this.subscribe( + "group-changed", + this.eventSave.bind(this, "group") + ), + this.subscribe( + "page-changed", + this.eventSave.bind(this, "page") + ), + this.subscribe( + "column-resized", + this.eventSave.bind(this, "columns") + ), + this.subscribe( + "column-width", + this.eventSave.bind(this, "columns") + ), + this.subscribe( + "layout-refreshed", + this.eventSave.bind(this, "columns") + ); + } + this.registerTableFunction( + "getColumnLayout", + this.getColumnLayout.bind(this) + ), + this.registerTableFunction( + "setColumnLayout", + this.setColumnLayout.bind(this) + ); + } + eventSave(t) { + this.config[t] && this.save(t); + } + tableBuilt() { + var t, e, i; + this.config.sort && + (t = this.load("sort")) && + (this.table.options.initialSort = t), + this.config.filter && + (e = this.load("filter")) && + (this.table.options.initialFilter = e), + this.config.headerFilter && + (i = this.load("headerFilter")) && + (this.table.options.initialHeaderFilter = i); + } + tableRedraw(t) { + t && this.config.columns && this.save("columns"); + } + getColumnLayout() { + return this.parseColumns(this.table.columnManager.getColumns()); + } + setColumnLayout(t) { + return ( + this.table.columnManager.setColumns( + this.mergeDefinition(this.table.options.columns, t, !0) + ), + !0 + ); + } + initializeColumn(t) { + var e; + this.config.columns && + ((this.defWatcherBlock = !0), + (e = t.getDefinition()), + (this.config.columns === !0 + ? Object.keys(e) + : this.config.columns + ).forEach((i) => { + var o = Object.getOwnPropertyDescriptor(e, i), + n = e[i]; + o && + Object.defineProperty(e, i, { + set: (r) => { + (n = r), + this.defWatcherBlock || + this.save("columns"), + o.set && o.set(r); + }, + get: () => (o.get && o.get(), n), + }); + }), + (this.defWatcherBlock = !1)); + } + load(t, e) { + var i = this.retrieveData(t); + return e && (i = i ? this.mergeDefinition(e, i) : e), i; + } + retrieveData(t) { + return !!this.readFunc && this.readFunc(this.id, t); + } + mergeDefinition(t, e, i) { + var o = []; + return ( + (e = e || []).forEach((n, r) => { + var a, + l = this._findColumn(t, n); + l && + (i + ? (a = Object.keys(n)) + : this.config.columns === !0 || + this.config.columns == null + ? (a = Object.keys(l)).push("width") + : (a = this.config.columns), + a.forEach((h) => { + h !== "columns" && + n[h] !== void 0 && + (l[h] = n[h]); + }), + l.columns && + (l.columns = this.mergeDefinition( + l.columns, + n.columns + )), + o.push(l)); + }), + t.forEach((n, r) => { + this._findColumn(e, n) || + (o.length > r ? o.splice(r, 0, n) : o.push(n)); + }), + o + ); + } + _findColumn(t, e) { + var i = e.columns ? "group" : e.field ? "field" : "object"; + return t.find(function (o) { + switch (i) { + case "group": + return ( + o.title === e.title && + o.columns.length === e.columns.length + ); + case "field": + return o.field === e.field; + case "object": + return o === e; + } + }); + } + save(t) { + var e = {}; + switch (t) { + case "columns": + e = this.parseColumns( + this.table.columnManager.getColumns() + ); + break; + case "filter": + e = this.table.modules.filter.getFilters(); + break; + case "headerFilter": + e = this.table.modules.filter.getHeaderFilters(); + break; + case "sort": + e = this.validateSorters( + this.table.modules.sort.getSort() + ); + break; + case "group": + e = this.getGroupConfig(); + break; + case "page": + e = this.getPageConfig(); + } + this.writeFunc && this.writeFunc(this.id, t, e); + } + validateSorters(t) { + return ( + t.forEach(function (e) { + (e.column = e.field), delete e.field; + }), + t + ); + } + getGroupConfig() { + var t = {}; + return ( + this.config.group && + ((this.config.group === !0 || + this.config.group.groupBy) && + (t.groupBy = this.table.options.groupBy), + (this.config.group === !0 || + this.config.group.groupStartOpen) && + (t.groupStartOpen = + this.table.options.groupStartOpen), + (this.config.group === !0 || + this.config.group.groupHeader) && + (t.groupHeader = this.table.options.groupHeader)), + t + ); + } + getPageConfig() { + var t = {}; + return ( + this.config.page && + ((this.config.page === !0 || this.config.page.size) && + (t.paginationSize = + this.table.modules.page.getPageSize()), + (this.config.page === !0 || this.config.page.page) && + (t.paginationInitialPage = + this.table.modules.page.getPage())), + t + ); + } + parseColumns(t) { + var e = [], + i = [ + "headerContextMenu", + "headerMenu", + "contextMenu", + "clickMenu", + ]; + return ( + t.forEach((o) => { + var n, + r = {}, + a = o.getDefinition(); + o.isGroup + ? ((r.title = a.title), + (r.columns = this.parseColumns(o.getColumns()))) + : ((r.field = o.getField()), + this.config.columns === !0 || + this.config.columns == null + ? ((n = Object.keys(a)).push("width"), + n.push("visible")) + : (n = this.config.columns), + n.forEach((l) => { + switch (l) { + case "width": + r.width = o.getWidth(); + break; + case "visible": + r.visible = o.visible; + break; + default: + typeof a[l] != "function" && + i.indexOf(l) === -1 && + (r[l] = a[l]); + } + })), + e.push(r); + }), + e + ); + } + }; + b(S, "moduleName", "persistence"), + b(S, "moduleInitOrder", -10), + b(S, "readers", ci), + b(S, "writers", ui); + let Ot = S; + var mi = { + format: { + formatters: { + responsiveCollapse: function (s, t, e) { + var i = document.createElement("div"), + o = s.getRow()._row.modules.responsiveLayout; + function n(r) { + var a = o.element; + (o.open = r), + a && + (o.open + ? (i.classList.add("open"), + (a.style.display = "")) + : (i.classList.remove("open"), + (a.style.display = "none"))); + } + return ( + i.classList.add( + "tabulator-responsive-collapse-toggle" + ), + (i.innerHTML = ` + + + + + + +`), + s + .getElement() + .classList.add("tabulator-row-handle"), + i.addEventListener("click", function (r) { + r.stopImmediatePropagation(), + n(!o.open), + s + .getTable() + .rowManager.adjustTableSize(); + }), + n(o.open), + i + ); + }, + }, + }, + }, + pi = { + format: { + formatters: { + rowSelection: function (s, t, e) { + var i = document.createElement("input"), + o = !1; + if ( + ((i.type = "checkbox"), + i.setAttribute("aria-label", "Select Row"), + this.table.modExists("selectRow", !0)) + ) + if ( + (i.addEventListener("click", (r) => { + r.stopPropagation(); + }), + typeof s.getRow == "function") + ) { + var n = s.getRow(); + n instanceof ht + ? (i.addEventListener("change", (r) => { + this.table.options + .selectableRowsRangeMode === + "click" && o + ? (o = !1) + : n.toggleSelect(); + }), + this.table.options + .selectableRowsRangeMode === + "click" && + i.addEventListener( + "click", + (r) => { + (o = !0), + this.table.modules.selectRow.handleComplexRowClick( + n._row, + r + ); + } + ), + (i.checked = + n.isSelected && n.isSelected()), + this.table.modules.selectRow.registerRowSelectCheckbox( + n, + i + )) + : (i = ""); + } else + i.addEventListener("change", (r) => { + this.table.modules.selectRow + .selectedRows.length + ? this.table.deselectRow() + : this.table.selectRow(t.rowRange); + }), + this.table.modules.selectRow.registerHeaderSelectCheckbox( + i + ); + return i; + }, + }, + }, + }; + class gi { + constructor(t) { + return ( + (this._range = t), + new Proxy(this, { + get: function (e, i, o) { + return e[i] !== void 0 + ? e[i] + : e._range.table.componentFunctionBinder.handle( + "range", + e._range, + i + ); + }, + }) + ); + } + getElement() { + return this._range.element; + } + getData() { + return this._range.getData(); + } + getCells() { + return this._range.getCells(!0, !0); + } + getStructuredCells() { + return this._range.getStructuredCells(); + } + getRows() { + return this._range.getRows().map((t) => t.getComponent()); + } + getColumns() { + return this._range.getColumns().map((t) => t.getComponent()); + } + getBounds() { + return this._range.getBounds(); + } + getTopEdge() { + return this._range.top; + } + getBottomEdge() { + return this._range.bottom; + } + getLeftEdge() { + return this._range.left; + } + getRightEdge() { + return this._range.right; + } + setBounds(t, e) { + this._range.destroyedGuard("setBounds") && + this._range.setBounds(t && t._cell, e && e._cell); + } + setStartBound(t) { + this._range.destroyedGuard("setStartBound") && + (this._range.setEndBound(t && t._cell), + this._range.rangeManager.layoutElement()); + } + setEndBound(t) { + this._range.destroyedGuard("setEndBound") && + (this._range.setEndBound(t && t._cell), + this._range.rangeManager.layoutElement()); + } + clearValues() { + this._range.destroyedGuard("clearValues") && + this._range.clearValues(); + } + remove() { + this._range.destroyedGuard("remove") && this._range.destroy(!0); + } + } + class bi extends C { + constructor(t, e, i, o) { + super(t), + (this.rangeManager = e), + (this.element = null), + (this.initialized = !1), + (this.initializing = { start: !1, end: !1 }), + (this.destroyed = !1), + (this.top = 0), + (this.bottom = 0), + (this.left = 0), + (this.right = 0), + (this.table = t), + (this.start = { row: 0, col: 0 }), + (this.end = { row: 0, col: 0 }), + this.rangeManager.rowHeader && + ((this.left = 1), + (this.right = 1), + (this.start.col = 1), + (this.end.col = 1)), + this.initElement(), + setTimeout(() => { + this.initBounds(i, o); + }); + } + initElement() { + (this.element = document.createElement("div")), + this.element.classList.add("tabulator-range"); + } + initBounds(t, e) { + this._updateMinMax(), t && this.setBounds(t, e || t); + } + setStart(t, e) { + (this.start.row === t && this.start.col === e) || + ((this.start.row = t), + (this.start.col = e), + (this.initializing.start = !0), + this._updateMinMax()); + } + setEnd(t, e) { + (this.end.row === t && this.end.col === e) || + ((this.end.row = t), + (this.end.col = e), + (this.initializing.end = !0), + this._updateMinMax()); + } + setBounds(t, e, i) { + t && this.setStartBound(t), + this.setEndBound(e || t), + this.rangeManager.layoutElement(i); + } + setStartBound(t) { + var e, i; + t.type === "column" + ? this.rangeManager.columnSelection && + this.setStart(0, t.getPosition() - 1) + : ((e = t.row.position - 1), + (i = t.column.getPosition() - 1), + t.column === this.rangeManager.rowHeader + ? this.setStart(e, 1) + : this.setStart(e, i)); + } + setEndBound(t) { + var e, + i, + o, + n = this._getTableRows().length; + t.type === "column" + ? this.rangeManager.columnSelection && + (this.rangeManager.selecting === "column" + ? this.setEnd(n - 1, t.getPosition() - 1) + : this.rangeManager.selecting === "cell" && + this.setEnd(0, t.getPosition() - 1)) + : ((e = t.row.position - 1), + (i = t.column.getPosition() - 1), + (o = t.column === this.rangeManager.rowHeader), + this.rangeManager.selecting === "row" + ? this.setEnd(e, this._getTableColumns().length - 1) + : this.rangeManager.selecting !== "row" && o + ? this.setEnd(e, 0) + : this.rangeManager.selecting === "column" + ? this.setEnd(n - 1, i) + : this.setEnd(e, i)); + } + _updateMinMax() { + (this.top = Math.min(this.start.row, this.end.row)), + (this.bottom = Math.max(this.start.row, this.end.row)), + (this.left = Math.min(this.start.col, this.end.col)), + (this.right = Math.max(this.start.col, this.end.col)), + this.initialized + ? this.dispatchExternal( + "rangeChanged", + this.getComponent() + ) + : this.initializing.start && + this.initializing.end && + ((this.initialized = !0), + this.dispatchExternal( + "rangeAdded", + this.getComponent() + )); + } + _getTableColumns() { + return this.table.columnManager.getVisibleColumnsByIndex(); + } + _getTableRows() { + return this.table.rowManager + .getDisplayRows() + .filter((t) => t.type === "row"); + } + layout() { + var t, + e, + i, + o, + n, + r, + a, + l, + h, + d, + c = this.table.rowManager.renderer.vDomTop, + u = this.table.rowManager.renderer.vDomBottom, + m = this.table.columnManager.renderer.leftCol, + p = this.table.columnManager.renderer.rightCol; + this.table.options.renderHorizontal === "virtual" && + this.rangeManager.rowHeader && + (p += 1), + c == null && (c = 0), + u == null && (u = 1 / 0), + m == null && (m = 0), + p == null && (p = 1 / 0), + this.overlaps(m, c, p, u) && + ((t = Math.max(this.top, c)), + (e = Math.min(this.bottom, u)), + (i = Math.max(this.left, m)), + (o = Math.min(this.right, p)), + (n = this.rangeManager.getCell(t, i)), + (r = this.rangeManager.getCell(e, o)), + (a = n.getElement()), + (l = r.getElement()), + (h = n.row.getElement()), + (d = r.row.getElement()), + this.element.classList.add("tabulator-range-active"), + this.table.rtl + ? ((this.element.style.right = + h.offsetWidth - + a.offsetLeft - + a.offsetWidth + + "px"), + (this.element.style.width = + a.offsetLeft + + a.offsetWidth - + l.offsetLeft + + "px")) + : ((this.element.style.left = + h.offsetLeft + a.offsetLeft + "px"), + (this.element.style.width = + l.offsetLeft + + l.offsetWidth - + a.offsetLeft + + "px")), + (this.element.style.top = h.offsetTop + "px"), + (this.element.style.height = + d.offsetTop + d.offsetHeight - h.offsetTop + "px")); + } + atTopLeft(t) { + return ( + t.row.position - 1 === this.top && + t.column.getPosition() - 1 === this.left + ); + } + atBottomRight(t) { + return ( + t.row.position - 1 === this.bottom && + t.column.getPosition() - 1 === this.right + ); + } + occupies(t) { + return this.occupiesRow(t.row) && this.occupiesColumn(t.column); + } + occupiesRow(t) { + return ( + this.top <= t.position - 1 && t.position - 1 <= this.bottom + ); + } + occupiesColumn(t) { + return ( + this.left <= t.getPosition() - 1 && + t.getPosition() - 1 <= this.right + ); + } + overlaps(t, e, i, o) { + return !( + this.left > i || + t > this.right || + this.top > o || + e > this.bottom + ); + } + getData() { + var t = [], + e = this.getRows(), + i = this.getColumns(); + return ( + e.forEach((o) => { + var n = o.getData(), + r = {}; + i.forEach((a) => { + r[a.field] = n[a.field]; + }), + t.push(r); + }), + t + ); + } + getCells(t, e) { + var i = [], + o = this.getRows(), + n = this.getColumns(); + return ( + t + ? (i = o.map((r) => { + var a = []; + return ( + r.getCells().forEach((l) => { + n.includes(l.column) && + a.push(e ? l.getComponent() : l); + }), + a + ); + })) + : o.forEach((r) => { + r.getCells().forEach((a) => { + n.includes(a.column) && + i.push(e ? a.getComponent() : a); + }); + }), + i + ); + } + getStructuredCells() { + return this.getCells(!0, !0); + } + getRows() { + return this._getTableRows().slice(this.top, this.bottom + 1); + } + getColumns() { + return this._getTableColumns().slice(this.left, this.right + 1); + } + clearValues() { + var t = this.getCells(), + e = this.table.options.selectableRangeClearCellsValue; + this.table.blockRedraw(), + t.forEach((i) => { + i.setValue(e); + }), + this.table.restoreRedraw(); + } + getBounds(t) { + var e = this.getCells(!1, t), + i = { start: null, end: null }; + return ( + e.length + ? ((i.start = e[0]), (i.end = e[e.length - 1])) + : console.warn("No bounds defined on range"), + i + ); + } + getComponent() { + return ( + this.component || (this.component = new gi(this)), + this.component + ); + } + destroy(t) { + (this.destroyed = !0), + this.element.remove(), + t && this.rangeManager.rangeRemoved(this), + this.initialized && + this.dispatchExternal( + "rangeRemoved", + this.getComponent() + ); + } + destroyedGuard(t) { + return ( + this.destroyed && + console.warn( + "You cannot call the " + + t + + " function on a destroyed range" + ), + !this.destroyed + ); + } + } + var fi = { + keybindings: { + bindings: { + rangeJumpUp: ["ctrl + 38", "meta + 38"], + rangeJumpDown: ["ctrl + 40", "meta + 40"], + rangeJumpLeft: ["ctrl + 37", "meta + 37"], + rangeJumpRight: ["ctrl + 39", "meta + 39"], + rangeExpandUp: "shift + 38", + rangeExpandDown: "shift + 40", + rangeExpandLeft: "shift + 37", + rangeExpandRight: "shift + 39", + rangeExpandJumpUp: [ + "ctrl + shift + 38", + "meta + shift + 38", + ], + rangeExpandJumpDown: [ + "ctrl + shift + 40", + "meta + shift + 40", + ], + rangeExpandJumpLeft: [ + "ctrl + shift + 37", + "meta + shift + 37", + ], + rangeExpandJumpRight: [ + "ctrl + shift + 39", + "meta + shift + 39", + ], + }, + actions: { + rangeJumpLeft: function (s) { + this.dispatch( + "keybinding-nav-range", + s, + "left", + !0, + !1 + ); + }, + rangeJumpRight: function (s) { + this.dispatch( + "keybinding-nav-range", + s, + "right", + !0, + !1 + ); + }, + rangeJumpUp: function (s) { + this.dispatch("keybinding-nav-range", s, "up", !0, !1); + }, + rangeJumpDown: function (s) { + this.dispatch( + "keybinding-nav-range", + s, + "down", + !0, + !1 + ); + }, + rangeExpandLeft: function (s) { + this.dispatch( + "keybinding-nav-range", + s, + "left", + !1, + !0 + ); + }, + rangeExpandRight: function (s) { + this.dispatch( + "keybinding-nav-range", + s, + "right", + !1, + !0 + ); + }, + rangeExpandUp: function (s) { + this.dispatch("keybinding-nav-range", s, "up", !1, !0); + }, + rangeExpandDown: function (s) { + this.dispatch( + "keybinding-nav-range", + s, + "down", + !1, + !0 + ); + }, + rangeExpandJumpLeft: function (s) { + this.dispatch( + "keybinding-nav-range", + s, + "left", + !0, + !0 + ); + }, + rangeExpandJumpRight: function (s) { + this.dispatch( + "keybinding-nav-range", + s, + "right", + !0, + !0 + ); + }, + rangeExpandJumpUp: function (s) { + this.dispatch("keybinding-nav-range", s, "up", !0, !0); + }, + rangeExpandJumpDown: function (s) { + this.dispatch( + "keybinding-nav-range", + s, + "down", + !0, + !0 + ); + }, + }, + }, + clipboard: { + pasteActions: { + range: function (s) { + var t, + e, + i, + o, + n, + r = [], + a = this.table.modules.selectRange.activeRange, + l = !1; + return ( + (n = s.length), + a && + ((e = (t = a.getBounds()).start), + t.start === t.end && (l = !0), + e && + ((i = (r = + this.table.rowManager.activeRows.slice()).indexOf( + e.row + )), + (o = l + ? s.length + : r.indexOf(t.end.row) - i + 1), + i > -1 && + (this.table.blockRedraw(), + (r = r.slice(i, i + o)).forEach( + (h, d) => { + h.updateData(s[d % n]); + } + ), + this.table.restoreRedraw()))), + r + ); + }, + }, + pasteParsers: { + range: function (s) { + var t, + e, + i, + o, + n, + r = [], + a = [], + l = this.table.modules.selectRange.activeRange, + h = !1; + return ( + !!( + l && + ((e = (t = l.getBounds()).start), + t.start === t.end && (h = !0), + e && + ((s = s.split(` +`)).forEach(function (d) { + r.push(d.split(" ")); + }), + r.length && + (n = (o = + this.table.columnManager.getVisibleColumnsByIndex()).indexOf( + e.column + )) > -1)) + ) && + ((i = h + ? r[0].length + : o.indexOf(t.end.column) - n + 1), + (o = o.slice(n, n + i)), + r.forEach((d) => { + var c = {}, + u = d.length; + o.forEach(function (m, p) { + c[m.field] = d[p % u]; + }), + a.push(c); + }), + a) + ); + }, + }, + }, + export: { + columnLookups: { + range: function () { + var s = this.modules.selectRange.selectedColumns(); + return ( + this.columnManager.rowHeader && + s.unshift(this.columnManager.rowHeader), + s + ); + }, + }, + rowLookups: { + range: function () { + return this.modules.selectRange.selectedRows(); + }, + }, + }, + }; + function At(s, t, e, i, o, n, r) { + var a = this.table.dependencyRegistry.lookup( + ["luxon", "DateTime"], + "DateTime" + ), + l = r.format || "dd/MM/yyyy HH:mm:ss", + h = r.alignEmptyValues, + d = 0; + if (a !== void 0) { + if ( + (a.isDateTime(s) || + (s = + l === "iso" + ? a.fromISO(String(s)) + : a.fromFormat(String(s), l)), + a.isDateTime(t) || + (t = + l === "iso" + ? a.fromISO(String(t)) + : a.fromFormat(String(t), l)), + s.isValid) + ) { + if (t.isValid) return s - t; + d = 1; + } else d = t.isValid ? -1 : 0; + return ( + ((h === "top" && n === "desc") || + (h === "bottom" && n === "asc")) && + (d *= -1), + d + ); + } + console.error( + "Sort Error - 'datetime' sorter is dependant on luxon.js" + ); + } + var vi = { + number: function (s, t, e, i, o, n, r) { + var a = r.alignEmptyValues, + l = r.decimalSeparator, + h = r.thousandSeparator, + d = 0; + if ( + ((s = String(s)), + (t = String(t)), + h && ((s = s.split(h).join("")), (t = t.split(h).join(""))), + l && + ((s = s.split(l).join(".")), + (t = t.split(l).join("."))), + (s = parseFloat(s)), + (t = parseFloat(t)), + isNaN(s)) + ) + d = isNaN(t) ? 0 : -1; + else { + if (!isNaN(t)) return s - t; + d = 1; + } + return ( + ((a === "top" && n === "desc") || + (a === "bottom" && n === "asc")) && + (d *= -1), + d + ); + }, + string: function (s, t, e, i, o, n, r) { + var a, + l = r.alignEmptyValues, + h = 0; + if (s) { + if (t) { + switch (typeof r.locale) { + case "boolean": + r.locale && (a = this.langLocale()); + break; + case "string": + a = r.locale; + } + return String(s) + .toLowerCase() + .localeCompare(String(t).toLowerCase(), a); + } + h = 1; + } else h = t ? -1 : 0; + return ( + ((l === "top" && n === "desc") || + (l === "bottom" && n === "asc")) && + (h *= -1), + h + ); + }, + date: function (s, t, e, i, o, n, r) { + return ( + r.format || (r.format = "dd/MM/yyyy"), + At.call(this, s, t, e, i, o, n, r) + ); + }, + time: function (s, t, e, i, o, n, r) { + return ( + r.format || (r.format = "HH:mm"), + At.call(this, s, t, e, i, o, n, r) + ); + }, + datetime: At, + boolean: function (s, t, e, i, o, n, r) { + return ( + (s === !0 || s === "true" || s === "True" || s === 1 + ? 1 + : 0) - + (t === !0 || t === "true" || t === "True" || t === 1 + ? 1 + : 0) + ); + }, + array: function (s, t, e, i, o, n, r) { + var a, + l = r.type || "length", + h = r.alignEmptyValues, + d = 0, + c = this.table; + function u(m) { + var p; + switch ((a && (m = a(m)), l)) { + case "length": + p = m.length; + break; + case "sum": + p = m.reduce(function (g, f) { + return g + f; + }); + break; + case "max": + p = Math.max.apply(null, m); + break; + case "min": + p = Math.min.apply(null, m); + break; + case "avg": + p = + m.reduce(function (g, f) { + return g + f; + }) / m.length; + break; + case "string": + p = m.join(""); + } + return p; + } + if ( + (r.valueMap && + (a = + typeof r.valueMap == "string" + ? function (m) { + return m.map((p) => + x.retrieveNestedData( + c.options.nestedFieldSeparator, + r.valueMap, + p + ) + ); + } + : r.valueMap), + Array.isArray(s)) + ) { + if (Array.isArray(t)) + return l === "string" + ? String(u(s)) + .toLowerCase() + .localeCompare(String(u(t)).toLowerCase()) + : u(t) - u(s); + d = 1; + } else d = Array.isArray(t) ? -1 : 0; + return ( + ((h === "top" && n === "desc") || + (h === "bottom" && n === "asc")) && + (d *= -1), + d + ); + }, + exists: function (s, t, e, i, o, n, r) { + return (s === void 0 ? 0 : 1) - (t === void 0 ? 0 : 1); + }, + alphanum: function (s, t, e, i, o, n, r) { + var a, + l, + h, + d, + c, + u = 0, + m = /(\d+)|(\D+)/g, + p = /\d/, + g = r.alignEmptyValues, + f = 0; + if (s || s === 0) { + if (t || t === 0) { + if (isFinite(s) && isFinite(t)) return s - t; + if ( + (a = String(s).toLowerCase()) === + (l = String(t).toLowerCase()) + ) + return 0; + if (!p.test(a) || !p.test(l)) return a > l ? 1 : -1; + for ( + a = a.match(m), + l = l.match(m), + c = a.length > l.length ? l.length : a.length; + u < c; + + ) + if ((h = a[u]) !== (d = l[u++])) + return isFinite(h) && isFinite(d) + ? (h.charAt(0) === "0" && (h = "." + h), + d.charAt(0) === "0" && (d = "." + d), + h - d) + : h > d + ? 1 + : -1; + return a.length > l.length; + } + f = 1; + } else f = t || t === 0 ? -1 : 0; + return ( + ((g === "top" && n === "desc") || + (g === "bottom" && n === "asc")) && + (f *= -1), + f + ); + }, + }; + let X = class X extends w { + constructor(t) { + super(t), + (this.sortList = []), + (this.changed = !1), + this.registerTableOption("sortMode", "local"), + this.registerTableOption("initialSort", !1), + this.registerTableOption("columnHeaderSortMulti", !0), + this.registerTableOption("sortOrderReverse", !1), + this.registerTableOption( + "headerSortElement", + "
" + ), + this.registerTableOption( + "headerSortClickElement", + "header" + ), + this.registerColumnOption("sorter"), + this.registerColumnOption("sorterParams"), + this.registerColumnOption("headerSort", !0), + this.registerColumnOption("headerSortStartingDir"), + this.registerColumnOption("headerSortTristate"); + } + initialize() { + this.subscribe( + "column-layout", + this.initializeColumn.bind(this) + ), + this.subscribe("table-built", this.tableBuilt.bind(this)), + this.registerDataHandler(this.sort.bind(this), 20), + this.registerTableFunction( + "setSort", + this.userSetSort.bind(this) + ), + this.registerTableFunction( + "getSorters", + this.getSort.bind(this) + ), + this.registerTableFunction( + "clearSort", + this.clearSort.bind(this) + ), + this.table.options.sortMode === "remote" && + this.subscribe( + "data-params", + this.remoteSortParams.bind(this) + ); + } + tableBuilt() { + this.table.options.initialSort && + this.setSort(this.table.options.initialSort); + } + remoteSortParams(t, e, i, o) { + var n = this.getSort(); + return ( + n.forEach((r) => { + delete r.column; + }), + (o.sort = n), + o + ); + } + userSetSort(t, e) { + this.setSort(t, e), this.refreshSort(); + } + clearSort() { + this.clear(), this.refreshSort(); + } + initializeColumn(t) { + var e, + i, + o = !1; + switch (typeof t.definition.sorter) { + case "string": + X.sorters[t.definition.sorter] + ? (o = X.sorters[t.definition.sorter]) + : console.warn( + "Sort Error - No such sorter found: ", + t.definition.sorter + ); + break; + case "function": + o = t.definition.sorter; + } + if ( + ((t.modules.sort = { + sorter: o, + dir: "none", + params: t.definition.sorterParams || {}, + startingDir: + t.definition.headerSortStartingDir || "asc", + tristate: t.definition.headerSortTristate, + }), + t.definition.headerSort !== !1) + ) { + switch ( + ((e = t.getElement()).classList.add( + "tabulator-sortable" + ), + (i = document.createElement("div")).classList.add( + "tabulator-col-sorter" + ), + this.table.options.headerSortClickElement === "icon" + ? i.classList.add("tabulator-col-sorter-element") + : e.classList.add("tabulator-col-sorter-element"), + this.table.options.headerSortElement) + ) { + case "function": + break; + case "object": + i.appendChild(this.table.options.headerSortElement); + break; + default: + i.innerHTML = this.table.options.headerSortElement; + } + t.titleHolderElement.appendChild(i), + (t.modules.sort.element = i), + this.setColumnHeaderSortIcon(t, "none"), + this.table.options.headerSortClickElement === "icon" && + i.addEventListener("mousedown", (n) => { + n.stopPropagation(); + }), + (this.table.options.headerSortClickElement === "icon" + ? i + : e + ).addEventListener("click", (n) => { + var r = "", + a = [], + l = !1; + if (t.modules.sort) { + if (t.modules.sort.tristate) + r = + t.modules.sort.dir == "none" + ? t.modules.sort.startingDir + : t.modules.sort.dir == + t.modules.sort.startingDir + ? t.modules.sort.dir == "asc" + ? "desc" + : "asc" + : "none"; + else + switch (t.modules.sort.dir) { + case "asc": + r = "desc"; + break; + case "desc": + r = "asc"; + break; + default: + r = t.modules.sort.startingDir; + } + this.table.options.columnHeaderSortMulti && + (n.shiftKey || n.ctrlKey) + ? ((l = (a = this.getSort()).findIndex( + (h) => h.field === t.getField() + )), + l > -1 + ? ((a[l].dir = r), + (l = a.splice(l, 1)[0]), + r != "none" && a.push(l)) + : r != "none" && + a.push({ column: t, dir: r }), + this.setSort(a)) + : r == "none" + ? this.clear() + : this.setSort(t, r), + this.refreshSort(); + } + }); + } + } + refreshSort() { + this.table.options.sortMode === "remote" + ? this.reloadData(null, !1, !1) + : this.refreshData(!0); + } + hasChanged() { + var t = this.changed; + return (this.changed = !1), t; + } + getSort() { + var t = []; + return ( + this.sortList.forEach(function (e) { + e.column && + t.push({ + column: e.column.getComponent(), + field: e.column.getField(), + dir: e.dir, + }); + }), + t + ); + } + setSort(t, e) { + var i = this, + o = []; + Array.isArray(t) || (t = [{ column: t, dir: e }]), + t.forEach(function (n) { + var r; + (r = i.table.columnManager.findColumn(n.column)) + ? ((n.column = r), o.push(n), (i.changed = !0)) + : console.warn( + "Sort Warning - Sort field does not exist and is being ignored: ", + n.column + ); + }), + (i.sortList = o), + this.dispatch("sort-changed"); + } + clear() { + this.setSort([]); + } + findSorter(t) { + var e, + i = this.table.rowManager.activeRows[0], + o = "string"; + if (i && ((i = i.getData()), t.getField())) + switch (typeof (e = t.getFieldValue(i))) { + case "undefined": + o = "string"; + break; + case "boolean": + o = "boolean"; + break; + default: + isNaN(e) || e === "" + ? e.match( + /((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i + ) && (o = "alphanum") + : (o = "number"); + } + return X.sorters[o]; + } + sort(t, e) { + var i = this, + o = this.table.options.sortOrderReverse + ? i.sortList.slice().reverse() + : i.sortList, + n = [], + r = []; + return ( + this.subscribedExternal("dataSorting") && + this.dispatchExternal("dataSorting", i.getSort()), + e || i.clearColumnHeaders(), + this.table.options.sortMode !== "remote" + ? (o.forEach(function (a, l) { + var h; + a.column && + ((h = a.column.modules.sort) && + (h.sorter || + (h.sorter = i.findSorter(a.column)), + (a.params = + typeof h.params == "function" + ? h.params( + a.column.getComponent(), + a.dir + ) + : h.params), + n.push(a)), + e || i.setColumnHeader(a.column, a.dir)); + }), + n.length && i._sortItems(t, n)) + : e || + o.forEach(function (a, l) { + i.setColumnHeader(a.column, a.dir); + }), + this.subscribedExternal("dataSorted") && + (t.forEach((a) => { + r.push(a.getComponent()); + }), + this.dispatchExternal("dataSorted", i.getSort(), r)), + t + ); + } + clearColumnHeaders() { + this.table.columnManager.getRealColumns().forEach((t) => { + t.modules.sort && + ((t.modules.sort.dir = "none"), + t.getElement().setAttribute("aria-sort", "none"), + this.setColumnHeaderSortIcon(t, "none")); + }); + } + setColumnHeader(t, e) { + (t.modules.sort.dir = e), + t + .getElement() + .setAttribute( + "aria-sort", + e === "asc" ? "ascending" : "descending" + ), + this.setColumnHeaderSortIcon(t, e); + } + setColumnHeaderSortIcon(t, e) { + var i, + o = t.modules.sort.element; + if ( + t.definition.headerSort && + typeof this.table.options.headerSortElement == "function" + ) { + for (; o.firstChild; ) o.removeChild(o.firstChild); + typeof (i = this.table.options.headerSortElement.call( + this.table, + t.getComponent(), + e + )) == "object" + ? o.appendChild(i) + : (o.innerHTML = i); + } + } + _sortItems(t, e) { + var i = e.length - 1; + t.sort((o, n) => { + for (var r, a = i; a >= 0; a--) { + let l = e[a]; + if ( + (r = this._sortRow( + o, + n, + l.column, + l.dir, + l.params + )) !== 0 + ) + break; + } + return r; + }); + } + _sortRow(t, e, i, o, n) { + var r, + a, + l = o == "asc" ? t : e, + h = o == "asc" ? e : t; + return ( + (t = + (t = i.getFieldValue(l.getData())) !== void 0 ? t : ""), + (e = + (e = i.getFieldValue(h.getData())) !== void 0 ? e : ""), + (r = l.getComponent()), + (a = h.getComponent()), + i.modules.sort.sorter.call( + this, + t, + e, + r, + a, + i.getComponent(), + o, + n + ) + ); + } + }; + b(X, "moduleName", "sort"), b(X, "sorters", vi); + let Bt = X; + class wi { + constructor(t, e) { + (this.columnCount = t), + (this.rowCount = e), + (this.columnString = []), + (this.columns = []), + (this.rows = []); + } + genColumns(t) { + var e = Math.max( + this.columnCount, + Math.max(...t.map((i) => i.length)) + ); + (this.columnString = []), (this.columns = []); + for (let i = 1; i <= e; i++) + this.incrementChar(this.columnString.length - 1), + this.columns.push(this.columnString.join("")); + return this.columns; + } + genRows(t) { + var e = Math.max(this.rowCount, t.length); + this.rows = []; + for (let i = 1; i <= e; i++) this.rows.push(i); + return this.rows; + } + incrementChar(t) { + let e = this.columnString[t]; + e + ? e !== "Z" + ? (this.columnString[t] = String.fromCharCode( + this.columnString[t].charCodeAt(0) + 1 + )) + : ((this.columnString[t] = "A"), + t + ? this.incrementChar(t - 1) + : this.columnString.push("A")) + : this.columnString.push("A"); + } + setRowCount(t) { + this.rowCount = t; + } + setColumnCount(t) { + this.columnCount = t; + } + } + class ue { + constructor(t) { + return ( + (this._sheet = t), + new Proxy(this, { + get: function (e, i, o) { + return e[i] !== void 0 + ? e[i] + : e._sheet.table.componentFunctionBinder.handle( + "sheet", + e._sheet, + i + ); + }, + }) + ); + } + getTitle() { + return this._sheet.title; + } + getKey() { + return this._sheet.key; + } + getDefinition() { + return this._sheet.getDefinition(); + } + getData() { + return this._sheet.getData(); + } + setData(t) { + return this._sheet.setData(t); + } + clear() { + return this._sheet.clear(); + } + remove() { + return this._sheet.remove(); + } + active() { + return this._sheet.active(); + } + setTitle(t) { + return this._sheet.setTitle(t); + } + setRows(t) { + return this._sheet.setRows(t); + } + setColumns(t) { + return this._sheet.setColumns(t); + } + } + class me extends C { + constructor(t, e) { + super(t.table), + (this.spreadsheetManager = t), + (this.definition = e), + (this.title = this.definition.title || ""), + (this.key = this.definition.key || this.definition.title), + (this.rowCount = this.definition.rows), + (this.columnCount = this.definition.columns), + (this.data = this.definition.data || []), + (this.element = null), + (this.isActive = !1), + (this.grid = new wi(this.columnCount, this.rowCount)), + (this.defaultColumnDefinition = { + width: 100, + headerHozAlign: "center", + headerSort: !1, + }), + (this.columnDefinition = Object.assign( + this.defaultColumnDefinition, + this.options("spreadsheetColumnDefinition") + )), + (this.columnDefs = []), + (this.rowDefs = []), + (this.columnFields = []), + (this.columns = []), + (this.rows = []), + (this.scrollTop = null), + (this.scrollLeft = null), + this.initialize(), + this.dispatchExternal("sheetAdded", this.getComponent()); + } + initialize() { + this.initializeElement(), + this.initializeColumns(), + this.initializeRows(); + } + reinitialize() { + this.initializeColumns(), this.initializeRows(); + } + initializeElement() { + (this.element = document.createElement("div")), + this.element.classList.add("tabulator-spreadsheet-tab"), + (this.element.innerText = this.title), + this.element.addEventListener("click", () => { + this.spreadsheetManager.loadSheet(this); + }); + } + initializeColumns() { + this.grid.setColumnCount(this.columnCount), + (this.columnFields = this.grid.genColumns(this.data)), + (this.columnDefs = []), + this.columnFields.forEach((t) => { + var e = Object.assign({}, this.columnDefinition); + (e.field = t), (e.title = t), this.columnDefs.push(e); + }); + } + initializeRows() { + var t; + this.grid.setRowCount(this.rowCount), + (t = this.grid.genRows(this.data)), + (this.rowDefs = []), + t.forEach((e, i) => { + var o = { _id: e }, + n = this.data[i]; + n && + n.forEach((r, a) => { + var l = this.columnFields[a]; + l && (o[l] = r); + }), + this.rowDefs.push(o); + }); + } + unload() { + (this.isActive = !1), + (this.scrollTop = this.table.rowManager.scrollTop), + (this.scrollLeft = this.table.rowManager.scrollLeft), + (this.data = this.getData(!0)), + this.element.classList.remove( + "tabulator-spreadsheet-tab-active" + ); + } + load() { + var t = !this.isActive; + (this.isActive = !0), + this.table.blockRedraw(), + this.table.setData([]), + this.table.setColumns(this.columnDefs), + this.table.setData(this.rowDefs), + this.table.restoreRedraw(), + t && + this.scrollTop !== null && + ((this.table.rowManager.element.scrollLeft = + this.scrollLeft), + (this.table.rowManager.element.scrollTop = + this.scrollTop)), + this.element.classList.add( + "tabulator-spreadsheet-tab-active" + ), + this.dispatchExternal("sheetLoaded", this.getComponent()); + } + getComponent() { + return new ue(this); + } + getDefinition() { + return { + title: this.title, + key: this.key, + rows: this.rowCount, + columns: this.columnCount, + data: this.getData(), + }; + } + getData(t) { + var e, + i, + o, + n = []; + return ( + this.rowDefs.forEach((r) => { + var a = []; + this.columnFields.forEach((l) => { + a.push(r[l]); + }), + n.push(a); + }), + t || + this.options("spreadsheetOutputFull") || + ((e = n.map( + (r) => r.findLastIndex((a) => a !== void 0) + 1 + )), + (i = Math.max(...e)), + (o = e.findLastIndex((r) => r > 0) + 1), + (n = (n = n.slice(0, o)).map((r) => r.slice(0, i)))), + n + ); + } + setData(t) { + (this.data = t), + this.reinitialize(), + this.dispatchExternal("sheetUpdated", this.getComponent()), + this.isActive && this.load(); + } + clear() { + this.setData([]); + } + setTitle(t) { + (this.title = t), + (this.element.innerText = t), + this.dispatchExternal("sheetUpdated", this.getComponent()); + } + setRows(t) { + (this.rowCount = t), + this.initializeRows(), + this.dispatchExternal("sheetUpdated", this.getComponent()), + this.isActive && this.load(); + } + setColumns(t) { + (this.columnCount = t), + this.reinitialize(), + this.dispatchExternal("sheetUpdated", this.getComponent()), + this.isActive && this.load(); + } + remove() { + this.spreadsheetManager.removeSheet(this); + } + destroy() { + this.element.parentNode && + this.element.parentNode.removeChild(this.element), + this.dispatchExternal("sheetRemoved", this.getComponent()); + } + active() { + this.spreadsheetManager.loadSheet(this); + } + } + var Ci = { + integer: function (s, t, e) { + return ( + t === "" || + t == null || + ((t = Number(t)), + !isNaN(t) && isFinite(t) && Math.floor(t) === t) + ); + }, + float: function (s, t, e) { + return ( + t === "" || + t == null || + ((t = Number(t)), !isNaN(t) && isFinite(t) && t % 1 != 0) + ); + }, + numeric: function (s, t, e) { + return t === "" || t == null || !isNaN(t); + }, + string: function (s, t, e) { + return t === "" || t == null || isNaN(t); + }, + alphanumeric: function (s, t, e) { + return ( + t === "" || t == null || new RegExp(/^[a-z0-9]+$/i).test(t) + ); + }, + max: function (s, t, e) { + return t === "" || t == null || parseFloat(t) <= e; + }, + min: function (s, t, e) { + return t === "" || t == null || parseFloat(t) >= e; + }, + starts: function (s, t, e) { + return ( + t === "" || + t == null || + String(t).toLowerCase().startsWith(String(e).toLowerCase()) + ); + }, + ends: function (s, t, e) { + return ( + t === "" || + t == null || + String(t).toLowerCase().endsWith(String(e).toLowerCase()) + ); + }, + minLength: function (s, t, e) { + return t === "" || t == null || String(t).length >= e; + }, + maxLength: function (s, t, e) { + return t === "" || t == null || String(t).length <= e; + }, + in: function (s, t, e) { + return ( + t === "" || + t == null || + (typeof e == "string" && (e = e.split("|")), + e.indexOf(t) > -1) + ); + }, + regex: function (s, t, e) { + return t === "" || t == null || new RegExp(e).test(t); + }, + unique: function (s, t, e) { + if (t === "" || t == null) return !0; + var i = !0, + o = s.getData(), + n = s.getColumn()._getSelf(); + return ( + this.table.rowManager.rows.forEach(function (r) { + var a = r.getData(); + a !== o && t == n.getFieldValue(a) && (i = !1); + }), + i + ); + }, + required: function (s, t, e) { + return t !== "" && t != null; + }, + }; + let rt = class rt extends w { + constructor(t) { + super(t), + (this.invalidCells = []), + this.registerTableOption("validationMode", "blocking"), + this.registerColumnOption("validator"), + this.registerTableFunction( + "getInvalidCells", + this.getInvalidCells.bind(this) + ), + this.registerTableFunction( + "clearCellValidation", + this.userClearCellValidation.bind(this) + ), + this.registerTableFunction( + "validate", + this.userValidate.bind(this) + ), + this.registerComponentFunction( + "cell", + "isValid", + this.cellIsValid.bind(this) + ), + this.registerComponentFunction( + "cell", + "clearValidation", + this.clearValidation.bind(this) + ), + this.registerComponentFunction( + "cell", + "validate", + this.cellValidate.bind(this) + ), + this.registerComponentFunction( + "column", + "validate", + this.columnValidate.bind(this) + ), + this.registerComponentFunction( + "row", + "validate", + this.rowValidate.bind(this) + ); + } + initialize() { + this.subscribe("cell-delete", this.clearValidation.bind(this)), + this.subscribe( + "column-layout", + this.initializeColumnCheck.bind(this) + ), + this.subscribe( + "edit-success", + this.editValidate.bind(this) + ), + this.subscribe( + "edit-editor-clear", + this.editorClear.bind(this) + ), + this.subscribe( + "edit-edited-clear", + this.editedClear.bind(this) + ); + } + editValidate(t, e, i) { + var o = + this.table.options.validationMode === "manual" || + this.validate(t.column.modules.validate, t, e); + return ( + o !== !0 && + setTimeout(() => { + t + .getElement() + .classList.add("tabulator-validation-fail"), + this.dispatchExternal( + "validationFailed", + t.getComponent(), + e, + o + ); + }), + o + ); + } + editorClear(t, e) { + e && t.column.modules.validate && this.cellValidate(t), + t + .getElement() + .classList.remove("tabulator-validation-fail"); + } + editedClear(t) { + t.modules.validate && (t.modules.validate.invalid = !1); + } + cellIsValid(t) { + return (t.modules.validate && t.modules.validate.invalid) || !0; + } + cellValidate(t) { + return this.validate( + t.column.modules.validate, + t, + t.getValue() + ); + } + columnValidate(t) { + var e = []; + return ( + t.cells.forEach((i) => { + this.cellValidate(i) !== !0 && e.push(i.getComponent()); + }), + !e.length || e + ); + } + rowValidate(t) { + var e = []; + return ( + t.cells.forEach((i) => { + this.cellValidate(i) !== !0 && e.push(i.getComponent()); + }), + !e.length || e + ); + } + userClearCellValidation(t) { + t || (t = this.getInvalidCells()), + Array.isArray(t) || (t = [t]), + t.forEach((e) => { + this.clearValidation(e._getSelf()); + }); + } + userValidate(t) { + var e = []; + return ( + this.table.rowManager.rows.forEach((i) => { + var o = (i = i.getComponent()).validate(); + o !== !0 && (e = e.concat(o)); + }), + !e.length || e + ); + } + initializeColumnCheck(t) { + t.definition.validator !== void 0 && this.initializeColumn(t); + } + initializeColumn(t) { + var e, + i = this, + o = []; + t.definition.validator && + (Array.isArray(t.definition.validator) + ? t.definition.validator.forEach((n) => { + (e = i._extractValidator(n)) && o.push(e); + }) + : (e = this._extractValidator( + t.definition.validator + )) && o.push(e), + (t.modules.validate = !!o.length && o)); + } + _extractValidator(t) { + var e, i, o; + switch (typeof t) { + case "string": + return ( + (o = t.indexOf(":")) > -1 + ? ((e = t.substring(0, o)), + (i = t.substring(o + 1))) + : (e = t), + this._buildValidator(e, i) + ); + case "function": + return this._buildValidator(t); + case "object": + return this._buildValidator(t.type, t.parameters); + } + } + _buildValidator(t, e) { + var i = typeof t == "function" ? t : rt.validators[t]; + return i + ? { + type: typeof t == "function" ? "function" : t, + func: i, + params: e, + } + : (console.warn( + "Validator Setup Error - No matching validator found:", + t + ), + !1); + } + validate(t, e, i) { + var o = this, + n = [], + r = this.invalidCells.indexOf(e); + return ( + t && + t.forEach((a) => { + a.func.call(o, e.getComponent(), i, a.params) || + n.push({ type: a.type, parameters: a.params }); + }), + e.modules.validate || (e.modules.validate = {}), + n.length + ? ((e.modules.validate.invalid = n), + this.table.options.validationMode !== "manual" && + e + .getElement() + .classList.add("tabulator-validation-fail"), + r == -1 && this.invalidCells.push(e)) + : ((e.modules.validate.invalid = !1), + e + .getElement() + .classList.remove("tabulator-validation-fail"), + r > -1 && this.invalidCells.splice(r, 1)), + !n.length || n + ); + } + getInvalidCells() { + var t = []; + return ( + this.invalidCells.forEach((e) => { + t.push(e.getComponent()); + }), + t + ); + } + clearValidation(t) { + var e; + t.modules.validate && + t.modules.validate.invalid && + (t + .getElement() + .classList.remove("tabulator-validation-fail"), + (t.modules.validate.invalid = !1), + (e = this.invalidCells.indexOf(t)) > -1 && + this.invalidCells.splice(e, 1)); + } + }; + b(rt, "moduleName", "validate"), b(rt, "validators", Ci); + let _t = rt; + var Vt = Object.freeze({ + __proto__: null, + AccessorModule: ft, + AjaxModule: Ct, + ClipboardModule: Et, + ColumnCalcsModule: yt, + DataTreeModule: + ((Nt = class extends w { + constructor(s) { + super(s), + (this.indent = 10), + (this.field = ""), + (this.collapseEl = null), + (this.expandEl = null), + (this.branchEl = null), + (this.elementField = !1), + (this.startOpen = function () {}), + this.registerTableOption("dataTree", !1), + this.registerTableOption("dataTreeFilter", !0), + this.registerTableOption("dataTreeSort", !0), + this.registerTableOption( + "dataTreeElementColumn", + !1 + ), + this.registerTableOption( + "dataTreeBranchElement", + !0 + ), + this.registerTableOption( + "dataTreeChildIndent", + 9 + ), + this.registerTableOption( + "dataTreeChildField", + "_children" + ), + this.registerTableOption( + "dataTreeCollapseElement", + !1 + ), + this.registerTableOption( + "dataTreeExpandElement", + !1 + ), + this.registerTableOption( + "dataTreeStartExpanded", + !1 + ), + this.registerTableOption( + "dataTreeChildColumnCalcs", + !1 + ), + this.registerTableOption( + "dataTreeSelectPropagate", + !1 + ), + this.registerComponentFunction( + "row", + "treeCollapse", + this.collapseRow.bind(this) + ), + this.registerComponentFunction( + "row", + "treeExpand", + this.expandRow.bind(this) + ), + this.registerComponentFunction( + "row", + "treeToggle", + this.toggleRow.bind(this) + ), + this.registerComponentFunction( + "row", + "getTreeParent", + this.getTreeParent.bind(this) + ), + this.registerComponentFunction( + "row", + "getTreeChildren", + this.getRowChildren.bind(this) + ), + this.registerComponentFunction( + "row", + "addTreeChild", + this.addTreeChildRow.bind(this) + ), + this.registerComponentFunction( + "row", + "isTreeExpanded", + this.isRowExpanded.bind(this) + ); + } + initialize() { + if (this.table.options.dataTree) { + var s = null, + t = this.table.options; + switch ( + ((this.field = t.dataTreeChildField), + (this.indent = t.dataTreeChildIndent), + this.options("movableRows") && + console.warn( + "The movableRows option is not available with dataTree enabled, moving of child rows could result in unpredictable behavior" + ), + t.dataTreeBranchElement + ? t.dataTreeBranchElement === !0 + ? ((this.branchEl = + document.createElement( + "div" + )), + this.branchEl.classList.add( + "tabulator-data-tree-branch" + )) + : typeof t.dataTreeBranchElement == + "string" + ? (((s = + document.createElement( + "div" + )).innerHTML = + t.dataTreeBranchElement), + (this.branchEl = s.firstChild)) + : (this.branchEl = + t.dataTreeBranchElement) + : ((this.branchEl = + document.createElement("div")), + this.branchEl.classList.add( + "tabulator-data-tree-branch-empty" + )), + t.dataTreeCollapseElement + ? typeof t.dataTreeCollapseElement == + "string" + ? (((s = + document.createElement( + "div" + )).innerHTML = + t.dataTreeCollapseElement), + (this.collapseEl = s.firstChild)) + : (this.collapseEl = + t.dataTreeCollapseElement) + : ((this.collapseEl = + document.createElement("div")), + this.collapseEl.classList.add( + "tabulator-data-tree-control" + ), + (this.collapseEl.tabIndex = 0), + (this.collapseEl.innerHTML = + "
")), + t.dataTreeExpandElement + ? typeof t.dataTreeExpandElement == + "string" + ? (((s = + document.createElement( + "div" + )).innerHTML = + t.dataTreeExpandElement), + (this.expandEl = s.firstChild)) + : (this.expandEl = + t.dataTreeExpandElement) + : ((this.expandEl = + document.createElement("div")), + this.expandEl.classList.add( + "tabulator-data-tree-control" + ), + (this.expandEl.tabIndex = 0), + (this.expandEl.innerHTML = + "
")), + typeof t.dataTreeStartExpanded) + ) { + case "boolean": + this.startOpen = function (e, i) { + return t.dataTreeStartExpanded; + }; + break; + case "function": + this.startOpen = + t.dataTreeStartExpanded; + break; + default: + this.startOpen = function (e, i) { + return t.dataTreeStartExpanded[i]; + }; + } + this.subscribe( + "row-init", + this.initializeRow.bind(this) + ), + this.subscribe( + "row-layout-after", + this.layoutRow.bind(this) + ), + this.subscribe( + "row-deleting", + this.rowDeleting.bind(this) + ), + this.subscribe( + "row-deleted", + this.rowDelete.bind(this), + 0 + ), + this.subscribe( + "row-data-changed", + this.rowDataChanged.bind(this), + 10 + ), + this.subscribe( + "cell-value-updated", + this.cellValueChanged.bind(this) + ), + this.subscribe( + "edit-cancelled", + this.cellValueChanged.bind(this) + ), + this.subscribe( + "column-moving-rows", + this.columnMoving.bind(this) + ), + this.subscribe( + "table-built", + this.initializeElementField.bind(this) + ), + this.subscribe( + "table-redrawing", + this.tableRedrawing.bind(this) + ), + this.registerDisplayHandler( + this.getRows.bind(this), + 30 + ); + } + } + tableRedrawing(s) { + s && + this.table.rowManager.getRows().forEach((t) => { + this.reinitializeRowChildren(t); + }); + } + initializeElementField() { + var s = + this.table.columnManager.getFirstVisibleColumn(); + this.elementField = + this.table.options.dataTreeElementColumn || + (!!s && s.field); + } + getRowChildren(s) { + return this.getTreeChildren(s, !0); + } + columnMoving() { + var s = []; + return ( + this.table.rowManager.rows.forEach((t) => { + s = s.concat( + this.getTreeChildren(t, !1, !0) + ); + }), + s + ); + } + rowDataChanged(s, t, e) { + this.redrawNeeded(e) && + (this.initializeRow(s), + t && (this.layoutRow(s), this.refreshData(!0))); + } + cellValueChanged(s) { + s.column.getField() === this.elementField && + this.layoutRow(s.row); + } + initializeRow(s) { + var t = s.getData()[this.field], + e = Array.isArray(t), + i = + e || + (!e && typeof t == "object" && t !== null); + !i && + s.modules.dataTree && + s.modules.dataTree.branchEl && + s.modules.dataTree.branchEl.parentNode.removeChild( + s.modules.dataTree.branchEl + ), + !i && + s.modules.dataTree && + s.modules.dataTree.controlEl && + s.modules.dataTree.controlEl.parentNode.removeChild( + s.modules.dataTree.controlEl + ), + (s.modules.dataTree = { + index: s.modules.dataTree + ? s.modules.dataTree.index + : 0, + open: + !!i && + (s.modules.dataTree + ? s.modules.dataTree.open + : this.startOpen( + s.getComponent(), + 0 + )), + controlEl: + !(!s.modules.dataTree || !i) && + s.modules.dataTree.controlEl, + branchEl: + !(!s.modules.dataTree || !i) && + s.modules.dataTree.branchEl, + parent: + !!s.modules.dataTree && + s.modules.dataTree.parent, + children: i, + }); + } + reinitializeRowChildren(s) { + this.getTreeChildren(s, !1, !0).forEach(function ( + t + ) { + t.reinitialize(!0); + }); + } + layoutRow(s) { + var t = ( + this.elementField + ? s.getCell(this.elementField) + : s.getCells()[0] + ).getElement(), + e = s.modules.dataTree; + e.branchEl && + (e.branchEl.parentNode && + e.branchEl.parentNode.removeChild( + e.branchEl + ), + (e.branchEl = !1)), + e.controlEl && + (e.controlEl.parentNode && + e.controlEl.parentNode.removeChild( + e.controlEl + ), + (e.controlEl = !1)), + this.generateControlElement(s, t), + s + .getElement() + .classList.add( + "tabulator-tree-level-" + e.index + ), + e.index && + (this.branchEl + ? ((e.branchEl = + this.branchEl.cloneNode(!0)), + t.insertBefore( + e.branchEl, + t.firstChild + ), + this.table.rtl + ? (e.branchEl.style.marginRight = + (e.branchEl.offsetWidth + + e.branchEl.style + .marginLeft) * + (e.index - 1) + + e.index * this.indent + + "px") + : (e.branchEl.style.marginLeft = + (e.branchEl.offsetWidth + + e.branchEl.style + .marginRight) * + (e.index - 1) + + e.index * this.indent + + "px")) + : this.table.rtl + ? (t.style.paddingRight = + parseInt( + window + .getComputedStyle(t, null) + .getPropertyValue( + "padding-right" + ) + ) + + e.index * this.indent + + "px") + : (t.style.paddingLeft = + parseInt( + window + .getComputedStyle(t, null) + .getPropertyValue( + "padding-left" + ) + ) + + e.index * this.indent + + "px")); + } + generateControlElement(s, t) { + var e = s.modules.dataTree, + i = e.controlEl; + (t = t || s.getCells()[0].getElement()), + e.children !== !1 && + (e.open + ? ((e.controlEl = + this.collapseEl.cloneNode(!0)), + e.controlEl.addEventListener( + "click", + (o) => { + o.stopPropagation(), + this.collapseRow(s); + } + )) + : ((e.controlEl = + this.expandEl.cloneNode(!0)), + e.controlEl.addEventListener( + "click", + (o) => { + o.stopPropagation(), + this.expandRow(s); + } + )), + e.controlEl.addEventListener( + "mousedown", + (o) => { + o.stopPropagation(); + } + ), + i && i.parentNode === t + ? i.parentNode.replaceChild( + e.controlEl, + i + ) + : t.insertBefore( + e.controlEl, + t.firstChild + )); + } + getRows(s) { + var t = []; + return ( + s.forEach((e, i) => { + var o; + t.push(e), + e instanceof k && + (e.create(), + (o = e.modules.dataTree).index || + o.children === !1 || + this.getChildren( + e, + !1, + !0 + ).forEach((n) => { + n.create(), t.push(n); + })); + }), + t + ); + } + getChildren(s, t, e) { + var i = s.modules.dataTree, + o = [], + n = []; + return ( + i.children !== !1 && + (i.open || t) && + (Array.isArray(i.children) || + (i.children = this.generateChildren(s)), + (o = + this.table.modExists("filter") && + this.table.options.dataTreeFilter + ? this.table.modules.filter.filter( + i.children + ) + : i.children), + this.table.modExists("sort") && + this.table.options.dataTreeSort && + this.table.modules.sort.sort(o, e), + o.forEach((r) => { + n.push(r), + this.getChildren(r, !1, !0).forEach( + (a) => { + n.push(a); + } + ); + })), + n + ); + } + generateChildren(s) { + var t = [], + e = s.getData()[this.field]; + return ( + Array.isArray(e) || (e = [e]), + e.forEach((i) => { + var o = new k( + i || {}, + this.table.rowManager + ); + o.create(), + (o.modules.dataTree.index = + s.modules.dataTree.index + 1), + (o.modules.dataTree.parent = s), + o.modules.dataTree.children && + (o.modules.dataTree.open = + this.startOpen( + o.getComponent(), + o.modules.dataTree.index + )), + t.push(o); + }), + t + ); + } + expandRow(s, t) { + var e = s.modules.dataTree; + e.children !== !1 && + ((e.open = !0), + s.reinitialize(), + this.refreshData(!0), + this.dispatchExternal( + "dataTreeRowExpanded", + s.getComponent(), + s.modules.dataTree.index + )); + } + collapseRow(s) { + var t = s.modules.dataTree; + t.children !== !1 && + ((t.open = !1), + s.reinitialize(), + this.refreshData(!0), + this.dispatchExternal( + "dataTreeRowCollapsed", + s.getComponent(), + s.modules.dataTree.index + )); + } + toggleRow(s) { + var t = s.modules.dataTree; + t.children !== !1 && + (t.open + ? this.collapseRow(s) + : this.expandRow(s)); + } + isRowExpanded(s) { + return s.modules.dataTree.open; + } + getTreeParent(s) { + return ( + !!s.modules.dataTree.parent && + s.modules.dataTree.parent.getComponent() + ); + } + getTreeParentRoot(s) { + return s.modules.dataTree && + s.modules.dataTree.parent + ? this.getTreeParentRoot( + s.modules.dataTree.parent + ) + : s; + } + getFilteredTreeChildren(s) { + var t = s.modules.dataTree, + e = []; + return ( + t.children && + (Array.isArray(t.children) || + (t.children = this.generateChildren(s)), + (this.table.modExists("filter") && + this.table.options.dataTreeFilter + ? this.table.modules.filter.filter( + t.children + ) + : t.children + ).forEach((i) => { + i instanceof k && e.push(i); + })), + e + ); + } + rowDeleting(s) { + var t = s.modules.dataTree; + t && + t.children && + Array.isArray(t.children) && + t.children.forEach((e) => { + e instanceof k && e.wipe(); + }); + } + rowDelete(s) { + var t, + e = s.modules.dataTree.parent; + e && + ((t = this.findChildIndex(s, e)) !== !1 && + e.data[this.field].splice(t, 1), + e.data[this.field].length || + delete e.data[this.field], + this.initializeRow(e), + this.layoutRow(e)), + this.refreshData(!0); + } + addTreeChildRow(s, t, e, i) { + var o = !1; + typeof t == "string" && (t = JSON.parse(t)), + Array.isArray(s.data[this.field]) || + ((s.data[this.field] = []), + (s.modules.dataTree.open = this.startOpen( + s.getComponent(), + s.modules.dataTree.index + ))), + i !== void 0 && + (o = this.findChildIndex(i, s)) !== !1 && + s.data[this.field].splice( + e ? o : o + 1, + 0, + t + ), + o === !1 && + (e + ? s.data[this.field].unshift(t) + : s.data[this.field].push(t)), + this.initializeRow(s), + this.layoutRow(s), + this.refreshData(!0); + } + findChildIndex(s, t) { + var e = !1; + return ( + typeof s == "object" + ? s instanceof k + ? (e = s.data) + : s instanceof ht + ? (e = s._getSelf().data) + : typeof HTMLElement < "u" && + s instanceof HTMLElement + ? t.modules.dataTree && + (e = t.modules.dataTree.children.find( + (i) => + i instanceof k && + i.element === s + )) && + (e = e.data) + : s === null && (e = !1) + : (e = + s !== void 0 && + t.data[this.field].find( + (i) => + i.data[ + this.table.options.index + ] == s + )), + e && + (Array.isArray(t.data[this.field]) && + (e = t.data[this.field].indexOf(e)), + e == -1 && (e = !1)), + e + ); + } + getTreeChildren(s, t, e) { + var i = s.modules.dataTree, + o = []; + return ( + i && + i.children && + (Array.isArray(i.children) || + (i.children = this.generateChildren(s)), + i.children.forEach((n) => { + n instanceof k && + (o.push(t ? n.getComponent() : n), + e && + this.getTreeChildren( + n, + t, + e + ).forEach((r) => { + o.push(r); + })); + })), + o + ); + } + getChildField() { + return this.field; + } + redrawNeeded(s) { + return ( + (!!this.field && s[this.field] !== void 0) || + (!!this.elementField && + s[this.elementField] !== void 0) + ); + } + }), + b(Nt, "moduleName", "dataTree"), + Nt), + DownloadModule: Rt, + EditModule: xt, + ExportModule: kt, + FilterModule: Mt, + FormatModule: Lt, + FrozenColumnsModule: + ((Wt = class extends w { + constructor(s) { + super(s), + (this.leftColumns = []), + (this.rightColumns = []), + (this.initializationMode = "left"), + (this.active = !1), + (this.blocked = !0), + this.registerColumnOption("frozen"); + } + reset() { + (this.initializationMode = "left"), + (this.leftColumns = []), + (this.rightColumns = []), + (this.active = !1); + } + initialize() { + this.subscribe( + "cell-layout", + this.layoutCell.bind(this) + ), + this.subscribe( + "column-init", + this.initializeColumn.bind(this) + ), + this.subscribe( + "column-width", + this.layout.bind(this) + ), + this.subscribe( + "row-layout-after", + this.layoutRow.bind(this) + ), + this.subscribe( + "table-layout", + this.layout.bind(this) + ), + this.subscribe( + "columns-loading", + this.reset.bind(this) + ), + this.subscribe( + "column-add", + this.reinitializeColumns.bind(this) + ), + this.subscribe( + "column-deleted", + this.reinitializeColumns.bind(this) + ), + this.subscribe( + "column-hide", + this.reinitializeColumns.bind(this) + ), + this.subscribe( + "column-show", + this.reinitializeColumns.bind(this) + ), + this.subscribe( + "columns-loaded", + this.reinitializeColumns.bind(this) + ), + this.subscribe( + "table-redraw", + this.layout.bind(this) + ), + this.subscribe( + "layout-refreshing", + this.blockLayout.bind(this) + ), + this.subscribe( + "layout-refreshed", + this.unblockLayout.bind(this) + ), + this.subscribe( + "scrollbar-vertical", + this.adjustForScrollbar.bind(this) + ); + } + blockLayout() { + this.blocked = !0; + } + unblockLayout() { + this.blocked = !1; + } + layoutCell(s) { + this.layoutElement(s.element, s.column); + } + reinitializeColumns() { + this.reset(), + this.table.columnManager.columnsByIndex.forEach( + (s) => { + this.initializeColumn(s); + } + ), + this.layout(); + } + initializeColumn(s) { + var t = { margin: 0, edge: !1 }; + s.isGroup || + (this.frozenCheck(s) + ? ((t.position = this.initializationMode), + this.initializationMode == "left" + ? this.leftColumns.push(s) + : this.rightColumns.unshift(s), + (this.active = !0), + (s.modules.frozen = t)) + : (this.initializationMode = "right")); + } + frozenCheck(s) { + return ( + s.parent.isGroup && + s.definition.frozen && + console.warn( + "Frozen Column Error - Parent column group must be frozen, not individual columns or sub column groups" + ), + s.parent.isGroup + ? this.frozenCheck(s.parent) + : s.definition.frozen + ); + } + layoutCalcRows() { + this.table.modExists("columnCalcs") && + (this.table.modules.columnCalcs + .topInitialized && + this.table.modules.columnCalcs.topRow && + this.layoutRow( + this.table.modules.columnCalcs.topRow + ), + this.table.modules.columnCalcs.botInitialized && + this.table.modules.columnCalcs.botRow && + this.layoutRow( + this.table.modules.columnCalcs.botRow + ), + this.table.modExists("groupRows") && + this.layoutGroupCalcs( + this.table.modules.groupRows.getGroups() + )); + } + layoutGroupCalcs(s) { + s.forEach((t) => { + t.calcs.top && this.layoutRow(t.calcs.top), + t.calcs.bottom && + this.layoutRow(t.calcs.bottom), + t.groupList && + t.groupList.length && + this.layoutGroupCalcs(t.groupList); + }); + } + layoutColumnPosition(s) { + var t = [], + e = 0, + i = 0; + this.leftColumns.forEach((o, n) => { + if ( + ((o.modules.frozen.marginValue = e), + (o.modules.frozen.margin = + o.modules.frozen.marginValue + "px"), + o.visible && (e += o.getWidth()), + n == this.leftColumns.length - 1 + ? (o.modules.frozen.edge = !0) + : (o.modules.frozen.edge = !1), + o.parent.isGroup) + ) { + var r = this.getColGroupParentElement(o); + t.includes(r) || + (this.layoutElement(r, o), t.push(r)), + r.classList.toggle( + "tabulator-frozen-left", + o.modules.frozen.edge && + o.modules.frozen.position === + "left" + ), + r.classList.toggle( + "tabulator-frozen-right", + o.modules.frozen.edge && + o.modules.frozen.position === + "right" + ); + } else this.layoutElement(o.getElement(), o); + s && + o.cells.forEach((a) => { + this.layoutElement(a.getElement(!0), o); + }); + }), + this.rightColumns.forEach((o, n) => { + (o.modules.frozen.marginValue = i), + (o.modules.frozen.margin = + o.modules.frozen.marginValue + + "px"), + o.visible && (i += o.getWidth()), + n == this.rightColumns.length - 1 + ? (o.modules.frozen.edge = !0) + : (o.modules.frozen.edge = !1), + o.parent.isGroup + ? this.layoutElement( + this.getColGroupParentElement( + o + ), + o + ) + : this.layoutElement( + o.getElement(), + o + ), + s && + o.cells.forEach((r) => { + this.layoutElement( + r.getElement(!0), + o + ); + }); + }); + } + getColGroupParentElement(s) { + return s.parent.isGroup + ? this.getColGroupParentElement(s.parent) + : s.getElement(); + } + layout() { + this.active && + !this.blocked && + (this.layoutColumnPosition(), + this.reinitializeRows(), + this.layoutCalcRows()); + } + reinitializeRows() { + var s = this.table.rowManager.getVisibleRows(!0); + this.table.rowManager + .getRows() + .filter((t) => !s.includes(t)) + .forEach((t) => { + t.deinitialize(); + }), + s.forEach((t) => { + t.type === "row" && this.layoutRow(t); + }); + } + layoutRow(s) { + this.table.options.layout === "fitDataFill" && + this.rightColumns.length && + (this.table.rowManager.getTableElement().style.minWidth = + "calc(100% - " + this.rightMargin + ")"), + this.leftColumns.forEach((t) => { + var e = s.getCell(t); + e && + this.layoutElement(e.getElement(!0), t); + }), + this.rightColumns.forEach((t) => { + var e = s.getCell(t); + e && + this.layoutElement(e.getElement(!0), t); + }); + } + layoutElement(s, t) { + var e; + t.modules.frozen && + s && + ((s.style.position = "sticky"), + (e = this.table.rtl + ? t.modules.frozen.position === "left" + ? "right" + : "left" + : t.modules.frozen.position), + (s.style[e] = t.modules.frozen.margin), + s.classList.add("tabulator-frozen"), + s.classList.toggle( + "tabulator-frozen-left", + t.modules.frozen.edge && + t.modules.frozen.position === "left" + ), + s.classList.toggle( + "tabulator-frozen-right", + t.modules.frozen.edge && + t.modules.frozen.position === "right" + )); + } + adjustForScrollbar(s) { + this.rightColumns.length && + (this.table.columnManager.getContentsElement().style.width = + "calc(100% - " + s + "px)"); + } + getFrozenColumns() { + return this.leftColumns.concat(this.rightColumns); + } + _calcSpace(s, t) { + var e = 0; + for (let i = 0; i < t; i++) + s[i].visible && (e += s[i].getWidth()); + return e; + } + }), + b(Wt, "moduleName", "frozenColumns"), + Wt), + FrozenRowsModule: + ((jt = class extends w { + constructor(s) { + super(s), + (this.topElement = + document.createElement("div")), + (this.rows = []), + this.registerComponentFunction( + "row", + "freeze", + this.freezeRow.bind(this) + ), + this.registerComponentFunction( + "row", + "unfreeze", + this.unfreezeRow.bind(this) + ), + this.registerComponentFunction( + "row", + "isFrozen", + this.isRowFrozen.bind(this) + ), + this.registerTableOption( + "frozenRowsField", + "id" + ), + this.registerTableOption("frozenRows", !1); + } + initialize() { + var s = document.createDocumentFragment(); + (this.rows = []), + this.topElement.classList.add( + "tabulator-frozen-rows-holder" + ), + s.appendChild(document.createElement("br")), + s.appendChild(this.topElement), + this.table.columnManager + .getContentsElement() + .insertBefore( + s, + this.table.columnManager.headersElement + .nextSibling + ), + this.subscribe( + "row-deleting", + this.detachRow.bind(this) + ), + this.subscribe( + "rows-visible", + this.visibleRows.bind(this) + ), + this.registerDisplayHandler( + this.getRows.bind(this), + 10 + ), + this.table.options.frozenRows && + (this.subscribe( + "data-processed", + this.initializeRows.bind(this) + ), + this.subscribe( + "row-added", + this.initializeRow.bind(this) + ), + this.subscribe( + "table-redrawing", + this.resizeHolderWidth.bind(this) + ), + this.subscribe( + "column-resized", + this.resizeHolderWidth.bind(this) + ), + this.subscribe( + "column-show", + this.resizeHolderWidth.bind(this) + ), + this.subscribe( + "column-hide", + this.resizeHolderWidth.bind(this) + )), + this.resizeHolderWidth(); + } + resizeHolderWidth() { + this.topElement.style.minWidth = + this.table.columnManager.headersElement + .offsetWidth + "px"; + } + initializeRows() { + this.table.rowManager.getRows().forEach((s) => { + this.initializeRow(s); + }); + } + initializeRow(s) { + var t = this.table.options.frozenRows, + e = typeof t; + e === "number" + ? s.getPosition() && + s.getPosition() + this.rows.length <= t && + this.freezeRow(s) + : e === "function" + ? t.call(this.table, s.getComponent()) && + this.freezeRow(s) + : Array.isArray(t) && + t.includes( + s.data[this.options("frozenRowsField")] + ) && + this.freezeRow(s); + } + isRowFrozen(s) { + return this.rows.indexOf(s) > -1; + } + isFrozen() { + return !!this.rows.length; + } + visibleRows(s, t) { + return ( + this.rows.forEach((e) => { + t.push(e); + }), + t + ); + } + getRows(s) { + var t = s.slice(0); + return ( + this.rows.forEach(function (e) { + var i = t.indexOf(e); + i > -1 && t.splice(i, 1); + }), + t + ); + } + freezeRow(s) { + s.modules.frozen + ? console.warn( + "Freeze Error - Row is already frozen" + ) + : ((s.modules.frozen = !0), + this.topElement.appendChild(s.getElement()), + s.initialize(), + s.normalizeHeight(), + this.rows.push(s), + this.refreshData(!1, "display"), + this.table.rowManager.adjustTableSize(), + this.styleRows()); + } + unfreezeRow(s) { + s.modules.frozen + ? ((s.modules.frozen = !1), + this.detachRow(s), + this.table.rowManager.adjustTableSize(), + this.refreshData(!1, "display"), + this.rows.length && this.styleRows()) + : console.warn( + "Freeze Error - Row is already unfrozen" + ); + } + detachRow(s) { + var t = this.rows.indexOf(s); + if (t > -1) { + var e = s.getElement(); + e.parentNode && e.parentNode.removeChild(e), + this.rows.splice(t, 1); + } + } + styleRows(s) { + this.rows.forEach((t, e) => { + this.table.rowManager.styleRow(t, e); + }); + } + }), + b(jt, "moduleName", "frozenRows"), + jt), + GroupRowsModule: + ((Gt = class extends w { + constructor(s) { + super(s), + (this.groupIDLookups = !1), + (this.startOpen = [ + function () { + return !1; + }, + ]), + (this.headerGenerator = [ + function () { + return ""; + }, + ]), + (this.groupList = []), + (this.allowedValues = !1), + (this.groups = {}), + (this.displayHandler = this.getRows.bind(this)), + (this.blockRedraw = !1), + this.registerTableOption("groupBy", !1), + this.registerTableOption("groupStartOpen", !0), + this.registerTableOption("groupValues", !1), + this.registerTableOption( + "groupUpdateOnCellEdit", + !1 + ), + this.registerTableOption("groupHeader", !1), + this.registerTableOption( + "groupHeaderPrint", + null + ), + this.registerTableOption( + "groupHeaderClipboard", + null + ), + this.registerTableOption( + "groupHeaderHtmlOutput", + null + ), + this.registerTableOption( + "groupHeaderDownload", + null + ), + this.registerTableOption( + "groupToggleElement", + "arrow" + ), + this.registerTableOption( + "groupClosedShowCalcs", + !1 + ), + this.registerTableFunction( + "setGroupBy", + this.setGroupBy.bind(this) + ), + this.registerTableFunction( + "setGroupValues", + this.setGroupValues.bind(this) + ), + this.registerTableFunction( + "setGroupStartOpen", + this.setGroupStartOpen.bind(this) + ), + this.registerTableFunction( + "setGroupHeader", + this.setGroupHeader.bind(this) + ), + this.registerTableFunction( + "getGroups", + this.userGetGroups.bind(this) + ), + this.registerTableFunction( + "getGroupedData", + this.userGetGroupedData.bind(this) + ), + this.registerComponentFunction( + "row", + "getGroup", + this.rowGetGroup.bind(this) + ); + } + initialize() { + this.subscribe( + "table-destroy", + this._blockRedrawing.bind(this) + ), + this.subscribe( + "rows-wipe", + this._blockRedrawing.bind(this) + ), + this.subscribe( + "rows-wiped", + this._restore_redrawing.bind(this) + ), + this.table.options.groupBy && + (this.table.options.groupUpdateOnCellEdit && + (this.subscribe( + "cell-value-updated", + this.cellUpdated.bind(this) + ), + this.subscribe( + "row-data-changed", + this.reassignRowToGroup.bind(this), + 0 + )), + this.subscribe( + "table-built", + this.configureGroupSetup.bind(this) + ), + this.subscribe( + "row-deleting", + this.rowDeleting.bind(this) + ), + this.subscribe( + "row-deleted", + this.rowsUpdated.bind(this) + ), + this.subscribe( + "scroll-horizontal", + this.scrollHeaders.bind(this) + ), + this.subscribe( + "rows-wipe", + this.wipe.bind(this) + ), + this.subscribe( + "rows-added", + this.rowsUpdated.bind(this) + ), + this.subscribe( + "row-moving", + this.rowMoving.bind(this) + ), + this.subscribe( + "row-adding-index", + this.rowAddingIndex.bind(this) + ), + this.subscribe( + "rows-sample", + this.rowSample.bind(this) + ), + this.subscribe( + "render-virtual-fill", + this.virtualRenderFill.bind(this) + ), + this.registerDisplayHandler( + this.displayHandler, + 20 + ), + (this.initialized = !0)); + } + _blockRedrawing() { + this.blockRedraw = !0; + } + _restore_redrawing() { + this.blockRedraw = !1; + } + configureGroupSetup() { + if (this.table.options.groupBy) { + var s = this.table.options.groupBy, + t = this.table.options.groupStartOpen, + e = this.table.options.groupHeader; + (this.allowedValues = + this.table.options.groupValues), + Array.isArray(s) && + Array.isArray(e) && + s.length > e.length && + console.warn( + "Error creating group headers, groupHeader array is shorter than groupBy array" + ), + (this.headerGenerator = [ + function () { + return ""; + }, + ]), + (this.startOpen = [ + function () { + return !1; + }, + ]), + this.langBind("groups|item", (i, o) => { + this.headerGenerator[0] = (n, r, a) => + (n === void 0 ? "" : n) + + "(" + + r + + " " + + (r === 1 ? i : o.groups.items) + + ")"; + }), + (this.groupIDLookups = []), + s + ? this.table.modExists("columnCalcs") && + this.table.options.columnCalcs != + "table" && + this.table.options.columnCalcs != + "both" && + this.table.modules.columnCalcs.removeCalcs() + : this.table.modExists("columnCalcs") && + this.table.options.columnCalcs != + "group" && + this.table.columnManager + .getRealColumns() + .forEach((i) => { + i.definition.topCalc && + this.table.modules.columnCalcs.initializeTopRow(), + i.definition.bottomCalc && + this.table.modules.columnCalcs.initializeBottomRow(); + }), + Array.isArray(s) || (s = [s]), + s.forEach((i, o) => { + var n, r; + (n = + typeof i == "function" + ? i + : (r = + this.table.columnManager.getColumnByField( + i + )) + ? function (a) { + return r.getFieldValue(a); + } + : function (a) { + return a[i]; + }), + this.groupIDLookups.push({ + field: + typeof i != "function" && i, + func: n, + values: + !!this.allowedValues && + this.allowedValues[o], + }); + }), + t && + (Array.isArray(t) || (t = [t]), + t.forEach((i) => {}), + (this.startOpen = t)), + e && + (this.headerGenerator = Array.isArray(e) + ? e + : [e]); + } else (this.groupList = []), (this.groups = {}); + } + rowSample(s, t) { + if (this.table.options.groupBy) { + var e = this.getGroups(!1)[0]; + t.push(e.getRows(!1)[0]); + } + return t; + } + virtualRenderFill() { + var s = this.table.rowManager.tableElement, + t = this.table.rowManager.getVisibleRows(); + if (!this.table.options.groupBy) return t; + (t = t.filter((e) => e.type !== "group")), + (s.style.minWidth = t.length + ? "" + : this.table.columnManager.getWidth() + + "px"); + } + rowAddingIndex(s, t, e) { + if (this.table.options.groupBy) { + this.assignRowToGroup(s); + var i = s.modules.group.rows; + return ( + i.length > 1 && + (!t || (t && i.indexOf(t) == -1) + ? e + ? i[0] !== s && + ((t = i[0]), + this.table.rowManager.moveRowInArray( + s.modules.group.rows, + s, + t, + !e + )) + : i[i.length - 1] !== s && + ((t = i[i.length - 1]), + this.table.rowManager.moveRowInArray( + s.modules.group.rows, + s, + t, + !e + )) + : this.table.rowManager.moveRowInArray( + s.modules.group.rows, + s, + t, + !e + )), + t + ); + } + } + trackChanges() { + this.dispatch("group-changed"); + } + setGroupBy(s) { + (this.table.options.groupBy = s), + this.initialized || this.initialize(), + this.configureGroupSetup(), + !s && + this.table.modExists("columnCalcs") && + this.table.options.columnCalcs === !0 && + this.table.modules.columnCalcs.reinitializeCalcs(), + this.refreshData(), + this.trackChanges(); + } + setGroupValues(s) { + (this.table.options.groupValues = s), + this.configureGroupSetup(), + this.refreshData(), + this.trackChanges(); + } + setGroupStartOpen(s) { + (this.table.options.groupStartOpen = s), + this.configureGroupSetup(), + this.table.options.groupBy + ? (this.refreshData(), this.trackChanges()) + : console.warn( + "Grouping Update - cant refresh view, no groups have been set" + ); + } + setGroupHeader(s) { + (this.table.options.groupHeader = s), + this.configureGroupSetup(), + this.table.options.groupBy + ? (this.refreshData(), this.trackChanges()) + : console.warn( + "Grouping Update - cant refresh view, no groups have been set" + ); + } + userGetGroups(s) { + return this.getGroups(!0); + } + userGetGroupedData() { + return this.table.options.groupBy + ? this.getGroupedData() + : this.getData(); + } + rowGetGroup(s) { + return ( + !!s.modules.group && + s.modules.group.getComponent() + ); + } + rowMoving(s, t, e) { + if (this.table.options.groupBy) { + !e && + t instanceof K && + (t = + this.table.rowManager.prevDisplayRow( + s + ) || t); + var i = t instanceof K ? t : t.modules.group, + o = s instanceof K ? s : s.modules.group; + i === o + ? this.table.rowManager.moveRowInArray( + i.rows, + s, + t, + e + ) + : (o && o.removeRow(s), + i.insertRow(s, t, e)); + } + } + rowDeleting(s) { + this.table.options.groupBy && + s.modules.group && + s.modules.group.removeRow(s); + } + rowsUpdated(s) { + this.table.options.groupBy && + this.updateGroupRows(!0); + } + cellUpdated(s) { + this.table.options.groupBy && + this.reassignRowToGroup(s.row); + } + getRows(s) { + return this.table.options.groupBy && + this.groupIDLookups.length + ? (this.dispatchExternal("dataGrouping"), + this.generateGroups(s), + this.subscribedExternal("dataGrouped") && + this.dispatchExternal( + "dataGrouped", + this.getGroups(!0) + ), + this.updateGroupRows()) + : s.slice(0); + } + getGroups(s) { + var t = []; + return ( + this.groupList.forEach(function (e) { + t.push(s ? e.getComponent() : e); + }), + t + ); + } + getChildGroups(s) { + var t = []; + return ( + s || (s = this), + s.groupList.forEach((e) => { + e.groupList.length + ? (t = t.concat(this.getChildGroups(e))) + : t.push(e); + }), + t + ); + } + wipe() { + this.table.options.groupBy && + (this.groupList.forEach(function (s) { + s.wipe(); + }), + (this.groupList = []), + (this.groups = {})); + } + pullGroupListData(s) { + var t = []; + return ( + s.forEach((e) => { + var i = { + level: 0, + rowCount: 0, + headerContent: "", + }, + o = []; + e.hasSubGroups + ? ((o = this.pullGroupListData( + e.groupList + )), + (i.level = e.level), + (i.rowCount = + o.length - e.groupList.length), + (i.headerContent = e.generator( + e.key, + i.rowCount, + e.rows, + e + )), + t.push(i), + (t = t.concat(o))) + : ((i.level = e.level), + (i.headerContent = e.generator( + e.key, + e.rows.length, + e.rows, + e + )), + (i.rowCount = e.getRows().length), + t.push(i), + e.getRows().forEach((n) => { + t.push(n.getData("data")); + })); + }), + t + ); + } + getGroupedData() { + return this.pullGroupListData(this.groupList); + } + getRowGroup(s) { + var t = !1; + return ( + this.options("dataTree") && + (s = + this.table.modules.dataTree.getTreeParentRoot( + s + )), + this.groupList.forEach((e) => { + var i = e.getRowGroup(s); + i && (t = i); + }), + t + ); + } + countGroups() { + return this.groupList.length; + } + generateGroups(s) { + var t = this.groups; + (this.groups = {}), + (this.groupList = []), + this.allowedValues && this.allowedValues[0] + ? (this.allowedValues[0].forEach((e) => { + this.createGroup(e, 0, t); + }), + s.forEach((e) => { + this.assignRowToExistingGroup(e, t); + })) + : s.forEach((e) => { + this.assignRowToGroup(e, t); + }), + Object.values(t).forEach((e) => { + e.wipe(!0); + }); + } + createGroup(s, t, e) { + var i, + o = t + "_" + s; + (e = e || []), + (i = new K( + this, + !1, + t, + s, + this.groupIDLookups[0].field, + this.headerGenerator[0], + e[o] + )), + (this.groups[o] = i), + this.groupList.push(i); + } + assignRowToExistingGroup(s, t) { + var e = + "0_" + this.groupIDLookups[0].func(s.getData()); + this.groups[e] && this.groups[e].addRow(s); + } + assignRowToGroup(s, t) { + var e = this.groupIDLookups[0].func(s.getData()), + i = !this.groups["0_" + e]; + return ( + i && this.createGroup(e, 0, t), + this.groups["0_" + e].addRow(s), + !i + ); + } + reassignRowToGroup(s) { + if (s.type === "row") { + var t = s.modules.group, + e = t.getPath(), + i = this.getExpectedPath(s); + (e.length == i.length && + e.every((o, n) => o === i[n])) || + (t.removeRow(s), + this.assignRowToGroup(s, this.groups), + this.refreshData(!0)); + } + } + getExpectedPath(s) { + var t = [], + e = s.getData(); + return ( + this.groupIDLookups.forEach((i) => { + t.push(i.func(e)); + }), + t + ); + } + updateGroupRows(s) { + var t = []; + return ( + this.blockRedraw || + (this.groupList.forEach((e) => { + t = t.concat(e.getHeadersAndRows()); + }), + s && this.refreshData(!0)), + t + ); + } + scrollHeaders(s) { + this.table.options.groupBy && + (this.table.options.renderHorizontal === + "virtual" && + (s -= + this.table.columnManager.renderer + .vDomPadLeft), + (s += "px"), + this.groupList.forEach((t) => { + t.scrollHeader(s); + })); + } + removeGroup(s) { + var t, + e = s.level + "_" + s.key; + this.groups[e] && + (delete this.groups[e], + (t = this.groupList.indexOf(s)) > -1 && + this.groupList.splice(t, 1)); + } + checkBasicModeGroupHeaderWidth() { + var s = this.table.rowManager.tableElement, + t = !0; + this.table.rowManager + .getDisplayRows() + .forEach((e, i) => { + this.table.rowManager.styleRow(e, i), + s.appendChild(e.getElement()), + e.initialize(!0), + e.type !== "group" && (t = !1); + }), + (s.style.minWidth = t + ? this.table.columnManager.getWidth() + "px" + : ""); + } + }), + b(Gt, "moduleName", "groupRows"), + Gt), + HistoryModule: St, + HtmlTableImportModule: + ((Ut = class extends w { + constructor(s) { + super(s), + (this.fieldIndex = []), + (this.hasIndex = !1); + } + initialize() { + this.tableElementCheck(); + } + tableElementCheck() { + this.table.originalElement && + this.table.originalElement.tagName === + "TABLE" && + (this.table.originalElement.childNodes.length + ? this.parseTable() + : console.warn( + "Unable to parse data from empty table tag, Tabulator should be initialized on a div tag unless importing data from a table element." + )); + } + parseTable() { + var s = this.table.originalElement, + t = this.table.options, + e = s.getElementsByTagName("th"), + i = s.getElementsByTagName("tbody")[0], + o = []; + (this.hasIndex = !1), + this.dispatchExternal("htmlImporting"), + (i = i ? i.getElementsByTagName("tr") : []), + this._extractOptions(s, t), + e.length + ? this._extractHeaders(e, i) + : this._generateBlankHeaders(e, i); + for (var n = 0; n < i.length; n++) { + var r = i[n].getElementsByTagName("td"), + a = {}; + this.hasIndex || (a[t.index] = n); + for (var l = 0; l < r.length; l++) { + var h = r[l]; + this.fieldIndex[l] !== void 0 && + (a[this.fieldIndex[l]] = h.innerHTML); + } + o.push(a); + } + (t.data = o), this.dispatchExternal("htmlImported"); + } + _extractOptions(s, t, e) { + var i = s.attributes, + o = Object.keys(e || t), + n = {}; + for (var r in (o.forEach((h) => { + n[h.toLowerCase()] = h; + }), + i)) { + var a, + l = i[r]; + l && + typeof l == "object" && + l.name && + l.name.indexOf("tabulator-") === 0 && + ((a = l.name.replace("tabulator-", "")), + n[a] !== void 0 && + (t[n[a]] = this._attribValue(l.value))); + } + } + _attribValue(s) { + return s === "true" || (s !== "false" && s); + } + _findCol(s) { + return ( + this.table.options.columns.find( + (t) => t.title === s + ) || !1 + ); + } + _extractHeaders(s, t) { + for (var e = 0; e < s.length; e++) { + var i, + o = s[e], + n = !1, + r = this._findCol(o.textContent); + r + ? (n = !0) + : (r = { title: o.textContent.trim() }), + r.field || + (r.field = o.textContent + .trim() + .toLowerCase() + .replaceAll(" ", "_")), + (i = o.getAttribute("width")) && + !r.width && + (r.width = i), + this._extractOptions( + o, + r, + this.table.columnManager.optionsList + .registeredDefaults + ), + (this.fieldIndex[e] = r.field), + r.field == this.table.options.index && + (this.hasIndex = !0), + n || this.table.options.columns.push(r); + } + } + _generateBlankHeaders(s, t) { + for (var e = 0; e < s.length; e++) { + var i = s[e], + o = { title: "", field: "col" + e }; + this.fieldIndex[e] = o.field; + var n = i.getAttribute("width"); + n && (o.width = n), + this.table.options.columns.push(o); + } + } + }), + b(Ut, "moduleName", "htmlTableImport"), + Ut), + ImportModule: Dt, + InteractionModule: + ((Jt = class extends w { + constructor(s) { + super(s), + (this.eventMap = { + rowClick: "row-click", + rowDblClick: "row-dblclick", + rowContext: "row-contextmenu", + rowMouseEnter: "row-mouseenter", + rowMouseLeave: "row-mouseleave", + rowMouseOver: "row-mouseover", + rowMouseOut: "row-mouseout", + rowMouseMove: "row-mousemove", + rowMouseDown: "row-mousedown", + rowMouseUp: "row-mouseup", + rowTap: "row", + rowDblTap: "row", + rowTapHold: "row", + cellClick: "cell-click", + cellDblClick: "cell-dblclick", + cellContext: "cell-contextmenu", + cellMouseEnter: "cell-mouseenter", + cellMouseLeave: "cell-mouseleave", + cellMouseOver: "cell-mouseover", + cellMouseOut: "cell-mouseout", + cellMouseMove: "cell-mousemove", + cellMouseDown: "cell-mousedown", + cellMouseUp: "cell-mouseup", + cellTap: "cell", + cellDblTap: "cell", + cellTapHold: "cell", + headerClick: "column-click", + headerDblClick: "column-dblclick", + headerContext: "column-contextmenu", + headerMouseEnter: "column-mouseenter", + headerMouseLeave: "column-mouseleave", + headerMouseOver: "column-mouseover", + headerMouseOut: "column-mouseout", + headerMouseMove: "column-mousemove", + headerMouseDown: "column-mousedown", + headerMouseUp: "column-mouseup", + headerTap: "column", + headerDblTap: "column", + headerTapHold: "column", + groupClick: "group-click", + groupDblClick: "group-dblclick", + groupContext: "group-contextmenu", + groupMouseEnter: "group-mouseenter", + groupMouseLeave: "group-mouseleave", + groupMouseOver: "group-mouseover", + groupMouseOut: "group-mouseout", + groupMouseMove: "group-mousemove", + groupMouseDown: "group-mousedown", + groupMouseUp: "group-mouseup", + groupTap: "group", + groupDblTap: "group", + groupTapHold: "group", + }), + (this.subscribers = {}), + (this.touchSubscribers = {}), + (this.columnSubscribers = {}), + (this.touchWatchers = { + row: { + tap: null, + tapDbl: null, + tapHold: null, + }, + cell: { + tap: null, + tapDbl: null, + tapHold: null, + }, + column: { + tap: null, + tapDbl: null, + tapHold: null, + }, + group: { + tap: null, + tapDbl: null, + tapHold: null, + }, + }), + this.registerColumnOption("headerClick"), + this.registerColumnOption("headerDblClick"), + this.registerColumnOption("headerContext"), + this.registerColumnOption("headerMouseEnter"), + this.registerColumnOption("headerMouseLeave"), + this.registerColumnOption("headerMouseOver"), + this.registerColumnOption("headerMouseOut"), + this.registerColumnOption("headerMouseMove"), + this.registerColumnOption("headerMouseDown"), + this.registerColumnOption("headerMouseUp"), + this.registerColumnOption("headerTap"), + this.registerColumnOption("headerDblTap"), + this.registerColumnOption("headerTapHold"), + this.registerColumnOption("cellClick"), + this.registerColumnOption("cellDblClick"), + this.registerColumnOption("cellContext"), + this.registerColumnOption("cellMouseEnter"), + this.registerColumnOption("cellMouseLeave"), + this.registerColumnOption("cellMouseOver"), + this.registerColumnOption("cellMouseOut"), + this.registerColumnOption("cellMouseMove"), + this.registerColumnOption("cellMouseDown"), + this.registerColumnOption("cellMouseUp"), + this.registerColumnOption("cellTap"), + this.registerColumnOption("cellDblTap"), + this.registerColumnOption("cellTapHold"); + } + initialize() { + this.initializeExternalEvents(), + this.subscribe( + "column-init", + this.initializeColumn.bind(this) + ), + this.subscribe( + "cell-dblclick", + this.cellContentsSelectionFixer.bind(this) + ), + this.subscribe( + "scroll-horizontal", + this.clearTouchWatchers.bind(this) + ), + this.subscribe( + "scroll-vertical", + this.clearTouchWatchers.bind(this) + ); + } + clearTouchWatchers() { + Object.values(this.touchWatchers).forEach((s) => { + for (let t in s) s[t] = null; + }); + } + cellContentsSelectionFixer(s, t) { + var e; + if ( + !this.table.modExists("edit") || + this.table.modules.edit.currentCell !== t + ) { + s.preventDefault(); + try { + document.selection + ? ((e = + document.body.createTextRange()).moveToElementText( + t.getElement() + ), + e.select()) + : window.getSelection && + ((e = + document.createRange()).selectNode( + t.getElement() + ), + window + .getSelection() + .removeAllRanges(), + window.getSelection().addRange(e)); + } catch {} + } + } + initializeExternalEvents() { + for (let s in this.eventMap) + this.subscriptionChangeExternal( + s, + this.subscriptionChanged.bind(this, s) + ); + } + subscriptionChanged(s, t) { + t + ? this.subscribers[s] || + (this.eventMap[s].includes("-") + ? ((this.subscribers[s] = + this.handle.bind(this, s)), + this.subscribe( + this.eventMap[s], + this.subscribers[s] + )) + : this.subscribeTouchEvents(s)) + : this.eventMap[s].includes("-") + ? !this.subscribers[s] || + this.columnSubscribers[s] || + this.subscribedExternal(s) || + (this.unsubscribe( + this.eventMap[s], + this.subscribers[s] + ), + delete this.subscribers[s]) + : this.unsubscribeTouchEvents(s); + } + subscribeTouchEvents(s) { + var t = this.eventMap[s]; + this.touchSubscribers[t + "-touchstart"] || + ((this.touchSubscribers[t + "-touchstart"] = + this.handleTouch.bind(this, t, "start")), + (this.touchSubscribers[t + "-touchend"] = + this.handleTouch.bind(this, t, "end")), + this.subscribe( + t + "-touchstart", + this.touchSubscribers[t + "-touchstart"] + ), + this.subscribe( + t + "-touchend", + this.touchSubscribers[t + "-touchend"] + )), + (this.subscribers[s] = !0); + } + unsubscribeTouchEvents(s) { + var t = !0, + e = this.eventMap[s]; + if ( + this.subscribers[s] && + !this.subscribedExternal(s) + ) { + delete this.subscribers[s]; + for (let i in this.eventMap) + this.eventMap[i] === e && + this.subscribers[i] && + (t = !1); + t && + (this.unsubscribe( + e + "-touchstart", + this.touchSubscribers[e + "-touchstart"] + ), + this.unsubscribe( + e + "-touchend", + this.touchSubscribers[e + "-touchend"] + ), + delete this.touchSubscribers[ + e + "-touchstart" + ], + delete this.touchSubscribers[ + e + "-touchend" + ]); + } + } + initializeColumn(s) { + var t = s.definition; + for (let e in this.eventMap) + t[e] && + (this.subscriptionChanged(e, !0), + this.columnSubscribers[e] || + (this.columnSubscribers[e] = []), + this.columnSubscribers[e].push(s)); + } + handle(s, t, e) { + this.dispatchEvent(s, t, e); + } + handleTouch(s, t, e, i) { + var o = this.touchWatchers[s]; + switch ((s === "column" && (s = "header"), t)) { + case "start": + (o.tap = !0), + clearTimeout(o.tapHold), + (o.tapHold = setTimeout(() => { + clearTimeout(o.tapHold), + (o.tapHold = null), + (o.tap = null), + clearTimeout(o.tapDbl), + (o.tapDbl = null), + this.dispatchEvent( + s + "TapHold", + e, + i + ); + }, 1e3)); + break; + case "end": + o.tap && + ((o.tap = null), + this.dispatchEvent(s + "Tap", e, i)), + o.tapDbl + ? (clearTimeout(o.tapDbl), + (o.tapDbl = null), + this.dispatchEvent( + s + "DblTap", + e, + i + )) + : (o.tapDbl = setTimeout(() => { + clearTimeout(o.tapDbl), + (o.tapDbl = null); + }, 300)), + clearTimeout(o.tapHold), + (o.tapHold = null); + } + } + dispatchEvent(s, t, e) { + var i, + o = e.getComponent(); + this.columnSubscribers[s] && + (e instanceof et + ? (i = e.column.definition[s]) + : e instanceof G && (i = e.definition[s]), + i && i(t, o)), + this.dispatchExternal(s, t, o); + } + }), + b(Jt, "moduleName", "interaction"), + Jt), + KeybindingsModule: zt, + MenuModule: + ((qt = class extends w { + constructor(s) { + super(s), + (this.menuContainer = null), + (this.nestedMenuBlock = !1), + (this.currentComponent = null), + (this.rootPopup = null), + (this.columnSubscribers = {}), + this.registerTableOption("rowContextMenu", !1), + this.registerTableOption("rowClickMenu", !1), + this.registerTableOption("rowDblClickMenu", !1), + this.registerTableOption( + "groupContextMenu", + !1 + ), + this.registerTableOption("groupClickMenu", !1), + this.registerTableOption( + "groupDblClickMenu", + !1 + ), + this.registerColumnOption("headerContextMenu"), + this.registerColumnOption("headerClickMenu"), + this.registerColumnOption("headerDblClickMenu"), + this.registerColumnOption("headerMenu"), + this.registerColumnOption("headerMenuIcon"), + this.registerColumnOption("contextMenu"), + this.registerColumnOption("clickMenu"), + this.registerColumnOption("dblClickMenu"); + } + initialize() { + this.deprecatedOptionsCheck(), + this.initializeRowWatchers(), + this.initializeGroupWatchers(), + this.subscribe( + "column-init", + this.initializeColumn.bind(this) + ); + } + deprecatedOptionsCheck() {} + initializeRowWatchers() { + this.table.options.rowContextMenu && + (this.subscribe( + "row-contextmenu", + this.loadMenuEvent.bind( + this, + this.table.options.rowContextMenu + ) + ), + this.table.on( + "rowTapHold", + this.loadMenuEvent.bind( + this, + this.table.options.rowContextMenu + ) + )), + this.table.options.rowClickMenu && + this.subscribe( + "row-click", + this.loadMenuEvent.bind( + this, + this.table.options.rowClickMenu + ) + ), + this.table.options.rowDblClickMenu && + this.subscribe( + "row-dblclick", + this.loadMenuEvent.bind( + this, + this.table.options.rowDblClickMenu + ) + ); + } + initializeGroupWatchers() { + this.table.options.groupContextMenu && + (this.subscribe( + "group-contextmenu", + this.loadMenuEvent.bind( + this, + this.table.options.groupContextMenu + ) + ), + this.table.on( + "groupTapHold", + this.loadMenuEvent.bind( + this, + this.table.options.groupContextMenu + ) + )), + this.table.options.groupClickMenu && + this.subscribe( + "group-click", + this.loadMenuEvent.bind( + this, + this.table.options.groupClickMenu + ) + ), + this.table.options.groupDblClickMenu && + this.subscribe( + "group-dblclick", + this.loadMenuEvent.bind( + this, + this.table.options.groupDblClickMenu + ) + ); + } + initializeColumn(s) { + var t = s.definition; + t.headerContextMenu && + !this.columnSubscribers.headerContextMenu && + ((this.columnSubscribers.headerContextMenu = + this.loadMenuTableColumnEvent.bind( + this, + "headerContextMenu" + )), + this.subscribe( + "column-contextmenu", + this.columnSubscribers.headerContextMenu + ), + this.table.on( + "headerTapHold", + this.loadMenuTableColumnEvent.bind( + this, + "headerContextMenu" + ) + )), + t.headerClickMenu && + !this.columnSubscribers.headerClickMenu && + ((this.columnSubscribers.headerClickMenu = + this.loadMenuTableColumnEvent.bind( + this, + "headerClickMenu" + )), + this.subscribe( + "column-click", + this.columnSubscribers.headerClickMenu + )), + t.headerDblClickMenu && + !this.columnSubscribers + .headerDblClickMenu && + ((this.columnSubscribers.headerDblClickMenu = + this.loadMenuTableColumnEvent.bind( + this, + "headerDblClickMenu" + )), + this.subscribe( + "column-dblclick", + this.columnSubscribers + .headerDblClickMenu + )), + t.headerMenu && + this.initializeColumnHeaderMenu(s), + t.contextMenu && + !this.columnSubscribers.contextMenu && + ((this.columnSubscribers.contextMenu = + this.loadMenuTableCellEvent.bind( + this, + "contextMenu" + )), + this.subscribe( + "cell-contextmenu", + this.columnSubscribers.contextMenu + ), + this.table.on( + "cellTapHold", + this.loadMenuTableCellEvent.bind( + this, + "contextMenu" + ) + )), + t.clickMenu && + !this.columnSubscribers.clickMenu && + ((this.columnSubscribers.clickMenu = + this.loadMenuTableCellEvent.bind( + this, + "clickMenu" + )), + this.subscribe( + "cell-click", + this.columnSubscribers.clickMenu + )), + t.dblClickMenu && + !this.columnSubscribers.dblClickMenu && + ((this.columnSubscribers.dblClickMenu = + this.loadMenuTableCellEvent.bind( + this, + "dblClickMenu" + )), + this.subscribe( + "cell-dblclick", + this.columnSubscribers.dblClickMenu + )); + } + initializeColumnHeaderMenu(s) { + var t, + e = s.definition.headerMenuIcon; + (t = document.createElement("span")).classList.add( + "tabulator-header-popup-button" + ), + e + ? (typeof e == "function" && + (e = e(s.getComponent())), + e instanceof HTMLElement + ? t.appendChild(e) + : (t.innerHTML = e)) + : (t.innerHTML = "⋮"), + t.addEventListener("click", (i) => { + i.stopPropagation(), + i.preventDefault(), + this.loadMenuEvent( + s.definition.headerMenu, + i, + s + ); + }), + s.titleElement.insertBefore( + t, + s.titleElement.firstChild + ); + } + loadMenuTableCellEvent(s, t, e) { + e._cell && (e = e._cell), + e.column.definition[s] && + this.loadMenuEvent( + e.column.definition[s], + t, + e + ); + } + loadMenuTableColumnEvent(s, t, e) { + e._column && (e = e._column), + e.definition[s] && + this.loadMenuEvent(e.definition[s], t, e); + } + loadMenuEvent(s, t, e) { + e._group ? (e = e._group) : e._row && (e = e._row), + (s = + typeof s == "function" + ? s.call( + this.table, + t, + e.getComponent() + ) + : s), + this.loadMenu(t, e, s); + } + loadMenu(s, t, e, i, o) { + var n, + r = !(s instanceof MouseEvent), + a = document.createElement("div"); + if ( + (a.classList.add("tabulator-menu"), + r || s.preventDefault(), + e && e.length) + ) { + if (i) n = o.child(a); + else { + if (this.nestedMenuBlock) { + if (this.rootPopup) return; + } else + this.nestedMenuBlock = setTimeout( + () => { + this.nestedMenuBlock = !1; + }, + 100 + ); + this.rootPopup && this.rootPopup.hide(), + (this.rootPopup = n = this.popup(a)); + } + e.forEach((l) => { + var h = document.createElement("div"), + d = l.label, + c = l.disabled; + l.separator + ? h.classList.add( + "tabulator-menu-separator" + ) + : (h.classList.add( + "tabulator-menu-item" + ), + typeof d == "function" && + (d = d.call( + this.table, + t.getComponent() + )), + d instanceof Node + ? h.appendChild(d) + : (h.innerHTML = d), + typeof c == "function" && + (c = c.call( + this.table, + t.getComponent() + )), + c + ? (h.classList.add( + "tabulator-menu-item-disabled" + ), + h.addEventListener( + "click", + (u) => { + u.stopPropagation(); + } + )) + : l.menu && l.menu.length + ? h.addEventListener( + "click", + (u) => { + u.stopPropagation(), + this.loadMenu( + u, + t, + l.menu, + h, + n + ); + } + ) + : l.action && + h.addEventListener( + "click", + (u) => { + l.action( + u, + t.getComponent() + ); + } + ), + l.menu && + l.menu.length && + h.classList.add( + "tabulator-menu-item-submenu" + )), + a.appendChild(h); + }), + a.addEventListener("click", (l) => { + this.rootPopup && this.rootPopup.hide(); + }), + n.show(i || s), + n === this.rootPopup && + (this.rootPopup.hideOnBlur(() => { + (this.rootPopup = null), + this.currentComponent && + (this.dispatch( + "menu-closed", + e, + n + ), + this.dispatchExternal( + "menuClosed", + this.currentComponent.getComponent() + ), + (this.currentComponent = + null)); + }), + (this.currentComponent = t), + this.dispatch("menu-opened", e, n), + this.dispatchExternal( + "menuOpened", + t.getComponent() + )); + } + } + }), + b(qt, "moduleName", "menu"), + qt), + MoveColumnsModule: + ((Xt = class extends w { + constructor(s) { + super(s), + (this.placeholderElement = + this.createPlaceholderElement()), + (this.hoverElement = !1), + (this.checkTimeout = !1), + (this.checkPeriod = 250), + (this.moving = !1), + (this.toCol = !1), + (this.toColAfter = !1), + (this.startX = 0), + (this.autoScrollMargin = 40), + (this.autoScrollStep = 5), + (this.autoScrollTimeout = !1), + (this.touchMove = !1), + (this.moveHover = this.moveHover.bind(this)), + (this.endMove = this.endMove.bind(this)), + this.registerTableOption("movableColumns", !1); + } + createPlaceholderElement() { + var s = document.createElement("div"); + return ( + s.classList.add("tabulator-col"), + s.classList.add("tabulator-col-placeholder"), + s + ); + } + initialize() { + this.table.options.movableColumns && + (this.subscribe( + "column-init", + this.initializeColumn.bind(this) + ), + this.subscribe( + "alert-show", + this.abortMove.bind(this) + )); + } + abortMove() { + clearTimeout(this.checkTimeout); + } + initializeColumn(s) { + var t, + e = this, + i = {}; + s.modules.frozen || + s.isGroup || + s.isRowHeader || + ((t = s.getElement()), + (i.mousemove = function (o) { + s.parent === e.moving.parent && + ((e.touchMove + ? o.touches[0].pageX + : o.pageX) - + x.elOffset(t).left + + e.table.columnManager + .contentsElement.scrollLeft > + s.getWidth() / 2 + ? (e.toCol === s && e.toColAfter) || + (t.parentNode.insertBefore( + e.placeholderElement, + t.nextSibling + ), + e.moveColumn(s, !0)) + : (e.toCol !== s || e.toColAfter) && + (t.parentNode.insertBefore( + e.placeholderElement, + t + ), + e.moveColumn(s, !1))); + }.bind(e)), + t.addEventListener("mousedown", function (o) { + (e.touchMove = !1), + o.which === 1 && + (e.checkTimeout = setTimeout( + function () { + e.startMove(o, s); + }, + e.checkPeriod + )); + }), + t.addEventListener("mouseup", function (o) { + o.which === 1 && + e.checkTimeout && + clearTimeout(e.checkTimeout); + }), + e.bindTouchEvents(s)), + (s.modules.moveColumn = i); + } + bindTouchEvents(s) { + var t, + e, + i, + o, + n, + r, + a = s.getElement(), + l = !1; + a.addEventListener( + "touchstart", + (h) => { + this.checkTimeout = setTimeout(() => { + (this.touchMove = !0), + (t = s.nextColumn()), + (i = t ? t.getWidth() / 2 : 0), + (e = s.prevColumn()), + (o = e ? e.getWidth() / 2 : 0), + (n = 0), + (r = 0), + (l = !1), + this.startMove(h, s); + }, this.checkPeriod); + }, + { passive: !0 } + ), + a.addEventListener( + "touchmove", + (h) => { + var d, c; + this.moving && + (this.moveHover(h), + l || (l = h.touches[0].pageX), + (d = h.touches[0].pageX - l) > 0 + ? t && + d - n > i && + (c = t) !== s && + ((l = h.touches[0].pageX), + c + .getElement() + .parentNode.insertBefore( + this + .placeholderElement, + c.getElement() + .nextSibling + ), + this.moveColumn(c, !0)) + : e && + -d - r > o && + (c = e) !== s && + ((l = h.touches[0].pageX), + c + .getElement() + .parentNode.insertBefore( + this + .placeholderElement, + c.getElement() + ), + this.moveColumn(c, !1)), + c && + ((t = c.nextColumn()), + (n = i), + (i = t ? t.getWidth() / 2 : 0), + (e = c.prevColumn()), + (r = o), + (o = e + ? e.getWidth() / 2 + : 0))); + }, + { passive: !0 } + ), + a.addEventListener("touchend", (h) => { + this.checkTimeout && + clearTimeout(this.checkTimeout), + this.moving && this.endMove(h); + }); + } + startMove(s, t) { + var e = t.getElement(), + i = + this.table.columnManager.getContentsElement(), + o = + this.table.columnManager.getHeadersElement(); + (this.table.modules.selectRange && + this.table.modules.selectRange + .columnSelection && + this.table.modules.selectRange.mousedown && + this.table.modules.selectRange.selecting === + "column") || + ((this.moving = t), + (this.startX = + (this.touchMove + ? s.touches[0].pageX + : s.pageX) - x.elOffset(e).left), + this.table.element.classList.add( + "tabulator-block-select" + ), + (this.placeholderElement.style.width = + t.getWidth() + "px"), + (this.placeholderElement.style.height = + t.getHeight() + "px"), + e.parentNode.insertBefore( + this.placeholderElement, + e + ), + e.parentNode.removeChild(e), + (this.hoverElement = e.cloneNode(!0)), + this.hoverElement.classList.add( + "tabulator-moving" + ), + i.appendChild(this.hoverElement), + (this.hoverElement.style.left = "0"), + (this.hoverElement.style.bottom = + i.clientHeight - o.offsetHeight + "px"), + this.touchMove || + (this._bindMouseMove(), + document.body.addEventListener( + "mousemove", + this.moveHover + ), + document.body.addEventListener( + "mouseup", + this.endMove + )), + this.moveHover(s), + this.dispatch("column-moving", s, this.moving)); + } + _bindMouseMove() { + this.table.columnManager.columnsByIndex.forEach( + function (s) { + s.modules.moveColumn.mousemove && + s + .getElement() + .addEventListener( + "mousemove", + s.modules.moveColumn.mousemove + ); + } + ); + } + _unbindMouseMove() { + this.table.columnManager.columnsByIndex.forEach( + function (s) { + s.modules.moveColumn.mousemove && + s + .getElement() + .removeEventListener( + "mousemove", + s.modules.moveColumn.mousemove + ); + } + ); + } + moveColumn(s, t) { + var e = this.moving.getCells(); + (this.toCol = s), + (this.toColAfter = t), + t + ? s.getCells().forEach(function (i, o) { + var n = i.getElement(!0); + n.parentNode && + e[o] && + n.parentNode.insertBefore( + e[o].getElement(), + n.nextSibling + ); + }) + : s.getCells().forEach(function (i, o) { + var n = i.getElement(!0); + n.parentNode && + e[o] && + n.parentNode.insertBefore( + e[o].getElement(), + n + ); + }); + } + endMove(s) { + (s.which === 1 || this.touchMove) && + (this._unbindMouseMove(), + this.placeholderElement.parentNode.insertBefore( + this.moving.getElement(), + this.placeholderElement.nextSibling + ), + this.placeholderElement.parentNode.removeChild( + this.placeholderElement + ), + this.hoverElement.parentNode.removeChild( + this.hoverElement + ), + this.table.element.classList.remove( + "tabulator-block-select" + ), + this.toCol && + this.table.columnManager.moveColumnActual( + this.moving, + this.toCol, + this.toColAfter + ), + (this.moving = !1), + (this.toCol = !1), + (this.toColAfter = !1), + this.touchMove || + (document.body.removeEventListener( + "mousemove", + this.moveHover + ), + document.body.removeEventListener( + "mouseup", + this.endMove + ))); + } + moveHover(s) { + var t, + e = + this.table.columnManager.getContentsElement(), + i = e.scrollLeft, + o = + (this.touchMove + ? s.touches[0].pageX + : s.pageX) - + x.elOffset(e).left + + i; + (this.hoverElement.style.left = + o - this.startX + "px"), + o - i < this.autoScrollMargin && + (this.autoScrollTimeout || + (this.autoScrollTimeout = setTimeout( + () => { + (t = Math.max(0, i - 5)), + (this.table.rowManager.getElement().scrollLeft = + t), + (this.autoScrollTimeout = + !1); + }, + 1 + ))), + i + e.clientWidth - o < this.autoScrollMargin && + (this.autoScrollTimeout || + (this.autoScrollTimeout = setTimeout( + () => { + (t = Math.min( + e.clientWidth, + i + 5 + )), + (this.table.rowManager.getElement().scrollLeft = + t), + (this.autoScrollTimeout = + !1); + }, + 1 + ))); + } + }), + b(Xt, "moduleName", "moveColumn"), + Xt), + MoveRowsModule: Pt, + MutatorModule: Ft, + PageModule: Ht, + PersistenceModule: Ot, + PopupModule: + ((Kt = class extends w { + constructor(s) { + super(s), + (this.columnSubscribers = {}), + this.registerTableOption("rowContextPopup", !1), + this.registerTableOption("rowClickPopup", !1), + this.registerTableOption( + "rowDblClickPopup", + !1 + ), + this.registerTableOption( + "groupContextPopup", + !1 + ), + this.registerTableOption("groupClickPopup", !1), + this.registerTableOption( + "groupDblClickPopup", + !1 + ), + this.registerColumnOption("headerContextPopup"), + this.registerColumnOption("headerClickPopup"), + this.registerColumnOption( + "headerDblClickPopup" + ), + this.registerColumnOption("headerPopup"), + this.registerColumnOption("headerPopupIcon"), + this.registerColumnOption("contextPopup"), + this.registerColumnOption("clickPopup"), + this.registerColumnOption("dblClickPopup"), + this.registerComponentFunction( + "cell", + "popup", + this._componentPopupCall.bind(this) + ), + this.registerComponentFunction( + "column", + "popup", + this._componentPopupCall.bind(this) + ), + this.registerComponentFunction( + "row", + "popup", + this._componentPopupCall.bind(this) + ), + this.registerComponentFunction( + "group", + "popup", + this._componentPopupCall.bind(this) + ); + } + initialize() { + this.initializeRowWatchers(), + this.initializeGroupWatchers(), + this.subscribe( + "column-init", + this.initializeColumn.bind(this) + ); + } + _componentPopupCall(s, t, e) { + this.loadPopupEvent(t, null, s, e); + } + initializeRowWatchers() { + this.table.options.rowContextPopup && + (this.subscribe( + "row-contextmenu", + this.loadPopupEvent.bind( + this, + this.table.options.rowContextPopup + ) + ), + this.table.on( + "rowTapHold", + this.loadPopupEvent.bind( + this, + this.table.options.rowContextPopup + ) + )), + this.table.options.rowClickPopup && + this.subscribe( + "row-click", + this.loadPopupEvent.bind( + this, + this.table.options.rowClickPopup + ) + ), + this.table.options.rowDblClickPopup && + this.subscribe( + "row-dblclick", + this.loadPopupEvent.bind( + this, + this.table.options.rowDblClickPopup + ) + ); + } + initializeGroupWatchers() { + this.table.options.groupContextPopup && + (this.subscribe( + "group-contextmenu", + this.loadPopupEvent.bind( + this, + this.table.options.groupContextPopup + ) + ), + this.table.on( + "groupTapHold", + this.loadPopupEvent.bind( + this, + this.table.options.groupContextPopup + ) + )), + this.table.options.groupClickPopup && + this.subscribe( + "group-click", + this.loadPopupEvent.bind( + this, + this.table.options.groupClickPopup + ) + ), + this.table.options.groupDblClickPopup && + this.subscribe( + "group-dblclick", + this.loadPopupEvent.bind( + this, + this.table.options + .groupDblClickPopup + ) + ); + } + initializeColumn(s) { + var t = s.definition; + t.headerContextPopup && + !this.columnSubscribers.headerContextPopup && + ((this.columnSubscribers.headerContextPopup = + this.loadPopupTableColumnEvent.bind( + this, + "headerContextPopup" + )), + this.subscribe( + "column-contextmenu", + this.columnSubscribers.headerContextPopup + ), + this.table.on( + "headerTapHold", + this.loadPopupTableColumnEvent.bind( + this, + "headerContextPopup" + ) + )), + t.headerClickPopup && + !this.columnSubscribers.headerClickPopup && + ((this.columnSubscribers.headerClickPopup = + this.loadPopupTableColumnEvent.bind( + this, + "headerClickPopup" + )), + this.subscribe( + "column-click", + this.columnSubscribers.headerClickPopup + )), + t.headerDblClickPopup && + !this.columnSubscribers + .headerDblClickPopup && + ((this.columnSubscribers.headerDblClickPopup = + this.loadPopupTableColumnEvent.bind( + this, + "headerDblClickPopup" + )), + this.subscribe( + "column-dblclick", + this.columnSubscribers + .headerDblClickPopup + )), + t.headerPopup && + this.initializeColumnHeaderPopup(s), + t.contextPopup && + !this.columnSubscribers.contextPopup && + ((this.columnSubscribers.contextPopup = + this.loadPopupTableCellEvent.bind( + this, + "contextPopup" + )), + this.subscribe( + "cell-contextmenu", + this.columnSubscribers.contextPopup + ), + this.table.on( + "cellTapHold", + this.loadPopupTableCellEvent.bind( + this, + "contextPopup" + ) + )), + t.clickPopup && + !this.columnSubscribers.clickPopup && + ((this.columnSubscribers.clickPopup = + this.loadPopupTableCellEvent.bind( + this, + "clickPopup" + )), + this.subscribe( + "cell-click", + this.columnSubscribers.clickPopup + )), + t.dblClickPopup && + !this.columnSubscribers.dblClickPopup && + ((this.columnSubscribers.dblClickPopup = + this.loadPopupTableCellEvent.bind( + this, + "dblClickPopup" + )), + this.subscribe( + "cell-click", + this.columnSubscribers.dblClickPopup + )); + } + initializeColumnHeaderPopup(s) { + var t, + e = s.definition.headerPopupIcon; + (t = document.createElement("span")).classList.add( + "tabulator-header-popup-button" + ), + e + ? (typeof e == "function" && + (e = e(s.getComponent())), + e instanceof HTMLElement + ? t.appendChild(e) + : (t.innerHTML = e)) + : (t.innerHTML = "⋮"), + t.addEventListener("click", (i) => { + i.stopPropagation(), + i.preventDefault(), + this.loadPopupEvent( + s.definition.headerPopup, + i, + s + ); + }), + s.titleElement.insertBefore( + t, + s.titleElement.firstChild + ); + } + loadPopupTableCellEvent(s, t, e) { + e._cell && (e = e._cell), + e.column.definition[s] && + this.loadPopupEvent( + e.column.definition[s], + t, + e + ); + } + loadPopupTableColumnEvent(s, t, e) { + e._column && (e = e._column), + e.definition[s] && + this.loadPopupEvent(e.definition[s], t, e); + } + loadPopupEvent(s, t, e, i) { + var o; + e._group ? (e = e._group) : e._row && (e = e._row), + (s = + typeof s == "function" + ? s.call( + this.table, + t, + e.getComponent(), + function (n) { + o = n; + } + ) + : s), + this.loadPopup(t, e, s, o, i); + } + loadPopup(s, t, e, i, o) { + var n, + r, + a = !(s instanceof MouseEvent); + e instanceof HTMLElement + ? (n = e) + : ((n = + document.createElement("div")).innerHTML = + e), + n.classList.add("tabulator-popup"), + n.addEventListener("click", (l) => { + l.stopPropagation(); + }), + a || s.preventDefault(), + (r = this.popup(n)), + typeof i == "function" && r.renderCallback(i), + s + ? r.show(s) + : r.show(t.getElement(), o || "center"), + r.hideOnBlur(() => { + this.dispatchExternal( + "popupClosed", + t.getComponent() + ); + }), + this.dispatchExternal( + "popupOpened", + t.getComponent() + ); + } + }), + b(Kt, "moduleName", "popup"), + Kt), + PrintModule: + ((Yt = class extends w { + constructor(s) { + super(s), + (this.element = !1), + (this.manualBlock = !1), + (this.beforeprintEventHandler = null), + (this.afterprintEventHandler = null), + this.registerTableOption("printAsHtml", !1), + this.registerTableOption("printFormatter", !1), + this.registerTableOption("printHeader", !1), + this.registerTableOption("printFooter", !1), + this.registerTableOption("printStyled", !0), + this.registerTableOption( + "printRowRange", + "visible" + ), + this.registerTableOption("printConfig", {}), + this.registerColumnOption("print"), + this.registerColumnOption("titlePrint"); + } + initialize() { + this.table.options.printAsHtml && + ((this.beforeprintEventHandler = + this.replaceTable.bind(this)), + (this.afterprintEventHandler = + this.cleanup.bind(this)), + window.addEventListener( + "beforeprint", + this.beforeprintEventHandler + ), + window.addEventListener( + "afterprint", + this.afterprintEventHandler + ), + this.subscribe( + "table-destroy", + this.destroy.bind(this) + )), + this.registerTableFunction( + "print", + this.printFullscreen.bind(this) + ); + } + destroy() { + this.table.options.printAsHtml && + (window.removeEventListener( + "beforeprint", + this.beforeprintEventHandler + ), + window.removeEventListener( + "afterprint", + this.afterprintEventHandler + )); + } + replaceTable() { + this.manualBlock || + ((this.element = document.createElement("div")), + this.element.classList.add( + "tabulator-print-table" + ), + this.element.appendChild( + this.table.modules.export.generateTable( + this.table.options.printConfig, + this.table.options.printStyled, + this.table.options.printRowRange, + "print" + ) + ), + (this.table.element.style.display = "none"), + this.table.element.parentNode.insertBefore( + this.element, + this.table.element + )); + } + cleanup() { + document.body.classList.remove( + "tabulator-print-fullscreen-hide" + ), + this.element && + this.element.parentNode && + (this.element.parentNode.removeChild( + this.element + ), + (this.table.element.style.display = "")); + } + printFullscreen(s, t, e) { + var i, + o, + n = window.scrollX, + r = window.scrollY, + a = document.createElement("div"), + l = document.createElement("div"), + h = this.table.modules.export.generateTable( + e !== void 0 + ? e + : this.table.options.printConfig, + t !== void 0 + ? t + : this.table.options.printStyled, + s || this.table.options.printRowRange, + "print" + ); + (this.manualBlock = !0), + (this.element = document.createElement("div")), + this.element.classList.add( + "tabulator-print-fullscreen" + ), + this.table.options.printHeader && + (a.classList.add("tabulator-print-header"), + typeof (i = + typeof this.table.options.printHeader == + "function" + ? this.table.options.printHeader.call( + this.table + ) + : this.table.options.printHeader) == + "string" + ? (a.innerHTML = i) + : a.appendChild(i), + this.element.appendChild(a)), + this.element.appendChild(h), + this.table.options.printFooter && + (l.classList.add("tabulator-print-footer"), + typeof (o = + typeof this.table.options.printFooter == + "function" + ? this.table.options.printFooter.call( + this.table + ) + : this.table.options.printFooter) == + "string" + ? (l.innerHTML = o) + : l.appendChild(o), + this.element.appendChild(l)), + document.body.classList.add( + "tabulator-print-fullscreen-hide" + ), + document.body.appendChild(this.element), + this.table.options.printFormatter && + this.table.options.printFormatter( + this.element, + h + ), + window.print(), + this.cleanup(), + window.scrollTo(n, r), + (this.manualBlock = !1); + } + }), + b(Yt, "moduleName", "print"), + Yt), + ReactiveDataModule: + ((Qt = class extends w { + constructor(s) { + super(s), + (this.data = !1), + (this.blocked = !1), + (this.origFuncs = {}), + (this.currentVersion = 0), + this.registerTableOption("reactiveData", !1); + } + initialize() { + this.table.options.reactiveData && + (this.subscribe( + "cell-value-save-before", + this.block.bind(this, "cellsave") + ), + this.subscribe( + "cell-value-save-after", + this.unblock.bind(this, "cellsave") + ), + this.subscribe( + "row-data-save-before", + this.block.bind(this, "rowsave") + ), + this.subscribe( + "row-data-save-after", + this.unblock.bind(this, "rowsave") + ), + this.subscribe( + "row-data-init-after", + this.watchRow.bind(this) + ), + this.subscribe( + "data-processing", + this.watchData.bind(this) + ), + this.subscribe( + "table-destroy", + this.unwatchData.bind(this) + )); + } + watchData(s) { + var t, + e = this; + this.currentVersion++, + (t = this.currentVersion), + this.unwatchData(), + (this.data = s), + (this.origFuncs.push = s.push), + Object.defineProperty(this.data, "push", { + enumerable: !1, + configurable: !0, + value: function () { + var i, + o = Array.from(arguments); + return ( + e.blocked || + t !== e.currentVersion || + (e.block("data-push"), + o.forEach((n) => { + e.table.rowManager.addRowActual( + n, + !1 + ); + }), + (i = e.origFuncs.push.apply( + s, + arguments + )), + e.unblock("data-push")), + i + ); + }, + }), + (this.origFuncs.unshift = s.unshift), + Object.defineProperty(this.data, "unshift", { + enumerable: !1, + configurable: !0, + value: function () { + var i, + o = Array.from(arguments); + return ( + e.blocked || + t !== e.currentVersion || + (e.block("data-unshift"), + o.forEach((n) => { + e.table.rowManager.addRowActual( + n, + !0 + ); + }), + (i = e.origFuncs.unshift.apply( + s, + arguments + )), + e.unblock("data-unshift")), + i + ); + }, + }), + (this.origFuncs.shift = s.shift), + Object.defineProperty(this.data, "shift", { + enumerable: !1, + configurable: !0, + value: function () { + var i, o; + return ( + e.blocked || + t !== e.currentVersion || + (e.block("data-shift"), + e.data.length && + (i = + e.table.rowManager.getRowFromDataObject( + e.data[0] + )) && + i.deleteActual(), + (o = e.origFuncs.shift.call(s)), + e.unblock("data-shift")), + o + ); + }, + }), + (this.origFuncs.pop = s.pop), + Object.defineProperty(this.data, "pop", { + enumerable: !1, + configurable: !0, + value: function () { + var i, o; + return ( + e.blocked || + t !== e.currentVersion || + (e.block("data-pop"), + e.data.length && + (i = + e.table.rowManager.getRowFromDataObject( + e.data[ + e.data.length - + 1 + ] + )) && + i.deleteActual(), + (o = e.origFuncs.pop.call(s)), + e.unblock("data-pop")), + o + ); + }, + }), + (this.origFuncs.splice = s.splice), + Object.defineProperty(this.data, "splice", { + enumerable: !1, + configurable: !0, + value: function () { + var i, + o, + n = Array.from(arguments), + r = + n[0] < 0 + ? s.length + n[0] + : n[0], + a = n[1], + l = !!n[2] && n.slice(2); + if ( + !e.blocked && + t === e.currentVersion + ) { + if ( + (e.block("data-splice"), + l && + ((i = + !!s[r] && + e.table.rowManager.getRowFromDataObject( + s[r] + )) + ? l.forEach((d) => { + e.table.rowManager.addRowActual( + d, + !0, + i, + !0 + ); + }) + : (l = l + .slice() + .reverse()).forEach( + (d) => { + e.table.rowManager.addRowActual( + d, + !0, + !1, + !0 + ); + } + )), + a !== 0) + ) { + var h = s.slice( + r, + n[1] === void 0 + ? n[1] + : r + a + ); + h.forEach((d, c) => { + var u = + e.table.rowManager.getRowFromDataObject( + d + ); + u && + u.deleteActual( + c !== h.length - 1 + ); + }); + } + (l || a !== 0) && + e.table.rowManager.reRenderInPosition(), + (o = e.origFuncs.splice.apply( + s, + arguments + )), + e.unblock("data-splice"); + } + return o; + }, + }); + } + unwatchData() { + if (this.data !== !1) + for (var s in this.origFuncs) + Object.defineProperty(this.data, s, { + enumerable: !0, + configurable: !0, + writable: !0, + value: this.origFuncs.key, + }); + } + watchRow(s) { + var t = s.getData(); + for (var e in t) this.watchKey(s, t, e); + this.table.options.dataTree && + this.watchTreeChildren(s); + } + watchTreeChildren(s) { + var t = this, + e = + s.getData()[ + this.table.options.dataTreeChildField + ], + i = {}; + e && + ((i.push = e.push), + Object.defineProperty(e, "push", { + enumerable: !1, + configurable: !0, + value: () => { + if (!t.blocked) { + t.block("tree-push"); + var o = i.push.apply(e, arguments); + this.rebuildTree(s), + t.unblock("tree-push"); + } + return o; + }, + }), + (i.unshift = e.unshift), + Object.defineProperty(e, "unshift", { + enumerable: !1, + configurable: !0, + value: () => { + if (!t.blocked) { + t.block("tree-unshift"); + var o = i.unshift.apply( + e, + arguments + ); + this.rebuildTree(s), + t.unblock("tree-unshift"); + } + return o; + }, + }), + (i.shift = e.shift), + Object.defineProperty(e, "shift", { + enumerable: !1, + configurable: !0, + value: () => { + if (!t.blocked) { + t.block("tree-shift"); + var o = i.shift.call(e); + this.rebuildTree(s), + t.unblock("tree-shift"); + } + return o; + }, + }), + (i.pop = e.pop), + Object.defineProperty(e, "pop", { + enumerable: !1, + configurable: !0, + value: () => { + if (!t.blocked) { + t.block("tree-pop"); + var o = i.pop.call(e); + this.rebuildTree(s), + t.unblock("tree-pop"); + } + return o; + }, + }), + (i.splice = e.splice), + Object.defineProperty(e, "splice", { + enumerable: !1, + configurable: !0, + value: () => { + if (!t.blocked) { + t.block("tree-splice"); + var o = i.splice.apply( + e, + arguments + ); + this.rebuildTree(s), + t.unblock("tree-splice"); + } + return o; + }, + })); + } + rebuildTree(s) { + this.table.modules.dataTree.initializeRow(s), + this.table.modules.dataTree.layoutRow(s), + this.table.rowManager.refreshActiveData( + "tree", + !1, + !0 + ); + } + watchKey(s, t, e) { + var i = this, + o = Object.getOwnPropertyDescriptor(t, e), + n = t[e], + r = this.currentVersion; + Object.defineProperty(t, e, { + set: (a) => { + if ( + ((n = a), + !i.blocked && r === i.currentVersion) + ) { + i.block("key"); + var l = {}; + (l[e] = a), + s.updateData(l), + i.unblock("key"); + } + o.set && o.set(a); + }, + get: () => (o.get && o.get(), n), + }); + } + unwatchRow(s) { + var t = s.getData(); + for (var e in t) + Object.defineProperty(t, e, { value: t[e] }); + } + block(s) { + this.blocked || (this.blocked = s); + } + unblock(s) { + this.blocked === s && (this.blocked = !1); + } + }), + b(Qt, "moduleName", "reactiveData"), + Qt), + ResizeColumnsModule: + ((Zt = class extends w { + constructor(s) { + super(s), + (this.startColumn = !1), + (this.startX = !1), + (this.startWidth = !1), + (this.latestX = !1), + (this.handle = null), + (this.initialNextColumn = null), + (this.nextColumn = null), + (this.initialized = !1), + this.registerColumnOption("resizable", !0), + this.registerTableOption( + "resizableColumnFit", + !1 + ), + this.registerTableOption( + "resizableColumnGuide", + !1 + ); + } + initialize() { + this.subscribe( + "column-rendered", + this.layoutColumnHeader.bind(this) + ); + } + initializeEventWatchers() { + this.initialized || + (this.subscribe( + "cell-rendered", + this.layoutCellHandles.bind(this) + ), + this.subscribe( + "cell-delete", + this.deInitializeComponent.bind(this) + ), + this.subscribe( + "cell-height", + this.resizeHandle.bind(this) + ), + this.subscribe( + "column-moved", + this.columnLayoutUpdated.bind(this) + ), + this.subscribe( + "column-hide", + this.deInitializeColumn.bind(this) + ), + this.subscribe( + "column-show", + this.columnLayoutUpdated.bind(this) + ), + this.subscribe( + "column-width", + this.columnWidthUpdated.bind(this) + ), + this.subscribe( + "column-delete", + this.deInitializeComponent.bind(this) + ), + this.subscribe( + "column-height", + this.resizeHandle.bind(this) + ), + (this.initialized = !0)); + } + layoutCellHandles(s) { + s.row.type === "row" && + (this.deInitializeComponent(s), + this.initializeColumn( + "cell", + s, + s.column, + s.element + )); + } + layoutColumnHeader(s) { + s.definition.resizable && + (this.initializeEventWatchers(), + this.deInitializeComponent(s), + this.initializeColumn( + "header", + s, + s, + s.element + )); + } + columnLayoutUpdated(s) { + var t = s.prevColumn(); + this.reinitializeColumn(s), + t && this.reinitializeColumn(t); + } + columnWidthUpdated(s) { + s.modules.frozen && + (this.table.modules.frozenColumns.leftColumns.includes( + s + ) + ? this.table.modules.frozenColumns.leftColumns.forEach( + (t) => { + this.reinitializeColumn(t); + } + ) + : this.table.modules.frozenColumns.rightColumns.includes( + s + ) && + this.table.modules.frozenColumns.rightColumns.forEach( + (t) => { + this.reinitializeColumn(t); + } + )); + } + frozenColumnOffset(s) { + var t = !1; + return ( + s.modules.frozen && + ((t = s.modules.frozen.marginValue), + s.modules.frozen.position === "left" + ? (t += s.getWidth() - 3) + : t && (t -= 3)), + t !== !1 && t + "px" + ); + } + reinitializeColumn(s) { + var t = this.frozenColumnOffset(s); + s.cells.forEach((e) => { + e.modules.resize && + e.modules.resize.handleEl && + (t && + ((e.modules.resize.handleEl.style[ + s.modules.frozen.position + ] = t), + (e.modules.resize.handleEl.style[ + "z-index" + ] = 11)), + e.element.after(e.modules.resize.handleEl)); + }), + s.modules.resize && + s.modules.resize.handleEl && + (t && + (s.modules.resize.handleEl.style[ + s.modules.frozen.position + ] = t), + s.element.after(s.modules.resize.handleEl)); + } + initializeColumn(s, t, e, i) { + var o = this, + n = e.definition.resizable, + r = {}, + a = e.getLastColumn(); + if ( + (s === "header" && + (r = { + variableHeight: + e.definition.formatter == + "textarea" || + e.definition.variableHeight, + }), + (n === !0 || n == s) && + this._checkResizability(a)) + ) { + var l = document.createElement("span"); + (l.className = "tabulator-col-resize-handle"), + l.addEventListener("click", function (d) { + d.stopPropagation(); + }); + var h = function (d) { + (o.startColumn = e), + (o.initialNextColumn = o.nextColumn = + a.nextColumn()), + o._mouseDown(d, a, l); + }; + l.addEventListener("mousedown", h), + l.addEventListener("touchstart", h, { + passive: !0, + }), + l.addEventListener("dblclick", (d) => { + var c = a.getWidth(); + d.stopPropagation(), + a.reinitializeWidth(!0), + c !== a.getWidth() && + (o.dispatch( + "column-resized", + a + ), + o.dispatchExternal( + "columnResized", + a.getComponent() + )); + }), + e.modules.frozen && + ((l.style.position = "sticky"), + (l.style[e.modules.frozen.position] = + this.frozenColumnOffset(e))), + (r.handleEl = l), + i.parentNode && e.visible && i.after(l); + } + t.modules.resize = r; + } + deInitializeColumn(s) { + this.deInitializeComponent(s), + s.cells.forEach((t) => { + this.deInitializeComponent(t); + }); + } + deInitializeComponent(s) { + var t; + s.modules.resize && + (t = s.modules.resize.handleEl) && + t.parentElement && + t.parentElement.removeChild(t); + } + resizeHandle(s, t) { + s.modules.resize && + s.modules.resize.handleEl && + (s.modules.resize.handleEl.style.height = t); + } + resize(s, t) { + var e, + i, + o = + s.clientX === void 0 + ? s.touches[0].clientX + : s.clientX, + n = o - this.startX, + r = o - this.latestX; + if ( + ((this.latestX = o), + this.table.rtl && ((n = -n), (r = -r)), + (e = + t.width == t.minWidth || + t.width == t.maxWidth), + t.setWidth(this.startWidth + n), + (i = + t.width == t.minWidth || + t.width == t.maxWidth), + r < 0 && + (this.nextColumn = this.initialNextColumn), + this.table.options.resizableColumnFit && + this.nextColumn && + (!e || !i)) + ) { + let a = this.nextColumn.getWidth(); + r > 0 && + a <= this.nextColumn.minWidth && + (this.nextColumn = + this.nextColumn.nextColumn()), + this.nextColumn && + this.nextColumn.setWidth( + this.nextColumn.getWidth() - r + ); + } + this.table.columnManager.rerenderColumns(!0), + !this.table.browserSlow && + t.modules.resize && + t.modules.resize.variableHeight && + t.checkCellHeights(); + } + calcGuidePosition(s, t, e) { + var i = + s.clientX === void 0 + ? s.touches[0].clientX + : s.clientX, + o = + e.getBoundingClientRect().x - + this.table.element.getBoundingClientRect() + .x, + n = + this.table.element.getBoundingClientRect() + .x, + r = t.element.getBoundingClientRect().left - n, + a = i - this.startX, + l = Math.max(o + a, r + t.minWidth); + return ( + t.maxWidth && (l = Math.min(l, r + t.maxWidth)), + l + ); + } + _checkResizability(s) { + return s.definition.resizable; + } + _mouseDown(s, t, e) { + var i, + o = this; + function n(a) { + o.table.options.resizableColumnGuide + ? (i.style.left = + o.calcGuidePosition(a, t, e) + "px") + : o.resize(a, t); + } + function r(a) { + o.table.options.resizableColumnGuide && + (o.resize(a, t), i.remove()), + o.startColumn.modules.edit && + (o.startColumn.modules.edit.blocked = + !1), + o.table.browserSlow && + t.modules.resize && + t.modules.resize.variableHeight && + t.checkCellHeights(), + document.body.removeEventListener( + "mouseup", + r + ), + document.body.removeEventListener( + "mousemove", + n + ), + e.removeEventListener("touchmove", n), + e.removeEventListener("touchend", r), + o.table.element.classList.remove( + "tabulator-block-select" + ), + o.startWidth !== t.getWidth() && + (o.table.columnManager.verticalAlignHeaders(), + o.dispatch("column-resized", t), + o.dispatchExternal( + "columnResized", + t.getComponent() + )); + } + this.dispatchExternal( + "columnResizing", + t.getComponent() + ), + o.table.options.resizableColumnGuide && + ((i = + document.createElement( + "span" + )).classList.add( + "tabulator-col-resize-guide" + ), + o.table.element.appendChild(i), + setTimeout(() => { + i.style.left = + o.calcGuidePosition(s, t, e) + "px"; + })), + o.table.element.classList.add( + "tabulator-block-select" + ), + s.stopPropagation(), + o.startColumn.modules.edit && + (o.startColumn.modules.edit.blocked = !0), + (o.startX = + s.clientX === void 0 + ? s.touches[0].clientX + : s.clientX), + (o.latestX = o.startX), + (o.startWidth = t.getWidth()), + document.body.addEventListener("mousemove", n), + document.body.addEventListener("mouseup", r), + e.addEventListener("touchmove", n, { + passive: !0, + }), + e.addEventListener("touchend", r); + } + }), + b(Zt, "moduleName", "resizeColumns"), + Zt), + ResizeRowsModule: + (($t = class extends w { + constructor(s) { + super(s), + (this.startColumn = !1), + (this.startY = !1), + (this.startHeight = !1), + (this.handle = null), + (this.prevHandle = null), + this.registerTableOption("resizableRows", !1), + this.registerTableOption( + "resizableRowGuide", + !1 + ); + } + initialize() { + this.table.options.resizableRows && + this.subscribe( + "row-layout-after", + this.initializeRow.bind(this) + ); + } + initializeRow(s) { + var t = this, + e = s.getElement(), + i = document.createElement("div"); + i.className = "tabulator-row-resize-handle"; + var o = document.createElement("div"); + (o.className = "tabulator-row-resize-handle prev"), + i.addEventListener("click", function (a) { + a.stopPropagation(); + }); + var n = function (a) { + (t.startRow = s), t._mouseDown(a, s, i); + }; + i.addEventListener("mousedown", n), + i.addEventListener("touchstart", n, { + passive: !0, + }), + o.addEventListener("click", function (a) { + a.stopPropagation(); + }); + var r = function (a) { + var l = t.table.rowManager.prevDisplayRow(s); + l && ((t.startRow = l), t._mouseDown(a, l, o)); + }; + o.addEventListener("mousedown", r), + o.addEventListener("touchstart", r, { + passive: !0, + }), + e.appendChild(i), + e.appendChild(o); + } + resize(s, t) { + t.setHeight( + this.startHeight + + ((s.screenY === void 0 + ? s.touches[0].screenY + : s.screenY) - + this.startY) + ); + } + calcGuidePosition(s, t, e) { + var i = + s.screenY === void 0 + ? s.touches[0].screenY + : s.screenY, + o = + e.getBoundingClientRect().y - + this.table.element.getBoundingClientRect() + .y, + n = + this.table.element.getBoundingClientRect() + .y, + r = t.element.getBoundingClientRect().top - n, + a = i - this.startY; + return Math.max(o + a, r); + } + _mouseDown(s, t, e) { + var i, + o = this; + function n(a) { + o.table.options.resizableRowGuide + ? (i.style.top = + o.calcGuidePosition(a, t, e) + "px") + : o.resize(a, t); + } + function r(a) { + o.table.options.resizableRowGuide && + (o.resize(a, t), i.remove()), + document.body.removeEventListener( + "mouseup", + n + ), + document.body.removeEventListener( + "mousemove", + n + ), + e.removeEventListener("touchmove", n), + e.removeEventListener("touchend", r), + o.table.element.classList.remove( + "tabulator-block-select" + ), + o.dispatchExternal( + "rowResized", + t.getComponent() + ); + } + o.dispatchExternal("rowResizing", t.getComponent()), + o.table.options.resizableRowGuide && + ((i = + document.createElement( + "span" + )).classList.add( + "tabulator-row-resize-guide" + ), + o.table.element.appendChild(i), + setTimeout(() => { + i.style.top = + o.calcGuidePosition(s, t, e) + "px"; + })), + o.table.element.classList.add( + "tabulator-block-select" + ), + s.stopPropagation(), + (o.startY = + s.screenY === void 0 + ? s.touches[0].screenY + : s.screenY), + (o.startHeight = t.getHeight()), + document.body.addEventListener("mousemove", n), + document.body.addEventListener("mouseup", r), + e.addEventListener("touchmove", n, { + passive: !0, + }), + e.addEventListener("touchend", r); + } + }), + b($t, "moduleName", "resizeRows"), + $t), + ResizeTableModule: + ((te = class extends w { + constructor(s) { + super(s), + (this.binding = !1), + (this.visibilityObserver = !1), + (this.resizeObserver = !1), + (this.containerObserver = !1), + (this.tableHeight = 0), + (this.tableWidth = 0), + (this.containerHeight = 0), + (this.containerWidth = 0), + (this.autoResize = !1), + (this.visible = !1), + (this.initialized = !1), + (this.initialRedraw = !1), + this.registerTableOption("autoResize", !0); + } + initialize() { + if (this.table.options.autoResize) { + var s, + t = this.table; + (this.tableHeight = t.element.clientHeight), + (this.tableWidth = t.element.clientWidth), + t.element.parentNode && + ((this.containerHeight = + t.element.parentNode.clientHeight), + (this.containerWidth = + t.element.parentNode.clientWidth)), + typeof IntersectionObserver < "u" && + typeof ResizeObserver < "u" && + t.rowManager.getRenderMode() === "virtual" + ? (this.initializeVisibilityObserver(), + (this.autoResize = !0), + (this.resizeObserver = + new ResizeObserver((e) => { + if ( + !t.browserMobile || + (t.browserMobile && + (!t.modules.edit || + (t.modules.edit && + !t.modules + .edit + .currentCell))) + ) { + var i = Math.floor( + e[0].contentRect + .height + ), + o = Math.floor( + e[0].contentRect + .width + ); + (this.tableHeight == i && + this.tableWidth == + o) || + ((this.tableHeight = + i), + (this.tableWidth = o), + t.element + .parentNode && + ((this.containerHeight = + t.element.parentNode.clientHeight), + (this.containerWidth = + t.element.parentNode.clientWidth)), + this.redrawTable()); + } + })), + this.resizeObserver.observe( + t.element + ), + (s = window.getComputedStyle( + t.element + )), + this.table.element.parentNode && + !this.table.rowManager + .fixedHeight && + (s.getPropertyValue( + "max-height" + ) || + s.getPropertyValue( + "min-height" + )) && + ((this.containerObserver = + new ResizeObserver((e) => { + if ( + !t.browserMobile || + (t.browserMobile && + (!t.modules + .edit || + (t.modules + .edit && + !t.modules + .edit + .currentCell))) + ) { + var i = Math.floor( + e[0] + .contentRect + .height + ), + o = Math.floor( + e[0] + .contentRect + .width + ); + (this + .containerHeight == + i && + this + .containerWidth == + o) || + ((this.containerHeight = + i), + (this.containerWidth = + o), + (this.tableHeight = + t.element.clientHeight), + (this.tableWidth = + t.element.clientWidth)), + this.redrawTable(); + } + })), + this.containerObserver.observe( + this.table.element.parentNode + )), + this.subscribe( + "table-resize", + this.tableResized.bind(this) + )) + : ((this.binding = function () { + (!t.browserMobile || + (t.browserMobile && + (!t.modules.edit || + (t.modules.edit && + !t.modules.edit + .currentCell)))) && + (t.columnManager.rerenderColumns( + !0 + ), + t.redraw()); + }), + window.addEventListener( + "resize", + this.binding + )), + this.subscribe( + "table-destroy", + this.clearBindings.bind(this) + ); + } + } + initializeVisibilityObserver() { + (this.visibilityObserver = new IntersectionObserver( + (s) => { + (this.visible = s[0].isIntersecting), + this.initialized + ? this.visible && + (this.redrawTable( + this.initialRedraw + ), + (this.initialRedraw = !1)) + : ((this.initialized = !0), + (this.initialRedraw = + !this.visible)); + } + )), + this.visibilityObserver.observe( + this.table.element + ); + } + redrawTable(s) { + this.initialized && + this.visible && + (this.table.columnManager.rerenderColumns(!0), + this.table.redraw(s)); + } + tableResized() { + this.table.rowManager.redraw(); + } + clearBindings() { + this.binding && + window.removeEventListener( + "resize", + this.binding + ), + this.resizeObserver && + this.resizeObserver.unobserve( + this.table.element + ), + this.visibilityObserver && + this.visibilityObserver.unobserve( + this.table.element + ), + this.containerObserver && + this.containerObserver.unobserve( + this.table.element.parentNode + ); + } + }), + b(te, "moduleName", "resizeTable"), + te), + ResponsiveLayoutModule: + ((ct = class extends w { + constructor(s) { + super(s), + (this.columns = []), + (this.hiddenColumns = []), + (this.mode = ""), + (this.index = 0), + (this.collapseFormatter = []), + (this.collapseStartOpen = !0), + (this.collapseHandleColumn = !1), + this.registerTableOption( + "responsiveLayout", + !1 + ), + this.registerTableOption( + "responsiveLayoutCollapseStartOpen", + !0 + ), + this.registerTableOption( + "responsiveLayoutCollapseUseFormatters", + !0 + ), + this.registerTableOption( + "responsiveLayoutCollapseFormatter", + !1 + ), + this.registerColumnOption("responsive"); + } + initialize() { + this.table.options.responsiveLayout && + (this.subscribe( + "column-layout", + this.initializeColumn.bind(this) + ), + this.subscribe( + "column-show", + this.updateColumnVisibility.bind(this) + ), + this.subscribe( + "column-hide", + this.updateColumnVisibility.bind(this) + ), + this.subscribe( + "columns-loaded", + this.initializeResponsivity.bind(this) + ), + this.subscribe( + "column-moved", + this.initializeResponsivity.bind(this) + ), + this.subscribe( + "column-add", + this.initializeResponsivity.bind(this) + ), + this.subscribe( + "column-delete", + this.initializeResponsivity.bind(this) + ), + this.subscribe( + "table-redrawing", + this.tableRedraw.bind(this) + ), + this.table.options.responsiveLayout === + "collapse" && + (this.subscribe( + "row-data-changed", + this.generateCollapsedRowContent.bind( + this + ) + ), + this.subscribe( + "row-init", + this.initializeRow.bind(this) + ), + this.subscribe( + "row-layout", + this.layoutRow.bind(this) + ))); + } + tableRedraw(s) { + ["fitColumns", "fitDataStretch"].indexOf( + this.layoutMode() + ) === -1 && + (s || this.update()); + } + initializeResponsivity() { + var s = []; + (this.mode = this.table.options.responsiveLayout), + (this.collapseFormatter = + this.table.options + .responsiveLayoutCollapseFormatter || + this.formatCollapsedData), + (this.collapseStartOpen = + this.table.options.responsiveLayoutCollapseStartOpen), + (this.hiddenColumns = []), + this.collapseFormatter && + (this.collapseFormatter = + this.collapseFormatter.bind( + this.table + )), + this.table.columnManager.columnsByIndex.forEach( + (t, e) => { + t.modules.responsive && + t.modules.responsive.order && + t.modules.responsive.visible && + ((t.modules.responsive.index = e), + s.push(t), + t.visible || + this.mode !== "collapse" || + this.hiddenColumns.push(t)); + } + ), + (s = (s = s.reverse()).sort( + (t, e) => + e.modules.responsive.order - + t.modules.responsive.order || + e.modules.responsive.index - + t.modules.responsive.index + )), + (this.columns = s), + this.mode === "collapse" && + this.generateCollapsedContent(); + for (let t of this.table.columnManager + .columnsByIndex) + if ( + t.definition.formatter == + "responsiveCollapse" + ) { + this.collapseHandleColumn = t; + break; + } + this.collapseHandleColumn && + (this.hiddenColumns.length + ? this.collapseHandleColumn.show() + : this.collapseHandleColumn.hide()); + } + initializeColumn(s) { + var t = s.getDefinition(); + s.modules.responsive = { + order: + t.responsive === void 0 ? 1 : t.responsive, + visible: t.visible !== !1, + }; + } + initializeRow(s) { + var t; + s.type !== "calc" && + ((t = + document.createElement( + "div" + )).classList.add( + "tabulator-responsive-collapse" + ), + (s.modules.responsiveLayout = { + element: t, + open: this.collapseStartOpen, + }), + this.collapseStartOpen || + (t.style.display = "none")); + } + layoutRow(s) { + var t = s.getElement(); + s.modules.responsiveLayout && + (t.appendChild( + s.modules.responsiveLayout.element + ), + this.generateCollapsedRowContent(s)); + } + updateColumnVisibility(s, t) { + !t && + s.modules.responsive && + ((s.modules.responsive.visible = s.visible), + this.initializeResponsivity()); + } + hideColumn(s) { + var t = this.hiddenColumns.length; + s.hide(!1, !0), + this.mode === "collapse" && + (this.hiddenColumns.unshift(s), + this.generateCollapsedContent(), + this.collapseHandleColumn && + !t && + this.collapseHandleColumn.show()); + } + showColumn(s) { + var t; + s.show(!1, !0), + s.setWidth(s.getWidth()), + this.mode === "collapse" && + ((t = this.hiddenColumns.indexOf(s)) > -1 && + this.hiddenColumns.splice(t, 1), + this.generateCollapsedContent(), + this.collapseHandleColumn && + !this.hiddenColumns.length && + this.collapseHandleColumn.hide()); + } + update() { + for (var s = !0; s; ) { + let t = + this.table.modules.layout.getMode() == + "fitColumns" + ? this.table.columnManager.getFlexBaseWidth() + : this.table.columnManager.getWidth(), + e = + (this.table.options.headerVisible + ? this.table.columnManager.element + .clientWidth + : this.table.element.clientWidth) - + t; + if (e < 0) { + let i = this.columns[this.index]; + i + ? (this.hideColumn(i), this.index++) + : (s = !1); + } else { + let i = this.columns[this.index - 1]; + i && e > 0 && e >= i.getWidth() + ? (this.showColumn(i), this.index--) + : (s = !1); + } + this.table.rowManager.activeRowsCount || + this.table.rowManager.renderEmptyScroll(); + } + } + generateCollapsedContent() { + this.table.rowManager + .getDisplayRows() + .forEach((s) => { + this.generateCollapsedRowContent(s); + }); + } + generateCollapsedRowContent(s) { + var t, e; + if (s.modules.responsiveLayout) { + for ( + t = s.modules.responsiveLayout.element; + t.firstChild; + + ) + t.removeChild(t.firstChild); + (e = this.collapseFormatter( + this.generateCollapsedRowData(s) + )) && t.appendChild(e), + s.calcHeight(!0); + } + } + generateCollapsedRowData(s) { + var t, + e = s.getData(), + i = []; + return ( + this.hiddenColumns.forEach((o) => { + var n = o.getFieldValue(e); + if (o.definition.title && o.field) + if ( + o.modules.format && + this.table.options + .responsiveLayoutCollapseUseFormatters + ) { + let r = function (a) { + a(); + }; + (t = { + value: !1, + data: {}, + getValue: function () { + return n; + }, + getData: function () { + return e; + }, + getType: function () { + return "cell"; + }, + getElement: function () { + return document.createElement( + "div" + ); + }, + getRow: function () { + return s.getComponent(); + }, + getColumn: function () { + return o.getComponent(); + }, + getTable: () => this.table, + }), + i.push({ + field: o.field, + title: o.definition.title, + value: o.modules.format.formatter.call( + this.table.modules + .format, + t, + o.modules.format.params, + r + ), + }); + } else + i.push({ + field: o.field, + title: o.definition.title, + value: n, + }); + }), + i + ); + } + formatCollapsedData(s) { + var t = document.createElement("table"); + return ( + s.forEach((e) => { + var i, + o = document.createElement("tr"), + n = document.createElement("td"), + r = document.createElement("td"), + a = document.createElement("strong"); + n.appendChild(a), + this.modules.localize.bind( + "columns|" + e.field, + function (l) { + a.innerHTML = l || e.title; + } + ), + e.value instanceof Node + ? ((i = + document.createElement( + "div" + )).appendChild(e.value), + r.appendChild(i)) + : (r.innerHTML = e.value), + o.appendChild(n), + o.appendChild(r), + t.appendChild(o); + }), + Object.keys(s).length ? t : "" + ); + } + }), + b(ct, "moduleName", "responsiveLayout"), + b(ct, "moduleExtensions", mi), + ct), + SelectRangeModule: + ((at = class extends w { + constructor(s) { + super(s), + (this.selecting = "cell"), + (this.mousedown = !1), + (this.ranges = []), + (this.overlay = null), + (this.rowHeader = null), + (this.layoutChangeTimeout = null), + (this.columnSelection = !1), + (this.rowSelection = !1), + (this.maxRanges = 0), + (this.activeRange = !1), + (this.blockKeydown = !1), + (this.keyDownEvent = + this._handleKeyDown.bind(this)), + (this.mouseUpEvent = + this._handleMouseUp.bind(this)), + this.registerTableOption("selectableRange", !1), + this.registerTableOption( + "selectableRangeColumns", + !1 + ), + this.registerTableOption( + "selectableRangeRows", + !1 + ), + this.registerTableOption( + "selectableRangeClearCells", + !1 + ), + this.registerTableOption( + "selectableRangeClearCellsValue", + void 0 + ), + this.registerTableOption( + "selectableRangeAutoFocus", + !0 + ), + this.registerTableFunction( + "getRangesData", + this.getRangesData.bind(this) + ), + this.registerTableFunction( + "getRanges", + this.getRanges.bind(this) + ), + this.registerTableFunction( + "addRange", + this.addRangeFromComponent.bind(this) + ), + this.registerComponentFunction( + "cell", + "getRanges", + this.cellGetRanges.bind(this) + ), + this.registerComponentFunction( + "row", + "getRanges", + this.rowGetRanges.bind(this) + ), + this.registerComponentFunction( + "column", + "getRanges", + this.colGetRanges.bind(this) + ); + } + initialize() { + this.options("selectableRange") && + (this.options("selectableRows") + ? console.warn( + "SelectRange functionality cannot be used in conjunction with row selection" + ) + : ((this.maxRanges = + this.options("selectableRange")), + this.initializeTable(), + this.initializeWatchers()), + this.options("columns").findIndex( + (s) => s.frozen + ) > 0 && + console.warn( + "Having frozen column in arbitrary position with selectRange option may result in unpredictable behavior." + ), + this.options("columns").filter( + (s) => s.frozen + ) > 1 && + console.warn( + "Having multiple frozen columns with selectRange option may result in unpredictable behavior." + )); + } + initializeTable() { + (this.overlay = document.createElement("div")), + this.overlay.classList.add( + "tabulator-range-overlay" + ), + (this.rangeContainer = + document.createElement("div")), + this.rangeContainer.classList.add( + "tabulator-range-container" + ), + (this.activeRangeCellElement = + document.createElement("div")), + this.activeRangeCellElement.classList.add( + "tabulator-range-cell-active" + ), + this.overlay.appendChild(this.rangeContainer), + this.overlay.appendChild( + this.activeRangeCellElement + ), + this.table.rowManager.element.addEventListener( + "keydown", + this.keyDownEvent + ), + this.resetRanges(), + this.table.rowManager.element.appendChild( + this.overlay + ), + this.table.columnManager.element.setAttribute( + "tabindex", + 0 + ), + this.table.element.classList.add( + "tabulator-ranges" + ); + } + initializeWatchers() { + (this.columnSelection = this.options( + "selectableRangeColumns" + )), + (this.rowSelection = this.options( + "selectableRangeRows" + )), + this.subscribe( + "column-init", + this.initializeColumn.bind(this) + ), + this.subscribe( + "column-mousedown", + this.handleColumnMouseDown.bind(this) + ), + this.subscribe( + "column-mousemove", + this.handleColumnMouseMove.bind(this) + ), + this.subscribe( + "column-resized", + this.handleColumnResized.bind(this) + ), + this.subscribe( + "column-moving", + this.handleColumnMoving.bind(this) + ), + this.subscribe( + "column-moved", + this.handleColumnMoved.bind(this) + ), + this.subscribe( + "column-width", + this.layoutChange.bind(this) + ), + this.subscribe( + "column-height", + this.layoutChange.bind(this) + ), + this.subscribe( + "column-resized", + this.layoutChange.bind(this) + ), + this.subscribe( + "columns-loaded", + this.updateHeaderColumn.bind(this) + ), + this.subscribe( + "cell-height", + this.layoutChange.bind(this) + ), + this.subscribe( + "cell-rendered", + this.renderCell.bind(this) + ), + this.subscribe( + "cell-mousedown", + this.handleCellMouseDown.bind(this) + ), + this.subscribe( + "cell-mousemove", + this.handleCellMouseMove.bind(this) + ), + this.subscribe( + "cell-click", + this.handleCellClick.bind(this) + ), + this.subscribe( + "cell-editing", + this.handleEditingCell.bind(this) + ), + this.subscribe( + "page-changed", + this.redraw.bind(this) + ), + this.subscribe( + "scroll-vertical", + this.layoutChange.bind(this) + ), + this.subscribe( + "scroll-horizontal", + this.layoutChange.bind(this) + ), + this.subscribe( + "data-destroy", + this.tableDestroyed.bind(this) + ), + this.subscribe( + "data-processed", + this.resetRanges.bind(this) + ), + this.subscribe( + "table-layout", + this.layoutElement.bind(this) + ), + this.subscribe( + "table-redraw", + this.redraw.bind(this) + ), + this.subscribe( + "table-destroy", + this.tableDestroyed.bind(this) + ), + this.subscribe( + "edit-editor-clear", + this.finishEditingCell.bind(this) + ), + this.subscribe( + "edit-blur", + this.restoreFocus.bind(this) + ), + this.subscribe( + "keybinding-nav-prev", + this.keyNavigate.bind(this, "left") + ), + this.subscribe( + "keybinding-nav-next", + this.keyNavigate.bind(this, "right") + ), + this.subscribe( + "keybinding-nav-left", + this.keyNavigate.bind(this, "left") + ), + this.subscribe( + "keybinding-nav-right", + this.keyNavigate.bind(this, "right") + ), + this.subscribe( + "keybinding-nav-up", + this.keyNavigate.bind(this, "up") + ), + this.subscribe( + "keybinding-nav-down", + this.keyNavigate.bind(this, "down") + ), + this.subscribe( + "keybinding-nav-range", + this.keyNavigateRange.bind(this) + ); + } + initializeColumn(s) { + this.columnSelection && + s.definition.headerSort && + this.options("headerSortClickElement") !== + "icon" && + console.warn( + "Using column headerSort with selectableRangeColumns option may result in unpredictable behavior. Consider using headerSortClickElement: 'icon'." + ), + s.modules.edit; + } + updateHeaderColumn() { + var s; + this.rowSelection && + ((this.rowHeader = + this.table.columnManager.getVisibleColumnsByIndex()[0]), + this.rowHeader && + ((this.rowHeader.definition.cssClass = + this.rowHeader.definition.cssClass + + " tabulator-range-row-header"), + this.rowHeader.definition.headerSort && + console.warn( + "Using column headerSort with selectableRangeRows option may result in unpredictable behavior" + ), + this.rowHeader.definition.editor && + console.warn( + "Using column editor with selectableRangeRows option may result in unpredictable behavior" + ))), + this.table.modules.frozenColumns && + this.table.modules.frozenColumns.active && + ((s = + this.table.modules.frozenColumns.getFrozenColumns()) + .length > 1 || + (s.length === 1 && + s[0] !== this.rowHeader)) && + console.warn( + "Using frozen columns that are not the range header in combination with the selectRange option may result in unpredictable behavior" + ); + } + getRanges() { + return this.ranges.map((s) => s.getComponent()); + } + getRangesData() { + return this.ranges.map((s) => s.getData()); + } + addRangeFromComponent(s, t) { + return ( + (s = s ? s._cell : null), + (t = t ? t._cell : null), + this.addRange(s, t) + ); + } + cellGetRanges(s) { + var t = []; + return ( + (t = + s.column === this.rowHeader + ? this.ranges.filter((e) => + e.occupiesRow(s.row) + ) + : this.ranges.filter((e) => + e.occupies(s) + )), + t.map((e) => e.getComponent()) + ); + } + rowGetRanges(s) { + var t = this.ranges.filter((e) => e.occupiesRow(s)); + return t.map((e) => e.getComponent()); + } + colGetRanges(s) { + var t = this.ranges.filter((e) => + e.occupiesColumn(s) + ); + return t.map((e) => e.getComponent()); + } + _handleMouseUp(s) { + (this.mousedown = !1), + document.removeEventListener( + "mouseup", + this.mouseUpEvent + ); + } + _handleKeyDown(s) { + if ( + !this.blockKeydown && + (!this.table.modules.edit || + (this.table.modules.edit && + !this.table.modules.edit.currentCell)) + ) { + if (s.key === "Enter") { + if ( + this.table.modules.edit && + this.table.modules.edit.currentCell + ) + return; + this.table.modules.edit.editCell( + this.getActiveCell() + ), + s.preventDefault(); + } + (s.key !== "Backspace" && s.key !== "Delete") || + !this.options( + "selectableRangeClearCells" + ) || + (this.activeRange && + this.activeRange.clearValues()); + } + } + initializeFocus(s) { + var t; + this.restoreFocus(); + try { + document.selection + ? ((t = + document.body.createTextRange()).moveToElementText( + s.getElement() + ), + t.select()) + : window.getSelection && + ((t = document.createRange()).selectNode( + s.getElement() + ), + window.getSelection().removeAllRanges(), + window.getSelection().addRange(t)); + } catch {} + } + restoreFocus(s) { + return this.table.rowManager.element.focus(), !0; + } + handleColumnResized(s) { + var t; + (this.selecting !== "column" && + this.selecting !== "all") || + ((t = this.ranges.some((e) => + e.occupiesColumn(s) + )), + t && + this.ranges.forEach((e) => { + e.getColumns(!0).forEach((i) => { + i !== s && i.setWidth(s.width); + }); + })); + } + handleColumnMoving(s, t) { + this.resetRanges().setBounds(t), + (this.overlay.style.visibility = "hidden"); + } + handleColumnMoved(s, t, e) { + this.activeRange.setBounds(s), this.layoutElement(); + } + handleColumnMouseDown(s, t) { + (s.button !== 2 || + (this.selecting !== "column" && + this.selecting !== "all") || + !this.activeRange.occupiesColumn(t)) && + ((this.table.options.movableColumns && + this.selecting === "column" && + this.activeRange.occupiesColumn(t)) || + ((this.mousedown = !0), + document.addEventListener( + "mouseup", + this.mouseUpEvent + ), + this.newSelection(s, t))); + } + handleColumnMouseMove(s, t) { + t !== this.rowHeader && + this.mousedown && + this.selecting !== "all" && + this.activeRange.setBounds(!1, t, !0); + } + renderCell(s) { + var t = s.getElement(), + e = this.ranges.findIndex((i) => i.occupies(s)); + t.classList.toggle( + "tabulator-range-selected", + e !== -1 + ), + t.classList.toggle( + "tabulator-range-only-cell-selected", + this.ranges.length === 1 && + this.ranges[0].atTopLeft(s) && + this.ranges[0].atBottomRight(s) + ), + (t.dataset.range = e); + } + handleCellMouseDown(s, t) { + (s.button === 2 && + (this.activeRange.occupies(t) || + ((this.selecting === "row" || + this.selecting === "all") && + this.activeRange.occupiesRow( + t.row + )))) || + ((this.mousedown = !0), + document.addEventListener( + "mouseup", + this.mouseUpEvent + ), + this.newSelection(s, t)); + } + handleCellMouseMove(s, t) { + this.mousedown && + this.selecting !== "all" && + this.activeRange.setBounds(!1, t, !0); + } + handleCellClick(s, t) { + this.initializeFocus(t); + } + handleEditingCell(s) { + this.activeRange && this.activeRange.setBounds(s); + } + finishEditingCell() { + (this.blockKeydown = !0), + this.table.rowManager.element.focus(), + setTimeout(() => { + this.blockKeydown = !1; + }, 10); + } + keyNavigate(s, t) { + this.navigate(!1, !1, s), t.preventDefault(); + } + keyNavigateRange(s, t, e, i) { + this.navigate(e, i, t), s.preventDefault(); + } + navigate(s, t, e) { + var i, o, n, r, a, l, h, d, c, u, m; + if ( + this.table.modules.edit && + this.table.modules.edit.currentCell + ) + return !1; + if ( + (this.ranges.length > 1 && + (this.ranges = this.ranges.filter((p) => + p === this.activeRange + ? (p.setEnd( + p.start.row, + p.start.col + ), + !0) + : (p.destroy(), !1) + )), + (n = { + top: (i = this.activeRange).top, + bottom: i.bottom, + left: i.left, + right: i.right, + }), + (r = (o = t ? i.end : i.start).row), + (a = o.col), + s) + ) + switch (e) { + case "left": + a = this.findJumpCellLeft( + i.start.row, + o.col + ); + break; + case "right": + a = this.findJumpCellRight( + i.start.row, + o.col + ); + break; + case "up": + r = this.findJumpCellUp( + o.row, + i.start.col + ); + break; + case "down": + r = this.findJumpCellDown( + o.row, + i.start.col + ); + } + else { + if ( + t && + ((this.selecting === "row" && + (e === "left" || e === "right")) || + (this.selecting === "column" && + (e === "up" || e === "down"))) + ) + return; + switch (e) { + case "left": + a = Math.max(a - 1, 0); + break; + case "right": + a = Math.min( + a + 1, + this.getTableColumns().length - 1 + ); + break; + case "up": + r = Math.max(r - 1, 0); + break; + case "down": + r = Math.min( + r + 1, + this.getTableRows().length - 1 + ); + } + } + return ( + this.rowHeader && a === 0 && (a = 1), + t || i.setStart(r, a), + i.setEnd(r, a), + t || (this.selecting = "cell"), + n.top !== i.top || + n.bottom !== i.bottom || + n.left !== i.left || + n.right !== i.right + ? ((l = this.getRowByRangePos(i.end.row)), + (h = this.getColumnByRangePos(i.end.col)), + (d = l + .getElement() + .getBoundingClientRect()), + (u = h + .getElement() + .getBoundingClientRect()), + (c = this.table.rowManager + .getElement() + .getBoundingClientRect()), + (m = this.table.columnManager + .getElement() + .getBoundingClientRect()), + (d.top >= c.top && + d.bottom <= c.bottom) || + (l.getElement().parentNode && + h.getElement().parentNode + ? this.autoScroll( + i, + l.getElement(), + h.getElement() + ) + : l + .getComponent() + .scrollTo(void 0, !1)), + (u.left >= + m.left + this.getRowHeaderWidth() && + u.right <= m.right) || + (l.getElement().parentNode && + h.getElement().parentNode + ? this.autoScroll( + i, + l.getElement(), + h.getElement() + ) + : h + .getComponent() + .scrollTo(void 0, !1)), + this.layoutElement(), + !0) + : void 0 + ); + } + rangeRemoved(s) { + (this.ranges = this.ranges.filter((t) => t !== s)), + this.activeRange === s && + (this.ranges.length + ? (this.activeRange = + this.ranges[ + this.ranges.length - 1 + ]) + : this.addRange()), + this.layoutElement(); + } + findJumpRow(s, t, e, i, o) { + return ( + e && (t = t.reverse()), + this.findJumpItem(i, o, t, function (n) { + return n.getData()[s.getField()]; + }) + ); + } + findJumpCol(s, t, e, i, o) { + return ( + e && (t = t.reverse()), + this.findJumpItem(i, o, t, function (n) { + return s.getData()[n.getField()]; + }) + ); + } + findJumpItem(s, t, e, i) { + var o; + for (let n of e) { + let r = i(n); + if (s) { + if (((o = n), r)) break; + } else if (t) { + if (((o = n), r)) break; + } else { + if (!r) break; + o = n; + } + } + return o; + } + findJumpCellLeft(s, t) { + var e = this.getRowByRangePos(s), + i = this.getTableColumns(), + o = this.isEmpty(e.getData()[i[t].getField()]), + n = + !!i[t - 1] && + this.isEmpty( + e.getData()[i[t - 1].getField()] + ), + r = this.rowHeader + ? i.slice(1, t) + : i.slice(0, t), + a = this.findJumpCol(e, r, !0, o, n); + return a ? a.getPosition() - 1 : t; + } + findJumpCellRight(s, t) { + var e = this.getRowByRangePos(s), + i = this.getTableColumns(), + o = this.isEmpty(e.getData()[i[t].getField()]), + n = + !!i[t + 1] && + this.isEmpty( + e.getData()[i[t + 1].getField()] + ), + r = this.findJumpCol( + e, + i.slice(t + 1, i.length), + !1, + o, + n + ); + return r ? r.getPosition() - 1 : t; + } + findJumpCellUp(s, t) { + var e = this.getColumnByRangePos(t), + i = this.getTableRows(), + o = this.isEmpty(i[s].getData()[e.getField()]), + n = + !!i[s - 1] && + this.isEmpty( + i[s - 1].getData()[e.getField()] + ), + r = this.findJumpRow( + e, + i.slice(0, s), + !0, + o, + n + ); + return r ? r.position - 1 : s; + } + findJumpCellDown(s, t) { + var e = this.getColumnByRangePos(t), + i = this.getTableRows(), + o = this.isEmpty(i[s].getData()[e.getField()]), + n = + !!i[s + 1] && + this.isEmpty( + i[s + 1].getData()[e.getField()] + ), + r = this.findJumpRow( + e, + i.slice(s + 1, i.length), + !1, + o, + n + ); + return r ? r.position - 1 : s; + } + newSelection(s, t) { + var e; + if (t.type === "column") { + if (!this.columnSelection) return; + if (t === this.rowHeader) { + (e = this.resetRanges()), + (this.selecting = "all"); + var i, + o = this.getCell(-1, -1); + return ( + (i = this.rowHeader + ? this.getCell(0, 1) + : this.getCell(0, 0)), + void e.setBounds(i, o) + ); + } + this.selecting = "column"; + } else + t.column === this.rowHeader + ? (this.selecting = "row") + : (this.selecting = "cell"); + s.shiftKey + ? this.activeRange.setBounds(!1, t) + : s.ctrlKey + ? this.addRange().setBounds(t) + : this.resetRanges().setBounds(t); + } + autoScroll(s, t, e) { + var i, + o, + n, + r = this.table.rowManager.element; + t === void 0 && + (t = this.getRowByRangePos( + s.end.row + ).getElement()), + e === void 0 && + (e = this.getColumnByRangePos( + s.end.col + ).getElement()), + (i = { + left: e.offsetLeft, + right: e.offsetLeft + e.offsetWidth, + top: t.offsetTop, + bottom: t.offsetTop + t.offsetHeight, + }), + (n = + (o = { + left: + r.scrollLeft + + this.getRowHeaderWidth(), + right: Math.ceil( + r.scrollLeft + r.clientWidth + ), + top: r.scrollTop, + bottom: + r.scrollTop + + r.offsetHeight - + this.table.rowManager + .scrollbarWidth, + }).top < i.top && + i.top < o.bottom && + o.top < i.bottom && + i.bottom < o.bottom), + (o.left < i.left && + i.left < o.right && + o.left < i.right && + i.right < o.right) || + (i.left < o.left + ? (r.scrollLeft = + i.left - this.getRowHeaderWidth()) + : i.right > o.right && + (r.scrollLeft = Math.min( + i.right - r.clientWidth, + i.left - this.getRowHeaderWidth() + ))), + n || + (i.top < o.top + ? (r.scrollTop = i.top) + : i.bottom > o.bottom && + (r.scrollTop = + i.bottom - r.clientHeight)); + } + layoutChange() { + (this.overlay.style.visibility = "hidden"), + clearTimeout(this.layoutChangeTimeout), + (this.layoutChangeTimeout = setTimeout( + this.layoutRanges.bind(this), + 200 + )); + } + redraw(s) { + s && + ((this.selecting = "cell"), + this.resetRanges(), + this.layoutElement()); + } + layoutElement(s) { + (s + ? this.table.rowManager.getVisibleRows(!0) + : this.table.rowManager.getRows() + ).forEach((t) => { + t.type === "row" && + (this.layoutRow(t), + t.cells.forEach((e) => this.renderCell(e))); + }), + this.getTableColumns().forEach((t) => { + this.layoutColumn(t); + }), + this.layoutRanges(); + } + layoutRow(s) { + var t = s.getElement(), + e = !1, + i = this.ranges.some((o) => o.occupiesRow(s)); + this.selecting === "row" + ? (e = i) + : this.selecting === "all" && (e = !0), + t.classList.toggle( + "tabulator-range-selected", + e + ), + t.classList.toggle( + "tabulator-range-highlight", + i + ); + } + layoutColumn(s) { + var t = s.getElement(), + e = !1, + i = this.ranges.some((o) => + o.occupiesColumn(s) + ); + this.selecting === "column" + ? (e = i) + : this.selecting === "all" && (e = !0), + t.classList.toggle( + "tabulator-range-selected", + e + ), + t.classList.toggle( + "tabulator-range-highlight", + i + ); + } + layoutRanges() { + var s, t, e; + this.table.initialized && + (s = this.getActiveCell()) && + ((t = s.getElement()), + (e = s.row.getElement()), + this.table.rtl + ? (this.activeRangeCellElement.style.right = + e.offsetWidth - + t.offsetLeft - + t.offsetWidth + + "px") + : (this.activeRangeCellElement.style.left = + e.offsetLeft + t.offsetLeft + "px"), + (this.activeRangeCellElement.style.top = + e.offsetTop + "px"), + (this.activeRangeCellElement.style.width = + t.offsetWidth + "px"), + (this.activeRangeCellElement.style.height = + e.offsetHeight + "px"), + this.ranges.forEach((i) => i.layout()), + (this.overlay.style.visibility = "visible")); + } + getCell(s, t) { + var e; + return t < 0 && + (t = this.getTableColumns().length + t) < 0 + ? null + : (s < 0 && + (s = this.getTableRows().length + s), + (e = this.table.rowManager.getRowFromPosition( + s + 1 + )) + ? e + .getCells(!1, !0) + .filter((i) => i.column.visible)[t] + : null); + } + getActiveCell() { + return this.getCell( + this.activeRange.start.row, + this.activeRange.start.col + ); + } + getRowByRangePos(s) { + return this.getTableRows()[s]; + } + getColumnByRangePos(s) { + return this.getTableColumns()[s]; + } + getTableRows() { + return this.table.rowManager + .getDisplayRows() + .filter((s) => s.type === "row"); + } + getTableColumns() { + return this.table.columnManager.getVisibleColumnsByIndex(); + } + addRange(s, t) { + var e; + return ( + this.maxRanges !== !0 && + this.ranges.length >= this.maxRanges && + this.ranges.shift().destroy(), + (e = new bi(this.table, this, s, t)), + (this.activeRange = e), + this.ranges.push(e), + this.rangeContainer.appendChild(e.element), + e + ); + } + resetRanges() { + var s, t, e; + return ( + this.ranges.forEach((i) => i.destroy()), + (this.ranges = []), + (s = this.addRange()), + this.table.rowManager.activeRows.length && + ((e = + this.table.rowManager.activeRows[0].cells.filter( + (i) => i.column.visible + )), + (t = e[this.rowHeader ? 1 : 0]) && + (s.setBounds(t), + this.options( + "selectableRangeAutoFocus" + ) && this.initializeFocus(t))), + s + ); + } + tableDestroyed() { + document.removeEventListener( + "mouseup", + this.mouseUpEvent + ), + this.table.rowManager.element.removeEventListener( + "keydown", + this.keyDownEvent + ); + } + selectedRows(s) { + return s + ? this.activeRange + .getRows() + .map((t) => t.getComponent()) + : this.activeRange.getRows(); + } + selectedColumns(s) { + return s + ? this.activeRange + .getColumns() + .map((t) => t.getComponent()) + : this.activeRange.getColumns(); + } + getRowHeaderWidth() { + return this.rowHeader + ? this.rowHeader.getElement().offsetWidth + : 0; + } + isEmpty(s) { + return s == null || s === ""; + } + }), + b(at, "moduleName", "selectRange"), + b(at, "moduleInitOrder", 1), + b(at, "moduleExtensions", fi), + at), + SelectRowModule: + ((ut = class extends w { + constructor(s) { + super(s), + (this.selecting = !1), + (this.lastClickedRow = !1), + (this.selectPrev = []), + (this.selectedRows = []), + (this.headerCheckboxElement = null), + this.registerTableOption( + "selectableRows", + "highlight" + ), + this.registerTableOption( + "selectableRowsRangeMode", + "drag" + ), + this.registerTableOption( + "selectableRowsRollingSelection", + !0 + ), + this.registerTableOption( + "selectableRowsPersistence", + !0 + ), + this.registerTableOption( + "selectableRowsCheck", + function (t, e) { + return !0; + } + ), + this.registerTableFunction( + "selectRow", + this.selectRows.bind(this) + ), + this.registerTableFunction( + "deselectRow", + this.deselectRows.bind(this) + ), + this.registerTableFunction( + "toggleSelectRow", + this.toggleRow.bind(this) + ), + this.registerTableFunction( + "getSelectedRows", + this.getSelectedRows.bind(this) + ), + this.registerTableFunction( + "getSelectedData", + this.getSelectedData.bind(this) + ), + this.registerComponentFunction( + "row", + "select", + this.selectRows.bind(this) + ), + this.registerComponentFunction( + "row", + "deselect", + this.deselectRows.bind(this) + ), + this.registerComponentFunction( + "row", + "toggleSelect", + this.toggleRow.bind(this) + ), + this.registerComponentFunction( + "row", + "isSelected", + this.isRowSelected.bind(this) + ); + } + initialize() { + this.deprecatedOptionsCheck(), + this.table.options.selectableRows === + "highlight" && + this.table.options.selectableRange && + (this.table.options.selectableRows = !1), + this.table.options.selectableRows !== !1 && + (this.subscribe( + "row-init", + this.initializeRow.bind(this) + ), + this.subscribe( + "row-deleting", + this.rowDeleted.bind(this) + ), + this.subscribe( + "rows-wipe", + this.clearSelectionData.bind(this) + ), + this.subscribe( + "rows-retrieve", + this.rowRetrieve.bind(this) + ), + this.table.options.selectableRows && + !this.table.options + .selectableRowsPersistence && + this.subscribe( + "data-refreshing", + this.deselectRows.bind(this) + )); + } + deprecatedOptionsCheck() {} + rowRetrieve(s, t) { + return s === "selected" ? this.selectedRows : t; + } + rowDeleted(s) { + this._deselectRow(s, !0); + } + clearSelectionData(s) { + var t = this.selectedRows.length; + (this.selecting = !1), + (this.lastClickedRow = !1), + (this.selectPrev = []), + (this.selectedRows = []), + t && s !== !0 && this._rowSelectionChanged(); + } + initializeRow(s) { + var t = this, + e = t.checkRowSelectability(s), + i = s.getElement(), + o = function () { + setTimeout(function () { + t.selecting = !1; + }, 50), + document.body.removeEventListener( + "mouseup", + o + ); + }; + (s.modules.select = { selected: !1 }), + i.classList.toggle("tabulator-selectable", e), + i.classList.toggle( + "tabulator-unselectable", + !e + ), + t.checkRowSelectability(s) && + t.table.options.selectableRows && + t.table.options.selectableRows != + "highlight" && + (t.table.options.selectableRowsRangeMode === + "click" + ? i.addEventListener( + "click", + this.handleComplexRowClick.bind( + this, + s + ) + ) + : (i.addEventListener( + "click", + function (n) { + (t.table.modExists("edit") && + t.table.modules.edit.getCurrentCell()) || + t.table._clearSelection(), + t.selecting || + t.toggleRow(s); + } + ), + i.addEventListener( + "mousedown", + function (n) { + if (n.shiftKey) + return ( + t.table._clearSelection(), + (t.selecting = !0), + (t.selectPrev = []), + document.body.addEventListener( + "mouseup", + o + ), + document.body.addEventListener( + "keyup", + o + ), + t.toggleRow(s), + !1 + ); + } + ), + i.addEventListener( + "mouseenter", + function (n) { + t.selecting && + (t.table._clearSelection(), + t.toggleRow(s), + t.selectPrev[1] == s && + t.toggleRow( + t.selectPrev[0] + )); + } + ), + i.addEventListener( + "mouseout", + function (n) { + t.selecting && + (t.table._clearSelection(), + t.selectPrev.unshift(s)); + } + ))); + } + handleComplexRowClick(s, t) { + if (t.shiftKey) { + this.table._clearSelection(), + (this.lastClickedRow = + this.lastClickedRow || s); + var e = + this.table.rowManager.getDisplayRowIndex( + this.lastClickedRow + ), + i = + this.table.rowManager.getDisplayRowIndex( + s + ), + o = e <= i ? e : i, + n = e >= i ? e : i, + r = this.table.rowManager + .getDisplayRows() + .slice(0) + .splice(o, n - o + 1); + t.ctrlKey || t.metaKey + ? (r.forEach((a) => { + a !== this.lastClickedRow && + (this.table.options + .selectableRows === !0 || + this.isRowSelected(s) || + this.selectedRows.length < + this.table.options + .selectableRows) && + this.toggleRow(a); + }), + (this.lastClickedRow = s)) + : (this.deselectRows(void 0, !0), + this.table.options.selectableRows !== + !0 && + r.length > + this.table.options + .selectableRows && + (r = r.slice( + 0, + this.table.options.selectableRows + )), + this.selectRows(r)), + this.table._clearSelection(); + } else + t.ctrlKey || t.metaKey + ? (this.toggleRow(s), + (this.lastClickedRow = s)) + : (this.deselectRows(void 0, !0), + this.selectRows(s), + (this.lastClickedRow = s)); + } + checkRowSelectability(s) { + return ( + !(!s || s.type !== "row") && + this.table.options.selectableRowsCheck.call( + this.table, + s.getComponent() + ) + ); + } + toggleRow(s) { + this.checkRowSelectability(s) && + (s.modules.select && s.modules.select.selected + ? this._deselectRow(s) + : this._selectRow(s)); + } + selectRows(s) { + var t, + e, + i = []; + switch (typeof s) { + case "undefined": + t = this.table.rowManager.rows; + break; + case "number": + t = this.table.rowManager.findRow(s); + break; + case "string": + (t = this.table.rowManager.findRow(s)) || + (t = this.table.rowManager.getRows(s)); + break; + default: + t = s; + } + Array.isArray(t) + ? t.length && + (t.forEach((o) => { + (e = this._selectRow(o, !0, !0)) && + i.push(e); + }), + this._rowSelectionChanged(!1, i)) + : t && this._selectRow(t, !1, !0); + } + _selectRow(s, t, e) { + if ( + !isNaN(this.table.options.selectableRows) && + this.table.options.selectableRows !== !0 && + !e && + this.selectedRows.length >= + this.table.options.selectableRows + ) { + if ( + !this.table.options + .selectableRowsRollingSelection + ) + return !1; + this._deselectRow(this.selectedRows[0]); + } + var i = this.table.rowManager.findRow(s); + if (i) { + if (this.selectedRows.indexOf(i) == -1) + return ( + i + .getElement() + .classList.add( + "tabulator-selected" + ), + i.modules.select || + (i.modules.select = {}), + (i.modules.select.selected = !0), + i.modules.select.checkboxEl && + (i.modules.select.checkboxEl.checked = + !0), + this.selectedRows.push(i), + this.table.options + .dataTreeSelectPropagate && + this.childRowSelection(i, !0), + this.dispatchExternal( + "rowSelected", + i.getComponent() + ), + this._rowSelectionChanged(t, i), + i + ); + } else + t || + console.warn( + "Selection Error - No such row found, ignoring selection:" + + s + ); + } + isRowSelected(s) { + return this.selectedRows.indexOf(s) !== -1; + } + deselectRows(s, t) { + var e, + i, + o = []; + switch (typeof s) { + case "undefined": + e = Object.assign([], this.selectedRows); + break; + case "number": + e = this.table.rowManager.findRow(s); + break; + case "string": + (e = this.table.rowManager.findRow(s)) || + (e = this.table.rowManager.getRows(s)); + break; + default: + e = s; + } + Array.isArray(e) + ? e.length && + (e.forEach((n) => { + (i = this._deselectRow(n, !0, !0)) && + o.push(i); + }), + this._rowSelectionChanged(t, [], o)) + : e && this._deselectRow(e, t, !0); + } + _deselectRow(s, t) { + var e, + i, + o = this, + n = o.table.rowManager.findRow(s); + if (n) { + if ( + (e = o.selectedRows.findIndex(function (r) { + return r == n; + })) > -1 + ) + return ( + (i = n.getElement()) && + i.classList.remove( + "tabulator-selected" + ), + n.modules.select || + (n.modules.select = {}), + (n.modules.select.selected = !1), + n.modules.select.checkboxEl && + (n.modules.select.checkboxEl.checked = + !1), + o.selectedRows.splice(e, 1), + this.table.options + .dataTreeSelectPropagate && + this.childRowSelection(n, !1), + this.dispatchExternal( + "rowDeselected", + n.getComponent() + ), + o._rowSelectionChanged(t, void 0, n), + n + ); + } else + t || + console.warn( + "Deselection Error - No such row found, ignoring selection:" + + s + ); + } + getSelectedData() { + var s = []; + return ( + this.selectedRows.forEach(function (t) { + s.push(t.getData()); + }), + s + ); + } + getSelectedRows() { + var s = []; + return ( + this.selectedRows.forEach(function (t) { + s.push(t.getComponent()); + }), + s + ); + } + _rowSelectionChanged(s, t = [], e = []) { + this.headerCheckboxElement && + (this.selectedRows.length === 0 + ? ((this.headerCheckboxElement.checked = + !1), + (this.headerCheckboxElement.indeterminate = + !1)) + : this.table.rowManager.rows.length === + this.selectedRows.length + ? ((this.headerCheckboxElement.checked = + !0), + (this.headerCheckboxElement.indeterminate = + !1)) + : ((this.headerCheckboxElement.indeterminate = + !0), + (this.headerCheckboxElement.checked = + !1))), + s || + (Array.isArray(t) || (t = [t]), + (t = t.map((i) => i.getComponent())), + Array.isArray(e) || (e = [e]), + (e = e.map((i) => i.getComponent())), + this.dispatchExternal( + "rowSelectionChanged", + this.getSelectedData(), + this.getSelectedRows(), + t, + e + )); + } + registerRowSelectCheckbox(s, t) { + s._row.modules.select || + (s._row.modules.select = {}), + (s._row.modules.select.checkboxEl = t); + } + registerHeaderSelectCheckbox(s) { + this.headerCheckboxElement = s; + } + childRowSelection(s, t) { + var e = this.table.modules.dataTree.getChildren( + s, + !0, + !0 + ); + if (t) for (let i of e) this._selectRow(i, !0); + else for (let i of e) this._deselectRow(i, !0); + } + }), + b(ut, "moduleName", "selectRow"), + b(ut, "moduleExtensions", pi), + ut), + SortModule: Bt, + SpreadsheetModule: + ((ee = class extends w { + constructor(s) { + super(s), + (this.sheets = []), + (this.element = null), + this.registerTableOption("spreadsheet", !1), + this.registerTableOption("spreadsheetRows", 50), + this.registerTableOption( + "spreadsheetColumns", + 50 + ), + this.registerTableOption( + "spreadsheetColumnDefinition", + {} + ), + this.registerTableOption( + "spreadsheetOutputFull", + !1 + ), + this.registerTableOption("spreadsheetData", !1), + this.registerTableOption( + "spreadsheetSheets", + !1 + ), + this.registerTableOption( + "spreadsheetSheetTabs", + !1 + ), + this.registerTableOption( + "spreadsheetSheetTabsElement", + !1 + ), + this.registerTableFunction( + "setSheets", + this.setSheets.bind(this) + ), + this.registerTableFunction( + "addSheet", + this.addSheet.bind(this) + ), + this.registerTableFunction( + "getSheets", + this.getSheets.bind(this) + ), + this.registerTableFunction( + "getSheetDefinitions", + this.getSheetDefinitions.bind(this) + ), + this.registerTableFunction( + "setSheetData", + this.setSheetData.bind(this) + ), + this.registerTableFunction( + "getSheet", + this.getSheet.bind(this) + ), + this.registerTableFunction( + "getSheetData", + this.getSheetData.bind(this) + ), + this.registerTableFunction( + "clearSheet", + this.clearSheet.bind(this) + ), + this.registerTableFunction( + "removeSheet", + this.removeSheetFunc.bind(this) + ), + this.registerTableFunction( + "activeSheet", + this.activeSheetFunc.bind(this) + ); + } + initialize() { + this.options("spreadsheet") && + (this.subscribe( + "table-initialized", + this.tableInitialized.bind(this) + ), + this.subscribe( + "data-loaded", + this.loadRemoteData.bind(this) + ), + (this.table.options.index = "_id"), + this.options("spreadsheetData") && + this.options("spreadsheetSheets") && + (console.warn( + "You cannot use spreadsheetData and spreadsheetSheets at the same time, ignoring spreadsheetData" + ), + (this.table.options.spreadsheetData = !1)), + this.compatibilityCheck(), + this.options("spreadsheetSheetTabs") && + this.initializeTabset()); + } + compatibilityCheck() { + this.options("data") && + console.warn( + "Do not use the data option when working with spreadsheets, use either spreadsheetData or spreadsheetSheets to pass data into the table" + ), + this.options("pagination") && + console.warn( + "The spreadsheet module is not compatible with the pagination module" + ), + this.options("groupBy") && + console.warn( + "The spreadsheet module is not compatible with the row grouping module" + ), + this.options("responsiveCollapse") && + console.warn( + "The spreadsheet module is not compatible with the responsive collapse module" + ); + } + initializeTabset() { + (this.element = document.createElement("div")), + this.element.classList.add( + "tabulator-spreadsheet-tabs" + ); + var s = this.options("spreadsheetSheetTabsElement"); + !s || + s instanceof HTMLElement || + (s = document.querySelector(s)) || + console.warn( + "Unable to find element matching spreadsheetSheetTabsElement selector:", + this.options("spreadsheetSheetTabsElement") + ), + s + ? s.appendChild(this.element) + : this.footerAppend(this.element); + } + tableInitialized() { + this.sheets.length + ? this.loadSheet(this.sheets[0]) + : this.options("spreadsheetSheets") + ? this.loadSheets( + this.options("spreadsheetSheets") + ) + : this.options("spreadsheetData") && + this.loadData( + this.options("spreadsheetData") + ); + } + loadRemoteData(s, t, e) { + return ( + console.log("data", s, t, e), + Array.isArray(s) + ? (this.table.dataLoader.clearAlert(), + this.dispatchExternal("dataLoaded", s), + !s.length || Array.isArray(s[0]) + ? this.loadData(s) + : this.loadSheets(s)) + : console.error( + `Spreadsheet Loading Error - Unable to process remote data due to invalid data type +Expecting: array +Received: `, + typeof s, + ` +Data: `, + s + ), + !1 + ); + } + loadData(s) { + var t = { data: s }; + this.loadSheet(this.newSheet(t)); + } + destroySheets() { + this.sheets.forEach((s) => { + s.destroy(); + }), + (this.sheets = []), + (this.activeSheet = null); + } + loadSheets(s) { + Array.isArray(s) || (s = []), + this.destroySheets(), + s.forEach((t) => { + this.newSheet(t); + }), + this.loadSheet(this.sheets[0]); + } + loadSheet(s) { + this.activeSheet !== s && + (this.activeSheet && this.activeSheet.unload(), + (this.activeSheet = s), + s.load()); + } + newSheet(s = {}) { + var t; + return ( + s.rows || + (s.rows = this.options("spreadsheetRows")), + s.columns || + (s.columns = + this.options("spreadsheetColumns")), + (t = new me(this, s)), + this.sheets.push(t), + this.element && + this.element.appendChild(t.element), + t + ); + } + removeSheet(s) { + var t, + e = this.sheets.indexOf(s); + this.sheets.length > 1 + ? e > -1 && + (this.sheets.splice(e, 1), + s.destroy(), + this.activeSheet === s && + ((t = + this.sheets[e - 1] || this.sheets[0]) + ? this.loadSheet(t) + : (this.activeSheet = null))) + : console.warn( + "Unable to remove sheet, at least one sheet must be active" + ); + } + lookupSheet(s) { + return s + ? s instanceof me + ? s + : s instanceof ue + ? s._sheet + : this.sheets.find((t) => t.key === s) || !1 + : this.activeSheet; + } + setSheets(s) { + return this.loadSheets(s), this.getSheets(); + } + addSheet(s) { + return this.newSheet(s).getComponent(); + } + getSheetDefinitions() { + return this.sheets.map((s) => s.getDefinition()); + } + getSheets() { + return this.sheets.map((s) => s.getComponent()); + } + getSheet(s) { + var t = this.lookupSheet(s); + return !!t && t.getComponent(); + } + setSheetData(s, t) { + s && !t && ((t = s), (s = !1)); + var e = this.lookupSheet(s); + return !!e && e.setData(t); + } + getSheetData(s) { + var t = this.lookupSheet(s); + return !!t && t.getData(); + } + clearSheet(s) { + var t = this.lookupSheet(s); + return !!t && t.clear(); + } + removeSheetFunc(s) { + var t = this.lookupSheet(s); + t && this.removeSheet(t); + } + activeSheetFunc(s) { + var t = this.lookupSheet(s); + return !!t && this.loadSheet(t); + } + }), + b(ee, "moduleName", "spreadsheet"), + ee), + TooltipModule: + ((ie = class extends w { + constructor(s) { + super(s), + (this.tooltipSubscriber = null), + (this.headerSubscriber = null), + (this.timeout = null), + (this.popupInstance = null), + this.registerTableOption("tooltipDelay", 300), + this.registerColumnOption("tooltip"), + this.registerColumnOption("headerTooltip"); + } + initialize() { + this.deprecatedOptionsCheck(), + this.subscribe( + "column-init", + this.initializeColumn.bind(this) + ); + } + deprecatedOptionsCheck() {} + initializeColumn(s) { + s.definition.headerTooltip && + !this.headerSubscriber && + ((this.headerSubscriber = !0), + this.subscribe( + "column-mousemove", + this.mousemoveCheck.bind( + this, + "headerTooltip" + ) + ), + this.subscribe( + "column-mouseout", + this.mouseoutCheck.bind( + this, + "headerTooltip" + ) + )), + s.definition.tooltip && + !this.tooltipSubscriber && + ((this.tooltipSubscriber = !0), + this.subscribe( + "cell-mousemove", + this.mousemoveCheck.bind( + this, + "tooltip" + ) + ), + this.subscribe( + "cell-mouseout", + this.mouseoutCheck.bind(this, "tooltip") + )); + } + mousemoveCheck(s, t, e) { + var i = + s === "tooltip" + ? e.column.definition.tooltip + : e.definition.headerTooltip; + i && + (this.clearPopup(), + (this.timeout = setTimeout( + this.loadTooltip.bind(this, t, e, i), + this.table.options.tooltipDelay + ))); + } + mouseoutCheck(s, t, e) { + this.popupInstance || this.clearPopup(); + } + clearPopup(s, t, e) { + clearTimeout(this.timeout), + (this.timeout = null), + this.popupInstance && this.popupInstance.hide(); + } + loadTooltip(s, t, e) { + var i, o, n; + typeof e == "function" && + (e = e(s, t.getComponent(), function (r) { + o = r; + })), + e instanceof HTMLElement + ? (i = e) + : ((i = document.createElement("div")), + e === !0 && + (t instanceof et + ? (e = t.value) + : t.definition.field + ? this.langBind( + "columns|" + + t.definition.field, + (r) => { + i.innerHTML = e = + r || + t.definition.title; + } + ) + : (e = t.definition.title)), + (i.innerHTML = e)), + (e || e === 0 || e === !1) && + (i.classList.add("tabulator-tooltip"), + i.addEventListener("mousemove", (r) => + r.preventDefault() + ), + (this.popupInstance = this.popup(i)), + typeof o == "function" && + this.popupInstance.renderCallback(o), + (n = + this.popupInstance.containerEventCoords( + s + )), + this.popupInstance + .show(n.x + 15, n.y + 15) + .hideOnBlur(() => { + this.dispatchExternal( + "TooltipClosed", + t.getComponent() + ), + (this.popupInstance = null); + }), + this.dispatchExternal( + "TooltipOpened", + t.getComponent() + )); + } + }), + b(ie, "moduleName", "tooltip"), + ie), + ValidateModule: _t, + }), + Ei = class extends U { + static extendModule() { + U.initializeModuleBinder(Vt), U._extendModule(...arguments); + } + static registerModule() { + U.initializeModuleBinder(Vt), + U._registerModule(...arguments); + } + constructor(s, t, e) { + super(s, t, Vt); + } + }; + return Ei; + }); +}); +export default Ti(); diff --git a/resources/views/filament/pages/monitor.blade.php b/resources/views/filament/pages/monitor.blade.php index 4720d7fa..4e99db4b 100644 --- a/resources/views/filament/pages/monitor.blade.php +++ b/resources/views/filament/pages/monitor.blade.php @@ -1,6 +1,48 @@ +@push('head') + + // + + + var table = new Tabulator("#example-table", { + layout: "fitDataFill", + height: "311px", + columns: [{ + title: "Name", + field: "name" + }, + { + title: "Progress", + field: "progress", + hozAlign: "right", + sorter: "number" + }, + { + title: "Gender", + field: "gender" + }, + { + title: "Rating", + field: "rating", + hozAlign: "center" + }, + { + title: "Favourite Color", + field: "col" + }, + ], + }); + // + +@endpush +
+
+ +
+ {{-- Page content --}} +