boardplot 0.56.0 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +408 -0
- package/README.md +49 -15
- package/dist/{DiagnosticDetails-JFBBXOT2.js → DiagnosticDetails-VGSL4NJK.js} +1 -1
- package/dist/{ReaderBox-GLCKYXBU.js → ReaderBox-MHMXIDAJ.js} +8 -7
- package/dist/{annotateEngine-QVNAE3EH.js → annotateEngine-753KQBNN.js} +2 -1
- package/dist/build-identity.json +3 -3
- package/dist/{chunk-HZUAEMN5.js → chunk-2CQBBN7M.js} +4 -4
- package/dist/{chunk-K3VZ5QJK.js → chunk-2ETK5TSA.js} +4 -4
- package/dist/{chunk-HHXIVFAU.js → chunk-2ETSI2EL.js} +11 -9
- package/dist/{chunk-ECBUFKCP.js → chunk-2GRXHWRH.js} +3 -3
- package/dist/{chunk-ZVM5TFGR.js → chunk-2HII2B6S.js} +6 -2
- package/dist/{chunk-WBETBGSC.js → chunk-2LC2H3ZM.js} +1003 -907
- package/dist/chunk-2NX7EO7H.js +23 -0
- package/dist/{chunk-52WNCUIN.js → chunk-2QI2PK2O.js} +1 -1
- package/dist/{chunk-QWCLWFKC.js → chunk-2VKQQLP7.js} +180 -58
- package/dist/chunk-3DOVXJ6K.js +602 -0
- package/dist/{chunk-CAJ54IEP.js → chunk-3E6NLODZ.js} +1 -1
- package/dist/{chunk-MOS6WFWM.js → chunk-3HA4IJTO.js} +9 -9
- package/dist/{chunk-JCIXYOND.js → chunk-3HPPTQEW.js} +4 -4
- package/dist/{chunk-7VVHTOE7.js → chunk-3KT2647F.js} +4 -2
- package/dist/{chunk-O6ZTIDWB.js → chunk-3MFVJMP6.js} +3 -2
- package/dist/{chunk-KQCKK3LD.js → chunk-3P3FKPFN.js} +170 -73
- package/dist/{chunk-WI5VOSQX.js → chunk-3XAJSMYD.js} +2 -2
- package/dist/{chunk-CPGASWNN.js → chunk-42QKUSHJ.js} +13 -3
- package/dist/{chunk-QB5HV4IY.js → chunk-44JU3VOT.js} +7 -8
- package/dist/{chunk-BYCJ6TKI.js → chunk-44K75CYE.js} +3 -3
- package/dist/{chunk-MS7O3KDJ.js → chunk-4FNM4D57.js} +6 -6
- package/dist/{chunk-BVYIKLQ5.js → chunk-4ROZ4TFL.js} +1 -1
- package/dist/{chunk-3V62N3Z7.js → chunk-4VV3KUFT.js} +7 -8
- package/dist/{chunk-MAFPVR4G.js → chunk-54YO56IK.js} +10 -5
- package/dist/{chunk-JMGB444D.js → chunk-5ACFYNA4.js} +8 -4
- package/dist/{chunk-6AMN7IKJ.js → chunk-5JEU6MWC.js} +49 -28
- package/dist/{chunk-NCLRZQR6.js → chunk-5JIB4VJA.js} +18 -10
- package/dist/{chunk-SXD3OYAR.js → chunk-5OP3E2ZD.js} +205 -96
- package/dist/{chunk-SS4YGK3E.js → chunk-5SLBD4BT.js} +72 -304
- package/dist/{chunk-XMP2DNLI.js → chunk-5SVGTQTW.js} +4 -4
- package/dist/chunk-5U567TYU.js +23 -0
- package/dist/chunk-5ZLF4S7X.js +40 -0
- package/dist/{chunk-T2YDWT54.js → chunk-5ZMTQATF.js} +261 -147
- package/dist/{chunk-WXJ5MHLH.js → chunk-62BDQTO6.js} +2 -2
- package/dist/chunk-64K3V4VN.js +25 -0
- package/dist/{chunk-BK6P6KMW.js → chunk-67YJJJIB.js} +1 -1
- package/dist/{chunk-32LLDRPI.js → chunk-6DJNFT2K.js} +42 -32
- package/dist/{chunk-JYAZPMSA.js → chunk-6IUK6PAH.js} +7 -6
- package/dist/{chunk-7STMIK2X.js → chunk-6JFQCVNN.js} +4 -4
- package/dist/chunk-6JXBLQJ2.js +32 -0
- package/dist/{chunk-5TWY3ZIC.js → chunk-6XPV6M3Q.js} +5 -5
- package/dist/{chunk-MPO5TVGF.js → chunk-6ZDSEITW.js} +3 -3
- package/dist/{chunk-75WIUG2W.js → chunk-72HVDLMT.js} +172 -78
- package/dist/chunk-75NU5RLX.js +24 -0
- package/dist/chunk-76GPN6AT.js +72 -0
- package/dist/chunk-7BQK2UDV.js +13 -0
- package/dist/{chunk-CF4NMRN7.js → chunk-7CAYRPJV.js} +45 -25
- package/dist/{chunk-U3A6FMSI.js → chunk-7GWWBHVQ.js} +7 -7
- package/dist/{chunk-CHAS5A5B.js → chunk-7NYUFMLJ.js} +149 -86
- package/dist/{chunk-D2B3KP35.js → chunk-7VWXXBTC.js} +4 -0
- package/dist/chunk-A65B23JK.js +113 -0
- package/dist/{chunk-4KMZAK6J.js → chunk-A7R6FUS6.js} +4 -4
- package/dist/{chunk-E2ZUBP4Q.js → chunk-AEVGUOPB.js} +7 -8
- package/dist/chunk-AHIK2N72.js +53 -0
- package/dist/{chunk-KLB2QC24.js → chunk-AICO24HJ.js} +5 -2
- package/dist/{chunk-7KSUMFBK.js → chunk-AJGSCVVW.js} +5 -1
- package/dist/{chunk-RSCRIWAH.js → chunk-AL62JJTB.js} +10 -3
- package/dist/{chunk-E7V3OHQQ.js → chunk-AN2V2LC4.js} +37 -22
- package/dist/{chunk-JIEVDGAF.js → chunk-AOFUA5XP.js} +1 -1
- package/dist/chunk-B5A7X2BA.js +44 -0
- package/dist/{chunk-2HTYGMMG.js → chunk-BCMEGJRX.js} +2 -2
- package/dist/{chunk-KD5GOR2K.js → chunk-BDIKWR45.js} +124 -69
- package/dist/{chunk-FNRPQIQE.js → chunk-BG6AIWAK.js} +4 -6
- package/dist/{chunk-ZMPH2OC4.js → chunk-BOT6W3VB.js} +7 -8
- package/dist/{chunk-DRHQG44U.js → chunk-BQBD6Q5J.js} +6 -2
- package/dist/{chunk-2DOEZ5QY.js → chunk-BZ67BJBH.js} +11 -10
- package/dist/{chunk-UBCVBBJJ.js → chunk-C47POAC5.js} +4 -3
- package/dist/{chunk-O7REHICC.js → chunk-C5OBPO4Z.js} +36 -28
- package/dist/{chunk-IGNBQT23.js → chunk-CCAAI56H.js} +121 -10
- package/dist/{chunk-RPIKNMZA.js → chunk-CDUR3KWV.js} +7 -2
- package/dist/{chunk-MZACASZY.js → chunk-CMPHT2LS.js} +14 -2
- package/dist/{chunk-FHA3KMFC.js → chunk-CQBPNE7Z.js} +5 -1
- package/dist/{chunk-IVRYF7QA.js → chunk-CR5FP5SF.js} +1 -1
- package/dist/{chunk-DD6RVD3S.js → chunk-D2TQX7UJ.js} +5 -1
- package/dist/{chunk-VVXKFU72.js → chunk-DEANHDXU.js} +62 -41
- package/dist/{chunk-GM3EGUYW.js → chunk-DHGE46UK.js} +1 -1
- package/dist/{chunk-UZTQUPTB.js → chunk-DIHX6NUB.js} +5 -5
- package/dist/{chunk-MD6DCQMA.js → chunk-DILQ34NW.js} +37 -37
- package/dist/{chunk-YMTXTQCN.js → chunk-DJKRYJP7.js} +6 -6
- package/dist/{chunk-JCAGVAB3.js → chunk-DKLC6QLF.js} +1200 -21
- package/dist/{chunk-SRAV6FPB.js → chunk-DNHTMCUP.js} +3 -3
- package/dist/{chunk-CKGSGRP7.js → chunk-DORE2RHL.js} +21 -5
- package/dist/{chunk-SMHZXHHD.js → chunk-DZYTXZNS.js} +15 -5
- package/dist/chunk-E262NRFP.js +39 -0
- package/dist/{chunk-V5JQQMFQ.js → chunk-E5YF236N.js} +4 -1
- package/dist/{chunk-IGJ2G5C6.js → chunk-EBUK7HJP.js} +6 -6
- package/dist/{chunk-ZL6IHMOW.js → chunk-ECBHC272.js} +198 -119
- package/dist/{chunk-SA46CNMS.js → chunk-ED7GLWTF.js} +4 -1
- package/dist/chunk-EFW43JQJ.js +24 -0
- package/dist/{chunk-5P2TTHBZ.js → chunk-EHRRHSPV.js} +2 -2
- package/dist/{chunk-JXBZIJCG.js → chunk-EILNJQMN.js} +32 -12
- package/dist/{chunk-GELSK76Y.js → chunk-ERDKMZ7O.js} +3 -3
- package/dist/{chunk-T2CYNDYU.js → chunk-ETRAPN5G.js} +366 -130
- package/dist/{chunk-JEUL777U.js → chunk-ETUKDEGL.js} +21 -12
- package/dist/chunk-F2ET5ZTT.js +49 -0
- package/dist/{chunk-2YO4WRJN.js → chunk-F3XOBFS4.js} +40 -29
- package/dist/{chunk-SPSGUFTI.js → chunk-FB6X7QHA.js} +1 -1
- package/dist/{chunk-5PPQIF4D.js → chunk-FGW54I23.js} +7 -8
- package/dist/{chunk-JTC5SEAQ.js → chunk-FP5B5XIL.js} +7 -3
- package/dist/{chunk-RJGCYGC3.js → chunk-FRHQGA5Q.js} +86 -250
- package/dist/{chunk-YZZLIYPA.js → chunk-FRR7BJ3B.js} +5 -1
- package/dist/{chunk-4DZFR52I.js → chunk-FVWHEM2N.js} +7 -5
- package/dist/{chunk-YPYD6OJ3.js → chunk-FWSMENKH.js} +2 -2
- package/dist/{chunk-YYJORENB.js → chunk-FWTUGNSF.js} +8 -8
- package/dist/{chunk-GIHH6VC2.js → chunk-FZKDZQ6U.js} +10 -6
- package/dist/{chunk-S7NRL66K.js → chunk-G4FF6G3I.js} +26 -17
- package/dist/{chunk-PQLAZEQV.js → chunk-GB6BZSTL.js} +248 -92
- package/dist/chunk-GCIHRRDJ.js +24 -0
- package/dist/{chunk-X3KCQEYZ.js → chunk-GHCU6OSE.js} +9 -1
- package/dist/chunk-GKDUIDU6.js +138 -0
- package/dist/chunk-GO66OCN7.js +24 -0
- package/dist/chunk-GOFS336W.js +24 -0
- package/dist/{chunk-AGDDH6XY.js → chunk-GQYT7G4F.js} +5 -1
- package/dist/{chunk-WN3HEU3P.js → chunk-GUTLXO7Q.js} +140 -89
- package/dist/chunk-H3VICNTN.js +47 -0
- package/dist/{chunk-GC4WOLV3.js → chunk-HAG3K6PQ.js} +14 -2
- package/dist/{chunk-CB4CERXZ.js → chunk-HBQHSZ6S.js} +11 -2
- package/dist/chunk-HTQGJQZN.js +124 -0
- package/dist/{chunk-F77TMAUY.js → chunk-HUQRO6VF.js} +39 -36
- package/dist/{chunk-4KQHKPB3.js → chunk-I5VDW2XZ.js} +543 -509
- package/dist/{chunk-43GGVT7W.js → chunk-I5VNHDPR.js} +11 -4
- package/dist/{chunk-4LTN7SND.js → chunk-IDXYHDQY.js} +1 -1
- package/dist/{chunk-Y54LU4CU.js → chunk-IIWZJ5ZM.js} +1 -1
- package/dist/{chunk-FMDNJ6PC.js → chunk-IPBOREIY.js} +2 -2
- package/dist/chunk-IU335UO7.js +27 -0
- package/dist/{chunk-JVZTKQFS.js → chunk-IVDTP6SV.js} +9 -5
- package/dist/{chunk-BDGLMWPO.js → chunk-IXOBDDMW.js} +11 -2
- package/dist/{chunk-EIL3KHAL.js → chunk-J4QRB6DQ.js} +5 -5
- package/dist/{chunk-3465633G.js → chunk-JCMGKQVS.js} +3 -3
- package/dist/{chunk-YK2KWNTU.js → chunk-JM7UTLF3.js} +28 -14
- package/dist/{chunk-CXETOLPX.js → chunk-JNDWRV34.js} +4 -4
- package/dist/{chunk-DLUNQHFO.js → chunk-JSRQTDZZ.js} +26 -24
- package/dist/{chunk-WTQAG2OT.js → chunk-JT3UTEWZ.js} +8 -3
- package/dist/{chunk-GQT2SY2S.js → chunk-JUYRDZSV.js} +291 -151
- package/dist/{chunk-LKMFMNQX.js → chunk-JVGL2SCN.js} +1 -1
- package/dist/{chunk-4JC3SE4G.js → chunk-JY4LTPOV.js} +1 -1
- package/dist/chunk-K7XPTQBJ.js +267 -0
- package/dist/{chunk-P4SMC4BY.js → chunk-KGBUXMFP.js} +120 -86
- package/dist/{chunk-XC5IRUEL.js → chunk-KIE5V3DA.js} +2 -2
- package/dist/{chunk-RT66UTLJ.js → chunk-KU4PCG4W.js} +2 -2
- package/dist/{chunk-VPL3JYC6.js → chunk-KVBLTAO7.js} +52 -10
- package/dist/{chunk-XCROSJ2Z.js → chunk-KW4JXWHO.js} +1 -1
- package/dist/{chunk-PJBEJR2U.js → chunk-KWIP5YRA.js} +24 -7
- package/dist/{chunk-JYBT2JNY.js → chunk-LE3LSEUL.js} +27 -2
- package/dist/{chunk-R2IKOLBK.js → chunk-LG6M2JTH.js} +3 -3
- package/dist/{chunk-DF3XEFQ7.js → chunk-LIE2WSB4.js} +21 -18
- package/dist/{chunk-Z55DXFWS.js → chunk-LJDATBPB.js} +26 -16
- package/dist/{chunk-KLIZXSBK.js → chunk-LMMS675D.js} +10 -9
- package/dist/{chunk-MRAP2UVV.js → chunk-LPKGZ664.js} +286 -35
- package/dist/{chunk-JFFREZGT.js → chunk-LPMSGO7L.js} +6 -2
- package/dist/chunk-LQWINE7K.js +211 -0
- package/dist/{chunk-6MJUW5R5.js → chunk-MKMMQDIY.js} +139 -71
- package/dist/{chunk-F5BYLT3M.js → chunk-MQ4IEDM5.js} +462 -138
- package/dist/{chunk-QGFKSDQO.js → chunk-MRM4KJ2O.js} +2 -2
- package/dist/{chunk-ETMHDCEH.js → chunk-MX2OZHIT.js} +102 -42
- package/dist/{chunk-6EYTD777.js → chunk-MXUPMGRY.js} +2 -2
- package/dist/{chunk-2FKEF2AC.js → chunk-NHU26HQ7.js} +58 -35
- package/dist/{chunk-KBJMLXNW.js → chunk-NQVJ4FPY.js} +161 -78
- package/dist/chunk-NZ7FX3AE.js +65 -0
- package/dist/chunk-OALBVELJ.js +23 -0
- package/dist/{chunk-5S3JQ5AT.js → chunk-OGZ4UPYK.js} +183 -137
- package/dist/{chunk-6WHWXCHJ.js → chunk-OMNB27GM.js} +7 -3
- package/dist/{chunk-EGGDPDYJ.js → chunk-OO63YP35.js} +1 -1
- package/dist/{chunk-ZYQYX66L.js → chunk-OPYDTW5Q.js} +6 -6
- package/dist/{chunk-A2GAWGVJ.js → chunk-OSJN7KDS.js} +68 -39
- package/dist/{chunk-RMC4OONA.js → chunk-OSJXIW6I.js} +1030 -1123
- package/dist/{chunk-X23SZHV5.js → chunk-OVVE42P4.js} +6 -6
- package/dist/{chunk-CCJP6QZO.js → chunk-OZA7HA6L.js} +1 -1
- package/dist/chunk-OZLKEBCD.js +54 -0
- package/dist/{chunk-TE4M52AA.js → chunk-P6DEFCMQ.js} +18 -2
- package/dist/{chunk-AMR4SUAN.js → chunk-PDTIQL3B.js} +6 -6
- package/dist/{chunk-BIVL764T.js → chunk-PJ5BYZPN.js} +2 -2
- package/dist/{chunk-BISJK67O.js → chunk-PK7Z7WRJ.js} +98 -46
- package/dist/{chunk-7VMEM3LN.js → chunk-PL6NWB5U.js} +178 -113
- package/dist/chunk-PMT75APP.js +94 -0
- package/dist/chunk-PP6A4X55.js +11 -0
- package/dist/{chunk-I7H5DU34.js → chunk-PPCH3PLO.js} +25 -13
- package/dist/{chunk-BIGQKCU7.js → chunk-PPE6S7WU.js} +42 -24
- package/dist/{chunk-2NSQIPAA.js → chunk-PT7KSIEO.js} +23 -36
- package/dist/{chunk-KZJ5VM6E.js → chunk-PZ3TQFSY.js} +15 -1
- package/dist/{chunk-ZJFJ2IKQ.js → chunk-QAUGRVRU.js} +122 -23
- package/dist/{chunk-BTDGWHGJ.js → chunk-QMFWZG2P.js} +39 -19
- package/dist/{chunk-L6YVK6VC.js → chunk-QZGGCE45.js} +2 -2
- package/dist/{chunk-67QSW5RW.js → chunk-R2RJQ3BM.js} +4 -4
- package/dist/{chunk-ZY72LSQK.js → chunk-R7HBIQ63.js} +102 -61
- package/dist/{chunk-4JHMCXOB.js → chunk-RBNDZLYS.js} +77 -36
- package/dist/chunk-RCSY4CT4.js +2170 -0
- package/dist/{chunk-NGA7ICG4.js → chunk-RDJ3ZU6O.js} +16 -13
- package/dist/{chunk-2NN676RI.js → chunk-RHQRPJHS.js} +7 -8
- package/dist/chunk-RI6XQKWJ.js +26 -0
- package/dist/{chunk-YOOHNQ3L.js → chunk-RJICOOB3.js} +18 -8
- package/dist/{chunk-5DTCOOLU.js → chunk-RLAVNCQJ.js} +2 -2
- package/dist/{chunk-CYKXROFG.js → chunk-ROPPWJQB.js} +23 -12
- package/dist/{chunk-54ROMBU7.js → chunk-SELOV32X.js} +105 -50
- package/dist/{chunk-TUW5IYGA.js → chunk-SQI4NWTQ.js} +9 -9
- package/dist/{chunk-ZEYBI47P.js → chunk-SRJ74CMG.js} +11 -3
- package/dist/{chunk-NHC2ADGI.js → chunk-STWOURLG.js} +253 -144
- package/dist/chunk-SWMFXSVW.js +23 -0
- package/dist/chunk-SXAZDIGM.js +84 -0
- package/dist/{chunk-EMFUZKYK.js → chunk-SZ5VGWDY.js} +3 -3
- package/dist/{chunk-R5MEBBAA.js → chunk-T26G23RS.js} +442 -119
- package/dist/{chunk-QHRE2M6V.js → chunk-T2L5H2WW.js} +4 -3
- package/dist/chunk-T7GPIJ4L.js +89 -0
- package/dist/{chunk-MJPXHCBW.js → chunk-TAEB3RU6.js} +5 -5
- package/dist/{chunk-V7F4F6JA.js → chunk-TBDIMTRD.js} +37 -16
- package/dist/{chunk-63Y3ROZ7.js → chunk-TFFPEWNP.js} +102 -64
- package/dist/{chunk-EZZ533MH.js → chunk-TMEUK2WS.js} +6 -2
- package/dist/{chunk-37PKNVLS.js → chunk-TVOMGNFQ.js} +1 -1
- package/dist/{chunk-HJRNBKIT.js → chunk-TX5FSNAU.js} +436 -30
- package/dist/{chunk-V634AXDM.js → chunk-U52PNFPX.js} +1 -1
- package/dist/{chunk-QLANK3VN.js → chunk-U74AWJ3X.js} +6 -6
- package/dist/chunk-UC7LBW7N.js +26 -0
- package/dist/{chunk-PZ46S2SY.js → chunk-UCKUAKYQ.js} +2 -2
- package/dist/{chunk-KF7HD3EH.js → chunk-UCYL3YA7.js} +77 -55
- package/dist/{chunk-HOU2MZHC.js → chunk-UD2GI3CS.js} +11 -4
- package/dist/{chunk-SNQ7D5R7.js → chunk-UIHGGWES.js} +51 -11
- package/dist/{chunk-LGNJCPFP.js → chunk-ULQIC76A.js} +10 -13
- package/dist/{chunk-KTHFHD6C.js → chunk-UY34DDUM.js} +11 -6
- package/dist/{chunk-6QDMRPXI.js → chunk-UYMFLWM6.js} +215 -258
- package/dist/{chunk-KDSYZLF6.js → chunk-V5IFI3FV.js} +8 -1
- package/dist/{chunk-JTFKRDDA.js → chunk-V7FV66KL.js} +1 -1
- package/dist/{chunk-27OIGDRK.js → chunk-V7NUJEJE.js} +1 -1
- package/dist/{chunk-CCDXK5NA.js → chunk-VESSIKBG.js} +8 -3
- package/dist/{chunk-QSMGZOT5.js → chunk-VRFJAF3R.js} +7 -8
- package/dist/chunk-VS2R3OGN.js +34 -0
- package/dist/{chunk-RLMC5CUP.js → chunk-VS5B4J2D.js} +7 -8
- package/dist/{chunk-7M2GK7XQ.js → chunk-W4R6SGU3.js} +252 -121
- package/dist/{chunk-JKOEHRGV.js → chunk-WDLWWEHZ.js} +1 -1
- package/dist/{chunk-7DAH2E4T.js → chunk-WFBN2HXR.js} +2 -2
- package/dist/{chunk-DLDDRXAI.js → chunk-WJS6SAWA.js} +296 -145
- package/dist/{chunk-WWGPTEQB.js → chunk-WQYNKF33.js} +73 -22
- package/dist/{chunk-64LJDGJH.js → chunk-WUP6C4ZD.js} +4 -2
- package/dist/{chunk-F2EVCJ4U.js → chunk-X24WAHHV.js} +87 -43
- package/dist/{chunk-OJ5CQV7H.js → chunk-X3UCQPVV.js} +209 -96
- package/dist/{chunk-7FKY6YWU.js → chunk-X46PSAJ7.js} +6 -6
- package/dist/{chunk-H3IBJQ5A.js → chunk-XD5XB22R.js} +2 -2
- package/dist/chunk-XDIAQEYK.js +28 -0
- package/dist/{chunk-7PPMT5EJ.js → chunk-XFPNYHX3.js} +372 -105
- package/dist/{chunk-FCECYJVA.js → chunk-XIBVAKCO.js} +1 -1
- package/dist/{chunk-OG2YUVBW.js → chunk-XMX4PCFL.js} +8 -3
- package/dist/{chunk-2NRHD2G7.js → chunk-XRRG4MBM.js} +12 -4
- package/dist/{chunk-FNMH5WEY.js → chunk-XTFO6D4L.js} +1 -1
- package/dist/chunk-XWRI3N5O.js +70 -0
- package/dist/{chunk-ZKJ5L35C.js → chunk-XXPLPSOE.js} +36 -25
- package/dist/{chunk-XQMYQ4TN.js → chunk-XZXZNI7A.js} +1 -1
- package/dist/{chunk-E555EDOQ.js → chunk-YEJZ2OYS.js} +490 -182
- package/dist/chunk-YGZEG3JV.js +123 -0
- package/dist/{chunk-F6OLHND5.js → chunk-Z3WQXVFV.js} +2 -2
- package/dist/{chunk-FFJGC2DX.js → chunk-Z6DUNKFU.js} +173 -40
- package/dist/{chunk-N5HN5QGH.js → chunk-Z6H5ED2I.js} +1 -1
- package/dist/{chunk-7Q37C6GZ.js → chunk-ZBOOMLHD.js} +1 -1
- package/dist/{chunk-MOK3ZS6P.js → chunk-ZDJ7C64T.js} +1 -1
- package/dist/{chunk-GLQ3KCTY.js → chunk-ZGZLEUKM.js} +7 -8
- package/dist/{chunk-YHD2FZFP.js → chunk-ZHRGX225.js} +6 -6
- package/dist/{chunk-76Q7E3TM.js → chunk-ZIVCPXXL.js} +510 -646
- package/dist/{chunk-BSATR6ZO.js → chunk-ZNRSYS76.js} +21 -3
- package/dist/{chunk-DMAMWUYY.js → chunk-ZSLTSCTI.js} +5 -5
- package/dist/{chunk-IGVAWAOK.js → chunk-ZSYFQSPF.js} +43 -9
- package/dist/cli/index.js +8 -3
- package/dist/{core-7Y5BZZON.js → core-43GLGBOY.js} +8 -1
- package/dist/{core-7S3XMW5O.js → core-5GI3ERXO.js} +4 -1
- package/dist/{core-K3JX5WPM.js → core-5L7TMK7I.js} +6 -1
- package/dist/{core-LB5M7XL4.js → core-7TO4OVY5.js} +6 -1
- package/dist/{core-ILPXXC2Z.js → core-BJVENHFQ.js} +7 -1
- package/dist/{core-JDFUZFRH.js → core-BX4MFWKC.js} +6 -1
- package/dist/{core-XW7UJFJZ.js → core-C3KXTOIZ.js} +7 -1
- package/dist/{core-WJNK7F2J.js → core-C5Y6BFLL.js} +7 -1
- package/dist/{core-WZ4CHVYL.js → core-CLUSJ2SK.js} +5 -1
- package/dist/{core-TCSW24N6.js → core-E3IN2VVH.js} +5 -1
- package/dist/{core-MU4ALRR7.js → core-FD67NQOV.js} +6 -1
- package/dist/{core-YMXYUGF5.js → core-FDKMLRAK.js} +5 -1
- package/dist/{core-VKZSQFRG.js → core-FL6Z3VVX.js} +5 -1
- package/dist/{core-5UF44NDI.js → core-JC7JUFPY.js} +8 -1
- package/dist/{core-RR2CAZC5.js → core-JF33TADA.js} +8 -1
- package/dist/{core-4RR6VSXM.js → core-JH32ZAKM.js} +4 -1
- package/dist/{core-G3LXHW73.js → core-JYYZPPQV.js} +7 -1
- package/dist/{core-4HFVG4CP.js → core-KJTKCV4U.js} +4 -1
- package/dist/{core-GSILPKUR.js → core-LCQPE5Y6.js} +8 -1
- package/dist/{core-GLOZY6Z7.js → core-LHVGWE54.js} +6 -1
- package/dist/{core-J2JD5ODO.js → core-OVSNBOCE.js} +9 -1
- package/dist/{core-BLHEJ5OK.js → core-PPEC236B.js} +5 -1
- package/dist/{core-ZLSQHZ3I.js → core-QTJZDK5H.js} +5 -1
- package/dist/{core-TKZZZ6UW.js → core-R3YZCOUZ.js} +7 -1
- package/dist/{core-HTD5RHE7.js → core-RIBW5XU4.js} +7 -1
- package/dist/{core-AR2T32Y3.js → core-RJFILBWL.js} +8 -1
- package/dist/{core-A5AKUB7H.js → core-RWSXEKTE.js} +4 -1
- package/dist/{core-DD62MWEW.js → core-SOPPZLEH.js} +5 -1
- package/dist/{core-HDNWVLJW.js → core-TBUZCXLX.js} +5 -1
- package/dist/{core-BOG33BFD.js → core-TZ5QLTAX.js} +5 -1
- package/dist/{core-H5HO2CED.js → core-U7E5W4MY.js} +3 -1
- package/dist/{core-QPSAYRFT.js → core-UBNVSL44.js} +7 -1
- package/dist/{core-E2XOSHPR.js → core-UDRD4WIU.js} +6 -1
- package/dist/{core-DFZMOO7E.js → core-UVJZ4HY2.js} +7 -1
- package/dist/{core-LGJZUP6H.js → core-X7WWYQH4.js} +8 -1
- package/dist/{core-BBNY2BX4.js → core-XP56X47I.js} +5 -1
- package/dist/{core-3KLQSYWB.js → core-XQG54CYG.js} +6 -1
- package/dist/{dataTable-CNDRVGA5.js → dataTable-U7W4I6IF.js} +15 -2
- package/dist/{engine-FVEIM3WV.js → engine-O5V26MGR.js} +32 -19
- package/dist/fixtures.js +4 -1
- package/dist/flags-BVLSAXT3.js +10 -0
- package/dist/{fontTables-ZPZQ6IR3.js → fontTables-JUW7ZTQY.js} +3 -1
- package/dist/fonts.js +1 -1
- package/dist/geo/dach.js +1 -1
- package/dist/geo/de-states.js +1 -1
- package/dist/geo/eu27.js +1 -1
- package/dist/geo/europe.js +1 -1
- package/dist/geo/index.js +2 -2
- package/dist/geo/us-states.js +1 -1
- package/dist/geo/world.js +1 -1
- package/dist/index.js +41 -22
- package/dist/{main-THU6VIVU.js → main-35GS47XC.js} +68 -123
- package/dist/mcp/server.js +131 -118
- package/dist/react/bar.js +10 -1
- package/dist/react/bartable.js +10 -1
- package/dist/react/box.js +8 -1
- package/dist/react/bullet.js +10 -1
- package/dist/react/butterfly.js +10 -1
- package/dist/react/choropleth.js +10 -1
- package/dist/react/cohort.js +11 -1
- package/dist/react/column.js +10 -1
- package/dist/react/combo.js +10 -1
- package/dist/react/creative.js +11 -1
- package/dist/react/diagram.js +10 -1
- package/dist/react/dimswitch.js +11 -1
- package/dist/react/dot.js +9 -1
- package/dist/react/export.js +36 -18
- package/dist/react/funnel.js +9 -1
- package/dist/react/gantt.js +9 -1
- package/dist/react/grid.js +10 -1
- package/dist/react/heatmap.js +9 -1
- package/dist/react/histogram.js +11 -1
- package/dist/react/index.js +101 -85
- package/dist/react/kpi.js +10 -1
- package/dist/react/likert.js +11 -1
- package/dist/react/line.js +9 -1
- package/dist/react/mekko.js +10 -1
- package/dist/react/pareto.js +11 -1
- package/dist/react/pie.js +9 -1
- package/dist/react/prepare.js +49 -21
- package/dist/react/pvm.js +12 -1
- package/dist/react/pyramid.js +10 -1
- package/dist/react/sankey.js +10 -1
- package/dist/react/scatter.js +8 -1
- package/dist/react/slope.js +10 -1
- package/dist/react/sparkline.js +10 -1
- package/dist/react/spec.js +24 -14
- package/dist/react/status.js +9 -1
- package/dist/react/story.js +5 -2
- package/dist/react/table.js +9 -1
- package/dist/react/theme.js +10 -3
- package/dist/react/tilemap.js +9 -1
- package/dist/react/treemap.js +9 -1
- package/dist/react/variance.js +10 -1
- package/dist/react/waffle.js +9 -1
- package/dist/react/waterfall.js +11 -1
- package/dist/{resvg-VB7S5HRF.js → resvg-ZYEZTSUO.js} +3 -1
- package/dist/rows.js +3 -2
- package/dist/{rowsModule-LI6KOS46.js → rowsModule-H2S6WW4D.js} +2 -1
- package/dist/{schema-CGQID64D.js → schema-2R32F6AW.js} +1 -1
- package/dist/{schema-H2EC4GAQ.js → schema-2TPGJGVR.js} +1 -1
- package/dist/{schema-THXXFY6I.js → schema-47BG2TZA.js} +1 -3
- package/dist/{schema-AMT7P7KB.js → schema-56MOEOVR.js} +1 -1
- package/dist/{schema-GNTKL5DN.js → schema-5MSR4LNN.js} +1 -1
- package/dist/{schema-5ZTGVQAJ.js → schema-5RIYEWE6.js} +1 -1
- package/dist/{schema-LOQ3AFC7.js → schema-A26ZNGTZ.js} +1 -3
- package/dist/{schema-MMVPMJEF.js → schema-ALBF6V7Y.js} +1 -3
- package/dist/{schema-BKUFZLLI.js → schema-BA6WP5YZ.js} +1 -1
- package/dist/{schema-PQZWO3BP.js → schema-CBL2SMVR.js} +1 -3
- package/dist/{schema-BBTXTWYI.js → schema-CWKGLDSR.js} +1 -3
- package/dist/{schema-5KDEQBBT.js → schema-DBIQFL56.js} +1 -1
- package/dist/{schema-KPEPBGAX.js → schema-DL7V6NN2.js} +1 -1
- package/dist/{schema-PL3EU6EQ.js → schema-DUVJMFKQ.js} +4 -2
- package/dist/{schema-L5U4OROI.js → schema-ECJERHKF.js} +2 -1
- package/dist/{schema-YLE4XXQQ.js → schema-EDSEKZDJ.js} +1 -1
- package/dist/{schema-HH5HOORE.js → schema-ESR6ZIK4.js} +1 -3
- package/dist/{schema-5DUTAVO7.js → schema-F7TWGLRZ.js} +1 -3
- package/dist/{schema-B2GCEYXD.js → schema-FGB6IGZM.js} +1 -3
- package/dist/{schema-7NSV542V.js → schema-FKGGTM4Z.js} +2 -1
- package/dist/{schema-72EEMYS3.js → schema-FU2AFIEE.js} +1 -1
- package/dist/{schema-QORUB6EK.js → schema-JNJFCYBM.js} +18 -1
- package/dist/{schema-JH57NFXJ.js → schema-JYZ4RF6S.js} +2 -1
- package/dist/{schema-25INXAMY.js → schema-K7F6TEDK.js} +1 -2
- package/dist/{schema-OU35XA3Z.js → schema-KAK6DZX4.js} +1 -1
- package/dist/{schema-R5Y6NVBH.js → schema-MOKWIGF7.js} +1 -1
- package/dist/{schema-ZQSIR5UC.js → schema-MQT6BMNK.js} +1 -3
- package/dist/{schema-FDFQKIO5.js → schema-MR3BPPQR.js} +1 -1
- package/dist/{schema-VYECMPON.js → schema-OPXZYIW7.js} +1 -3
- package/dist/{schema-ZEVJMFLV.js → schema-PV7JGX5H.js} +1 -1
- package/dist/{schema-QPOBZUAR.js → schema-PWPQF5RC.js} +1 -1
- package/dist/{schema-GN6GAIU5.js → schema-PYQEUC5P.js} +1 -3
- package/dist/{schema-M5JBHQIV.js → schema-QPIC5MAG.js} +9 -2
- package/dist/{schema-QCIE6M2P.js → schema-R42VXFIS.js} +1 -1
- package/dist/{schema-J7TNCZIP.js → schema-TVUJNEX7.js} +1 -1
- package/dist/{schema-AXRDF6ND.js → schema-Y4TI2T3T.js} +1 -1
- package/dist/{schema-ZG6ZKFRZ.js → schema-ZU2EU2VP.js} +1 -1
- package/dist/{specValidation-VHLGDEME.js → specValidation-2NHJT7TQ.js} +4 -1
- package/dist/theme.js +7 -2
- package/dist/{themeShapeRules-PW4BQHKL.js → themeShapeRules-G7UZX6GJ.js} +1 -1
- package/dist/types/core/annotate.d.ts +27 -2
- package/dist/types/core/annotateArms.d.ts +3 -1
- package/dist/types/core/annotateTargets.d.ts +4 -0
- package/dist/types/core/annotationOrigin.d.ts +13 -0
- package/dist/types/core/axis.d.ts +2 -2
- package/dist/types/core/charts/band/stacks.d.ts +7 -1
- package/dist/types/core/charts/bartable/types.d.ts +14 -1
- package/dist/types/core/charts/box/types.d.ts +3 -1
- package/dist/types/core/charts/choropleth/layout.d.ts +1 -5
- package/dist/types/core/charts/choropleth/types.d.ts +19 -0
- package/dist/types/core/charts/cohort/types.d.ts +16 -3
- package/dist/types/core/charts/column/model.d.ts +13 -0
- package/dist/types/core/charts/combo/layout.d.ts +7 -0
- package/dist/types/core/charts/creative/types.d.ts +21 -0
- package/dist/types/core/charts/dimswitch/compile.d.ts +15 -2
- package/dist/types/core/charts/dimswitch/types.d.ts +24 -1
- package/dist/types/core/charts/gantt/calendar.d.ts +24 -0
- package/dist/types/core/charts/gantt/columns.d.ts +56 -0
- package/dist/types/core/charts/gantt/layout.d.ts +8 -2
- package/dist/types/core/charts/gantt/model.d.ts +296 -0
- package/dist/types/core/charts/grid/metricStack.d.ts +9 -0
- package/dist/types/core/charts/grid/metricStackSchema.d.ts +13 -0
- package/dist/types/core/charts/grid/normalize.d.ts +5 -0
- package/dist/types/core/charts/grid/schema.d.ts +2 -2
- package/dist/types/core/charts/histogram/types.d.ts +8 -0
- package/dist/types/core/charts/likert/layout.d.ts +10 -8
- package/dist/types/core/charts/pareto/layout.d.ts +2 -0
- package/dist/types/core/charts/pvm/types.d.ts +10 -1
- package/dist/types/core/charts/pyramid/types.d.ts +3 -1
- package/dist/types/core/charts/sankey/types.d.ts +5 -1
- package/dist/types/core/charts/scatter/clamp.d.ts +2 -1
- package/dist/types/core/charts/scatter/model.d.ts +5 -0
- package/dist/types/core/charts/scatter/valueLines.d.ts +3 -1
- package/dist/types/core/charts/status/layout.d.ts +3 -0
- package/dist/types/core/charts/table/resolve.d.ts +22 -3
- package/dist/types/core/charts/table/view.d.ts +24 -1
- package/dist/types/core/claims/browser.d.ts +2 -0
- package/dist/types/core/claims/ids.d.ts +38 -0
- package/dist/types/core/deferred.d.ts +1 -0
- package/dist/types/core/doc/diagnostics.d.ts +3 -2
- package/dist/types/core/footer.d.ts +2 -0
- package/dist/types/core/formatSpec.d.ts +43 -14
- package/dist/types/core/frame.d.ts +26 -59
- package/dist/types/core/frameText.d.ts +203 -0
- package/dist/types/core/geo/types.d.ts +2 -0
- package/dist/types/core/geometry.d.ts +3 -1
- package/dist/types/core/label/categoryRow.d.ts +19 -2
- package/dist/types/core/label/solver.d.ts +23 -2
- package/dist/types/core/normalize/shared.d.ts +14 -2
- package/dist/types/core/notes.d.ts +15 -2
- package/dist/types/core/reading.d.ts +12 -1
- package/dist/types/core/registry.d.ts +4 -5
- package/dist/types/core/request.d.ts +7 -1
- package/dist/types/core/schema/capability.d.ts +32 -7
- package/dist/types/core/schema/generatedColumns.d.ts +168 -0
- package/dist/types/core/seriesIdentity.d.ts +4 -1
- package/dist/types/core/sizing.d.ts +32 -1
- package/dist/types/core/structureCounts.d.ts +3 -1
- package/dist/types/core/text.d.ts +16 -0
- package/dist/types/core/theme.d.ts +33 -4
- package/dist/types/core/themeGeometry.d.ts +9 -0
- package/dist/types/core/themeRules.d.ts +2 -0
- package/dist/types/core/timeAxis.d.ts +6 -1
- package/dist/types/core/types/annotations.d.ts +74 -4
- package/dist/types/core/types/diagram.d.ts +7 -0
- package/dist/types/core/types/options.d.ts +118 -15
- package/dist/types/core/types/scene.d.ts +30 -2
- package/dist/types/core/types/table.d.ts +27 -3
- package/dist/types/core/types/theme.d.ts +23 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/react/TableChart.d.ts +5 -0
- package/dist/types/react/barrelCharts.d.ts +16 -5
- package/dist/types/react/charts/butterfly.d.ts +2 -2
- package/dist/types/react/charts/dot.d.ts +7 -1
- package/dist/types/react/charts/pareto.d.ts +4 -1
- package/dist/types/react/charts/variance.d.ts +3 -1
- package/dist/types/react/hover/labelCard.d.ts +11 -2
- package/dist/types/react/prepare.d.ts +7 -1
- package/dist/types/theme.d.ts +2 -0
- package/dist/validate.js +23 -6
- package/docs/TELEMETRY.md +2 -2
- package/docs/manual.md +283 -65
- package/docs/reference/bar.md +15 -4
- package/docs/reference/bartable.md +17 -2
- package/docs/reference/box.md +15 -4
- package/docs/reference/bullet.md +21 -6
- package/docs/reference/butterfly.md +17 -6
- package/docs/reference/choropleth.md +16 -5
- package/docs/reference/cohort.md +25 -5
- package/docs/reference/column.md +19 -4
- package/docs/reference/combo.md +11 -5
- package/docs/reference/creative.md +17 -8
- package/docs/reference/diagram.md +6 -1
- package/docs/reference/dimswitch.md +71 -118
- package/docs/reference/dot.md +16 -7
- package/docs/reference/fixtures.md +94 -1
- package/docs/reference/funnel.md +14 -5
- package/docs/reference/gantt.md +17 -16
- package/docs/reference/grid.md +13 -3
- package/docs/reference/heatmap.md +16 -6
- package/docs/reference/histogram.md +2 -2
- package/docs/reference/kpi.md +5 -1
- package/docs/reference/likert.md +17 -4
- package/docs/reference/line.md +18 -5
- package/docs/reference/mekko.md +10 -5
- package/docs/reference/options.md +20 -15
- package/docs/reference/pareto.md +9 -5
- package/docs/reference/pie.md +9 -5
- package/docs/reference/pvm.md +16 -6
- package/docs/reference/pyramid.md +14 -4
- package/docs/reference/react.md +6 -7
- package/docs/reference/sankey.md +7 -3
- package/docs/reference/scatter.md +8 -4
- package/docs/reference/slope.md +15 -5
- package/docs/reference/sparkline.md +1 -1
- package/docs/reference/status.md +7 -1
- package/docs/reference/table.md +41 -110
- package/docs/reference/theme.md +12 -4
- package/docs/reference/tilemap.md +2 -4
- package/docs/reference/treemap.md +1 -1
- package/docs/reference/variance.md +12 -6
- package/docs/reference/waffle.md +1 -1
- package/docs/reference/warnings.md +1077 -0
- package/docs/reference/waterfall.md +20 -5
- package/docs/use-cases.md +25 -13
- package/llms.txt +19 -6
- package/package.json +18 -3
- package/dist/chunk-6364WO5D.js +0 -47
- package/dist/chunk-DQ7YMQVX.js +0 -26
- package/dist/chunk-EBB4PYBN.js +0 -24
- package/dist/chunk-FG5L2LUK.js +0 -89
- package/dist/chunk-IFQN4GKK.js +0 -1852
- package/dist/chunk-IRXVV65V.js +0 -24
- package/dist/chunk-JGFHNAHS.js +0 -22
- package/dist/chunk-JHWYG7V5.js +0 -24
- package/dist/chunk-M4SPKUZE.js +0 -7
- package/dist/chunk-O36WX56O.js +0 -13
- package/dist/chunk-QJWLNP64.js +0 -24
- package/dist/chunk-QZIHKQRH.js +0 -26
- package/dist/chunk-SE7MJ2LQ.js +0 -24
- package/dist/chunk-TXBO2LWM.js +0 -25
- package/dist/chunk-UPTXFTKH.js +0 -25
- package/dist/chunk-UREXN6WG.js +0 -25
- package/dist/chunk-UZLR25BW.js +0 -24
- package/dist/chunk-WIVFIVFZ.js +0 -27
- package/dist/chunk-WZL4EEBS.js +0 -11
- package/dist/chunk-XHRUXZD7.js +0 -28
- package/dist/chunk-ZWNRLIFT.js +0 -24
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BADGE_SECTION_ONLY,
|
|
3
|
-
BADGE_TEXT_EMPTY,
|
|
4
|
-
STATUS_VALUES,
|
|
5
|
-
STATUS_WORDS
|
|
6
|
-
} from "./chunk-7ADUVRG5.js";
|
|
7
|
-
import {
|
|
8
|
-
tableCellKey
|
|
9
|
-
} from "./chunk-M4SPKUZE.js";
|
|
10
1
|
import {
|
|
11
2
|
calcFlipsWithInputs,
|
|
12
3
|
calcIsLinear,
|
|
@@ -15,82 +6,52 @@ import {
|
|
|
15
6
|
columnOwnsFormat
|
|
16
7
|
} from "./chunk-X3YP4DUV.js";
|
|
17
8
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
SORT_CHEVRON_RESERVE,
|
|
24
|
-
authoredTrackWidth,
|
|
25
|
-
authoredWidthWarnings,
|
|
26
|
-
cellPadX,
|
|
27
|
-
changeLineFont,
|
|
28
|
-
collapsedHintWidth,
|
|
29
|
-
columnTracks,
|
|
30
|
-
encodingReserve,
|
|
31
|
-
frameFillExtras,
|
|
32
|
-
groupHeadingFaces,
|
|
33
|
-
groupHeadingFloors,
|
|
34
|
-
groupHeadingNeed,
|
|
35
|
-
groupHeadingWrap,
|
|
36
|
-
headerContentWidth,
|
|
37
|
-
headsFit,
|
|
38
|
-
inlineFont,
|
|
39
|
-
intrinsicColumnWidth,
|
|
40
|
-
kindFont,
|
|
41
|
-
labelIndents,
|
|
42
|
-
rowFont,
|
|
43
|
-
sectionChipFloor,
|
|
44
|
-
strongColumnFont,
|
|
45
|
-
tableFonts,
|
|
46
|
-
wrapFloorWidth
|
|
47
|
-
} from "./chunk-2YO4WRJN.js";
|
|
48
|
-
import {
|
|
49
|
-
toneTextPaint
|
|
50
|
-
} from "./chunk-BVYIKLQ5.js";
|
|
9
|
+
BADGE_SECTION_ONLY,
|
|
10
|
+
BADGE_TEXT_EMPTY,
|
|
11
|
+
STATUS_VALUES,
|
|
12
|
+
STATUS_WORDS
|
|
13
|
+
} from "./chunk-7ADUVRG5.js";
|
|
51
14
|
import {
|
|
52
|
-
|
|
53
|
-
} from "./chunk-
|
|
15
|
+
chartString as chartString2
|
|
16
|
+
} from "./chunk-PMT75APP.js";
|
|
54
17
|
import {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
} from "./chunk-Z2MGTKDR.js";
|
|
18
|
+
toneTextPaint
|
|
19
|
+
} from "./chunk-4ROZ4TFL.js";
|
|
58
20
|
import {
|
|
59
21
|
bandFor
|
|
60
22
|
} from "./chunk-263SZKIL.js";
|
|
61
|
-
import {
|
|
62
|
-
emptyIdRecord
|
|
63
|
-
} from "./chunk-LINZPU5D.js";
|
|
64
23
|
import {
|
|
65
24
|
closestKey
|
|
66
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-ZNRSYS76.js";
|
|
67
26
|
import {
|
|
68
27
|
caseInsensitiveValue,
|
|
69
|
-
|
|
70
|
-
fitsSize,
|
|
28
|
+
copyPlannedValue,
|
|
71
29
|
inputConversion,
|
|
72
|
-
|
|
73
|
-
|
|
30
|
+
memoExactInputKey,
|
|
31
|
+
ownPlanInput
|
|
32
|
+
} from "./chunk-ETRAPN5G.js";
|
|
74
33
|
import {
|
|
75
|
-
clamp,
|
|
76
|
-
cleanDiff,
|
|
77
|
-
cleanSum,
|
|
78
34
|
formatDate,
|
|
79
35
|
isNumberAlone,
|
|
80
36
|
numericVariant,
|
|
81
37
|
readDateFormat,
|
|
82
38
|
unitPrinted
|
|
83
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-I5VDW2XZ.js";
|
|
84
40
|
import {
|
|
85
41
|
disclosureNote,
|
|
86
|
-
disclosuresShown
|
|
87
|
-
|
|
88
|
-
|
|
42
|
+
disclosuresShown
|
|
43
|
+
} from "./chunk-DZYTXZNS.js";
|
|
44
|
+
import {
|
|
45
|
+
emptyIdRecord
|
|
46
|
+
} from "./chunk-LINZPU5D.js";
|
|
89
47
|
import {
|
|
90
48
|
AUTOMATIC_FORMAT,
|
|
49
|
+
LABEL_ONLY_ROW,
|
|
91
50
|
MAGNITUDE_DIVISOR,
|
|
51
|
+
MAGNITUDE_FIGURES,
|
|
92
52
|
MAGNITUDE_GROUP,
|
|
93
53
|
MAGNITUDE_LABEL,
|
|
54
|
+
compileNumberFormat,
|
|
94
55
|
differenceExample,
|
|
95
56
|
effectiveScale,
|
|
96
57
|
formatWithSpec,
|
|
@@ -100,13 +61,16 @@ import {
|
|
|
100
61
|
roundedNumber,
|
|
101
62
|
sameUnit,
|
|
102
63
|
specUnitKind,
|
|
64
|
+
unitMagnitude,
|
|
103
65
|
unitOfSpec,
|
|
104
66
|
withChartMarks
|
|
105
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-Z6DUNKFU.js";
|
|
106
68
|
import {
|
|
107
69
|
MINUS,
|
|
108
70
|
chartNumberMarks,
|
|
71
|
+
chartString,
|
|
109
72
|
currencyWholeNumbers,
|
|
73
|
+
currentSmallValues,
|
|
110
74
|
formatExactNumber,
|
|
111
75
|
intervalText,
|
|
112
76
|
localeStrings,
|
|
@@ -116,7 +80,9 @@ import {
|
|
|
116
80
|
zeroLifts
|
|
117
81
|
} from "./chunk-MSYTF3DZ.js";
|
|
118
82
|
import {
|
|
119
|
-
|
|
83
|
+
clamp,
|
|
84
|
+
cleanDiff,
|
|
85
|
+
cleanSum,
|
|
120
86
|
contrastInkPaint,
|
|
121
87
|
groundTextPaint,
|
|
122
88
|
markRolePaint,
|
|
@@ -128,28 +94,37 @@ import {
|
|
|
128
94
|
sequentialShare,
|
|
129
95
|
signedFillPaint,
|
|
130
96
|
tableEmphasis,
|
|
131
|
-
tableHeadFloorPx
|
|
132
|
-
|
|
133
|
-
} from "./chunk-HJRNBKIT.js";
|
|
97
|
+
tableHeadFloorPx
|
|
98
|
+
} from "./chunk-TX5FSNAU.js";
|
|
134
99
|
import {
|
|
135
100
|
DEFAULT_TARGET,
|
|
136
101
|
NormalizeError,
|
|
137
|
-
TARGET_SIZE,
|
|
138
|
-
resolveCanvasOptions,
|
|
139
102
|
resolveHighlight,
|
|
140
|
-
resolveSize,
|
|
141
103
|
resolveSubtitle,
|
|
142
104
|
scaleTextPx,
|
|
143
105
|
targetFloorsPx
|
|
144
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-RJICOOB3.js";
|
|
145
107
|
import {
|
|
146
108
|
maxOf,
|
|
147
109
|
minOf,
|
|
148
110
|
pushAll
|
|
149
111
|
} from "./chunk-WYJEOMNY.js";
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
112
|
+
|
|
113
|
+
// src/core/charts/table/cellKey.ts
|
|
114
|
+
var tableCellKey = (rowId, colId) => `${rowId.length}:${rowId}:${colId}`, ESCAPED = /[%:]/, scenePart = (id) => ESCAPED.test(id) ? id.replaceAll("%", "%25").replaceAll(":", "%3A") : id, tableCellNodeId = (part, rowId, colId, lineId) => lineId === void 0 ? `${part}:${scenePart(rowId)}:${scenePart(colId)}` : `${part}:${scenePart(rowId)}:${scenePart(colId)}:${scenePart(lineId)}`;
|
|
115
|
+
function printsInCell(record) {
|
|
116
|
+
switch (record.kind) {
|
|
117
|
+
case "calc":
|
|
118
|
+
case "aggregate":
|
|
119
|
+
return !0;
|
|
120
|
+
case "rounding-adjustment":
|
|
121
|
+
return record.op === "share-reconcile";
|
|
122
|
+
case "reconciliation":
|
|
123
|
+
return record.printedInCell === !0;
|
|
124
|
+
default:
|
|
125
|
+
return !1;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
153
128
|
|
|
154
129
|
// src/core/charts/table/ladder.ts
|
|
155
130
|
var COHORT_GRID = {
|
|
@@ -263,7 +238,9 @@ function assertTableRankOptions(options) {
|
|
|
263
238
|
"table-sort-segments-unsupported",
|
|
264
239
|
"options.sort.segments",
|
|
265
240
|
`table has no segments; sort.segments '${segments}' cannot reorder columns without breaking groups and accounting`,
|
|
266
|
-
"drop sort.segments, or sort rows with sort.categories ('sheet', 'reverse', 'asc', 'desc')"
|
|
241
|
+
"drop sort.segments, or sort rows with sort.categories ('sheet', 'reverse', 'asc', 'desc')",
|
|
242
|
+
void 0,
|
|
243
|
+
["options", "sort", "segments"]
|
|
267
244
|
);
|
|
268
245
|
}
|
|
269
246
|
function ranksAsData(row) {
|
|
@@ -278,13 +255,15 @@ function additiveRankKey(row, columns) {
|
|
|
278
255
|
}
|
|
279
256
|
return counted ? sum : null;
|
|
280
257
|
}
|
|
281
|
-
function requireAdditiveRanking(columns, rows, path, action) {
|
|
258
|
+
function requireAdditiveRanking(columns, rows, path, action, segments) {
|
|
282
259
|
if (!rows.some((row) => ranksAsData(row) && additiveRankKey(row, columns) !== null))
|
|
283
260
|
throw new NormalizeError(
|
|
284
261
|
"table-rank-unranked",
|
|
285
262
|
path,
|
|
286
263
|
`${action} needs at least one additive value column with a numeric cell; text, status and non-aggregating columns are not ranking keys`,
|
|
287
|
-
"add a value column with aggregate 'sum', or drop the ranking option"
|
|
264
|
+
"add a value column with aggregate 'sum', or drop the ranking option",
|
|
265
|
+
void 0,
|
|
266
|
+
segments
|
|
288
267
|
);
|
|
289
268
|
}
|
|
290
269
|
function authoredById(rows) {
|
|
@@ -326,16 +305,8 @@ function foldSiblings(parentId, groups, original, table, topN, used, generatedOt
|
|
|
326
305
|
let rebuilt = (groups.get(parentId) ?? []).map(
|
|
327
306
|
(row) => toAuthored(row, original.get(row.id), foldSiblings(row.id, groups, original, table, topN, used, generatedOthers))
|
|
328
307
|
), dataIdx = rebuilt.map((_, index) => index).filter((index) => ranksAsData(original.get(rebuilt[index].id)));
|
|
329
|
-
if (dataIdx.length <= topN.n) return rebuilt;
|
|
330
|
-
let dataRows = dataIdx.map((index) => rebuilt[index])
|
|
331
|
-
if (dataRows.some((row) => (original.get(row.id)?.relation ?? "additive") !== "additive"))
|
|
332
|
-
throw new NormalizeError(
|
|
333
|
-
"table-topn-relation-unsupported",
|
|
334
|
-
"options.topN",
|
|
335
|
-
"topN cannot regroup ofWhich or displayOnly rows; nesting them under Others would change whose total they annotate",
|
|
336
|
-
"keep those rows as authored siblings, or drop options.topN"
|
|
337
|
-
);
|
|
338
|
-
let keys = dataRows.map((row) => {
|
|
308
|
+
if (dataIdx.length <= topN.n && topN.threshold === void 0) return rebuilt;
|
|
309
|
+
let dataRows = dataIdx.map((index) => rebuilt[index]), keys = dataRows.map((row) => {
|
|
339
310
|
let resolved = table.rows.find((candidate) => candidate.id === row.id);
|
|
340
311
|
return Math.abs(additiveRankKey(resolved, table.columns) ?? 0);
|
|
341
312
|
}), ranked = dataRows.map((_, index) => index).sort((a, b) => keys[b] - keys[a] || a - b), keep = new Set(ranked.slice(0, Math.max(1, topN.n)));
|
|
@@ -346,13 +317,24 @@ function foldSiblings(parentId, groups, original, table, topN, used, generatedOt
|
|
|
346
317
|
}
|
|
347
318
|
let dropped = dataRows.filter((_, index) => !keep.has(index));
|
|
348
319
|
if (dropped.length === 0) return rebuilt;
|
|
320
|
+
if (dataRows.some((row) => (original.get(row.id)?.relation ?? "additive") !== "additive"))
|
|
321
|
+
throw new NormalizeError(
|
|
322
|
+
"table-topn-relation-unsupported",
|
|
323
|
+
"options.topN",
|
|
324
|
+
"topN cannot regroup ofWhich or displayOnly rows; nesting them under Others would change whose total they annotate",
|
|
325
|
+
"keep those rows as authored siblings, or drop options.topN",
|
|
326
|
+
void 0,
|
|
327
|
+
["options", "topN"]
|
|
328
|
+
);
|
|
349
329
|
if (topN.rest === !1) {
|
|
350
330
|
if (parentId !== void 0)
|
|
351
331
|
throw new NormalizeError(
|
|
352
332
|
"table-topn-rest-required",
|
|
353
333
|
"options.topN.rest",
|
|
354
334
|
"topN.rest false would drop sibling summands and change the parent total; tables keep accounting by nesting the rest under Others",
|
|
355
|
-
"omit topN.rest (defaults to true), or flatten the hierarchy before omitting rows"
|
|
335
|
+
"omit topN.rest (defaults to true), or flatten the hierarchy before omitting rows",
|
|
336
|
+
void 0,
|
|
337
|
+
["options", "topN", "rest"]
|
|
356
338
|
);
|
|
357
339
|
let keptIds2 = new Set(dataRows.filter((_, index) => keep.has(index)).map((row) => row.id));
|
|
358
340
|
return rebuilt.filter((row, index) => dataIdx.includes(index) ? keptIds2.has(row.id) : !0);
|
|
@@ -370,70 +352,20 @@ function foldSiblings(parentId, groups, original, table, topN, used, generatedOt
|
|
|
370
352
|
function foldTableTopN(data, ranked, options) {
|
|
371
353
|
let topN = options.topN, generatedOthers = /* @__PURE__ */ new Set();
|
|
372
354
|
if (!topN || topN.n <= 0) return { data, generatedOthers };
|
|
373
|
-
requireAdditiveRanking(ranked.columns, ranked.rows, "options.topN", "topN");
|
|
355
|
+
requireAdditiveRanking(ranked.columns, ranked.rows, "options.topN", "topN", ["options", "topN"]);
|
|
374
356
|
let original = authoredById(data.rows), folded = foldSiblings(
|
|
375
357
|
void 0,
|
|
376
358
|
siblingGroups(ranked),
|
|
377
359
|
original,
|
|
378
360
|
ranked,
|
|
379
|
-
|
|
361
|
+
// The rest row takes the table language's word unless the author names it.
|
|
362
|
+
{ ...topN, restLabel: topN.restLabel ?? localeStrings(options.locale?.language).others },
|
|
380
363
|
usedIds(data.rows),
|
|
381
364
|
generatedOthers
|
|
382
365
|
);
|
|
383
366
|
return { data: { ...data, rows: folded }, generatedOthers };
|
|
384
367
|
}
|
|
385
368
|
|
|
386
|
-
// src/core/charts/table/encodings/arrow.ts
|
|
387
|
-
var ARROW_GAP = 4, printedNumber = (cell) => cell.negated ? -cell.raw : cell.raw;
|
|
388
|
-
function arrowGlyph(value, maxAbs, scale) {
|
|
389
|
-
let share = scale === "absolute" ? value / 100 : maxAbs > 0 ? value / maxAbs : 0;
|
|
390
|
-
return share > 0.1 ? "\u2191" : share > 0.02 ? "\u2197" : share >= -0.02 ? "\u2192" : share >= -0.1 ? "\u2198" : "\u2193";
|
|
391
|
-
}
|
|
392
|
-
var ARROW_KEY = [
|
|
393
|
-
["\u2191", "rise over 10%", "rise over 10% of the largest change"],
|
|
394
|
-
["\u2197", "rise over 2%, up to 10%", "rise over 2%, up to 10% of the largest change"],
|
|
395
|
-
["\u2192", "within 2%", "within 2% of the largest change"],
|
|
396
|
-
["\u2198", "fall over 2%, up to 10%", "fall over 2%, up to 10% of the largest change"],
|
|
397
|
-
["\u2193", "fall over 10%", "fall over 10% of the largest change"]
|
|
398
|
-
], ARROW_FOOTNOTE = "An arrow's angle on a relative scale compares the change with the largest change in its column.";
|
|
399
|
-
function arrowKey(columns, rows) {
|
|
400
|
-
let drawn = { absolute: /* @__PURE__ */ new Set(), relative: /* @__PURE__ */ new Set() };
|
|
401
|
-
for (let column of columns) {
|
|
402
|
-
if (column.cellEncoding?.type !== "arrow" || column.kind !== "computed" || !column.polarity) continue;
|
|
403
|
-
let scale = column.cellEncoding.scale, values = rows.flatMap((row) => {
|
|
404
|
-
let cell = row.cells[column.id];
|
|
405
|
-
return cell?.state === "value" && typeof cell.raw == "number" ? [printedNumber(cell)] : [];
|
|
406
|
-
}), maxAbs = Math.max(0, maxOf(values.map(Math.abs)));
|
|
407
|
-
for (let value of values) drawn[scale].add(arrowGlyph(value, maxAbs, scale));
|
|
408
|
-
}
|
|
409
|
-
return ["absolute", "relative"].flatMap((scale) => ARROW_KEY.filter(([glyph]) => drawn[scale].has(glyph)).map(([glyph, absolute, relative]) => ({ id: scale === "absolute" ? `arrowKey:${glyph}` : `arrowKey:relative:${glyph}`, label: scale === "absolute" ? absolute : relative, glyph })));
|
|
410
|
-
}
|
|
411
|
-
function emitArrow(context, metrics) {
|
|
412
|
-
if (context.cell.state !== "value" || typeof context.cell.raw != "number") return [];
|
|
413
|
-
let value = printedNumber(context.cell), glyph = arrowGlyph(value, metrics.maxAbs, metrics.scale), font = metrics.font, glyphWidth = context.measure(glyph, font).width, valueWidth = context.measure(context.cell.displayed, metrics.font).width, valueLeft = metrics.valueX - valueWidth, available = valueLeft - context.box.x - ARROW_GAP;
|
|
414
|
-
if (available <= 0) return [];
|
|
415
|
-
if (glyphWidth > available) {
|
|
416
|
-
let floor = Math.min(font.size, readerFloorPx(metrics.target ?? DEFAULT_TARGET, "label", metrics.textScale));
|
|
417
|
-
if (font = { ...font, size: Math.max(floor, font.size * available / glyphWidth) }, glyphWidth = context.measure(glyph, font).width, glyphWidth > available) return [];
|
|
418
|
-
}
|
|
419
|
-
return [
|
|
420
|
-
{
|
|
421
|
-
t: "text",
|
|
422
|
-
typeRole: "label",
|
|
423
|
-
id: context.nodeId("arrow"),
|
|
424
|
-
x: valueLeft - ARROW_GAP - glyphWidth,
|
|
425
|
-
y: context.box.y + (context.box.h - context.measure(glyph, font).height) / 2,
|
|
426
|
-
lines: [glyph],
|
|
427
|
-
align: "start",
|
|
428
|
-
font,
|
|
429
|
-
// The glyph prints in its figure's text colour, as the grid's arrow inherits it.
|
|
430
|
-
ink: context.cell.tone === "neutral" ? { token: "neutral" } : context.toneInk ?? toneTextPaint(context.theme, context.cell.tone, context.palette),
|
|
431
|
-
owner: context.owner,
|
|
432
|
-
part: "tableArrow"
|
|
433
|
-
}
|
|
434
|
-
];
|
|
435
|
-
}
|
|
436
|
-
|
|
437
369
|
// src/core/charts/table/encodings/heat.ts
|
|
438
370
|
function heatRanges(columns, rows) {
|
|
439
371
|
let ranges = /* @__PURE__ */ new Map();
|
|
@@ -508,7 +440,7 @@ function heatKey(columns, ranges, theme, strings, language) {
|
|
|
508
440
|
for (let column of columns) {
|
|
509
441
|
let encoding = column.cellEncoding;
|
|
510
442
|
if (encoding?.type !== "heat") continue;
|
|
511
|
-
let entries = encoding.scale === "status" ? statusEntries ??= statusKey(columns, ranges, encoding, strings) : laneHeatKey([column], ranges, theme, strings, language);
|
|
443
|
+
let entries = encoding.scale === "status" ? statusEntries ??= statusKey(columns, ranges, encoding, strings, language) : laneHeatKey([column], ranges, theme, strings, language);
|
|
512
444
|
if (entries.length === 0) continue;
|
|
513
445
|
let format = column.format === void 0 ? void 0 : parseFormatExample(column.format), identity = JSON.stringify(encoding.scale === "status" ? entries : [
|
|
514
446
|
encoding.scale,
|
|
@@ -527,19 +459,19 @@ function heatKey(columns, ranges, theme, strings, language) {
|
|
|
527
459
|
function laneHeatKey(columns, ranges, theme, strings, language) {
|
|
528
460
|
for (let column of columns) {
|
|
529
461
|
let encoding = column.cellEncoding;
|
|
530
|
-
if (encoding?.type === "heat" && encoding.scale === "status") return statusKey(columns, ranges, encoding, strings);
|
|
462
|
+
if (encoding?.type === "heat" && encoding.scale === "status") return statusKey(columns, ranges, encoding, strings, language);
|
|
531
463
|
if (encoding?.type !== "heat" || encoding.scale !== "absolute" && encoding.scale !== "diverging") continue;
|
|
532
464
|
let diverging = encoding.scale === "diverging";
|
|
533
465
|
if (diverging && encoding.bins === void 0 && (encoding.steps ?? 0) < 2) continue;
|
|
534
466
|
let edges = encoding.bins ?? (diverging ? DIVERGING_BINS : []);
|
|
535
467
|
if (edges.length === 0) continue;
|
|
536
|
-
let steps = encoding.steps ?? edges.length + 1, spec = column.format === void 0 ? void 0 : withChartMarks(diverging ? { ...parseFormatExample(differenceExample(column.format)), signed: !1 } : parseFormatExample(column.format), language), text = spec === void 0 ? (value) => formatExactNumber(value, language) : (value) => formatWithSpec(value, spec), band = (index, last) => last ?
|
|
468
|
+
let steps = encoding.steps ?? edges.length + 1, spec = column.format === void 0 ? void 0 : withChartMarks(diverging ? { ...parseFormatExample(differenceExample(column.format)), signed: !1 } : parseFormatExample(column.format), language), text = spec === void 0 ? (value) => formatExactNumber(value, language) : (value) => formatWithSpec(value, spec), words = { locale: { language } }, band = (index, last) => last ? chartString2(words, "tableHeatAndMore", { v1: text(edges[index - 1]) }) : index === 0 ? chartString2(words, "tableHeatUnder", { v1: text(edges[0]) }) : intervalText(text(edges[index - 1]), text(edges[index]), !1, words), swatch = (id, label, fill) => ({ id: `heatKey:${id}`, label, fill });
|
|
537
469
|
if (diverging) {
|
|
538
470
|
let sides = edges.map((_, index) => ({ index: index + 1, label: band(index + 1, index === edges.length - 1) }));
|
|
539
471
|
return [
|
|
540
|
-
...[...sides].reverse().map(({ index, label }) => swatch(`below${index}`,
|
|
541
|
-
swatch("none",
|
|
542
|
-
...sides.map(({ index, label }) => swatch(`above${index}`,
|
|
472
|
+
...[...sides].reverse().map(({ index, label }) => swatch(`below${index}`, chartString2(words, "tableHeatBelowSide", { v1: label }), bandPaint(theme, encoding, steps, index, badSide(!0, column.polarity)).fill)),
|
|
473
|
+
swatch("none", chartString2(words, "tableHeatEitherWay", { v1: text(edges[0]) }), { token: "background" }),
|
|
474
|
+
...sides.map(({ index, label }) => swatch(`above${index}`, chartString2(words, "tableHeatAboveSide", { v1: label }), bandPaint(theme, encoding, steps, index, badSide(!1, column.polarity)).fill))
|
|
543
475
|
];
|
|
544
476
|
}
|
|
545
477
|
let count = Math.min(steps, edges.length + 1);
|
|
@@ -564,15 +496,15 @@ function statusLanes(columns) {
|
|
|
564
496
|
function centreNoun(range) {
|
|
565
497
|
return range?.totalCentre === !0 ? "total" : "average";
|
|
566
498
|
}
|
|
567
|
-
function statusKey(columns, ranges, encoding, strings) {
|
|
568
|
-
let lanes = statusLanes(columns), lower = lanes.length > 0 && lanes.every((column) => column.polarity === "lowerIsBetter"),
|
|
499
|
+
function statusKey(columns, ranges, encoding, strings, language) {
|
|
500
|
+
let lanes = statusLanes(columns), lower = lanes.length > 0 && lanes.every((column) => column.polarity === "lowerIsBetter"), total = centreNoun(ranges.get(lanes[0].id)) === "total", words = { locale: { language } }, swatch = (id, label, band) => ({ id: `heatKey:${id}`, label, fill: statusFill(band, encoding.alpha) });
|
|
569
501
|
return [
|
|
570
|
-
swatch("below", strings?.heatBelow ??
|
|
571
|
-
swatch("around", strings?.heatAround ??
|
|
572
|
-
swatch("above", strings?.heatAbove ??
|
|
502
|
+
swatch("below", strings?.heatBelow ?? chartString2(words, total ? "tableHeatBelowTotal" : "tableHeatBelowAverage"), lower ? "good" : "bad"),
|
|
503
|
+
swatch("around", strings?.heatAround ?? chartString2(words, total ? "tableHeatAroundTotal" : "tableHeatAroundAverage"), "warn"),
|
|
504
|
+
swatch("above", strings?.heatAbove ?? chartString2(words, total ? "tableHeatAboveTotal" : "tableHeatAboveAverage"), lower ? "bad" : "good")
|
|
573
505
|
];
|
|
574
506
|
}
|
|
575
|
-
function statusDirectionNote(columns, ranges, colorblindSafe = !1) {
|
|
507
|
+
function statusDirectionNote(columns, ranges, colorblindSafe = !1, language) {
|
|
576
508
|
let lanes = statusLanes(columns), lower = lanes.filter((column) => column.polarity === "lowerIsBetter");
|
|
577
509
|
if (lower.length === 0 || lower.length === lanes.length) return;
|
|
578
510
|
let byNoun = /* @__PURE__ */ new Map();
|
|
@@ -580,8 +512,8 @@ function statusDirectionNote(columns, ranges, colorblindSafe = !1) {
|
|
|
580
512
|
let noun = centreNoun(ranges.get(column.id));
|
|
581
513
|
byNoun.set(noun, [...byNoun.get(noun) ?? [], column.label]);
|
|
582
514
|
}
|
|
583
|
-
let where = byNoun.size === 1 ?
|
|
584
|
-
return
|
|
515
|
+
let words = { locale: { language } }, below = (noun) => chartString2(words, noun === "total" ? "tableBelowTotal" : "tableBelowAverage"), where = byNoun.size === 1 ? below([...byNoun.keys()][0]) : [...byNoun].map(([noun, labels]) => chartString2(words, "tableBelowFor", { where: below(noun), columns: labels.join(", ") })).join(` ${chartString(words, "and")} `);
|
|
516
|
+
return chartString2(words, colorblindSafe ? "tableLowerBetterGood" : "tableLowerBetterGreen", { columns: lower.map((column) => column.label).join(", "), where });
|
|
585
517
|
}
|
|
586
518
|
function heatPaint(context, range, options = {}) {
|
|
587
519
|
let value = context.cell.raw, alpha = options.alpha ?? DEFAULT_ALPHA, excludeTotals = options.excludeTotals ?? !0;
|
|
@@ -651,7 +583,7 @@ function stateGlyphs(theme, notApplicable = STATE_GLYPHS.na) {
|
|
|
651
583
|
open: STATE_GLYPHS.open
|
|
652
584
|
};
|
|
653
585
|
}
|
|
654
|
-
var PERCENT_DELTA_CAP = 999,
|
|
586
|
+
var PERCENT_DELTA_CAP = 999, PARTIAL_MARKER = "\u2020", partialFootnote = (language, marker = PARTIAL_MARKER) => chartString2({ locale: { language } }, "tablePartialNote", { marker }), suppressedFootnote = (language) => chartString2({ locale: { language } }, "tableSuppressedNote", { marker: SUPPRESSED_MARKER }), STATE_PRECEDENCE = ["suppressed", "open", "nm", "na", "missing"], STATE_REASON = {
|
|
655
587
|
missing: "missing",
|
|
656
588
|
na: "not applicable (n/a)",
|
|
657
589
|
nm: "not meaningful (n.m.)",
|
|
@@ -680,11 +612,130 @@ function columnHeaderAffix(column) {
|
|
|
680
612
|
let affix = [column.scenario, column.unitLabel].filter(Boolean).join(", ");
|
|
681
613
|
return `${affix ? ` (${affix})` : ""}${column.partial ? ` ${PARTIAL_MARKER}` : ""}`;
|
|
682
614
|
}
|
|
615
|
+
var preparedData = /* @__PURE__ */ new WeakMap(), sharedPreparedData = /* @__PURE__ */ new Map(), MAX_SHARED_KEY_CHARS = 128 * 1024, MAX_SHARED_TOTAL_CHARS = 2 * 1024 * 1024, sharedKeyChars = 0, modelSymbols = new Map([AUTOMATIC_FORMAT, MAGNITUDE_GROUP, MAGNITUDE_FIGURES, ZERO_LIFT, LABEL_ONLY_ROW].map((symbol, index) => [symbol, index]));
|
|
616
|
+
function modelContentKey(value) {
|
|
617
|
+
let parts = [], seen = /* @__PURE__ */ new Map(), active = /* @__PURE__ */ new Set(), supported = !0, write = (value2) => {
|
|
618
|
+
if (!supported) return;
|
|
619
|
+
if (value2 === null) {
|
|
620
|
+
parts.push("null;");
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
switch (typeof value2) {
|
|
624
|
+
case "undefined":
|
|
625
|
+
parts.push("undefined;");
|
|
626
|
+
return;
|
|
627
|
+
case "string":
|
|
628
|
+
parts.push("s", JSON.stringify(value2));
|
|
629
|
+
return;
|
|
630
|
+
case "boolean":
|
|
631
|
+
parts.push(value2 ? "true;" : "false;");
|
|
632
|
+
return;
|
|
633
|
+
case "number":
|
|
634
|
+
parts.push("n", Object.is(value2, -0) ? "-0" : String(value2), ";");
|
|
635
|
+
return;
|
|
636
|
+
case "object":
|
|
637
|
+
break;
|
|
638
|
+
default:
|
|
639
|
+
supported = !1;
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
let prototype = Object.getPrototypeOf(value2), array = Array.isArray(value2);
|
|
643
|
+
if (!array && prototype !== Object.prototype && prototype !== null) {
|
|
644
|
+
supported = !1;
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
let known = seen.get(value2);
|
|
648
|
+
if (known !== void 0) {
|
|
649
|
+
if (active.has(value2)) {
|
|
650
|
+
supported = !1;
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
parts.push("ref", String(known), ";");
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
seen.set(value2, seen.size), active.add(value2), parts.push(array ? `array${value2.length}{` : prototype === null ? "record{" : "object{");
|
|
657
|
+
for (let key of Reflect.ownKeys(value2)) {
|
|
658
|
+
if (array && key === "length") continue;
|
|
659
|
+
if (!("value" in Object.getOwnPropertyDescriptor(value2, key))) {
|
|
660
|
+
supported = !1;
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
if (typeof key == "symbol") {
|
|
664
|
+
let index = modelSymbols.get(key);
|
|
665
|
+
if (index === void 0) {
|
|
666
|
+
supported = !1;
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
parts.push("symbol", String(index), ":");
|
|
670
|
+
} else parts.push("key", JSON.stringify(key), ":");
|
|
671
|
+
write(Reflect.get(value2, key));
|
|
672
|
+
}
|
|
673
|
+
parts.push("}"), active.delete(value2);
|
|
674
|
+
};
|
|
675
|
+
return write(value), supported ? parts.join("") : void 0;
|
|
676
|
+
}
|
|
677
|
+
function prepareTableData(data, options = {}, magnitudeSource = data) {
|
|
678
|
+
return withSmallValues(options.smallValues, () => {
|
|
679
|
+
let theme = resolveTheme(options.theme), semantic = {
|
|
680
|
+
locale: options.locale,
|
|
681
|
+
strings: options.strings,
|
|
682
|
+
variant: options.variant,
|
|
683
|
+
density: isCohortDensity(options.density ?? "regular"),
|
|
684
|
+
nulls: options.nulls,
|
|
685
|
+
levelOffset: options.levelOffset,
|
|
686
|
+
columnHeads: options.columnHeads,
|
|
687
|
+
disclosures: disclosuresShown(options),
|
|
688
|
+
highlight: options.highlight,
|
|
689
|
+
sort: options.sort,
|
|
690
|
+
topN: options.topN,
|
|
691
|
+
format: options.format,
|
|
692
|
+
unit: options.unit,
|
|
693
|
+
magnitude: options.magnitude,
|
|
694
|
+
target: options.target,
|
|
695
|
+
subtitle: options.subtitle,
|
|
696
|
+
unitShown: options.unitShown,
|
|
697
|
+
encodings: options.encodings,
|
|
698
|
+
signs: options.signs,
|
|
699
|
+
driverTones: options.driverTones,
|
|
700
|
+
judgements: options.judgements,
|
|
701
|
+
totalPosition: options.totalPosition,
|
|
702
|
+
colorblindSafe: options.colorblindSafe,
|
|
703
|
+
theme: { glyphs: theme.table?.glyphs, noPrevious: theme.table?.noPrevious, dataGap: theme.table?.dataGap },
|
|
704
|
+
// Top-N ranks the complete formatted table before folding it. Its inner resolution must retain the current precision.
|
|
705
|
+
...options.topN ? { columnVisibility: options.columnVisibility, [ZERO_LIFT]: options[ZERO_LIFT] } : {}
|
|
706
|
+
}, dataContent = memoExactInputKey(data, modelContentKey), magnitudeContent = magnitudeSource === data ? "same;" : memoExactInputKey(magnitudeSource, modelContentKey), semanticContent = modelContentKey([semantic, currentSmallValues()]), content = dataContent === void 0 || magnitudeContent === void 0 || semanticContent === void 0 ? void 0 : dataContent.length + ":" + dataContent + magnitudeContent.length + ":" + magnitudeContent + semanticContent, key = content, models = key === void 0 ? void 0 : preparedData.get(data);
|
|
707
|
+
!models && key !== void 0 && preparedData.set(data, models = /* @__PURE__ */ new Map());
|
|
708
|
+
let model = key === void 0 ? void 0 : models.get(key) ?? (content === void 0 ? void 0 : sharedPreparedData.get(content));
|
|
709
|
+
if (!model) {
|
|
710
|
+
let before = zeroLifts.count;
|
|
711
|
+
try {
|
|
712
|
+
let owned = copyPlannedValue(data);
|
|
713
|
+
ownPlanInput(owned);
|
|
714
|
+
let { theme: authoredTheme, measure: _measure, ...kept } = options;
|
|
715
|
+
model = compileTableData(owned, { ...copyPlannedValue(kept), theme: authoredTheme }, magnitudeSource === data ? owned : copyPlannedValue(magnitudeSource)), ownPlanInput(model);
|
|
716
|
+
} finally {
|
|
717
|
+
zeroLifts.count = before;
|
|
718
|
+
}
|
|
719
|
+
if (content !== void 0 && content.length <= MAX_SHARED_KEY_CHARS) {
|
|
720
|
+
for (sharedKeyChars += content.length; sharedPreparedData.size >= 32 || sharedKeyChars > MAX_SHARED_TOTAL_CHARS; ) {
|
|
721
|
+
let oldest = sharedPreparedData.keys().next().value;
|
|
722
|
+
sharedKeyChars -= oldest.length, sharedPreparedData.delete(oldest);
|
|
723
|
+
}
|
|
724
|
+
sharedPreparedData.set(content, model);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
return key !== void 0 && !models.has(key) && (models.size >= 32 && models.delete(models.keys().next().value), models.set(key, model)), model;
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
function resolvePreparedTable(model, options = {}) {
|
|
731
|
+
return withSmallValues(options.smallValues, () => model.resolve(options));
|
|
732
|
+
}
|
|
683
733
|
function resolveTable(data, options = {}, magnitudeSource = data) {
|
|
684
|
-
|
|
734
|
+
let borrowed = resolvePreparedTable(prepareTableData(data, options, magnitudeSource), options), owned = copyPlannedValue(borrowed);
|
|
735
|
+
return evaluatedStates.set(owned, evaluatedStates.get(borrowed)), owned;
|
|
685
736
|
}
|
|
686
|
-
function
|
|
687
|
-
let
|
|
737
|
+
function compileTableData(data, options, magnitudeSource) {
|
|
738
|
+
let source = data, modelLiftsBefore = zeroLifts.count, formats = /* @__PURE__ */ new Map(), markedLanguage = options.locale?.language, parseFormatExample2 = (example) => {
|
|
688
739
|
let spec = formats.get(example);
|
|
689
740
|
return spec === void 0 && (spec = parseFormatExample(example), spec.locale = markedLanguage, formats.set(example, spec)), { ...spec };
|
|
690
741
|
}, warnings = [], datePatterns = /* @__PURE__ */ new Map();
|
|
@@ -749,14 +800,14 @@ function resolveTableIn(data, options, magnitudeSource) {
|
|
|
749
800
|
}
|
|
750
801
|
});
|
|
751
802
|
}
|
|
752
|
-
let records = [], autoFootnotes = /* @__PURE__ */ new Set(),
|
|
803
|
+
let records = [], autoFootnotes = /* @__PURE__ */ new Set(), partialColumnIds = /* @__PURE__ */ new Set(), headMarksPartial = disclosuresShown(options) && options.columnHeads !== !1, partialNote = partialFootnote(options.locale?.language, headMarksPartial ? PARTIAL_MARKER : options.strings?.incomplete ?? localeStrings(options.locale?.language).incomplete), highlightedRows = new Set(resolveHighlight(options.highlight));
|
|
753
804
|
assertTableRankOptions(options);
|
|
754
805
|
let folded = applyTableTopN(data, options);
|
|
755
806
|
data = folded.data;
|
|
756
807
|
let generatedOthers = folded.generatedOthers, language = presetLanguage(options.variant), theme = resolveTheme(options.theme), glyphs = stateGlyphs(theme, options.strings?.notApplicable ?? localeStrings(options.locale?.language).notApplicable), previousPlaceholders = theme?.table?.noPrevious === void 0, noPrevious = theme?.table?.noPrevious ?? "na", cohortDash = isCohortDensity(options.density ?? "regular") && theme?.table?.glyphs?.missing === void 0 ? "\u2013" : glyphs.missing, tableMissingGlyph = options.nulls === "blank" ? "" : cohortDash, dataGap = theme?.table?.dataGap ?? (theme?.table?.glyphs?.missing === void 0 ? "word" : "glyph"), gapWord = options.nulls !== "blank" && !isCohortDensity(options.density ?? "regular") && dataGap === "word", columns = data.columns, colById = /* @__PURE__ */ new Map();
|
|
757
808
|
for (let c of columns) {
|
|
758
809
|
if (colById.has(c.id))
|
|
759
|
-
throw new NormalizeError("duplicate-column-id", `columns[${c.id}]`, `duplicate column id '${c.id}'
|
|
810
|
+
throw new NormalizeError("duplicate-column-id", `columns[${c.id}]`, `duplicate column id '${c.id}'`, void 0, void 0, ["data", "columns", columns.indexOf(c), "id"]);
|
|
760
811
|
colById.set(c.id, c);
|
|
761
812
|
}
|
|
762
813
|
let rowLabelCols = columns.filter((c) => c.kind === "rowLabel");
|
|
@@ -764,10 +815,13 @@ function resolveTableIn(data, options, magnitudeSource) {
|
|
|
764
815
|
throw new NormalizeError(
|
|
765
816
|
"row-label-count",
|
|
766
817
|
"columns",
|
|
767
|
-
`exactly one rowLabel column required, found ${rowLabelCols.length}
|
|
818
|
+
`exactly one rowLabel column required, found ${rowLabelCols.length}`,
|
|
819
|
+
void 0,
|
|
820
|
+
void 0,
|
|
821
|
+
["data", "columns"]
|
|
768
822
|
);
|
|
769
823
|
validateGroups(data, colById), validateCalcRefs(columns, colById);
|
|
770
|
-
let toggleResolution = resolveColumnToggles(data, options, colById, warnings), flat = flattenRows(data.rows), flatById = new Map(flat.map((row) => [row.id, row])), calcRunIds = new Set(columns.filter((c) => c.kind === "value" || c.kind === "computed" && calcPreservesScale(c.calc)).map((c) => c.id)), predecessorIds = new Set(columns.filter((c) => c.kind === "value" || c.kind === "computed").map((c) => c.id));
|
|
824
|
+
let toggleResolution = resolveColumnToggles(data, { ...options, columnVisibility: void 0 }, colById, warnings), toggleWarningAt = warnings.length, flat = flattenRows(data.rows), flatById = new Map(flat.map((row) => [row.id, row])), calcRunIds = new Set(columns.filter((c) => c.kind === "value" || c.kind === "computed" && calcPreservesScale(c.calc)).map((c) => c.id)), predecessorIds = new Set(columns.filter((c) => c.kind === "value" || c.kind === "computed").map((c) => c.id));
|
|
771
825
|
if (![...calcRunIds].some((id) => predecessorIds.has(previousColumnInGroup(data.columnGroups ?? [], id) ?? "")))
|
|
772
826
|
for (let row of flat)
|
|
773
827
|
row.calc === void 0 || !calcRefs(row.calc).some((ref) => typeof ref != "string" && ref.previous === !0) || warnings.push({
|
|
@@ -787,7 +841,7 @@ function resolveTableIn(data, options, magnitudeSource) {
|
|
|
787
841
|
let kept = list.filter((child) => child.inline !== !0);
|
|
788
842
|
kept.length > 0 && treeChildrenOf.set(parentId, kept);
|
|
789
843
|
}
|
|
790
|
-
let expansion = resolveExpansion(flat, treeChildrenOf,
|
|
844
|
+
let expansionWarningAt = warnings.length, expansion = resolveExpansion(flat, treeChildrenOf, {}, warnings, generatedOthers), signTo = (row, stop) => contributionSignOf(row, (id) => flatById.get(id), stop), summandCache = /* @__PURE__ */ new Map(), summandsOf = (parentId) => {
|
|
791
845
|
let cached = summandCache.get(parentId);
|
|
792
846
|
if (cached) return cached;
|
|
793
847
|
let hoisted = [], dissolveSections = (pid) => {
|
|
@@ -902,13 +956,14 @@ function resolveTableIn(data, options, magnitudeSource) {
|
|
|
902
956
|
message: `'${row.id}'.'${col.id}' is '${glyphs[inherited]}' because ${blockers.map((b) => `child '${b.id}' is ${STATE_REASON[b.state]}`).join(", ")} (column nulls policy 'propagate')`
|
|
903
957
|
}), derived = { raw: null, state: inherited };
|
|
904
958
|
} else
|
|
905
|
-
blockers.length > 0 && (autoFootnotes.add(
|
|
959
|
+
blockers.length > 0 && (options.columnHeads !== !1 && autoFootnotes.add(partialNote), partialColumnIds.add(col.id)), derived = { raw: cleanSum(inputs.map((input) => input.value)), state: "value", ...blockers.length > 0 || partialKid ? { partial: !0, skipped: skippedKey([...blockers.map((b) => b.id), ...skippedKids]) } : {} };
|
|
906
960
|
let policy = row.totalPolicy ?? (authored.raw !== null ? "validate" : "derive");
|
|
907
961
|
return policy === "source" ? authored.raw === null ? derived : { raw: authored.raw, state: "value" } : policy === "validate" && authored.raw !== null ? (noSummands ? unauditedRecord() : records.push({
|
|
908
962
|
rowId: row.id,
|
|
909
963
|
colId: col.id,
|
|
910
964
|
op: "sum",
|
|
911
|
-
|
|
965
|
+
// A sum a missing child stops names that child, so the record recomputes to the nothing it states.
|
|
966
|
+
inputs: derived.raw === null ? [...inputs, ...blockers.map((b) => ({ rowId: b.id, colId: col.id, value: null, state: b.state }))] : inputs,
|
|
912
967
|
raw: derived.raw,
|
|
913
968
|
state: derived.state,
|
|
914
969
|
displayed: "",
|
|
@@ -951,7 +1006,7 @@ function resolveTableIn(data, options, magnitudeSource) {
|
|
|
951
1006
|
}, computedCols = columns.filter((c) => c.kind === "computed"), calcNotes = evaluateTableCalcs(flat, valueCols, computedCols, rawState, records, leafTotal, data.columnGroups ?? [], colById, noPrevious, (id) => {
|
|
952
1007
|
let row = flatById.get(id);
|
|
953
1008
|
return row ? signTo(row, null) : folded.hidden.get(id)?.sign ?? 1;
|
|
954
|
-
});
|
|
1009
|
+
}, source.rows);
|
|
955
1010
|
calcNotes.nearZero && autoFootnotes.add(options.strings?.nearZeroChange ?? localeStrings(options.locale?.language).nearZeroChange), calcNotes.mixedCoverage && autoFootnotes.add(options.strings?.mixedCoverage ?? localeStrings(options.locale?.language).mixedCoverage);
|
|
956
1011
|
for (let { scope, rowId, colId, cells } of calcNotes.negativeBase) {
|
|
957
1012
|
let more = cells > 1 ? ` and ${cells - 1} more` : "";
|
|
@@ -962,548 +1017,651 @@ function resolveTableIn(data, options, magnitudeSource) {
|
|
|
962
1017
|
owner: { rowId, colId }
|
|
963
1018
|
});
|
|
964
1019
|
}
|
|
965
|
-
let
|
|
966
|
-
|
|
967
|
-
let
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
let spec = parseFormatExample2(example);
|
|
974
|
-
return forcedMagnitude !== void 0 && scales(sourceExample) && forceScale(spec, forcedMagnitude, locale.thousands), spec;
|
|
975
|
-
}, cellsOfRow = /* @__PURE__ */ new Map(), rowCells = (row) => {
|
|
976
|
-
let cells = cellsOfRow.get(row.id);
|
|
977
|
-
return cells === void 0 && cellsOfRow.set(row.id, cells = rowCellsUncached(row)), cells;
|
|
978
|
-
}, rowValues = (row) => rowCells(row).map(([, value]) => value), rowCellsUncached = (row) => valueCols.filter((col) => col.format === void 0 && cellFormat(row.cells[col.id]) === void 0 && !(data.columnToggles ?? []).some((toggle) => toggle.columns.includes(col.id) && (options.columnVisibility?.[toggle.id] ?? toggle.defaultVisible ?? !1) === !1)).flatMap((col) => {
|
|
979
|
-
let raw = rawState.get(row.id)?.get(col.id)?.raw;
|
|
980
|
-
return typeof raw == "number" ? [[col.id, raw]] : [];
|
|
981
|
-
}), largest = (values) => values.reduce((n, v) => Math.max(n, Math.abs(v)), 0), groupOf = (row) => sourceRows.get(row.id)?.[MAGNITUDE_GROUP], groupMax = /* @__PURE__ */ new Map(), groupColumns = /* @__PURE__ */ new Map();
|
|
982
|
-
for (let row of flat) {
|
|
983
|
-
let group = groupOf(row);
|
|
984
|
-
if (group === void 0) continue;
|
|
985
|
-
groupMax.set(group, Math.max(groupMax.get(group) ?? 0, largest(rowValues(row))));
|
|
986
|
-
let columns2 = groupColumns.get(group);
|
|
987
|
-
columns2 === void 0 && groupColumns.set(group, columns2 = /* @__PURE__ */ new Map());
|
|
988
|
-
for (let [colId, value] of rowCells(row)) {
|
|
989
|
-
let column = columns2.get(colId);
|
|
990
|
-
column === void 0 ? columns2.set(colId, [value]) : column.push(value);
|
|
1020
|
+
let rawWarnings = warnings, rawRecords = records, rawFootnotes = autoFootnotes, rawCells = rawState, childGroups = childrenOf, rawLifts = zeroLifts.count - modelLiftsBefore, rowIds = flat.map((row) => row.id), rowIndex = new Map(rowIds.map((id, index) => [id, index])), columnIndex = new Map(columnIds.map((id, index) => [id, index])), formatted = /* @__PURE__ */ new Map();
|
|
1021
|
+
return { source, rowIds, columnIds, rowIndex, columnIndex, resolve(current) {
|
|
1022
|
+
let formatKey = JSON.stringify([current.columnVisibility, current[ZERO_LIFT]]), display = formatted.get(formatKey);
|
|
1023
|
+
if (display)
|
|
1024
|
+
zeroLifts.count += display.lifts;
|
|
1025
|
+
else {
|
|
1026
|
+
let before = zeroLifts.count;
|
|
1027
|
+
display = { result: formatTable({ ...options, columnVisibility: current.columnVisibility, [ZERO_LIFT]: current[ZERO_LIFT] }), lifts: zeroLifts.count - before, views: /* @__PURE__ */ new Map() }, formatted.size >= 32 && formatted.delete(formatted.keys().next().value), formatted.set(formatKey, display);
|
|
991
1028
|
}
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
let
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1029
|
+
zeroLifts.count += rawLifts;
|
|
1030
|
+
let viewKey = JSON.stringify(current.expansion), view = display.views.get(viewKey ?? "");
|
|
1031
|
+
if (!view) {
|
|
1032
|
+
let toggleWarnings = [], expansionWarnings = [], toggles = toggleResolution.toggles.map((toggle) => ({ ...toggle, visible: current.columnVisibility?.[toggle.id] ?? toggle.defaultVisible }));
|
|
1033
|
+
columnVisibilityWarnings(toggles, current, toggleWarnings);
|
|
1034
|
+
let expanded = resolveExpansion(flat, treeChildrenOf, current, expansionWarnings, generatedOthers), base = display.result, rows = base.table.rows.map((row) => row.hasChildren ? { ...row, defaultExpanded: expanded.get(row.id) } : row.inlineRows ? { ...row } : row), rowsById = new Map(rows.map((row) => [row.id, row]));
|
|
1035
|
+
for (let index = 0; index < rows.length; index++) {
|
|
1036
|
+
let row = rows[index];
|
|
1037
|
+
row.inlineRows && (row.inlineRows = row.inlineRows.map((line) => rowsById.get(line.id)));
|
|
1038
|
+
}
|
|
1039
|
+
view = { ...base, table: { ...base.table, rows, columnToggles: toggles }, warnings: [
|
|
1040
|
+
...base.warnings.slice(0, toggleWarningAt),
|
|
1041
|
+
...toggleWarnings,
|
|
1042
|
+
...base.warnings.slice(toggleWarningAt, expansionWarningAt),
|
|
1043
|
+
...expansionWarnings,
|
|
1044
|
+
...base.warnings.slice(expansionWarningAt)
|
|
1045
|
+
] }, evaluatedStates.set(view, evaluatedStates.get(base)), display.views.size >= 32 && display.views.delete(display.views.keys().next().value), display.views.set(viewKey ?? "", view);
|
|
1046
|
+
}
|
|
1047
|
+
return view;
|
|
1048
|
+
} };
|
|
1049
|
+
function formatTable(options2) {
|
|
1050
|
+
let liftsBefore = zeroLifts.count, liftMode = options2[ZERO_LIFT], automaticAs = (on) => on && liftMode !== "none" ? liftMode ?? !0 : !1, warnings2 = rawWarnings.slice(), records2 = rawRecords.map((record) => ({ ...record })), autoFootnotes2 = new Set(rawFootnotes), lowerJudged = /* @__PURE__ */ new Set(), higherJudged = /* @__PURE__ */ new Set(), rawState2 = new Map([...rawCells].map(([id, cells]) => [id, new Map(cells)]));
|
|
1051
|
+
partitionLeafIds.set(rawState2, partitionLeafIds.get(rawCells));
|
|
1052
|
+
let childrenOf2 = new Map([...childGroups].map(([id, rows]) => [id, rows.slice()])), locale = localeDefaults(options2.locale), sourceRows = magnitudeSource === data ? flatById : new Map(flattenRows(magnitudeSource.rows).map((row) => [row.id, row])), sourceColumns = new Map(magnitudeSource.columns.map((col) => [col.id, col])), scales = (example) => scalesWithMagnitude(parseFormatExample2(example)), specs = /* @__PURE__ */ new Map(), formatExamples = /* @__PURE__ */ new Map(), forcedColumns = /* @__PURE__ */ new Set(), localeDerivedColumns = /* @__PURE__ */ new Set();
|
|
1053
|
+
for (let col of [...valueCols, ...computedCols]) {
|
|
1054
|
+
let inherited = col.kind === "computed" && !calcPreservesScale(col.calc) ? void 0 : options2.format, authoredExample = col.format ?? inherited, example = authoredExample ?? defaultExample(col);
|
|
1055
|
+
authoredExample === void 0 && localeDerivedColumns.add(col.id), formatExamples.set(col.id, example);
|
|
1056
|
+
let spec = parseFormatExample2(example), sourceExample = sourceColumns.get(col.id)?.format ?? inherited;
|
|
1057
|
+
spec.automatic = automaticAs(sourceExample === void 0 && options2.unit === void 0 && options2.magnitude !== "million" && options2.magnitude !== "thousand"), authoredExample === void 0 && currencyWholeNumbers(options2.unit, options2.target) && (col.kind !== "computed" || calcPreservesScale(col.calc)) && (spec.currencyWhole = !0), scales(sourceColumns.get(col.id)?.format ?? inherited ?? defaultExample(col)) && (options2.magnitude === "million" || options2.magnitude === "thousand") && (forceScale(spec, options2.magnitude === "million" ? "m" : "k", locale.thousands), spec.lockMagnitude && forcedColumns.add(col.id)), sourceExample !== void 0 && holdAuthoredScale(spec, locale.thousands), specs.set(col.id, spec);
|
|
1058
|
+
}
|
|
1059
|
+
let rowSpecs = /* @__PURE__ */ new Map(), rowById = /* @__PURE__ */ new Map(), forcedMagnitude = options2.magnitude === "million" ? "m" : options2.magnitude === "thousand" ? "k" : void 0, authoredSpec = (example, sourceExample = example) => {
|
|
1060
|
+
let spec = parseFormatExample2(example);
|
|
1061
|
+
return forcedMagnitude !== void 0 && scales(sourceExample) && forceScale(spec, forcedMagnitude, locale.thousands), spec;
|
|
1062
|
+
}, cellsOfRow = /* @__PURE__ */ new Map(), rowCells = (row) => {
|
|
1063
|
+
let cells = cellsOfRow.get(row.id);
|
|
1064
|
+
return cells === void 0 && cellsOfRow.set(row.id, cells = rowCellsUncached(row)), cells;
|
|
1065
|
+
}, rowValues = (row) => rowCells(row).map(([, value]) => value), rowCellsUncached = (row) => valueCols.filter((col) => col.format === void 0 && cellFormat(row.cells[col.id]) === void 0 && !(data.columnToggles ?? []).some((toggle) => toggle.columns.includes(col.id) && (options2.columnVisibility?.[toggle.id] ?? toggle.defaultVisible ?? !1) === !1)).flatMap((col) => {
|
|
1066
|
+
let raw = rawState2.get(row.id)?.get(col.id)?.raw;
|
|
1067
|
+
return typeof raw == "number" ? [[col.id, raw]] : [];
|
|
1068
|
+
}), largest = (values) => values.reduce((n, v) => Math.max(n, Math.abs(v)), 0), groupOf = (row) => sourceRows.get(row.id)?.[MAGNITUDE_GROUP], groupMax = /* @__PURE__ */ new Map(), groupColumns = /* @__PURE__ */ new Map();
|
|
1069
|
+
for (let row of flat) {
|
|
1070
|
+
let group = groupOf(row);
|
|
1071
|
+
if (group === void 0) continue;
|
|
1072
|
+
let kept = sourceRows.get(row.id)?.[MAGNITUDE_FIGURES], figures = kept === void 0 ? rowCells(row) : [...rowCells(row), ...kept];
|
|
1073
|
+
groupMax.set(group, Math.max(groupMax.get(group) ?? 0, largest(kept === void 0 ? rowValues(row) : figures.map(([, value]) => value))));
|
|
1074
|
+
let columns2 = groupColumns.get(group);
|
|
1075
|
+
columns2 === void 0 && groupColumns.set(group, columns2 = /* @__PURE__ */ new Map());
|
|
1076
|
+
for (let [colId, value] of figures) {
|
|
1077
|
+
let column = columns2.get(colId);
|
|
1078
|
+
column === void 0 ? columns2.set(colId, [value]) : column.push(value);
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
let scaleChangingColumns = new Set(computedCols.filter((col) => !calcPreservesScale(col.calc)).map((col) => col.id)), unfitColumns = forcedMagnitude === void 0 ? [...valueCols, ...computedCols].filter((col) => !scaleChangingColumns.has(col.id)).filter((col) => {
|
|
1082
|
+
let spec = specs.get(col.id);
|
|
1083
|
+
return localeDerivedColumns.has(col.id) && spec.magnitude !== "none" && flat.some((row) => {
|
|
1084
|
+
let raw = rawState2.get(row.id)?.get(col.id)?.raw;
|
|
1085
|
+
return typeof raw == "number" && raw !== 0 && roundedNumber(raw, { ...spec, automatic: !1 }) === 0;
|
|
1086
|
+
});
|
|
1087
|
+
}) : [], ownScaleExamples = /* @__PURE__ */ new Map(), rowScaleReaches = (rowId, colId) => !(ownScaleExamples.has(rowId) && scaleChangingColumns.has(colId));
|
|
1088
|
+
for (let row of unfitColumns.length === 0 ? [] : flat) {
|
|
1089
|
+
if (row.role === "section" || row.format !== void 0 || row.scale !== void 0 || row.calc !== void 0 || row.inline === !0 || groupOf(row) !== void 0 || !unfitColumns.some((col) => typeof rawState2.get(row.id)?.get(col.id)?.raw == "number")) continue;
|
|
1090
|
+
let values = rowValues(row);
|
|
1091
|
+
values.length > 0 && ownScaleExamples.set(row.id, exampleOf(values));
|
|
1092
|
+
}
|
|
1093
|
+
let printsAsZero = (raw, spec) => typeof raw == "number" && raw !== 0 && roundedNumber(raw, { ...spec, automatic: !1 }) === 0;
|
|
1094
|
+
[...ownScaleExamples].some(([rowId, example]) => unfitColumns.some((col) => {
|
|
1095
|
+
let raw = rawState2.get(rowId)?.get(col.id)?.raw;
|
|
1096
|
+
return printsAsZero(raw, specs.get(col.id)) && !printsAsZero(raw, parseFormatExample2(example));
|
|
1097
|
+
})) || ownScaleExamples.clear();
|
|
1098
|
+
let groupCellSpecs = /* @__PURE__ */ new Map();
|
|
1099
|
+
for (let row of flat) {
|
|
1100
|
+
rowById.set(row.id, row);
|
|
1101
|
+
let example = row.format ?? ownScaleExamples.get(row.id) ?? (row.scale ? row.scale === "percent" ? "1.2%" : "1,234" : void 0) ?? (row.calc && calcYieldsPoints(row.calc) ? `1${locale.decimal}2%` : void 0);
|
|
1102
|
+
if (example) {
|
|
1103
|
+
let ownScale = row.scale === "count" || row.scale === "percent", spec = ownScale ? parseFormatExample2(example) : authoredSpec(example, sourceRows.get(row.id)?.format ?? example), authoredRow = sourceRows.get(row.id);
|
|
1104
|
+
authoredRow?.format !== void 0 && authoredRow[AUTOMATIC_FORMAT] !== !0 && holdAuthoredScale(spec, locale.thousands);
|
|
1105
|
+
let group = groupOf(row), rowScale = row.scale === "money" || row.scale === "perUnit";
|
|
1106
|
+
if (rowScale || specUnitKind(spec) === "number") {
|
|
1107
|
+
let values = rowValues(row), max = group === void 0 ? largest(values) : groupMax.get(group), climb = (from) => max >= 1e9 ? "bn" : max >= 1e6 ? "m" : max >= from ? "k" : "none", authoredFormat = sourceRows.get(row.id)?.format !== void 0;
|
|
1108
|
+
if (rowScale && !spec.magnitudeInAffix && !spec.exponent && !spec.ordinal) {
|
|
1109
|
+
let heldMoney = row.scale === "money" && forcedMagnitude !== void 0;
|
|
1110
|
+
if (spec.magnitude = heldMoney ? forcedMagnitude : row.scale === "money" ? climb(1e3) : "none", row.scale === "money")
|
|
1111
|
+
spec.decimals = max >= 1e3 && !(heldMoney && forcedMagnitude === "k" && max >= 1e5) ? 1 : 0;
|
|
1112
|
+
else if ((!authoredFormat || values.every(Number.isInteger)) && (spec.decimals = max >= 10 ? 0 : 1, !authoredFormat))
|
|
1113
|
+
for (let value of values)
|
|
1114
|
+
for (; value !== 0 && spec.decimals < 20 && Math.abs(roundedNumber(value, spec) - value) > Math.abs(value) * 0.01; ) spec.decimals++;
|
|
1115
|
+
spec.prefix = "", spec.suffix = "", spec.lockMagnitude = heldMoney, spec.rollMagnitude = !1, spec.thousandsSep === "" && (spec.thousandsSep = locale.thousands);
|
|
1116
|
+
} else row.scale === "count" && !authoredFormat && max >= 1e6 && spec.magnitude === "none" && !spec.signed && (spec.magnitude = climb(1 / 0), spec.decimals = 1, spec.lockMagnitude = !1, spec.rollMagnitude = !1);
|
|
1117
|
+
let smallMoney = !spec.magnitudeInAffix && !spec.exponent && !spec.ordinal && !rowScale && !ownScale && forcedMagnitude && scales(example) && values.every((v) => Math.abs(v) < 1e3), changeLine = row.inline === !0 || spec.signed;
|
|
1118
|
+
if ((smallMoney || !changeLine && group === void 0 && values.some((v) => v !== 0 && roundedNumber(v, spec) === 0)) && !spec.magnitudeInAffix && (smallMoney || !rowScale && spec.lockMagnitude && spec.magnitude === "k" || row.scale === "money" && spec.magnitude === "k")) {
|
|
1015
1119
|
let authored = parseFormatExample2(example);
|
|
1016
|
-
spec.decimals = !rowScale && authored.magnitude === "none" ? authored.decimals : 0, spec.magnitude = "none";
|
|
1120
|
+
spec.decimals = !rowScale && authored.magnitude === "none" ? authored.decimals : 0, spec.magnitude = "none", spec.decimals = values.reduce((decimals, value) => nonzeroDecimals(value / MAGNITUDE_DIVISOR[spec.magnitude], decimals), spec.decimals);
|
|
1017
1121
|
}
|
|
1018
|
-
spec.
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1122
|
+
if (!changeLine && (spec.magnitude !== "none" || group !== void 0 && row.scale === "money") && !(spec.lockMagnitude && spec.magnitude === "k") && (row.scale === "money" || row.scale === "count" && !authoredFormat))
|
|
1123
|
+
if (group === void 0)
|
|
1124
|
+
for (let value of values)
|
|
1125
|
+
for (; value !== 0 && spec.decimals < 20 && Math.abs(roundedNumber(value, spec) - value) > Math.abs(value) * 0.01; ) spec.decimals++;
|
|
1126
|
+
else {
|
|
1127
|
+
let columns2 = groupColumns.get(group);
|
|
1128
|
+
for (let column of columns2.values())
|
|
1129
|
+
for (let value of column)
|
|
1130
|
+
for (; value !== 0 && spec.decimals < 20 && Math.abs(roundedNumber(value, spec) - value) > max * 0.01; ) spec.decimals++;
|
|
1131
|
+
let inRow = /* @__PURE__ */ new Map();
|
|
1132
|
+
for (let [colId, column] of columns2) {
|
|
1133
|
+
let cellSpec = { ...spec }, bound = largest(column) * 0.01;
|
|
1134
|
+
for (let value of column)
|
|
1135
|
+
for (; value !== 0 && cellSpec.decimals < 20 && Math.abs(roundedNumber(value, cellSpec) - value) > bound; ) cellSpec.decimals++;
|
|
1136
|
+
inRow.set(colId, cellSpec);
|
|
1137
|
+
}
|
|
1138
|
+
groupCellSpecs.set(row.id, inRow);
|
|
1139
|
+
}
|
|
1140
|
+
if (!changeLine && group === void 0) {
|
|
1029
1141
|
let inRow = /* @__PURE__ */ new Map();
|
|
1030
|
-
for (let [
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
inRow.set(colId, cellSpec);
|
|
1142
|
+
for (let col of [...valueCols, ...computedCols]) {
|
|
1143
|
+
if (row.calc === void 0 && columnOwnsFormat(col) || cellFormat(row.cells[col.id]) !== void 0 || !rowScaleReaches(row.id, col.id)) continue;
|
|
1144
|
+
let value = rawState2.get(row.id)?.get(col.id)?.raw;
|
|
1145
|
+
typeof value == "number" && value !== 0 && roundedNumber(value, spec) === 0 && inRow.set(col.id, { ...spec, decimals: nonzeroDecimals(value / MAGNITUDE_DIVISOR[spec.magnitude], spec.decimals) });
|
|
1035
1146
|
}
|
|
1036
|
-
groupCellSpecs.set(row.id, inRow);
|
|
1147
|
+
inRow.size > 0 && groupCellSpecs.set(row.id, inRow);
|
|
1037
1148
|
}
|
|
1149
|
+
}
|
|
1150
|
+
let sourceRow = sourceRows.get(row.id);
|
|
1151
|
+
spec.automatic = automaticAs(group !== void 0 || (sourceRow?.format === void 0 || sourceRow[AUTOMATIC_FORMAT] === !0) && options2.format === void 0 && options2.unit === void 0 && forcedMagnitude === void 0);
|
|
1152
|
+
for (let cellSpec of groupCellSpecs.get(row.id)?.values() ?? []) cellSpec.automatic = spec.automatic;
|
|
1153
|
+
rowSpecs.set(row.id, spec);
|
|
1038
1154
|
}
|
|
1039
|
-
let sourceRow = sourceRows.get(row.id);
|
|
1040
|
-
spec.automatic = automaticAs(group !== void 0 || (sourceRow?.format === void 0 || sourceRow[AUTOMATIC_FORMAT] === !0) && options.format === void 0 && options.unit === void 0 && forcedMagnitude === void 0);
|
|
1041
|
-
for (let cellSpec of groupCellSpecs.get(row.id)?.values() ?? []) cellSpec.automatic = spec.automatic;
|
|
1042
|
-
rowSpecs.set(row.id, spec);
|
|
1043
1155
|
}
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1156
|
+
let cellSpecs = /* @__PURE__ */ new Map(), cellFormatCols = [...valueCols, ...computedCols];
|
|
1157
|
+
for (let row of flat)
|
|
1158
|
+
for (let col of cellFormatCols) {
|
|
1159
|
+
let example = cellFormat(row.cells[col.id]);
|
|
1160
|
+
if (example !== void 0) {
|
|
1161
|
+
let sourceRow = sourceRows.get(row.id), sourceColumn = sourceColumns.get(col.id), sourceExample = cellFormat(sourceRow?.cells[col.id]) ?? sourceColumn?.format ?? sourceRow?.format ?? options2.format ?? defaultExample(col), inRow = cellSpecs.get(row.id);
|
|
1162
|
+
inRow || cellSpecs.set(row.id, inRow = /* @__PURE__ */ new Map());
|
|
1163
|
+
let spec = authoredSpec(example, sourceExample), sourceCell = sourceRow?.cells[col.id];
|
|
1164
|
+
cellFormat(sourceRow?.cells[col.id]) !== void 0 && sourceCell?.[AUTOMATIC_FORMAT] !== !0 && holdAuthoredScale(spec, locale.thousands), sourceCell?.[AUTOMATIC_FORMAT] === !0 && (spec.automatic = automaticAs(!0)), inRow.set(col.id, spec);
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
let cellNamesOtherUnit = (rowId, colId, spec) => {
|
|
1168
|
+
let own = cellSpecs.get(rowId)?.get(colId);
|
|
1169
|
+
return own !== void 0 && typeof rawState2.get(rowId)?.get(colId)?.raw == "number" && unitOfSpec(own) !== unitOfSpec(spec);
|
|
1170
|
+
}, hoistedRowUnits = /* @__PURE__ */ new Map();
|
|
1171
|
+
if (forcedMagnitude !== void 0)
|
|
1172
|
+
for (let [rowId, spec] of rowSpecs) {
|
|
1173
|
+
if (rowById.get(rowId)?.scale !== void 0 || rowById.get(rowId)?.calc !== void 0 || !scales(sourceRows.get(rowId)?.format ?? "1,234") || valueCols.some((col) => cellNamesOtherUnit(rowId, col.id, spec))) continue;
|
|
1174
|
+
let unit = spec.magnitude === "none" ? null : unitOfSpec(spec);
|
|
1175
|
+
unit !== null && hoistedRowUnits.set(rowId, unit);
|
|
1176
|
+
}
|
|
1177
|
+
let ownFormatColumns = new Set([...valueCols, ...computedCols].filter(columnOwnsFormat).map((col) => col.id)), rowFormattedColumns = /* @__PURE__ */ new Set();
|
|
1178
|
+
for (let row of flat)
|
|
1179
|
+
if (!(row.calc || !rowSpecs.has(row.id)))
|
|
1180
|
+
for (let col of valueCols)
|
|
1181
|
+
!ownFormatColumns.has(col.id) && typeof rawState2.get(row.id)?.get(col.id)?.raw == "number" && rowFormattedColumns.add(col.id);
|
|
1182
|
+
let hoistedUnitSet = new Set(hoistedRowUnits.values()), figureRows = flat.filter((row) => !row.calc && valueCols.some((col) => typeof rawState2.get(row.id)?.get(col.id)?.raw == "number")), headUnit = options2.columnHeads !== !1 && figureRows.length > 1 && hoistedUnitSet.size === 1 && figureRows.every((row) => hoistedRowUnits.has(row.id)) ? [...hoistedUnitSet][0] : void 0;
|
|
1183
|
+
function defaultExample(col) {
|
|
1184
|
+
if (col.kind === "computed" && calcYieldsPoints(col.calc)) return `1${locale.decimal}2%`;
|
|
1185
|
+
if (options2.magnitude === "million") return `1${locale.thousands}234${locale.decimal}2m`;
|
|
1186
|
+
if (options2.magnitude === "thousand") return `1${locale.thousands}234k`;
|
|
1187
|
+
let values = [];
|
|
1188
|
+
for (let r of flat) {
|
|
1189
|
+
let s = rawState2.get(r.id).get(col.id);
|
|
1190
|
+
s && typeof s.raw == "number" && values.push(s.raw);
|
|
1054
1191
|
}
|
|
1192
|
+
return exampleOf(values);
|
|
1055
1193
|
}
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
let unit = spec.magnitude === "none" ? null : unitOfSpec(spec);
|
|
1064
|
-
unit !== null && hoistedRowUnits.set(rowId, unit);
|
|
1194
|
+
function exampleOf(values) {
|
|
1195
|
+
let maxAbs = values.reduce((max, value) => Math.max(max, Math.abs(value)), 0);
|
|
1196
|
+
if (maxAbs >= 1e9 && unitMagnitude(options2.unit) === void 0) return `1${locale.decimal}2bn`;
|
|
1197
|
+
if (maxAbs >= 1e6 && unitMagnitude(options2.unit) === void 0) return `1${locale.decimal}2m`;
|
|
1198
|
+
if (maxAbs >= 100) return `1${locale.thousands}234`;
|
|
1199
|
+
let decimals = typicalDecimals(values);
|
|
1200
|
+
return decimals > 1 ? `0${locale.decimal}${"1234".slice(0, decimals)}` : `1${locale.decimal}2`;
|
|
1065
1201
|
}
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
s && typeof s.raw == "number" && (maxAbs = Math.max(maxAbs, Math.abs(s.raw)), values.push(s.raw));
|
|
1202
|
+
let printsThroughRow = (row, colId) => rowSpecs.has(row.id) && (row.calc !== void 0 || row.inline === !0 || !ownFormatColumns.has(colId) && rowScaleReaches(row.id, colId)), printsThroughColumn = (row, colId) => !printsThroughRow(row, colId) && !cellSpecs.get(row.id)?.has(colId);
|
|
1203
|
+
for (let colId of forcedColumns) {
|
|
1204
|
+
let spec = specs.get(colId), values = flat.flatMap((row) => {
|
|
1205
|
+
let raw = printsThroughColumn(row, colId) ? rawState2.get(row.id)?.get(colId)?.raw : void 0;
|
|
1206
|
+
return typeof raw == "number" && raw !== 0 ? [raw] : [];
|
|
1207
|
+
});
|
|
1208
|
+
if (values.some((value) => roundedNumber(value, spec) === 0)) {
|
|
1209
|
+
if (spec.magnitude === "k" || values.every((value) => Math.abs(value) < 1e3)) {
|
|
1210
|
+
let authored = parseFormatExample2(formatExamples.get(colId));
|
|
1211
|
+
spec.decimals = authored.magnitude === "none" ? authored.decimals : 0, spec.magnitude = "none";
|
|
1212
|
+
}
|
|
1213
|
+
spec.decimals = values.reduce((decimals, value) => nonzeroDecimals(value / MAGNITUDE_DIVISOR[spec.magnitude], decimals), spec.decimals);
|
|
1214
|
+
}
|
|
1080
1215
|
}
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
let raw = rawState.get(row.id)?.get(colId)?.raw;
|
|
1090
|
-
return typeof raw == "number" && raw !== 0 && effectiveScale(Math.abs(raw), spec).magnitude !== spec.magnitude;
|
|
1091
|
-
}), lettersInCells = /* @__PURE__ */ new Set();
|
|
1092
|
-
for (let col of [...valueCols, ...computedCols]) {
|
|
1093
|
-
let spec = specs.get(col.id);
|
|
1094
|
-
!rowFormattedColumns.has(col.id) && (rollsOff(col.id, spec) || flat.some((row) => cellNamesOtherUnit(row.id, col.id, spec))) && lettersInCells.add(col.id), unitByCol.set(col.id, rowFormattedColumns.has(col.id) || lettersInCells.has(col.id) ? null : unitOfSpec(spec));
|
|
1095
|
-
}
|
|
1096
|
-
let headerUnitFor = (id) => unitByCol.get(id) ?? (rowFormattedColumns.has(id) ? headUnit ?? null : null), headerScaledFor = (id) => unitByCol.get(id) != null ? specs.get(id).magnitude !== "none" : rowFormattedColumns.has(id) && headUnit !== void 0 && figureRows.some((row) => (rowSpecs.get(row.id)?.magnitude ?? "none") !== "none"), distinctUnits = [...new Set([...unitByCol.keys()].map(headerUnitFor).filter((u) => u !== null))], candidateUnit = distinctUnits.length === 1 && [...valueCols, ...computedCols].every((col) => {
|
|
1097
|
-
let kind = specUnitKind(specs.get(col.id));
|
|
1098
|
-
return kind === "percent" || kind === "pp" || headerUnitFor(col.id) === distinctUnits[0];
|
|
1099
|
-
}) ? distinctUnits[0] : void 0, frameCarriesUnit = unitPrinted({
|
|
1100
|
-
subtitle: resolveSubtitle(options.subtitle),
|
|
1101
|
-
unit: candidateUnit,
|
|
1102
|
-
unitShown: options.unitShown
|
|
1103
|
-
}), authoredUnit = typeof options.unit == "string" ? options.unit.trim() : void 0, scaleWords = (authoredUnit?.split(/[\s$€£¥()]+/) ?? []).filter((word) => Object.values(MAGNITUDE_LABEL).some((label) => label !== "" && sameUnit(word, label))), bareScale = candidateUnit !== void 0 && [...[...valueCols, ...computedCols].map((col) => specs.get(col.id)), ...rowSpecs.values()].every((spec) => specUnitKind(spec) !== "number" || spec.prefix.trim() === "" && spec.suffix.trim() === ""), carriesScale = scaleWords.some((word) => sameUnit(word, candidateUnit ?? "")), composes = bareScale && !!authoredUnit && (carriesScale || scaleWords.length === 0 && /^(?:[A-Z]{3}|\p{Sc})$/u.test(authoredUnit)), composedUnit = composes ? carriesScale ? authoredUnit : `${authoredUnit} ${candidateUnit}` : candidateUnit, uniformUnit = composedUnit && frameCarriesUnit ? composedUnit : null;
|
|
1104
|
-
uniformUnit !== null && options.unit !== void 0 && options.unit !== uniformUnit && !composes && warnings.push({
|
|
1105
|
-
code: "table-unit-overridden",
|
|
1106
|
-
severity: "warn",
|
|
1107
|
-
field: ["options", "unit"],
|
|
1108
|
-
message: `options.unit '${options.unit}' is not printed. The table prints '${uniformUnit}' because its column formats resolve that shared unit.`,
|
|
1109
|
-
suggest: "Remove options.unit so the column formats supply the unit.",
|
|
1110
|
-
fix: [{ op: "remove", path: "/options/unit" }]
|
|
1111
|
-
});
|
|
1112
|
-
let rowOverridesColumn = (rowId) => {
|
|
1113
|
-
let row = rowById.get(rowId);
|
|
1114
|
-
return row?.calc !== void 0 || row?.inline === !0;
|
|
1115
|
-
}, specFor = (colId, rowId) => {
|
|
1116
|
-
let cellSpec = rowId ? cellSpecs.get(rowId)?.get(colId) : void 0;
|
|
1117
|
-
if (cellSpec) return cellSpec;
|
|
1118
|
-
let rowSpec = rowId ? rowSpecs.get(rowId) : void 0;
|
|
1119
|
-
return rowSpec && (rowOverridesColumn(rowId) || !ownFormatColumns.has(colId)) ? groupCellSpecs.get(rowId)?.get(colId) ?? rowSpec : specs.get(colId);
|
|
1120
|
-
}, formatNumber = (raw, colId, rowId, lift = !0) => {
|
|
1121
|
-
let cellSpec = rowId ? cellSpecs.get(rowId)?.get(colId) : void 0, rowSpec = rowId ? rowSpecs.get(rowId) : void 0, rowPath = rowSpec !== void 0 && (rowOverridesColumn(rowId) || !ownFormatColumns.has(colId)), base = rowPath ? rowSpec : specs.get(colId);
|
|
1122
|
-
if (cellSpec && !sameUnit2(cellSpec, base)) return formatWithSpec(raw, lift ? cellSpec : { ...cellSpec, automatic: !1 });
|
|
1123
|
-
let decimals = cellSpec?.decimals ?? (rowPath ? groupCellSpecs.get(rowId)?.get(colId)?.decimals : void 0) ?? base.decimals;
|
|
1124
|
-
if (rowPath) {
|
|
1125
|
-
if (raw === 0 && lift && !cellSpec && groupOf(rowById.get(rowId)) !== void 0) return "0";
|
|
1126
|
-
let hoisted = rowId !== void 0 && hoistedRowUnits.has(rowId), automatic = lift && (cellSpec ? cellSpec.automatic : rowSpec.automatic);
|
|
1127
|
-
return hoisted ? formatWithSpec(raw, { ...rowSpec, decimals, automatic, prefix: "", suffix: "", magnitudeInAffix: !0 }) : formatWithSpec(raw, { ...rowSpec, decimals, automatic });
|
|
1216
|
+
let unitByCol = /* @__PURE__ */ new Map(), rollsOff = (colId, spec) => spec.magnitude !== "none" && flat.some((row) => {
|
|
1217
|
+
if (!printsThroughColumn(row, colId)) return !1;
|
|
1218
|
+
let raw = rawState2.get(row.id)?.get(colId)?.raw;
|
|
1219
|
+
return typeof raw == "number" && raw !== 0 && effectiveScale(Math.abs(raw), spec).magnitude !== spec.magnitude;
|
|
1220
|
+
}), lettersInCells = /* @__PURE__ */ new Set(), figurelessColumns = /* @__PURE__ */ new Set();
|
|
1221
|
+
for (let col of [...valueCols, ...computedCols]) {
|
|
1222
|
+
let spec = specs.get(col.id);
|
|
1223
|
+
flat.some((row) => typeof rawState2.get(row.id)?.get(col.id)?.raw == "number" && !printsThroughRow(row, col.id)) || figurelessColumns.add(col.id), !rowFormattedColumns.has(col.id) && (rollsOff(col.id, spec) || flat.some((row) => cellNamesOtherUnit(row.id, col.id, spec))) && lettersInCells.add(col.id), unitByCol.set(col.id, rowFormattedColumns.has(col.id) || lettersInCells.has(col.id) || figurelessColumns.has(col.id) ? null : unitOfSpec(spec));
|
|
1128
1224
|
}
|
|
1129
|
-
let
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
...leafRows.map((r) => ({ r, s: rawState.get(r.id).get(colId), shown: !0 })),
|
|
1146
|
-
...hiddenLeaves.map(([id, h]) => ({ r: { id }, s: h.states.get(colId), shown: !1 }))
|
|
1147
|
-
].filter((e) => e.s?.state === "value" && typeof e.s.raw == "number"), LAST = Number.MAX_SAFE_INTEGER;
|
|
1148
|
-
if (entries.sort((a, b) => (folded.leafOrder.get(a.r.id) ?? LAST) - (folded.leafOrder.get(b.r.id) ?? LAST)), entries.length !== leafRows.length + hiddenLeaves.length || entries.length === 0) return;
|
|
1149
|
-
let decimals = spec.decimals ?? 1, unit = Math.pow(10, -decimals), floors = entries.map((e) => Math.floor(e.s.raw / unit) * unit), remainders = entries.map((e, i) => e.s.raw - floors[i]), deficit = Math.round((100 - floors.reduce((a, b) => a + b, 0)) / unit), ownPrecision = entries.map((e) => {
|
|
1150
|
-
let cellSpec = cellSpecs.get(e.r.id)?.get(colId);
|
|
1151
|
-
return cellSpec !== void 0 && (cellSpec.decimals ?? 1) !== decimals;
|
|
1152
|
-
}), order = entries.map((_, i) => i).filter((i) => !ownPrecision[i]).sort((a, b) => remainders[b] - remainders[a] || a - b), adjusted = /* @__PURE__ */ new Set();
|
|
1153
|
-
for (let i of order) {
|
|
1154
|
-
if (deficit <= 0) break;
|
|
1155
|
-
adjusted.add(i), deficit--;
|
|
1156
|
-
}
|
|
1157
|
-
entries.forEach((e, i) => {
|
|
1158
|
-
if (ownPrecision[i] || !e.shown) return;
|
|
1159
|
-
let shown = floors[i] + (adjusted.has(i) ? unit : 0), cellSpec = cellSpecs.get(e.r.id)?.get(colId);
|
|
1160
|
-
displayOverride.set(tableCellKey(e.r.id, colId), shown === 0 && e.s.raw > 0 && spec.automatic && !cellSpec ? `<${formatNumber(unit, colId)}` : formatNumber(shown, colId, e.r.id)), overrideAmount.set(tableCellKey(e.r.id, colId), shown), adjusted.has(i) && Math.abs(shown - e.s.raw) > 1e-9 && records.push({
|
|
1161
|
-
rowId: e.r.id,
|
|
1162
|
-
colId,
|
|
1163
|
-
op: "share-reconcile",
|
|
1164
|
-
// The display UNIT is half the calculation: this record says "the
|
|
1165
|
-
// exact share, rounded up by one unit". With only the exact share in
|
|
1166
|
-
// the receipt, the adjustment could not be checked against anything.
|
|
1167
|
-
inputs: [
|
|
1168
|
-
{ rowId: e.r.id, colId, value: e.s.raw },
|
|
1169
|
-
{ rowId: SHARE_UNIT_ROW_ID, colId, value: unit }
|
|
1170
|
-
],
|
|
1171
|
-
raw: shown,
|
|
1172
|
-
state: "value",
|
|
1173
|
-
displayed: formatNumber(shown, colId, e.r.id),
|
|
1174
|
-
kind: "rounding-adjustment"
|
|
1175
|
-
});
|
|
1176
|
-
});
|
|
1177
|
-
}
|
|
1178
|
-
for (let col of [...valueCols, ...computedCols]) {
|
|
1179
|
-
if (col.kind === "computed" ? calcYieldsPoints(col.calc) : col.percentScale === "points") continue;
|
|
1180
|
-
let spec = col.kind === "computed" || col.format ? specs.get(col.id) : void 0;
|
|
1181
|
-
if (!spec || !(spec.suffix ?? "").includes("%")) continue;
|
|
1182
|
-
let vals = flat.map((r) => rawState.get(r.id).get(col.id)).filter((s) => !!s && typeof s.raw == "number");
|
|
1183
|
-
vals.length > 0 && vals.every((v) => Math.abs(v.raw) <= 1.5) && warnings.push({
|
|
1184
|
-
code: "percent-scale-suspect",
|
|
1225
|
+
let figureColumns = [...valueCols, ...computedCols].filter((col) => !figurelessColumns.has(col.id)), headerUnitFor = (id) => unitByCol.get(id) ?? (rowFormattedColumns.has(id) ? headUnit ?? null : null), headerScaledFor = (id) => unitByCol.get(id) != null ? specs.get(id).magnitude !== "none" : rowFormattedColumns.has(id) && headUnit !== void 0 && figureRows.some((row) => (rowSpecs.get(row.id)?.magnitude ?? "none") !== "none"), distinctUnits = [...new Set([...unitByCol.keys()].map(headerUnitFor).filter((u) => u !== null))], candidateUnit = distinctUnits.length === 1 && figureColumns.every((col) => {
|
|
1226
|
+
let kind = specUnitKind(specs.get(col.id));
|
|
1227
|
+
return kind === "percent" || kind === "pp" || headerUnitFor(col.id) === distinctUnits[0];
|
|
1228
|
+
}) ? distinctUnits[0] : void 0, frameCarriesUnit = unitPrinted({
|
|
1229
|
+
subtitle: resolveSubtitle(options2.subtitle),
|
|
1230
|
+
unit: candidateUnit,
|
|
1231
|
+
unitShown: options2.unitShown
|
|
1232
|
+
}), authoredUnit = typeof options2.unit == "string" ? options2.unit.trim() : void 0, scaleWords = (authoredUnit?.split(/[\s$€£¥()]+/) ?? []).filter((word) => Object.values(MAGNITUDE_LABEL).some((label) => label !== "" && sameUnit(word, label))), bareScale = candidateUnit !== void 0 && [...figureColumns.map((col) => specs.get(col.id)), ...rowSpecs.values()].every((spec) => specUnitKind(spec) !== "number" || spec.prefix.trim() === "" && spec.suffix.trim() === ""), carriesScale = scaleWords.some((word) => sameUnit(word, candidateUnit ?? "")), composes = bareScale && !!authoredUnit && (carriesScale || scaleWords.length === 0 && /^(?:[A-Z]{3}|\p{Sc})$/u.test(authoredUnit)), composedUnit = composes ? carriesScale ? authoredUnit : `${authoredUnit} ${candidateUnit}` : candidateUnit, uniformUnit = composedUnit && frameCarriesUnit ? composedUnit : null;
|
|
1233
|
+
if (options2.columnHeads === !1 && uniformUnit === null)
|
|
1234
|
+
for (let [id, unit] of unitByCol) unit !== null && (unitByCol.set(id, null), lettersInCells.add(id));
|
|
1235
|
+
let statesUnit = (id) => {
|
|
1236
|
+
let spec = specs.get(id);
|
|
1237
|
+
return specUnitKind(spec) !== "number" || spec.prefix.trim() !== "" || spec.suffix.trim() !== "";
|
|
1238
|
+
}, columnUnits = uniformUnit === null && distinctUnits.length > 1 && figureColumns.every((col) => statesUnit(col.id));
|
|
1239
|
+
(uniformUnit !== null || columnUnits) && options2.unit !== void 0 && options2.unit !== uniformUnit && !composes && warnings2.push({
|
|
1240
|
+
code: "table-unit-overridden",
|
|
1185
1241
|
severity: "warn",
|
|
1186
|
-
|
|
1187
|
-
|
|
1242
|
+
field: ["options", "unit"],
|
|
1243
|
+
message: uniformUnit !== null ? `options.unit '${options2.unit}' is not printed. The table prints '${uniformUnit}' because its column formats resolve that shared unit.` : `options.unit '${options2.unit}' is not printed. The column heads print their own units (${distinctUnits.join(", ")}).`,
|
|
1244
|
+
suggest: "Remove options.unit so the column formats supply the unit.",
|
|
1245
|
+
fix: [{ op: "remove", path: "/options/unit" }]
|
|
1188
1246
|
});
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1247
|
+
let rowOverridesColumn = (rowId) => {
|
|
1248
|
+
let row = rowById.get(rowId);
|
|
1249
|
+
return row?.calc !== void 0 || row?.inline === !0;
|
|
1250
|
+
}, specFor = (colId, rowId) => {
|
|
1251
|
+
let cellSpec = rowId ? cellSpecs.get(rowId)?.get(colId) : void 0;
|
|
1252
|
+
if (cellSpec) return cellSpec;
|
|
1253
|
+
let rowSpec = rowId ? rowSpecs.get(rowId) : void 0;
|
|
1254
|
+
return rowSpec && (rowOverridesColumn(rowId) || !ownFormatColumns.has(colId) && rowScaleReaches(rowId, colId)) ? groupCellSpecs.get(rowId)?.get(colId) ?? rowSpec : specs.get(colId);
|
|
1255
|
+
}, displayFormats = /* @__PURE__ */ new Map(), displayFormat = (base, decimals, automatic, hoisted, clearCurrency = !1) => {
|
|
1256
|
+
let variants = displayFormats.get(base);
|
|
1257
|
+
variants || displayFormats.set(base, variants = /* @__PURE__ */ new Map());
|
|
1258
|
+
let key = `${decimals}:${automatic}:${hoisted}:${clearCurrency}`, format = variants.get(key);
|
|
1259
|
+
if (!format) {
|
|
1260
|
+
let spec = {
|
|
1261
|
+
...base,
|
|
1262
|
+
decimals,
|
|
1263
|
+
automatic,
|
|
1264
|
+
...clearCurrency ? { currencyWhole: void 0 } : {},
|
|
1265
|
+
...hoisted ? { prefix: "", suffix: "", magnitudeInAffix: !0 } : {}
|
|
1266
|
+
};
|
|
1267
|
+
variants.set(key, format = compileNumberFormat(spec));
|
|
1268
|
+
}
|
|
1269
|
+
return format;
|
|
1270
|
+
}, formatNumber = (raw, colId, rowId, lift = !0) => {
|
|
1271
|
+
let cellSpec = rowId ? cellSpecs.get(rowId)?.get(colId) : void 0, rowSpec = rowId ? rowSpecs.get(rowId) : void 0, rowPath = rowSpec !== void 0 && (rowOverridesColumn(rowId) || !ownFormatColumns.has(colId) && rowScaleReaches(rowId, colId)), base = rowPath ? rowSpec : specs.get(colId);
|
|
1272
|
+
if (cellSpec && !sameUnit2(cellSpec, base)) return displayFormat(cellSpec, cellSpec.decimals, lift ? cellSpec.automatic : !1, !1)(raw);
|
|
1273
|
+
let decimals = cellSpec?.decimals ?? (rowPath ? groupCellSpecs.get(rowId)?.get(colId)?.decimals : void 0) ?? base.decimals;
|
|
1274
|
+
if (rowPath) {
|
|
1275
|
+
if (raw === 0 && lift && !cellSpec && groupOf(rowById.get(rowId)) !== void 0) return "0";
|
|
1276
|
+
let hoisted = rowId !== void 0 && hoistedRowUnits.has(rowId), automatic2 = lift && (cellSpec ? cellSpec.automatic : rowSpec.automatic), printed = displayFormat(rowSpec, decimals, automatic2, hoisted)(raw);
|
|
1277
|
+
return ownScaleExamples.has(rowId) && !cellSpec && locale.minusGlyph === "-" && printed.startsWith(MINUS) ? `-${printed.slice(MINUS.length)}` : printed;
|
|
1278
|
+
}
|
|
1279
|
+
let automatic = lift ? cellSpec ? cellSpec.automatic : base.automatic : !1, rendered = displayFormat(base, decimals, automatic, unitByCol.get(colId) != null, cellSpec !== void 0)(raw);
|
|
1280
|
+
return localeDerivedColumns.has(colId) && locale.minusGlyph === "-" && rendered.startsWith(MINUS) ? `-${rendered.slice(MINUS.length)}` : rendered;
|
|
1281
|
+
}, madeNm = /* @__PURE__ */ new Set();
|
|
1282
|
+
for (let record of records2) {
|
|
1283
|
+
if (record.kind !== "calc" || record.state !== "value") continue;
|
|
1284
|
+
let baseInput = record.op === "percentDelta($0,$1)" ? record.inputs[1] : void 0, nearZeroBase = baseInput !== void 0 && baseInput.value !== null && !/[1-9]/.test(formatNumber(baseInput.value, baseInput.colId, baseInput.rowId, !1));
|
|
1285
|
+
!nearZeroBase && (madeNm.size === 0 || !record.inputs.some((input) => madeNm.has(JSON.stringify([input.rowId, input.colId])))) || (record.raw = null, record.state = "nm", rawState2.get(record.rowId)?.set(record.colId, { raw: null, state: "nm" }), madeNm.add(JSON.stringify([record.rowId, record.colId])), nearZeroBase && autoFootnotes2.add(options2.strings?.nearZeroChange ?? localeStrings(options2.locale?.language).nearZeroChange));
|
|
1286
|
+
}
|
|
1287
|
+
let displayOverride = /* @__PURE__ */ new Map(), overrideAmount = /* @__PURE__ */ new Map();
|
|
1288
|
+
for (let col of computedCols) {
|
|
1289
|
+
if (!("op" in col.calc) || col.calc.op !== "share") continue;
|
|
1290
|
+
let spec = specs.get(col.id);
|
|
1291
|
+
reconcileShares(col.id, spec);
|
|
1292
|
+
}
|
|
1293
|
+
function reconcileShares(colId, spec) {
|
|
1294
|
+
let entries = [
|
|
1295
|
+
...leafRows.map((r) => ({ r, s: rawState2.get(r.id).get(colId), shown: !0 })),
|
|
1296
|
+
...hiddenLeaves.map(([id, h]) => ({ r: { id }, s: h.states.get(colId), shown: !1 }))
|
|
1297
|
+
].filter((e) => e.s?.state === "value" && typeof e.s.raw == "number"), LAST = Number.MAX_SAFE_INTEGER;
|
|
1298
|
+
if (entries.sort((a, b) => (folded.leafOrder.get(a.r.id) ?? LAST) - (folded.leafOrder.get(b.r.id) ?? LAST)), entries.length !== leafRows.length + hiddenLeaves.length || entries.length === 0) return;
|
|
1299
|
+
let decimals = spec.decimals ?? 1, unit = Math.pow(10, -decimals), floors = entries.map((e) => Math.floor(e.s.raw / unit) * unit), remainders = entries.map((e, i) => e.s.raw - floors[i]), deficit = Math.round((100 - floors.reduce((a, b) => a + b, 0)) / unit), ownPrecision = entries.map((e) => {
|
|
1300
|
+
let cellSpec = cellSpecs.get(e.r.id)?.get(colId);
|
|
1301
|
+
return cellSpec !== void 0 && (cellSpec.decimals ?? 1) !== decimals;
|
|
1302
|
+
}), order = entries.map((_, i) => i).filter((i) => !ownPrecision[i]).sort((a, b) => remainders[b] - remainders[a] || a - b), adjusted = /* @__PURE__ */ new Set();
|
|
1303
|
+
for (let i of order) {
|
|
1304
|
+
if (deficit <= 0) break;
|
|
1305
|
+
adjusted.add(i), deficit--;
|
|
1306
|
+
}
|
|
1307
|
+
entries.forEach((e, i) => {
|
|
1308
|
+
if (ownPrecision[i] || !e.shown) return;
|
|
1309
|
+
let shown = floors[i] + (adjusted.has(i) ? unit : 0), cellSpec = cellSpecs.get(e.r.id)?.get(colId);
|
|
1310
|
+
displayOverride.set(tableCellKey(e.r.id, colId), shown === 0 && e.s.raw > 0 && spec.automatic && !cellSpec ? `<${formatNumber(unit, colId)}` : formatNumber(shown, colId, e.r.id)), overrideAmount.set(tableCellKey(e.r.id, colId), shown), adjusted.has(i) && Math.abs(shown - e.s.raw) > 1e-9 && records2.push({
|
|
1311
|
+
rowId: e.r.id,
|
|
1312
|
+
colId,
|
|
1313
|
+
op: "share-reconcile",
|
|
1314
|
+
// The display UNIT is half the calculation: this record says "the
|
|
1315
|
+
// exact share, rounded up by one unit". With only the exact share in
|
|
1316
|
+
// the receipt, the adjustment could not be checked against anything.
|
|
1317
|
+
inputs: [
|
|
1318
|
+
{ rowId: e.r.id, colId, value: e.s.raw },
|
|
1319
|
+
{ rowId: SHARE_UNIT_ROW_ID, colId, value: unit }
|
|
1320
|
+
],
|
|
1321
|
+
raw: shown,
|
|
1224
1322
|
state: "value",
|
|
1225
|
-
displayed:
|
|
1323
|
+
displayed: formatNumber(shown, colId, e.r.id),
|
|
1226
1324
|
kind: "rounding-adjustment"
|
|
1227
|
-
})
|
|
1228
|
-
}
|
|
1229
|
-
}
|
|
1230
|
-
for (let column of columns)
|
|
1231
|
-
(column.kind === "value" || column.kind === "computed") && column.align === "left" && warnings.push({
|
|
1232
|
-
code: "align-override-suspect",
|
|
1233
|
-
severity: "warn",
|
|
1234
|
-
message: `column '${column.id}' forces a numeric column left \u2014 right alignment is the comparison-safe default`,
|
|
1235
|
-
owner: { colId: column.id }
|
|
1236
|
-
});
|
|
1237
|
-
let resolvedColumns = columns.map((c) => ({
|
|
1238
|
-
id: c.id,
|
|
1239
|
-
kind: c.kind,
|
|
1240
|
-
label: c.label ?? (c.kind === "rowLabel" ? "" : c.id),
|
|
1241
|
-
...c.subLabel === void 0 ? {} : { subLabel: c.subLabel },
|
|
1242
|
-
format: c.kind === "value" || c.kind === "computed" ? formatExamples.get(c.id) : c.kind === "date" ? c.format : void 0,
|
|
1243
|
-
scenario: c.kind === "value" ? c.scenario : void 0,
|
|
1244
|
-
polarity: c.kind === "value" || c.kind === "computed" ? c.polarity : void 0,
|
|
1245
|
-
aggregate: c.kind === "value" ? c.aggregate ?? (nonAdditiveFormat(c.format) ? "none" : "sum") : "none",
|
|
1246
|
-
groupId: data.columnGroups?.find((g) => g.columns.includes(c.id))?.id,
|
|
1247
|
-
toggleGroup: toggleResolution.membership.get(c.id),
|
|
1248
|
-
width: c.width,
|
|
1249
|
-
maxWidth: c.kind === "rowLabel" ? c.maxWidth : void 0,
|
|
1250
|
-
maxTextWidth: c.kind === "rowLabel" ? c.maxTextWidth : void 0,
|
|
1251
|
-
wrap: c.kind === "text" ? c.wrap : void 0,
|
|
1252
|
-
statusMark: c.kind === "status" && c.mark === "square" ? "square" : void 0,
|
|
1253
|
-
unitLabel: uniformUnit === null && (c.kind === "value" || c.kind === "computed") ? headerUnitFor(c.id) ?? void 0 : void 0,
|
|
1254
|
-
...uniformUnit === null && (c.kind === "value" || c.kind === "computed") && headerUnitFor(c.id) !== null && headerScaledFor(c.id) ? { unitScaled: !0 } : {},
|
|
1255
|
-
...lettersInCells.has(c.id) ? { magnitudeInCells: !0 } : {},
|
|
1256
|
-
encoding: c.kind === "encoding" ? c.encoding : void 0,
|
|
1257
|
-
cellEncoding: resolveCellEncoding(encodingFor(options.encodings, c.id), specs.get(c.id)?.suffix.includes("%") === !0),
|
|
1258
|
-
// The preset's own two column decisions: a benchmark's first
|
|
1259
|
-
// column is the subject and carries the header's weight, a receipts
|
|
1260
|
-
// table's dates sit under each other on the right.
|
|
1261
|
-
emphasis: c.emphasis ?? (c.kind === "rowLabel" ? language.labelEmphasis : void 0),
|
|
1262
|
-
...c.band === void 0 ? {} : { band: c.band },
|
|
1263
|
-
...c.noteLine === void 0 ? {} : { noteLine: c.noteLine },
|
|
1264
|
-
// A cohort grid centres its figures: every cell in a period column is
|
|
1265
|
-
// the same two or three digits, and a right edge would draw a ragged
|
|
1266
|
-
// column of gaps. A column that names its own alignment, the
|
|
1267
|
-
// cohort size beside the label, keeps it.
|
|
1268
|
-
align: c.align ?? (c.kind === "value" || c.kind === "computed" ? isCohortDensity(options.density ?? "regular") ? "center" : "right" : c.kind === "status" ? "center" : c.kind === "date" && language.datesRight ? "right" : "left")
|
|
1269
|
-
})), driverToneMode = options.driverTones ?? "grouped";
|
|
1270
|
-
function driverToneOf(row) {
|
|
1271
|
-
return driverToneMode !== "grouped" ? driverToneMode === "always" : row.parentId !== null && flatById.get(row.parentId)?.role !== "section";
|
|
1272
|
-
}
|
|
1273
|
-
function memoIndentStep(row) {
|
|
1274
|
-
if (row.relation !== "ofWhich" || row.kind !== void 0 || row.parentId === null) return;
|
|
1275
|
-
let siblings = treeChildrenOf.get(row.parentId) ?? [];
|
|
1276
|
-
if (!siblings.slice(0, siblings.findIndex((sibling) => sibling.id === row.id)).some((sibling) => sibling.relation !== "ofWhich")) return;
|
|
1277
|
-
let parentStep = ladderStep(flatById.get(row.parentId), flatById, levelOffset);
|
|
1278
|
-
return parentStep < ladderStep(row, flatById, levelOffset) ? parentStep : void 0;
|
|
1279
|
-
}
|
|
1280
|
-
let resolvedRows = flat.map((row) => {
|
|
1281
|
-
let cells = emptyIdRecord();
|
|
1282
|
-
for (let col of columns)
|
|
1283
|
-
cells[col.id] = resolveCell(row, col);
|
|
1284
|
-
let hasChildren = (treeChildrenOf.get(row.id) ?? []).length > 0, indentStep = memoIndentStep(row);
|
|
1285
|
-
return {
|
|
1286
|
-
id: row.id,
|
|
1287
|
-
label: row.label,
|
|
1288
|
-
...row.parentId === null ? {} : { parentId: row.parentId },
|
|
1289
|
-
hasChildren,
|
|
1290
|
-
...hasChildren ? { defaultExpanded: expansion.get(row.id) } : {},
|
|
1291
|
-
level: row.level,
|
|
1292
|
-
step: ladderStep(row, flatById, levelOffset),
|
|
1293
|
-
...indentStep === void 0 ? {} : { indentStep },
|
|
1294
|
-
...row.kind === void 0 ? {} : { kind: row.kind },
|
|
1295
|
-
...row.kind === "driver" && driverToneOf(row) ? { driverTone: !0 } : {},
|
|
1296
|
-
...row.sign === void 0 ? {} : { sign: row.sign },
|
|
1297
|
-
...row.final === void 0 ? {} : { final: row.final },
|
|
1298
|
-
...options.signs === "operators" ? { operator: row.sign === -1 ? "\u2212" : row.kind === "result" ? "=" : row.operator } : {},
|
|
1299
|
-
...row.divider === !0 ? { divider: !0 } : {},
|
|
1300
|
-
role: row.role,
|
|
1301
|
-
relation: row.relation,
|
|
1302
|
-
order: row.order,
|
|
1303
|
-
...row.polarity === void 0 ? {} : { polarity: row.polarity },
|
|
1304
|
-
...row.inline === !0 ? { inline: !0, inlineGroup: row.inlineGroup ?? row.id } : {},
|
|
1305
|
-
highlightTone: highlightedRows.has(row.id) ? rowHighlightTone(cells) : void 0,
|
|
1306
|
-
// A forced magnitude wins: it is a claim about the whole table, and
|
|
1307
|
-
// the letter it hoists out of the cells has to be the one the label
|
|
1308
|
-
// prints. Without one the author's own affix stands.
|
|
1309
|
-
...hoistedRowUnits.has(row.id) ? headUnit === void 0 ? { unitAffix: row.kind === "member" && row.unitAffix ? `${row.unitAffix.split(",")[0]}, ${hoistedRowUnits.get(row.id)}` : hoistedRowUnits.get(row.id) } : {} : row.unitAffix === void 0 ? {} : { unitAffix: row.unitAffix },
|
|
1310
|
-
...row.spacer === void 0 ? {} : { spacer: row.spacer },
|
|
1311
|
-
...hasChildren && row.foldable === !1 ? { foldable: !1 } : {},
|
|
1312
|
-
...row.badge === void 0 ? {} : { badge: { text: row.badge.text, tone: row.badge.tone ?? "neutral" } },
|
|
1313
|
-
cells
|
|
1314
|
-
};
|
|
1315
|
-
});
|
|
1316
|
-
{
|
|
1317
|
-
let resolvedById = new Map(resolvedRows.map((row) => [row.id, row]));
|
|
1318
|
-
for (let [parentId, list] of childrenOf) {
|
|
1319
|
-
if (parentId === null) continue;
|
|
1320
|
-
let lines = list.filter((child) => child.inline === !0).map((child) => resolvedById.get(child.id));
|
|
1321
|
-
lines.length > 0 && (resolvedById.get(parentId).inlineRows = lines);
|
|
1325
|
+
});
|
|
1326
|
+
});
|
|
1322
1327
|
}
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
let
|
|
1338
|
-
|
|
1328
|
+
let scaledBy100 = (calc) => "op" in calc && calc.op === "mul" && [calc.a, calc.b].some((side) => "lit" in side && side.lit === 100);
|
|
1329
|
+
for (let col of [...valueCols, ...computedCols]) {
|
|
1330
|
+
if (col.kind === "computed" ? calcYieldsPoints(col.calc) || scaledBy100(col.calc) : col.percentScale === "points") continue;
|
|
1331
|
+
let spec = col.kind === "computed" || col.format ? specs.get(col.id) : void 0;
|
|
1332
|
+
if (!spec || !(spec.suffix ?? "").includes("%")) continue;
|
|
1333
|
+
let vals = flat.map((r) => rawState2.get(r.id).get(col.id)).filter((s) => !!s && typeof s.raw == "number");
|
|
1334
|
+
vals.length > 0 && vals.every((v) => Math.abs(v.raw) <= 1.5) && warnings2.push({
|
|
1335
|
+
code: "percent-scale-suspect",
|
|
1336
|
+
severity: "warn",
|
|
1337
|
+
message: col.kind === "computed" ? `column '${col.id}': the format is percent but every computed value is within \xB11.5 \u2014 percent columns carry POINTS, and a ratio calc yields a FRACTION (0.42 renders "0.4%"); multiply by 100 (mul(div(a,b), lit 100)) or drop the '%'` : `column '${col.id}': every value is within \xB11.5 but the format is percent \u2014 percent values are authored in POINTS (6.2 \u2192 "6.2%"); these look like fractions`,
|
|
1338
|
+
...col.kind === "value" ? { suggest: "values already in points: set percentScale: 'points' on the column" } : {}
|
|
1339
|
+
});
|
|
1340
|
+
}
|
|
1341
|
+
for (let row of flat) {
|
|
1342
|
+
let rowSpec = rowSpecs.get(row.id);
|
|
1343
|
+
if (!rowSpec || row.calc || !(rowSpec.suffix ?? "").includes("%")) continue;
|
|
1344
|
+
let vals = valueCols.filter((col) => !ownFormatColumns.has(col.id) && col.percentScale !== "points").map((col) => rawState2.get(row.id).get(col.id)).filter((s) => !!s && typeof s.raw == "number");
|
|
1345
|
+
vals.length > 0 && vals.every((v) => Math.abs(v.raw) <= 1.5) && warnings2.push({
|
|
1346
|
+
code: "percent-scale-suspect",
|
|
1347
|
+
severity: "warn",
|
|
1348
|
+
message: `row '${row.id}': every value is within \xB11.5 but the row format is percent \u2014 percent values are authored in POINTS (6.2 \u2192 "6.2%"); these look like fractions`
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
for (let row of flat) {
|
|
1352
|
+
if (row.role === "section") continue;
|
|
1353
|
+
let kids = summandsOf(row.id);
|
|
1354
|
+
if (kids.length !== 0)
|
|
1355
|
+
for (let col of valueCols) {
|
|
1356
|
+
if (aggregateFor(col, row) !== "sum") continue;
|
|
1357
|
+
let spec = specFor(col.id, row.id), p = rawState2.get(row.id).get(col.id);
|
|
1358
|
+
if (p.state !== "value" || typeof p.raw != "number") continue;
|
|
1359
|
+
let childRaw = kids.map((k) => rawState2.get(k.id).get(col.id)).filter((s) => s.state === "value" && typeof s.raw == "number").map((s, i) => s.raw * signTo(kids[i], row.id));
|
|
1360
|
+
if (childRaw.length !== kids.length) continue;
|
|
1361
|
+
let rawSum = childRaw.reduce((a, b) => a + b, 0), rawGap = p.raw - rawSum, noise = floatNoise(p.raw, rawSum), parentShown = roundedNumber(p.raw, spec), childShown = childRaw.map((value, i) => roundedNumber(value, specFor(col.id, kids[i].id))), displayGap = parentShown - childShown.reduce((a, b) => a + b, 0), roundingGap = Math.abs(rawGap) > noise ? displayGap - rawGap : displayGap, inputs = [
|
|
1362
|
+
{ rowId: row.id, colId: col.id, value: p.raw, role: "raw" },
|
|
1363
|
+
{ rowId: row.id, colId: col.id, value: parentShown, role: "displayed" },
|
|
1364
|
+
...kids.flatMap((k, i) => [
|
|
1365
|
+
{ rowId: k.id, colId: col.id, value: childRaw[i], role: "raw" },
|
|
1366
|
+
{ rowId: k.id, colId: col.id, value: childShown[i], role: "displayed" }
|
|
1367
|
+
])
|
|
1368
|
+
], unitOf2 = (candidate) => Math.pow(10, -candidate.decimals) * MAGNITUDE_DIVISOR[candidate.magnitude], displayUnit = Math.min(unitOf2(spec), minOf(kids.map((k) => unitOf2(specFor(col.id, k.id)))));
|
|
1369
|
+
Math.abs(roundingGap) > displayUnit * 0.5 && (autoFootnotes2.add(chartString2(options2, "tableRoundingNote")), records2.push({
|
|
1370
|
+
rowId: row.id,
|
|
1371
|
+
colId: col.id,
|
|
1372
|
+
op: "rounding-gap",
|
|
1373
|
+
inputs,
|
|
1374
|
+
raw: roundingGap,
|
|
1375
|
+
state: "value",
|
|
1376
|
+
displayed: "",
|
|
1377
|
+
kind: "rounding-adjustment"
|
|
1378
|
+
}));
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
for (let column of columns)
|
|
1382
|
+
(column.kind === "value" || column.kind === "computed") && column.align === "left" && warnings2.push({
|
|
1383
|
+
code: "align-override-suspect",
|
|
1384
|
+
severity: "warn",
|
|
1385
|
+
message: `column '${column.id}' forces a numeric column left \u2014 right alignment is the comparison-safe default`,
|
|
1386
|
+
owner: { colId: column.id }
|
|
1387
|
+
});
|
|
1388
|
+
let resolvedColumns = columns.map((c) => ({
|
|
1389
|
+
id: c.id,
|
|
1390
|
+
kind: c.kind,
|
|
1391
|
+
label: c.label ?? (c.kind === "rowLabel" ? "" : c.id),
|
|
1392
|
+
...c.subLabel === void 0 ? {} : { subLabel: c.subLabel },
|
|
1393
|
+
format: c.kind === "value" || c.kind === "computed" ? formatExamples.get(c.id) : c.kind === "date" ? c.format : void 0,
|
|
1394
|
+
scenario: c.kind === "value" ? c.scenario : void 0,
|
|
1395
|
+
polarity: c.kind === "value" || c.kind === "computed" ? c.polarity : void 0,
|
|
1396
|
+
aggregate: c.kind === "value" ? c.aggregate ?? (nonAdditiveFormat(c.format) ? "none" : "sum") : "none",
|
|
1397
|
+
groupId: data.columnGroups?.find((g) => g.columns.includes(c.id))?.id,
|
|
1398
|
+
toggleGroup: toggleResolution.membership.get(c.id),
|
|
1399
|
+
width: c.width,
|
|
1400
|
+
maxWidth: c.kind === "rowLabel" ? c.maxWidth : void 0,
|
|
1401
|
+
maxTextWidth: c.kind === "rowLabel" ? c.maxTextWidth : void 0,
|
|
1402
|
+
wrap: c.kind === "text" ? c.wrap : void 0,
|
|
1403
|
+
statusMark: c.kind === "status" && c.mark === "square" ? "square" : void 0,
|
|
1404
|
+
unitLabel: uniformUnit === null && (c.kind === "value" || c.kind === "computed") ? headerUnitFor(c.id) ?? void 0 : void 0,
|
|
1405
|
+
...uniformUnit === null && (c.kind === "value" || c.kind === "computed") && headerUnitFor(c.id) !== null && headerScaledFor(c.id) ? { unitScaled: !0 } : {},
|
|
1406
|
+
...lettersInCells.has(c.id) ? { magnitudeInCells: !0 } : {},
|
|
1407
|
+
encoding: c.kind === "encoding" ? c.encoding : void 0,
|
|
1408
|
+
cellEncoding: resolveCellEncoding(encodingFor(options2.encodings, c.id), specs.get(c.id)?.suffix.includes("%") === !0),
|
|
1409
|
+
// The preset's own two column decisions: a benchmark's first
|
|
1410
|
+
// column is the subject and carries the header's weight, a receipts
|
|
1411
|
+
// table's dates sit under each other on the right.
|
|
1412
|
+
emphasis: c.emphasis ?? (c.kind === "rowLabel" ? language.labelEmphasis : void 0),
|
|
1413
|
+
...c.band === void 0 ? {} : { band: c.band },
|
|
1414
|
+
...c.noteLine === void 0 ? {} : { noteLine: c.noteLine },
|
|
1415
|
+
...c.headAlign === void 0 ? {} : { headAlign: c.headAlign },
|
|
1416
|
+
// A cohort grid centres its figures: every cell in a period column is
|
|
1417
|
+
// the same two or three digits, and a right edge would draw a ragged
|
|
1418
|
+
// column of gaps. A column that names its own alignment, the
|
|
1419
|
+
// cohort size beside the label, keeps it.
|
|
1420
|
+
align: c.align ?? (c.kind === "value" || c.kind === "computed" ? isCohortDensity(options2.density ?? "regular") ? "center" : "right" : c.kind === "status" ? "center" : c.kind === "date" && language.datesRight ? "right" : "left")
|
|
1421
|
+
})), driverToneMode = options2.driverTones ?? "grouped";
|
|
1422
|
+
function driverToneOf(row) {
|
|
1423
|
+
return driverToneMode !== "grouped" ? driverToneMode === "always" : row.parentId !== null && flatById.get(row.parentId)?.role !== "section";
|
|
1424
|
+
}
|
|
1425
|
+
function memoIndentStep(row) {
|
|
1426
|
+
if (row.relation !== "ofWhich" || row.kind !== void 0 || row.parentId === null) return;
|
|
1427
|
+
let siblings = treeChildrenOf.get(row.parentId) ?? [];
|
|
1428
|
+
if (!siblings.slice(0, siblings.findIndex((sibling) => sibling.id === row.id)).some((sibling) => sibling.relation !== "ofWhich")) return;
|
|
1429
|
+
let parentStep = ladderStep(flatById.get(row.parentId), flatById, levelOffset);
|
|
1430
|
+
return parentStep < ladderStep(row, flatById, levelOffset) ? parentStep : void 0;
|
|
1431
|
+
}
|
|
1432
|
+
let resolvedRows = flat.map((row) => {
|
|
1433
|
+
let cells = emptyIdRecord();
|
|
1434
|
+
for (let col of columns)
|
|
1435
|
+
cells[col.id] = resolveCell(row, col);
|
|
1436
|
+
let hasChildren = (treeChildrenOf.get(row.id) ?? []).length > 0, indentStep = memoIndentStep(row);
|
|
1437
|
+
return {
|
|
1438
|
+
id: row.id,
|
|
1439
|
+
label: row.label,
|
|
1440
|
+
...row.parentId === null ? {} : { parentId: row.parentId },
|
|
1441
|
+
hasChildren,
|
|
1442
|
+
...hasChildren ? { defaultExpanded: expansion.get(row.id) } : {},
|
|
1443
|
+
level: row.level,
|
|
1444
|
+
step: ladderStep(row, flatById, levelOffset),
|
|
1445
|
+
...indentStep === void 0 ? {} : { indentStep },
|
|
1446
|
+
...row.kind === void 0 ? {} : { kind: row.kind },
|
|
1447
|
+
...row.kind === "driver" && driverToneOf(row) ? { driverTone: !0 } : {},
|
|
1448
|
+
...row.sign === void 0 ? {} : { sign: row.sign },
|
|
1449
|
+
...row.final === void 0 ? {} : { final: row.final },
|
|
1450
|
+
...options2.signs === "operators" ? { operator: row.sign === -1 ? "\u2212" : row.kind === "result" ? "=" : row.operator } : {},
|
|
1451
|
+
...row.divider === !0 ? { divider: !0 } : {},
|
|
1452
|
+
role: row.role,
|
|
1453
|
+
relation: row.relation,
|
|
1454
|
+
order: row.order,
|
|
1455
|
+
...row.polarity === void 0 ? {} : { polarity: row.polarity },
|
|
1456
|
+
...row.inline === !0 ? { inline: !0, inlineGroup: row.inlineGroup ?? row.id } : {},
|
|
1457
|
+
highlightTone: highlightedRows.has(row.id) ? rowHighlightTone(cells) : void 0,
|
|
1458
|
+
// A forced magnitude wins: it is a claim about the whole table, and
|
|
1459
|
+
// the letter it hoists out of the cells has to be the one the label
|
|
1460
|
+
// prints. Without one the author's own affix stands.
|
|
1461
|
+
...hoistedRowUnits.has(row.id) ? headUnit === void 0 ? { unitAffix: row.kind === "member" && row.unitAffix ? `${row.unitAffix.split(",")[0]}, ${hoistedRowUnits.get(row.id)}` : hoistedRowUnits.get(row.id) } : {} : row.unitAffix === void 0 ? {} : { unitAffix: row.unitAffix },
|
|
1462
|
+
...row.spacer === void 0 ? {} : { spacer: row.spacer },
|
|
1463
|
+
...hasChildren && row.foldable === !1 ? { foldable: !1 } : {},
|
|
1464
|
+
...row.badge === void 0 ? {} : { badge: { text: row.badge.text, tone: row.badge.tone ?? "neutral" } },
|
|
1465
|
+
cells
|
|
1466
|
+
};
|
|
1339
1467
|
});
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1468
|
+
{
|
|
1469
|
+
let resolvedById = new Map(resolvedRows.map((row) => [row.id, row]));
|
|
1470
|
+
for (let [parentId, list] of childrenOf2) {
|
|
1471
|
+
if (parentId === null) continue;
|
|
1472
|
+
let lines = list.filter((child) => child.inline === !0).map((child) => resolvedById.get(child.id));
|
|
1473
|
+
lines.length > 0 && (resolvedById.get(parentId).inlineRows = lines);
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
function judgementTone(tone, strong) {
|
|
1477
|
+
return options2.judgements === "exceptions" && (tone === "warn" || tone === "good" && !strong) ? "neutral" : tone;
|
|
1478
|
+
}
|
|
1479
|
+
function blankInputs(row, col) {
|
|
1480
|
+
let calc = row.calc ?? (col.kind === "computed" ? col.calc : void 0);
|
|
1481
|
+
if (calc === void 0) return !1;
|
|
1482
|
+
let gaps = calcRefs(calc).flatMap((ref) => {
|
|
1483
|
+
let rowId = typeof ref == "string" ? row.id : ref.row, colId = typeof ref == "string" ? ref : ref.col ?? (ref.previous ? previousColumnInGroup(data.columnGroups ?? [], col.id) : col.id);
|
|
1484
|
+
if (colId === null) return [];
|
|
1485
|
+
let state = rawState2.get(rowId)?.get(colId);
|
|
1486
|
+
return state !== void 0 && state.state === "missing" ? [{ rowId, colId }] : [];
|
|
1487
|
+
});
|
|
1488
|
+
return gaps.length > 0 && gaps.every(({ rowId, colId }) => {
|
|
1489
|
+
let input = flatById.get(rowId), cell = input?.cells[colId];
|
|
1490
|
+
return ((isCellObject(cell) ? cell.missing : void 0) ?? input?.missing) === "blank";
|
|
1491
|
+
});
|
|
1492
|
+
}
|
|
1493
|
+
function resolveCell(row, col) {
|
|
1494
|
+
let authored = row.cells[col.id], obj = isCellObject(authored) ? authored : void 0, missing = obj?.missing ?? row.missing, missingGlyph = missing === void 0 ? tableMissingGlyph : missing === "blank" ? "" : glyphs.missing, base = {
|
|
1495
|
+
rowId: row.id,
|
|
1496
|
+
colId: col.id,
|
|
1497
|
+
kind: col.kind,
|
|
1498
|
+
raw: null,
|
|
1499
|
+
state: "missing",
|
|
1500
|
+
displayed: "",
|
|
1501
|
+
tone: judgementTone(obj?.tone ?? "neutral", obj?.strong),
|
|
1502
|
+
note: obj?.note,
|
|
1503
|
+
href: obj?.href,
|
|
1504
|
+
...obj?.heat === !1 ? { heat: !1 } : {},
|
|
1505
|
+
...obj?.strong === !0 && obj.tone !== void 0 && obj.tone !== "neutral" ? { strong: !0 } : {},
|
|
1506
|
+
...typeof obj?.bar == "number" && Number.isFinite(obj.bar) ? { bar: Math.min(1, Math.max(0, obj.bar)) } : {},
|
|
1507
|
+
...(col.kind === "value" || col.kind === "computed") && obj?.format !== void 0 ? { format: obj.format } : {},
|
|
1508
|
+
scenario: col.kind === "value" ? col.scenario : void 0,
|
|
1509
|
+
role: row.role,
|
|
1510
|
+
relation: row.relation,
|
|
1511
|
+
level: row.level
|
|
1512
|
+
};
|
|
1513
|
+
if (row.role === "section" && col.kind !== "rowLabel")
|
|
1514
|
+
return { ...base, state: "na", displayed: "" };
|
|
1515
|
+
if (obj?.state && col.kind !== "rowLabel" && col.kind !== "encoding")
|
|
1516
|
+
return { ...base, raw: null, state: obj.state, displayed: glyphs[obj.state], tone: "neutral", ...obj.muted === !0 ? { deEmphasized: !0 } : {} };
|
|
1517
|
+
switch (col.kind) {
|
|
1518
|
+
case "rowLabel":
|
|
1519
|
+
return { ...base, raw: row.label, state: "value", displayed: row.label };
|
|
1520
|
+
case "value":
|
|
1521
|
+
case "computed": {
|
|
1522
|
+
let evaluated = rawState2.get(row.id).get(col.id), s = evaluated ?? { raw: null, state: "missing" }, displayed, negated = !1;
|
|
1523
|
+
if (s.state !== "value" || typeof s.raw != "number") {
|
|
1524
|
+
let state = s.state === "value" ? "missing" : s.state, noPreviousColumn = row.calc !== void 0 && JSON.stringify(row.calc).includes('"previous":true') && previousColumnInGroup(data.columnGroups ?? [], col.id) === null, noPreviousValue = state === "na" && previousPlaceholders && noPreviousColumn;
|
|
1525
|
+
displayed = state === "missing" && gapWord && missing === void 0 && evaluated !== void 0 && !(noPreviousColumn && noPrevious === "missing") && !blankInputs(row, col) ? glyphs.na : state === "missing" || noPreviousValue ? missingGlyph : glyphs[state];
|
|
1526
|
+
} else {
|
|
1527
|
+
let relativeChange = (row.inline === !0 || row.calc !== void 0 || col.kind === "computed") && (specUnitKind(specFor(col.id, row.id)) !== "number" || row.calc !== void 0 && calcYieldsPoints(row.calc) || col.kind === "computed" && calcYieldsPoints(col.calc)), negate = (options2.signs ?? "signed") === "signed" && row.kind !== "driver" && row.kind !== "result" && !relativeChange && signTo(row, null) === -1 && (col.kind !== "computed" || row.calc !== void 0 || calcFlipsWithInputs(col.calc));
|
|
1528
|
+
negated = negate && s.raw !== 0, displayed = (negate ? void 0 : displayOverride.get(tableCellKey(row.id, col.id))) ?? formatNumber(negate && s.raw !== 0 ? -s.raw : s.raw, col.id, row.id), negate && locale.minusGlyph === "-" && (displayed = displayed.replace(MINUS, "-")), s.partial && !(headMarksPartial && partialColumnIds.has(col.id)) && (displayed = `${displayed} ${options2.strings?.incomplete ?? localeStrings(options2.locale?.language).incomplete}`);
|
|
1529
|
+
}
|
|
1530
|
+
let band = obj?.bands !== void 0 && s.state === "value" && typeof s.raw == "number" ? bandFor(s.raw, obj.bands) : void 0, bandIndex = band === void 0 ? -1 : obj.bands.indexOf(band), tone = obj?.tone ?? band?.tone ?? "neutral", deEmphasized, judgmentRow = row.relation === "additive" || row.calc !== void 0 || row.inline === !0 && row.polarity !== void 0, polarity = col.polarity !== void 0 ? row.polarity ?? col.polarity : row.calc !== void 0 || row.inline === !0 || specFor(col.id, row.id).signed ? row.polarity : void 0;
|
|
1531
|
+
if (s.state === "value" && typeof s.raw == "number" && judgmentRow) {
|
|
1532
|
+
if (polarity && !obj?.tone && band === void 0 && roundedNumber(s.raw, specFor(col.id, row.id)) !== 0) {
|
|
1533
|
+
let goodSign = polarity === "higherIsBetter" ? 1 : -1;
|
|
1534
|
+
tone = Math.sign(s.raw) === goodSign ? "good" : "bad";
|
|
1535
|
+
let measure = row.polarity === void 0 ? col.label ?? col.id : row.inline === !0 && row.parentId !== null ? flatById.get(row.parentId)?.label ?? row.label : row.label;
|
|
1536
|
+
(polarity === "lowerIsBetter" ? lowerJudged : higherJudged).add(measure);
|
|
1537
|
+
}
|
|
1538
|
+
let mat = col.materiality, threshold = specs.get(col.id).suffix.includes("%") ? mat?.pct : mat?.abs;
|
|
1539
|
+
threshold !== void 0 && Math.abs(roundedNumber(s.raw, specFor(col.id, row.id))) < threshold && (deEmphasized = !0, tone = "neutral");
|
|
1540
|
+
}
|
|
1541
|
+
obj?.muted === !0 && (deEmphasized = !0, tone = "neutral"), tone = judgementTone(tone, obj?.strong);
|
|
1542
|
+
let reconciled = overrideAmount.get(tableCellKey(row.id, col.id)), zero = tone === "neutral" && !deEmphasized && s.state === "value" && typeof s.raw == "number" && (reconciled !== void 0 ? Math.abs(reconciled) < 1e-9 : roundedNumber(s.raw, specFor(col.id, row.id)) === 0);
|
|
1543
|
+
return {
|
|
1544
|
+
...base,
|
|
1545
|
+
raw: s.raw,
|
|
1546
|
+
state: s.state,
|
|
1547
|
+
displayed,
|
|
1548
|
+
tone,
|
|
1549
|
+
deEmphasized,
|
|
1550
|
+
polarity,
|
|
1551
|
+
...zero ? { zero: !0 } : {},
|
|
1552
|
+
...negated ? { negated: !0 } : {},
|
|
1553
|
+
...band === void 0 ? {} : { band: { to: band.to, ...bandIndex > 0 ? { from: obj.bands[bandIndex - 1].to } : {}, ...band.label === void 0 ? {} : { label: band.label } } }
|
|
1554
|
+
};
|
|
1377
1555
|
}
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1556
|
+
case "status": {
|
|
1557
|
+
let rowPaths = (rows, base2) => rows.flatMap((candidate, index) => [
|
|
1558
|
+
...candidate.id === row.id ? [[...base2, index]] : [],
|
|
1559
|
+
...candidate.children ? rowPaths(candidate.children, [...base2, index, "children"]) : []
|
|
1560
|
+
]), given = typeof authored == "number" ? authored : obj?.v, written = typeof authored == "string" ? authored : typeof given == "string" ? given : null, v = written;
|
|
1561
|
+
if (typeof given == "number")
|
|
1562
|
+
return warnings2.push({
|
|
1563
|
+
code: "status-value-number",
|
|
1564
|
+
severity: "warn",
|
|
1565
|
+
message: `status cell rows[${row.id}].cells[${col.id}] holds the number ${given} and draws the missing dash; write one of: ${STATUS_VALUES.join(" \xB7 ")}, or use a text column with a cell tone. A later release refuses a number here.`,
|
|
1566
|
+
owner: { rowId: row.id, colId: col.id }
|
|
1567
|
+
}), { ...base, displayed: missingGlyph };
|
|
1568
|
+
if (v !== null && !STATUS_VALUES.includes(v)) {
|
|
1569
|
+
let converted = caseInsensitiveValue(v, STATUS_VALUES) ?? (Object.hasOwn(STATUS_WORDS, v.toLowerCase()) ? STATUS_WORDS[v.toLowerCase()] : void 0);
|
|
1570
|
+
if (converted !== void 0) {
|
|
1571
|
+
let field = [...rowPaths(data.rows, ["data", "rows"])[0], "cells", col.id, ...obj ? ["v"] : []];
|
|
1572
|
+
warnings2.push(inputConversion(field, v, converted)), v = converted;
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
if (v !== null && !STATUS_VALUES.includes(v)) {
|
|
1576
|
+
let paths = rowPaths(data.rows, ["data", "rows"]);
|
|
1577
|
+
throw new NormalizeError(
|
|
1578
|
+
"status-value-invalid",
|
|
1579
|
+
`rows[${row.id}].cells[${col.id}]`,
|
|
1580
|
+
`status '${v}' is not one of: ${STATUS_VALUES.join(" \xB7 ")}; for free status text use a text column with a cell tone`,
|
|
1581
|
+
"Use on-track, at-risk, off-track, done or pending, or green, amber, yellow or red (any case). Send { state: 'na' } for a status that cannot be decided, or use a text column with a cell tone for free text.",
|
|
1582
|
+
void 0,
|
|
1583
|
+
paths.length === 1 ? [...paths[0], "cells", col.id, ...obj ? ["v"] : []] : void 0
|
|
1584
|
+
);
|
|
1385
1585
|
}
|
|
1386
|
-
|
|
1387
|
-
|
|
1586
|
+
if (v === null) return { ...base, displayed: missingGlyph };
|
|
1587
|
+
let tone = v === "off-track" ? "bad" : v === "at-risk" ? "warn" : v === "done" || v === "on-track" ? "good" : "neutral", labels = col.kind === "status" ? col.labels : void 0, displayed = written === v ? labels?.[v] ?? v : labels?.[written] ?? labels?.[v] ?? v;
|
|
1588
|
+
return { ...base, raw: v, state: "value", displayed, tone: judgementTone(tone, obj?.strong) };
|
|
1388
1589
|
}
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
raw: s.raw,
|
|
1394
|
-
state: s.state,
|
|
1395
|
-
displayed,
|
|
1396
|
-
tone,
|
|
1397
|
-
deEmphasized,
|
|
1398
|
-
polarity,
|
|
1399
|
-
...zero ? { zero: !0 } : {},
|
|
1400
|
-
...negated ? { negated: !0 } : {},
|
|
1401
|
-
...band === void 0 ? {} : { band: { to: band.to, ...bandIndex > 0 ? { from: obj.bands[bandIndex - 1].to } : {}, ...band.label === void 0 ? {} : { label: band.label } } }
|
|
1402
|
-
};
|
|
1403
|
-
}
|
|
1404
|
-
case "status": {
|
|
1405
|
-
let given = typeof authored == "number" ? authored : obj?.v, written = typeof authored == "string" ? authored : typeof given == "string" ? given : null, v = written;
|
|
1406
|
-
if (typeof given == "number")
|
|
1407
|
-
return warnings.push({
|
|
1408
|
-
code: "status-value-number",
|
|
1590
|
+
case "date": {
|
|
1591
|
+
let given = typeof authored == "number" ? authored : obj?.v, v = typeof authored == "string" ? authored : typeof given == "string" ? given : null;
|
|
1592
|
+
if (typeof given == "number" && warnings2.push({
|
|
1593
|
+
code: "date-value-number",
|
|
1409
1594
|
severity: "warn",
|
|
1410
|
-
message: `
|
|
1595
|
+
message: `date cell rows[${row.id}].cells[${col.id}] holds the number ${given} and draws the missing dash; write an ISO date (YYYY-MM-DD), or use a value or text column.`,
|
|
1411
1596
|
owner: { rowId: row.id, colId: col.id }
|
|
1412
|
-
}), { ...base, displayed: missingGlyph };
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
}
|
|
1597
|
+
}), v === null) return { ...base, displayed: missingGlyph };
|
|
1598
|
+
let d = parseISODate(v);
|
|
1599
|
+
if (!d)
|
|
1600
|
+
throw new NormalizeError(
|
|
1601
|
+
"date-invalid",
|
|
1602
|
+
`rows[${row.id}].cells[${col.id}]`,
|
|
1603
|
+
`'${v}' is not an ISO date (YYYY-MM-DD)`,
|
|
1604
|
+
void 0,
|
|
1605
|
+
void 0,
|
|
1606
|
+
rowPointer(source.rows, (authored2) => authored2.id === row.id, "cells", col.id)
|
|
1607
|
+
);
|
|
1608
|
+
let pattern = datePatterns.get(col.id);
|
|
1609
|
+
return { ...base, raw: v, state: "value", displayed: formatDate(d, pattern, options2.locale?.language) };
|
|
1426
1610
|
}
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
);
|
|
1434
|
-
if (v === null) return { ...base, displayed: missingGlyph };
|
|
1435
|
-
let tone = v === "off-track" ? "bad" : v === "at-risk" ? "warn" : v === "done" || v === "on-track" ? "good" : "neutral", labels = col.kind === "status" ? col.labels : void 0, displayed = written === v ? labels?.[v] ?? v : labels?.[written] ?? labels?.[v] ?? v;
|
|
1436
|
-
return { ...base, raw: v, state: "value", displayed, tone: judgementTone(tone, obj?.strong) };
|
|
1437
|
-
}
|
|
1438
|
-
case "date": {
|
|
1439
|
-
let given = typeof authored == "number" ? authored : obj?.v, v = typeof authored == "string" ? authored : typeof given == "string" ? given : null;
|
|
1440
|
-
if (typeof given == "number" && warnings.push({
|
|
1441
|
-
code: "date-value-number",
|
|
1442
|
-
severity: "warn",
|
|
1443
|
-
message: `date cell rows[${row.id}].cells[${col.id}] holds the number ${given} and draws the missing dash; write an ISO date (YYYY-MM-DD), or use a value or text column.`,
|
|
1444
|
-
owner: { rowId: row.id, colId: col.id }
|
|
1445
|
-
}), v === null) return { ...base, displayed: missingGlyph };
|
|
1446
|
-
let d = parseISODate(v);
|
|
1447
|
-
if (!d)
|
|
1448
|
-
throw new NormalizeError(
|
|
1449
|
-
"date-invalid",
|
|
1450
|
-
`rows[${row.id}].cells[${col.id}]`,
|
|
1451
|
-
`'${v}' is not an ISO date (YYYY-MM-DD)`
|
|
1452
|
-
);
|
|
1453
|
-
let pattern = datePatterns.get(col.id);
|
|
1454
|
-
return { ...base, raw: v, state: "value", displayed: formatDate(d, pattern, options.locale?.language) };
|
|
1455
|
-
}
|
|
1456
|
-
case "text": {
|
|
1457
|
-
let v = typeof authored == "string" ? authored : typeof authored == "number" ? String(authored) : obj?.v !== void 0 ? String(obj.v) : null;
|
|
1458
|
-
return v === null && !obj?.note ? { ...base, displayed: "" } : { ...base, raw: v, state: "value", displayed: v ?? "" };
|
|
1611
|
+
case "text": {
|
|
1612
|
+
let v = typeof authored == "string" ? authored : typeof authored == "number" ? String(authored) : obj?.v !== void 0 ? String(obj.v) : null;
|
|
1613
|
+
return v === null && !obj?.note ? { ...base, displayed: "" } : { ...base, raw: v, state: "value", displayed: v ?? "" };
|
|
1614
|
+
}
|
|
1615
|
+
case "encoding":
|
|
1616
|
+
return { ...base, state: "value", displayed: "" };
|
|
1459
1617
|
}
|
|
1460
|
-
case "encoding":
|
|
1461
|
-
return { ...base, state: "value", displayed: "" };
|
|
1462
1618
|
}
|
|
1619
|
+
stampRecordDisplay(records2, resolvedRows, formatNumber), sortSiblingGroups(childrenOf2, resolvedRows, resolvedColumns, options2, generatedOthers);
|
|
1620
|
+
let totalPos = options2.totalPosition ?? language.totalPosition, ordered = orderRows(resolvedRows, childrenOf2, totalPos);
|
|
1621
|
+
ordered.forEach((r, i) => r.order = i);
|
|
1622
|
+
for (let row of ordered) {
|
|
1623
|
+
if (!generatedOthers.has(row.id) || !row.hasChildren) continue;
|
|
1624
|
+
let members = (treeChildrenOf.get(row.id) ?? []).map((child) => child.label);
|
|
1625
|
+
autoFootnotes2.add(chartString2(options2, "tableGroupsNote", { group: row.label, members: members.join(", ") }));
|
|
1626
|
+
}
|
|
1627
|
+
let perColumnHeat = resolvedColumns.flatMap((column) => (column.kind === "value" || column.kind === "computed") && column.cellEncoding?.type === "heat" && (column.cellEncoding.scale ?? "column") === "column" ? [column.cellEncoding.cap === void 0 ? column.id : JSON.stringify(column.cellEncoding.cap)] : []);
|
|
1628
|
+
new Set(perColumnHeat).size > 1 && autoFootnotes2.add(chartString2(options2, "tableHeatColumnNote"));
|
|
1629
|
+
let statusNote = statusDirectionNote(resolvedColumns, heatRanges(resolvedColumns, ordered), options2.colorblindSafe === !0, options2.locale?.language);
|
|
1630
|
+
if (statusNote !== void 0 && autoFootnotes2.add(statusNote), resolvedColumns.some((column) => column.cellEncoding?.type === "arrow" && column.cellEncoding.scale === "relative" && column.kind === "computed" && column.polarity) && autoFootnotes2.add(chartString2(options2, "tableArrowNote")), lowerJudged.size && higherJudged.size) {
|
|
1631
|
+
let [fewer, word] = lowerJudged.size <= higherJudged.size ? [lowerJudged, "tableLower"] : [higherJudged, "tableHigher"];
|
|
1632
|
+
autoFootnotes2.add(chartString2(options2, options2.colorblindSafe === !0 ? "tableFavourableGood" : "tableFavourableGreen", { direction: chartString2(options2, word), columns: [...fewer].join(", ") }));
|
|
1633
|
+
}
|
|
1634
|
+
let footnotes = [...autoFootnotes2];
|
|
1635
|
+
if (headMarksPartial) for (let column of resolvedColumns) partialColumnIds.has(column.id) && (column.partial = !0);
|
|
1636
|
+
let result = {
|
|
1637
|
+
...zeroLifts.count === liftsBefore && rawLifts === 0 ? {} : { lifted: !0 },
|
|
1638
|
+
table: {
|
|
1639
|
+
columns: resolvedColumns,
|
|
1640
|
+
columnGroups: (data.columnGroups ?? []).map((g) => ({
|
|
1641
|
+
id: g.id,
|
|
1642
|
+
label: g.label,
|
|
1643
|
+
columnIds: g.columns,
|
|
1644
|
+
...g.band === void 0 ? {} : { band: g.band },
|
|
1645
|
+
...g.note === void 0 ? {} : { note: g.note },
|
|
1646
|
+
...g.spacer === void 0 ? {} : { spacer: g.spacer },
|
|
1647
|
+
...g.heading === void 0 ? {} : { heading: g.heading },
|
|
1648
|
+
...g.hoverSeries === void 0 ? {} : { hoverSeries: g.hoverSeries }
|
|
1649
|
+
})),
|
|
1650
|
+
columnToggles: toggleResolution.toggles,
|
|
1651
|
+
rows: ordered,
|
|
1652
|
+
unit: uniformUnit ?? void 0,
|
|
1653
|
+
...columnUnits ? { columnUnits: !0 } : {},
|
|
1654
|
+
...data.levelNouns === void 0 ? {} : { levelNouns: data.levelNouns },
|
|
1655
|
+
footnotes,
|
|
1656
|
+
...partialColumnIds.size > 0 ? { partialColumnIds: [...partialColumnIds], partialNote } : {},
|
|
1657
|
+
...options2.colorblindSafe === !0 ? { colorblindSafe: !0 } : {},
|
|
1658
|
+
provenance: {}
|
|
1659
|
+
},
|
|
1660
|
+
computedCells: records2,
|
|
1661
|
+
warnings: warnings2
|
|
1662
|
+
};
|
|
1663
|
+
return evaluatedStates.set(result, rawState2), result;
|
|
1463
1664
|
}
|
|
1464
|
-
stampRecordDisplay(records, resolvedRows, formatNumber), sortSiblingGroups(childrenOf, resolvedRows, resolvedColumns, options, generatedOthers);
|
|
1465
|
-
let totalPos = options.totalPosition ?? language.totalPosition, ordered = orderRows(resolvedRows, childrenOf, totalPos);
|
|
1466
|
-
ordered.forEach((r, i) => r.order = i);
|
|
1467
|
-
for (let row of ordered) {
|
|
1468
|
-
if (!generatedOthers.has(row.id) || !row.hasChildren) continue;
|
|
1469
|
-
let members = (treeChildrenOf.get(row.id) ?? []).map((child) => child.label);
|
|
1470
|
-
autoFootnotes.add(`${row.label} groups ${members.join(", ")}.`);
|
|
1471
|
-
}
|
|
1472
|
-
resolvedColumns.filter((column) => (column.kind === "value" || column.kind === "computed") && column.cellEncoding?.type === "heat" && (column.cellEncoding.scale ?? "column") === "column" && column.cellEncoding.cap === void 0).length > 1 && autoFootnotes.add(HEAT_COLUMN_FOOTNOTE);
|
|
1473
|
-
let statusNote = statusDirectionNote(resolvedColumns, heatRanges(resolvedColumns, ordered), options.colorblindSafe === !0);
|
|
1474
|
-
if (statusNote !== void 0 && autoFootnotes.add(statusNote), resolvedColumns.some((column) => column.cellEncoding?.type === "arrow" && column.cellEncoding.scale === "relative" && column.kind === "computed" && column.polarity) && autoFootnotes.add(ARROW_FOOTNOTE), lowerJudged.size && higherJudged.size) {
|
|
1475
|
-
let [fewer, word] = lowerJudged.size <= higherJudged.size ? [lowerJudged, "Lower"] : [higherJudged, "Higher"];
|
|
1476
|
-
autoFootnotes.add(`${options.colorblindSafe === !0 ? "The good tone" : "Green"} marks a favourable change. ${word} is better for ${[...fewer].join(", ")}.`);
|
|
1477
|
-
}
|
|
1478
|
-
let footnotes = [...autoFootnotes];
|
|
1479
|
-
if (disclosuresShown(options)) for (let column of resolvedColumns) partialColumnIds.has(column.id) && (column.partial = !0);
|
|
1480
|
-
let result = {
|
|
1481
|
-
...zeroLifts.count === liftsBefore ? {} : { lifted: !0 },
|
|
1482
|
-
table: {
|
|
1483
|
-
columns: resolvedColumns,
|
|
1484
|
-
columnGroups: (data.columnGroups ?? []).map((g) => ({
|
|
1485
|
-
id: g.id,
|
|
1486
|
-
label: g.label,
|
|
1487
|
-
columnIds: g.columns,
|
|
1488
|
-
...g.band === void 0 ? {} : { band: g.band },
|
|
1489
|
-
...g.note === void 0 ? {} : { note: g.note },
|
|
1490
|
-
...g.spacer === void 0 ? {} : { spacer: g.spacer },
|
|
1491
|
-
...g.heading === void 0 ? {} : { heading: g.heading },
|
|
1492
|
-
...g.hoverSeries === void 0 ? {} : { hoverSeries: g.hoverSeries }
|
|
1493
|
-
})),
|
|
1494
|
-
columnToggles: toggleResolution.toggles,
|
|
1495
|
-
rows: ordered,
|
|
1496
|
-
unit: uniformUnit ?? void 0,
|
|
1497
|
-
...data.levelNouns === void 0 ? {} : { levelNouns: data.levelNouns },
|
|
1498
|
-
footnotes,
|
|
1499
|
-
...partialColumnIds.size > 0 ? { partialColumnIds: [...partialColumnIds] } : {},
|
|
1500
|
-
...options.colorblindSafe === !0 ? { colorblindSafe: !0 } : {},
|
|
1501
|
-
provenance: {}
|
|
1502
|
-
},
|
|
1503
|
-
computedCells: records,
|
|
1504
|
-
warnings
|
|
1505
|
-
};
|
|
1506
|
-
return evaluatedStates.set(result, rawState), result;
|
|
1507
1665
|
}
|
|
1508
1666
|
var HEAT_DEFAULT_ALPHA = 0.18, HEAT_STATUS_ALPHA = 0.26;
|
|
1509
1667
|
function encodingFor(encodings, columnId) {
|
|
@@ -1548,7 +1706,7 @@ function stampRecordDisplay(records, resolvedRows, formatNumber) {
|
|
|
1548
1706
|
for (let r of resolvedRows) for (let c of Object.values(r.cells)) cellIndex.set(tableCellKey(c.rowId, c.colId), c);
|
|
1549
1707
|
for (let rec of records) {
|
|
1550
1708
|
if (rec.kind === "reconciliation" || rec.kind === "rounding-adjustment") {
|
|
1551
|
-
rec.displayed = typeof rec.raw == "number" ? formatNumber(rec.raw, rec.colId, rec.kind === "rounding-adjustment" ? rec.rowId : void 0) : "";
|
|
1709
|
+
rec.displayed = typeof rec.raw == "number" ? formatNumber(rec.raw, rec.colId, rec.kind === "rounding-adjustment" ? rec.rowId : void 0) : "", rec.kind === "reconciliation" && typeof rec.raw == "number" && formatNumber(rec.raw, rec.colId, rec.rowId) === cellIndex.get(tableCellKey(rec.rowId, rec.colId))?.displayed && (rec.printedInCell = !0);
|
|
1552
1710
|
continue;
|
|
1553
1711
|
}
|
|
1554
1712
|
rec.displayed = cellIndex.get(tableCellKey(rec.rowId, rec.colId))?.displayed ?? rec.displayed;
|
|
@@ -1556,7 +1714,7 @@ function stampRecordDisplay(records, resolvedRows, formatNumber) {
|
|
|
1556
1714
|
}
|
|
1557
1715
|
function sortSiblingGroups(childrenOf, resolvedRows, columns, options, generatedOthers) {
|
|
1558
1716
|
let catSort = options.sort?.categories ?? "sheet";
|
|
1559
|
-
if ((catSort === "asc" || catSort === "desc") && requireAdditiveRanking(columns, resolvedRows, "options.sort.categories", "sort.categories"), catSort === "sheet") {
|
|
1717
|
+
if ((catSort === "asc" || catSort === "desc") && requireAdditiveRanking(columns, resolvedRows, "options.sort.categories", "sort.categories", ["options", "sort", "categories"]), catSort === "sheet") {
|
|
1560
1718
|
pinOthersLast(childrenOf, resolvedRows, generatedOthers);
|
|
1561
1719
|
return;
|
|
1562
1720
|
}
|
|
@@ -1613,28 +1771,40 @@ function ladderStep(row, byId, offset) {
|
|
|
1613
1771
|
}
|
|
1614
1772
|
return Math.max(0, depth + (row.role === "total" ? 0 : offset));
|
|
1615
1773
|
}
|
|
1774
|
+
function rowPointer(rows, test, ...field) {
|
|
1775
|
+
let hits = [], walk = (list, at) => list.forEach((row, i) => {
|
|
1776
|
+
test(row) && hits.push([...at, i, ...field]), walk(row.children ?? [], [...at, i, "children"]);
|
|
1777
|
+
});
|
|
1778
|
+
return walk(rows, ["data", "rows"]), hits.length === 1 ? hits[0] : void 0;
|
|
1779
|
+
}
|
|
1616
1780
|
function flattenRows(rows) {
|
|
1617
1781
|
let out = [], seen = /* @__PURE__ */ new Set(), order = 0, walk = (row, parentId, level) => {
|
|
1618
1782
|
if (seen.has(row.id))
|
|
1619
1783
|
throw new NormalizeError(
|
|
1620
1784
|
"duplicate-row-id",
|
|
1621
1785
|
`rows[${row.id}]`,
|
|
1622
|
-
`row id '${row.id}' appears more than once \u2014 row ids are globally unique (a fact shown in two groupings needs two rows referencing it)
|
|
1786
|
+
`row id '${row.id}' appears more than once \u2014 row ids are globally unique (a fact shown in two groupings needs two rows referencing it)`,
|
|
1787
|
+
void 0,
|
|
1788
|
+
void 0,
|
|
1789
|
+
rowPointer(rows, (authored) => authored === row, "id")
|
|
1623
1790
|
);
|
|
1624
1791
|
if (seen.add(row.id), row.badge !== void 0 && row.role !== "section")
|
|
1625
|
-
throw new NormalizeError("invalid-data", `rows[${row.id}].badge`, BADGE_SECTION_ONLY);
|
|
1792
|
+
throw new NormalizeError("invalid-data", `rows[${row.id}].badge`, BADGE_SECTION_ONLY, void 0, void 0, rowPointer(rows, (authored) => authored === row, "badge"));
|
|
1626
1793
|
let badgeText = row.badge?.text.trim();
|
|
1627
|
-
if (badgeText === "") throw new NormalizeError("invalid-data", `rows[${row.id}].badge.text`, BADGE_TEXT_EMPTY);
|
|
1794
|
+
if (badgeText === "") throw new NormalizeError("invalid-data", `rows[${row.id}].badge.text`, BADGE_TEXT_EMPTY, void 0, void 0, rowPointer(rows, (authored) => authored === row, "badge", "text"));
|
|
1628
1795
|
let displayOnly = row.kind === "result" || row.kind === "driver";
|
|
1629
|
-
if (displayOnly && row.relation !== void 0 && row.relation !== "displayOnly") throw new NormalizeError("invalid-data", `rows[${row.id}].relation`, row.kind === "result" ? "a result is computed from rows above; adding it to a parent counts it twice" : "a driver explains a row; adding it to a parent counts a different measure");
|
|
1630
|
-
if (row.sign !== void 0 && (displayOnly || (row.relation ?? "additive") !== "additive")) throw new NormalizeError("invalid-data", `rows[${row.id}].sign`, "sign requires relation additive");
|
|
1631
|
-
if (row.final && row.kind !== "result") throw new NormalizeError("invalid-data", `rows[${row.id}].final`, "final requires kind result");
|
|
1796
|
+
if (displayOnly && row.relation !== void 0 && row.relation !== "displayOnly") throw new NormalizeError("invalid-data", `rows[${row.id}].relation`, row.kind === "result" ? "a result is computed from rows above; adding it to a parent counts it twice" : "a driver explains a row; adding it to a parent counts a different measure", void 0, void 0, rowPointer(rows, (authored) => authored === row, "relation"));
|
|
1797
|
+
if (row.sign !== void 0 && (displayOnly || (row.relation ?? "additive") !== "additive")) throw new NormalizeError("invalid-data", `rows[${row.id}].sign`, "sign requires relation additive", void 0, void 0, rowPointer(rows, (authored) => authored === row, "sign"));
|
|
1798
|
+
if (row.final && row.kind !== "result") throw new NormalizeError("invalid-data", `rows[${row.id}].final`, "final requires kind result", void 0, void 0, rowPointer(rows, (authored) => authored === row, "final"));
|
|
1632
1799
|
let declaredParent = row.parentId ?? parentId;
|
|
1633
1800
|
if (row.parentId && parentId && row.parentId !== parentId)
|
|
1634
1801
|
throw new NormalizeError(
|
|
1635
1802
|
"parent-conflict",
|
|
1636
1803
|
`rows[${row.id}]`,
|
|
1637
|
-
`nested under '${parentId}' but declares parentId '${row.parentId}'
|
|
1804
|
+
`nested under '${parentId}' but declares parentId '${row.parentId}'`,
|
|
1805
|
+
void 0,
|
|
1806
|
+
void 0,
|
|
1807
|
+
rowPointer(rows, (authored) => authored === row, "parentId")
|
|
1638
1808
|
);
|
|
1639
1809
|
out.push({
|
|
1640
1810
|
id: row.id,
|
|
@@ -1663,6 +1833,7 @@ function flattenRows(rows) {
|
|
|
1663
1833
|
level,
|
|
1664
1834
|
order: order++,
|
|
1665
1835
|
...row[MAGNITUDE_GROUP] === void 0 ? {} : { [MAGNITUDE_GROUP]: row[MAGNITUDE_GROUP] },
|
|
1836
|
+
...row[MAGNITUDE_FIGURES] === void 0 ? {} : { [MAGNITUDE_FIGURES]: row[MAGNITUDE_FIGURES] },
|
|
1666
1837
|
...row[AUTOMATIC_FORMAT] === !0 ? { [AUTOMATIC_FORMAT]: !0 } : {}
|
|
1667
1838
|
});
|
|
1668
1839
|
for (let child of row.children ?? []) walk(child, row.id, level + 1);
|
|
@@ -1671,11 +1842,11 @@ function flattenRows(rows) {
|
|
|
1671
1842
|
let byId = new Map(out.map((r) => [r.id, r]));
|
|
1672
1843
|
for (let r of out) {
|
|
1673
1844
|
if (r.parentId && !byId.has(r.parentId))
|
|
1674
|
-
throw new NormalizeError("parent-missing", `rows[${r.id}]`, `parentId '${r.parentId}' does not exist
|
|
1845
|
+
throw new NormalizeError("parent-missing", `rows[${r.id}]`, `parentId '${r.parentId}' does not exist`, void 0, void 0, rowPointer(rows, (authored) => authored.id === r.id, "parentId"));
|
|
1675
1846
|
let level = 0, p = r.parentId, guard = /* @__PURE__ */ new Set([r.id]);
|
|
1676
1847
|
for (; p; ) {
|
|
1677
1848
|
if (guard.has(p))
|
|
1678
|
-
throw new NormalizeError("parent-cycle", `rows[${r.id}]`, `row hierarchy contains a cycle at '${p}'
|
|
1849
|
+
throw new NormalizeError("parent-cycle", `rows[${r.id}]`, `row hierarchy contains a cycle at '${p}'`, void 0, void 0, rowPointer(rows, (authored) => authored.id === r.id, "parentId"));
|
|
1679
1850
|
guard.add(p), level++, p = byId.get(p).parentId;
|
|
1680
1851
|
}
|
|
1681
1852
|
r.level = level;
|
|
@@ -1739,22 +1910,32 @@ function resolveColumnToggles(data, options, colById, warnings) {
|
|
|
1739
1910
|
throw new NormalizeError(
|
|
1740
1911
|
"duplicate-toggle-id",
|
|
1741
1912
|
`columnToggles[${toggle.id}]`,
|
|
1742
|
-
`duplicate toggle id '${toggle.id}'
|
|
1913
|
+
`duplicate toggle id '${toggle.id}'`,
|
|
1914
|
+
void 0,
|
|
1915
|
+
void 0,
|
|
1916
|
+
["data", "columnToggles", data.columnToggles.indexOf(toggle), "id"]
|
|
1743
1917
|
);
|
|
1744
1918
|
toggleIds.add(toggle.id);
|
|
1745
|
-
for (let
|
|
1919
|
+
for (let ci = 0; ci < toggle.columns.length; ci++) {
|
|
1920
|
+
let columnId = toggle.columns[ci];
|
|
1746
1921
|
if (!colById.has(columnId))
|
|
1747
1922
|
throw new NormalizeError(
|
|
1748
1923
|
"toggle-ref-invalid",
|
|
1749
1924
|
`columnToggles[${toggle.id}]`,
|
|
1750
|
-
`toggle '${toggle.id}' references unknown column '${columnId}'
|
|
1925
|
+
`toggle '${toggle.id}' references unknown column '${columnId}'`,
|
|
1926
|
+
void 0,
|
|
1927
|
+
void 0,
|
|
1928
|
+
["data", "columnToggles", data.columnToggles.indexOf(toggle), "columns", ci]
|
|
1751
1929
|
);
|
|
1752
1930
|
let owner = membership.get(columnId);
|
|
1753
1931
|
if (owner !== void 0)
|
|
1754
1932
|
throw new NormalizeError(
|
|
1755
1933
|
"toggle-ref-invalid",
|
|
1756
1934
|
`columnToggles[${toggle.id}]`,
|
|
1757
|
-
`column '${columnId}' already belongs to toggle '${owner}' \u2014 a column may belong to at most one toggle group
|
|
1935
|
+
`column '${columnId}' already belongs to toggle '${owner}' \u2014 a column may belong to at most one toggle group`,
|
|
1936
|
+
void 0,
|
|
1937
|
+
void 0,
|
|
1938
|
+
["data", "columnToggles", data.columnToggles.indexOf(toggle), "columns", ci]
|
|
1758
1939
|
);
|
|
1759
1940
|
membership.set(columnId, toggle.id);
|
|
1760
1941
|
}
|
|
@@ -1762,16 +1943,13 @@ function resolveColumnToggles(data, options, colById, warnings) {
|
|
|
1762
1943
|
throw new NormalizeError(
|
|
1763
1944
|
"toggle-group-span",
|
|
1764
1945
|
`columnToggles[${toggle.id}]`,
|
|
1765
|
-
`every member of toggle '${toggle.id}' must belong to one columnGroup, or none of them to any
|
|
1946
|
+
`every member of toggle '${toggle.id}' must belong to one columnGroup, or none of them to any`,
|
|
1947
|
+
void 0,
|
|
1948
|
+
void 0,
|
|
1949
|
+
["data", "columnToggles", data.columnToggles.indexOf(toggle), "columns"]
|
|
1766
1950
|
);
|
|
1767
1951
|
}
|
|
1768
|
-
|
|
1769
|
-
toggleIds.has(toggleId) || warnings.push({
|
|
1770
|
-
code: "column-visibility-ref-unknown",
|
|
1771
|
-
severity: "warn",
|
|
1772
|
-
message: `columnVisibility references unknown toggle '${toggleId}' \u2014 no columns were changed`
|
|
1773
|
-
});
|
|
1774
|
-
return {
|
|
1952
|
+
return columnVisibilityWarnings(data.columnToggles ?? [], options, warnings), {
|
|
1775
1953
|
membership,
|
|
1776
1954
|
toggles: (data.columnToggles ?? []).map((toggle) => {
|
|
1777
1955
|
let defaultVisible = toggle.defaultVisible ?? !1;
|
|
@@ -1785,17 +1963,30 @@ function resolveColumnToggles(data, options, colById, warnings) {
|
|
|
1785
1963
|
})
|
|
1786
1964
|
};
|
|
1787
1965
|
}
|
|
1966
|
+
function columnVisibilityWarnings(toggles, options, warnings) {
|
|
1967
|
+
let ids = new Set(toggles.map((toggle) => toggle.id));
|
|
1968
|
+
for (let toggleId of Object.keys(options.columnVisibility ?? {}))
|
|
1969
|
+
ids.has(toggleId) || warnings.push({
|
|
1970
|
+
code: "column-visibility-ref-unknown",
|
|
1971
|
+
severity: "warn",
|
|
1972
|
+
message: `columnVisibility references unknown toggle '${toggleId}' \u2014 no columns were changed`
|
|
1973
|
+
});
|
|
1974
|
+
}
|
|
1788
1975
|
function validateGroups(data, colById) {
|
|
1789
1976
|
let groups = data.columnGroups ?? [], claimed = /* @__PURE__ */ new Map(), columnIndex = new Map(data.columns.map((column, index) => [column.id, index]));
|
|
1790
1977
|
for (let g of groups) {
|
|
1791
|
-
for (let
|
|
1978
|
+
for (let ci = 0; ci < g.columns.length; ci++) {
|
|
1979
|
+
let cid = g.columns[ci];
|
|
1792
1980
|
if (!colById.has(cid))
|
|
1793
|
-
throw new NormalizeError("group-ref-invalid", `columnGroups[${g.id}]`, `references unknown column '${cid}'
|
|
1981
|
+
throw new NormalizeError("group-ref-invalid", `columnGroups[${g.id}]`, `references unknown column '${cid}'`, void 0, void 0, ["data", "columnGroups", groups.indexOf(g), "columns", ci]);
|
|
1794
1982
|
if (claimed.has(cid))
|
|
1795
1983
|
throw new NormalizeError(
|
|
1796
1984
|
"group-ref-invalid",
|
|
1797
1985
|
`columnGroups[${g.id}]`,
|
|
1798
|
-
`column '${cid}' already belongs to group '${claimed.get(cid)}'
|
|
1986
|
+
`column '${cid}' already belongs to group '${claimed.get(cid)}'`,
|
|
1987
|
+
void 0,
|
|
1988
|
+
void 0,
|
|
1989
|
+
["data", "columnGroups", groups.indexOf(g), "columns", ci]
|
|
1799
1990
|
);
|
|
1800
1991
|
claimed.set(cid, g.id);
|
|
1801
1992
|
}
|
|
@@ -1805,27 +1996,36 @@ function validateGroups(data, colById) {
|
|
|
1805
1996
|
throw new NormalizeError(
|
|
1806
1997
|
"group-not-contiguous",
|
|
1807
1998
|
`columnGroups[${g.id}]`,
|
|
1808
|
-
"group members must be contiguous in columns[] order"
|
|
1999
|
+
"group members must be contiguous in columns[] order",
|
|
2000
|
+
void 0,
|
|
2001
|
+
void 0,
|
|
2002
|
+
["data", "columnGroups", groups.indexOf(g), "columns"]
|
|
1809
2003
|
);
|
|
1810
2004
|
}
|
|
1811
2005
|
}
|
|
1812
2006
|
function validateCalcRefs(columns, colById) {
|
|
1813
|
-
let checkRef = (rid, owner) => {
|
|
2007
|
+
let columnCalc = (owner) => ["data", "columns", columns.findIndex((column) => column.id === owner), "calc"], checkRef = (rid, owner) => {
|
|
1814
2008
|
let target = colById.get(rid);
|
|
1815
2009
|
if (!target)
|
|
1816
|
-
throw new NormalizeError("calc-ref-missing", `columns[${owner}].calc`, `references unknown column '${rid}'
|
|
2010
|
+
throw new NormalizeError("calc-ref-missing", `columns[${owner}].calc`, `references unknown column '${rid}'`, void 0, void 0, columnCalc(owner));
|
|
1817
2011
|
if (target.kind !== "value")
|
|
1818
2012
|
throw new NormalizeError(
|
|
1819
2013
|
"compute-ref-computed",
|
|
1820
2014
|
`columns[${owner}].calc`,
|
|
1821
|
-
`references '${rid}' (kind '${target.kind}') \u2014 calcs may reference value columns only in v1
|
|
2015
|
+
`references '${rid}' (kind '${target.kind}') \u2014 calcs may reference value columns only in v1`,
|
|
2016
|
+
void 0,
|
|
2017
|
+
void 0,
|
|
2018
|
+
columnCalc(owner)
|
|
1822
2019
|
);
|
|
1823
2020
|
}, checkCell = (ref, owner) => {
|
|
1824
2021
|
if (typeof ref != "string")
|
|
1825
2022
|
throw new NormalizeError(
|
|
1826
2023
|
"row-ref-in-column-calc",
|
|
1827
2024
|
`columns[${owner}].calc`,
|
|
1828
|
-
"column calculations still refer to the current row \u2014 use a column id, or put a cross-row calc on the row"
|
|
2025
|
+
"column calculations still refer to the current row \u2014 use a column id, or put a cross-row calc on the row",
|
|
2026
|
+
void 0,
|
|
2027
|
+
void 0,
|
|
2028
|
+
columnCalc(owner)
|
|
1829
2029
|
);
|
|
1830
2030
|
checkRef(ref, owner);
|
|
1831
2031
|
}, check = (calc, owner) => {
|
|
@@ -1874,26 +2074,32 @@ function contributionSignOf(row, byId, stop) {
|
|
|
1874
2074
|
function numericColKind(kind) {
|
|
1875
2075
|
return kind === "value" || kind === "computed";
|
|
1876
2076
|
}
|
|
1877
|
-
function validateRowCalcRef(ref, owner, rowIds, calcRows, colById, reads) {
|
|
2077
|
+
function validateRowCalcRef(ref, owner, rowIds, calcRows, colById, authoredRows, reads) {
|
|
1878
2078
|
if (typeof ref == "string") {
|
|
1879
2079
|
let target = colById.get(ref);
|
|
1880
2080
|
if (!target || !numericColKind(target.kind))
|
|
1881
2081
|
throw new NormalizeError(
|
|
1882
2082
|
"calc-ref-missing",
|
|
1883
2083
|
`rows[${owner}].calc`,
|
|
1884
|
-
`references unknown numeric column '${typeof ref == "string" ? ref : ""}'
|
|
2084
|
+
`references unknown numeric column '${typeof ref == "string" ? ref : ""}'`,
|
|
2085
|
+
void 0,
|
|
2086
|
+
void 0,
|
|
2087
|
+
rowPointer(authoredRows, (authored) => authored.id === owner, "calc")
|
|
1885
2088
|
);
|
|
1886
2089
|
return;
|
|
1887
2090
|
}
|
|
1888
2091
|
if (!rowIds.has(ref.row))
|
|
1889
|
-
throw new NormalizeError("calc-ref-missing", `rows[${owner}].calc`, `references unknown row '${ref.row}'
|
|
2092
|
+
throw new NormalizeError("calc-ref-missing", `rows[${owner}].calc`, `references unknown row '${ref.row}'`, void 0, void 0, rowPointer(authoredRows, (authored) => authored.id === owner, "calc"));
|
|
1890
2093
|
if (calcRows.has(ref.row) && reads?.push(ref.row), ref.col) {
|
|
1891
2094
|
let target = colById.get(ref.col);
|
|
1892
2095
|
if (!target || !numericColKind(target.kind))
|
|
1893
2096
|
throw new NormalizeError(
|
|
1894
2097
|
"calc-ref-missing",
|
|
1895
2098
|
`rows[${owner}].calc`,
|
|
1896
|
-
`references unknown numeric column '${ref.col}'
|
|
2099
|
+
`references unknown numeric column '${ref.col}'`,
|
|
2100
|
+
void 0,
|
|
2101
|
+
void 0,
|
|
2102
|
+
rowPointer(authoredRows, (authored) => authored.id === owner, "calc")
|
|
1897
2103
|
);
|
|
1898
2104
|
}
|
|
1899
2105
|
}
|
|
@@ -1917,19 +2123,19 @@ function calcRefs(calc, refs = []) {
|
|
|
1917
2123
|
}
|
|
1918
2124
|
return refs;
|
|
1919
2125
|
}
|
|
1920
|
-
function walkRowCalc(calc, owner, rowIds, calcRows, colById, reads = []) {
|
|
1921
|
-
let ref = (r) => validateRowCalcRef(r, owner, rowIds, calcRows, colById, reads);
|
|
2126
|
+
function walkRowCalc(calc, owner, rowIds, calcRows, colById, authoredRows, reads = []) {
|
|
2127
|
+
let ref = (r) => validateRowCalcRef(r, owner, rowIds, calcRows, colById, authoredRows, reads);
|
|
1922
2128
|
if ("lit" in calc) return reads;
|
|
1923
2129
|
if ("ref" in calc)
|
|
1924
2130
|
return ref(calc.ref), reads;
|
|
1925
2131
|
switch (calc.op) {
|
|
1926
2132
|
case "abs":
|
|
1927
|
-
return walkRowCalc(calc.of, owner, rowIds, calcRows, colById, reads);
|
|
2133
|
+
return walkRowCalc(calc.of, owner, rowIds, calcRows, colById, authoredRows, reads);
|
|
1928
2134
|
case "add":
|
|
1929
2135
|
case "sub":
|
|
1930
2136
|
case "mul":
|
|
1931
2137
|
case "div":
|
|
1932
|
-
return walkRowCalc(calc.a, owner, rowIds, calcRows, colById, reads), walkRowCalc(calc.b, owner, rowIds, calcRows, colById, reads), reads;
|
|
2138
|
+
return walkRowCalc(calc.a, owner, rowIds, calcRows, colById, authoredRows, reads), walkRowCalc(calc.b, owner, rowIds, calcRows, colById, authoredRows, reads), reads;
|
|
1933
2139
|
case "share":
|
|
1934
2140
|
return ref(calc.of), reads;
|
|
1935
2141
|
case "delta":
|
|
@@ -1938,7 +2144,7 @@ function walkRowCalc(calc, owner, rowIds, calcRows, colById, reads = []) {
|
|
|
1938
2144
|
}
|
|
1939
2145
|
return reads;
|
|
1940
2146
|
}
|
|
1941
|
-
function evaluateTableCalcs(flat, valueCols, computedCols, rawState, records, leafTotal, columnGroups, colById, noPrevious = "na", contributionSign = () => 1) {
|
|
2147
|
+
function evaluateTableCalcs(flat, valueCols, computedCols, rawState, records, leafTotal, columnGroups, colById, noPrevious = "na", contributionSign = () => 1, authoredRows = []) {
|
|
1942
2148
|
let negativeBase = /* @__PURE__ */ new Map(), noteNegativeBase = (scope, rowId, colId) => {
|
|
1943
2149
|
let key = `${scope}:${scope === "column" ? colId : rowId}`, seen = negativeBase.get(key);
|
|
1944
2150
|
seen ? seen.cells += 1 : negativeBase.set(key, { scope, rowId, colId, cells: 1 });
|
|
@@ -1961,15 +2167,18 @@ function evaluateTableCalcs(flat, valueCols, computedCols, rawState, records, le
|
|
|
1961
2167
|
}
|
|
1962
2168
|
let calcFlat = flat.filter((row) => row.role !== "section" && row.calc), byId = new Map(calcFlat.map((row) => [row.id, row])), ordered = [], visit = /* @__PURE__ */ new Map(), place = (row) => {
|
|
1963
2169
|
if (visit.get(row.id) !== "done") {
|
|
1964
|
-
if (visit.get(row.id) === "open") throw new NormalizeError("compute-ref-cycle", `rows[${row.id}].calc`, `row calcs form a cycle through '${row.id}'
|
|
2170
|
+
if (visit.get(row.id) === "open") throw new NormalizeError("compute-ref-cycle", `rows[${row.id}].calc`, `row calcs form a cycle through '${row.id}'`, void 0, void 0, rowPointer(authoredRows, (authored) => authored.id === row.id, "calc"));
|
|
1965
2171
|
if (row.relation === "additive")
|
|
1966
2172
|
throw new NormalizeError(
|
|
1967
2173
|
"row-calc-relation",
|
|
1968
2174
|
`rows[${row.id}]`,
|
|
1969
|
-
`row '${row.id}' has calc but relation '${row.relation}' \u2014 row calculations must be ofWhich or displayOnly so they are not summed
|
|
2175
|
+
`row '${row.id}' has calc but relation '${row.relation}' \u2014 row calculations must be ofWhich or displayOnly so they are not summed`,
|
|
2176
|
+
void 0,
|
|
2177
|
+
void 0,
|
|
2178
|
+
rowPointer(authoredRows, (authored) => authored.id === row.id)
|
|
1970
2179
|
);
|
|
1971
2180
|
visit.set(row.id, "open");
|
|
1972
|
-
for (let id of walkRowCalc(row.calc, row.id, rowIds, calcRows, colById)) place(byId.get(id));
|
|
2181
|
+
for (let id of walkRowCalc(row.calc, row.id, rowIds, calcRows, colById, authoredRows)) place(byId.get(id));
|
|
1973
2182
|
visit.set(row.id, "done"), ordered.push(row);
|
|
1974
2183
|
}
|
|
1975
2184
|
};
|
|
@@ -1977,14 +2186,14 @@ function evaluateTableCalcs(flat, valueCols, computedCols, rawState, records, le
|
|
|
1977
2186
|
for (let row of ordered) {
|
|
1978
2187
|
let states = rawState.get(row.id), sourceStates = new Map(states);
|
|
1979
2188
|
for (let col of numericCols) {
|
|
1980
|
-
if (col.kind === "computed" &&
|
|
1981
|
-
let ownCalc = col.kind === "computed" && isChangeCalc(col.calc) && !calcIsLinear(row.calc), calc = ownCalc ? col.calc : row.calc, read = ownCalc ? states : sourceStates, res = evalCalc(calc, row, read, leafTotal, ownCalc ? void 0 : {
|
|
2189
|
+
if (col.kind === "computed" && "op" in col.calc && col.calc.op === "share") continue;
|
|
2190
|
+
let ownCalc = col.kind === "computed" && (!calcPreservesScale(col.calc) || isChangeCalc(col.calc) && !calcIsLinear(row.calc)), calc = ownCalc ? col.calc : row.calc, read = ownCalc ? states : sourceStates, res = evalCalc(calc, row, read, leafTotal, ownCalc ? void 0 : {
|
|
1982
2191
|
currentCol: col.id,
|
|
1983
2192
|
rawState,
|
|
1984
2193
|
previousCol,
|
|
1985
2194
|
noPrevious
|
|
1986
2195
|
}, contributionSign);
|
|
1987
|
-
res.state === "value" && comparesMixedRows(calc, coverageOf(row.id, read, col.id)) && (res = { ...res, raw: null, state: "nm" }, mixedCoverage = !0), states.set(col.id, { raw: res.raw, state: res.state, ...partialFrom(res, row.id, read) }), res.nearZero && (nearZero = !0), res.negativeBase && res.state === "value" && noteNegativeBase("row", row.id, col.id), pushCalcRecord(records, row.id, col.id, res);
|
|
2196
|
+
res.state === "value" && comparesMixedRows(calc, coverageOf(row.id, read, col.id)) && (res = { ...res, raw: null, state: "nm" }, mixedCoverage = !0), states.set(col.id, { raw: res.raw, state: res.state, ...partialFrom(res, row.id, read) }), res.nearZero && (nearZero = !0), res.negativeBase && res.state === "value" && noteNegativeBase(ownCalc ? "column" : "row", row.id, col.id), pushCalcRecord(records, row.id, col.id, res);
|
|
1988
2197
|
}
|
|
1989
2198
|
}
|
|
1990
2199
|
return { nearZero, mixedCoverage, negativeBase: [...negativeBase.values()] };
|
|
@@ -2080,6 +2289,60 @@ function evalCalc(calc, row, states, leafTotal, scope, contributionSign = () =>
|
|
|
2080
2289
|
}, result = evalNode(calc), op = "ref" in calc ? `ref(${expr})` : "lit" in calc ? `lit(${expr})` : expr;
|
|
2081
2290
|
return isState(result) ? { raw: null, state: result, op, inputs, ...nearZero && result === "nm" ? { nearZero: !0 } : {} } : { raw: result, state: "value", op, inputs, ...negativeBase ? { negativeBase: !0 } : {} };
|
|
2082
2291
|
}
|
|
2292
|
+
function tableFrameUnit(table, options) {
|
|
2293
|
+
return table.unit ?? (table.columnUnits ? void 0 : options.unit);
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
// src/core/charts/table/encodings/arrow.ts
|
|
2297
|
+
var ARROW_GAP = 4, printedNumber = (cell) => cell.negated ? -cell.raw : cell.raw;
|
|
2298
|
+
function arrowGlyph(value, maxAbs, scale) {
|
|
2299
|
+
let share = scale === "absolute" ? value / 100 : maxAbs > 0 ? value / maxAbs : 0;
|
|
2300
|
+
return share > 0.1 ? "\u2191" : share > 0.02 ? "\u2197" : share >= -0.02 ? "\u2192" : share >= -0.1 ? "\u2198" : "\u2193";
|
|
2301
|
+
}
|
|
2302
|
+
var ARROW_KEY = [
|
|
2303
|
+
["\u2191", "tableArrowRise10"],
|
|
2304
|
+
["\u2197", "tableArrowRise2"],
|
|
2305
|
+
["\u2192", "tableArrowFlat"],
|
|
2306
|
+
["\u2198", "tableArrowFall2"],
|
|
2307
|
+
["\u2193", "tableArrowFall10"]
|
|
2308
|
+
];
|
|
2309
|
+
function arrowKey(columns, rows, language) {
|
|
2310
|
+
let drawn = { absolute: /* @__PURE__ */ new Set(), relative: /* @__PURE__ */ new Set() };
|
|
2311
|
+
for (let column of columns) {
|
|
2312
|
+
if (column.cellEncoding?.type !== "arrow" || column.kind !== "computed" || !column.polarity) continue;
|
|
2313
|
+
let scale = column.cellEncoding.scale, values = rows.flatMap((row) => {
|
|
2314
|
+
let cell = row.cells[column.id];
|
|
2315
|
+
return cell?.state === "value" && typeof cell.raw == "number" ? [printedNumber(cell)] : [];
|
|
2316
|
+
}), maxAbs = Math.max(0, maxOf(values.map(Math.abs)));
|
|
2317
|
+
for (let value of values) drawn[scale].add(arrowGlyph(value, maxAbs, scale));
|
|
2318
|
+
}
|
|
2319
|
+
return ["absolute", "relative"].flatMap((scale) => ARROW_KEY.filter(([glyph]) => drawn[scale].has(glyph)).map(([glyph, key]) => ({ id: scale === "absolute" ? `arrowKey:${glyph}` : `arrowKey:relative:${glyph}`, label: chartString2({ locale: { language } }, scale === "absolute" ? key : `${key}Relative`), glyph })));
|
|
2320
|
+
}
|
|
2321
|
+
function emitArrow(context, metrics) {
|
|
2322
|
+
if (context.cell.state !== "value" || typeof context.cell.raw != "number") return [];
|
|
2323
|
+
let value = printedNumber(context.cell), glyph = arrowGlyph(value, metrics.maxAbs, metrics.scale), font = metrics.font, glyphWidth = context.measure(glyph, font).width, valueWidth = context.measure(context.cell.displayed, metrics.font).width, valueLeft = metrics.valueX - valueWidth, available = valueLeft - context.box.x - ARROW_GAP;
|
|
2324
|
+
if (available <= 0) return [];
|
|
2325
|
+
if (glyphWidth > available) {
|
|
2326
|
+
let floor = Math.min(font.size, readerFloorPx(metrics.target ?? DEFAULT_TARGET, "label", metrics.textScale));
|
|
2327
|
+
if (font = { ...font, size: Math.max(floor, font.size * available / glyphWidth) }, glyphWidth = context.measure(glyph, font).width, glyphWidth > available) return [];
|
|
2328
|
+
}
|
|
2329
|
+
return [
|
|
2330
|
+
{
|
|
2331
|
+
t: "text",
|
|
2332
|
+
typeRole: "label",
|
|
2333
|
+
id: context.nodeId("arrow"),
|
|
2334
|
+
x: valueLeft - ARROW_GAP - glyphWidth,
|
|
2335
|
+
y: context.box.y + (context.box.h - context.measure(glyph, font).height) / 2,
|
|
2336
|
+
lines: [glyph],
|
|
2337
|
+
align: "start",
|
|
2338
|
+
font,
|
|
2339
|
+
// The glyph prints in its figure's text colour, as the grid's arrow inherits it.
|
|
2340
|
+
ink: context.cell.tone === "neutral" ? { token: "neutral" } : context.toneInk ?? toneTextPaint(context.theme, context.cell.tone, context.palette),
|
|
2341
|
+
owner: context.owner,
|
|
2342
|
+
part: "tableArrow"
|
|
2343
|
+
}
|
|
2344
|
+
];
|
|
2345
|
+
}
|
|
2083
2346
|
|
|
2084
2347
|
// src/core/charts/table/view.ts
|
|
2085
2348
|
var NUMERIC_COLUMNS = /* @__PURE__ */ new Set(["value", "computed", "date", "encoding"]);
|
|
@@ -2095,13 +2358,13 @@ function numericCell(cell) {
|
|
|
2095
2358
|
function cellDrawsTabular(theme, kind, displayed) {
|
|
2096
2359
|
return numericVariant("value", theme) === "tabular-nums" && cellHoldsNumber(kind, displayed);
|
|
2097
2360
|
}
|
|
2098
|
-
function tableFootnotes(table, rows, columns) {
|
|
2361
|
+
function tableFootnotes(table, rows, columns, language) {
|
|
2099
2362
|
let emitted = new Set(columns.map((column) => column.id)), marked = rows.some(
|
|
2100
2363
|
(row) => Object.values(row.cells).some(
|
|
2101
2364
|
(cell) => cell.state === "suppressed" && emitted.has(cell.colId)
|
|
2102
2365
|
)
|
|
2103
|
-
), partialShown = table.partialColumnIds === void 0 || table.partialColumnIds.some((id) => emitted.has(id)), statusNote = statusDirectionNote(table.columns, heatRanges(table.columns, table.rows), table.colorblindSafe), shownStatusNote = statusNote === void 0 ? void 0 : statusDirectionNote(columns, heatRanges(columns, rows), table.colorblindSafe), footnotes = table.footnotes.flatMap((note) => note ===
|
|
2104
|
-
return (marked ? [...footnotes,
|
|
2366
|
+
), partialShown = table.partialColumnIds === void 0 || table.partialColumnIds.some((id) => emitted.has(id)), statusNote = statusDirectionNote(table.columns, heatRanges(table.columns, table.rows), table.colorblindSafe, language), shownStatusNote = statusNote === void 0 ? void 0 : statusDirectionNote(columns, heatRanges(columns, rows), table.colorblindSafe, language), partialNote = table.partialNote ?? partialFootnote(language), footnotes = table.footnotes.flatMap((note) => note === partialNote && !partialShown ? [] : note === statusNote ? shownStatusNote === void 0 ? [] : [shownStatusNote] : [note]);
|
|
2367
|
+
return (marked ? [...footnotes, suppressedFootnote(language)] : footnotes).map(disclosureNote);
|
|
2105
2368
|
}
|
|
2106
2369
|
function treeChildCounts(table) {
|
|
2107
2370
|
let counts = /* @__PURE__ */ new Map();
|
|
@@ -2137,8 +2400,9 @@ function expansionForFolds(table, authored, folds) {
|
|
|
2137
2400
|
function expansionRootsHidden(table, expansion) {
|
|
2138
2401
|
return expansion?.rootsHidden ?? (expansion?.depth === "totals" && table.rows.some((row) => row.role === "total"));
|
|
2139
2402
|
}
|
|
2403
|
+
var EMPTY_ROW_ID = "boardplot:empty";
|
|
2140
2404
|
function emptyMessageRow(table, message) {
|
|
2141
|
-
let id =
|
|
2405
|
+
let id = EMPTY_ROW_ID, labelId = table.columns.find((column) => column.kind === "rowLabel")?.id;
|
|
2142
2406
|
return {
|
|
2143
2407
|
id,
|
|
2144
2408
|
label: message,
|
|
@@ -2299,391 +2563,27 @@ function inCellBarMaxima(rows, columns) {
|
|
|
2299
2563
|
}
|
|
2300
2564
|
return maxima;
|
|
2301
2565
|
}
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
let
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
if (
|
|
2320
|
-
let
|
|
2321
|
-
|
|
2322
|
-
}
|
|
2323
|
-
let spacerTotal = view.spacerTotal ?? [...spacerBefore.values()].reduce((sum, width) => sum + width, 0), figures = printsFigures(options.figures, cols), wideTable = cols.length >= DENSE_COLUMNS, cellPadX2 = options.cellPadX ?? cellPadX(cols.length), labelColumn = cols.find((col) => col.kind === "rowLabel"), labelLead = labelColumn?.width === void 0 ? Math.ceil(view.leadWidth ?? 0) : 0, groupCell = {
|
|
2324
|
-
padX: cellPadX2,
|
|
2325
|
-
trailingTracking: view.trailingTracking,
|
|
2326
|
-
startRule: view.groupStart === void 0 ? void 0 : (groupId) => {
|
|
2327
|
-
let first = cols.find((col) => col.groupId === groupId);
|
|
2328
|
-
return first && view.groupStart.has(first.id) ? 1 : 0;
|
|
2329
|
-
}
|
|
2330
|
-
}, headingFaces = (faces) => groupHeadingFaces(view.trailingTracking ? { ...faces.group, letterSpacing: Math.round((faces.group.letterSpacing ?? 0) * 1e3) / 1e3 } : faces.group), warnings = [], ladder = levelLadder(theme, options.density ?? "regular", options.target, textScaleOf(options)), regularFonts = tableFonts(theme, ladder), rowById = new Map([...widthRows, ...rows].map((row) => [row.id, row])), hasChanges = new Set(table.rows.filter((row) => visibleInlineRows(row, options.inlineVisibility).length > 0).map((row) => row.id)), cellStep = (cell) => rowById.get(cell.rowId)?.step ?? cell.level, indentStep = (cell) => rowById.get(cell.rowId)?.indentStep ?? cellStep(cell), childCount = treeChildCounts(table), isTree = fullRows.some((row) => row.hasChildren), indents = labelIndents(cellPadX2, options.labelIndent, view.withMarks ?? options.outlineMarks === !0), operatorSlot = operatorWidth(rows, theme), rowIndent = (level) => (isTree ? indents.base + level * indents.step : 0) + operatorSlot, inlineFont2 = (level, signed) => inlineFont(theme, ladder, level, signed);
|
|
2331
|
-
function cellFont(cell) {
|
|
2332
|
-
let row = rowById.get(cell.rowId), kind = row?.kind, totalFace = kind === void 0 || kind !== "subtotal" && kind !== "result" && kind !== "driver" && (kind !== "member" && kind !== "measure" || theme.table?.weights?.figures?.[kind] === void 0);
|
|
2333
|
-
if (cell.role === "total" && cell.kind !== "rowLabel" && totalFace) return regularFonts.totalValue;
|
|
2334
|
-
let font = kindFont(rowFont(theme, ladder, regularFonts, cell.role, cellStep(cell), row?.hasChildren === !0, hasChanges.has(cell.rowId)), kind, cell.kind === "rowLabel", theme);
|
|
2335
|
-
return cell.state === "value" ? strongColumnFont(font, cols.find((col) => col.id === cell.colId), cell, kind, theme) : font;
|
|
2336
|
-
}
|
|
2337
|
-
function affixRoom(row, font) {
|
|
2338
|
-
return row.unitAffix === void 0 ? 0 : theme.table?.qualifier === void 0 ? measure(` ${row.unitAffix}`, inlineFont2(row.step, !1)).width : measure(row.unitAffix, qualifierFont(font, theme)).width + (theme.table.qualifier.gap ?? 4);
|
|
2339
|
-
}
|
|
2340
|
-
let columnHeaderText = (col) => {
|
|
2341
|
-
let text = fieldHeadText(col.label, theme) + columnHeaderAffix(col);
|
|
2342
|
-
return view.headGlue === !1 ? text : text.replace(/ (\S{1,2})$/u, "\xA0$1");
|
|
2343
|
-
};
|
|
2344
|
-
function trackWidths(faces) {
|
|
2345
|
-
let widths2 = /* @__PURE__ */ new Map(), minimumWidths2 = /* @__PURE__ */ new Map(), wrappedOneLines = /* @__PURE__ */ new Map(), context = {
|
|
2346
|
-
theme,
|
|
2347
|
-
measure,
|
|
2348
|
-
fonts: faces,
|
|
2349
|
-
cellFont,
|
|
2350
|
-
inlineFont: inlineFont2,
|
|
2351
|
-
changeFont: (level) => changeLineFont(theme, ladder, level),
|
|
2352
|
-
rowIndent,
|
|
2353
|
-
inlineIndent: INLINE_LABEL_INDENT,
|
|
2354
|
-
padX: cellPadX2,
|
|
2355
|
-
headerText: columnHeaderText,
|
|
2356
|
-
headerReserve: (col) => view.sortable?.has(col.id) ? SORT_CHEVRON_RESERVE : 0,
|
|
2357
|
-
headerTrailingTracking: view.trailingTracking,
|
|
2358
|
-
slack: view.slack,
|
|
2359
|
-
reserve: (col) => encodingReserve(col, measure, faces),
|
|
2360
|
-
// The face the sparkline cells draw their end value in (`emitSparkline`).
|
|
2361
|
-
sparkFont: { family: theme.type.family, ...theme.type.label },
|
|
2362
|
-
// A cell and each line in it take figures by their own string, as the
|
|
2363
|
-
// text nodes below take their role.
|
|
2364
|
-
figures: (col, cellText, lineText) => cellDrawsTabular(theme, col.kind, lineText ?? cellText),
|
|
2365
|
-
// the collapsed hint shares the label's line, as a unit affix does, so the track pays for it.
|
|
2366
|
-
hint: (row) => collapsedHintWidth(row, table.levelNouns, childCount.get(row.id) ?? 0, measure, faces.hint),
|
|
2367
|
-
...view.headLines === void 0 ? {} : { headLines: view.headLines }
|
|
2368
|
-
};
|
|
2369
|
-
for (let col of cols) {
|
|
2370
|
-
let heatOnlyWidth = Math.max(HEAT_ONLY_CELL_W, Math.ceil((view.scroll ? headerContentWidth(col, context) : measure(columnHeaderText(col), faces.header).width) + 2 * cellPadX2)), intrinsicWidth = figures || !heatColumn(col) ? intrinsicColumnWidth(col, widthRows, context) : heatOnlyWidth, endRule = col.width === void 0 && (figures || !heatColumn(col)) && view.groupEnd?.has(col.id) ? 1 : 0;
|
|
2371
|
-
if (col.kind === "encoding") {
|
|
2372
|
-
let track = (authoredTrackWidth(col, widthRows, context) ?? intrinsicWidth) + endRule;
|
|
2373
|
-
widths2.set(col.id, track), minimumWidths2.set(col.id, track);
|
|
2374
|
-
continue;
|
|
2375
|
-
}
|
|
2376
|
-
let headerW = view.scroll ? headerContentWidth(col, context) : measure(columnHeaderText(col), faces.header).width + (context.headerReserve?.(col) ?? 0), minimumWidth = col.wrap ? wrapFloorWidth(col, widthRows, headerW, context) : col.kind === "rowLabel" ? intrinsicColumnWidth(col, widthRows, { ...context, hint: void 0 }) : intrinsicWidth;
|
|
2377
|
-
minimumWidths2.set(col.id, minimumWidth);
|
|
2378
|
-
let wrapped = view.scroll && col.wrap && col.width === void 0 && (figures || !heatColumn(col)), authoredContext = col.kind === "rowLabel" ? { ...context, twoLineLabels: options.rowLabelLines !== 1 } : context, authored = col.kind === "rowLabel" && col.width !== void 0 && intrinsicWidth <= col.width ? col.width : authoredTrackWidth(col, widthRows, authoredContext);
|
|
2379
|
-
widths2.set(col.id, figures || !heatColumn(col) ? authored ?? (wrapped ? minimumWidth : intrinsicWidth) : heatOnlyWidth), wrapped && wrappedOneLines.set(col.id, intrinsicWidth);
|
|
2380
|
-
let extra = (col.kind === "rowLabel" ? labelLead : 0) + endRule;
|
|
2381
|
-
if (extra > 0) for (let target of [widths2, minimumWidths2]) target.set(col.id, target.get(col.id) + extra);
|
|
2382
|
-
}
|
|
2383
|
-
{
|
|
2384
|
-
let groupFaces = headingFaces(faces), drawn = cols.map((col) => col.id), isFixed = (id) => {
|
|
2385
|
-
let col = cols.find((candidate) => candidate.id === id);
|
|
2386
|
-
return col !== void 0 && (col.width !== void 0 || !figures && heatColumn(col));
|
|
2387
|
-
};
|
|
2388
|
-
for (let target of [widths2, minimumWidths2]) {
|
|
2389
|
-
let floors = groupHeadingFloors(table.columnGroups, drawn, (id) => target.get(id) ?? 0, isFixed, groupFaces, measure, groupCell);
|
|
2390
|
-
for (let [id, extra] of floors) target.set(id, target.get(id) + extra);
|
|
2391
|
-
}
|
|
2392
|
-
}
|
|
2393
|
-
let chipFloor = sectionChipFloor(widthRows, { ...context, hint: void 0 });
|
|
2394
|
-
if (labelColumn !== void 0)
|
|
2395
|
-
for (let [target, floor] of [[widths2, sectionChipFloor(widthRows, context)], [minimumWidths2, chipFloor]]) {
|
|
2396
|
-
let span = chipSpan(target);
|
|
2397
|
-
span < floor && target.set(labelColumn.id, target.get(labelColumn.id) + floor - span);
|
|
2398
|
-
}
|
|
2399
|
-
let labelFloor = options[LABEL_WRAP_FLOOR] === !0 && labelColumn !== void 0 ? labelWrapFloor(labelColumn, faces) + labelLead : 0;
|
|
2400
|
-
if (labelFloor > 0) for (let target of [widths2, minimumWidths2]) target.set(labelColumn.id, Math.max(target.get(labelColumn.id), labelFloor));
|
|
2401
|
-
view.scroll && labelColumn?.width === void 0 && labelColumn !== void 0 && (labelFloor = Math.max(labelFloor, view.labelKeep ?? 0, intrinsicColumnWidth(labelColumn, widthRows, {
|
|
2402
|
-
...context,
|
|
2403
|
-
hint: void 0,
|
|
2404
|
-
twoLineLabels: options.rowLabelLines !== 1
|
|
2405
|
-
}) + labelLead + (view.groupEnd?.has(labelColumn.id) ? 1 : 0)));
|
|
2406
|
-
let wrapFloors = /* @__PURE__ */ new Map(), wouldWrap = cols.filter((col) => {
|
|
2407
|
-
if (col.kind !== "text" || col.wrap || col.width !== void 0) return !1;
|
|
2408
|
-
let floor = wrapFloorWidth(col, widthRows, measure(columnHeaderText(col), faces.header).width, context);
|
|
2409
|
-
return floor >= minimumWidths2.get(col.id) ? !1 : (wrapFloors.set(col.id, floor), !0);
|
|
2410
|
-
});
|
|
2411
|
-
return { widths: widths2, minimumWidths: minimumWidths2, context, wouldWrap, wrapFloors, chipFloor, labelFloor, wrappedOneLines };
|
|
2412
|
-
}
|
|
2413
|
-
function labelWrapFloor(col, faces) {
|
|
2414
|
-
let text = rowIndent(0) + Math.max(0, ...columnHeaderText(col).split(/\s+/).map((word) => measure(word, faces.header).width)), unit = 0, open = new Set(rows.map((row) => row.parentId));
|
|
2415
|
-
for (let row of rows) {
|
|
2416
|
-
let cell = row.cells[col.id];
|
|
2417
|
-
if (row.role === "section" || row.inline === !0 || !cell?.displayed) continue;
|
|
2418
|
-
let font = cellFont(cell), indent = rowIndent(indentStep(cell));
|
|
2419
|
-
if (text = Math.max(text, indent + (options.rowLabelLines === 1 ? measure(cell.displayed, font).width : twoLineWidth(cell.displayed, font, measure, !0))), row.unitAffix !== void 0 && !(row.kind === "member" && open.has(row.id))) {
|
|
2420
|
-
let unitFont = theme.table?.qualifier === void 0 ? { ...inlineFont2(row.step, !1), ...font.style ? { style: font.style } : {} } : qualifierFont(font, theme);
|
|
2421
|
-
unit = Math.max(unit, indent + measure(row.unitAffix, unitFont).width);
|
|
2422
|
-
}
|
|
2423
|
-
for (let line of visibleInlineRows(row, options.inlineVisibility))
|
|
2424
|
-
line.label && (text = Math.max(text, indent + INLINE_LABEL_INDENT + measure(line.label, changeLineFont(theme, ladder, row.step)).width));
|
|
2425
|
-
}
|
|
2426
|
-
return Math.ceil(Math.max(text + 2 * cellPadX2, unit + cellPadX2));
|
|
2427
|
-
}
|
|
2428
|
-
function chipSpan(target) {
|
|
2429
|
-
return cols.slice(cols.indexOf(labelColumn)).reduce((sum, col) => sum + (target.get(col.id) ?? 0), 0);
|
|
2430
|
-
}
|
|
2431
|
-
let sumOf = (map) => [...map.values()].reduce((a, b) => a + b, spacerTotal), regular = trackWidths(regularFonts), dense = cols.length >= DENSE_COLUMNS ? trackWidths(tableFonts(theme, ladder, cols.length)) : void 0, wrapMinimumWidth = dense === void 0 && table.columnGroups.length === 0 && regular.chipFloor === 0 ? cols.reduce((sum, col) => sum + (regular.wrapFloors.get(col.id) ?? regular.minimumWidths.get(col.id)), spacerTotal) : void 0, regularHeadsFit = dense === void 0 || headsFit(
|
|
2432
|
-
cols,
|
|
2433
|
-
table.columnGroups,
|
|
2434
|
-
(id) => regular.widths.get(id) ?? 0,
|
|
2435
|
-
figures,
|
|
2436
|
-
regular.context,
|
|
2437
|
-
headingFaces(regularFonts),
|
|
2438
|
-
groupCell
|
|
2439
|
-
), chosen = dense !== void 0 && (!regularHeadsFit || !view.scroll && sumOf(regular.widths) > available) ? dense : regular, fonts = chosen.context.fonts, widths = chosen.widths, minimumWidths = chosen.minimumWidths, sizingMinimums = (dense ?? regular).minimumWidths, sizingTracks = new Map((dense ?? regular).widths);
|
|
2440
|
-
if (view.scroll && view.fit === void 0 && Number.isFinite(available) && chosen.wrappedOneLines.size > 0) {
|
|
2441
|
-
let want = [...chosen.wrappedOneLines].reduce((sum, [id, oneLine]) => sum + Math.max(0, oneLine - widths.get(id)), 0), share = Math.max(0, Math.min(want, available - sumOf(widths)));
|
|
2442
|
-
if (share > 0) for (let [id, oneLine] of chosen.wrappedOneLines) {
|
|
2443
|
-
let natural = widths.get(id);
|
|
2444
|
-
widths.set(id, Math.floor(natural + share * Math.max(0, oneLine - natural) / want));
|
|
2445
|
-
}
|
|
2446
|
-
}
|
|
2447
|
-
let canShrink = (col) => !view.scroll || col.width === void 0 && col.kind === "rowLabel", flexIds = cols.filter((c) => canShrink(c) && (c.kind === "rowLabel" || c.kind === "text")).map((c) => c.id), totalW = sumOf(widths), floorFlexIds = cols.filter((col) => col.kind === "rowLabel" || col.kind === "text").map((col) => col.id), minimumW = Math.max(sumOf(sizingMinimums), sumOf(shrinkReach(cols, floorFlexIds, wideTable, sizingTracks, sizingMinimums, (dense ?? regular).labelFloor)));
|
|
2448
|
-
if (totalW > available && flexIds.length > 0) {
|
|
2449
|
-
let deficit = totalW - available, beforeShrink = new Map(widths), floorOf = (col) => view.scroll ? chosen.labelFloor : shrinkFloorWidth(col, wideTable, minimumWidths, chosen.labelFloor);
|
|
2450
|
-
for (let col of cols.filter((c) => canShrink(c) && c.kind === "rowLabel")) {
|
|
2451
|
-
let take = Math.min(deficit, Math.max(0, widths.get(col.id) - Math.max(minimumWidths.get(col.id), view.scroll ? view.labelKeep ?? 0 : 0)));
|
|
2452
|
-
take > 0 && (widths.set(col.id, widths.get(col.id) - take), deficit -= take);
|
|
2453
|
-
}
|
|
2454
|
-
for (let kind of ["text", "rowLabel"]) {
|
|
2455
|
-
if (deficit <= 0) break;
|
|
2456
|
-
let shrinkable = cols.filter((c) => canShrink(c) && c.kind === kind).map((col) => ({
|
|
2457
|
-
id: col.id,
|
|
2458
|
-
room: Math.max(0, widths.get(col.id) - floorOf(col))
|
|
2459
|
-
})).filter((f) => f.room > 0), totalRoom = shrinkable.reduce((a, f) => a + f.room, 0);
|
|
2460
|
-
if (totalRoom <= 0) continue;
|
|
2461
|
-
let take = Math.min(deficit, totalRoom);
|
|
2462
|
-
for (let f of shrinkable) {
|
|
2463
|
-
let cut2 = take * f.room / totalRoom;
|
|
2464
|
-
widths.set(f.id, Math.round(widths.get(f.id) - cut2));
|
|
2465
|
-
}
|
|
2466
|
-
deficit -= take;
|
|
2467
|
-
}
|
|
2468
|
-
if (deficit <= 0) {
|
|
2469
|
-
let flex = cols.filter((col) => canShrink(col) && (col.kind === "rowLabel" || col.kind === "text"));
|
|
2470
|
-
for (let over = Math.ceil(sumOf(widths) - available); over > 0; over--) {
|
|
2471
|
-
let roomOf2 = (col) => widths.get(col.id) - floorOf(col), widest = flex.reduce((best, col) => best === void 0 || roomOf2(col) > roomOf2(best) ? col : best, void 0);
|
|
2472
|
-
if (widest === void 0 || roomOf2(widest) < 1) break;
|
|
2473
|
-
widths.set(widest.id, widths.get(widest.id) - 1);
|
|
2474
|
-
}
|
|
2475
|
-
}
|
|
2476
|
-
let remaining = Math.ceil(sumOf(widths) - available);
|
|
2477
|
-
if (remaining > 0 && wideTable) {
|
|
2478
|
-
let compactable = cols.filter((col) => canShrink(col) && col.kind !== "rowLabel" && col.kind !== "text").map((col) => col.id);
|
|
2479
|
-
for (; remaining > 0; ) {
|
|
2480
|
-
let changed = !1;
|
|
2481
|
-
for (let id of compactable) {
|
|
2482
|
-
if (remaining <= 0) break;
|
|
2483
|
-
let current = widths.get(id), minimum = minimumWidths.get(id);
|
|
2484
|
-
current <= minimum || (widths.set(id, current - 1), remaining--, changed = !0);
|
|
2485
|
-
}
|
|
2486
|
-
if (!changed) break;
|
|
2487
|
-
}
|
|
2488
|
-
}
|
|
2489
|
-
let printsUncut = (col) => col.wrap ? minimumWidths.get(col.id) : intrinsicColumnWidth(col, widthRows, { ...chosen.context, hint: void 0, twoLineLabels: !0 }), flexText = cols.filter((col) => canShrink(col) && col.kind === "text" && col.width === void 0), gapOf = (col) => ({ id: col.id, gap: printsUncut(col) - widths.get(col.id) }), cutGaps = flexText.filter((col) => widths.get(col.id) < beforeShrink.get(col.id)).map(gapOf), wants = cutGaps.filter((entry) => entry.gap > 0), gaps = wants.length === 0 ? [] : flexText.map((col) => cutGaps.find((entry) => entry.id === col.id) ?? gapOf(col)), wanted = wants.reduce((sum, entry) => sum + entry.gap, 0), groupFaces = headingFaces(fonts), spare = new Map(table.columnGroups.filter((group) => group.heading !== !1).map((group) => [
|
|
2490
|
-
group.id,
|
|
2491
|
-
cols.filter((col) => group.columnIds.includes(col.id)).reduce((sum, col) => sum + widths.get(col.id), 0) - groupHeadingNeed(group, groupFaces, measure, groupCell)
|
|
2492
|
-
])), donors = gaps.filter((entry) => entry.gap < 0).map((entry) => ({
|
|
2493
|
-
id: entry.id,
|
|
2494
|
-
slack: Math.floor(-entry.gap),
|
|
2495
|
-
groups: table.columnGroups.filter((group) => spare.has(group.id) && group.columnIds.includes(entry.id))
|
|
2496
|
-
})), roomOf = (donor) => Math.max(0, Math.min(donor.slack, ...donor.groups.map((group) => spare.get(group.id)))), rooms = donors.map(roomOf), given = rooms.reduce((sum, room2) => sum + room2, 0), move = Math.floor(Math.min(wanted, given)), moved = 0, cut = (donor, amount) => {
|
|
2497
|
-
let take = Math.min(amount, roomOf(donor));
|
|
2498
|
-
widths.set(donor.id, widths.get(donor.id) - take), donor.slack -= take;
|
|
2499
|
-
for (let group of donor.groups) spare.set(group.id, spare.get(group.id) - take);
|
|
2500
|
-
moved += take;
|
|
2501
|
-
};
|
|
2502
|
-
if (move > 0) {
|
|
2503
|
-
donors.forEach((donor, index) => cut(donor, Math.floor(move * rooms[index] / given)));
|
|
2504
|
-
for (let progress = !0; progress && moved < move; ) {
|
|
2505
|
-
progress = !1;
|
|
2506
|
-
for (let donor of donors) moved < move && roomOf(donor) > 0 && (cut(donor, 1), progress = !0);
|
|
2507
|
-
}
|
|
2508
|
-
let toTake = moved;
|
|
2509
|
-
for (let [index, entry] of wants.entries()) {
|
|
2510
|
-
let add = index === wants.length - 1 ? toTake : Math.min(toTake, Math.floor(moved * entry.gap / wanted));
|
|
2511
|
-
widths.set(entry.id, widths.get(entry.id) + add), toTake -= add;
|
|
2512
|
-
}
|
|
2513
|
-
}
|
|
2514
|
-
labelColumn !== void 0 && chipSpan(widths) < chosen.chipFloor && widths.set(labelColumn.id, widths.get(labelColumn.id) + chosen.chipFloor - chipSpan(widths));
|
|
2515
|
-
}
|
|
2516
|
-
let narrowed = cols.some((col) => col.width !== void 0 && (figures || !heatColumn(col)) && widths.get(col.id) < col.width);
|
|
2517
|
-
if (narrowed || sumOf(widths) > available) {
|
|
2518
|
-
let margin = resolveCanvasOptions(options).margin, frameWidth = Math.ceil(totalW);
|
|
2519
|
-
for (let pass = 0; pass < 4; pass++) {
|
|
2520
|
-
let sides = { ...canvasMargin(theme, frameWidth), ...margin }, next = Math.ceil(totalW + sides.left + sides.right);
|
|
2521
|
-
if (next === frameWidth) break;
|
|
2522
|
-
frameWidth = next;
|
|
2523
|
-
}
|
|
2524
|
-
let size = options.size === void 0 ? void 0 : resolveSize(options.size), height = options[TARGET_SIZE]?.fixed.height === !1 || typeof options.size == "object" && options.size.height === void 0 ? void 0 : size?.height;
|
|
2525
|
-
warnings.push({
|
|
2526
|
-
code: "table-overflow",
|
|
2527
|
-
severity: "warn",
|
|
2528
|
-
message: narrowed ? `authored column widths were narrowed to fit the frame; use a frame at least ${frameWidth} px wide to keep them` : `table wider than the plot area; use a frame at least ${frameWidth} px wide to show all columns`,
|
|
2529
|
-
field: ["options", "size"],
|
|
2530
|
-
detail: { naturalWidth: frameWidth },
|
|
2531
|
-
suggest: `Set the frame width to ${frameWidth} px or more.`,
|
|
2532
|
-
fix: [{ op: "add", path: "/options/size", value: { width: frameWidth, ...height === void 0 ? {} : { height } } }]
|
|
2533
|
-
});
|
|
2534
|
-
}
|
|
2535
|
-
let grownFrom = /* @__PURE__ */ new Map(), grow = (id, add) => {
|
|
2536
|
-
grownFrom.has(id) || grownFrom.set(id, widths.get(id)), widths.set(id, widths.get(id) + add);
|
|
2537
|
-
}, room = Number.isFinite(available) ? Math.floor(available - sumOf(widths)) : 1 / 0;
|
|
2538
|
-
if (Number.isFinite(available) && options.frameFill !== "none")
|
|
2539
|
-
for (let col of cols) {
|
|
2540
|
-
if (room < 1) break;
|
|
2541
|
-
if (col.width === void 0 || col.kind !== "value" && col.kind !== "computed" || !figures && heatColumn(col)) continue;
|
|
2542
|
-
let add = Math.min(room, Math.ceil(minimumWidths.get(col.id) - widths.get(col.id)));
|
|
2543
|
-
add < 1 || (grow(col.id, add), room -= add);
|
|
2544
|
-
}
|
|
2545
|
-
for (let [id, short] of groupHeadingFloors(table.columnGroups, cols.map((col) => col.id), (member) => widths.get(member) ?? 0, () => !1, headingFaces(fonts), measure, groupCell)) {
|
|
2546
|
-
let add = options.frameFill === "none" ? 0 : Math.max(0, Math.min(room, Math.ceil(short)));
|
|
2547
|
-
add >= 1 && (grow(id, add), room -= add);
|
|
2548
|
-
let group = table.columnGroups.find((candidate) => candidate.columnIds.includes(id)), wraps = () => !view.scroll && groupHeadingWrap(
|
|
2549
|
-
group,
|
|
2550
|
-
headingFaces(fonts),
|
|
2551
|
-
measure,
|
|
2552
|
-
cols.filter((col) => group.columnIds.includes(col.id)).reduce((sum, col) => sum + widths.get(col.id), 0) - 2 * cellPadX2 - (groupCell.startRule?.(group.id) ?? 0)
|
|
2553
|
-
) !== void 0;
|
|
2554
|
-
short - add > 0.5 && !wraps() && warnings.push({
|
|
2555
|
-
code: "table-group-heading-overflow",
|
|
2556
|
-
severity: "warn",
|
|
2557
|
-
message: `column group '${group.id}' heading needs ${Math.ceil(short - add)} px more than its columns' authored widths; it runs past the block`,
|
|
2558
|
-
suggest: "Shorten the heading or its note, widen a column of the group, or give the table a wider frame."
|
|
2559
|
-
});
|
|
2560
|
-
}
|
|
2561
|
-
for (let col of cols) if (figures || !heatColumn(col)) {
|
|
2562
|
-
let grown = grownFrom.get(col.id), track = grown ?? widths.get(col.id), minimum = col.kind === "rowLabel" && col.width !== void 0 && minimumWidths.get(col.id) > track ? intrinsicColumnWidth(col, widthRows, { ...chosen.context, twoLineLabels: options.rowLabelLines !== 1 }) : minimumWidths.get(col.id), found = authoredWidthWarnings(col, table.columns.findIndex((authored) => authored.id === col.id), track, minimum, chosen.context);
|
|
2563
|
-
warnings.push(...grown === void 0 ? found : found.filter((warning) => warning.code === "table-column-widened" || widths.get(col.id) < minimumWidths.get(col.id)));
|
|
2564
|
-
}
|
|
2565
|
-
let rowToFrame = (options.rowExtent ?? "frame") === "frame";
|
|
2566
|
-
if (Number.isFinite(available) && options.lastTrackFlex === !0 && !rowToFrame && cols.length > 0) {
|
|
2567
|
-
let slack = available - sumOf(widths), lastCol = cols[cols.length - 1];
|
|
2568
|
-
slack > 0 && lastCol.width === void 0 && widths.set(lastCol.id, widths.get(lastCol.id) + slack);
|
|
2569
|
-
}
|
|
2570
|
-
let beforeFill = new Map(widths);
|
|
2571
|
-
if (Number.isFinite(available) && rowToFrame && options.frameFill !== "none") {
|
|
2572
|
-
let growing = cols.filter((col) => col.width === void 0 && (col.kind === "value" || col.kind === "computed") && (figures || !heatColumn(col))), extras = frameFillExtras(
|
|
2573
|
-
growing.map((col) => ({ id: col.id, width: widths.get(col.id) })),
|
|
2574
|
-
available - sumOf(widths),
|
|
2575
|
-
options.maxGrowth,
|
|
2576
|
-
labelColumn?.width === void 0 ? labelColumn?.id : void 0
|
|
2577
|
-
), labelCap = labelColumn?.maxWidth;
|
|
2578
|
-
labelColumn !== void 0 && labelCap !== void 0 && extras.has(labelColumn.id) && extras.set(labelColumn.id, Math.max(0, Math.min(extras.get(labelColumn.id), labelCap - widths.get(labelColumn.id))));
|
|
2579
|
-
for (let [id, extra] of extras) widths.set(id, widths.get(id) + extra);
|
|
2580
|
-
}
|
|
2581
|
-
let labelNeed;
|
|
2582
|
-
if (labelColumn !== void 0 && labelColumn.width === void 0) {
|
|
2583
|
-
let labelId = labelColumn.id, need = view.scroll ? intrinsicColumnWidth(
|
|
2584
|
-
{ ...labelColumn, maxWidth: void 0, maxTextWidth: void 0 },
|
|
2585
|
-
widthRows,
|
|
2586
|
-
{ ...chosen.context, hint: void 0 }
|
|
2587
|
-
) + labelLead : Math.ceil(Math.max(0, maxOf(rows.map((row) => {
|
|
2588
|
-
let cell = row.cells[labelId];
|
|
2589
|
-
if (row.role === "section" || !cell?.displayed) return 0;
|
|
2590
|
-
let font = cellFont(cell);
|
|
2591
|
-
return measure(cell.displayed, font).width + affixRoom(row, font) + rowIndent(indentStep(cell)) + 2 * cellPadX2;
|
|
2592
|
-
})))), cap = labelColumn.maxWidth !== void 0 && options[SOFT_LABEL_CAP] !== !0 ? labelColumn.maxWidth : 1 / 0;
|
|
2593
|
-
labelNeed = Math.min(need, cap);
|
|
2594
|
-
let short = labelNeed - widths.get(labelId);
|
|
2595
|
-
if (short > 0) {
|
|
2596
|
-
let outside = Number.isFinite(available) ? Math.min(short, Math.max(0, Math.floor(available - sumOf(widths)))) : 0;
|
|
2597
|
-
widths.set(labelId, widths.get(labelId) + outside), short -= outside;
|
|
2598
|
-
let grown = cols.filter((col) => col.id !== labelId && widths.get(col.id) > beforeFill.get(col.id)), total = grown.reduce((sum, col) => sum + widths.get(col.id) - beforeFill.get(col.id), 0), take = Math.min(short, Math.floor(total)), left = take;
|
|
2599
|
-
for (let [index, col] of grown.entries()) {
|
|
2600
|
-
let extra = widths.get(col.id) - beforeFill.get(col.id), back = index === grown.length - 1 ? Math.min(left, Math.floor(extra)) : Math.min(left, Math.floor(take * extra / total));
|
|
2601
|
-
widths.set(col.id, widths.get(col.id) - back), left -= back;
|
|
2602
|
-
}
|
|
2603
|
-
widths.set(labelId, widths.get(labelId) + take - left);
|
|
2604
|
-
}
|
|
2605
|
-
}
|
|
2606
|
-
let tracks = columnTracks((view.allColumns ?? cols).map((col) => ({ id: col.id, natural: widths.get(col.id) ?? 0 })), {
|
|
2607
|
-
fit: rowToFrame ? "content" : view.fit,
|
|
2608
|
-
available: Number.isFinite(available) && (!view.scroll || view.fit !== void 0) ? Math.max(0, available - spacerTotal) : void 0,
|
|
2609
|
-
anchorId: (view.allColumns ?? cols)[0]?.id,
|
|
2610
|
-
hidden: view.allColumns === void 0 ? void 0 : new Set(view.allColumns.filter((col) => !widths.has(col.id)).map((col) => col.id)),
|
|
2611
|
-
fixed: new Set(cols.filter((col) => col.width !== void 0 || !figures && heatColumn(col)).map((col) => col.id)),
|
|
2612
|
-
...options.maxGrowth === !1 ? {} : { maxGrowth: options.maxGrowth ?? DEFAULT_TRACK_GROWTH }
|
|
2613
|
-
}), labelsWrap = labelColumn !== void 0 && labelNeed !== void 0 && widths.get(labelColumn.id) < labelNeed, gridTracks = tracks.flatMap((track, index) => {
|
|
2614
|
-
let spacer = spacerBefore.get(track.id), drawn = index === 0 && (view.frameStart ?? 0) > 0 ? { ...track, width: track.width + view.frameStart } : track;
|
|
2615
|
-
return spacer === void 0 ? [drawn] : [{ id: `bp-spacer:${track.id}`, natural: spacer, width: spacer }, drawn];
|
|
2616
|
-
}), labelBeforeFill = labelColumn === void 0 ? void 0 : beforeFill.get(labelColumn.id);
|
|
2617
|
-
return {
|
|
2618
|
-
tracks,
|
|
2619
|
-
gridTracks,
|
|
2620
|
-
spacerBefore,
|
|
2621
|
-
spacerTotal,
|
|
2622
|
-
labelNeed,
|
|
2623
|
-
labelBeforeFill,
|
|
2624
|
-
labelsWrap,
|
|
2625
|
-
widths,
|
|
2626
|
-
minimumWidths,
|
|
2627
|
-
sizingMinimums,
|
|
2628
|
-
totalW,
|
|
2629
|
-
minimumW,
|
|
2630
|
-
fonts,
|
|
2631
|
-
regularFonts,
|
|
2632
|
-
context: chosen.context,
|
|
2633
|
-
wouldWrap: (dense ?? regular).wouldWrap,
|
|
2634
|
-
wrapMinimumWidth,
|
|
2635
|
-
warnings,
|
|
2636
|
-
cellPadX: cellPadX2,
|
|
2637
|
-
rowIndent,
|
|
2638
|
-
cellFont,
|
|
2639
|
-
cellStep,
|
|
2640
|
-
indentStep,
|
|
2641
|
-
columnHeaderText,
|
|
2642
|
-
indents,
|
|
2643
|
-
operatorSlot,
|
|
2644
|
-
childCount,
|
|
2645
|
-
hasChanges
|
|
2646
|
-
};
|
|
2647
|
-
}
|
|
2648
|
-
function shrinkFloorWidth(col, wideTable, minimumWidths, labelFloor = 0) {
|
|
2649
|
-
return col.kind === "rowLabel" ? Math.min(col.width ?? 1 / 0, Math.max(wideTable ? 180 : FLEX_MIN, labelFloor)) : col.kind === "text" && col.wrap ? Math.max(FLEX_MIN, minimumWidths.get(col.id) ?? FLEX_MIN) : FLEX_MIN;
|
|
2650
|
-
}
|
|
2651
|
-
function shrinkReach(cols, flexIds, wideTable, drawn, minimumWidths, labelFloor = 0) {
|
|
2652
|
-
return new Map(cols.map((col) => {
|
|
2653
|
-
let width = drawn.get(col.id) ?? 0, minimum = minimumWidths.get(col.id) ?? width;
|
|
2654
|
-
if (!flexIds.includes(col.id)) return [col.id, wideTable ? Math.min(width, minimum) : width];
|
|
2655
|
-
let floor = shrinkFloorWidth(col, wideTable, minimumWidths, labelFloor);
|
|
2656
|
-
return [col.id, Math.min(width, floor, col.kind === "rowLabel" ? minimum : width)];
|
|
2657
|
-
}));
|
|
2658
|
-
}
|
|
2659
|
-
function tableDisplayFloor(table, theme, options, target, width, frame) {
|
|
2660
|
-
let ladder = levelLadder(theme, options.density ?? "regular", target, textScaleOf(options)), fonts = tableFonts(theme, ladder), floors = targetFloorsPx(target), scale = 0.9, include = (size, role) => {
|
|
2661
|
-
scale = Math.max(scale, floors[role] / size);
|
|
2662
|
-
};
|
|
2663
|
-
frame.title && include(theme.type.title.size, "title"), frame.subtitle && include(theme.type.subtitle.size, "subtitle"), (frame.source || frame.footnotes.length) && include(footerType(theme.type.footnote, target, textScaleOf(options)).size, "footnote");
|
|
2664
|
-
let includeHead = (size) => {
|
|
2665
|
-
scale = Math.max(scale, tableHeadFloorPx(target) / size);
|
|
2566
|
+
var isTotalRow = (row) => row.role === "total" && row.kind !== "result" && row.kind !== "driver", labelOnlyRow = (row, expanded) => row.role === "section" || row.kind === "member" && expanded.has(row.id);
|
|
2567
|
+
function noteLineIndex(lines, colId) {
|
|
2568
|
+
let index = lines.findIndex((line) => {
|
|
2569
|
+
let cell = line.cells[colId];
|
|
2570
|
+
return cell === void 0 || cell.state !== "value" || cell.displayed === "";
|
|
2571
|
+
});
|
|
2572
|
+
return index < 0 ? lines.length : index;
|
|
2573
|
+
}
|
|
2574
|
+
function cellPrinted(table, laidOut, options) {
|
|
2575
|
+
let rows = new Set(laidOut.rows.map((row) => row.id)), byId = new Map(table.rows.map((row) => [row.id, row])), expanded = new Set(laidOut.rows.map((row) => byId.get(row.id)?.parentId).filter((id) => id !== void 0)), columns = new Set(laidOut.columns.map((column) => column.id)), labels = new Set(table.columns.filter((column) => column.kind === "rowLabel").map((column) => column.id)), figures = printsFigures(options.figures, table.columns.filter((column) => columns.has(column.id))), heat = new Set(table.columns.filter(heatColumn).map((column) => column.id)), noteLines = table.columns.filter((column) => column.noteLine === !0 && column.kind !== "rowLabel"), lines = /* @__PURE__ */ new Map();
|
|
2576
|
+
for (let row of table.rows) if (rows.has(row.id)) {
|
|
2577
|
+
let shown = visibleInlineRows(row, options.inlineVisibility);
|
|
2578
|
+
for (let line of shown) lines.set(line.id, /* @__PURE__ */ new Set());
|
|
2579
|
+
for (let column of noteLines) row.cells[column.id]?.note !== void 0 && lines.get(shown[noteLineIndex(shown, column.id)]?.id ?? "")?.add(column.id);
|
|
2580
|
+
}
|
|
2581
|
+
return (rowId, colId) => {
|
|
2582
|
+
let row = byId.get(rowId);
|
|
2583
|
+
if (row === void 0 || !columns.has(colId) || (row.cells[colId]?.displayed ?? "") === "") return !1;
|
|
2584
|
+
let host = row.inline === !0 ? byId.get(row.parentId ?? "") ?? row : row;
|
|
2585
|
+
return labelOnlyRow(host, expanded) && !labels.has(colId) || !figures && heat.has(colId) && !isTotalRow(row) ? !1 : row.inline === !0 ? lines.get(rowId)?.has(colId) === !1 : rows.has(rowId);
|
|
2666
2586
|
};
|
|
2667
|
-
table.columns.length && includeHead(fonts.header.size), table.columns.some((column) => column.subLabel) && includeHead(fonts.sub.size), table.columnGroups.some((group) => group.heading !== !1) && includeHead(fonts.group.size);
|
|
2668
|
-
for (let row of table.rows) {
|
|
2669
|
-
if (row.inline) continue;
|
|
2670
|
-
let hasChanges = visibleInlineRows(row, options.inlineVisibility).length > 0;
|
|
2671
|
-
include(rowFont(theme, ladder, fonts, row.role, row.step, row.hasChildren, hasChanges).size, "label"), hasChanges && include(changeLineFont(theme, ladder, row.step).size, "label"), row.badge && include(fonts.chip.size, "label"), row.unitAffix && include(ladder.inlineSize(), "label");
|
|
2672
|
-
for (let cell of Object.values(row.cells))
|
|
2673
|
-
cell.kind === "status" && include(fonts.chip.size, "label"), cell.note && include(ladder.inlineSize(), "footnote");
|
|
2674
|
-
}
|
|
2675
|
-
return { target, minDisplayWidth: width * scale };
|
|
2676
|
-
}
|
|
2677
|
-
function belowTableViewportFloor(authoredSize) {
|
|
2678
|
-
if (authoredSize === void 0) return !1;
|
|
2679
|
-
let size = resolveSize(authoredSize), sizing = resolveSizing(chartSizing("table"), size), heightAuthored = typeof authoredSize != "object" || authoredSize.height !== void 0;
|
|
2680
|
-
return !fitsSize({ width: size.width, height: heightAuthored ? size.height : 1 / 0 }, sizing);
|
|
2681
|
-
}
|
|
2682
|
-
function tableFrameMode(options) {
|
|
2683
|
-
if (options.mode) return options.mode;
|
|
2684
|
-
if (options.size === void 0) return "full";
|
|
2685
|
-
let size = resolveSize(options.size), sizing = resolveSizing(chartSizing("table"), size);
|
|
2686
|
-
return fitsSize(size, sizing) ? "full" : "compact";
|
|
2687
2587
|
}
|
|
2688
2588
|
|
|
2689
2589
|
export {
|
|
@@ -2692,11 +2592,10 @@ export {
|
|
|
2692
2592
|
INLINE_LINE_RATIO,
|
|
2693
2593
|
LINE_BOX_EPSILON,
|
|
2694
2594
|
levelLadder,
|
|
2595
|
+
tableCellKey,
|
|
2596
|
+
tableCellNodeId,
|
|
2597
|
+
printsInCell,
|
|
2695
2598
|
presetLanguage,
|
|
2696
|
-
printedNumber,
|
|
2697
|
-
arrowGlyph,
|
|
2698
|
-
arrowKey,
|
|
2699
|
-
emitArrow,
|
|
2700
2599
|
heatRanges,
|
|
2701
2600
|
badSide,
|
|
2702
2601
|
heatKey,
|
|
@@ -2704,7 +2603,14 @@ export {
|
|
|
2704
2603
|
emitHeat,
|
|
2705
2604
|
ZERO_LIFT,
|
|
2706
2605
|
columnHeaderAffix,
|
|
2606
|
+
prepareTableData,
|
|
2607
|
+
resolvePreparedTable,
|
|
2707
2608
|
resolveTable,
|
|
2609
|
+
tableFrameUnit,
|
|
2610
|
+
printedNumber,
|
|
2611
|
+
arrowGlyph,
|
|
2612
|
+
arrowKey,
|
|
2613
|
+
emitArrow,
|
|
2708
2614
|
cellHoldsNumber,
|
|
2709
2615
|
numericCell,
|
|
2710
2616
|
cellDrawsTabular,
|
|
@@ -2715,6 +2621,7 @@ export {
|
|
|
2715
2621
|
depthToExpansion,
|
|
2716
2622
|
expansionForFolds,
|
|
2717
2623
|
expansionRootsHidden,
|
|
2624
|
+
EMPTY_ROW_ID,
|
|
2718
2625
|
emptyMessageRow,
|
|
2719
2626
|
visibleRows,
|
|
2720
2627
|
finalClosers,
|
|
@@ -2727,8 +2634,8 @@ export {
|
|
|
2727
2634
|
visibleColumns,
|
|
2728
2635
|
groupSpans,
|
|
2729
2636
|
inCellBarMaxima,
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2637
|
+
isTotalRow,
|
|
2638
|
+
labelOnlyRow,
|
|
2639
|
+
noteLineIndex,
|
|
2640
|
+
cellPrinted
|
|
2734
2641
|
};
|