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 =
+ '