@frangoteam/fuxa-min 1.1.19
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/LICENSE +21 -0
- package/README.md +41 -0
- package/_images/Pipes/P1.svg +39 -0
- package/_images/Tanks/Fl.svg +7 -0
- package/api/alarms/index.js +132 -0
- package/api/auth/index.js +71 -0
- package/api/command/index.js +187 -0
- package/api/daq/index.js +79 -0
- package/api/diagnose/index.js +163 -0
- package/api/index.js +181 -0
- package/api/jwt-helper.js +106 -0
- package/api/plugins/index.js +109 -0
- package/api/projects/index.js +229 -0
- package/api/resources/index.js +118 -0
- package/api/scripts/index.js +82 -0
- package/api/users/index.js +109 -0
- package/dist/3rdpartylicenses.txt +1477 -0
- package/dist/Quicksand-Bold.071154c292aef0b8.woff +0 -0
- package/dist/Quicksand-Bold.6383d6475ed5c40f.woff2 +0 -0
- package/dist/Quicksand-Bold.f07d467887f9cfab.ttf +0 -0
- package/dist/Quicksand-Medium.0982a651e8d4315f.woff +0 -0
- package/dist/Quicksand-Medium.9d2733fbfb9b1be8.ttf +0 -0
- package/dist/Quicksand-Medium.b09302365c586eb2.woff2 +0 -0
- package/dist/Quicksand-Regular.16adf9eecd267273.woff +0 -0
- package/dist/Quicksand-Regular.78819724f6aeff59.woff2 +0 -0
- package/dist/Quicksand-Regular.8829564f0e14bf76.ttf +0 -0
- package/dist/assets/fonts/icomoon.eot +0 -0
- package/dist/assets/fonts/icomoon.svg +19 -0
- package/dist/assets/fonts/icomoon.ttf +0 -0
- package/dist/assets/fonts/icomoon.woff +0 -0
- package/dist/assets/fonts/myicons.eot +0 -0
- package/dist/assets/fonts/myicons.svg +19 -0
- package/dist/assets/fonts/myicons.ttf +0 -0
- package/dist/assets/fonts/myicons.woff +0 -0
- package/dist/assets/fonts/quicksand-bold/Quicksand-Bold.ttf +0 -0
- package/dist/assets/fonts/quicksand-bold/Quicksand-Bold.woff +0 -0
- package/dist/assets/fonts/quicksand-bold/Quicksand-Bold.woff2 +0 -0
- package/dist/assets/fonts/quicksand-medium/Quicksand-Medium.ttf +0 -0
- package/dist/assets/fonts/quicksand-medium/Quicksand-Medium.woff +0 -0
- package/dist/assets/fonts/quicksand-medium/Quicksand-Medium.woff2 +0 -0
- package/dist/assets/fonts/quicksand-regular/Quicksand-Regular.ttf +0 -0
- package/dist/assets/fonts/quicksand-regular/Quicksand-Regular.woff +0 -0
- package/dist/assets/fonts/quicksand-regular/Quicksand-Regular.woff2 +0 -0
- package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.svg +10486 -0
- package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.woff2 +0 -0
- package/dist/assets/fonts/roboto-light/roboto-light-webfont.svg +9998 -0
- package/dist/assets/fonts/roboto-light/roboto-light-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-light/roboto-light-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-light/roboto-light-webfont.woff2 +0 -0
- package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.svg +10487 -0
- package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.woff2 +0 -0
- package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.svg +10004 -0
- package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.woff2 +0 -0
- package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.svg +10012 -0
- package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.woff2 +0 -0
- package/dist/assets/i18n/de.json +1308 -0
- package/dist/assets/i18n/en.json +1438 -0
- package/dist/assets/i18n/es.json +777 -0
- package/dist/assets/i18n/fr.json +1129 -0
- package/dist/assets/i18n/ko.json +774 -0
- package/dist/assets/i18n/pt.json +657 -0
- package/dist/assets/i18n/ru.json +1228 -0
- package/dist/assets/i18n/tr.json +673 -0
- package/dist/assets/i18n/ua.json +614 -0
- package/dist/assets/i18n/zh-cn.json +1252 -0
- package/dist/assets/images/align-bottom.svg +88 -0
- package/dist/assets/images/align-center.svg +86 -0
- package/dist/assets/images/align-left.svg +86 -0
- package/dist/assets/images/align-middle.svg +88 -0
- package/dist/assets/images/align-right.svg +88 -0
- package/dist/assets/images/align-top.svg +88 -0
- package/dist/assets/images/bag.svg +115 -0
- package/dist/assets/images/button.svg +22 -0
- package/dist/assets/images/chart.svg +17 -0
- package/dist/assets/images/circle.svg +84 -0
- package/dist/assets/images/compressor-a.svg +2 -0
- package/dist/assets/images/editvalue.svg +14 -0
- package/dist/assets/images/ellipse.svg +84 -0
- package/dist/assets/images/flip-orizontal.svg +86 -0
- package/dist/assets/images/flip-vertical.svg +82 -0
- package/dist/assets/images/gauge-donut.png +0 -0
- package/dist/assets/images/gauge-mat.png +0 -0
- package/dist/assets/images/gauge-zone.png +0 -0
- package/dist/assets/images/graphbar.svg +18 -0
- package/dist/assets/images/group.svg +91 -0
- package/dist/assets/images/iframe.svg +54 -0
- package/dist/assets/images/image.svg +95 -0
- package/dist/assets/images/led-circle.svg +77 -0
- package/dist/assets/images/line.svg +86 -0
- package/dist/assets/images/linecap-butt.svg +77 -0
- package/dist/assets/images/linecap-round.svg +77 -0
- package/dist/assets/images/linecap-square.svg +82 -0
- package/dist/assets/images/linejoin-bevel.svg +77 -0
- package/dist/assets/images/linejoin-miter.svg +77 -0
- package/dist/assets/images/linejoin-round.svg +77 -0
- package/dist/assets/images/logo.svg +18 -0
- package/dist/assets/images/path.svg +100 -0
- package/dist/assets/images/pencil.svg +98 -0
- package/dist/assets/images/pipe.svg +15 -0
- package/dist/assets/images/progress-v.svg +79 -0
- package/dist/assets/images/rect.svg +84 -0
- package/dist/assets/images/select-pointer.svg +93 -0
- package/dist/assets/images/selectvalue.svg +14 -0
- package/dist/assets/images/semaphore.svg +19 -0
- package/dist/assets/images/slider.svg +17 -0
- package/dist/assets/images/switch.svg +15 -0
- package/dist/assets/images/table.svg +55 -0
- package/dist/assets/images/text.svg +294 -0
- package/dist/assets/images/to-bottom.svg +163 -0
- package/dist/assets/images/to-path.svg +94 -0
- package/dist/assets/images/to-top.svg +163 -0
- package/dist/assets/images/to_top.svg +88 -0
- package/dist/assets/images/todelete.svg +13 -0
- package/dist/assets/images/ungroup.svg +108 -0
- package/dist/assets/images/value.svg +81 -0
- package/dist/assets/images/valve-a.svg +2 -0
- package/dist/assets/images/webcam.svg +16 -0
- package/dist/assets/lib/ext-styles.css +28 -0
- package/dist/assets/lib/gauge/gauge.js +988 -0
- package/dist/assets/lib/gauge/gauge.min.js +1 -0
- package/dist/assets/lib/nouislider/nouislider.min.css +1 -0
- package/dist/assets/lib/nouislider/nouislider.min.js +1 -0
- package/dist/assets/lib/numeral/locales.min.js +7 -0
- package/dist/assets/lib/numeral/numeral.min.js +8 -0
- package/dist/assets/lib/pdfkit-table/index.js +967 -0
- package/dist/assets/lib/svg/raphael.min.js +1 -0
- package/dist/assets/lib/svg/svg.js +5573 -0
- package/dist/assets/lib/svg/svg.min.js +13 -0
- package/dist/assets/lib/svgeditor/extensions/ext-bundle.min.js +1 -0
- package/dist/assets/lib/svgeditor/extensions/ext-html_button.min.css +1 -0
- package/dist/assets/lib/svgeditor/fuxa-editor.min.js +23 -0
- package/dist/assets/lib/svgeditor/jquery-plugin.min.css +2 -0
- package/dist/assets/lib/svgeditor/jquery-plugin.min.js +52 -0
- package/dist/assets/lib/svgeditor/jquery-ui-1.8.17.custom.min.js +54 -0
- package/dist/assets/lib/svgeditor/jquery.min.js +4 -0
- package/dist/assets/lib/svgeditor/shapes/ape-shapes.js +39 -0
- package/dist/assets/lib/svgeditor/shapes/img/agitator-disc.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/agitator-paddle.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/agitator-prop.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/agitator-turbo.svg +19 -0
- package/dist/assets/lib/svgeditor/shapes/img/anim-eli.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/anim-piston.svg +14 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifugal.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifugal1.svg +67 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifuge1.svg +67 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifuge2.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifuge3.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifuge4.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compair.svg +92 -0
- package/dist/assets/lib/svgeditor/shapes/img/compdiaph.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compejector.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compreci.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/compreci2.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/compressor-fan.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/compressor-piston.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compressor-void.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compring.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/compring2.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/comprotary.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/comprotary2.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/compscrew.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compsilence.svg +20 -0
- package/dist/assets/lib/svgeditor/shapes/img/compturbo.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher1.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher2.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher3.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher4.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher5.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher6.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher7.svg +21 -0
- package/dist/assets/lib/svgeditor/shapes/img/diaph.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier1.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier2.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier3.svg +23 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier4.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger-filter.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger-heat.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger-tube.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger1.svg +67 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger2.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger3.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger4.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger6.svg +71 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger7.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger8.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger9.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/feeder.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/feeder2.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/feeder3.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/filter2.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/filter3.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting1.svg +67 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting10.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting11.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting12.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting13.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting2.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting3.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting4.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting6.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting7.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting8.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting9.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc1.svg +75 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc2.svg +71 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc3.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc4.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc6.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc7.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc8.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/motor-simb.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/nozzle.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/nozzle2.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi1.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi2.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi3.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi4.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi6.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi7.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpblower.svg +76 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpcentri1.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpcentri2.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpfeed.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpgear.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpgear2.svg +19 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumphidra.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumphorizo.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpjet.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpperis.svg +20 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpscreew.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpscreew2.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpturbi.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpvacuum.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-arrow.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-circle.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-circleindi.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-cloud.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-cone.svg +71 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-corner.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-cross.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-cylinder.svg +71 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-delay.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-diamond.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-display.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-docu.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-doublearrow.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-drop.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-halfcircle.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-heart.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-looplimit.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-maninput.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-nosymbol.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-octagon.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-offpage.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-or.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-or2.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-parallelogram.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-pentagon.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-poval.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-prepara.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-rectangle.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-rectindi.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-star4.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-switch.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-tape.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-tee.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-ticket.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-trape.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-triangle.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-vor.svg +14 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank1.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank2.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank3.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank4.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank5.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank6.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank7.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank8.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank9.svg +21 -0
- package/dist/assets/lib/svgeditor/shapes/img/valve-ax.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/valve-bx.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/valve-cx.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/webcam.svg +6 -0
- package/dist/assets/lib/svgeditor/shapes/my-shapes.js +178 -0
- package/dist/assets/lib/svgeditor/shapes/proc-comp-shapes.js +105 -0
- package/dist/assets/lib/svgeditor/shapes/proc-general-shapes.js +60 -0
- package/dist/assets/lib/svgeditor/shapes/proc-pumps-shapes.js +112 -0
- package/dist/assets/lib/svgeditor/shapes/proc-shapes.js +606 -0
- package/dist/assets/lib/svgeditor/shapes/shapes.js +30 -0
- package/dist/assets/lib/svgeditor/svg-editor.min.css +1 -0
- package/dist/assets/lib/uplot/placement.min.js +2 -0
- package/dist/assets/project.demo.fuxap +1 -0
- package/dist/favicon.ico +0 -0
- package/dist/icomoon.86abfb46e057ade8.eot +0 -0
- package/dist/icomoon.c1f8b59bad308d66.woff +0 -0
- package/dist/icomoon.ce427f75e21963af.ttf +0 -0
- package/dist/icomoon.dfb0a89feb346906.svg +19 -0
- package/dist/index.html +50 -0
- package/dist/logo.0e8e64e69250a450.svg +18 -0
- package/dist/main.a356f552d9838b9e.js +1 -0
- package/dist/material-icons-outlined.78a93b2079680a08.woff +0 -0
- package/dist/material-icons-outlined.f86cb7b0aa53f0fe.woff2 +0 -0
- package/dist/material-icons-round.92dc7ca2f4c591e7.woff +0 -0
- package/dist/material-icons-round.b10ec9db5b7fbc74.woff2 +0 -0
- package/dist/material-icons-sharp.3885863ee4746422.woff2 +0 -0
- package/dist/material-icons-sharp.a71cb2bf66c604de.woff +0 -0
- package/dist/material-icons-two-tone.588d63134de807a7.woff +0 -0
- package/dist/material-icons-two-tone.675bd578bd14533e.woff2 +0 -0
- package/dist/material-icons.4ad034d2c499d9b6.woff +0 -0
- package/dist/material-icons.59322316b3fd6063.woff2 +0 -0
- package/dist/polyfills.2696a6f9dc75535e.js +1 -0
- package/dist/roboto-bold-webfont.29ac6158e35aee95.woff +0 -0
- package/dist/roboto-bold-webfont.568ab1fa3f154a77.svg +10486 -0
- package/dist/roboto-bold-webfont.6bcfbdc216b3bc78.woff2 +0 -0
- package/dist/roboto-bold-webfont.7c22a4dfdee2ff33.ttf +0 -0
- package/dist/roboto-light-webfont.13492ec56771eeee.svg +9998 -0
- package/dist/roboto-light-webfont.61fa26c99b07ac83.woff2 +0 -0
- package/dist/roboto-light-webfont.95295ce84942d8ce.ttf +0 -0
- package/dist/roboto-light-webfont.ae19119a2889dfdf.woff +0 -0
- package/dist/roboto-medium-webfont.30344f0411888055.woff +0 -0
- package/dist/roboto-medium-webfont.57fb00cab0317d2d.woff2 +0 -0
- package/dist/roboto-medium-webfont.a40869e060a388c0.ttf +0 -0
- package/dist/roboto-medium-webfont.ea02241c29620c02.svg +10487 -0
- package/dist/roboto-regular-webfont.2b0501b72f5a94d5.ttf +0 -0
- package/dist/roboto-regular-webfont.2ce0ba9a06424965.svg +10004 -0
- package/dist/roboto-regular-webfont.ae47f6f1292d196f.woff2 +0 -0
- package/dist/roboto-regular-webfont.f58066a2d9061006.woff +0 -0
- package/dist/roboto-thin-webfont.0a64479870f676e8.ttf +0 -0
- package/dist/roboto-thin-webfont.0f7221f5c7e972ef.woff2 +0 -0
- package/dist/roboto-thin-webfont.51b221e22714b1fe.svg +10012 -0
- package/dist/roboto-thin-webfont.dac941649dd4eac0.woff +0 -0
- package/dist/runtime.8ef63094e52a66ba.js +1 -0
- package/dist/scripts.1c3385254ff4c93c.js +1 -0
- package/dist/styles.cf8e3cf50d039a5c.css +1 -0
- package/fuxa.js +39 -0
- package/main.js +381 -0
- package/package.json +68 -0
- package/paths.js +44 -0
- package/project.default.json +11 -0
- package/project.demo.fuxap +1 -0
- package/runtime/alarms/alarmstorage.js +205 -0
- package/runtime/alarms/index.js +678 -0
- package/runtime/devices/bacnet/index.js +730 -0
- package/runtime/devices/device-utils.js +95 -0
- package/runtime/devices/device.js +551 -0
- package/runtime/devices/ethernetip/index.js +381 -0
- package/runtime/devices/fuxaserver/index.js +310 -0
- package/runtime/devices/httprequest/index.js +495 -0
- package/runtime/devices/index.js +489 -0
- package/runtime/devices/modbus/datatypes.js +122 -0
- package/runtime/devices/modbus/index.js +730 -0
- package/runtime/devices/mqtt/index.js +618 -0
- package/runtime/devices/odbc/index.js +408 -0
- package/runtime/devices/opcua/index.js +817 -0
- package/runtime/devices/s7/datatypes.js +88 -0
- package/runtime/devices/s7/index.js +702 -0
- package/runtime/devices/template/index.js +141 -0
- package/runtime/events.js +33 -0
- package/runtime/index.js +559 -0
- package/runtime/jobs/cleaner.js +74 -0
- package/runtime/jobs/fonts/LICENSE.txt +202 -0
- package/runtime/jobs/fonts/Roboto-Black.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-BlackItalic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Bold.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-BoldItalic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Italic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Light.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-LightItalic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Medium.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-MediumItalic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Regular.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Thin.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-ThinItalic.ttf +0 -0
- package/runtime/jobs/helper/image-generator.js +82 -0
- package/runtime/jobs/index.js +214 -0
- package/runtime/jobs/report.js +353 -0
- package/runtime/logger.js +113 -0
- package/runtime/notificator/index.js +383 -0
- package/runtime/notificator/notifystorage.js +179 -0
- package/runtime/plugins/index.js +255 -0
- package/runtime/project/index.js +959 -0
- package/runtime/project/prjstorage.js +222 -0
- package/runtime/scripts/index.js +313 -0
- package/runtime/scripts/msm.js +146 -0
- package/runtime/storage/calculator.js +227 -0
- package/runtime/storage/daqstorage.js +188 -0
- package/runtime/storage/influxdb/index.js +240 -0
- package/runtime/storage/sqlite/currentstorage.js +144 -0
- package/runtime/storage/sqlite/index.js +695 -0
- package/runtime/storage/tdengine/index.js +106 -0
- package/runtime/users/index.js +123 -0
- package/runtime/users/usrstorage.js +201 -0
- package/runtime/utils.js +284 -0
- package/screenshot/feature-action-move.gif +0 -0
- package/screenshot/fuxa-ani.gif +0 -0
- package/screenshot/fuxa-device.gif +0 -0
- package/screenshot/fuxa-editor.png +0 -0
- package/screenshot/fuxa-hmi.gif +0 -0
- package/screenshot/fuxa-home.png +0 -0
- package/screenshot/fuxa-test.gif +0 -0
- package/settings.default.js +65 -0
|
@@ -0,0 +1,967 @@
|
|
|
1
|
+
// jshint esversion: 6
|
|
2
|
+
// "use strict";
|
|
3
|
+
// https://jshint.com/
|
|
4
|
+
|
|
5
|
+
const PDFDocument = require("pdfkit");
|
|
6
|
+
// const EventEmitter = require('events').EventEmitter;
|
|
7
|
+
|
|
8
|
+
class PDFDocumentWithTables extends PDFDocument {
|
|
9
|
+
|
|
10
|
+
constructor(option) {
|
|
11
|
+
super(option);
|
|
12
|
+
this.opt = option;
|
|
13
|
+
// this.emitter = new EventEmitter();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
logg(...args) {
|
|
17
|
+
// console.log(args);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* addBackground
|
|
22
|
+
* @param {Object} rect
|
|
23
|
+
* @param {String} fillColor
|
|
24
|
+
* @param {Number} fillOpacity
|
|
25
|
+
* @param {Function} callback
|
|
26
|
+
*/
|
|
27
|
+
addBackground ({x, y, width, height}, fillColor, fillOpacity, callback) {
|
|
28
|
+
|
|
29
|
+
// validate
|
|
30
|
+
fillColor || (fillColor = 'grey');
|
|
31
|
+
fillOpacity || (fillOpacity = 0.1);
|
|
32
|
+
|
|
33
|
+
// save current style
|
|
34
|
+
this.save();
|
|
35
|
+
|
|
36
|
+
// draw bg
|
|
37
|
+
this
|
|
38
|
+
.fill(fillColor)
|
|
39
|
+
//.stroke(fillColor)
|
|
40
|
+
.fillOpacity(fillOpacity)
|
|
41
|
+
.rect( x, y, width, height )
|
|
42
|
+
//.stroke()
|
|
43
|
+
.fill();
|
|
44
|
+
|
|
45
|
+
// back to saved style
|
|
46
|
+
this.restore();
|
|
47
|
+
|
|
48
|
+
// restore
|
|
49
|
+
// this
|
|
50
|
+
// .fillColor('black')
|
|
51
|
+
// .fillOpacity(1)
|
|
52
|
+
// .fill();
|
|
53
|
+
|
|
54
|
+
typeof callback === 'function' && callback(this);
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* table
|
|
60
|
+
* @param {Object} table
|
|
61
|
+
* @param {Object} options
|
|
62
|
+
* @param {Function} callback
|
|
63
|
+
*/
|
|
64
|
+
table(table, options, callback) {
|
|
65
|
+
return new Promise((resolve, reject) => {
|
|
66
|
+
try {
|
|
67
|
+
|
|
68
|
+
typeof table === 'string' && (table = JSON.parse(table));
|
|
69
|
+
|
|
70
|
+
table || (table = {});
|
|
71
|
+
options || (options = {});
|
|
72
|
+
|
|
73
|
+
table.headers || (table.headers = []);
|
|
74
|
+
table.datas || (table.datas = []);
|
|
75
|
+
table.rows || (table.rows = []);
|
|
76
|
+
table.options && (options = {...options, ...table.options});
|
|
77
|
+
|
|
78
|
+
options.hideHeader || (options.hideHeader = false);
|
|
79
|
+
options.padding || (options.padding = 0);
|
|
80
|
+
options.columnsSize || (options.columnsSize = []);
|
|
81
|
+
options.addPage || (options.addPage = false);
|
|
82
|
+
options.absolutePosition || (options.absolutePosition = false);
|
|
83
|
+
options.minRowHeight || (options.minRowHeight = 0);
|
|
84
|
+
// TODO options.hyperlink || (options.hyperlink = { urlToLink: false, description: null });
|
|
85
|
+
|
|
86
|
+
// divider lines
|
|
87
|
+
options.divider || (options.divider = {});
|
|
88
|
+
options.divider.header || (options.divider.header = { disabled: false, width: undefined, opacity: undefined });
|
|
89
|
+
options.divider.horizontal || (options.divider.horizontal = { disabled: false, width: undefined, opacity: undefined });
|
|
90
|
+
options.divider.vertical || (options.divider.vertical = { disabled: true, width: undefined, opacity: undefined });
|
|
91
|
+
|
|
92
|
+
if(!table.headers.length) throw new Error('Headers not defined. Use options: hideHeader to hide.');
|
|
93
|
+
|
|
94
|
+
if(options.useSafelyMarginBottom === undefined) options.useSafelyMarginBottom = true;
|
|
95
|
+
|
|
96
|
+
const title = table.title ? table.title : ( options.title || '' ) ;
|
|
97
|
+
const subtitle = table.subtitle ? table.subtitle : ( options.subtitle || '' ) ;
|
|
98
|
+
|
|
99
|
+
this.logg('layout', this.page.layout);
|
|
100
|
+
this.logg('size', this.page.size);
|
|
101
|
+
this.logg('margins', this.page.margins);
|
|
102
|
+
// this.logg('options', this.options);
|
|
103
|
+
|
|
104
|
+
// const columnIsDefined = options.columnsSize.length ? true : false;
|
|
105
|
+
const columnSpacing = options.columnSpacing || 3; // 15
|
|
106
|
+
let columnSizes = [];
|
|
107
|
+
let columnPositions = []; // 0, 10, 20, 30, 100
|
|
108
|
+
let columnWidth = 0;
|
|
109
|
+
|
|
110
|
+
const rowDistance = 0.5;
|
|
111
|
+
let cellPadding = {top: 0, right: 0, bottom: 0, left: 0}; // universal
|
|
112
|
+
|
|
113
|
+
const prepareHeader = options.prepareHeader || (() => this.fillColor('black').font("Helvetica-Bold").fontSize(8).fill());
|
|
114
|
+
const prepareRow = options.prepareRow || ((row, indexColumn, indexRow, rectRow, rectCell) => this.fillColor('black').font("Helvetica").fontSize(8).fill());
|
|
115
|
+
//const prepareCell = options.prepareCell || ((cell, indexColumn, indexRow, indexCell, rectCell) => this.fillColor('black').font("Helvetica").fontSize(8).fill());
|
|
116
|
+
|
|
117
|
+
let tableWidth = 0;
|
|
118
|
+
const maxY = this.page.height - (this.page.margins.bottom); // this.page.margins.top +
|
|
119
|
+
|
|
120
|
+
let startX = options.x || this.x || this.page.margins.left;
|
|
121
|
+
let startY = options.y || this.y || this.page.margins.top;
|
|
122
|
+
|
|
123
|
+
let lastPositionX = 0;
|
|
124
|
+
let rowBottomY = 0;
|
|
125
|
+
|
|
126
|
+
//------------ experimental fast variables
|
|
127
|
+
let titleHeight = 0;
|
|
128
|
+
this.headerHeight = 0;
|
|
129
|
+
let firstLineHeight = 0;
|
|
130
|
+
this.datasIndex = 0;
|
|
131
|
+
this.rowsIndex = 0 ;
|
|
132
|
+
let lockAddTitles = false; // to addd title one time
|
|
133
|
+
let lockAddPage = false;
|
|
134
|
+
let lockAddHeader = false;
|
|
135
|
+
let safelyMarginBottom = this.page.margins.top/2;
|
|
136
|
+
|
|
137
|
+
// reset position to margins.left
|
|
138
|
+
if( options.x === null || options.x === -1 ){
|
|
139
|
+
startX = this.page.margins.left;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const createTitle = ( data, size, opacity ) => {
|
|
143
|
+
|
|
144
|
+
// Title
|
|
145
|
+
if(!data) return;
|
|
146
|
+
|
|
147
|
+
// get height line
|
|
148
|
+
// let cellHeight = 0;
|
|
149
|
+
// if string
|
|
150
|
+
if(typeof data === 'string' ){
|
|
151
|
+
// font size
|
|
152
|
+
this.fillColor('black').fontSize(8).fontSize(size).opacity(opacity).fill();
|
|
153
|
+
// this.fillColor('black').font("Helvetica").fontSize(8).fontSize(size).opacity(opacity).fill();
|
|
154
|
+
|
|
155
|
+
// const titleHeight = this.heightOfString(data, {
|
|
156
|
+
// width: tableWidth,
|
|
157
|
+
// align: 'left',
|
|
158
|
+
// });
|
|
159
|
+
this.logg(data, titleHeight); // 24
|
|
160
|
+
|
|
161
|
+
// write
|
|
162
|
+
this.text( data, startX, startY ).opacity( 1 ); // moveDown( 0.5 )
|
|
163
|
+
// startY += cellHeight;
|
|
164
|
+
startY = this.y + columnSpacing + 2;
|
|
165
|
+
// else object
|
|
166
|
+
} else if(typeof data === 'object' ){
|
|
167
|
+
// title object
|
|
168
|
+
data.fontFamily && this.font( data.fontFamily );
|
|
169
|
+
data.label && this.fillColor( data.color || 'black').fontSize( data.fontSize || size ).text( data.label, startX, startY ).fill();
|
|
170
|
+
|
|
171
|
+
startY = this.y + columnSpacing + 2;
|
|
172
|
+
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
// add a new page before crate table
|
|
177
|
+
options.addPage === true && onFirePageAdded(); // this.emitter.emit('addPage'); //this.addPage();
|
|
178
|
+
|
|
179
|
+
// // create title and subtitle
|
|
180
|
+
// createTitle( title, 12, 1 );
|
|
181
|
+
// createTitle( subtitle, 9, 0.7 );
|
|
182
|
+
|
|
183
|
+
// add space after title
|
|
184
|
+
// if( title || subtitle ){
|
|
185
|
+
// startY += 3;
|
|
186
|
+
// };
|
|
187
|
+
|
|
188
|
+
// event emitter
|
|
189
|
+
const onFirePageAdded = () => {
|
|
190
|
+
// startX = this.page.margins.left;
|
|
191
|
+
startY = this.page.margins.top;
|
|
192
|
+
rowBottomY = 0;
|
|
193
|
+
// lockAddPage || this.addPage(this.options);
|
|
194
|
+
lockAddPage || this.addPage({
|
|
195
|
+
layout: this.page.layout,
|
|
196
|
+
size: this.page.size,
|
|
197
|
+
margins: this.page.margins,
|
|
198
|
+
});
|
|
199
|
+
lockAddHeader || addHeader();
|
|
200
|
+
//addHeader();
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
// add fire
|
|
204
|
+
// this.emitter.removeAllListeners();
|
|
205
|
+
// this.emitter.on('addTitle', addTitle);
|
|
206
|
+
// this.emitter.on('addSubtitle', addSubTitle);
|
|
207
|
+
// this.emitter.on('addPage', onFirePageAdded);
|
|
208
|
+
// this.emitter.emit('addPage');
|
|
209
|
+
// this.on('pageAdded', onFirePageAdded);
|
|
210
|
+
|
|
211
|
+
// warning - eval can be harmful
|
|
212
|
+
const fEval = (str) => {
|
|
213
|
+
let f = null; eval('f = ' + str); return f;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
const separationsColumn = () => {
|
|
217
|
+
// soon
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const separationsRow = (type, x, y, width, opacity, color) => {
|
|
221
|
+
|
|
222
|
+
type || (type = 'horizontal'); // header | horizontal | vertical
|
|
223
|
+
|
|
224
|
+
// distance
|
|
225
|
+
const d = rowDistance * 1.5;
|
|
226
|
+
// margin
|
|
227
|
+
const m = options.x || this.page.margins.left || 30;
|
|
228
|
+
// disabled
|
|
229
|
+
const s = options.divider[type].disabled || false;
|
|
230
|
+
|
|
231
|
+
if(s === true) return;
|
|
232
|
+
opacity = opacity || options.divider[type].opacity || 0.5;
|
|
233
|
+
width = width || options.divider[type].width || 0.5;
|
|
234
|
+
color = color || options.divider[type].color || 'black';
|
|
235
|
+
|
|
236
|
+
// draw
|
|
237
|
+
this
|
|
238
|
+
.moveTo(x, y - d)
|
|
239
|
+
.lineTo(x + tableWidth - m, y - d)
|
|
240
|
+
.lineWidth(width)
|
|
241
|
+
.strokeColor(color)
|
|
242
|
+
.opacity(opacity)
|
|
243
|
+
.stroke()
|
|
244
|
+
// Reset opacity after drawing the line
|
|
245
|
+
.opacity(1);
|
|
246
|
+
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
// padding: [10, 10, 10, 10]
|
|
250
|
+
// padding: [10, 10]
|
|
251
|
+
// padding: {top: 10, right: 10, bottom: 10, left: 10}
|
|
252
|
+
// padding: 10,
|
|
253
|
+
const prepareCellPadding = (p) => {
|
|
254
|
+
|
|
255
|
+
// array
|
|
256
|
+
if(Array.isArray(p)){
|
|
257
|
+
switch(p.length){
|
|
258
|
+
case 3: p = [...p, 0]; break;
|
|
259
|
+
case 2: p = [...p, ...p]; break;
|
|
260
|
+
case 1: p = Array(4).fill(p[0]); break;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
// number
|
|
264
|
+
else if(typeof p === 'number'){
|
|
265
|
+
p = Array(4).fill(p);
|
|
266
|
+
}
|
|
267
|
+
// object
|
|
268
|
+
else if(typeof p === 'object'){
|
|
269
|
+
const {top, right, bottom, left} = p;
|
|
270
|
+
p = [top, right, bottom, left];
|
|
271
|
+
}
|
|
272
|
+
// null
|
|
273
|
+
else {
|
|
274
|
+
p = Array(4).fill(0);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return {
|
|
278
|
+
top: p[0] >> 0, // int
|
|
279
|
+
right: p[1] >> 0,
|
|
280
|
+
bottom: p[2] >> 0,
|
|
281
|
+
left: p[3] >> 0,
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
const prepareRowOptions = (row) => {
|
|
287
|
+
|
|
288
|
+
// validate
|
|
289
|
+
if( typeof row !== 'object' || !row.hasOwnProperty('options') ) return;
|
|
290
|
+
|
|
291
|
+
const {fontFamily, fontSize, color} = row.options;
|
|
292
|
+
|
|
293
|
+
fontFamily && this.font(fontFamily);
|
|
294
|
+
fontSize && this.fontSize(fontSize);
|
|
295
|
+
color && this.fillColor(color);
|
|
296
|
+
|
|
297
|
+
// row.options.hasOwnProperty('fontFamily') && this.font(row.options.fontFamily);
|
|
298
|
+
// row.options.hasOwnProperty('fontSize') && this.fontSize(row.options.fontSize);
|
|
299
|
+
// row.options.hasOwnProperty('color') && this.fillColor(row.options.color);
|
|
300
|
+
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
const prepareRowBackground = (row, rect) => {
|
|
304
|
+
|
|
305
|
+
// validate
|
|
306
|
+
if(typeof row !== 'object') return;
|
|
307
|
+
|
|
308
|
+
// options
|
|
309
|
+
row.options && (row = row.options);
|
|
310
|
+
|
|
311
|
+
let { fill, opac } = {};
|
|
312
|
+
|
|
313
|
+
// add backgroundColor
|
|
314
|
+
if(row.hasOwnProperty('columnColor')){ // ^0.1.70
|
|
315
|
+
|
|
316
|
+
const { columnColor, columnOpacity } = row;
|
|
317
|
+
fill = columnColor;
|
|
318
|
+
opac = columnOpacity;
|
|
319
|
+
|
|
320
|
+
} else if(row.hasOwnProperty('backgroundColor')){ // ~0.1.65 old
|
|
321
|
+
|
|
322
|
+
const { backgroundColor, backgroundOpacity } = row;
|
|
323
|
+
fill = backgroundColor;
|
|
324
|
+
opac = backgroundOpacity;
|
|
325
|
+
|
|
326
|
+
} else if(row.hasOwnProperty('background')){ // dont remove
|
|
327
|
+
|
|
328
|
+
if(typeof row.background === 'object'){
|
|
329
|
+
let { color, opacity } = row.background;
|
|
330
|
+
fill = color;
|
|
331
|
+
opac = opacity;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
fill && this.addBackground(rect, fill, opac);
|
|
337
|
+
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
const computeRowHeight = (row, isHeader) => {
|
|
341
|
+
|
|
342
|
+
let result = isHeader ? 0 : (options.minRowHeight || 0);
|
|
343
|
+
let cellp;
|
|
344
|
+
|
|
345
|
+
// if row is object, content with property and options
|
|
346
|
+
if(!Array.isArray(row) && typeof row === 'object' && !row.hasOwnProperty('property')){
|
|
347
|
+
const cells = [];
|
|
348
|
+
// get all properties names on header
|
|
349
|
+
table.headers.forEach(({property}) => cells.push(row[property]) );
|
|
350
|
+
// define row with properties header
|
|
351
|
+
row = cells;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
row.forEach((cell,i) => {
|
|
355
|
+
|
|
356
|
+
let text = cell;
|
|
357
|
+
|
|
358
|
+
// object
|
|
359
|
+
// read cell and get label of object
|
|
360
|
+
if( typeof cell === 'object' ){
|
|
361
|
+
// define label
|
|
362
|
+
text = String(cell.label);
|
|
363
|
+
// apply font size on calc about height row
|
|
364
|
+
cell.hasOwnProperty('options') && prepareRowOptions(cell);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
text = String(text).replace('bold:','').replace('size','');
|
|
368
|
+
|
|
369
|
+
// cell padding
|
|
370
|
+
cellp = prepareCellPadding(table.headers[i].padding || options.padding || 0);
|
|
371
|
+
// cellp = prepareCellPadding(options.padding || 0);
|
|
372
|
+
// - (cellp.left + cellp.right + (columnSpacing * 2))
|
|
373
|
+
// console.log(cellp);
|
|
374
|
+
|
|
375
|
+
// calc height size of string
|
|
376
|
+
const cellHeight = this.heightOfString(text, {
|
|
377
|
+
width: columnSizes[i] - (cellp.left + cellp.right),
|
|
378
|
+
align: 'left',
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
result = Math.max(result, cellHeight);
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
// isHeader && (result = Math.max(result, options.minRowHeight));
|
|
385
|
+
|
|
386
|
+
// if(result + columnSpacing === 0) {
|
|
387
|
+
// computeRowHeight(row);
|
|
388
|
+
// }
|
|
389
|
+
|
|
390
|
+
return result + (columnSpacing);
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
// Calc columns size
|
|
394
|
+
|
|
395
|
+
const calcColumnSizes = () => {
|
|
396
|
+
|
|
397
|
+
let h = []; // header width
|
|
398
|
+
let p = []; // position
|
|
399
|
+
let w = 0; // table width
|
|
400
|
+
|
|
401
|
+
// (table width) 1o - Max size table
|
|
402
|
+
w = this.page.width - this.page.margins.right - ( options.x || this.page.margins.left );
|
|
403
|
+
// (table width) 2o - Size defined
|
|
404
|
+
options.width && ( w = parseInt(options.width) || String(options.width).replace(/[^0-9]/g,'') >> 0 );
|
|
405
|
+
|
|
406
|
+
// (table width) if table is percent of page
|
|
407
|
+
// ...
|
|
408
|
+
|
|
409
|
+
// (size columns) 1o
|
|
410
|
+
table.headers.forEach( el => {
|
|
411
|
+
el.width && h.push(el.width); // - columnSpacing
|
|
412
|
+
});
|
|
413
|
+
// (size columns) 2o
|
|
414
|
+
if(h.length === 0) {
|
|
415
|
+
h = options.columnsSize;
|
|
416
|
+
}
|
|
417
|
+
// (size columns) 3o
|
|
418
|
+
if(h.length === 0) {
|
|
419
|
+
columnWidth = ( w / table.headers.length ); // - columnSpacing // define column width
|
|
420
|
+
table.headers.forEach( () => h.push(columnWidth) );
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// Set columnPositions
|
|
424
|
+
h.reduce((prev, curr, indx) => {
|
|
425
|
+
p.push(prev >> 0);
|
|
426
|
+
return prev + curr;
|
|
427
|
+
},( options.x || this.page.margins.left ));
|
|
428
|
+
|
|
429
|
+
// !Set columnSizes
|
|
430
|
+
h.length && (columnSizes = h);
|
|
431
|
+
p.length && (columnPositions = p);
|
|
432
|
+
|
|
433
|
+
// (table width) 3o - Sum last position + lest header width
|
|
434
|
+
w = p[p.length-1] + h[h.length-1];
|
|
435
|
+
|
|
436
|
+
// !Set tableWidth
|
|
437
|
+
w && ( tableWidth = w );
|
|
438
|
+
|
|
439
|
+
// Ajust spacing
|
|
440
|
+
// tableWidth = tableWidth - (h.length * columnSpacing);
|
|
441
|
+
|
|
442
|
+
this.logg('columnSizes', h);
|
|
443
|
+
this.logg('columnPositions', p);
|
|
444
|
+
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
calcColumnSizes();
|
|
448
|
+
|
|
449
|
+
// Header
|
|
450
|
+
|
|
451
|
+
const addHeader = () => {
|
|
452
|
+
|
|
453
|
+
// Allow the user to override style for headers
|
|
454
|
+
prepareHeader();
|
|
455
|
+
|
|
456
|
+
// calc header height
|
|
457
|
+
if(this.headerHeight === 0){
|
|
458
|
+
this.headerHeight = computeRowHeight(table.headers, true);
|
|
459
|
+
this.logg(this.headerHeight, 'headers');
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// calc first table line when init table
|
|
463
|
+
if(firstLineHeight === 0){
|
|
464
|
+
if(table.datas.length > 0){
|
|
465
|
+
firstLineHeight = computeRowHeight(table.datas[0], true);
|
|
466
|
+
this.logg(firstLineHeight, 'datas');
|
|
467
|
+
}
|
|
468
|
+
if(table.rows.length > 0){
|
|
469
|
+
firstLineHeight = computeRowHeight(table.rows[0], true);
|
|
470
|
+
this.logg(firstLineHeight, 'rows');
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// 24.1 is height calc title + subtitle
|
|
475
|
+
titleHeight = !lockAddTitles ? 24.1 : 0;
|
|
476
|
+
// calc if header + first line fit on last page
|
|
477
|
+
const calc = startY + titleHeight + firstLineHeight + this.headerHeight + safelyMarginBottom// * 1.3;
|
|
478
|
+
|
|
479
|
+
// content is big text (crazy!)
|
|
480
|
+
if(firstLineHeight > maxY) {
|
|
481
|
+
// lockAddHeader = true;
|
|
482
|
+
lockAddPage = true;
|
|
483
|
+
this.logg('CRAZY! This a big text on cell');
|
|
484
|
+
} else if(calc > maxY) { // && !lockAddPage
|
|
485
|
+
// lockAddHeader = false;
|
|
486
|
+
lockAddPage = true;
|
|
487
|
+
onFirePageAdded(); // this.emitter.emit('addPage'); //this.addPage();
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
// if has title
|
|
492
|
+
if(lockAddTitles === false) {
|
|
493
|
+
|
|
494
|
+
// create title and subtitle
|
|
495
|
+
createTitle( title, 12, 1 );
|
|
496
|
+
createTitle( subtitle, 9, 0.7 );
|
|
497
|
+
|
|
498
|
+
// add space after title
|
|
499
|
+
if( title || subtitle ){
|
|
500
|
+
startY += 3;
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
// Allow the user to override style for headers
|
|
506
|
+
prepareHeader();
|
|
507
|
+
|
|
508
|
+
lockAddTitles = true;
|
|
509
|
+
|
|
510
|
+
// this options is trial
|
|
511
|
+
if(options.absolutePosition === true){
|
|
512
|
+
lastPositionX = options.x || startX || this.x; // x position head
|
|
513
|
+
startY = options.y || startY || this.y; // x position head
|
|
514
|
+
} else {
|
|
515
|
+
lastPositionX = startX; // x position head
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
// Check to have enough room for header and first rows. default 3
|
|
519
|
+
// if (startY + 2 * this.headerHeight >= maxY) this.emitter.emit('addPage'); //this.addPage();
|
|
520
|
+
|
|
521
|
+
if(!options.hideHeader && table.headers.length > 0) {
|
|
522
|
+
|
|
523
|
+
// simple header
|
|
524
|
+
if(typeof table.headers[0] === 'string') {
|
|
525
|
+
|
|
526
|
+
// // background header
|
|
527
|
+
// const rectRow = {
|
|
528
|
+
// x: startX,
|
|
529
|
+
// y: startY - columnSpacing - (rowDistance * 2),
|
|
530
|
+
// width: columnWidth,
|
|
531
|
+
// height: this.headerHeight + columnSpacing,
|
|
532
|
+
// };
|
|
533
|
+
|
|
534
|
+
// // add background
|
|
535
|
+
// this.addBackground(rectRow);
|
|
536
|
+
|
|
537
|
+
// print headers
|
|
538
|
+
table.headers.forEach((header, i) => {
|
|
539
|
+
|
|
540
|
+
// background header
|
|
541
|
+
const rectCell = {
|
|
542
|
+
x: lastPositionX,
|
|
543
|
+
y: startY - columnSpacing - (rowDistance * 2),
|
|
544
|
+
width: columnSizes[i],
|
|
545
|
+
height: this.headerHeight + columnSpacing,
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
// add background
|
|
549
|
+
this.addBackground(rectCell);
|
|
550
|
+
|
|
551
|
+
// cell padding
|
|
552
|
+
cellPadding = prepareCellPadding(options.padding || 0);
|
|
553
|
+
|
|
554
|
+
// write
|
|
555
|
+
this.text(header,
|
|
556
|
+
lastPositionX + (cellPadding.left),
|
|
557
|
+
startY, {
|
|
558
|
+
width: Number(columnSizes[i]) - (cellPadding.left + cellPadding.right),
|
|
559
|
+
align: 'left',
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
lastPositionX += columnSizes[i] >> 0;
|
|
563
|
+
|
|
564
|
+
});
|
|
565
|
+
|
|
566
|
+
}else{
|
|
567
|
+
|
|
568
|
+
// Print all headers
|
|
569
|
+
table.headers.forEach( (dataHeader, i) => {
|
|
570
|
+
|
|
571
|
+
let {label, width, renderer, align, headerColor, headerOpacity, headerAlign, padding} = dataHeader;
|
|
572
|
+
// check defination
|
|
573
|
+
width = width || columnSizes[i];
|
|
574
|
+
align = headerAlign || align || 'left';
|
|
575
|
+
// force number
|
|
576
|
+
width = width >> 0;
|
|
577
|
+
|
|
578
|
+
// register renderer function
|
|
579
|
+
if(renderer && typeof renderer === 'string') {
|
|
580
|
+
table.headers[i].renderer = fEval(renderer);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
// # Rotation
|
|
584
|
+
// var doTransform = function (x, y, angle) {
|
|
585
|
+
// var rads = angle / 180 * Math.PI;
|
|
586
|
+
// var newX = x * Math.cos(rads) + y * Math.sin(rads);
|
|
587
|
+
// var newY = y * Math.cos(rads) - x * Math.sin(rads);
|
|
588
|
+
|
|
589
|
+
// return {
|
|
590
|
+
// x: newX,
|
|
591
|
+
// y: newY,
|
|
592
|
+
// rads: rads,
|
|
593
|
+
// angle: angle
|
|
594
|
+
// };
|
|
595
|
+
// };
|
|
596
|
+
// }
|
|
597
|
+
// this.save(); // rotation
|
|
598
|
+
// this.rotate(90, {origin: [lastPositionX, startY]});
|
|
599
|
+
// width = 50;
|
|
600
|
+
|
|
601
|
+
// background header
|
|
602
|
+
const rectCell = {
|
|
603
|
+
x: lastPositionX,
|
|
604
|
+
y: startY - columnSpacing - (rowDistance * 2),
|
|
605
|
+
width: width,
|
|
606
|
+
height: this.headerHeight + columnSpacing,
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
// add background
|
|
610
|
+
this.addBackground(rectCell, headerColor, headerOpacity);
|
|
611
|
+
|
|
612
|
+
// cell padding
|
|
613
|
+
cellPadding = prepareCellPadding(padding || options.padding || 0);
|
|
614
|
+
|
|
615
|
+
// write
|
|
616
|
+
this.text(label,
|
|
617
|
+
lastPositionX + (cellPadding.left),
|
|
618
|
+
startY, {
|
|
619
|
+
width: width - (cellPadding.left + cellPadding.right),
|
|
620
|
+
align: align,
|
|
621
|
+
})
|
|
622
|
+
|
|
623
|
+
lastPositionX += width;
|
|
624
|
+
// this.restore(); // rotation
|
|
625
|
+
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
// set style
|
|
631
|
+
prepareRowOptions(table.headers);
|
|
632
|
+
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
if(!options.hideHeader) {
|
|
636
|
+
// Refresh the y coordinate of the bottom of the headers row
|
|
637
|
+
rowBottomY = Math.max(startY + computeRowHeight(table.headers, true), rowBottomY);
|
|
638
|
+
// Separation line between headers and rows
|
|
639
|
+
separationsRow('header', startX, rowBottomY);
|
|
640
|
+
} else {
|
|
641
|
+
rowBottomY = startY;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
// End header
|
|
647
|
+
addHeader();
|
|
648
|
+
|
|
649
|
+
// Datas
|
|
650
|
+
table.datas.forEach((row, i) => {
|
|
651
|
+
|
|
652
|
+
this.datasIndex = i;
|
|
653
|
+
const rowHeight = computeRowHeight(row, false);
|
|
654
|
+
this.logg(rowHeight);
|
|
655
|
+
|
|
656
|
+
// Switch to next page if we cannot go any further because the space is over.
|
|
657
|
+
// For safety, consider 3 rows margin instead of just one
|
|
658
|
+
// if (startY + 2 * rowHeight < maxY) startY = rowBottomY + columnSpacing + rowDistance; // 0.5 is spacing rows
|
|
659
|
+
// else this.emitter.emit('addPage'); //this.addPage();
|
|
660
|
+
if(options.useSafelyMarginBottom && this.y + safelyMarginBottom + rowHeight >= maxY && !lockAddPage) onFirePageAdded(); // this.emitter.emit('addPage'); //this.addPage();
|
|
661
|
+
|
|
662
|
+
// calc position
|
|
663
|
+
startY = rowBottomY + columnSpacing + rowDistance; // 0.5 is spacing rows
|
|
664
|
+
|
|
665
|
+
// unlock add page function
|
|
666
|
+
lockAddPage = false;
|
|
667
|
+
|
|
668
|
+
const rectRow = {
|
|
669
|
+
x: startX,
|
|
670
|
+
y: startY - columnSpacing - (rowDistance * 2),
|
|
671
|
+
width: tableWidth - startX,
|
|
672
|
+
height: rowHeight + columnSpacing,
|
|
673
|
+
};
|
|
674
|
+
|
|
675
|
+
// add background row
|
|
676
|
+
prepareRowBackground(row, rectRow);
|
|
677
|
+
|
|
678
|
+
lastPositionX = startX;
|
|
679
|
+
|
|
680
|
+
// Print all cells of the current row
|
|
681
|
+
table.headers.forEach(( dataHeader, index) => {
|
|
682
|
+
|
|
683
|
+
let {property, width, renderer, align, valign, padding} = dataHeader;
|
|
684
|
+
|
|
685
|
+
// check defination
|
|
686
|
+
width = width || columnWidth;
|
|
687
|
+
align = align || 'left';
|
|
688
|
+
|
|
689
|
+
// cell padding
|
|
690
|
+
cellPadding = prepareCellPadding(padding || options.padding || 0);
|
|
691
|
+
|
|
692
|
+
const rectCell = {
|
|
693
|
+
x: lastPositionX,
|
|
694
|
+
y: startY - columnSpacing - (rowDistance * 2),
|
|
695
|
+
width: width,
|
|
696
|
+
height: rowHeight + columnSpacing,
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
// allow the user to override style for rows
|
|
700
|
+
prepareRowOptions(row);
|
|
701
|
+
prepareRow(row, index, i, rectRow, rectCell,);
|
|
702
|
+
|
|
703
|
+
let text = row[property];
|
|
704
|
+
|
|
705
|
+
// cell object
|
|
706
|
+
if(typeof text === 'object' ){
|
|
707
|
+
|
|
708
|
+
text = String(text.label); // get label
|
|
709
|
+
// row[property].hasOwnProperty('options') && prepareRowOptions(row[property]); // set style
|
|
710
|
+
|
|
711
|
+
// options if text cell is object
|
|
712
|
+
if( row[property].hasOwnProperty('options') ){
|
|
713
|
+
|
|
714
|
+
// set font style
|
|
715
|
+
prepareRowOptions(row[property]);
|
|
716
|
+
prepareRowBackground(row[property], rectCell);
|
|
717
|
+
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
} else {
|
|
721
|
+
|
|
722
|
+
// style column by header
|
|
723
|
+
prepareRowBackground(table.headers[index], rectCell);
|
|
724
|
+
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
// bold
|
|
728
|
+
if( String(text).indexOf('bold:') === 0 ){
|
|
729
|
+
this.font('Helvetica-Bold');
|
|
730
|
+
text = text.replace('bold:','');
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
// size
|
|
734
|
+
if( String(text).indexOf('size') === 0 ){
|
|
735
|
+
let size = String(text).substr(4,2).replace(':','').replace('+','') >> 0;
|
|
736
|
+
this.fontSize( size < 7 ? 7 : size );
|
|
737
|
+
text = text.replace(`size${size}:`,'');
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
// renderer column
|
|
741
|
+
// renderer && (text = renderer(text, index, i, row, rectRow, rectCell)) // value, index-column, index-row, row nbhmn
|
|
742
|
+
if(typeof renderer === 'function'){
|
|
743
|
+
text = renderer(text, index, i, row, rectRow, rectCell); // value, index-column, index-row, row, doc[this]
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
// TODO # Experimental
|
|
747
|
+
// ------------------------------------------------------------------------------
|
|
748
|
+
// align vertically
|
|
749
|
+
let topTextToAlignVertically = 0;
|
|
750
|
+
if(valign && valign !== 'top'){
|
|
751
|
+
const heightText = this.heightOfString(text, {
|
|
752
|
+
width: width - (cellPadding.left + cellPadding.right),
|
|
753
|
+
align: align,
|
|
754
|
+
});
|
|
755
|
+
// line height, spacing hehight, cell and text diference
|
|
756
|
+
topTextToAlignVertically = rowDistance - columnSpacing + (rectCell.height - heightText) / 2;
|
|
757
|
+
}
|
|
758
|
+
// ------------------------------------------------------------------------------
|
|
759
|
+
|
|
760
|
+
this.text(text,
|
|
761
|
+
lastPositionX + (cellPadding.left),
|
|
762
|
+
startY + topTextToAlignVertically, {
|
|
763
|
+
width: width - (cellPadding.left + cellPadding.right),
|
|
764
|
+
align: align,
|
|
765
|
+
});
|
|
766
|
+
|
|
767
|
+
lastPositionX += width;
|
|
768
|
+
|
|
769
|
+
// set style
|
|
770
|
+
// Maybe REMOVE ???
|
|
771
|
+
prepareRowOptions(row);
|
|
772
|
+
prepareRow(row, index, i, rectRow, rectCell);
|
|
773
|
+
|
|
774
|
+
});
|
|
775
|
+
|
|
776
|
+
// Refresh the y coordinate of the bottom of this row
|
|
777
|
+
rowBottomY = Math.max(startY + rowHeight, rowBottomY);
|
|
778
|
+
|
|
779
|
+
// console.log(this.page.height, rowBottomY, this.y);
|
|
780
|
+
// text is so big as page (crazy!)
|
|
781
|
+
if(rowBottomY > this.page.height) {
|
|
782
|
+
rowBottomY = this.y + columnSpacing + (rowDistance * 2);
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
// Separation line between rows
|
|
786
|
+
separationsRow('horizontal', startX, rowBottomY);
|
|
787
|
+
|
|
788
|
+
// review this code
|
|
789
|
+
if( row.hasOwnProperty('options') ){
|
|
790
|
+
if( row.options.hasOwnProperty('separation') ){
|
|
791
|
+
// Separation line between rows
|
|
792
|
+
separationsRow('horizontal',startX, rowBottomY, 1, 1);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
});
|
|
797
|
+
// End datas
|
|
798
|
+
|
|
799
|
+
// Rows
|
|
800
|
+
table.rows.forEach((row, i) => {
|
|
801
|
+
|
|
802
|
+
this.rowsIndex = i;
|
|
803
|
+
const rowHeight = computeRowHeight(row, false);
|
|
804
|
+
this.logg(rowHeight);
|
|
805
|
+
|
|
806
|
+
// Switch to next page if we cannot go any further because the space is over.
|
|
807
|
+
// For safety, consider 3 rows margin instead of just one
|
|
808
|
+
// if (startY + 3 * rowHeight < maxY) startY = rowBottomY + columnSpacing + rowDistance; // 0.5 is spacing rows
|
|
809
|
+
// else this.emitter.emit('addPage'); //this.addPage();
|
|
810
|
+
if(options.useSafelyMarginBottom && this.y + safelyMarginBottom + rowHeight >= maxY && !lockAddPage) onFirePageAdded(); // this.emitter.emit('addPage'); //this.addPage();
|
|
811
|
+
|
|
812
|
+
// calc position
|
|
813
|
+
startY = rowBottomY + columnSpacing + rowDistance; // 0.5 is spacing rows
|
|
814
|
+
|
|
815
|
+
// unlock add page function
|
|
816
|
+
lockAddPage = false;
|
|
817
|
+
|
|
818
|
+
const rectRow = {
|
|
819
|
+
x: columnPositions[0],
|
|
820
|
+
// x: startX,
|
|
821
|
+
y: startY - columnSpacing - (rowDistance * 2),
|
|
822
|
+
width: tableWidth - startX,
|
|
823
|
+
height: rowHeight + columnSpacing,
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
// add background
|
|
827
|
+
// doc.addBackground(rectRow);
|
|
828
|
+
|
|
829
|
+
lastPositionX = startX;
|
|
830
|
+
|
|
831
|
+
row.forEach((cell, index) => {
|
|
832
|
+
|
|
833
|
+
let align = 'left';
|
|
834
|
+
let valign = undefined;
|
|
835
|
+
|
|
836
|
+
const rectCell = {
|
|
837
|
+
// x: columnPositions[index],
|
|
838
|
+
x: lastPositionX,
|
|
839
|
+
y: startY - columnSpacing - (rowDistance * 2),
|
|
840
|
+
width: columnSizes[index],
|
|
841
|
+
height: rowHeight + columnSpacing,
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
prepareRowBackground(table.headers[index], rectCell);
|
|
845
|
+
|
|
846
|
+
// Allow the user to override style for rows
|
|
847
|
+
prepareRow(row, index, i, rectRow, rectCell);
|
|
848
|
+
|
|
849
|
+
if(typeof table.headers[index] === 'object') {
|
|
850
|
+
// renderer column
|
|
851
|
+
table.headers[index].renderer && (cell = table.headers[index].renderer(cell, index, i, row, rectRow, rectCell, this)); // text-cell, index-column, index-line, row, doc[this]
|
|
852
|
+
// align
|
|
853
|
+
table.headers[index].align && (align = table.headers[index].align);
|
|
854
|
+
table.headers[index].valign && (valign = table.headers[index].valign);
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
// cell padding
|
|
858
|
+
cellPadding = prepareCellPadding(table.headers[index].padding || options.padding || 0);
|
|
859
|
+
|
|
860
|
+
// TODO # Experimental
|
|
861
|
+
// ------------------------------------------------------------------------------
|
|
862
|
+
// align vertically
|
|
863
|
+
let topTextToAlignVertically = 0;
|
|
864
|
+
if(valign && valign !== 'top'){
|
|
865
|
+
const heightText = this.heightOfString(cell, {
|
|
866
|
+
width: columnSizes[index] - (cellPadding.left + cellPadding.right),
|
|
867
|
+
align: align,
|
|
868
|
+
});
|
|
869
|
+
// line height, spacing hehight, cell and text diference
|
|
870
|
+
topTextToAlignVertically = rowDistance - columnSpacing + (rectCell.height - heightText) / 2;
|
|
871
|
+
}
|
|
872
|
+
// ------------------------------------------------------------------------------
|
|
873
|
+
|
|
874
|
+
this.text(cell,
|
|
875
|
+
lastPositionX + (cellPadding.left),
|
|
876
|
+
startY + topTextToAlignVertically, {
|
|
877
|
+
width: columnSizes[index] - (cellPadding.left + cellPadding.right),
|
|
878
|
+
align: align,
|
|
879
|
+
});
|
|
880
|
+
|
|
881
|
+
lastPositionX += columnSizes[index];
|
|
882
|
+
|
|
883
|
+
});
|
|
884
|
+
|
|
885
|
+
// Refresh the y coordinate of the bottom of this row
|
|
886
|
+
rowBottomY = Math.max(startY + rowHeight, rowBottomY);
|
|
887
|
+
|
|
888
|
+
// console.log(this.page.height, rowBottomY, this.y);
|
|
889
|
+
// text is so big as page (crazy!)
|
|
890
|
+
if(rowBottomY > this.page.height) {
|
|
891
|
+
rowBottomY = this.y + columnSpacing + (rowDistance * 2);
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
// Separation line between rows
|
|
895
|
+
separationsRow('horizontal', startX, rowBottomY);
|
|
896
|
+
|
|
897
|
+
});
|
|
898
|
+
// End rows
|
|
899
|
+
|
|
900
|
+
// update position
|
|
901
|
+
this.x = startX;
|
|
902
|
+
this.y = rowBottomY; // position y final;
|
|
903
|
+
this.moveDown(); // break
|
|
904
|
+
|
|
905
|
+
// add fire
|
|
906
|
+
this.off("pageAdded", onFirePageAdded);
|
|
907
|
+
|
|
908
|
+
// callback
|
|
909
|
+
typeof callback === 'function' && callback(this);
|
|
910
|
+
|
|
911
|
+
// nice :)
|
|
912
|
+
resolve();
|
|
913
|
+
|
|
914
|
+
} catch (error) {
|
|
915
|
+
|
|
916
|
+
// error
|
|
917
|
+
reject(error);
|
|
918
|
+
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
/**
|
|
925
|
+
* tables
|
|
926
|
+
* @param {Object} tables
|
|
927
|
+
* @returns
|
|
928
|
+
*/
|
|
929
|
+
async tables(tables, callback) {
|
|
930
|
+
return new Promise(async (resolve, reject) => {
|
|
931
|
+
try {
|
|
932
|
+
|
|
933
|
+
if(Array.isArray(tables) === false)
|
|
934
|
+
{
|
|
935
|
+
resolve();
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
const len = tables.length;
|
|
940
|
+
for(let i; i < len; i++)
|
|
941
|
+
{
|
|
942
|
+
await this.table(tables[i], tables[i].options || {});
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
// if tables is Array
|
|
946
|
+
// Array.isArray(tables) ?
|
|
947
|
+
// // for each on Array
|
|
948
|
+
// tables.forEach( async table => await this.table( table, table.options || {} ) ) :
|
|
949
|
+
// // else is tables is a unique table object
|
|
950
|
+
// ( typeof tables === 'object' ? this.table( tables, tables.options || {} ) : null ) ;
|
|
951
|
+
// // callback
|
|
952
|
+
typeof callback === 'function' && callback(this);
|
|
953
|
+
// // donw!
|
|
954
|
+
resolve();
|
|
955
|
+
}
|
|
956
|
+
catch(error)
|
|
957
|
+
{
|
|
958
|
+
reject(error);
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
module.exports = PDFDocumentWithTables;
|
|
967
|
+
module.exports.default = PDFDocumentWithTables;
|