@univerjs/sheets-numfmt-ui 1.0.0-alpha.1 → 1.0.0-insiders.20260629-12f2e44
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/lib/cjs/index.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +9 -9
- package/LICENSE +0 -176
package/lib/cjs/index.js
CHANGED
|
@@ -15,7 +15,7 @@ let _univerjs_engine_formula = require("@univerjs/engine-formula");
|
|
|
15
15
|
|
|
16
16
|
//#region package.json
|
|
17
17
|
var name = "@univerjs/sheets-numfmt-ui";
|
|
18
|
-
var version = "1.0.0-
|
|
18
|
+
var version = "1.0.0-insiders.20260629-12f2e44";
|
|
19
19
|
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region src/config/config.ts
|
package/lib/es/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import { stripErrorMargin } from "@univerjs/engine-formula";
|
|
|
14
14
|
|
|
15
15
|
//#region package.json
|
|
16
16
|
var name = "@univerjs/sheets-numfmt-ui";
|
|
17
|
-
var version = "1.0.0-
|
|
17
|
+
var version = "1.0.0-insiders.20260629-12f2e44";
|
|
18
18
|
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/config/config.ts
|
package/lib/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import { stripErrorMargin } from "@univerjs/engine-formula";
|
|
|
14
14
|
|
|
15
15
|
//#region package.json
|
|
16
16
|
var name = "@univerjs/sheets-numfmt-ui";
|
|
17
|
-
var version = "1.0.0-
|
|
17
|
+
var version = "1.0.0-insiders.20260629-12f2e44";
|
|
18
18
|
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/config/config.ts
|
package/lib/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("@univerjs/engine-render"),require("@univerjs/sheets-numfmt"),require("@univerjs/sheets-ui"),require("react"),require("@univerjs/ui"),require("@univerjs/design"),require("@univerjs/sheets"),require("rxjs"),require("rxjs/operators"),require("react/jsx-runtime"),require("@univerjs/engine-formula")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/engine-render`,`@univerjs/sheets-numfmt`,`@univerjs/sheets-ui`,`react`,`@univerjs/ui`,`@univerjs/design`,`@univerjs/sheets`,`rxjs`,`rxjs/operators`,`react/jsx-runtime`,`@univerjs/engine-formula`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsNumfmtUi={},e.UniverCore,e.UniverEngineRender,e.UniverSheetsNumfmt,e.UniverSheetsUi,e.React,e.UniverUi,e.UniverDesign,e.UniverSheets,e.rxjs,e.rxjs.operators,e.React,e.UniverEngineFormula))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var p=`@univerjs/sheets-numfmt-ui`,m=`1.0.0-alpha.1`;let h={};function g({ref:e,...t}){let{icon:n,id:r,className:i,extend:o,...s}=t,c=`univerjs-icon univerjs-icon-${r} ${i||``}`.trim(),l=(0,a.useRef)(`_${b()}`);return _(n,`${r}`,{defIds:n.defIds,idSuffix:l.current},{ref:e,className:c,...s},o)}function _(e,t,n,r,i){return(0,a.createElement)(e.tag,{key:t,...v(e,n,i),...r},(y(e,n).children||[]).map((r,a)=>_(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function v(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),n!=null&&n.colorChannel1&&r.stroke===`colorChannel1`&&(r.stroke=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function y(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function b(){return Math.random().toString(36).substring(2,8)}g.displayName=`UniverIcon`;let x={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M4.06641 3.49366C4.06641 2.27555 5.14145 1.3916 6.33307 1.3916C7.52469 1.3916 8.59974 2.27555 8.59974 3.49366V6.49777C8.59974 7.71586 7.52469 8.59982 6.33307 8.59982C5.14145 8.59982 4.06641 7.71586 4.06641 6.49777V3.49366ZM6.33307 2.5916C5.68376 2.5916 5.26641 3.05264 5.26641 3.49366V6.49777C5.26641 6.93878 5.68376 7.39982 6.33307 7.39982C6.98239 7.39982 7.39974 6.93878 7.39974 6.49777V3.49366C7.39974 3.05264 6.98239 2.5916 6.33307 2.5916Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M10.0664 3.49366C10.0664 2.27555 11.1415 1.3916 12.3331 1.3916C13.5247 1.3916 14.5997 2.27555 14.5997 3.49366V6.49777C14.5997 7.71586 13.5247 8.59982 12.3331 8.59982C11.1415 8.59982 10.0664 7.71586 10.0664 6.49777V3.49366ZM12.3331 2.5916C11.6838 2.5916 11.2664 3.05264 11.2664 3.49366V6.49777C11.2664 6.93878 11.6838 7.39982 12.3331 7.39982C12.9824 7.39982 13.3997 6.93878 13.3997 6.49777V3.49366C13.3997 3.05264 12.9824 2.5916 12.3331 2.5916Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M12.4242 9.5417C12.1899 9.30739 11.81 9.30739 11.5756 9.5417C11.3413 9.77602 11.3413 10.1559 11.5756 10.3902L12.5514 11.366H6.3334C6.00203 11.366 5.7334 11.6346 5.7334 11.966C5.7334 12.2973 6.00203 12.566 6.3334 12.566H12.5514L11.5756 13.5417C11.3413 13.776 11.3413 14.1559 11.5756 14.3902C11.81 14.6245 12.1899 14.6245 12.4242 14.3902L14.4159 12.3985C14.5294 12.2893 14.6001 12.1359 14.6001 11.966C14.6001 11.796 14.5294 11.6426 14.4159 11.5334L12.4242 9.5417Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M1.3999 8.3002C1.3999 7.96882 1.66853 7.7002 1.9999 7.7002H2.33324C2.66461 7.7002 2.93324 7.96882 2.93324 8.3002C2.93324 8.63157 2.66461 8.9002 2.33324 8.9002H1.9999C1.66853 8.9002 1.3999 8.63157 1.3999 8.3002Z`}}]},S=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(g,Object.assign({},e,{id:`add-digits-icon`,ref:t,icon:x}))});S.displayName=`AddDigitsIcon`;let C={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},w=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(g,Object.assign({},e,{id:`check-mark-icon`,ref:t,icon:C}))});w.displayName=`CheckMarkIcon`;let ee={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M7.3999 2.8999V1.6C7.3999 1.26863 7.66853 1 7.9999 1C8.33127 1 8.5999 1.26863 8.5999 1.6V2.8999H10.2044C11.6655 2.8999 12.8499 4.08431 12.8499 5.54536C12.8499 5.87673 12.5813 6.14536 12.2499 6.14536C11.9185 6.14536 11.6499 5.87673 11.6499 5.54536C11.6499 4.74705 11.0028 4.0999 10.2044 4.0999H5.7384C4.97155 4.0999 4.3499 4.72155 4.3499 5.4884C4.3499 6.14439 4.80899 6.71087 5.45074 6.84677L10.7977 7.97906C11.994 8.23242 12.8499 9.28849 12.8499 10.5114C12.8499 11.941 11.691 13.0999 10.2614 13.0999H8.5999V14.4C8.5999 14.7314 8.33127 15 7.9999 15C7.66853 15 7.3999 14.7314 7.3999 14.4V13.0999H5.79536C4.33431 13.0999 3.1499 11.9155 3.1499 10.4544C3.1499 10.1231 3.41853 9.85445 3.7499 9.85445C4.08127 9.85445 4.3499 10.1231 4.3499 10.4544C4.3499 11.2527 4.99705 11.8999 5.79536 11.8999H10.2614C11.0283 11.8999 11.6499 11.2782 11.6499 10.5114C11.6499 9.85542 11.1908 9.28893 10.5491 9.15303L5.20214 8.02074C4.00575 7.76739 3.1499 6.71132 3.1499 5.4884C3.1499 4.05881 4.30881 2.8999 5.7384 2.8999H7.3999Z`}}]},T=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(g,Object.assign({},e,{id:`dollar-icon`,ref:t,icon:ee}))});T.displayName=`DollarIcon`;let te={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M5.84964 5.80918C6.71946 3.63548 8.84516 2.2 11.3295 2.2C11.8324 2.2 12.3198 2.26279 12.7846 2.38065C13.1058 2.46209 13.4322 2.26773 13.5137 1.94652C13.5951 1.62532 13.4008 1.2989 13.0795 1.21746C12.5191 1.07535 11.9327 1 11.3295 1C8.17278 1 5.49724 2.96009 4.57394 5.80918H3.06582C2.73445 5.80918 2.46582 6.07781 2.46582 6.40918C2.46582 6.74055 2.73445 7.00918 3.06582 7.00918H4.29808C4.25287 7.33297 4.22949 7.66376 4.22949 8C4.22949 8.33608 4.25284 8.6667 4.29801 8.99033H3.06582C2.73445 8.99033 2.46582 9.25896 2.46582 9.59033C2.46582 9.9217 2.73445 10.1903 3.06582 10.1903H4.57378C5.49693 13.0397 8.1726 15 11.3295 15C11.9336 15 12.5209 14.9244 13.0821 14.7819C13.4033 14.7003 13.5975 14.3738 13.5159 14.0527C13.4344 13.7315 13.1079 13.5373 12.7867 13.6188C12.3213 13.737 11.8332 13.8 11.3295 13.8C8.84497 13.8 6.71914 12.3643 5.84944 10.1903H11.4291C11.7605 10.1903 12.0291 9.9217 12.0291 9.59033C12.0291 9.25896 11.7605 8.99033 11.4291 8.99033H5.51225C5.45783 8.66834 5.42949 8.33748 5.42949 8C5.42949 7.66235 5.45786 7.33133 5.51233 7.00918H11.4291C11.7605 7.00918 12.0291 6.74055 12.0291 6.40918C12.0291 6.07781 11.7605 5.80918 11.4291 5.80918H5.84964Z`}}]},E=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(g,Object.assign({},e,{id:`euro-icon`,ref:t,icon:te}))});E.displayName=`EuroIcon`;let D={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M1.85059 4.06725C1.85059 2.84302 2.84302 1.85059 4.06725 1.85059C5.29148 1.85059 6.28392 2.84302 6.28392 4.06725C6.28392 5.29148 5.29148 6.28392 4.06725 6.28392C2.84302 6.28392 1.85059 5.29148 1.85059 4.06725ZM4.06725 2.95059C3.45053 2.95059 2.95059 3.45053 2.95059 4.06725C2.95059 4.68397 3.45053 5.18392 4.06725 5.18392C4.68397 5.18392 5.18392 4.68397 5.18392 4.06725C5.18392 3.45053 4.68397 2.95059 4.06725 2.95059Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M9.7168 11.933C9.7168 10.7087 10.7092 9.71631 11.9335 9.71631C13.1577 9.71631 14.1501 10.7087 14.1501 11.933C14.1501 13.1572 13.1577 14.1496 11.9335 14.1496C10.7092 14.1496 9.7168 13.1572 9.7168 11.933ZM11.9335 10.8163C11.3167 10.8163 10.8168 11.3163 10.8168 11.933C10.8168 12.5497 11.3167 13.0496 11.9335 13.0496C12.5502 13.0496 13.0501 12.5497 13.0501 11.933C13.0501 11.3163 12.5502 10.8163 11.9335 10.8163Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M13.5241 3.32407C13.7584 3.08975 13.7584 2.70986 13.5241 2.47554C13.2898 2.24123 12.9099 2.24123 12.6755 2.47554L2.47554 12.6755C2.24123 12.9099 2.24123 13.2898 2.47554 13.5241C2.70986 13.7584 3.08975 13.7584 3.32407 13.5241L13.5241 3.32407Z`}}]},O=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(g,Object.assign({},e,{id:`percent-icon`,ref:t,icon:D}))});O.displayName=`PercentIcon`;let ne={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M6.33307 1.3916C5.14145 1.3916 4.06641 2.27555 4.06641 3.49366V6.49777C4.06641 7.71586 5.14145 8.59982 6.33307 8.59982C7.52469 8.59982 8.59974 7.71586 8.59974 6.49777V3.49366C8.59974 2.27555 7.52469 1.3916 6.33307 1.3916ZM5.26641 3.49366C5.26641 3.05264 5.68376 2.5916 6.33307 2.5916C6.98239 2.5916 7.39974 3.05264 7.39974 3.49366V6.49777C7.39974 6.93878 6.98239 7.39982 6.33307 7.39982C5.68376 7.39982 5.26641 6.93878 5.26641 6.49777V3.49366Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M7.90913 9.5417C8.14345 9.30739 8.52335 9.30739 8.75766 9.5417C8.99198 9.77602 8.99198 10.1559 8.75766 10.3902L7.78193 11.366H13.9999C14.3313 11.366 14.5999 11.6346 14.5999 11.966C14.5999 12.2973 14.3313 12.566 13.9999 12.566H7.78193L8.75766 13.5417C8.99198 13.776 8.99198 14.1559 8.75766 14.3902C8.52335 14.6245 8.14345 14.6245 7.90913 14.3902L5.91739 12.3985C5.80388 12.2893 5.73324 12.1359 5.73324 11.966C5.73324 11.796 5.80388 11.6426 5.91739 11.5334L7.90913 9.5417Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M1.3999 8.3002C1.3999 7.96882 1.66853 7.7002 1.9999 7.7002H2.33324C2.66461 7.7002 2.93324 7.96882 2.93324 8.3002C2.93324 8.63157 2.66461 8.9002 2.33324 8.9002H1.9999C1.66853 8.9002 1.3999 8.63157 1.3999 8.3002Z`}}]},k=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(g,Object.assign({},e,{id:`reduce-digits-icon`,ref:t,icon:ne}))});k.displayName=`ReduceDigitsIcon`;let re={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M11.9445 1.55649C12.2184 1.744 12.2895 2.11755 12.1033 2.39085L9.24342 6.58659H12.8001C13.1315 6.58659 13.4001 6.85522 13.4001 7.18659C13.4001 7.51796 13.1315 7.78659 12.8001 7.78659H8.5999V9.91276H13.2221C13.5534 9.91276 13.8221 10.1814 13.8221 10.5128C13.8221 10.8441 13.5534 11.1128 13.2221 11.1128H8.5999V14.0877C8.5999 14.4191 8.33127 14.6877 7.9999 14.6877C7.66853 14.6877 7.3999 14.4191 7.3999 14.0877V11.1128H2.77773C2.44636 11.1128 2.17773 10.8441 2.17773 10.5128C2.17773 10.1814 2.44636 9.91276 2.77773 9.91276H7.3999V7.78659H3.2001C2.86873 7.78659 2.6001 7.51796 2.6001 7.18659C2.6001 6.85522 2.86873 6.58659 3.2001 6.58659H6.75736L3.89753 2.39085C3.71125 2.11755 3.78234 1.744 4.05631 1.55649C4.33029 1.36899 4.7034 1.43854 4.88968 1.71184L7.94595 6.19577C7.96752 6.22741 7.98564 6.2604 8.00039 6.29429C8.01514 6.2604 8.03326 6.22741 8.05483 6.19577L11.1111 1.71184C11.2974 1.43854 11.6705 1.36899 11.9445 1.55649Z`}}]},A=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(g,Object.assign({},e,{id:`rmb-icon`,ref:t,icon:re}))});A.displayName=`RmbIcon`;let ie={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M9.72502 1.02051H6.07803C4.97346 1.02051 4.07803 1.91594 4.07803 3.02051V7.57046H3.00039C2.66902 7.57046 2.40039 7.83909 2.40039 8.17046C2.40039 8.50183 2.66902 8.77046 3.00039 8.77046H4.07803V10.4854H3.00039C2.66902 10.4854 2.40039 10.754 2.40039 11.0854C2.40039 11.4167 2.66902 11.6854 3.00039 11.6854H4.07803V14.3795C4.07803 14.7108 4.34666 14.9795 4.67803 14.9795C5.0094 14.9795 5.27803 14.7108 5.27803 14.3795V11.6854H10.3637C10.695 11.6854 10.9637 11.4167 10.9637 11.0854C10.9637 10.754 10.695 10.4854 10.3637 10.4854H5.27803V8.77046H9.72503C11.8651 8.77046 13.6 7.03557 13.6 4.89548C13.6 2.75539 11.8651 1.02051 9.72502 1.02051ZM9.72503 7.57046H5.27803V3.12051C5.27803 2.62345 5.68097 2.22051 6.17803 2.22051H9.72502C11.2024 2.22051 12.4 3.41814 12.4 4.89548C12.4 6.37283 11.2024 7.57046 9.72503 7.57046Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},j=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(g,Object.assign({},e,{id:`rouble-icon`,ref:t,icon:ie}))});j.displayName=`RoubleIcon`;let M={id:`sheet.operation.close.numfmt.panel`,type:t.CommandType.OPERATION,handler:()=>!0};function N(e){"@babel/helpers - typeof";return N=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},N(e)}function ae(e,t){if(N(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(N(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function oe(e){var t=ae(e,`string`);return N(t)==`symbol`?t:t+``}function P(e,t,n){return(t=oe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F(e,t){return function(n,r){t(n,r,e)}}function I(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let L=class extends t.Disposable{constructor(e,t,n,r,i,a,o,s,c,l,u){super(),this._sheetInterceptorService=e,this._themeService=t,this._univerInstanceService=n,this._commandService=r,this._selectionManagerService=i,this._renderManagerService=a,this._numfmtService=o,this._componentManager=s,this._sidebarService=c,this._localeService=l,this._sheetsNumfmtCellContentController=u,P(this,`_previewPattern`,``),P(this,`_sidebarDisposable`,null),this._initRealTimeRenderingInterceptor(),this._initCommands(),this._initCloseListener(),this._commandExecutedListener(),this._initNumfmtLocalChange()}_initNumfmtLocalChange(){this.disposeWithMe((0,l.merge)(this._sheetsNumfmtCellContentController.locale$,this._localeService.currentLocale$).subscribe(()=>{this._forceUpdate()}))}openPanel(){var e;let n=this._sidebarService,i=this._selectionManagerService,a=this._commandService,o=this._univerInstanceService,s=this._numfmtService,c=this._localeService,l=(((e=i.getCurrentSelections())==null?void 0:e.map(e=>e.range))||[])[0];if(!l)return!1;let u=o.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),d=u.getActiveSheet();if(!d)return!1;let f=d.getCellRaw(l.startRow,l.startColumn),p=s.getValue(u.getUnitId(),d.getSheetId(),l.startRow,l.startColumn),m=``;p&&(m=p.pattern);let h=(f==null?void 0:f.t)===t.CellValueType.NUMBER?f.v:12345678,g={onChange:e=>{if(e.type===`change`)this._previewPattern=e.value,this._forceUpdate();else if(e.type===`confirm`){var o;let s=((o=i.getCurrentSelections())==null?void 0:o.map(e=>e.range))||[],c={values:[]},l=(0,r.getPatternType)(e.value);s.forEach(n=>{t.Range.foreach(n,(t,n)=>{c.values.push({row:t,col:n,pattern:e.value,type:l})})}),a.executeCommand(r.SetNumfmtCommand.id,c),n.close()}else e.type===`cancel`&&n.close()},value:{defaultPattern:m,defaultValue:h,row:l.startRow,col:l.startColumn}};return this._sidebarDisposable=n.open({header:{title:c.t(`sheets-numfmt-ui.title`)},children:{label:`SHEET_NUMFMT_PANEL`,...g},onClose:()=>{this._forceUpdate(),a.executeCommand(M.id)}}),!0}_forceUpdate(e){var n;let r=this._renderManagerService.getRenderById(e==null?this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId():e);r==null||r.with(i.SheetSkeletonManagerService).reCalculate(),r==null||(n=r.mainComponent)==null||n.makeDirty()}_initCommands(){[R,M].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initRealTimeRenderingInterceptor(){let e=(0,l.combineLatest)([new l.Observable(e=>{this._commandService.onCommandExecuted(t=>{t.id===R.id&&e.next(!0),t.id===M.id&&e.next(!1)})}),this._selectionManagerService.selectionMoveEnd$.pipe((0,u.map)(e=>e?e.map(e=>e.range):[]))]);this.disposeWithMe((0,t.toDisposable)(e.pipe((0,u.switchMap)(([e,n])=>new l.Observable(r=>{let i=new t.DisposableCollection;return e&&n.length&&r.next({selectionRanges:n,disposableCollection:i}),()=>{i.dispose()}})),(0,u.tap)(()=>{this._previewPattern=null})).subscribe(({disposableCollection:e,selectionRanges:n})=>{var i;let a=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET);this.openPanel(),e.add(this._sheetInterceptorService.intercept(c.INTERCEPTOR_POINT.CELL_CONTENT,{priority:99,effect:t.InterceptorEffectEnum.Value|t.InterceptorEffectEnum.Style,handler:(e,i,a)=>{let{row:o,col:s}=i,c=a(e)||{};if(n.find(e=>e.startColumn<=s&&e.endColumn>=s&&e.startRow<=o&&e.endRow>=o)){let e=i.worksheet.getCellRaw(o,s),n=e==null?void 0:e.v,a=e==null?void 0:e.t;if(n==null||a!==t.CellValueType.NUMBER||this._previewPattern===null)return c;let u=(0,r.getPatternPreviewIgnoreGeneral)(this._previewPattern,n,this._sheetsNumfmtCellContentController.locale);if(u.color){var l;let e=(l=this._themeService.getColorFromTheme(`${u.color}.500`))==null?u.color:l;return{...c,v:u.result,t:t.CellValueType.STRING,s:{cl:{rgb:e}}}}return{...c,v:u.result,t:t.CellValueType.STRING}}return c}})),(i=this._renderManagerService.getRenderById(a.getUnitId()))==null||(i=i.mainComponent)==null||i.makeDirty()})))}_commandExecutedListener(){let e=[c.RemoveNumfmtMutation.id,c.SetNumfmtMutation.id];this.disposeWithMe(new l.Observable(t=>{let n=this._commandService.onCommandExecuted(n=>{if(e.includes(n.id)){let e=n.params;t.next(e.unitId)}});return()=>n.dispose()}).pipe((0,u.debounceTime)(16)).subscribe(e=>this._forceUpdate(e)))}_initCloseListener(){this._univerInstanceService.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET).subscribe(e=>{if(!e){var t;(t=this._sidebarDisposable)==null||t.dispose(),this._sidebarDisposable=null}})}};L=I([F(0,(0,t.Inject)(c.SheetInterceptorService)),F(1,(0,t.Inject)(t.ThemeService)),F(2,t.IUniverInstanceService),F(3,t.ICommandService),F(4,(0,t.Inject)(c.SheetsSelectionsService)),F(5,n.IRenderManagerService),F(6,c.INumfmtService),F(7,(0,t.Inject)(o.ComponentManager)),F(8,o.ISidebarService),F(9,(0,t.Inject)(t.LocaleService)),F(10,(0,t.Inject)(r.SheetsNumfmtCellContentController))],L);let R={id:`sheet.operation.open.numfmt.panel`,type:t.CommandType.OPERATION,handler:e=>(e.get(L).openPanel(),!0)},z=e=>[{label:`sheets-numfmt-ui.general`,pattern:null},{label:`sheets-numfmt-ui.text`,pattern:t.DEFAULT_TEXT_FORMAT_EXCEL},`|`,{label:`sheets-numfmt-ui.number`,pattern:`0`},{label:`sheets-numfmt-ui.percent`,pattern:`0.00%`},{label:`sheets-numfmt-ui.scientific`,pattern:`0.00E+00`},`|`,{label:`sheets-numfmt-ui.accounting`,pattern:`"${e}" #,##0.00_);[Red]("${e}"#,##0.00)`},{label:`sheets-numfmt-ui.financialValue`,pattern:`#,##0.00;[Red]#,##0.00`},{label:`sheets-numfmt-ui.currency`,pattern:`"${e}"#,##0.00_);[Red]("${e}"#,##0.00)`},{label:`sheets-numfmt-ui.roundingCurrency`,pattern:`"${e}"#,##0;[Red]"${e}"#,##0`},`|`,{label:`sheets-numfmt-ui.date`,pattern:`yyyy-mm-dd;@`},{label:`sheets-numfmt-ui.time`,pattern:`am/pm h":"mm":"ss`},{label:`sheets-numfmt-ui.dateTime`,pattern:`yyyy-m-d am/pm h:mm`},{label:`sheets-numfmt-ui.timeDuration`,pattern:`h:mm:ss`},`|`,{label:`sheets-numfmt-ui.moreFmt`,pattern:``}];function se(e){return{icon:new l.Observable(n=>{let i=e.get(t.LocaleService);return n.next((0,r.getCurrencySymbolIconByLocale)(i.getCurrentLocale()).icon),i.localeChanged$.subscribe(()=>{n.next((0,r.getCurrencySymbolIconByLocale)(i.getCurrentLocale()).icon)})}),id:r.SetCurrencyCommand.id,title:`sheets-numfmt-ui.currency`,tooltip:`sheets-numfmt-ui.currency`,type:o.MenuItemType.BUTTON,hidden$:(0,o.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,i.getCurrentRangeDisable$)(e,{workbookTypes:[c.WorkbookEditablePermission],worksheetTypes:[c.WorksheetEditPermission,c.WorksheetSetCellStylePermission],rangeTypes:[c.RangeProtectionPermissionEditPoint]})}}function ce(e){return{icon:`AddDigitsIcon`,id:r.AddDecimalCommand.id,title:`sheets-numfmt-ui.addDecimal`,tooltip:`sheets-numfmt-ui.addDecimal`,type:o.MenuItemType.BUTTON,hidden$:(0,o.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,i.getCurrentRangeDisable$)(e,{workbookTypes:[c.WorkbookEditablePermission],worksheetTypes:[c.WorksheetEditPermission,c.WorksheetSetCellStylePermission],rangeTypes:[c.RangeProtectionPermissionEditPoint]})}}function le(e){return{icon:`ReduceDigitsIcon`,id:r.SubtractDecimalCommand.id,title:`sheets-numfmt-ui.subtractDecimal`,tooltip:`sheets-numfmt-ui.subtractDecimal`,type:o.MenuItemType.BUTTON,hidden$:(0,o.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,i.getCurrentRangeDisable$)(e,{workbookTypes:[c.WorkbookEditablePermission],worksheetTypes:[c.WorksheetEditPermission,c.WorksheetSetCellStylePermission],rangeTypes:[c.RangeProtectionPermissionEditPoint]})}}function ue(e){return{icon:`PercentIcon`,id:r.SetPercentCommand.id,title:`sheets-numfmt-ui.percent`,tooltip:`sheets-numfmt-ui.percent`,type:o.MenuItemType.BUTTON,hidden$:(0,o.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,i.getCurrentRangeDisable$)(e,{workbookTypes:[c.WorkbookEditablePermission],worksheetTypes:[c.WorksheetEditPermission,c.WorksheetSetCellStylePermission],rangeTypes:[c.RangeProtectionPermissionEditPoint]})}}function de(e){let n=e.get(t.IUniverInstanceService),a=e.get(t.ICommandService),s=e.get(t.LocaleService),u=e.get(c.SheetsSelectionsService),d=[c.RemoveNumfmtMutation.id,c.SetNumfmtMutation.id],f=(0,i.deriveStateFromActiveSheet$)(n,``,({workbook:e,worksheet:n})=>new l.Observable(i=>(0,l.merge)(u.selectionMoveEnd$,(0,t.fromCallback)(a.onCommandExecuted.bind(a)).pipe((0,l.filter)(([e])=>d.includes(e.id)))).subscribe(()=>{let a=u.getCurrentSelections();if(a&&a[0]){var o,c;let l=a[0].range,u=l.startRow,d=l.startColumn,f=(o=e.getStyles().get((c=n.getCell(u,d))==null?void 0:c.s))==null?void 0:o.n,p=f==null?void 0:f.pattern,m=(0,r.getCurrencySymbolByLocale)(s.getCurrentLocale()),h=s.t(`sheets-numfmt-ui.general`);if((0,t.isDefaultFormat)(p)){i.next(h);return}if(p){let e=z(m).filter(e=>typeof e==`object`&&e.pattern).find(e=>(0,t.isPatternEqualWithoutDecimal)(p,e.pattern));h=e&&typeof e==`object`&&e.pattern?s.t(e.label):s.t(`sheets-numfmt-ui.moreFmt`)}i.next(h)}})));return{label:B,id:R.id,tooltip:`sheets-numfmt-ui.title`,type:o.MenuItemType.SELECTOR,slot:!0,selections:[{label:{name:V,hoverable:!1,selectable:!1}}],value$:f,hidden$:(0,o.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,i.getCurrentRangeDisable$)(e,{workbookTypes:[c.WorkbookEditablePermission],worksheetTypes:[c.WorksheetSetCellStylePermission,c.WorksheetEditPermission],rangeTypes:[c.RangeProtectionPermissionEditPoint]})}}let B=`sheets-numfmt-ui.moreNumfmtType`,V=`sheets-numfmt-ui.moreNumfmtType.options`;function fe(e){let{value:n}=e,r=(0,o.useDependency)(t.LocaleService);return(0,d.jsx)(`span`,{className:`univer-text-sm`,children:n==null?r.t(`sheets-numfmt-ui.general`):n})}function pe(){let e=(0,o.useDependency)(t.ICommandService),n=(0,o.useDependency)(t.LocaleService),i=(0,o.useDependency)(o.ILayoutService),l=(0,o.useDependency)(r.SheetsNumfmtCellContentController),u=(0,o.useDependency)(c.SheetsSelectionsService),f=n=>{let a=u.getCurrentLastSelection();if(!a)return;let o=a.range,s=[];t.Range.foreach(o,(e,t)=>{n?s.push({row:e,col:t,pattern:n,type:(0,r.getPatternType)(n)}):s.push({row:e,col:t})}),e.executeCommand(r.SetNumfmtCommand.id,{values:s}),i.focus()},p=(0,a.useMemo)(()=>z(r.localeCurrencySymbolMap.get(n.getCurrentLocale())),[n]),m=t=>{if(t===0)f(null);else if(t===p.length-1)e.executeCommand(R.id),i.focus();else{let e=p[t];e.pattern&&f(e.pattern)}};return(0,d.jsx)(`div`,{className:`univer-grid univer-gap-1 univer-p-1.5`,children:p.map((e,t)=>e===`|`?(0,d.jsx)(s.Separator,{},t):(0,d.jsxs)(`div`,{className:`univer-flex univer-h-7 univer-cursor-default univer-items-center univer-justify-between univer-gap-6 univer-rounded univer-px-2 univer-text-sm hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700`,onClick:()=>m(t),children:[(0,d.jsx)(`span`,{children:n.t(e.label)}),(0,d.jsx)(`span`,{className:`univer-text-xs univer-text-gray-500 dark:!univer-text-gray-400`,children:e.pattern?(0,r.getPatternPreview)(e.pattern||``,1220,l.locale).result.trim():``})]},t))})}let H=(0,a.createContext)([]),U=class{constructor(e){this._localStorageService=e}_getKey(e){return`userHabitController_${e}`}async addHabit(e,t){let n=this._getKey(e);return this._localStorageService.getItem(n).then(e=>{e||this._localStorageService.setItem(n,t)})}markHabit(e,t){let n=this._getKey(e);this._localStorageService.getItem(n).then(e=>{if(e){let r=e.findIndex(e=>e===t);r>-1&&e.splice(r,1),e.unshift(t),this._localStorageService.setItem(n,e)}})}async getHabit(e,t){let n=this._getKey(e),r=await this._localStorageService.getItem(n);if(t&&r){let e=r.map((e,t,n)=>({value:e,priority:n.length-t}));return t.sort((t,n)=>{var r,i;let a=((r=e.find(e=>e.value===t))==null?void 0:r.priority)||-1;return(((i=e.find(e=>e.value===n))==null?void 0:i.priority)||-1)-a})}return r||[]}deleteHabit(e){this._localStorageService.removeItem(e)}};U=I([F(0,(0,t.Inject)(t.ILocalStorageService))],U);let me=e=>!!(0,r.getCurrencyType)(e)&&e.startsWith(`_(`);function he(e){let{defaultPattern:n,onActionChange:i,onChange:c}=e,[l,u]=(0,a.useState)(()=>(0,r.getDecimalFromPattern)(n||``,2)),f=(0,a.useContext)(H),[p,m]=(0,a.useState)(()=>(0,r.getCurrencyType)(n)||f[0]),h=(0,a.useMemo)(()=>f.map(e=>({label:e,value:e})),[]),g=(0,o.useDependency)(t.LocaleService);return(0,a.useLayoutEffect)(()=>{i(()=>(0,r.setPatternDecimal)(`_("${p}"* #,##0${l>0?`.0`:``}_)`,l))},[l,i,p]),(0,d.jsxs)(`div`,{children:[(0,d.jsxs)(`div`,{className:`univer-mt-4 univer-flex univer-justify-between`,children:[(0,d.jsxs)(`div`,{className:`option`,children:[(0,d.jsx)(`div`,{className:`univer-text-sm univer-text-gray-400`,children:g.t(`sheets-numfmt-ui.decimalLength`)}),(0,d.jsx)(`div`,{className:`univer-mt-2 univer-w-32`,children:(0,d.jsx)(s.InputNumber,{value:l,step:1,precision:0,max:20,min:0,onChange:e=>{let t=e||0;u(t),c((0,r.setPatternDecimal)(`_("${p}"* #,##0${t>0?`.0`:``}_)`,t))}})})]}),(0,d.jsxs)(`div`,{className:`option`,children:[(0,d.jsx)(`div`,{className:`univer-text-sm univer-text-gray-400`,children:g.t(`sheets-numfmt-ui.currencyType`)}),(0,d.jsx)(`div`,{className:`univer-mt-2 univer-w-36`,children:(0,d.jsx)(s.Select,{options:h,value:p,onChange:e=>{m(e),c((0,r.setPatternDecimal)(`_("${e}"* #,##0${l>0?`.0`:``}_)`,l))}})})]})]}),(0,d.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-400`,children:g.t(`sheets-numfmt-ui.accountingDes`)})]})}let ge=e=>!!(0,r.getCurrencyType)(e)&&!e.startsWith(`_(`);function _e(e){let{onActionChange:n,onChange:i}=e,c=(0,o.useDependency)(t.LocaleService),l=(0,a.useContext)(H),[u,f]=(0,a.useState)(()=>(0,r.getCurrencyType)(e.defaultPattern)||l[0]),[p,m]=(0,a.useState)(()=>(0,r.getDecimalFromPattern)(e.defaultPattern||``,2)),[h,g]=(0,a.useState)(()=>{var n;let i=(0,r.getCurrencyFormatOptions)(u);return((n=i.find(n=>(0,t.isPatternEqualWithoutDecimal)(n.value,e.defaultPattern)))==null?void 0:n.value)||i[0].value}),_=(0,a.useMemo)(()=>(0,r.getCurrencyFormatOptions)(u),[u]),v=(0,a.useMemo)(()=>l.map(e=>({label:e,value:e})),[l]);return(0,a.useLayoutEffect)(()=>{n(()=>(0,r.setPatternDecimal)(h,p))},[p,n,h]),(0,d.jsxs)(`div`,{children:[(0,d.jsxs)(`div`,{className:`univer-mt-4 univer-flex univer-justify-between`,children:[(0,d.jsxs)(`div`,{className:`option`,children:[(0,d.jsx)(`div`,{className:`univer-text-sm univer-text-gray-400`,children:c.t(`sheets-numfmt-ui.decimalLength`)}),(0,d.jsx)(`div`,{className:`univer-mt-2 univer-w-32`,children:(0,d.jsx)(s.InputNumber,{value:p,max:20,min:0,onChange:e=>{m(e||0),i((0,r.setPatternDecimal)(h,e||0))}})})]}),(0,d.jsxs)(`div`,{className:`option`,children:[(0,d.jsx)(`div`,{className:`univer-text-sm univer-text-gray-400`,children:c.t(`sheets-numfmt-ui.currencyType`)}),(0,d.jsx)(`div`,{className:`univer-mt-2 univer-w-36`,children:(0,d.jsx)(s.Select,{value:u,options:v,onChange:e=>{if(e===void 0)return;f(e);let t=(0,r.getCurrencyFormatOptions)(e)[0].value;g(t),i((0,r.setPatternDecimal)(t,p))}})})]})]}),(0,d.jsx)(`div`,{className:`label univer-mt-4`,children:c.t(`sheets-numfmt-ui.negType`)}),(0,d.jsx)(`div`,{className:`univer-mt-2`,children:(0,d.jsx)(s.SelectList,{value:h,options:_,onChange:e=>{e!==void 0&&(g(e),i((0,r.setPatternDecimal)(e,p)))}})}),(0,d.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-400`,children:c.t(`sheets-numfmt-ui.currencyDes`)})]})}let W=`customFormat`,G=`numfmt_custom_pattern`;function ve(e){let{defaultPattern:n,onActionChange:i,onChange:c}=e,l=(0,o.useDependency)(U),u=(0,o.useDependency)(t.ILocalStorageService),f=(0,o.useDependency)(t.LocaleService),[p,m]=(0,a.useState)(n);(0,a.useLayoutEffect)(()=>{i(()=>(l.markHabit(W,p),u.getItem(G).then((e=[])=>{let t=[...new Set([p,...e||[]])].splice(0,10).filter(e=>!!e);u.setItem(G,t)}),p))},[u,i,p,l]);let[h,g]=(0,a.useState)([]);(0,a.useEffect)(()=>{u.getItem(G).then(e=>{let t=[...r.CURRENCYFORMAT.map(e=>e.suffix(`$`)),...r.DATEFMTLISG.map(e=>e.suffix),...r.NUMBERFORMAT.map(e=>e.suffix)];t.push(...e||[]),l.addHabit(W,[]).finally(()=>{l.getHabit(W,t).then(e=>{g([...new Set(e)])})})})},[]);let _=e=>{m(e),c(e)};return(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-400`,children:f.t(`sheets-numfmt-ui.customFormat`)}),(0,d.jsx)(s.Input,{placeholder:f.t(`sheets-numfmt-ui.customFormat`),onBlur:()=>{c(p)},value:p,onChange:m,className:`univer-mt-2 univer-w-full`}),(0,d.jsx)(`div`,{className:(0,s.clsx)(`univer-mt-2 univer-max-h-[400px] univer-overflow-auto univer-rounded-lg univer-p-2`,s.borderClassName),children:h.map(e=>(0,d.jsxs)(`div`,{onClick:()=>_(e),className:`univer-flex univer-cursor-pointer univer-items-center univer-gap-1.5 univer-py-1.5 univer-text-sm`,children:[(0,d.jsx)(`div`,{className:`univer-flex univer-w-4 univer-items-center univer-text-primary-600`,children:p===e&&(0,d.jsx)(w,{})}),(0,d.jsx)(`div`,{children:e})]},e))}),(0,d.jsx)(`div`,{className:`univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:f.t(`sheets-numfmt-ui.customFormatDes`)})]})}let ye=e=>{let n=t.numfmt.getFormatInfo(e);return(0,r.getDateFormatOptions)().map(e=>e.value).includes(e)||[`date`,`datetime`,`time`].includes(n.type)};function be(e){let{onActionChange:n,onChange:i,defaultPattern:c}=e,l=(0,a.useMemo)(r.getDateFormatOptions,[]),u=(0,o.useDependency)(t.LocaleService),[f,p]=(0,a.useState)(()=>{if(c){let e=l.find(e=>e.value===c);if(e)return e.value}return l[0].value});return(0,a.useLayoutEffect)(()=>{n(()=>f)},[n,f]),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-400`,children:u.t(`sheets-numfmt-ui.dateType`)}),(0,d.jsx)(`div`,{className:`univer-mt-2`,children:(0,d.jsx)(s.SelectList,{value:f,options:l,onChange:e=>{e!==void 0&&(p(e),i(e))}})}),(0,d.jsx)(`div`,{className:`univer-mt-3.5 univer-text-sm/5 univer-text-gray-600 dark:!univer-text-gray-200`,children:u.t(`sheets-numfmt-ui.dateDes`)})]})}let xe=e=>!e;function Se(e){let n=(0,o.useDependency)(t.LocaleService),{onActionChange:r}=e;return(0,a.useLayoutEffect)(()=>{r(()=>``)},[r]),(0,d.jsx)(`div`,{children:(0,d.jsx)(`div`,{className:`univer-mt-3.5 univer-text-sm/5 univer-text-gray-600 dark:!univer-text-gray-200`,children:n.t(`sheets-numfmt-ui.generalDes`)})})}let Ce=e=>(0,r.getNumberFormatOptions)().some(n=>(0,t.isPatternEqualWithoutDecimal)(n.value,e));function we(e){let{onActionChange:n,onChange:i}=e,c=(0,o.useDependency)(t.LocaleService),l=(0,a.useMemo)(r.getNumberFormatOptions,[]),[u,f]=(0,a.useState)(()=>(0,r.getDecimalFromPattern)(e.defaultPattern||``,0)),[p,m]=(0,a.useState)(()=>{let n=l.find(n=>(0,t.isPatternEqualWithoutDecimal)(n.value,e.defaultPattern||``));return(n==null?void 0:n.value)||l[0].value}),h=(0,a.useMemo)(()=>(0,r.setPatternDecimal)(p,Number(u||0)),[p,u]),g=(0,a.useMemo)(()=>!(0,r.isPatternHasDecimal)(p),[p]);return(0,a.useLayoutEffect)(()=>{n(()=>h)},[n,h]),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-400`,children:c.t(`sheets-numfmt-ui.decimalLength`)}),(0,d.jsx)(`div`,{className:`univer-mt-2`,children:(0,d.jsx)(s.InputNumber,{disabled:g,value:u,max:20,min:0,onChange:e=>{f(e||0),i((0,r.setPatternDecimal)(p,Number(e||0)))}})}),(0,d.jsxs)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-400`,children:[` `,c.t(`sheets-numfmt-ui.negType`)]}),(0,d.jsx)(`div`,{className:`univer-mt-2`,children:(0,d.jsx)(s.SelectList,{onChange:e=>{e!==void 0&&(f((0,r.getDecimalFromPattern)(e,0)),m(e),i(e))},options:l,value:p})}),(0,d.jsx)(`div`,{className:`univer-mt-3.5 univer-text-sm/5 univer-text-gray-600 dark:!univer-text-gray-200`,children:c.t(`sheets-numfmt-ui.thousandthPercentileDes`)})]})}let K=`numfmtCurrency`,Te=e=>{let n=(0,o.useDependency)(U),[r,i]=(0,a.useState)(t.currencySymbols);return(0,a.useEffect)(()=>{n.addHabit(`numfmtCurrency`,[]).then(()=>{n.getHabit(K,[...t.currencySymbols]).then(t=>{i(t),e&&e(t)})})},[]),{userHabitCurrency:r,mark:e=>{n.markHabit(K,e)}}},Ee=()=>{let e=(0,a.useRef)([]),[t,n]=(0,a.useState)({});return(0,a.useEffect)(()=>{e.current.forEach(e=>{e()}),e.current=[]},[t]),t=>{e.current.push(t),n({})}};function De(e){let{defaultValue:n,defaultPattern:i,row:c,col:l}=e.value,u=(0,o.useDependency)(t.LocaleService),f=(0,a.useRef)(()=>``),p=Ee(),m=(0,a.useMemo)(()=>[{label:`sheets-numfmt-ui.general`,component:Se},{label:`sheets-numfmt-ui.accounting`,component:he},{label:`sheets-numfmt-ui.currency`,component:_e},{label:`sheets-numfmt-ui.date`,component:be},{label:`sheets-numfmt-ui.thousandthPercentile`,component:we},{label:`sheets-numfmt-ui.customFormat`,component:ve}].map(e=>({...e,label:u.t(e.label)})),[u]),[h,g]=(0,a.useState)(S),[_,v]=(0,a.useState)(()=>`${c}_${l}_${i}`),{mark:y,userHabitCurrency:b}=Te(()=>v(`${c}_${l}_${i}_userCurrency`)),x=(0,a.useMemo)(()=>{var e;return(e=m.find(e=>e.label===h))==null?void 0:e.component},[h]);function S(){return[xe,me,ge,ye,Ce].reduce((e,t,n)=>e||(t(i)?m[n].label:``),``)||m[0].label}let C=m.map(e=>({label:e.label,value:e.label})),w=t=>{g(t),p(()=>e.onChange({type:`change`,value:f.current()||``}))},ee=(0,a.useCallback)(t=>{e.onChange({type:`change`,value:t})},[]),T=(0,a.useCallback)(e=>{f.current=e},[]),te=()=>{let t=f.current()||``,n=(0,r.getCurrencyType)(t);n&&y(n),e.onChange({type:`confirm`,value:t})},E=()=>{e.onChange({type:`cancel`,value:``})},D={onChange:ee,onActionChange:T,defaultValue:n,defaultPattern:i};return(0,a.useEffect)(()=>{g(S()),v(`${c}_${l}_${i}`)},[c,l,i]),(0,d.jsxs)(`div`,{className:(0,s.clsx)(`univer-flex univer-h-full univer-flex-col univer-justify-between univer-overflow-y-auto univer-pb-5`,s.scrollbarClassName),children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`univer-mt-3.5 univer-text-sm univer-text-gray-400`,children:u.t(`sheets-numfmt-ui.numfmtType`)}),(0,d.jsx)(`div`,{className:`univer-mt-2`,children:(0,d.jsx)(s.Select,{className:`univer-w-full`,value:h,options:C,onChange:w})}),(0,d.jsx)(`div`,{children:x&&(0,d.jsx)(H.Provider,{value:b,children:(0,a.createElement)(x,{...D,key:_})})})]}),(0,d.jsxs)(`div`,{className:`univer-mb-5 univer-mt-3.5 univer-flex univer-justify-end`,children:[(0,d.jsx)(s.Button,{onClick:E,className:`univer-mr-3`,children:u.t(`sheets-numfmt-ui.cancel`)}),(0,d.jsx)(s.Button,{variant:`primary`,onClick:te,children:u.t(`sheets-numfmt-ui.confirm`)})]})]})}let q=class extends t.Disposable{constructor(e,t){super(),this._componentManager=e,this._iconManager=t,this._registerComponents(),this._registerIcons()}_registerIcons(){this.disposeWithMe(this._iconManager.register({AddDigitsIcon:S,DollarIcon:T,EuroIcon:E,PercentIcon:O,ReduceDigitsIcon:k,RmbIcon:A,RoubleIcon:j}))}_registerComponents(){this.disposeWithMe(this._componentManager.register(`SHEET_NUMFMT_PANEL`,De)),[[B,fe],[V,pe]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))})}};q=I([F(0,(0,t.Inject)(o.ComponentManager)),F(1,(0,t.Inject)(o.IconManager))],q);let J=`SHEET_NUMFMT_ALERT`,Y=class extends t.Disposable{constructor(e,t,n,r,i,a){super(),this._context=e,this._hoverManagerService=t,this._cellAlertManagerService=n,this._localeService=r,this._numfmtService=i,this._configService=a,this._init()}_init(){this._initCellAlertPopup()}_initCellAlertPopup(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe((0,l.debounceTime)(100)).subscribe(e=>{if(e){let o=e.location,s=this._context.unit,c=s.getActiveSheet();if(!c)return this._hideAlert();let l=o.unitId,u=o.subUnitId,d,f=c.getCell(o.row,o.col);if(f!=null&&f.s){let e=s.getStyles().get(f.s);e!=null&&e.n&&(d=e.n)}if(d||(d=this._numfmtService.getValue(l,u,o.row,o.col)),!d){this._hideAlert();return}if((0,t.isTextFormat)(d.pattern)&&t.Tools.isDefine(f==null?void 0:f.v)&&(0,t.isRealNum)(f.v)){var n,a;if((n=this._configService.getConfig(r.SHEETS_NUMFMT_PLUGIN_CONFIG_KEY))!=null&&n.disableTextFormatAlert)return;let e=this._cellAlertManagerService.currentAlert.get(J),t=e==null||(a=e.alert)==null?void 0:a.location;if(t&&t.row===o.row&&t.col===o.col&&t.subUnitId===o.subUnitId&&t.unitId===o.unitId){this._hideAlert();return}this._cellAlertManagerService.showAlert({type:i.CellAlertType.ERROR,title:this._localeService.t(`sheets-numfmt-ui.info.error`),message:this._localeService.t(`sheets-numfmt-ui.info.forceStringInfo`),location:o,width:200,height:74,key:J});return}}this._hideAlert()}))}_hideAlert(){this._cellAlertManagerService.removeAlert(J)}};Y=I([F(1,(0,t.Inject)(i.HoverManagerService)),F(2,(0,t.Inject)(i.CellAlertManagerService)),F(3,(0,t.Inject)(t.LocaleService)),F(4,(0,t.Inject)(c.INumfmtService)),F(5,t.IConfigService)],Y);let X=class extends t.Disposable{constructor(e){super(),this._repeatLastActionService=e,this._initCommandRecording()}_initCommandRecording(){this._repeatLastActionService&&this.disposeWithMe(this._repeatLastActionService.registerRepeatableCommand(r.SetNumfmtCommand.id,(e,t)=>{if(!t)return;let{values:n}=t,r=n.find(e=>e.pattern);if(!r)return;let{pattern:i,type:a}=r,o=[],s=new Set;for(let t of e){let{startRow:e,startColumn:n,endRow:r,endColumn:c}=t;for(let t=e;t<=r;t++)for(let e=n;e<=c;e++){let n=`${t}-${e}`;s.has(n)||(s.add(n),o.push({row:t,col:e,pattern:i,type:a}))}}return{...t,values:o}},i.RepeatLastActionPermission.CellStyle))}};X=I([F(0,(0,t.Optional)(i.IRepeatLastActionService))],X);let Oe=()=>{let e=[];return{add:(t,n,r,i,a)=>e.push({unitId:t,subUnitId:n,row:r,col:i,value:a}),getEffects:()=>e,clean:()=>{e=[]}}},Z=class extends t.Disposable{constructor(e,t,n,r,i){super(),this._sheetInterceptorService=e,this._numfmtService=t,this._univerInstanceService=n,this._injector=r,this._editorBridgeService=i,P(this,`_collectEffectMutation`,Oe()),this._initInterceptorEditorStart(),this._initInterceptorEditorEnd(),this._initInterceptorCommands()}_initInterceptorEditorStart(){this._editorBridgeService&&this.disposeWithMe((0,t.toDisposable)(this._sheetInterceptorService.writeCellInterceptor.intercept(c.BEFORE_CELL_EDIT,{handler:(e,n,i)=>{let a=n.row,o=n.col,s=this._numfmtService.getValue(n.unitId,n.subUnitId,a,o);if(s)switch((0,r.getPatternType)(s.pattern)){case`scientific`:case`currency`:case`grouped`:case`number`:{let e={...n.worksheet.getCellRaw(a,o)};return(e==null?void 0:e.t)===t.CellValueType.NUMBER&&(0,t.isRealNum)(e.v)&&(e.v=(0,f.stripErrorMargin)(Number(e.v))),i&&i(e)}case`percent`:{let e={...n.worksheet.getCellRaw(a,o)};return(e==null?void 0:e.t)===t.CellValueType.NUMBER&&(0,t.isRealNum)(e.v)&&(e.v=`${(0,f.stripErrorMargin)(Number(e.v)*100)}%`),i&&i(e)}default:return i&&i(e)}return i(e)}})))}_initInterceptorEditorEnd(){this.disposeWithMe((0,t.toDisposable)(this._sheetInterceptorService.writeCellInterceptor.intercept(c.AFTER_CELL_EDIT,{handler:(e,n,i)=>{var a,o;if(!(e!=null&&e.v)&&!(e!=null&&e.p))return i(e);this._collectEffectMutation.clean();let s=this._numfmtService.getValue(n.unitId,n.subUnitId,n.row,n.col),c=n.worksheet.getCellRaw(n.row,n.col);if((0,t.isTextFormat)(s==null?void 0:s.pattern)||e.t===t.CellValueType.FORCE_STRING)return i(e);let l=(a=e.p)==null?void 0:a.body,u=!(e==null||(o=e.p)==null||(o=o.body)==null)&&o.dataStream?e.p.body.dataStream.replace(/\r\n$/,``):String(e.v),d=(0,t.getNumfmtParseValueFilter)(u);if(l)if(ke(l)){let{dataStream:t}=l,n=t.replace(/\r\n$/,``),r=Number(n);if(Number.isNaN(r)&&!d)return i(e)}else return i(e);if(d){if(!d.z&&!(s!=null&&s.pattern)&&(c==null?void 0:c.t)!==t.CellValueType.STRING&&(c==null?void 0:c.t)!==t.CellValueType.FORCE_STRING&&(0,t.willLoseNumericPrecision)(u))return i({...e,p:void 0,v:u,t:t.CellValueType.FORCE_STRING});d.z&&(!(s!=null&&s.pattern)||(0,r.getPatternType)(d.z)!==(0,r.getPatternType)(s.pattern))&&this._collectEffectMutation.add(n.unitId,n.subUnitId,n.row,n.col,{pattern:d.z});let a=(0,f.stripErrorMargin)(Number(d.v),16);return i({...e,p:void 0,v:a,t:t.CellValueType.NUMBER})}return i(e)}})))}_initInterceptorCommands(){let e=this;this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations(n){switch(n.id){case c.SetRangeValuesCommand.id:{var r;let n=e._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),i=n.getUnitId(),a=(r=n.getActiveSheet())==null?void 0:r.getSheetId();if(!a)return{redos:[],undos:[]};let o=e._collectEffectMutation.getEffects();if(e._collectEffectMutation.clean(),!o.length)return{redos:[],undos:[]};let s=o.filter(e=>{var t;return!!((t=e.value)!=null&&t.pattern)}).map(e=>({row:e.row,col:e.col,pattern:e.value.pattern})),l=o.filter(e=>{var t;return!((t=e.value)!=null&&t.pattern)}).map(e=>({startRow:e.row,endColumn:e.col,startColumn:e.col,endRow:e.row})),u=[],d=[];if(s.length){let t={id:c.SetNumfmtMutation.id,params:(0,c.transformCellsToRange)(i,a,s)};u.push(t),d.push(...(0,c.factorySetNumfmtUndoMutation)(e._injector,t.params))}if(l.length){let t={id:c.RemoveNumfmtMutation.id,params:{unitId:i,subUnitId:a,ranges:l}};u.push(t),d.push(...(0,c.factoryRemoveNumfmtUndoMutation)(e._injector,t.params))}return{redos:u,undos:d.reverse()}}}return{redos:[],undos:[]}}}))}dispose(){super.dispose(),this._collectEffectMutation.clean()}};Z=I([F(0,(0,t.Inject)(c.SheetInterceptorService)),F(1,(0,t.Inject)(c.INumfmtService)),F(2,(0,t.Inject)(t.IUniverInstanceService)),F(3,(0,t.Inject)(t.Injector)),F(4,(0,t.Optional)(i.IEditorBridgeService))],Z);function ke(e){let{textRuns:t=[],paragraphs:n=[],customRanges:r,customBlocks:i=[]}=e,a=[`va`];return!(t.some(e=>!!(e.ts&&Object.keys(e.ts).some(e=>a.includes(e))))||n.some(e=>e.bullet)||n.length>=2||r!=null&&r.length||i.length>0)}let Ae={[o.RibbonStartGroup.LAYOUT]:{[R.id]:{order:9,menuItemFactory:de},[r.SetPercentCommand.id]:{order:9.1,menuItemFactory:ue},[r.SetCurrencyCommand.id]:{order:9.2,menuItemFactory:se},[r.AddDecimalCommand.id]:{order:9.3,menuItemFactory:ce},[r.SubtractDecimalCommand.id]:{order:9.4,menuItemFactory:le}}},Q=class extends t.Disposable{constructor(e,t){super(),this._componentManager=e,this._menuManagerService=t,this._initMenu()}_initMenu(){this._menuManagerService.mergeMenu(Ae)}};Q=I([F(0,(0,t.Inject)(o.ComponentManager)),F(1,o.IMenuManagerService)],Q);let $=class extends t.Plugin{constructor(e=h,n,r,i){super(),this._config=e,this._injector=n,this._configService=r,this._renderManagerService=i;let{menu:a,...o}=(0,t.merge)({},h,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(`sheets-numfmt-ui.config`,o)}onStarting(){this._injector.add([q]),this._injector.get(q),(0,t.registerDependencies)(this._injector,[[L],[Z],[U],[Q],[X]])}onRendered(){this._registerRenderModules(),(0,t.touchDependencies)(this._injector,[[L],[Z],[Q],[X]])}_registerRenderModules(){[[Y]].forEach(e=>{this.disposeWithMe(this._renderManagerService.registerRenderModule(t.UniverInstanceType.UNIVER_SHEET,e))})}};P($,`pluginName`,`SHEET_NUMFMT_UI_PLUGIN`),P($,`packageName`,p),P($,`version`,m),P($,`type`,t.UniverInstanceType.UNIVER_SHEET),$=I([(0,t.DependentOn)(i.UniverSheetsUIPlugin,r.UniverSheetsNumfmtPlugin),F(1,(0,t.Inject)(t.Injector)),F(2,t.IConfigService),F(3,n.IRenderManagerService)],$),Object.defineProperty(e,"UniverSheetsNumfmtUIPlugin",{enumerable:!0,get:function(){return $}})});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("@univerjs/engine-render"),require("@univerjs/sheets-numfmt"),require("@univerjs/sheets-ui"),require("react"),require("@univerjs/ui"),require("@univerjs/design"),require("@univerjs/sheets"),require("rxjs"),require("rxjs/operators"),require("react/jsx-runtime"),require("@univerjs/engine-formula")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/engine-render`,`@univerjs/sheets-numfmt`,`@univerjs/sheets-ui`,`react`,`@univerjs/ui`,`@univerjs/design`,`@univerjs/sheets`,`rxjs`,`rxjs/operators`,`react/jsx-runtime`,`@univerjs/engine-formula`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsNumfmtUi={},e.UniverCore,e.UniverEngineRender,e.UniverSheetsNumfmt,e.UniverSheetsUi,e.React,e.UniverUi,e.UniverDesign,e.UniverSheets,e.rxjs,e.rxjs.operators,e.React,e.UniverEngineFormula))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var p=`@univerjs/sheets-numfmt-ui`,m=`1.0.0-insiders.20260629-12f2e44`;let h={};function g({ref:e,...t}){let{icon:n,id:r,className:i,extend:o,...s}=t,c=`univerjs-icon univerjs-icon-${r} ${i||``}`.trim(),l=(0,a.useRef)(`_${b()}`);return _(n,`${r}`,{defIds:n.defIds,idSuffix:l.current},{ref:e,className:c,...s},o)}function _(e,t,n,r,i){return(0,a.createElement)(e.tag,{key:t,...v(e,n,i),...r},(y(e,n).children||[]).map((r,a)=>_(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function v(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),n!=null&&n.colorChannel1&&r.stroke===`colorChannel1`&&(r.stroke=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function y(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function b(){return Math.random().toString(36).substring(2,8)}g.displayName=`UniverIcon`;let x={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M4.06641 3.49366C4.06641 2.27555 5.14145 1.3916 6.33307 1.3916C7.52469 1.3916 8.59974 2.27555 8.59974 3.49366V6.49777C8.59974 7.71586 7.52469 8.59982 6.33307 8.59982C5.14145 8.59982 4.06641 7.71586 4.06641 6.49777V3.49366ZM6.33307 2.5916C5.68376 2.5916 5.26641 3.05264 5.26641 3.49366V6.49777C5.26641 6.93878 5.68376 7.39982 6.33307 7.39982C6.98239 7.39982 7.39974 6.93878 7.39974 6.49777V3.49366C7.39974 3.05264 6.98239 2.5916 6.33307 2.5916Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M10.0664 3.49366C10.0664 2.27555 11.1415 1.3916 12.3331 1.3916C13.5247 1.3916 14.5997 2.27555 14.5997 3.49366V6.49777C14.5997 7.71586 13.5247 8.59982 12.3331 8.59982C11.1415 8.59982 10.0664 7.71586 10.0664 6.49777V3.49366ZM12.3331 2.5916C11.6838 2.5916 11.2664 3.05264 11.2664 3.49366V6.49777C11.2664 6.93878 11.6838 7.39982 12.3331 7.39982C12.9824 7.39982 13.3997 6.93878 13.3997 6.49777V3.49366C13.3997 3.05264 12.9824 2.5916 12.3331 2.5916Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M12.4242 9.5417C12.1899 9.30739 11.81 9.30739 11.5756 9.5417C11.3413 9.77602 11.3413 10.1559 11.5756 10.3902L12.5514 11.366H6.3334C6.00203 11.366 5.7334 11.6346 5.7334 11.966C5.7334 12.2973 6.00203 12.566 6.3334 12.566H12.5514L11.5756 13.5417C11.3413 13.776 11.3413 14.1559 11.5756 14.3902C11.81 14.6245 12.1899 14.6245 12.4242 14.3902L14.4159 12.3985C14.5294 12.2893 14.6001 12.1359 14.6001 11.966C14.6001 11.796 14.5294 11.6426 14.4159 11.5334L12.4242 9.5417Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M1.3999 8.3002C1.3999 7.96882 1.66853 7.7002 1.9999 7.7002H2.33324C2.66461 7.7002 2.93324 7.96882 2.93324 8.3002C2.93324 8.63157 2.66461 8.9002 2.33324 8.9002H1.9999C1.66853 8.9002 1.3999 8.63157 1.3999 8.3002Z`}}]},S=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(g,Object.assign({},e,{id:`add-digits-icon`,ref:t,icon:x}))});S.displayName=`AddDigitsIcon`;let C={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},w=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(g,Object.assign({},e,{id:`check-mark-icon`,ref:t,icon:C}))});w.displayName=`CheckMarkIcon`;let ee={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M7.3999 2.8999V1.6C7.3999 1.26863 7.66853 1 7.9999 1C8.33127 1 8.5999 1.26863 8.5999 1.6V2.8999H10.2044C11.6655 2.8999 12.8499 4.08431 12.8499 5.54536C12.8499 5.87673 12.5813 6.14536 12.2499 6.14536C11.9185 6.14536 11.6499 5.87673 11.6499 5.54536C11.6499 4.74705 11.0028 4.0999 10.2044 4.0999H5.7384C4.97155 4.0999 4.3499 4.72155 4.3499 5.4884C4.3499 6.14439 4.80899 6.71087 5.45074 6.84677L10.7977 7.97906C11.994 8.23242 12.8499 9.28849 12.8499 10.5114C12.8499 11.941 11.691 13.0999 10.2614 13.0999H8.5999V14.4C8.5999 14.7314 8.33127 15 7.9999 15C7.66853 15 7.3999 14.7314 7.3999 14.4V13.0999H5.79536C4.33431 13.0999 3.1499 11.9155 3.1499 10.4544C3.1499 10.1231 3.41853 9.85445 3.7499 9.85445C4.08127 9.85445 4.3499 10.1231 4.3499 10.4544C4.3499 11.2527 4.99705 11.8999 5.79536 11.8999H10.2614C11.0283 11.8999 11.6499 11.2782 11.6499 10.5114C11.6499 9.85542 11.1908 9.28893 10.5491 9.15303L5.20214 8.02074C4.00575 7.76739 3.1499 6.71132 3.1499 5.4884C3.1499 4.05881 4.30881 2.8999 5.7384 2.8999H7.3999Z`}}]},T=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(g,Object.assign({},e,{id:`dollar-icon`,ref:t,icon:ee}))});T.displayName=`DollarIcon`;let te={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M5.84964 5.80918C6.71946 3.63548 8.84516 2.2 11.3295 2.2C11.8324 2.2 12.3198 2.26279 12.7846 2.38065C13.1058 2.46209 13.4322 2.26773 13.5137 1.94652C13.5951 1.62532 13.4008 1.2989 13.0795 1.21746C12.5191 1.07535 11.9327 1 11.3295 1C8.17278 1 5.49724 2.96009 4.57394 5.80918H3.06582C2.73445 5.80918 2.46582 6.07781 2.46582 6.40918C2.46582 6.74055 2.73445 7.00918 3.06582 7.00918H4.29808C4.25287 7.33297 4.22949 7.66376 4.22949 8C4.22949 8.33608 4.25284 8.6667 4.29801 8.99033H3.06582C2.73445 8.99033 2.46582 9.25896 2.46582 9.59033C2.46582 9.9217 2.73445 10.1903 3.06582 10.1903H4.57378C5.49693 13.0397 8.1726 15 11.3295 15C11.9336 15 12.5209 14.9244 13.0821 14.7819C13.4033 14.7003 13.5975 14.3738 13.5159 14.0527C13.4344 13.7315 13.1079 13.5373 12.7867 13.6188C12.3213 13.737 11.8332 13.8 11.3295 13.8C8.84497 13.8 6.71914 12.3643 5.84944 10.1903H11.4291C11.7605 10.1903 12.0291 9.9217 12.0291 9.59033C12.0291 9.25896 11.7605 8.99033 11.4291 8.99033H5.51225C5.45783 8.66834 5.42949 8.33748 5.42949 8C5.42949 7.66235 5.45786 7.33133 5.51233 7.00918H11.4291C11.7605 7.00918 12.0291 6.74055 12.0291 6.40918C12.0291 6.07781 11.7605 5.80918 11.4291 5.80918H5.84964Z`}}]},E=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(g,Object.assign({},e,{id:`euro-icon`,ref:t,icon:te}))});E.displayName=`EuroIcon`;let D={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M1.85059 4.06725C1.85059 2.84302 2.84302 1.85059 4.06725 1.85059C5.29148 1.85059 6.28392 2.84302 6.28392 4.06725C6.28392 5.29148 5.29148 6.28392 4.06725 6.28392C2.84302 6.28392 1.85059 5.29148 1.85059 4.06725ZM4.06725 2.95059C3.45053 2.95059 2.95059 3.45053 2.95059 4.06725C2.95059 4.68397 3.45053 5.18392 4.06725 5.18392C4.68397 5.18392 5.18392 4.68397 5.18392 4.06725C5.18392 3.45053 4.68397 2.95059 4.06725 2.95059Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M9.7168 11.933C9.7168 10.7087 10.7092 9.71631 11.9335 9.71631C13.1577 9.71631 14.1501 10.7087 14.1501 11.933C14.1501 13.1572 13.1577 14.1496 11.9335 14.1496C10.7092 14.1496 9.7168 13.1572 9.7168 11.933ZM11.9335 10.8163C11.3167 10.8163 10.8168 11.3163 10.8168 11.933C10.8168 12.5497 11.3167 13.0496 11.9335 13.0496C12.5502 13.0496 13.0501 12.5497 13.0501 11.933C13.0501 11.3163 12.5502 10.8163 11.9335 10.8163Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M13.5241 3.32407C13.7584 3.08975 13.7584 2.70986 13.5241 2.47554C13.2898 2.24123 12.9099 2.24123 12.6755 2.47554L2.47554 12.6755C2.24123 12.9099 2.24123 13.2898 2.47554 13.5241C2.70986 13.7584 3.08975 13.7584 3.32407 13.5241L13.5241 3.32407Z`}}]},O=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(g,Object.assign({},e,{id:`percent-icon`,ref:t,icon:D}))});O.displayName=`PercentIcon`;let ne={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M6.33307 1.3916C5.14145 1.3916 4.06641 2.27555 4.06641 3.49366V6.49777C4.06641 7.71586 5.14145 8.59982 6.33307 8.59982C7.52469 8.59982 8.59974 7.71586 8.59974 6.49777V3.49366C8.59974 2.27555 7.52469 1.3916 6.33307 1.3916ZM5.26641 3.49366C5.26641 3.05264 5.68376 2.5916 6.33307 2.5916C6.98239 2.5916 7.39974 3.05264 7.39974 3.49366V6.49777C7.39974 6.93878 6.98239 7.39982 6.33307 7.39982C5.68376 7.39982 5.26641 6.93878 5.26641 6.49777V3.49366Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M7.90913 9.5417C8.14345 9.30739 8.52335 9.30739 8.75766 9.5417C8.99198 9.77602 8.99198 10.1559 8.75766 10.3902L7.78193 11.366H13.9999C14.3313 11.366 14.5999 11.6346 14.5999 11.966C14.5999 12.2973 14.3313 12.566 13.9999 12.566H7.78193L8.75766 13.5417C8.99198 13.776 8.99198 14.1559 8.75766 14.3902C8.52335 14.6245 8.14345 14.6245 7.90913 14.3902L5.91739 12.3985C5.80388 12.2893 5.73324 12.1359 5.73324 11.966C5.73324 11.796 5.80388 11.6426 5.91739 11.5334L7.90913 9.5417Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M1.3999 8.3002C1.3999 7.96882 1.66853 7.7002 1.9999 7.7002H2.33324C2.66461 7.7002 2.93324 7.96882 2.93324 8.3002C2.93324 8.63157 2.66461 8.9002 2.33324 8.9002H1.9999C1.66853 8.9002 1.3999 8.63157 1.3999 8.3002Z`}}]},k=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(g,Object.assign({},e,{id:`reduce-digits-icon`,ref:t,icon:ne}))});k.displayName=`ReduceDigitsIcon`;let re={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M11.9445 1.55649C12.2184 1.744 12.2895 2.11755 12.1033 2.39085L9.24342 6.58659H12.8001C13.1315 6.58659 13.4001 6.85522 13.4001 7.18659C13.4001 7.51796 13.1315 7.78659 12.8001 7.78659H8.5999V9.91276H13.2221C13.5534 9.91276 13.8221 10.1814 13.8221 10.5128C13.8221 10.8441 13.5534 11.1128 13.2221 11.1128H8.5999V14.0877C8.5999 14.4191 8.33127 14.6877 7.9999 14.6877C7.66853 14.6877 7.3999 14.4191 7.3999 14.0877V11.1128H2.77773C2.44636 11.1128 2.17773 10.8441 2.17773 10.5128C2.17773 10.1814 2.44636 9.91276 2.77773 9.91276H7.3999V7.78659H3.2001C2.86873 7.78659 2.6001 7.51796 2.6001 7.18659C2.6001 6.85522 2.86873 6.58659 3.2001 6.58659H6.75736L3.89753 2.39085C3.71125 2.11755 3.78234 1.744 4.05631 1.55649C4.33029 1.36899 4.7034 1.43854 4.88968 1.71184L7.94595 6.19577C7.96752 6.22741 7.98564 6.2604 8.00039 6.29429C8.01514 6.2604 8.03326 6.22741 8.05483 6.19577L11.1111 1.71184C11.2974 1.43854 11.6705 1.36899 11.9445 1.55649Z`}}]},A=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(g,Object.assign({},e,{id:`rmb-icon`,ref:t,icon:re}))});A.displayName=`RmbIcon`;let ie={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M9.72502 1.02051H6.07803C4.97346 1.02051 4.07803 1.91594 4.07803 3.02051V7.57046H3.00039C2.66902 7.57046 2.40039 7.83909 2.40039 8.17046C2.40039 8.50183 2.66902 8.77046 3.00039 8.77046H4.07803V10.4854H3.00039C2.66902 10.4854 2.40039 10.754 2.40039 11.0854C2.40039 11.4167 2.66902 11.6854 3.00039 11.6854H4.07803V14.3795C4.07803 14.7108 4.34666 14.9795 4.67803 14.9795C5.0094 14.9795 5.27803 14.7108 5.27803 14.3795V11.6854H10.3637C10.695 11.6854 10.9637 11.4167 10.9637 11.0854C10.9637 10.754 10.695 10.4854 10.3637 10.4854H5.27803V8.77046H9.72503C11.8651 8.77046 13.6 7.03557 13.6 4.89548C13.6 2.75539 11.8651 1.02051 9.72502 1.02051ZM9.72503 7.57046H5.27803V3.12051C5.27803 2.62345 5.68097 2.22051 6.17803 2.22051H9.72502C11.2024 2.22051 12.4 3.41814 12.4 4.89548C12.4 6.37283 11.2024 7.57046 9.72503 7.57046Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},j=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(g,Object.assign({},e,{id:`rouble-icon`,ref:t,icon:ie}))});j.displayName=`RoubleIcon`;let M={id:`sheet.operation.close.numfmt.panel`,type:t.CommandType.OPERATION,handler:()=>!0};function N(e){"@babel/helpers - typeof";return N=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},N(e)}function ae(e,t){if(N(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(N(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function oe(e){var t=ae(e,`string`);return N(t)==`symbol`?t:t+``}function P(e,t,n){return(t=oe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F(e,t){return function(n,r){t(n,r,e)}}function I(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let L=class extends t.Disposable{constructor(e,t,n,r,i,a,o,s,c,l,u){super(),this._sheetInterceptorService=e,this._themeService=t,this._univerInstanceService=n,this._commandService=r,this._selectionManagerService=i,this._renderManagerService=a,this._numfmtService=o,this._componentManager=s,this._sidebarService=c,this._localeService=l,this._sheetsNumfmtCellContentController=u,P(this,`_previewPattern`,``),P(this,`_sidebarDisposable`,null),this._initRealTimeRenderingInterceptor(),this._initCommands(),this._initCloseListener(),this._commandExecutedListener(),this._initNumfmtLocalChange()}_initNumfmtLocalChange(){this.disposeWithMe((0,l.merge)(this._sheetsNumfmtCellContentController.locale$,this._localeService.currentLocale$).subscribe(()=>{this._forceUpdate()}))}openPanel(){var e;let n=this._sidebarService,i=this._selectionManagerService,a=this._commandService,o=this._univerInstanceService,s=this._numfmtService,c=this._localeService,l=(((e=i.getCurrentSelections())==null?void 0:e.map(e=>e.range))||[])[0];if(!l)return!1;let u=o.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),d=u.getActiveSheet();if(!d)return!1;let f=d.getCellRaw(l.startRow,l.startColumn),p=s.getValue(u.getUnitId(),d.getSheetId(),l.startRow,l.startColumn),m=``;p&&(m=p.pattern);let h=(f==null?void 0:f.t)===t.CellValueType.NUMBER?f.v:12345678,g={onChange:e=>{if(e.type===`change`)this._previewPattern=e.value,this._forceUpdate();else if(e.type===`confirm`){var o;let s=((o=i.getCurrentSelections())==null?void 0:o.map(e=>e.range))||[],c={values:[]},l=(0,r.getPatternType)(e.value);s.forEach(n=>{t.Range.foreach(n,(t,n)=>{c.values.push({row:t,col:n,pattern:e.value,type:l})})}),a.executeCommand(r.SetNumfmtCommand.id,c),n.close()}else e.type===`cancel`&&n.close()},value:{defaultPattern:m,defaultValue:h,row:l.startRow,col:l.startColumn}};return this._sidebarDisposable=n.open({header:{title:c.t(`sheets-numfmt-ui.title`)},children:{label:`SHEET_NUMFMT_PANEL`,...g},onClose:()=>{this._forceUpdate(),a.executeCommand(M.id)}}),!0}_forceUpdate(e){var n;let r=this._renderManagerService.getRenderById(e==null?this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId():e);r==null||r.with(i.SheetSkeletonManagerService).reCalculate(),r==null||(n=r.mainComponent)==null||n.makeDirty()}_initCommands(){[R,M].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initRealTimeRenderingInterceptor(){let e=(0,l.combineLatest)([new l.Observable(e=>{this._commandService.onCommandExecuted(t=>{t.id===R.id&&e.next(!0),t.id===M.id&&e.next(!1)})}),this._selectionManagerService.selectionMoveEnd$.pipe((0,u.map)(e=>e?e.map(e=>e.range):[]))]);this.disposeWithMe((0,t.toDisposable)(e.pipe((0,u.switchMap)(([e,n])=>new l.Observable(r=>{let i=new t.DisposableCollection;return e&&n.length&&r.next({selectionRanges:n,disposableCollection:i}),()=>{i.dispose()}})),(0,u.tap)(()=>{this._previewPattern=null})).subscribe(({disposableCollection:e,selectionRanges:n})=>{var i;let a=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET);this.openPanel(),e.add(this._sheetInterceptorService.intercept(c.INTERCEPTOR_POINT.CELL_CONTENT,{priority:99,effect:t.InterceptorEffectEnum.Value|t.InterceptorEffectEnum.Style,handler:(e,i,a)=>{let{row:o,col:s}=i,c=a(e)||{};if(n.find(e=>e.startColumn<=s&&e.endColumn>=s&&e.startRow<=o&&e.endRow>=o)){let e=i.worksheet.getCellRaw(o,s),n=e==null?void 0:e.v,a=e==null?void 0:e.t;if(n==null||a!==t.CellValueType.NUMBER||this._previewPattern===null)return c;let u=(0,r.getPatternPreviewIgnoreGeneral)(this._previewPattern,n,this._sheetsNumfmtCellContentController.locale);if(u.color){var l;let e=(l=this._themeService.getColorFromTheme(`${u.color}.500`))==null?u.color:l;return{...c,v:u.result,t:t.CellValueType.STRING,s:{cl:{rgb:e}}}}return{...c,v:u.result,t:t.CellValueType.STRING}}return c}})),(i=this._renderManagerService.getRenderById(a.getUnitId()))==null||(i=i.mainComponent)==null||i.makeDirty()})))}_commandExecutedListener(){let e=[c.RemoveNumfmtMutation.id,c.SetNumfmtMutation.id];this.disposeWithMe(new l.Observable(t=>{let n=this._commandService.onCommandExecuted(n=>{if(e.includes(n.id)){let e=n.params;t.next(e.unitId)}});return()=>n.dispose()}).pipe((0,u.debounceTime)(16)).subscribe(e=>this._forceUpdate(e)))}_initCloseListener(){this._univerInstanceService.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET).subscribe(e=>{if(!e){var t;(t=this._sidebarDisposable)==null||t.dispose(),this._sidebarDisposable=null}})}};L=I([F(0,(0,t.Inject)(c.SheetInterceptorService)),F(1,(0,t.Inject)(t.ThemeService)),F(2,t.IUniverInstanceService),F(3,t.ICommandService),F(4,(0,t.Inject)(c.SheetsSelectionsService)),F(5,n.IRenderManagerService),F(6,c.INumfmtService),F(7,(0,t.Inject)(o.ComponentManager)),F(8,o.ISidebarService),F(9,(0,t.Inject)(t.LocaleService)),F(10,(0,t.Inject)(r.SheetsNumfmtCellContentController))],L);let R={id:`sheet.operation.open.numfmt.panel`,type:t.CommandType.OPERATION,handler:e=>(e.get(L).openPanel(),!0)},z=e=>[{label:`sheets-numfmt-ui.general`,pattern:null},{label:`sheets-numfmt-ui.text`,pattern:t.DEFAULT_TEXT_FORMAT_EXCEL},`|`,{label:`sheets-numfmt-ui.number`,pattern:`0`},{label:`sheets-numfmt-ui.percent`,pattern:`0.00%`},{label:`sheets-numfmt-ui.scientific`,pattern:`0.00E+00`},`|`,{label:`sheets-numfmt-ui.accounting`,pattern:`"${e}" #,##0.00_);[Red]("${e}"#,##0.00)`},{label:`sheets-numfmt-ui.financialValue`,pattern:`#,##0.00;[Red]#,##0.00`},{label:`sheets-numfmt-ui.currency`,pattern:`"${e}"#,##0.00_);[Red]("${e}"#,##0.00)`},{label:`sheets-numfmt-ui.roundingCurrency`,pattern:`"${e}"#,##0;[Red]"${e}"#,##0`},`|`,{label:`sheets-numfmt-ui.date`,pattern:`yyyy-mm-dd;@`},{label:`sheets-numfmt-ui.time`,pattern:`am/pm h":"mm":"ss`},{label:`sheets-numfmt-ui.dateTime`,pattern:`yyyy-m-d am/pm h:mm`},{label:`sheets-numfmt-ui.timeDuration`,pattern:`h:mm:ss`},`|`,{label:`sheets-numfmt-ui.moreFmt`,pattern:``}];function se(e){return{icon:new l.Observable(n=>{let i=e.get(t.LocaleService);return n.next((0,r.getCurrencySymbolIconByLocale)(i.getCurrentLocale()).icon),i.localeChanged$.subscribe(()=>{n.next((0,r.getCurrencySymbolIconByLocale)(i.getCurrentLocale()).icon)})}),id:r.SetCurrencyCommand.id,title:`sheets-numfmt-ui.currency`,tooltip:`sheets-numfmt-ui.currency`,type:o.MenuItemType.BUTTON,hidden$:(0,o.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,i.getCurrentRangeDisable$)(e,{workbookTypes:[c.WorkbookEditablePermission],worksheetTypes:[c.WorksheetEditPermission,c.WorksheetSetCellStylePermission],rangeTypes:[c.RangeProtectionPermissionEditPoint]})}}function ce(e){return{icon:`AddDigitsIcon`,id:r.AddDecimalCommand.id,title:`sheets-numfmt-ui.addDecimal`,tooltip:`sheets-numfmt-ui.addDecimal`,type:o.MenuItemType.BUTTON,hidden$:(0,o.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,i.getCurrentRangeDisable$)(e,{workbookTypes:[c.WorkbookEditablePermission],worksheetTypes:[c.WorksheetEditPermission,c.WorksheetSetCellStylePermission],rangeTypes:[c.RangeProtectionPermissionEditPoint]})}}function le(e){return{icon:`ReduceDigitsIcon`,id:r.SubtractDecimalCommand.id,title:`sheets-numfmt-ui.subtractDecimal`,tooltip:`sheets-numfmt-ui.subtractDecimal`,type:o.MenuItemType.BUTTON,hidden$:(0,o.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,i.getCurrentRangeDisable$)(e,{workbookTypes:[c.WorkbookEditablePermission],worksheetTypes:[c.WorksheetEditPermission,c.WorksheetSetCellStylePermission],rangeTypes:[c.RangeProtectionPermissionEditPoint]})}}function ue(e){return{icon:`PercentIcon`,id:r.SetPercentCommand.id,title:`sheets-numfmt-ui.percent`,tooltip:`sheets-numfmt-ui.percent`,type:o.MenuItemType.BUTTON,hidden$:(0,o.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,i.getCurrentRangeDisable$)(e,{workbookTypes:[c.WorkbookEditablePermission],worksheetTypes:[c.WorksheetEditPermission,c.WorksheetSetCellStylePermission],rangeTypes:[c.RangeProtectionPermissionEditPoint]})}}function de(e){let n=e.get(t.IUniverInstanceService),a=e.get(t.ICommandService),s=e.get(t.LocaleService),u=e.get(c.SheetsSelectionsService),d=[c.RemoveNumfmtMutation.id,c.SetNumfmtMutation.id],f=(0,i.deriveStateFromActiveSheet$)(n,``,({workbook:e,worksheet:n})=>new l.Observable(i=>(0,l.merge)(u.selectionMoveEnd$,(0,t.fromCallback)(a.onCommandExecuted.bind(a)).pipe((0,l.filter)(([e])=>d.includes(e.id)))).subscribe(()=>{let a=u.getCurrentSelections();if(a&&a[0]){var o,c;let l=a[0].range,u=l.startRow,d=l.startColumn,f=(o=e.getStyles().get((c=n.getCell(u,d))==null?void 0:c.s))==null?void 0:o.n,p=f==null?void 0:f.pattern,m=(0,r.getCurrencySymbolByLocale)(s.getCurrentLocale()),h=s.t(`sheets-numfmt-ui.general`);if((0,t.isDefaultFormat)(p)){i.next(h);return}if(p){let e=z(m).filter(e=>typeof e==`object`&&e.pattern).find(e=>(0,t.isPatternEqualWithoutDecimal)(p,e.pattern));h=e&&typeof e==`object`&&e.pattern?s.t(e.label):s.t(`sheets-numfmt-ui.moreFmt`)}i.next(h)}})));return{label:B,id:R.id,tooltip:`sheets-numfmt-ui.title`,type:o.MenuItemType.SELECTOR,slot:!0,selections:[{label:{name:V,hoverable:!1,selectable:!1}}],value$:f,hidden$:(0,o.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,i.getCurrentRangeDisable$)(e,{workbookTypes:[c.WorkbookEditablePermission],worksheetTypes:[c.WorksheetSetCellStylePermission,c.WorksheetEditPermission],rangeTypes:[c.RangeProtectionPermissionEditPoint]})}}let B=`sheets-numfmt-ui.moreNumfmtType`,V=`sheets-numfmt-ui.moreNumfmtType.options`;function fe(e){let{value:n}=e,r=(0,o.useDependency)(t.LocaleService);return(0,d.jsx)(`span`,{className:`univer-text-sm`,children:n==null?r.t(`sheets-numfmt-ui.general`):n})}function pe(){let e=(0,o.useDependency)(t.ICommandService),n=(0,o.useDependency)(t.LocaleService),i=(0,o.useDependency)(o.ILayoutService),l=(0,o.useDependency)(r.SheetsNumfmtCellContentController),u=(0,o.useDependency)(c.SheetsSelectionsService),f=n=>{let a=u.getCurrentLastSelection();if(!a)return;let o=a.range,s=[];t.Range.foreach(o,(e,t)=>{n?s.push({row:e,col:t,pattern:n,type:(0,r.getPatternType)(n)}):s.push({row:e,col:t})}),e.executeCommand(r.SetNumfmtCommand.id,{values:s}),i.focus()},p=(0,a.useMemo)(()=>z(r.localeCurrencySymbolMap.get(n.getCurrentLocale())),[n]),m=t=>{if(t===0)f(null);else if(t===p.length-1)e.executeCommand(R.id),i.focus();else{let e=p[t];e.pattern&&f(e.pattern)}};return(0,d.jsx)(`div`,{className:`univer-grid univer-gap-1 univer-p-1.5`,children:p.map((e,t)=>e===`|`?(0,d.jsx)(s.Separator,{},t):(0,d.jsxs)(`div`,{className:`univer-flex univer-h-7 univer-cursor-default univer-items-center univer-justify-between univer-gap-6 univer-rounded univer-px-2 univer-text-sm hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700`,onClick:()=>m(t),children:[(0,d.jsx)(`span`,{children:n.t(e.label)}),(0,d.jsx)(`span`,{className:`univer-text-xs univer-text-gray-500 dark:!univer-text-gray-400`,children:e.pattern?(0,r.getPatternPreview)(e.pattern||``,1220,l.locale).result.trim():``})]},t))})}let H=(0,a.createContext)([]),U=class{constructor(e){this._localStorageService=e}_getKey(e){return`userHabitController_${e}`}async addHabit(e,t){let n=this._getKey(e);return this._localStorageService.getItem(n).then(e=>{e||this._localStorageService.setItem(n,t)})}markHabit(e,t){let n=this._getKey(e);this._localStorageService.getItem(n).then(e=>{if(e){let r=e.findIndex(e=>e===t);r>-1&&e.splice(r,1),e.unshift(t),this._localStorageService.setItem(n,e)}})}async getHabit(e,t){let n=this._getKey(e),r=await this._localStorageService.getItem(n);if(t&&r){let e=r.map((e,t,n)=>({value:e,priority:n.length-t}));return t.sort((t,n)=>{var r,i;let a=((r=e.find(e=>e.value===t))==null?void 0:r.priority)||-1;return(((i=e.find(e=>e.value===n))==null?void 0:i.priority)||-1)-a})}return r||[]}deleteHabit(e){this._localStorageService.removeItem(e)}};U=I([F(0,(0,t.Inject)(t.ILocalStorageService))],U);let me=e=>!!(0,r.getCurrencyType)(e)&&e.startsWith(`_(`);function he(e){let{defaultPattern:n,onActionChange:i,onChange:c}=e,[l,u]=(0,a.useState)(()=>(0,r.getDecimalFromPattern)(n||``,2)),f=(0,a.useContext)(H),[p,m]=(0,a.useState)(()=>(0,r.getCurrencyType)(n)||f[0]),h=(0,a.useMemo)(()=>f.map(e=>({label:e,value:e})),[]),g=(0,o.useDependency)(t.LocaleService);return(0,a.useLayoutEffect)(()=>{i(()=>(0,r.setPatternDecimal)(`_("${p}"* #,##0${l>0?`.0`:``}_)`,l))},[l,i,p]),(0,d.jsxs)(`div`,{children:[(0,d.jsxs)(`div`,{className:`univer-mt-4 univer-flex univer-justify-between`,children:[(0,d.jsxs)(`div`,{className:`option`,children:[(0,d.jsx)(`div`,{className:`univer-text-sm univer-text-gray-400`,children:g.t(`sheets-numfmt-ui.decimalLength`)}),(0,d.jsx)(`div`,{className:`univer-mt-2 univer-w-32`,children:(0,d.jsx)(s.InputNumber,{value:l,step:1,precision:0,max:20,min:0,onChange:e=>{let t=e||0;u(t),c((0,r.setPatternDecimal)(`_("${p}"* #,##0${t>0?`.0`:``}_)`,t))}})})]}),(0,d.jsxs)(`div`,{className:`option`,children:[(0,d.jsx)(`div`,{className:`univer-text-sm univer-text-gray-400`,children:g.t(`sheets-numfmt-ui.currencyType`)}),(0,d.jsx)(`div`,{className:`univer-mt-2 univer-w-36`,children:(0,d.jsx)(s.Select,{options:h,value:p,onChange:e=>{m(e),c((0,r.setPatternDecimal)(`_("${e}"* #,##0${l>0?`.0`:``}_)`,l))}})})]})]}),(0,d.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-400`,children:g.t(`sheets-numfmt-ui.accountingDes`)})]})}let ge=e=>!!(0,r.getCurrencyType)(e)&&!e.startsWith(`_(`);function _e(e){let{onActionChange:n,onChange:i}=e,c=(0,o.useDependency)(t.LocaleService),l=(0,a.useContext)(H),[u,f]=(0,a.useState)(()=>(0,r.getCurrencyType)(e.defaultPattern)||l[0]),[p,m]=(0,a.useState)(()=>(0,r.getDecimalFromPattern)(e.defaultPattern||``,2)),[h,g]=(0,a.useState)(()=>{var n;let i=(0,r.getCurrencyFormatOptions)(u);return((n=i.find(n=>(0,t.isPatternEqualWithoutDecimal)(n.value,e.defaultPattern)))==null?void 0:n.value)||i[0].value}),_=(0,a.useMemo)(()=>(0,r.getCurrencyFormatOptions)(u),[u]),v=(0,a.useMemo)(()=>l.map(e=>({label:e,value:e})),[l]);return(0,a.useLayoutEffect)(()=>{n(()=>(0,r.setPatternDecimal)(h,p))},[p,n,h]),(0,d.jsxs)(`div`,{children:[(0,d.jsxs)(`div`,{className:`univer-mt-4 univer-flex univer-justify-between`,children:[(0,d.jsxs)(`div`,{className:`option`,children:[(0,d.jsx)(`div`,{className:`univer-text-sm univer-text-gray-400`,children:c.t(`sheets-numfmt-ui.decimalLength`)}),(0,d.jsx)(`div`,{className:`univer-mt-2 univer-w-32`,children:(0,d.jsx)(s.InputNumber,{value:p,max:20,min:0,onChange:e=>{m(e||0),i((0,r.setPatternDecimal)(h,e||0))}})})]}),(0,d.jsxs)(`div`,{className:`option`,children:[(0,d.jsx)(`div`,{className:`univer-text-sm univer-text-gray-400`,children:c.t(`sheets-numfmt-ui.currencyType`)}),(0,d.jsx)(`div`,{className:`univer-mt-2 univer-w-36`,children:(0,d.jsx)(s.Select,{value:u,options:v,onChange:e=>{if(e===void 0)return;f(e);let t=(0,r.getCurrencyFormatOptions)(e)[0].value;g(t),i((0,r.setPatternDecimal)(t,p))}})})]})]}),(0,d.jsx)(`div`,{className:`label univer-mt-4`,children:c.t(`sheets-numfmt-ui.negType`)}),(0,d.jsx)(`div`,{className:`univer-mt-2`,children:(0,d.jsx)(s.SelectList,{value:h,options:_,onChange:e=>{e!==void 0&&(g(e),i((0,r.setPatternDecimal)(e,p)))}})}),(0,d.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-400`,children:c.t(`sheets-numfmt-ui.currencyDes`)})]})}let W=`customFormat`,G=`numfmt_custom_pattern`;function ve(e){let{defaultPattern:n,onActionChange:i,onChange:c}=e,l=(0,o.useDependency)(U),u=(0,o.useDependency)(t.ILocalStorageService),f=(0,o.useDependency)(t.LocaleService),[p,m]=(0,a.useState)(n);(0,a.useLayoutEffect)(()=>{i(()=>(l.markHabit(W,p),u.getItem(G).then((e=[])=>{let t=[...new Set([p,...e||[]])].splice(0,10).filter(e=>!!e);u.setItem(G,t)}),p))},[u,i,p,l]);let[h,g]=(0,a.useState)([]);(0,a.useEffect)(()=>{u.getItem(G).then(e=>{let t=[...r.CURRENCYFORMAT.map(e=>e.suffix(`$`)),...r.DATEFMTLISG.map(e=>e.suffix),...r.NUMBERFORMAT.map(e=>e.suffix)];t.push(...e||[]),l.addHabit(W,[]).finally(()=>{l.getHabit(W,t).then(e=>{g([...new Set(e)])})})})},[]);let _=e=>{m(e),c(e)};return(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-400`,children:f.t(`sheets-numfmt-ui.customFormat`)}),(0,d.jsx)(s.Input,{placeholder:f.t(`sheets-numfmt-ui.customFormat`),onBlur:()=>{c(p)},value:p,onChange:m,className:`univer-mt-2 univer-w-full`}),(0,d.jsx)(`div`,{className:(0,s.clsx)(`univer-mt-2 univer-max-h-[400px] univer-overflow-auto univer-rounded-lg univer-p-2`,s.borderClassName),children:h.map(e=>(0,d.jsxs)(`div`,{onClick:()=>_(e),className:`univer-flex univer-cursor-pointer univer-items-center univer-gap-1.5 univer-py-1.5 univer-text-sm`,children:[(0,d.jsx)(`div`,{className:`univer-flex univer-w-4 univer-items-center univer-text-primary-600`,children:p===e&&(0,d.jsx)(w,{})}),(0,d.jsx)(`div`,{children:e})]},e))}),(0,d.jsx)(`div`,{className:`univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200`,children:f.t(`sheets-numfmt-ui.customFormatDes`)})]})}let ye=e=>{let n=t.numfmt.getFormatInfo(e);return(0,r.getDateFormatOptions)().map(e=>e.value).includes(e)||[`date`,`datetime`,`time`].includes(n.type)};function be(e){let{onActionChange:n,onChange:i,defaultPattern:c}=e,l=(0,a.useMemo)(r.getDateFormatOptions,[]),u=(0,o.useDependency)(t.LocaleService),[f,p]=(0,a.useState)(()=>{if(c){let e=l.find(e=>e.value===c);if(e)return e.value}return l[0].value});return(0,a.useLayoutEffect)(()=>{n(()=>f)},[n,f]),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-400`,children:u.t(`sheets-numfmt-ui.dateType`)}),(0,d.jsx)(`div`,{className:`univer-mt-2`,children:(0,d.jsx)(s.SelectList,{value:f,options:l,onChange:e=>{e!==void 0&&(p(e),i(e))}})}),(0,d.jsx)(`div`,{className:`univer-mt-3.5 univer-text-sm/5 univer-text-gray-600 dark:!univer-text-gray-200`,children:u.t(`sheets-numfmt-ui.dateDes`)})]})}let xe=e=>!e;function Se(e){let n=(0,o.useDependency)(t.LocaleService),{onActionChange:r}=e;return(0,a.useLayoutEffect)(()=>{r(()=>``)},[r]),(0,d.jsx)(`div`,{children:(0,d.jsx)(`div`,{className:`univer-mt-3.5 univer-text-sm/5 univer-text-gray-600 dark:!univer-text-gray-200`,children:n.t(`sheets-numfmt-ui.generalDes`)})})}let Ce=e=>(0,r.getNumberFormatOptions)().some(n=>(0,t.isPatternEqualWithoutDecimal)(n.value,e));function we(e){let{onActionChange:n,onChange:i}=e,c=(0,o.useDependency)(t.LocaleService),l=(0,a.useMemo)(r.getNumberFormatOptions,[]),[u,f]=(0,a.useState)(()=>(0,r.getDecimalFromPattern)(e.defaultPattern||``,0)),[p,m]=(0,a.useState)(()=>{let n=l.find(n=>(0,t.isPatternEqualWithoutDecimal)(n.value,e.defaultPattern||``));return(n==null?void 0:n.value)||l[0].value}),h=(0,a.useMemo)(()=>(0,r.setPatternDecimal)(p,Number(u||0)),[p,u]),g=(0,a.useMemo)(()=>!(0,r.isPatternHasDecimal)(p),[p]);return(0,a.useLayoutEffect)(()=>{n(()=>h)},[n,h]),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-400`,children:c.t(`sheets-numfmt-ui.decimalLength`)}),(0,d.jsx)(`div`,{className:`univer-mt-2`,children:(0,d.jsx)(s.InputNumber,{disabled:g,value:u,max:20,min:0,onChange:e=>{f(e||0),i((0,r.setPatternDecimal)(p,Number(e||0)))}})}),(0,d.jsxs)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-400`,children:[` `,c.t(`sheets-numfmt-ui.negType`)]}),(0,d.jsx)(`div`,{className:`univer-mt-2`,children:(0,d.jsx)(s.SelectList,{onChange:e=>{e!==void 0&&(f((0,r.getDecimalFromPattern)(e,0)),m(e),i(e))},options:l,value:p})}),(0,d.jsx)(`div`,{className:`univer-mt-3.5 univer-text-sm/5 univer-text-gray-600 dark:!univer-text-gray-200`,children:c.t(`sheets-numfmt-ui.thousandthPercentileDes`)})]})}let K=`numfmtCurrency`,Te=e=>{let n=(0,o.useDependency)(U),[r,i]=(0,a.useState)(t.currencySymbols);return(0,a.useEffect)(()=>{n.addHabit(`numfmtCurrency`,[]).then(()=>{n.getHabit(K,[...t.currencySymbols]).then(t=>{i(t),e&&e(t)})})},[]),{userHabitCurrency:r,mark:e=>{n.markHabit(K,e)}}},Ee=()=>{let e=(0,a.useRef)([]),[t,n]=(0,a.useState)({});return(0,a.useEffect)(()=>{e.current.forEach(e=>{e()}),e.current=[]},[t]),t=>{e.current.push(t),n({})}};function De(e){let{defaultValue:n,defaultPattern:i,row:c,col:l}=e.value,u=(0,o.useDependency)(t.LocaleService),f=(0,a.useRef)(()=>``),p=Ee(),m=(0,a.useMemo)(()=>[{label:`sheets-numfmt-ui.general`,component:Se},{label:`sheets-numfmt-ui.accounting`,component:he},{label:`sheets-numfmt-ui.currency`,component:_e},{label:`sheets-numfmt-ui.date`,component:be},{label:`sheets-numfmt-ui.thousandthPercentile`,component:we},{label:`sheets-numfmt-ui.customFormat`,component:ve}].map(e=>({...e,label:u.t(e.label)})),[u]),[h,g]=(0,a.useState)(S),[_,v]=(0,a.useState)(()=>`${c}_${l}_${i}`),{mark:y,userHabitCurrency:b}=Te(()=>v(`${c}_${l}_${i}_userCurrency`)),x=(0,a.useMemo)(()=>{var e;return(e=m.find(e=>e.label===h))==null?void 0:e.component},[h]);function S(){return[xe,me,ge,ye,Ce].reduce((e,t,n)=>e||(t(i)?m[n].label:``),``)||m[0].label}let C=m.map(e=>({label:e.label,value:e.label})),w=t=>{g(t),p(()=>e.onChange({type:`change`,value:f.current()||``}))},ee=(0,a.useCallback)(t=>{e.onChange({type:`change`,value:t})},[]),T=(0,a.useCallback)(e=>{f.current=e},[]),te=()=>{let t=f.current()||``,n=(0,r.getCurrencyType)(t);n&&y(n),e.onChange({type:`confirm`,value:t})},E=()=>{e.onChange({type:`cancel`,value:``})},D={onChange:ee,onActionChange:T,defaultValue:n,defaultPattern:i};return(0,a.useEffect)(()=>{g(S()),v(`${c}_${l}_${i}`)},[c,l,i]),(0,d.jsxs)(`div`,{className:(0,s.clsx)(`univer-flex univer-h-full univer-flex-col univer-justify-between univer-overflow-y-auto univer-pb-5`,s.scrollbarClassName),children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`univer-mt-3.5 univer-text-sm univer-text-gray-400`,children:u.t(`sheets-numfmt-ui.numfmtType`)}),(0,d.jsx)(`div`,{className:`univer-mt-2`,children:(0,d.jsx)(s.Select,{className:`univer-w-full`,value:h,options:C,onChange:w})}),(0,d.jsx)(`div`,{children:x&&(0,d.jsx)(H.Provider,{value:b,children:(0,a.createElement)(x,{...D,key:_})})})]}),(0,d.jsxs)(`div`,{className:`univer-mb-5 univer-mt-3.5 univer-flex univer-justify-end`,children:[(0,d.jsx)(s.Button,{onClick:E,className:`univer-mr-3`,children:u.t(`sheets-numfmt-ui.cancel`)}),(0,d.jsx)(s.Button,{variant:`primary`,onClick:te,children:u.t(`sheets-numfmt-ui.confirm`)})]})]})}let q=class extends t.Disposable{constructor(e,t){super(),this._componentManager=e,this._iconManager=t,this._registerComponents(),this._registerIcons()}_registerIcons(){this.disposeWithMe(this._iconManager.register({AddDigitsIcon:S,DollarIcon:T,EuroIcon:E,PercentIcon:O,ReduceDigitsIcon:k,RmbIcon:A,RoubleIcon:j}))}_registerComponents(){this.disposeWithMe(this._componentManager.register(`SHEET_NUMFMT_PANEL`,De)),[[B,fe],[V,pe]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))})}};q=I([F(0,(0,t.Inject)(o.ComponentManager)),F(1,(0,t.Inject)(o.IconManager))],q);let J=`SHEET_NUMFMT_ALERT`,Y=class extends t.Disposable{constructor(e,t,n,r,i,a){super(),this._context=e,this._hoverManagerService=t,this._cellAlertManagerService=n,this._localeService=r,this._numfmtService=i,this._configService=a,this._init()}_init(){this._initCellAlertPopup()}_initCellAlertPopup(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe((0,l.debounceTime)(100)).subscribe(e=>{if(e){let o=e.location,s=this._context.unit,c=s.getActiveSheet();if(!c)return this._hideAlert();let l=o.unitId,u=o.subUnitId,d,f=c.getCell(o.row,o.col);if(f!=null&&f.s){let e=s.getStyles().get(f.s);e!=null&&e.n&&(d=e.n)}if(d||(d=this._numfmtService.getValue(l,u,o.row,o.col)),!d){this._hideAlert();return}if((0,t.isTextFormat)(d.pattern)&&t.Tools.isDefine(f==null?void 0:f.v)&&(0,t.isRealNum)(f.v)){var n,a;if((n=this._configService.getConfig(r.SHEETS_NUMFMT_PLUGIN_CONFIG_KEY))!=null&&n.disableTextFormatAlert)return;let e=this._cellAlertManagerService.currentAlert.get(J),t=e==null||(a=e.alert)==null?void 0:a.location;if(t&&t.row===o.row&&t.col===o.col&&t.subUnitId===o.subUnitId&&t.unitId===o.unitId){this._hideAlert();return}this._cellAlertManagerService.showAlert({type:i.CellAlertType.ERROR,title:this._localeService.t(`sheets-numfmt-ui.info.error`),message:this._localeService.t(`sheets-numfmt-ui.info.forceStringInfo`),location:o,width:200,height:74,key:J});return}}this._hideAlert()}))}_hideAlert(){this._cellAlertManagerService.removeAlert(J)}};Y=I([F(1,(0,t.Inject)(i.HoverManagerService)),F(2,(0,t.Inject)(i.CellAlertManagerService)),F(3,(0,t.Inject)(t.LocaleService)),F(4,(0,t.Inject)(c.INumfmtService)),F(5,t.IConfigService)],Y);let X=class extends t.Disposable{constructor(e){super(),this._repeatLastActionService=e,this._initCommandRecording()}_initCommandRecording(){this._repeatLastActionService&&this.disposeWithMe(this._repeatLastActionService.registerRepeatableCommand(r.SetNumfmtCommand.id,(e,t)=>{if(!t)return;let{values:n}=t,r=n.find(e=>e.pattern);if(!r)return;let{pattern:i,type:a}=r,o=[],s=new Set;for(let t of e){let{startRow:e,startColumn:n,endRow:r,endColumn:c}=t;for(let t=e;t<=r;t++)for(let e=n;e<=c;e++){let n=`${t}-${e}`;s.has(n)||(s.add(n),o.push({row:t,col:e,pattern:i,type:a}))}}return{...t,values:o}},i.RepeatLastActionPermission.CellStyle))}};X=I([F(0,(0,t.Optional)(i.IRepeatLastActionService))],X);let Oe=()=>{let e=[];return{add:(t,n,r,i,a)=>e.push({unitId:t,subUnitId:n,row:r,col:i,value:a}),getEffects:()=>e,clean:()=>{e=[]}}},Z=class extends t.Disposable{constructor(e,t,n,r,i){super(),this._sheetInterceptorService=e,this._numfmtService=t,this._univerInstanceService=n,this._injector=r,this._editorBridgeService=i,P(this,`_collectEffectMutation`,Oe()),this._initInterceptorEditorStart(),this._initInterceptorEditorEnd(),this._initInterceptorCommands()}_initInterceptorEditorStart(){this._editorBridgeService&&this.disposeWithMe((0,t.toDisposable)(this._sheetInterceptorService.writeCellInterceptor.intercept(c.BEFORE_CELL_EDIT,{handler:(e,n,i)=>{let a=n.row,o=n.col,s=this._numfmtService.getValue(n.unitId,n.subUnitId,a,o);if(s)switch((0,r.getPatternType)(s.pattern)){case`scientific`:case`currency`:case`grouped`:case`number`:{let e={...n.worksheet.getCellRaw(a,o)};return(e==null?void 0:e.t)===t.CellValueType.NUMBER&&(0,t.isRealNum)(e.v)&&(e.v=(0,f.stripErrorMargin)(Number(e.v))),i&&i(e)}case`percent`:{let e={...n.worksheet.getCellRaw(a,o)};return(e==null?void 0:e.t)===t.CellValueType.NUMBER&&(0,t.isRealNum)(e.v)&&(e.v=`${(0,f.stripErrorMargin)(Number(e.v)*100)}%`),i&&i(e)}default:return i&&i(e)}return i(e)}})))}_initInterceptorEditorEnd(){this.disposeWithMe((0,t.toDisposable)(this._sheetInterceptorService.writeCellInterceptor.intercept(c.AFTER_CELL_EDIT,{handler:(e,n,i)=>{var a,o;if(!(e!=null&&e.v)&&!(e!=null&&e.p))return i(e);this._collectEffectMutation.clean();let s=this._numfmtService.getValue(n.unitId,n.subUnitId,n.row,n.col),c=n.worksheet.getCellRaw(n.row,n.col);if((0,t.isTextFormat)(s==null?void 0:s.pattern)||e.t===t.CellValueType.FORCE_STRING)return i(e);let l=(a=e.p)==null?void 0:a.body,u=!(e==null||(o=e.p)==null||(o=o.body)==null)&&o.dataStream?e.p.body.dataStream.replace(/\r\n$/,``):String(e.v),d=(0,t.getNumfmtParseValueFilter)(u);if(l)if(ke(l)){let{dataStream:t}=l,n=t.replace(/\r\n$/,``),r=Number(n);if(Number.isNaN(r)&&!d)return i(e)}else return i(e);if(d){if(!d.z&&!(s!=null&&s.pattern)&&(c==null?void 0:c.t)!==t.CellValueType.STRING&&(c==null?void 0:c.t)!==t.CellValueType.FORCE_STRING&&(0,t.willLoseNumericPrecision)(u))return i({...e,p:void 0,v:u,t:t.CellValueType.FORCE_STRING});d.z&&(!(s!=null&&s.pattern)||(0,r.getPatternType)(d.z)!==(0,r.getPatternType)(s.pattern))&&this._collectEffectMutation.add(n.unitId,n.subUnitId,n.row,n.col,{pattern:d.z});let a=(0,f.stripErrorMargin)(Number(d.v),16);return i({...e,p:void 0,v:a,t:t.CellValueType.NUMBER})}return i(e)}})))}_initInterceptorCommands(){let e=this;this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations(n){switch(n.id){case c.SetRangeValuesCommand.id:{var r;let n=e._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),i=n.getUnitId(),a=(r=n.getActiveSheet())==null?void 0:r.getSheetId();if(!a)return{redos:[],undos:[]};let o=e._collectEffectMutation.getEffects();if(e._collectEffectMutation.clean(),!o.length)return{redos:[],undos:[]};let s=o.filter(e=>{var t;return!!((t=e.value)!=null&&t.pattern)}).map(e=>({row:e.row,col:e.col,pattern:e.value.pattern})),l=o.filter(e=>{var t;return!((t=e.value)!=null&&t.pattern)}).map(e=>({startRow:e.row,endColumn:e.col,startColumn:e.col,endRow:e.row})),u=[],d=[];if(s.length){let t={id:c.SetNumfmtMutation.id,params:(0,c.transformCellsToRange)(i,a,s)};u.push(t),d.push(...(0,c.factorySetNumfmtUndoMutation)(e._injector,t.params))}if(l.length){let t={id:c.RemoveNumfmtMutation.id,params:{unitId:i,subUnitId:a,ranges:l}};u.push(t),d.push(...(0,c.factoryRemoveNumfmtUndoMutation)(e._injector,t.params))}return{redos:u,undos:d.reverse()}}}return{redos:[],undos:[]}}}))}dispose(){super.dispose(),this._collectEffectMutation.clean()}};Z=I([F(0,(0,t.Inject)(c.SheetInterceptorService)),F(1,(0,t.Inject)(c.INumfmtService)),F(2,(0,t.Inject)(t.IUniverInstanceService)),F(3,(0,t.Inject)(t.Injector)),F(4,(0,t.Optional)(i.IEditorBridgeService))],Z);function ke(e){let{textRuns:t=[],paragraphs:n=[],customRanges:r,customBlocks:i=[]}=e,a=[`va`];return!(t.some(e=>!!(e.ts&&Object.keys(e.ts).some(e=>a.includes(e))))||n.some(e=>e.bullet)||n.length>=2||r!=null&&r.length||i.length>0)}let Ae={[o.RibbonStartGroup.LAYOUT]:{[R.id]:{order:9,menuItemFactory:de},[r.SetPercentCommand.id]:{order:9.1,menuItemFactory:ue},[r.SetCurrencyCommand.id]:{order:9.2,menuItemFactory:se},[r.AddDecimalCommand.id]:{order:9.3,menuItemFactory:ce},[r.SubtractDecimalCommand.id]:{order:9.4,menuItemFactory:le}}},Q=class extends t.Disposable{constructor(e,t){super(),this._componentManager=e,this._menuManagerService=t,this._initMenu()}_initMenu(){this._menuManagerService.mergeMenu(Ae)}};Q=I([F(0,(0,t.Inject)(o.ComponentManager)),F(1,o.IMenuManagerService)],Q);let $=class extends t.Plugin{constructor(e=h,n,r,i){super(),this._config=e,this._injector=n,this._configService=r,this._renderManagerService=i;let{menu:a,...o}=(0,t.merge)({},h,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(`sheets-numfmt-ui.config`,o)}onStarting(){this._injector.add([q]),this._injector.get(q),(0,t.registerDependencies)(this._injector,[[L],[Z],[U],[Q],[X]])}onRendered(){this._registerRenderModules(),(0,t.touchDependencies)(this._injector,[[L],[Z],[Q],[X]])}_registerRenderModules(){[[Y]].forEach(e=>{this.disposeWithMe(this._renderManagerService.registerRenderModule(t.UniverInstanceType.UNIVER_SHEET,e))})}};P($,`pluginName`,`SHEET_NUMFMT_UI_PLUGIN`),P($,`packageName`,p),P($,`version`,m),P($,`type`,t.UniverInstanceType.UNIVER_SHEET),$=I([(0,t.DependentOn)(i.UniverSheetsUIPlugin,r.UniverSheetsNumfmtPlugin),F(1,(0,t.Inject)(t.Injector)),F(2,t.IConfigService),F(3,n.IRenderManagerService)],$),Object.defineProperty(e,"UniverSheetsNumfmtUIPlugin",{enumerable:!0,get:function(){return $}})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-numfmt-ui",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-insiders.20260629-12f2e44",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Number format menus, editors, and previews for Univer Sheets.",
|
|
6
6
|
"author": "DreamNum Co., Ltd. <developer@univer.ai>",
|
|
@@ -59,14 +59,14 @@
|
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@univerjs/icons": "1.14.0",
|
|
62
|
-
"@univerjs/core": "1.0.0-
|
|
63
|
-
"@univerjs/engine-
|
|
64
|
-
"@univerjs/
|
|
65
|
-
"@univerjs/engine-
|
|
66
|
-
"@univerjs/
|
|
67
|
-
"@univerjs/ui": "1.0.0-
|
|
68
|
-
"@univerjs/
|
|
69
|
-
"@univerjs/sheets-numfmt": "1.0.0-
|
|
62
|
+
"@univerjs/core": "1.0.0-insiders.20260629-12f2e44",
|
|
63
|
+
"@univerjs/engine-render": "1.0.0-insiders.20260629-12f2e44",
|
|
64
|
+
"@univerjs/sheets": "1.0.0-insiders.20260629-12f2e44",
|
|
65
|
+
"@univerjs/engine-formula": "1.0.0-insiders.20260629-12f2e44",
|
|
66
|
+
"@univerjs/design": "1.0.0-insiders.20260629-12f2e44",
|
|
67
|
+
"@univerjs/sheets-ui": "1.0.0-insiders.20260629-12f2e44",
|
|
68
|
+
"@univerjs/ui": "1.0.0-insiders.20260629-12f2e44",
|
|
69
|
+
"@univerjs/sheets-numfmt": "1.0.0-insiders.20260629-12f2e44"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"postcss": "^8.5.15",
|
package/LICENSE
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|