boardplot 0.56.0 → 0.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +110 -0
- package/README.md +3 -3
- package/dist/{ReaderBox-GLCKYXBU.js → ReaderBox-GCIITQCX.js} +4 -4
- package/dist/{annotateEngine-QVNAE3EH.js → annotateEngine-JMZI6QEG.js} +1 -1
- package/dist/build-identity.json +3 -3
- package/dist/{chunk-CKGSGRP7.js → chunk-26WNBTWB.js} +20 -4
- package/dist/{chunk-UBCVBBJJ.js → chunk-2AJWRVZ2.js} +4 -3
- package/dist/{chunk-XMP2DNLI.js → chunk-2BHLRHF2.js} +2 -2
- package/dist/{chunk-2NRHD2G7.js → chunk-2HD5RY2U.js} +11 -3
- package/dist/{chunk-6QDMRPXI.js → chunk-2I76VFMZ.js} +184 -239
- package/dist/{chunk-XC5IRUEL.js → chunk-2KCK63DD.js} +2 -2
- package/dist/{chunk-ZEYBI47P.js → chunk-2WTD3GCR.js} +11 -3
- package/dist/{chunk-BTDGWHGJ.js → chunk-2X6XY4K4.js} +4 -4
- package/dist/{chunk-5S3JQ5AT.js → chunk-3DUGZ7ML.js} +149 -118
- package/dist/{chunk-JTFKRDDA.js → chunk-3LNVEE5Z.js} +1 -1
- package/dist/{chunk-JCAGVAB3.js → chunk-43PCSBVQ.js} +563 -10
- package/dist/{chunk-F2EVCJ4U.js → chunk-4JNHF6JW.js} +10 -10
- package/dist/{chunk-ECBUFKCP.js → chunk-4RN4OM6I.js} +3 -3
- package/dist/{chunk-A2GAWGVJ.js → chunk-4U2WSW6F.js} +20 -20
- package/dist/{chunk-CCDXK5NA.js → chunk-53OEKS4L.js} +5 -3
- package/dist/{chunk-YPYD6OJ3.js → chunk-54HEIM2A.js} +2 -2
- package/dist/{chunk-IGJ2G5C6.js → chunk-5H4HFRDO.js} +6 -6
- package/dist/{chunk-EMFUZKYK.js → chunk-5HTGSB6Y.js} +3 -3
- package/dist/{chunk-WXJ5MHLH.js → chunk-5JTRCSBN.js} +1 -1
- package/dist/{chunk-67QSW5RW.js → chunk-5P4MXWKP.js} +3 -3
- package/dist/{chunk-EBB4PYBN.js → chunk-5RHP7YTL.js} +5 -5
- package/dist/{chunk-VVXKFU72.js → chunk-5TUDYKNL.js} +35 -27
- package/dist/{chunk-HZUAEMN5.js → chunk-5WSIH4SR.js} +1 -1
- package/dist/{chunk-KF7HD3EH.js → chunk-62JZL6FW.js} +43 -35
- package/dist/{chunk-S7NRL66K.js → chunk-6EE6XEMA.js} +4 -4
- package/dist/chunk-6JXBLQJ2.js +32 -0
- package/dist/{chunk-KBJMLXNW.js → chunk-6KHRMK3I.js} +14 -14
- package/dist/{chunk-2DOEZ5QY.js → chunk-6LQKU6YN.js} +4 -4
- package/dist/chunk-6VU2XI3W.js +89 -0
- package/dist/{chunk-DQ7YMQVX.js → chunk-6WJOHZPW.js} +5 -5
- package/dist/{chunk-ZMPH2OC4.js → chunk-6XU5XGYV.js} +7 -8
- package/dist/{chunk-MAFPVR4G.js → chunk-6ZN2XJFI.js} +10 -5
- package/dist/{chunk-PQLAZEQV.js → chunk-72OJBDRB.js} +204 -59
- package/dist/{chunk-T2YDWT54.js → chunk-73O6AOAA.js} +43 -30
- package/dist/{chunk-4JHMCXOB.js → chunk-76UL4CT4.js} +60 -24
- package/dist/chunk-7BQK2UDV.js +13 -0
- package/dist/{chunk-7PPMT5EJ.js → chunk-7EQU2TUN.js} +300 -64
- package/dist/{chunk-2HTYGMMG.js → chunk-7FAO4ICF.js} +2 -2
- package/dist/{chunk-6WHWXCHJ.js → chunk-7MYJUJZV.js} +6 -2
- package/dist/{chunk-CB4CERXZ.js → chunk-7P7D6WXR.js} +11 -2
- package/dist/{chunk-RT66UTLJ.js → chunk-A33MFWHW.js} +2 -2
- package/dist/{chunk-4JC3SE4G.js → chunk-A6XCVOC5.js} +1 -1
- package/dist/{chunk-QWCLWFKC.js → chunk-AFA32LHN.js} +132 -36
- package/dist/{chunk-T2CYNDYU.js → chunk-AFGQXMKT.js} +235 -80
- package/dist/{chunk-HOU2MZHC.js → chunk-AKJO6N4K.js} +2 -2
- package/dist/{chunk-MRAP2UVV.js → chunk-ANNQJWDX.js} +10 -10
- package/dist/{chunk-LGNJCPFP.js → chunk-AOIZJ7GR.js} +7 -7
- package/dist/chunk-B5A7X2BA.js +44 -0
- package/dist/{chunk-SS4YGK3E.js → chunk-BDCKHLUB.js} +15 -15
- package/dist/{chunk-XHRUXZD7.js → chunk-BFDPY7JM.js} +10 -3
- package/dist/{chunk-BK6P6KMW.js → chunk-BM2A3IGQ.js} +1 -1
- package/dist/{chunk-GQT2SY2S.js → chunk-BO5EJBLH.js} +247 -127
- package/dist/chunk-BQIADGJB.js +23 -0
- package/dist/{chunk-PJBEJR2U.js → chunk-BY5JGQFZ.js} +24 -7
- package/dist/{chunk-SXD3OYAR.js → chunk-C5SQEYTQ.js} +76 -55
- package/dist/{chunk-3465633G.js → chunk-CEMXGMQN.js} +2 -2
- package/dist/{chunk-AMR4SUAN.js → chunk-CIDOL4FO.js} +5 -5
- package/dist/{chunk-E7V3OHQQ.js → chunk-CT4RFZO4.js} +6 -6
- package/dist/{chunk-7Q37C6GZ.js → chunk-CV3NC75L.js} +1 -1
- package/dist/{chunk-FFJGC2DX.js → chunk-D3PQAVFW.js} +22 -12
- package/dist/{chunk-52WNCUIN.js → chunk-D5G67OER.js} +1 -1
- package/dist/{chunk-MOS6WFWM.js → chunk-D5RAVZ5C.js} +6 -7
- package/dist/{chunk-FNRPQIQE.js → chunk-DJBMA4FW.js} +4 -4
- package/dist/{chunk-4DZFR52I.js → chunk-DPUCT567.js} +2 -2
- package/dist/{chunk-TE4M52AA.js → chunk-DYSEZVIJ.js} +18 -2
- package/dist/{chunk-SA46CNMS.js → chunk-ED7GLWTF.js} +4 -1
- package/dist/{chunk-R5MEBBAA.js → chunk-EDBUVDRI.js} +117 -67
- package/dist/{chunk-TUW5IYGA.js → chunk-EEBMK6T6.js} +6 -6
- package/dist/{chunk-RLMC5CUP.js → chunk-EEL2N4Y6.js} +7 -8
- package/dist/{chunk-CF4NMRN7.js → chunk-EFKFZNQC.js} +24 -18
- package/dist/{chunk-UPTXFTKH.js → chunk-EHNGPUTO.js} +6 -6
- package/dist/{chunk-BISJK67O.js → chunk-EHQLLZCQ.js} +48 -21
- package/dist/{chunk-U3A6FMSI.js → chunk-EWR6WVOV.js} +6 -6
- package/dist/{chunk-RMC4OONA.js → chunk-EY4OA4OF.js} +985 -663
- package/dist/{chunk-YYJORENB.js → chunk-F4JAGDPD.js} +5 -5
- package/dist/{chunk-ZY72LSQK.js → chunk-FAFUMSPR.js} +33 -24
- package/dist/{chunk-CYKXROFG.js → chunk-FERP4WS3.js} +19 -9
- package/dist/{chunk-N5HN5QGH.js → chunk-FF7MV4D4.js} +1 -1
- package/dist/{chunk-O7REHICC.js → chunk-FJKFYQ5I.js} +10 -10
- package/dist/chunk-FL3FQ2YA.js +27 -0
- package/dist/{chunk-YOOHNQ3L.js → chunk-FX5VZK5F.js} +4 -0
- package/dist/{chunk-7M2GK7XQ.js → chunk-G5BUGYIL.js} +68 -16
- package/dist/{chunk-QZIHKQRH.js → chunk-G5CELEUR.js} +6 -6
- package/dist/{chunk-ZJFJ2IKQ.js → chunk-GADI2DU7.js} +11 -10
- package/dist/{chunk-F6OLHND5.js → chunk-GAFEN3H7.js} +2 -2
- package/dist/{chunk-GM3EGUYW.js → chunk-GHFTKVJN.js} +1 -1
- package/dist/chunk-GKDUIDU6.js +138 -0
- package/dist/{chunk-OJ5CQV7H.js → chunk-GKQLKUMF.js} +186 -82
- package/dist/{chunk-EGGDPDYJ.js → chunk-GS5UG6QD.js} +1 -1
- package/dist/{chunk-5TWY3ZIC.js → chunk-H2POQ4LB.js} +5 -5
- package/dist/{chunk-KD5GOR2K.js → chunk-H3EWFSWI.js} +93 -52
- package/dist/{chunk-CHAS5A5B.js → chunk-H6EJ63QN.js} +18 -16
- package/dist/{chunk-GIHH6VC2.js → chunk-HB3TH7GY.js} +3 -3
- package/dist/{chunk-FMDNJ6PC.js → chunk-HC6WHTBX.js} +2 -2
- package/dist/{chunk-63Y3ROZ7.js → chunk-HDSHS2QZ.js} +45 -30
- package/dist/{chunk-KTHFHD6C.js → chunk-HFFKN7PA.js} +11 -6
- package/dist/{chunk-QSMGZOT5.js → chunk-HGPFEG2L.js} +7 -8
- package/dist/{chunk-2YO4WRJN.js → chunk-HVX2E26J.js} +35 -25
- package/dist/{chunk-KLB2QC24.js → chunk-I3DLERI7.js} +1 -1
- package/dist/{chunk-SPSGUFTI.js → chunk-I4NUYVP5.js} +1 -1
- package/dist/{chunk-LKMFMNQX.js → chunk-I5ZADE2U.js} +1 -1
- package/dist/{chunk-CPGASWNN.js → chunk-I65OLJ2X.js} +1 -1
- package/dist/{chunk-SRAV6FPB.js → chunk-I6QGYRY4.js} +3 -3
- package/dist/{chunk-NCLRZQR6.js → chunk-I7KDPCC7.js} +3 -3
- package/dist/{chunk-6EYTD777.js → chunk-IFURKTOL.js} +2 -2
- package/dist/{chunk-Y54LU4CU.js → chunk-IPWUBZ4P.js} +1 -1
- package/dist/{chunk-BIGQKCU7.js → chunk-IRXTNSZL.js} +9 -9
- package/dist/{chunk-2FKEF2AC.js → chunk-IUVJVMKS.js} +11 -11
- package/dist/{chunk-ZKJ5L35C.js → chunk-IVQT2E3Y.js} +28 -17
- package/dist/{chunk-7DAH2E4T.js → chunk-IW3YUMPI.js} +2 -2
- package/dist/chunk-IXM6BAM4.js +53 -0
- package/dist/{chunk-YMTXTQCN.js → chunk-IZRTNCJQ.js} +5 -5
- package/dist/{chunk-QGFKSDQO.js → chunk-J22ETKDJ.js} +2 -2
- package/dist/{chunk-HJRNBKIT.js → chunk-JARJP576.js} +3 -3
- package/dist/{chunk-DD6RVD3S.js → chunk-JHWDTV4K.js} +5 -1
- package/dist/{chunk-P4SMC4BY.js → chunk-JIH52I36.js} +79 -79
- package/dist/{chunk-KQCKK3LD.js → chunk-JKXJWCJ5.js} +69 -34
- package/dist/{chunk-WI5VOSQX.js → chunk-JMOBA5ES.js} +2 -2
- package/dist/{chunk-AGDDH6XY.js → chunk-JMXNXLAC.js} +5 -1
- package/dist/{chunk-R2IKOLBK.js → chunk-JRRSKCGG.js} +3 -3
- package/dist/{chunk-IVRYF7QA.js → chunk-JSA3ESEJ.js} +1 -1
- package/dist/{chunk-WBETBGSC.js → chunk-K6Y4HBK7.js} +31 -31
- package/dist/{chunk-Z55DXFWS.js → chunk-KAAB2DIV.js} +23 -13
- package/dist/{chunk-UZLR25BW.js → chunk-KF3ZHLHQ.js} +7 -8
- package/dist/{chunk-GELSK76Y.js → chunk-KGS5Z7SL.js} +3 -3
- package/dist/{chunk-E2ZUBP4Q.js → chunk-KIXNHDXS.js} +7 -8
- package/dist/{chunk-7VMEM3LN.js → chunk-KJLH5EHD.js} +26 -26
- package/dist/{chunk-KLIZXSBK.js → chunk-KLQKHA3T.js} +6 -6
- package/dist/chunk-KQ2WZ6BY.js +11 -0
- package/dist/{chunk-DF3XEFQ7.js → chunk-KUMJI5B6.js} +10 -10
- package/dist/{chunk-SE7MJ2LQ.js → chunk-L2XRUG4P.js} +7 -8
- package/dist/{chunk-JYBT2JNY.js → chunk-LE3LSEUL.js} +27 -2
- package/dist/{chunk-75WIUG2W.js → chunk-LFX5BERN.js} +140 -60
- package/dist/{chunk-MJPXHCBW.js → chunk-LGMV7ZV4.js} +4 -4
- package/dist/{chunk-3V62N3Z7.js → chunk-LO3AGGE3.js} +7 -8
- package/dist/{chunk-7KSUMFBK.js → chunk-LSKCKGCF.js} +5 -1
- package/dist/{chunk-NHC2ADGI.js → chunk-LSR3SBJ4.js} +45 -34
- package/dist/{chunk-V634AXDM.js → chunk-LUZ7HXBT.js} +1 -1
- package/dist/{chunk-5PPQIF4D.js → chunk-LW4ZQGVL.js} +2 -2
- package/dist/{chunk-H3IBJQ5A.js → chunk-M2OQK2FO.js} +1 -1
- package/dist/{chunk-4LTN7SND.js → chunk-M74H7QYD.js} +1 -1
- package/dist/{chunk-TXBO2LWM.js → chunk-MOQFYJ3F.js} +6 -6
- package/dist/{chunk-VPL3JYC6.js → chunk-MQ5EKWIG.js} +51 -9
- package/dist/{chunk-X3KCQEYZ.js → chunk-MTCDGSYW.js} +9 -1
- package/dist/{chunk-FCECYJVA.js → chunk-NCCDEUHD.js} +1 -1
- package/dist/{chunk-IGVAWAOK.js → chunk-NIDH22DI.js} +31 -7
- package/dist/{chunk-5DTCOOLU.js → chunk-NINK4G7U.js} +2 -2
- package/dist/{chunk-HHXIVFAU.js → chunk-NO7GRVUU.js} +10 -8
- package/dist/{chunk-X23SZHV5.js → chunk-NRYERHEI.js} +6 -6
- package/dist/{chunk-V5JQQMFQ.js → chunk-O4D27FKH.js} +1 -1
- package/dist/{chunk-I7H5DU34.js → chunk-O7Y6RJ4D.js} +21 -9
- package/dist/{chunk-2NN676RI.js → chunk-OAT6FWKL.js} +7 -8
- package/dist/{chunk-JHWYG7V5.js → chunk-OF7FMGH5.js} +6 -6
- package/dist/{chunk-GLQ3KCTY.js → chunk-OKM5LYYP.js} +7 -8
- package/dist/{chunk-JCIXYOND.js → chunk-OTGNVAI4.js} +2 -2
- package/dist/{chunk-EIL3KHAL.js → chunk-PSYPB22T.js} +3 -3
- package/dist/{chunk-JXBZIJCG.js → chunk-PYGEIPPH.js} +1 -1
- package/dist/{chunk-KZJ5VM6E.js → chunk-PZ3TQFSY.js} +15 -1
- package/dist/{chunk-K3VZ5QJK.js → chunk-Q7VPTN5X.js} +4 -4
- package/dist/{chunk-ZVM5TFGR.js → chunk-QFIRPOXR.js} +6 -2
- package/dist/{chunk-YHD2FZFP.js → chunk-QHPJ5ZKS.js} +6 -6
- package/dist/{chunk-QLANK3VN.js → chunk-QLWUFEKR.js} +6 -6
- package/dist/{chunk-64LJDGJH.js → chunk-QNLESRH6.js} +3 -1
- package/dist/{chunk-RJGCYGC3.js → chunk-QRZESG66.js} +38 -27
- package/dist/{chunk-76Q7E3TM.js → chunk-QYOZ46ZQ.js} +70 -23
- package/dist/{chunk-E555EDOQ.js → chunk-QZMLSK43.js} +221 -62
- package/dist/{chunk-NGA7ICG4.js → chunk-RDJ3ZU6O.js} +16 -13
- package/dist/{chunk-6MJUW5R5.js → chunk-RHBQ2Q5H.js} +95 -44
- package/dist/{chunk-ZYQYX66L.js → chunk-RHVP62HI.js} +6 -6
- package/dist/{chunk-F5BYLT3M.js → chunk-RMVCKO6N.js} +13 -11
- package/dist/chunk-RRPTQGRU.js +47 -0
- package/dist/{chunk-IRXVV65V.js → chunk-S2TSXUYP.js} +6 -6
- package/dist/{chunk-OG2YUVBW.js → chunk-SD6ENKTO.js} +7 -2
- package/dist/{chunk-6AMN7IKJ.js → chunk-SHAAMKN7.js} +43 -22
- package/dist/{chunk-DLUNQHFO.js → chunk-SHCW2TCA.js} +9 -9
- package/dist/{chunk-54ROMBU7.js → chunk-SSZB3VXG.js} +17 -17
- package/dist/chunk-SXAZDIGM.js +84 -0
- package/dist/{chunk-QHRE2M6V.js → chunk-T2L5H2WW.js} +4 -3
- package/dist/{chunk-RPIKNMZA.js → chunk-T3WCDDIL.js} +7 -2
- package/dist/{chunk-JIEVDGAF.js → chunk-T5MBORBK.js} +1 -1
- package/dist/{chunk-32LLDRPI.js → chunk-TDDSWNGD.js} +23 -15
- package/dist/{chunk-7VVHTOE7.js → chunk-TGR6PRKG.js} +2 -2
- package/dist/{chunk-QJWLNP64.js → chunk-TKERVBJ3.js} +7 -8
- package/dist/{chunk-43GGVT7W.js → chunk-TMXRTYGT.js} +10 -4
- package/dist/{chunk-BIVL764T.js → chunk-TQ5HHNM3.js} +2 -2
- package/dist/{chunk-WN3HEU3P.js → chunk-TWRFVW3J.js} +4 -2
- package/dist/{chunk-7FKY6YWU.js → chunk-TXMS7QUJ.js} +3 -3
- package/dist/{chunk-O6ZTIDWB.js → chunk-UBXIGE2P.js} +3 -2
- package/dist/{chunk-JTC5SEAQ.js → chunk-UCIAHSJK.js} +2 -2
- package/dist/{chunk-BVYIKLQ5.js → chunk-UD6U4EF5.js} +1 -1
- package/dist/{chunk-DMAMWUYY.js → chunk-UFZXZJJG.js} +5 -5
- package/dist/{chunk-SNQ7D5R7.js → chunk-UIHGGWES.js} +51 -11
- package/dist/{chunk-27OIGDRK.js → chunk-UP4JSNDR.js} +1 -1
- package/dist/{chunk-JEUL777U.js → chunk-USFIDSTO.js} +7 -5
- package/dist/{chunk-PZ46S2SY.js → chunk-V3UE3TB7.js} +2 -2
- package/dist/{chunk-KDSYZLF6.js → chunk-V5IFI3FV.js} +8 -1
- package/dist/{chunk-BSATR6ZO.js → chunk-V62B23VC.js} +13 -1
- package/dist/{chunk-WWGPTEQB.js → chunk-VFLMBA2M.js} +66 -16
- package/dist/{chunk-5P2TTHBZ.js → chunk-VM5CQ7CG.js} +2 -2
- package/dist/{chunk-UREXN6WG.js → chunk-VMGTNB6H.js} +6 -6
- package/dist/{chunk-2NSQIPAA.js → chunk-VT7PBGL2.js} +6 -6
- package/dist/{chunk-CXETOLPX.js → chunk-VY2NPB2Q.js} +1 -1
- package/dist/{chunk-F77TMAUY.js → chunk-VY67Q6CJ.js} +18 -18
- package/dist/{chunk-7STMIK2X.js → chunk-W5SVS4B6.js} +2 -2
- package/dist/{chunk-MD6DCQMA.js → chunk-W7Q6PLT4.js} +37 -37
- package/dist/{chunk-JVZTKQFS.js → chunk-WDAZ2MT4.js} +8 -4
- package/dist/{chunk-MZACASZY.js → chunk-WE5WVQE4.js} +13 -1
- package/dist/chunk-WJQX7HBH.js +54 -0
- package/dist/{chunk-MS7O3KDJ.js → chunk-WKWCNS6K.js} +6 -6
- package/dist/{chunk-4KQHKPB3.js → chunk-WSKZZ2ZB.js} +11 -12
- package/dist/{chunk-SMHZXHHD.js → chunk-WZB6R2ZX.js} +6 -4
- package/dist/{chunk-37PKNVLS.js → chunk-X5OVVMZX.js} +1 -1
- package/dist/{chunk-MPO5TVGF.js → chunk-XFCBH3TI.js} +3 -3
- package/dist/{chunk-CAJ54IEP.js → chunk-XJUZC53Y.js} +1 -1
- package/dist/chunk-XN7JDII2.js +2047 -0
- package/dist/{chunk-4KMZAK6J.js → chunk-XNV7VOIT.js} +4 -4
- package/dist/{chunk-YK2KWNTU.js → chunk-XR7VOF2V.js} +9 -7
- package/dist/{chunk-WTQAG2OT.js → chunk-XYUXB5VK.js} +8 -3
- package/dist/{chunk-QB5HV4IY.js → chunk-Y5IKCXQR.js} +7 -8
- package/dist/{chunk-FNMH5WEY.js → chunk-Y5WHM2Q5.js} +1 -1
- package/dist/{chunk-IGNBQT23.js → chunk-Y7Q3VEYC.js} +96 -5
- package/dist/{chunk-L6YVK6VC.js → chunk-YB6QGOCO.js} +1 -1
- package/dist/{chunk-BYCJ6TKI.js → chunk-YBYV56FS.js} +3 -3
- package/dist/{chunk-DLDDRXAI.js → chunk-YCUNFAEE.js} +77 -37
- package/dist/{chunk-V7F4F6JA.js → chunk-YFI5PN5O.js} +5 -7
- package/dist/{chunk-ZL6IHMOW.js → chunk-YGPLUENN.js} +88 -58
- package/dist/chunk-YGZEG3JV.js +123 -0
- package/dist/{chunk-JGFHNAHS.js → chunk-YJGFT63R.js} +8 -3
- package/dist/{chunk-XQMYQ4TN.js → chunk-YNHPPZ7S.js} +1 -1
- package/dist/{chunk-EZZ533MH.js → chunk-YO5UKKCQ.js} +1 -1
- package/dist/{chunk-YZZLIYPA.js → chunk-YTEJYLU7.js} +5 -1
- package/dist/{chunk-CCJP6QZO.js → chunk-Z257SH5U.js} +1 -1
- package/dist/{chunk-ETMHDCEH.js → chunk-Z2BDTZDT.js} +13 -11
- package/dist/{chunk-MOK3ZS6P.js → chunk-ZDD3MJ2H.js} +1 -1
- package/dist/{chunk-6364WO5D.js → chunk-ZNX5J7D7.js} +2 -2
- package/dist/{chunk-UZTQUPTB.js → chunk-ZSYU6LIH.js} +4 -4
- package/dist/{chunk-JFFREZGT.js → chunk-ZTSJ7NY6.js} +6 -2
- package/dist/chunk-ZV3SNRJI.js +122 -0
- package/dist/cli/index.js +1 -1
- package/dist/{core-MU4ALRR7.js → core-4M4RY7MX.js} +4 -1
- package/dist/{core-XW7UJFJZ.js → core-4PW4MXWR.js} +4 -1
- package/dist/{core-LB5M7XL4.js → core-5S5CJHBG.js} +5 -1
- package/dist/{core-LGJZUP6H.js → core-7TTM4KRP.js} +6 -1
- package/dist/{core-GSILPKUR.js → core-7XKNJM7Y.js} +4 -1
- package/dist/{core-JDFUZFRH.js → core-A7HXVSKB.js} +5 -1
- package/dist/{core-K3JX5WPM.js → core-AMWCZTOT.js} +2 -1
- package/dist/{core-BLHEJ5OK.js → core-AVA4XLQ2.js} +4 -1
- package/dist/{core-ILPXXC2Z.js → core-BJZEJ63L.js} +5 -1
- package/dist/{core-3KLQSYWB.js → core-CCB3IXGD.js} +4 -1
- package/dist/{core-BBNY2BX4.js → core-D2OIGYC7.js} +2 -1
- package/dist/{core-4RR6VSXM.js → core-DMDAXVMY.js} +3 -1
- package/dist/{core-HDNWVLJW.js → core-EMSJRGSE.js} +4 -1
- package/dist/{core-A5AKUB7H.js → core-FCSA74RT.js} +2 -1
- package/dist/{core-WZ4CHVYL.js → core-FTQBESDS.js} +3 -1
- package/dist/{core-G3LXHW73.js → core-GS4DXDDG.js} +4 -1
- package/dist/{core-H5HO2CED.js → core-JDZDBTID.js} +2 -1
- package/dist/{core-VKZSQFRG.js → core-L3UR75IJ.js} +2 -1
- package/dist/{core-AR2T32Y3.js → core-MAW4S3KA.js} +4 -1
- package/dist/{core-4HFVG4CP.js → core-N2JEWJ7D.js} +3 -1
- package/dist/{core-BOG33BFD.js → core-OBPTBKX6.js} +4 -1
- package/dist/{core-HTD5RHE7.js → core-OFPPRHYY.js} +5 -1
- package/dist/{core-ZLSQHZ3I.js → core-QFAVWFI3.js} +4 -1
- package/dist/{core-TCSW24N6.js → core-QM34237W.js} +4 -1
- package/dist/{core-WJNK7F2J.js → core-SKMHEA4Y.js} +5 -1
- package/dist/{core-7S3XMW5O.js → core-T3OSZOVV.js} +2 -1
- package/dist/{core-7Y5BZZON.js → core-UNX4ZV4M.js} +4 -1
- package/dist/{core-DFZMOO7E.js → core-VRVL6LIM.js} +5 -1
- package/dist/{core-J2JD5ODO.js → core-VT35VDVS.js} +4 -1
- package/dist/{core-TKZZZ6UW.js → core-VWYXK2R3.js} +4 -1
- package/dist/{core-E2XOSHPR.js → core-WNT6ZMRO.js} +5 -1
- package/dist/{core-RR2CAZC5.js → core-WP73P4CW.js} +4 -1
- package/dist/{core-DD62MWEW.js → core-WPEYRK6Y.js} +2 -1
- package/dist/{core-YMXYUGF5.js → core-WXZJ7V7S.js} +2 -1
- package/dist/{core-5UF44NDI.js → core-XKXDXALI.js} +3 -1
- package/dist/{core-GLOZY6Z7.js → core-ZACFV6XR.js} +2 -1
- package/dist/{core-QPSAYRFT.js → core-ZSERZGK6.js} +5 -1
- package/dist/{dataTable-CNDRVGA5.js → dataTable-7IO546LM.js} +10 -2
- package/dist/{engine-FVEIM3WV.js → engine-US3N6UCH.js} +17 -9
- package/dist/fixtures.js +3 -1
- package/dist/fonts.js +1 -1
- package/dist/geo/dach.js +1 -1
- package/dist/geo/de-states.js +1 -1
- package/dist/geo/eu27.js +1 -1
- package/dist/geo/europe.js +1 -1
- package/dist/geo/index.js +2 -2
- package/dist/geo/us-states.js +1 -1
- package/dist/geo/world.js +1 -1
- package/dist/index.js +31 -19
- package/dist/{main-THU6VIVU.js → main-2UWKGUHR.js} +27 -13
- package/dist/mcp/server.js +23 -13
- package/dist/react/bar.js +6 -1
- package/dist/react/bartable.js +8 -1
- package/dist/react/box.js +6 -1
- package/dist/react/bullet.js +7 -1
- package/dist/react/butterfly.js +6 -1
- package/dist/react/choropleth.js +8 -1
- package/dist/react/cohort.js +9 -1
- package/dist/react/column.js +6 -1
- package/dist/react/combo.js +6 -1
- package/dist/react/creative.js +8 -1
- package/dist/react/diagram.js +8 -1
- package/dist/react/dimswitch.js +6 -1
- package/dist/react/dot.js +6 -1
- package/dist/react/export.js +25 -18
- package/dist/react/funnel.js +6 -1
- package/dist/react/gantt.js +7 -1
- package/dist/react/grid.js +5 -1
- package/dist/react/heatmap.js +7 -1
- package/dist/react/histogram.js +6 -1
- package/dist/react/index.js +93 -84
- package/dist/react/kpi.js +7 -1
- package/dist/react/likert.js +6 -1
- package/dist/react/line.js +6 -1
- package/dist/react/mekko.js +6 -1
- package/dist/react/pareto.js +6 -1
- package/dist/react/pie.js +6 -1
- package/dist/react/prepare.js +35 -20
- package/dist/react/pvm.js +7 -1
- package/dist/react/pyramid.js +6 -1
- package/dist/react/sankey.js +8 -1
- package/dist/react/scatter.js +6 -1
- package/dist/react/slope.js +7 -1
- package/dist/react/sparkline.js +7 -1
- package/dist/react/spec.js +17 -11
- package/dist/react/status.js +7 -1
- package/dist/react/story.js +4 -2
- package/dist/react/table.js +6 -1
- package/dist/react/theme.js +8 -3
- package/dist/react/tilemap.js +7 -1
- package/dist/react/treemap.js +7 -1
- package/dist/react/variance.js +6 -1
- package/dist/react/waffle.js +7 -1
- package/dist/react/waterfall.js +7 -1
- package/dist/rows.js +3 -2
- package/dist/{rowsModule-LI6KOS46.js → rowsModule-DYDVHBAX.js} +2 -1
- package/dist/{schema-ZQSIR5UC.js → schema-3KMU5737.js} +1 -1
- package/dist/{schema-YLE4XXQQ.js → schema-4JRNXEZF.js} +3 -1
- package/dist/{schema-KPEPBGAX.js → schema-626QXX4G.js} +3 -1
- package/dist/{schema-72EEMYS3.js → schema-6PL46VXZ.js} +3 -1
- package/dist/{schema-JH57NFXJ.js → schema-6V5K3J2V.js} +4 -1
- package/dist/{schema-H2EC4GAQ.js → schema-A2XUZUCV.js} +3 -1
- package/dist/{schema-QPOBZUAR.js → schema-CNJ4Y6CT.js} +3 -1
- package/dist/{schema-5KDEQBBT.js → schema-DHMMGDTI.js} +3 -1
- package/dist/{schema-BKUFZLLI.js → schema-F2Q6MH7W.js} +3 -1
- package/dist/{schema-PL3EU6EQ.js → schema-FC6J6KZC.js} +5 -1
- package/dist/{schema-AXRDF6ND.js → schema-FGE5YK3S.js} +3 -1
- package/dist/{schema-5DUTAVO7.js → schema-FSYDLMGD.js} +1 -1
- package/dist/{schema-PQZWO3BP.js → schema-G5KSSI5W.js} +1 -1
- package/dist/{schema-25INXAMY.js → schema-GXOG4MXL.js} +1 -1
- package/dist/{schema-AMT7P7KB.js → schema-HEB6ZDI5.js} +3 -1
- package/dist/{schema-HH5HOORE.js → schema-I44IDRGD.js} +1 -1
- package/dist/{schema-VYECMPON.js → schema-IFTIMTS3.js} +1 -1
- package/dist/{schema-QCIE6M2P.js → schema-IUY7VYHJ.js} +3 -1
- package/dist/{schema-M5JBHQIV.js → schema-J4HCSD5C.js} +5 -2
- package/dist/{schema-B2GCEYXD.js → schema-JCU6LTYD.js} +1 -1
- package/dist/{schema-FDFQKIO5.js → schema-JJWORI7D.js} +3 -1
- package/dist/{schema-GNTKL5DN.js → schema-K4V4PYBO.js} +3 -1
- package/dist/{schema-L5U4OROI.js → schema-LGLQBRC4.js} +3 -1
- package/dist/{schema-THXXFY6I.js → schema-MD22QYZU.js} +1 -1
- package/dist/{schema-7NSV542V.js → schema-MGETMQYC.js} +3 -1
- package/dist/{schema-ZG6ZKFRZ.js → schema-MQB6CE5V.js} +3 -1
- package/dist/{schema-OU35XA3Z.js → schema-NMIYKGHE.js} +3 -1
- package/dist/{schema-5ZTGVQAJ.js → schema-NOBNFD2F.js} +3 -1
- package/dist/{schema-MMVPMJEF.js → schema-OXO2XY4Y.js} +1 -1
- package/dist/{schema-LOQ3AFC7.js → schema-PHIHMDVB.js} +1 -1
- package/dist/{schema-ZEVJMFLV.js → schema-UXWKA3PI.js} +3 -1
- package/dist/{schema-GN6GAIU5.js → schema-WBOPCTPC.js} +1 -1
- package/dist/{schema-BBTXTWYI.js → schema-WFGDVBJK.js} +1 -1
- package/dist/{schema-J7TNCZIP.js → schema-WX2RS4OU.js} +3 -1
- package/dist/{schema-QORUB6EK.js → schema-XIHAKX3B.js} +18 -1
- package/dist/{schema-R5Y6NVBH.js → schema-XRSORYBI.js} +3 -1
- package/dist/{schema-CGQID64D.js → schema-YDZCGL56.js} +3 -1
- package/dist/{specValidation-VHLGDEME.js → specValidation-XGELWQUU.js} +2 -1
- package/dist/theme.js +5 -1
- package/dist/types/core/charts/bartable/types.d.ts +14 -1
- package/dist/types/core/charts/box/types.d.ts +3 -1
- package/dist/types/core/charts/choropleth/layout.d.ts +1 -5
- package/dist/types/core/charts/choropleth/types.d.ts +19 -0
- package/dist/types/core/charts/cohort/types.d.ts +16 -3
- package/dist/types/core/charts/creative/types.d.ts +21 -0
- package/dist/types/core/charts/dimswitch/compile.d.ts +15 -2
- package/dist/types/core/charts/dimswitch/types.d.ts +24 -1
- package/dist/types/core/charts/gantt/calendar.d.ts +20 -0
- package/dist/types/core/charts/gantt/columns.d.ts +56 -0
- package/dist/types/core/charts/gantt/layout.d.ts +8 -2
- package/dist/types/core/charts/gantt/model.d.ts +296 -0
- package/dist/types/core/charts/grid/metricStack.d.ts +9 -0
- package/dist/types/core/charts/grid/metricStackSchema.d.ts +13 -0
- package/dist/types/core/charts/histogram/types.d.ts +8 -0
- package/dist/types/core/charts/likert/layout.d.ts +10 -8
- package/dist/types/core/charts/pvm/types.d.ts +9 -1
- package/dist/types/core/charts/pyramid/types.d.ts +3 -1
- package/dist/types/core/charts/sankey/types.d.ts +5 -1
- package/dist/types/core/charts/status/layout.d.ts +3 -0
- package/dist/types/core/charts/table/resolve.d.ts +14 -0
- package/dist/types/core/footer.d.ts +2 -0
- package/dist/types/core/formatSpec.d.ts +10 -0
- package/dist/types/core/frame.d.ts +1 -1
- package/dist/types/core/geo/types.d.ts +2 -0
- package/dist/types/core/geometry.d.ts +1 -1
- package/dist/types/core/normalize/shared.d.ts +2 -0
- package/dist/types/core/registry.d.ts +4 -5
- package/dist/types/core/request.d.ts +6 -0
- package/dist/types/core/schema/capability.d.ts +20 -7
- package/dist/types/core/schema/generatedColumns.d.ts +168 -0
- package/dist/types/core/text.d.ts +16 -0
- package/dist/types/core/themeGeometry.d.ts +9 -0
- package/dist/types/core/timeAxis.d.ts +6 -1
- package/dist/types/core/types/diagram.d.ts +7 -0
- package/dist/types/core/types/options.d.ts +83 -12
- package/dist/types/core/types/table.d.ts +21 -3
- package/dist/types/index.d.ts +2 -0
- package/dist/types/react/barrelCharts.d.ts +16 -5
- package/dist/types/react/charts/butterfly.d.ts +2 -2
- package/dist/types/react/charts/dot.d.ts +7 -1
- package/dist/types/react/charts/pareto.d.ts +4 -1
- package/dist/types/react/charts/variance.d.ts +3 -1
- package/dist/types/react/hover/labelCard.d.ts +11 -2
- package/dist/types/react/prepare.d.ts +7 -1
- package/dist/types/theme.d.ts +2 -0
- package/dist/validate.js +15 -5
- package/docs/manual.md +31 -3
- package/docs/reference/bar.md +3 -0
- package/docs/reference/bartable.md +16 -1
- package/docs/reference/box.md +8 -1
- package/docs/reference/bullet.md +12 -1
- package/docs/reference/butterfly.md +7 -1
- package/docs/reference/choropleth.md +14 -1
- package/docs/reference/cohort.md +25 -5
- package/docs/reference/column.md +1 -0
- package/docs/reference/combo.md +1 -0
- package/docs/reference/creative.md +13 -0
- package/docs/reference/diagram.md +5 -0
- package/docs/reference/dimswitch.md +50 -32
- package/docs/reference/dot.md +7 -2
- package/docs/reference/fixtures.md +57 -0
- package/docs/reference/funnel.md +5 -0
- package/docs/reference/gantt.md +10 -2
- package/docs/reference/grid.md +9 -2
- package/docs/reference/heatmap.md +6 -0
- package/docs/reference/histogram.md +2 -2
- package/docs/reference/kpi.md +5 -1
- package/docs/reference/likert.md +8 -0
- package/docs/reference/options.md +4 -3
- package/docs/reference/pareto.md +1 -1
- package/docs/reference/pvm.md +7 -1
- package/docs/reference/pyramid.md +6 -0
- package/docs/reference/react.md +1 -2
- package/docs/reference/sankey.md +6 -2
- package/docs/reference/slope.md +6 -0
- package/docs/reference/sparkline.md +1 -1
- package/docs/reference/status.md +7 -1
- package/docs/reference/table.md +16 -4
- package/docs/reference/tilemap.md +1 -1
- package/docs/reference/treemap.md +1 -1
- package/docs/reference/waffle.md +1 -1
- package/docs/reference/waterfall.md +4 -1
- package/package.json +1 -1
- package/dist/chunk-FG5L2LUK.js +0 -89
- package/dist/chunk-IFQN4GKK.js +0 -1852
- package/dist/chunk-O36WX56O.js +0 -13
- package/dist/chunk-WIVFIVFZ.js +0 -27
- package/dist/chunk-ZWNRLIFT.js +0 -24
|
@@ -0,0 +1,2047 @@
|
|
|
1
|
+
import {
|
|
2
|
+
liftOrFallback,
|
|
3
|
+
missesSize,
|
|
4
|
+
tightSpacingWarning
|
|
5
|
+
} from "./chunk-ZNX5J7D7.js";
|
|
6
|
+
import {
|
|
7
|
+
chartTheme
|
|
8
|
+
} from "./chunk-IW3YUMPI.js";
|
|
9
|
+
import {
|
|
10
|
+
ZERO_LIFT,
|
|
11
|
+
arrowKey,
|
|
12
|
+
badSide,
|
|
13
|
+
cellDrawsTabular,
|
|
14
|
+
cellHoldsNumber,
|
|
15
|
+
emitArrow,
|
|
16
|
+
emitHeat,
|
|
17
|
+
emptyMessageRow,
|
|
18
|
+
expansionRootsHidden,
|
|
19
|
+
finalClosers,
|
|
20
|
+
groupSpans,
|
|
21
|
+
heatColumn,
|
|
22
|
+
heatKey,
|
|
23
|
+
heatRanges,
|
|
24
|
+
isCohortDensity,
|
|
25
|
+
levelLadder,
|
|
26
|
+
prepareTableData,
|
|
27
|
+
prepareTableWidthRung,
|
|
28
|
+
presetLanguage,
|
|
29
|
+
printsFigures,
|
|
30
|
+
resolvePreparedTable,
|
|
31
|
+
resolveTable,
|
|
32
|
+
rowGrounds,
|
|
33
|
+
solveTableWidthRung,
|
|
34
|
+
tableFootnotes,
|
|
35
|
+
tableWidths,
|
|
36
|
+
visibleColumns,
|
|
37
|
+
visibleInlineRows,
|
|
38
|
+
visibleRows
|
|
39
|
+
} from "./chunk-EY4OA4OF.js";
|
|
40
|
+
import {
|
|
41
|
+
tableCellKey,
|
|
42
|
+
tableCellNodeId
|
|
43
|
+
} from "./chunk-M4SPKUZE.js";
|
|
44
|
+
import {
|
|
45
|
+
columnOwnsFormat
|
|
46
|
+
} from "./chunk-X3YP4DUV.js";
|
|
47
|
+
import {
|
|
48
|
+
TABLE_SPARK_STYLE,
|
|
49
|
+
emitSparklineMarks,
|
|
50
|
+
lastObservedIndex,
|
|
51
|
+
plotSparkline,
|
|
52
|
+
sparklineDomain
|
|
53
|
+
} from "./chunk-VT7PBGL2.js";
|
|
54
|
+
import {
|
|
55
|
+
structureCount
|
|
56
|
+
} from "./chunk-XCROSJ2Z.js";
|
|
57
|
+
import {
|
|
58
|
+
CHIP_PAD_X,
|
|
59
|
+
ENGINE_NOTES,
|
|
60
|
+
HEADING_CUT_MIN,
|
|
61
|
+
HINT_GAP,
|
|
62
|
+
INDENT_BASE,
|
|
63
|
+
INLINE_LABEL_INDENT,
|
|
64
|
+
MARK_SIZE,
|
|
65
|
+
SECTION_CHIP_GAP,
|
|
66
|
+
cellPadX,
|
|
67
|
+
changeLineFitFont,
|
|
68
|
+
changeLineFont,
|
|
69
|
+
figureFont,
|
|
70
|
+
groupHeadingFaces,
|
|
71
|
+
groupHeadingLabel,
|
|
72
|
+
groupHeadingNote,
|
|
73
|
+
groupHeadingWidth,
|
|
74
|
+
groupHeadingWrap,
|
|
75
|
+
inlineFont,
|
|
76
|
+
kindFont,
|
|
77
|
+
rowFont,
|
|
78
|
+
strongColumnFont,
|
|
79
|
+
tableFonts
|
|
80
|
+
} from "./chunk-HVX2E26J.js";
|
|
81
|
+
import {
|
|
82
|
+
chipHeight,
|
|
83
|
+
chipPaints,
|
|
84
|
+
hasPolarityBadge,
|
|
85
|
+
isFigureCell,
|
|
86
|
+
onTableGround,
|
|
87
|
+
polarityBadgeInk,
|
|
88
|
+
statusSquare,
|
|
89
|
+
statusSquarePaint,
|
|
90
|
+
tableGround,
|
|
91
|
+
toneTextPaint
|
|
92
|
+
} from "./chunk-UD6U4EF5.js";
|
|
93
|
+
import {
|
|
94
|
+
qualifierFont,
|
|
95
|
+
tableInk,
|
|
96
|
+
tableRuleInk
|
|
97
|
+
} from "./chunk-Z2MGTKDR.js";
|
|
98
|
+
import {
|
|
99
|
+
DEFAULT_EMPTY_MESSAGE,
|
|
100
|
+
hasNoDataRows
|
|
101
|
+
} from "./chunk-YB6QGOCO.js";
|
|
102
|
+
import {
|
|
103
|
+
ACCEPTANCE_PROBE,
|
|
104
|
+
FIXED_SIZE_PROBE,
|
|
105
|
+
FORCE_COMPACT,
|
|
106
|
+
PLAN_ONLY,
|
|
107
|
+
VERIFY_ADVICE,
|
|
108
|
+
WIDTH_PROBE,
|
|
109
|
+
copyPlannedValue,
|
|
110
|
+
deferLayout,
|
|
111
|
+
fixedHeightCanvas,
|
|
112
|
+
heightOmitted,
|
|
113
|
+
isPlanned,
|
|
114
|
+
layoutKey,
|
|
115
|
+
materializeLayout,
|
|
116
|
+
optionKey,
|
|
117
|
+
plannedCutCount,
|
|
118
|
+
rowDrivenHeight,
|
|
119
|
+
rowSizing,
|
|
120
|
+
spareShare,
|
|
121
|
+
tableTextMeasure,
|
|
122
|
+
withPlanInputs
|
|
123
|
+
} from "./chunk-AFGQXMKT.js";
|
|
124
|
+
import {
|
|
125
|
+
authoredNotes,
|
|
126
|
+
composedTextRole,
|
|
127
|
+
createOccupiedIndex,
|
|
128
|
+
cutWithTitle,
|
|
129
|
+
distinctCut,
|
|
130
|
+
fitText,
|
|
131
|
+
frameTextOptions,
|
|
132
|
+
groundTextWarnings,
|
|
133
|
+
legendOff,
|
|
134
|
+
legendRequired,
|
|
135
|
+
solveFrame
|
|
136
|
+
} from "./chunk-WSKZZ2ZB.js";
|
|
137
|
+
import {
|
|
138
|
+
disclosureNote,
|
|
139
|
+
staticFrame
|
|
140
|
+
} from "./chunk-WZB6R2ZX.js";
|
|
141
|
+
import {
|
|
142
|
+
AUTOMATIC_FORMAT,
|
|
143
|
+
MAGNITUDE_DIVISOR,
|
|
144
|
+
MAGNITUDE_GROUP,
|
|
145
|
+
MAGNITUDE_LABEL,
|
|
146
|
+
effectiveScale,
|
|
147
|
+
formatWithSpec,
|
|
148
|
+
parseFormatExample,
|
|
149
|
+
specUnitKind,
|
|
150
|
+
unitOfSpec
|
|
151
|
+
} from "./chunk-D3PQAVFW.js";
|
|
152
|
+
import {
|
|
153
|
+
formatExactNumber,
|
|
154
|
+
nonzeroDecimals,
|
|
155
|
+
roundHalfUp,
|
|
156
|
+
roundsToZero,
|
|
157
|
+
zeroLifts
|
|
158
|
+
} from "./chunk-MSYTF3DZ.js";
|
|
159
|
+
import {
|
|
160
|
+
canvasMargin,
|
|
161
|
+
colorblindRoles,
|
|
162
|
+
markRolePaint,
|
|
163
|
+
panelTypeClass,
|
|
164
|
+
resolveSemanticPaletteTheme,
|
|
165
|
+
resolveSurface,
|
|
166
|
+
resolveTheme,
|
|
167
|
+
semanticPalettePaint,
|
|
168
|
+
signedFillPaint,
|
|
169
|
+
strokeToken,
|
|
170
|
+
textScaleOf,
|
|
171
|
+
typeWidthClass
|
|
172
|
+
} from "./chunk-JARJP576.js";
|
|
173
|
+
import {
|
|
174
|
+
TARGET_SIZE,
|
|
175
|
+
accessibleTitle,
|
|
176
|
+
resolveSize
|
|
177
|
+
} from "./chunk-FX5VZK5F.js";
|
|
178
|
+
import {
|
|
179
|
+
maxOf,
|
|
180
|
+
minOf,
|
|
181
|
+
pushAll
|
|
182
|
+
} from "./chunk-WYJEOMNY.js";
|
|
183
|
+
import {
|
|
184
|
+
WIDTH_SAFETY,
|
|
185
|
+
defaultMeasurer,
|
|
186
|
+
ellipsize
|
|
187
|
+
} from "./chunk-UIHGGWES.js";
|
|
188
|
+
|
|
189
|
+
// src/core/charts/table/fitPolicy.ts
|
|
190
|
+
var COMPACT_RETRY = /* @__PURE__ */ Symbol("tableCompactRetry"), SIZING_ONLY = /* @__PURE__ */ Symbol("tableSizingOnly"), HEAD_LINES = /* @__PURE__ */ Symbol("tableHeadLines"), TIGHT_SPACING = /* @__PURE__ */ Symbol("tableTightSpacing"), HEAD_AIR_MIN = /* @__PURE__ */ Symbol("tableHeadAirMin"), HEAD_LOOSE = /* @__PURE__ */ Symbol("tableHeadLoose"), TIGHT_PAD = 2, SUB_LINES = /* @__PURE__ */ Symbol("tableSubLines"), REGULAR_SPACING = /* @__PURE__ */ Symbol("tableRegularSpacing"), CARD_GUTTER = 12;
|
|
191
|
+
function executeTableFit(authoredData, options, resolved, preserveCompactFloor, run, cutCount2, hasHeadAir2) {
|
|
192
|
+
let sizingOnly = options[SIZING_ONLY] === !0, once = (step, widthOnly = !0) => run(step, sizingOnly, fits, widthOnly), targetSize = options[TARGET_SIZE], fullSizingOnly = sizingOnly && resolveSize(options.size).width !== targetSize?.sizePx.width, open = options[TARGET_SIZE]?.fixed, widthFits = (geometry) => open?.width === !1 || geometry.size.width >= (geometry.sizing?.minWidth ?? 0), heightFits = (geometry) => options.size === void 0 || open?.height === !1 || geometry.size.height >= (geometry.sizing?.minHeight ?? 0), fits = (geometry) => widthFits(geometry) && heightFits(geometry), full = run({}, fullSizingOnly, options.belowMinimum === "refuse" ? void 0 : fits, options.belowMinimum !== "refuse"), widthRepair = full.warnings.find((warning) => warning.code === "table-overflow" && warning.fix?.length), withWidthRepair = (drawn) => (widthRepair && (drawn.warnings = drawn.warnings.map((warning) => warning.code === "table-overflow" && warning.fix?.length ? widthRepair : warning)), drawn), pad = options.cellPadX ?? cellPadX(full.marks.columns.length), margin = { ...options.margin, left: Math.min(options.margin?.left ?? CARD_GUTTER, CARD_GUTTER), right: Math.min(options.margin?.right ?? CARD_GUTTER, CARD_GUTTER) }, gutterHelps = full.plot.x > margin.left + 0.5 || full.size.width - (full.plot.x + full.plot.w) > margin.right + 0.5, fixedHeight = !heightOmitted(options.size) && open?.height !== !1, withFloor = (drawn) => {
|
|
193
|
+
if (!sizingOnly && !preserveCompactFloor && !options[VERIFY_ADVICE]) return withWidthRepair(drawn);
|
|
194
|
+
let compact = drawn.sizing === void 0 ? void 0 : compactTable(authoredData, options, full, margin, Math.min(pad, 3), 2, resolved, !0, run);
|
|
195
|
+
return compact?.sizing && !compact.refused && (drawn.sizing = {
|
|
196
|
+
...drawn.sizing,
|
|
197
|
+
minWidth: Math.min(drawn.sizing.minWidth, compact.sizing.minWidth),
|
|
198
|
+
minHeight: fixedHeight ? Math.min(drawn.sizing.minHeight, compact.sizing.minHeight) : drawn.sizing.minHeight
|
|
199
|
+
}), withWidthRepair(drawn);
|
|
200
|
+
};
|
|
201
|
+
if (options.belowMinimum === "refuse" || !full.sizing) return full;
|
|
202
|
+
if (fits(full)) {
|
|
203
|
+
fullSizingOnly && (full = run({}, !1));
|
|
204
|
+
let cut = cutCount2(full), gutter = cut === 0 || !gutterHelps ? void 0 : run({ margin }, !1), drawn = gutter?.sizing !== void 0 && fits(gutter) && cutCount2(gutter) < cut ? gutter : full;
|
|
205
|
+
return open?.width === !1 ? drawn : withFloor(drawn);
|
|
206
|
+
}
|
|
207
|
+
if (widthFits(full) && fixedHeight && hasHeadAir2(options)) {
|
|
208
|
+
let lean = once({ [HEAD_AIR_MIN]: !0 });
|
|
209
|
+
if (lean.sizing !== void 0 && fits(lean))
|
|
210
|
+
return withFloor(lean), lean.warnings.push({ code: "table-compact-fallback", severity: "info", message: "The full table did not fit. The head and group rows took their least air." }), lean;
|
|
211
|
+
}
|
|
212
|
+
if (widthFits(full)) return withWidthRepair(compactTable(authoredData, options, full, margin, Math.min(pad, 6), void 0, resolved, sizingOnly, run));
|
|
213
|
+
let rung = (step) => once({ margin, cellPadX: step.pad, ...step.heads === void 0 ? {} : { [HEAD_LINES]: step.heads } }, "regular-rung"), narrowest = rung({ pad: Math.min(pad, 3), heads: 2 });
|
|
214
|
+
if (narrowest.sizing !== void 0 && !widthFits(narrowest)) return withWidthRepair(compactTable(authoredData, options, full, margin, Math.min(pad, 3), 2, resolved, sizingOnly, run));
|
|
215
|
+
let tried = new Set(gutterHelps ? [] : [`${pad}`]);
|
|
216
|
+
for (let step of [{ pad }, { pad: Math.min(pad, 6) }, { pad: Math.min(pad, 3) }, { pad: Math.min(pad, 3), heads: 2 }]) {
|
|
217
|
+
let key = `${step.pad}${step.heads === void 0 ? "" : `:${step.heads}`}`;
|
|
218
|
+
if (tried.has(key)) continue;
|
|
219
|
+
tried.add(key);
|
|
220
|
+
let last = step.heads === void 0 ? rung(step) : narrowest;
|
|
221
|
+
if (last.sizing === void 0 || widthFits(last) && heightFits(last))
|
|
222
|
+
return withFloor(last), last.warnings.push({ code: "table-compact-fallback", severity: "info", message: `The full table did not fit. ${step.pad === pad && step.heads === void 0 ? "12 px side margins were" : `${step.pad} px cell air${step.heads === void 0 ? "" : ", heads on two lines"} and 12 px side margins were`} used.` }), last;
|
|
223
|
+
}
|
|
224
|
+
return withWidthRepair(compactTable(authoredData, options, full, margin, Math.min(pad, 3), 2, resolved, sizingOnly, run));
|
|
225
|
+
}
|
|
226
|
+
function compactTable(authoredData, options, full, margin, cellPadX2, heads, resolved, sizingOnly, run) {
|
|
227
|
+
let compactOptions = {
|
|
228
|
+
density: isCohortDensity(options.density ?? "regular") ? options.density : "compact",
|
|
229
|
+
margin,
|
|
230
|
+
// Tighter than the full table, never wider: a dense table already pads 3 or 5 px.
|
|
231
|
+
cellPadX: cellPadX2,
|
|
232
|
+
labelIndent: { base: 8 + (options.outlineMarks === !0 ? INDENT_BASE : 0), step: 8 },
|
|
233
|
+
// A fixed height never grows (docs/manual.md, "Fixed height"): only an omitted height turns automatic.
|
|
234
|
+
size: heightOmitted(options.size) ? { width: full.size.width } : { width: full.size.width, height: full.size.height },
|
|
235
|
+
[COMPACT_RETRY]: full.size.height,
|
|
236
|
+
...heads === void 0 ? {} : { [HEAD_LINES]: heads }
|
|
237
|
+
}, tightens = (geometry) => {
|
|
238
|
+
let across = 2 * Math.max(0, cellPadX2 - TIGHT_PAD) * geometry.marks.columns.length + Math.max(0, geometry.plot.x - TIGHT_PAD * 2) + Math.max(0, geometry.size.width - geometry.plot.x - geometry.plot.w - TIGHT_PAD * 2) + (authoredData.columnGroups ?? []).reduce((sum, group) => sum + Math.max(0, (group.spacer ?? 0) - TIGHT_PAD * 2), 0) + 6 + 4 * Math.max(0, maxOf(resolved.rows.map((row) => row.level))) + 4, missed = missesSize(geometry, options), reachable = !missed.width || (geometry.sizing?.minWidth ?? 0) - geometry.size.width <= across;
|
|
239
|
+
return !options[REGULAR_SPACING] && geometry.sizing !== void 0 && (missed.width || missed.height) && reachable;
|
|
240
|
+
}, compact = run(compactOptions, sizingOnly, (geometry) => !tightens(geometry)), misses = missesSize(compact, options), { width: missesWidth, height: missesHeight } = misses, lastOptions = compactOptions;
|
|
241
|
+
if (tightens(compact) && compact.sizing) {
|
|
242
|
+
let tightWarning = tightSpacingWarning(misses, { width: "cell air, column gaps and side margins", height: "row air and top and bottom margins" }, "the table", "compact", { ...compact, sizing: compact.sizing }, options);
|
|
243
|
+
if (compact = run(lastOptions = {
|
|
244
|
+
...compactOptions,
|
|
245
|
+
[TIGHT_SPACING]: { columns: missesWidth, rows: missesHeight },
|
|
246
|
+
...missesWidth ? {
|
|
247
|
+
cellPadX: Math.min(cellPadX2, TIGHT_PAD),
|
|
248
|
+
labelIndent: { base: TIGHT_PAD + (options.outlineMarks === !0 ? INDENT_BASE : 0), step: TIGHT_PAD * 2 }
|
|
249
|
+
} : {},
|
|
250
|
+
margin: {
|
|
251
|
+
...missesHeight ? { top: TIGHT_PAD * 2, bottom: TIGHT_PAD * 2 } : {},
|
|
252
|
+
...margin,
|
|
253
|
+
...missesWidth ? { left: Math.min(margin.left ?? CARD_GUTTER, TIGHT_PAD * 2), right: Math.min(margin.right ?? CARD_GUTTER, TIGHT_PAD * 2) } : {}
|
|
254
|
+
}
|
|
255
|
+
}, sizingOnly), missesSize(compact, options).width && resolved.columns.some((col) => / \S{1,2}$/u.test(col.label ?? ""))) {
|
|
256
|
+
let loose = run({ ...lastOptions, [HEAD_LOOSE]: !0 }, sizingOnly);
|
|
257
|
+
missesSize(loose, options).width || (compact = loose, lastOptions = { ...lastOptions, [HEAD_LOOSE]: !0 });
|
|
258
|
+
}
|
|
259
|
+
compact.warnings.push(tightWarning);
|
|
260
|
+
}
|
|
261
|
+
if (missesHeight && compact.sizing && compact.size.height + 0.5 < compact.sizing.minHeight && resolved.columns.some((col) => col.subLabel !== void 0)) {
|
|
262
|
+
let warnings = compact.warnings;
|
|
263
|
+
compact = run({ ...lastOptions, [SUB_LINES]: 1 }, sizingOnly);
|
|
264
|
+
for (let warning of warnings) warning.code === "table-tight-spacing" && !compact.warnings.includes(warning) && compact.warnings.push(warning);
|
|
265
|
+
}
|
|
266
|
+
return compact.warnings.push({ code: "table-compact-fallback", severity: "info", message: `The full table did not fit. Compact spacing and tight margins${heightOmitted(options.size) ? " and automatic height" : ""} were used.` }), compact;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// src/core/charts/table/encodings/inCellBar.ts
|
|
270
|
+
var TEXT_GAP = 8, BAR_HEIGHT = 10;
|
|
271
|
+
function emitInCellBar(context, metrics) {
|
|
272
|
+
let value = context.cell.raw;
|
|
273
|
+
if (context.cell.state !== "value" || typeof value != "number" || value === 0 || metrics.maxAbs <= 0)
|
|
274
|
+
return [];
|
|
275
|
+
let width = Math.max(0, metrics.contentBox.w - metrics.textReserve - TEXT_GAP) * Math.min(1, Math.abs(value) / metrics.maxAbs);
|
|
276
|
+
if (width <= 0) return [];
|
|
277
|
+
let height = Math.min(BAR_HEIGHT, metrics.contentBox.h), fill = badSide(value < 0, context.cell.polarity) ? { ...signedFillPaint("bad"), tint: 0.55 } : semanticPalettePaint(context.theme, context.palette, "focus", 0.55);
|
|
278
|
+
return [
|
|
279
|
+
{
|
|
280
|
+
t: "rect",
|
|
281
|
+
id: context.nodeId("bar"),
|
|
282
|
+
rect: {
|
|
283
|
+
x: metrics.contentBox.x,
|
|
284
|
+
y: metrics.contentBox.y + (metrics.contentBox.h - height) / 2,
|
|
285
|
+
w: width,
|
|
286
|
+
h: height
|
|
287
|
+
},
|
|
288
|
+
fill,
|
|
289
|
+
owner: context.owner,
|
|
290
|
+
part: "tableBar"
|
|
291
|
+
}
|
|
292
|
+
];
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// src/core/charts/table/encodings/sparkline.ts
|
|
296
|
+
function sparklineSourceValues(row, sourceColumns) {
|
|
297
|
+
return sourceColumns.map((sourceId) => {
|
|
298
|
+
let source = row.cells[sourceId];
|
|
299
|
+
return source?.state === "value" && typeof source.raw == "number" ? source.raw : null;
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
function tableSparklineDomain(rows, sourceColumns, shape) {
|
|
303
|
+
return sparklineDomain(
|
|
304
|
+
rows.filter((row) => row.role !== "section").map((row) => sparklineSourceValues(row, sourceColumns)),
|
|
305
|
+
shape
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
function sparklineDomains(columns, rows) {
|
|
309
|
+
let domains = /* @__PURE__ */ new Map();
|
|
310
|
+
for (let column of columns)
|
|
311
|
+
column.kind !== "encoding" || column.encoding?.type !== "sparkline" || domains.set(column.id, tableSparklineDomain(rows, column.encoding.sourceColumns, column.encoding.kind ?? "line"));
|
|
312
|
+
return domains;
|
|
313
|
+
}
|
|
314
|
+
function emitSparkline(context, values, metrics) {
|
|
315
|
+
if (!values.some((value) => value !== null)) {
|
|
316
|
+
let font2 = { family: context.theme.type.family, ...context.theme.type.label }, mark = context.theme.table?.glyphs?.missing ?? "\u2014";
|
|
317
|
+
return [
|
|
318
|
+
{
|
|
319
|
+
t: "text",
|
|
320
|
+
typeRole: "label",
|
|
321
|
+
id: context.nodeId("sparkEmpty"),
|
|
322
|
+
x: context.box.x + context.box.w / 2,
|
|
323
|
+
y: context.box.y + (context.box.h - context.measure(mark, font2).height) / 2,
|
|
324
|
+
lines: [mark],
|
|
325
|
+
align: "middle",
|
|
326
|
+
font: font2,
|
|
327
|
+
ink: { token: "inkMuted" },
|
|
328
|
+
owner: context.owner,
|
|
329
|
+
part: "tableSparkEmpty"
|
|
330
|
+
}
|
|
331
|
+
];
|
|
332
|
+
}
|
|
333
|
+
let kind = metrics.kind ?? "line", font = { family: context.theme.type.family, ...context.theme.type.label }, lastIndex = lastObservedIndex(values), lastText = metrics.lastText ?? (lastIndex === void 0 ? void 0 : formatExactNumber(values[lastIndex], metrics.language)), plot = plotSparkline({
|
|
334
|
+
box: context.box,
|
|
335
|
+
values,
|
|
336
|
+
shape: kind,
|
|
337
|
+
domain: metrics.domain,
|
|
338
|
+
style: TABLE_SPARK_STYLE,
|
|
339
|
+
lastText,
|
|
340
|
+
font,
|
|
341
|
+
measure: context.measure
|
|
342
|
+
});
|
|
343
|
+
return emitSparklineMarks({
|
|
344
|
+
plot,
|
|
345
|
+
shape: kind,
|
|
346
|
+
theme: context.theme,
|
|
347
|
+
palette: context.palette,
|
|
348
|
+
style: TABLE_SPARK_STYLE,
|
|
349
|
+
nodeId: context.nodeId,
|
|
350
|
+
owner: context.owner,
|
|
351
|
+
partPrefix: "table"
|
|
352
|
+
}).map((node) => node.t === "text" ? { ...node, typeRole: "label" } : node);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// src/core/charts/table/fitFormats.ts
|
|
356
|
+
var NEXT_MAGNITUDE = {
|
|
357
|
+
none: "k",
|
|
358
|
+
k: "m",
|
|
359
|
+
m: "bn",
|
|
360
|
+
bn: "t",
|
|
361
|
+
t: void 0
|
|
362
|
+
}, FIT_DIGITS = 2;
|
|
363
|
+
function keptDigits(value, magnitude, decimals) {
|
|
364
|
+
return roundHalfUp(Math.abs(value) / MAGNITUDE_DIVISOR[magnitude], decimals).replace(".", "").replace(/^0+/, "").length;
|
|
365
|
+
}
|
|
366
|
+
var ONE_DIGIT_TOLERANCE = 0.05;
|
|
367
|
+
function printsNear(value, magnitude, decimals) {
|
|
368
|
+
let scaled = Math.abs(value) / MAGNITUDE_DIVISOR[magnitude];
|
|
369
|
+
return Math.abs(Number(roundHalfUp(scaled, decimals)) / scaled - 1) <= ONE_DIGIT_TOLERANCE;
|
|
370
|
+
}
|
|
371
|
+
function keepsDigits(figures, spec, next) {
|
|
372
|
+
return figures.every((value) => {
|
|
373
|
+
let kept = keptDigits(value, next.magnitude, next.decimals);
|
|
374
|
+
return kept === 0 && spec.automatic ? !0 : kept < Math.min(FIT_DIGITS, keptDigits(value, spec.magnitude, spec.decimals)) ? !1 : kept === 0 || kept >= FIT_DIGITS || printsNear(value, next.magnitude, next.decimals);
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
function floorDecimals(figures, spec, magnitude, from = 0) {
|
|
378
|
+
let decimals = from;
|
|
379
|
+
for (; decimals < 6 && !keepsDigits(figures, spec, { magnitude, decimals }); ) decimals++;
|
|
380
|
+
return decimals;
|
|
381
|
+
}
|
|
382
|
+
function shorterSpec(spec, figures) {
|
|
383
|
+
if (spec.glyphs || spec.negative === "trailing" || spec.ordinal || spec.exponent || spec.magnitudeInAffix) return;
|
|
384
|
+
let maxAbs = figures === void 0 ? 1 / 0 : Math.max(0, maxOf(figures));
|
|
385
|
+
if (figures ??= [], spec.significantDigits !== void 0) return;
|
|
386
|
+
if (spec.decimals > 0) {
|
|
387
|
+
let decimals = spec.decimals === 4 && spec.thousandsSep === "" ? 2 : spec.decimals - 1, plain = { ...spec, decimals }, next2 = plain.magnitude === "none" || maxAbs === 1 / 0 ? plain : { ...plain, ...effectiveScale(maxAbs, plain) };
|
|
388
|
+
return keepsDigits(figures, spec, next2) ? next2 : void 0;
|
|
389
|
+
}
|
|
390
|
+
if (specUnitKind(spec) !== "number" || !/^(?:|\p{Sc}|[A-Z]{3})$/u.test(spec.suffix.trim())) return;
|
|
391
|
+
let magnitude = NEXT_MAGNITUDE[spec.magnitude];
|
|
392
|
+
if (magnitude === void 0 || maxAbs / MAGNITUDE_DIVISOR[magnitude] < 1) return;
|
|
393
|
+
let next = { ...spec, magnitude, decimals: 1, rollMagnitude: void 0 };
|
|
394
|
+
if (maxAbs === 1 / 0) return next;
|
|
395
|
+
let rolled = { ...next, ...effectiveScale(maxAbs, next) };
|
|
396
|
+
rolled.decimals = floorDecimals(figures, spec, rolled.magnitude, rolled.decimals);
|
|
397
|
+
let widest = (candidate) => maxOf(figures.map((value) => formatWithSpec(value, candidate).length)), held = { ...next, decimals: floorDecimals(figures, spec, magnitude), thousandsSep: spec.thousandsSep || ",", rollMagnitude: !1 }, step = rolled.magnitude === magnitude || widest(held) > widest(rolled) ? rolled : held;
|
|
398
|
+
return widest(step) >= widest(spec) ? void 0 : step;
|
|
399
|
+
}
|
|
400
|
+
function exampleOf(spec) {
|
|
401
|
+
let whole = spec.thousandsSep === "" ? spec.decimals === 3 ? "0" : "1" : `1${spec.thousandsSep}234`, fraction = spec.decimals > 0 ? `${spec.decimalSep}${"2345678".slice(0, spec.decimals)}` : "", ordinal = spec.ordinal ? spec.thousandsSep ? "th" : "st" : "", numberStyle = spec.exponent ? `${spec.exponent.letter}${spec.exponent.sign}${"6".padStart(spec.exponent.digits, "0")}` : spec.ordinal === "upper" ? ordinal.toUpperCase() : ordinal, body = `${spec.signed && !spec.glyphs ? "+" : ""}${spec.prefix}${whole}${fraction}${numberStyle}${spec.magnitudeInAffix ? "" : MAGNITUDE_LABEL[spec.magnitude]}${spec.suffix}`;
|
|
402
|
+
return spec.glyphs && (body = spec.glyphs.at === "start" ? spec.glyphs.up + spec.glyphs.space + body : body + spec.glyphs.space + spec.glyphs.up), spec.negative === "parens" ? `(${body})` : spec.negative === "trailing" ? body + spec.trailingMinus : body;
|
|
403
|
+
}
|
|
404
|
+
function withRowFormats(rows, formats) {
|
|
405
|
+
return rows.map((row) => {
|
|
406
|
+
let next = formats.get(row.id), children = row.children === void 0 ? void 0 : withRowFormats(row.children, formats);
|
|
407
|
+
return next === void 0 && children === row.children ? row : {
|
|
408
|
+
...row,
|
|
409
|
+
...next === void 0 ? {} : { format: next.format },
|
|
410
|
+
...next?.unitAffix === void 0 ? {} : { unitAffix: next.unitAffix },
|
|
411
|
+
...children === void 0 ? {} : { children }
|
|
412
|
+
};
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
function withCellFormats(rows, formats) {
|
|
416
|
+
return rows.map((row) => {
|
|
417
|
+
let next = formats.get(row.id), children = row.children === void 0 ? void 0 : withCellFormats(row.children, formats);
|
|
418
|
+
if (next === void 0 && children === void 0) return row;
|
|
419
|
+
let cells = next === void 0 ? row.cells : { ...row.cells };
|
|
420
|
+
for (let [columnId, format] of next ?? []) {
|
|
421
|
+
let cell = row.cells[columnId];
|
|
422
|
+
cells[columnId] = typeof cell == "number" ? { v: cell, format } : { ...cell, format };
|
|
423
|
+
}
|
|
424
|
+
return { ...row, ...cells === void 0 ? {} : { cells }, ...children === void 0 ? {} : { children } };
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
function rowExample(row, decimal) {
|
|
428
|
+
if (row === void 0) return;
|
|
429
|
+
if (row.format !== void 0) return row.format;
|
|
430
|
+
let calc = row.calc;
|
|
431
|
+
return calc !== void 0 && "op" in calc && (calc.op === "share" || calc.op === "percentDelta") ? `1${decimal}2%` : void 0;
|
|
432
|
+
}
|
|
433
|
+
function authoredRows(rows, into = /* @__PURE__ */ new Map()) {
|
|
434
|
+
for (let row of rows)
|
|
435
|
+
into.set(row.id, row), row.children && authoredRows(row.children, into);
|
|
436
|
+
return into;
|
|
437
|
+
}
|
|
438
|
+
function fitTableFormats(data, options, resolved, columns, ctx) {
|
|
439
|
+
let current = data, unlifted = { ...options, [ZERO_LIFT]: "none" }, result = resolved.lifted ? resolveTable(data, unlifted) : resolved, fitted, exhausted = /* @__PURE__ */ new Set(), decimal = ctx.decimal ?? ".", fittedRows = /* @__PURE__ */ new Set(), fittedColumns = /* @__PURE__ */ new Set(), fittedCells = /* @__PURE__ */ new Set();
|
|
440
|
+
for (let round = 0; round < 8; round++) {
|
|
441
|
+
let table = result.table, resolvedById = new Map(table.rows.map((row) => [row.id, row])), rowsById = authoredRows(current.rows), authoredColumns = new Map(current.columns.map((column) => [column.id, column])), rowOverflow = /* @__PURE__ */ new Set(), rowPrinting = /* @__PURE__ */ new Set(), columnOverflow = /* @__PURE__ */ new Set(), cellOverflow = [], rowFigures = /* @__PURE__ */ new Map(), columnFigures = /* @__PURE__ */ new Map(), figure = (map, id, value) => {
|
|
442
|
+
value !== 0 && map.set(id, [...map.get(id) ?? [], Math.abs(value)]);
|
|
443
|
+
};
|
|
444
|
+
for (let column of columns(table)) {
|
|
445
|
+
if (column.width === void 0 || column.kind !== "value" && column.kind !== "computed") continue;
|
|
446
|
+
let room = column.width - 2 * ctx.padX, authoredColumn = authoredColumns.get(column.id);
|
|
447
|
+
for (let row of table.rows) {
|
|
448
|
+
if (row.role === "section") continue;
|
|
449
|
+
let parent = row.inline === !0 && row.parentId !== void 0 ? resolvedById.get(row.parentId) : void 0;
|
|
450
|
+
if (row.inline === !0 && (parent === void 0 || ctx.lineFont === void 0)) continue;
|
|
451
|
+
let cell = row.cells[column.id];
|
|
452
|
+
if (cell === void 0 || cell.state !== "value" || typeof cell.raw != "number") continue;
|
|
453
|
+
let tabular = ctx.figures?.(column, cell.displayed), font = parent !== void 0 ? ctx.lineFont(parent, row, cell.displayed, tabular) : ctx.cellFont(cell), measured = ctx.measure(cell.displayed, figureFont(font, tabular)).width, overflows = measured + (ctx.slack?.(font, measured) ?? 0) > room;
|
|
454
|
+
if (cell.format !== void 0) {
|
|
455
|
+
overflows && cellOverflow.push({ rowId: row.id, columnId: column.id, format: cell.format, max: Math.abs(cell.raw) });
|
|
456
|
+
continue;
|
|
457
|
+
}
|
|
458
|
+
figure(rowFigures, row.id, cell.raw), figure(columnFigures, column.id, cell.raw);
|
|
459
|
+
let authoredRow = rowsById.get(row.id), rowFormatted = rowExample(authoredRow, decimal) !== void 0 && (authoredRow.calc !== void 0 || authoredRow.inline === !0 || authoredColumn === void 0 || !columnOwnsFormat(authoredColumn)), fits = authoredRow?.fitFormat !== !1 && !(authoredRow?.scale === "money" && authoredRow[MAGNITUDE_GROUP] !== void 0);
|
|
460
|
+
rowFormatted && fits && rowPrinting.add(row.id), overflows && (rowFormatted ? fits : authoredColumn?.fitFormat !== !1) && (rowFormatted ? rowOverflow.add(row.id) : columnOverflow.add(column.id));
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
let rowFormattedColumn = (columnId) => {
|
|
464
|
+
let authoredColumn = authoredColumns.get(columnId);
|
|
465
|
+
return authoredColumn !== void 0 && columnOwnsFormat(authoredColumn) ? !1 : table.rows.some((row) => {
|
|
466
|
+
let authored = rowsById.get(row.id);
|
|
467
|
+
return authored?.format !== void 0 && authored.calc === void 0 && row.inline !== !0 && typeof row.cells[columnId]?.raw == "number";
|
|
468
|
+
});
|
|
469
|
+
}, rowFormats = /* @__PURE__ */ new Map();
|
|
470
|
+
for (let rowId of rowOverflow) {
|
|
471
|
+
if (exhausted.has(`row:${rowId}`)) continue;
|
|
472
|
+
let row = rowsById.get(rowId), spec = parseFormatExample(rowExample(row, decimal)), automatic = row.format === void 0 || row[AUTOMATIC_FORMAT] === !0, next = shorterSpec({ ...spec, automatic }, rowFigures.get(rowId) ?? []);
|
|
473
|
+
if (next === void 0) {
|
|
474
|
+
exhausted.add(`row:${rowId}`);
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
let before = unitOfSpec(spec), after = unitOfSpec(next);
|
|
478
|
+
rowFormats.set(rowId, {
|
|
479
|
+
format: exampleOf(next),
|
|
480
|
+
// The label names the unit the cells now read in.
|
|
481
|
+
...row.unitAffix !== void 0 && before !== null && after !== null && row.unitAffix === before && before !== after ? { unitAffix: after } : {}
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
let unitOf = (row, spec) => `${row.inline === !0 ? "line" : "row"}|${row.unitAffix ?? ""}|${spec.prefix.trim()}|${spec.suffix.trim()}|${specUnitKind(spec)}|${spec.magnitude}`, caps = /* @__PURE__ */ new Map();
|
|
485
|
+
for (let [rowId, next] of rowFormats) {
|
|
486
|
+
let row = resolvedById.get(rowId);
|
|
487
|
+
if (row === void 0) continue;
|
|
488
|
+
let spec = parseFormatExample(next.format), key = unitOf(row, spec);
|
|
489
|
+
caps.set(key, Math.min(caps.get(key) ?? 1 / 0, spec.decimals));
|
|
490
|
+
}
|
|
491
|
+
for (let rowId of rowPrinting) {
|
|
492
|
+
if (exhausted.has(`row:${rowId}`)) continue;
|
|
493
|
+
let row = resolvedById.get(rowId), shortened = rowFormats.get(rowId), example = shortened?.format ?? rowExample(rowsById.get(rowId), decimal);
|
|
494
|
+
if (row === void 0 || example === void 0) continue;
|
|
495
|
+
let spec = parseFormatExample(example), cap = caps.get(unitOf(row, spec));
|
|
496
|
+
if (cap === void 0 || spec.significantDigits !== void 0 || spec.decimals <= cap || cap === 3 && spec.thousandsSep === "") continue;
|
|
497
|
+
let decimals = floorDecimals(rowFigures.get(rowId) ?? [], spec, spec.magnitude, cap);
|
|
498
|
+
decimals >= spec.decimals || rowFormats.set(rowId, { ...shortened, format: exampleOf({ ...spec, decimals }) });
|
|
499
|
+
}
|
|
500
|
+
let columnFormats = /* @__PURE__ */ new Map();
|
|
501
|
+
for (let columnId of columnOverflow) {
|
|
502
|
+
if (exhausted.has(`col:${columnId}`)) continue;
|
|
503
|
+
if (rowFormattedColumn(columnId)) {
|
|
504
|
+
exhausted.add(`col:${columnId}`);
|
|
505
|
+
continue;
|
|
506
|
+
}
|
|
507
|
+
let authoredExample = authoredColumns.get(columnId), example = authoredExample?.format ?? table.columns.find((column) => column.id === columnId)?.format, automatic = options.format === void 0 && (authoredExample?.format === void 0 || authoredExample[AUTOMATIC_FORMAT] === !0), next = example === void 0 ? void 0 : shorterSpec({ ...parseFormatExample(example), automatic }, columnFigures.get(columnId) ?? []);
|
|
508
|
+
if (next === void 0) {
|
|
509
|
+
exhausted.add(`col:${columnId}`);
|
|
510
|
+
continue;
|
|
511
|
+
}
|
|
512
|
+
columnFormats.set(columnId, exampleOf(next));
|
|
513
|
+
}
|
|
514
|
+
let cellFormats = /* @__PURE__ */ new Map();
|
|
515
|
+
for (let { rowId, columnId, format, max } of cellOverflow) {
|
|
516
|
+
let key = tableCellNodeId("cell", rowId, columnId);
|
|
517
|
+
if (exhausted.has(key)) continue;
|
|
518
|
+
let next = shorterSpec(parseFormatExample(format), [max]);
|
|
519
|
+
if (next === void 0) {
|
|
520
|
+
exhausted.add(key);
|
|
521
|
+
continue;
|
|
522
|
+
}
|
|
523
|
+
cellFormats.set(rowId, (cellFormats.get(rowId) ?? /* @__PURE__ */ new Map()).set(columnId, exampleOf(next)));
|
|
524
|
+
}
|
|
525
|
+
if (rowFormats.size === 0 && columnFormats.size === 0 && cellFormats.size === 0) break;
|
|
526
|
+
for (let rowId of rowFormats.keys()) fittedRows.add(rowId);
|
|
527
|
+
for (let columnId of columnFormats.keys()) fittedColumns.add(columnId);
|
|
528
|
+
for (let [rowId, formats] of cellFormats) for (let columnId of formats.keys()) fittedCells.add(`${rowId}\0${columnId}`);
|
|
529
|
+
let rows = rowFormats.size === 0 ? current.rows : withRowFormats(current.rows, rowFormats);
|
|
530
|
+
current = {
|
|
531
|
+
...current,
|
|
532
|
+
columns: current.columns.map((column) => columnFormats.has(column.id) ? { ...column, format: columnFormats.get(column.id) } : column),
|
|
533
|
+
rows: cellFormats.size === 0 ? rows : withCellFormats(rows, cellFormats)
|
|
534
|
+
}, fitted = resolveTable(current, unlifted, data), result = fitted;
|
|
535
|
+
}
|
|
536
|
+
if (fitted === void 0) return;
|
|
537
|
+
{
|
|
538
|
+
let table = result.table, resolvedById = new Map(table.rows.map((row) => [row.id, row])), rowsById = authoredRows(current.rows), familyKey = (row, spec) => `${row.inline === !0 ? "line" : "row"}|${row.unitAffix ?? ""}|${spec.prefix.trim()}|${spec.suffix.trim()}|${specUnitKind(spec)}|${spec.magnitude}`, families = /* @__PURE__ */ new Map();
|
|
539
|
+
for (let [id, authored] of rowsById) {
|
|
540
|
+
let row = resolvedById.get(id), example = rowExample(authored, decimal);
|
|
541
|
+
if (row === void 0 || example === void 0 || authored.calc !== void 0 || authored.fitFormat === !1) continue;
|
|
542
|
+
let spec = parseFormatExample(example);
|
|
543
|
+
if (spec.significantDigits !== void 0) continue;
|
|
544
|
+
let key = familyKey(row, spec);
|
|
545
|
+
families.set(key, [...families.get(key) ?? [], { id, spec }]);
|
|
546
|
+
}
|
|
547
|
+
let unified = /* @__PURE__ */ new Map();
|
|
548
|
+
for (let members of families.values()) {
|
|
549
|
+
if (!members.some((member) => fittedRows.has(member.id))) continue;
|
|
550
|
+
let least = minOf(members.map((member) => member.spec.decimals));
|
|
551
|
+
for (let member of members) {
|
|
552
|
+
if (member.spec.decimals <= least || least === 3 && member.spec.thousandsSep === "") continue;
|
|
553
|
+
let figures = Object.values(resolvedById.get(member.id).cells).flatMap((cell) => cell?.state === "value" && typeof cell.raw == "number" && cell.raw !== 0 && cell.format === void 0 ? [Math.abs(cell.raw)] : []), decimals = floorDecimals(figures, member.spec, member.spec.magnitude, least);
|
|
554
|
+
decimals < member.spec.decimals && unified.set(member.id, { format: exampleOf({ ...member.spec, decimals }) });
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
if (unified.size > 0) {
|
|
558
|
+
for (let id of unified.keys()) fittedRows.add(id);
|
|
559
|
+
current = { ...current, rows: withRowFormats(current.rows, unified) }, fitted = resolveTable(current, unlifted, data);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
let lifts = zeroFigureFormats(current, fitted.table, fittedRows, fittedColumns, fittedCells, decimal, options, data);
|
|
563
|
+
return lifts.size > 0 && (current = { ...current, rows: withCellFormats(current.rows, lifts) }), (lifts.size > 0 || options[ZERO_LIFT] !== "none") && (fitted = resolveTable(current, options, data)), { data: current, resolved: fitted, changes: formatChanges(data, current, decimal) };
|
|
564
|
+
}
|
|
565
|
+
function formatsFittedWarning(changes) {
|
|
566
|
+
if (changes.length === 0) return;
|
|
567
|
+
let name = (change) => change.row !== void 0 && change.column !== void 0 ? `cell '${change.row}/${change.column}'` : change.row !== void 0 ? `row '${change.row}'` : `column '${change.column}'`, listed = changes.slice(0, 6).map((change) => `${name(change)} ${change.from ?? "derived"} to ${change.to}`).join("; ");
|
|
568
|
+
return {
|
|
569
|
+
code: "table-formats-fitted",
|
|
570
|
+
severity: "info",
|
|
571
|
+
message: `fitFormats shortened ${changes.length} format${changes.length === 1 ? "" : "s"} to fit authored widths: ${listed}${changes.length > 6 ? `; and ${changes.length - 6} more` : ""}`,
|
|
572
|
+
detail: { changes },
|
|
573
|
+
suggest: "Widen the column, or set fitFormat: false on the row or column to keep its format as authored."
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
function formatChanges(before, after, decimal) {
|
|
577
|
+
let changes = [], rowsBefore = authoredRows(before.rows), rowsAfter = authoredRows(after.rows);
|
|
578
|
+
for (let [id, row] of rowsAfter) {
|
|
579
|
+
let from = rowExample(rowsBefore.get(id), decimal), to = rowExample(row, decimal);
|
|
580
|
+
from !== to && to !== void 0 && changes.push({ row: id, ...from === void 0 ? {} : { from }, to });
|
|
581
|
+
}
|
|
582
|
+
let columnsBefore = new Map(before.columns.map((column) => [column.id, column]));
|
|
583
|
+
for (let column of after.columns) {
|
|
584
|
+
let from = columnsBefore.get(column.id)?.format, to = column.format;
|
|
585
|
+
from !== to && to !== void 0 && changes.push({ column: column.id, ...from === void 0 ? {} : { from }, to });
|
|
586
|
+
}
|
|
587
|
+
for (let [id, row] of rowsAfter)
|
|
588
|
+
for (let [columnId, cell] of Object.entries(row.cells ?? {})) {
|
|
589
|
+
let to = typeof cell == "object" && cell !== null ? cell.format : void 0, earlier = rowsBefore.get(id)?.cells?.[columnId], from = typeof earlier == "object" && earlier !== null ? earlier.format : void 0;
|
|
590
|
+
to !== void 0 && from !== to && changes.push({ row: id, column: columnId, ...from === void 0 ? {} : { from }, to });
|
|
591
|
+
}
|
|
592
|
+
return changes;
|
|
593
|
+
}
|
|
594
|
+
function zeroFigureFormats(data, table, fittedRows, fittedColumns, fittedCells, decimal, options, source) {
|
|
595
|
+
let lifts = /* @__PURE__ */ new Map();
|
|
596
|
+
if (fittedRows.size === 0 && fittedColumns.size === 0 && fittedCells.size === 0) return lifts;
|
|
597
|
+
let rowsById = authoredRows(data.rows), sourceRows = authoredRows(source.rows), automatic = options.format === void 0 && options.unit === void 0 && options.magnitude !== "million" && options.magnitude !== "thousand";
|
|
598
|
+
for (let column of data.columns) {
|
|
599
|
+
if (column.kind !== "value") continue;
|
|
600
|
+
let columnFormat = column.format, automaticColumn = automatic && source.columns.find((entry) => entry.id === column.id)?.format === void 0;
|
|
601
|
+
for (let row of table.rows) {
|
|
602
|
+
let authoredRow = rowsById.get(row.id), authored = authoredRow?.cells?.[column.id], ownFitted = typeof authored == "object" && authored !== null && authored.format !== void 0 && fittedCells.has(`${row.id}\0${column.id}`) ? authored.format : void 0, raw = typeof authored == "number" ? authored : typeof authored == "object" && authored !== null && typeof authored.v == "number" && (authored.format === void 0 || ownFitted !== void 0) ? authored.v : void 0;
|
|
603
|
+
if (raw === void 0 || raw === 0 || authoredRow.calc !== void 0) continue;
|
|
604
|
+
let rowFormat = rowExample(authoredRow, decimal), line = row.inline === !0, rowFormatted = rowFormat !== void 0 && (columnFormat === void 0 || line), example = ownFitted ?? (rowFormatted ? fittedRows.has(row.id) && (line || specUnitKind(parseFormatExample(rowFormat)) !== "number") ? rowFormat : void 0 : fittedColumns.has(column.id) ? columnFormat ?? table.columns.find((entry) => entry.id === column.id)?.format : void 0);
|
|
605
|
+
if (example === void 0) continue;
|
|
606
|
+
let sourceRow = sourceRows.get(row.id);
|
|
607
|
+
if (ownFitted === void 0 && (rowFormatted ? automatic && (sourceRow?.format === void 0 || sourceRow[AUTOMATIC_FORMAT] === !0) : automaticColumn)) continue;
|
|
608
|
+
let spec = parseFormatExample(example), scaled = raw / MAGNITUDE_DIVISOR[spec.magnitude];
|
|
609
|
+
if (roundsToZero(scaled, spec.decimals)) {
|
|
610
|
+
if (ownFitted !== void 0 || row.inline === !0) {
|
|
611
|
+
if (options[ZERO_LIFT] !== void 0) continue;
|
|
612
|
+
zeroLifts.count++;
|
|
613
|
+
}
|
|
614
|
+
lifts.set(row.id, (lifts.get(row.id) ?? /* @__PURE__ */ new Map()).set(column.id, exampleOf({ ...spec, decimals: nonzeroDecimals(scaled, spec.decimals) })));
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
return lifts;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
// src/core/charts/table/layout.ts
|
|
622
|
+
var CRISP = 0.5, NOTE_BASELINE_LOCK = 0.88, HEADER_RULE_GAP = 7, GROUP_PAD_TOP = 6, GROUP_PAD_BOTTOM = 2, HEAT_ONLY_ROW_H = 14;
|
|
623
|
+
function cellRole(kind, text) {
|
|
624
|
+
return cellHoldsNumber(kind, text) ? {} : { role: "category" };
|
|
625
|
+
}
|
|
626
|
+
var TABLE_PAD_MAX = 16, STANDOFF_BELOW = 12, isLeafRow = (row) => row.role !== "total" && row.role !== "section" && !row.hasChildren;
|
|
627
|
+
function cutCount(geometry) {
|
|
628
|
+
return plannedCutCount(geometry) ?? geometry.scene.filter((node) => node.t === "text" && node.id.startsWith("cell:") && node.title !== void 0).length;
|
|
629
|
+
}
|
|
630
|
+
function layoutTable(authoredData, options = {}, resolved = resolvedForSize(authoredData, options), preserveCompactFloor = !1) {
|
|
631
|
+
return prepareTableExecutor(authoredData, options, resolved).run(options, preserveCompactFloor);
|
|
632
|
+
}
|
|
633
|
+
function snapshotTableOptions(options) {
|
|
634
|
+
let theme = { preset: typeof options.theme == "string" ? options.theme : options.theme?.preset, overrides: resolveTheme(options.theme) };
|
|
635
|
+
return { ...copyPlannedValue({ ...options, theme: void 0 }), theme };
|
|
636
|
+
}
|
|
637
|
+
function prepareTableExecutor(authoredData, initialOptions = {}, initialResolved) {
|
|
638
|
+
let candidates = /* @__PURE__ */ new WeakMap(), run = (options = initialOptions, preserveCompactFloor = !1, suppliedResolved, preparedInput) => withPlanInputs(() => {
|
|
639
|
+
let input = preparedInput ?? prepareTableData(authoredData, options), resolved = suppliedResolved ?? (options === initialOptions && initialResolved ? initialResolved : resolvePreparedTable(input, options));
|
|
640
|
+
preparedInput || (options = snapshotTableOptions(options));
|
|
641
|
+
let geometry = liftOrFallback(
|
|
642
|
+
(mode) => {
|
|
643
|
+
let variant = mode === "full" ? options : { ...options, [ZERO_LIFT]: mode }, model = mode === "full" ? resolved : resolvedForSize(authoredData, variant), formatFits = /* @__PURE__ */ new Map(), {
|
|
644
|
+
size: _size,
|
|
645
|
+
mode: _mode,
|
|
646
|
+
belowMinimum: _below,
|
|
647
|
+
[TARGET_SIZE]: _target,
|
|
648
|
+
[PLAN_ONLY]: _plan,
|
|
649
|
+
[WIDTH_PROBE]: _width,
|
|
650
|
+
[FIXED_SIZE_PROBE]: _fixed,
|
|
651
|
+
[FORCE_COMPACT]: _forced,
|
|
652
|
+
[ACCEPTANCE_PROBE]: _accept,
|
|
653
|
+
[SIZING_ONLY]: _sizing,
|
|
654
|
+
[COMPACT_RETRY]: _retry,
|
|
655
|
+
[ENGINE_NOTES]: _notes,
|
|
656
|
+
...stable
|
|
657
|
+
} = variant, variantKey = optionKey(stable);
|
|
658
|
+
return executeTableFit(
|
|
659
|
+
input.source,
|
|
660
|
+
variant,
|
|
661
|
+
model.table,
|
|
662
|
+
preserveCompactFloor,
|
|
663
|
+
(candidate, sizingOnly, selected, widthOnlyOnMiss = !1) => {
|
|
664
|
+
let current = Object.keys(candidate).length === 0 && Object.getOwnPropertySymbols(candidate).length === 0 ? variant : { ...variant, ...candidate }, { size: _candidateSize, [COMPACT_RETRY]: _candidateHeight, ...spacing } = candidate, typeClass = panelTypeClass(current) ?? typeWidthClass(resolveSize(current.size).width), key = variantKey + ":" + optionKey(spacing) + ":" + typeClass, byKey = candidates.get(model);
|
|
665
|
+
byKey || candidates.set(model, byKey = /* @__PURE__ */ new Map());
|
|
666
|
+
let prepared = byKey.get(key);
|
|
667
|
+
return prepared || (prepared = prepareTableCandidate(input.source, current, model, formatFits), byKey.size >= 256 && byKey.delete(byKey.keys().next().value), byKey.set(key, prepared)), prepared(current, sizingOnly, selected, widthOnlyOnMiss);
|
|
668
|
+
},
|
|
669
|
+
cutCount,
|
|
670
|
+
hasHeadAir
|
|
671
|
+
);
|
|
672
|
+
},
|
|
673
|
+
(lifted, plain) => costsWidth(lifted, plain, options),
|
|
674
|
+
resolved.lifted,
|
|
675
|
+
(bound, plain) => missesFrame(bound, options) && !missesFrame(plain, options)
|
|
676
|
+
);
|
|
677
|
+
return options[PLAN_ONLY] || options[SIZING_ONLY] ? geometry : materializeLayout(geometry);
|
|
678
|
+
}), runCard = (options = initialOptions) => withPlanInputs(() => {
|
|
679
|
+
let input = prepareTableData(authoredData, options), { [WIDTH_PROBE]: _width, ...keyOptions } = options;
|
|
680
|
+
return typeof options.theme != "string" && (keyOptions.theme = { preset: options.theme?.preset, overrides: resolveTheme(options.theme) }), memoLayout(input, keyOptions, () => {
|
|
681
|
+
let planned = { ...snapshotTableOptions(options), [PLAN_ONLY]: !0 }, geometry = run(planned, !1, void 0, input), sized = options[SIZING_ONLY] || options[VERIFY_ADVICE] || missesFrame(geometry, options) ? classFloor((_data, frame) => run(frame, !1, void 0, input), input.source, planned, geometry) : geometry;
|
|
682
|
+
return widthRepairHeight(input.source, planned, sized, runCard);
|
|
683
|
+
}, 8);
|
|
684
|
+
});
|
|
685
|
+
return { run, runCard };
|
|
686
|
+
}
|
|
687
|
+
function prepareTableCardExecutor(data) {
|
|
688
|
+
return prepareTableExecutor(data).runCard;
|
|
689
|
+
}
|
|
690
|
+
function resolvedForSize(data, options) {
|
|
691
|
+
return resolvePreparedTable(prepareTableData(data, options), options);
|
|
692
|
+
}
|
|
693
|
+
var widthPlans = /* @__PURE__ */ new WeakMap();
|
|
694
|
+
function sharedWidthPlan(table, theme, measure, options, view, probe) {
|
|
695
|
+
if (typeof options.theme == "string") return tableWidths(table, theme, measure, options, view, probe);
|
|
696
|
+
let { size, [TARGET_SIZE]: target, [WIDTH_PROBE]: _probe, [COMPACT_RETRY]: _retry, [PLAN_ONLY]: _plan, ...rest } = options, widthOptions = rest;
|
|
697
|
+
for (let symbol of [SIZING_ONLY, REGULAR_SPACING, VERIFY_ADVICE, WIDTH_REPAIR_PROBE, HEAD_LINES, HEAD_AIR_MIN, HEAD_LOOSE, SUB_LINES, TIGHT_SPACING, ENGINE_NOTES]) delete widthOptions[symbol];
|
|
698
|
+
let heightOpen = target?.fixed.height === !1 || typeof size == "object" && size.height === void 0, key = `${optionKey(rest)}:${JSON.stringify({
|
|
699
|
+
rows: view.rows.map((row) => row.id),
|
|
700
|
+
widthRows: view.widthRows.map((row) => row.id),
|
|
701
|
+
columns: view.columns.map((col) => col.id),
|
|
702
|
+
available: view.available,
|
|
703
|
+
spacerTotal: view.spacerTotal,
|
|
704
|
+
headLines: view.headLines,
|
|
705
|
+
subLines: view.subLines,
|
|
706
|
+
headGlue: view.headGlue,
|
|
707
|
+
height: heightOpen || size === void 0 ? void 0 : resolveSize(size).height,
|
|
708
|
+
// The theme's fonts follow the frame's type class, and two classes can share one plot width.
|
|
709
|
+
typeClass: panelTypeClass(options) ?? typeWidthClass(resolveSize(size).width)
|
|
710
|
+
})}`, byKey = widthPlans.get(table);
|
|
711
|
+
byKey || widthPlans.set(table, byKey = /* @__PURE__ */ new Map());
|
|
712
|
+
let plan = byKey.get(key);
|
|
713
|
+
if (plan === void 0) {
|
|
714
|
+
let measured = tableWidths(table, theme, measure, options, view, probe);
|
|
715
|
+
if ("widthMiss" in measured) return measured;
|
|
716
|
+
byKey.size >= 32 && byKey.delete(byKey.keys().next().value), byKey.set(key, plan = measured);
|
|
717
|
+
}
|
|
718
|
+
return plan;
|
|
719
|
+
}
|
|
720
|
+
function missesFrame(geometry, options) {
|
|
721
|
+
let open = options[TARGET_SIZE]?.fixed;
|
|
722
|
+
return geometry.sizing !== void 0 && (open?.width !== !1 && geometry.size.width < geometry.sizing.minWidth || options.size !== void 0 && open?.height !== !1 && geometry.size.height < geometry.sizing.minHeight);
|
|
723
|
+
}
|
|
724
|
+
function costsWidth(lifted, plain, options) {
|
|
725
|
+
let misses = (geometry) => missesFrame(geometry, options);
|
|
726
|
+
if (misses(plain)) return !1;
|
|
727
|
+
if (misses(lifted) || cutCount(lifted) > cutCount(plain)) return !0;
|
|
728
|
+
let stepped = /* @__PURE__ */ new Set(["table-compact-fallback", "table-column-clipped", "table-overflow", "table-formats-fitted"]), before = new Set(plain.warnings.map((warning) => warning.code));
|
|
729
|
+
return lifted.warnings.some((warning) => stepped.has(warning.code) && !before.has(warning.code));
|
|
730
|
+
}
|
|
731
|
+
function themeGroupPad(theme) {
|
|
732
|
+
let pad = theme.table?.groupPad;
|
|
733
|
+
return pad?.top === void 0 && pad?.bottom === void 0 ? void 0 : { top: pad?.top ?? GROUP_PAD_TOP, bottom: pad?.bottom ?? GROUP_PAD_BOTTOM };
|
|
734
|
+
}
|
|
735
|
+
var groupAirAboveLeast = (pad, ruleSpace) => pad.top + ruleSpace + pad.bottom > 9;
|
|
736
|
+
function hasHeadAir(options) {
|
|
737
|
+
let theme = chartTheme(options), group = themeGroupPad(theme);
|
|
738
|
+
return (theme.table?.headPad?.top ?? 0) > 0 || (theme.table?.headPad?.bottom ?? HEADER_RULE_GAP) > HEADER_RULE_GAP || group !== void 0 && groupAirAboveLeast(group, Math.ceil(strokeToken(theme, "hair")));
|
|
739
|
+
}
|
|
740
|
+
var WIDTH_REPAIR_PROBE = /* @__PURE__ */ Symbol("tableWidthRepairProbe");
|
|
741
|
+
function widthRepairHeight(data, options, geometry, run = (options2) => layoutTableCard(data, options2)) {
|
|
742
|
+
if (options[WIDTH_REPAIR_PROBE] || options[SIZING_ONLY]) return geometry;
|
|
743
|
+
let warning = geometry.warnings.find((w) => w.code === "table-overflow" && w.fix?.length), patch = warning?.fix?.[0], size = patch && "value" in patch ? patch.value : void 0;
|
|
744
|
+
if (!warning || !size || size.height === void 0) return geometry;
|
|
745
|
+
if (!options[VERIFY_ADVICE])
|
|
746
|
+
return geometry.warnings = geometry.warnings.map((w) => {
|
|
747
|
+
if (w !== warning) return w;
|
|
748
|
+
let { fix: _unverified, ...rest } = w;
|
|
749
|
+
return { ...rest, suggest: `${w.suggest ?? ""} Call measure for a size that keeps the height and draws.`.trim() };
|
|
750
|
+
}), geometry;
|
|
751
|
+
let wider = run({ ...options, size, [WIDTH_REPAIR_PROBE]: !0 }), needed = wider.refused || !wider.sizing ? void 0 : Math.ceil(wider.sizing.minHeight);
|
|
752
|
+
return needed !== void 0 && needed > size.height && (geometry.warnings = geometry.warnings.map((w) => w === warning ? { ...w, fix: [{ op: "add", path: "/options/size", value: { width: size.width, height: needed } }] } : w)), geometry;
|
|
753
|
+
}
|
|
754
|
+
function layoutTableCard(data, options = {}) {
|
|
755
|
+
return prepareTableExecutor(data).runCard(options);
|
|
756
|
+
}
|
|
757
|
+
var layouts = /* @__PURE__ */ new WeakMap();
|
|
758
|
+
function memoLayout(data, options, layout, limit = 32) {
|
|
759
|
+
return withPlanInputs(() => {
|
|
760
|
+
let finish = (value) => isPlanned(value) ? options[PLAN_ONLY] ? { ...value, warnings: [...value.warnings] } : materializeLayout(value) : copyPlannedValue(value);
|
|
761
|
+
if (typeof options.theme == "string") return finish(layout());
|
|
762
|
+
let { [PLAN_ONLY]: _plan, ...answerOptions } = options, key = layoutKey(data, answerOptions), byKey = layouts.get(data);
|
|
763
|
+
return byKey || layouts.set(data, byKey = /* @__PURE__ */ new Map()), byKey.size >= limit && !byKey.has(key) && byKey.delete(byKey.keys().next().value), byKey.has(key) || byKey.set(key, layout()), finish(byKey.get(key));
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
function classFloor(layout, data, options, geometry) {
|
|
767
|
+
if (geometry.refused || !geometry.sizing || panelTypeClass(options) !== void 0) return geometry;
|
|
768
|
+
let sizing = geometry.sizing;
|
|
769
|
+
if (sizing.minWidth >= geometry.size.width || typeWidthClass(sizing.minWidth) === typeWidthClass(geometry.size.width)) return geometry;
|
|
770
|
+
let height = Math.max(geometry.size.height, sizing.minHeight), byKey = classFloors.get(data);
|
|
771
|
+
byKey || classFloors.set(data, byKey = /* @__PURE__ */ new Map());
|
|
772
|
+
let key = layoutKey(data, { ...options, size: [sizing.minWidth, typeWidthClass(geometry.size.width), height] });
|
|
773
|
+
byKey.size >= 32 && !byKey.has(key) && byKey.delete(byKey.keys().next().value);
|
|
774
|
+
let floor = byKey.get(key);
|
|
775
|
+
if (floor === void 0) {
|
|
776
|
+
floor = sizing.minWidth;
|
|
777
|
+
for (let pass = 0; pass < 3 && typeWidthClass(floor) !== typeWidthClass(geometry.size.width); pass++) {
|
|
778
|
+
let probe = layout(data, { ...options, size: { width: floor, height }, [SIZING_ONLY]: !0, [REGULAR_SPACING]: !0 });
|
|
779
|
+
if (probe.refused || !probe.sizing || probe.sizing.minWidth >= floor) break;
|
|
780
|
+
floor = probe.sizing.minWidth;
|
|
781
|
+
}
|
|
782
|
+
byKey.set(key, floor);
|
|
783
|
+
}
|
|
784
|
+
return floor !== sizing.minWidth && (geometry.sizing = { ...sizing, minWidth: floor }), geometry;
|
|
785
|
+
}
|
|
786
|
+
var classFloors = /* @__PURE__ */ new WeakMap();
|
|
787
|
+
function prepareTableView(data, options, table) {
|
|
788
|
+
let dataRows = visibleRows(table, void 0, expansionRootsHidden(table, options.expansion)), rows = hasNoDataRows(table) ? [...dataRows, emptyMessageRow(table, DEFAULT_EMPTY_MESSAGE)] : dataRows, expandedIds = new Set(rows.map((row) => row.parentId).filter((id) => id !== void 0)), fullRows = options.topN ? resolvedForSize(data, { ...options, topN: void 0 }).table.rows : table.rows, fullIds = new Set(fullRows.map((row) => row.id)), widthRows = [...fullRows, ...table.rows.filter((row) => !fullIds.has(row.id)), ...rows.filter((row) => !fullIds.has(row.id) && !table.rows.includes(row))], cols = visibleColumns(table), spans = groupSpans(table, cols), bandedColumnRuns = [];
|
|
789
|
+
for (let col of cols) {
|
|
790
|
+
if (col.band !== !0) continue;
|
|
791
|
+
let previous = bandedColumnRuns[bandedColumnRuns.length - 1];
|
|
792
|
+
previous !== void 0 && cols[cols.indexOf(col) - 1]?.id === previous.columnIds[previous.columnIds.length - 1] ? previous.columnIds.push(col.id) : bandedColumnRuns.push({ columnIds: [col.id] });
|
|
793
|
+
}
|
|
794
|
+
return {
|
|
795
|
+
dataRows,
|
|
796
|
+
rows,
|
|
797
|
+
expandedIds,
|
|
798
|
+
fullRows,
|
|
799
|
+
widthRows,
|
|
800
|
+
cols,
|
|
801
|
+
spans,
|
|
802
|
+
bandedColumnRuns,
|
|
803
|
+
heatLanes: heatRanges(cols, rows),
|
|
804
|
+
arrowShapes: arrowKey(cols, rows),
|
|
805
|
+
notes: tableFootnotes(table, rows, cols),
|
|
806
|
+
textColumns: cols.filter((col) => col.kind === "rowLabel" || col.kind === "text"),
|
|
807
|
+
statusColumns: cols.filter((col) => col.kind === "status")
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
var tableViews = /* @__PURE__ */ new WeakMap();
|
|
811
|
+
function sharedTableView(data, options, table) {
|
|
812
|
+
let key = layoutKey(data, { expansion: options.expansion, topN: options.topN }), known = tableViews.get(table);
|
|
813
|
+
return (!known || known.key !== key) && tableViews.set(table, known = { key, view: prepareTableView(data, options, table) }), known.view.notes.forEach(disclosureNote), known.view;
|
|
814
|
+
}
|
|
815
|
+
var tableFrames = /* @__PURE__ */ new WeakMap();
|
|
816
|
+
function sharedTableFrame(table, input) {
|
|
817
|
+
let key = `${staticFrame.pinned}:${staticFrame.live}:${optionKey(input)}`, frames = tableFrames.get(table);
|
|
818
|
+
frames || tableFrames.set(table, frames = /* @__PURE__ */ new Map());
|
|
819
|
+
let value = frames.get(key);
|
|
820
|
+
if (!value) {
|
|
821
|
+
let occupied = createOccupiedIndex({ x: 0, y: 0, w: input.size.width, h: input.size.height });
|
|
822
|
+
value = { frame: solveFrame(input, occupied), claims: occupied.snapshot() }, frames.size >= 64 && frames.delete(frames.keys().next().value), frames.set(key, value);
|
|
823
|
+
}
|
|
824
|
+
return value;
|
|
825
|
+
}
|
|
826
|
+
function prepareTableCandidate(authoredData, options, initialResolved, formatFits) {
|
|
827
|
+
let tight = options[TIGHT_SPACING]?.columns === !0, tightRows = options[TIGHT_SPACING]?.rows === !0, measure = tableTextMeasure(options.measure ?? defaultMeasurer), data = authoredData, resolved = initialResolved, warnings = [...resolved.warnings], theme = resolveSemanticPaletteTheme(
|
|
828
|
+
chartTheme(options),
|
|
829
|
+
options.palette,
|
|
830
|
+
warnings
|
|
831
|
+
), ruleSpace = Math.ceil(strokeToken(theme, "hair")), heavySectionRule = theme.table?.section?.rule !== "hair", rowRuleWidth = theme.table?.ruleWidths?.row ?? strokeToken(theme, "hair"), sectionRuleWidth = heavySectionRule ? 2 * strokeToken(theme, "rule") : rowRuleWidth, sectionRuleSpace = Math.ceil(sectionRuleWidth);
|
|
832
|
+
if (options.fitFormats === !0) {
|
|
833
|
+
let padX = options.cellPadX ?? cellPadX(visibleColumns(resolved.table).length), fitKey = `${options.density ?? "regular"}:${padX}`, fitted = formatFits.get(fitKey);
|
|
834
|
+
if (!formatFits.has(fitKey)) {
|
|
835
|
+
let fitLadder = levelLadder(theme, options.density ?? "regular", options.target, textScaleOf(options)), fitFonts = tableFonts(theme, fitLadder), rowById = new Map(resolved.table.rows.map((row) => [row.id, row])), fitChanges = new Set(resolved.table.rows.filter((row) => visibleInlineRows(row, options.inlineVisibility).length > 0).map((row) => row.id));
|
|
836
|
+
fitted = fitTableFormats(data, options, resolved, (table2) => visibleColumns(table2), {
|
|
837
|
+
measure,
|
|
838
|
+
padX,
|
|
839
|
+
cellFont: (cell) => {
|
|
840
|
+
let row = rowById.get(cell.rowId);
|
|
841
|
+
return kindFont(rowFont(theme, fitLadder, fitFonts, cell.role, row?.step ?? cell.level, row?.hasChildren === !0, fitChanges.size > 0 && fitChanges.has(cell.rowId)), row?.kind, cell.kind === "rowLabel", theme);
|
|
842
|
+
},
|
|
843
|
+
figures: (col, text) => cellDrawsTabular(theme, col.kind, text),
|
|
844
|
+
lineFont: (parent, line, text, tabular) => changeLineFitFont(theme, fitLadder, parent.step, line.polarity !== void 0, text, measure, tabular),
|
|
845
|
+
...options.locale?.decimal === void 0 ? {} : { decimal: options.locale.decimal }
|
|
846
|
+
}), formatFits.set(fitKey, fitted);
|
|
847
|
+
}
|
|
848
|
+
if (fitted !== void 0) {
|
|
849
|
+
let warningsAfter = warnings.splice(resolved.warnings.length);
|
|
850
|
+
warnings.length = 0, pushAll(warnings, fitted.resolved.warnings), pushAll(warnings, warningsAfter);
|
|
851
|
+
let fittedNote = formatsFittedWarning(fitted.changes);
|
|
852
|
+
fittedNote !== void 0 && warnings.push(fittedNote), data = fitted.data, resolved = fitted.resolved;
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
let table = resolved.table, { dataRows, rows, expandedIds, fullRows, widthRows, cols, spans, bandedColumnRuns, heatLanes, arrowShapes, notes: tableNotes, textColumns, statusColumns } = sharedTableView(data, options, table), spacerBefore = /* @__PURE__ */ new Map();
|
|
856
|
+
for (let group of table.columnGroups) {
|
|
857
|
+
if (group.spacer === void 0 || group.spacer <= 0) continue;
|
|
858
|
+
let first = cols.find((col) => group.columnIds.includes(col.id));
|
|
859
|
+
first === void 0 || first.id === cols[0]?.id || spacerBefore.set(first.id, tight ? Math.min(group.spacer, TIGHT_PAD * 2) : group.spacer);
|
|
860
|
+
}
|
|
861
|
+
let spacerTotal = [...spacerBefore.values()].reduce((a, b) => a + b, 0), figures = printsFigures(options.figures, cols), rowRule = figures ? { paint: tableRuleInk(), width: rowRuleWidth } : { paint: { token: "grid" }, width: strokeToken(theme, "hair") };
|
|
862
|
+
options.figures === !1 && figures && warnings.push({
|
|
863
|
+
code: "figures-need-heat",
|
|
864
|
+
severity: "warn",
|
|
865
|
+
message: "figures: false needs a heat column, and this table draws none, so it prints its figures",
|
|
866
|
+
field: ["options", "figures"],
|
|
867
|
+
suggest: "Remove figures: false, or give a column a heat lane in options.encodings."
|
|
868
|
+
});
|
|
869
|
+
let initialCellPadX = options.cellPadX ?? cellPadX(cols.length), keyless = options.legend === "none", heatEntries = heatKey(cols, heatLanes, theme, options.strings, options.locale?.language);
|
|
870
|
+
keyless && legendOff(warnings, "table", [...heatEntries, ...arrowShapes].map((entry) => entry.label));
|
|
871
|
+
let keyEntries = keyless ? [] : heatEntries, arrowEntries = keyless ? [] : arrowShapes, authored = authoredNotes(options), surface = resolveSurface(theme), density = options.density ?? "regular", language = presetLanguage(options.variant), ladder = levelLadder(theme, density, options.target, textScaleOf(options));
|
|
872
|
+
tightRows && (ladder.pad = () => 1, ladder.totalPad = 1, ladder.rowHeight !== void 0 && (ladder.rowHeight = ladder.lineBox(ladder.label) + 2));
|
|
873
|
+
let { lineBox, pad: levelPad } = ladder, widthViewBase = {
|
|
874
|
+
columns: cols,
|
|
875
|
+
rows,
|
|
876
|
+
widthRows,
|
|
877
|
+
fullRows,
|
|
878
|
+
spacerTotal,
|
|
879
|
+
headLines: options[HEAD_LINES],
|
|
880
|
+
subLines: options[SUB_LINES],
|
|
881
|
+
headGlue: options[HEAD_LOOSE] !== !0
|
|
882
|
+
}, preparedWidth = options.cellPadX !== void 0 && options.columnHeads !== !1 ? prepareTableWidthRung(table, theme, measure, options, widthViewBase) : void 0;
|
|
883
|
+
function prepareRows(options2, widthPlan, size, plot) {
|
|
884
|
+
let gridX = Math.round(plot.x), cellPadX2 = widthPlan.cellPadX, { fonts, regularFonts, columnHeaderText, cellFont, indentStep, rowIndent, hasChanges: hasChangesById } = widthPlan, statusCuts = /* @__PURE__ */ new Map(), statusFits = /* @__PURE__ */ new Map(), rowFont2 = (role, level, hasChildren, hasChanges = !1) => rowFont(theme, ladder, regularFonts, role, level, hasChildren, hasChanges), sectionInk = theme.table?.section?.ink, ofWhichMuted = theme.table?.ofWhich !== "ink";
|
|
885
|
+
function rowHeight(row) {
|
|
886
|
+
if (row.role === "total" && row.kind !== "result" && row.kind !== "driver")
|
|
887
|
+
return ladder.totalPad * 2 + lineBox(fonts.total.size) + 2 * ruleSpace;
|
|
888
|
+
if (row.role === "section") {
|
|
889
|
+
if (tightRows || options2[COMPACT_RETRY] !== void 0) return sectionNatural();
|
|
890
|
+
let space = theme.table?.section?.spaceBefore ?? lineBox(ladder.label);
|
|
891
|
+
return sectionNatural() + Math.round(row.id === rows[0]?.id ? Math.min(space, lineBox(ladder.label) / 4) : space);
|
|
892
|
+
}
|
|
893
|
+
let pad = levelPad(row.step, row.hasChildren);
|
|
894
|
+
return figures ? ladder.rowHeight !== void 0 ? ladder.rowHeight + inlineBlock(row).extra : pad * 2 + lineBox(rowFont2(row.role, row.step, row.hasChildren, hasChangesById.size > 0 && hasChangesById.has(row.id)).size) + ruleSpace + inlineBlock(row).extra : Math.max(HEAT_ONLY_ROW_H, lineBox(ladder.size(0)));
|
|
895
|
+
}
|
|
896
|
+
function sectionNatural() {
|
|
897
|
+
return levelPad(1, !1) * 2 + ladder.sectionBox(fonts.section.size) + sectionRuleSpace;
|
|
898
|
+
}
|
|
899
|
+
function lineHoldsValue(line, colId) {
|
|
900
|
+
let cell = line.cells[colId];
|
|
901
|
+
return cell !== void 0 && cell.state === "value" && cell.displayed !== "";
|
|
902
|
+
}
|
|
903
|
+
let labelColumnId = cols.find((col) => col.kind === "rowLabel")?.id;
|
|
904
|
+
function labelNoteOf(row) {
|
|
905
|
+
if (!(labelColumnId === void 0 || row.role === "section"))
|
|
906
|
+
return row.cells[labelColumnId]?.note;
|
|
907
|
+
}
|
|
908
|
+
let inlineBlocks = /* @__PURE__ */ new Map();
|
|
909
|
+
function inlineBlock(row) {
|
|
910
|
+
let cached = inlineBlocks.get(row);
|
|
911
|
+
if (cached !== void 0) return cached;
|
|
912
|
+
let lines = visibleInlineRows(row, options2.inlineVisibility), box = ladder.inlineBox(Math.max(ladder.inlineSize(), lines.length ? changeLineFont(theme, ladder, row.step).size : 0)), note = labelNoteOf(row), base = note === void 0 ? 0 : 1, stacked = base + lines.length, noteSlots = /* @__PURE__ */ new Map();
|
|
913
|
+
for (let col of cols) {
|
|
914
|
+
if (col.noteLine !== !0 || col.kind === "rowLabel" || row.cells[col.id]?.note === void 0) continue;
|
|
915
|
+
let slot = base + lines.length;
|
|
916
|
+
for (let [index, line] of lines.entries())
|
|
917
|
+
if (!lineHoldsValue(line, col.id)) {
|
|
918
|
+
slot = base + index;
|
|
919
|
+
break;
|
|
920
|
+
}
|
|
921
|
+
noteSlots.set(col.id, slot), stacked = Math.max(stacked, slot + 1);
|
|
922
|
+
}
|
|
923
|
+
let block = {
|
|
924
|
+
lines,
|
|
925
|
+
...note === void 0 ? {} : { note },
|
|
926
|
+
box,
|
|
927
|
+
noteSlots,
|
|
928
|
+
extra: stacked === 0 ? 0 : ladder.inlineGap + stacked * box
|
|
929
|
+
};
|
|
930
|
+
return inlineBlocks.set(row, block), block;
|
|
931
|
+
}
|
|
932
|
+
let inlineFont2 = (level, signed) => inlineFont(theme, ladder, level, signed);
|
|
933
|
+
function affixRoom(row, font) {
|
|
934
|
+
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);
|
|
935
|
+
}
|
|
936
|
+
function noteStatusCut(col, row, shown, full) {
|
|
937
|
+
let cuts2 = statusCuts.get(col.id);
|
|
938
|
+
cuts2 || statusCuts.set(col.id, cuts2 = /* @__PURE__ */ new Map());
|
|
939
|
+
let key = `${shown}\0${full}`, cut = cuts2.get(key) ?? { shown, full, rows: [] };
|
|
940
|
+
cuts2.set(key, cut), shown === "" && !cut.rows.includes(row.label) && cut.rows.push(row.label);
|
|
941
|
+
}
|
|
942
|
+
function statusFit(col, label, font, room, trackRoom) {
|
|
943
|
+
let key = `${col.id}\0${room}\0${trackRoom}`, fits = statusFits.get(key);
|
|
944
|
+
if (fits === void 0) {
|
|
945
|
+
let labels = [...new Set(widthRows.flatMap((row) => {
|
|
946
|
+
let cell = row.cells[col.id];
|
|
947
|
+
return cell?.kind === "status" && cell.state === "value" ? [cell.displayed] : [];
|
|
948
|
+
}))];
|
|
949
|
+
fits = new Map(labels.map((text) => {
|
|
950
|
+
let fit2 = fitStatusLabel(text, font, room, trackRoom, measure), distinct = fit2?.title === void 0 ? void 0 : distinctCut(text, [fit2.text], labels, font, room, measure), cut = distinct === void 0 ? fit2 : { text: distinct, title: text };
|
|
951
|
+
return [text, cut && cut.text !== text && cut.text.slice(text.startsWith("\u2026") ? 1 : 0).startsWith("\u2026") ? null : cut];
|
|
952
|
+
}));
|
|
953
|
+
let keeper = /* @__PURE__ */ new Map();
|
|
954
|
+
for (let [text, fit2] of fits) {
|
|
955
|
+
let kept = fit2?.title === void 0 ? void 0 : keeper.get(fit2.text);
|
|
956
|
+
fit2?.title !== void 0 && (kept === void 0 || text.length < kept.length) && keeper.set(fit2.text, text);
|
|
957
|
+
}
|
|
958
|
+
for (let [text, fit2] of fits) fit2?.title !== void 0 && keeper.get(fit2.text) !== text && fits.set(text, null);
|
|
959
|
+
statusFits.set(key, fits);
|
|
960
|
+
}
|
|
961
|
+
let fit = fits.get(label);
|
|
962
|
+
return fit === void 0 ? fitStatusLabel(label, font, room, trackRoom, measure) : fit;
|
|
963
|
+
}
|
|
964
|
+
let hasGroups = table.columnGroups.length > 0, headsDrawn = options2.columnHeads !== !1, hasGroupHeads = headsDrawn && table.columnGroups.some((g) => g.heading !== !1), leanHead = options2[HEAD_AIR_MIN] === !0 || options2[COMPACT_RETRY] !== void 0, headPadTop = tightRows || leanHead ? 0 : theme.table?.headPad?.top ?? 0, themeHeadBottom = theme.table?.headPad?.bottom ?? HEADER_RULE_GAP, headPadBottom = tightRows ? 2 : leanHead ? Math.min(themeHeadBottom, HEADER_RULE_GAP) : themeHeadBottom, themeGroup = themeGroupPad(theme), groupPad = tightRows ? { top: 2, bottom: 2 } : leanHead && themeGroup !== void 0 && groupAirAboveLeast(themeGroup, ruleSpace) ? void 0 : themeGroup, headRoom = (col) => Math.max(1, Math.round(widthAt(widthPlan, col.id)) - 2 * cellPadX2 - (col.kind === "rowLabel" ? rowIndent(0) : 0)), headerFits = new Map(cols.map((col) => {
|
|
965
|
+
let text = columnHeaderText(col), headFit = (head) => fitText(head, fonts.header, headRoom(col), 1 / 0, measure, { target: options2.target, typeRole: "axis" }), fit = headFit(text);
|
|
966
|
+
return fit.title !== void 0 && text.includes("\xA0") && (fit = headFit(text.replace(/\u00a0/g, " "))), [col.id, { ...fit, lines: fit.lines.map((line) => line.replace(/\u00a0/g, " ")) }];
|
|
967
|
+
})), subFits = new Map(cols.flatMap((col) => col.subLabel === void 0 ? [] : [[col.id, fitText(
|
|
968
|
+
col.subLabel,
|
|
969
|
+
fonts.sub,
|
|
970
|
+
headRoom(col),
|
|
971
|
+
!col.label && col.kind === "rowLabel" ? 1 : options2[SUB_LINES] ?? 1 / 0,
|
|
972
|
+
measure,
|
|
973
|
+
{ target: options2.target, typeRole: "axis" }
|
|
974
|
+
)]])), headerSubH = subFits.size === 0 ? 0 : maxOf([...subFits.values()].map((fit) => lineBox(fonts.sub.size) + (fit.lines.length > 1 ? fit.h * (fit.lines.length - 1) / fit.lines.length : 0))), headerTextH = Math.max(fonts.header.size * 1.2, maxOf([...headerFits.values()].map((fit) => fit.h))), headerLabelH = headsDrawn ? headPadTop + Math.max(ladder.headBox(fonts.header.size), headerTextH) + headerSubH + headPadBottom + ruleSpace : 0, colX = /* @__PURE__ */ new Map(), x = gridX;
|
|
975
|
+
for (let col of cols) {
|
|
976
|
+
x += spacerBefore.get(col.id) ?? 0;
|
|
977
|
+
let w = Math.round(widthAt(widthPlan, col.id));
|
|
978
|
+
colX.set(col.id, { x, w }), x += w;
|
|
979
|
+
}
|
|
980
|
+
let groupWraps = /* @__PURE__ */ new Map();
|
|
981
|
+
if (hasGroupHeads)
|
|
982
|
+
for (let [groupIndex, g] of table.columnGroups.entries()) {
|
|
983
|
+
if (spans[groupIndex].span === 0 || g.heading === !1) continue;
|
|
984
|
+
let tracks = g.columnIds.filter((columnId) => colX.has(columnId)).map((columnId) => colX.get(columnId)), from = Math.round(Math.min(...tracks.map((track) => track.x)) + cellPadX2), to = Math.round(Math.max(...tracks.map((track) => track.x + track.w)) - cellPadX2), wrap = groupHeadingWrap(g, groupHeadingFaces(fonts.group), measure, to - from);
|
|
985
|
+
wrap !== void 0 && groupWraps.set(g.id, wrap);
|
|
986
|
+
}
|
|
987
|
+
let groupLineCount = (id) => {
|
|
988
|
+
let wrap = groupWraps.get(id);
|
|
989
|
+
return wrap === void 0 ? 1 : wrap.label.length + (wrap.note === void 0 ? 0 : 1);
|
|
990
|
+
}, groupLines = Math.max(1, ...[...groupWraps.keys()].map(groupLineCount)), groupLineH = fonts.group.size * (fonts.group.lineHeight ?? 1.2), groupExtraH = Math.ceil((groupLines - 1) * groupLineH), headerGroupH = hasGroupHeads ? groupExtraH + (groupPad === void 0 ? ladder.headBox(fonts.group.size) + 9 : groupPad.top + ladder.headBox(fonts.group.size) + ruleSpace + groupPad.bottom) : 0, headerH = headerGroupH + headerLabelH, spanRule = (options2.groupRule ?? "span") === "span", groupAlign = options2.groupAlign ?? "center", tableW = x - gridX, rowX = options2.rowExtent === "frame" && (options2.margin?.left ?? 0) > 0 ? 0 : gridX, filledShort = options2.rowExtent === void 0 && options2.frameFill !== "none" && Math.floor(plot.w - tableW) >= 1, rowW = (options2.rowExtent ?? "frame") === "frame" && !filledShort ? Math.max(tableW + gridX - rowX, (options2.rowExtent === "frame" && (options2.margin?.right ?? 0) > 0 ? size.width : Math.round(plot.x + plot.w)) - rowX) : tableW + gridX - rowX, wrappedLines = /* @__PURE__ */ new Map(), cutTitles = /* @__PURE__ */ new Map(), rowExtra = /* @__PURE__ */ new Map(), labelHead = /* @__PURE__ */ new Map(), affixBelow = /* @__PURE__ */ new Set(), labelTexts = (colId) => rows.flatMap((row) => row.role === "section" ? [] : [row.cells[colId]?.displayed ?? ""]);
|
|
991
|
+
for (let row of rows) {
|
|
992
|
+
let sectionCol = row.role === "section" ? cols.find((col) => col.kind === "rowLabel") : void 0, sectionCell = sectionCol === void 0 ? void 0 : row.cells[sectionCol.id];
|
|
993
|
+
if (sectionCol !== void 0 && sectionCell?.displayed) {
|
|
994
|
+
let font = cellFont(sectionCell), text = theme.table?.section?.case === "asis" ? sectionCell.displayed : sectionCell.displayed.toUpperCase(), badgeW = row.badge === void 0 ? 0 : Math.round(measure(row.badge.text, fonts.chip).width + 2 * CHIP_PAD_X) + SECTION_CHIP_GAP, room = tableW - (colX.get(sectionCol.id).x - gridX) - 2 * cellPadX2 - rowIndent(indentStep(sectionCell)) - affixRoom(row, font) - badgeW;
|
|
995
|
+
if (measure(text, font).width > room) {
|
|
996
|
+
let wrap = fitText(text, font, Math.max(room, 20), 2, measure, { target: options2.target, typeRole: "label" });
|
|
997
|
+
wrappedLines.set(tableCellKey(row.id, sectionCol.id), wrap.lines), wrap.title !== void 0 && cutTitles.set(tableCellKey(row.id, sectionCol.id), wrap.title), wrap.lines.length > 1 && rowExtra.set(row.id, Math.ceil((wrap.lines.length - 1) * font.size * 1.2));
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
for (let col of textColumns) {
|
|
1001
|
+
let rowLabel = col.kind === "rowLabel" && row.role !== "section";
|
|
1002
|
+
if (col.kind !== "text" && !rowLabel) continue;
|
|
1003
|
+
let cell = row.cells[col.id];
|
|
1004
|
+
if (!cell || !cell.displayed) continue;
|
|
1005
|
+
let font = cellFont(cell), w = colX.get(col.id).w, indent = cell.kind === "rowLabel" ? rowIndent(indentStep(cell)) : 0, room = w - 2 * cellPadX2 - indent - (cell.note && cell.kind !== "rowLabel" && col.noteLine !== !0 ? measure(` ${cell.note}`, fonts.note).width : 0), affix = cell.kind === "rowLabel" ? affixRoom(row, font) : 0, textW = measure(cell.displayed, font).width, authoredBreak = col.kind === "text" && col.wrap === !0 && cell.displayed.includes(`
|
|
1006
|
+
`);
|
|
1007
|
+
if (textW <= room - affix && !authoredBreak) continue;
|
|
1008
|
+
let ownLine = rowLabel && affix > 0, maxW = ownLine ? room : room - affix, slack = rowLabel && !visibleInlineRows(row, options2.inlineVisibility).some((line) => line.label !== "") ? inlineBlock(row).extra : 0, affixHead = ownLine ? Math.ceil((theme.table?.qualifier === void 0 ? inlineFont2(row.step, !1) : qualifierFont(font, theme)).size * 1.2) : 0, setHead = (own) => {
|
|
1009
|
+
let head = Math.max(0, own - slack);
|
|
1010
|
+
head > 0 && labelHead.set(row.id, head), head > 0 && rowExtra.set(row.id, Math.max(rowExtra.get(row.id) ?? 0, head));
|
|
1011
|
+
};
|
|
1012
|
+
if (ownLine && (affixBelow.add(row.id), textW <= maxW)) {
|
|
1013
|
+
wrappedLines.set(tableCellKey(row.id, col.id), [cell.displayed]), setHead(affixHead);
|
|
1014
|
+
continue;
|
|
1015
|
+
}
|
|
1016
|
+
let wrap = rowLabel ? fitText(cell.displayed, font, Math.max(maxW, 20), options2.rowLabelLines ?? 2, measure, { target: options2.target, typeRole: "label", breakAfter: !0 }) : fitText(cell.displayed, font, Math.max(maxW, 20), col.kind === "text" && col.wrap ? 1 / 0 : 2, measure, { target: options2.target, typeRole: "label" }), last = rowLabel && wrap.title !== void 0 ? distinctCut(cell.displayed, wrap.lines, labelTexts(col.id), font, Math.max(maxW, 20), measure, !0) : void 0;
|
|
1017
|
+
last !== void 0 && (wrap.lines = [...wrap.lines.slice(0, -1), last]), wrappedLines.set(tableCellKey(row.id, col.id), wrap.lines), wrap.title !== void 0 && cutTitles.set(tableCellKey(row.id, col.id), wrap.title);
|
|
1018
|
+
let grow = Math.ceil((wrap.lines.length - 1) * font.size * 1.2);
|
|
1019
|
+
rowLabel ? setHead(grow + affixHead) : grow > 0 && rowExtra.set(row.id, Math.max(rowExtra.get(row.id) ?? 0, grow));
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
let plannedCellText = /* @__PURE__ */ new Map(), cuts = 0;
|
|
1023
|
+
for (let row of rows) for (let col of statusColumns) {
|
|
1024
|
+
let cell = row.cells[col.id], isSection = row.role === "section";
|
|
1025
|
+
if (!cell || col.kind === "encoding" || (isSection || row.kind === "member" && expandedIds.has(row.id)) && col.kind !== "rowLabel") continue;
|
|
1026
|
+
let track = colX.get(col.id);
|
|
1027
|
+
if (cell.kind === "status" && cell.state === "value") {
|
|
1028
|
+
let square = col.statusMark === "square" ? statusSquare(fonts.body.size) : void 0, reserve = square ? square.side + square.gap : 2 * CHIP_PAD_X, fit = statusFit(col, cell.displayed, square ? fonts.body : fonts.chip, track.w - 2 * cellPadX2 - reserve, track.w - reserve);
|
|
1029
|
+
fit === null ? noteStatusCut(col, row, "", cell.displayed) : fit.title !== void 0 && (noteStatusCut(col, row, fit.text, fit.title), cuts++);
|
|
1030
|
+
continue;
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
let cellsFitted = !1, plannedCuts = () => {
|
|
1034
|
+
if (cellsFitted) return cuts;
|
|
1035
|
+
cellsFitted = !0;
|
|
1036
|
+
for (let row of rows) for (let col of textColumns) {
|
|
1037
|
+
let cell = row.cells[col.id], isSection = row.role === "section";
|
|
1038
|
+
if (!cell || col.kind === "encoding" || (isSection || row.kind === "member" && expandedIds.has(row.id)) && col.kind !== "rowLabel") continue;
|
|
1039
|
+
let track = colX.get(col.id);
|
|
1040
|
+
if (col.kind !== "rowLabel" && col.kind !== "text") continue;
|
|
1041
|
+
let font = cellFont(cell), indent = cell.kind === "rowLabel" ? rowIndent(indentStep(cell)) : 0, badge = isSection && col.kind === "rowLabel" ? row.badge : void 0, badgeW = badge === void 0 ? 0 : Math.round(measure(badge.text, fonts.chip).width + 2 * CHIP_PAD_X), affixFont = theme.table?.qualifier === void 0 ? { ...inlineFont2(row.step, !1), weight: theme.type.label.weight, ...font.style ? { style: font.style } : {} } : qualifierFont(font, theme), affixWidth = col.kind === "rowLabel" && row.unitAffix !== void 0 && !(row.kind === "member" && expandedIds.has(row.id)) ? theme.table?.qualifier === void 0 ? measure(` ${row.unitAffix}`, affixFont).width : measure(row.unitAffix, affixFont).width + (theme.table.qualifier.gap ?? 4) : 0, maxW = (isSection ? tableW - (track.x - gridX) : track.w) - 2 * cellPadX2 - indent - (badgeW === 0 ? 0 : badgeW + SECTION_CHIP_GAP) - (affixBelow.has(row.id) ? 0 : affixWidth) - (cell.note && col.kind !== "rowLabel" && col.noteLine !== !0 ? measure(` ${cell.note}`, fonts.note).width : 0), key = tableCellKey(row.id, col.id), fit = cellText(cell, col.kind, isSection, font, maxW, wrappedLines.get(key), cutTitles.get(key), measure, theme.table?.section?.case);
|
|
1042
|
+
plannedCellText.set(key, fit), fit.title !== void 0 && cuts++;
|
|
1043
|
+
}
|
|
1044
|
+
return cuts;
|
|
1045
|
+
}, cutNotes = cols.flatMap((col) => {
|
|
1046
|
+
let cut = statusCuts.get(col.id), entry = ({ shown, full, rows: named }) => `${shown !== "" ? shown : named.join(", ")} = ${full}`;
|
|
1047
|
+
return cut ? [`${col.label}: ${[...cut.values()].map(entry).join("; ")}`] : [];
|
|
1048
|
+
});
|
|
1049
|
+
return { sectionInk, ofWhichMuted, rowHeight, sectionNatural, inlineBlock, inlineFont: inlineFont2, noteStatusCut, statusFit, hasGroups, headsDrawn, hasGroupHeads, headPadBottom, groupPad, headerFits, subFits, headerSubH, colX, groupWraps, groupLineCount, groupLineH, groupExtraH, headerGroupH, headerH, spanRule, groupAlign, tableW, rowX, rowW, wrappedLines, cutTitles, rowExtra, labelHead, affixBelow, plannedCellText, plannedCuts, cutNotes };
|
|
1050
|
+
}
|
|
1051
|
+
let previousRows;
|
|
1052
|
+
function rowsAt(options2, widthPlan, size, plot) {
|
|
1053
|
+
let compact = options2[COMPACT_RETRY] !== void 0;
|
|
1054
|
+
if (previousRows && previousRows.x === plot.x && previousRows.y === plot.y && previousRows.width === plot.w && previousRows.canvasWidth === size.width && previousRows.cellPadX === widthPlan.cellPadX && previousRows.compact === compact && previousRows.fonts === widthPlan.fonts && cols.every((col, index) => previousRows.widths[index] === widthAt(widthPlan, col.id))) return previousRows.value;
|
|
1055
|
+
let value = prepareRows(options2, widthPlan, size, plot);
|
|
1056
|
+
return previousRows = {
|
|
1057
|
+
x: plot.x,
|
|
1058
|
+
y: plot.y,
|
|
1059
|
+
width: plot.w,
|
|
1060
|
+
canvasWidth: size.width,
|
|
1061
|
+
cellPadX: widthPlan.cellPadX,
|
|
1062
|
+
compact,
|
|
1063
|
+
fonts: widthPlan.fonts,
|
|
1064
|
+
widths: cols.map((col) => widthAt(widthPlan, col.id)),
|
|
1065
|
+
value
|
|
1066
|
+
}, value;
|
|
1067
|
+
}
|
|
1068
|
+
let preparedWarnings = warnings, liftedByFormatting = resolved !== initialResolved && resolved.lifted;
|
|
1069
|
+
return function(options2, sizingOnly, wantsScene, widthOnlyOnMiss = !1) {
|
|
1070
|
+
liftedByFormatting && zeroLifts.count++;
|
|
1071
|
+
for (let note of tableNotes) disclosureNote(note);
|
|
1072
|
+
let size = resolveSize(options2.size), engineNotes = options2[ENGINE_NOTES] ?? [];
|
|
1073
|
+
for (; ; ) {
|
|
1074
|
+
let sizingProbe2 = function(sizing2, marks) {
|
|
1075
|
+
return {
|
|
1076
|
+
type: "table",
|
|
1077
|
+
size,
|
|
1078
|
+
sizing: sizing2,
|
|
1079
|
+
plot,
|
|
1080
|
+
scene: [],
|
|
1081
|
+
labels: [],
|
|
1082
|
+
axes: [],
|
|
1083
|
+
annotations: [],
|
|
1084
|
+
frame: frame.frame,
|
|
1085
|
+
marks,
|
|
1086
|
+
derived: { table, computedCells: resolved.computedCells },
|
|
1087
|
+
a11y: { title: "", desc: "", counts: [] },
|
|
1088
|
+
warnings: warnings2,
|
|
1089
|
+
debug: { occupied: [], decisions: [] }
|
|
1090
|
+
};
|
|
1091
|
+
};
|
|
1092
|
+
var sizingProbe = sizingProbe2;
|
|
1093
|
+
let warnings2 = [...preparedWarnings], cellPadX2 = initialCellPadX, frameInput = {
|
|
1094
|
+
size,
|
|
1095
|
+
margin: { ...canvasMargin(theme, size.width), ...options2.margin },
|
|
1096
|
+
...frameTextOptions(options2),
|
|
1097
|
+
// uniform money unit hoisted out of every cell → the frame slot
|
|
1098
|
+
// (solveFrame prepends 'in' itself)
|
|
1099
|
+
unit: table.unit ?? options2.unit,
|
|
1100
|
+
// rows/cols, not table.rows/table.columns: this surface is static, so a
|
|
1101
|
+
// marker inside a collapsed row or a hidden column is unreachable here
|
|
1102
|
+
// and its footnote would point at nothing
|
|
1103
|
+
footnotes: [...tableNotes, ...authored, ...engineNotes],
|
|
1104
|
+
// Nothing in a table points at a note: no head or cell carries a
|
|
1105
|
+
// mark, so a "1)" before the note is a number the reader cannot follow
|
|
1106
|
+
// (the same rule as for the engine's own notes). The author's
|
|
1107
|
+
// notes stay notes and print without a number.
|
|
1108
|
+
numberedFootnotes: authored,
|
|
1109
|
+
unreferencedNotes: authored.map((_, i) => i + 1),
|
|
1110
|
+
// A table's notes read in the tertiary ink where the theme names one.
|
|
1111
|
+
footnoteInk: "inkMeta",
|
|
1112
|
+
// The notes and the source keep the cell air in from both edges, as on React, also at canvas margin 0.
|
|
1113
|
+
footerInset: cellPadX2,
|
|
1114
|
+
...keyEntries.length + arrowEntries.length > 0 ? {
|
|
1115
|
+
legend: {
|
|
1116
|
+
options: legendRequired(options2.legend, warnings2, "table", theme, keyEntries.length > 0 ? "its heat bands cut at edges no cell prints" : "its arrow shapes stand for shares no cell prints"),
|
|
1117
|
+
items: [
|
|
1118
|
+
...keyEntries.map((entry) => ({ id: entry.id, label: entry.label, paint: entry.fill, key: "box", stroke: { token: "grid" } })),
|
|
1119
|
+
...arrowEntries.map((entry) => ({ id: entry.id, label: entry.label, paint: { token: "ink" }, key: "glyph", glyph: entry.glyph }))
|
|
1120
|
+
]
|
|
1121
|
+
},
|
|
1122
|
+
legendFont: "footnote"
|
|
1123
|
+
} : {},
|
|
1124
|
+
theme,
|
|
1125
|
+
measure
|
|
1126
|
+
}, framePlan = sharedTableFrame(table, frameInput), frame = framePlan.frame, plot = frame.plot, groundTexts = /* @__PURE__ */ new Map(), widthView = { ...widthViewBase, available: plot.w }, widthProbe = widthOnlyOnMiss === "regular-rung" && options2[TARGET_SIZE]?.fixed.width !== !1 ? { canvasWidth: size.width, footerInset: cellPadX2 } : void 0, widthPlan = preparedWidth ? solveTableWidthRung(preparedWidth, plot.w, options2, widthProbe) : sharedWidthPlan(table, theme, measure, options2, widthView, widthProbe);
|
|
1127
|
+
if ("widthMiss" in widthPlan) {
|
|
1128
|
+
let sizing2 = tableSizing(size, plot, plot.y, widthPlan.totalW, widthPlan.minimumW);
|
|
1129
|
+
if (size.width < sizing2.minWidth) {
|
|
1130
|
+
let x = Math.round(plot.x), y2 = Math.round(plot.y);
|
|
1131
|
+
return sizingProbe2(sizing2, {
|
|
1132
|
+
table: { x, y: y2, w: widthPlan.totalW, h: 0 },
|
|
1133
|
+
columns: [],
|
|
1134
|
+
rows: [],
|
|
1135
|
+
headerBand: { x, y: y2, w: widthPlan.totalW, h: 0 }
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1138
|
+
widthPlan = preparedWidth ? solveTableWidthRung(preparedWidth, plot.w, options2) : sharedWidthPlan(table, theme, measure, options2, widthView);
|
|
1139
|
+
}
|
|
1140
|
+
cellPadX2 = widthPlan.cellPadX, frameInput.footerInset !== cellPadX2 && (frameInput.footerInset = cellPadX2, framePlan = sharedTableFrame(table, frameInput), frame = framePlan.frame, plot = frame.plot);
|
|
1141
|
+
let gridX = Math.round(plot.x), gridY = Math.round(plot.y), { sizingMinimums, totalW, minimumW, fonts, columnHeaderText, cellFont, indentStep, rowIndent, operatorSlot, childCount } = widthPlan, sumOf = (map) => [...map.values()].reduce((a, b) => a + b, spacerTotal);
|
|
1142
|
+
if (pushAll(warnings2, widthPlan.warnings), sizingOnly && options2[TARGET_SIZE]?.fixed.height === !1 && !heightOmitted(options2.size) || widthOnlyOnMiss && options2[TARGET_SIZE]?.fixed.width !== !1 && size.width < size.width - plot.w + minimumW)
|
|
1143
|
+
return sizingProbe2(tableSizing(size, plot, plot.y, totalW, minimumW), {
|
|
1144
|
+
table: { x: gridX, y: gridY, w: totalW, h: 0 },
|
|
1145
|
+
columns: cols.map((col) => ({ id: col.id, x: gridX, w: widthAt(widthPlan, col.id) })),
|
|
1146
|
+
rows: [],
|
|
1147
|
+
headerBand: { x: gridX, y: gridY, w: totalW, h: 0 }
|
|
1148
|
+
});
|
|
1149
|
+
let rowModel = rowsAt(options2, widthPlan, size, plot), { sectionInk, ofWhichMuted, rowHeight, sectionNatural, inlineBlock, inlineFont: inlineFont2, noteStatusCut, statusFit, hasGroups, headsDrawn, hasGroupHeads, headPadBottom, groupPad, headerFits, subFits, headerSubH, colX, groupWraps, groupLineCount, groupLineH, groupExtraH, headerGroupH, headerH, spanRule, groupAlign, tableW, rowX, rowW, wrappedLines, cutTitles, rowExtra, labelHead, affixBelow, plannedCellText, plannedCuts } = rowModel, cutNotes = rowModel.cutNotes.map(disclosureNote).filter((note) => !engineNotes.includes(note));
|
|
1150
|
+
if (!sizingOnly && cutNotes.length > 0) {
|
|
1151
|
+
engineNotes = [...engineNotes, ...cutNotes];
|
|
1152
|
+
continue;
|
|
1153
|
+
}
|
|
1154
|
+
let rowY = /* @__PURE__ */ new Map(), y = gridY + headerH;
|
|
1155
|
+
for (let [index, row] of rows.entries()) {
|
|
1156
|
+
index > 0 && row.spacer !== void 0 && (y += Math.round(row.spacer));
|
|
1157
|
+
let h = rowHeight(row) + (rowExtra.get(row.id) ?? 0);
|
|
1158
|
+
rowY.set(row.id, { y, h }), y += h;
|
|
1159
|
+
}
|
|
1160
|
+
let naturalTableH = y - gridY;
|
|
1161
|
+
{
|
|
1162
|
+
let callerH = options2[COMPACT_RETRY], grow = rowDrivenHeight({
|
|
1163
|
+
options: callerH === void 0 || !heightOmitted(options2.size) ? options2 : {},
|
|
1164
|
+
width: size.width,
|
|
1165
|
+
height: size.height,
|
|
1166
|
+
chromeH: size.height - plot.h,
|
|
1167
|
+
rowsH: y - plot.y + 4,
|
|
1168
|
+
...callerH === void 0 ? {} : { ceiling: callerH }
|
|
1169
|
+
});
|
|
1170
|
+
if (grow !== void 0) {
|
|
1171
|
+
size = { width: size.width, height: grow }, options2 = { ...options2, size };
|
|
1172
|
+
continue;
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
let targetSize = options2[TARGET_SIZE];
|
|
1176
|
+
if (!sizingOnly && targetSize?.fixed.height === !1 && size.width === targetSize.sizePx.width && size.height === targetSize.sizePx.height) {
|
|
1177
|
+
let height = tableSizing(size, plot, y, totalW, 0).naturalHeight;
|
|
1178
|
+
if (height !== size.height) {
|
|
1179
|
+
let nextSize = { width: size.width, height }, nextFramePlan = sharedTableFrame(table, { ...frameInput, size: nextSize }), nextFrame = nextFramePlan.frame;
|
|
1180
|
+
nextFrame.plot.x === plot.x && nextFrame.plot.y === plot.y && nextFrame.plot.w === plot.w && tableSizing(nextSize, nextFrame.plot, y, totalW, 0).naturalHeight === height && (size = nextSize, framePlan = nextFramePlan, frame = nextFrame, plot = frame.plot);
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
y > plot.y + plot.h && warnings2.push({
|
|
1184
|
+
code: "table-overflow",
|
|
1185
|
+
severity: "error",
|
|
1186
|
+
message: `${rows.length} rows exceed the plot height at density '${density}' \u2014 use 'compact', fewer rows, or a taller size`
|
|
1187
|
+
});
|
|
1188
|
+
let wrapFits = !1;
|
|
1189
|
+
if (widthPlan.wouldWrap.length > 0 && size.width - plot.w + sumOf(sizingMinimums) > size.width)
|
|
1190
|
+
if (options2[VERIFY_ADVICE]) {
|
|
1191
|
+
let ids = new Set(widthPlan.wouldWrap.map((col) => col.id)), wrapped = { ...authoredData, columns: authoredData.columns.map((col) => ids.has(col.id) ? { ...col, wrap: !0 } : col) };
|
|
1192
|
+
wrapFits = !missesFrame(layoutTable(wrapped, options2), options2);
|
|
1193
|
+
} else
|
|
1194
|
+
wrapFits = widthPlan.wrapMinimumWidth === void 0 || widthPlan.wrapMinimumWidth <= plot.w;
|
|
1195
|
+
let sizing = {
|
|
1196
|
+
...tableSizing(size, plot, y, totalW, minimumW),
|
|
1197
|
+
...wrapFits ? { hint: `Or set wrap: true on text column ${widthPlan.wouldWrap.map((col) => `'${col.id}'`).join(", ")}: its cells then take as many lines as they need instead of one line's width.` } : {}
|
|
1198
|
+
};
|
|
1199
|
+
if (sizingOnly || wantsScene !== void 0) {
|
|
1200
|
+
let probe = sizingProbe2(sizing, { table: { x: gridX, y: gridY, w: tableW, h: naturalTableH }, columns: cols.map((col) => ({ id: col.id, ...colX.get(col.id) })), rows: [], headerBand: { x: gridX, y: gridY, w: tableW, h: headerH } });
|
|
1201
|
+
if (sizingOnly || !wantsScene(probe)) return probe;
|
|
1202
|
+
}
|
|
1203
|
+
let tableH = naturalTableH;
|
|
1204
|
+
if (options2.heightFill !== "none" && fixedHeightCanvas(options2) && ladder.rowHeight === void 0 && figures) {
|
|
1205
|
+
let leaves = rows.filter(isLeafRow), room = Math.min(...leaves.map((row) => 2 * (TABLE_PAD_MAX - levelPad(row.step, !1)))), extra = spareShare(plot.y + plot.h - y - 4 - STANDOFF_BELOW, leaves.length, room, !0);
|
|
1206
|
+
if (extra > 0) {
|
|
1207
|
+
let shift = 0;
|
|
1208
|
+
for (let row of rows) {
|
|
1209
|
+
let at = rowY.get(row.id), h = isLeafRow(row) ? at.h + extra : at.h;
|
|
1210
|
+
rowY.set(row.id, { y: at.y + shift, h }), isLeafRow(row) && (shift += extra);
|
|
1211
|
+
}
|
|
1212
|
+
tableH += shift;
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
let geometry = {
|
|
1216
|
+
type: "table",
|
|
1217
|
+
size,
|
|
1218
|
+
sizing,
|
|
1219
|
+
plot,
|
|
1220
|
+
scene: [],
|
|
1221
|
+
labels: [],
|
|
1222
|
+
axes: [],
|
|
1223
|
+
annotations: [],
|
|
1224
|
+
frame: frame.frame,
|
|
1225
|
+
marks: {
|
|
1226
|
+
table: { x: gridX, y: gridY, w: tableW, h: tableH },
|
|
1227
|
+
headerBand: { x: gridX, y: gridY, w: tableW, h: headerH },
|
|
1228
|
+
columns: cols.map((col) => ({ id: col.id, ...colX.get(col.id) })),
|
|
1229
|
+
rows: rows.map((row) => ({ id: row.id, ...rowY.get(row.id) }))
|
|
1230
|
+
},
|
|
1231
|
+
derived: { table, computedCells: resolved.computedCells },
|
|
1232
|
+
a11y: { title: accessibleTitle(options2.title, "Table"), counts: [structureCount("rows", dataRows.length), structureCount("columns", cols.length)], desc: `Table with ${dataRows.length} rows and ${cols.length} columns` },
|
|
1233
|
+
warnings: warnings2,
|
|
1234
|
+
paintWarningRules: void 0,
|
|
1235
|
+
debug: { occupied: [], decisions: [] }
|
|
1236
|
+
}, plannedWarnings = [...warnings2];
|
|
1237
|
+
return deferLayout(geometry, () => {
|
|
1238
|
+
warnings2 = [...plannedWarnings];
|
|
1239
|
+
let nodes = [...frame.nodes];
|
|
1240
|
+
plannedCuts();
|
|
1241
|
+
let numericStats = /* @__PURE__ */ new Map();
|
|
1242
|
+
for (let col of cols) {
|
|
1243
|
+
if (col.kind !== "value" && col.kind !== "computed") continue;
|
|
1244
|
+
let values = [], textReserve = 0;
|
|
1245
|
+
for (let row of rows) {
|
|
1246
|
+
let cell = row.cells[col.id];
|
|
1247
|
+
cell && (cell.state === "value" && typeof cell.raw == "number" && values.push(cell.raw), textReserve = Math.max(textReserve, measure(cell.displayed, figureFont(cellFont(cell), cellDrawsTabular(theme, col.kind, cell.displayed))).width));
|
|
1248
|
+
}
|
|
1249
|
+
let signed = col.kind === "computed" && !!col.polarity || (col.format ? parseFormatExample(col.format).signed : !1);
|
|
1250
|
+
numericStats.set(col.id, {
|
|
1251
|
+
min: values.length > 0 ? minOf(values) : 0,
|
|
1252
|
+
max: values.length > 0 ? maxOf(values) : 0,
|
|
1253
|
+
maxAbs: values.length > 0 ? maxOf(values.map((value) => Math.abs(value))) : 0,
|
|
1254
|
+
textReserve,
|
|
1255
|
+
signed
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
let sparkDomains = sparklineDomains(cols, rows);
|
|
1259
|
+
if (hasGroupHeads) {
|
|
1260
|
+
let headingFrom = -1 / 0, headingEnd = -1 / 0;
|
|
1261
|
+
for (let [groupIndex, g] of table.columnGroups.entries()) {
|
|
1262
|
+
if (spans[groupIndex].span === 0 || g.heading === !1) continue;
|
|
1263
|
+
let tracks = g.columnIds.filter((columnId) => colX.has(columnId)).map((columnId) => colX.get(columnId)), first = tracks.reduce((a, b) => b.x < a.x ? b : a), last = tracks.reduce((a, b) => b.x + b.w > a.x + a.w ? b : a), cx = Math.round(first.x + (last.x + last.w - first.x) / 2), bracketY = groupPad === void 0 ? gridY + headerGroupH - 3 + CRISP : gridY + groupPad.top + groupExtraH + ladder.headBox(fonts.group.size) + CRISP, label = groupHeadingLabel(g.label), lineCount = groupLineCount(g.id), labelY = groupPad === void 0 ? bracketY - 4 - fonts.group.size * 1.2 - (lineCount - 1) * groupLineH : gridY + groupPad.top + groupExtraH - (lineCount - 1) * groupLineH + (ladder.headBox(fonts.group.size) - fonts.group.size * 1.2) / 2, note = groupHeadingNote(g.note), faces = groupHeadingFaces(fonts.group), noteFont = faces.note, measured = groupHeadingWidth(g, faces, measure), trackedW = measured.label, labelW = trackedW + measured.note, spanStart = Math.round(first.x + cellPadX2), spanEnd = Math.round(last.x + last.w - cellPadX2), wrap = groupWraps.get(g.id);
|
|
1264
|
+
if (wrap !== void 0) {
|
|
1265
|
+
let align = groupAlign === "left" ? "start" : groupAlign === "right" ? "end" : "middle", anchorX = align === "start" ? spanStart : align === "end" ? spanEnd : cx;
|
|
1266
|
+
nodes.push({
|
|
1267
|
+
t: "text",
|
|
1268
|
+
typeRole: "axis",
|
|
1269
|
+
id: `group:${g.id}`,
|
|
1270
|
+
x: anchorX,
|
|
1271
|
+
y: labelY,
|
|
1272
|
+
lines: wrap.label,
|
|
1273
|
+
align,
|
|
1274
|
+
font: fonts.group,
|
|
1275
|
+
ink: tableInk("head"),
|
|
1276
|
+
owner: {},
|
|
1277
|
+
part: "tableGroupHeader"
|
|
1278
|
+
}), wrap.note !== void 0 && nodes.push({
|
|
1279
|
+
t: "text",
|
|
1280
|
+
typeRole: "footnote",
|
|
1281
|
+
id: `group-note:${g.id}`,
|
|
1282
|
+
x: anchorX,
|
|
1283
|
+
y: labelY + wrap.label.length * groupLineH,
|
|
1284
|
+
lines: [wrap.note],
|
|
1285
|
+
align,
|
|
1286
|
+
font: noteFont,
|
|
1287
|
+
ink: tableInk("secondary"),
|
|
1288
|
+
owner: {},
|
|
1289
|
+
part: "tableGroupHeader"
|
|
1290
|
+
});
|
|
1291
|
+
let textW = Math.max(
|
|
1292
|
+
...wrap.label.map((line) => measure(line, fonts.group).width),
|
|
1293
|
+
wrap.note === void 0 ? 0 : measure(wrap.note, noteFont).width
|
|
1294
|
+
), textStart = align === "start" ? spanStart : Math.round(align === "end" ? spanEnd - textW : cx - textW / 2);
|
|
1295
|
+
nodes.push({
|
|
1296
|
+
t: "line",
|
|
1297
|
+
id: `group-rule:${g.id}`,
|
|
1298
|
+
x1: spanRule ? spanStart : textStart,
|
|
1299
|
+
y1: bracketY,
|
|
1300
|
+
x2: spanRule ? spanEnd : Math.round(textStart + textW),
|
|
1301
|
+
y2: bracketY,
|
|
1302
|
+
stroke: tableRuleInk(),
|
|
1303
|
+
width: rowRuleWidth,
|
|
1304
|
+
owner: {},
|
|
1305
|
+
part: "tableGroupRule"
|
|
1306
|
+
}), headingFrom = first.x, headingEnd = spanEnd;
|
|
1307
|
+
continue;
|
|
1308
|
+
}
|
|
1309
|
+
let overflows = labelW > spanEnd - spanStart, centred = groupAlign === "center" && !overflows, clear = first.x > headingFrom ? Math.round(headingEnd + fonts.group.size) : -1 / 0, startX = overflows || groupAlign === "left" ? Math.max(spanStart, clear) : Math.round(groupAlign === "right" ? spanEnd - labelW : cx - labelW / 2);
|
|
1310
|
+
headingFrom = first.x, headingEnd = centred ? cx + labelW / 2 : startX + labelW, centred ? note === void 0 ? nodes.push({
|
|
1311
|
+
t: "text",
|
|
1312
|
+
typeRole: "axis",
|
|
1313
|
+
id: `group:${g.id}`,
|
|
1314
|
+
x: cx,
|
|
1315
|
+
y: labelY,
|
|
1316
|
+
lines: [label],
|
|
1317
|
+
align: "middle",
|
|
1318
|
+
font: fonts.group,
|
|
1319
|
+
ink: tableInk("head"),
|
|
1320
|
+
owner: {},
|
|
1321
|
+
part: "tableGroupHeader"
|
|
1322
|
+
}) : (nodes.push({
|
|
1323
|
+
t: "text",
|
|
1324
|
+
typeRole: "axis",
|
|
1325
|
+
id: `group:${g.id}`,
|
|
1326
|
+
x: startX,
|
|
1327
|
+
y: labelY,
|
|
1328
|
+
lines: [label],
|
|
1329
|
+
align: "start",
|
|
1330
|
+
font: fonts.group,
|
|
1331
|
+
ink: tableInk("head"),
|
|
1332
|
+
owner: {},
|
|
1333
|
+
part: "tableGroupHeader"
|
|
1334
|
+
}), nodes.push({
|
|
1335
|
+
t: "text",
|
|
1336
|
+
typeRole: "footnote",
|
|
1337
|
+
id: `group-note:${g.id}`,
|
|
1338
|
+
x: startX + trackedW,
|
|
1339
|
+
y: labelY,
|
|
1340
|
+
lines: [note],
|
|
1341
|
+
align: "start",
|
|
1342
|
+
font: noteFont,
|
|
1343
|
+
ink: tableInk("secondary"),
|
|
1344
|
+
owner: {},
|
|
1345
|
+
part: "tableGroupHeader"
|
|
1346
|
+
})) : (nodes.push({
|
|
1347
|
+
t: "text",
|
|
1348
|
+
typeRole: "axis",
|
|
1349
|
+
id: `group:${g.id}`,
|
|
1350
|
+
x: startX,
|
|
1351
|
+
y: labelY,
|
|
1352
|
+
lines: [label],
|
|
1353
|
+
align: "start",
|
|
1354
|
+
font: fonts.group,
|
|
1355
|
+
ink: tableInk("head"),
|
|
1356
|
+
owner: {},
|
|
1357
|
+
part: "tableGroupHeader"
|
|
1358
|
+
}), note !== void 0 && nodes.push({
|
|
1359
|
+
t: "text",
|
|
1360
|
+
typeRole: "footnote",
|
|
1361
|
+
id: `group-note:${g.id}`,
|
|
1362
|
+
x: startX + trackedW,
|
|
1363
|
+
y: labelY,
|
|
1364
|
+
lines: [note],
|
|
1365
|
+
align: "start",
|
|
1366
|
+
font: noteFont,
|
|
1367
|
+
ink: tableInk("secondary"),
|
|
1368
|
+
owner: {},
|
|
1369
|
+
part: "tableGroupHeader"
|
|
1370
|
+
})), nodes.push({
|
|
1371
|
+
t: "line",
|
|
1372
|
+
id: `group-rule:${g.id}`,
|
|
1373
|
+
x1: spanRule ? spanStart : centred ? Math.round(cx - labelW / 2) : startX,
|
|
1374
|
+
y1: bracketY,
|
|
1375
|
+
// A heading wider than its block runs on, but the rule stops at the block's last column.
|
|
1376
|
+
x2: spanRule ? spanEnd : Math.round(centred ? cx + labelW / 2 : startX + labelW),
|
|
1377
|
+
y2: bracketY,
|
|
1378
|
+
stroke: tableRuleInk(),
|
|
1379
|
+
width: rowRuleWidth,
|
|
1380
|
+
owner: {},
|
|
1381
|
+
part: "tableGroupRule"
|
|
1382
|
+
});
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
let headerRuleY = gridY + headerH - 1 + CRISP, headerSubY = headerRuleY - headPadBottom - headerSubH - fonts.header.size * 1.2 + fonts.header.size * 1.2;
|
|
1386
|
+
for (let col of headsDrawn ? cols : []) {
|
|
1387
|
+
if (!col.label && col.kind === "rowLabel") continue;
|
|
1388
|
+
let { x: cx, w } = colX.get(col.id), headAlign = col.headAlign ?? col.align, align = headAlign === "right" ? "end" : headAlign === "center" ? "middle" : "start", headerIndent = col.kind === "rowLabel" ? rowIndent(0) : 0, tx = align === "end" ? cx + w - cellPadX2 : align === "middle" ? cx + w / 2 : cx + cellPadX2 + headerIndent, label = columnHeaderText(col).replace(/\u00a0/g, " ");
|
|
1389
|
+
nodes.push({
|
|
1390
|
+
t: "text",
|
|
1391
|
+
typeRole: "axis",
|
|
1392
|
+
id: `header:${col.id}`,
|
|
1393
|
+
x: tx,
|
|
1394
|
+
y: headerSubY - headerFits.get(col.id).h,
|
|
1395
|
+
lines: headerFits.get(col.id).lines,
|
|
1396
|
+
...headerFits.get(col.id).title ? { title: label } : {},
|
|
1397
|
+
align,
|
|
1398
|
+
font: fonts.header,
|
|
1399
|
+
ink: tableInk("head"),
|
|
1400
|
+
owner: { colId: col.id },
|
|
1401
|
+
part: "tableHeader"
|
|
1402
|
+
}), col.subLabel !== void 0 && nodes.push({
|
|
1403
|
+
t: "text",
|
|
1404
|
+
typeRole: "axis",
|
|
1405
|
+
id: `header-sub:${col.id}`,
|
|
1406
|
+
x: tx,
|
|
1407
|
+
y: headerSubY,
|
|
1408
|
+
lines: subFits.get(col.id).lines,
|
|
1409
|
+
...subFits.get(col.id).title ? { title: col.subLabel } : {},
|
|
1410
|
+
align,
|
|
1411
|
+
font: fonts.sub,
|
|
1412
|
+
ink: tableInk("subLabel"),
|
|
1413
|
+
owner: { colId: col.id },
|
|
1414
|
+
part: "tableHeaderSub"
|
|
1415
|
+
});
|
|
1416
|
+
}
|
|
1417
|
+
headsDrawn && nodes.push({
|
|
1418
|
+
t: "line",
|
|
1419
|
+
id: "rule:header",
|
|
1420
|
+
x1: rowX,
|
|
1421
|
+
y1: headerRuleY,
|
|
1422
|
+
x2: rowX + rowW,
|
|
1423
|
+
y2: headerRuleY,
|
|
1424
|
+
// `table.headRule: 'ink'` closes the head on the text ink.
|
|
1425
|
+
stroke: { token: theme.table?.headRule === "ink" ? "ink" : "rule" },
|
|
1426
|
+
width: theme.table?.ruleWidths?.head ?? strokeToken(theme, "hair"),
|
|
1427
|
+
owner: {},
|
|
1428
|
+
part: "tableHeaderRule"
|
|
1429
|
+
});
|
|
1430
|
+
let bodyBottom = rowY.size > 0 ? maxOf([...rowY.values()].map((r) => r.y + r.h)) : gridY + headerH, spacerGaps = [];
|
|
1431
|
+
rows.forEach((row, index) => {
|
|
1432
|
+
if (index === 0 || row.spacer === void 0) return;
|
|
1433
|
+
let previous = rowY.get(rows[index - 1].id);
|
|
1434
|
+
spacerGaps.push({ from: previous.y + previous.h, to: rowY.get(row.id).y });
|
|
1435
|
+
});
|
|
1436
|
+
let blockDivider = (id, columnId, fromY = gridY) => {
|
|
1437
|
+
let edge = colX.get(columnId)?.x;
|
|
1438
|
+
edge === void 0 || edge <= gridX || dividerAt(id, Math.round(edge) + CRISP, fromY);
|
|
1439
|
+
};
|
|
1440
|
+
function dividerAt(id, x, fromY) {
|
|
1441
|
+
if (nodes.some((node) => node.t === "line" && node.x1 === x && node.part === "tableGroupDivider")) return;
|
|
1442
|
+
let segments = [], start = fromY;
|
|
1443
|
+
for (let gap of spacerGaps)
|
|
1444
|
+
gap.from <= start || (segments.push([start, Math.round(gap.from) + CRISP]), start = Math.round(gap.to));
|
|
1445
|
+
segments.push([start, Math.round(bodyBottom) + CRISP]), segments.forEach(([y1, y2], index) => nodes.push({
|
|
1446
|
+
t: "line",
|
|
1447
|
+
id: index === 0 ? id : `${id}:${index}`,
|
|
1448
|
+
x1: x,
|
|
1449
|
+
y1,
|
|
1450
|
+
x2: x,
|
|
1451
|
+
y2,
|
|
1452
|
+
stroke: tableRuleInk(),
|
|
1453
|
+
width: rowRuleWidth,
|
|
1454
|
+
owner: {},
|
|
1455
|
+
part: "tableGroupDivider"
|
|
1456
|
+
}));
|
|
1457
|
+
}
|
|
1458
|
+
if (hasGroups)
|
|
1459
|
+
for (let [groupIndex, g] of table.columnGroups.entries()) {
|
|
1460
|
+
if (groupIndex === 0 || spans[groupIndex].span === 0 || g.spacer !== void 0 && g.spacer > 0) continue;
|
|
1461
|
+
let firstVisible = g.columnIds.find((columnId) => colX.has(columnId));
|
|
1462
|
+
firstVisible !== void 0 && blockDivider(`rule:group-divider:${g.id}`, firstVisible);
|
|
1463
|
+
}
|
|
1464
|
+
for (let run of bandedColumnRuns)
|
|
1465
|
+
blockDivider(`rule:band-divider:${run.columnIds[0]}`, run.columnIds[0], gridY + headerGroupH);
|
|
1466
|
+
let closeBlock = (id, lastId, fromY) => {
|
|
1467
|
+
let index = cols.findIndex((col) => col.id === lastId), next = cols[index + 1];
|
|
1468
|
+
if (next !== void 0) {
|
|
1469
|
+
let nextGroup = table.columnGroups.find((group) => group.columnIds.includes(next.id));
|
|
1470
|
+
nextGroup !== void 0 && (nextGroup.spacer ?? 0) > 0 && nextGroup.columnIds.find((columnId) => colX.has(columnId)) === next.id || blockDivider(id, next.id, fromY);
|
|
1471
|
+
return;
|
|
1472
|
+
}
|
|
1473
|
+
if (options2.rowExtent !== "frame") return;
|
|
1474
|
+
let last = colX.get(lastId);
|
|
1475
|
+
dividerAt(id, Math.round(last.x + last.w) - 1 + CRISP, fromY);
|
|
1476
|
+
};
|
|
1477
|
+
for (let group of table.columnGroups) {
|
|
1478
|
+
if (group.band !== !0) continue;
|
|
1479
|
+
let visible = group.columnIds.filter((columnId) => colX.has(columnId));
|
|
1480
|
+
visible.length > 0 && closeBlock(`rule:band-close:${group.id}`, visible[visible.length - 1], gridY);
|
|
1481
|
+
}
|
|
1482
|
+
for (let run of bandedColumnRuns)
|
|
1483
|
+
closeBlock(`rule:band-close:${run.columnIds[run.columnIds.length - 1]}`, run.columnIds[run.columnIds.length - 1], gridY + headerGroupH);
|
|
1484
|
+
let bandPaint = semanticPalettePaint(theme, options2.palette, "neutral", 1 - surface.bandTint), totalGroundPaint = semanticPalettePaint(
|
|
1485
|
+
theme,
|
|
1486
|
+
options2.palette,
|
|
1487
|
+
"neutral",
|
|
1488
|
+
1 - Math.min(1, surface.bandTint * 2)
|
|
1489
|
+
), strongColumnBandPaint = {
|
|
1490
|
+
token: "neutral",
|
|
1491
|
+
theme: { kind: "mix", from: { token: "ink" }, to: totalGroundPaint, weight: surface.bandTint }
|
|
1492
|
+
}, grounds = rowGrounds(table), columnBandFills = /* @__PURE__ */ new Map(), rowWashes = /* @__PURE__ */ new Map(), bandedGroups = table.columnGroups.filter((g) => g.band === !0), bandRect = (g) => {
|
|
1493
|
+
let visible = g.columnIds.filter((columnId) => colX.has(columnId));
|
|
1494
|
+
if (visible.length === 0) return;
|
|
1495
|
+
let first = colX.get(visible[0]), last = colX.get(visible[visible.length - 1]);
|
|
1496
|
+
return { x: first.x, w: last.x + last.w - first.x };
|
|
1497
|
+
}, groundMode = options2.groupGround ?? theme.table?.groupGround ?? "expanded", groundShown = (open) => groundMode === "always" || groundMode === "expanded" && open, closers = finalClosers(rows), totalGroundless = theme.table?.grounds?.total !== void 0 && transparentCss(theme.table.grounds.total), rowById = new Map(rows.map((row) => [row.id, row])), topOf = (row) => {
|
|
1498
|
+
let top = row;
|
|
1499
|
+
for (; top.parentId !== void 0 && rowById.has(top.parentId); ) top = rowById.get(top.parentId);
|
|
1500
|
+
return top;
|
|
1501
|
+
}, blockRuled = /* @__PURE__ */ new Set(), opensBlock = (row) => row.parentId === void 0 && row.role !== "section" && expandedIds.has(row.id), blockRuleAbove = (row, next) => theme.table?.blockRule === "rule" && next.parentId === void 0 && (opensBlock(next) || next.id !== topOf(row).id && opensBlock(topOf(row))), lastRow = rows[rows.length - 1];
|
|
1502
|
+
rows.forEach((row, ri) => {
|
|
1503
|
+
let { y: ry, h: rh } = rowY.get(row.id), isTotal = row.role === "total" && row.kind !== "result" && row.kind !== "driver", isSection = row.role === "section", ground = row.kind === "member" ? expandedIds.has(row.id) && groundMode !== "none" ? "band" : void 0 : row.kind === "measure" || row.kind === "detail" || row.kind === "split" || row.kind === "subtotal" || row.kind === "result" || row.kind === "driver" ? void 0 : isTotal ? "emphasis" : language.groupBand && groundShown(expandedIds.has(row.id)) ? grounds.get(row.id) : void 0;
|
|
1504
|
+
ri > 0 && row.kind === "member" ? nodes.push(rule(`rule:member:${row.id}`, ry, { token: "rule" }, strokeToken(theme, "rule"), "tableMemberRule")) : ri > 0 && row.divider && nodes.push(rule(`rule:divider:${row.id}`, ry, { token: "rule" }, strokeToken(theme, "rule"), "tableDividerRule"));
|
|
1505
|
+
let customGround = authoredGround(row, isTotal);
|
|
1506
|
+
if (customGround !== void 0 && nodes.push({ t: "rect", id: `statementground:${row.id}`, rect: { x: rowX, y: ry, w: rowW, h: rh }, fill: { css: customGround }, owner: { rowId: row.id }, part: "tableStatementGround" }), row.kind === "result" && theme.table?.resultRule !== "none" && nodes.push(rule(`rule:result:${row.id}`, ry, { token: theme.table?.resultRule === "rule" ? "rule" : "ink" }, strokeToken(theme, "hair"), "tableResultRule")), ground !== void 0 && customGround === void 0 && !(isTotal && totalGroundless)) {
|
|
1507
|
+
let part = isTotal ? "tableTotalGround" : ground === "emphasis" ? "tableGroupGround" : "tableGroupBand";
|
|
1508
|
+
nodes.push({
|
|
1509
|
+
t: "rect",
|
|
1510
|
+
id: `${isTotal ? "totalground" : ground === "emphasis" ? "groupground" : "groupband"}:${row.id}`,
|
|
1511
|
+
rect: blockRuled.has(row.id) ? { x: rowX, y: ry + 1, w: rowW, h: rh - 1 } : { x: rowX, y: ry, w: rowW, h: rh },
|
|
1512
|
+
fill: isTotal ? totalGroundPaint : bandPaint,
|
|
1513
|
+
owner: { rowId: row.id },
|
|
1514
|
+
part
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
for (let g of [...bandedGroups, ...bandedColumnRuns]) {
|
|
1518
|
+
let band = bandRect(g);
|
|
1519
|
+
if (band !== void 0) {
|
|
1520
|
+
for (let id of g.columnIds) columnBandFills.set(`${row.id}\0${id}`, ground === "emphasis" ? strongColumnBandPaint : totalGroundPaint);
|
|
1521
|
+
nodes.push({
|
|
1522
|
+
t: "rect",
|
|
1523
|
+
id: `columnband:${"id" in g ? g.id : g.columnIds[0]}:${row.id}`,
|
|
1524
|
+
rect: { x: band.x, y: ry, w: band.w, h: rh },
|
|
1525
|
+
fill: ground === "emphasis" ? strongColumnBandPaint : totalGroundPaint,
|
|
1526
|
+
owner: { rowId: row.id },
|
|
1527
|
+
part: "tableColumnBand"
|
|
1528
|
+
});
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
let rowWash;
|
|
1532
|
+
if (options2.anchorWash && row.step === 0 && row.hasChildren && row.defaultExpanded && (rowWash = semanticPalettePaint(theme, options2.palette, "neutral", surface.anchorTint), nodes.push({
|
|
1533
|
+
t: "rect",
|
|
1534
|
+
id: `anchorwash:${row.id}`,
|
|
1535
|
+
rect: { x: rowX, y: ry, w: rowW, h: rh },
|
|
1536
|
+
fill: rowWash,
|
|
1537
|
+
owner: { rowId: row.id },
|
|
1538
|
+
part: "tableAnchorTint"
|
|
1539
|
+
})), row.highlightTone) {
|
|
1540
|
+
let tone = row.highlightTone, edgePaint = tone === "highlight" ? semanticPalettePaint(theme, options2.palette, "focus") : { token: tone };
|
|
1541
|
+
rowWash = tone === "highlight" ? semanticPalettePaint(theme, options2.palette, "focus", surface.rowTint) : { ...markRolePaint(tone, !0), tint: surface.rowTint }, nodes.push({
|
|
1542
|
+
t: "rect",
|
|
1543
|
+
id: `rowtint:${row.id}`,
|
|
1544
|
+
rect: { x: rowX, y: ry, w: rowW, h: rh },
|
|
1545
|
+
fill: rowWash,
|
|
1546
|
+
owner: { rowId: row.id },
|
|
1547
|
+
part: "tableRowTint"
|
|
1548
|
+
}), nodes.push({
|
|
1549
|
+
t: "rect",
|
|
1550
|
+
id: `rowedge:${row.id}`,
|
|
1551
|
+
rect: { x: rowX, y: ry, w: 3, h: rh },
|
|
1552
|
+
fill: edgePaint,
|
|
1553
|
+
owner: { rowId: row.id },
|
|
1554
|
+
part: "tableRowEdge"
|
|
1555
|
+
});
|
|
1556
|
+
}
|
|
1557
|
+
rowWash !== void 0 && rowWashes.set(row.id, rowWash);
|
|
1558
|
+
for (let col of cols) {
|
|
1559
|
+
let cell = row.cells[col.id];
|
|
1560
|
+
if (!cell) continue;
|
|
1561
|
+
let { x: cx, w } = colX.get(col.id);
|
|
1562
|
+
if (col.kind === "encoding") {
|
|
1563
|
+
pushAll(
|
|
1564
|
+
nodes,
|
|
1565
|
+
encodingSparklineNodes(col, row, { x: cx, y: ry, w, h: rh }, theme, options2.palette, measure, sparkDomains.get(col.id), options2.locale?.language)
|
|
1566
|
+
);
|
|
1567
|
+
continue;
|
|
1568
|
+
}
|
|
1569
|
+
if ((isSection || row.kind === "member" && expandedIds.has(row.id)) && col.kind !== "rowLabel") continue;
|
|
1570
|
+
let drop = isSection ? Math.max(0, rh - sectionNatural() - (rowExtra.get(row.id) ?? 0)) : 0;
|
|
1571
|
+
emitCell(cell, row, col.id, cx, w, ry + drop, rh - drop, isTotal, isSection);
|
|
1572
|
+
}
|
|
1573
|
+
let isLast = row.id === lastRow?.id, next = rows[ri + 1], spacedNext = next?.spacer !== void 0;
|
|
1574
|
+
if (closers.has(row.id)) {
|
|
1575
|
+
let finalRule = theme.table?.finalRule ?? "double";
|
|
1576
|
+
finalRule === "double" ? (nodes.push(rule(`rule:final:${row.id}:1`, ry + rh - 2, { token: "ink" }, strokeToken(theme, "hair"), "tableFinalRule")), nodes.push(rule(`rule:final:${row.id}:2`, ry + rh, { token: "ink" }, strokeToken(theme, "hair"), "tableFinalRule"))) : finalRule === "rule" && nodes.push(rule(`rule:final:${row.id}`, ry + rh, { token: "rule" }, strokeToken(theme, "hair"), "tableFinalRule"));
|
|
1577
|
+
} else if (next?.kind !== "result") {
|
|
1578
|
+
if (spacedNext && next.role === "total")
|
|
1579
|
+
nodes.push(rule(`rule:pre-total:${next.id}`, rowY.get(next.id).y, { token: "rule" }, strokeToken(theme, "rule"), "tableTotalRule")), isTotal && nodes.push(rule(`rule:total:${row.id}`, ry + rh, { token: "rule" }, strokeToken(theme, "rule"), "tableTotalRule"));
|
|
1580
|
+
else if (!(spacedNext && !isTotal))
|
|
1581
|
+
if (isTotal && next)
|
|
1582
|
+
nodes.push(rule(`rule:total:${row.id}`, ry + rh, { token: "rule" }, strokeToken(theme, "rule"), "tableTotalRule"));
|
|
1583
|
+
else if (isLast) {
|
|
1584
|
+
let close = isTotal ? "rule" : theme.table?.closeRule ?? "rule";
|
|
1585
|
+
close !== "none" && nodes.push(rule("rule:close", ry + rh, close === "grid" ? tableRuleInk() : { token: close }, close === "grid" ? rowRuleWidth : strokeToken(theme, "rule"), "tableCloseRule"));
|
|
1586
|
+
} else next?.role === "total" ? nodes.push(rule(`rule:pre-total:${next.id}`, ry + rh, { token: "rule" }, strokeToken(theme, "rule"), "tableTotalRule")) : isSection && heavySectionRule || (isSection ? nodes.push(rule(`rule:section:${row.id}`, ry + rh, theme.table?.headRule === "ink" ? { token: "ink" } : tableRuleInk(), rowRuleWidth, "tableSectionRule")) : next !== void 0 && blockRuleAbove(row, next) ? (nodes.push(rule(`rule:block:${next.id}`, ry + rh, { token: "rule" }, strokeToken(theme, "rule"), "tableBlockRule")), blockRuled.add(next.id)) : nodes.push(rule(`rule:row:${row.id}`, ry + rh, rowRule.paint, rowRule.width, "tableRowRule")));
|
|
1587
|
+
}
|
|
1588
|
+
let ruleRefused = isLast && theme.table?.closeRule === "none" || next?.kind === "result" && theme.table?.resultRule === "none";
|
|
1589
|
+
if (isSection && heavySectionRule && !ruleRefused) {
|
|
1590
|
+
let atY = Math.round(ry + rh) + ruleSpace - sectionRuleSpace / 2;
|
|
1591
|
+
nodes.push({ t: "line", id: `rule:section:${row.id}`, x1: rowX, y1: atY, x2: rowX + rowW, y2: atY, stroke: { token: "ink" }, width: sectionRuleWidth, owner: {}, part: "tableSectionRule" });
|
|
1592
|
+
}
|
|
1593
|
+
});
|
|
1594
|
+
function rule(id, atY, stroke, width, part) {
|
|
1595
|
+
let yCrisp = Math.round(atY) + CRISP;
|
|
1596
|
+
return { t: "line", id, x1: rowX, y1: yCrisp, x2: rowX + rowW, y2: yCrisp, stroke, width, owner: {}, part };
|
|
1597
|
+
}
|
|
1598
|
+
function usesTotalFace(kind) {
|
|
1599
|
+
return kind === void 0 ? !0 : kind === "subtotal" || kind === "result" || kind === "driver" ? !1 : kind !== "member" && kind !== "measure" || theme.table?.weights?.figures?.[kind] === void 0;
|
|
1600
|
+
}
|
|
1601
|
+
function emitStatusMark(cell, row, col, cx, w, ry, rh) {
|
|
1602
|
+
let owner = { rowId: row.id, colId: col.id }, square = statusSquare(fonts.body.size), side = Math.min(square.side, Math.max(0, w - 2));
|
|
1603
|
+
nodes.push({
|
|
1604
|
+
t: "rect",
|
|
1605
|
+
id: tableCellNodeId("chip", row.id, col.id),
|
|
1606
|
+
rect: { x: Math.round(cx + (w - side) / 2), y: Math.round(ry + (rh - side) / 2), w: side, h: side },
|
|
1607
|
+
fill: statusSquarePaint(cell.tone),
|
|
1608
|
+
owner,
|
|
1609
|
+
part: "tableChip",
|
|
1610
|
+
title: cell.displayed,
|
|
1611
|
+
display: { state: cell.displayed }
|
|
1612
|
+
}), noteStatusCut(col, row, "", cell.displayed);
|
|
1613
|
+
}
|
|
1614
|
+
function authoredGround(row, isTotal) {
|
|
1615
|
+
let css = row.kind === "subtotal" ? theme.table?.grounds?.subtotal : isTotal ? theme.table?.grounds?.total : void 0;
|
|
1616
|
+
return css === void 0 || transparentCss(css) ? void 0 : css;
|
|
1617
|
+
}
|
|
1618
|
+
function groundInk(ground, ink, tone) {
|
|
1619
|
+
if (ground === void 0 || "theme" in ink && ink.theme?.kind === "ground-text") return ink;
|
|
1620
|
+
let paint = onTableGround(ink, ground, tone), key = JSON.stringify(paint), known = groundTexts.get(key);
|
|
1621
|
+
return known !== void 0 ? known : (groundTexts.set(key, paint), paint);
|
|
1622
|
+
}
|
|
1623
|
+
function toneInk(ground, tone) {
|
|
1624
|
+
return groundInk(ground, toneTextPaint(theme, tone, options2.palette), tone);
|
|
1625
|
+
}
|
|
1626
|
+
function emitCell(cell, row, colId, cx, w, ry, rh, isTotal, isSection) {
|
|
1627
|
+
let rowId = row.id, col = cols.find((c) => c.id === colId), font = cellFont(cell), owner = { rowId, colId };
|
|
1628
|
+
cell.state === "open" && nodes.push({ t: "rect", id: tableCellNodeId("openground", rowId, colId), rect: { x: cx, y: ry, w, h: rh }, fill: bandPaint, owner, part: "tableOpenGround" });
|
|
1629
|
+
let inline = inlineBlock(row), valueBox = lineBox(font.size), head = inline.extra > 0 || affixBelow.has(rowId) ? labelHead.get(rowId) ?? 0 : 0, blockTop = ry + Math.max(0, (rh - ruleSpace - (valueBox + head + inline.extra)) / 2), figureCell = isFigureCell(cell, col), tintBox = { x: cx + 1, y: ry + ruleSpace + 1, w: Math.max(0, w - 2), h: Math.max(0, rh - ruleSpace - 2) }, toneFill = figureCell && cell.tone !== "neutral" && theme.table?.tones === "fill" && !isTotal ? tableGround(cell.tone === "good" && cell.strong ? "goodStrong" : cell.tone) : void 0;
|
|
1630
|
+
toneFill !== void 0 && nodes.push({ t: "rect", id: tableCellNodeId("toneground", rowId, colId), rect: tintBox, fill: toneFill, owner, part: "tableToneGround" });
|
|
1631
|
+
let rowGround = authoredGround(row, isTotal), columnBand = columnBandFills.get(`${rowId}\0${colId}`), textGround = toneFill ?? (rowGround === void 0 ? columnBand === strongColumnBandPaint && !rowWashes.has(rowId) ? columnBand : void 0 : rowWashes.get(rowId) ?? columnBand ?? { css: rowGround });
|
|
1632
|
+
if (figureCell && cell.bar !== void 0 && cell.bar > 0) {
|
|
1633
|
+
let top = (inline.extra + head > 0 ? blockTop : ry + (rh - ruleSpace - valueBox) / 2) + 2;
|
|
1634
|
+
nodes.push({ t: "rect", id: tableCellNodeId("sizebar", rowId, colId), rect: { x: cx + 1, y: top, w: (w - 1) * cell.bar, h: valueBox - 4 }, fill: { token: "background", theme: { kind: "table-ground", ground: col.emphasis === "muted" ? "barMuted" : "bar" } }, owner, part: "tableSizeBar" });
|
|
1635
|
+
}
|
|
1636
|
+
let stacked = inline.extra + head > 0, textY = stacked ? blockTop + (valueBox - font.size * 1.2) / 2 : ry + (rh - font.size * 1.2) / 2, contentX = cx + cellPadX2, contentW = (isSection ? tableW - (cx - gridX) : w) - 2 * cellPadX2;
|
|
1637
|
+
if (cell.kind === "status" && cell.state === "value" && col.statusMark === "square") {
|
|
1638
|
+
let square = statusSquare(fonts.body.size), fit = statusFit(col, cell.displayed, fonts.body, w - 2 * cellPadX2 - square.side - square.gap, w - square.side - square.gap);
|
|
1639
|
+
if (fit === null) return emitStatusMark(cell, row, col, cx, w, ry, rh);
|
|
1640
|
+
let { text: label, title } = fit;
|
|
1641
|
+
title !== void 0 && noteStatusCut(col, row, label, title);
|
|
1642
|
+
let groupW = square.side + square.gap + measure(label, fonts.body).width, markX = Math.round(cx + (w - groupW) / 2);
|
|
1643
|
+
nodes.push({
|
|
1644
|
+
t: "rect",
|
|
1645
|
+
id: tableCellNodeId("chip", rowId, colId),
|
|
1646
|
+
rect: { x: markX, y: Math.round(ry + (rh - square.side) / 2), w: square.side, h: square.side },
|
|
1647
|
+
fill: statusSquarePaint(cell.tone),
|
|
1648
|
+
owner,
|
|
1649
|
+
part: "tableChip"
|
|
1650
|
+
}), nodes.push({
|
|
1651
|
+
t: "text",
|
|
1652
|
+
typeRole: "label",
|
|
1653
|
+
id: tableCellNodeId("cell", rowId, colId),
|
|
1654
|
+
x: markX + square.side + square.gap,
|
|
1655
|
+
y: ry + (rh - fonts.body.size * 1.2) / 2,
|
|
1656
|
+
lines: [label],
|
|
1657
|
+
align: "start",
|
|
1658
|
+
font: fonts.body,
|
|
1659
|
+
ink: groundInk(textGround, { token: "ink" }),
|
|
1660
|
+
owner,
|
|
1661
|
+
part: "tableCell",
|
|
1662
|
+
role: "category",
|
|
1663
|
+
display: { state: cell.displayed },
|
|
1664
|
+
...title === void 0 ? {} : { title }
|
|
1665
|
+
});
|
|
1666
|
+
return;
|
|
1667
|
+
}
|
|
1668
|
+
if (cell.kind === "status" && cell.state === "value") {
|
|
1669
|
+
let fit = statusFit(col, cell.displayed, fonts.chip, w - 2 * cellPadX2 - 2 * CHIP_PAD_X, w - 2 * CHIP_PAD_X);
|
|
1670
|
+
if (fit === null) return emitStatusMark(cell, row, col, cx, w, ry, rh);
|
|
1671
|
+
let { text: label, title } = fit;
|
|
1672
|
+
title !== void 0 && noteStatusCut(col, row, label, title);
|
|
1673
|
+
let tw = measure(label, fonts.chip).width, chipW = Math.round(tw + 2 * CHIP_PAD_X), chipH = chipHeight(rh, fonts.chip.size), chipX = Math.round(cx + (w - chipW) / 2), chipY = Math.round(ry + (rh - chipH) / 2), chip = chipPaints(theme, cell.tone, options2.palette);
|
|
1674
|
+
nodes.push({
|
|
1675
|
+
t: "rect",
|
|
1676
|
+
id: tableCellNodeId("chip", rowId, colId),
|
|
1677
|
+
rect: { x: chipX, y: chipY, w: chipW, h: chipH },
|
|
1678
|
+
fill: chip.fill,
|
|
1679
|
+
// A status preset's chips are square; everywhere else they keep the
|
|
1680
|
+
// theme's chip radius.
|
|
1681
|
+
radius: language.squareChips ? 0 : surface.chipRadius,
|
|
1682
|
+
owner,
|
|
1683
|
+
part: "tableChip"
|
|
1684
|
+
}), nodes.push({
|
|
1685
|
+
t: "text",
|
|
1686
|
+
typeRole: "label",
|
|
1687
|
+
id: tableCellNodeId("cell", rowId, colId),
|
|
1688
|
+
x: chipX + chipW / 2,
|
|
1689
|
+
y: chipY + (chipH - fonts.chip.size * 1.2) / 2,
|
|
1690
|
+
lines: [label],
|
|
1691
|
+
align: "middle",
|
|
1692
|
+
font: fonts.chip,
|
|
1693
|
+
ink: chip.ink,
|
|
1694
|
+
owner,
|
|
1695
|
+
part: "tableCell",
|
|
1696
|
+
role: "category",
|
|
1697
|
+
display: { state: cell.displayed },
|
|
1698
|
+
...title === void 0 ? {} : { title }
|
|
1699
|
+
});
|
|
1700
|
+
return;
|
|
1701
|
+
}
|
|
1702
|
+
let indent = cell.kind === "rowLabel" ? rowIndent(indentStep(cell)) : 0, align = col.align === "right" ? "end" : col.align === "center" ? "middle" : "start", tx = align === "end" ? cx + w - cellPadX2 : align === "middle" ? cx + w / 2 : contentX + indent, parentRow = cell.kind === "rowLabel" && row.hasChildren, expanded = parentRow && expandedIds.has(rowId);
|
|
1703
|
+
if (parentRow && options2.outlineMarks === !0 && row.foldable !== !1) {
|
|
1704
|
+
let boxed = (theme.table?.mark ?? (options2.variant === "steering" ? "boxed" : "bare")) === "boxed", mx = Math.round(Math.max(cx + 2, contentX + indent - operatorSlot - (theme.table?.toggle?.gap ?? (boxed ? 17 : 16)))), my = Math.round(stacked ? blockTop + (valueBox - MARK_SIZE) / 2 : ry + (rh - MARK_SIZE) / 2), toggleSize = theme.table?.toggle?.size ?? 11, boxY = my + (MARK_SIZE - toggleSize) / 2;
|
|
1705
|
+
boxed && nodes.push({ t: "path", id: `markbox:${rowId}`, d: `M${mx} ${boxY}h${toggleSize}v${toggleSize}h-${toggleSize}Z`, stroke: tableInk("toggle"), width: strokeToken(theme, "mark"), owner, part: "tableOutlineBox" }), nodes.push({
|
|
1706
|
+
t: "path",
|
|
1707
|
+
id: `mark:${rowId}`,
|
|
1708
|
+
d: boxed ? `M${mx + (toggleSize - 5) / 2} ${my + 4}h5${expanded ? "" : `M${mx + toggleSize / 2} ${my + 1.5}v5`}` : expanded ? `M${mx + 1} ${my + 4}h6` : `M${mx + 1} ${my + 4}h6M${mx + 4} ${my + 1}v6`,
|
|
1709
|
+
stroke: boxed ? { token: "ink" } : tableInk("toggle"),
|
|
1710
|
+
width: strokeToken(theme, "mark"),
|
|
1711
|
+
lineCap: "round",
|
|
1712
|
+
owner,
|
|
1713
|
+
part: "tableOutlineMark"
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
let badge = isSection && col.kind === "rowLabel" ? row.badge : void 0, badgeW = badge === void 0 ? 0 : Math.round(measure(badge.text, fonts.chip).width + 2 * CHIP_PAD_X), badgeReserve = badgeW === 0 ? 0 : badgeW + SECTION_CHIP_GAP, affixFont = theme.table?.qualifier === void 0 ? { ...inlineFont2(row.step, !1), weight: theme.type.label.weight, ...font.style ? { style: font.style } : {} } : qualifierFont(font, theme), affixWidth = col.kind === "rowLabel" && row.unitAffix !== void 0 && !(row.kind === "member" && expandedIds.has(row.id)) ? theme.table?.qualifier === void 0 ? measure(` ${row.unitAffix}`, affixFont).width : measure(row.unitAffix, affixFont).width + (theme.table.qualifier.gap ?? 4) : 0, lineAffix = affixBelow.has(rowId) ? 0 : affixWidth, maxW = contentW - indent - badgeReserve - lineAffix - (cell.note && col.kind !== "rowLabel" && col.noteLine !== !0 ? measure(` ${cell.note}`, fonts.note).width : 0), wrappedCell = wrappedLines.get(tableCellKey(rowId, colId)), { text, title: cutTitle } = plannedCellText.get(tableCellKey(rowId, colId)) ?? cellText(
|
|
1717
|
+
cell,
|
|
1718
|
+
col.kind,
|
|
1719
|
+
isSection,
|
|
1720
|
+
font,
|
|
1721
|
+
maxW,
|
|
1722
|
+
wrappedCell,
|
|
1723
|
+
cutTitles.get(tableCellKey(rowId, colId)),
|
|
1724
|
+
measure,
|
|
1725
|
+
theme.table?.section?.case
|
|
1726
|
+
), lines = wrappedCell ?? [text], sectionLabel = isSection && col.kind === "rowLabel";
|
|
1727
|
+
if (sectionLabel && align !== "start") {
|
|
1728
|
+
let groupW = measure(lines[lines.length - 1] ?? text, font).width / WIDTH_SAFETY + lineAffix + badgeReserve, start = contentX + indent;
|
|
1729
|
+
tx = align === "end" ? contentX + contentW - groupW : start + (contentX + contentW - start - groupW) / 2;
|
|
1730
|
+
}
|
|
1731
|
+
let drawnAlign = sectionLabel ? "start" : align, textTop = lines.length > 1 ? stacked ? blockTop : ry + (rh - lines.length * font.size * 1.2) / 2 : textY, drawnFont = cell.state !== "value" ? row.kind === "driver" ? kindFont(fonts.body, "driver", !1, theme) : fonts.body : isTotal && cell.kind !== "rowLabel" && usesTotalFace(row.kind) ? fonts.totalValue : col.emphasis === "strong" ? strongColumnFont(font, col, cell, row.kind, theme) : col.emphasis === "muted" && isCohortDensity(density) ? { ...font, weight: fonts.body.weight } : font, enc = col.cellEncoding, context = {
|
|
1732
|
+
cell,
|
|
1733
|
+
box: { x: cx, y: ry, w, h: rh },
|
|
1734
|
+
theme,
|
|
1735
|
+
...options2.palette === void 0 ? {} : { palette: options2.palette },
|
|
1736
|
+
...cell.tone === "neutral" || enc?.type !== "arrow" ? {} : { toneInk: toneInk(textGround, cell.tone) },
|
|
1737
|
+
measure,
|
|
1738
|
+
nodeId: (suffix) => tableCellNodeId(suffix, rowId, colId),
|
|
1739
|
+
owner
|
|
1740
|
+
}, stats = numericStats.get(colId), encodingInk, ownGround = hasPolarityBadge(cell, col), lane = heatLanes.get(colId);
|
|
1741
|
+
if ((col.kind === "value" || col.kind === "computed") && enc?.type === "heat" && lane) {
|
|
1742
|
+
let heat = emitHeat({ ...context, box: tintBox }, lane, enc), heatGround = heat.nodes.find((node) => node.t === "rect")?.fill;
|
|
1743
|
+
heatGround !== void 0 && (textGround = heatGround), nodes.push(...heat.nodes), !cell.deEmphasized && !(cell.relation === "ofWhich" && ofWhichMuted) && (encodingInk = heat.ink), heat.weight !== void 0 && !isTotal && (drawnFont = { ...drawnFont, weight: heat.weight });
|
|
1744
|
+
} else (col.kind === "value" || col.kind === "computed") && enc?.type === "inCellBar" && stats ? nodes.push(
|
|
1745
|
+
...emitInCellBar(context, {
|
|
1746
|
+
contentBox: { x: contentX, y: ry, w: contentW, h: rh },
|
|
1747
|
+
maxAbs: stats.maxAbs,
|
|
1748
|
+
textReserve: stats.textReserve
|
|
1749
|
+
})
|
|
1750
|
+
) : col.kind === "computed" && col.polarity && enc?.type === "arrow" && stats && nodes.push(...emitArrow(context, { scale: enc.scale, target: options2.target, textScale: textScaleOf(options2), font, maxAbs: stats.maxAbs, valueX: cx + w - cellPadX2 }));
|
|
1751
|
+
if (ownGround) {
|
|
1752
|
+
let badgeH = chipHeight(rh, font.size), tw = measure(text, figureFont(font, cellDrawsTabular(theme, col.kind, text))).width;
|
|
1753
|
+
nodes.push({
|
|
1754
|
+
t: "rect",
|
|
1755
|
+
id: tableCellNodeId("badge", rowId, colId),
|
|
1756
|
+
rect: {
|
|
1757
|
+
x: Math.round(cx + w - cellPadX2 - tw - 6),
|
|
1758
|
+
y: Math.round(textTop + (font.size * 1.2 - badgeH) / 2),
|
|
1759
|
+
w: Math.round(tw + 12),
|
|
1760
|
+
h: badgeH
|
|
1761
|
+
},
|
|
1762
|
+
fill: chipPaints(theme, cell.tone, options2.palette).fill,
|
|
1763
|
+
radius: surface.chipRadius,
|
|
1764
|
+
owner,
|
|
1765
|
+
part: "tableBadge"
|
|
1766
|
+
}), tx = cx + w - cellPadX2;
|
|
1767
|
+
}
|
|
1768
|
+
let isGlyph = cell.state !== "value", quiet = col.emphasis === "muted", driverToned = row.driverTone === !0 && cell.kind !== "rowLabel" && cell.state === "value" && cell.tone !== "neutral", plainInk = row.kind === "driver" && !driverToned ? tableInk("driver") : cell.kind === "rowLabel" && (row.kind === "detail" || row.kind === "split") ? tableInk("child") : isGlyph ? tableInk("secondary") : quiet ? tableInk("secondary") : isSection && sectionInk !== void 0 ? { token: sectionInk } : encodingInk ?? (cell.deEmphasized || cell.relation === "ofWhich" && ofWhichMuted ? tableInk("secondary") : cell.tone === "neutral" ? cell.zero ? tableInk("secondary") : tableInk(cell.kind === "rowLabel" ? "label" : "figure") : theme.table?.tones === "fill" && (col.kind === "value" || col.kind === "computed") && !isTotal ? tableInk("figure") : enc?.type === "polarityBadge" ? toneTextPaint(theme, cell.tone, options2.palette) : toneInk(textGround, cell.tone)), ink = ownGround ? polarityBadgeInk(theme, cell, col, row, options2.palette) : groundInk(textGround, plainInk), printsFigure = figures || !heatColumn(col) || isTotal;
|
|
1769
|
+
if (cell.kind === "rowLabel" && row.operator !== void 0 && operatorSlot > 0 && nodes.push({
|
|
1770
|
+
t: "text",
|
|
1771
|
+
id: `operator:${rowId}`,
|
|
1772
|
+
x: tx - operatorSlot,
|
|
1773
|
+
y: textTop,
|
|
1774
|
+
lines: [row.operator],
|
|
1775
|
+
align: "start",
|
|
1776
|
+
font,
|
|
1777
|
+
ink: groundInk(textGround, tableInk("operator")),
|
|
1778
|
+
owner,
|
|
1779
|
+
part: "tableOperator",
|
|
1780
|
+
typeRole: "label",
|
|
1781
|
+
role: "category"
|
|
1782
|
+
}), printsFigure && nodes.push({
|
|
1783
|
+
t: "text",
|
|
1784
|
+
typeRole: "label",
|
|
1785
|
+
id: tableCellNodeId("cell", rowId, colId),
|
|
1786
|
+
x: tx,
|
|
1787
|
+
y: textTop,
|
|
1788
|
+
lines,
|
|
1789
|
+
...cutTitle !== void 0 ? { title: cutTitle } : {},
|
|
1790
|
+
align: drawnAlign,
|
|
1791
|
+
font: drawnFont,
|
|
1792
|
+
ink,
|
|
1793
|
+
owner,
|
|
1794
|
+
part: "tableCell",
|
|
1795
|
+
...cellRole(col.kind, lines.join(" ")),
|
|
1796
|
+
...cell.displayed === "" ? {} : {
|
|
1797
|
+
display: cell.state === "value" ? { value: cell.displayed } : { state: cell.displayed }
|
|
1798
|
+
}
|
|
1799
|
+
}), inline.lines.length > 0 && (col.kind === "rowLabel" || col.kind === "value" || col.kind === "computed")) {
|
|
1800
|
+
let base = inline.note === void 0 ? 0 : 1, lineY = blockTop + valueBox + head + ladder.inlineGap + base * inline.box;
|
|
1801
|
+
for (let [index, line] of inline.lines.entries()) {
|
|
1802
|
+
let baseLineFont = changeLineFont(theme, ladder, row.step), driverLine = row.kind === "driver" || line.kind === "driver", lineFont = driverLine && theme.table?.driver?.italic !== !1 ? { ...baseLineFont, style: "italic" } : baseLineFont, lineCell = line.cells[colId], printed = col.kind === "rowLabel" ? ellipsize(line.label, lineFont, contentW - indent - INLINE_LABEL_INDENT, measure).text : lineCell?.displayed ?? "", y2 = lineY + (inline.box - lineFont.size * 1.2) / 2;
|
|
1803
|
+
if (lineY += inline.box, inline.noteSlots.get(colId) === base + index || !printed) continue;
|
|
1804
|
+
let toned = col.kind !== "rowLabel" && lineCell?.state === "value" && lineCell.tone !== "neutral";
|
|
1805
|
+
nodes.push({
|
|
1806
|
+
t: "text",
|
|
1807
|
+
typeRole: "label",
|
|
1808
|
+
id: tableCellNodeId("cellline", rowId, colId, line.id),
|
|
1809
|
+
// A line sits under its figure: a column's alignment seats both.
|
|
1810
|
+
x: col.kind === "rowLabel" && align === "start" ? contentX + indent + INLINE_LABEL_INDENT : align === "middle" ? cx + w / 2 : align === "start" ? contentX + indent : cx + w - cellPadX2,
|
|
1811
|
+
y: y2,
|
|
1812
|
+
lines: [printed],
|
|
1813
|
+
align,
|
|
1814
|
+
font: lineFont,
|
|
1815
|
+
ink: groundInk(textGround, driverLine && !(toned && (row.driverTone === !0 || line.driverTone === !0)) ? tableInk("driver") : toned && !(theme.table?.tones === "fill" && lineCell.tone === "warn") ? toneInk(textGround, lineCell.tone) : tableInk("secondary")),
|
|
1816
|
+
owner,
|
|
1817
|
+
part: "tableCellLine",
|
|
1818
|
+
...col.kind === "rowLabel" ? { role: "category" } : cellRole(col.kind, printed),
|
|
1819
|
+
...lineCell === void 0 || lineCell.displayed === "" || col.kind === "rowLabel" ? {} : { display: lineCell.state === "value" ? { value: lineCell.displayed } : { state: lineCell.displayed } }
|
|
1820
|
+
});
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
if (affixWidth > 0 && nodes.push({
|
|
1824
|
+
t: "text",
|
|
1825
|
+
typeRole: "label",
|
|
1826
|
+
id: `unit:${rowId}`,
|
|
1827
|
+
// Measured in the face the label is drawn in: a bolder label measured in the body face ran
|
|
1828
|
+
// into its unit ("marginof product sales"). Under the label, the unit starts its own line.
|
|
1829
|
+
x: affixBelow.has(rowId) ? tx : tx + measure(lines[lines.length - 1] ?? text, drawnFont).width + Math.max(theme.table?.qualifier?.gap ?? 4, measure(" ", affixFont).width),
|
|
1830
|
+
// baseline lock: the affix shares the label's baseline exactly
|
|
1831
|
+
y: affixBelow.has(rowId) ? textTop + lines.length * font.size * 1.2 : textTop + (lines.length - 1) * font.size * 1.2 + (font.size - affixFont.size) * NOTE_BASELINE_LOCK,
|
|
1832
|
+
lines: [row.unitAffix],
|
|
1833
|
+
align: "start",
|
|
1834
|
+
font: affixFont,
|
|
1835
|
+
ink: groundInk(textGround, tableInk(row.kind === "driver" ? "driver" : "qualifier")),
|
|
1836
|
+
owner,
|
|
1837
|
+
part: "tableRowUnit",
|
|
1838
|
+
// A hoisted scale letter is a number's tail and takes the figures;
|
|
1839
|
+
// an authored unit is a phrase ("$ per order") and reads as prose,
|
|
1840
|
+
// which is the composed-role rule.
|
|
1841
|
+
role: composedTextRole(row.unitAffix, "caption")
|
|
1842
|
+
}), badge !== void 0) {
|
|
1843
|
+
let chip = chipPaints(theme, badge.tone, options2.palette), chipH = chipHeight(rh, fonts.chip.size), chipX = Math.round(tx + measure(lines[lines.length - 1] ?? text, font).width / WIDTH_SAFETY + lineAffix + SECTION_CHIP_GAP), clearAbove = lines.length > 1 ? Math.ceil(textTop + (lines.length - 2) * font.size * 1.2 + font.size) : -1 / 0, chipY = Math.max(clearAbove, Math.round(textTop + (lines.length - 1) * font.size * 1.2 + (font.size * 1.2 - chipH) / 2));
|
|
1844
|
+
nodes.push({
|
|
1845
|
+
t: "rect",
|
|
1846
|
+
id: `sectionbadge:${rowId}`,
|
|
1847
|
+
rect: { x: chipX, y: chipY, w: badgeW, h: chipH },
|
|
1848
|
+
fill: chip.fill,
|
|
1849
|
+
radius: language.squareChips ? 0 : surface.chipRadius,
|
|
1850
|
+
owner,
|
|
1851
|
+
part: "tableSectionBadge"
|
|
1852
|
+
}), nodes.push({
|
|
1853
|
+
t: "text",
|
|
1854
|
+
typeRole: "label",
|
|
1855
|
+
id: `sectionbadge-text:${rowId}`,
|
|
1856
|
+
x: chipX + badgeW / 2,
|
|
1857
|
+
y: chipY + (chipH - fonts.chip.size * 1.2) / 2,
|
|
1858
|
+
lines: [badge.text],
|
|
1859
|
+
align: "middle",
|
|
1860
|
+
font: fonts.chip,
|
|
1861
|
+
ink: chip.ink,
|
|
1862
|
+
owner,
|
|
1863
|
+
part: "tableSectionBadge",
|
|
1864
|
+
role: "category",
|
|
1865
|
+
display: { state: badge.text }
|
|
1866
|
+
});
|
|
1867
|
+
}
|
|
1868
|
+
if (parentRow && !expanded && align === "start") {
|
|
1869
|
+
let noun = table.levelNouns?.[cell.level + 1], count = childCount.get(rowId) ?? 0;
|
|
1870
|
+
if (noun !== void 0 && count > 0) {
|
|
1871
|
+
let word = count === 1 ? noun.one : noun.other, hintX = tx + measure(lines[lines.length - 1] ?? text, font).width + lineAffix + badgeReserve + HINT_GAP, full = `\xB7 ${count} ${word}`, room = contentX + contentW - hintX, short = `\xB7 ${count}\u2026`, hint = measure(full, fonts.hint).width <= room ? { text: full } : measure(short, fonts.hint).width <= room ? { text: short, title: full } : void 0;
|
|
1872
|
+
hint !== void 0 && nodes.push({
|
|
1873
|
+
t: "text",
|
|
1874
|
+
typeRole: "label",
|
|
1875
|
+
id: `hint:${rowId}`,
|
|
1876
|
+
x: hintX,
|
|
1877
|
+
y: textTop + (lines.length - 1) * font.size * 1.2 + (font.size - fonts.hint.size) * NOTE_BASELINE_LOCK,
|
|
1878
|
+
lines: [hint.text],
|
|
1879
|
+
...hint.title === void 0 ? {} : { title: hint.title },
|
|
1880
|
+
align: "start",
|
|
1881
|
+
font: fonts.hint,
|
|
1882
|
+
ink: groundInk(textGround, tableInk("secondary")),
|
|
1883
|
+
owner,
|
|
1884
|
+
part: "tableCollapsedHint",
|
|
1885
|
+
role: "category"
|
|
1886
|
+
});
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
let noteSlot = inline.noteSlots.get(colId);
|
|
1890
|
+
if (cell.note && noteSlot !== void 0) {
|
|
1891
|
+
let noteFont = inlineFont2(row.step, !1);
|
|
1892
|
+
nodes.push({
|
|
1893
|
+
t: "text",
|
|
1894
|
+
typeRole: "footnote",
|
|
1895
|
+
id: tableCellNodeId("note", rowId, colId),
|
|
1896
|
+
x: align === "end" ? cx + w - cellPadX2 : align === "middle" ? cx + w / 2 : contentX + indent,
|
|
1897
|
+
y: blockTop + valueBox + head + ladder.inlineGap + noteSlot * inline.box + (inline.box - noteFont.size * 1.2) / 2,
|
|
1898
|
+
lines: [cell.note],
|
|
1899
|
+
align,
|
|
1900
|
+
font: noteFont,
|
|
1901
|
+
ink: groundInk(textGround, tableInk("secondary")),
|
|
1902
|
+
owner,
|
|
1903
|
+
part: "tableCellNote"
|
|
1904
|
+
});
|
|
1905
|
+
} else if (cell.note && col.kind === "rowLabel" && inline.note !== void 0) {
|
|
1906
|
+
let noteFont = inlineFont2(row.step, !1);
|
|
1907
|
+
nodes.push({
|
|
1908
|
+
t: "text",
|
|
1909
|
+
typeRole: "footnote",
|
|
1910
|
+
id: tableCellNodeId("note", rowId, colId),
|
|
1911
|
+
x: contentX + indent,
|
|
1912
|
+
y: blockTop + valueBox + head + ladder.inlineGap + (inline.box - noteFont.size * 1.2) / 2,
|
|
1913
|
+
lines: [cell.note],
|
|
1914
|
+
align: "start",
|
|
1915
|
+
font: noteFont,
|
|
1916
|
+
ink: groundInk(textGround, tableInk("secondary")),
|
|
1917
|
+
owner,
|
|
1918
|
+
part: "tableCellNote"
|
|
1919
|
+
});
|
|
1920
|
+
} else if (cell.note) {
|
|
1921
|
+
let lastLine = lines[lines.length - 1] ?? text, noteX = align === "end" ? tx - measure(lastLine, font).width - 4 : tx + measure(lastLine, font).width + 4, hostFont = drawnFont, noteY = textTop + (lines.length - 1) * font.size * 1.2 + (hostFont.size - fonts.note.size) * NOTE_BASELINE_LOCK;
|
|
1922
|
+
nodes.push({
|
|
1923
|
+
t: "text",
|
|
1924
|
+
typeRole: "footnote",
|
|
1925
|
+
id: tableCellNodeId("note", rowId, colId),
|
|
1926
|
+
x: noteX,
|
|
1927
|
+
y: noteY,
|
|
1928
|
+
lines: [cell.note],
|
|
1929
|
+
align: align === "end" ? "end" : "start",
|
|
1930
|
+
font: fonts.note,
|
|
1931
|
+
ink: groundInk(textGround, tableInk("secondary")),
|
|
1932
|
+
owner,
|
|
1933
|
+
part: "tableCellNote"
|
|
1934
|
+
});
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
let occupied = [...framePlan.claims];
|
|
1938
|
+
headsDrawn && occupied.push({ rect: { x: rowX, y: gridY, w: rowW, h: headerH }, kind: "mark", owner: {}, part: "tableHeader" });
|
|
1939
|
+
for (let row of rows) {
|
|
1940
|
+
let { y: ry, h: rh } = rowY.get(row.id);
|
|
1941
|
+
occupied.push({ rect: { x: rowX, y: ry, w: rowW, h: rh }, kind: "mark", owner: { rowId: row.id }, part: "tableRow" });
|
|
1942
|
+
}
|
|
1943
|
+
for (let col of cols) {
|
|
1944
|
+
let { x: cx, w } = colX.get(col.id);
|
|
1945
|
+
occupied.push({ rect: { x: cx, y: gridY, w, h: tableH }, kind: "mark", owner: { colId: col.id }, part: "tableColumn" });
|
|
1946
|
+
}
|
|
1947
|
+
let marks = {
|
|
1948
|
+
table: { x: gridX, y: gridY, w: tableW, h: tableH },
|
|
1949
|
+
headerBand: { x: gridX, y: gridY, w: tableW, h: headerH },
|
|
1950
|
+
columns: cols.map((c) => ({ id: c.id, ...colX.get(c.id) })),
|
|
1951
|
+
rows: rows.map((r) => ({ id: r.id, ...rowY.get(r.id) }))
|
|
1952
|
+
}, paintWarningRules = [];
|
|
1953
|
+
if (groundTexts.size > 0) {
|
|
1954
|
+
let texts = options2.colorblindSafe === !0 ? colorblindRoles([...groundTexts.values()]).value : [...groundTexts.values()];
|
|
1955
|
+
paintWarningRules.push({ kind: "table-ground-text", texts, before: warnings2.length }), pushAll(warnings2, groundTextWarnings(theme, texts));
|
|
1956
|
+
}
|
|
1957
|
+
let scene = options2.colorblindSafe === !0 ? colorblindRoles(nodes).value : nodes;
|
|
1958
|
+
return {
|
|
1959
|
+
type: "table",
|
|
1960
|
+
size,
|
|
1961
|
+
sizing,
|
|
1962
|
+
plot,
|
|
1963
|
+
scene,
|
|
1964
|
+
labels: [],
|
|
1965
|
+
axes: [],
|
|
1966
|
+
annotations: [],
|
|
1967
|
+
frame: frame.frame,
|
|
1968
|
+
marks,
|
|
1969
|
+
derived: { table, computedCells: resolved.computedCells },
|
|
1970
|
+
a11y: {
|
|
1971
|
+
title: accessibleTitle(options2.title, "Table"),
|
|
1972
|
+
counts: [structureCount("rows", dataRows.length), structureCount("columns", cols.length)],
|
|
1973
|
+
desc: `Table with ${dataRows.length} rows and ${cols.length} columns`
|
|
1974
|
+
},
|
|
1975
|
+
warnings: warnings2,
|
|
1976
|
+
...paintWarningRules.length > 0 ? { paintWarningRules } : {},
|
|
1977
|
+
debug: { occupied, decisions: [] }
|
|
1978
|
+
};
|
|
1979
|
+
}, plannedCuts);
|
|
1980
|
+
}
|
|
1981
|
+
};
|
|
1982
|
+
}
|
|
1983
|
+
function widthAt(plan, id) {
|
|
1984
|
+
return "columnIndex" in plan ? plan.widths[plan.columnIndex.get(id)] : plan.widths.get(id);
|
|
1985
|
+
}
|
|
1986
|
+
function tableSizing(size, plot, bottom, totalW, minimumW) {
|
|
1987
|
+
return rowSizing("table", size, {
|
|
1988
|
+
chromeH: size.height - plot.h,
|
|
1989
|
+
minimumRowsH: bottom - plot.y + 4,
|
|
1990
|
+
naturalRowsH: bottom - plot.y + 4,
|
|
1991
|
+
minWidth: size.width - plot.w + minimumW,
|
|
1992
|
+
naturalWidth: size.width - plot.w + totalW
|
|
1993
|
+
});
|
|
1994
|
+
}
|
|
1995
|
+
function fitStatusLabel(label, font, room, trackRoom, measure) {
|
|
1996
|
+
let width = measure(label, font).width;
|
|
1997
|
+
if (width <= room) return { text: label };
|
|
1998
|
+
if (room < HEADING_CUT_MIN) return width <= trackRoom ? { text: label } : null;
|
|
1999
|
+
let cut = cutWithTitle(label, font, room, measure);
|
|
2000
|
+
return cut.text === "\u2026" || cut.text === "" ? null : cut;
|
|
2001
|
+
}
|
|
2002
|
+
function cellText(cell, kind, isSection, font, maxW, wrapped, wrappedTitle, measure, sectionCase) {
|
|
2003
|
+
let text = isSection && sectionCase !== "asis" ? sectionText(cell.displayed) : cell.displayed;
|
|
2004
|
+
return wrapped ? { text: wrapped[0] ?? text, ...wrappedTitle !== void 0 ? { title: wrappedTitle } : {} } : (kind === "rowLabel" || kind === "text") && measure(text, font).width > maxW ? cutWithTitle(text, font, Math.max(maxW, HEADING_CUT_MIN), measure) : { text };
|
|
2005
|
+
}
|
|
2006
|
+
function sectionText(s) {
|
|
2007
|
+
return s.toUpperCase();
|
|
2008
|
+
}
|
|
2009
|
+
function encodingSparklineNodes(col, row, box, theme, palette, measure, domain, language) {
|
|
2010
|
+
if (row.role === "section" || col.encoding?.type !== "sparkline") return [];
|
|
2011
|
+
let values = sparklineSourceValues(row, col.encoding.sourceColumns), last = lastObservedIndex(values), lastSource = last === void 0 ? void 0 : col.encoding.sourceColumns[last];
|
|
2012
|
+
return emitSparkline(
|
|
2013
|
+
{
|
|
2014
|
+
cell: row.cells[col.id],
|
|
2015
|
+
box,
|
|
2016
|
+
theme,
|
|
2017
|
+
...palette === void 0 ? {} : { palette },
|
|
2018
|
+
measure,
|
|
2019
|
+
nodeId: (suffix) => tableCellNodeId(suffix, row.id, col.id),
|
|
2020
|
+
owner: { rowId: row.id, colId: col.id }
|
|
2021
|
+
},
|
|
2022
|
+
values,
|
|
2023
|
+
{
|
|
2024
|
+
kind: col.encoding.kind ?? "line",
|
|
2025
|
+
domain: domain ?? tableSparklineDomain([row], col.encoding.sourceColumns, col.encoding.kind ?? "line"),
|
|
2026
|
+
lastText: lastSource === void 0 ? void 0 : row.cells[lastSource]?.displayed,
|
|
2027
|
+
language
|
|
2028
|
+
}
|
|
2029
|
+
);
|
|
2030
|
+
}
|
|
2031
|
+
function transparentCss(css) {
|
|
2032
|
+
return css.trim().toLowerCase() === "transparent";
|
|
2033
|
+
}
|
|
2034
|
+
|
|
2035
|
+
export {
|
|
2036
|
+
REGULAR_SPACING,
|
|
2037
|
+
sparklineSourceValues,
|
|
2038
|
+
sparklineDomains,
|
|
2039
|
+
emitSparkline,
|
|
2040
|
+
fitTableFormats,
|
|
2041
|
+
formatsFittedWarning,
|
|
2042
|
+
prepareTableExecutor,
|
|
2043
|
+
prepareTableCardExecutor,
|
|
2044
|
+
layoutTableCard,
|
|
2045
|
+
memoLayout,
|
|
2046
|
+
classFloor
|
|
2047
|
+
};
|