@stlite/desktop 0.30.2 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/dump_artifacts.js +1 -1
- package/build/asset-manifest.json +31 -29
- package/build/index.html +1 -1
- package/build/static/js/2116.fd3de825.chunk.js +1 -0
- package/build/static/js/2523.4761d79a.chunk.js +5 -0
- package/build/static/js/2632.de1769ff.chunk.js +1 -0
- package/build/static/js/277.d9ceff66.chunk.js +1 -0
- package/build/static/js/3376.d5aaecc4.chunk.js +1 -0
- package/build/static/js/3392.5ed3420d.chunk.js +1 -0
- package/build/static/js/{3977.8a9ac9d7.chunk.js → 3977.24eb5fb8.chunk.js} +1 -1
- package/build/static/js/{4210.66c14600.chunk.js → 4210.945a5966.chunk.js} +1 -1
- package/build/static/js/{4514.ff4d47b7.chunk.js → 4514.7931bd64.chunk.js} +1 -1
- package/build/static/js/{464.8a875fdd.chunk.js → 464.7c22f33c.chunk.js} +1 -1
- package/build/static/js/5608.b4074ab9.chunk.js +1 -0
- package/build/static/js/{5678.b7f865a0.chunk.js → 5678.729bced9.chunk.js} +1 -1
- package/build/static/js/6223.4bb0039e.chunk.js +2 -0
- package/build/static/js/6223.4bb0039e.chunk.js.LICENSE.txt +11 -0
- package/build/static/js/{6422.f69a61a8.chunk.js → 6422.c2900a88.chunk.js} +1 -1
- package/build/static/js/{7073.33f107fd.chunk.js → 7073.0a198301.chunk.js} +1 -1
- package/build/static/js/7496.0f941cac.chunk.js +1 -0
- package/build/static/js/{761.e16e6486.chunk.js → 761.ca3883de.chunk.js} +1 -1
- package/build/static/js/7698.00f5ff0b.chunk.js +1 -0
- package/build/static/js/7858.e4a6aa6d.chunk.js +5 -0
- package/build/static/js/{7937.a3bc5cdb.chunk.js → 7937.4b1be66e.chunk.js} +1 -1
- package/build/static/js/{8355.7352ad1b.chunk.js → 8355.b110abc9.chunk.js} +1 -1
- package/build/static/js/{8461.87a9a578.chunk.js → 8461.85faefa1.chunk.js} +1 -1
- package/build/static/js/9462.81f9c52a.chunk.js +1 -0
- package/build/static/js/9551.c45b17cf.chunk.js +1 -0
- package/build/static/js/main.1add465f.js +28 -0
- package/build/static/js/{main.4ee8ce64.js.LICENSE.txt → main.1add465f.js.LICENSE.txt} +1 -3
- package/build/static/media/checkmark.29851c8e9e6ef0c3d6c1e4efe3c1bb9e.svg +3 -0
- package/build/static/media/logo.83ae4f2fb87e38be7cbb8a5d2beb64d2.svg +5 -0
- package/build/static/media/rocket.b75b17d2b0a063c6cea230d1a9d77f1e.svg +9 -0
- package/package.json +4 -4
- package/build/static/js/2116.2e449b06.chunk.js +0 -1
- package/build/static/js/2523.7919ada5.chunk.js +0 -5
- package/build/static/js/2632.1bb45c13.chunk.js +0 -1
- package/build/static/js/277.fbace0b9.chunk.js +0 -1
- package/build/static/js/3376.839fa3bf.chunk.js +0 -1
- package/build/static/js/3392.7b32c75f.chunk.js +0 -1
- package/build/static/js/458.895bbb73.chunk.js +0 -1
- package/build/static/js/5608.314b94e4.chunk.js +0 -1
- package/build/static/js/6928.228563da.chunk.js +0 -2
- package/build/static/js/6928.228563da.chunk.js.LICENSE.txt +0 -26
- package/build/static/js/7496.37614377.chunk.js +0 -1
- package/build/static/js/7698.095351a0.chunk.js +0 -1
- package/build/static/js/7858.fa281cb7.chunk.js +0 -5
- package/build/static/js/9462.ebffc855.chunk.js +0 -1
- package/build/static/js/9551.f6ae672e.chunk.js +0 -1
- package/build/static/js/main.4ee8ce64.js +0 -28
package/bin/dump_artifacts.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
var O=Object.create;var h=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var g=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var x=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of $(t))!F.call(e,o)&&o!==r&&h(e,o,{get:()=>t[o],enumerable:!(i=P(t,o))||i.enumerable});return e};var n=(e,t,r)=>(r=e!=null?O(j(e)):{},x(t||!e||!e.__esModule?h(r,"default",{value:e,enumerable:!0}):r,e));var w=g(u=>{"use strict";Object.defineProperty(u,"__esModule",{value:!0});u.parseRequirementsTxt=void 0;function C(e){return e.split(`
|
|
3
|
-
`).filter(t=>!t.startsWith("#")).map(t=>t.trim()).filter(t=>t!=="")}u.parseRequirementsTxt=C});var v=g(c=>{"use strict";var K=c&&c.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,o)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),R=c&&c.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&K(t,e,r)};Object.defineProperty(c,"__esModule",{value:!0});R(w(),c)});var D=n(require("yargs")),b=require("yargs/helpers"),a=n(require("path")),s=n(require("fs/promises")),m=n(require("fs-extra")),f=n(require("node-fetch")),k=require("pyodide"),T=n(v());global.fetch=f.default;async function B(e){console.info("Copy the build directory (the bare built app files) to this directory...");let t=a.default.resolve(__dirname,"../build");if(!(await s.default.stat(t)).isDirectory())throw new Error(`The source ${t} does not exist.`);if(t===e.copyTo){console.warn(`sourceDir == destDir (${t}). Are you in the development environment? Skip copying the directory.`);return}if(e.keepOld)try{await s.default.access(e.copyTo),console.info(`${e.copyTo} already exists. Use it and skip copying.`);return}catch{throw new Error(`${e.copyTo} does not exist even though the \`keepOld\` option is specified`)}console.log(`Copy ${t} to ${e.copyTo}`),await s.default.rm(e.copyTo,{recursive:!0,force:!0}),await m.default.copy(t,e.copyTo)}async function _(e,t){console.log(`Install the local wheel ${t}`);let r=await s.default.readFile(t),i="/tmp/"+a.default.basename(t);e.FS.writeFile(i,r);let o=e.pyimport("micropip"),l=`emfs:${i}`;console.log(`Install ${l}`),await o.install.callKwargs(l,{keep_going:!0})}async function E(e){console.info("Create the site-packages snapshot file...");let t=await(0,k.loadPyodide)();if(await t.loadPackage(["micropip"]),e.useLocalKernelWheels){let l=a.default.dirname(require.resolve("@stlite/kernel")),p=a.default.resolve(l,"../py");await _(t,a.default.join(p,"stlite-server/dist/stlite_server-0.1.0-py3-none-any.whl")),await _(t,a.default.join(p,"streamlit/lib/dist/streamlit-1.
|
|
3
|
+
`).filter(t=>!t.startsWith("#")).map(t=>t.trim()).filter(t=>t!=="")}u.parseRequirementsTxt=C});var v=g(c=>{"use strict";var K=c&&c.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,o)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),R=c&&c.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&K(t,e,r)};Object.defineProperty(c,"__esModule",{value:!0});R(w(),c)});var D=n(require("yargs")),b=require("yargs/helpers"),a=n(require("path")),s=n(require("fs/promises")),m=n(require("fs-extra")),f=n(require("node-fetch")),k=require("pyodide"),T=n(v());global.fetch=f.default;async function B(e){console.info("Copy the build directory (the bare built app files) to this directory...");let t=a.default.resolve(__dirname,"../build");if(!(await s.default.stat(t)).isDirectory())throw new Error(`The source ${t} does not exist.`);if(t===e.copyTo){console.warn(`sourceDir == destDir (${t}). Are you in the development environment? Skip copying the directory.`);return}if(e.keepOld)try{await s.default.access(e.copyTo),console.info(`${e.copyTo} already exists. Use it and skip copying.`);return}catch{throw new Error(`${e.copyTo} does not exist even though the \`keepOld\` option is specified`)}console.log(`Copy ${t} to ${e.copyTo}`),await s.default.rm(e.copyTo,{recursive:!0,force:!0}),await m.default.copy(t,e.copyTo)}async function _(e,t){console.log(`Install the local wheel ${t}`);let r=await s.default.readFile(t),i="/tmp/"+a.default.basename(t);e.FS.writeFile(i,r);let o=e.pyimport("micropip"),l=`emfs:${i}`;console.log(`Install ${l}`),await o.install.callKwargs(l,{keep_going:!0})}async function E(e){console.info("Create the site-packages snapshot file...");let t=await(0,k.loadPyodide)();if(await t.loadPackage(["micropip"]),e.useLocalKernelWheels){let l=a.default.dirname(require.resolve("@stlite/kernel")),p=a.default.resolve(l,"../py");await _(t,a.default.join(p,"stlite-server/dist/stlite_server-0.1.0-py3-none-any.whl")),await _(t,a.default.join(p,"streamlit/lib/dist/streamlit-1.21.0-py2.py3-none-any.whl"))}else{let p=require(a.default.resolve(__dirname,"../package.json")).version,S=`https://data.jsdelivr.com/v1/package/npm/@stlite/kernel@${p}/flat`,y=(await(await(0,f.default)(S)).json()).files.filter(d=>d.name.endsWith(".whl")).map(d=>`https://cdn.jsdelivr.net/npm/@stlite/kernel@${p}${d.name}`),q=t.pyimport("micropip");console.log("Install",y),await q.install.callKwargs(y,{keep_going:!0})}console.log(`Install the requirements ${JSON.stringify(e.requirements)}`),await t.pyimport("micropip").install.callKwargs(e.requirements,{keep_going:!0}),console.log("Archive the site-packages director(y|ies)");let i="/tmp/site-packages-snapshot.tar.gz";await t.runPythonAsync(`
|
|
4
4
|
import tarfile
|
|
5
5
|
import site
|
|
6
6
|
|
|
@@ -1,48 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": {
|
|
3
3
|
"main.css": "/static/css/main.b43a24ba.css",
|
|
4
|
-
"main.js": "/static/js/main.
|
|
5
|
-
"static/js/7073.
|
|
4
|
+
"main.js": "/static/js/main.1add465f.js",
|
|
5
|
+
"static/js/7073.0a198301.chunk.js": "/static/js/7073.0a198301.chunk.js",
|
|
6
6
|
"static/js/4994.551c87ac.chunk.js": "/static/js/4994.551c87ac.chunk.js",
|
|
7
|
-
"static/js/9462.
|
|
7
|
+
"static/js/9462.81f9c52a.chunk.js": "/static/js/9462.81f9c52a.chunk.js",
|
|
8
8
|
"static/js/1367.9dcea0bc.chunk.js": "/static/js/1367.9dcea0bc.chunk.js",
|
|
9
9
|
"static/js/5865.90a40692.chunk.js": "/static/js/5865.90a40692.chunk.js",
|
|
10
10
|
"static/css/3376.60b7ada4.chunk.css": "/static/css/3376.60b7ada4.chunk.css",
|
|
11
|
-
"static/js/3376.
|
|
12
|
-
"static/js/8461.
|
|
11
|
+
"static/js/3376.d5aaecc4.chunk.js": "/static/js/3376.d5aaecc4.chunk.js",
|
|
12
|
+
"static/js/8461.85faefa1.chunk.js": "/static/js/8461.85faefa1.chunk.js",
|
|
13
13
|
"static/js/5752.d5d30939.chunk.js": "/static/js/5752.d5d30939.chunk.js",
|
|
14
14
|
"static/js/8565.f27e3917.chunk.js": "/static/js/8565.f27e3917.chunk.js",
|
|
15
|
-
"static/js/2116.
|
|
15
|
+
"static/js/2116.fd3de825.chunk.js": "/static/js/2116.fd3de825.chunk.js",
|
|
16
16
|
"static/js/6097.56c4b02a.chunk.js": "/static/js/6097.56c4b02a.chunk.js",
|
|
17
17
|
"static/js/91.f23bbeac.chunk.js": "/static/js/91.f23bbeac.chunk.js",
|
|
18
|
-
"static/js/2632.
|
|
18
|
+
"static/js/2632.de1769ff.chunk.js": "/static/js/2632.de1769ff.chunk.js",
|
|
19
19
|
"static/js/9735.0e70600f.chunk.js": "/static/js/9735.0e70600f.chunk.js",
|
|
20
|
-
"static/js/5678.
|
|
21
|
-
"static/js/9551.
|
|
22
|
-
"static/js/7937.
|
|
23
|
-
"static/js/3392.
|
|
24
|
-
"static/js/7496.
|
|
25
|
-
"static/js/3977.
|
|
20
|
+
"static/js/5678.729bced9.chunk.js": "/static/js/5678.729bced9.chunk.js",
|
|
21
|
+
"static/js/9551.c45b17cf.chunk.js": "/static/js/9551.c45b17cf.chunk.js",
|
|
22
|
+
"static/js/7937.4b1be66e.chunk.js": "/static/js/7937.4b1be66e.chunk.js",
|
|
23
|
+
"static/js/3392.5ed3420d.chunk.js": "/static/js/3392.5ed3420d.chunk.js",
|
|
24
|
+
"static/js/7496.0f941cac.chunk.js": "/static/js/7496.0f941cac.chunk.js",
|
|
25
|
+
"static/js/3977.24eb5fb8.chunk.js": "/static/js/3977.24eb5fb8.chunk.js",
|
|
26
26
|
"static/js/6242.5e6f91ac.chunk.js": "/static/js/6242.5e6f91ac.chunk.js",
|
|
27
|
-
"static/js/6422.
|
|
28
|
-
"static/js/4210.
|
|
29
|
-
"static/js/5608.
|
|
30
|
-
"static/js/7698.
|
|
31
|
-
"static/js/761.
|
|
27
|
+
"static/js/6422.c2900a88.chunk.js": "/static/js/6422.c2900a88.chunk.js",
|
|
28
|
+
"static/js/4210.945a5966.chunk.js": "/static/js/4210.945a5966.chunk.js",
|
|
29
|
+
"static/js/5608.b4074ab9.chunk.js": "/static/js/5608.b4074ab9.chunk.js",
|
|
30
|
+
"static/js/7698.00f5ff0b.chunk.js": "/static/js/7698.00f5ff0b.chunk.js",
|
|
31
|
+
"static/js/761.ca3883de.chunk.js": "/static/js/761.ca3883de.chunk.js",
|
|
32
32
|
"static/js/5070.1d0d565e.chunk.js": "/static/js/5070.1d0d565e.chunk.js",
|
|
33
|
-
"static/js/464.
|
|
34
|
-
"static/js/277.
|
|
35
|
-
"static/js/4514.
|
|
36
|
-
"static/js/2523.
|
|
37
|
-
"static/js/8355.
|
|
38
|
-
"static/js/7858.
|
|
33
|
+
"static/js/464.7c22f33c.chunk.js": "/static/js/464.7c22f33c.chunk.js",
|
|
34
|
+
"static/js/277.d9ceff66.chunk.js": "/static/js/277.d9ceff66.chunk.js",
|
|
35
|
+
"static/js/4514.7931bd64.chunk.js": "/static/js/4514.7931bd64.chunk.js",
|
|
36
|
+
"static/js/2523.4761d79a.chunk.js": "/static/js/2523.4761d79a.chunk.js",
|
|
37
|
+
"static/js/8355.b110abc9.chunk.js": "/static/js/8355.b110abc9.chunk.js",
|
|
38
|
+
"static/js/7858.e4a6aa6d.chunk.js": "/static/js/7858.e4a6aa6d.chunk.js",
|
|
39
39
|
"static/js/7842.a98fbb15.chunk.js": "/static/js/7842.a98fbb15.chunk.js",
|
|
40
40
|
"static/js/2961.e91b0c14.chunk.js": "/static/js/2961.e91b0c14.chunk.js",
|
|
41
41
|
"static/js/7135.57023452.chunk.js": "/static/js/7135.57023452.chunk.js",
|
|
42
|
-
"static/js/458.895bbb73.chunk.js": "/static/js/458.895bbb73.chunk.js",
|
|
43
42
|
"static/js/6449.702355ee.chunk.js": "/static/js/6449.702355ee.chunk.js",
|
|
44
43
|
"static/js/2909.783348bb.chunk.js": "/static/js/2909.783348bb.chunk.js",
|
|
45
|
-
"static/js/
|
|
44
|
+
"static/js/6223.4bb0039e.chunk.js": "/static/js/6223.4bb0039e.chunk.js",
|
|
46
45
|
"static/js/1839.410079bf.chunk.js": "/static/js/1839.410079bf.chunk.js",
|
|
47
46
|
"static/css/4320.1edfa457.chunk.css": "/static/css/4320.1edfa457.chunk.css",
|
|
48
47
|
"static/js/4320.8fa60786.chunk.js": "/static/js/4320.8fa60786.chunk.js",
|
|
@@ -55,7 +54,7 @@
|
|
|
55
54
|
"static/js/8910.e6dda87e.chunk.js": "/static/js/8910.e6dda87e.chunk.js",
|
|
56
55
|
"static/js/6865.b0803b6b.chunk.js": "/static/js/6865.b0803b6b.chunk.js",
|
|
57
56
|
"static/js/6679.859559e9.chunk.js": "/static/js/6679.859559e9.chunk.js",
|
|
58
|
-
"pypi/streamlit-1.
|
|
57
|
+
"pypi/streamlit-1.21.0-py2.py3-none-any.whl": "/pypi/streamlit-1.21.0-py2.py3-none-any.whl",
|
|
59
58
|
"static/media/SourceSansPro-Regular.ttf": "/static/media/SourceSansPro-Regular.efa76f8326aa5cee3bdd.ttf",
|
|
60
59
|
"static/media/SourceSansPro-SemiBold.ttf": "/static/media/SourceSansPro-SemiBold.43cc81b496222dc9ce3c.ttf",
|
|
61
60
|
"static/media/SourceSansPro-Bold.ttf": "/static/media/SourceSansPro-Bold.12e6acd2589d00c9d0aa.ttf",
|
|
@@ -82,6 +81,7 @@
|
|
|
82
81
|
"static/media/KaTeX_AMS-Regular.ttf": "/static/media/KaTeX_AMS-Regular.853be92419a6c3766b9a.ttf",
|
|
83
82
|
"static/media/KaTeX_Main-Regular.ttf": "/static/media/KaTeX_Main-Regular.9eba1d77abcf2aa6e94e.ttf",
|
|
84
83
|
"static/media/KaTeX_Main-Bold.ttf": "/static/media/KaTeX_Main-Bold.8169508bf58f8bd92ad8.ttf",
|
|
84
|
+
"static/media/rocket.svg": "/static/media/rocket.b75b17d2b0a063c6cea230d1a9d77f1e.svg",
|
|
85
85
|
"static/media/KaTeX_Main-Italic.ttf": "/static/media/KaTeX_Main-Italic.fa675e5e4bec9eb250b6.ttf",
|
|
86
86
|
"static/media/KaTeX_AMS-Regular.woff": "/static/media/KaTeX_AMS-Regular.d562e886c52f12660a41.woff",
|
|
87
87
|
"static/media/KaTeX_Main-BoldItalic.ttf": "/static/media/KaTeX_Main-BoldItalic.828abcb200061cffbaae.ttf",
|
|
@@ -147,10 +147,12 @@
|
|
|
147
147
|
"static/media/KaTeX_Size3-Regular.woff": "/static/media/KaTeX_Size3-Regular.7947224e8a9914fa332b.woff",
|
|
148
148
|
"static/media/KaTeX_Size3-Regular.woff2": "/static/media/KaTeX_Size3-Regular.e1951519f6f0596f7356.woff2",
|
|
149
149
|
"static/media/icon_running.gif": "/static/media/icon_running.de1119daebe465fa5263.gif",
|
|
150
|
-
"
|
|
150
|
+
"static/media/logo.svg": "/static/media/logo.83ae4f2fb87e38be7cbb8a5d2beb64d2.svg",
|
|
151
|
+
"index.html": "/index.html",
|
|
152
|
+
"static/media/checkmark.svg": "/static/media/checkmark.29851c8e9e6ef0c3d6c1e4efe3c1bb9e.svg"
|
|
151
153
|
},
|
|
152
154
|
"entrypoints": [
|
|
153
155
|
"static/css/main.b43a24ba.css",
|
|
154
|
-
"static/js/main.
|
|
156
|
+
"static/js/main.1add465f.js"
|
|
155
157
|
]
|
|
156
158
|
}
|
package/build/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>stlite</title><meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'wasm-unsafe-eval' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; worker-src 'self' blob:; script-src-elem 'self' 'unsafe-inline' https:; style-src-elem 'self' 'unsafe-inline' https:; font-src 'self' data: https:; connect-src https://data.streamlit.io/ https://*.mapbox.com/ 'self' https:; img-src https: blob: data: file:; media-src https: blob:; frame-src https:"><script defer="defer" src="/static/js/main.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>stlite</title><meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'wasm-unsafe-eval' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; worker-src 'self' blob:; script-src-elem 'self' 'unsafe-inline' https:; style-src-elem 'self' 'unsafe-inline' https:; font-src 'self' data: https:; connect-src https://data.streamlit.io/ https://*.mapbox.com/ 'self' https:; img-src https: blob: data: file:; media-src https: blob:; frame-src https:"><script defer="defer" src="/static/js/main.1add465f.js"></script><link href="/static/css/main.b43a24ba.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[2116],{339:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>_});var o=i(5057),n=i(97991),s=i(50482),a=i.n(s),r=i(64169),h=i(31476),c=i(99362),l=i(34531),p=i(80552),d=i(58186),m=i(65815),w=i(50256),g=i(98899),u=i(22404),x=i(719),b=i(62658),S=i(53313),k=i(77234),j=i(10458),y=i.n(j),f=i(47143);class v extends Error{}class T extends Error{}class V{static async get(t){const{commandLine:e,userMapboxToken:i}=t.current;return V.token&&V.commandLine===e.toLowerCase()||(V.token=""!==i?i:await this.fetchToken("https://data.streamlit.io/tokens.json","mapbox"),V.commandLine=e.toLowerCase()),V.token}static async fetchToken(t,e){try{const i=await y().get(t),{[e]:o}=i.data;if(null==o||""===o)throw new Error(`Missing token "${e}"`);return o}catch(i){const e=(0,f.b)(i);throw new T(`${e.message} (${t})`)}}}V.token=void 0,V.commandLine=void 0,V.isRunningLocal=()=>{const{hostname:t}=window.location;return"localhost"===t||"127.0.0.1"===t};var C=i(56129),E=i.n(C),M=i(69402),Z=i(96266);const O=({error:t,width:e,deltaType:i})=>t instanceof v?(0,Z.jsx)(M.Z,{width:e,name:"No Mapbox token provided",message:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)("p",{children:["To use ",(0,Z.jsxs)("code",{children:["st.",i]})," or ",(0,Z.jsx)("code",{children:"st.map"})," you need to set up a Mapbox access token."]}),(0,Z.jsxs)("p",{children:["To get a token, create an account at"," ",(0,Z.jsx)("a",{href:"https://mapbox.com",children:"https://mapbox.com"}),". It's free for moderate usage levels!"]}),(0,Z.jsxs)("p",{children:["Once you have a token, just set it using the Streamlit config option ",(0,Z.jsx)("code",{children:"mapbox.token"})," and don't forget to restart your Streamlit server at this point if it's still running, then reload this tab."]}),(0,Z.jsxs)("p",{children:["See"," ",(0,Z.jsx)("a",{href:"https://docs.streamlit.io/library/advanced-features/configuration#view-all-configuration-options",children:"our documentation"})," ","for more info on how to set config options."]})]})}):t instanceof T?(0,Z.jsx)(M.Z,{width:e,name:"Error fetching Streamlit Mapbox token",message:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)("p",{children:"This app requires an internet connection."}),(0,Z.jsx)("p",{children:"Please check your connection and try again."}),(0,Z.jsxs)("p",{children:["If you think this is a bug, please file bug report"," ",(0,Z.jsx)("a",{href:"https://github.com/streamlit/streamlit/issues/new/choose",children:"here"}),"."]})]})}):(0,Z.jsx)(M.Z,{width:e,name:"Error fetching Streamlit Mapbox token",message:t.message}),F=t=>e=>{class i extends o.PureComponent{constructor(i){super(i),this.initMapboxToken=async()=>{try{const t=await V.get(this.props.sessionInfo);this.setState({mapboxToken:t,isFetching:!1})}catch(t){const e=(0,f.b)(t);this.setState({mapboxTokenError:e,isFetching:!1})}},this.render=()=>{const{mapboxToken:i,mapboxTokenError:o,isFetching:n}=this.state,{width:s}=this.props;return o?(0,Z.jsx)(O,{width:s,error:o,deltaType:t}):n?(0,Z.jsx)(S.Z,{body:"Loading...",kind:k.h.INFO,width:s}):(0,Z.jsx)(e,{...this.props,mapboxToken:i,width:s})},this.state={isFetching:!0,mapboxToken:void 0,mapboxTokenError:void 0},this.initMapboxToken()}}return i.displayName=`withMapboxToken(${e.displayName||e.name})`,E()(i,e)};var L=i(34422),N=i(45490);const P=(0,N.Z)("div",{target:"e1q4dr931"})((({width:t,height:e,theme:i})=>({marginTop:i.spacing.sm,position:"relative",height:e,width:t})),""),I=(0,N.Z)("div",{target:"e1q4dr930"})((({theme:t})=>({position:"absolute",right:"2.625rem",top:t.spacing.md,zIndex:1,"button:not(:disabled)":{background:t.colors.bgColor,"& + button":{borderTopColor:t.colors.secondaryBg},"& span":{filter:(0,c.Iy)(t)?"":"invert(100%)"}}})),"");i(20512);const z={classes:{...l,...m,...d,...w}};(0,x.fh)([g.w,u.E]);const D=new p.Z({configuration:z});class $ extends o.PureComponent{constructor(...t){super(...t),this.state={viewState:{bearing:0,pitch:0,zoom:11},initialized:!1,initialViewState:{}},this.componentDidMount=()=>{this.setState({initialized:!0})},this.createTooltip=t=>{const{element:e}=this.props;if(!t||!t.object||!e.tooltip)return!1;const i=JSON.parse(e.tooltip);return i.html?i.html=this.interpolate(t,i.html):i.text=this.interpolate(t,i.text),i},this.interpolate=(t,e)=>{const i=e.match(/{(.*?)}/g);return i&&i.forEach((i=>{const o=i.substring(1,i.length-1);t.object.hasOwnProperty(o)&&(e=e.replace(i,t.object[o]))})),e},this.onViewStateChange=({viewState:t})=>{this.setState({viewState:t})}}static getDerivedStateFromProps(t,e){const i=$.getDeckObject(t);if(!a()(i.initialViewState,e.initialViewState)){const t=Object.keys(i.initialViewState).reduce(((t,o)=>i.initialViewState[o]===e.initialViewState[o]?t:{...t,[o]:i.initialViewState[o]}),{});return{viewState:{...e.viewState,...t},initialViewState:i.initialViewState}}return null}render(){const t=$.getDeckObject(this.props),{viewState:e}=this.state;return(0,Z.jsx)(P,{className:"stDeckGlJsonChart",width:t.initialViewState.width,height:t.initialViewState.height,children:(0,Z.jsxs)(n.Z,{viewState:e,onViewStateChange:this.onViewStateChange,height:t.initialViewState.height,width:t.initialViewState.width,layers:this.state.initialized?t.layers:[],getTooltip:this.createTooltip,ContextProvider:r.X$.Provider,controller:!0,children:[(0,Z.jsx)(r.Z3,{height:t.initialViewState.height,width:t.initialViewState.width,mapStyle:t.mapStyle&&("string"===typeof t.mapStyle?t.mapStyle:t.mapStyle[0]),mapboxApiAccessToken:this.props.mapboxToken}),(0,Z.jsx)(I,{children:(0,Z.jsx)(r.Pv,{className:"zoomButton",showCompass:!1})})]})})}}$.getDeckObject=t=>{const{element:e,width:i,height:o,theme:n}=t,s=JSON.parse(e.json);if(!(0,L.bb)(s.mapStyle)){const t=(0,c.Iy)(n)?"light":"dark";s.mapStyle=`mapbox://styles/mapbox/${t}-v9`}return o?(s.initialViewState.height=o,s.initialViewState.width=i):(s.initialViewState.height||(s.initialViewState.height=500),e.useContainerWidth&&(s.initialViewState.width=i)),delete s.views,D.convert(s)};const _=(0,h.b)(F("st.pydeck_chart")((0,b.Z)($)))},37398:()=>{},85248:()=>{}}]);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[2523],{6757:(t,e,r)=>{r.d(e,{Z:()=>u});r(5057);var n=r(34422),o=r(86964),i=r(45490);const a=r(21371).F4`
|
|
2
|
+
50% {
|
|
3
|
+
color: rgba(0, 0, 0, 0);
|
|
4
|
+
}
|
|
5
|
+
`,s=(0,i.Z)("span",{target:"e1m4n6jn0"})((({includeDot:t,shouldBlink:e,theme:r})=>({...t?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:r.colors.gray,margin:"0 5px"}}:{},...e?{color:r.colors.red,animationName:`${a}`,animationDuration:"0.5s",animationIterationCount:5}:{}})),"");var l=r(96266);const u=({dirty:t,value:e,maxLength:r,className:i,type:a="single"})=>{const u=[],c=(t,e=!1)=>{u.push((0,l.jsx)(s,{includeDot:u.length>0,shouldBlink:e,children:t},u.length))};return t&&("multiline"===a?(0,n.Ge)()?c("Press \u2318+Enter to apply"):c("Press Ctrl+Enter to apply"):c("Press Enter to apply")),r&&c(`${e.length}/${r}`,t&&e.length>=r),(0,l.jsx)(o.X7,{className:i,children:u})}},42523:(t,e,r)=>{r.r(e),r.d(e,{default:()=>m});var n=r(5057),o=r(30124),i=r(32291),a=r(56846),s=r(6757),l=r(86964),u=r(8429),c=r(54840),p=r(34422);const d=(0,r(45490).Z)("div",{target:"edfmue0"})((({width:t})=>({position:"relative",width:t})),"");var f=r(96266);class h extends n.PureComponent{constructor(...t){super(...t),this.formClearHelper=new a.Kz,this.state={dirty:!1,value:this.initialValue},this.commitWidgetValue=t=>{this.props.widgetMgr.setStringValue(this.props.element,this.state.value,t),this.setState({dirty:!1})},this.onFormCleared=()=>{this.setState(((t,e)=>({value:e.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.onBlur=()=>{this.state.dirty&&this.commitWidgetValue({fromUi:!0})},this.onChange=t=>{const{value:e}=t.target,{element:r}=this.props,{maxChars:n}=r;0!==n&&e.length>n||((0,p.$b)(this.props.element)?this.setState({dirty:!1,value:e},(()=>this.commitWidgetValue({fromUi:!0}))):this.setState({dirty:!0,value:e}))},this.onKeyPress=t=>{"Enter"===t.key&&this.state.dirty&&this.commitWidgetValue({fromUi:!0})}}get initialValue(){const t=this.props.widgetMgr.getStringValue(this.props.element);return void 0!==t?t:this.props.element.default}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:t}=this.props.element;t&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:t}=this.props.element;this.props.element.setValue=!1,this.setState({value:t},(()=>{this.commitWidgetValue({fromUi:!1})}))}getTypeString(){return this.props.element.type===i.oi.Type.PASSWORD?"password":"text"}render(){var t;const{dirty:e,value:r}=this.state,{element:n,width:i,disabled:a,widgetMgr:h}=this.props,{placeholder:m}=n;return this.formClearHelper.manageFormClearListener(h,n.formId,this.onFormCleared),(0,f.jsxs)(d,{className:"row-widget stTextInput",width:i,children:[(0,f.jsx)(l.ON,{label:n.label,disabled:a,labelVisibility:(0,p.iF)(null===(t=n.labelVisibility)||void 0===t?void 0:t.value),children:n.help&&(0,f.jsx)(l.dT,{children:(0,f.jsx)(u.ZP,{content:n.help,placement:c.ug.TOP_RIGHT})})}),(0,f.jsx)(o.Z,{value:r,placeholder:m,onBlur:this.onBlur,onChange:this.onChange,onKeyPress:this.onKeyPress,"aria-label":n.label,disabled:a,type:this.getTypeString(),autoComplete:n.autocomplete,overrides:{Input:{style:{minWidth:0,"::placeholder":{opacity:"0.7"},lineHeight:"1.4",paddingRight:".5rem",paddingLeft:".5rem",paddingBottom:".5rem",paddingTop:".5rem"}},Root:{style:{borderLeftWidth:"1px",borderRightWidth:"1px",borderTopWidth:"1px",borderBottomWidth:"1px"}}}}),(0,f.jsx)(s.Z,{dirty:e,value:r,maxLength:n.maxChars})]})}}const m=h},30124:(t,e,r)=>{r.d(e,{Z:()=>x});var n=r(5057),o=r(80099),i=r(91224),a=r(97135),s=r(4547),l=r(18150);function u(t){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u(t)}var c=["Root","StartEnhancer","EndEnhancer"],p=["startEnhancer","endEnhancer","overrides"];function d(){return d=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},d.apply(this,arguments)}function f(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!==typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(l){s=!0,o=l}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}(t,e)||function(t,e){if(!t)return;if("string"===typeof t)return h(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return h(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function m(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function y(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function b(t,e){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},b(t,e)}function g(t){var e=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=j(t);if(e){var o=j(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(t,e){if(e&&("object"===u(e)||"function"===typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return v(t)}(this,r)}}function v(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function j(t){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},j(t)}function w(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var O=function(t){!function(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&b(t,e)}(j,t);var e,r,u,h=g(j);function j(){var t;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,j);for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return w(v(t=h.call.apply(h,[this].concat(r))),"state",{isFocused:t.props.autoFocus||!1}),w(v(t),"onFocus",(function(e){t.setState({isFocused:!0}),t.props.onFocus(e)})),w(v(t),"onBlur",(function(e){t.setState({isFocused:!1}),t.props.onBlur(e)})),t}return e=j,(r=[{key:"render",value:function(){var t=this.props,e=t.startEnhancer,r=t.endEnhancer,u=t.overrides,h=u.Root,y=u.StartEnhancer,b=u.EndEnhancer,g=m(u,c),v=m(t,p),j=f((0,o.jb)(h,s.fC),2),w=j[0],O=j[1],x=f((0,o.jb)(y,s.Fp),2),E=x[0],C=x[1],F=f((0,o.jb)(b,s.Fp),2),T=F[0],V=F[1],B=(0,i.t)(this.props,this.state);return n.createElement(w,d({"data-baseweb":"input"},B,O,{$adjoined:P(e,r),$hasIconTrailing:this.props.clearable||"password"==this.props.type}),S(e)&&n.createElement(E,d({},B,C,{$position:l.Xf.start}),"function"===typeof e?e(B):e),n.createElement(a.Z,d({},v,{overrides:g,adjoined:P(e,r),onFocus:this.onFocus,onBlur:this.onBlur})),S(r)&&n.createElement(T,d({},B,V,{$position:l.Xf.end}),"function"===typeof r?r(B):r))}}])&&y(e.prototype,r),u&&y(e,u),Object.defineProperty(e,"prototype",{writable:!1}),j}(n.Component);function P(t,e){return S(t)&&S(e)?l.y4.both:S(t)?l.y4.left:S(e)?l.y4.right:l.y4.none}function S(t){return Boolean(t||0===t)}w(O,"defaultProps",{autoComplete:"on",autoFocus:!1,disabled:!1,name:"",onBlur:function(){},onFocus:function(){},overrides:{},required:!1,size:l.NO.default,startEnhancer:null,endEnhancer:null,clearable:!1,type:"text",readOnly:!1});const x=O}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[2632],{86926:(t,i,e)=>{"use strict";e.r(i),e.d(i,{default:()=>u});e(5057);var n=e(89733),o=e(35e3),r=e(62658),a=e(22199),d=e(45490);const l=(0,d.Z)("div",{target:"etr89bj2"})((({theme:t})=>({display:"flex",flexDirection:"row",flexWrap:"wrap",rowGap:t.spacing.lg})),""),s=(0,d.Z)("div",{target:"etr89bj1"})((()=>({display:"flex",flexDirection:"column",alignItems:"stretch",width:"auto",flexGrow:0})),""),h=(0,d.Z)("div",{target:"etr89bj0"})((({theme:t})=>({fontFamily:t.genericFonts.bodyFont,fontSize:t.fontSizes.sm,color:t.colors.fadedText60,textAlign:"center",marginTop:t.spacing.xs,wordWrap:"break-word",padding:"0.125rem"})),"");var c,g=e(96266);!function(t){t[t.OriginalWidth=-1]="OriginalWidth",t[t.ColumnWidth=-2]="ColumnWidth",t[t.AutoWidth=-3]="AutoWidth"}(c||(c={}));const u=(0,r.Z)((function({width:t,isFullScreen:i,element:e,height:r,endpoints:d}){const u=(0,o.$R)(e.imgs);let p;const m=e.width;if(m===c.OriginalWidth||m===c.AutoWidth)p=void 0;else if(m===c.ColumnWidth)p=t;else{if(!(m>0))throw Error(`Invalid image width: ${m}`);p=m}const f={};return r&&i?(f.maxHeight=r,f["object-fit"]="contain"):(f.width=p,m===c.AutoWidth&&(f.maxWidth="100%")),(0,g.jsx)(l,{style:{width:t},children:u.map(((t,i)=>{const e=t;return(0,g.jsxs)(s,{"data-testid":"stImage",children:[e.markup?(0,n.ZP)((0,a.kB)(e.markup)):(0,g.jsx)("img",{style:f,src:d.buildMediaURL(e.url),alt:i.toString()}),e.caption&&(0,g.jsx)(h,{"data-testid":"caption",style:f,children:` ${e.caption} `})]},i)}))})}))},24875:()=>{}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[277],{77390:(e,t,i)=>{i.d(t,{$:()=>g,Z:()=>p});var s=i(5057),n=i(31476),a=i(63),l=i(99362),r=i(16449),o=i(80099),d=i(96266);let g;!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(g||(g={}));const p=function({value:e,width:t,size:i=g.SMALL,overrides:p}){const c=(0,n.u)(),h={xs:c.spacing.twoXS,sm:c.spacing.sm,md:c.spacing.lg,lg:c.spacing.xl,xl:c.spacing.twoXL},{activeTheme:m}=s.useContext(a.I),u=!(0,l.MJ)(m),x={BarContainer:{style:{marginTop:c.spacing.none,marginBottom:c.spacing.none,marginRight:c.spacing.none,marginLeft:c.spacing.none}},Bar:{style:({$theme:e})=>({width:t?t.toString():void 0,marginTop:c.spacing.none,marginBottom:c.spacing.none,marginRight:c.spacing.none,marginLeft:c.spacing.none,height:h[i],backgroundColor:e.colors.progressbarTrackFill,borderTopLeftRadius:c.spacing.twoXS,borderTopRightRadius:c.spacing.twoXS,borderBottomLeftRadius:c.spacing.twoXS,borderBottomRightRadius:c.spacing.twoXS})},BarProgress:{style:()=>({backgroundColor:u?c.colors.primary:c.colors.blue70,borderTopLeftRadius:c.spacing.twoXS,borderTopRightRadius:c.spacing.twoXS,borderBottomLeftRadius:c.spacing.twoXS,borderBottomRightRadius:c.spacing.twoXS})}};return(0,d.jsx)(r.Z,{value:e,overrides:(0,o.aO)(x,p)})}},41605:(e,t,i)=>{i.d(t,{R:()=>s});class s{setStatus(e){return new s(this.name,this.size,this.id,e)}constructor(e,t,i,s){this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=e,this.size=t,this.id=i,this.status=s}}},277:(e,t,i)=>{i.r(t),i.d(t,{default:()=>ge});var s=i(10458),n=i.n(s),a=i(65873),l=i.n(a),r=i(5057),o=i(32291),d=i(56846),g=i(34422);let p;!function(e){e.Gigabyte="gb",e.Megabyte="mb",e.Kilobyte="kb",e.Byte="b"}(p||(p={}));const c=(0,g.rA)()?1024:1e3,h=[p.Gigabyte,p.Megabyte,p.Kilobyte,p.Byte],m=(e,t,i=1)=>{if(t||(t=p.Byte),i<0&&(i=0),e<0)throw new Error("Size must be greater than or equal to 0");const s=h.indexOf(t);return s&&e>c/2?m(e/c,h[s-1],i):`${e.toFixed(i)}${t.toUpperCase()}`};var u=i(86964),x=i(8429),f=i(54840),v=i(71096),y=i(92445),S=i(45490);const b=(0,S.Z)("section",{target:"exg6vvm15"})((({isDisabled:e,theme:t})=>({display:"flex",alignItems:"center",padding:t.spacing.lg,backgroundColor:t.colors.secondaryBg,borderRadius:t.radii.md,":focus":{outline:"none",boxShadow:`0 0 0 1px ${t.colors.primary}`},color:e?t.colors.gray:t.colors.bodyText})),""),w=(0,S.Z)("div",{target:"exg6vvm14"})((()=>({marginRight:"auto",alignItems:"center",display:"flex"})),""),F=(0,S.Z)("span",{target:"exg6vvm13"})((({theme:e})=>({color:e.colors.darkenedBgMix100,marginRight:e.spacing.lg})),""),j=(0,S.Z)("span",{target:"exg6vvm12"})((({theme:e})=>({marginBottom:e.spacing.twoXS})),""),I=(0,S.Z)("div",{target:"exg6vvm11"})({name:"1fttcpj",styles:"display:flex;flex-direction:column"}),z=(0,S.Z)("div",{target:"exg6vvm10"})((({theme:e})=>({left:0,right:0,lineHeight:e.lineHeights.tight,paddingTop:e.spacing.md,paddingLeft:e.spacing.lg,paddingRight:e.spacing.lg})),""),B=(0,S.Z)("ul",{target:"exg6vvm9"})((()=>({listStyleType:"none",marginBottom:0})),""),M=(0,S.Z)("li",{target:"exg6vvm8"})((({theme:e})=>({margin:e.spacing.none,padding:e.spacing.none})),""),L=(0,S.Z)("div",{target:"exg6vvm7"})((({theme:e})=>({display:"flex",alignItems:"baseline",flex:1,paddingLeft:e.spacing.lg,overflow:"hidden"})),""),Z=(0,S.Z)("div",{target:"exg6vvm6"})((({theme:e})=>({marginRight:e.spacing.sm,marginBottom:e.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),""),R=(0,S.Z)("div",{target:"exg6vvm5"})((({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing.twoXS})),""),C=(0,S.Z)("span",{target:"exg6vvm4"})((({theme:e})=>({marginRight:e.spacing.twoXS})),""),k=(0,S.Z)("div",{target:"exg6vvm3"})((({theme:e})=>({display:"flex",padding:e.spacing.twoXS,color:e.colors.darkenedBgMix100})),""),U=(0,S.Z)("small",{target:"exg6vvm2"})((({theme:e})=>({color:e.colors.danger,fontSize:e.fontSizes.sm,height:e.fontSizes.sm,lineHeight:e.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"})),""),P=(0,S.Z)("span",{target:"exg6vvm1"})({name:"0",styles:""}),T=e=>({[b]:{display:"flex",flexDirection:"column",alignItems:"flex-start"},[w]:{marginBottom:e.spacing.lg},[F]:{display:"none"},[z]:{paddingRight:e.spacing.lg},[R]:{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm},[Z]:{width:e.sizes.full},[L]:{flexDirection:"column"},[U]:{height:"auto",whiteSpace:"initial"},[P]:{display:"none"},[M]:{margin:e.spacing.none,padding:e.spacing.none}}),X=(0,S.Z)("div",{target:"exg6vvm0"})((({theme:e})=>e.inSidebar?T(e):{[`@media (max-width: ${e.breakpoints.sm})`]:T(e)}),"");var D=i(44071),E=i(97292),A=i(10786),N=i(96266);const $=({multiple:e,acceptedExtensions:t,maxSizeBytes:i})=>(0,N.jsxs)(w,{children:[(0,N.jsx)(F,{children:(0,N.jsx)(E.ZP,{content:D.n,size:"threeXL"})}),(0,N.jsxs)(I,{children:[(0,N.jsxs)(j,{children:["Drag and drop file",e?"s":""," here"]}),(0,N.jsxs)(A.x,{children:[`Limit ${m(i,p.Byte,0)} per file`,t.length?` \u2022 ${t.join(", ").replace(/\./g,"").toUpperCase()}`:null]})]})]}),V=({onDrop:e,multiple:t,acceptedExtensions:i,maxSizeBytes:s,disabled:n,label:a})=>(0,N.jsx)(v.ZP,{onDrop:e,multiple:t,accept:i.length?i:void 0,maxSize:s,disabled:n,useFsAccessApi:!1,children:({getRootProps:e,getInputProps:l})=>(0,N.jsxs)(b,{...e(),"data-testid":"stFileUploadDropzone",isDisabled:n,"aria-label":a,children:[(0,N.jsx)("input",{...l()}),(0,N.jsx)($,{multiple:t,acceptedExtensions:i,maxSizeBytes:s}),(0,N.jsx)(y.ZP,{kind:y.hY.SECONDARY,disabled:n,size:y.$u.SMALL,children:"Browse files"})]})});var O=i(56129),H=i.n(O),_=i(75427),G=i(5642);const W=(0,S.Z)("div",{target:"e1f8s2qs1"})((({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:e.spacing.twoXS,marginBottom:e.spacing.twoXS})),""),Y=(0,S.Z)("div",{target:"e1f8s2qs0"})((({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",color:e.colors.fadedText40})),""),q=({className:e,currentPage:t,totalPages:i,onNext:s,onPrevious:n})=>(0,N.jsxs)(W,{className:e,children:[(0,N.jsx)(A.x,{children:`Showing page ${t} of ${i}`}),(0,N.jsxs)(Y,{children:[(0,N.jsx)(y.ZP,{onClick:n,kind:y.hY.MINIMAL,children:(0,N.jsx)(E.ZP,{content:_.s,size:"xl"})}),(0,N.jsx)(y.ZP,{onClick:s,kind:y.hY.MINIMAL,children:(0,N.jsx)(E.ZP,{content:G._,size:"xl"})})]})]});var K=i(36300);const J=(e,t)=>Math.ceil(e.length/t),Q=e=>H()((({pageSize:t,items:i,resetOnAdd:s,...n})=>{const[a,l]=(0,r.useState)(0),[o,d]=(0,r.useState)(J(i,t)),g=(0,K.D)(i);(0,r.useEffect)((()=>{g&&g.length!==i.length&&d(J(i,t)),g&&g.length<i.length?s&&l(0):a+1>=o&&l(o-1)}),[i,a,t,g,s,o]);const p=i.slice(a*t,a*t+t);return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(e,{items:p,...n}),i.length>t?(0,N.jsx)(q,{className:"streamlit-paginator",pageSize:t,totalPages:o,currentPage:a+1,onNext:()=>{l(Math.min(a+1,o-1))},onPrevious:()=>{l(Math.max(0,a-1))}}):null]})}),e);var ee=i(15766),te=i(31906),ie=i(13324),se=i(77390);const ne=({fileInfo:e})=>"uploading"===e.status.type?(0,N.jsx)(se.Z,{value:e.status.progress,size:se.$.SMALL,overrides:{Bar:{style:{marginLeft:0,marginTop:"4px"}}}}):"error"===e.status.type?(0,N.jsxs)(U,{children:[(0,N.jsx)(C,{"data-testid":"stUploadedFileErrorMessage",children:e.status.errorMessage}),(0,N.jsx)(P,{children:(0,N.jsx)(E.ZP,{content:ee.j,size:"lg"})})]}):"uploaded"===e.status.type?(0,N.jsx)(A.x,{children:m(e.size,p.Byte)}):null,ae=({fileInfo:e,onDelete:t})=>(0,N.jsxs)(R,{className:"uploadedFile",children:[(0,N.jsx)(k,{children:(0,N.jsx)(E.ZP,{content:te.h,size:"twoXL"})}),(0,N.jsxs)(L,{className:"uploadedFileData",children:[(0,N.jsx)(Z,{className:"uploadedFileName",title:e.name,children:e.name}),(0,N.jsx)(ne,{fileInfo:e})]}),(0,N.jsx)("div",{"data-testid":"fileDeleteBtn",children:(0,N.jsx)(y.ZP,{onClick:()=>t(e.id),kind:y.hY.MINIMAL,children:(0,N.jsx)(E.ZP,{content:ie.U,size:"lg"})})})]}),le=Q((({items:e,onDelete:t})=>(0,N.jsx)(B,{children:e.map((e=>(0,N.jsx)(M,{children:(0,N.jsx)(ae,{fileInfo:e,onDelete:t})},e.id)))}))),re=e=>(0,N.jsx)(z,{children:(0,N.jsx)(le,{...e})});var oe=i(41605);class de extends r.PureComponent{constructor(e){super(e),this.formClearHelper=new d.Kz,this.localFileIdCounter=1,this.componentDidUpdate=e=>{const{element:t,widgetMgr:i}=this.props;if(e.disabled!==this.props.disabled&&this.props.disabled)return this.reset(),void i.setFileUploaderStateValue(t,new o.xO,{fromUi:!1});if("ready"!==this.status)return;const s=this.createWidgetValue();if(void 0===s)return;const n=i.getFileUploaderStateValue(t);l().isEqual(s,n)||i.setFileUploaderStateValue(t,s,{fromUi:!0})},this.reset=()=>{this.setState({files:[]})},this.dropHandler=(e,t)=>{const{element:i}=this.props,{multipleFiles:s}=i;if(!s&&0===e.length&&t.length>1){const i=t.findIndex((e=>1===e.errors.length&&"too-many-files"===e.errors[0].code));i>=0&&(e.push(t[i].file),t.splice(i,1))}if(!s&&e.length>0&&this.state.files.length>0&&this.removeFile(this.state.files[0].id),e.forEach(this.uploadFile),t.length>0){const e=t.map((e=>{const{file:t}=e;return new oe.R(t.name,t.size,this.nextLocalFileId(),{type:"error",errorMessage:this.getErrorMessage(e.errors[0].code,e.file)})}));this.addFiles(e)}},this.uploadFile=e=>{const t=n().CancelToken.source(),i=new oe.R(e.name,e.size,this.nextLocalFileId(),{type:"uploading",cancelToken:t,progress:1});this.addFile(i),this.props.uploadClient.uploadFile(this.props.element,e,(e=>this.onUploadProgress(e,i.id)),t.token).then((e=>this.onUploadComplete(i.id,e))).catch((e=>{n().isCancel(e)||this.updateFile(i.id,i.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},this.onUploadComplete=(e,t)=>{this.setState((e=>({newestServerFileId:Math.max(e.newestServerFileId,t)})));const i=this.getFile(e);null!=i&&"uploading"===i.status.type&&this.updateFile(i.id,i.setStatus({type:"uploaded",serverFileId:t}))},this.getErrorMessage=(e,t)=>{switch(e){case"file-too-large":return`File must be ${m(this.maxUploadSizeInBytes,p.Byte)} or smaller.`;case"file-invalid-type":return`${t.type} files are not allowed.`;case"file-too-small":return"File size is too small.";case"too-many-files":return"Only one file is allowed.";default:return"Unexpected error. Please try again."}},this.deleteFile=e=>{const t=this.getFile(e);null!=t&&("uploading"===t.status.type&&t.status.cancelToken.cancel(),this.removeFile(e))},this.addFile=e=>{this.setState((t=>({files:[...t.files,e]})))},this.addFiles=e=>{this.setState((t=>({files:[...t.files,...e]})))},this.removeFile=e=>{this.setState((t=>({files:t.files.filter((t=>t.id!==e))})))},this.getFile=e=>this.state.files.find((t=>t.id===e)),this.updateFile=(e,t)=>{this.setState((i=>({files:i.files.map((i=>i.id===e?t:i))})))},this.onUploadProgress=(e,t)=>{const i=this.getFile(t);if(null==i||"uploading"!==i.status.type)return;const s=Math.round(100*e.loaded/e.total);i.status.progress!==s&&this.updateFile(t,i.setStatus({type:"uploading",cancelToken:i.status.cancelToken,progress:s}))},this.onFormCleared=()=>{this.setState({files:[]},(()=>{const e=this.createWidgetValue();null!=e&&this.props.widgetMgr.setFileUploaderStateValue(this.props.element,e,{fromUi:!0})}))},this.state=this.initialValue}get initialValue(){const e={files:[],newestServerFileId:0},{widgetMgr:t,element:i}=this.props,s=t.getFileUploaderStateValue(i);if(null==s)return e;const{maxFileId:n,uploadedFileInfo:a}=s;return null==n||0===n||null==a?e:{files:a.map((e=>{const t=e.name,i=e.size,s=e.id;return new oe.R(t,i,this.nextLocalFileId(),{type:"uploaded",serverFileId:s})})),newestServerFileId:Number(n)}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){return((e,t,i)=>{if(e<0)throw Error("Size must be 0 or greater");const s=h.findIndex((e=>e===t)),n=h.findIndex((e=>e===i));if(-1===s||-1===n)throw Error("Unexpected byte unit provided");if(s===n)return e;const a=Math.abs(s-n),l=c**a;return s>n?e/l:e*l})(this.props.element.maxUploadSizeMb,p.Megabyte,p.Byte)}get status(){return this.state.files.some((e=>"uploading"===e.status.type))?"updating":"ready"}createWidgetValue(){if(0===this.state.newestServerFileId)return;const e=this.state.files.filter((e=>"uploaded"===e.status.type)).map((e=>{const{name:t,size:i,status:s}=e;return new o.jM({id:s.serverFileId,name:t,size:i})}));return new o.xO({maxFileId:this.state.newestServerFileId,uploadedFileInfo:e})}render(){var e;const{files:t}=this.state,{element:i,disabled:s,widgetMgr:n}=this.props,a=i.type;this.formClearHelper.manageFormClearListener(n,i.formId,this.onFormCleared);const l=t.slice().reverse();return(0,N.jsxs)(X,{"data-testid":"stFileUploader",children:[(0,N.jsx)(u.ON,{label:i.label,disabled:s,labelVisibility:(0,g.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,N.jsx)(u.dT,{children:(0,N.jsx)(x.ZP,{content:i.help,placement:f.ug.TOP_RIGHT})})}),(0,N.jsx)(V,{onDrop:this.dropHandler,multiple:i.multipleFiles,acceptedExtensions:a,maxSizeBytes:this.maxUploadSizeInBytes,label:i.label,disabled:s}),l.length>0&&(0,N.jsx)(re,{items:l,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}nextLocalFileId(){return this.localFileIdCounter++}}const ge=de}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[3376],{15310:(e,t,n)=>{n.r(t),n.d(t,{default:()=>ye});var i=n(5057),o=n(66751),l=n(55783),r=n(27179),a=n(56846),s=n(62658),d=n(32291),u=n(34422);const c=class{constructor(e){this.editedCells=new Map,this.addedRows=[],this.deletedRows=[],this.numRows=0,this.numRows=e}toJson(e){const t=new Map;e.forEach((e=>{t.set(e.indexNumber,e)}));const n={edited_cells:{},added_rows:[],deleted_rows:[]};this.editedCells.forEach(((e,i,o)=>{e.forEach(((e,o,l)=>{const r=t.get(o);r&&(n.edited_cells[`${i}:${o}`]=r.getCellValue(e))}))})),this.addedRows.forEach((e=>{const i={};e.forEach(((e,n,o)=>{const l=t.get(n);if(l){const t=l.getCellValue(e);(0,u.bb)(t)&&(i[n]=t)}})),n.added_rows.push(i)})),n.deleted_rows=this.deletedRows;return JSON.stringify(n,((e,t)=>void 0===t?null:t))}fromJson(e,t){const n=JSON.parse(e),i=new Map;t.forEach((e=>{i.set(e.indexNumber,e)})),Object.keys(n.edited_cells).forEach((e=>{const[t,o]=e.split(":").map(Number),l=i.get(o);if(l){const i=l.getCell(n.edited_cells[e]);var r;if(i)0==this.editedCells.has(t)&&this.editedCells.set(t,new Map),null===(r=this.editedCells.get(t))||void 0===r||r.set(o,i)}})),n.added_rows.forEach((e=>{const n=new Map;t.forEach((e=>{n.set(e.indexNumber,e.getCell(void 0))})),Object.keys(e).forEach((t=>{const o=i.get(Number(t));if(o){const i=o.getCell(e[Number(t)]);i&&n.set(Number(t),i)}})),this.addedRows.push(n)})),this.deletedRows=n.deleted_rows}isAddedRow(e){return e>=this.numRows}getCell(e,t){if(this.isAddedRow(t))return this.addedRows[t-this.numRows].get(e);const n=this.editedCells.get(t);return void 0!==n?n.get(e):void 0}setCell(e,t,n){if(this.isAddedRow(t)){if(t-this.numRows>=this.addedRows.length)return;this.addedRows[t-this.numRows].set(e,n)}else{void 0===this.editedCells.get(t)&&this.editedCells.set(t,new Map);this.editedCells.get(t).set(e,n)}}addRow(e){this.addedRows.push(e)}deleteRows(e){e.sort(((e,t)=>t-e)).forEach((e=>{this.deleteRow(e)}))}deleteRow(e){(0,u.le)(e)||e<0||(this.isAddedRow(e)?this.addedRows.splice(e-this.numRows,1):(this.deletedRows.includes(e)||(this.deletedRows.push(e),this.deletedRows=this.deletedRows.sort(((e,t)=>e-t))),this.editedCells.delete(e)))}getOriginalRowIndex(e){let t=e;for(let n=0;n<this.deletedRows.length&&!(this.deletedRows[n]>t);n++)t+=1;return t}getNumRows(){return this.numRows+this.addedRows.length-this.deletedRows.length}};var h=n(59990),g=n(31476);const m=function(){const e=(0,g.u)();return{accentColor:e.colors.primary,accentFg:e.colors.white,accentLight:(0,h.DZ)(e.colors.primary,.9),borderColor:e.colors.fadedText05,horizontalBorderColor:e.colors.fadedText05,fontFamily:e.genericFonts.bodyFont,bgSearchResult:(0,h.DZ)(e.colors.primary,.9),bgIconHeader:e.colors.fadedText60,fgIconHeader:e.colors.white,bgHeader:e.colors.bgMix,bgHeaderHasFocus:e.colors.secondaryBg,bgHeaderHovered:e.colors.bgMix,textHeader:e.colors.fadedText60,textHeaderSelected:e.colors.white,textGroupHeader:e.colors.fadedText60,headerFontStyle:`${e.fontSizes.sm}`,baseFontStyle:e.fontSizes.sm,editorFontSize:e.fontSizes.sm,textDark:e.colors.bodyText,textMedium:(0,h.DZ)(e.colors.bodyText,.2),textLight:e.colors.fadedText40,textBubble:e.colors.fadedText60,bgCell:e.colors.bgColor,bgCellMedium:e.colors.bgColor,cellHorizontalPadding:8,cellVerticalPadding:3,bgBubble:e.colors.secondaryBg,bgBubbleSelected:e.colors.secondaryBg,linkColor:e.colors.linkText,drilldownBorder:e.colors.darkenedBgMix25,tableBorderRadius:e.radii.md}};var f=n(52801),b=n(89163),p=n(65873),w=n(61918),y=n.n(w);const C=["true","t","yes","y","on","1"],x=["false","f","no","n","off","0"];function v(e,t=""){return e=`\u26a0\ufe0f ${e}`,{kind:o.p6.Text,readonly:!0,allowOverlay:!0,data:e+(t?`\n\n${t}\n`:""),displayData:e,isError:!0}}function M(e){return e.hasOwnProperty("isError")&&e.isError}function R(e,t){const n=t?"faded":"normal";return{kind:o.p6.Text,data:"",displayData:"",allowOverlay:!0,readonly:e,style:n}}function E(e){return{id:e.id,title:e.title,hasMenu:!1,themeOverride:e.themeOverride,...e.isStretched&&{grow:e.isIndex?1:3},...e.width&&{width:e.width}}}function N(e,t){return(0,u.le)(e)?t||{}:(0,u.le)(t)?e||{}:(0,p.merge)(e,t)}function k(e){if((0,u.le)(e))return[];if("number"===typeof e||"boolean"===typeof e)return[e];if("string"===typeof e){if(""===e)return[];if(!e.trim().startsWith("[")||!e.trim().endsWith("]"))return e.split(",");try{return JSON.parse(e)}catch(t){return[e]}}try{const t=JSON.parse(JSON.stringify(e,((e,t)=>"bigint"===typeof t?Number(t):t)));return(0,p.isArray)(t)?t.map((e=>["string","number","boolean","null"].includes(typeof e)?e:T(e))):[T(t)]}catch(t){return[T(e)]}}function T(e){try{try{return(0,p.toString)(e)}catch(t){return JSON.stringify(e,((e,t)=>"bigint"===typeof t?Number(t):t))}}catch(t){return`[${typeof e}]`}}function S(e){if((0,u.le)(e))return null;if("boolean"===typeof e)return e;const t=T(e).toLowerCase().trim();return""===t?null:!!C.includes(t)||!x.includes(t)&&void 0}function O(e){if((0,u.le)(e))return null;if((0,p.isArray)(e))return NaN;if("string"===typeof e){if(0===e.trim().length)return null;try{const t=y().unformat(e.trim());if((0,u.bb)(t))return t}catch(t){}}else if(e instanceof Int32Array)return Number(e[0]);return Number(e)}function D(e,t=4,n=!1){return!Number.isNaN(e)&&Number.isFinite(e)?(0===t&&(e=Math.round(e)),y()(e).format(n?`0,0.${"0".repeat(t)}`:`0,0.[${"0".repeat(t)}]`)):""}function A(e){const t={kind:o.p6.Text,data:"",displayData:"",allowOverlay:!0,contentAlignment:e.contentAlignment,readonly:!0,style:e.isIndex?"faded":"normal"};return{...e,kind:"object",sortMode:"default",isEditable:!1,getCell(e){try{const n=(0,u.bb)(e)?T(e):null,i=(0,u.bb)(n)?n:"";return{...t,data:n,displayData:i,isMissingValue:(0,u.le)(e)}}catch(n){return v(T(e),`The value cannot be interpreted as a string. Error: ${n}`)}},getCellValue:e=>void 0===e.data?null:e.data}}A.isEditableType=!1;const H=A;function z(e){const t={kind:o.p6.Text,data:"",displayData:"",allowOverlay:!0,contentAlignment:e.contentAlignment,readonly:!e.isEditable,style:e.isIndex?"faded":"normal"};return{...e,kind:"text",sortMode:"default",getCell(e){try{const n=(0,u.bb)(e)?T(e):null,i=(0,u.bb)(n)?n:"";return{...t,isMissingValue:(0,u.le)(n),data:n,displayData:i}}catch(n){return v("Incompatible value",`The value cannot be interpreted as string. Error: ${n}`)}},getCellValue:e=>void 0===e.data?null:e.data}}z.isEditableType=!0;const I=z;function V(e){const t={kind:o.p6.Boolean,data:!1,allowOverlay:!1,contentAlign:e.contentAlignment,readonly:!e.isEditable,style:e.isIndex?"faded":"normal"};return{...e,kind:"boolean",sortMode:"default",getCell(e){let n=null;return n=S(e),void 0===n?v(T(e),"The value cannot be interpreted as boolean."):{...t,data:n}},getCellValue:e=>void 0===e.data?null:e.data}}V.isEditableType=!0;const $=V;function W(e){let t="string";const n=N({options:"bool"===b.fu.getTypeName(e.arrowType)?[!0,!1]:[]},e.columnTypeMetadata),i=new Set(n.options.map((e=>typeof e)));1===i.size&&(i.has("number")||i.has("bigint")?t="number":i.has("boolean")&&(t="boolean"));const l={kind:o.p6.Custom,allowOverlay:e.isEditable,copyData:"",contentAlign:e.contentAlignment,readonly:!e.isEditable,data:{kind:"dropdown-cell",allowedValues:["",...n.options.filter((e=>""!==e)).map((e=>T(e)))],value:"",readonly:!e.isEditable}};return{...e,kind:"categorical",sortMode:"default",getCell(e){let t="";return(0,u.bb)(e)&&(t=T(e)),l.data.allowedValues.includes(t)?{...l,isMissingValue:""===t,copyData:t,data:{...l.data,value:t}}:v(T(t),"The value is not part of the allowed options.")},getCellValue(e){var n,i,o,l,r,a,s;return void 0===(null===(n=e.data)||void 0===n?void 0:n.value)||""===(null===(i=e.data)||void 0===i?void 0:i.value)?null:"number"===t?null!==(l=O(null===(r=e.data)||void 0===r?void 0:r.value))&&void 0!==l?l:null:"boolean"===t?null!==(a=S(null===(s=e.data)||void 0===s?void 0:s.value))&&void 0!==a?a:null:null===(o=e.data)||void 0===o?void 0:o.value}}}W.isEditableType=!0;const L=W;function _(e){const t={kind:o.p6.Bubble,data:[],allowOverlay:!0,contentAlign:e.contentAlignment,style:e.isIndex?"faded":"normal"};return{...e,kind:"list",sortMode:"default",isEditable:!1,getCell:e=>({...t,data:k(e),isMissingValue:(0,u.le)(e)}),getCellValue:e=>void 0===e.data?null:e.data}}_.isEditableType=!1;const F=_;function B(e){const t=b.fu.getTypeName(e.arrowType),n=N({precision:t.startsWith("int")||"range"===t||t.startsWith("uint")?0:void 0,min:t.startsWith("uint")?0:void 0},e.columnTypeMetadata),i=(0,u.le)(n.min)||n.min<0,l=(0,u.bb)(n.precision)?n.precision:void 0,r={kind:o.p6.Number,data:void 0,displayData:"",readonly:!e.isEditable,allowOverlay:!0,contentAlign:e.contentAlignment||"right",style:e.isIndex?"faded":"normal",allowNegative:i,fixedDecimals:l};return{...e,kind:"number",sortMode:"smart",getCell(e){let t=O(e);if((0,u.bb)(t)){if(Number.isNaN(t))return v(T(e),"The value cannot be interpreted as a number.");(0,u.bb)(n.precision)&&(t=0===n.precision?Math.trunc(t):Math.trunc(t*10**n.precision)/10**n.precision),(0,u.bb)(n.min)&&(t=Math.max(t,n.min)),(0,u.bb)(n.max)&&(t=Math.min(t,n.max))}return{...r,data:t,displayData:(0,u.bb)(t)?D(t):"",isMissingValue:(0,u.le)(t)}},getCellValue:e=>void 0===e.data?null:e.data}}B.isEditableType=!0;const j=B,J=new Map(Object.entries({object:H,text:I,boolean:$,categorical:L,list:F,number:j}));function P(e,t,n){const i=new RegExp(`${e}[,\\s].*{(?:[^}]*[\\s;]{1})?${t}:\\s*([^;}]+)[;]?.*}`,"gm");n=n.replace(/{/g," {");const o=i.exec(n);if(o)return o[1].trim()}function Y(e){return e.replace(/(\r\n|\n|\r)/gm," ")}function Z(e,t){const n=e.types.index[t],i=e.indexNames[t];let o=!0;return"range"===b.fu.getTypeName(n)&&(o=!1),{id:`index-${t}`,isEditable:o,title:i,arrowType:n,isIndex:!0,isHidden:!1}}function U(e,t){const n=e.columns[0][t];let i,o=e.types.data[t];if((0,u.le)(o)&&(o={meta:null,numpy_type:"object",pandas_type:"object"}),"categorical"===b.fu.getTypeName(o)){const n=e.getCategoricalOptions(t);(0,u.bb)(n)&&(i={options:n})}return{id:`column-${n}-${t}`,isEditable:!0,title:n,arrowType:o,columnTypeMetadata:i,isIndex:!1,isHidden:!1}}function G(e,t,n){let i;if(i="object"===e.kind?e.getCell((0,u.bb)(t.content)?Y(b.fu.format(t.content,t.contentType,t.field)):null):e.getCell(t.content),M(i))return i;if(!e.isEditable){if((0,u.bb)(t.displayContent)){const e=Y(t.displayContent);(i.kind===o.p6.Text||i.kind===o.p6.Number)&&(i={...i,displayData:e})}n&&t.cssId&&(i=function(e,t,n){const i={},o=P(t,"color",n);o&&(i.textDark=o);const l=P(t,"background-color",n);return l&&(i.bgCell=l),"yellow"===l&&void 0===o&&(i.textDark="#31333F"),i?{...e,themeOverride:i}:e}(i,t.cssId,n))}return i}const X=function(e,t,n,o){return{getCellContent:i.useCallback((([i,l])=>{if(i>t.length-1)return v("Column index out of bounds.","This should never happen. Please report this bug.");if(l>n-1)return v("Row index out of bounds.","This should never happen. Please report this bug.");const r=t[i],a=r.indexNumber,s=o.current.getOriginalRowIndex(l);if(r.isEditable||o.current.isAddedRow(s)){const e=o.current.getCell(a,s);if(void 0!==e)return e}try{return G(r,e.getCell(s+1,a),e.cssStyles)}catch(d){return(0,f.H)(d),v("Error during cell creation.",`This should never happen. Please report this bug. \nError: ${d}`)}}),[t,n,e,o])}},K=35,q=52,Q=2*K+3,ee=400;const te=function(e,t,n,o,l){let r,a=function(e){return Math.max(e*K+1+2,Q)}(t+1+(e.editingMode===d.Eh.EditingMode.DYNAMIC?1:0)),s=Math.min(a,ee);e.height&&(s=Math.max(e.height,Q),a=Math.max(e.height,a)),o&&(s=Math.min(s,o),a=Math.min(a,o),e.height||(s=a));let c=n;e.useContainerWidth?r=n:e.width&&(r=Math.min(Math.max(e.width,q),n),c=Math.min(Math.max(e.width,c),n));const[h,g]=i.useState({width:r||"100%",height:s});return i.useLayoutEffect((()=>{e.useContainerWidth&&"100%"===h.width&&g({width:n,height:h.height})}),[n]),i.useLayoutEffect((()=>{g({width:h.width,height:s})}),[t]),i.useLayoutEffect((()=>{g({width:r||"100%",height:h.height})}),[r]),i.useLayoutEffect((()=>{g({width:h.width,height:s})}),[s]),i.useLayoutEffect((()=>{if(l){const t=e.useContainerWidth||(0,u.bb)(e.width)&&e.width>0;g({width:t?c:"100%",height:a})}else g({width:r||"100%",height:s})}),[l]),{rowHeight:K,minHeight:Q,maxHeight:a,minWidth:q,maxWidth:c,resizableSize:h,setResizableSize:g}};const ne=function(e,t,n,o,l,r,a){const s=i.useCallback((([t,i],r)=>{const s=e[t],d=s.indexNumber,u=n.current.getOriginalRowIndex(l(i)),c=o([t,i]),h=s.getCellValue(c),g=s.getCellValue(r);if(!M(c)&&g===h)return;const m=s.getCell(g);n.current.setCell(d,u,{...m,lastUpdated:performance.now()}),a()}),[e,n,l,o,a]),d=i.useCallback((()=>{if(t)return;const i=new Map;e.forEach((e=>{i.set(e.indexNumber,e.getCell(void 0))})),n.current.addRow(i),a(!1,!1)}),[e,n,t]),u=i.useCallback((i=>{var o;if(i.rows.length>0){if(t)return!0;const e=i.rows.toArray().map((e=>n.current.getOriginalRowIndex(l(e))));return n.current.deleteRows(e),a(!0),!1}if(null!==(o=i.current)&&void 0!==o&&o.range){const t=[],n=i.current.range;for(let i=n.y;i<n.y+n.height;i++)for(let o=n.x;o<n.x+n.width;o++){const n=e[o];n.isEditable&&(t.push({cell:[o,i]}),s([o,i],n.getCell(null)))}return t.length>0&&(a(),r(t)),!1}return!0}),[e,n,t,r,l,a]),c=i.useCallback(((i,s)=>{const[u,c]=i,h=[];for(let g=0;g<s.length;g++){const i=s[g];if(g+c>=n.current.getNumRows()){if(t)break;d()}for(let t=0;t<i.length;t++){const r=i[t],a=g+c,s=t+u;if(s>=e.length)break;const d=e[s];if(d.isEditable){const e=d.getCell(r);if(!M(e)){const t=d.indexNumber,i=n.current.getOriginalRowIndex(l(a)),r=d.getCellValue(o([s,a]));d.getCellValue(e)!==r&&(n.current.setCell(t,i,{...e,lastUpdated:performance.now()}),h.push({cell:[s,a]}))}}}h.length>0&&(a(),r(h))}return!1}),[e,n,t,l,o,d,a,r]);return{onCellEdited:s,onPaste:c,onRowAppended:d,onDelete:u}};const ie=function(e){const[t,n]=(0,i.useState)((()=>new Map)),o=i.useCallback(((e,i,o,l)=>{e.id&&n(new Map(t).set(e.id,l))}),[t]);return{columns:e.map((e=>e.id&&t.has(e.id)&&void 0!==t.get(e.id)?{...e,width:t.get(e.id),grow:0}:e)),onColumnResize:o}};var oe=n(33256);const le=function(e,t,n){const[o,l]=i.useState(),{getCellContent:r,getOriginalIndex:a}=(0,oe.fF)({columns:t.map((e=>E(e))),getCellContent:n,rows:e,sort:o}),s=function(e,t){return void 0===t?e:e.map((e=>e.id===t.column.id?{...e,title:"asc"===t.direction?`\u2191 ${e.title}`:`\u2193 ${e.title}`}:e))}(t,o),d=i.useCallback((e=>{let t="asc";const n=s[e];if(o&&o.column.id===n.id){if("asc"!==o.direction)return void l(void 0);t="desc"}l({column:E(n),direction:t,mode:n.sortMode})}),[o,s]);return{columns:s,sortColumn:d,getOriginalIndex:a,getCellContent:r}},re="index",ae="col:";function se(e,t){var n;if(!t)return e;let i;return t.has(e.title)?i=t.get(e.title):t.has(`${ae}${e.indexNumber}`)?i=t.get(`${ae}${e.indexNumber}`):e.isIndex&&t.has(re)&&(i=t.get(re)),i?(0,p.merge)({...e},{title:i.title,width:i.width,customType:null===(n=i.type)||void 0===n?void 0:n.toLowerCase().trim(),isEditable:i.editable,isHidden:i.hidden,columnTypeMetadata:i.metadata,contentAlignment:i.alignment}):e}function de(e){let t;return(0,u.bb)(e.customType)&&(J.has(e.customType)?t=J.get(e.customType):(0,f.KE)(`Unknown column type configured in column configuration: ${e.customType}`)),(0,u.le)(t)&&(t=function(e){let t=e?b.fu.getTypeName(e):null;return t?(t=t.toLowerCase().trim(),["unicode","empty"].includes(t)?I:["object","date","time","datetime","datetimetz","decimal","bytes"].includes(t)?H:["bool"].includes(t)?$:["int8","int16","int32","int64","uint8","uint16","uint32","uint64","float16","float32","float64","float96","float128","range"].includes(t)?j:"categorical"===t?L:t.startsWith("list")?F:H):H}(e.arrowType)),t}const ue=function(e,t,n){const i=function(e){if(!e.columns)return new Map;try{return new Map(Object.entries(JSON.parse(e.columns)))}catch(t){return(0,f.H)(t),new Map}}(e),o=e.useContainerWidth||(0,u.bb)(e.width)&&e.width>0,l=function(e){var t,n,i,o,l,r;const a=[],s=null!==(t=null===(n=e.types)||void 0===n||null===(i=n.index)||void 0===i?void 0:i.length)&&void 0!==t?t:0,d=null!==(o=null===(l=e.columns)||void 0===l||null===(r=l[0])||void 0===r?void 0:r.length)&&void 0!==o?o:0;if(0===s&&0===d)return a.push({id:"empty-index",title:"",indexNumber:0,isEditable:!1,isIndex:!0}),a;for(let u=0;u<s;u++){const t={...Z(e,u),indexNumber:u};a.push(t)}for(let u=0;u<d;u++){const t={...U(e,u),indexNumber:u+s};a.push(t)}return a}(t).map((t=>{let l={...t,...se(t,i),isStretched:o};const r=de(l);return(e.editingMode===d.Eh.EditingMode.READ_ONLY||n||!1===r.isEditableType)&&(l={...l,isEditable:!1}),r(l)})).filter((e=>!e.isHidden));return{columns:l.length>0?l:[H({id:"empty-index",title:"",indexNumber:0,isEditable:!1,isIndex:!0})]}};const ce=(0,n(45490).Z)("div",{target:"e17g77xh0"})((({theme:e})=>({position:"relative",display:"inline-block","& .glideDataEditor":{height:"100%",minWidth:"100%",borderRadius:e.radii.md},"& .dvn-scroller":{scrollbarWidth:"thin",overflowX:"overlay !important",overflowY:"overlay !important"}})),"");n(27235);var he=n(96266);const ge=50,me=1e3,fe=500,be=100,pe=15e4,we=e=>{const{cell:t,theme:n}=e;return!!function(e){return e.hasOwnProperty("isMissingValue")&&e.isMissingValue}(t)&&((0,o.uN)({...e,theme:{...n,textDark:n.textLight,textMedium:n.textLight},spriteManager:{},hyperWrapping:!1},"None",t.contentAlign),!0)};const ye=(0,s.Z)((function({element:e,data:t,width:n,height:s,disabled:h,widgetMgr:g,isFullScreen:f}){const b=i.useRef(null),p=i.useRef(null),w=(0,l.Bn)(),y=m(),[C,x]=i.useState(!0),[v,M]=i.useState({columns:o.EV.empty(),rows:o.EV.empty(),current:void 0}),N=i.useCallback((()=>{M({columns:o.EV.empty(),rows:o.EV.empty(),current:void 0})}),[]),k=i.useCallback((e=>{var t;null===(t=p.current)||void 0===t||t.updateCells(e)}),[]);(0,u.le)(e.editingMode)&&(e.editingMode=d.Eh.EditingMode.READ_ONLY);const{READ_ONLY:T,DYNAMIC:S}=d.Eh.EditingMode,O=t.dimensions,D=Math.max(0,O.rows-1),A=0===D&&!(e.editingMode===S&&O.dataColumns>0),H=D>pe,z=i.useRef(new c(D)),[I,V]=i.useState(z.current.getNumRows());i.useEffect((()=>{z.current=new c(D),V(z.current.getNumRows())}),[D]);const $=i.useCallback((()=>{z.current=new c(D),V(z.current.getNumRows())}),[D]),{columns:W}=ue(e,t,h);i.useEffect((()=>{if(e.editingMode!==T){const t=g.getStringValue(e);t&&(z.current.fromJson(t,W),V(z.current.getNumRows()))}}),[]);const{getCellContent:L}=X(t,W,I,z),{columns:_,sortColumn:F,getOriginalIndex:B,getCellContent:j}=le(D,W,L),J=i.useCallback(((t=!1,n=!0)=>{I!==z.current.getNumRows()&&V(z.current.getNumRows()),t&&N(),(0,u.Ds)(be,(()=>{const t=z.current.toJson(_);let i=g.getStringValue(e);void 0===i&&(i=new c(0).toJson([])),t!==i&&g.setStringValue(e,t,{fromUi:n})}))()}),[g,e,I]),{onCellEdited:P,onPaste:Y,onRowAppended:Z,onDelete:U}=ne(_,e.editingMode!==S,z,j,B,k,J),{columns:G,onColumnResize:K}=ie(_.map((e=>E(e)))),{rowHeight:q,minHeight:Q,maxHeight:ee,minWidth:oe,maxWidth:re,resizableSize:ae,setResizableSize:se}=te(e,I,n,s,f),de=i.useCallback((([e,t])=>({...R(!0,!1),displayData:"empty",contentAlign:"center",allowOverlay:!1,themeOverride:{textDark:y.textLight},span:[0,Math.max(_.length-1,0)]})),[_]);return i.useEffect((()=>{const t=new a.Kz;return t.manageFormClearListener(g,e.formId,$),()=>{t.disconnect()}}),[]),(0,he.jsx)(ce,{className:"stDataFrame",onBlur:()=>{C||N()},children:(0,he.jsx)(r.e,{"data-testid":"stDataFrameResizable",ref:b,defaultSize:ae,style:{border:`1px solid ${y.borderColor}`,borderRadius:`${y.tableBorderRadius}`},minHeight:Q,maxHeight:ee,minWidth:oe,maxWidth:re,size:ae,enable:{top:!1,right:!1,bottom:!1,left:!1,topRight:!1,bottomRight:!0,bottomLeft:!1,topLeft:!1},grid:[1,q],snapGap:q/3,onResizeStop:(e,t,n,i)=>{b.current&&se({width:b.current.size.width,height:ee-b.current.size.height===3?b.current.size.height+3:b.current.size.height})},children:(0,he.jsx)(o.Nd,{className:"glideDataEditor",ref:p,columns:G,rows:A?1:I,minColumnWidth:ge,maxColumnWidth:me,maxColumnAutoWidth:fe,rowHeight:q,headerHeight:q,getCellContent:A?de:j,onColumnResize:K,freezeColumns:A?0:_.filter((e=>e.isIndex)).length,smoothScrollX:!0,smoothScrollY:!0,verticalBorder:t=>!(t>=_.length&&(e.useContainerWidth||"100%"===ae.width)),getCellsForSelection:!0,rowMarkers:"none",rangeSelect:"rect",columnSelect:"none",rowSelect:"none",keybindings:{search:!0,downFill:!0},onHeaderClicked:A||H?void 0:F,gridSelection:v,onGridSelectionChange:M,drawCell:we,theme:y,onMouseMove:e=>{"out-of-bounds"===e.kind&&C?x(!1):"out-of-bounds"===e.kind||C||x(!0)},fixedShadowX:!0,fixedShadowY:!0,experimental:{scrollbarWidthOverride:1},customRenderers:w.customRenderers,onPaste:!1,...!A&&e.editingMode!==T&&!h&&{fillHandle:!0,onCellEdited:P,onPaste:Y,onDelete:U},...!A&&e.editingMode===S&&{trailingRowOptions:{sticky:!1,tint:!0},rowMarkerTheme:{bgCell:y.bgHeader,bgCellMedium:y.bgHeader},rowMarkers:"checkbox",rowSelectionMode:"auto",rowSelect:h?"none":"multi",onRowAppended:h?void 0:Z,onHeaderClicked:void 0}})})})}))}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[3392],{23392:(e,t,i)=>{i.r(t),i.d(t,{default:()=>r});i(5057);var l=i(92445),s=i(46540),d=i(35e3),n=i(96266);const r=function(e){const{disabled:t,element:i,widgetMgr:r,width:o,endpoints:u}=e,a={width:o},c=(0,d.v_)();return(0,n.jsx)("div",{className:"row-widget stDownloadButton",style:a,children:(0,n.jsx)(l.uD,{help:i.help,children:(0,n.jsx)(l.ZP,{kind:l.hY.SECONDARY,size:l.$u.SMALL,disabled:t,onClick:()=>{if(r.setTriggerValue(i,{fromUi:!0}),i.url.startsWith("/media"))return void(0,d.uP)(c,i.url);const e=document.createElement("a"),t=`${u.buildMediaURL(i.url)}?title=${encodeURIComponent(document.title)}`;e.setAttribute("href",t),e.setAttribute("target","_blank"),e.click()},fluidWidth:i.useContainerWidth||!1,children:(0,n.jsx)(s.Z,{source:i.label,allowHTML:!1,isLabel:!0,isButton:!0})})})})}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[3977],{3977:(e,t,o)=>{o.r(t),o.d(t,{default:()=>W});var r=o(5057),i=o(31476),n=o(34422),a=o(80099),l=o(53381);function s(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function c(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?s(Object(o),!0).forEach((function(t){d(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):s(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function d(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function u(e){var t=e.$disabled,o=e.$checked,r=e.$isIndeterminate,i=e.$error,n=e.$isHovered,a=e.$isActive,l=e.$theme.colors;return t?o||r?l.tickFillDisabled:l.tickFill:i&&(r||o)?a?l.tickFillErrorSelectedHoverActive:n?l.tickFillErrorSelectedHover:l.tickFillErrorSelected:i?a?l.tickFillErrorHoverActive:n?l.tickFillErrorHover:l.tickFillError:r||o?a?l.tickFillSelectedHoverActive:n?l.tickFillSelectedHover:l.tickFillSelected:a?l.tickFillActive:n?l.tickFillHover:l.tickFill}function p(e){var t=e.$disabled,o=e.$theme.colors;return t?o.contentSecondary:o.contentPrimary}var h=(0,l.zo)("label",(function(e){var t=e.$disabled,o=e.$labelPlacement;return{flexDirection:"top"===o||"bottom"===o?"column":"row",display:"flex",alignItems:"top"===o||"bottom"===o?"center":"flex-start",cursor:t?"not-allowed":"pointer",userSelect:"none"}}));h.displayName="Root",h.displayName="Root";var m=(0,l.zo)("span",(function(e){var t=e.$checked,o=e.$disabled,r=e.$error,i=e.$isIndeterminate,n=e.$theme,a=e.$isFocusVisible,l=n.sizing,s=n.animation,c=o?n.colors.tickMarkFillDisabled:r?n.colors.tickMarkFillError:n.colors.tickMarkFill,d=encodeURIComponent('\n <svg width="14" height="4" viewBox="0 0 14 4" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M14 0.5H0V3.5H14V0.5Z" fill="'.concat(c,'"/>\n </svg>\n ')),p=encodeURIComponent('\n <svg width="17" height="13" viewBox="0 0 17 13" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M6.50002 12.6L0.400024 6.60002L2.60002 4.40002L6.50002 8.40002L13.9 0.900024L16.1 3.10002L6.50002 12.6Z" fill="'.concat(c,'"/>\n </svg>\n ')),h=n.borders.checkboxBorderRadius,m=function(e){var t=e.$disabled,o=e.$checked,r=e.$error,i=e.$isIndeterminate,n=e.$theme,a=e.$isFocusVisible,l=n.colors;return t?l.tickFillDisabled:o||i?"transparent":r?l.borderNegative:a?l.borderSelected:l.tickBorder}(e);return{flex:"0 0 auto",transitionDuration:s.timing200,transitionTimingFunction:s.easeOutCurve,transitionProperty:"background-image, border-color, background-color",width:l.scale700,height:l.scale700,left:"4px",top:"4px",boxSizing:"border-box",borderLeftStyle:"solid",borderRightStyle:"solid",borderTopStyle:"solid",borderBottomStyle:"solid",borderLeftWidth:"3px",borderRightWidth:"3px",borderTopWidth:"3px",borderBottomWidth:"3px",borderLeftColor:m,borderRightColor:m,borderTopColor:m,borderBottomColor:m,borderTopLeftRadius:h,borderTopRightRadius:h,borderBottomRightRadius:h,borderBottomLeftRadius:h,outline:a&&t?"3px solid ".concat(n.colors.accent):"none",display:"inline-block",verticalAlign:"middle",backgroundImage:i?"url('data:image/svg+xml,".concat(d,"');"):t?"url('data:image/svg+xml,".concat(p,"');"):null,backgroundColor:u(e),backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"contain",marginTop:n.sizing.scale0,marginBottom:n.sizing.scale0,marginLeft:n.sizing.scale0,marginRight:n.sizing.scale0}}));m.displayName="Checkmark",m.displayName="Checkmark";var b=(0,l.zo)("div",(function(e){var t=e.$theme.typography;return c(c(c({verticalAlign:"middle"},function(e){var t,o=e.$labelPlacement,r=void 0===o?"":o,i=e.$theme,n=i.sizing.scale300;switch(r){case"top":t="Bottom";break;case"bottom":t="Top";break;case"left":t="Right";break;default:t="Left"}return"rtl"===i.direction&&"Left"===t?t="Right":"rtl"===i.direction&&"Right"===t&&(t="Left"),d({},"padding".concat(t),n)}(e)),{},{color:p(e)},t.LabelMedium),{},{lineHeight:"24px"})}));b.displayName="Label",b.displayName="Label";var f=(0,l.zo)("input",{opacity:0,width:0,height:0,overflow:"hidden",margin:0,padding:0,position:"absolute"});f.displayName="Input",f.displayName="Input";var g=(0,l.zo)("div",(function(e){var t=e.$theme.colors.toggleFill;return e.$disabled?t=e.$theme.colors.toggleFillDisabled:e.$checked&&e.$error?t=e.$theme.colors.tickFillErrorSelected:e.$checked&&(t=e.$theme.colors.toggleFillChecked),{backgroundColor:t,borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible?"0 0 0 3px ".concat(e.$theme.colors.accent):e.$isHovered&&!e.$disabled?e.$theme.lighting.shadow500:e.$theme.lighting.shadow400,outline:"none",height:e.$theme.sizing.scale700,width:e.$theme.sizing.scale700,transform:e.$checked?"translateX(".concat("rtl"===e.$theme.direction?"-100%":"100%",")"):null,transition:"transform ".concat(e.$theme.animation.timing200)}}));g.displayName="Toggle",g.displayName="Toggle";var v=(0,l.zo)("div",(function(e){var t=e.$theme.colors.toggleTrackFill;return e.$disabled?t=e.$theme.colors.toggleTrackFillDisabled:e.$error&&e.$checked&&(t=e.$theme.colors.tickFillError),{alignItems:"center",backgroundColor:t,borderTopLeftRadius:"7px",borderTopRightRadius:"7px",borderBottomRightRadius:"7px",borderBottomLeftRadius:"7px",display:"flex",height:e.$theme.sizing.scale550,marginTop:e.$theme.sizing.scale200,marginBottom:e.$theme.sizing.scale100,marginLeft:e.$theme.sizing.scale200,marginRight:e.$theme.sizing.scale100,width:e.$theme.sizing.scale1000}}));v.displayName="ToggleTrack",v.displayName="ToggleTrack";var y=Object.freeze({default:"default",toggle:"toggle",toggle_round:"toggle"}),k=(Object.freeze({top:"top",right:"right",bottom:"bottom",left:"left"}),o(94253));function $(e){return $="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$(e)}function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},w.apply(this,arguments)}function F(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function R(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var o,r=C(e);if(t){var i=C(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return function(e,t){if(t&&("object"===$(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return T(e)}(this,o)}}function T(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(e){return C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},C(e)}function O(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var L=function(e){return e.stopPropagation()},S=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}(l,e);var t,o,i,n=R(l);function l(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l);for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return O(T(e=n.call.apply(n,[this].concat(o))),"state",{isFocused:e.props.autoFocus||!1,isFocusVisible:!1,isHovered:!1,isActive:!1}),O(T(e),"onMouseEnter",(function(t){e.setState({isHovered:!0}),e.props.onMouseEnter(t)})),O(T(e),"onMouseLeave",(function(t){e.setState({isHovered:!1,isActive:!1}),e.props.onMouseLeave(t)})),O(T(e),"onMouseDown",(function(t){e.setState({isActive:!0}),e.props.onMouseDown(t)})),O(T(e),"onMouseUp",(function(t){e.setState({isActive:!1}),e.props.onMouseUp(t)})),O(T(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t),(0,k.E)(t)&&e.setState({isFocusVisible:!0})})),O(T(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t),!1!==e.state.isFocusVisible&&e.setState({isFocusVisible:!1})})),e}return t=l,(o=[{key:"componentDidMount",value:function(){var e=this.props,t=e.autoFocus,o=e.inputRef;t&&o.current&&o.current.focus()}},{key:"render",value:function(){var e=this.props,t=e.overrides,o=void 0===t?{}:t,i=e.onChange,n=e.labelPlacement,l=void 0===n?this.props.checkmarkType===y.toggle?"left":"right":n,s=e.inputRef,c=e.isIndeterminate,d=e.error,u=e.disabled,p=e.value,k=e.name,$=e.type,F=e.checked,x=e.children,R=e.required,T=e.title,C=o.Root,O=o.Checkmark,S=o.Label,P=o.Input,j=o.Toggle,M=o.ToggleTrack,B=(0,a.XG)(C)||h,E=(0,a.XG)(O)||m,V=(0,a.XG)(S)||b,z=(0,a.XG)(P)||f,H=(0,a.XG)(j)||g,D=(0,a.XG)(M)||v,I={onChange:i,onFocus:this.onFocus,onBlur:this.onBlur},W={onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},A={$isFocused:this.state.isFocused,$isFocusVisible:this.state.isFocusVisible,$isHovered:this.state.isHovered,$isActive:this.state.isActive,$error:d,$checked:F,$isIndeterminate:c,$required:R,$disabled:u,$value:p},U=x&&r.createElement(V,w({$labelPlacement:l},A,(0,a.ch)(S)),this.props.containsInteractiveElement?r.createElement("div",{onClick:function(e){return e.preventDefault()}},x):x);return r.createElement(B,w({"data-baseweb":"checkbox",title:T||null,$labelPlacement:l},A,W,(0,a.ch)(C)),("top"===l||"left"===l)&&U,this.props.checkmarkType===y.toggle?r.createElement(D,w({},A,(0,a.ch)(M)),r.createElement(H,w({},A,(0,a.ch)(j)))):r.createElement(E,w({},A,(0,a.ch)(O))),r.createElement(z,w({value:p,name:k,checked:F,required:R,"aria-label":this.props["aria-label"]||this.props.ariaLabel,"aria-checked":c?"mixed":F,"aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":d||null,"aria-required":R||null,disabled:u,type:$,ref:s,onClick:L},A,I,(0,a.ch)(P))),("bottom"===l||"right"===l)&&U)}}])&&F(t.prototype,o),i&&F(t,i),Object.defineProperty(t,"prototype",{writable:!1}),l}(r.Component);O(S,"defaultProps",{overrides:{},checked:!1,containsInteractiveElement:!1,disabled:!1,autoFocus:!1,isIndeterminate:!1,inputRef:r.createRef(),error:!1,type:"checkbox",checkmarkType:y.default,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});const P=S;var j=o(59990),M=o(56846),B=o(8429),E=o(54840),V=o(86964),z=o(46540);const H=(0,o(45490).Z)("div",{target:"ek41t0m0"})((({theme:e,visibility:t})=>({display:t===n.Ws.Collapsed?"none":"flex",visibility:t===n.Ws.Hidden?"hidden":"visible",verticalAlign:"middle",flexDirection:"row",alignItems:"center"})),"");var D=o(96266);class I extends r.PureComponent{constructor(...e){super(...e),this.formClearHelper=new M.Kz,this.state={value:this.initialValue},this.commitWidgetValue=e=>{this.props.widgetMgr.setBoolValue(this.props.element,this.state.value,e)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.onChange=e=>{const t=e.target.checked;this.setState({value:t},(()=>this.commitWidgetValue({fromUi:!0})))}}get initialValue(){const e=this.props.widgetMgr.getBoolValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}render(){var e;const{theme:t,width:o,element:r,disabled:i,widgetMgr:a}=this.props,{colors:l,spacing:s,radii:c}=t,d={width:o},u=i?l.fadedText40:l.bodyText;return this.formClearHelper.manageFormClearListener(a,r.formId,this.onFormCleared),(0,D.jsx)("div",{className:"row-widget stCheckbox",style:d,children:(0,D.jsx)(P,{checked:this.state.value,disabled:i,onChange:this.onChange,"aria-label":r.label,overrides:{Root:{style:({$isFocusVisible:e})=>({marginBottom:0,marginTop:0,paddingRight:s.twoThirdsSmFont,backgroundColor:e?l.darkenedBgMix25:"",display:"flex",alignItems:"start"})},Checkmark:{style:({$isFocusVisible:e,$checked:t})=>{const o=t&&!i?l.primary:l.fadedText40;return{outline:0,width:"1rem",height:"1rem",marginTop:"0.30rem",boxShadow:e&&t?`0 0 0 0.2rem ${(0,j.DZ)(l.primary,.5)}`:"",borderLeftWidth:"2px",borderRightWidth:"2px",borderTopWidth:"2px",borderBottomWidth:"2px",borderTopLeftRadius:c.md,borderTopRightRadius:c.md,borderBottomLeftRadius:c.md,borderBottomRightRadius:c.md,borderLeftColor:o,borderRightColor:o,borderTopColor:o,borderBottomColor:o}}},Label:{style:{color:u}}},children:(0,D.jsxs)(H,{visibility:(0,n.iF)(null===(e=r.labelVisibility)||void 0===e?void 0:e.value),children:[(0,D.jsx)(z.Z,{source:r.label,allowHTML:!1,isLabel:!0,isCheckbox:!0}),r.help&&(0,D.jsx)(V.Hp,{color:u,children:(0,D.jsx)(B.Z,{content:r.help,placement:E.ug.TOP_RIGHT})})]})})})}}const W=(0,i.b)(I)}}]);
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[3977],{3977:(e,t,o)=>{o.r(t),o.d(t,{default:()=>W});var r=o(5057),i=o(31476),n=o(34422),l=o(80099),a=o(53381);function s(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function c(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?s(Object(o),!0).forEach((function(t){d(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):s(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function d(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function u(e){var t=e.$disabled,o=e.$checked,r=e.$isIndeterminate,i=e.$error,n=e.$isHovered,l=e.$isActive,a=e.$theme.colors;return t?o||r?a.tickFillDisabled:a.tickFill:i&&(r||o)?l?a.tickFillErrorSelectedHoverActive:n?a.tickFillErrorSelectedHover:a.tickFillErrorSelected:i?l?a.tickFillErrorHoverActive:n?a.tickFillErrorHover:a.tickFillError:r||o?l?a.tickFillSelectedHoverActive:n?a.tickFillSelectedHover:a.tickFillSelected:l?a.tickFillActive:n?a.tickFillHover:a.tickFill}function p(e){var t=e.$disabled,o=e.$theme.colors;return t?o.contentSecondary:o.contentPrimary}var h=(0,a.zo)("label",(function(e){var t=e.$disabled,o=e.$labelPlacement;return{flexDirection:"top"===o||"bottom"===o?"column":"row",display:"flex",alignItems:"top"===o||"bottom"===o?"center":"flex-start",cursor:t?"not-allowed":"pointer",userSelect:"none"}}));h.displayName="Root",h.displayName="Root";var m=(0,a.zo)("span",(function(e){var t=e.$checked,o=e.$disabled,r=e.$error,i=e.$isIndeterminate,n=e.$theme,l=e.$isFocusVisible,a=n.sizing,s=n.animation,c=o?n.colors.tickMarkFillDisabled:r?n.colors.tickMarkFillError:n.colors.tickMarkFill,d=encodeURIComponent('\n <svg width="14" height="4" viewBox="0 0 14 4" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M14 0.5H0V3.5H14V0.5Z" fill="'.concat(c,'"/>\n </svg>\n ')),p=encodeURIComponent('\n <svg width="17" height="13" viewBox="0 0 17 13" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M6.50002 12.6L0.400024 6.60002L2.60002 4.40002L6.50002 8.40002L13.9 0.900024L16.1 3.10002L6.50002 12.6Z" fill="'.concat(c,'"/>\n </svg>\n ')),h=n.borders.checkboxBorderRadius,m=function(e){var t=e.$disabled,o=e.$checked,r=e.$error,i=e.$isIndeterminate,n=e.$theme,l=e.$isFocusVisible,a=n.colors;return t?a.tickFillDisabled:o||i?"transparent":r?a.borderNegative:l?a.borderSelected:a.tickBorder}(e);return{flex:"0 0 auto",transitionDuration:s.timing200,transitionTimingFunction:s.easeOutCurve,transitionProperty:"background-image, border-color, background-color",width:a.scale700,height:a.scale700,left:"4px",top:"4px",boxSizing:"border-box",borderLeftStyle:"solid",borderRightStyle:"solid",borderTopStyle:"solid",borderBottomStyle:"solid",borderLeftWidth:"3px",borderRightWidth:"3px",borderTopWidth:"3px",borderBottomWidth:"3px",borderLeftColor:m,borderRightColor:m,borderTopColor:m,borderBottomColor:m,borderTopLeftRadius:h,borderTopRightRadius:h,borderBottomRightRadius:h,borderBottomLeftRadius:h,outline:l&&t?"3px solid ".concat(n.colors.accent):"none",display:"inline-block",verticalAlign:"middle",backgroundImage:i?"url('data:image/svg+xml,".concat(d,"');"):t?"url('data:image/svg+xml,".concat(p,"');"):null,backgroundColor:u(e),backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"contain",marginTop:n.sizing.scale0,marginBottom:n.sizing.scale0,marginLeft:n.sizing.scale0,marginRight:n.sizing.scale0}}));m.displayName="Checkmark",m.displayName="Checkmark";var b=(0,a.zo)("div",(function(e){var t=e.$theme.typography;return c(c(c({verticalAlign:"middle"},function(e){var t,o=e.$labelPlacement,r=void 0===o?"":o,i=e.$theme,n=i.sizing.scale300;switch(r){case"top":t="Bottom";break;case"bottom":t="Top";break;case"left":t="Right";break;default:t="Left"}return"rtl"===i.direction&&"Left"===t?t="Right":"rtl"===i.direction&&"Right"===t&&(t="Left"),d({},"padding".concat(t),n)}(e)),{},{color:p(e)},t.LabelMedium),{},{lineHeight:"24px"})}));b.displayName="Label",b.displayName="Label";var f=(0,a.zo)("input",{opacity:0,width:0,height:0,overflow:"hidden",margin:0,padding:0,position:"absolute"});f.displayName="Input",f.displayName="Input";var g=(0,a.zo)("div",(function(e){var t=e.$theme.colors.toggleFill;return e.$disabled?t=e.$theme.colors.toggleFillDisabled:e.$checked&&e.$error?t=e.$theme.colors.tickFillErrorSelected:e.$checked&&(t=e.$theme.colors.toggleFillChecked),{backgroundColor:t,borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible?"0 0 0 3px ".concat(e.$theme.colors.accent):e.$isHovered&&!e.$disabled?e.$theme.lighting.shadow500:e.$theme.lighting.shadow400,outline:"none",height:e.$theme.sizing.scale700,width:e.$theme.sizing.scale700,transform:e.$checked?"translateX(".concat("rtl"===e.$theme.direction?"-100%":"100%",")"):null,transition:"transform ".concat(e.$theme.animation.timing200)}}));g.displayName="Toggle",g.displayName="Toggle";var v=(0,a.zo)("div",(function(e){var t=e.$theme.colors.toggleTrackFill;return e.$disabled?t=e.$theme.colors.toggleTrackFillDisabled:e.$error&&e.$checked&&(t=e.$theme.colors.tickFillError),{alignItems:"center",backgroundColor:t,borderTopLeftRadius:"7px",borderTopRightRadius:"7px",borderBottomRightRadius:"7px",borderBottomLeftRadius:"7px",display:"flex",height:e.$theme.sizing.scale550,marginTop:e.$theme.sizing.scale200,marginBottom:e.$theme.sizing.scale100,marginLeft:e.$theme.sizing.scale200,marginRight:e.$theme.sizing.scale100,width:e.$theme.sizing.scale1000}}));v.displayName="ToggleTrack",v.displayName="ToggleTrack";var y=Object.freeze({default:"default",toggle:"toggle",toggle_round:"toggle"}),k=(Object.freeze({top:"top",right:"right",bottom:"bottom",left:"left"}),o(94253));function $(e){return $="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$(e)}function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},w.apply(this,arguments)}function F(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function R(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var o,r=C(e);if(t){var i=C(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return function(e,t){if(t&&("object"===$(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return T(e)}(this,o)}}function T(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(e){return C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},C(e)}function O(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var P=function(e){return e.stopPropagation()},S=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}(a,e);var t,o,i,n=R(a);function a(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a);for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return O(T(e=n.call.apply(n,[this].concat(o))),"state",{isFocused:e.props.autoFocus||!1,isFocusVisible:!1,isHovered:!1,isActive:!1}),O(T(e),"onMouseEnter",(function(t){e.setState({isHovered:!0}),e.props.onMouseEnter(t)})),O(T(e),"onMouseLeave",(function(t){e.setState({isHovered:!1,isActive:!1}),e.props.onMouseLeave(t)})),O(T(e),"onMouseDown",(function(t){e.setState({isActive:!0}),e.props.onMouseDown(t)})),O(T(e),"onMouseUp",(function(t){e.setState({isActive:!1}),e.props.onMouseUp(t)})),O(T(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t),(0,k.E)(t)&&e.setState({isFocusVisible:!0})})),O(T(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t),!1!==e.state.isFocusVisible&&e.setState({isFocusVisible:!1})})),e}return t=a,(o=[{key:"componentDidMount",value:function(){var e=this.props,t=e.autoFocus,o=e.inputRef;t&&o.current&&o.current.focus()}},{key:"render",value:function(){var e=this.props,t=e.overrides,o=void 0===t?{}:t,i=e.onChange,n=e.labelPlacement,a=void 0===n?this.props.checkmarkType===y.toggle?"left":"right":n,s=e.inputRef,c=e.isIndeterminate,d=e.error,u=e.disabled,p=e.value,k=e.name,$=e.type,F=e.checked,x=e.children,R=e.required,T=e.title,C=o.Root,O=o.Checkmark,S=o.Label,L=o.Input,j=o.Toggle,M=o.ToggleTrack,E=(0,l.XG)(C)||h,B=(0,l.XG)(O)||m,V=(0,l.XG)(S)||b,z=(0,l.XG)(L)||f,H=(0,l.XG)(j)||g,D=(0,l.XG)(M)||v,I={onChange:i,onFocus:this.onFocus,onBlur:this.onBlur},W={onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},A={$isFocused:this.state.isFocused,$isFocusVisible:this.state.isFocusVisible,$isHovered:this.state.isHovered,$isActive:this.state.isActive,$error:d,$checked:F,$isIndeterminate:c,$required:R,$disabled:u,$value:p},U=x&&r.createElement(V,w({$labelPlacement:a},A,(0,l.ch)(S)),this.props.containsInteractiveElement?r.createElement("div",{onClick:function(e){return e.preventDefault()}},x):x);return r.createElement(E,w({"data-baseweb":"checkbox",title:T||null,$labelPlacement:a},A,W,(0,l.ch)(C)),("top"===a||"left"===a)&&U,this.props.checkmarkType===y.toggle?r.createElement(D,w({},A,(0,l.ch)(M)),r.createElement(H,w({},A,(0,l.ch)(j)))):r.createElement(B,w({},A,(0,l.ch)(O))),r.createElement(z,w({value:p,name:k,checked:F,required:R,"aria-label":this.props["aria-label"]||this.props.ariaLabel,"aria-checked":c?"mixed":F,"aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":d||null,"aria-required":R||null,disabled:u,type:$,ref:s,onClick:P},A,I,(0,l.ch)(L))),("bottom"===a||"right"===a)&&U)}}])&&F(t.prototype,o),i&&F(t,i),Object.defineProperty(t,"prototype",{writable:!1}),a}(r.Component);O(S,"defaultProps",{overrides:{},checked:!1,containsInteractiveElement:!1,disabled:!1,autoFocus:!1,isIndeterminate:!1,inputRef:r.createRef(),error:!1,type:"checkbox",checkmarkType:y.default,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});const L=S;var j=o(59990),M=o(56846),E=o(8429),B=o(54840),V=o(86964),z=o(46540);const H=(0,o(45490).Z)("div",{target:"ek41t0m0"})((({visibility:e})=>({display:e===n.Ws.Collapsed?"none":"flex",visibility:e===n.Ws.Hidden?"hidden":"visible",verticalAlign:"middle",flexDirection:"row",alignItems:"center"})),"");var D=o(96266);class I extends r.PureComponent{constructor(...e){super(...e),this.formClearHelper=new M.Kz,this.state={value:this.initialValue},this.commitWidgetValue=e=>{this.props.widgetMgr.setBoolValue(this.props.element,this.state.value,e)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.onChange=e=>{const t=e.target.checked;this.setState({value:t},(()=>this.commitWidgetValue({fromUi:!0})))}}get initialValue(){const e=this.props.widgetMgr.getBoolValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}render(){var e;const{theme:t,width:o,element:r,disabled:i,widgetMgr:l}=this.props,{colors:a,spacing:s}=t,c={width:o},d=i?a.fadedText40:a.bodyText;return this.formClearHelper.manageFormClearListener(l,r.formId,this.onFormCleared),(0,D.jsx)("div",{className:"row-widget stCheckbox",style:c,children:(0,D.jsx)(L,{checked:this.state.value,disabled:i,onChange:this.onChange,"aria-label":r.label,overrides:{Root:{style:({$isFocusVisible:e})=>({marginBottom:0,marginTop:0,paddingRight:s.twoThirdsSmFont,backgroundColor:e?a.darkenedBgMix25:"",display:"flex",alignItems:"start"})},Checkmark:{style:({$isFocusVisible:e,$checked:t})=>{const o=t&&!i?a.primary:a.fadedText40;return{outline:0,width:"1rem",height:"1rem",marginTop:"0.30rem",boxShadow:e&&t?`0 0 0 0.2rem ${(0,j.DZ)(a.primary,.5)}`:"",borderLeftWidth:"2px",borderRightWidth:"2px",borderTopWidth:"2px",borderBottomWidth:"2px",borderLeftColor:o,borderRightColor:o,borderTopColor:o,borderBottomColor:o}}},Label:{style:{color:d}}},children:(0,D.jsxs)(H,{visibility:(0,n.iF)(null===(e=r.labelVisibility)||void 0===e?void 0:e.value),children:[(0,D.jsx)(z.Z,{source:r.label,allowHTML:!1,isLabel:!0,isCheckbox:!0}),r.help&&(0,D.jsx)(V.Hp,{color:d,children:(0,D.jsx)(E.ZP,{content:r.help,placement:B.ug.TOP_RIGHT})})]})})})}}const W=(0,i.b)(I)}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[4210],{44210:(e,t,o)=>{"use strict";o.r(t),o.d(t,{default:()=>S});var r=o(5057),s=o(11226),i=o(78164),n=o.n(i),l=o(31476),a=o(56846),p=o(94861),u=o(87118),d=o(86964);const h=(0,o(45490).Z)("div",{target:"ede6r8z0"})((({theme:e})=>({"span[aria-disabled='true']":{background:e.colors.fadedText05}})),"");var c=o(8429),m=o(54840),g=o(95323),f=o(58269),v=o(34422),b=o(96266);class x extends r.PureComponent{constructor(...e){super(...e),this.formClearHelper=new a.Kz,this.state={value:this.initialValue},this.commitWidgetValue=e=>{this.props.widgetMgr.setIntArrayValue(this.props.element,this.state.value,e)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.onChange=e=>{this.props.element.maxSelections&&"select"===e.type&&this.state.value.length>=this.props.element.maxSelections||this.setState(this.generateNewState(e),(()=>{this.commitWidgetValue({fromUi:!0})}))},this.filterOptions=(e,t)=>{if(this.overMaxSelections())return[];const o=e.filter((e=>!this.state.value.includes(Number(e.value))));return(0,f.H)(o,t)}}overMaxSelections(){return this.props.element.maxSelections>0&&this.state.value.length>=this.props.element.maxSelections}getNoResultsMsg(){if(0===this.props.element.maxSelections)return"No results";const e=1!==this.props.element.maxSelections?"options":"option";return`You can only select up to ${this.props.element.maxSelections} ${e}. Remove an option first.`}get initialValue(){const e=this.props.widgetMgr.getIntArrayValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}get valueFromState(){return this.state.value.map((e=>{const t=this.props.element.options[e];return{value:e.toString(),label:t}}))}generateNewState(e){const t=()=>{var t;const o=null===(t=e.option)||void 0===t?void 0:t.value;return parseInt(o,10)};switch(e.type){case"remove":return{value:n()(this.state.value,t())};case"clear":return{value:[]};case"select":return{value:this.state.value.concat([t()])};default:throw new Error(`State transition is unknown: ${e.type}`)}}render(){var e;const{element:t,theme:o,width:r,widgetMgr:i}=this.props,n={width:r},{options:l}=t,a=0===l.length||this.props.disabled,f=0===l.length?"No options to select.":"Choose an option",x=l.map(((e,t)=>({label:e,value:t.toString()})));this.formClearHelper.manageFormClearListener(i,t.formId,this.onFormCleared);const S=l.length>10;return(0,b.jsxs)("div",{className:"row-widget stMultiSelect",style:n,children:[(0,b.jsx)(d.ON,{label:t.label,disabled:a,labelVisibility:(0,v.iF)(null===(e=t.labelVisibility)||void 0===e?void 0:e.value),children:t.help&&(0,b.jsx)(d.dT,{children:(0,b.jsx)(c.
|
|
1
|
+
(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[4210],{44210:(e,t,o)=>{"use strict";o.r(t),o.d(t,{default:()=>S});var r=o(5057),s=o(11226),i=o(78164),n=o.n(i),l=o(31476),a=o(56846),p=o(94861),u=o(87118),d=o(86964);const h=(0,o(45490).Z)("div",{target:"ede6r8z0"})((({theme:e})=>({"span[aria-disabled='true']":{background:e.colors.fadedText05}})),"");var c=o(8429),m=o(54840),g=o(95323),f=o(58269),v=o(34422),b=o(96266);class x extends r.PureComponent{constructor(...e){super(...e),this.formClearHelper=new a.Kz,this.state={value:this.initialValue},this.commitWidgetValue=e=>{this.props.widgetMgr.setIntArrayValue(this.props.element,this.state.value,e)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.onChange=e=>{this.props.element.maxSelections&&"select"===e.type&&this.state.value.length>=this.props.element.maxSelections||this.setState(this.generateNewState(e),(()=>{this.commitWidgetValue({fromUi:!0})}))},this.filterOptions=(e,t)=>{if(this.overMaxSelections())return[];const o=e.filter((e=>!this.state.value.includes(Number(e.value))));return(0,f.H)(o,t)}}overMaxSelections(){return this.props.element.maxSelections>0&&this.state.value.length>=this.props.element.maxSelections}getNoResultsMsg(){if(0===this.props.element.maxSelections)return"No results";const e=1!==this.props.element.maxSelections?"options":"option";return`You can only select up to ${this.props.element.maxSelections} ${e}. Remove an option first.`}get initialValue(){const e=this.props.widgetMgr.getIntArrayValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}get valueFromState(){return this.state.value.map((e=>{const t=this.props.element.options[e];return{value:e.toString(),label:t}}))}generateNewState(e){const t=()=>{var t;const o=null===(t=e.option)||void 0===t?void 0:t.value;return parseInt(o,10)};switch(e.type){case"remove":return{value:n()(this.state.value,t())};case"clear":return{value:[]};case"select":return{value:this.state.value.concat([t()])};default:throw new Error(`State transition is unknown: ${e.type}`)}}render(){var e;const{element:t,theme:o,width:r,widgetMgr:i}=this.props,n={width:r},{options:l}=t,a=0===l.length||this.props.disabled,f=0===l.length?"No options to select.":"Choose an option",x=l.map(((e,t)=>({label:e,value:t.toString()})));this.formClearHelper.manageFormClearListener(i,t.formId,this.onFormCleared);const S=l.length>10;return(0,b.jsxs)("div",{className:"row-widget stMultiSelect",style:n,children:[(0,b.jsx)(d.ON,{label:t.label,disabled:a,labelVisibility:(0,v.iF)(null===(e=t.labelVisibility)||void 0===e?void 0:e.value),children:t.help&&(0,b.jsx)(d.dT,{children:(0,b.jsx)(c.ZP,{content:t.help,placement:m.ug.TOP_RIGHT})})}),(0,b.jsx)(h,{children:(0,b.jsx)(p.Z,{options:x,labelKey:"label",valueKey:"value","aria-label":t.label,placeholder:f,type:u.wD.select,multi:!0,onChange:this.onChange,value:this.valueFromState,disabled:a,size:"compact",noResultsMsg:this.getNoResultsMsg(),filterOptions:this.filterOptions,closeOnSelect:!1,overrides:{IconsContainer:{style:()=>({paddingRight:".5rem"})},ControlContainer:{style:{borderLeftWidth:"1px",borderRightWidth:"1px",borderTopWidth:"1px",borderBottomWidth:"1px"}},Placeholder:{style:()=>({flex:"inherit"})},ValueContainer:{style:()=>({minHeight:"38.4px",paddingLeft:".5rem",paddingTop:0,paddingBottom:0,paddingRight:0})},ClearIcon:{props:{overrides:{Svg:{style:{color:o.colors.darkGray}}}}},SearchIcon:{style:{color:o.colors.darkGray}},Tag:{props:{overrides:{Root:{style:{borderTopLeftRadius:o.radii.md,borderTopRightRadius:o.radii.md,borderBottomRightRadius:o.radii.md,borderBottomLeftRadius:o.radii.md,fontSize:o.fontSizes.sm,paddingLeft:o.spacing.sm,marginLeft:0,marginRight:o.spacing.sm,height:"28px"}},Action:{style:{paddingLeft:0}},ActionIcon:{props:{overrides:{Svg:{style:{width:"10px",height:"10px"}}}}},Text:{style:{fontSize:o.fontSizes.md}}}}},MultiValue:{props:{overrides:{Root:{style:{fontSize:o.fontSizes.sm}}}}},Input:{props:{readOnly:s.tq&&!1===S?"readonly":null}},Dropdown:{component:g.s}}})})]})}}const S=(0,l.b)(x)},97247:(e,t,o)=>{var r=o(54305);e.exports=function(e,t){return!!(null==e?0:e.length)&&r(e,t,0)>-1}},89479:e=>{e.exports=function(e,t,o){for(var r=-1,s=null==e?0:e.length;++r<s;)if(o(t,e[r]))return!0;return!1}},3895:(e,t,o)=>{var r=o(98323),s=o(97247),i=o(89479),n=o(73470),l=o(74631),a=o(51565),p=200;e.exports=function(e,t,o,u){var d=-1,h=s,c=!0,m=e.length,g=[],f=t.length;if(!m)return g;o&&(t=n(t,l(o))),u?(h=i,c=!1):t.length>=p&&(h=a,c=!1,t=new r(t));e:for(;++d<m;){var v=e[d],b=null==o?v:o(v);if(v=u||0!==v?v:0,c&&b===b){for(var x=f;x--;)if(t[x]===b)continue e;g.push(v)}else h(t,b,u)||g.push(v)}return g}},60238:e=>{e.exports=function(e,t,o,r){for(var s=e.length,i=o+(r?1:-1);r?i--:++i<s;)if(t(e[i],i,e))return i;return-1}},54305:(e,t,o)=>{var r=o(60238),s=o(24981),i=o(23481);e.exports=function(e,t,o){return t===t?i(e,t,o):r(e,s,o)}},24981:e=>{e.exports=function(e){return e!==e}},23481:e=>{e.exports=function(e,t,o){for(var r=o-1,s=e.length;++r<s;)if(e[r]===t)return r;return-1}},78164:(e,t,o)=>{var r=o(3895),s=o(86456),i=o(7244),n=s((function(e,t){return i(e)?r(e,t):[]}));e.exports=n}}]);
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
50% {
|
|
3
3
|
color: rgba(0, 0, 0, 0);
|
|
4
4
|
}
|
|
5
|
-
`,s=(0,i.Z)("span",{target:"e1m4n6jn0"})((({includeDot:e,shouldBlink:t,theme:r})=>({...e?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:r.colors.gray,margin:"0 5px"}}:{},...t?{color:r.colors.red,animationName:`${a}`,animationDuration:"0.5s",animationIterationCount:5}:{}})),"");var l=r(96266);const u=({dirty:e,value:t,maxLength:r,className:i,type:a="single"})=>{const u=[],c=(e,t=!1)=>{u.push((0,l.jsx)(s,{includeDot:u.length>0,shouldBlink:t,children:e},u.length))};return e&&("multiline"===a?(0,n.Ge)()?c("Press \u2318+Enter to apply"):c("Press Ctrl+Enter to apply"):c("Press Enter to apply")),r&&c(`${t.length}/${r}`,e&&t.length>=r),(0,l.jsx)(o.X7,{className:i,children:u})}},54514:(e,t,r)=>{r.r(t),r.d(t,{default:()=>_});var n=r(5057),o=r(56846),i=r(80099),a=r(97135),s=r(18150),l=r(53381),u=r(4547);function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach((function(t){d(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var f=(0,l.zo)("div",(function(e){return p(p({},(0,u.d5)(p(p({$positive:!1},e),{},{$hasIconTrailing:!1}))),{},{width:e.$resize?"fit-content":"100%"})}));f.displayName="StyledTextAreaRoot",f.displayName="StyledTextAreaRoot";var h=(0,l.zo)("div",(function(e){return(0,u.hB)(p({$positive:!1},e))}));h.displayName="StyledTextareaContainer",h.displayName="StyledTextareaContainer";var y=(0,l.zo)("textarea",(function(e){return p(p({},(0,u.Hx)(e)),{},{resize:e.$resize||"none"})}));function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},b.apply(this,arguments)}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(l){s=!0,o=l}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return g(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function O(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function w(e,t){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},w(e,t)}function j(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=x(e);if(t){var o=x(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===m(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return P(e)}(this,r)}}function P(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function x(e){return x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},x(e)}function S(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}y.displayName="StyledTextarea",y.displayName="StyledTextarea";var C=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&w(e,t)}(u,e);var t,r,o,l=j(u);function u(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return S(P(e=l.call.apply(l,[this].concat(r))),"state",{isFocused:e.props.autoFocus||!1}),S(P(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t)})),S(P(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t)})),e}return t=u,(r=[{key:"render",value:function(){var e=this.props.overrides,t=void 0===e?{}:e,r=v((0,i.jb)(t.Root,f),2),o=r[0],l=r[1],u=(0,i.aO)({Input:{component:y},InputContainer:{component:h}},t);return n.createElement(o,b({"data-baseweb":"textarea",$isFocused:this.state.isFocused,$isReadOnly:this.props.readOnly,$disabled:this.props.disabled,$error:this.props.error,$positive:this.props.positive,$required:this.props.required,$resize:this.props.resize},l),n.createElement(a.Z,b({},this.props,{type:s.iB.textarea,overrides:u,onFocus:this.onFocus,onBlur:this.onBlur,resize:this.props.resize})))}}])&&O(t.prototype,r),o&&O(t,o),Object.defineProperty(t,"prototype",{writable:!1}),u}(n.Component);S(C,"defaultProps",{autoFocus:!1,disabled:!1,readOnly:!1,error:!1,name:"",onBlur:function(){},onChange:function(){},onKeyDown:function(){},onKeyPress:function(){},onKeyUp:function(){},onFocus:function(){},overrides:{},placeholder:"",required:!1,rows:3,size:s.NO.default});const F=C;var T=r(6757),$=r(86964),V=r(8429),B=r(54840),D=r(34422);const E=(0,r(45490).Z)("div",{target:"e1y61itm0"})({name:"1om1ktf",styles:"div{border-width:1px;}"});var k=r(96266);class z extends n.PureComponent{constructor(...e){super(...e),this.formClearHelper=new o.Kz,this.state={dirty:!1,value:this.initialValue},this.commitWidgetValue=e=>{this.props.widgetMgr.setStringValue(this.props.element,this.state.value,e),this.setState({dirty:!1})},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.onBlur=()=>{this.state.dirty&&this.commitWidgetValue({fromUi:!0})},this.onChange=e=>{const{value:t}=e.target,{element:r}=this.props,{maxChars:n}=r;0!==n&&t.length>n||((0,D.$b)(this.props.element)?this.setState({dirty:!1,value:t},(()=>this.commitWidgetValue({fromUi:!0}))):this.setState({dirty:!0,value:t}))},this.isEnterKeyPressed=e=>{const{keyCode:t,key:r}=e;return"Enter"===r||13===t||10===t},this.onKeyDown=e=>{const{metaKey:t,ctrlKey:r}=e,{dirty:n}=this.state;this.isEnterKeyPressed(e)&&(r||t)&&n&&(e.preventDefault(),this.commitWidgetValue({fromUi:!0}))}}get initialValue(){const e=this.props.widgetMgr.getStringValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}render(){var e;const{element:t,disabled:r,width:n,widgetMgr:o}=this.props,{value:i,dirty:a}=this.state,s={width:n},{height:l,placeholder:u}=t;return this.formClearHelper.manageFormClearListener(o,t.formId,this.onFormCleared),(0,k.jsxs)("div",{className:"stTextArea",style:s,children:[(0,k.jsx)($.ON,{label:t.label,disabled:r,labelVisibility:(0,D.iF)(null===(e=t.labelVisibility)||void 0===e?void 0:e.value),children:t.help&&(0,k.jsx)($.dT,{children:(0,k.jsx)(V.
|
|
5
|
+
`,s=(0,i.Z)("span",{target:"e1m4n6jn0"})((({includeDot:e,shouldBlink:t,theme:r})=>({...e?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:r.colors.gray,margin:"0 5px"}}:{},...t?{color:r.colors.red,animationName:`${a}`,animationDuration:"0.5s",animationIterationCount:5}:{}})),"");var l=r(96266);const u=({dirty:e,value:t,maxLength:r,className:i,type:a="single"})=>{const u=[],c=(e,t=!1)=>{u.push((0,l.jsx)(s,{includeDot:u.length>0,shouldBlink:t,children:e},u.length))};return e&&("multiline"===a?(0,n.Ge)()?c("Press \u2318+Enter to apply"):c("Press Ctrl+Enter to apply"):c("Press Enter to apply")),r&&c(`${t.length}/${r}`,e&&t.length>=r),(0,l.jsx)(o.X7,{className:i,children:u})}},54514:(e,t,r)=>{r.r(t),r.d(t,{default:()=>_});var n=r(5057),o=r(56846),i=r(80099),a=r(97135),s=r(18150),l=r(53381),u=r(4547);function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach((function(t){d(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var f=(0,l.zo)("div",(function(e){return p(p({},(0,u.d5)(p(p({$positive:!1},e),{},{$hasIconTrailing:!1}))),{},{width:e.$resize?"fit-content":"100%"})}));f.displayName="StyledTextAreaRoot",f.displayName="StyledTextAreaRoot";var h=(0,l.zo)("div",(function(e){return(0,u.hB)(p({$positive:!1},e))}));h.displayName="StyledTextareaContainer",h.displayName="StyledTextareaContainer";var y=(0,l.zo)("textarea",(function(e){return p(p({},(0,u.Hx)(e)),{},{resize:e.$resize||"none"})}));function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},b.apply(this,arguments)}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(l){s=!0,o=l}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return g(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function O(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function w(e,t){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},w(e,t)}function j(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=x(e);if(t){var o=x(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===m(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return P(e)}(this,r)}}function P(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function x(e){return x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},x(e)}function S(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}y.displayName="StyledTextarea",y.displayName="StyledTextarea";var C=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&w(e,t)}(u,e);var t,r,o,l=j(u);function u(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return S(P(e=l.call.apply(l,[this].concat(r))),"state",{isFocused:e.props.autoFocus||!1}),S(P(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t)})),S(P(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t)})),e}return t=u,(r=[{key:"render",value:function(){var e=this.props.overrides,t=void 0===e?{}:e,r=v((0,i.jb)(t.Root,f),2),o=r[0],l=r[1],u=(0,i.aO)({Input:{component:y},InputContainer:{component:h}},t);return n.createElement(o,b({"data-baseweb":"textarea",$isFocused:this.state.isFocused,$isReadOnly:this.props.readOnly,$disabled:this.props.disabled,$error:this.props.error,$positive:this.props.positive,$required:this.props.required,$resize:this.props.resize},l),n.createElement(a.Z,b({},this.props,{type:s.iB.textarea,overrides:u,onFocus:this.onFocus,onBlur:this.onBlur,resize:this.props.resize})))}}])&&O(t.prototype,r),o&&O(t,o),Object.defineProperty(t,"prototype",{writable:!1}),u}(n.Component);S(C,"defaultProps",{autoFocus:!1,disabled:!1,readOnly:!1,error:!1,name:"",onBlur:function(){},onChange:function(){},onKeyDown:function(){},onKeyPress:function(){},onKeyUp:function(){},onFocus:function(){},overrides:{},placeholder:"",required:!1,rows:3,size:s.NO.default});const F=C;var T=r(6757),$=r(86964),V=r(8429),B=r(54840),D=r(34422);const E=(0,r(45490).Z)("div",{target:"e1y61itm0"})({name:"1om1ktf",styles:"div{border-width:1px;}"});var k=r(96266);class z extends n.PureComponent{constructor(...e){super(...e),this.formClearHelper=new o.Kz,this.state={dirty:!1,value:this.initialValue},this.commitWidgetValue=e=>{this.props.widgetMgr.setStringValue(this.props.element,this.state.value,e),this.setState({dirty:!1})},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.onBlur=()=>{this.state.dirty&&this.commitWidgetValue({fromUi:!0})},this.onChange=e=>{const{value:t}=e.target,{element:r}=this.props,{maxChars:n}=r;0!==n&&t.length>n||((0,D.$b)(this.props.element)?this.setState({dirty:!1,value:t},(()=>this.commitWidgetValue({fromUi:!0}))):this.setState({dirty:!0,value:t}))},this.isEnterKeyPressed=e=>{const{keyCode:t,key:r}=e;return"Enter"===r||13===t||10===t},this.onKeyDown=e=>{const{metaKey:t,ctrlKey:r}=e,{dirty:n}=this.state;this.isEnterKeyPressed(e)&&(r||t)&&n&&(e.preventDefault(),this.commitWidgetValue({fromUi:!0}))}}get initialValue(){const e=this.props.widgetMgr.getStringValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}render(){var e;const{element:t,disabled:r,width:n,widgetMgr:o}=this.props,{value:i,dirty:a}=this.state,s={width:n},{height:l,placeholder:u}=t;return this.formClearHelper.manageFormClearListener(o,t.formId,this.onFormCleared),(0,k.jsxs)("div",{className:"stTextArea",style:s,children:[(0,k.jsx)($.ON,{label:t.label,disabled:r,labelVisibility:(0,D.iF)(null===(e=t.labelVisibility)||void 0===e?void 0:e.value),children:t.help&&(0,k.jsx)($.dT,{children:(0,k.jsx)(V.ZP,{content:t.help,placement:B.ug.TOP_RIGHT})})}),(0,k.jsx)(E,{children:(0,k.jsx)(F,{"data-testid":"stTextArea",value:i,placeholder:u,onBlur:this.onBlur,onChange:this.onChange,onKeyDown:this.onKeyDown,"aria-label":t.label,disabled:r,overrides:{Input:{style:{lineHeight:"1.4",height:l?`${l}px`:"",minHeight:"95px",resize:"vertical","::placeholder":{opacity:"0.7"},paddingRight:"1rem",paddingLeft:"1rem",paddingBottom:"1rem",paddingTop:"1rem"}}}})}),(0,k.jsx)(T.Z,{dirty:a,value:i,maxLength:t.maxChars,type:"multiline"})]})}}const _=z}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[464],{60464:(e,t,i)=>{i.r(t),i.d(t,{default:()=>w});var s=i(5057),a=i(65873),o=i(55790),n=i(31476),r=i(59500),l=i(56846),d=i(32291),h=i(34422),m=i(9187),u=i.n(m),p=i(86964),c=i(8429),g=i(54840),b=i(45490),f=i(59990);const T=(0,b.Z)("div",{target:"e88czh83"})((({disabled:e,theme:t})=>({alignItems:"center",backgroundColor:e?t.colors.gray:t.colors.primary,borderTopLeftRadius:"100%",borderTopRightRadius:"100%",borderBottomLeftRadius:"100%",borderBottomRightRadius:"100%",borderTopStyle:"none",borderBottomStyle:"none",borderRightStyle:"none",borderLeftStyle:"none",boxShadow:"none",display:"flex",height:t.radii.xl,justifyContent:"center",width:t.radii.xl,":focus":{boxShadow:`0 0 0 0.2rem ${(0,f.DZ)(t.colors.primary,.5)}`,outline:"none"}})),""),y=(0,b.Z)("div",{target:"e88czh82"})((({disabled:e,theme:t})=>({fontFamily:t.fonts.monospace,fontSize:t.fontSizes.sm,paddingBottom:t.spacing.twoThirdsSmFont,color:e?t.colors.gray:t.colors.primary,top:"-22px",position:"absolute",whiteSpace:"nowrap",backgroundColor:t.colors.transparent,lineHeight:t.lineHeights.base,fontWeight:"normal"})),""),R=(0,b.Z)("div",{target:"e88czh81"})((({theme:e})=>({paddingBottom:e.spacing.none,paddingLeft:e.spacing.none,paddingRight:e.spacing.none,paddingTop:e.spacing.twoThirdsSmFont,justifyContent:"space-between",alignItems:"center",display:"flex"})),""),v=(0,b.Z)("div",{target:"e88czh80"})((({disabled:e,theme:t})=>({lineHeight:t.lineHeights.base,fontWeight:"normal",fontSize:t.fontSizes.sm,fontFamily:t.fonts.monospace,color:e?t.colors.fadedText40:"inherit"})),"");var V=i(96266);class x extends s.PureComponent{constructor(e){super(e),this.formClearHelper=new l.Kz,this.state=void 0,this.sliderRef=s.createRef(),this.thumbRef=[],this.thumbValueRef=[],this.commitWidgetValueDebounced=void 0,this.commitWidgetValue=e=>{this.props.widgetMgr.setDoubleArrayValue(this.props.element,this.state.value,e)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.handleChange=({value:e})=>{this.setState({value:e},(()=>this.commitWidgetValueDebounced({fromUi:!0})))},this.renderThumb=s.forwardRef(((e,t)=>{const{$value:i,$thumbIndex:o}=e,n=o||0;this.thumbRef[n]=t,this.thumbValueRef[n]||=s.createRef();const r=i?this.formatValue(i[o]):"",l=(0,a.pick)(e,["role","style","aria-valuemax","aria-valuemin","aria-valuenow","tabIndex","onKeyUp","onKeyDown","onMouseEnter","onMouseLeave","draggable"]),d={};return(this.props.element.options.length>0||this.isDateTimeType())&&(d["aria-valuetext"]=r),this.thumbValueAlignment(this.thumbRef[n].current,this.thumbValueRef[n].current),(0,V.jsx)(T,{...l,disabled:!0===e.$disabled,ref:this.thumbRef[n],"aria-valuetext":r,"aria-label":this.props.element.label,children:(0,V.jsx)(y,{className:"StyledThumbValue","data-testid":"stThumbValue",disabled:!0===e.$disabled,ref:this.thumbValueRef[n],children:r})})})),this.renderTickBar=()=>{const{disabled:e,element:t}=this.props,{max:i,min:s}=t;return(0,V.jsxs)(R,{"data-testid":"stTickBar",children:[(0,V.jsx)(v,{disabled:e,"data-testid":"stTickBarMin",children:this.formatValue(s)}),(0,V.jsx)(v,{disabled:e,"data-testid":"stTickBarMax",children:this.formatValue(i)})]})},this.commitWidgetValueDebounced=(0,h.Ds)(200,this.commitWidgetValue.bind(this)),this.state={value:this.initialValue}}get initialValue(){const e=this.props.widgetMgr.getDoubleArrayValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){for(let e=0;e<Math.min(this.thumbRef.length,this.thumbValueRef.length);e++)this.thumbValueAlignment(this.thumbRef[e].current,this.thumbValueRef[e].current);this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}get value(){const{min:e,max:t}=this.props.element,{value:i}=this.state;let s=i[0],a=i.length>1?i[1]:i[0];return s>a&&(s=a),s<e&&(s=e),s>t&&(s=t),a<e&&(a=e),a>t&&(a=t),i.length>1?[s,a]:[s]}isDateTimeType(){const{dataType:e}=this.props.element;return e===d.iR.DataType.DATETIME||e===d.iR.DataType.DATE||e===d.iR.DataType.TIME}formatValue(e){const{format:t,options:i}=this.props.element;return this.isDateTimeType()?u().utc(e/1e3).format(t):i.length>0?(0,r.sprintf)(t,i[e]):(0,r.sprintf)(t,e)}thumbValueAlignment(e,t){const i=this.sliderRef.current;if(i&&e&&t){const s=i.getBoundingClientRect(),a=e.getBoundingClientRect(),o=t.getBoundingClientRect(),n=a.left+a.width/2,r=n-o.width/2<s.left,l=n+o.width/2>s.right;t.style.left=r?"0":"",t.style.right=l?"0":""}}render(){var e;const{disabled:t,element:i,theme:s,width:a,widgetMgr:n}=this.props,{colors:r,fonts:l,fontSizes:d,spacing:m}=s,u={width:a};return this.formClearHelper.manageFormClearListener(n,i.formId,this.onFormCleared),(0,V.jsxs)("div",{ref:this.sliderRef,className:"stSlider",style:u,children:[(0,V.jsx)(p.ON,{label:i.label,disabled:t,labelVisibility:(0,h.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,V.jsx)(p.dT,{children:(0,V.jsx)(c.
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[464],{60464:(e,t,i)=>{i.r(t),i.d(t,{default:()=>w});var s=i(5057),a=i(65873),o=i(55790),n=i(31476),r=i(59500),l=i(56846),d=i(32291),h=i(34422),m=i(9187),u=i.n(m),p=i(86964),c=i(8429),g=i(54840),b=i(45490),f=i(59990);const T=(0,b.Z)("div",{target:"e88czh83"})((({disabled:e,theme:t})=>({alignItems:"center",backgroundColor:e?t.colors.gray:t.colors.primary,borderTopLeftRadius:"100%",borderTopRightRadius:"100%",borderBottomLeftRadius:"100%",borderBottomRightRadius:"100%",borderTopStyle:"none",borderBottomStyle:"none",borderRightStyle:"none",borderLeftStyle:"none",boxShadow:"none",display:"flex",height:t.radii.xl,justifyContent:"center",width:t.radii.xl,":focus":{boxShadow:`0 0 0 0.2rem ${(0,f.DZ)(t.colors.primary,.5)}`,outline:"none"}})),""),y=(0,b.Z)("div",{target:"e88czh82"})((({disabled:e,theme:t})=>({fontFamily:t.fonts.monospace,fontSize:t.fontSizes.sm,paddingBottom:t.spacing.twoThirdsSmFont,color:e?t.colors.gray:t.colors.primary,top:"-22px",position:"absolute",whiteSpace:"nowrap",backgroundColor:t.colors.transparent,lineHeight:t.lineHeights.base,fontWeight:"normal"})),""),R=(0,b.Z)("div",{target:"e88czh81"})((({theme:e})=>({paddingBottom:e.spacing.none,paddingLeft:e.spacing.none,paddingRight:e.spacing.none,paddingTop:e.spacing.twoThirdsSmFont,justifyContent:"space-between",alignItems:"center",display:"flex"})),""),v=(0,b.Z)("div",{target:"e88czh80"})((({disabled:e,theme:t})=>({lineHeight:t.lineHeights.base,fontWeight:"normal",fontSize:t.fontSizes.sm,fontFamily:t.fonts.monospace,color:e?t.colors.fadedText40:"inherit"})),"");var V=i(96266);class x extends s.PureComponent{constructor(e){super(e),this.formClearHelper=new l.Kz,this.state=void 0,this.sliderRef=s.createRef(),this.thumbRef=[],this.thumbValueRef=[],this.commitWidgetValueDebounced=void 0,this.commitWidgetValue=e=>{this.props.widgetMgr.setDoubleArrayValue(this.props.element,this.state.value,e)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.handleChange=({value:e})=>{this.setState({value:e},(()=>this.commitWidgetValueDebounced({fromUi:!0})))},this.renderThumb=s.forwardRef(((e,t)=>{const{$value:i,$thumbIndex:o}=e,n=o||0;this.thumbRef[n]=t,this.thumbValueRef[n]||=s.createRef();const r=i?this.formatValue(i[o]):"",l=(0,a.pick)(e,["role","style","aria-valuemax","aria-valuemin","aria-valuenow","tabIndex","onKeyUp","onKeyDown","onMouseEnter","onMouseLeave","draggable"]),d={};return(this.props.element.options.length>0||this.isDateTimeType())&&(d["aria-valuetext"]=r),this.thumbValueAlignment(this.thumbRef[n].current,this.thumbValueRef[n].current),(0,V.jsx)(T,{...l,disabled:!0===e.$disabled,ref:this.thumbRef[n],"aria-valuetext":r,"aria-label":this.props.element.label,children:(0,V.jsx)(y,{className:"StyledThumbValue","data-testid":"stThumbValue",disabled:!0===e.$disabled,ref:this.thumbValueRef[n],children:r})})})),this.renderTickBar=()=>{const{disabled:e,element:t}=this.props,{max:i,min:s}=t;return(0,V.jsxs)(R,{"data-testid":"stTickBar",children:[(0,V.jsx)(v,{disabled:e,"data-testid":"stTickBarMin",children:this.formatValue(s)}),(0,V.jsx)(v,{disabled:e,"data-testid":"stTickBarMax",children:this.formatValue(i)})]})},this.commitWidgetValueDebounced=(0,h.Ds)(200,this.commitWidgetValue.bind(this)),this.state={value:this.initialValue}}get initialValue(){const e=this.props.widgetMgr.getDoubleArrayValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){for(let e=0;e<Math.min(this.thumbRef.length,this.thumbValueRef.length);e++)this.thumbValueAlignment(this.thumbRef[e].current,this.thumbValueRef[e].current);this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}get value(){const{min:e,max:t}=this.props.element,{value:i}=this.state;let s=i[0],a=i.length>1?i[1]:i[0];return s>a&&(s=a),s<e&&(s=e),s>t&&(s=t),a<e&&(a=e),a>t&&(a=t),i.length>1?[s,a]:[s]}isDateTimeType(){const{dataType:e}=this.props.element;return e===d.iR.DataType.DATETIME||e===d.iR.DataType.DATE||e===d.iR.DataType.TIME}formatValue(e){const{format:t,options:i}=this.props.element;return this.isDateTimeType()?u().utc(e/1e3).format(t):i.length>0?(0,r.sprintf)(t,i[e]):(0,r.sprintf)(t,e)}thumbValueAlignment(e,t){const i=this.sliderRef.current;if(i&&e&&t){const s=i.getBoundingClientRect(),a=e.getBoundingClientRect(),o=t.getBoundingClientRect(),n=a.left+a.width/2,r=n-o.width/2<s.left,l=n+o.width/2>s.right;t.style.left=r?"0":"",t.style.right=l?"0":""}}render(){var e;const{disabled:t,element:i,theme:s,width:a,widgetMgr:n}=this.props,{colors:r,fonts:l,fontSizes:d,spacing:m}=s,u={width:a};return this.formClearHelper.manageFormClearListener(n,i.formId,this.onFormCleared),(0,V.jsxs)("div",{ref:this.sliderRef,className:"stSlider",style:u,children:[(0,V.jsx)(p.ON,{label:i.label,disabled:t,labelVisibility:(0,h.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,V.jsx)(p.dT,{children:(0,V.jsx)(c.ZP,{content:i.help,placement:g.ug.TOP_RIGHT})})}),(0,V.jsx)(o.Z,{min:i.min,max:i.max,step:i.step,value:this.value,onChange:this.handleChange,disabled:t,overrides:{Root:{style:{paddingTop:m.twoThirdsSmFont}},Thumb:this.renderThumb,Tick:{style:{fontFamily:l.monospace,fontSize:d.sm}},Track:{style:{backgroundColor:"none !important",paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:m.twoThirdsSmFont}},InnerTrack:{style:({$disabled:e})=>({height:"4px",...e?{background:r.darkenedBgMix25}:{}})},TickBar:this.renderTickBar}})]})}}const w=(0,n.b)(x)}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[5608],{75608:(o,t,s)=>{s.r(t),s.d(t,{default:()=>c});s(5057);var i=s(77390),e=s(45490),n=s(99362);const a=(0,e.Z)("div",{target:"edb2rvg0"})((({theme:o})=>({paddingBottom:o.spacing.smPx,lineHeight:o.lineHeights.normal,color:(0,n.yq)(o)})),"");var r=s(46540),g=s(96266);const c=function({element:o,width:t}){return(0,g.jsxs)("div",{className:"stProgress",children:[(0,g.jsx)(a,{children:(0,g.jsx)(r.Z,{source:o.text,allowHTML:!1,isLabel:!0})}),(0,g.jsx)(i.Z,{value:o.value,width:t})]})}},77390:(o,t,s)=>{s.d(t,{$:()=>l,Z:()=>d});var i=s(5057),e=s(31476),n=s(63),a=s(99362),r=s(16449),g=s(80099),c=s(96266);let l;!function(o){o.EXTRASMALL="xs",o.SMALL="sm",o.MEDIUM="md",o.LARGE="lg",o.EXTRALARGE="xl"}(l||(l={}));const d=function({value:o,width:t,size:s=l.SMALL,overrides:d}){const p=(0,e.u)(),m={xs:p.spacing.twoXS,sm:p.spacing.sm,md:p.spacing.lg,lg:p.spacing.xl,xl:p.spacing.twoXL},{activeTheme:u}=i.useContext(n.I),h=!(0,a.MJ)(u),b={BarContainer:{style:{marginTop:p.spacing.none,marginBottom:p.spacing.none,marginRight:p.spacing.none,marginLeft:p.spacing.none}},Bar:{style:({$theme:o})=>({width:t?t.toString():void 0,marginTop:p.spacing.none,marginBottom:p.spacing.none,marginRight:p.spacing.none,marginLeft:p.spacing.none,height:m[s],backgroundColor:o.colors.progressbarTrackFill,borderTopLeftRadius:p.spacing.twoXS,borderTopRightRadius:p.spacing.twoXS,borderBottomLeftRadius:p.spacing.twoXS,borderBottomRightRadius:p.spacing.twoXS})},BarProgress:{style:()=>({backgroundColor:h?p.colors.primary:p.colors.blue70,borderTopLeftRadius:p.spacing.twoXS,borderTopRightRadius:p.spacing.twoXS,borderBottomLeftRadius:p.spacing.twoXS,borderBottomRightRadius:p.spacing.twoXS})}};return(0,c.jsx)(r.Z,{value:o,overrides:(0,g.aO)(b,d)})}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[5678],{15678:(t,e,i)=>{i.r(e),i.d(e,{default:()=>V});var a=i(5057),n=i(31476),s=i(52801),o=i(40807),r=i.n(o),h=i(62658),d=i(42429),l=i(47143),c=i(
|
|
1
|
+
"use strict";(globalThis.webpackChunk_stlite_desktop=globalThis.webpackChunk_stlite_desktop||[]).push([[5678],{15678:(t,e,i)=>{i.r(e),i.d(e,{default:()=>V});var a=i(5057),n=i(31476),s=i(52801),o=i(40807),r=i.n(o),h=i(62658),d=i(42429),l=i(47143),c=i(96223),g=i(96533),u=i(79220);const f=(0,i(45490).Z)("div",{target:"e10fe9o10"})((({theme:t})=>({"&.vega-embed":{".vega-actions":{zIndex:t.zIndices.popupMenu},summary:{height:"auto",zIndex:t.zIndices.menuButton}}})),"");var p=i(96266);const m={DATAFRAME_INDEX:"(index)"},w="source",v=new Set(["datetimeIndex","float_64Index","int_64Index","rangeIndex","timedeltaIndex","uint_64Index"]);class b extends a.PureComponent{constructor(...t){super(...t),this.vegaView=void 0,this.vegaFinalizer=void 0,this.defaultDataName=w,this.element=null,this.state={error:void 0},this.finalizeView=()=>{this.vegaFinalizer&&this.vegaFinalizer(),this.vegaFinalizer=void 0,this.vegaView=void 0},this.generateSpec=()=>{const{element:t,theme:e}=this.props,i=JSON.parse(t.get("spec")),a=JSON.parse(t.get("useContainerWidth"));if(i.config=function(t,e){const{colors:i,fontSizes:a,genericFonts:n}=e,s={labelFont:n.bodyFont,titleFont:n.bodyFont,labelFontSize:a.twoSmPx,titleFontSize:a.twoSmPx},o={background:i.bgColor,axis:{labelColor:i.bodyText,titleColor:i.bodyText,gridColor:i.fadedText10,...s},legend:{labelColor:i.bodyText,titleColor:i.bodyText,...s},title:{color:i.bodyText,subtitleColor:i.bodyText,...s},header:{labelColor:i.bodyText},view:{continuousHeight:300,continuousWidth:400}};if(!t)return o;return r()({},o,t)}(i.config,e),this.props.height?(i.width=this.props.width-38,i.height=this.props.height):a&&(i.width=this.props.width-38),i.padding||(i.padding={}),null==i.padding.bottom&&(i.padding.bottom=20),i.datasets)throw new Error("Datasets should not be passed as part of the spec");return i}}async componentDidMount(){try{await this.createView()}catch(t){const e=(0,l.b)(t);this.setState({error:e})}}componentWillUnmount(){this.finalizeView()}async componentDidUpdate(t){const{element:e,theme:i}=t,{element:a,theme:n}=this.props,o=e.get("spec"),r=a.get("spec");if(!this.vegaView||o!==r||i!==n||t.width!==this.props.width||t.height!==this.props.height){(0,s.ji)("Vega spec changed.");try{await this.createView()}catch(u){const t=(0,l.b)(u);this.setState({error:t})}return}const h=e.get("data"),d=a.get("data");(h||d)&&this.updateData(this.defaultDataName,h,d);const c=y(e)||{},g=y(a)||{};for(const[s,l]of Object.entries(g)){const t=s||this.defaultDataName,e=c[t];this.updateData(t,e,l)}for(const s of Object.keys(c))g.hasOwnProperty(s)||s===this.defaultDataName||this.updateData(s,null,null);this.vegaView.resize().runAsync()}updateData(t,e,i){if(!this.vegaView)throw new Error("Chart has not been drawn yet");if(!i||!i.get("data")){return void(this.vegaView._runtime.data.hasOwnProperty(t)&&this.vegaView.remove(t,g.truthy))}if(!e||!e.get("data"))return void this.vegaView.insert(t,x(i));const[a,n]=(0,d.oo)(e.get("data")),[o,r]=(0,d.oo)(i.get("data"));if(function(t,e,i,a,n,s){if(i!==s)return!1;if(e>=n)return!1;if(0===e)return!1;const o=t.get("data"),r=a.get("data"),h=s-1,l=e-1;if((0,d.Fm)(o,h,0)!==(0,d.Fm)(r,h,0)||(0,d.Fm)(o,h,l)!==(0,d.Fm)(r,h,l))return!1;return!0}(e,a,n,i,o,r))a<o&&this.vegaView.insert(t,x(i,a));else{const e=g.changeset().remove(g.truthy).insert(x(i));this.vegaView.change(t,e),(0,s.ji)(`Had to clear the ${t} dataset before inserting data through Vega view.`)}}async createView(){if((0,s.ji)("Creating a new Vega view."),!this.element)throw Error("Element missing.");this.finalizeView();const t=this.props.element,e=this.generateSpec(),i={ast:!0,expr:u.N},{vgSpec:a,view:n,finalize:o}=await(0,c.ZP)(this.element,e,i);this.vegaView=n,this.vegaFinalizer=o;const r=function(t){const e=y(t);if(null==e)return null;const i={};for(const[a,n]of Object.entries(e))i[a]=x(n);return i}(t),h=r?Object.keys(r):[];if(1===h.length){const[t]=h;this.defaultDataName=t}else 0===h.length&&a.data&&(this.defaultDataName=w);const d=function(t){const e=t.get("data");if(!e)return null;return x(e)}(t);if(d&&n.insert(this.defaultDataName,d),r)for(const[s,l]of Object.entries(r))n.insert(s,l);await n.runAsync(),this.vegaView.resize().runAsync()}render(){if(this.state.error)throw this.state.error;return(0,p.jsx)(f,{"data-testid":"stVegaLiteChart",ref:t=>{this.element=t}})}}function y(t){if(!t.get("datasets")||t.get("datasets").isEmpty())return null;const e={};return t.get("datasets").forEach((t=>{if(!t)return;const i=t.get("hasName")?t.get("name"):null;e[i]=t.get("data")})),e}function x(t,e=0){if(!t.get("data"))return[];if(!t.get("index"))return[];if(!t.get("columns"))return[];const i=[],[a,n]=(0,d.oo)(t.get("data")),s=t.get("index").get("type"),o=v.has(s);for(let r=e;r<a;r++){const e={};o&&(e[m.DATAFRAME_INDEX]=(0,d.l$)(t.get("index"),0,r));for(let i=0;i<n;i++)e[(0,d.l$)(t.get("columns"),0,i)]=(0,d.Fm)(t.get("data"),i,r);i.push(e)}return i}const V=(0,n.b)((0,h.Z)(b))}}]);
|