@nanoporetech-digital/components 6.0.1 → 6.2.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 +30 -0
- package/dist/cjs/index-14451c95.js +6 -2
- package/dist/cjs/index-browser.cjs-d4554470.js +39 -0
- package/dist/cjs/index-browser.cjs-d4554470.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/nano-algolia.cjs.entry.js +6 -1
- package/dist/cjs/nano-algolia.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-animation.cjs.entry.js +1209 -0
- package/dist/cjs/nano-animation.cjs.entry.js.map +1 -0
- package/dist/cjs/nano-components.cjs.js +1 -1
- package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-nav.cjs.entry.js +24 -25
- package/dist/cjs/nano-global-nav.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-search-results.cjs.entry.js +51 -27
- package/dist/cjs/nano-global-search-results.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-hero.cjs.entry.js +1 -1
- package/dist/cjs/nano-hero.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-intersection-observe.cjs.entry.js +131 -0
- package/dist/cjs/nano-intersection-observe.cjs.entry.js.map +1 -0
- package/dist/cjs/nano-resize-observe_2.cjs.entry.js +1 -1
- package/dist/cjs/nano-resize-observe_2.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-sticker.cjs.entry.js +2 -27
- package/dist/cjs/nano-sticker.cjs.entry.js.map +1 -1
- package/dist/cjs/{nano-table-400049cc.js → nano-table-06530d49.js} +5 -25
- package/dist/cjs/nano-table-06530d49.js.map +1 -0
- package/dist/cjs/nano-table.cjs.entry.js +2 -1
- package/dist/cjs/nano-table.cjs.entry.js.map +1 -1
- package/dist/cjs/scroll-parent-87393de2.js +31 -0
- package/dist/cjs/scroll-parent-87393de2.js.map +1 -0
- package/dist/cjs/search-insights-b2bb12bd.js +50 -0
- package/dist/cjs/search-insights-b2bb12bd.js.map +1 -0
- package/dist/cjs/{table.worker-a37f8365.js → table.worker-b4922b9b.js} +3 -2
- package/dist/cjs/table.worker-b4922b9b.js.map +1 -0
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/algolia/algolia-interface.js.map +1 -1
- package/dist/collection/components/algolia/algolia.js +8 -3
- package/dist/collection/components/algolia/algolia.js.map +1 -1
- package/dist/collection/components/animation/animation.js +547 -0
- package/dist/collection/components/animation/animation.js.map +1 -0
- package/dist/collection/components/animation/animations/attention_seekers/bounce.js +43 -0
- package/dist/collection/components/animation/animations/attention_seekers/flash.js +7 -0
- package/dist/collection/components/animation/animations/attention_seekers/headShake.js +8 -0
- package/dist/collection/components/animation/animations/attention_seekers/heartBeat.js +7 -0
- package/dist/collection/components/animation/animations/attention_seekers/jello.js +15 -0
- package/dist/collection/components/animation/animations/attention_seekers/pulse.js +5 -0
- package/dist/collection/components/animation/animations/attention_seekers/rubberBand.js +9 -0
- package/dist/collection/components/animation/animations/attention_seekers/shake.js +13 -0
- package/dist/collection/components/animation/animations/attention_seekers/shakeX.js +13 -0
- package/dist/collection/components/animation/animations/attention_seekers/shakeY.js +13 -0
- package/dist/collection/components/animation/animations/attention_seekers/swing.js +7 -0
- package/dist/collection/components/animation/animations/attention_seekers/tada.js +13 -0
- package/dist/collection/components/animation/animations/attention_seekers/wobble.js +18 -0
- package/dist/collection/components/animation/animations/back_entrances/backInDown.js +5 -0
- package/dist/collection/components/animation/animations/back_entrances/backInLeft.js +5 -0
- package/dist/collection/components/animation/animations/back_entrances/backInRight.js +5 -0
- package/dist/collection/components/animation/animations/back_entrances/backInUp.js +5 -0
- package/dist/collection/components/animation/animations/back_exits/backOutDown.js +5 -0
- package/dist/collection/components/animation/animations/back_exits/backOutLeft.js +5 -0
- package/dist/collection/components/animation/animations/back_exits/backOutRight.js +5 -0
- package/dist/collection/components/animation/animations/back_exits/backOutUp.js +5 -0
- package/dist/collection/components/animation/animations/bouncing_entrances/bounceIn.js +14 -0
- package/dist/collection/components/animation/animations/bouncing_entrances/bounceInDown.js +20 -0
- package/dist/collection/components/animation/animations/bouncing_entrances/bounceInLeft.js +16 -0
- package/dist/collection/components/animation/animations/bouncing_entrances/bounceInRight.js +16 -0
- package/dist/collection/components/animation/animations/bouncing_entrances/bounceInUp.js +16 -0
- package/dist/collection/components/animation/animations/bouncing_exits/bounceOut.js +6 -0
- package/dist/collection/components/animation/animations/bouncing_exits/bounceOutDown.js +14 -0
- package/dist/collection/components/animation/animations/bouncing_exits/bounceOutLeft.js +12 -0
- package/dist/collection/components/animation/animations/bouncing_exits/bounceOutRight.js +8 -0
- package/dist/collection/components/animation/animations/bouncing_exits/bounceOutUp.js +18 -0
- package/dist/collection/components/animation/animations/easings/easings.js +35 -0
- package/dist/collection/components/animation/animations/easings/easings.js.map +1 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeIn.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInBottomLeft.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInBottomRight.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInDown.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInDownBig.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInLeft.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInLeftBig.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInRight.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInRightBig.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInTopLeft.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInTopRight.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInUp.js +4 -0
- package/dist/collection/components/animation/animations/fading_entrances/fadeInUpBig.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOut.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutBottomLeft.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutBottomRight.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutDown.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutDownBig.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutLeft.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutLeftBig.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutRight.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutRightBig.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutTopLeft.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutTopRight.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutUp.js +4 -0
- package/dist/collection/components/animation/animations/fading_exits/fadeOutUpBig.js +4 -0
- package/dist/collection/components/animation/animations/flippers/flip.js +32 -0
- package/dist/collection/components/animation/animations/flippers/flipInX.js +20 -0
- package/dist/collection/components/animation/animations/flippers/flipInY.js +20 -0
- package/dist/collection/components/animation/animations/flippers/flipOutX.js +13 -0
- package/dist/collection/components/animation/animations/flippers/flipOutY.js +13 -0
- package/dist/collection/components/animation/animations/index.js +203 -0
- package/dist/collection/components/animation/animations/index.js.map +1 -0
- package/dist/collection/components/animation/animations/lightspeed/lightSpeedInLeft.js +10 -0
- package/dist/collection/components/animation/animations/lightspeed/lightSpeedInRight.js +10 -0
- package/dist/collection/components/animation/animations/lightspeed/lightSpeedOutLeft.js +8 -0
- package/dist/collection/components/animation/animations/lightspeed/lightSpeedOutRight.js +8 -0
- package/dist/collection/components/animation/animations/rotating_entrances/rotateIn.js +4 -0
- package/dist/collection/components/animation/animations/rotating_entrances/rotateInDownLeft.js +4 -0
- package/dist/collection/components/animation/animations/rotating_entrances/rotateInDownRight.js +4 -0
- package/dist/collection/components/animation/animations/rotating_entrances/rotateInUpLeft.js +4 -0
- package/dist/collection/components/animation/animations/rotating_entrances/rotateInUpRight.js +4 -0
- package/dist/collection/components/animation/animations/rotating_exits/rotateOut.js +4 -0
- package/dist/collection/components/animation/animations/rotating_exits/rotateOutDownLeft.js +4 -0
- package/dist/collection/components/animation/animations/rotating_exits/rotateOutDownRight.js +4 -0
- package/dist/collection/components/animation/animations/rotating_exits/rotateOutUpLeft.js +4 -0
- package/dist/collection/components/animation/animations/rotating_exits/rotateOutUpRight.js +4 -0
- package/dist/collection/components/animation/animations/sliding_entrances/slideInDown.js +4 -0
- package/dist/collection/components/animation/animations/sliding_entrances/slideInLeft.js +4 -0
- package/dist/collection/components/animation/animations/sliding_entrances/slideInRight.js +4 -0
- package/dist/collection/components/animation/animations/sliding_entrances/slideInUp.js +4 -0
- package/dist/collection/components/animation/animations/sliding_exits/slideOutDown.js +4 -0
- package/dist/collection/components/animation/animations/sliding_exits/slideOutLeft.js +4 -0
- package/dist/collection/components/animation/animations/sliding_exits/slideOutRight.js +4 -0
- package/dist/collection/components/animation/animations/sliding_exits/slideOutUp.js +4 -0
- package/dist/collection/components/animation/animations/specials/hinge.js +18 -0
- package/dist/collection/components/animation/animations/specials/jackInTheBox.js +11 -0
- package/dist/collection/components/animation/animations/specials/rollIn.js +8 -0
- package/dist/collection/components/animation/animations/specials/rollOut.js +8 -0
- package/dist/collection/components/animation/animations/zooming_entrances/zoomIn.js +4 -0
- package/dist/collection/components/animation/animations/zooming_entrances/zoomInDown.js +14 -0
- package/dist/collection/components/animation/animations/zooming_entrances/zoomInLeft.js +14 -0
- package/dist/collection/components/animation/animations/zooming_entrances/zoomInRight.js +14 -0
- package/dist/collection/components/animation/animations/zooming_entrances/zoomInUp.js +14 -0
- package/dist/collection/components/animation/animations/zooming_exits/zoomOut.js +5 -0
- package/dist/collection/components/animation/animations/zooming_exits/zoomOutDown.js +14 -0
- package/dist/collection/components/animation/animations/zooming_exits/zoomOutLeft.js +12 -0
- package/dist/collection/components/animation/animations/zooming_exits/zoomOutRight.js +12 -0
- package/dist/collection/components/animation/animations/zooming_exits/zoomOutUp.js +14 -0
- package/dist/collection/components/global-nav/global-nav-interface.js.map +1 -1
- package/dist/collection/components/global-nav/global-nav.js +25 -25
- package/dist/collection/components/global-nav/global-nav.js.map +1 -1
- package/dist/collection/components/global-search-results/global-search-results.js +51 -27
- package/dist/collection/components/global-search-results/global-search-results.js.map +1 -1
- package/dist/collection/components/hero/hero.css +0 -1
- package/dist/collection/components/intersection-observe/intersection-observe.js +256 -0
- package/dist/collection/components/intersection-observe/intersection-observe.js.map +1 -0
- package/dist/collection/components/resize-observe/resize-observe.js +1 -1
- package/dist/collection/components/resize-observe/resize-observe.js.map +1 -1
- package/dist/collection/components/select/select.js +5 -5
- package/dist/collection/components/select/select.js.map +1 -1
- package/dist/collection/components/sticker/sticker.js +2 -27
- package/dist/collection/components/sticker/sticker.js.map +1 -1
- package/dist/collection/components/table/table.js +2 -1
- package/dist/collection/components/table/table.js.map +1 -1
- package/dist/collection/components/table/table.utils.js +0 -21
- package/dist/collection/components/table/table.utils.js.map +1 -1
- package/dist/collection/utils/scroll-parent.js +26 -0
- package/dist/collection/utils/scroll-parent.js.map +1 -0
- package/dist/collection/utils/search-insights.js +46 -0
- package/dist/collection/utils/search-insights.js.map +1 -0
- package/dist/components/algolia.js +6 -1
- package/dist/components/algolia.js.map +1 -1
- package/dist/components/index-browser.cjs.js +37 -0
- package/dist/components/index-browser.cjs.js.map +1 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.js +2 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/{nano-aspect-ratio.d.ts → nano-animation.d.ts} +4 -4
- package/dist/components/nano-animation.js +1239 -0
- package/dist/components/nano-animation.js.map +1 -0
- package/dist/components/nano-global-nav.js +24 -25
- package/dist/components/nano-global-nav.js.map +1 -1
- package/dist/components/nano-global-search-results.js +51 -27
- package/dist/components/nano-global-search-results.js.map +1 -1
- package/dist/components/nano-hero.js +1 -1
- package/dist/components/nano-hero.js.map +1 -1
- package/dist/components/nano-intersection-observe.d.ts +11 -0
- package/dist/components/nano-intersection-observe.js +149 -0
- package/dist/components/nano-intersection-observe.js.map +1 -0
- package/dist/components/resize-observe.js +1 -1
- package/dist/components/resize-observe.js.map +1 -1
- package/dist/components/scroll-parent.js +29 -0
- package/dist/components/scroll-parent.js.map +1 -0
- package/dist/components/search-insights.js +48 -0
- package/dist/components/search-insights.js.map +1 -0
- package/dist/components/select.js.map +1 -1
- package/dist/components/sticker.js +2 -27
- package/dist/components/sticker.js.map +1 -1
- package/dist/components/table.js +1 -21
- package/dist/components/table.js.map +1 -1
- package/dist/esm/index-9695db0a.js +6 -2
- package/dist/esm/index-browser.cjs-bf702094.js +37 -0
- package/dist/esm/index-browser.cjs-bf702094.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/nano-algolia.entry.js +6 -1
- package/dist/esm/nano-algolia.entry.js.map +1 -1
- package/dist/esm/nano-animation.entry.js +1205 -0
- package/dist/esm/nano-animation.entry.js.map +1 -0
- package/dist/esm/nano-components.js +1 -1
- package/dist/esm/nano-global-nav-user-profile_3.entry.js.map +1 -1
- package/dist/esm/nano-global-nav.entry.js +24 -25
- package/dist/esm/nano-global-nav.entry.js.map +1 -1
- package/dist/esm/nano-global-search-results.entry.js +51 -27
- package/dist/esm/nano-global-search-results.entry.js.map +1 -1
- package/dist/esm/nano-hero.entry.js +1 -1
- package/dist/esm/nano-hero.entry.js.map +1 -1
- package/dist/esm/nano-intersection-observe.entry.js +127 -0
- package/dist/esm/nano-intersection-observe.entry.js.map +1 -0
- package/dist/esm/nano-resize-observe_2.entry.js +1 -1
- package/dist/esm/nano-resize-observe_2.entry.js.map +1 -1
- package/dist/esm/nano-sticker.entry.js +2 -27
- package/dist/esm/nano-sticker.entry.js.map +1 -1
- package/dist/esm/{nano-table-a6641aef.js → nano-table-c85a2fd3.js} +3 -23
- package/dist/esm/nano-table-c85a2fd3.js.map +1 -0
- package/dist/esm/nano-table.entry.js +2 -1
- package/dist/esm/nano-table.entry.js.map +1 -1
- package/dist/esm/scroll-parent-bab1cbf7.js +29 -0
- package/dist/esm/scroll-parent-bab1cbf7.js.map +1 -0
- package/dist/esm/search-insights-f64a6b4c.js +48 -0
- package/dist/esm/search-insights-f64a6b4c.js.map +1 -0
- package/dist/esm/{table.worker-6b597e20.js → table.worker-761fba3e.js} +3 -2
- package/dist/esm/table.worker-761fba3e.js.map +1 -0
- package/dist/nano-components/index-browser.cjs-bf702094.js +5 -0
- package/dist/nano-components/index-browser.cjs-bf702094.js.map +1 -0
- package/dist/nano-components/nano-algolia.entry.js +1 -1
- package/dist/nano-components/nano-algolia.entry.js.map +1 -1
- package/dist/nano-components/nano-animation.entry.js +5 -0
- package/dist/nano-components/nano-animation.entry.js.map +1 -0
- package/dist/nano-components/nano-components.css +1 -1
- package/dist/nano-components/nano-components.esm.js +1 -1
- package/dist/nano-components/nano-components.esm.js.map +1 -1
- package/dist/nano-components/nano-global-nav-user-profile_3.entry.js.map +1 -1
- package/dist/nano-components/nano-global-nav.entry.js +1 -1
- package/dist/nano-components/nano-global-nav.entry.js.map +1 -1
- package/dist/nano-components/nano-global-search-results.entry.js +1 -1
- package/dist/nano-components/nano-global-search-results.entry.js.map +1 -1
- package/dist/nano-components/nano-hero.entry.js +1 -1
- package/dist/nano-components/nano-hero.entry.js.map +1 -1
- package/dist/nano-components/nano-intersection-observe.entry.js +5 -0
- package/dist/nano-components/nano-intersection-observe.entry.js.map +1 -0
- package/dist/nano-components/nano-resize-observe_2.entry.js +1 -1
- package/dist/nano-components/nano-resize-observe_2.entry.js.map +1 -1
- package/dist/nano-components/nano-sticker.entry.js +1 -1
- package/dist/nano-components/nano-sticker.entry.js.map +1 -1
- package/dist/nano-components/nano-table-c85a2fd3.js +5 -0
- package/dist/nano-components/nano-table-c85a2fd3.js.map +1 -0
- package/dist/nano-components/nano-table.entry.js +1 -1
- package/dist/nano-components/scroll-parent-bab1cbf7.js +5 -0
- package/dist/nano-components/scroll-parent-bab1cbf7.js.map +1 -0
- package/dist/nano-components/search-insights-f64a6b4c.js +5 -0
- package/dist/nano-components/search-insights-f64a6b4c.js.map +1 -0
- package/dist/nano-components/table.worker-761fba3e.js +5 -0
- package/dist/types/components/algolia/algolia-interface.d.ts +2 -1
- package/dist/types/components/algolia/algolia.d.ts +7 -1
- package/dist/types/components/animation/animation.d.ts +74 -0
- package/dist/types/components/animation/animations/easings/easings.d.ts +31 -0
- package/dist/types/components/animation/animations/index.d.ts +101 -0
- package/dist/types/components/global-nav/global-nav-interface.d.ts +1 -0
- package/dist/types/components/global-nav/global-nav.d.ts +2 -6
- package/dist/types/components/global-search-results/global-search-results.d.ts +13 -7
- package/dist/types/components/intersection-observe/intersection-observe.d.ts +45 -0
- package/dist/types/components/select/select.d.ts +2 -4
- package/dist/types/components/sticker/sticker.d.ts +0 -5
- package/dist/types/components/table/table.utils.d.ts +0 -6
- package/dist/types/components.d.ts +213 -43
- package/dist/types/interface.d.ts +7 -2
- package/dist/types/utils/scroll-parent.d.ts +6 -0
- package/dist/types/utils/search-insights.d.ts +22 -0
- package/docs-json.json +1031 -117
- package/docs-vscode.json +488 -8
- package/hydrate/index.js +1636 -249
- package/package.json +3 -2
- package/dist/cjs/nano-aspect-ratio.cjs.entry.js +0 -53
- package/dist/cjs/nano-aspect-ratio.cjs.entry.js.map +0 -1
- package/dist/cjs/nano-table-400049cc.js.map +0 -1
- package/dist/cjs/table.worker-a37f8365.js.map +0 -1
- package/dist/collection/components/aspect-ratio/aspect-ratio.css +0 -38
- package/dist/collection/components/aspect-ratio/aspect-ratio.js +0 -106
- package/dist/collection/components/aspect-ratio/aspect-ratio.js.map +0 -1
- package/dist/components/nano-aspect-ratio.js +0 -70
- package/dist/components/nano-aspect-ratio.js.map +0 -1
- package/dist/esm/nano-aspect-ratio.entry.js +0 -49
- package/dist/esm/nano-aspect-ratio.entry.js.map +0 -1
- package/dist/esm/nano-table-a6641aef.js.map +0 -1
- package/dist/esm/table.worker-6b597e20.js.map +0 -1
- package/dist/nano-components/nano-aspect-ratio.entry.js +0 -5
- package/dist/nano-components/nano-aspect-ratio.entry.js.map +0 -1
- package/dist/nano-components/nano-table-a6641aef.js +0 -5
- package/dist/nano-components/nano-table-a6641aef.js.map +0 -1
- package/dist/nano-components/table.worker-6b597e20.js +0 -5
- package/dist/types/components/aspect-ratio/aspect-ratio.d.ts +0 -19
- /package/dist/nano-components/{table.worker-6b597e20.js.map → table.worker-761fba3e.js.map} +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../../src/components/table/table.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,CAAC,EAED,OAAO,EACP,IAAI,EACJ,KAAK,EACL,KAAK,EACL,QAAQ,EACR,KAAK,EAEL,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAGL,UAAU,GACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EACL,aAAa,EACb,WAAW,EACX,cAAc,EACd,YAAY,EACZ,SAAS,EACT,WAAW,GAEZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,WAAW,GAAG,KAAK,CAAC;AAE1B,SAAS,OAAO,CAAC,IAAY,EAAE,MAAe,KAAK;EACjD,IAAI,CAAC,WAAW,IAAI,CAAC,WAAW;IAAE,O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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Prop,\n h,\n ComponentInterface,\n Element,\n Host,\n Watch,\n State,\n readTask,\n Event,\n EventEmitter,\n Method,\n} from '@stencil/core';\nimport { cyrb53 } from '../../utils/math';\nimport { debounce } from '../../utils/throttle';\nimport {\n NanoResizeObserveCustomEvent,\n ResizeStateChangeEventDetail,\n TableTypes,\n} from '../../interface';\nimport { TableColHead } from './table.header';\nimport { TableRow, TableHeadFootRow } from './table.row';\nimport { TableCell } from './table.cell';\nimport { CSSNAMESPACE } from './table.constants';\nimport {\n generateStore,\n storeSearch,\n storeSetConfig,\n storeSetData,\n storeSort,\n storeFilter,\n TableStores,\n} from './table.store';\nimport { findScrollParent, isInViewport } from './table.utils';\nimport { TablePinService } from './table.pin-service';\n\nconst measurePerf = false;\n\nfunction perMark(name: string, end: boolean = false) {\n if (!performance || !measurePerf) return;\n if (end) {\n performance?.mark('end' + name);\n performance?.measure(name, 'start' + name, 'end' + name);\n const entries = performance?.getEntriesByName(name);\n console.info(entries[entries.length ? entries.length - 1 : 0]);\n } else {\n performance?.mark('start' + name);\n }\n}\n\nlet id = 0;\n/**\n * A performant, accessible and semantic (uses real html `<table />`, `<tr />` etc) table and data-grid solution.\n *\n *- Built-in search\n *- Built-in column filter\n *- Built-in column sort\n *- Easily swap in API / async based search / filter & sort\n *- Pin headers, footers, rows, columns\n *- Add custom rendering at every level\n *- Add custom properties at every level\n *\n * @slot caption - The table's caption. You must either use this or the `caption` attribute.\n * @slot no-results - text to display when search or filtering yields no results\n */\n@Component({\n tag: 'nano-table',\n styleUrl: 'table.scss',\n})\nexport class Table implements ComponentInterface {\n constructor() {\n this.debounceSetLoading = debounce(this.debounceSetLoading.bind(this), 50);\n }\n // Public API\n\n // Props\n\n /** Function called whenever `col.cellTemplate` renders an unknown object.\n * The function should render a valid HTMLElement to the cell arg.\n * Example usage - render JSX from a 3rd party lib and append the result to the cell element. */\n @Prop() customRenderer: (\n node: any,\n cell: HTMLElement\n ) => void | Promise<string>;\n\n /** The type of table. Grid type will make cells navigable by keyboard */\n @Prop() type: 'grid' | 'table' = 'table';\n\n /** A descriptive title of the table.\n * You must use this or the `slot=\"caption\"` for accessibility */\n @Prop() caption: string;\n\n /** Show the caption on-screen */\n @Prop() showCaption: boolean = false;\n\n /** Will show a loading state when set to true.\n * By default, will be shown automatically if `rows` is a promise waiting to resolve / or falsy\n * *or* when performing custom filtering or sorting.\n * *Note* when set manually, will overwrite any internal loading state.\n * Set to 'undefined' to revert to default behaviour. */\n @Prop() loading: boolean = undefined;\n\n get _loading() {\n return this.loading !== undefined ? this.loading : this.internalLoading;\n }\n set _loading(l: boolean) {\n if (this.loading !== undefined) return;\n this.debounceSetLoading(l);\n }\n private debounceSetLoading(l: boolean) {\n this.internalLoading = l;\n }\n @State() internalLoading = true;\n\n /** When loading rows asynchronously, this will render this number of placeholder rows */\n @Prop() placeholderSize = 5;\n\n /** The data to place in the table */\n @Prop({ mutable: true }) rows:\n | TableTypes.NanoTable['rows']\n | Promise<TableTypes.NanoTable['rows']>;\n\n @Watch('rows')\n handleRowsChange() {\n if (!this.rows) {\n this._loading = true;\n return;\n }\n\n this._loading = true;\n Promise.resolve(this.rows).then(async (rows) => {\n await storeSetData(this.host, rows);\n\n // reset everything\n this.currentFilters = '';\n this.currentSort = '';\n await this.columnInit();\n\n if (!this.isReady)\n requestAnimationFrame(() => this.setInitialBlockDimension());\n this._loading = false;\n if (this.tablePinnedService) this.tablePinnedService.assessRows();\n });\n }\n\n /** The column config used to present the rows of data */\n @Prop({ mutable: true }) columns: TableTypes.NanoTable<any>['columns'] = [];\n\n @Watch('columns')\n async handleColsChange() {\n await storeSetConfig(this.host, this.columns);\n if (this.isReady) this.columnInit();\n }\n\n /** Used for custom thead row rendering */\n @Prop() headRender: TableTypes.HeadFootRenderer = { pinned: 'top' };\n\n /** Used for custom row rendering */\n @Prop() rowRender: TableTypes.RowRenderer;\n\n /** Used for custom tfoot row rendering */\n @Prop() footRender: TableTypes.HeadFootRenderer = { pinned: 'bottom' };\n\n /** Whether to show a `<tfoot>` component */\n @Prop() showFooter = false;\n\n /** To improve performance, data is split into blocks\n * which are shown / hidden and rendered as they become visible.\n * Use this to control the number of hits within a block -\n * A block should fill a scrolling viewport.\n * The less perBlock the better for performance */\n @Prop() perBlock = 50;\n\n /** The number of total blocks currently rendered in the table. @readonly */\n @Prop()\n get blocksLength() {\n return this.blocks.length;\n }\n\n /** Term to search for in the data */\n @Prop() searchTerm: string;\n\n /** A custom filtering function. Should return a promise.\n * If the promise resolves as `true` the column UI will be updated.\n * If the promise resolves as falsy, the sort will be performed by the component.\n * A good use-case would be performing the filter on a server / via fetch.\n * Then on success, updating the table's data via the `rows` property */\n @Prop() customFilterFn?: (\n filters: TableTypes.Filter[]\n ) => Promise<true | TableTypes.Falsy>;\n\n /** A custom sorting function. Should return a promise.\n * If the promise resolves as `true` the column UI will be updated.\n * If the promise resolves as falsey, the sort will be performed by the component.\n * A good use-case would be performing the sort on a server / via fetch.\n * Then on success, updating the table's data via the `rows` property */\n @Prop() customSortFn?: (\n property: TableTypes.Prop,\n order: TableTypes.Order\n ) => Promise<true | TableTypes.Falsy>;\n\n /**\n * The default sortable option for all columns.\n * `true` will enable column sorting unless you set `sortable: false` on a column\n * `false` will disable column sorting unless you set `sortable: true` on a column\n */\n @Prop() defaultSort = true;\n\n @Watch('searchTerm')\n handleSearchTermChange() {\n this.searchStart();\n }\n\n /** Use this to render the table with roughly the correct dimensions.\n * a use-case might be; fetch a small initial dataset to minimise load-time,\n * render the table with the correct dimensions, the table becomes interactive,\n * load the rest of the data\n */\n @Prop() virtualTotalItems: number = 0;\n\n @Watch('virtualTotalItems')\n virtualTotalItemsChangeHandler() {\n this.setBlocks();\n }\n\n /** @readonly - shows the currently applied filters */\n @Prop()\n get appliedFilters() {\n return this.filters;\n }\n\n /** Fired when the table has done it's first complete render */\n @Event() nanoTblReady: EventEmitter;\n\n /** Fired whenever a block is activated by scrolling into view / becoming visible\n * This could be leveraged for infinite scrolling / to fetch more data.\n */\n @Event() nanoTblBlockRendered: EventEmitter<{\n block: number;\n totalBlocks: number;\n }>;\n\n /** Fired before a column is sorted.\n * `event.preventDefault()` to stop sorting. */\n @Event() nanoTblBeforeSort: EventEmitter<{\n column: TableTypes.Prop;\n order: TableTypes.Order;\n }>;\n\n /** Fired after a column is sorted */\n @Event() nanoTblAfterSort: EventEmitter<{\n column: TableTypes.Prop;\n order: TableTypes.Order;\n }>;\n\n /** Fired before a column is filtered.\n * `event.preventDefault()` to stop filtering. */\n @Event() nanoTblBeforeFilter: EventEmitter<{ filters: TableTypes.Filter[] }>;\n\n /** Fired after a column is sorted */\n @Event() nanoTblAfterFilter: EventEmitter<{ filters: TableTypes.Filter[] }>;\n\n /** Fired before a general search.\n * `event.preventDefault()` to stop searching. */\n @Event() nanoTblBeforeSearch: EventEmitter<{ term: string }>;\n\n /** Fired after a general / cross column search */\n @Event() nanoTblAfterSearch: EventEmitter<{ term: string }>;\n\n /** Fired before a general search.\n * `event.preventDefault()` to stop searching. */\n @Event() nanoTblBeforeEdit: EventEmitter<{ term: string }>;\n\n /** Remove any column sorts currently applied\n * @returns a promise which resolves when complete */\n @Method()\n async resetSorting() {\n const col = (this.columns as TableTypes.NanoTable['columns']).find(\n (c) => !!c.order\n );\n if (!col) return;\n return this.sortStart(null, col.prop);\n }\n\n /** Apply a sort on a column\n * @returns a promise which resolves when complete */\n @Method()\n async addSort(column: TableTypes.Prop, order: TableTypes.Order) {\n const col = (this.columns as TableTypes.NanoTable['columns']).find(\n (c) => c.prop === column\n );\n if (!col) throw 'Cannot find column with ' + column;\n return this.sortStart(order, col.prop);\n }\n\n /** Remove any column filters currently applied\n * @returns a promise which resolves when complete */\n @Method()\n async resetFilters() {\n this.filters = [];\n return this.filterStart();\n }\n\n /** Apply a filter on a column\n * @param filters - the filters to apply\n * @param additive - if true, will add the filters to any currently applied\n * @returns a promise which resolves when complete\n */\n @Method()\n async addFilters(filters: TableTypes.Filter[], additive: boolean = true) {\n if (!additive) this.filters = [];\n return this.filterStart(filters, additive);\n }\n\n /** Remove filters from a column\n * @param columnNames - the filters to apply\n * @returns a promise which resolves when complete\n */\n @Method()\n async removeFilters(columnNames: TableTypes.Prop[]) {\n this.filters = this.filters.filter((f) => !columnNames.includes(f.prop));\n return this.filterStart();\n }\n\n /** Updates a row model at a given index\n * @param row - the row to update.\n * @param rowIndex - the row index to insert this row\n */\n @Method()\n async updateRow(row: TableTypes.RowData, rowIndex: number) {\n (this.rows as TableTypes.NanoTable['rows']).splice(rowIndex, 1, row);\n this.handleRowsChange();\n }\n\n // TODO.\n // change this.rows to be a Map instead?\n // this will allow 'padding' < inserting row data at a non-adjacent index\n\n // /**\n // * During pagination or infinite scroll\n // * you may not always want to load data in serial order.\n // * This method allows you to insert a block of results at a particular index.\n // * Use in-conjunction with `virtualTotalItems`\n // * @param blockIndex - where to insert\n // * @param rows - what to insert\n // */\n // @Method()\n // async insertBlock(blockIndex: number, rows: TableTypes.NanoTable['rows']) {\n // this.pauseAutoBlockAssign = true;\n // const cRows = (this.rows as TableTypes.NanoTable['rows']);\n\n // if (cRows.length < (blockIndex * this.perBlock)) {\n // (this.rows as TableTypes.NanoTable['rows'])\n // }\n\n // (this.rows as TableTypes.NanoTable['rows']).splice((blockIndex * this.perBlock)-1, 0, ...rows);\n\n // console.log(this.rows)\n // debugger;\n\n // await this.handleRowsChange(this.rows);\n // this.blocks[blockIndex] = {rows, __uuid: cyrb53(rows.map((b) => b.__uuid).join())};\n // this.blocks = this.blocks;\n // this.pauseAutoBlockAssign = true;\n\n // console.log(this.rows, this.blocks)\n // }\n\n // Private State\n\n @Element() host: HTMLNanoTableElement;\n private renderId = 'tbl-' + id++;\n private store: TableStores;\n private filters: TableTypes.Filter[] = [];\n private currentFilters = '[]';\n private currentSort = '';\n private tableEle: HTMLTableElement;\n private topAnchorEle: HTMLElement;\n private tableWrapperEle: HTMLElement;\n private activeWatcherIo: IntersectionObserver;\n private tablePinnedService: TablePinService;\n\n // Block view management\n\n /** `tr` elements split into units - defined by `perBlock`\n These are show / hidden for perf */\n @State() blocks: TableTypes.TBody[] = [];\n @State() activeBlocks: number[] = [0, 1];\n\n private measureHeight = 0;\n private blockElements: HTMLTableSectionElement[];\n private blockHeights: { blockIndex: number; height: number }[] = [];\n\n // uses the first 'tr' of an active block as our yard stick\n private set measureEle(el: HTMLTableSectionElement) {\n if (!el) return;\n const potentialHeight = el.getBoundingClientRect().height;\n this.measureHeight =\n Math.abs(this.measureHeight - potentialHeight) < 5\n ? this.measureHeight\n : potentialHeight;\n this.unitHeight =\n el.querySelector('tr')?.getBoundingClientRect().height || this.unitHeight;\n }\n\n private unitHeight = 0;\n\n private get scrollParent() {\n return this._scrollParent;\n }\n\n private set scrollParent(ele: HTMLElement) {\n if (ele === this._scrollParent) return;\n\n if (this._scrollParent) {\n (this._scrollParent === document.documentElement\n ? document\n : this._scrollParent\n ).removeEventListener('scroll', this.scrollHandler);\n }\n (ele === document.documentElement ? document : ele).addEventListener(\n 'scroll',\n this.scrollHandler\n // {passive: true}\n );\n this._scrollParent = ele;\n }\n\n private _scrollParent: HTMLElement;\n\n // used to fire `nanoTblBlockRendered` on block render change\n private get primaryBlockIndex() {\n return this._primaryBlockIndex;\n }\n\n private set primaryBlockIndex(blockIndex) {\n if (this._primaryBlockIndex === blockIndex) return;\n\n this._primaryBlockIndex = blockIndex;\n\n // fire block change event\n this.nanoTblBlockRendered.emit({\n block: blockIndex,\n totalBlocks: this.blockElements.length,\n });\n }\n\n private _primaryBlockIndex;\n\n // Misc.\n\n private get isReady() {\n return this._isReady;\n }\n private set isReady(ready: boolean) {\n if (ready === this._isReady) return;\n this._isReady = ready;\n if (this.isReady) requestAnimationFrame(() => this.handleReady());\n }\n private _isReady = false;\n\n // Private Logic\n\n // Listeners\n\n private handleReady() {\n const hash = window.location.hash;\n if (hash.length > 1) {\n try {\n const idRow = document.querySelector(hash);\n if (idRow) idRow.scrollIntoView();\n } catch (e) {}\n }\n this.nanoTblReady.emit();\n }\n\n /**\n * Start a sort - can be cancelled by `preventDefault`\n * @param order - column order\n * @param column - column config object\n * @returns A promise\n */\n private sortStart = async (\n order: TableTypes.Order,\n column: TableTypes.Prop,\n element?: HTMLElement\n ) => {\n // did order change?\n if (this.currentSort === order + ':' + column) return;\n\n this._loading = true;\n const sortEvent = this.nanoTblBeforeSort.emit({ column: column, order });\n if (sortEvent.defaultPrevented) return;\n perMark('sort');\n this.currentSort = order + ':' + column;\n\n // doesn't make sense to leave user in place for a sort\n this.scrollToTop(element);\n\n if (this.customSortFn) {\n try {\n const res = await this.customSortFn(column, order);\n\n // if the response is 'true', the custom sort did it's thing\n // handover to finish and stop loading state.\n // if response is falsey, carry on to do a FE sort\n if (res === true) {\n this.sortComplete(order, column);\n this._loading = false;\n return;\n }\n } catch (e) {\n // if response errored, stop loading state\n // clear current sort cache\n console.warn('custom sort failed', e);\n this.currentSort = '';\n this._loading = false;\n return;\n }\n }\n\n try {\n await storeSort(this.host, column, order);\n this.sortComplete(order, column);\n } catch (e) {\n console.warn('sort failed', e);\n this.currentSort = '';\n } finally {\n if (this.blocks.length) this._loading = false;\n }\n };\n\n /**\n * Complete a sort. Reflects the order to ui.\n * @param order - column order\n * @param column - column config object\n */\n private sortComplete(order: TableTypes.Order, column: TableTypes.Prop) {\n this.columns = this.columns.map((c) => {\n if (c.prop === column) return { ...c, order };\n return { ...c, order: null };\n });\n this.nanoTblAfterSort.emit({ column: column, order });\n perMark('sort', true);\n }\n\n private async searchStart() {\n this._loading = true;\n const sortEvent = this.nanoTblBeforeSearch.emit({ term: this.searchTerm });\n if (sortEvent.defaultPrevented) return;\n perMark('search');\n\n // doesn't make sense to leave user in place for a search\n this.scrollToTop();\n\n try {\n await storeSearch(this.host, this.searchTerm);\n this.nanoTblAfterSearch.emit({ term: this.searchTerm });\n perMark('search', true);\n } catch (e) {\n console.warn('search failed', e);\n } finally {\n this._loading = false;\n }\n }\n\n private async filterStart(\n filters?: TableTypes.Filter[],\n additive: boolean = true\n ) {\n if (filters) {\n if (additive) {\n this.filters = [\n ...this.filters.filter(\n (f) => !filters.find((ff) => ff.prop === f.prop)\n ),\n ...filters,\n ];\n } else {\n this.filters = filters;\n }\n }\n\n if (this.currentFilters === JSON.stringify(this.filters)) return;\n\n this._loading = true;\n const sortEvent = this.nanoTblBeforeFilter.emit({ filters: this.filters });\n if (sortEvent.defaultPrevented) return;\n perMark('filter');\n this.currentFilters = JSON.stringify(this.filters);\n\n // doesn't make sense to leave user in place for a search\n this.scrollToTop();\n\n if (this.customFilterFn) {\n try {\n const res = await this.customFilterFn(this.filters);\n\n // if the response is 'true', the custom filter did it's thing\n // handover to finish and stop loading state.\n // if response is falsy, carry on to do a FE filter\n if (res === true) {\n this.filterComplete();\n this._loading = false;\n return;\n }\n } catch (e) {\n // if response errored, stop loading state\n // clear current sort cache\n console.warn('custom filter failed', e);\n this.currentFilters = '';\n this._loading = false;\n return;\n }\n }\n\n try {\n await storeFilter(this.host, this.filters);\n this.filterComplete();\n } catch (e) {\n console.warn('filter failed', e);\n } finally {\n this._loading = false;\n }\n }\n\n private filterComplete() {\n this.columns = this.columns.map((c) => {\n const cFilter = this.filters.find((f) => f.prop === c.prop);\n // if we found a filter AND\n // it isn't true / false and has a length OR\n // it is true or false\n if (\n cFilter &&\n ((typeof cFilter.filter !== 'boolean' && cFilter.filter.length) ||\n typeof cFilter.filter === 'boolean')\n )\n c.filter = cFilter.filter;\n // if a filter value is not set OR\n // it isn't true / false and has no length\n else if (\n (c.filter !== null && c.filter !== undefined) ||\n (!!c.filter && typeof c.filter !== 'boolean' && !c.filter.length)\n )\n c.filter = undefined;\n\n return c;\n });\n this.nanoTblAfterFilter.emit({ filters: this.filters });\n perMark('filter', true);\n }\n\n /** Scrolls to the top immediately - used whilst sorting / filtering */\n private scrollToTop(element?: HTMLElement) {\n const scrollBehaviour = this.scrollParent.style?.scrollBehavior;\n const scrollX = this.scrollParent.scrollLeft;\n this.scrollParent.style.scrollBehavior = 'auto';\n\n if (this.topAnchorEle && !isInViewport(this.topAnchorEle, 0.1)) {\n this.host.scrollIntoView();\n }\n if (element && !isInViewport(element, 1))\n setTimeout(() => element.scrollIntoView({ block: 'start' }), 500);\n\n if (scrollX) this.scrollParent.scrollLeft = scrollX;\n\n if (scrollBehaviour)\n this.scrollParent.style.scrollBehavior = scrollBehaviour;\n\n this.scrollHandler();\n }\n\n private setMeasureElement(): Promise<void> {\n return new Promise((resolve) => {\n readTask(() => {\n this.measureEle = this.blockElements.find(\n (b) => !b?.classList?.contains(`${CSSNAMESPACE}__inactive`)\n );\n resolve();\n });\n });\n }\n\n /**\n * Makes sure we have dimensions on at least one, active tbody element.\n * We'll use this is a yard stick for inactive tbody elements in future.\n * These elements have no natural height (on account of all their rows being hidden)\n */\n private setInitialBlockDimension() {\n if (!this.blockElements?.length) return;\n perMark('blockDims');\n\n const testForDimensions = async () => {\n await this.setMeasureElement();\n if (this.unitHeight) return true;\n return false;\n };\n\n const dimensionsReady: Promise<void> = new Promise(async (resolve) => {\n if (await testForDimensions()) resolve();\n else {\n // it's likely this table is hidden in the dom.\n // we need to wait until it's visible\n const observer = new IntersectionObserver(\n async () => {\n if (await testForDimensions()) {\n resolve();\n observer.disconnect();\n }\n },\n { root: this.scrollParent }\n );\n observer.observe(this.tableEle);\n }\n });\n\n // we're all finished.\n dimensionsReady.then(() => {\n perMark('blockDims', true);\n perMark('init', true);\n requestAnimationFrame(() => (this.isReady = true));\n });\n }\n\n /** Apply initial columns settings */\n private async columnInit() {\n this.filters = (this.columns as TableTypes.NanoTable['columns'])\n .filter((c) => c.filter !== undefined && c.filter !== null)\n .map((c) => {\n const { filter, prop } = c;\n return { filter, prop };\n });\n\n if (this.searchTerm) {\n await this.searchStart();\n }\n\n if (this.filters.length) {\n await this.filterStart();\n }\n // apply sort\n const col = (this.columns as TableTypes.NanoTable['columns']).find(\n (c) => !!c.order\n );\n if (!!col) {\n await this.sortStart(col.order, col.prop);\n }\n if (this.tablePinnedService) this.tablePinnedService.assessCols();\n }\n\n /** Split up all incoming rows into 'blocks' split amongst tbody elements.\n * These can then be hidden / shown to improve performance.\n */\n private setBlocks() {\n const dRows = this.store.data.state.rows;\n if (!dRows.length) {\n this.blocks = [];\n return;\n }\n\n perMark('setBlocks');\n // this.ignoreIO = true;\n let i = 1;\n const l =\n this.virtualTotalItems > dRows.length\n ? this.virtualTotalItems\n : dRows.length;\n let rows: TableTypes.RowData[] = [];\n const blocks: TableTypes.TBody[] = [];\n\n // old skool loop for perf\n for (i; i <= l; i++) {\n rows.push(this.store.data.state.rows[i - 1] || { __uuid: '' });\n\n if (i % this.perBlock === 0) {\n // assign a UUID for the whole block\n // for block diffing\n blocks.push({ rows, __uuid: cyrb53(rows.map((b) => b.__uuid).join()) });\n rows = [];\n }\n }\n\n // any leftover rows\n if (rows.length) {\n blocks.push({ rows, __uuid: cyrb53(rows.map((b) => b.__uuid).join()) });\n }\n\n this.blocks = blocks;\n perMark('setBlocks', true);\n }\n\n /**\n * Returns a block render height.\n * If it's currently active - let auto do it's thing\n * If we've rendered it before - return that\n * If all else fails, let's guess it\n * @param blockIndex\n * @returns a height string (incl px)\n */\n private getBlockHeight(blockIndex: number): number {\n if (this.blockHeights.length) {\n const cachedBlockHeight = this.blockHeights.find(\n (bh) => bh.blockIndex === blockIndex\n );\n if (cachedBlockHeight && cachedBlockHeight.height)\n return cachedBlockHeight.height;\n }\n const blockLength = this.blocks[blockIndex].rows.length;\n if (blockLength === this.perBlock && this.measureHeight) {\n return this.measureHeight;\n }\n return this.unitHeight ? this.unitHeight * blockLength : 100;\n }\n\n /** cache the height for all active blocks for later renders */\n private setBlockHeight() {\n this.activeBlocks.forEach((blockIndex) => {\n const el = this.blockElements[blockIndex];\n if (!el) return;\n\n readTask(() => {\n if (el.classList.contains(`${CSSNAMESPACE}__inactive`)) return;\n\n const height = el.getBoundingClientRect().height;\n // cache height to our block heights array\n // for subsequent renders\n const fBhIdx = this.blockHeights.findIndex(\n (bh) => bh.blockIndex === blockIndex\n );\n if (fBhIdx > -1) {\n this.blockHeights[fBhIdx] = { height, blockIndex };\n } else this.blockHeights.push({ height, blockIndex });\n });\n });\n }\n\n /**\n * On scroll, loop through all blocks' heights and cumulatively, add them together.\n * When we find that the scroll position is less than this cumulative block height -\n * stop loop - it's on the current active block.\n */\n private scrollHandler = () => {\n let scrollPos: number = 0;\n\n perMark('scrollHandler');\n // don't listen if this table isn't in the viewport\n if (!this.store?.general.state.isActive || !this.rows) return;\n if (this.primaryBlockIndex === undefined) this.primaryBlockIndex = 0;\n\n readTask(() => {\n scrollPos =\n typeof this.scrollParent.scrollTop !== 'undefined'\n ? this.scrollParent.scrollTop\n : window.scrollY;\n scrollPos += this.host.offsetTop;\n\n if (this.tablePinnedService) {\n this.tablePinnedService.onScroll({\n x:\n typeof this.scrollParent.scrollLeft !== 'undefined'\n ? this.scrollParent.scrollLeft\n : window.scrollX,\n y: scrollPos,\n });\n }\n\n let cumulativeHeight = this.host.offsetTop;\n let blockIndex = 0;\n const blockLen = this.blocks.length;\n\n while (blockIndex < blockLen && scrollPos >= cumulativeHeight) {\n cumulativeHeight += this.getBlockHeight(blockIndex);\n\n if (scrollPos < cumulativeHeight) {\n const potentialBlocks = [\n blockIndex,\n blockIndex + 1,\n // Math.max(0, blockIndex - 1),\n ];\n if (potentialBlocks.toString() !== this.activeBlocks.toString()) {\n this.activeBlocks = potentialBlocks;\n }\n this.primaryBlockIndex = blockIndex;\n }\n blockIndex++;\n }\n perMark('scrollHandler', true);\n });\n };\n\n /** Process slotted content */\n private processSlots() {\n // see if we have slot content\n if (!this.caption && !this.host.querySelector('[slot=\"caption\"]')) {\n console.error(\n 'For accessibility you must set a `caption` prop or use the `caption` slot'\n );\n }\n }\n\n private handleResizeChange = (\n e: NanoResizeObserveCustomEvent<ResizeStateChangeEventDetail>\n ) => {\n this.tableWrapperEle.className = '';\n\n let classes: string[] = [`${CSSNAMESPACE}__wrap`];\n if (e.target?.className)\n classes = [...e.target.className.split(' '), ...classes];\n\n this.tableWrapperEle.classList.add(...classes.filter((cl) => !!cl));\n };\n\n /** Adds an IO. Makes sure our scroll listener is only active when\n * the table is in viewport */\n private setupActiveWatcher() {\n if (!this.host || !this.scrollParent || !this.store) return;\n\n if (this.activeWatcherIo) {\n this.activeWatcherIo.disconnect();\n this.activeWatcherIo = undefined;\n }\n const io = (this.activeWatcherIo = new IntersectionObserver(\n async ([e]) => {\n if (e.isIntersecting) this.store.general.state.isActive = true;\n else this.store.general.state.isActive = false;\n },\n { root: this.scrollParent, threshold: 0 }\n ));\n io.observe(this.host);\n }\n\n // Component lifecycle\n\n async componentWillLoad() {\n perMark('init');\n // setup stores\n this.store = await generateStore(\n this.host,\n this.columns,\n this.scrollParent,\n this.isReady\n );\n await this.handleRowsChange();\n this.store.general.onChange('isActive', () => {\n this.scrollHandler();\n });\n this.store.data.onChange('rows', () => this.setBlocks());\n\n // setup dom and attach listeners\n this.processSlots();\n this.setBlocks();\n this.scrollParent = findScrollParent(this.host);\n this.setupActiveWatcher();\n }\n\n connectedCallback(): void {\n this.scrollParent = findScrollParent(this.host);\n this.setupActiveWatcher();\n }\n\n componentDidLoad(): void {\n this.setInitialBlockDimension();\n if (!this.tablePinnedService) {\n this.tablePinnedService = new TablePinService(\n this.tableEle,\n this.scrollParent\n );\n }\n }\n\n componentShouldUpdate(_newVal, _oldVal, stateName: keyof Table) {\n // stop double rendering - we use the store for rendering internally\n // the public facing props are kept in-sync with the store\n // but we don't want it to cause renders\n if (['rows', 'columns'].includes(stateName)) return false;\n\n if (measurePerf) console.info(stateName, _newVal, _oldVal);\n }\n\n componentWillRender(): void | Promise<void> {\n perMark('render');\n }\n\n componentDidRender(): void {\n this.setMeasureElement().then(() => this.setBlockHeight());\n perMark('render', true);\n }\n\n disconnectedCallback(): void {\n if (!this.activeWatcherIo) return;\n this.activeWatcherIo.disconnect();\n this.activeWatcherIo = undefined;\n\n (this.scrollParent === document.documentElement\n ? document\n : this.scrollParent\n ).removeEventListener('scroll', this.scrollHandler);\n }\n\n render() {\n this.blockElements = [];\n\n return (\n <Host>\n <div\n class={`${CSSNAMESPACE}__top-anchor`}\n ref={(a) => (this.topAnchorEle = a)}\n >\n \n </div>\n\n <nano-resize-observe\n states=\"576w sm, 768w md\"\n class=\"sm md\"\n onNanoResizeStateChange={this.handleResizeChange}\n onNanoResize={() => {\n if (this.tablePinnedService) this.tablePinnedService.onResize();\n }}\n ></nano-resize-observe>\n\n <div\n class={`${CSSNAMESPACE}__wrap sm md`}\n ref={(div) => (this.tableWrapperEle = div)}\n aria-labelledby={'nano-table-caption-' + this.renderId}\n tabindex={this.type === 'grid' ? '0' : undefined}\n >\n <nano-progress-bar\n indeterminate\n class={{\n [`${CSSNAMESPACE}__progress-bar`]: true,\n [`${CSSNAMESPACE}__progress-bar--show`]: this._loading,\n }}\n />\n <table\n role={this.type === 'grid' ? 'grid' : undefined}\n aria-rowcount={this.store.data.state.rows.length}\n aria-colcount={this.store.config.state.columns.length}\n class={`${CSSNAMESPACE}`}\n ref={(tbl) => (this.tableEle = tbl)}\n id={'nano-table-' + this.renderId}\n >\n <caption\n class={{\n [`${CSSNAMESPACE}__caption`]: true,\n [`${CSSNAMESPACE}__caption--hide`]: !this.showCaption,\n }}\n id={'nano-table-caption-' + this.renderId}\n >\n <slot name=\"caption\">{this.caption}</slot>\n </caption>\n\n {/* Header */}\n <thead>\n <TableHeadFootRow rowRenderer={this.headRender}>\n {this.store.config.state.columns.map((colModel) => [\n <TableColHead\n column={colModel}\n headRenderer={this.headRender}\n onColumnSortClick={this.sortStart}\n defaults={{\n sortable: this.defaultSort,\n }}\n />,\n ])}\n </TableHeadFootRow>\n </thead>\n\n {this._loading && !this.blocks.length && (\n <tbody class={`${CSSNAMESPACE}__active ${CSSNAMESPACE}__loading`}>\n {[...Array(10).keys()].map((rowIndex) => (\n <tr>\n {this.store.config.state.columns.map(\n (_colModel, colIndex) => (\n <TableCell\n rowIndex={rowIndex}\n colIndex={colIndex}\n nestedContent={() => <nano-skeleton />}\n />\n )\n )}\n </tr>\n ))}\n </tbody>\n )}\n\n <tr hidden={!!this._loading || !!this.blocks.length}>\n <th\n class={`${CSSNAMESPACE}__th`}\n colSpan={this.store.config.state.columns.length}\n >\n <div class=\"nano-tbl__cell-content nano-tbl__cell-content--no-result\">\n <slot name=\"no-results\">No results found</slot>\n </div>\n </th>\n </tr>\n\n {/* Body */}\n {this.blocks.map((block, blockIndex) => (\n <tbody\n key={block.__uuid}\n id={`tbody-${this.renderId}-${blockIndex}`}\n ref={(tb) => {\n this.blockElements.push(tb);\n }}\n class={{\n [`${CSSNAMESPACE}__inactive`]:\n !this.activeBlocks.includes(blockIndex),\n [`${CSSNAMESPACE}__active`]:\n this.activeBlocks.includes(blockIndex),\n }}\n >\n {this.activeBlocks.includes(blockIndex) ? (\n block.rows.map((row, i) => {\n const rowIndex =\n blockIndex > 0 ? blockIndex * this.perBlock + i : i;\n return (\n <TableRow\n rowRenderer={this.rowRender}\n rowModel={row}\n rowIndex={rowIndex}\n >\n {this.store.config.state.columns.map(\n (_colModel, colIndex) => (\n <TableCell\n rowIndex={rowIndex}\n colIndex={colIndex}\n />\n )\n )}\n </TableRow>\n );\n })\n ) : (\n <tr class={`${CSSNAMESPACE}__tr--placeholder`}>\n <td\n colSpan={this.store.config.state.columns.length}\n style={{\n height: this.getBlockHeight(blockIndex) + 'px',\n }}\n />\n </tr>\n )}\n </tbody>\n ))}\n\n {/* Footer */}\n {this.showFooter && (\n <tfoot>\n <TableHeadFootRow rowRenderer={this.footRender}>\n {this.store.config.state.columns.map((colModel) => [\n <TableColHead\n column={colModel}\n headRenderer={this.footRender}\n onColumnSortClick={this.sortStart}\n defaults={{\n sortable: this.defaultSort,\n }}\n />,\n ])}\n </TableHeadFootRow>\n </tfoot>\n )}\n </table>\n\n {!!this.blocks.length && (\n <nano-spinner\n type=\"circle\"\n class={{\n [`${CSSNAMESPACE}__spinner`]: true,\n [`${CSSNAMESPACE}__spinner--show`]: this._loading,\n }}\n />\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../../src/components/table/table.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,CAAC,EAED,OAAO,EACP,IAAI,EACJ,KAAK,EACL,KAAK,EACL,QAAQ,EACR,KAAK,EAEL,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAGL,UAAU,GACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EA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G,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Prop,\n h,\n ComponentInterface,\n Element,\n Host,\n Watch,\n State,\n readTask,\n Event,\n EventEmitter,\n Method,\n} from '@stencil/core';\nimport { cyrb53 } from '../../utils/math';\nimport { debounce } from '../../utils/throttle';\nimport {\n NanoResizeObserveCustomEvent,\n ResizeStateChangeEventDetail,\n TableTypes,\n} from '../../interface';\nimport { findScrollParent } from '../../utils/scroll-parent';\nimport { TableColHead } from './table.header';\nimport { TableRow, TableHeadFootRow } from './table.row';\nimport { TableCell } from './table.cell';\nimport { CSSNAMESPACE } from './table.constants';\nimport {\n generateStore,\n storeSearch,\n storeSetConfig,\n storeSetData,\n storeSort,\n storeFilter,\n TableStores,\n} from './table.store';\nimport { isInViewport } from './table.utils';\nimport { TablePinService } from './table.pin-service';\n\nconst measurePerf = false;\n\nfunction perMark(name: string, end: boolean = false) {\n if (!performance || !measurePerf) return;\n if (end) {\n performance?.mark('end' + name);\n performance?.measure(name, 'start' + name, 'end' + name);\n const entries = performance?.getEntriesByName(name);\n console.info(entries[entries.length ? entries.length - 1 : 0]);\n } else {\n performance?.mark('start' + name);\n }\n}\n\nlet id = 0;\n/**\n * A performant, accessible and semantic (uses real html `<table />`, `<tr />` etc) table and data-grid solution.\n *\n *- Built-in search\n *- Built-in column filter\n *- Built-in column sort\n *- Easily swap in API / async based search / filter & sort\n *- Pin headers, footers, rows, columns\n *- Add custom rendering at every level\n *- Add custom properties at every level\n *\n * @slot caption - The table's caption. You must either use this or the `caption` attribute.\n * @slot no-results - text to display when search or filtering yields no results\n */\n@Component({\n tag: 'nano-table',\n styleUrl: 'table.scss',\n})\nexport class Table implements ComponentInterface {\n constructor() {\n this.debounceSetLoading = debounce(this.debounceSetLoading.bind(this), 50);\n }\n // Public API\n\n // Props\n\n /** Function called whenever `col.cellTemplate` renders an unknown object.\n * The function should render a valid HTMLElement to the cell arg.\n * Example usage - render JSX from a 3rd party lib and append the result to the cell element. */\n @Prop() customRenderer: (\n node: any,\n cell: HTMLElement\n ) => void | Promise<string>;\n\n /** The type of table. Grid type will make cells navigable by keyboard */\n @Prop() type: 'grid' | 'table' = 'table';\n\n /** A descriptive title of the table.\n * You must use this or the `slot=\"caption\"` for accessibility */\n @Prop() caption: string;\n\n /** Show the caption on-screen */\n @Prop() showCaption: boolean = false;\n\n /** Will show a loading state when set to true.\n * By default, will be shown automatically if `rows` is a promise waiting to resolve / or falsy\n * *or* when performing custom filtering or sorting.\n * *Note* when set manually, will overwrite any internal loading state.\n * Set to 'undefined' to revert to default behaviour. */\n @Prop() loading: boolean = undefined;\n\n get _loading() {\n return this.loading !== undefined ? this.loading : this.internalLoading;\n }\n set _loading(l: boolean) {\n if (this.loading !== undefined) return;\n this.debounceSetLoading(l);\n }\n private debounceSetLoading(l: boolean) {\n this.internalLoading = l;\n }\n @State() internalLoading = true;\n\n /** When loading rows asynchronously, this will render this number of placeholder rows */\n @Prop() placeholderSize = 5;\n\n /** The data to place in the table */\n @Prop({ mutable: true }) rows:\n | TableTypes.NanoTable['rows']\n | Promise<TableTypes.NanoTable['rows']>;\n\n @Watch('rows')\n handleRowsChange() {\n if (!this.rows) {\n this._loading = true;\n return;\n }\n\n this._loading = true;\n Promise.resolve(this.rows).then(async (rows) => {\n await storeSetData(this.host, rows);\n\n // reset everything\n this.currentFilters = '';\n this.currentSort = '';\n await this.columnInit();\n\n if (!this.isReady)\n requestAnimationFrame(() => this.setInitialBlockDimension());\n this._loading = false;\n if (this.tablePinnedService) this.tablePinnedService.assessRows();\n });\n }\n\n /** The column config used to present the rows of data */\n @Prop({ mutable: true }) columns: TableTypes.NanoTable<any>['columns'] = [];\n\n @Watch('columns')\n async handleColsChange() {\n await storeSetConfig(this.host, this.columns);\n if (this.isReady) this.columnInit();\n }\n\n /** Used for custom thead row rendering */\n @Prop() headRender: TableTypes.HeadFootRenderer = { pinned: 'top' };\n\n /** Used for custom row rendering */\n @Prop() rowRender: TableTypes.RowRenderer;\n\n /** Used for custom tfoot row rendering */\n @Prop() footRender: TableTypes.HeadFootRenderer = { pinned: 'bottom' };\n\n /** Whether to show a `<tfoot>` component */\n @Prop() showFooter = false;\n\n /** To improve performance, data is split into blocks\n * which are shown / hidden and rendered as they become visible.\n * Use this to control the number of hits within a block -\n * A block should fill a scrolling viewport.\n * The less perBlock the better for performance */\n @Prop() perBlock = 50;\n\n /** The number of total blocks currently rendered in the table. @readonly */\n @Prop()\n get blocksLength() {\n return this.blocks.length;\n }\n\n /** Term to search for in the data */\n @Prop() searchTerm: string;\n\n /** A custom filtering function. Should return a promise.\n * If the promise resolves as `true` the column UI will be updated.\n * If the promise resolves as falsy, the sort will be performed by the component.\n * A good use-case would be performing the filter on a server / via fetch.\n * Then on success, updating the table's data via the `rows` property */\n @Prop() customFilterFn?: (\n filters: TableTypes.Filter[]\n ) => Promise<true | TableTypes.Falsy>;\n\n /** A custom sorting function. Should return a promise.\n * If the promise resolves as `true` the column UI will be updated.\n * If the promise resolves as falsey, the sort will be performed by the component.\n * A good use-case would be performing the sort on a server / via fetch.\n * Then on success, updating the table's data via the `rows` property */\n @Prop() customSortFn?: (\n property: TableTypes.Prop,\n order: TableTypes.Order\n ) => Promise<true | TableTypes.Falsy>;\n\n /**\n * The default sortable option for all columns.\n * `true` will enable column sorting unless you set `sortable: false` on a column\n * `false` will disable column sorting unless you set `sortable: true` on a column\n */\n @Prop() defaultSort = true;\n\n @Watch('searchTerm')\n handleSearchTermChange() {\n this.searchStart();\n }\n\n /** Use this to render the table with roughly the correct dimensions.\n * a use-case might be; fetch a small initial dataset to minimise load-time,\n * render the table with the correct dimensions, the table becomes interactive,\n * load the rest of the data\n */\n @Prop() virtualTotalItems: number = 0;\n\n @Watch('virtualTotalItems')\n virtualTotalItemsChangeHandler() {\n this.setBlocks();\n }\n\n /** @readonly - shows the currently applied filters */\n @Prop()\n get appliedFilters() {\n return this.filters;\n }\n\n /** Fired when the table has done it's first complete render */\n @Event() nanoTblReady: EventEmitter;\n\n /** Fired whenever a block is activated by scrolling into view / becoming visible\n * This could be leveraged for infinite scrolling / to fetch more data.\n */\n @Event() nanoTblBlockRendered: EventEmitter<{\n block: number;\n totalBlocks: number;\n }>;\n\n /** Fired before a column is sorted.\n * `event.preventDefault()` to stop sorting. */\n @Event() nanoTblBeforeSort: EventEmitter<{\n column: TableTypes.Prop;\n order: TableTypes.Order;\n }>;\n\n /** Fired after a column is sorted */\n @Event() nanoTblAfterSort: EventEmitter<{\n column: TableTypes.Prop;\n order: TableTypes.Order;\n }>;\n\n /** Fired before a column is filtered.\n * `event.preventDefault()` to stop filtering. */\n @Event() nanoTblBeforeFilter: EventEmitter<{ filters: TableTypes.Filter[] }>;\n\n /** Fired after a column is sorted */\n @Event() nanoTblAfterFilter: EventEmitter<{ filters: TableTypes.Filter[] }>;\n\n /** Fired before a general search.\n * `event.preventDefault()` to stop searching. */\n @Event() nanoTblBeforeSearch: EventEmitter<{ term: string }>;\n\n /** Fired after a general / cross column search */\n @Event() nanoTblAfterSearch: EventEmitter<{ term: string }>;\n\n /** Fired before a general search.\n * `event.preventDefault()` to stop searching. */\n @Event() nanoTblBeforeEdit: EventEmitter<{ term: string }>;\n\n /** Remove any column sorts currently applied\n * @returns a promise which resolves when complete */\n @Method()\n async resetSorting() {\n const col = (this.columns as TableTypes.NanoTable['columns']).find(\n (c) => !!c.order\n );\n if (!col) return;\n return this.sortStart(null, col.prop);\n }\n\n /** Apply a sort on a column\n * @returns a promise which resolves when complete */\n @Method()\n async addSort(column: TableTypes.Prop, order: TableTypes.Order) {\n const col = (this.columns as TableTypes.NanoTable['columns']).find(\n (c) => c.prop === column\n );\n if (!col) throw 'Cannot find column with ' + column;\n return this.sortStart(order, col.prop);\n }\n\n /** Remove any column filters currently applied\n * @returns a promise which resolves when complete */\n @Method()\n async resetFilters() {\n this.filters = [];\n return this.filterStart();\n }\n\n /** Apply a filter on a column\n * @param filters - the filters to apply\n * @param additive - if true, will add the filters to any currently applied\n * @returns a promise which resolves when complete\n */\n @Method()\n async addFilters(filters: TableTypes.Filter[], additive: boolean = true) {\n if (!additive) this.filters = [];\n return this.filterStart(filters, additive);\n }\n\n /** Remove filters from a column\n * @param columnNames - the filters to apply\n * @returns a promise which resolves when complete\n */\n @Method()\n async removeFilters(columnNames: TableTypes.Prop[]) {\n this.filters = this.filters.filter((f) => !columnNames.includes(f.prop));\n return this.filterStart();\n }\n\n /** Updates a row model at a given index\n * @param row - the row to update.\n * @param rowIndex - the row index to insert this row\n */\n @Method()\n async updateRow(row: TableTypes.RowData, rowIndex: number) {\n (this.rows as TableTypes.NanoTable['rows']).splice(rowIndex, 1, row);\n this.handleRowsChange();\n }\n\n // TODO.\n // change this.rows to be a Map instead?\n // this will allow 'padding' < inserting row data at a non-adjacent index\n\n // /**\n // * During pagination or infinite scroll\n // * you may not always want to load data in serial order.\n // * This method allows you to insert a block of results at a particular index.\n // * Use in-conjunction with `virtualTotalItems`\n // * @param blockIndex - where to insert\n // * @param rows - what to insert\n // */\n // @Method()\n // async insertBlock(blockIndex: number, rows: TableTypes.NanoTable['rows']) {\n // this.pauseAutoBlockAssign = true;\n // const cRows = (this.rows as TableTypes.NanoTable['rows']);\n\n // if (cRows.length < (blockIndex * this.perBlock)) {\n // (this.rows as TableTypes.NanoTable['rows'])\n // }\n\n // (this.rows as TableTypes.NanoTable['rows']).splice((blockIndex * this.perBlock)-1, 0, ...rows);\n\n // console.log(this.rows)\n // debugger;\n\n // await this.handleRowsChange(this.rows);\n // this.blocks[blockIndex] = {rows, __uuid: cyrb53(rows.map((b) => b.__uuid).join())};\n // this.blocks = this.blocks;\n // this.pauseAutoBlockAssign = true;\n\n // console.log(this.rows, this.blocks)\n // }\n\n // Private State\n\n @Element() host: HTMLNanoTableElement;\n private renderId = 'tbl-' + id++;\n private store: TableStores;\n private filters: TableTypes.Filter[] = [];\n private currentFilters = '[]';\n private currentSort = '';\n private tableEle: HTMLTableElement;\n private topAnchorEle: HTMLElement;\n private tableWrapperEle: HTMLElement;\n private activeWatcherIo: IntersectionObserver;\n private tablePinnedService: TablePinService;\n\n // Block view management\n\n /** `tr` elements split into units - defined by `perBlock`\n These are show / hidden for perf */\n @State() blocks: TableTypes.TBody[] = [];\n @State() activeBlocks: number[] = [0, 1];\n\n private measureHeight = 0;\n private blockElements: HTMLTableSectionElement[];\n private blockHeights: { blockIndex: number; height: number }[] = [];\n\n // uses the first 'tr' of an active block as our yard stick\n private set measureEle(el: HTMLTableSectionElement) {\n if (!el) return;\n const potentialHeight = el.getBoundingClientRect().height;\n this.measureHeight =\n Math.abs(this.measureHeight - potentialHeight) < 5\n ? this.measureHeight\n : potentialHeight;\n this.unitHeight =\n el.querySelector('tr')?.getBoundingClientRect().height || this.unitHeight;\n }\n\n private unitHeight = 0;\n\n private get scrollParent() {\n return this._scrollParent;\n }\n\n private set scrollParent(ele: HTMLElement) {\n if (ele === this._scrollParent) return;\n\n if (this._scrollParent) {\n (this._scrollParent === document.documentElement\n ? document\n : this._scrollParent\n ).removeEventListener('scroll', this.scrollHandler);\n }\n (ele === document.documentElement ? document : ele).addEventListener(\n 'scroll',\n this.scrollHandler\n // {passive: true}\n );\n this._scrollParent = ele;\n }\n\n private _scrollParent: HTMLElement;\n\n // used to fire `nanoTblBlockRendered` on block render change\n private get primaryBlockIndex() {\n return this._primaryBlockIndex;\n }\n\n private set primaryBlockIndex(blockIndex) {\n if (this._primaryBlockIndex === blockIndex) return;\n\n this._primaryBlockIndex = blockIndex;\n\n // fire block change event\n this.nanoTblBlockRendered.emit({\n block: blockIndex,\n totalBlocks: this.blockElements.length,\n });\n }\n\n private _primaryBlockIndex;\n\n // Misc.\n\n private get isReady() {\n return this._isReady;\n }\n private set isReady(ready: boolean) {\n if (ready === this._isReady) return;\n this._isReady = ready;\n if (this.isReady) requestAnimationFrame(() => this.handleReady());\n }\n private _isReady = false;\n\n // Private Logic\n\n // Listeners\n\n private handleReady() {\n const hash = window.location.hash;\n if (hash.length > 1) {\n try {\n const idRow = document.querySelector(hash);\n if (idRow) idRow.scrollIntoView();\n } catch (e) {}\n }\n this.nanoTblReady.emit();\n }\n\n /**\n * Start a sort - can be cancelled by `preventDefault`\n * @param order - column order\n * @param column - column config object\n * @returns A promise\n */\n private sortStart = async (\n order: TableTypes.Order,\n column: TableTypes.Prop,\n element?: HTMLElement\n ) => {\n // did order change?\n if (this.currentSort === order + ':' + column) return;\n\n this._loading = true;\n const sortEvent = this.nanoTblBeforeSort.emit({ column: column, order });\n if (sortEvent.defaultPrevented) return;\n perMark('sort');\n this.currentSort = order + ':' + column;\n\n // doesn't make sense to leave user in place for a sort\n this.scrollToTop(element);\n\n if (this.customSortFn) {\n try {\n const res = await this.customSortFn(column, order);\n\n // if the response is 'true', the custom sort did it's thing\n // handover to finish and stop loading state.\n // if response is falsey, carry on to do a FE sort\n if (res === true) {\n this.sortComplete(order, column);\n this._loading = false;\n return;\n }\n } catch (e) {\n // if response errored, stop loading state\n // clear current sort cache\n console.warn('custom sort failed', e);\n this.currentSort = '';\n this._loading = false;\n return;\n }\n }\n\n try {\n await storeSort(this.host, column, order);\n this.sortComplete(order, column);\n } catch (e) {\n console.warn('sort failed', e);\n this.currentSort = '';\n } finally {\n if (this.blocks.length) this._loading = false;\n }\n };\n\n /**\n * Complete a sort. Reflects the order to ui.\n * @param order - column order\n * @param column - column config object\n */\n private sortComplete(order: TableTypes.Order, column: TableTypes.Prop) {\n this.columns = this.columns.map((c) => {\n if (c.prop === column) return { ...c, order };\n return { ...c, order: null };\n });\n this.nanoTblAfterSort.emit({ column: column, order });\n perMark('sort', true);\n }\n\n private async searchStart() {\n this._loading = true;\n const sortEvent = this.nanoTblBeforeSearch.emit({ term: this.searchTerm });\n if (sortEvent.defaultPrevented) return;\n perMark('search');\n\n // doesn't make sense to leave user in place for a search\n this.scrollToTop();\n\n try {\n await storeSearch(this.host, this.searchTerm);\n this.nanoTblAfterSearch.emit({ term: this.searchTerm });\n perMark('search', true);\n } catch (e) {\n console.warn('search failed', e);\n } finally {\n this._loading = false;\n }\n }\n\n private async filterStart(\n filters?: TableTypes.Filter[],\n additive: boolean = true\n ) {\n if (filters) {\n if (additive) {\n this.filters = [\n ...this.filters.filter(\n (f) => !filters.find((ff) => ff.prop === f.prop)\n ),\n ...filters,\n ];\n } else {\n this.filters = filters;\n }\n }\n\n if (this.currentFilters === JSON.stringify(this.filters)) return;\n\n this._loading = true;\n const sortEvent = this.nanoTblBeforeFilter.emit({ filters: this.filters });\n if (sortEvent.defaultPrevented) return;\n perMark('filter');\n this.currentFilters = JSON.stringify(this.filters);\n\n // doesn't make sense to leave user in place for a search\n this.scrollToTop();\n\n if (this.customFilterFn) {\n try {\n const res = await this.customFilterFn(this.filters);\n\n // if the response is 'true', the custom filter did it's thing\n // handover to finish and stop loading state.\n // if response is falsy, carry on to do a FE filter\n if (res === true) {\n this.filterComplete();\n this._loading = false;\n return;\n }\n } catch (e) {\n // if response errored, stop loading state\n // clear current sort cache\n console.warn('custom filter failed', e);\n this.currentFilters = '';\n this._loading = false;\n return;\n }\n }\n\n try {\n await storeFilter(this.host, this.filters);\n this.filterComplete();\n } catch (e) {\n console.warn('filter failed', e);\n } finally {\n this._loading = false;\n }\n }\n\n private filterComplete() {\n this.columns = this.columns.map((c) => {\n const cFilter = this.filters.find((f) => f.prop === c.prop);\n // if we found a filter AND\n // it isn't true / false and has a length OR\n // it is true or false\n if (\n cFilter &&\n ((typeof cFilter.filter !== 'boolean' && cFilter.filter.length) ||\n typeof cFilter.filter === 'boolean')\n )\n c.filter = cFilter.filter;\n // if a filter value is not set OR\n // it isn't true / false and has no length\n else if (\n (c.filter !== null && c.filter !== undefined) ||\n (!!c.filter && typeof c.filter !== 'boolean' && !c.filter.length)\n )\n c.filter = undefined;\n\n return c;\n });\n this.nanoTblAfterFilter.emit({ filters: this.filters });\n perMark('filter', true);\n }\n\n /** Scrolls to the top immediately - used whilst sorting / filtering */\n private scrollToTop(element?: HTMLElement) {\n const scrollBehaviour = this.scrollParent.style?.scrollBehavior;\n const scrollX = this.scrollParent.scrollLeft;\n this.scrollParent.style.scrollBehavior = 'auto';\n\n if (this.topAnchorEle && !isInViewport(this.topAnchorEle, 0.1)) {\n this.host.scrollIntoView();\n }\n if (element && !isInViewport(element, 1))\n setTimeout(() => element.scrollIntoView({ block: 'start' }), 500);\n\n if (scrollX) this.scrollParent.scrollLeft = scrollX;\n\n if (scrollBehaviour)\n this.scrollParent.style.scrollBehavior = scrollBehaviour;\n\n this.scrollHandler();\n }\n\n private setMeasureElement(): Promise<void> {\n return new Promise((resolve) => {\n readTask(() => {\n this.measureEle = this.blockElements.find(\n (b) => !b?.classList?.contains(`${CSSNAMESPACE}__inactive`)\n );\n resolve();\n });\n });\n }\n\n /**\n * Makes sure we have dimensions on at least one, active tbody element.\n * We'll use this is a yard stick for inactive tbody elements in future.\n * These elements have no natural height (on account of all their rows being hidden)\n */\n private setInitialBlockDimension() {\n if (!this.blockElements?.length) return;\n perMark('blockDims');\n\n const testForDimensions = async () => {\n await this.setMeasureElement();\n if (this.unitHeight) return true;\n return false;\n };\n\n const dimensionsReady: Promise<void> = new Promise(async (resolve) => {\n if (await testForDimensions()) resolve();\n else {\n // it's likely this table is hidden in the dom.\n // we need to wait until it's visible\n const observer = new IntersectionObserver(\n async () => {\n if (await testForDimensions()) {\n resolve();\n observer.disconnect();\n }\n },\n { root: this.scrollParent }\n );\n observer.observe(this.tableEle);\n }\n });\n\n // we're all finished.\n dimensionsReady.then(() => {\n perMark('blockDims', true);\n perMark('init', true);\n requestAnimationFrame(() => (this.isReady = true));\n });\n }\n\n /** Apply initial columns settings */\n private async columnInit() {\n this.filters = (this.columns as TableTypes.NanoTable['columns'])\n .filter((c) => c.filter !== undefined && c.filter !== null)\n .map((c) => {\n const { filter, prop } = c;\n return { filter, prop };\n });\n\n if (this.searchTerm) {\n await this.searchStart();\n }\n\n if (this.filters.length) {\n await this.filterStart();\n }\n // apply sort\n const col = (this.columns as TableTypes.NanoTable['columns']).find(\n (c) => !!c.order\n );\n if (!!col) {\n await this.sortStart(col.order, col.prop);\n }\n if (this.tablePinnedService) this.tablePinnedService.assessCols();\n }\n\n /** Split up all incoming rows into 'blocks' split amongst tbody elements.\n * These can then be hidden / shown to improve performance.\n */\n private setBlocks() {\n const dRows = this.store.data.state.rows;\n if (!dRows.length) {\n this.blocks = [];\n return;\n }\n\n perMark('setBlocks');\n // this.ignoreIO = true;\n let i = 1;\n const l =\n this.virtualTotalItems > dRows.length\n ? this.virtualTotalItems\n : dRows.length;\n let rows: TableTypes.RowData[] = [];\n const blocks: TableTypes.TBody[] = [];\n\n // old skool loop for perf\n for (i; i <= l; i++) {\n rows.push(this.store.data.state.rows[i - 1] || { __uuid: '' });\n\n if (i % this.perBlock === 0) {\n // assign a UUID for the whole block\n // for block diffing\n blocks.push({ rows, __uuid: cyrb53(rows.map((b) => b.__uuid).join()) });\n rows = [];\n }\n }\n\n // any leftover rows\n if (rows.length) {\n blocks.push({ rows, __uuid: cyrb53(rows.map((b) => b.__uuid).join()) });\n }\n\n this.blocks = blocks;\n perMark('setBlocks', true);\n }\n\n /**\n * Returns a block render height.\n * If it's currently active - let auto do it's thing\n * If we've rendered it before - return that\n * If all else fails, let's guess it\n * @param blockIndex\n * @returns a height string (incl px)\n */\n private getBlockHeight(blockIndex: number): number {\n if (this.blockHeights.length) {\n const cachedBlockHeight = this.blockHeights.find(\n (bh) => bh.blockIndex === blockIndex\n );\n if (cachedBlockHeight && cachedBlockHeight.height)\n return cachedBlockHeight.height;\n }\n const blockLength = this.blocks[blockIndex].rows.length;\n if (blockLength === this.perBlock && this.measureHeight) {\n return this.measureHeight;\n }\n return this.unitHeight ? this.unitHeight * blockLength : 100;\n }\n\n /** cache the height for all active blocks for later renders */\n private setBlockHeight() {\n this.activeBlocks.forEach((blockIndex) => {\n const el = this.blockElements[blockIndex];\n if (!el) return;\n\n readTask(() => {\n if (el.classList.contains(`${CSSNAMESPACE}__inactive`)) return;\n\n const height = el.getBoundingClientRect().height;\n // cache height to our block heights array\n // for subsequent renders\n const fBhIdx = this.blockHeights.findIndex(\n (bh) => bh.blockIndex === blockIndex\n );\n if (fBhIdx > -1) {\n this.blockHeights[fBhIdx] = { height, blockIndex };\n } else this.blockHeights.push({ height, blockIndex });\n });\n });\n }\n\n /**\n * On scroll, loop through all blocks' heights and cumulatively, add them together.\n * When we find that the scroll position is less than this cumulative block height -\n * stop loop - it's on the current active block.\n */\n private scrollHandler = () => {\n let scrollPos: number = 0;\n\n perMark('scrollHandler');\n // don't listen if this table isn't in the viewport\n if (!this.store?.general.state.isActive || !this.rows) return;\n if (this.primaryBlockIndex === undefined) this.primaryBlockIndex = 0;\n\n readTask(() => {\n scrollPos =\n typeof this.scrollParent.scrollTop !== 'undefined'\n ? this.scrollParent.scrollTop\n : window.scrollY;\n scrollPos += this.host.offsetTop;\n\n if (this.tablePinnedService) {\n this.tablePinnedService.onScroll({\n x:\n typeof this.scrollParent.scrollLeft !== 'undefined'\n ? this.scrollParent.scrollLeft\n : window.scrollX,\n y: scrollPos,\n });\n }\n\n let cumulativeHeight = this.host.offsetTop;\n let blockIndex = 0;\n const blockLen = this.blocks.length;\n\n while (blockIndex < blockLen && scrollPos >= cumulativeHeight) {\n cumulativeHeight += this.getBlockHeight(blockIndex);\n\n if (scrollPos < cumulativeHeight) {\n const potentialBlocks = [\n blockIndex,\n blockIndex + 1,\n // Math.max(0, blockIndex - 1),\n ];\n if (potentialBlocks.toString() !== this.activeBlocks.toString()) {\n this.activeBlocks = potentialBlocks;\n }\n this.primaryBlockIndex = blockIndex;\n }\n blockIndex++;\n }\n perMark('scrollHandler', true);\n });\n };\n\n /** Process slotted content */\n private processSlots() {\n // see if we have slot content\n if (!this.caption && !this.host.querySelector('[slot=\"caption\"]')) {\n console.error(\n 'For accessibility you must set a `caption` prop or use the `caption` slot'\n );\n }\n }\n\n private handleResizeChange = (\n e: NanoResizeObserveCustomEvent<ResizeStateChangeEventDetail>\n ) => {\n this.tableWrapperEle.className = '';\n\n let classes: string[] = [`${CSSNAMESPACE}__wrap`];\n if (e.target?.className)\n classes = [...e.target.className.split(' '), ...classes];\n\n this.tableWrapperEle.classList.add(...classes.filter((cl) => !!cl));\n };\n\n /** Adds an IO. Makes sure our scroll listener is only active when\n * the table is in viewport */\n private setupActiveWatcher() {\n if (!this.host || !this.scrollParent || !this.store) return;\n\n if (this.activeWatcherIo) {\n this.activeWatcherIo.disconnect();\n this.activeWatcherIo = undefined;\n }\n const io = (this.activeWatcherIo = new IntersectionObserver(\n async ([e]) => {\n if (e.isIntersecting) this.store.general.state.isActive = true;\n else this.store.general.state.isActive = false;\n },\n { root: this.scrollParent, threshold: 0 }\n ));\n io.observe(this.host);\n }\n\n // Component lifecycle\n\n async componentWillLoad() {\n perMark('init');\n // setup stores\n this.store = await generateStore(\n this.host,\n this.columns,\n this.scrollParent,\n this.isReady\n );\n await this.handleRowsChange();\n this.store.general.onChange('isActive', () => {\n this.scrollHandler();\n });\n this.store.data.onChange('rows', () => this.setBlocks());\n\n // setup dom and attach listeners\n this.processSlots();\n this.setBlocks();\n this.scrollParent = findScrollParent(this.host);\n this.setupActiveWatcher();\n }\n\n connectedCallback(): void {\n this.scrollParent = findScrollParent(this.host);\n this.setupActiveWatcher();\n }\n\n componentDidLoad(): void {\n this.setInitialBlockDimension();\n if (!this.tablePinnedService) {\n this.tablePinnedService = new TablePinService(\n this.tableEle,\n this.scrollParent\n );\n }\n }\n\n componentShouldUpdate(_newVal, _oldVal, stateName: keyof Table) {\n // stop double rendering - we use the store for rendering internally\n // the public facing props are kept in-sync with the store\n // but we don't want it to cause renders\n if (['rows', 'columns'].includes(stateName)) return false;\n\n if (measurePerf) console.info(stateName, _newVal, _oldVal);\n }\n\n componentWillRender(): void | Promise<void> {\n perMark('render');\n }\n\n componentDidRender(): void {\n this.setMeasureElement().then(() => this.setBlockHeight());\n perMark('render', true);\n }\n\n disconnectedCallback(): void {\n if (!this.activeWatcherIo) return;\n this.activeWatcherIo.disconnect();\n this.activeWatcherIo = undefined;\n\n (this.scrollParent === document.documentElement\n ? document\n : this.scrollParent\n ).removeEventListener('scroll', this.scrollHandler);\n }\n\n render() {\n this.blockElements = [];\n\n return (\n <Host>\n <div\n class={`${CSSNAMESPACE}__top-anchor`}\n ref={(a) => (this.topAnchorEle = a)}\n >\n \n </div>\n\n <nano-resize-observe\n states=\"576w sm, 768w md\"\n class=\"sm md\"\n onNanoResizeStateChange={this.handleResizeChange}\n onNanoResize={() => {\n if (this.tablePinnedService) this.tablePinnedService.onResize();\n }}\n ></nano-resize-observe>\n\n <div\n class={`${CSSNAMESPACE}__wrap sm md`}\n ref={(div) => (this.tableWrapperEle = div)}\n aria-labelledby={'nano-table-caption-' + this.renderId}\n tabindex={this.type === 'grid' ? '0' : undefined}\n >\n <nano-progress-bar\n indeterminate\n class={{\n [`${CSSNAMESPACE}__progress-bar`]: true,\n [`${CSSNAMESPACE}__progress-bar--show`]: this._loading,\n }}\n />\n <table\n role={this.type === 'grid' ? 'grid' : undefined}\n aria-rowcount={this.store.data.state.rows.length}\n aria-colcount={this.store.config.state.columns.length}\n class={`${CSSNAMESPACE}`}\n ref={(tbl) => (this.tableEle = tbl)}\n id={'nano-table-' + this.renderId}\n >\n <caption\n class={{\n [`${CSSNAMESPACE}__caption`]: true,\n [`${CSSNAMESPACE}__caption--hide`]: !this.showCaption,\n }}\n id={'nano-table-caption-' + this.renderId}\n >\n <slot name=\"caption\">{this.caption}</slot>\n </caption>\n\n {/* Header */}\n <thead>\n <TableHeadFootRow rowRenderer={this.headRender}>\n {this.store.config.state.columns.map((colModel) => [\n <TableColHead\n column={colModel}\n headRenderer={this.headRender}\n onColumnSortClick={this.sortStart}\n defaults={{\n sortable: this.defaultSort,\n }}\n />,\n ])}\n </TableHeadFootRow>\n </thead>\n\n {this._loading && !this.blocks.length && (\n <tbody class={`${CSSNAMESPACE}__active ${CSSNAMESPACE}__loading`}>\n {[...Array(10).keys()].map((rowIndex) => (\n <tr>\n {this.store.config.state.columns.map(\n (_colModel, colIndex) => (\n <TableCell\n rowIndex={rowIndex}\n colIndex={colIndex}\n nestedContent={() => <nano-skeleton />}\n />\n )\n )}\n </tr>\n ))}\n </tbody>\n )}\n\n <tr hidden={!!this._loading || !!this.blocks.length}>\n <th\n class={`${CSSNAMESPACE}__th`}\n colSpan={this.store.config.state.columns.length}\n >\n <div class=\"nano-tbl__cell-content nano-tbl__cell-content--no-result\">\n <slot name=\"no-results\">No results found</slot>\n </div>\n </th>\n </tr>\n\n {/* Body */}\n {this.blocks.map((block, blockIndex) => (\n <tbody\n key={block.__uuid}\n id={`tbody-${this.renderId}-${blockIndex}`}\n ref={(tb) => {\n this.blockElements.push(tb);\n }}\n class={{\n [`${CSSNAMESPACE}__inactive`]:\n !this.activeBlocks.includes(blockIndex),\n [`${CSSNAMESPACE}__active`]:\n this.activeBlocks.includes(blockIndex),\n }}\n >\n {this.activeBlocks.includes(blockIndex) ? (\n block.rows.map((row, i) => {\n const rowIndex =\n blockIndex > 0 ? blockIndex * this.perBlock + i : i;\n return (\n <TableRow\n rowRenderer={this.rowRender}\n rowModel={row}\n rowIndex={rowIndex}\n >\n {this.store.config.state.columns.map(\n (_colModel, colIndex) => (\n <TableCell\n rowIndex={rowIndex}\n colIndex={colIndex}\n />\n )\n )}\n </TableRow>\n );\n })\n ) : (\n <tr class={`${CSSNAMESPACE}__tr--placeholder`}>\n <td\n colSpan={this.store.config.state.columns.length}\n style={{\n height: this.getBlockHeight(blockIndex) + 'px',\n }}\n />\n </tr>\n )}\n </tbody>\n ))}\n\n {/* Footer */}\n {this.showFooter && (\n <tfoot>\n <TableHeadFootRow rowRenderer={this.footRender}>\n {this.store.config.state.columns.map((colModel) => [\n <TableColHead\n column={colModel}\n headRenderer={this.footRender}\n onColumnSortClick={this.sortStart}\n defaults={{\n sortable: this.defaultSort,\n }}\n />,\n ])}\n </TableHeadFootRow>\n </tfoot>\n )}\n </table>\n\n {!!this.blocks.length && (\n <nano-spinner\n type=\"circle\"\n class={{\n [`${CSSNAMESPACE}__spinner`]: true,\n [`${CSSNAMESPACE}__spinner--show`]: this._loading,\n }}\n />\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
|
@@ -130,27 +130,6 @@ export function classListToStr(classes) {
|
|
130
130
|
});
|
131
131
|
return classString;
|
132
132
|
}
|
133
|
-
/**
|
134
|
-
* Attempts to find the closes scrolling parental element
|
135
|
-
* @param element - the element from which to traverse up the DOM
|
136
|
-
* @returns - the closest scrolling parental element
|
137
|
-
*/
|
138
|
-
export function findScrollParent(element) {
|
139
|
-
let style = getComputedStyle(element);
|
140
|
-
const excludeStaticParent = style.position === 'absolute';
|
141
|
-
const overflowRegex = /(auto|scroll)/;
|
142
|
-
if (style.position === 'fixed')
|
143
|
-
return document.documentElement;
|
144
|
-
for (let parent = element; (parent = parent.parentElement);) {
|
145
|
-
style = getComputedStyle(parent);
|
146
|
-
if (excludeStaticParent && style.position === 'static') {
|
147
|
-
continue;
|
148
|
-
}
|
149
|
-
if (overflowRegex.test(style.overflow + style.overflowY + style.overflowX))
|
150
|
-
return parent;
|
151
|
-
}
|
152
|
-
return document.documentElement;
|
153
|
-
}
|
154
133
|
/**
|
155
134
|
* Checks whether an element is currently viewable within the viewport
|
156
135
|
* @param el - element to check
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"table.utils.js","sourceRoot":"","sources":["../../../src/components/table/table.utils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAS,CAAC,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKjD;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAC1B,QAAgB,EAChB,QAAgB;EAEhB,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;EAC5B,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;EAC3C,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;EAEnC,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;EACjC,MAAM,IAAI,GAAsC,MAAM,EAAE,IAAI,CAAC;EAC7D,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;EAChC,MAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO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CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;MACxE,OAAO,MAAM,CAAC;GACjB;EACD,OAAO,QAAQ,CAAC,eAAe,CAAC;AAClC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,EAAW,EAAE,cAAc,GAAG,GAAG;EAC5D,MAAM,CAAC,GAAG,EAAE,CAAC,qBAAqB,EAAE,CAAC;EACrC,MAAM,YAAY,GAChB,MAAM,CAAC,WAAW,IAAI,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC;EAE9D,IACE,CAAC,CAAC,CAAC,MAAM;IACT,CAAC,CAAC,CAAC,GAAG;IACN,CAAC,CAAC,CAAC,IAAI;IACP,CAAC,CAAC,CAAC,KAAK;IACR,CAAC,CAAC,CAAC,MAAM;IACT,CAAC,CAAC,CAAC,KAAK;IACR,CAAC,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC,CAAC;IAEJ,OAAO,KAAK,CAAC;EAEf,OAAO,CAAC,CACN,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC;IAC7D,cAAc;IAChB,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC;MAC5D,cAAc,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import { getRenderingRef, getElement, VNode, h, Fragment } from '@stencil/core';\nimport { getStore } from './table.store';\nimport { CSSNAMESPACE } from './table.constants';\nimport type { TableTypes } from '../../interface';\n\ntype ValidRenderTypes = 'tr' | 'th' | 'td';\n\n/**\n * Get a model object for custom cell / property renderers.\n * @param rowIndex - the current row index being rendered\n * @param colIndex - the current column index being rendered\n * @returns a model object which will be passed to custom renderers\n */\nexport function colDataModel(\n rowIndex: number,\n colIndex: number\n): TableTypes.RenderModel {\n const store = fetchStores();\n const columns = store.config.state.columns;\n const rows = store.data.state.rows;\n\n const column = columns[colIndex];\n const prop: TableTypes.ColumnProp | undefined = column?.prop;\n const rowModel = rows[rowIndex];\n const cellModel = rowModel ? rowModel[columns[colIndex].prop] : '';\n\n return {\n prop,\n cellModel,\n column,\n rowIndex,\n rowModel,\n };\n}\n\n/**\n * Get a model object for custom row renderers.\n * @param rowIndex\n * @returns a model object passed to custom row renderers\n */\nexport function rowDataModel(rowIndex: number): TableTypes.RowDataSchemaModel {\n const store = fetchStores();\n const rows = store.data.state.rows;\n const rowModel = rows[rowIndex];\n\n return {\n rowModel,\n rowIndex,\n };\n}\n\n/**\n * Merges 2 objects of properties together\n * @param current - property object\n * @param extra - additional object property\n * @returns - merged properties that can be applied to a node\n */\nexport function mergeProperties<\n T extends TableTypes.CellProps | TableTypes.CellProps\n>(current: T, extra: T) {\n if (!extra) return current;\n\n // top level merge\n const props: T = { ...extra, ...current };\n\n // deeper merge\n // merge classes maps or strings\n if (extra.class) {\n if (typeof extra.class === 'object' && typeof props.class === 'object') {\n props.class = { ...extra.class, ...props.class };\n } else if (\n typeof extra.class === 'string' &&\n typeof props.class === 'object'\n ) {\n props.class[extra.class] = true;\n } else if (typeof props.class === 'string') {\n props.class += ' ' + extra.class;\n }\n }\n // merge style\n if (extra.style) {\n props.style = { ...extra.style, ...props.style };\n }\n return props;\n}\n\n/**\n * Returns the current nano-table's stores.\n * @returns the current nano-table stores\n */\nexport function fetchStores() {\n return getStore(getElement(getRenderingRef()));\n}\n\n/**\n * Merges any defined cell properties with properties\n * required by `nano-table` functionality\n * @param rowIndex - the current row index being rendered\n * @param colIndex = the current column index being rendered\n * @param defaultProps - default properties required by `nano-table`\n * @returns - the merged properties that will be applied to a node\n */\nexport function mergeCellProperties(\n rowIndex: number,\n colIndex: number,\n defaultProps: TableTypes.CellProps\n): TableTypes.CellProps {\n const props: TableTypes.CellProps = { ...defaultProps };\n const extraPropsFunc =\n fetchStores().config.state.columns[colIndex]?.cellProperties;\n if (!extraPropsFunc) return props;\n\n const data = colDataModel(rowIndex, colIndex);\n const extra = extraPropsFunc(data);\n if (!extra) return props;\n\n return mergeProperties(props, extra);\n}\n\n/**\n * Renders a table header (within a thead) using a custom template if set.\n * @param col - the current column config object\n * @returns - a JSX node\n */\nexport function colheadFootRender(col: TableTypes.ColumnConfig): VNode {\n const tpl = col?.columnTemplate;\n return tpl ? (\n tpl(h as TableTypes.HFunc<VNode>, col)\n ) : (\n <Fragment>{col.title}</Fragment>\n );\n}\n\n/**\n * Renders a class string or map for pinned classes on the v axis.\n * @param type - element tagName\n * @param vPinned - whether element is currently pinned vertically to top or bottom\n * @param toString - render as a string (defaults to class map)\n * @returns a class string or class map\n */\nexport function headerPinClasses(\n type: ValidRenderTypes,\n vPinned?: TableTypes.Position,\n toString?: false\n): { [key: string]: boolean };\nexport function headerPinClasses(\n type: ValidRenderTypes,\n vPinned?: TableTypes.Position,\n toString?: true\n): string;\nexport function headerPinClasses(\n type: ValidRenderTypes,\n vPinned?: TableTypes.Position,\n toString = false\n): { [key: string]: boolean } | string {\n const classes = {\n [`${CSSNAMESPACE}__${type}`]: true,\n [`${CSSNAMESPACE}__pin`]: !!vPinned,\n [`${CSSNAMESPACE}__pin--top`]: vPinned === 'top',\n [`${CSSNAMESPACE}__pin--bottom`]: vPinned === 'bottom',\n };\n\n if (toString) return classListToStr(classes);\n return classes;\n}\n\n/**\n * Turns a class map {'string': boolean} to class string\n * @param classes - the class map to convert\n * @returns a class string\n */\nexport function classListToStr(classes: { [key: string]: boolean }): string {\n let classString = '';\n Object.entries(classes).forEach(([className, on]) => {\n if (on) classString += className + ' ';\n });\n return classString;\n}\n\n/**\n * Attempts to find the closes scrolling parental element\n * @param element - the element from which to traverse up the DOM\n * @returns - the closest scrolling parental element\n */\nexport function findScrollParent(element: HTMLElement) {\n let style = getComputedStyle(element);\n const excludeStaticParent = style.position === 'absolute';\n const overflowRegex = /(auto|scroll)/;\n\n if (style.position === 'fixed') return document.documentElement;\n for (let parent = element; (parent = parent.parentElement); ) {\n style = getComputedStyle(parent);\n if (excludeStaticParent && style.position === 'static') {\n continue;\n }\n if (overflowRegex.test(style.overflow + style.overflowY + style.overflowX))\n return parent;\n }\n return document.documentElement;\n}\n\n/**\n * Checks whether an element is currently viewable within the viewport\n * @param el - element to check\n * @param percentVisible - the percentage of the element that should be within the viewport\n * @returns true if the element's area percentage is visible\n */\nexport function isInViewport(el: Element, percentVisible = 100) {\n const r = el.getBoundingClientRect();\n const windowHeight =\n window.innerHeight || document.documentElement.clientHeight;\n\n if (\n !r.bottom &&\n !r.top &&\n !r.left &&\n !r.right &&\n !r.height &&\n !r.width &&\n !r.x &&\n !r.y\n )\n return false;\n\n return !(\n Math.floor(100 - ((r.top >= 0 ? 0 : r.top) / +-r.height) * 100) <\n percentVisible ||\n Math.floor(100 - ((r.bottom - windowHeight) / r.height) * 100) <\n percentVisible\n );\n}\n"]}
|
1
|
+
{"version":3,"file":"table.utils.js","sourceRoot":"","sources":["../../../src/components/table/table.utils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAS,CAAC,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKjD;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAC1B,QAAgB,EAChB,QAAgB;EAEhB,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;EAC5B,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;EAC3C,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;EAEnC,MAAM,MAAM,GAAG,O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C,CAAC,CAAC,KAAK;IACR,CAAC,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC,CAAC;IAEJ,OAAO,KAAK,CAAC;EAEf,OAAO,CAAC,CACN,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC;IAC7D,cAAc;IAChB,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC;MAC5D,cAAc,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import { getRenderingRef, getElement, VNode, h, Fragment } from '@stencil/core';\nimport { getStore } from './table.store';\nimport { CSSNAMESPACE } from './table.constants';\nimport type { TableTypes } from '../../interface';\n\ntype ValidRenderTypes = 'tr' | 'th' | 'td';\n\n/**\n * Get a model object for custom cell / property renderers.\n * @param rowIndex - the current row index being rendered\n * @param colIndex - the current column index being rendered\n * @returns a model object which will be passed to custom renderers\n */\nexport function colDataModel(\n rowIndex: number,\n colIndex: number\n): TableTypes.RenderModel {\n const store = fetchStores();\n const columns = store.config.state.columns;\n const rows = store.data.state.rows;\n\n const column = columns[colIndex];\n const prop: TableTypes.ColumnProp | undefined = column?.prop;\n const rowModel = rows[rowIndex];\n const cellModel = rowModel ? rowModel[columns[colIndex].prop] : '';\n\n return {\n prop,\n cellModel,\n column,\n rowIndex,\n rowModel,\n };\n}\n\n/**\n * Get a model object for custom row renderers.\n * @param rowIndex\n * @returns a model object passed to custom row renderers\n */\nexport function rowDataModel(rowIndex: number): TableTypes.RowDataSchemaModel {\n const store = fetchStores();\n const rows = store.data.state.rows;\n const rowModel = rows[rowIndex];\n\n return {\n rowModel,\n rowIndex,\n };\n}\n\n/**\n * Merges 2 objects of properties together\n * @param current - property object\n * @param extra - additional object property\n * @returns - merged properties that can be applied to a node\n */\nexport function mergeProperties<\n T extends TableTypes.CellProps | TableTypes.CellProps\n>(current: T, extra: T) {\n if (!extra) return current;\n\n // top level merge\n const props: T = { ...extra, ...current };\n\n // deeper merge\n // merge classes maps or strings\n if (extra.class) {\n if (typeof extra.class === 'object' && typeof props.class === 'object') {\n props.class = { ...extra.class, ...props.class };\n } else if (\n typeof extra.class === 'string' &&\n typeof props.class === 'object'\n ) {\n props.class[extra.class] = true;\n } else if (typeof props.class === 'string') {\n props.class += ' ' + extra.class;\n }\n }\n // merge style\n if (extra.style) {\n props.style = { ...extra.style, ...props.style };\n }\n return props;\n}\n\n/**\n * Returns the current nano-table's stores.\n * @returns the current nano-table stores\n */\nexport function fetchStores() {\n return getStore(getElement(getRenderingRef()));\n}\n\n/**\n * Merges any defined cell properties with properties\n * required by `nano-table` functionality\n * @param rowIndex - the current row index being rendered\n * @param colIndex = the current column index being rendered\n * @param defaultProps - default properties required by `nano-table`\n * @returns - the merged properties that will be applied to a node\n */\nexport function mergeCellProperties(\n rowIndex: number,\n colIndex: number,\n defaultProps: TableTypes.CellProps\n): TableTypes.CellProps {\n const props: TableTypes.CellProps = { ...defaultProps };\n const extraPropsFunc =\n fetchStores().config.state.columns[colIndex]?.cellProperties;\n if (!extraPropsFunc) return props;\n\n const data = colDataModel(rowIndex, colIndex);\n const extra = extraPropsFunc(data);\n if (!extra) return props;\n\n return mergeProperties(props, extra);\n}\n\n/**\n * Renders a table header (within a thead) using a custom template if set.\n * @param col - the current column config object\n * @returns - a JSX node\n */\nexport function colheadFootRender(col: TableTypes.ColumnConfig): VNode {\n const tpl = col?.columnTemplate;\n return tpl ? (\n tpl(h as TableTypes.HFunc<VNode>, col)\n ) : (\n <Fragment>{col.title}</Fragment>\n );\n}\n\n/**\n * Renders a class string or map for pinned classes on the v axis.\n * @param type - element tagName\n * @param vPinned - whether element is currently pinned vertically to top or bottom\n * @param toString - render as a string (defaults to class map)\n * @returns a class string or class map\n */\nexport function headerPinClasses(\n type: ValidRenderTypes,\n vPinned?: TableTypes.Position,\n toString?: false\n): { [key: string]: boolean };\nexport function headerPinClasses(\n type: ValidRenderTypes,\n vPinned?: TableTypes.Position,\n toString?: true\n): string;\nexport function headerPinClasses(\n type: ValidRenderTypes,\n vPinned?: TableTypes.Position,\n toString = false\n): { [key: string]: boolean } | string {\n const classes = {\n [`${CSSNAMESPACE}__${type}`]: true,\n [`${CSSNAMESPACE}__pin`]: !!vPinned,\n [`${CSSNAMESPACE}__pin--top`]: vPinned === 'top',\n [`${CSSNAMESPACE}__pin--bottom`]: vPinned === 'bottom',\n };\n\n if (toString) return classListToStr(classes);\n return classes;\n}\n\n/**\n * Turns a class map {'string': boolean} to class string\n * @param classes - the class map to convert\n * @returns a class string\n */\nexport function classListToStr(classes: { [key: string]: boolean }): string {\n let classString = '';\n Object.entries(classes).forEach(([className, on]) => {\n if (on) classString += className + ' ';\n });\n return classString;\n}\n\n/**\n * Checks whether an element is currently viewable within the viewport\n * @param el - element to check\n * @param percentVisible - the percentage of the element that should be within the viewport\n * @returns true if the element's area percentage is visible\n */\nexport function isInViewport(el: Element, percentVisible = 100) {\n const r = el.getBoundingClientRect();\n const windowHeight =\n window.innerHeight || document.documentElement.clientHeight;\n\n if (\n !r.bottom &&\n !r.top &&\n !r.left &&\n !r.right &&\n !r.height &&\n !r.width &&\n !r.x &&\n !r.y\n )\n return false;\n\n return !(\n Math.floor(100 - ((r.top >= 0 ? 0 : r.top) / +-r.height) * 100) <\n percentVisible ||\n Math.floor(100 - ((r.bottom - windowHeight) / r.height) * 100) <\n percentVisible\n );\n}\n"]}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
/*!
|
2
|
+
* Web Components for Nanopore digital Web Apps
|
3
|
+
*/
|
4
|
+
/**
|
5
|
+
* Attempts to find the closest scrolling parental element
|
6
|
+
* @param element - the element from which to traverse up the DOM
|
7
|
+
* @returns - the closest scrolling parental element
|
8
|
+
*/
|
9
|
+
export function findScrollParent(element) {
|
10
|
+
let style = getComputedStyle(element);
|
11
|
+
const excludeStaticParent = style.position === 'absolute';
|
12
|
+
const overflowRegex = /(auto|scroll)/;
|
13
|
+
if (style.position === 'fixed')
|
14
|
+
return document.documentElement;
|
15
|
+
for (let parent = element; (parent = parent.parentElement);) {
|
16
|
+
style = getComputedStyle(parent);
|
17
|
+
if (excludeStaticParent && style.position === 'static') {
|
18
|
+
continue;
|
19
|
+
}
|
20
|
+
if (overflowRegex.test(style.overflow + style.overflowY + style.overflowX)) {
|
21
|
+
return parent;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
return document.documentElement;
|
25
|
+
}
|
26
|
+
//# sourceMappingURL=scroll-parent.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"scroll-parent.js","sourceRoot":"","sources":["../../src/utils/scroll-parent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAoB;EACnD,IAAI,KAAK,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;EACtC,MAAM,mBAAmB,GAAG,KAAK,CAAC,QAAQ,KAAK,UAAU,CAAC;EAC1D,MAAM,aAAa,GAAG,eAAe,CAAC;EAEtC,IAAI,KAAK,CAAC,QAAQ,KAAK,OAAO;IAAE,OAAO,QAAQ,CAAC,eAAe,CAAC;EAEhE,KAAK,IAAI,MAAM,GAAG,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC,GAAI;IAC5D,KAAK,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACjC,IAAI,mBAAmB,IAAI,KAAK,CAAC,QAAQ,KAAK,QAAQ,EAAE;MACtD,SAAS;KACV;IACD,IACE,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,EACtE;MACA,OAAO,MAAM,CAAC;KACf;GACF;EACD,OAAO,QAAQ,CAAC,eAAe,CAAC;AAClC,CAAC","sourcesContent":["/**\n * Attempts to find the closest scrolling parental element\n * @param element - the element from which to traverse up the DOM\n * @returns - the closest scrolling parental element\n */\nexport function findScrollParent(element: HTMLElement) {\n let style = getComputedStyle(element);\n const excludeStaticParent = style.position === 'absolute';\n const overflowRegex = /(auto|scroll)/;\n\n if (style.position === 'fixed') return document.documentElement;\n\n for (let parent = element; (parent = parent.parentElement); ) {\n style = getComputedStyle(parent);\n if (excludeStaticParent && style.position === 'static') {\n continue;\n }\n if (\n overflowRegex.test(style.overflow + style.overflowY + style.overflowX)\n ) {\n return parent;\n }\n }\n return document.documentElement;\n}\n"]}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
/*!
|
2
|
+
* Web Components for Nanopore digital Web Apps
|
3
|
+
*/
|
4
|
+
let searchInsights;
|
5
|
+
const searchInsight = {
|
6
|
+
/**
|
7
|
+
* Initialise algolia search insights.
|
8
|
+
* Will asynchronously import the search-insight library
|
9
|
+
* @param appId
|
10
|
+
* @param apiKey
|
11
|
+
*/
|
12
|
+
init: async (appId, apiKey) => {
|
13
|
+
if (searchInsights)
|
14
|
+
return;
|
15
|
+
searchInsights = (await import('search-insights')).default;
|
16
|
+
searchInsights('init', {
|
17
|
+
appId,
|
18
|
+
apiKey,
|
19
|
+
});
|
20
|
+
},
|
21
|
+
/**
|
22
|
+
* Sends a `clickedObjectIDsAfterSearch` event to algolia search-insights.
|
23
|
+
* `init(...)` Must have been called first.
|
24
|
+
* @param params
|
25
|
+
*/
|
26
|
+
sendClick: (params) => {
|
27
|
+
if (!searchInsights) {
|
28
|
+
console.error('You must call `init()` first');
|
29
|
+
return;
|
30
|
+
}
|
31
|
+
searchInsights('clickedObjectIDsAfterSearch', { ...params });
|
32
|
+
},
|
33
|
+
/**
|
34
|
+
* Associates algolia analytics with a user id
|
35
|
+
* @param userToken
|
36
|
+
*/
|
37
|
+
setUser: (userToken) => {
|
38
|
+
if (!searchInsights) {
|
39
|
+
console.error('You must call `init()` first');
|
40
|
+
return;
|
41
|
+
}
|
42
|
+
searchInsights('setUserToken', userToken);
|
43
|
+
},
|
44
|
+
};
|
45
|
+
export default searchInsight;
|
46
|
+
//# sourceMappingURL=search-insights.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"search-insights.js","sourceRoot":"","sources":["../../src/utils/search-insights.ts"],"names":[],"mappings":"AAGA,IAAI,cAAqC,CAAC;AAE1C,MAAM,aAAa,GAAG;EACpB;;;;;KAKG;EACH,IAAI,EAAE,KAAK,EAAE,KAAa,EAAE,MAAc,EAAE,EAAE;IAC5C,IAAI,cAAc;MAAE,OAAO;IAE3B,cAAc,GAAG,CAAC,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,OAAO,CAAC;IAC3D,cAAc,CAAC,MAAM,EAAE;MACrB,KAAK;MACL,MAAM;KACP,CAAC,CAAC;EACL,CAAC;EAED;;;;KAIG;EACH,SAAS,EAAE,CAAC,MAAgC,EAAE,EAAE;IAC9C,IAAI,CAAC,cAAc,EAAE;MACnB,OAAO,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;MAC9C,OAAO;KACR;IACD,cAAc,CAAC,6BAA6B,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;EAC/D,CAAC;EAED;;;KAGG;EACH,OAAO,EAAE,CAAC,SAAiB,EAAE,EAAE;IAC7B,IAAI,CAAC,cAAc,EAAE;MACnB,OAAO,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;MAC9C,OAAO;KACR;IACD,cAAc,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;EAC5C,CAAC;CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import type SearchInsights from 'search-insights';\nimport type { InsightsSearchClickEvent } from 'search-insights/dist/click';\n\nlet searchInsights: typeof SearchInsights;\n\nconst searchInsight = {\n /**\n * Initialise algolia search insights.\n * Will asynchronously import the search-insight library\n * @param appId\n * @param apiKey\n */\n init: async (appId: string, apiKey: string) => {\n if (searchInsights) return;\n\n searchInsights = (await import('search-insights')).default;\n searchInsights('init', {\n appId,\n apiKey,\n });\n },\n\n /**\n * Sends a `clickedObjectIDsAfterSearch` event to algolia search-insights.\n * `init(...)` Must have been called first.\n * @param params\n */\n sendClick: (params: InsightsSearchClickEvent) => {\n if (!searchInsights) {\n console.error('You must call `init()` first');\n return;\n }\n searchInsights('clickedObjectIDsAfterSearch', { ...params });\n },\n\n /**\n * Associates algolia analytics with a user id\n * @param userToken\n */\n setUser: (userToken: string) => {\n if (!searchInsights) {\n console.error('You must call `init()` first');\n return;\n }\n searchInsights('setUserToken', userToken);\n },\n};\n\nexport default searchInsight;\n"]}
|
@@ -1214,7 +1214,10 @@ const Algolia = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
1214
1214
|
await this.updateContent();
|
1215
1215
|
setTimeout((_) => (this.isLoading = false), 800);
|
1216
1216
|
this.showResults = true;
|
1217
|
-
this.nanoResultsShown.emit(
|
1217
|
+
this.nanoResultsShown.emit({
|
1218
|
+
meta: this.indexResults,
|
1219
|
+
client: { appId: this.appId, apiKey: this.apiKey },
|
1220
|
+
});
|
1218
1221
|
}, 200);
|
1219
1222
|
};
|
1220
1223
|
// Takes all current filters (dynamic and static)
|
@@ -1259,6 +1262,7 @@ const Algolia = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
1259
1262
|
const searchParams = {
|
1260
1263
|
filters: this.algoliaFilterStr(),
|
1261
1264
|
page: this.indexResults ? this.indexResults.currentPage : 0,
|
1265
|
+
clickAnalytics: true,
|
1262
1266
|
};
|
1263
1267
|
if (this.searchIndex.filters)
|
1264
1268
|
searchParams.facets = this.searchIndex.filters;
|
@@ -1271,6 +1275,7 @@ const Algolia = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
1271
1275
|
// Setup initial meta on new queries. Some of it should not change on filter / pagination
|
1272
1276
|
if (eventType === SearchChangeEvent.Init || !this.indexResults) {
|
1273
1277
|
this.indexResults = {
|
1278
|
+
queryID: result.queryID,
|
1274
1279
|
currentPage: 0,
|
1275
1280
|
totalHits: result.nbHits,
|
1276
1281
|
hitsPerPage: null,
|