@nanoporetech-digital/components 5.1.2 → 5.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 +35 -0
- package/dist/cjs/{component-store-74d25f63.js → component-store-f1dc1276.js} +2 -2
- package/dist/cjs/{component-store-74d25f63.js.map → component-store-f1dc1276.js.map} +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/nano-algolia-filter.cjs.entry.js +2 -2
- package/dist/cjs/nano-algolia-input.cjs.entry.js +2 -2
- package/dist/cjs/nano-algolia.cjs.entry.js +2 -2
- package/dist/cjs/nano-checkbox-group.cjs.entry.js +5 -1
- package/dist/cjs/nano-checkbox-group.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-components.cjs.js +1 -1
- package/dist/cjs/nano-datalist_3.cjs.entry.js +14 -5
- package/dist/cjs/nano-datalist_3.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-dialog.cjs.entry.js +2 -2
- package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js +8 -5
- package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-nav.cjs.entry.js +2 -2
- package/dist/cjs/nano-input.cjs.entry.js +3 -3
- package/dist/cjs/nano-input.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-overflow-nav.cjs.entry.js +1 -1
- package/dist/cjs/nano-range.cjs.entry.js +1 -1
- package/dist/cjs/nano-resize-observe_2.cjs.entry.js +3 -1
- package/dist/cjs/nano-resize-observe_2.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-sortable.cjs.entry.js +18 -8
- package/dist/cjs/nano-sortable.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-split-pane.cjs.entry.js +1 -1
- package/dist/cjs/nano-sticker.cjs.entry.js +4 -2
- package/dist/cjs/nano-sticker.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-tab-group.cjs.entry.js +2 -2
- package/dist/cjs/{nano-table-0a720c5f.js → nano-table-04993bb4.js} +560 -186
- package/dist/cjs/nano-table-04993bb4.js.map +1 -0
- package/dist/cjs/nano-table.cjs.entry.js +2 -2
- package/dist/cjs/{table.worker-347d4d31.js → table.worker-85877b23.js} +4 -4
- package/dist/cjs/table.worker-85877b23.js.map +1 -0
- package/dist/cjs/{table.worker-bd51e29f.js → table.worker-f258383d.js} +1 -1
- package/dist/cjs/{throttle-f55496c8.js → throttle-dfa64b9e.js} +17 -20
- package/dist/cjs/throttle-dfa64b9e.js.map +1 -0
- package/dist/collection/components/checkbox/checkbox-group.js +4 -0
- package/dist/collection/components/checkbox/checkbox-group.js.map +1 -1
- package/dist/collection/components/datalist/datalist.js +13 -4
- package/dist/collection/components/datalist/datalist.js.map +1 -1
- package/dist/collection/components/input/input.css +1 -1
- package/dist/collection/components/input/input.js +1 -1
- package/dist/collection/components/input/input.js.map +1 -1
- package/dist/collection/components/nav-item/nav-item.js +6 -3
- package/dist/collection/components/nav-item/nav-item.js.map +1 -1
- package/dist/collection/components/resize-observe/resize-observe.js +21 -1
- package/dist/collection/components/resize-observe/resize-observe.js.map +1 -1
- package/dist/collection/components/select/select.css +1 -2
- package/dist/collection/components/sortable/sortable.js +5 -7
- package/dist/collection/components/sortable/sortable.js.map +1 -1
- package/dist/collection/components/sticker/sticker.js +11 -5
- package/dist/collection/components/sticker/sticker.js.map +1 -1
- package/dist/collection/components/table/table-interface.js.map +1 -1
- package/dist/collection/components/table/table.cell.js +43 -10
- package/dist/collection/components/table/table.cell.js.map +1 -1
- package/dist/collection/components/table/table.css +38 -55
- package/dist/collection/components/table/table.header.js +4 -9
- package/dist/collection/components/table/table.header.js.map +1 -1
- package/dist/collection/components/table/table.js +104 -48
- package/dist/collection/components/table/table.js.map +1 -1
- package/dist/collection/components/table/table.pin-service.js +382 -0
- package/dist/collection/components/table/table.pin-service.js.map +1 -0
- package/dist/collection/components/table/table.row.js +39 -46
- package/dist/collection/components/table/table.row.js.map +1 -1
- package/dist/collection/components/table/table.utils.js +0 -124
- package/dist/collection/components/table/table.utils.js.map +1 -1
- package/dist/collection/components/table/table.worker.js +1 -0
- package/dist/collection/components/table/table.worker.js.map +1 -1
- package/dist/collection/utils/events.js +27 -0
- package/dist/collection/utils/events.js.map +1 -0
- package/dist/collection/utils/throttle.js +16 -19
- package/dist/collection/utils/throttle.js.map +1 -1
- package/dist/components/datalist.js +13 -4
- package/dist/components/datalist.js.map +1 -1
- package/dist/components/input.js +2 -2
- package/dist/components/input.js.map +1 -1
- package/dist/components/nano-checkbox-group.js +4 -0
- package/dist/components/nano-checkbox-group.js.map +1 -1
- package/dist/components/nano-sortable.js +17 -7
- package/dist/components/nano-sortable.js.map +1 -1
- package/dist/components/nav-item.js +6 -3
- package/dist/components/nav-item.js.map +1 -1
- package/dist/components/resize-observe.js +3 -1
- package/dist/components/resize-observe.js.map +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/select.js.map +1 -1
- package/dist/components/sticker.js +3 -1
- package/dist/components/sticker.js.map +1 -1
- package/dist/components/table.js +533 -188
- package/dist/components/table.js.map +1 -1
- package/dist/components/table.worker.js +1 -1
- package/dist/components/throttle.js +16 -19
- package/dist/components/throttle.js.map +1 -1
- package/dist/esm/{component-store-244a8431.js → component-store-c23ebc9c.js} +2 -2
- package/dist/esm/{component-store-244a8431.js.map → component-store-c23ebc9c.js.map} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/nano-algolia-filter.entry.js +2 -2
- package/dist/esm/nano-algolia-input.entry.js +2 -2
- package/dist/esm/nano-algolia.entry.js +2 -2
- package/dist/esm/nano-checkbox-group.entry.js +5 -1
- package/dist/esm/nano-checkbox-group.entry.js.map +1 -1
- package/dist/esm/nano-components.js +1 -1
- package/dist/esm/nano-datalist_3.entry.js +14 -5
- package/dist/esm/nano-datalist_3.entry.js.map +1 -1
- package/dist/esm/nano-dialog.entry.js +2 -2
- package/dist/esm/nano-global-nav-user-profile_3.entry.js +8 -5
- package/dist/esm/nano-global-nav-user-profile_3.entry.js.map +1 -1
- package/dist/esm/nano-global-nav.entry.js +2 -2
- package/dist/esm/nano-input.entry.js +3 -3
- package/dist/esm/nano-input.entry.js.map +1 -1
- package/dist/esm/nano-overflow-nav.entry.js +1 -1
- package/dist/esm/nano-range.entry.js +1 -1
- package/dist/esm/nano-resize-observe_2.entry.js +3 -1
- package/dist/esm/nano-resize-observe_2.entry.js.map +1 -1
- package/dist/esm/nano-sortable.entry.js +18 -8
- package/dist/esm/nano-sortable.entry.js.map +1 -1
- package/dist/esm/nano-split-pane.entry.js +1 -1
- package/dist/esm/nano-sticker.entry.js +4 -2
- package/dist/esm/nano-sticker.entry.js.map +1 -1
- package/dist/esm/nano-tab-group.entry.js +2 -2
- package/dist/esm/{nano-table-9767860f.js → nano-table-91f09583.js} +561 -187
- package/dist/esm/nano-table-91f09583.js.map +1 -0
- package/dist/esm/nano-table.entry.js +2 -2
- package/dist/esm/{table.worker-d252307c.js → table.worker-625475ba.js} +4 -4
- package/dist/esm/table.worker-625475ba.js.map +1 -0
- package/dist/esm/{table.worker-bd51e29f.js → table.worker-f258383d.js} +1 -1
- package/dist/esm/{throttle-7836544e.js → throttle-ac4fcefa.js} +17 -20
- package/dist/esm/throttle-ac4fcefa.js.map +1 -0
- package/dist/nano-components/index.esm.js +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/{p-7d6065c6.entry.js → p-0697795a.entry.js} +2 -2
- package/dist/nano-components/p-0697795a.entry.js.map +1 -0
- package/dist/nano-components/p-17ee0c07.entry.js +5 -0
- package/dist/nano-components/{p-6975f110.entry.js → p-192902e0.entry.js} +2 -2
- package/dist/nano-components/{p-a6ff5ca6.js → p-1a0b5bc3.js} +2 -2
- package/dist/nano-components/{p-3a761d77.entry.js → p-1b791810.entry.js} +2 -2
- package/dist/nano-components/p-3de3449e.js +5 -0
- package/dist/nano-components/p-3de3449e.js.map +1 -0
- package/dist/nano-components/p-3eb6d833.entry.js +5 -0
- package/dist/nano-components/p-3eb6d833.entry.js.map +1 -0
- package/dist/nano-components/{p-a1c0afb6.entry.js → p-4884b65a.entry.js} +2 -2
- package/dist/nano-components/{p-75735a91.entry.js → p-565793a2.entry.js} +2 -2
- package/dist/nano-components/p-565793a2.entry.js.map +1 -0
- package/dist/nano-components/p-5aae2588.entry.js +5 -0
- package/dist/nano-components/p-5aae2588.entry.js.map +1 -0
- package/dist/nano-components/{p-935aef3d.entry.js → p-6920ad69.entry.js} +2 -2
- package/dist/nano-components/{p-1c6c94cb.entry.js → p-7baa9e14.entry.js} +2 -2
- package/dist/nano-components/p-7bff5224.js +5 -0
- package/dist/nano-components/p-7bff5224.js.map +1 -0
- package/dist/nano-components/{p-f60fe933.entry.js → p-898cbac7.entry.js} +2 -2
- package/dist/nano-components/{p-ace1ffc2.entry.js → p-a362bd23.entry.js} +2 -2
- package/dist/nano-components/{p-eb6c9191.entry.js → p-b72df1aa.entry.js} +2 -2
- package/dist/nano-components/p-bf18e298.entry.js +5 -0
- package/dist/nano-components/p-bf18e298.entry.js.map +1 -0
- package/dist/nano-components/p-ce5efc3f.entry.js +5 -0
- package/dist/nano-components/p-ce5efc3f.entry.js.map +1 -0
- package/dist/nano-components/{p-1b687f96.entry.js → p-d0eefd52.entry.js} +2 -2
- package/dist/nano-components/{p-2d43a82b.entry.js → p-d74e2642.entry.js} +2 -2
- package/dist/nano-components/p-d74e2642.entry.js.map +1 -0
- package/dist/nano-components/p-dfbf0d56.js +5 -0
- package/dist/nano-components/{p-bd51e29f.js → p-f258383d.js} +1 -1
- package/dist/types/components/datalist/datalist.d.ts +1 -0
- package/dist/types/components/nav-item/nav-item.d.ts +1 -1
- package/dist/types/components/resize-observe/resize-observe.d.ts +2 -0
- package/dist/types/components/sortable/sortable.d.ts +0 -1
- package/dist/types/components/sticker/sticker.d.ts +2 -2
- package/dist/types/components/table/table-interface.d.ts +23 -11
- package/dist/types/components/table/table.cell.d.ts +0 -7
- package/dist/types/components/table/table.d.ts +10 -7
- package/dist/types/components/table/table.header.d.ts +0 -1
- package/dist/types/components/table/table.pin-service.d.ts +90 -0
- package/dist/types/components/table/table.row.d.ts +3 -2
- package/dist/types/components/table/table.utils.d.ts +0 -27
- package/dist/types/components.d.ts +29 -11
- package/dist/types/utils/events.d.ts +15 -0
- package/dist/types/utils/throttle.d.ts +1 -1
- package/docs-json.json +59 -24
- package/docs-vscode.json +2 -2
- package/hydrate/index.js +610 -204
- package/package.json +2 -2
- package/dist/cjs/nano-table-0a720c5f.js.map +0 -1
- package/dist/cjs/table.worker-347d4d31.js.map +0 -1
- package/dist/cjs/throttle-f55496c8.js.map +0 -1
- package/dist/esm/nano-table-9767860f.js.map +0 -1
- package/dist/esm/table.worker-d252307c.js.map +0 -1
- package/dist/esm/throttle-7836544e.js.map +0 -1
- package/dist/nano-components/p-15217442.entry.js +0 -5
- package/dist/nano-components/p-15217442.entry.js.map +0 -1
- package/dist/nano-components/p-2d43a82b.entry.js.map +0 -1
- package/dist/nano-components/p-633c778c.js +0 -5
- package/dist/nano-components/p-633c778c.js.map +0 -1
- package/dist/nano-components/p-66631f50.js +0 -5
- package/dist/nano-components/p-75735a91.entry.js.map +0 -1
- package/dist/nano-components/p-7d6065c6.entry.js.map +0 -1
- package/dist/nano-components/p-8a79a7ca.entry.js +0 -5
- package/dist/nano-components/p-9746b0a5.js +0 -5
- package/dist/nano-components/p-9746b0a5.js.map +0 -1
- package/dist/nano-components/p-b0c60290.entry.js +0 -5
- package/dist/nano-components/p-b0c60290.entry.js.map +0 -1
- package/dist/nano-components/p-c8ccb57a.entry.js +0 -5
- package/dist/nano-components/p-c8ccb57a.entry.js.map +0 -1
- package/dist/nano-components/p-d1a5326f.entry.js +0 -5
- package/dist/nano-components/p-d1a5326f.entry.js.map +0 -1
- /package/dist/nano-components/{p-66631f50.js.map → p-17ee0c07.entry.js.map} +0 -0
- /package/dist/nano-components/{p-6975f110.entry.js.map → p-192902e0.entry.js.map} +0 -0
- /package/dist/nano-components/{p-a6ff5ca6.js.map → p-1a0b5bc3.js.map} +0 -0
- /package/dist/nano-components/{p-3a761d77.entry.js.map → p-1b791810.entry.js.map} +0 -0
- /package/dist/nano-components/{p-a1c0afb6.entry.js.map → p-4884b65a.entry.js.map} +0 -0
- /package/dist/nano-components/{p-935aef3d.entry.js.map → p-6920ad69.entry.js.map} +0 -0
- /package/dist/nano-components/{p-1c6c94cb.entry.js.map → p-7baa9e14.entry.js.map} +0 -0
- /package/dist/nano-components/{p-f60fe933.entry.js.map → p-898cbac7.entry.js.map} +0 -0
- /package/dist/nano-components/{p-ace1ffc2.entry.js.map → p-a362bd23.entry.js.map} +0 -0
- /package/dist/nano-components/{p-eb6c9191.entry.js.map → p-b72df1aa.entry.js.map} +0 -0
- /package/dist/nano-components/{p-1b687f96.entry.js.map → p-d0eefd52.entry.js.map} +0 -0
- /package/dist/nano-components/{p-8a79a7ca.entry.js.map → p-dfbf0d56.js.map} +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["checkboxGroupCss","CheckboxGroup","this","grpId","grpIds","ignoreValueSet","handleInvalid","ev","_invalid","validateOn","showErrorMsg","customValidate","showInlineError","preventDefault","showInlineValidation","nativeCbs","length","forEach","cb","_i","validity","valid","errorMessage","validationMessage","nanoValidate","emit","isValid","invalid","originalEvent","validityMessage","handleValuePropChange","nanoChange","value","setCbValue","async","validateFirst","Promise","resolve","setTimeout","message","optVal","checkboxes","find","c","setError","handleValueChange","target","host","setInteralValue","handleCbChange","onlyRadios","filter","type","required","checked","rd","reportValidity","onlyCbs","i","nativeCb","setCustomValidity","min","max","handleComponentChange","_a","checkboxTypes","getClassMap","map","handleDisabledChange","disabled","radios","flatMap","requestAnimationFrame","Array","isArray","includes","attachSlotObserver","mo","window","MutationObserver","handleSlotChange","observe","childList","from","querySelectorAll","hasHelperSlot","querySelector","all","reduce","acc","push","getInputElement","addEventListener","componentWillLoad","debounce","bind","connectedCallback","disconnectedCallback","disconnect","removeEventListener","componentDidLoad","render","legendId","moreId","h","Host","Object","assign","class","nanogroupcb","id","legend","role","name"],"sources":["./src/components/checkbox/checkbox-group.scss?tag=nano-checkbox-group&encapsulation=scoped","./src/components/checkbox/checkbox-group.tsx"],"sourcesContent":["@import '../../global/style/utilities/globals';\n@import '../../global/style/nano-theme/form';\n@import '../../global/style/nano-theme/base';\n\n:host {\n /**\n * @prop --control-margin-top: Margin between controls. Default depends on control type;\n * @prop --control-margin-end: Margin between controls. Default depends on control type;\n * @prop --control-margin-bottom: Margin between controls. Default depends on control type;\n * @prop --control-margin-start: Margin between controls. Default depends on control type;\n\n * @prop --invalid-msg-color: Default #{nano-color(danger, base)};\n * @prop --invalid-msg-font-size: Default #{$input-help-font-size};\n\n * @prop --help-msg-color: Font color applied to slot=\"helper\". Default #{$input-help-color};\n\n * @prop --label-color: Default #{$label-color};\n * @prop --label-color--invalid: Default #{$label-color-invalid};\n * @prop --label-font-size: Default #{$label-font-size};\n * @prop --label-padding: space between legend and control. Default #{$input-padding-bottom};\n */\n\n --control-margin-top: 0;\n --control-margin-end: 0;\n --control-margin-bottom: 0;\n --control-margin-start: 0;\n --invalid-msg-color: #{nano-color(danger, base)};\n --invalid-msg-font-size: #{$input-help-font-size};\n --help-msg-color: #{$input-help-color};\n --label-color: #{$label-color};\n --label-color--invalid: #{$label-color-invalid};\n --label-font-size: #{$label-font-size};\n --label-padding: #{$input-padding-bottom};\n\n display: block;\n\n * {\n box-sizing: inherit;\n }\n}\n\n:host([types-tag]),\n:host([types-segment]) {\n --control-margin-top: 0;\n --control-margin-end: 8px;\n --control-margin-bottom: 6px;\n --control-margin-start: 0;\n}\n\n:host([types-checkbox]),\n:host([types-radio]) {\n --control-margin-top: 0;\n --control-margin-end: 10px;\n --control-margin-bottom: 6px;\n --control-margin-start: 0;\n}\n\n.nanogroupcb {\n border: none;\n margin: 0;\n padding: 0;\n\n &__error,\n &__help,\n &__more {\n display: block;\n width: 100%;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n\n &__legend {\n font-size: var(--label-font-size);\n padding: 0 0 var(--label-padding);\n margin: 0;\n line-height: 1.5;\n white-space: normal;\n display: block;\n width: 100%;\n\n :host([invalid]:not([invalid='false'])) & {\n color: var(--label-color--invalid);\n }\n }\n\n &__more {\n height: 1em;\n margin-block-start:\n calc(\n var(--label-padding) - var(--control-margin-bottom)\n );\n margin-inline-end: 0;\n margin-block-end: var(--label-padding);\n margin-inline-start: 3px;\n position: relative;\n }\n\n &__error,\n &__help {\n inset-block-start: 0;\n inset-inline-start: 0;\n position: absolute;\n font-size: var(--invalid-msg-font-size);\n line-height: 1.2;\n transition: 0.3s ease-out opacity;\n\n .show-error & {\n opacity: 1;\n }\n }\n\n &__error {\n color: var(--invalid-msg-color);\n font-stretch: condensed;\n opacity: 0;\n\n .show-error & {\n opacity: 1;\n }\n }\n\n &__help {\n font-style: italic;\n opacity: 1;\n color: var(--help-msg-color);\n\n .show-error & {\n opacity: 0;\n }\n }\n\n &__cbs {\n margin: 0;\n padding: 0;\n line-height: 1;\n display: flex;\n flex-wrap: wrap;\n\n ::slotted(*:not([type='tag']):not([type='segment']):not([type='segment-pill'])) {\n --check-base-size: 1.2em;\n\n font-size: 0.85em;\n }\n\n ::slotted(*) {\n margin-inline: var(--control-margin-start) var(--control-margin-end);\n margin-block: var(--control-margin-top) var(--control-margin-bottom);\n }\n }\n}\n\n/* autoprefixer: ignore next */\n@supports ((margin-inline-start: 0) or (-webkit-margin-start: 0)) {\n .nanogroupcb__cbs {\n &::slotted(*),\n ::slotted(*) {\n margin-inline-start: var(--control-margin-start);\n margin-inline-end: var(--control-margin-end);\n }\n }\n}\n","import {\n Component,\n Prop,\n Element,\n h,\n ComponentInterface,\n State,\n Listen,\n Watch,\n Host,\n Method,\n Event,\n EventEmitter,\n} from '@stencil/core';\nimport { getClassMap } from '../../utils/theme';\nimport { debounce } from '../../utils/throttle';\nimport type {\n CssClassMap,\n ControlValidityEventDetail,\n ControlValidity,\n} from '../../interface';\n\n/**\n * `nano-checkbox-group` is an optional wrapper for all `nano-checkbox` controls.\n * It provides a convenient place to anchor a collective label and any validation issues.\n *\n * @slot - Used for grouping checkboxes inside the group wrapper\n * @slot helper - helper text to accompany the form field underneath.\n */\n@Component({\n tag: 'nano-checkbox-group',\n styleUrl: 'checkbox-group.scss',\n scoped: true,\n})\nexport class CheckboxGroup implements ComponentInterface {\n private mo?: MutationObserver;\n private checkboxTypes: CssClassMap;\n private grpId = `nano-checkbox-group-${grpIds++}`;\n private ignoreValueSet = false;\n\n @Element() host: HTMLNanoCheckboxGroupElement;\n\n // internal state\n\n @State() checkboxes?: HTMLNanoCheckboxElement[];\n @State() nativeCbs: HTMLInputElement[];\n @State() errorMessage: string = '';\n @State() showErrorMsg = false;\n @State() hasHelperSlot = false;\n\n // public properties\n\n /**\n * When should the field perform validation\n */\n @Prop({ mutable: true }) validateOn?: 'dirty' | 'submit' | 'submitThenDirty' =\n 'submitThenDirty';\n\n /**\n * Whether to show validation errors underneath input\n */\n @Prop() showInlineError = true;\n\n /**\n * The minimum number of checkboxes required to be valid. Only relevant for checkbox type controls.\n * A validation error will be thrown if not enough controls are checked.\n */\n @Prop() min: number = 0;\n\n /**\n * The maximum number of checkboxes allowed. Only relevant for checkbox type controls.\n * Other controls will automatically be disabled upon reaching this number.\n */\n @Prop() max: number = null;\n\n /**\n * Disable all the nested form controls\n */\n @Prop({ reflect: true }) disabled: boolean | null = null;\n\n /**\n * A common label for children controls\n */\n @Prop() legend: string = '';\n\n /**\n * This will be true when the control is in an invalid state.\n * Validity is determined by the `required` prop. Or if custom validity message is set. @readonly\n */\n @Prop({ reflect: true })\n get invalid() {\n return this._invalid;\n }\n @State() _invalid = false;\n\n /**\n * Current validation message - if any. @readonly\n */\n @Prop()\n get validityMessage() {\n return this.errorMessage;\n }\n\n /** The current, collective checkbox value */\n @Prop({ mutable: true }) value: string[] | string;\n\n @Watch('value')\n handleValuePropChange() {\n this.nanoChange.emit(this.value);\n\n // this change is coming from a checkbox being checked\n // so don't then change the checkbox state\n // (would cause an infinite loop)\n if (this.ignoreValueSet) return;\n\n // value has changed via prop directly, so update the checkbox's state\n this.setCbValue();\n }\n\n // Public methods\n\n /**\n * Get the current state of the control.\n * @param validateFirst - perform validation first before reporting\n * @returns `{ isValid: boolean, errorMessage: string }`\n */\n @Method()\n async reportValidity(validateFirst: boolean): Promise<ControlValidity> {\n return new Promise((resolve) => {\n if (validateFirst) {\n this.customValidate();\n this.showInlineValidation();\n }\n setTimeout(() => {\n resolve({\n isValid: !this.invalid,\n errorMessage: this.errorMessage,\n });\n }, 50);\n });\n }\n\n /**\n * Invalidate the field and show a custom error message.\n * To clear the error you will need to re-call this method with an empty string.\n * @param message - the error message to show\n * @param optVal - optionally supply an option value to target which checkbox to show invalidate against (default is the first)\n */\n @Method()\n async showError(message: string, optVal?: string) {\n let cb: HTMLNanoCheckboxElement;\n if (!this.checkboxes) return;\n if (optVal) cb = this.checkboxes.find((c) => c.value === optVal);\n if (!cb) cb = this.checkboxes[0];\n if (!cb) return;\n\n this.errorMessage = message;\n await cb.setError(message);\n if (!!this.showInlineError) this.showInlineValidation();\n }\n\n // Events\n\n /**\n * Called when a nested checkbox changes\n */\n @Event() nanoChange: EventEmitter<string | string[]>;\n\n /**\n * Called when validation is performed (which depends on `validateOn`).\n * @returns event.detail: `{ isValid: boolean, errorMessage: string, originalEvent: Event }`.\n */\n @Event() nanoValidate: EventEmitter<ControlValidityEventDetail>;\n\n // listeners & watchers\n\n @Listen('nanoChange')\n handleValueChange(ev: CustomEvent) {\n if (ev.target === this.host) return;\n this.setInteralValue();\n }\n\n /**\n * Notes on validation... custom validation messages should be set\n * no matter whether we show inline messages or native html5.\n * this will mean forms cannot submit when there are pending validation issues.\n */\n @Listen('nanoChange')\n @Watch('min')\n @Watch('max')\n handleCbChange() {\n if (this.invalid) this.showErrorMsg = this._invalid = false;\n this.customValidate();\n\n if (this.validateOn !== 'dirty') return;\n this.showInlineValidation();\n }\n\n @Watch('nativeCbs')\n customValidate() {\n if (!this.nativeCbs || !this.nativeCbs.length || !this.checkboxes) return;\n\n const onlyRadios = this.nativeCbs.filter((cb) => cb?.type === 'radio');\n\n if (\n onlyRadios &&\n onlyRadios.length &&\n (this.showErrorMsg || this.validateOn === 'dirty')\n ) {\n const required = onlyRadios.find((cb) => cb.required);\n const checked = onlyRadios.filter((cb) => cb.checked);\n\n if (required && checked) {\n this.checkboxes.forEach((rd) => rd.reportValidity(false));\n return false;\n } else if (required && !checked) return true;\n }\n\n // we only care about checkbox controls.\n const onlyCbs = this.nativeCbs.filter((cb) => cb?.type === 'checkbox');\n if (!onlyCbs || !onlyCbs.length) return;\n\n const checked = onlyCbs.filter((cb) => cb.checked);\n const required = onlyCbs.find((cb) => cb.required);\n let invalid = false;\n\n if (required && !checked.find((cb) => cb === required)) return true;\n\n this.checkboxes.forEach((cb, i) => {\n const nativeCb = this.nativeCbs[i];\n cb.setError('');\n nativeCb.setCustomValidity('');\n\n if (this.min && checked.length < this.min) {\n this.errorMessage = `You must select a minimum of ${this.min} values.`;\n invalid = true;\n }\n if (this.max && checked.length > this.max) {\n this.errorMessage = `Only up to ${this.max} values are allowed.`;\n invalid = true;\n }\n\n if (invalid) {\n cb.setError(this.errorMessage, this.showErrorMsg);\n // bit fugly. We're just doing this 'cos stencil\n // methods are async and we want the validity message\n // asap to keep things in sync\n nativeCb.setCustomValidity(this.errorMessage);\n }\n });\n return invalid;\n }\n\n @Watch('checkboxes')\n handleComponentChange() {\n if (!this.checkboxes?.length) return;\n\n this.checkboxTypes = getClassMap(\n this.checkboxes.map((cb) => 'types-' + cb.type)\n );\n }\n\n @Watch('disabled')\n @Watch('checkboxes')\n handleDisabledChange() {\n if (this.disabled === null || !this.checkboxes?.length) return;\n this.checkboxes.map((cb) => (cb.disabled = this.disabled));\n }\n\n // private methods\n\n private setInteralValue() {\n this.ignoreValueSet = true;\n const radios = this.nativeCbs.filter((cb) => cb?.type === 'radio');\n if (radios?.length) {\n this.value = radios.find((cb) => cb.checked)?.value || null;\n return;\n }\n this.value = this.checkboxes.flatMap((cb) =>\n cb.checked ? [cb.value] : []\n );\n requestAnimationFrame(() => (this.ignoreValueSet = false));\n }\n\n private setCbValue() {\n this.checkboxes.forEach((cb) => {\n if (\n cb.value === this.value ||\n (Array.isArray(this.value) && this.value.includes(cb.value))\n ) {\n cb.checked = true;\n }\n });\n }\n\n private attachSlotObserver() {\n if (!!this.mo || !window['MutationObserver']) return;\n const mo = (this.mo = new MutationObserver(() => this.handleSlotChange()));\n mo.observe(this.host, { childList: true });\n }\n\n private async handleSlotChange() {\n this.checkboxes = Array.from(this.host.querySelectorAll('nano-checkbox'));\n this.hasHelperSlot = !!this.host.querySelector('[slot=\"helper\"]');\n\n this.nativeCbs = await Promise.all(\n this.checkboxes.reduce((acc: Array<Promise<HTMLInputElement>>, cb) => {\n acc.push(cb.getInputElement());\n return acc;\n }, [])\n );\n\n this.nativeCbs.forEach((cb) => {\n if (cb) cb.addEventListener('invalid', this.handleInvalid);\n });\n }\n\n private handleInvalid = (ev: Event) => {\n this._invalid = true;\n\n if (this.validateOn === 'submit') {\n this._invalid = this.showErrorMsg = this.customValidate();\n }\n if (!!this.showInlineError) ev.preventDefault();\n\n this.showInlineValidation(ev);\n };\n\n private showInlineValidation = (ev?: Event) => {\n if (!this.nativeCbs || !this.nativeCbs.length) return;\n if (this.validateOn === 'submitThenDirty') this.validateOn = 'dirty';\n this.showErrorMsg = false;\n this._invalid = false;\n\n this.nativeCbs.forEach((cb, _i) => {\n if (!cb.validity.valid) {\n this.errorMessage = cb.validationMessage;\n this.showErrorMsg = true;\n this._invalid = true;\n }\n });\n\n this.nanoValidate.emit({\n isValid: !this.invalid,\n errorMessage: this.errorMessage,\n originalEvent: ev,\n });\n };\n\n // stencil hooks\n\n componentWillLoad() {\n this.showInlineValidation = debounce(this.showInlineValidation, 50);\n this.customValidate = this.customValidate.bind(this);\n this.handleDisabledChange();\n this.handleSlotChange();\n }\n\n connectedCallback() {\n this.attachSlotObserver();\n }\n\n disconnectedCallback() {\n if (this.mo) this.mo.disconnect();\n\n this.nativeCbs.forEach((cb) => {\n if (cb) cb.removeEventListener('invalid', this.handleInvalid);\n });\n }\n\n componentDidLoad() {\n this.handleComponentChange();\n }\n\n render() {\n const legendId = this.grpId + '-lbl';\n const moreId =\n this.showInlineError || this.hasHelperSlot ? this.grpId + '-more' : '';\n\n return (\n <Host {...this.checkboxTypes}>\n <fieldset\n disabled={this.disabled}\n class={{ nanogroupcb: true, 'show-error': this.showErrorMsg }}\n >\n <legend class=\"nanogroupcb__legend\" id={legendId}>\n {this.legend}\n </legend>\n <div\n class=\"nanogroupcb__cbs\"\n role=\"group\"\n aria-labelledby={legendId + ' ' + moreId}\n >\n <slot />\n </div>\n {(this.showInlineError || this.hasHelperSlot) && (\n <div class=\"nanogroupcb__more\" id={moreId}>\n {!!this.showInlineError ? (\n <div class=\"nanogroupcb__error\">{this.errorMessage}</div>\n ) : (\n ''\n )}\n <div class=\"nanogroupcb__help\">\n <slot name=\"helper\" />\n </div>\n </div>\n )}\n </fieldset>\n </Host>\n );\n }\n}\n\nlet grpIds = 0;\n"],"mappings":";;;wIAAA,MAAMA,EAAmB,m1H,MCkCZC,EAAa,M,2GAGhBC,KAAAC,MAAQ,uBAAuBC,MAC/BF,KAAAG,eAAiB,MAuRjBH,KAAAI,cAAiBC,IACvBL,KAAKM,SAAW,KAEhB,GAAIN,KAAKO,aAAe,SAAU,CAChCP,KAAKM,SAAWN,KAAKQ,aAAeR,KAAKS,gB,CAE3C,KAAMT,KAAKU,gBAAiBL,EAAGM,iBAE/BX,KAAKY,qBAAqBP,EAAG,EAGvBL,KAAAY,qBAAwBP,IAC9B,IAAKL,KAAKa,YAAcb,KAAKa,UAAUC,OAAQ,OAC/C,GAAId,KAAKO,aAAe,kBAAmBP,KAAKO,WAAa,QAC7DP,KAAKQ,aAAe,MACpBR,KAA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kF,EAAA,OAAKI,MAAM,qBACTJ,EAAA,QAAMS,KAAK,c,oQAU3B,IAAI7G,EAAS,E"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/*!
|
2
|
+
* Web Components for Nanopore digital Web Apps
|
3
|
+
*/
|
4
|
+
import{c as t}from"./p-3de3449e.js";import"./p-f6a8467a.js";import"./p-ee045579.js";import"./p-7bff5224.js";import"./p-9ebbb814.js";const o="table.worker";const p="stencil.table.worker";const s=new URL("p-f258383d.js",import.meta.url).href;const e=new Blob(['importScripts("'+s+'")'],{type:"text/javascript"});const r=URL.createObjectURL(e);const c=t(r,o,p);URL.revokeObjectURL(r);export{c as worker,p as workerMsgId,o as workerName,s as workerPath};
|
5
|
+
//# sourceMappingURL=p-dfbf0d56.js.map
|
@@ -1,4 +1,4 @@
|
|
1
1
|
/*!
|
2
2
|
* Web Components for Nanopore digital Web Apps
|
3
3
|
*/
|
4
|
-
(()=>{"use strict";const e=(e,t)=>{const n=globalThis[t];return n!=null&&e instanceof n};const t=n=>{if(n!=null){if(e(n,"ArrayBuffer")||e(n,"MessagePort")||e(n,"ImageBitmap")||e(n,"OffscreenCanvas")){return[n]}if(typeof n==="object"){if(n.constructor===Object){n=Object.values(n)}if(Array.isArray(n)){return n.flatMap(t)}return t(n.buffer)}}return[]};const n={};const r="stencil.table.worker";const o=r+".cb";addEventListener("message",(async({data:e})=>{if(e&&e[0]===r){let i=e[1];let s=e[2];let f=e[3];let u=0;let c=f.length;let a;let l;try{for(;u<c;u++){if(Array.isArray(f[u])&&f[u][0]===o){const e=f[u][1];f[u]=(...t)=>{postMessage([o,e,t])}}}a=await n[s](...f)}catch(e){a=null;if(e instanceof Error){l={isError:true,value:{message:e.message,name:e.name,stack:e.stack}}}else{l={isError:false,value:e}}a=undefined}const p=t(a);postMessage([r,i,a,l],p)}}));var i=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};var s=1/0;var f="[object Symbol]";var u=/[\\^$.*+?()[\]{}|]/g,c=RegExp(u.source);var a=typeof i=="object"&&i&&i.Object===Object&&i;var l=typeof self=="object"&&self&&self.Object===Object&&self;var p=a||l||Function("return this")();var d=Object.prototype;var h=d.toString;var w=p.Symbol;var y=w?w.prototype:undefined,g=y?y.toString:undefined;function b(e){if(typeof e=="string"){return e}if(m(e)){return g?g.call(e):""}var t=e+"";return t=="0"&&1/e==-s?"-0":t}function v(e){return!!e&&typeof e=="object"}function m(e){return typeof e=="symbol"||v(e)&&h.call(e)==f}function k(e){return e==null?"":b(e)}function $(e){e=k(e);return e&&c.test(e)?e.replace(u,"\\$&"):e}var E=$;function x(e,t){if(typeof e==="string"){return t.checkString(e)}else if(typeof e==="number"){return t.checkNumber(e)}else{return false}}function A(e,t,n,r){if(typeof e==="object"){if(Array.isArray(e)){for(const o of e){if(A(o,t,n,r)){return true}}}else{for(const o in e){n.push(o);const i=A(e[o],t,n,r);n.pop();if(i)return true}}}else if(t.type==="exists"){if(t.key.test(n.join("."))){return!!e}else{return false}}else{const o=n.join(".");for(const e of r.ignorePaths){if(e.test(o))return false}if(r.includePaths){let e=false;for(const t of r.includePaths){if(t.test(o)){e=true;break}}if(!e)return false}if(t.key){if(!t.key.test(o))return false}return x(e,t)}return false}function j(e,t,n,r){if(t.length){let o=false;for(const i of t){if(A(e,i,[],r)?!i.negate:i.negate){if(n==="OR"){return true}o=true}else if(n==="AND"){return false}}return o}return true}function N(e,t){const n=[];let r=false;let o=0;let i="";for(let s=0;s<e.length;s++){const f=e[s];if(r){if(f===i){r=false;i=""}}else if(f==='"'||f==="'"){r=true;i=f}else if(f.match(t)&&!r){n.push(e.slice(o,s).trim());o=s+1}if(s===e.length-1){n.push(e.slice(o).trim())}}return n.map((e=>{if(e.startsWith('"')&&e.endsWith('"')){return e.slice(1,-1)}if(e.startsWith("'")&&e.endsWith("'")){return e.slice(1,-1)}return e})).filter((e=>e))}const O={"<":function e(t){const n=Number(t[0]);return e=>e<n},"<=":function e(t){const n=Number(t[0]);return e=>e<=n},"=":function e(t){const n=t[0].split(",").filter((e=>e)).map(Number);return e=>{for(let t=0;t<n.length;t++){if(e===n[t]){return true}}return false}},">=":function e(t){const n=Number(t[0]);return e=>e>=n},">":function e(t){const n=Number(t[0]);return e=>e>n},"..":function e(t){const n=Number(t[0]);const r=Number(t[1]);return e=>e>=n&&e<=r}};function
|
4
|
+
(()=>{"use strict";const e=(e,t)=>{const n=globalThis[t];return n!=null&&e instanceof n};const t=n=>{if(n!=null){if(e(n,"ArrayBuffer")||e(n,"MessagePort")||e(n,"ImageBitmap")||e(n,"OffscreenCanvas")){return[n]}if(typeof n==="object"){if(n.constructor===Object){n=Object.values(n)}if(Array.isArray(n)){return n.flatMap(t)}return t(n.buffer)}}return[]};const n={};const r="stencil.table.worker";const o=r+".cb";addEventListener("message",(async({data:e})=>{if(e&&e[0]===r){let i=e[1];let s=e[2];let f=e[3];let u=0;let c=f.length;let a;let l;try{for(;u<c;u++){if(Array.isArray(f[u])&&f[u][0]===o){const e=f[u][1];f[u]=(...t)=>{postMessage([o,e,t])}}}a=await n[s](...f)}catch(e){a=null;if(e instanceof Error){l={isError:true,value:{message:e.message,name:e.name,stack:e.stack}}}else{l={isError:false,value:e}}a=undefined}const p=t(a);postMessage([r,i,a,l],p)}}));var i=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};var s=1/0;var f="[object Symbol]";var u=/[\\^$.*+?()[\]{}|]/g,c=RegExp(u.source);var a=typeof i=="object"&&i&&i.Object===Object&&i;var l=typeof self=="object"&&self&&self.Object===Object&&self;var p=a||l||Function("return this")();var d=Object.prototype;var h=d.toString;var w=p.Symbol;var y=w?w.prototype:undefined,g=y?y.toString:undefined;function b(e){if(typeof e=="string"){return e}if(m(e)){return g?g.call(e):""}var t=e+"";return t=="0"&&1/e==-s?"-0":t}function v(e){return!!e&&typeof e=="object"}function m(e){return typeof e=="symbol"||v(e)&&h.call(e)==f}function k(e){return e==null?"":b(e)}function $(e){e=k(e);return e&&c.test(e)?e.replace(u,"\\$&"):e}var E=$;function x(e,t){if(typeof e==="string"){return t.checkString(e)}else if(typeof e==="number"){return t.checkNumber(e)}else{return false}}function A(e,t,n,r){if(typeof e==="object"){if(Array.isArray(e)){for(const o of e){if(A(o,t,n,r)){return true}}}else{for(const o in e){n.push(o);const i=A(e[o],t,n,r);n.pop();if(i)return true}}}else if(t.type==="exists"){if(t.key.test(n.join("."))){return!!e}else{return false}}else{const o=n.join(".");for(const e of r.ignorePaths){if(e.test(o))return false}if(r.includePaths){let e=false;for(const t of r.includePaths){if(t.test(o)){e=true;break}}if(!e)return false}if(t.key){if(!t.key.test(o))return false}return x(e,t)}return false}function j(e,t,n,r){if(t.length){let o=false;for(const i of t){if(A(e,i,[],r)?!i.negate:i.negate){if(n==="OR"){return true}o=true}else if(n==="AND"){return false}}return o}return true}function N(e,t){const n=[];let r=false;let o=0;let i="";for(let s=0;s<e.length;s++){const f=e[s];if(r){if(f===i){r=false;i=""}}else if(f==='"'||f==="'"){r=true;i=f}else if(f.match(t)&&!r){n.push(e.slice(o,s).trim());o=s+1}if(s===e.length-1){n.push(e.slice(o).trim())}}return n.map((e=>{if(e.startsWith('"')&&e.endsWith('"')){return e.slice(1,-1)}if(e.startsWith("'")&&e.endsWith("'")){return e.slice(1,-1)}return e})).filter((e=>e))}const O={"<":function e(t){const n=Number(t[0]);return e=>e<n},"<=":function e(t){const n=Number(t[0]);return e=>e<=n},"=":function e(t){const n=t[0].split(",").filter((e=>e)).map(Number);return e=>{for(let t=0;t<n.length;t++){if(e===n[t]){return true}}return false}},">=":function e(t){const n=Number(t[0]);return e=>e>=n},">":function e(t){const n=Number(t[0]);return e=>e>n},"..":function e(t){const n=Number(t[0]);const r=Number(t[1]);return e=>e>=n&&e<=r}};function R(e){const{values:t,operator:n}=D(e);const r=O[n];if(!r){throw new Error(`unknown operator ${n}`)}return r(t)}function D(e){const t=/^\s*\(?\s*(?<startOperator><=|>=|<|=|>|\.\.\s*)?\s*(?<firstValue>-?\d*\.?\d+)\s*(?:(?<afterDots>\.\.)\s*(?<secondValue>-?\d*\.?\d*))?\s*\)?\s*$/.exec(e);if(!t){return{operator:"=",values:[e]}}if(!t.groups){throw new Error("unreachable")}const{startOperator:n,firstValue:r,afterDots:o,secondValue:i}=t.groups;let s=n;let f=r?[r]:[];if(n===".."){s="<="}else if(!n&&o&&!i){s=">="}else if(o){s=".."}if(i){f.push(i)}return{values:f,operator:s||"="}}const P={"<":function e(t){return e=>e<t[0]},"<=":function e(t){return e=>e<=t[0]},"=":function e(t,n){const r=N(t[0],",").filter((e=>e)).map((e=>new RegExp(`^${E(e)}$`,n)));return e=>{for(const t of r){if(t.test(e)){return true}}return false}},"~":function e(t,n){const r=N(t[0],",").filter((e=>e)).map((e=>new RegExp(E(e),n)));return e=>{for(const t of r){if(t.test(e)){return true}}return false}},">=":function e(t){return e=>e>=t[0]},">":function e(t){return e=>e>t[0]},"..":function e(t){return e=>e>=t[0]&&e<=t[1]}};function _(e,t){const{values:n,operator:r}=I(e);const o=P[r];if(!o){throw new Error(`unreachable unknown operator ${r}`)}return o(n,t)}function I(e){const t=e.split("..");const n=/^\s*\(?(?<operator><=|<|=|>=|>)?\s*(?<value>\S*)\s*\)?$/.exec(t[0]);if(!n){return{operator:"~",values:[e]}}if(!n.groups){throw new Error("unreachable")}let{operator:r,value:o}=n.groups;let i=t[1]?.trim();let s=[o];if(t.length>1){r="..";if(!i){r=">="}else if(!o){s=[i];r="<="}else{s.push(i)}}return{operator:r||"~",values:s}}function S(e,t={pathAlias:{}}){const{caseSensitive:n,pathAlias:r}=t;const o=n?"":"i";let i=false;if(e.startsWith("-")){i=true;e=e.substring(1)}const s=e.indexOf(":");if(s>-1){const t=e.substring(s+1);if(s>0){const n=e.substring(0,s);if(n==="is"){return{type:"exists",negate:i,key:new RegExp(`(^|\\.)${E(t)}(\\.|$)`,o)}}else{return{type:"matches",negate:i,key:r[n]?r[n]:new RegExp(`(^|\\.)${E(n)}(\\.|$)`,o),checkNumber:R(t),checkString:_(t,o)}}}}return{type:"matches",negate:i,checkNumber:R(e),checkString:_(e,o)}}function M(e,t={pathAlias:{}}){return e.map((e=>S(e,t)))}function V(e,t){const{insensitive:n}=t;const r={};for(const[t,o]of Object.entries(e)){if(o instanceof RegExp){r[t]=o}else{r[t]=new RegExp(`(^|\\.)${E(o)}(\\.|$)`,n)}}return r}function T(e,t={}){let{index:n=false,predicate:r="AND",ignorePaths:o=[],includePaths:i,pathAlias:s={}}=t;const f=t.limit?t.limit:Infinity;const u=t.caseSensitive?"":"i";let c=t.keywords||[];const a=V(s,{insensitive:u});const l=o.map((e=>typeof e==="string"?new RegExp(`(^|\\.)${E(e)}(\\.|$)`,u):e));const p=i?i.map((e=>typeof e==="string"?new RegExp(`(^|\\.)${E(e)}(\\.|$)`,u):e)):undefined;if(typeof c==="string"){c=N(c,/[ \t\r\n]/)}const d=M(c,{caseSensitive:t.caseSensitive,pathAlias:a});let h=0;if(n){const t=[];for(let n=0;n<e.length&&h<f;n++){if(j(e[n],d,r,{ignorePaths:l,includePaths:p,pathAlias:a})){h=t.push(n)}}return t}else{const t=[];for(let n=0;n<e.length&&h<f;n++){if(j(e[n],d,r,{ignorePaths:l,includePaths:p,pathAlias:a})){h=t.push(e[n])}}return t}}const B=new Map;function F(){return Date.now().toString(36)+Math.random().toString(36).substring(2)}async function C(e,t){const n=F();B.set(n,{rows:e,columns:X(t)});return n}async function L(e,t){const n=B.get(e);if(!n)throw"cannot find worker with ID "+e;n.rows=t;if(!n.rows&&!n.columns)Y(e);return true}async function q(e,t){const n=B.get(e);if(!n)throw"cannot find worker with ID "+e;n.columns=X(t);if(!n.rows&&!n.columns)Y(e);return true}async function z(e,t){const n=B.get(e);if(!n)throw"cannot find worker with ID "+e;n.searchTerm=t;if(!t||!t.length){n.filterRows=n.rows;return W(n,n.rows)}const r=n.columns.filter((e=>e.searchable!==false));n.filterRows=T(n.rows,{keywords:t,predicate:"OR",includePaths:[...r.map((e=>e.prop))],ignorePaths:["__uuid","__index"]});return W(n,n.filterRows)}function G(e){return e.columns.filter((e=>e.filter!==undefined&&e.filter!==null)).reduce(((e,t)=>{const{prop:n,filter:r}=t;e.push({prop:n,filter:r});return e}),[])}function H(e,t,n=[]){if(!n||!n.length)n=G(e);if(!n||!n.length)return t;n.forEach((e=>{if(typeof e.filter==="boolean"){t=t.filter((t=>t[e.prop]===e.filter))}else{t=T(t,{predicate:typeof e.filter==="string"?"AND":"OR",keywords:e.filter,includePaths:[e.prop],ignorePaths:["__uuid","__index"]})}}));return t}async function J(e,t){const n=B.get(e);if(!n)throw"cannot find worker with ID "+e;const r=(!t||!t.length)&&n.searchTerm?await z(e,n.searchTerm):n.searchTerm?n.filterRows:n.rows;n.filterRows=H(n,r,t);return Q(n,n.filterRows)}function K(e){const t=e.columns.find((e=>!!e.order));if(t){const{prop:e,order:n}=t;return{prop:e,order:n}}return null}function Q(e,t,n,r){if(!n&&!r){const t=K(e);if(t){({prop:n,order:r}=t)}}if(!n||!r||!t.length)return t;const o=e.columns.find((e=>e.prop===n));if(!!(o===null||o===void 0?void 0:o.sortCompareFn)&&typeof o.sortCompareFn==="function"){const e=t.slice().sort(o.sortCompareFn(n,r));return e}if((o===null||o===void 0?void 0:o.type)==="text"&&typeof t[0][n]==="string"){const e=t.slice().sort(((e,t)=>{if(!e[n])return 1;if(!t[n])return-1;return r==="asc"?e[n].localeCompare(t[n]):t[n].localeCompare(e[n])}));return e}const i=t.slice().sort(((e,t)=>{if(!e[n])return 1;if(!t[n])return-1;if(e[n]<t[n])return r==="asc"?-1:1;if(e[n]>t[n])return r==="asc"?1:-1;return 0}));return i}async function U(e,t,n){const r=B.get(e);if(!r)throw"cannot find worker with ID "+e;const o=r.filterRows||r.rows;return Q(r,o,t,n)}function W(e,t){t=H(e,t);return Q(e,t)}function X(e){return e.map((e=>{if(!!(e===null||e===void 0?void 0:e.sortCompareFn)){e.sortCompareFn=new Function("return "+e.sortCompareFn)()}return e}))}async function Y(e){B.delete(e)}n.createWorkerStore=C;n.destroyWorkerStore=Y;n.syncConfigToWorker=q;n.syncDataToWorker=L;n.workerFilter=J;n.workerSearch=z;n.workerSort=U})();
|
@@ -116,7 +116,7 @@ export declare class NavItem implements ComponentInterface {
|
|
116
116
|
private handleMouseEnter;
|
117
117
|
private handleMouseLeave;
|
118
118
|
private handleClick;
|
119
|
-
componentWillLoad(): void;
|
120
119
|
connectedCallback(): void;
|
120
|
+
disconnectedCallback(): void;
|
121
121
|
render(): any;
|
122
122
|
}
|
@@ -41,6 +41,8 @@ export declare class ResizeObserve implements ComponentInterface {
|
|
41
41
|
x: boolean;
|
42
42
|
y: boolean;
|
43
43
|
}>;
|
44
|
+
/** Fires after any resizing */
|
45
|
+
nanoResize: EventEmitter<ResizeObserverEntry[]>;
|
44
46
|
dimensionChanged(): void;
|
45
47
|
statesChanged(): void;
|
46
48
|
private assesContentFit;
|
@@ -68,8 +68,8 @@ export declare class Sticker implements ComponentInterface {
|
|
68
68
|
* By default, it will find traverse the DOM to find the closest. */
|
69
69
|
scrollParent?: HTMLElement | Document;
|
70
70
|
/** Upon being stuck, attach the sticker to another sticker element.
|
71
|
-
*
|
72
|
-
stickTo: string;
|
71
|
+
* JS query selector string or DOM element pointing to a `<nano-sticker>` */
|
72
|
+
stickTo: string | HTMLNanoStickerElement;
|
73
73
|
/** Emitted when a sticker is stuck */
|
74
74
|
nanoStuck: EventEmitter<{
|
75
75
|
sticker: HTMLNanoStickerElement;
|
@@ -10,13 +10,13 @@ export declare namespace TableTypes {
|
|
10
10
|
/** Function called, via intersection observer, when an element's pinned status changes */
|
11
11
|
type PinnedCb = (positions: {
|
12
12
|
[key in Position]?: boolean;
|
13
|
-
}) => void;
|
13
|
+
}, target: Element) => void;
|
14
14
|
/** Potential column ordering options */
|
15
15
|
type Order = 'asc' | 'desc' | undefined;
|
16
16
|
/** Column filtering */
|
17
17
|
interface Filter {
|
18
18
|
prop: TableTypes.Prop;
|
19
|
-
filter: string | boolean;
|
19
|
+
filter: string | boolean | string[];
|
20
20
|
}
|
21
21
|
/** Column sorting */
|
22
22
|
interface Sort {
|
@@ -73,6 +73,15 @@ export declare namespace TableTypes {
|
|
73
73
|
interface HFunc<T> {
|
74
74
|
(sel: any, data: any, children: T): T;
|
75
75
|
}
|
76
|
+
/**
|
77
|
+
* Properties that can be used with the row template `TableCell` jsx partial
|
78
|
+
*/
|
79
|
+
type TableRowCellHelperProps = {
|
80
|
+
header?: boolean;
|
81
|
+
wrap?: boolean;
|
82
|
+
cellProps?: CellProps;
|
83
|
+
wrapperProps?: JSXBase.HTMLAttributes<HTMLDivElement>;
|
84
|
+
};
|
76
85
|
/**
|
77
86
|
* A row render function, called during a any row's render to the dom.
|
78
87
|
* It can be used to add extra markup around any given table row
|
@@ -85,19 +94,17 @@ export declare namespace TableTypes {
|
|
85
94
|
props: RowDataSchemaModel<P>,
|
86
95
|
/** a helper template to minimise boilerplate.
|
87
96
|
* A shortcut for `<td><div class="nano-tbl__cell-content"></div></td>` */
|
88
|
-
TableCell: FunctionalComponent<
|
89
|
-
header?: boolean;
|
90
|
-
}>) => T | undefined;
|
97
|
+
TableCell: FunctionalComponent<TableRowCellHelperProps>) => T | undefined;
|
91
98
|
/**
|
92
99
|
* A cell render function, called during any cell's render to the dom.
|
93
100
|
* It can be used to add any markup within a table cell.
|
94
101
|
*/
|
95
|
-
type CellTemplateFunc<T, P> = (createElement: HFunc<T>, props: RenderModel<P>) =>
|
102
|
+
type CellTemplateFunc<T, P> = (createElement: HFunc<T>, props: RenderModel<P>) => TplResult;
|
96
103
|
/**
|
97
104
|
* A table header render function, called during any column's render to the dom.
|
98
105
|
* It can be used to add any markup within a table header `th`.
|
99
106
|
*/
|
100
|
-
type ColumnTemplateFunc<T, P> = (createElement: HFunc<T>, col: ColumnConfig<P>) =>
|
107
|
+
type ColumnTemplateFunc<T, P> = (createElement: HFunc<T>, col: ColumnConfig<P>) => TplResult;
|
101
108
|
/** A function used to assess the order of any given column.
|
102
109
|
* e.g. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
|
103
110
|
*/
|
@@ -120,6 +127,11 @@ export declare namespace TableTypes {
|
|
120
127
|
type Prop = keyof RowData;
|
121
128
|
/** Valid column data types */
|
122
129
|
type ColumnType = 'text' | 'string' | 'number' | 'date' | 'boolean' | 'unknown';
|
130
|
+
type LibJSX = {
|
131
|
+
[key: string]: any;
|
132
|
+
};
|
133
|
+
type JSXRender = VNode | VNode[] | LibJSX | LibJSX[];
|
134
|
+
type TplResult = JSXRender | string | Element | undefined;
|
123
135
|
/**
|
124
136
|
* A table column's configuration
|
125
137
|
*/
|
@@ -151,19 +163,19 @@ export declare namespace TableTypes {
|
|
151
163
|
/** Whether to include this column when doing a general search. Defaults to true */
|
152
164
|
searchable?: boolean;
|
153
165
|
/** Current filters applied to this column */
|
154
|
-
filter?: string | boolean;
|
166
|
+
filter?: string | boolean | string[];
|
155
167
|
/**
|
156
168
|
* A cell render function, called during any cell's render to the dom.
|
157
169
|
* It can be used to add any markup within a table cell.
|
158
170
|
*/
|
159
|
-
cellTemplate?: CellTemplateFunc<
|
171
|
+
cellTemplate?: CellTemplateFunc<JSXRender, T>;
|
160
172
|
/** A function which can be used to apply any html attribute/s onto a table cell `td` */
|
161
173
|
cellProperties?: PropertiesFunc;
|
162
174
|
/**
|
163
175
|
* A table header render function, called during any column's render to the dom.
|
164
176
|
* It can be used to add any markup within a table header `th`.
|
165
177
|
*/
|
166
|
-
columnTemplate?: ColumnTemplateFunc<
|
178
|
+
columnTemplate?: ColumnTemplateFunc<JSXRender, T>;
|
167
179
|
/** A function which can be used to apply any html attribute/s onto a table head `th` */
|
168
180
|
columnProperties?: ColPropertiesFunc<T>;
|
169
181
|
/** A custom sorting comparator function - assess the order of any given column.
|
@@ -190,7 +202,7 @@ export declare namespace TableTypes {
|
|
190
202
|
* controlling their visual state.
|
191
203
|
*/
|
192
204
|
interface HeadFootRenderer<T = RowData> {
|
193
|
-
/**
|
205
|
+
/** Position prop. Defaults to `top` for the header and `bottom` the footer */
|
194
206
|
pinned: Position;
|
195
207
|
/**
|
196
208
|
* A row render function, called during a any row's render to the dom.
|
@@ -1,11 +1,4 @@
|
|
1
1
|
import { FunctionalComponent, VNode } from '../../stencil-public-runtime';
|
2
|
-
/**
|
3
|
-
* Renders a cell using a custom renderer if set.
|
4
|
-
* @param rowIndex - the current row index being rendered
|
5
|
-
* @param colIndex - the current column index being rendered
|
6
|
-
* @returns - a JSX node
|
7
|
-
*/
|
8
|
-
export declare function cellRender(rowIndex: number, colIndex: number): VNode;
|
9
2
|
export declare const baseCellClasses: (colIndex: number, toString?: boolean) => string | {
|
10
3
|
[x: string]: boolean;
|
11
4
|
};
|
@@ -16,7 +16,10 @@ import { TableTypes } from '../../interface';
|
|
16
16
|
*/
|
17
17
|
export declare class Table implements ComponentInterface {
|
18
18
|
constructor();
|
19
|
-
|
19
|
+
/** Function called whenever `col.cellTemplate` renders an unknown object.
|
20
|
+
* The function should render a valid HTMLElement to the cell arg.
|
21
|
+
* Example usage - render JSX from a 3rd party lib and append the result to the cell element. */
|
22
|
+
customRenderer: (node: any, cell: HTMLElement) => void;
|
20
23
|
/** The type of table. Grid type will make cells navigable by keyboard */
|
21
24
|
type: 'grid' | 'table';
|
22
25
|
/** A descriptive title of the table.
|
@@ -25,8 +28,8 @@ export declare class Table implements ComponentInterface {
|
|
25
28
|
/** Show the caption on-screen */
|
26
29
|
showCaption: boolean;
|
27
30
|
/** Will show a loading state when set to true.
|
28
|
-
* By default, will be shown automatically if `rows` is a promise waiting to resolve
|
29
|
-
* or when performing custom filtering or sorting.
|
31
|
+
* By default, will be shown automatically if `rows` is a promise waiting to resolve / or falsy
|
32
|
+
* *or* when performing custom filtering or sorting.
|
30
33
|
* *Note* when set manually, will overwrite any internal loading state.
|
31
34
|
* Set to 'undefined' to revert to default behaviour. */
|
32
35
|
loading: boolean;
|
@@ -62,7 +65,7 @@ export declare class Table implements ComponentInterface {
|
|
62
65
|
searchTerm: string;
|
63
66
|
/** A custom filtering function. Should return a promise.
|
64
67
|
* If the promise resolves as `true` the column UI will be updated.
|
65
|
-
* If the promise resolves as
|
68
|
+
* If the promise resolves as falsy, the sort will be performed by the component.
|
66
69
|
* A good use-case would be performing the filter on a server / via fetch.
|
67
70
|
* Then on success, updating the table's data via the `rows` property */
|
68
71
|
customFilterFn?: (filters: TableTypes.Filter[]) => Promise<true | TableTypes.Falsy>;
|
@@ -86,6 +89,8 @@ export declare class Table implements ComponentInterface {
|
|
86
89
|
*/
|
87
90
|
virtualTotalItems: number;
|
88
91
|
virtualTotalItemsChangeHandler(): void;
|
92
|
+
/** @readonly - shows the currently applied filters */
|
93
|
+
get appliedFilters(): TableTypes.Filter[];
|
89
94
|
/** Fired when the table has done it's first complete render */
|
90
95
|
nanoTblReady: EventEmitter;
|
91
96
|
/** Fired whenever a block is activated by scrolling into view / becoming visible
|
@@ -151,8 +156,6 @@ export declare class Table implements ComponentInterface {
|
|
151
156
|
removeFilters(columnNames: TableTypes.Prop[]): Promise<void>;
|
152
157
|
/** Updates a row model at a given index
|
153
158
|
* @param row - the row to update.
|
154
|
-
* *Note* - this should come from the `col.cellTemplate` or `row.rowRender.template` `rowModel` property
|
155
|
-
* - rows are augmented with certain properties to aid with efficient rendering
|
156
159
|
* @param rowIndex - the row index to insert this row
|
157
160
|
*/
|
158
161
|
updateRow(row: TableTypes.RowData, rowIndex: number): Promise<void>;
|
@@ -167,6 +170,7 @@ export declare class Table implements ComponentInterface {
|
|
167
170
|
private tableWrapperEle;
|
168
171
|
private cacheScrollPosition;
|
169
172
|
private activeWatcherIo;
|
173
|
+
private tablePinnedService;
|
170
174
|
/** `tr` elements split into units - defined by `perBlock`
|
171
175
|
These are show / hidden for perf */
|
172
176
|
blocks: TableTypes.TBody[];
|
@@ -236,7 +240,6 @@ export declare class Table implements ComponentInterface {
|
|
236
240
|
private scrollHandler;
|
237
241
|
/** Process slotted content */
|
238
242
|
private processSlots;
|
239
|
-
private handleColumnPinned;
|
240
243
|
private handleResizeChange;
|
241
244
|
/** Adds an IO. Makes sure our scroll listener is only active when
|
242
245
|
* the table is in viewport */
|
@@ -4,7 +4,6 @@ type TableColHeadProps = {
|
|
4
4
|
column: TableTypes.ColumnConfig;
|
5
5
|
headRenderer: TableTypes.HeadFootRenderer;
|
6
6
|
onColumnSortClick?: (order: TableTypes.Order, column: TableTypes.Prop, el: HTMLTableCellElement) => void;
|
7
|
-
onColumnPinned?: TableTypes.PinnedCb;
|
8
7
|
defaults: {
|
9
8
|
sortable?: boolean;
|
10
9
|
};
|
@@ -0,0 +1,90 @@
|
|
1
|
+
/**
|
2
|
+
* Manages the complex business of table 'pinning'; sticking columns and rows to the scrolling parent element.
|
3
|
+
*
|
4
|
+
* *knowing* when an element is pinned is tricky.
|
5
|
+
* Managing the display of multiple, side-by-side pinned elements is trickier still.
|
6
|
+
*
|
7
|
+
* Pinning table columns are very different from pinning table rows:
|
8
|
+
* - Rows are actual elements we can select, measure and apply styles to.
|
9
|
+
* - Columns are disparate collections of elements that are much harder to select, measure and apply styles to.
|
10
|
+
*
|
11
|
+
* With this in mind, how columns and rows are pinned is different:
|
12
|
+
* Rows can have changes applied directly, Columns have changes applied via dynamic stylesheets.
|
13
|
+
*
|
14
|
+
* The service is slightly opinionated on how it pins rows and columns (with some room for override):
|
15
|
+
* - Pinned columns are stuck consecutively, without overlapping.
|
16
|
+
* e.g. If column 'name' and 'surname' are both `pin: 'start'`; 'surname' will display **next** to name.
|
17
|
+
* Both columns are important for context
|
18
|
+
*
|
19
|
+
* - Pinned rows are set to overlap *when* they have the same ancestor,
|
20
|
+
* and stuck consecutively when they have a different ancestor.
|
21
|
+
* e.g. `tbody > tr.pin ~ tr.pin` the second row will **overlap** the first; it's unlikely both rows will be important for context.
|
22
|
+
* `thead > tr.pin`, `tbody > tr.pin`. Both rows are required for context so will require next to each other.
|
23
|
+
*
|
24
|
+
* Devs can override this behaviour by setting `--pin-start`, `--pin-end`, `--pin-top`, `--pin-bottom` custom vars.
|
25
|
+
*/
|
26
|
+
export declare class TablePinService {
|
27
|
+
private cachedColMeta;
|
28
|
+
private tableId;
|
29
|
+
private tableEle;
|
30
|
+
private scrollElement;
|
31
|
+
private startColumns;
|
32
|
+
private endColumns;
|
33
|
+
private topRows;
|
34
|
+
private bottomRows;
|
35
|
+
private tableDims;
|
36
|
+
constructor(table: HTMLTableElement, scrollElement: HTMLElement);
|
37
|
+
private get pinnedStart();
|
38
|
+
private set pinnedStart(value);
|
39
|
+
private _pinnedStart;
|
40
|
+
/**
|
41
|
+
* Called when columns are either pinned or unpinned.
|
42
|
+
* Attaches a tiny stylesheet to target the 'last' start column.
|
43
|
+
* (e.g. We only want to apply drop shadow on last pinned start column - not all pinned columns)
|
44
|
+
*/
|
45
|
+
private handlePinnedStartChange;
|
46
|
+
private get pinnedEnd();
|
47
|
+
private set pinnedEnd(value);
|
48
|
+
private _pinnedEnd;
|
49
|
+
/**
|
50
|
+
* Called when columns are either pinned or unpinned.
|
51
|
+
* Attaches a tiny stylesheet to target the 'first' end column.
|
52
|
+
* (e.g. We only want to apply drop shadow on first pinned end column - not all pinned columns)
|
53
|
+
*/
|
54
|
+
private handlePinnedEndChange;
|
55
|
+
private get cssColDimensionCacheKey();
|
56
|
+
private set cssColDimensionCacheKey(value);
|
57
|
+
private _cssColDimensionCacheKey;
|
58
|
+
/**
|
59
|
+
* To only generate column dimension styles when necessary we
|
60
|
+
* maintain a cache key string via serialised column meta.
|
61
|
+
* Only when this key changes do we generate a new stylesheet
|
62
|
+
*/
|
63
|
+
private generateCssCacheKey;
|
64
|
+
/**
|
65
|
+
* Generates pinned column width offset styles
|
66
|
+
* so pinned columns can appear stuck together,
|
67
|
+
* then attaches a stylesheet.
|
68
|
+
*/
|
69
|
+
private createPinnedColDimensionStyles;
|
70
|
+
private getParentOffsets;
|
71
|
+
/**
|
72
|
+
* Loops through all 'top' & 'bottom' rows (on scroll or resize)
|
73
|
+
* Manages their visual state by applying classes on stuck / unstuck
|
74
|
+
* And their pinned offset / distance
|
75
|
+
*/
|
76
|
+
assessRows(): void;
|
77
|
+
/**
|
78
|
+
* Loops through all 'start' & 'end' columns (on scroll or resize)
|
79
|
+
* Caches meta about each column (e.g. size, position-index)
|
80
|
+
* and decides which columns are pinned
|
81
|
+
*/
|
82
|
+
assessCols(): Promise<void>;
|
83
|
+
private cacheX;
|
84
|
+
private cacheY;
|
85
|
+
onScroll(pos: {
|
86
|
+
x: number;
|
87
|
+
y: number;
|
88
|
+
}): void;
|
89
|
+
onResize(): void;
|
90
|
+
}
|
@@ -4,12 +4,13 @@ type TableRowProps = {
|
|
4
4
|
rowRenderer: TableTypes.RowRenderer;
|
5
5
|
rowIndex: number;
|
6
6
|
rowModel: TableTypes.RowData;
|
7
|
-
|
7
|
+
onRowPinned?: TableTypes.PinnedCb;
|
8
8
|
};
|
9
9
|
export declare const TableRow: FunctionalComponent<TableRowProps>;
|
10
10
|
type TableHeadFootProps = {
|
11
11
|
rowRenderer: TableTypes.HeadFootRenderer;
|
12
|
-
|
12
|
+
onRowPinned?: TableTypes.PinnedCb;
|
13
|
+
onColPinned?: TableTypes.PinnedCb;
|
13
14
|
};
|
14
15
|
export declare const TableHeadFootRow: FunctionalComponent<TableHeadFootProps>;
|
15
16
|
export {};
|
@@ -41,20 +41,6 @@ export declare function mergeCellProperties(rowIndex: number, colIndex: number,
|
|
41
41
|
* @returns - a JSX node
|
42
42
|
*/
|
43
43
|
export declare function colheadFootRender(col: TableTypes.ColumnConfig): VNode;
|
44
|
-
/**
|
45
|
-
* Adds element to Intersection Observer. Fires when element changes on the x axis
|
46
|
-
* @param el - an element to observe
|
47
|
-
* @param pos - the edge to watch (start or end)
|
48
|
-
* @param cb - callback when an intersection state changes.
|
49
|
-
*/
|
50
|
-
export declare function addHObserver(el: HTMLTableCellElement, pos: TableTypes.Position, cb: TableTypes.PinnedCb): void;
|
51
|
-
/**
|
52
|
-
* Adds element to Intersection Observer. Fires when element changes on the y axis
|
53
|
-
* @param el - an element to observe
|
54
|
-
* @param pos - the edge to watch (start or end)
|
55
|
-
* @param cb - callback when an intersection state changes.
|
56
|
-
*/
|
57
|
-
export declare function addVObserver(el: HTMLTableCellElement, pos: TableTypes.Position, cb: TableTypes.PinnedCb): void;
|
58
44
|
/**
|
59
45
|
* Renders a class string or map for pinned classes on the v axis.
|
60
46
|
* @param type - element tagName
|
@@ -74,11 +60,6 @@ export declare function headerPinClasses(type: ValidRenderTypes, vPinned?: Table
|
|
74
60
|
export declare function classListToStr(classes: {
|
75
61
|
[key: string]: boolean;
|
76
62
|
}): string;
|
77
|
-
/**
|
78
|
-
* Detects the current scroll speed as a number.
|
79
|
-
* Use within a scroll listener
|
80
|
-
*/
|
81
|
-
export declare const detectScrollSpeed: () => number;
|
82
63
|
/**
|
83
64
|
* Attempts to find the closes scrolling parental element
|
84
65
|
* @param element - the element from which to traverse up the DOM
|
@@ -92,12 +73,4 @@ export declare function findScrollParent(element: HTMLElement): HTMLElement;
|
|
92
73
|
* @returns true if the element's area percentage is visible
|
93
74
|
*/
|
94
75
|
export declare function isInViewport(el: Element, percentVisible?: number): boolean;
|
95
|
-
/**
|
96
|
-
* Immutable array re-order
|
97
|
-
* @param from - the index to move from
|
98
|
-
* @param to - the index to move to
|
99
|
-
* @param arr - the array to re-order
|
100
|
-
* @returns - a new, re-orderd array
|
101
|
-
*/
|
102
|
-
export declare function arrMove(from: number, to: number, arr: any[]): any[];
|
103
76
|
export {};
|
@@ -2294,9 +2294,9 @@ export namespace Components {
|
|
2294
2294
|
"scrollParent"?: HTMLElement | Document;
|
2295
2295
|
"setTriggerPos": (offset: number | { v: number; h: number; }) => Promise<number | { v: number; h: number; }>;
|
2296
2296
|
/**
|
2297
|
-
* Upon being stuck, attach the sticker to another sticker element.
|
2297
|
+
* Upon being stuck, attach the sticker to another sticker element. JS query selector string or DOM element pointing to a `<nano-sticker>`
|
2298
2298
|
*/
|
2299
|
-
"stickTo": string;
|
2299
|
+
"stickTo": string | HTMLNanoStickerElement;
|
2300
2300
|
}
|
2301
2301
|
interface NanoTab {
|
2302
2302
|
/**
|
@@ -2393,6 +2393,10 @@ export namespace Components {
|
|
2393
2393
|
* @returns a promise which resolves when complete
|
2394
2394
|
*/
|
2395
2395
|
"addSort": (column: TableTypes.Prop, order: TableTypes.Order) => Promise<void>;
|
2396
|
+
/**
|
2397
|
+
* @readonly - shows the currently applied filters
|
2398
|
+
*/
|
2399
|
+
"appliedFilters": Filter[];
|
2396
2400
|
/**
|
2397
2401
|
* The number of total blocks currently rendered in the table. @readonly
|
2398
2402
|
*/
|
@@ -2406,11 +2410,15 @@ export namespace Components {
|
|
2406
2410
|
*/
|
2407
2411
|
"columns": TableTypes.NanoTable<any>['columns'];
|
2408
2412
|
/**
|
2409
|
-
* A custom filtering function. Should return a promise. If the promise resolves as `true` the column UI will be updated. If the promise resolves as
|
2413
|
+
* A custom filtering function. Should return a promise. If the promise resolves as `true` the column UI will be updated. If the promise resolves as falsy, the sort will be performed by the component. A good use-case would be performing the filter on a server / via fetch. Then on success, updating the table's data via the `rows` property
|
2410
2414
|
*/
|
2411
2415
|
"customFilterFn"?: (
|
2412
2416
|
filters: TableTypes.Filter[]
|
2413
2417
|
) => Promise<true | TableTypes.Falsy>;
|
2418
|
+
/**
|
2419
|
+
* Function called whenever `col.cellTemplate` renders an unknown object. The function should render a valid HTMLElement to the cell arg. Example usage - render JSX from a 3rd party lib and append the result to the cell element.
|
2420
|
+
*/
|
2421
|
+
"customRenderer": (node: any, cell: HTMLElement) => void;
|
2414
2422
|
/**
|
2415
2423
|
* A custom sorting function. Should return a promise. If the promise resolves as `true` the column UI will be updated. If the promise resolves as falsey, the sort will be performed by the component. A good use-case would be performing the sort on a server / via fetch. Then on success, updating the table's data via the `rows` property
|
2416
2424
|
*/
|
@@ -2430,9 +2438,8 @@ export namespace Components {
|
|
2430
2438
|
* Used for custom thead row rendering
|
2431
2439
|
*/
|
2432
2440
|
"headRender": TableTypes.HeadFootRenderer;
|
2433
|
-
"jsxRenderer": TableTypes.HFunc<any>;
|
2434
2441
|
/**
|
2435
|
-
* Will show a loading state when set to true. By default, will be shown automatically if `rows` is a promise waiting to resolve or when performing custom filtering or sorting. *Note* when set manually, will overwrite any internal loading state. Set to 'undefined' to revert to default behaviour.
|
2442
|
+
* Will show a loading state when set to true. By default, will be shown automatically if `rows` is a promise waiting to resolve / or falsy *or* when performing custom filtering or sorting. *Note* when set manually, will overwrite any internal loading state. Set to 'undefined' to revert to default behaviour.
|
2436
2443
|
*/
|
2437
2444
|
"loading": boolean;
|
2438
2445
|
/**
|
@@ -2486,7 +2493,7 @@ export namespace Components {
|
|
2486
2493
|
"type": 'grid' | 'table';
|
2487
2494
|
/**
|
2488
2495
|
* Updates a row model at a given index
|
2489
|
-
* @param row - the row to update.
|
2496
|
+
* @param row - the row to update.
|
2490
2497
|
* @param rowIndex - the row index to insert this row
|
2491
2498
|
*/
|
2492
2499
|
"updateRow": (row: TableTypes.RowData, rowIndex: number) => Promise<void>;
|
@@ -5198,6 +5205,10 @@ declare namespace LocalJSX {
|
|
5198
5205
|
* Fire `nanoResizeContentFitChange` events notifying whether content currently fits or does not on the x, y or both axis'. Also makes the `content-fit-...` slots available
|
5199
5206
|
*/
|
5200
5207
|
"notifyContentFit"?: 'x' | 'y' | 'xy';
|
5208
|
+
/**
|
5209
|
+
* Fires after any resizing
|
5210
|
+
*/
|
5211
|
+
"onNanoResize"?: (event: NanoResizeObserveCustomEvent<ResizeObserverEntry[]>) => void;
|
5201
5212
|
/**
|
5202
5213
|
* Fires when the content either begins or stops fitting. Will only work when `notifyContentFit` is set.
|
5203
5214
|
*/
|
@@ -5679,9 +5690,9 @@ declare namespace LocalJSX {
|
|
5679
5690
|
*/
|
5680
5691
|
"scrollParent"?: HTMLElement | Document;
|
5681
5692
|
/**
|
5682
|
-
* Upon being stuck, attach the sticker to another sticker element.
|
5693
|
+
* Upon being stuck, attach the sticker to another sticker element. JS query selector string or DOM element pointing to a `<nano-sticker>`
|
5683
5694
|
*/
|
5684
|
-
"stickTo"?: string;
|
5695
|
+
"stickTo"?: string | HTMLNanoStickerElement;
|
5685
5696
|
}
|
5686
5697
|
interface NanoTab {
|
5687
5698
|
/**
|
@@ -5774,6 +5785,10 @@ declare namespace LocalJSX {
|
|
5774
5785
|
* - Add custom properties at every level
|
5775
5786
|
*/
|
5776
5787
|
interface NanoTable {
|
5788
|
+
/**
|
5789
|
+
* @readonly - shows the currently applied filters
|
5790
|
+
*/
|
5791
|
+
"appliedFilters"?: Filter[];
|
5777
5792
|
/**
|
5778
5793
|
* The number of total blocks currently rendered in the table. @readonly
|
5779
5794
|
*/
|
@@ -5787,11 +5802,15 @@ declare namespace LocalJSX {
|
|
5787
5802
|
*/
|
5788
5803
|
"columns"?: TableTypes.NanoTable<any>['columns'];
|
5789
5804
|
/**
|
5790
|
-
* A custom filtering function. Should return a promise. If the promise resolves as `true` the column UI will be updated. If the promise resolves as
|
5805
|
+
* A custom filtering function. Should return a promise. If the promise resolves as `true` the column UI will be updated. If the promise resolves as falsy, the sort will be performed by the component. A good use-case would be performing the filter on a server / via fetch. Then on success, updating the table's data via the `rows` property
|
5791
5806
|
*/
|
5792
5807
|
"customFilterFn"?: (
|
5793
5808
|
filters: TableTypes.Filter[]
|
5794
5809
|
) => Promise<true | TableTypes.Falsy>;
|
5810
|
+
/**
|
5811
|
+
* Function called whenever `col.cellTemplate` renders an unknown object. The function should render a valid HTMLElement to the cell arg. Example usage - render JSX from a 3rd party lib and append the result to the cell element.
|
5812
|
+
*/
|
5813
|
+
"customRenderer"?: (node: any, cell: HTMLElement) => void;
|
5795
5814
|
/**
|
5796
5815
|
* A custom sorting function. Should return a promise. If the promise resolves as `true` the column UI will be updated. If the promise resolves as falsey, the sort will be performed by the component. A good use-case would be performing the sort on a server / via fetch. Then on success, updating the table's data via the `rows` property
|
5797
5816
|
*/
|
@@ -5811,9 +5830,8 @@ declare namespace LocalJSX {
|
|
5811
5830
|
* Used for custom thead row rendering
|
5812
5831
|
*/
|
5813
5832
|
"headRender"?: TableTypes.HeadFootRenderer;
|
5814
|
-
"jsxRenderer"?: TableTypes.HFunc<any>;
|
5815
5833
|
/**
|
5816
|
-
* Will show a loading state when set to true. By default, will be shown automatically if `rows` is a promise waiting to resolve or when performing custom filtering or sorting. *Note* when set manually, will overwrite any internal loading state. Set to 'undefined' to revert to default behaviour.
|
5834
|
+
* Will show a loading state when set to true. By default, will be shown automatically if `rows` is a promise waiting to resolve / or falsy *or* when performing custom filtering or sorting. *Note* when set manually, will overwrite any internal loading state. Set to 'undefined' to revert to default behaviour.
|
5817
5835
|
*/
|
5818
5836
|
"loading"?: boolean;
|
5819
5837
|
/**
|