boardplot 0.57.0 → 0.58.1
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 +311 -0
- package/README.md +48 -14
- package/dist/{DiagnosticDetails-JFBBXOT2.js → DiagnosticDetails-FXNTFSA4.js} +2 -2
- package/dist/{ReaderBox-GCIITQCX.js → ReaderBox-WVOT7VVJ.js} +8 -7
- package/dist/{annotateEngine-JMZI6QEG.js → annotateEngine-57L26X77.js} +2 -1
- package/dist/build-identity.json +3 -3
- package/dist/{chunk-6LQKU6YN.js → chunk-23FT7RLN.js} +11 -10
- package/dist/{chunk-5WSIH4SR.js → chunk-2CQBBN7M.js} +4 -4
- package/dist/chunk-2DS4MT7T.js +25 -0
- package/dist/{chunk-QFIRPOXR.js → chunk-2HII2B6S.js} +3 -3
- package/dist/{chunk-JMOBA5ES.js → chunk-2IRMGCYE.js} +2 -2
- package/dist/{chunk-JKXJWCJ5.js → chunk-2SWSUNA4.js} +116 -54
- package/dist/{chunk-O7Y6RJ4D.js → chunk-33EBLJVZ.js} +11 -11
- package/dist/{chunk-EHQLLZCQ.js → chunk-34PKJZRY.js} +59 -34
- package/dist/{chunk-SHAAMKN7.js → chunk-35ZJUZUO.js} +18 -18
- package/dist/{chunk-TGR6PRKG.js → chunk-3BMPYY26.js} +6 -3
- package/dist/{chunk-XJUZC53Y.js → chunk-3E6NLODZ.js} +1 -1
- package/dist/{chunk-H3EWFSWI.js → chunk-3ESWPMDW.js} +43 -29
- package/dist/{chunk-6KHRMK3I.js → chunk-3M2F7KSS.js} +158 -75
- package/dist/{chunk-UBXIGE2P.js → chunk-3MFVJMP6.js} +2 -2
- package/dist/{chunk-MOQFYJ3F.js → chunk-3OSQ32GN.js} +5 -5
- package/dist/{chunk-HGPFEG2L.js → chunk-3RXUA6VY.js} +5 -5
- package/dist/{chunk-I65OLJ2X.js → chunk-42QKUSHJ.js} +13 -3
- package/dist/{chunk-FAFUMSPR.js → chunk-4DK67I3B.js} +83 -51
- package/dist/{chunk-EEBMK6T6.js → chunk-4DMRIL5K.js} +8 -8
- package/dist/chunk-4M3UADCM.js +602 -0
- package/dist/{chunk-WSKZZ2ZB.js → chunk-4OJF6DXL.js} +538 -503
- package/dist/{chunk-UD6U4EF5.js → chunk-4ROZ4TFL.js} +1 -1
- package/dist/{chunk-I7KDPCC7.js → chunk-4TUU3UGY.js} +18 -10
- package/dist/{chunk-6ZN2XJFI.js → chunk-54YO56IK.js} +1 -1
- package/dist/{chunk-JMGB444D.js → chunk-5ACFYNA4.js} +8 -4
- package/dist/{chunk-BQIADGJB.js → chunk-5CYLT6FJ.js} +5 -5
- package/dist/{chunk-IVQT2E3Y.js → chunk-5I4RPBNE.js} +13 -13
- package/dist/{chunk-LW4ZQGVL.js → chunk-5KAYLRRP.js} +7 -8
- package/dist/{chunk-2BHLRHF2.js → chunk-5SVGTQTW.js} +4 -4
- package/dist/{chunk-5JTRCSBN.js → chunk-62BDQTO6.js} +2 -2
- package/dist/{chunk-4RN4OM6I.js → chunk-63JUV7NR.js} +3 -3
- package/dist/chunk-645BGVPP.js +26 -0
- package/dist/{chunk-JIH52I36.js → chunk-65U6ZBZZ.js} +119 -85
- package/dist/{chunk-3DUGZ7ML.js → chunk-6ALORYH7.js} +46 -31
- package/dist/{chunk-HB3TH7GY.js → chunk-6AVUTZ6W.js} +10 -6
- package/dist/{chunk-JYAZPMSA.js → chunk-6IUK6PAH.js} +7 -6
- package/dist/{chunk-W5SVS4B6.js → chunk-6JFQCVNN.js} +4 -4
- package/dist/{chunk-IZRTNCJQ.js → chunk-6JTCFPAD.js} +5 -5
- package/dist/{chunk-5TUDYKNL.js → chunk-6NGKQNTB.js} +42 -29
- package/dist/{chunk-IUVJVMKS.js → chunk-6V3A3MTG.js} +55 -32
- package/dist/{chunk-FJKFYQ5I.js → chunk-6YBNVI5I.js} +36 -28
- package/dist/chunk-76GPN6AT.js +72 -0
- package/dist/{chunk-SHCW2TCA.js → chunk-7GRR72MY.js} +25 -23
- package/dist/{chunk-D2B3KP35.js → chunk-7VWXXBTC.js} +4 -0
- package/dist/{chunk-Y5IKCXQR.js → chunk-7YZZCQT3.js} +5 -5
- package/dist/chunk-A65B23JK.js +113 -0
- package/dist/{chunk-2WTD3GCR.js → chunk-A6N24NGW.js} +3 -3
- package/dist/{chunk-72OJBDRB.js → chunk-AAQWFTDM.js} +52 -41
- package/dist/{chunk-4JNHF6JW.js → chunk-AGJ2QL4A.js} +84 -40
- package/dist/{chunk-I3DLERI7.js → chunk-AICO24HJ.js} +5 -2
- package/dist/{chunk-LSKCKGCF.js → chunk-AJGSCVVW.js} +2 -2
- package/dist/{chunk-7P7D6WXR.js → chunk-AKZOQGF3.js} +3 -3
- package/dist/{chunk-RSCRIWAH.js → chunk-AL62JJTB.js} +10 -3
- package/dist/{chunk-VY67Q6CJ.js → chunk-AMBQ6SWU.js} +36 -33
- package/dist/{chunk-73O6AOAA.js → chunk-AQ2PQ7FK.js} +241 -140
- package/dist/{chunk-XFCBH3TI.js → chunk-BHLNSJG7.js} +3 -3
- package/dist/{chunk-6XU5XGYV.js → chunk-BQ7SN7AW.js} +5 -5
- package/dist/{chunk-DRHQG44U.js → chunk-BQBD6Q5J.js} +6 -2
- package/dist/{chunk-LSR3SBJ4.js → chunk-BSZOQJXB.js} +234 -136
- package/dist/{chunk-KJLH5EHD.js → chunk-BVIJCUWW.js} +175 -110
- package/dist/{chunk-2AJWRVZ2.js → chunk-C47POAC5.js} +1 -1
- package/dist/{chunk-AOIZJ7GR.js → chunk-C4SQU2PB.js} +6 -6
- package/dist/{chunk-Y7Q3VEYC.js → chunk-CCAAI56H.js} +30 -10
- package/dist/{chunk-T3WCDDIL.js → chunk-CDUR3KWV.js} +2 -2
- package/dist/{chunk-T5MBORBK.js → chunk-CFESVCZR.js} +1 -1
- package/dist/{chunk-EEL2N4Y6.js → chunk-CKEFAD4R.js} +5 -5
- package/dist/{chunk-WE5WVQE4.js → chunk-CMPHT2LS.js} +3 -3
- package/dist/{chunk-FHA3KMFC.js → chunk-CQBPNE7Z.js} +5 -1
- package/dist/{chunk-JSA3ESEJ.js → chunk-CR5FP5SF.js} +1 -1
- package/dist/{chunk-NCCDEUHD.js → chunk-CSMVKG2C.js} +1 -1
- package/dist/{chunk-JHWDTV4K.js → chunk-D2TQX7UJ.js} +2 -2
- package/dist/{chunk-GHFTKVJN.js → chunk-DHGE46UK.js} +1 -1
- package/dist/{chunk-26WNBTWB.js → chunk-DORE2RHL.js} +5 -5
- package/dist/{chunk-AFA32LHN.js → chunk-DUOGEFLG.js} +62 -36
- package/dist/{chunk-WZB6R2ZX.js → chunk-DZYTXZNS.js} +11 -3
- package/dist/{chunk-O4D27FKH.js → chunk-E5YF236N.js} +4 -1
- package/dist/{chunk-6EE6XEMA.js → chunk-EB4PQEI3.js} +26 -17
- package/dist/{chunk-ANNQJWDX.js → chunk-EBWMTQ4U.js} +285 -34
- package/dist/{chunk-EHNGPUTO.js → chunk-EDW5HQND.js} +5 -5
- package/dist/{chunk-VM5CQ7CG.js → chunk-EHRRHSPV.js} +2 -2
- package/dist/{chunk-PYGEIPPH.js → chunk-EILNJQMN.js} +32 -12
- package/dist/{chunk-KGS5Z7SL.js → chunk-ERDKMZ7O.js} +2 -2
- package/dist/{chunk-USFIDSTO.js → chunk-ETUKDEGL.js} +18 -11
- package/dist/chunk-F2ET5ZTT.js +49 -0
- package/dist/{chunk-HVX2E26J.js → chunk-F3XOBFS4.js} +9 -8
- package/dist/{chunk-I4NUYVP5.js → chunk-FB6X7QHA.js} +1 -1
- package/dist/{chunk-LO3AGGE3.js → chunk-FJNZ7NWD.js} +5 -5
- package/dist/{chunk-IRXTNSZL.js → chunk-FPFRLRQO.js} +40 -22
- package/dist/{chunk-YTEJYLU7.js → chunk-FRR7BJ3B.js} +2 -2
- package/dist/{chunk-DPUCT567.js → chunk-FVWHEM2N.js} +7 -5
- package/dist/{chunk-A33MFWHW.js → chunk-G7BCLYL4.js} +2 -2
- package/dist/{chunk-2KCK63DD.js → chunk-G7CXJPEN.js} +2 -2
- package/dist/{chunk-2X6XY4K4.js → chunk-GB3RZYTK.js} +39 -19
- package/dist/{chunk-MTCDGSYW.js → chunk-GHCU6OSE.js} +2 -2
- package/dist/{chunk-AFGQXMKT.js → chunk-GNMB72V7.js} +161 -67
- package/dist/chunk-GOFS336W.js +24 -0
- package/dist/{chunk-JMXNXLAC.js → chunk-GQYT7G4F.js} +2 -2
- package/dist/{chunk-RRPTQGRU.js → chunk-H3VICNTN.js} +1 -1
- package/dist/{chunk-JRRSKCGG.js → chunk-H4EDDGGX.js} +3 -3
- package/dist/{chunk-5H4HFRDO.js → chunk-H7BCNS5J.js} +5 -5
- package/dist/{chunk-GC4WOLV3.js → chunk-HAG3K6PQ.js} +14 -2
- package/dist/chunk-HF4BCPIV.js +26 -0
- package/dist/{chunk-YCUNFAEE.js → chunk-HM4AJ5U4.js} +238 -127
- package/dist/{chunk-7FAO4ICF.js → chunk-HO4ILCW7.js} +2 -2
- package/dist/{chunk-ZV3SNRJI.js → chunk-HTQGJQZN.js} +4 -2
- package/dist/{chunk-G5BUGYIL.js → chunk-I52OMC5B.js} +192 -113
- package/dist/{chunk-TMXRTYGT.js → chunk-I5VNHDPR.js} +3 -2
- package/dist/{chunk-M74H7QYD.js → chunk-IDXYHDQY.js} +1 -1
- package/dist/{chunk-SSZB3VXG.js → chunk-IFUAPFL5.js} +102 -47
- package/dist/{chunk-IPWUBZ4P.js → chunk-IIWZJ5ZM.js} +1 -1
- package/dist/{chunk-KF3ZHLHQ.js → chunk-IMUMPKXF.js} +5 -5
- package/dist/{chunk-HC6WHTBX.js → chunk-IPBOREIY.js} +1 -1
- package/dist/{chunk-76UL4CT4.js → chunk-IPZJCBWD.js} +27 -22
- package/dist/{chunk-5P4MXWKP.js → chunk-ITEJQHXE.js} +4 -4
- package/dist/{chunk-WDAZ2MT4.js → chunk-IVDTP6SV.js} +4 -4
- package/dist/{chunk-BDGLMWPO.js → chunk-IXOBDDMW.js} +11 -2
- package/dist/{chunk-K6Y4HBK7.js → chunk-IXU5C3YY.js} +1000 -904
- package/dist/{chunk-EDBUVDRI.js → chunk-JBAVMO56.js} +372 -93
- package/dist/{chunk-VY2NPB2Q.js → chunk-JNDWRV34.js} +4 -4
- package/dist/{chunk-XYUXB5VK.js → chunk-JT3UTEWZ.js} +3 -3
- package/dist/{chunk-A6XCVOC5.js → chunk-JY4LTPOV.js} +1 -1
- package/dist/{chunk-VT7PBGL2.js → chunk-JYSFAH7C.js} +23 -36
- package/dist/chunk-K7XPTQBJ.js +267 -0
- package/dist/{chunk-2I76VFMZ.js → chunk-KI7VCHNZ.js} +49 -37
- package/dist/{chunk-YB6QGOCO.js → chunk-KUWIRCYJ.js} +2 -2
- package/dist/{chunk-MQ5EKWIG.js → chunk-KVBLTAO7.js} +5 -5
- package/dist/{chunk-XCROSJ2Z.js → chunk-KW4JXWHO.js} +1 -1
- package/dist/{chunk-BY5JGQFZ.js → chunk-KWIP5YRA.js} +4 -4
- package/dist/{chunk-KAAB2DIV.js → chunk-LJDATBPB.js} +6 -6
- package/dist/{chunk-TDDSWNGD.js → chunk-LOXZSTIM.js} +30 -28
- package/dist/{chunk-ZTSJ7NY6.js → chunk-LPMSGO7L.js} +3 -3
- package/dist/{chunk-IXM6BAM4.js → chunk-LXH4RPY4.js} +1 -1
- package/dist/{chunk-D5G67OER.js → chunk-LYAT62UT.js} +1 -1
- package/dist/{chunk-EFKFZNQC.js → chunk-M5LPP2GQ.js} +34 -20
- package/dist/{chunk-QZMLSK43.js → chunk-MALSSEXO.js} +294 -145
- package/dist/{chunk-XN7JDII2.js → chunk-MB5EX2YG.js} +230 -107
- package/dist/{chunk-PSYPB22T.js → chunk-MGXHFRQK.js} +5 -5
- package/dist/{chunk-GADI2DU7.js → chunk-MVR7YKBF.js} +152 -27
- package/dist/{chunk-IFURKTOL.js → chunk-MXUPMGRY.js} +2 -2
- package/dist/{chunk-C5SQEYTQ.js → chunk-NFGV5OAR.js} +153 -65
- package/dist/{chunk-RZNYW7UP.js → chunk-NNIZG3TH.js} +8 -0
- package/dist/{chunk-AKJO6N4K.js → chunk-NQPJWQTW.js} +11 -4
- package/dist/{chunk-YFI5PN5O.js → chunk-NSMYIUBZ.js} +34 -11
- package/dist/{chunk-H6EJ63QN.js → chunk-NT3HCXQC.js} +144 -83
- package/dist/chunk-NZ7FX3AE.js +65 -0
- package/dist/chunk-O3LT4TAI.js +34 -0
- package/dist/{chunk-L2XRUG4P.js → chunk-OELB7MTE.js} +5 -5
- package/dist/{chunk-7MYJUJZV.js → chunk-OMNB27GM.js} +4 -4
- package/dist/{chunk-GS5UG6QD.js → chunk-OO63YP35.js} +1 -1
- package/dist/{chunk-CEMXGMQN.js → chunk-OQUH7I5T.js} +3 -3
- package/dist/{chunk-Q7VPTN5X.js → chunk-OS7C2KMQ.js} +4 -4
- package/dist/{chunk-NRYERHEI.js → chunk-OTWIW2L3.js} +5 -5
- package/dist/chunk-OUNYHYJL.js +27 -0
- package/dist/{chunk-54HEIM2A.js → chunk-OUR5ZHCB.js} +2 -2
- package/dist/{chunk-Z257SH5U.js → chunk-OZA7HA6L.js} +1 -1
- package/dist/{chunk-WJQX7HBH.js → chunk-OZLKEBCD.js} +2 -2
- package/dist/{chunk-YGPLUENN.js → chunk-P3NMDPDP.js} +132 -83
- package/dist/{chunk-NINK4G7U.js → chunk-P5RCP4NK.js} +2 -2
- package/dist/{chunk-DYSEZVIJ.js → chunk-P6DEFCMQ.js} +2 -2
- package/dist/{chunk-J22ETKDJ.js → chunk-P7UOOMXE.js} +2 -2
- package/dist/chunk-PMT75APP.js +94 -0
- package/dist/{chunk-KLQKHA3T.js → chunk-PNYWBY4K.js} +5 -5
- package/dist/{chunk-XNV7VOIT.js → chunk-PVGJM2HP.js} +4 -4
- package/dist/{chunk-4U2WSW6F.js → chunk-Q2I3QLE3.js} +65 -36
- package/dist/{chunk-LGMV7ZV4.js → chunk-QATOOZMH.js} +5 -5
- package/dist/{chunk-H2POQ4LB.js → chunk-QFNWGSCT.js} +4 -4
- package/dist/{chunk-CIDOL4FO.js → chunk-QQMESIDA.js} +5 -5
- package/dist/{chunk-OTGNVAI4.js → chunk-R3VSWOTI.js} +4 -4
- package/dist/{chunk-UCIAHSJK.js → chunk-R5SGE2NS.js} +7 -3
- package/dist/{chunk-FX5VZK5F.js → chunk-RJICOOB3.js} +14 -8
- package/dist/{chunk-RMVCKO6N.js → chunk-RLH2CQCD.js} +458 -136
- package/dist/{chunk-VFLMBA2M.js → chunk-RPGEB3Z5.js} +19 -18
- package/dist/{chunk-KIXNHDXS.js → chunk-RQKDEJFQ.js} +5 -5
- package/dist/chunk-SBKM6XFS.js +211 -0
- package/dist/{chunk-TQ5HHNM3.js → chunk-SCAYWQZK.js} +2 -2
- package/dist/{chunk-Y5WHM2Q5.js → chunk-SH4FLUAD.js} +1 -1
- package/dist/{chunk-7EQU2TUN.js → chunk-SH4UGK5U.js} +84 -53
- package/dist/{chunk-EY4OA4OF.js → chunk-SHYS52VO.js} +370 -785
- package/dist/{chunk-ZSYU6LIH.js → chunk-SKPOXLG5.js} +5 -5
- package/dist/{chunk-OAT6FWKL.js → chunk-T7PRG6AO.js} +5 -5
- package/dist/chunk-TBZT5WUT.js +39 -0
- package/dist/{chunk-5HTGSB6Y.js → chunk-TKH655ON.js} +3 -3
- package/dist/{chunk-YO5UKKCQ.js → chunk-TMEUK2WS.js} +6 -2
- package/dist/{chunk-X5OVVMZX.js → chunk-TVOMGNFQ.js} +1 -1
- package/dist/{chunk-JARJP576.js → chunk-TX5FSNAU.js} +435 -29
- package/dist/{chunk-LUZ7HXBT.js → chunk-U52PNFPX.js} +1 -1
- package/dist/{chunk-OKM5LYYP.js → chunk-U6QZOMYC.js} +5 -5
- package/dist/{chunk-F4JAGDPD.js → chunk-UBYDY4B7.js} +8 -8
- package/dist/{chunk-V3UE3TB7.js → chunk-UCKUAKYQ.js} +2 -2
- package/dist/{chunk-NO7GRVUU.js → chunk-UOOXWGBU.js} +8 -8
- package/dist/{chunk-LFX5BERN.js → chunk-USMKNNOU.js} +47 -33
- package/dist/chunk-USSG6TJV.js +23 -0
- package/dist/{chunk-HFFKN7PA.js → chunk-UY34DDUM.js} +3 -3
- package/dist/{chunk-3LNVEE5Z.js → chunk-V7FV66KL.js} +1 -1
- package/dist/{chunk-62JZL6FW.js → chunk-V7JFT7NQ.js} +56 -42
- package/dist/{chunk-UP4JSNDR.js → chunk-V7NUJEJE.js} +1 -1
- package/dist/{chunk-FERP4WS3.js → chunk-VACZGW5R.js} +16 -18
- package/dist/{chunk-BO5EJBLH.js → chunk-VC62V7CX.js} +82 -47
- package/dist/{chunk-53OEKS4L.js → chunk-VESSIKBG.js} +6 -3
- package/dist/chunk-VJULLJLN.js +70 -0
- package/dist/{chunk-QLWUFEKR.js → chunk-VKNQOSGW.js} +8 -8
- package/dist/{chunk-BFDPY7JM.js → chunk-VTY6YHQZ.js} +11 -6
- package/dist/{chunk-UFZXZJJG.js → chunk-W2QILXAL.js} +5 -5
- package/dist/{chunk-QHPJ5ZKS.js → chunk-W6XSIBLR.js} +5 -5
- package/dist/{chunk-DJBMA4FW.js → chunk-WDJSDJLV.js} +4 -6
- package/dist/{chunk-JKOEHRGV.js → chunk-WDLWWEHZ.js} +1 -1
- package/dist/{chunk-IW3YUMPI.js → chunk-WFBN2HXR.js} +2 -2
- package/dist/chunk-WGJIYFVQ.js +24 -0
- package/dist/{chunk-43PCSBVQ.js → chunk-WKXLJNHW.js} +634 -8
- package/dist/{chunk-EWR6WVOV.js → chunk-WLH5IBFY.js} +6 -6
- package/dist/{chunk-RHVP62HI.js → chunk-WMQ57FOP.js} +5 -5
- package/dist/{chunk-GKQLKUMF.js → chunk-WNTUBGBB.js} +41 -32
- package/dist/{chunk-RHBQ2Q5H.js → chunk-WOICFLOJ.js} +60 -43
- package/dist/{chunk-QNLESRH6.js → chunk-WUP6C4ZD.js} +2 -2
- package/dist/chunk-WVCDISZP.js +89 -0
- package/dist/{chunk-CT4RFZO4.js → chunk-WW4KLAVO.js} +38 -23
- package/dist/{chunk-I5ZADE2U.js → chunk-X3QUASBR.js} +1 -1
- package/dist/{chunk-TXMS7QUJ.js → chunk-X46PSAJ7.js} +6 -6
- package/dist/{chunk-Z2BDTZDT.js → chunk-XC32OSCD.js} +97 -39
- package/dist/{chunk-M2OQK2FO.js → chunk-XD5XB22R.js} +2 -2
- package/dist/chunk-XLLWIHN2.js +24 -0
- package/dist/{chunk-SD6ENKTO.js → chunk-XMX4PCFL.js} +3 -3
- package/dist/{chunk-BM2A3IGQ.js → chunk-XO44IJGZ.js} +1 -1
- package/dist/{chunk-2HD5RY2U.js → chunk-XRRG4MBM.js} +3 -3
- package/dist/chunk-XSC4IXXC.js +24 -0
- package/dist/{chunk-D5RAVZ5C.js → chunk-XSEETONJ.js} +10 -9
- package/dist/{chunk-YBYV56FS.js → chunk-XZOFKLTD.js} +3 -3
- package/dist/{chunk-YNHPPZ7S.js → chunk-XZXZNI7A.js} +1 -1
- package/dist/{chunk-W7Q6PLT4.js → chunk-Y6E4JU3U.js} +37 -37
- package/dist/{chunk-XR7VOF2V.js → chunk-YGWPOYDE.js} +25 -13
- package/dist/{chunk-HDSHS2QZ.js → chunk-YJUBX3QF.js} +70 -47
- package/dist/{chunk-BDCKHLUB.js → chunk-YLRAAJYV.js} +72 -304
- package/dist/{chunk-I6QGYRY4.js → chunk-YW35KSXR.js} +2 -2
- package/dist/{chunk-GAFEN3H7.js → chunk-Z3WQXVFV.js} +2 -2
- package/dist/{chunk-WKWCNS6K.js → chunk-Z62TJQO5.js} +5 -5
- package/dist/{chunk-D3PQAVFW.js → chunk-Z6DUNKFU.js} +152 -29
- package/dist/{chunk-FF7MV4D4.js → chunk-Z6H5ED2I.js} +1 -1
- package/dist/{chunk-TWRFVW3J.js → chunk-ZB3JIL3L.js} +138 -89
- package/dist/{chunk-KUMJI5B6.js → chunk-ZBCCJPGW.js} +17 -14
- package/dist/{chunk-CV3NC75L.js → chunk-ZBOOMLHD.js} +1 -1
- package/dist/{chunk-QRZESG66.js → chunk-ZCHKIR7C.js} +64 -239
- package/dist/{chunk-ZDD3MJ2H.js → chunk-ZDJ7C64T.js} +1 -1
- package/dist/{chunk-KQ2WZ6BY.js → chunk-ZG4BMJRL.js} +1 -1
- package/dist/{chunk-QYOZ46ZQ.js → chunk-ZIVCPXXL.js} +467 -650
- package/dist/{chunk-V62B23VC.js → chunk-ZNRSYS76.js} +8 -2
- package/dist/{chunk-NIDH22DI.js → chunk-ZSYFQSPF.js} +12 -2
- package/dist/cli/index.js +8 -3
- package/dist/{core-5S5CJHBG.js → core-2GWH3ED7.js} +2 -1
- package/dist/{core-ZSERZGK6.js → core-3LCSHMKN.js} +3 -1
- package/dist/{core-FTQBESDS.js → core-3NQ5TXOJ.js} +3 -1
- package/dist/{core-D2OIGYC7.js → core-3XGQBHJI.js} +4 -1
- package/dist/{core-T3OSZOVV.js → core-4N6WH3IF.js} +3 -1
- package/dist/{core-VRVL6LIM.js → core-5CRTPVYA.js} +3 -1
- package/dist/{core-7XKNJM7Y.js → core-5K4HRIHX.js} +5 -1
- package/dist/{core-CCB3IXGD.js → core-743ZXTWK.js} +3 -1
- package/dist/{core-4M4RY7MX.js → core-7OAGK7ZJ.js} +3 -1
- package/dist/{core-VT35VDVS.js → core-7YDNMUU3.js} +6 -1
- package/dist/{core-4PW4MXWR.js → core-AAPPZSSZ.js} +4 -1
- package/dist/{core-OBPTBKX6.js → core-AC5AKSCM.js} +2 -1
- package/dist/{core-QFAVWFI3.js → core-AEALAFRA.js} +2 -1
- package/dist/{core-WXZJ7V7S.js → core-BEK6EPVF.js} +4 -1
- package/dist/{core-WP73P4CW.js → core-BRBJ3LPF.js} +5 -1
- package/dist/{core-AVA4XLQ2.js → core-EGTJOQK7.js} +2 -1
- package/dist/{core-XKXDXALI.js → core-FE4THVV3.js} +6 -1
- package/dist/{core-MAW4S3KA.js → core-FEBNVNVE.js} +5 -1
- package/dist/{core-L3UR75IJ.js → core-HIONDJGC.js} +4 -1
- package/dist/{core-GS4DXDDG.js → core-HMBMMF5Z.js} +4 -1
- package/dist/{core-QM34237W.js → core-LSYX4UQQ.js} +2 -1
- package/dist/{core-N2JEWJ7D.js → core-MIERUUUT.js} +2 -1
- package/dist/{core-A7HXVSKB.js → core-NTOOJZRA.js} +2 -1
- package/dist/{core-JDZDBTID.js → core-O5S2NETE.js} +2 -1
- package/dist/{core-OFPPRHYY.js → core-Q2Y3JEWL.js} +3 -1
- package/dist/{core-BJZEJ63L.js → core-RTBPKALG.js} +3 -1
- package/dist/{core-WNT6ZMRO.js → core-T7CKLMT2.js} +2 -1
- package/dist/{core-VWYXK2R3.js → core-TIIPSEK3.js} +4 -1
- package/dist/{core-EMSJRGSE.js → core-VBMWBPKM.js} +2 -1
- package/dist/{core-WPEYRK6Y.js → core-VLXOQ5CK.js} +4 -1
- package/dist/{core-7TTM4KRP.js → core-VYHQ5JY6.js} +3 -1
- package/dist/{core-DMDAXVMY.js → core-XJZWD43V.js} +2 -1
- package/dist/{core-AMWCZTOT.js → core-XUNZB6BM.js} +5 -1
- package/dist/{core-UNX4ZV4M.js → core-YKDDPMWW.js} +5 -1
- package/dist/{core-SKMHEA4Y.js → core-YN2VVGUL.js} +3 -1
- package/dist/{core-ZACFV6XR.js → core-YP4MNIMV.js} +5 -1
- package/dist/{core-FCSA74RT.js → core-ZETBHLSV.js} +3 -1
- package/dist/{dataTable-7IO546LM.js → dataTable-FEQZSDUZ.js} +7 -2
- package/dist/{engine-US3N6UCH.js → engine-SCQVNSAM.js} +23 -18
- package/dist/fixtures.js +2 -1
- package/dist/flags-BVLSAXT3.js +10 -0
- package/dist/{fontTables-ZPZQ6IR3.js → fontTables-JUW7ZTQY.js} +3 -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 +27 -20
- package/dist/{main-2UWKGUHR.js → main-7UKLXCIL.js} +50 -119
- package/dist/mcp/server.js +121 -118
- package/dist/react/bar.js +5 -1
- package/dist/react/bartable.js +3 -1
- package/dist/react/box.js +3 -1
- package/dist/react/bullet.js +4 -1
- package/dist/react/butterfly.js +5 -1
- package/dist/react/choropleth.js +3 -1
- package/dist/react/cohort.js +3 -1
- package/dist/react/column.js +5 -1
- package/dist/react/combo.js +5 -1
- package/dist/react/creative.js +4 -1
- package/dist/react/diagram.js +3 -1
- package/dist/react/dimswitch.js +6 -1
- package/dist/react/dot.js +4 -1
- package/dist/react/export.js +29 -18
- package/dist/react/funnel.js +4 -1
- package/dist/react/gantt.js +3 -1
- package/dist/react/grid.js +6 -1
- package/dist/react/heatmap.js +3 -1
- package/dist/react/histogram.js +6 -1
- package/dist/react/index.js +92 -85
- package/dist/react/kpi.js +4 -1
- package/dist/react/likert.js +6 -1
- package/dist/react/line.js +4 -1
- package/dist/react/mekko.js +5 -1
- package/dist/react/pareto.js +6 -1
- package/dist/react/pie.js +4 -1
- package/dist/react/prepare.js +35 -22
- package/dist/react/pvm.js +6 -1
- package/dist/react/pyramid.js +5 -1
- package/dist/react/sankey.js +3 -1
- package/dist/react/scatter.js +3 -1
- package/dist/react/slope.js +4 -1
- package/dist/react/sparkline.js +4 -1
- package/dist/react/spec.js +17 -13
- package/dist/react/status.js +3 -1
- package/dist/react/story.js +3 -2
- package/dist/react/table.js +4 -1
- package/dist/react/theme.js +5 -3
- package/dist/react/tilemap.js +3 -1
- package/dist/react/treemap.js +3 -1
- package/dist/react/variance.js +5 -1
- package/dist/react/waffle.js +3 -1
- package/dist/react/waterfall.js +5 -1
- package/dist/{resvg-VB7S5HRF.js → resvg-ZYEZTSUO.js} +3 -1
- package/dist/rows.js +2 -2
- package/dist/{rowsModule-DYDVHBAX.js → rowsModule-WJH4QNXZ.js} +1 -1
- package/dist/{schema-YDZCGL56.js → schema-2R32F6AW.js} +1 -3
- package/dist/{schema-A2XUZUCV.js → schema-2TPGJGVR.js} +1 -3
- package/dist/{schema-MD22QYZU.js → schema-47BG2TZA.js} +1 -3
- package/dist/{schema-HEB6ZDI5.js → schema-56MOEOVR.js} +1 -3
- package/dist/{schema-K4V4PYBO.js → schema-5MSR4LNN.js} +1 -3
- package/dist/{schema-NOBNFD2F.js → schema-5RIYEWE6.js} +1 -3
- package/dist/{schema-OXO2XY4Y.js → schema-ALBF6V7Y.js} +1 -3
- package/dist/{schema-F2Q6MH7W.js → schema-BA6WP5YZ.js} +1 -3
- package/dist/{schema-G5KSSI5W.js → schema-CBL2SMVR.js} +1 -3
- package/dist/{schema-WFGDVBJK.js → schema-CWKGLDSR.js} +1 -3
- package/dist/{schema-DHMMGDTI.js → schema-DBIQFL56.js} +1 -3
- package/dist/{schema-626QXX4G.js → schema-DL7V6NN2.js} +1 -3
- package/dist/{schema-FC6J6KZC.js → schema-DUVJMFKQ.js} +1 -3
- package/dist/{schema-LGLQBRC4.js → schema-ECJERHKF.js} +1 -2
- package/dist/{schema-4JRNXEZF.js → schema-EDSEKZDJ.js} +1 -3
- package/dist/{schema-I44IDRGD.js → schema-ESR6ZIK4.js} +1 -3
- package/dist/{schema-FSYDLMGD.js → schema-F7TWGLRZ.js} +1 -3
- package/dist/{schema-JCU6LTYD.js → schema-FGB6IGZM.js} +1 -3
- package/dist/{schema-MGETMQYC.js → schema-FKGGTM4Z.js} +1 -2
- package/dist/{schema-XIHAKX3B.js → schema-JIAQE7WO.js} +1 -1
- package/dist/{schema-6V5K3J2V.js → schema-JYZ4RF6S.js} +1 -3
- package/dist/{schema-GXOG4MXL.js → schema-K7F6TEDK.js} +1 -2
- package/dist/{schema-NMIYKGHE.js → schema-KAK6DZX4.js} +1 -3
- package/dist/{schema-PHIHMDVB.js → schema-KCJ6WTGV.js} +1 -3
- package/dist/{schema-XRSORYBI.js → schema-MOKWIGF7.js} +1 -3
- package/dist/{schema-3KMU5737.js → schema-MQT6BMNK.js} +1 -3
- package/dist/{schema-JJWORI7D.js → schema-MR3BPPQR.js} +1 -3
- package/dist/{schema-IFTIMTS3.js → schema-OPXZYIW7.js} +1 -3
- package/dist/{schema-UXWKA3PI.js → schema-PV7JGX5H.js} +1 -3
- package/dist/{schema-CNJ4Y6CT.js → schema-PWPQF5RC.js} +1 -3
- package/dist/{schema-WBOPCTPC.js → schema-PYQEUC5P.js} +1 -3
- package/dist/{schema-J4HCSD5C.js → schema-Q5DACE4I.js} +6 -2
- package/dist/{schema-IUY7VYHJ.js → schema-R42VXFIS.js} +1 -3
- package/dist/{schema-WX2RS4OU.js → schema-TVUJNEX7.js} +1 -3
- package/dist/{schema-6PL46VXZ.js → schema-WZOSDDDJ.js} +1 -3
- package/dist/{schema-FGE5YK3S.js → schema-Y4TI2T3T.js} +1 -3
- package/dist/{schema-MQB6CE5V.js → schema-ZU2EU2VP.js} +1 -3
- package/dist/{specValidation-XGELWQUU.js → specValidation-DC4TVHWD.js} +3 -1
- package/dist/theme.js +4 -3
- 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/column/model.d.ts +13 -0
- package/dist/types/core/charts/combo/layout.d.ts +7 -0
- package/dist/types/core/charts/gantt/calendar.d.ts +4 -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/pareto/layout.d.ts +2 -0
- package/dist/types/core/charts/pvm/types.d.ts +1 -0
- 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/table/resolve.d.ts +8 -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/diagnostics/describe.d.ts +6 -1
- package/dist/types/core/doc/diagnostics.d.ts +3 -2
- package/dist/types/core/formatSpec.d.ts +33 -14
- package/dist/types/core/frame.d.ts +25 -58
- package/dist/types/core/frameText.d.ts +203 -0
- package/dist/types/core/geometry.d.ts +2 -0
- 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 +12 -2
- package/dist/types/core/notes.d.ts +15 -2
- package/dist/types/core/reading.d.ts +12 -1
- package/dist/types/core/request.d.ts +1 -1
- package/dist/types/core/schema/capability.d.ts +12 -0
- package/dist/types/core/seriesIdentity.d.ts +4 -1
- package/dist/types/core/sizing.d.ts +37 -1
- package/dist/types/core/structureCounts.d.ts +3 -1
- package/dist/types/core/theme.d.ts +33 -4
- package/dist/types/core/themeRules.d.ts +2 -0
- package/dist/types/core/types/annotations.d.ts +74 -4
- package/dist/types/core/types/options.d.ts +35 -3
- package/dist/types/core/types/scene.d.ts +30 -2
- package/dist/types/core/types/table.d.ts +6 -0
- package/dist/types/core/types/theme.d.ts +23 -0
- package/dist/types/react/TableChart.d.ts +5 -0
- package/dist/validate.js +13 -6
- package/docs/TELEMETRY.md +2 -2
- package/docs/manual.md +252 -62
- package/docs/reference/bar.md +12 -4
- package/docs/reference/bartable.md +2 -2
- package/docs/reference/box.md +8 -4
- package/docs/reference/bullet.md +9 -5
- package/docs/reference/butterfly.md +10 -5
- package/docs/reference/choropleth.md +3 -5
- package/docs/reference/cohort.md +1 -1
- package/docs/reference/column.md +18 -4
- package/docs/reference/combo.md +10 -5
- package/docs/reference/creative.md +3 -7
- package/docs/reference/diagram.md +1 -1
- package/docs/reference/dimswitch.md +23 -88
- package/docs/reference/dot.md +9 -5
- package/docs/reference/fixtures.md +37 -1
- package/docs/reference/funnel.md +9 -5
- package/docs/reference/gantt.md +8 -15
- package/docs/reference/grid.md +5 -2
- package/docs/reference/heatmap.md +10 -6
- package/docs/reference/kpi.md +1 -1
- package/docs/reference/likert.md +9 -4
- package/docs/reference/line.md +18 -5
- package/docs/reference/mekko.md +10 -5
- package/docs/reference/options.md +17 -13
- package/docs/reference/pareto.md +8 -4
- package/docs/reference/pie.md +9 -5
- package/docs/reference/pvm.md +9 -5
- package/docs/reference/pyramid.md +8 -4
- package/docs/reference/react.md +5 -5
- package/docs/reference/sankey.md +2 -2
- package/docs/reference/scatter.md +8 -4
- package/docs/reference/slope.md +9 -5
- package/docs/reference/sparkline.md +1 -1
- package/docs/reference/status.md +1 -1
- package/docs/reference/table.md +33 -114
- 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 +16 -4
- package/docs/use-cases.md +25 -13
- package/llms.txt +19 -6
- package/package.json +18 -3
- package/dist/chunk-5RHP7YTL.js +0 -24
- package/dist/chunk-6VU2XI3W.js +0 -89
- package/dist/chunk-6WJOHZPW.js +0 -26
- package/dist/chunk-FL3FQ2YA.js +0 -27
- package/dist/chunk-G5CELEUR.js +0 -26
- package/dist/chunk-M4SPKUZE.js +0 -7
- package/dist/chunk-OF7FMGH5.js +0 -24
- package/dist/chunk-S2TSXUYP.js +0 -24
- package/dist/chunk-TKERVBJ3.js +0 -23
- package/dist/chunk-VMGTNB6H.js +0 -25
- package/dist/chunk-WZL4EEBS.js +0 -11
- package/dist/chunk-YJGFT63R.js +0 -27
- package/dist/chunk-ZNX5J7D7.js +0 -47
|
@@ -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,77 +6,41 @@ 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
|
-
frameFillAmounts,
|
|
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-HVX2E26J.js";
|
|
48
|
-
import {
|
|
49
|
-
toneTextPaint
|
|
50
|
-
} from "./chunk-UD6U4EF5.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
23
|
import {
|
|
62
24
|
closestKey
|
|
63
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-ZNRSYS76.js";
|
|
64
26
|
import {
|
|
65
27
|
caseInsensitiveValue,
|
|
66
|
-
chartSizing,
|
|
67
28
|
copyPlannedValue,
|
|
68
|
-
fitsSize,
|
|
69
29
|
inputConversion,
|
|
70
30
|
memoExactInputKey,
|
|
71
|
-
ownPlanInput
|
|
72
|
-
|
|
73
|
-
} from "./chunk-AFGQXMKT.js";
|
|
31
|
+
ownPlanInput
|
|
32
|
+
} from "./chunk-GNMB72V7.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-4OJF6DXL.js";
|
|
84
40
|
import {
|
|
85
41
|
disclosureNote,
|
|
86
|
-
disclosuresShown
|
|
87
|
-
|
|
88
|
-
} from "./chunk-WZB6R2ZX.js";
|
|
42
|
+
disclosuresShown
|
|
43
|
+
} from "./chunk-DZYTXZNS.js";
|
|
89
44
|
import {
|
|
90
45
|
emptyIdRecord
|
|
91
46
|
} from "./chunk-LINZPU5D.js";
|
|
@@ -106,12 +61,14 @@ import {
|
|
|
106
61
|
roundedNumber,
|
|
107
62
|
sameUnit,
|
|
108
63
|
specUnitKind,
|
|
64
|
+
unitMagnitude,
|
|
109
65
|
unitOfSpec,
|
|
110
66
|
withChartMarks
|
|
111
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-Z6DUNKFU.js";
|
|
112
68
|
import {
|
|
113
69
|
MINUS,
|
|
114
70
|
chartNumberMarks,
|
|
71
|
+
chartString,
|
|
115
72
|
currencyWholeNumbers,
|
|
116
73
|
currentSmallValues,
|
|
117
74
|
formatExactNumber,
|
|
@@ -123,7 +80,9 @@ import {
|
|
|
123
80
|
zeroLifts
|
|
124
81
|
} from "./chunk-MSYTF3DZ.js";
|
|
125
82
|
import {
|
|
126
|
-
|
|
83
|
+
clamp,
|
|
84
|
+
cleanDiff,
|
|
85
|
+
cleanSum,
|
|
127
86
|
contrastInkPaint,
|
|
128
87
|
groundTextPaint,
|
|
129
88
|
markRolePaint,
|
|
@@ -135,28 +94,37 @@ import {
|
|
|
135
94
|
sequentialShare,
|
|
136
95
|
signedFillPaint,
|
|
137
96
|
tableEmphasis,
|
|
138
|
-
tableHeadFloorPx
|
|
139
|
-
|
|
140
|
-
} from "./chunk-JARJP576.js";
|
|
97
|
+
tableHeadFloorPx
|
|
98
|
+
} from "./chunk-TX5FSNAU.js";
|
|
141
99
|
import {
|
|
142
100
|
DEFAULT_TARGET,
|
|
143
101
|
NormalizeError,
|
|
144
|
-
TARGET_SIZE,
|
|
145
|
-
resolveCanvasOptions,
|
|
146
102
|
resolveHighlight,
|
|
147
|
-
resolveSize,
|
|
148
103
|
resolveSubtitle,
|
|
149
104
|
scaleTextPx,
|
|
150
105
|
targetFloorsPx
|
|
151
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-RJICOOB3.js";
|
|
152
107
|
import {
|
|
153
108
|
maxOf,
|
|
154
109
|
minOf,
|
|
155
110
|
pushAll
|
|
156
111
|
} from "./chunk-WYJEOMNY.js";
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
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
|
+
}
|
|
160
128
|
|
|
161
129
|
// src/core/charts/table/ladder.ts
|
|
162
130
|
var COHORT_GRID = {
|
|
@@ -270,7 +238,9 @@ function assertTableRankOptions(options) {
|
|
|
270
238
|
"table-sort-segments-unsupported",
|
|
271
239
|
"options.sort.segments",
|
|
272
240
|
`table has no segments; sort.segments '${segments}' cannot reorder columns without breaking groups and accounting`,
|
|
273
|
-
"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"]
|
|
274
244
|
);
|
|
275
245
|
}
|
|
276
246
|
function ranksAsData(row) {
|
|
@@ -285,13 +255,15 @@ function additiveRankKey(row, columns) {
|
|
|
285
255
|
}
|
|
286
256
|
return counted ? sum : null;
|
|
287
257
|
}
|
|
288
|
-
function requireAdditiveRanking(columns, rows, path, action) {
|
|
258
|
+
function requireAdditiveRanking(columns, rows, path, action, segments) {
|
|
289
259
|
if (!rows.some((row) => ranksAsData(row) && additiveRankKey(row, columns) !== null))
|
|
290
260
|
throw new NormalizeError(
|
|
291
261
|
"table-rank-unranked",
|
|
292
262
|
path,
|
|
293
263
|
`${action} needs at least one additive value column with a numeric cell; text, status and non-aggregating columns are not ranking keys`,
|
|
294
|
-
"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
|
|
295
267
|
);
|
|
296
268
|
}
|
|
297
269
|
function authoredById(rows) {
|
|
@@ -333,16 +305,8 @@ function foldSiblings(parentId, groups, original, table, topN, used, generatedOt
|
|
|
333
305
|
let rebuilt = (groups.get(parentId) ?? []).map(
|
|
334
306
|
(row) => toAuthored(row, original.get(row.id), foldSiblings(row.id, groups, original, table, topN, used, generatedOthers))
|
|
335
307
|
), dataIdx = rebuilt.map((_, index) => index).filter((index) => ranksAsData(original.get(rebuilt[index].id)));
|
|
336
|
-
if (dataIdx.length <= topN.n) return rebuilt;
|
|
337
|
-
let dataRows = dataIdx.map((index) => rebuilt[index])
|
|
338
|
-
if (dataRows.some((row) => (original.get(row.id)?.relation ?? "additive") !== "additive"))
|
|
339
|
-
throw new NormalizeError(
|
|
340
|
-
"table-topn-relation-unsupported",
|
|
341
|
-
"options.topN",
|
|
342
|
-
"topN cannot regroup ofWhich or displayOnly rows; nesting them under Others would change whose total they annotate",
|
|
343
|
-
"keep those rows as authored siblings, or drop options.topN"
|
|
344
|
-
);
|
|
345
|
-
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) => {
|
|
346
310
|
let resolved = table.rows.find((candidate) => candidate.id === row.id);
|
|
347
311
|
return Math.abs(additiveRankKey(resolved, table.columns) ?? 0);
|
|
348
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)));
|
|
@@ -353,13 +317,24 @@ function foldSiblings(parentId, groups, original, table, topN, used, generatedOt
|
|
|
353
317
|
}
|
|
354
318
|
let dropped = dataRows.filter((_, index) => !keep.has(index));
|
|
355
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
|
+
);
|
|
356
329
|
if (topN.rest === !1) {
|
|
357
330
|
if (parentId !== void 0)
|
|
358
331
|
throw new NormalizeError(
|
|
359
332
|
"table-topn-rest-required",
|
|
360
333
|
"options.topN.rest",
|
|
361
334
|
"topN.rest false would drop sibling summands and change the parent total; tables keep accounting by nesting the rest under Others",
|
|
362
|
-
"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"]
|
|
363
338
|
);
|
|
364
339
|
let keptIds2 = new Set(dataRows.filter((_, index) => keep.has(index)).map((row) => row.id));
|
|
365
340
|
return rebuilt.filter((row, index) => dataIdx.includes(index) ? keptIds2.has(row.id) : !0);
|
|
@@ -377,70 +352,20 @@ function foldSiblings(parentId, groups, original, table, topN, used, generatedOt
|
|
|
377
352
|
function foldTableTopN(data, ranked, options) {
|
|
378
353
|
let topN = options.topN, generatedOthers = /* @__PURE__ */ new Set();
|
|
379
354
|
if (!topN || topN.n <= 0) return { data, generatedOthers };
|
|
380
|
-
requireAdditiveRanking(ranked.columns, ranked.rows, "options.topN", "topN");
|
|
355
|
+
requireAdditiveRanking(ranked.columns, ranked.rows, "options.topN", "topN", ["options", "topN"]);
|
|
381
356
|
let original = authoredById(data.rows), folded = foldSiblings(
|
|
382
357
|
void 0,
|
|
383
358
|
siblingGroups(ranked),
|
|
384
359
|
original,
|
|
385
360
|
ranked,
|
|
386
|
-
|
|
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 },
|
|
387
363
|
usedIds(data.rows),
|
|
388
364
|
generatedOthers
|
|
389
365
|
);
|
|
390
366
|
return { data: { ...data, rows: folded }, generatedOthers };
|
|
391
367
|
}
|
|
392
368
|
|
|
393
|
-
// src/core/charts/table/encodings/arrow.ts
|
|
394
|
-
var ARROW_GAP = 4, printedNumber = (cell) => cell.negated ? -cell.raw : cell.raw;
|
|
395
|
-
function arrowGlyph(value, maxAbs, scale) {
|
|
396
|
-
let share = scale === "absolute" ? value / 100 : maxAbs > 0 ? value / maxAbs : 0;
|
|
397
|
-
return share > 0.1 ? "\u2191" : share > 0.02 ? "\u2197" : share >= -0.02 ? "\u2192" : share >= -0.1 ? "\u2198" : "\u2193";
|
|
398
|
-
}
|
|
399
|
-
var ARROW_KEY = [
|
|
400
|
-
["\u2191", "rise over 10%", "rise over 10% of the largest change"],
|
|
401
|
-
["\u2197", "rise over 2%, up to 10%", "rise over 2%, up to 10% of the largest change"],
|
|
402
|
-
["\u2192", "within 2%", "within 2% of the largest change"],
|
|
403
|
-
["\u2198", "fall over 2%, up to 10%", "fall over 2%, up to 10% of the largest change"],
|
|
404
|
-
["\u2193", "fall over 10%", "fall over 10% of the largest change"]
|
|
405
|
-
], ARROW_FOOTNOTE = "An arrow's angle on a relative scale compares the change with the largest change in its column.";
|
|
406
|
-
function arrowKey(columns, rows) {
|
|
407
|
-
let drawn = { absolute: /* @__PURE__ */ new Set(), relative: /* @__PURE__ */ new Set() };
|
|
408
|
-
for (let column of columns) {
|
|
409
|
-
if (column.cellEncoding?.type !== "arrow" || column.kind !== "computed" || !column.polarity) continue;
|
|
410
|
-
let scale = column.cellEncoding.scale, values = rows.flatMap((row) => {
|
|
411
|
-
let cell = row.cells[column.id];
|
|
412
|
-
return cell?.state === "value" && typeof cell.raw == "number" ? [printedNumber(cell)] : [];
|
|
413
|
-
}), maxAbs = Math.max(0, maxOf(values.map(Math.abs)));
|
|
414
|
-
for (let value of values) drawn[scale].add(arrowGlyph(value, maxAbs, scale));
|
|
415
|
-
}
|
|
416
|
-
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 })));
|
|
417
|
-
}
|
|
418
|
-
function emitArrow(context, metrics) {
|
|
419
|
-
if (context.cell.state !== "value" || typeof context.cell.raw != "number") return [];
|
|
420
|
-
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;
|
|
421
|
-
if (available <= 0) return [];
|
|
422
|
-
if (glyphWidth > available) {
|
|
423
|
-
let floor = Math.min(font.size, readerFloorPx(metrics.target ?? DEFAULT_TARGET, "label", metrics.textScale));
|
|
424
|
-
if (font = { ...font, size: Math.max(floor, font.size * available / glyphWidth) }, glyphWidth = context.measure(glyph, font).width, glyphWidth > available) return [];
|
|
425
|
-
}
|
|
426
|
-
return [
|
|
427
|
-
{
|
|
428
|
-
t: "text",
|
|
429
|
-
typeRole: "label",
|
|
430
|
-
id: context.nodeId("arrow"),
|
|
431
|
-
x: valueLeft - ARROW_GAP - glyphWidth,
|
|
432
|
-
y: context.box.y + (context.box.h - context.measure(glyph, font).height) / 2,
|
|
433
|
-
lines: [glyph],
|
|
434
|
-
align: "start",
|
|
435
|
-
font,
|
|
436
|
-
// The glyph prints in its figure's text colour, as the grid's arrow inherits it.
|
|
437
|
-
ink: context.cell.tone === "neutral" ? { token: "neutral" } : context.toneInk ?? toneTextPaint(context.theme, context.cell.tone, context.palette),
|
|
438
|
-
owner: context.owner,
|
|
439
|
-
part: "tableArrow"
|
|
440
|
-
}
|
|
441
|
-
];
|
|
442
|
-
}
|
|
443
|
-
|
|
444
369
|
// src/core/charts/table/encodings/heat.ts
|
|
445
370
|
function heatRanges(columns, rows) {
|
|
446
371
|
let ranges = /* @__PURE__ */ new Map();
|
|
@@ -515,7 +440,7 @@ function heatKey(columns, ranges, theme, strings, language) {
|
|
|
515
440
|
for (let column of columns) {
|
|
516
441
|
let encoding = column.cellEncoding;
|
|
517
442
|
if (encoding?.type !== "heat") continue;
|
|
518
|
-
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);
|
|
519
444
|
if (entries.length === 0) continue;
|
|
520
445
|
let format = column.format === void 0 ? void 0 : parseFormatExample(column.format), identity = JSON.stringify(encoding.scale === "status" ? entries : [
|
|
521
446
|
encoding.scale,
|
|
@@ -534,19 +459,19 @@ function heatKey(columns, ranges, theme, strings, language) {
|
|
|
534
459
|
function laneHeatKey(columns, ranges, theme, strings, language) {
|
|
535
460
|
for (let column of columns) {
|
|
536
461
|
let encoding = column.cellEncoding;
|
|
537
|
-
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);
|
|
538
463
|
if (encoding?.type !== "heat" || encoding.scale !== "absolute" && encoding.scale !== "diverging") continue;
|
|
539
464
|
let diverging = encoding.scale === "diverging";
|
|
540
465
|
if (diverging && encoding.bins === void 0 && (encoding.steps ?? 0) < 2) continue;
|
|
541
466
|
let edges = encoding.bins ?? (diverging ? DIVERGING_BINS : []);
|
|
542
467
|
if (edges.length === 0) continue;
|
|
543
|
-
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 });
|
|
544
469
|
if (diverging) {
|
|
545
470
|
let sides = edges.map((_, index) => ({ index: index + 1, label: band(index + 1, index === edges.length - 1) }));
|
|
546
471
|
return [
|
|
547
|
-
...[...sides].reverse().map(({ index, label }) => swatch(`below${index}`,
|
|
548
|
-
swatch("none",
|
|
549
|
-
...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))
|
|
550
475
|
];
|
|
551
476
|
}
|
|
552
477
|
let count = Math.min(steps, edges.length + 1);
|
|
@@ -571,15 +496,15 @@ function statusLanes(columns) {
|
|
|
571
496
|
function centreNoun(range) {
|
|
572
497
|
return range?.totalCentre === !0 ? "total" : "average";
|
|
573
498
|
}
|
|
574
|
-
function statusKey(columns, ranges, encoding, strings) {
|
|
575
|
-
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) });
|
|
576
501
|
return [
|
|
577
|
-
swatch("below", strings?.heatBelow ??
|
|
578
|
-
swatch("around", strings?.heatAround ??
|
|
579
|
-
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")
|
|
580
505
|
];
|
|
581
506
|
}
|
|
582
|
-
function statusDirectionNote(columns, ranges, colorblindSafe = !1) {
|
|
507
|
+
function statusDirectionNote(columns, ranges, colorblindSafe = !1, language) {
|
|
583
508
|
let lanes = statusLanes(columns), lower = lanes.filter((column) => column.polarity === "lowerIsBetter");
|
|
584
509
|
if (lower.length === 0 || lower.length === lanes.length) return;
|
|
585
510
|
let byNoun = /* @__PURE__ */ new Map();
|
|
@@ -587,8 +512,8 @@ function statusDirectionNote(columns, ranges, colorblindSafe = !1) {
|
|
|
587
512
|
let noun = centreNoun(ranges.get(column.id));
|
|
588
513
|
byNoun.set(noun, [...byNoun.get(noun) ?? [], column.label]);
|
|
589
514
|
}
|
|
590
|
-
let where = byNoun.size === 1 ?
|
|
591
|
-
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 });
|
|
592
517
|
}
|
|
593
518
|
function heatPaint(context, range, options = {}) {
|
|
594
519
|
let value = context.cell.raw, alpha = options.alpha ?? DEFAULT_ALPHA, excludeTotals = options.excludeTotals ?? !0;
|
|
@@ -658,7 +583,7 @@ function stateGlyphs(theme, notApplicable = STATE_GLYPHS.na) {
|
|
|
658
583
|
open: STATE_GLYPHS.open
|
|
659
584
|
};
|
|
660
585
|
}
|
|
661
|
-
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 = {
|
|
662
587
|
missing: "missing",
|
|
663
588
|
na: "not applicable (n/a)",
|
|
664
589
|
nm: "not meaningful (n.m.)",
|
|
@@ -875,14 +800,14 @@ function compileTableData(data, options, magnitudeSource) {
|
|
|
875
800
|
}
|
|
876
801
|
});
|
|
877
802
|
}
|
|
878
|
-
let records = [], autoFootnotes = /* @__PURE__ */ new Set(), partialColumnIds = /* @__PURE__ */ new Set(), headMarksPartial = disclosuresShown(options) && options.columnHeads !== !1, highlightedRows = new Set(resolveHighlight(options.highlight));
|
|
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));
|
|
879
804
|
assertTableRankOptions(options);
|
|
880
805
|
let folded = applyTableTopN(data, options);
|
|
881
806
|
data = folded.data;
|
|
882
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();
|
|
883
808
|
for (let c of columns) {
|
|
884
809
|
if (colById.has(c.id))
|
|
885
|
-
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"]);
|
|
886
811
|
colById.set(c.id, c);
|
|
887
812
|
}
|
|
888
813
|
let rowLabelCols = columns.filter((c) => c.kind === "rowLabel");
|
|
@@ -890,7 +815,10 @@ function compileTableData(data, options, magnitudeSource) {
|
|
|
890
815
|
throw new NormalizeError(
|
|
891
816
|
"row-label-count",
|
|
892
817
|
"columns",
|
|
893
|
-
`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"]
|
|
894
822
|
);
|
|
895
823
|
validateGroups(data, colById), validateCalcRefs(columns, colById);
|
|
896
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));
|
|
@@ -1028,13 +956,14 @@ function compileTableData(data, options, magnitudeSource) {
|
|
|
1028
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')`
|
|
1029
957
|
}), derived = { raw: null, state: inherited };
|
|
1030
958
|
} else
|
|
1031
|
-
blockers.length > 0 && (options.columnHeads !== !1 && 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]) } : {} };
|
|
1032
960
|
let policy = row.totalPolicy ?? (authored.raw !== null ? "validate" : "derive");
|
|
1033
961
|
return policy === "source" ? authored.raw === null ? derived : { raw: authored.raw, state: "value" } : policy === "validate" && authored.raw !== null ? (noSummands ? unauditedRecord() : records.push({
|
|
1034
962
|
rowId: row.id,
|
|
1035
963
|
colId: col.id,
|
|
1036
964
|
op: "sum",
|
|
1037
|
-
|
|
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,
|
|
1038
967
|
raw: derived.raw,
|
|
1039
968
|
state: derived.state,
|
|
1040
969
|
displayed: "",
|
|
@@ -1077,7 +1006,7 @@ function compileTableData(data, options, magnitudeSource) {
|
|
|
1077
1006
|
}, computedCols = columns.filter((c) => c.kind === "computed"), calcNotes = evaluateTableCalcs(flat, valueCols, computedCols, rawState, records, leafTotal, data.columnGroups ?? [], colById, noPrevious, (id) => {
|
|
1078
1007
|
let row = flatById.get(id);
|
|
1079
1008
|
return row ? signTo(row, null) : folded.hidden.get(id)?.sign ?? 1;
|
|
1080
|
-
});
|
|
1009
|
+
}, source.rows);
|
|
1081
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);
|
|
1082
1011
|
for (let { scope, rowId, colId, cells } of calcNotes.negativeBase) {
|
|
1083
1012
|
let more = cells > 1 ? ` and ${cells - 1} more` : "";
|
|
@@ -1120,12 +1049,12 @@ function compileTableData(data, options, magnitudeSource) {
|
|
|
1120
1049
|
function formatTable(options2) {
|
|
1121
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)]));
|
|
1122
1051
|
partitionLeafIds.set(rawState2, partitionLeafIds.get(rawCells));
|
|
1123
|
-
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(), localeDerivedColumns = /* @__PURE__ */ new Set();
|
|
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();
|
|
1124
1053
|
for (let col of [...valueCols, ...computedCols]) {
|
|
1125
1054
|
let inherited = col.kind === "computed" && !calcPreservesScale(col.calc) ? void 0 : options2.format, authoredExample = col.format ?? inherited, example = authoredExample ?? defaultExample(col);
|
|
1126
1055
|
authoredExample === void 0 && localeDerivedColumns.add(col.id), formatExamples.set(col.id, example);
|
|
1127
1056
|
let spec = parseFormatExample2(example), sourceExample = sourceColumns.get(col.id)?.format ?? inherited;
|
|
1128
|
-
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), sourceExample !== void 0 && holdAuthoredScale(spec, locale.thousands), specs.set(col.id, spec);
|
|
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);
|
|
1129
1058
|
}
|
|
1130
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) => {
|
|
1131
1060
|
let spec = parseFormatExample2(example);
|
|
@@ -1149,12 +1078,29 @@ function compileTableData(data, options, magnitudeSource) {
|
|
|
1149
1078
|
column === void 0 ? columns2.set(colId, [value]) : column.push(value);
|
|
1150
1079
|
}
|
|
1151
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();
|
|
1152
1098
|
let groupCellSpecs = /* @__PURE__ */ new Map();
|
|
1153
1099
|
for (let row of flat) {
|
|
1154
1100
|
rowById.set(row.id, row);
|
|
1155
|
-
let example = row.format ?? (row.scale ? row.scale === "percent" ? "1.2%" : "1,234" : void 0) ?? (row.calc && calcYieldsPoints(row.calc) ? `1${locale.decimal}2%` : void 0);
|
|
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);
|
|
1156
1102
|
if (example) {
|
|
1157
|
-
let spec = authoredSpec(example, sourceRows.get(row.id)?.format ?? example), authoredRow = sourceRows.get(row.id);
|
|
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);
|
|
1158
1104
|
authoredRow?.format !== void 0 && authoredRow[AUTOMATIC_FORMAT] !== !0 && holdAuthoredScale(spec, locale.thousands);
|
|
1159
1105
|
let group = groupOf(row), rowScale = row.scale === "money" || row.scale === "perUnit";
|
|
1160
1106
|
if (rowScale || specUnitKind(spec) === "number") {
|
|
@@ -1168,13 +1114,10 @@ function compileTableData(data, options, magnitudeSource) {
|
|
|
1168
1114
|
for (; value !== 0 && spec.decimals < 20 && Math.abs(roundedNumber(value, spec) - value) > Math.abs(value) * 0.01; ) spec.decimals++;
|
|
1169
1115
|
spec.prefix = "", spec.suffix = "", spec.lockMagnitude = heldMoney, spec.rollMagnitude = !1, spec.thousandsSep === "" && (spec.thousandsSep = locale.thousands);
|
|
1170
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);
|
|
1171
|
-
let smallMoney = !spec.magnitudeInAffix && !spec.exponent && !spec.ordinal && !rowScale && forcedMagnitude && scales(example) && values.every((v) => Math.abs(v) < 1e3), changeLine = row.inline === !0 || spec.signed;
|
|
1172
|
-
if (smallMoney || !changeLine && group === void 0 && values.some((v) => v !== 0 && roundedNumber(v, spec) === 0)) {
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
spec.decimals = !rowScale && authored.magnitude === "none" ? authored.decimals : 0, spec.magnitude = "none";
|
|
1176
|
-
}
|
|
1177
|
-
spec.decimals = values.reduce((decimals, value) => nonzeroDecimals(value / MAGNITUDE_DIVISOR[spec.magnitude], decimals), spec.decimals);
|
|
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")) {
|
|
1119
|
+
let authored = parseFormatExample2(example);
|
|
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);
|
|
1178
1121
|
}
|
|
1179
1122
|
if (!changeLine && (spec.magnitude !== "none" || group !== void 0 && row.scale === "money") && !(spec.lockMagnitude && spec.magnitude === "k") && (row.scale === "money" || row.scale === "count" && !authoredFormat))
|
|
1180
1123
|
if (group === void 0)
|
|
@@ -1194,6 +1137,15 @@ function compileTableData(data, options, magnitudeSource) {
|
|
|
1194
1137
|
}
|
|
1195
1138
|
groupCellSpecs.set(row.id, inRow);
|
|
1196
1139
|
}
|
|
1140
|
+
if (!changeLine && group === void 0) {
|
|
1141
|
+
let inRow = /* @__PURE__ */ new Map();
|
|
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) });
|
|
1146
|
+
}
|
|
1147
|
+
inRow.size > 0 && groupCellSpecs.set(row.id, inRow);
|
|
1148
|
+
}
|
|
1197
1149
|
}
|
|
1198
1150
|
let sourceRow = sourceRows.get(row.id);
|
|
1199
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);
|
|
@@ -1218,7 +1170,7 @@ function compileTableData(data, options, magnitudeSource) {
|
|
|
1218
1170
|
}, hoistedRowUnits = /* @__PURE__ */ new Map();
|
|
1219
1171
|
if (forcedMagnitude !== void 0)
|
|
1220
1172
|
for (let [rowId, spec] of rowSpecs) {
|
|
1221
|
-
if (rowById.get(rowId)?.scale
|
|
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;
|
|
1222
1174
|
let unit = spec.magnitude === "none" ? null : unitOfSpec(spec);
|
|
1223
1175
|
unit !== null && hoistedRowUnits.set(rowId, unit);
|
|
1224
1176
|
}
|
|
@@ -1227,44 +1179,68 @@ function compileTableData(data, options, magnitudeSource) {
|
|
|
1227
1179
|
if (!(row.calc || !rowSpecs.has(row.id)))
|
|
1228
1180
|
for (let col of valueCols)
|
|
1229
1181
|
!ownFormatColumns.has(col.id) && typeof rawState2.get(row.id)?.get(col.id)?.raw == "number" && rowFormattedColumns.add(col.id);
|
|
1230
|
-
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 = figureRows.length > 1 && hoistedUnitSet.size === 1 && figureRows.every((row) => hoistedRowUnits.has(row.id)) ? [...hoistedUnitSet][0] : void 0;
|
|
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;
|
|
1231
1183
|
function defaultExample(col) {
|
|
1232
1184
|
if (col.kind === "computed" && calcYieldsPoints(col.calc)) return `1${locale.decimal}2%`;
|
|
1233
1185
|
if (options2.magnitude === "million") return `1${locale.thousands}234${locale.decimal}2m`;
|
|
1234
1186
|
if (options2.magnitude === "thousand") return `1${locale.thousands}234k`;
|
|
1235
|
-
let
|
|
1187
|
+
let values = [];
|
|
1236
1188
|
for (let r of flat) {
|
|
1237
|
-
let s = rawState2.get(r.id).get(
|
|
1238
|
-
s && typeof s.raw == "number" &&
|
|
1189
|
+
let s = rawState2.get(r.id).get(col.id);
|
|
1190
|
+
s && typeof s.raw == "number" && values.push(s.raw);
|
|
1239
1191
|
}
|
|
1240
|
-
|
|
1241
|
-
|
|
1192
|
+
return exampleOf(values);
|
|
1193
|
+
}
|
|
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`;
|
|
1242
1198
|
if (maxAbs >= 100) return `1${locale.thousands}234`;
|
|
1243
1199
|
let decimals = typicalDecimals(values);
|
|
1244
1200
|
return decimals > 1 ? `0${locale.decimal}${"1234".slice(0, decimals)}` : `1${locale.decimal}2`;
|
|
1245
1201
|
}
|
|
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
|
+
}
|
|
1215
|
+
}
|
|
1246
1216
|
let unitByCol = /* @__PURE__ */ new Map(), rollsOff = (colId, spec) => spec.magnitude !== "none" && flat.some((row) => {
|
|
1247
|
-
if (
|
|
1217
|
+
if (!printsThroughColumn(row, colId)) return !1;
|
|
1248
1218
|
let raw = rawState2.get(row.id)?.get(colId)?.raw;
|
|
1249
1219
|
return typeof raw == "number" && raw !== 0 && effectiveScale(Math.abs(raw), spec).magnitude !== spec.magnitude;
|
|
1250
|
-
}), lettersInCells = /* @__PURE__ */ new Set();
|
|
1220
|
+
}), lettersInCells = /* @__PURE__ */ new Set(), figurelessColumns = /* @__PURE__ */ new Set();
|
|
1251
1221
|
for (let col of [...valueCols, ...computedCols]) {
|
|
1252
1222
|
let spec = specs.get(col.id);
|
|
1253
|
-
!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));
|
|
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));
|
|
1254
1224
|
}
|
|
1255
|
-
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 &&
|
|
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) => {
|
|
1256
1226
|
let kind = specUnitKind(specs.get(col.id));
|
|
1257
1227
|
return kind === "percent" || kind === "pp" || headerUnitFor(col.id) === distinctUnits[0];
|
|
1258
1228
|
}) ? distinctUnits[0] : void 0, frameCarriesUnit = unitPrinted({
|
|
1259
1229
|
subtitle: resolveSubtitle(options2.subtitle),
|
|
1260
1230
|
unit: candidateUnit,
|
|
1261
1231
|
unitShown: options2.unitShown
|
|
1262
|
-
}), 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 && [...
|
|
1263
|
-
|
|
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({
|
|
1264
1240
|
code: "table-unit-overridden",
|
|
1265
1241
|
severity: "warn",
|
|
1266
1242
|
field: ["options", "unit"],
|
|
1267
|
-
message: `options.unit '${options2.unit}' is not printed. The table prints '${uniformUnit}' because its column formats resolve that shared 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(", ")}).`,
|
|
1268
1244
|
suggest: "Remove options.unit so the column formats supply the unit.",
|
|
1269
1245
|
fix: [{ op: "remove", path: "/options/unit" }]
|
|
1270
1246
|
});
|
|
@@ -1275,7 +1251,7 @@ function compileTableData(data, options, magnitudeSource) {
|
|
|
1275
1251
|
let cellSpec = rowId ? cellSpecs.get(rowId)?.get(colId) : void 0;
|
|
1276
1252
|
if (cellSpec) return cellSpec;
|
|
1277
1253
|
let rowSpec = rowId ? rowSpecs.get(rowId) : void 0;
|
|
1278
|
-
return rowSpec && (rowOverridesColumn(rowId) || !ownFormatColumns.has(colId)) ? groupCellSpecs.get(rowId)?.get(colId) ?? rowSpec : specs.get(colId);
|
|
1254
|
+
return rowSpec && (rowOverridesColumn(rowId) || !ownFormatColumns.has(colId) && rowScaleReaches(rowId, colId)) ? groupCellSpecs.get(rowId)?.get(colId) ?? rowSpec : specs.get(colId);
|
|
1279
1255
|
}, displayFormats = /* @__PURE__ */ new Map(), displayFormat = (base, decimals, automatic, hoisted, clearCurrency = !1) => {
|
|
1280
1256
|
let variants = displayFormats.get(base);
|
|
1281
1257
|
variants || displayFormats.set(base, variants = /* @__PURE__ */ new Map());
|
|
@@ -1292,13 +1268,13 @@ function compileTableData(data, options, magnitudeSource) {
|
|
|
1292
1268
|
}
|
|
1293
1269
|
return format;
|
|
1294
1270
|
}, formatNumber = (raw, colId, rowId, lift = !0) => {
|
|
1295
|
-
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);
|
|
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);
|
|
1296
1272
|
if (cellSpec && !sameUnit2(cellSpec, base)) return displayFormat(cellSpec, cellSpec.decimals, lift ? cellSpec.automatic : !1, !1)(raw);
|
|
1297
1273
|
let decimals = cellSpec?.decimals ?? (rowPath ? groupCellSpecs.get(rowId)?.get(colId)?.decimals : void 0) ?? base.decimals;
|
|
1298
1274
|
if (rowPath) {
|
|
1299
1275
|
if (raw === 0 && lift && !cellSpec && groupOf(rowById.get(rowId)) !== void 0) return "0";
|
|
1300
|
-
let hoisted = rowId !== void 0 && hoistedRowUnits.has(rowId), automatic2 = lift && (cellSpec ? cellSpec.automatic : rowSpec.automatic);
|
|
1301
|
-
return
|
|
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;
|
|
1302
1278
|
}
|
|
1303
1279
|
let automatic = lift ? cellSpec ? cellSpec.automatic : base.automatic : !1, rendered = displayFormat(base, decimals, automatic, unitByCol.get(colId) != null, cellSpec !== void 0)(raw);
|
|
1304
1280
|
return localeDerivedColumns.has(colId) && locale.minusGlyph === "-" && rendered.startsWith(MINUS) ? `-${rendered.slice(MINUS.length)}` : rendered;
|
|
@@ -1349,8 +1325,9 @@ function compileTableData(data, options, magnitudeSource) {
|
|
|
1349
1325
|
});
|
|
1350
1326
|
});
|
|
1351
1327
|
}
|
|
1328
|
+
let scaledBy100 = (calc) => "op" in calc && calc.op === "mul" && [calc.a, calc.b].some((side) => "lit" in side && side.lit === 100);
|
|
1352
1329
|
for (let col of [...valueCols, ...computedCols]) {
|
|
1353
|
-
if (col.kind === "computed" ? calcYieldsPoints(col.calc) : col.percentScale === "points") continue;
|
|
1330
|
+
if (col.kind === "computed" ? calcYieldsPoints(col.calc) || scaledBy100(col.calc) : col.percentScale === "points") continue;
|
|
1354
1331
|
let spec = col.kind === "computed" || col.format ? specs.get(col.id) : void 0;
|
|
1355
1332
|
if (!spec || !(spec.suffix ?? "").includes("%")) continue;
|
|
1356
1333
|
let vals = flat.map((r) => rawState2.get(r.id).get(col.id)).filter((s) => !!s && typeof s.raw == "number");
|
|
@@ -1389,7 +1366,7 @@ function compileTableData(data, options, magnitudeSource) {
|
|
|
1389
1366
|
{ rowId: k.id, colId: col.id, value: childShown[i], role: "displayed" }
|
|
1390
1367
|
])
|
|
1391
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)))));
|
|
1392
|
-
Math.abs(roundingGap) > displayUnit * 0.5 && (autoFootnotes2.add(
|
|
1369
|
+
Math.abs(roundingGap) > displayUnit * 0.5 && (autoFootnotes2.add(chartString2(options2, "tableRoundingNote")), records2.push({
|
|
1393
1370
|
rowId: row.id,
|
|
1394
1371
|
colId: col.id,
|
|
1395
1372
|
op: "rounding-gap",
|
|
@@ -1559,7 +1536,7 @@ function compileTableData(data, options, magnitudeSource) {
|
|
|
1559
1536
|
(polarity === "lowerIsBetter" ? lowerJudged : higherJudged).add(measure);
|
|
1560
1537
|
}
|
|
1561
1538
|
let mat = col.materiality, threshold = specs.get(col.id).suffix.includes("%") ? mat?.pct : mat?.abs;
|
|
1562
|
-
threshold !== void 0 && Math.abs(s.raw) < threshold && (deEmphasized = !0, tone = "neutral");
|
|
1539
|
+
threshold !== void 0 && Math.abs(roundedNumber(s.raw, specFor(col.id, row.id))) < threshold && (deEmphasized = !0, tone = "neutral");
|
|
1563
1540
|
}
|
|
1564
1541
|
obj?.muted === !0 && (deEmphasized = !0, tone = "neutral"), tone = judgementTone(tone, obj?.strong);
|
|
1565
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);
|
|
@@ -1577,7 +1554,10 @@ function compileTableData(data, options, magnitudeSource) {
|
|
|
1577
1554
|
};
|
|
1578
1555
|
}
|
|
1579
1556
|
case "status": {
|
|
1580
|
-
let
|
|
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;
|
|
1581
1561
|
if (typeof given == "number")
|
|
1582
1562
|
return warnings2.push({
|
|
1583
1563
|
code: "status-value-number",
|
|
@@ -1588,24 +1568,21 @@ function compileTableData(data, options, magnitudeSource) {
|
|
|
1588
1568
|
if (v !== null && !STATUS_VALUES.includes(v)) {
|
|
1589
1569
|
let converted = caseInsensitiveValue(v, STATUS_VALUES) ?? (Object.hasOwn(STATUS_WORDS, v.toLowerCase()) ? STATUS_WORDS[v.toLowerCase()] : void 0);
|
|
1590
1570
|
if (converted !== void 0) {
|
|
1591
|
-
let
|
|
1592
|
-
for (let [index, candidate] of rows.entries()) {
|
|
1593
|
-
let path = [...base2, index];
|
|
1594
|
-
if (candidate.id === row.id) return path;
|
|
1595
|
-
let child = candidate.children && rowPath(candidate.children, [...path, "children"]);
|
|
1596
|
-
if (child) return child;
|
|
1597
|
-
}
|
|
1598
|
-
}, field = [...rowPath(data.rows, ["data", "rows"]), "cells", col.id, ...obj ? ["v"] : []];
|
|
1571
|
+
let field = [...rowPaths(data.rows, ["data", "rows"])[0], "cells", col.id, ...obj ? ["v"] : []];
|
|
1599
1572
|
warnings2.push(inputConversion(field, v, converted)), v = converted;
|
|
1600
1573
|
}
|
|
1601
1574
|
}
|
|
1602
|
-
if (v !== null && !STATUS_VALUES.includes(v))
|
|
1575
|
+
if (v !== null && !STATUS_VALUES.includes(v)) {
|
|
1576
|
+
let paths = rowPaths(data.rows, ["data", "rows"]);
|
|
1603
1577
|
throw new NormalizeError(
|
|
1604
1578
|
"status-value-invalid",
|
|
1605
1579
|
`rows[${row.id}].cells[${col.id}]`,
|
|
1606
1580
|
`status '${v}' is not one of: ${STATUS_VALUES.join(" \xB7 ")}; for free status text use a text column with a cell tone`,
|
|
1607
|
-
"Use on-track, at-risk, off-track, done or pending, or green, amber, yellow or red (any case).
|
|
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
|
|
1608
1584
|
);
|
|
1585
|
+
}
|
|
1609
1586
|
if (v === null) return { ...base, displayed: missingGlyph };
|
|
1610
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;
|
|
1611
1588
|
return { ...base, raw: v, state: "value", displayed, tone: judgementTone(tone, obj?.strong) };
|
|
@@ -1623,7 +1600,10 @@ function compileTableData(data, options, magnitudeSource) {
|
|
|
1623
1600
|
throw new NormalizeError(
|
|
1624
1601
|
"date-invalid",
|
|
1625
1602
|
`rows[${row.id}].cells[${col.id}]`,
|
|
1626
|
-
`'${v}' is not an ISO date (YYYY-MM-DD)
|
|
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)
|
|
1627
1607
|
);
|
|
1628
1608
|
let pattern = datePatterns.get(col.id);
|
|
1629
1609
|
return { ...base, raw: v, state: "value", displayed: formatDate(d, pattern, options2.locale?.language) };
|
|
@@ -1642,26 +1622,17 @@ function compileTableData(data, options, magnitudeSource) {
|
|
|
1642
1622
|
for (let row of ordered) {
|
|
1643
1623
|
if (!generatedOthers.has(row.id) || !row.hasChildren) continue;
|
|
1644
1624
|
let members = (treeChildrenOf.get(row.id) ?? []).map((child) => child.label);
|
|
1645
|
-
autoFootnotes2.add(
|
|
1625
|
+
autoFootnotes2.add(chartString2(options2, "tableGroupsNote", { group: row.label, members: members.join(", ") }));
|
|
1646
1626
|
}
|
|
1647
|
-
resolvedColumns.
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
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(", ") }));
|
|
1652
1633
|
}
|
|
1653
1634
|
let footnotes = [...autoFootnotes2];
|
|
1654
1635
|
if (headMarksPartial) for (let column of resolvedColumns) partialColumnIds.has(column.id) && (column.partial = !0);
|
|
1655
|
-
if (options2.columnHeads === !1) {
|
|
1656
|
-
let units = [...new Set(resolvedColumns.flatMap((column) => column.unitLabel ?? []))];
|
|
1657
|
-
units.length > 0 && warnings2.push({
|
|
1658
|
-
code: "column-heads-unit-hidden",
|
|
1659
|
-
severity: "warn",
|
|
1660
|
-
field: ["options", "columnHeads"],
|
|
1661
|
-
message: `columnHeads: false removes the only print of the unit ${units.join(", ")}`,
|
|
1662
|
-
suggest: "Name the unit in the subtitle or a footnote, or use formats that print it in each cell."
|
|
1663
|
-
});
|
|
1664
|
-
}
|
|
1665
1636
|
let result = {
|
|
1666
1637
|
...zeroLifts.count === liftsBefore && rawLifts === 0 ? {} : { lifted: !0 },
|
|
1667
1638
|
table: {
|
|
@@ -1679,9 +1650,10 @@ function compileTableData(data, options, magnitudeSource) {
|
|
|
1679
1650
|
columnToggles: toggleResolution.toggles,
|
|
1680
1651
|
rows: ordered,
|
|
1681
1652
|
unit: uniformUnit ?? void 0,
|
|
1653
|
+
...columnUnits ? { columnUnits: !0 } : {},
|
|
1682
1654
|
...data.levelNouns === void 0 ? {} : { levelNouns: data.levelNouns },
|
|
1683
1655
|
footnotes,
|
|
1684
|
-
...partialColumnIds.size > 0 ? { partialColumnIds: [...partialColumnIds] } : {},
|
|
1656
|
+
...partialColumnIds.size > 0 ? { partialColumnIds: [...partialColumnIds], partialNote } : {},
|
|
1685
1657
|
...options2.colorblindSafe === !0 ? { colorblindSafe: !0 } : {},
|
|
1686
1658
|
provenance: {}
|
|
1687
1659
|
},
|
|
@@ -1734,7 +1706,7 @@ function stampRecordDisplay(records, resolvedRows, formatNumber) {
|
|
|
1734
1706
|
for (let r of resolvedRows) for (let c of Object.values(r.cells)) cellIndex.set(tableCellKey(c.rowId, c.colId), c);
|
|
1735
1707
|
for (let rec of records) {
|
|
1736
1708
|
if (rec.kind === "reconciliation" || rec.kind === "rounding-adjustment") {
|
|
1737
|
-
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);
|
|
1738
1710
|
continue;
|
|
1739
1711
|
}
|
|
1740
1712
|
rec.displayed = cellIndex.get(tableCellKey(rec.rowId, rec.colId))?.displayed ?? rec.displayed;
|
|
@@ -1742,7 +1714,7 @@ function stampRecordDisplay(records, resolvedRows, formatNumber) {
|
|
|
1742
1714
|
}
|
|
1743
1715
|
function sortSiblingGroups(childrenOf, resolvedRows, columns, options, generatedOthers) {
|
|
1744
1716
|
let catSort = options.sort?.categories ?? "sheet";
|
|
1745
|
-
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") {
|
|
1746
1718
|
pinOthersLast(childrenOf, resolvedRows, generatedOthers);
|
|
1747
1719
|
return;
|
|
1748
1720
|
}
|
|
@@ -1799,28 +1771,40 @@ function ladderStep(row, byId, offset) {
|
|
|
1799
1771
|
}
|
|
1800
1772
|
return Math.max(0, depth + (row.role === "total" ? 0 : offset));
|
|
1801
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
|
+
}
|
|
1802
1780
|
function flattenRows(rows) {
|
|
1803
1781
|
let out = [], seen = /* @__PURE__ */ new Set(), order = 0, walk = (row, parentId, level) => {
|
|
1804
1782
|
if (seen.has(row.id))
|
|
1805
1783
|
throw new NormalizeError(
|
|
1806
1784
|
"duplicate-row-id",
|
|
1807
1785
|
`rows[${row.id}]`,
|
|
1808
|
-
`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")
|
|
1809
1790
|
);
|
|
1810
1791
|
if (seen.add(row.id), row.badge !== void 0 && row.role !== "section")
|
|
1811
|
-
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"));
|
|
1812
1793
|
let badgeText = row.badge?.text.trim();
|
|
1813
|
-
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"));
|
|
1814
1795
|
let displayOnly = row.kind === "result" || row.kind === "driver";
|
|
1815
|
-
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");
|
|
1816
|
-
if (row.sign !== void 0 && (displayOnly || (row.relation ?? "additive") !== "additive")) throw new NormalizeError("invalid-data", `rows[${row.id}].sign`, "sign requires relation additive");
|
|
1817
|
-
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"));
|
|
1818
1799
|
let declaredParent = row.parentId ?? parentId;
|
|
1819
1800
|
if (row.parentId && parentId && row.parentId !== parentId)
|
|
1820
1801
|
throw new NormalizeError(
|
|
1821
1802
|
"parent-conflict",
|
|
1822
1803
|
`rows[${row.id}]`,
|
|
1823
|
-
`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")
|
|
1824
1808
|
);
|
|
1825
1809
|
out.push({
|
|
1826
1810
|
id: row.id,
|
|
@@ -1858,11 +1842,11 @@ function flattenRows(rows) {
|
|
|
1858
1842
|
let byId = new Map(out.map((r) => [r.id, r]));
|
|
1859
1843
|
for (let r of out) {
|
|
1860
1844
|
if (r.parentId && !byId.has(r.parentId))
|
|
1861
|
-
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"));
|
|
1862
1846
|
let level = 0, p = r.parentId, guard = /* @__PURE__ */ new Set([r.id]);
|
|
1863
1847
|
for (; p; ) {
|
|
1864
1848
|
if (guard.has(p))
|
|
1865
|
-
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"));
|
|
1866
1850
|
guard.add(p), level++, p = byId.get(p).parentId;
|
|
1867
1851
|
}
|
|
1868
1852
|
r.level = level;
|
|
@@ -1926,22 +1910,32 @@ function resolveColumnToggles(data, options, colById, warnings) {
|
|
|
1926
1910
|
throw new NormalizeError(
|
|
1927
1911
|
"duplicate-toggle-id",
|
|
1928
1912
|
`columnToggles[${toggle.id}]`,
|
|
1929
|
-
`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"]
|
|
1930
1917
|
);
|
|
1931
1918
|
toggleIds.add(toggle.id);
|
|
1932
|
-
for (let
|
|
1919
|
+
for (let ci = 0; ci < toggle.columns.length; ci++) {
|
|
1920
|
+
let columnId = toggle.columns[ci];
|
|
1933
1921
|
if (!colById.has(columnId))
|
|
1934
1922
|
throw new NormalizeError(
|
|
1935
1923
|
"toggle-ref-invalid",
|
|
1936
1924
|
`columnToggles[${toggle.id}]`,
|
|
1937
|
-
`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]
|
|
1938
1929
|
);
|
|
1939
1930
|
let owner = membership.get(columnId);
|
|
1940
1931
|
if (owner !== void 0)
|
|
1941
1932
|
throw new NormalizeError(
|
|
1942
1933
|
"toggle-ref-invalid",
|
|
1943
1934
|
`columnToggles[${toggle.id}]`,
|
|
1944
|
-
`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]
|
|
1945
1939
|
);
|
|
1946
1940
|
membership.set(columnId, toggle.id);
|
|
1947
1941
|
}
|
|
@@ -1949,7 +1943,10 @@ function resolveColumnToggles(data, options, colById, warnings) {
|
|
|
1949
1943
|
throw new NormalizeError(
|
|
1950
1944
|
"toggle-group-span",
|
|
1951
1945
|
`columnToggles[${toggle.id}]`,
|
|
1952
|
-
`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"]
|
|
1953
1950
|
);
|
|
1954
1951
|
}
|
|
1955
1952
|
return columnVisibilityWarnings(data.columnToggles ?? [], options, warnings), {
|
|
@@ -1978,14 +1975,18 @@ function columnVisibilityWarnings(toggles, options, warnings) {
|
|
|
1978
1975
|
function validateGroups(data, colById) {
|
|
1979
1976
|
let groups = data.columnGroups ?? [], claimed = /* @__PURE__ */ new Map(), columnIndex = new Map(data.columns.map((column, index) => [column.id, index]));
|
|
1980
1977
|
for (let g of groups) {
|
|
1981
|
-
for (let
|
|
1978
|
+
for (let ci = 0; ci < g.columns.length; ci++) {
|
|
1979
|
+
let cid = g.columns[ci];
|
|
1982
1980
|
if (!colById.has(cid))
|
|
1983
|
-
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]);
|
|
1984
1982
|
if (claimed.has(cid))
|
|
1985
1983
|
throw new NormalizeError(
|
|
1986
1984
|
"group-ref-invalid",
|
|
1987
1985
|
`columnGroups[${g.id}]`,
|
|
1988
|
-
`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]
|
|
1989
1990
|
);
|
|
1990
1991
|
claimed.set(cid, g.id);
|
|
1991
1992
|
}
|
|
@@ -1995,27 +1996,36 @@ function validateGroups(data, colById) {
|
|
|
1995
1996
|
throw new NormalizeError(
|
|
1996
1997
|
"group-not-contiguous",
|
|
1997
1998
|
`columnGroups[${g.id}]`,
|
|
1998
|
-
"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"]
|
|
1999
2003
|
);
|
|
2000
2004
|
}
|
|
2001
2005
|
}
|
|
2002
2006
|
function validateCalcRefs(columns, colById) {
|
|
2003
|
-
let checkRef = (rid, owner) => {
|
|
2007
|
+
let columnCalc = (owner) => ["data", "columns", columns.findIndex((column) => column.id === owner), "calc"], checkRef = (rid, owner) => {
|
|
2004
2008
|
let target = colById.get(rid);
|
|
2005
2009
|
if (!target)
|
|
2006
|
-
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));
|
|
2007
2011
|
if (target.kind !== "value")
|
|
2008
2012
|
throw new NormalizeError(
|
|
2009
2013
|
"compute-ref-computed",
|
|
2010
2014
|
`columns[${owner}].calc`,
|
|
2011
|
-
`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)
|
|
2012
2019
|
);
|
|
2013
2020
|
}, checkCell = (ref, owner) => {
|
|
2014
2021
|
if (typeof ref != "string")
|
|
2015
2022
|
throw new NormalizeError(
|
|
2016
2023
|
"row-ref-in-column-calc",
|
|
2017
2024
|
`columns[${owner}].calc`,
|
|
2018
|
-
"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)
|
|
2019
2029
|
);
|
|
2020
2030
|
checkRef(ref, owner);
|
|
2021
2031
|
}, check = (calc, owner) => {
|
|
@@ -2064,26 +2074,32 @@ function contributionSignOf(row, byId, stop) {
|
|
|
2064
2074
|
function numericColKind(kind) {
|
|
2065
2075
|
return kind === "value" || kind === "computed";
|
|
2066
2076
|
}
|
|
2067
|
-
function validateRowCalcRef(ref, owner, rowIds, calcRows, colById, reads) {
|
|
2077
|
+
function validateRowCalcRef(ref, owner, rowIds, calcRows, colById, authoredRows, reads) {
|
|
2068
2078
|
if (typeof ref == "string") {
|
|
2069
2079
|
let target = colById.get(ref);
|
|
2070
2080
|
if (!target || !numericColKind(target.kind))
|
|
2071
2081
|
throw new NormalizeError(
|
|
2072
2082
|
"calc-ref-missing",
|
|
2073
2083
|
`rows[${owner}].calc`,
|
|
2074
|
-
`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")
|
|
2075
2088
|
);
|
|
2076
2089
|
return;
|
|
2077
2090
|
}
|
|
2078
2091
|
if (!rowIds.has(ref.row))
|
|
2079
|
-
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"));
|
|
2080
2093
|
if (calcRows.has(ref.row) && reads?.push(ref.row), ref.col) {
|
|
2081
2094
|
let target = colById.get(ref.col);
|
|
2082
2095
|
if (!target || !numericColKind(target.kind))
|
|
2083
2096
|
throw new NormalizeError(
|
|
2084
2097
|
"calc-ref-missing",
|
|
2085
2098
|
`rows[${owner}].calc`,
|
|
2086
|
-
`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")
|
|
2087
2103
|
);
|
|
2088
2104
|
}
|
|
2089
2105
|
}
|
|
@@ -2107,19 +2123,19 @@ function calcRefs(calc, refs = []) {
|
|
|
2107
2123
|
}
|
|
2108
2124
|
return refs;
|
|
2109
2125
|
}
|
|
2110
|
-
function walkRowCalc(calc, owner, rowIds, calcRows, colById, reads = []) {
|
|
2111
|
-
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);
|
|
2112
2128
|
if ("lit" in calc) return reads;
|
|
2113
2129
|
if ("ref" in calc)
|
|
2114
2130
|
return ref(calc.ref), reads;
|
|
2115
2131
|
switch (calc.op) {
|
|
2116
2132
|
case "abs":
|
|
2117
|
-
return walkRowCalc(calc.of, owner, rowIds, calcRows, colById, reads);
|
|
2133
|
+
return walkRowCalc(calc.of, owner, rowIds, calcRows, colById, authoredRows, reads);
|
|
2118
2134
|
case "add":
|
|
2119
2135
|
case "sub":
|
|
2120
2136
|
case "mul":
|
|
2121
2137
|
case "div":
|
|
2122
|
-
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;
|
|
2123
2139
|
case "share":
|
|
2124
2140
|
return ref(calc.of), reads;
|
|
2125
2141
|
case "delta":
|
|
@@ -2128,7 +2144,7 @@ function walkRowCalc(calc, owner, rowIds, calcRows, colById, reads = []) {
|
|
|
2128
2144
|
}
|
|
2129
2145
|
return reads;
|
|
2130
2146
|
}
|
|
2131
|
-
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 = []) {
|
|
2132
2148
|
let negativeBase = /* @__PURE__ */ new Map(), noteNegativeBase = (scope, rowId, colId) => {
|
|
2133
2149
|
let key = `${scope}:${scope === "column" ? colId : rowId}`, seen = negativeBase.get(key);
|
|
2134
2150
|
seen ? seen.cells += 1 : negativeBase.set(key, { scope, rowId, colId, cells: 1 });
|
|
@@ -2151,15 +2167,18 @@ function evaluateTableCalcs(flat, valueCols, computedCols, rawState, records, le
|
|
|
2151
2167
|
}
|
|
2152
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) => {
|
|
2153
2169
|
if (visit.get(row.id) !== "done") {
|
|
2154
|
-
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"));
|
|
2155
2171
|
if (row.relation === "additive")
|
|
2156
2172
|
throw new NormalizeError(
|
|
2157
2173
|
"row-calc-relation",
|
|
2158
2174
|
`rows[${row.id}]`,
|
|
2159
|
-
`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)
|
|
2160
2179
|
);
|
|
2161
2180
|
visit.set(row.id, "open");
|
|
2162
|
-
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));
|
|
2163
2182
|
visit.set(row.id, "done"), ordered.push(row);
|
|
2164
2183
|
}
|
|
2165
2184
|
};
|
|
@@ -2167,14 +2186,14 @@ function evaluateTableCalcs(flat, valueCols, computedCols, rawState, records, le
|
|
|
2167
2186
|
for (let row of ordered) {
|
|
2168
2187
|
let states = rawState.get(row.id), sourceStates = new Map(states);
|
|
2169
2188
|
for (let col of numericCols) {
|
|
2170
|
-
if (col.kind === "computed" &&
|
|
2171
|
-
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 : {
|
|
2172
2191
|
currentCol: col.id,
|
|
2173
2192
|
rawState,
|
|
2174
2193
|
previousCol,
|
|
2175
2194
|
noPrevious
|
|
2176
2195
|
}, contributionSign);
|
|
2177
|
-
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);
|
|
2178
2197
|
}
|
|
2179
2198
|
}
|
|
2180
2199
|
return { nearZero, mixedCoverage, negativeBase: [...negativeBase.values()] };
|
|
@@ -2270,6 +2289,60 @@ function evalCalc(calc, row, states, leafTotal, scope, contributionSign = () =>
|
|
|
2270
2289
|
}, result = evalNode(calc), op = "ref" in calc ? `ref(${expr})` : "lit" in calc ? `lit(${expr})` : expr;
|
|
2271
2290
|
return isState(result) ? { raw: null, state: result, op, inputs, ...nearZero && result === "nm" ? { nearZero: !0 } : {} } : { raw: result, state: "value", op, inputs, ...negativeBase ? { negativeBase: !0 } : {} };
|
|
2272
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
|
+
}
|
|
2273
2346
|
|
|
2274
2347
|
// src/core/charts/table/view.ts
|
|
2275
2348
|
var NUMERIC_COLUMNS = /* @__PURE__ */ new Set(["value", "computed", "date", "encoding"]);
|
|
@@ -2285,13 +2358,13 @@ function numericCell(cell) {
|
|
|
2285
2358
|
function cellDrawsTabular(theme, kind, displayed) {
|
|
2286
2359
|
return numericVariant("value", theme) === "tabular-nums" && cellHoldsNumber(kind, displayed);
|
|
2287
2360
|
}
|
|
2288
|
-
function tableFootnotes(table, rows, columns) {
|
|
2361
|
+
function tableFootnotes(table, rows, columns, language) {
|
|
2289
2362
|
let emitted = new Set(columns.map((column) => column.id)), marked = rows.some(
|
|
2290
2363
|
(row) => Object.values(row.cells).some(
|
|
2291
2364
|
(cell) => cell.state === "suppressed" && emitted.has(cell.colId)
|
|
2292
2365
|
)
|
|
2293
|
-
), 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 ===
|
|
2294
|
-
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);
|
|
2295
2368
|
}
|
|
2296
2369
|
function treeChildCounts(table) {
|
|
2297
2370
|
let counts = /* @__PURE__ */ new Map();
|
|
@@ -2327,8 +2400,9 @@ function expansionForFolds(table, authored, folds) {
|
|
|
2327
2400
|
function expansionRootsHidden(table, expansion) {
|
|
2328
2401
|
return expansion?.rootsHidden ?? (expansion?.depth === "totals" && table.rows.some((row) => row.role === "total"));
|
|
2329
2402
|
}
|
|
2403
|
+
var EMPTY_ROW_ID = "boardplot:empty";
|
|
2330
2404
|
function emptyMessageRow(table, message) {
|
|
2331
|
-
let id =
|
|
2405
|
+
let id = EMPTY_ROW_ID, labelId = table.columns.find((column) => column.kind === "rowLabel")?.id;
|
|
2332
2406
|
return {
|
|
2333
2407
|
id,
|
|
2334
2408
|
label: message,
|
|
@@ -2489,519 +2563,27 @@ function inCellBarMaxima(rows, columns) {
|
|
|
2489
2563
|
}
|
|
2490
2564
|
return maxima;
|
|
2491
2565
|
}
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
let { columnHeads: _heads, ...withHeads } = options, bare = (columns) => columns.map((col) => {
|
|
2498
|
-
let { subLabel: _sub, unitLabel: _unit, partial: _partial, scenario: _scenario, ...rest } = col;
|
|
2499
|
-
return { ...rest, label: "" };
|
|
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 === "";
|
|
2500
2571
|
});
|
|
2501
|
-
return
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
let
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
if ("widthMiss" in regular) return regular;
|
|
2516
|
-
let count = (view.columns ?? visibleColumns(table)).length, densePad = count >= 25 ? 3 : count >= DENSE_COLUMNS ? 5 : regular.cellPadX;
|
|
2517
|
-
if (options.cellPadX !== void 0 || densePad >= regular.cellPadX || Math.max(regular.minimumW, regular.totalW) <= (view.available ?? 1 / 0)) return regular;
|
|
2518
|
-
let dense = tableWidthsOnce(table, theme, measure, { ...options, cellPadX: densePad }, own);
|
|
2519
|
-
if ("widthMiss" in dense) return dense;
|
|
2520
|
-
let regularOverflow = regular.warnings.find((warning) => warning.code === "table-overflow");
|
|
2521
|
-
return regularOverflow && (dense.warnings = dense.warnings.map((warning) => warning.code === "table-overflow" ? regularOverflow : warning)), dense;
|
|
2522
|
-
}
|
|
2523
|
-
function measureTableTracks(table, theme, measure, options, view) {
|
|
2524
|
-
let cols = view.columns ?? visibleColumns(table), columnIndex = new Map(cols.map((col, index) => [col.id, index])), rows = view.rows ?? visibleRows(table), fullRows = view.fullRows ?? table.rows, widthRows = view.widthRows ?? table.rows, spacerBefore = /* @__PURE__ */ new Map();
|
|
2525
|
-
for (let group of table.columnGroups) {
|
|
2526
|
-
if (group.spacer === void 0 || group.spacer <= 0) continue;
|
|
2527
|
-
let ordered = view.allColumns ?? cols, first = ordered.find((col) => group.columnIds.includes(col.id));
|
|
2528
|
-
first && first.id !== ordered[0]?.id && spacerBefore.set(first.id, cols.some((col) => group.columnIds.includes(col.id)) ? group.spacer : 0);
|
|
2529
|
-
}
|
|
2530
|
-
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 = {
|
|
2531
|
-
padX: cellPadX2,
|
|
2532
|
-
trailingTracking: view.trailingTracking,
|
|
2533
|
-
startRule: view.groupStart === void 0 ? void 0 : (groupId) => {
|
|
2534
|
-
let first = cols.find((col) => col.groupId === groupId);
|
|
2535
|
-
return first && view.groupStart.has(first.id) ? 1 : 0;
|
|
2536
|
-
}
|
|
2537
|
-
}, headingFaces = (faces) => groupHeadingFaces(view.trailingTracking ? { ...faces.group, letterSpacing: Math.round((faces.group.letterSpacing ?? 0) * 1e3) / 1e3 } : faces.group), { ladder, regularFonts, cellStep, indentStep, childCount, cellFont, inlineFont: inlineFont2, hasChanges, bodyWidths } = measuredTypography(table, theme, measure, options, view, cols, rows, widthRows), 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;
|
|
2538
|
-
function affixRoom(row, font) {
|
|
2539
|
-
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);
|
|
2540
|
-
}
|
|
2541
|
-
let columnHeaderText = (col) => {
|
|
2542
|
-
let text = fieldHeadText(col.label, theme) + columnHeaderAffix(col);
|
|
2543
|
-
return view.headGlue === !1 ? text : text.replace(/ (\S{1,2})$/u, "\xA0$1");
|
|
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);
|
|
2544
2586
|
};
|
|
2545
|
-
function trackWidths(faces) {
|
|
2546
|
-
let widths = [], minimumWidths = [], wrappedOneLines = [], context = {
|
|
2547
|
-
theme,
|
|
2548
|
-
measure,
|
|
2549
|
-
bodyWidths,
|
|
2550
|
-
fonts: faces,
|
|
2551
|
-
cellFont,
|
|
2552
|
-
inlineFont: inlineFont2,
|
|
2553
|
-
changeFont: (level) => changeLineFont(theme, ladder, level),
|
|
2554
|
-
rowIndent,
|
|
2555
|
-
inlineIndent: INLINE_LABEL_INDENT,
|
|
2556
|
-
padX: cellPadX2,
|
|
2557
|
-
headerText: columnHeaderText,
|
|
2558
|
-
headerReserve: (col) => view.sortable?.has(col.id) ? SORT_CHEVRON_RESERVE : 0,
|
|
2559
|
-
headerTrailingTracking: view.trailingTracking,
|
|
2560
|
-
slack: view.slack,
|
|
2561
|
-
reserve: (col) => encodingReserve(col, measure, faces),
|
|
2562
|
-
// The face the sparkline cells draw their end value in (`emitSparkline`).
|
|
2563
|
-
sparkFont: { family: theme.type.family, ...theme.type.label },
|
|
2564
|
-
// A cell and each line in it take figures by their own string, as the
|
|
2565
|
-
// text nodes below take their role.
|
|
2566
|
-
figures: (col, cellText, lineText) => cellDrawsTabular(theme, col.kind, lineText ?? cellText),
|
|
2567
|
-
// the collapsed hint shares the label's line, as a unit affix does, so the track pays for it.
|
|
2568
|
-
hint: (row) => collapsedHintWidth(row, table.levelNouns, childCount.get(row.id) ?? 0, measure, faces.hint),
|
|
2569
|
-
...view.headLines === void 0 ? {} : { headLines: view.headLines }
|
|
2570
|
-
};
|
|
2571
|
-
for (let index = 0; index < cols.length; index++) {
|
|
2572
|
-
let col = cols[index], 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;
|
|
2573
|
-
if (col.kind === "encoding") {
|
|
2574
|
-
let track = (authoredTrackWidth(col, widthRows, context) ?? intrinsicWidth) + endRule;
|
|
2575
|
-
widths[index] = track, minimumWidths[index] = track;
|
|
2576
|
-
continue;
|
|
2577
|
-
}
|
|
2578
|
-
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;
|
|
2579
|
-
minimumWidths[index] = minimumWidth;
|
|
2580
|
-
let wrapped = view.scroll && col.wrap && col.width === void 0 && (figures || !heatColumn(col)), authoredContext = col.kind === "rowLabel" ? { ...context, labelLines: options.rowLabelLines ?? 2 } : context, authored = col.kind === "rowLabel" && col.width !== void 0 && intrinsicWidth <= col.width ? col.width : authoredTrackWidth(col, widthRows, authoredContext);
|
|
2581
|
-
widths[index] = figures || !heatColumn(col) ? authored ?? (wrapped ? minimumWidth : intrinsicWidth) : heatOnlyWidth, wrapped && wrappedOneLines.push({ index, width: intrinsicWidth });
|
|
2582
|
-
let extra = (col.kind === "rowLabel" ? labelLead : 0) + endRule;
|
|
2583
|
-
if (extra > 0) for (let target of [widths, minimumWidths]) target[index] = target[index] + extra;
|
|
2584
|
-
}
|
|
2585
|
-
{
|
|
2586
|
-
let groupFaces = headingFaces(faces), drawn = cols.map((col) => col.id), isFixed = (id) => {
|
|
2587
|
-
let col = cols.find((candidate) => candidate.id === id);
|
|
2588
|
-
return col !== void 0 && (col.width !== void 0 || !figures && heatColumn(col));
|
|
2589
|
-
};
|
|
2590
|
-
for (let target of [widths, minimumWidths]) {
|
|
2591
|
-
let floors = groupHeadingFloors(table.columnGroups, drawn, (id) => target[columnIndex.get(id)] ?? 0, isFixed, groupFaces, measure, groupCell);
|
|
2592
|
-
for (let [id, extra] of floors) target[columnIndex.get(id)] = target[columnIndex.get(id)] + extra;
|
|
2593
|
-
}
|
|
2594
|
-
}
|
|
2595
|
-
let chipFloor = sectionChipFloor(widthRows, { ...context, hint: void 0 });
|
|
2596
|
-
if (labelColumn !== void 0)
|
|
2597
|
-
for (let [target, floor] of [[widths, sectionChipFloor(widthRows, context)], [minimumWidths, chipFloor]]) {
|
|
2598
|
-
let span = chipSpan(target);
|
|
2599
|
-
span < floor && (target[columnIndex.get(labelColumn.id)] = target[columnIndex.get(labelColumn.id)] + floor - span);
|
|
2600
|
-
}
|
|
2601
|
-
let labelFloor = options[LABEL_WRAP_FLOOR] === !0 && labelColumn !== void 0 ? labelWrapFloor(labelColumn, faces) + labelLead : 0;
|
|
2602
|
-
if (labelFloor > 0) for (let target of [widths, minimumWidths]) target[columnIndex.get(labelColumn.id)] = Math.max(target[columnIndex.get(labelColumn.id)], labelFloor);
|
|
2603
|
-
view.scroll && labelColumn?.width === void 0 && labelColumn !== void 0 && (labelFloor = Math.max(labelFloor, view.labelKeep ?? 0, intrinsicColumnWidth(labelColumn, widthRows, {
|
|
2604
|
-
...context,
|
|
2605
|
-
hint: void 0,
|
|
2606
|
-
labelLines: options.rowLabelLines ?? 2
|
|
2607
|
-
}) + labelLead + (view.groupEnd?.has(labelColumn.id) ? 1 : 0)));
|
|
2608
|
-
let wrapFloors = [], wouldWrap = cols.filter((col) => {
|
|
2609
|
-
if (col.kind !== "text" || col.wrap || col.width !== void 0) return !1;
|
|
2610
|
-
let floor = wrapFloorWidth(col, widthRows, measure(columnHeaderText(col), faces.header).width, context);
|
|
2611
|
-
return floor >= minimumWidths[columnIndex.get(col.id)] ? !1 : (wrapFloors[columnIndex.get(col.id)] = floor, !0);
|
|
2612
|
-
});
|
|
2613
|
-
return { widths, minimumWidths, context, wouldWrap, wrapFloors, chipFloor, labelFloor, wrappedOneLines };
|
|
2614
|
-
}
|
|
2615
|
-
function labelWrapFloor(col, faces) {
|
|
2616
|
-
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));
|
|
2617
|
-
for (let row of rows) {
|
|
2618
|
-
let cell = row.cells[col.id];
|
|
2619
|
-
if (row.role === "section" || row.inline === !0 || !cell?.displayed) continue;
|
|
2620
|
-
let font = cellFont(cell), indent = rowIndent(indentStep(cell));
|
|
2621
|
-
if (text = Math.max(text, indent + lineBlockWidth(cell.displayed, options.rowLabelLines ?? 2, font, measure, !0)), row.unitAffix !== void 0 && !(row.kind === "member" && open.has(row.id))) {
|
|
2622
|
-
let unitFont = theme.table?.qualifier === void 0 ? { ...inlineFont2(row.step, !1), ...font.style ? { style: font.style } : {} } : qualifierFont(font, theme);
|
|
2623
|
-
unit = Math.max(unit, indent + measure(row.unitAffix, unitFont).width);
|
|
2624
|
-
}
|
|
2625
|
-
for (let line of visibleInlineRows(row, options.inlineVisibility))
|
|
2626
|
-
line.label && (text = Math.max(text, indent + INLINE_LABEL_INDENT + measure(line.label, changeLineFont(theme, ladder, row.step)).width));
|
|
2627
|
-
}
|
|
2628
|
-
return Math.ceil(Math.max(text + 2 * cellPadX2, unit + cellPadX2));
|
|
2629
|
-
}
|
|
2630
|
-
function chipSpan(target) {
|
|
2631
|
-
return cols.slice(cols.indexOf(labelColumn)).reduce((sum, col) => sum + (target[columnIndex.get(col.id)] ?? 0), 0);
|
|
2632
|
-
}
|
|
2633
|
-
let sumOf = (values) => values.reduce((a, b) => a + b, spacerTotal), oneLineLabelWidth, uncutLabelWidth = () => oneLineLabelWidth ??= Math.ceil(Math.max(0, maxOf(rows.map((row) => {
|
|
2634
|
-
let cell = row.cells[labelColumn.id];
|
|
2635
|
-
if (row.role === "section" || !cell?.displayed) return 0;
|
|
2636
|
-
let font = cellFont(cell);
|
|
2637
|
-
return measure(cell.displayed, font).width + affixRoom(row, font) + rowIndent(indentStep(cell)) + 2 * cellPadX2;
|
|
2638
|
-
})))), regular = trackWidths(regularFonts), denseFonts = cols.length >= DENSE_COLUMNS ? tableFonts(theme, ladder, cols.length) : void 0, dense = denseFonts === void 0 ? void 0 : denseFonts.header.letterSpacing === regularFonts.header.letterSpacing ? regular : trackWidths(denseFonts), sizing = dense ?? regular, reach = spacerTotal;
|
|
2639
|
-
for (let index = 0; index < cols.length; index++) {
|
|
2640
|
-
let col = cols[index], width = sizing.widths[index] ?? 0, minimum = sizing.minimumWidths[index] ?? width;
|
|
2641
|
-
reach += col.kind !== "rowLabel" && col.kind !== "text" ? wideTable ? Math.min(width, minimum) : width : Math.min(width, shrinkFloorWidth(col, wideTable, sizing.minimumWidths[index], sizing.labelFloor), col.kind === "rowLabel" ? minimum : width);
|
|
2642
|
-
}
|
|
2643
|
-
let minimumW = Math.max(sumOf(sizing.minimumWidths), reach), wrapMinimumWidth = dense === void 0 && table.columnGroups.length === 0 && regular.chipFloor === 0 ? cols.reduce((sum, _col, index) => sum + (regular.wrapFloors[index] ?? regular.minimumWidths[index]), spacerTotal) : void 0, regularHeadsFit = dense === void 0 || headsFit(
|
|
2644
|
-
cols,
|
|
2645
|
-
table.columnGroups,
|
|
2646
|
-
(id) => regular.widths[columnIndex.get(id)] ?? 0,
|
|
2647
|
-
figures,
|
|
2648
|
-
regular.context,
|
|
2649
|
-
headingFaces(regularFonts),
|
|
2650
|
-
groupCell
|
|
2651
|
-
), columnIds = cols.map((col) => col.id), indices = cols.map((_col, index) => index), labelIndices = indices.filter((index) => cols[index].kind === "rowLabel" && (!view.scroll || cols[index].width === void 0)), textIndices = view.scroll ? [] : indices.filter((index) => cols[index].kind === "text"), compactIndices = view.scroll ? [] : indices.filter((index) => cols[index].kind !== "rowLabel" && cols[index].kind !== "text"), growingIndices = indices.filter((index) => {
|
|
2652
|
-
let col = cols[index];
|
|
2653
|
-
return col.width === void 0 && (col.kind === "value" || col.kind === "computed") && (figures || !heatColumn(col));
|
|
2654
|
-
});
|
|
2655
|
-
return { cols, columnIds, columnIndex, indices, labelIndices, textIndices, compactIndices, growingIndices, rows, widthRows, spacerBefore, spacerTotal, figures, wideTable, cellPadX: cellPadX2, labelColumn, labelLead, groupCell, headingFaces, regularFonts, cellStep, indentStep, childCount, indents, operatorSlot, rowIndent, cellFont, affixRoom, columnHeaderText, chipSpan, sumOf, hasChanges, uncutLabelWidth, regular, dense, minimumW, wrapMinimumWidth, regularHeadsFit };
|
|
2656
|
-
}
|
|
2657
|
-
var measuredTables = /* @__PURE__ */ new WeakMap(), measureIds = /* @__PURE__ */ new WeakMap(), nextMeasureId = 0, measureId = (fn) => {
|
|
2658
|
-
if (fn === void 0) return;
|
|
2659
|
-
let id = measureIds.get(fn);
|
|
2660
|
-
return id === void 0 && measureIds.set(fn, id = nextMeasureId++), id;
|
|
2661
|
-
};
|
|
2662
|
-
function measurementTheme(theme) {
|
|
2663
|
-
let table = theme.table;
|
|
2664
|
-
return [
|
|
2665
|
-
theme.type,
|
|
2666
|
-
table?.head && [table.head.size, table.head.weight, table.head.tracking, table.head.case],
|
|
2667
|
-
table?.section && [table.section.size, table.section.weight, table.section.tracking, table.section.case],
|
|
2668
|
-
table?.fixedType,
|
|
2669
|
-
table?.rows !== void 0,
|
|
2670
|
-
table?.weights,
|
|
2671
|
-
table?.driver?.italic,
|
|
2672
|
-
table?.qualifier,
|
|
2673
|
-
table?.operator?.width
|
|
2674
|
-
];
|
|
2675
|
-
}
|
|
2676
|
-
function prepareWidthTypography(table, theme, options, cols, rows, widthRows) {
|
|
2677
|
-
let ladder = levelLadder(theme, options.density ?? "regular", options.target, textScaleOf(options)), regularFonts = tableFonts(theme, ladder), rowById = new Map([...widthRows, ...rows].map((row) => [row.id, row])), colById = new Map(cols.map((col) => [col.id, col])), 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), inlineFont2 = (level, signed) => inlineFont(theme, ladder, level, signed), cellIndex = /* @__PURE__ */ new Map(), cellFonts = [];
|
|
2678
|
-
function makeCellFont(cell) {
|
|
2679
|
-
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);
|
|
2680
|
-
if (cell.role === "total" && cell.kind !== "rowLabel" && totalFace) return regularFonts.totalValue;
|
|
2681
|
-
let font = kindFont(rowFont(theme, ladder, regularFonts, cell.role, cellStep(cell), row?.hasChildren === !0, hasChanges.has(cell.rowId)), kind, cell.kind === "rowLabel", theme);
|
|
2682
|
-
return cell.state === "value" ? strongColumnFont(font, colById.get(cell.colId), cell, kind, theme) : font;
|
|
2683
|
-
}
|
|
2684
|
-
for (let row of rowById.values()) for (let col of cols) {
|
|
2685
|
-
let cell = row.cells[col.id];
|
|
2686
|
-
cell === void 0 || cellIndex.has(cell) || (cellIndex.set(cell, cellFonts.length), cellFonts.push(makeCellFont(cell)));
|
|
2687
|
-
}
|
|
2688
|
-
function cellFont(cell) {
|
|
2689
|
-
let index = cellIndex.get(cell);
|
|
2690
|
-
return index === void 0 ? makeCellFont(cell) : cellFonts[index];
|
|
2691
|
-
}
|
|
2692
|
-
let bodyWidths = {
|
|
2693
|
-
columnIndex: new Map(cols.map((col, index) => [col.id, index])),
|
|
2694
|
-
columns: cols.map(() => [])
|
|
2695
|
-
};
|
|
2696
|
-
return { ladder, regularFonts, cellStep, indentStep, childCount, cellFont, inlineFont: inlineFont2, hasChanges, bodyWidths };
|
|
2697
|
-
}
|
|
2698
|
-
var measuredBodies = /* @__PURE__ */ new WeakMap();
|
|
2699
|
-
function measuredTypography(table, theme, measure, options, view, cols, rows, widthRows) {
|
|
2700
|
-
let key = JSON.stringify([
|
|
2701
|
-
measurementTheme(theme),
|
|
2702
|
-
measureId(measure),
|
|
2703
|
-
measureId(view.slack),
|
|
2704
|
-
// Ordinary densities change row air only. Cohort densities also change the measured type.
|
|
2705
|
-
isCohortDensity(options.density ?? "regular") ? options.density : void 0,
|
|
2706
|
-
options.target,
|
|
2707
|
-
textScaleOf(options),
|
|
2708
|
-
options.inlineVisibility,
|
|
2709
|
-
cols.map((col) => col.id),
|
|
2710
|
-
rows.map((row) => row.id),
|
|
2711
|
-
widthRows.map((row) => row.id)
|
|
2712
|
-
]), variants = measuredBodies.get(table);
|
|
2713
|
-
variants || measuredBodies.set(table, variants = /* @__PURE__ */ new Map());
|
|
2714
|
-
let measured = variants.get(key);
|
|
2715
|
-
return measured || (variants.size >= 64 && variants.delete(variants.keys().next().value), variants.set(key, measured = prepareWidthTypography(table, theme, options, cols, rows, widthRows))), measured;
|
|
2716
|
-
}
|
|
2717
|
-
function measuredTable(table, theme, measure, options, view) {
|
|
2718
|
-
let ids = (entries) => entries?.map((entry) => entry.id), key = JSON.stringify([
|
|
2719
|
-
measurementTheme(theme),
|
|
2720
|
-
measureId(measure),
|
|
2721
|
-
measureId(view.slack),
|
|
2722
|
-
isCohortDensity(options.density ?? "regular") ? options.density : void 0,
|
|
2723
|
-
options.target,
|
|
2724
|
-
textScaleOf(options),
|
|
2725
|
-
options.cellPadX,
|
|
2726
|
-
options.labelIndent,
|
|
2727
|
-
options.outlineMarks,
|
|
2728
|
-
options.figures,
|
|
2729
|
-
options.inlineVisibility,
|
|
2730
|
-
options.rowLabelLines,
|
|
2731
|
-
options[LABEL_WRAP_FLOOR],
|
|
2732
|
-
ids(view.columns),
|
|
2733
|
-
ids(view.rows),
|
|
2734
|
-
ids(view.widthRows),
|
|
2735
|
-
ids(view.fullRows),
|
|
2736
|
-
ids(view.allColumns),
|
|
2737
|
-
view.spacerTotal,
|
|
2738
|
-
view.scroll,
|
|
2739
|
-
view.headLines,
|
|
2740
|
-
view.headGlue,
|
|
2741
|
-
view.withMarks,
|
|
2742
|
-
view.trailingTracking,
|
|
2743
|
-
view.sortable && [...view.sortable],
|
|
2744
|
-
view.groupStart && [...view.groupStart],
|
|
2745
|
-
view.groupEnd && [...view.groupEnd],
|
|
2746
|
-
view.leadWidth,
|
|
2747
|
-
view.labelKeep
|
|
2748
|
-
]), variants = measuredTables.get(table);
|
|
2749
|
-
variants || measuredTables.set(table, variants = /* @__PURE__ */ new Map());
|
|
2750
|
-
let measured = variants.get(key);
|
|
2751
|
-
return measured || (variants.size >= 64 && variants.delete(variants.keys().next().value), variants.set(key, measured = measureTableTracks(table, theme, measure, options, view))), measured;
|
|
2752
|
-
}
|
|
2753
|
-
function prepareTableWidthRung(table, theme, measure, options, view) {
|
|
2754
|
-
return { table, theme, measure, options, view, measured: measuredTable(table, theme, measure, options, view) };
|
|
2755
|
-
}
|
|
2756
|
-
function solveTableWidthRung(rung, available, options = rung.options, probe) {
|
|
2757
|
-
let { table, theme, measure, view } = rung, { cols, columnIds, columnIndex, indices, labelIndices, textIndices, compactIndices, growingIndices, widthRows, spacerBefore, spacerTotal, figures, wideTable, cellPadX: cellPadX2, labelColumn, labelLead, groupCell, headingFaces, regularFonts, cellStep, indentStep, childCount, indents, operatorSlot, rowIndent, cellFont, columnHeaderText, chipSpan, sumOf, hasChanges, uncutLabelWidth, regular, dense, minimumW, wrapMinimumWidth, regularHeadsFit } = rung.measured, warnings = [], chosen = dense !== void 0 && (!regularHeadsFit || !view.scroll && sumOf(regular.widths) > available) ? dense : regular, fonts = chosen.context.fonts, widths = chosen.widths.slice(), minimumWidths = chosen.minimumWidths, sizingMinimums = (dense ?? regular).minimumWidths;
|
|
2758
|
-
if (view.scroll && view.fit === void 0 && Number.isFinite(available) && chosen.wrappedOneLines.length > 0) {
|
|
2759
|
-
let want = chosen.wrappedOneLines.reduce((sum, entry) => sum + Math.max(0, entry.width - widths[entry.index]), 0), share = Math.max(0, Math.min(want, available - sumOf(widths)));
|
|
2760
|
-
if (share > 0) for (let { index, width: oneLine } of chosen.wrappedOneLines) {
|
|
2761
|
-
let natural = widths[index];
|
|
2762
|
-
widths[index] = Math.floor(natural + share * Math.max(0, oneLine - natural) / want);
|
|
2763
|
-
}
|
|
2764
|
-
}
|
|
2765
|
-
let totalW = sumOf(widths);
|
|
2766
|
-
if (probe && !view.scroll && options.cellPadX !== void 0 && cellPadX2 === probe.footerInset && probe.canvasWidth < probe.canvasWidth - available + minimumW)
|
|
2767
|
-
return { widthMiss: !0, minimumW, totalW, cellPadX: cellPadX2 };
|
|
2768
|
-
if (totalW > available && labelIndices.length + textIndices.length > 0) {
|
|
2769
|
-
let deficit = totalW - available, beforeShrink = widths.slice(), floorOf = (index) => view.scroll ? chosen.labelFloor : shrinkFloorWidth(cols[index], wideTable, minimumWidths[index], chosen.labelFloor);
|
|
2770
|
-
for (let index of labelIndices) {
|
|
2771
|
-
let take = Math.min(deficit, Math.max(0, widths[index] - Math.max(minimumWidths[index], view.scroll ? view.labelKeep ?? 0 : 0)));
|
|
2772
|
-
take > 0 && (widths[index] = widths[index] - take, deficit -= take);
|
|
2773
|
-
}
|
|
2774
|
-
for (let kind of ["text", "rowLabel"]) {
|
|
2775
|
-
if (deficit <= 0) break;
|
|
2776
|
-
let shrinkable = (kind === "text" ? textIndices : labelIndices).map((index) => ({
|
|
2777
|
-
index,
|
|
2778
|
-
room: Math.max(0, widths[index] - floorOf(index))
|
|
2779
|
-
})).filter((f) => f.room > 0), totalRoom = shrinkable.reduce((a, f) => a + f.room, 0);
|
|
2780
|
-
if (totalRoom <= 0) continue;
|
|
2781
|
-
let take = Math.min(deficit, totalRoom);
|
|
2782
|
-
for (let f of shrinkable) {
|
|
2783
|
-
let cut2 = take * f.room / totalRoom;
|
|
2784
|
-
widths[f.index] = Math.round(widths[f.index] - cut2);
|
|
2785
|
-
}
|
|
2786
|
-
deficit -= take;
|
|
2787
|
-
}
|
|
2788
|
-
if (deficit <= 0) {
|
|
2789
|
-
let flex = indices.filter((index) => labelIndices.includes(index) || textIndices.includes(index));
|
|
2790
|
-
for (let over = Math.ceil(sumOf(widths) - available); over > 0; over--) {
|
|
2791
|
-
let roomOf2 = (index) => widths[index] - floorOf(index), widest = flex.reduce((best, index) => best === void 0 || roomOf2(index) > roomOf2(best) ? index : best, void 0);
|
|
2792
|
-
if (widest === void 0 || roomOf2(widest) < 1) break;
|
|
2793
|
-
widths[widest] = widths[widest] - 1;
|
|
2794
|
-
}
|
|
2795
|
-
}
|
|
2796
|
-
let remaining = Math.ceil(sumOf(widths) - available);
|
|
2797
|
-
if (remaining > 0 && wideTable) {
|
|
2798
|
-
let compactable = compactIndices;
|
|
2799
|
-
for (; remaining > 0; ) {
|
|
2800
|
-
let open = compactable.filter((index) => widths[index] > minimumWidths[index]);
|
|
2801
|
-
if (open.length === 0) break;
|
|
2802
|
-
let rounds = Math.max(1, Math.min(Math.floor(remaining / open.length), ...open.map((index) => Math.ceil(widths[index] - minimumWidths[index]))));
|
|
2803
|
-
for (let index of open) {
|
|
2804
|
-
if (remaining <= 0) break;
|
|
2805
|
-
widths[index] = widths[index] - rounds, remaining -= rounds;
|
|
2806
|
-
}
|
|
2807
|
-
}
|
|
2808
|
-
}
|
|
2809
|
-
let printsUncut = (col) => col.wrap ? minimumWidths[columnIndex.get(col.id)] : intrinsicColumnWidth(col, widthRows, { ...chosen.context, hint: void 0, labelLines: 2 }), flexText = textIndices.map((index) => cols[index]).filter((col) => col.width === void 0), gapOf = (col) => ({ id: col.id, gap: printsUncut(col) - widths[columnIndex.get(col.id)] }), cutGaps = flexText.filter((col) => widths[columnIndex.get(col.id)] < beforeShrink[columnIndex.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) => [
|
|
2810
|
-
group.id,
|
|
2811
|
-
cols.filter((col) => group.columnIds.includes(col.id)).reduce((sum, col) => sum + widths[columnIndex.get(col.id)], 0) - groupHeadingNeed(group, groupFaces, measure, groupCell)
|
|
2812
|
-
])), donors = gaps.filter((entry) => entry.gap < 0).map((entry) => ({
|
|
2813
|
-
id: entry.id,
|
|
2814
|
-
slack: Math.floor(-entry.gap),
|
|
2815
|
-
groups: table.columnGroups.filter((group) => spare.has(group.id) && group.columnIds.includes(entry.id))
|
|
2816
|
-
})), 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) => {
|
|
2817
|
-
let take = Math.min(amount, roomOf(donor));
|
|
2818
|
-
widths[columnIndex.get(donor.id)] = widths[columnIndex.get(donor.id)] - take, donor.slack -= take;
|
|
2819
|
-
for (let group of donor.groups) spare.set(group.id, spare.get(group.id) - take);
|
|
2820
|
-
moved += take;
|
|
2821
|
-
};
|
|
2822
|
-
if (move > 0) {
|
|
2823
|
-
donors.forEach((donor, index) => cut(donor, Math.floor(move * rooms[index] / given)));
|
|
2824
|
-
for (let progress = !0; progress && moved < move; ) {
|
|
2825
|
-
progress = !1;
|
|
2826
|
-
for (let donor of donors) moved < move && roomOf(donor) > 0 && (cut(donor, 1), progress = !0);
|
|
2827
|
-
}
|
|
2828
|
-
let toTake = moved;
|
|
2829
|
-
for (let [index, entry] of wants.entries()) {
|
|
2830
|
-
let add = index === wants.length - 1 ? toTake : Math.min(toTake, Math.floor(moved * entry.gap / wanted));
|
|
2831
|
-
widths[columnIndex.get(entry.id)] = widths[columnIndex.get(entry.id)] + add, toTake -= add;
|
|
2832
|
-
}
|
|
2833
|
-
}
|
|
2834
|
-
labelColumn !== void 0 && chipSpan(widths) < chosen.chipFloor && (widths[columnIndex.get(labelColumn.id)] = widths[columnIndex.get(labelColumn.id)] + chosen.chipFloor - chipSpan(widths));
|
|
2835
|
-
}
|
|
2836
|
-
let narrowed = cols.some((col) => col.width !== void 0 && (figures || !heatColumn(col)) && widths[columnIndex.get(col.id)] < col.width);
|
|
2837
|
-
if (narrowed || sumOf(widths) > available) {
|
|
2838
|
-
let margin = resolveCanvasOptions(options).margin, frameWidth = Math.ceil(totalW);
|
|
2839
|
-
for (let pass = 0; pass < 4; pass++) {
|
|
2840
|
-
let sides = { ...canvasMargin(theme, frameWidth), ...margin }, next = Math.ceil(totalW + sides.left + sides.right);
|
|
2841
|
-
if (next === frameWidth) break;
|
|
2842
|
-
frameWidth = next;
|
|
2843
|
-
}
|
|
2844
|
-
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;
|
|
2845
|
-
warnings.push({
|
|
2846
|
-
code: "table-overflow",
|
|
2847
|
-
severity: "warn",
|
|
2848
|
-
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`,
|
|
2849
|
-
field: ["options", "size"],
|
|
2850
|
-
detail: { naturalWidth: frameWidth },
|
|
2851
|
-
suggest: `Set the frame width to ${frameWidth} px or more.`,
|
|
2852
|
-
fix: [{ op: "add", path: "/options/size", value: { width: frameWidth, ...height === void 0 ? {} : { height } } }]
|
|
2853
|
-
});
|
|
2854
|
-
}
|
|
2855
|
-
let grownFrom = [], grow = (id, add) => {
|
|
2856
|
-
let index = columnIndex.get(id);
|
|
2857
|
-
grownFrom[index] === void 0 && (grownFrom[index] = widths[index]), widths[index] = widths[index] + add;
|
|
2858
|
-
}, room = Number.isFinite(available) ? Math.floor(available - sumOf(widths)) : 1 / 0;
|
|
2859
|
-
if (Number.isFinite(available) && options.frameFill !== "none")
|
|
2860
|
-
for (let col of cols) {
|
|
2861
|
-
if (room < 1) break;
|
|
2862
|
-
if (col.width === void 0 || col.kind !== "value" && col.kind !== "computed" || !figures && heatColumn(col)) continue;
|
|
2863
|
-
let add = Math.min(room, Math.ceil(minimumWidths[columnIndex.get(col.id)] - widths[columnIndex.get(col.id)]));
|
|
2864
|
-
add < 1 || (grow(col.id, add), room -= add);
|
|
2865
|
-
}
|
|
2866
|
-
for (let [id, short] of groupHeadingFloors(table.columnGroups, columnIds, (member) => widths[columnIndex.get(member)] ?? 0, () => !1, headingFaces(fonts), measure, groupCell)) {
|
|
2867
|
-
let add = options.frameFill === "none" ? 0 : Math.max(0, Math.min(room, Math.ceil(short)));
|
|
2868
|
-
add >= 1 && (grow(id, add), room -= add);
|
|
2869
|
-
let group = table.columnGroups.find((candidate) => candidate.columnIds.includes(id)), wraps = () => !view.scroll && groupHeadingWrap(
|
|
2870
|
-
group,
|
|
2871
|
-
headingFaces(fonts),
|
|
2872
|
-
measure,
|
|
2873
|
-
cols.filter((col) => group.columnIds.includes(col.id)).reduce((sum, col) => sum + widths[columnIndex.get(col.id)], 0) - 2 * cellPadX2 - (groupCell.startRule?.(group.id) ?? 0)
|
|
2874
|
-
) !== void 0;
|
|
2875
|
-
short - add > 0.5 && !wraps() && warnings.push({
|
|
2876
|
-
code: "table-group-heading-overflow",
|
|
2877
|
-
severity: "warn",
|
|
2878
|
-
message: `column group '${group.id}' heading needs ${Math.ceil(short - add)} px more than its columns' authored widths; it runs past the block`,
|
|
2879
|
-
suggest: "Shorten the heading or its note, widen a column of the group, or give the table a wider frame."
|
|
2880
|
-
});
|
|
2881
|
-
}
|
|
2882
|
-
for (let col of cols) if (figures || !heatColumn(col)) {
|
|
2883
|
-
let grown = grownFrom[columnIndex.get(col.id)], track = grown ?? widths[columnIndex.get(col.id)], minimum = col.kind === "rowLabel" && col.width !== void 0 && minimumWidths[columnIndex.get(col.id)] > track ? intrinsicColumnWidth(col, widthRows, { ...chosen.context, labelLines: options.rowLabelLines ?? 2 }) : minimumWidths[columnIndex.get(col.id)], found = authoredWidthWarnings(col, table.columns.findIndex((authored) => authored.id === col.id), track, minimum, chosen.context);
|
|
2884
|
-
warnings.push(...grown === void 0 ? found : found.filter((warning) => warning.code === "table-column-widened" || widths[columnIndex.get(col.id)] < minimumWidths[columnIndex.get(col.id)]));
|
|
2885
|
-
}
|
|
2886
|
-
let rowToFrame = (options.rowExtent ?? "frame") === "frame";
|
|
2887
|
-
if (Number.isFinite(available) && options.lastTrackFlex === !0 && !rowToFrame && cols.length > 0) {
|
|
2888
|
-
let slack = available - sumOf(widths), lastCol = cols[cols.length - 1];
|
|
2889
|
-
slack > 0 && lastCol.width === void 0 && (widths[columnIndex.get(lastCol.id)] = widths[columnIndex.get(lastCol.id)] + slack);
|
|
2890
|
-
}
|
|
2891
|
-
let beforeFill = widths.slice();
|
|
2892
|
-
if (Number.isFinite(available) && rowToFrame && options.frameFill !== "none") {
|
|
2893
|
-
let extras = frameFillAmounts(growingIndices.map((index) => widths[index]), available - sumOf(widths), options.maxGrowth);
|
|
2894
|
-
for (let item = 0; item < extras.values.length; item++) {
|
|
2895
|
-
let index = growingIndices[item];
|
|
2896
|
-
widths[index] = widths[index] + extras.values[item];
|
|
2897
|
-
}
|
|
2898
|
-
if (labelColumn !== void 0 && labelColumn.width === void 0 && extras.remainder > 0) {
|
|
2899
|
-
let index = columnIndex.get(labelColumn.id), extra = labelColumn.maxWidth === void 0 ? extras.remainder : Math.max(0, Math.min(extras.remainder, labelColumn.maxWidth - widths[index]));
|
|
2900
|
-
widths[index] = widths[index] + extra;
|
|
2901
|
-
}
|
|
2902
|
-
}
|
|
2903
|
-
let labelNeed;
|
|
2904
|
-
if (labelColumn !== void 0 && labelColumn.width === void 0) {
|
|
2905
|
-
let labelId = labelColumn.id, need = view.scroll ? intrinsicColumnWidth(
|
|
2906
|
-
{ ...labelColumn, maxWidth: void 0, maxTextWidth: void 0 },
|
|
2907
|
-
widthRows,
|
|
2908
|
-
{ ...chosen.context, hint: void 0 }
|
|
2909
|
-
) + labelLead : uncutLabelWidth(), cap = labelColumn.maxWidth !== void 0 && options[SOFT_LABEL_CAP] !== !0 ? labelColumn.maxWidth : 1 / 0;
|
|
2910
|
-
labelNeed = Math.min(need, cap);
|
|
2911
|
-
let short = labelNeed - widths[columnIndex.get(labelId)];
|
|
2912
|
-
if (short > 0) {
|
|
2913
|
-
let outside = Number.isFinite(available) ? Math.min(short, Math.max(0, Math.floor(available - sumOf(widths)))) : 0;
|
|
2914
|
-
widths[columnIndex.get(labelId)] = widths[columnIndex.get(labelId)] + outside, short -= outside;
|
|
2915
|
-
let grown = cols.filter((col) => col.id !== labelId && widths[columnIndex.get(col.id)] > beforeFill[columnIndex.get(col.id)]), total = grown.reduce((sum, col) => sum + widths[columnIndex.get(col.id)] - beforeFill[columnIndex.get(col.id)], 0), take = Math.min(short, Math.floor(total)), left = take;
|
|
2916
|
-
for (let [index, col] of grown.entries()) {
|
|
2917
|
-
let extra = widths[columnIndex.get(col.id)] - beforeFill[columnIndex.get(col.id)], back = index === grown.length - 1 ? Math.min(left, Math.floor(extra)) : Math.min(left, Math.floor(take * extra / total));
|
|
2918
|
-
widths[columnIndex.get(col.id)] = widths[columnIndex.get(col.id)] - back, left -= back;
|
|
2919
|
-
}
|
|
2920
|
-
widths[columnIndex.get(labelId)] = widths[columnIndex.get(labelId)] + take - left;
|
|
2921
|
-
}
|
|
2922
|
-
}
|
|
2923
|
-
let tracks = columnTracks((view.allColumns ?? cols).map((col) => ({ id: col.id, natural: widths[columnIndex.get(col.id)] ?? 0 })), {
|
|
2924
|
-
fit: rowToFrame ? "content" : view.fit,
|
|
2925
|
-
available: Number.isFinite(available) && (!view.scroll || view.fit !== void 0) ? Math.max(0, available - spacerTotal) : void 0,
|
|
2926
|
-
anchorId: (view.allColumns ?? cols)[0]?.id,
|
|
2927
|
-
hidden: view.allColumns === void 0 ? void 0 : new Set(view.allColumns.filter((col) => !columnIndex.has(col.id)).map((col) => col.id)),
|
|
2928
|
-
fixed: new Set(cols.filter((col) => col.width !== void 0 || !figures && heatColumn(col)).map((col) => col.id)),
|
|
2929
|
-
...options.maxGrowth === !1 ? {} : { maxGrowth: options.maxGrowth ?? DEFAULT_TRACK_GROWTH }
|
|
2930
|
-
}), labelsWrap = labelColumn !== void 0 && labelNeed !== void 0 && widths[columnIndex.get(labelColumn.id)] < labelNeed, gridTracks = tracks.flatMap((track, index) => {
|
|
2931
|
-
let spacer = spacerBefore.get(track.id), drawn = index === 0 && (view.frameStart ?? 0) > 0 ? { ...track, width: track.width + view.frameStart } : track;
|
|
2932
|
-
return spacer === void 0 ? [drawn] : [{ id: `bp-spacer:${track.id}`, natural: spacer, width: spacer }, drawn];
|
|
2933
|
-
}), labelBeforeFill = labelColumn === void 0 ? void 0 : beforeFill[columnIndex.get(labelColumn.id)];
|
|
2934
|
-
return {
|
|
2935
|
-
tracks,
|
|
2936
|
-
gridTracks,
|
|
2937
|
-
spacerBefore,
|
|
2938
|
-
spacerTotal,
|
|
2939
|
-
labelNeed,
|
|
2940
|
-
labelBeforeFill,
|
|
2941
|
-
labelsWrap,
|
|
2942
|
-
columnIndex,
|
|
2943
|
-
widths,
|
|
2944
|
-
minimumWidths,
|
|
2945
|
-
sizingMinimums,
|
|
2946
|
-
totalW,
|
|
2947
|
-
minimumW,
|
|
2948
|
-
fonts,
|
|
2949
|
-
regularFonts,
|
|
2950
|
-
context: chosen.context.theme === theme ? chosen.context : { ...chosen.context, theme },
|
|
2951
|
-
wouldWrap: (dense ?? regular).wouldWrap,
|
|
2952
|
-
wrapMinimumWidth,
|
|
2953
|
-
warnings,
|
|
2954
|
-
cellPadX: cellPadX2,
|
|
2955
|
-
rowIndent,
|
|
2956
|
-
cellFont,
|
|
2957
|
-
cellStep,
|
|
2958
|
-
indentStep,
|
|
2959
|
-
columnHeaderText,
|
|
2960
|
-
indents,
|
|
2961
|
-
operatorSlot,
|
|
2962
|
-
childCount,
|
|
2963
|
-
hasChanges
|
|
2964
|
-
};
|
|
2965
|
-
}
|
|
2966
|
-
function materializeTableWidthPlan(plan) {
|
|
2967
|
-
let { columnIndex, ...rest } = plan, map = (values) => new Map([...columnIndex].map(([id, index]) => [id, values[index]]));
|
|
2968
|
-
return { ...rest, widths: map(plan.widths), minimumWidths: map(plan.minimumWidths), sizingMinimums: map(plan.sizingMinimums) };
|
|
2969
|
-
}
|
|
2970
|
-
function tableWidthsOnce(table, theme, measure, options = {}, view = {}, probe) {
|
|
2971
|
-
let result = solveTableWidthRung(prepareTableWidthRung(table, theme, measure, options, view), view.available ?? 1 / 0, options, probe);
|
|
2972
|
-
return result.widthMiss === !0 ? result : materializeTableWidthPlan(result);
|
|
2973
|
-
}
|
|
2974
|
-
function shrinkFloorWidth(col, wideTable, minimumWidth, labelFloor = 0) {
|
|
2975
|
-
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, minimumWidth ?? FLEX_MIN) : FLEX_MIN;
|
|
2976
|
-
}
|
|
2977
|
-
function tableDisplayFloor(table, theme, options, target, width, frame) {
|
|
2978
|
-
let ladder = levelLadder(theme, options.density ?? "regular", target, textScaleOf(options)), fonts = tableFonts(theme, ladder), floors = targetFloorsPx(target), scale = 0.9, include = (size, role) => {
|
|
2979
|
-
scale = Math.max(scale, floors[role] / size);
|
|
2980
|
-
};
|
|
2981
|
-
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");
|
|
2982
|
-
let includeHead = (size) => {
|
|
2983
|
-
scale = Math.max(scale, tableHeadFloorPx(target) / size);
|
|
2984
|
-
};
|
|
2985
|
-
options.columnHeads !== !1 && (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));
|
|
2986
|
-
for (let row of table.rows) {
|
|
2987
|
-
if (row.inline) continue;
|
|
2988
|
-
let hasChanges = visibleInlineRows(row, options.inlineVisibility).length > 0;
|
|
2989
|
-
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");
|
|
2990
|
-
for (let cell of Object.values(row.cells))
|
|
2991
|
-
cell.kind === "status" && include(fonts.chip.size, "label"), cell.note && include(ladder.inlineSize(), "footnote");
|
|
2992
|
-
}
|
|
2993
|
-
return { target, minDisplayWidth: width * scale };
|
|
2994
|
-
}
|
|
2995
|
-
function belowTableViewportFloor(authoredSize) {
|
|
2996
|
-
if (authoredSize === void 0) return !1;
|
|
2997
|
-
let size = resolveSize(authoredSize), sizing = resolveSizing(chartSizing("table"), size), heightAuthored = typeof authoredSize != "object" || authoredSize.height !== void 0;
|
|
2998
|
-
return !fitsSize({ width: size.width, height: heightAuthored ? size.height : 1 / 0 }, sizing);
|
|
2999
|
-
}
|
|
3000
|
-
function tableFrameMode(options) {
|
|
3001
|
-
if (options.mode) return options.mode;
|
|
3002
|
-
if (options.size === void 0) return "full";
|
|
3003
|
-
let size = resolveSize(options.size), sizing = resolveSizing(chartSizing("table"), size);
|
|
3004
|
-
return fitsSize(size, sizing) ? "full" : "compact";
|
|
3005
2587
|
}
|
|
3006
2588
|
|
|
3007
2589
|
export {
|
|
@@ -3010,11 +2592,10 @@ export {
|
|
|
3010
2592
|
INLINE_LINE_RATIO,
|
|
3011
2593
|
LINE_BOX_EPSILON,
|
|
3012
2594
|
levelLadder,
|
|
2595
|
+
tableCellKey,
|
|
2596
|
+
tableCellNodeId,
|
|
2597
|
+
printsInCell,
|
|
3013
2598
|
presetLanguage,
|
|
3014
|
-
printedNumber,
|
|
3015
|
-
arrowGlyph,
|
|
3016
|
-
arrowKey,
|
|
3017
|
-
emitArrow,
|
|
3018
2599
|
heatRanges,
|
|
3019
2600
|
badSide,
|
|
3020
2601
|
heatKey,
|
|
@@ -3025,6 +2606,11 @@ export {
|
|
|
3025
2606
|
prepareTableData,
|
|
3026
2607
|
resolvePreparedTable,
|
|
3027
2608
|
resolveTable,
|
|
2609
|
+
tableFrameUnit,
|
|
2610
|
+
printedNumber,
|
|
2611
|
+
arrowGlyph,
|
|
2612
|
+
arrowKey,
|
|
2613
|
+
emitArrow,
|
|
3028
2614
|
cellHoldsNumber,
|
|
3029
2615
|
numericCell,
|
|
3030
2616
|
cellDrawsTabular,
|
|
@@ -3035,6 +2621,7 @@ export {
|
|
|
3035
2621
|
depthToExpansion,
|
|
3036
2622
|
expansionForFolds,
|
|
3037
2623
|
expansionRootsHidden,
|
|
2624
|
+
EMPTY_ROW_ID,
|
|
3038
2625
|
emptyMessageRow,
|
|
3039
2626
|
visibleRows,
|
|
3040
2627
|
finalClosers,
|
|
@@ -3047,10 +2634,8 @@ export {
|
|
|
3047
2634
|
visibleColumns,
|
|
3048
2635
|
groupSpans,
|
|
3049
2636
|
inCellBarMaxima,
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
belowTableViewportFloor,
|
|
3055
|
-
tableFrameMode
|
|
2637
|
+
isTotalRow,
|
|
2638
|
+
labelOnlyRow,
|
|
2639
|
+
noteLineIndex,
|
|
2640
|
+
cellPrinted
|
|
3056
2641
|
};
|