@nova-design-system/nova-webcomponents 3.0.0-beta.27 → 3.0.0-beta.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.MD +61 -108
- package/dist/blazor-docs.json +1305 -194
- package/dist/cjs/index-c50face0.js +48 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/native.cjs.js +1 -1
- package/dist/cjs/nv-datagrid.cjs.entry.js +3226 -0
- package/dist/cjs/nv-datagrid.cjs.entry.js.map +1 -0
- package/dist/cjs/nv-datagridbody.cjs.entry.js +24 -0
- package/dist/cjs/nv-datagridbody.cjs.entry.js.map +1 -0
- package/dist/cjs/nv-datagridcolumn.cjs.entry.js +27 -0
- package/dist/cjs/nv-datagridcolumn.cjs.entry.js.map +1 -0
- package/dist/cjs/nv-datagriddatacell.cjs.entry.js +26 -0
- package/dist/cjs/nv-datagriddatacell.cjs.entry.js.map +1 -0
- package/dist/cjs/nv-datagridhead.cjs.entry.js +24 -0
- package/dist/cjs/nv-datagridhead.cjs.entry.js.map +1 -0
- package/dist/cjs/nv-datagridrow.cjs.entry.js +24 -0
- package/dist/cjs/nv-datagridrow.cjs.entry.js.map +1 -0
- package/dist/cjs/nv-fieldcheckbox.cjs.entry.js +4 -4
- package/dist/cjs/nv-fielddropdown.cjs.entry.js +3 -3
- package/dist/cjs/nv-fielddropdownitem.cjs.entry.js +1 -1
- package/dist/cjs/nv-fieldnumber.cjs.entry.js +3 -3
- package/dist/cjs/nv-fieldnumber.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldpassword.cjs.entry.js +3 -3
- package/dist/cjs/nv-fieldpassword.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldradio.cjs.entry.js +3 -3
- package/dist/cjs/nv-fieldradio.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldselect.cjs.entry.js +5 -5
- package/dist/cjs/nv-fieldselect.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldtext.cjs.entry.js +3 -3
- package/dist/cjs/nv-fieldtextarea.cjs.entry.js +4 -4
- package/dist/cjs/nv-fieldtextarea.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-fieldtoggle.cjs.entry.js +8 -4
- package/dist/cjs/nv-fieldtoggle.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-icon.cjs.entry.js +1 -1
- package/dist/cjs/nv-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-iconbutton.cjs.entry.js +1 -1
- package/dist/cjs/nv-iconbutton.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-loader.cjs.entry.js +1 -1
- package/dist/cjs/nv-loader.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-menu.cjs.entry.js +1 -1
- package/dist/cjs/nv-menuitem.cjs.entry.js +1 -1
- package/dist/cjs/nv-menuitem.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-popover.cjs.entry.js +1 -1
- package/dist/cjs/nv-popover.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-row.cjs.entry.js +1 -1
- package/dist/cjs/nv-row.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-stack.cjs.entry.js +1 -1
- package/dist/cjs/nv-stack.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-table.cjs.entry.js +134 -0
- package/dist/cjs/nv-table.cjs.entry.js.map +1 -0
- package/dist/cjs/nv-tablebody.cjs.entry.js +24 -0
- package/dist/cjs/nv-tablebody.cjs.entry.js.map +1 -0
- package/dist/cjs/nv-tablecolumn.cjs.entry.js +30 -0
- package/dist/cjs/nv-tablecolumn.cjs.entry.js.map +1 -0
- package/dist/cjs/nv-tabledatacell.cjs.entry.js +28 -0
- package/dist/cjs/nv-tabledatacell.cjs.entry.js.map +1 -0
- package/dist/cjs/nv-tablehead.cjs.entry.js +24 -0
- package/dist/cjs/nv-tablehead.cjs.entry.js.map +1 -0
- package/dist/cjs/nv-tablerow.cjs.entry.js +24 -0
- package/dist/cjs/nv-tablerow.cjs.entry.js.map +1 -0
- package/dist/cjs/nv-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/nv-tooltip.cjs.entry.js.map +1 -1
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/nv-datagrid/nv-datagrid.css +5 -0
- package/dist/collection/components/nv-datagrid/nv-datagrid.docs.js +225 -0
- package/dist/collection/components/nv-datagrid/nv-datagrid.docs.js.map +1 -0
- package/dist/collection/components/nv-datagrid/nv-datagrid.js +441 -0
- package/dist/collection/components/nv-datagrid/nv-datagrid.js.map +1 -0
- package/dist/collection/components/nv-datagridbody/nv-datagridbody.css +0 -0
- package/dist/collection/components/nv-datagridbody/nv-datagridbody.docs.js +8 -0
- package/dist/collection/components/nv-datagridbody/nv-datagridbody.docs.js.map +1 -0
- package/dist/collection/components/nv-datagridbody/nv-datagridbody.js +23 -0
- package/dist/collection/components/nv-datagridbody/nv-datagridbody.js.map +1 -0
- package/dist/collection/components/nv-datagridcolumn/nv-datagridcolumn.css +0 -0
- package/dist/collection/components/nv-datagridcolumn/nv-datagridcolumn.docs.js +6 -0
- package/dist/collection/components/nv-datagridcolumn/nv-datagridcolumn.docs.js.map +1 -0
- package/dist/collection/components/nv-datagridcolumn/nv-datagridcolumn.js +66 -0
- package/dist/collection/components/nv-datagridcolumn/nv-datagridcolumn.js.map +1 -0
- package/dist/collection/components/nv-datagriddatacell/nv-datagriddatacell.css +0 -0
- package/dist/collection/components/nv-datagriddatacell/nv-datagriddatacell.docs.js +6 -0
- package/dist/collection/components/nv-datagriddatacell/nv-datagriddatacell.docs.js.map +1 -0
- package/dist/collection/components/nv-datagriddatacell/nv-datagriddatacell.js +51 -0
- package/dist/collection/components/nv-datagriddatacell/nv-datagriddatacell.js.map +1 -0
- package/dist/collection/components/nv-datagridhead/nv-datagridhead.css +0 -0
- package/dist/collection/components/nv-datagridhead/nv-datagridhead.docs.js +8 -0
- package/dist/collection/components/nv-datagridhead/nv-datagridhead.docs.js.map +1 -0
- package/dist/collection/components/nv-datagridhead/nv-datagridhead.js +23 -0
- package/dist/collection/components/nv-datagridhead/nv-datagridhead.js.map +1 -0
- package/dist/collection/components/nv-datagridrow/nv-datagridrow.css +0 -0
- package/dist/collection/components/nv-datagridrow/nv-datagridrow.docs.js +8 -0
- package/dist/collection/components/nv-datagridrow/nv-datagridrow.docs.js.map +1 -0
- package/dist/collection/components/nv-datagridrow/nv-datagridrow.js +23 -0
- package/dist/collection/components/nv-datagridrow/nv-datagridrow.js.map +1 -0
- package/dist/collection/components/nv-fieldcheckbox/nv-fieldcheckbox.js +4 -4
- package/dist/collection/components/nv-fielddropdown/nv-fielddropdown.js +3 -3
- package/dist/collection/components/nv-fielddropdownitem/DropdownItemSelectedEventDetail.js.map +1 -1
- package/dist/collection/components/nv-fielddropdownitem/nv-fielddropdownitem.js +1 -1
- package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.js +3 -3
- package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.js.map +1 -1
- package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.js +3 -3
- package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.js.map +1 -1
- package/dist/collection/components/nv-fieldradio/nv-fieldradio.js +3 -3
- package/dist/collection/components/nv-fieldradio/nv-fieldradio.js.map +1 -1
- package/dist/collection/components/nv-fieldselect/nv-fieldselect.js +5 -5
- package/dist/collection/components/nv-fieldselect/nv-fieldselect.js.map +1 -1
- package/dist/collection/components/nv-fieldtext/nv-fieldtext.js +3 -3
- package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.js +7 -7
- package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.js.map +1 -1
- package/dist/collection/components/nv-fieldtoggle/nv-fieldtoggle.js +8 -4
- package/dist/collection/components/nv-fieldtoggle/nv-fieldtoggle.js.map +1 -1
- package/dist/collection/components/nv-icon/nv-icon.js +1 -1
- package/dist/collection/components/nv-icon/nv-icon.js.map +1 -1
- package/dist/collection/components/nv-iconbutton/nv-iconbutton.js +1 -1
- package/dist/collection/components/nv-iconbutton/nv-iconbutton.js.map +1 -1
- package/dist/collection/components/nv-loader/nv-loader.js +1 -1
- package/dist/collection/components/nv-loader/nv-loader.js.map +1 -1
- package/dist/collection/components/nv-menu/nv-menu.js +1 -1
- package/dist/collection/components/nv-menuitem/nv-menuitem.js +1 -1
- package/dist/collection/components/nv-menuitem/nv-menuitem.js.map +1 -1
- package/dist/collection/components/nv-popover/nv-popover.js +1 -1
- package/dist/collection/components/nv-popover/nv-popover.js.map +1 -1
- package/dist/collection/components/nv-row/nv-row.js +1 -1
- package/dist/collection/components/nv-row/nv-row.js.map +1 -1
- package/dist/collection/components/nv-stack/nv-stack.js +1 -1
- package/dist/collection/components/nv-stack/nv-stack.js.map +1 -1
- package/dist/collection/components/nv-table/nv-table.css +5 -0
- package/dist/collection/components/nv-table/nv-table.docs.js +178 -0
- package/dist/collection/components/nv-table/nv-table.docs.js.map +1 -0
- package/dist/collection/components/nv-table/nv-table.js +287 -0
- package/dist/collection/components/nv-table/nv-table.js.map +1 -0
- package/dist/collection/components/nv-tablebody/nv-tablebody.css +0 -0
- package/dist/collection/components/nv-tablebody/nv-tablebody.docs.js +8 -0
- package/dist/collection/components/nv-tablebody/nv-tablebody.docs.js.map +1 -0
- package/dist/collection/components/nv-tablebody/nv-tablebody.js +23 -0
- package/dist/collection/components/nv-tablebody/nv-tablebody.js.map +1 -0
- package/dist/collection/components/nv-tablecolumn/nv-tablecolumn.css +0 -0
- package/dist/collection/components/nv-tablecolumn/nv-tablecolumn.docs.js +6 -0
- package/dist/collection/components/nv-tablecolumn/nv-tablecolumn.docs.js.map +1 -0
- package/dist/collection/components/nv-tablecolumn/nv-tablecolumn.js +131 -0
- package/dist/collection/components/nv-tablecolumn/nv-tablecolumn.js.map +1 -0
- package/dist/collection/components/nv-tabledatacell/nv-tabledatacell.css +0 -0
- package/dist/collection/components/nv-tabledatacell/nv-tabledatacell.docs.js +6 -0
- package/dist/collection/components/nv-tabledatacell/nv-tabledatacell.docs.js.map +1 -0
- package/dist/collection/components/nv-tabledatacell/nv-tabledatacell.js +95 -0
- package/dist/collection/components/nv-tabledatacell/nv-tabledatacell.js.map +1 -0
- package/dist/collection/components/nv-tablehead/nv-tablehead.css +0 -0
- package/dist/collection/components/nv-tablehead/nv-tablehead.docs.js +8 -0
- package/dist/collection/components/nv-tablehead/nv-tablehead.docs.js.map +1 -0
- package/dist/collection/components/nv-tablehead/nv-tablehead.js +23 -0
- package/dist/collection/components/nv-tablehead/nv-tablehead.js.map +1 -0
- package/dist/collection/components/nv-tablerow/nv-tablerow.css +0 -0
- package/dist/collection/components/nv-tablerow/nv-tablerow.docs.js +8 -0
- package/dist/collection/components/nv-tablerow/nv-tablerow.docs.js.map +1 -0
- package/dist/collection/components/nv-tablerow/nv-tablerow.js +23 -0
- package/dist/collection/components/nv-tablerow/nv-tablerow.js.map +1 -0
- package/dist/collection/components/nv-tooltip/nv-tooltip.js +1 -1
- package/dist/collection/components/nv-tooltip/nv-tooltip.js.map +1 -1
- package/dist/collection/interfaces/Column.js +2 -0
- package/dist/collection/interfaces/Column.js.map +1 -0
- package/dist/components/nv-alert.js +1 -1
- package/dist/components/nv-avatar.js +1 -1
- package/dist/components/nv-badge.js +1 -1
- package/dist/components/nv-button.js +1 -1
- package/dist/components/nv-datagrid.d.ts +11 -0
- package/dist/components/nv-datagrid.js +3259 -0
- package/dist/components/nv-datagrid.js.map +1 -0
- package/dist/components/nv-datagridbody.d.ts +11 -0
- package/dist/components/nv-datagridbody.js +38 -0
- package/dist/components/nv-datagridbody.js.map +1 -0
- package/dist/components/nv-datagridcolumn.d.ts +11 -0
- package/dist/components/nv-datagridcolumn.js +44 -0
- package/dist/components/nv-datagridcolumn.js.map +1 -0
- package/dist/components/nv-datagriddatacell.d.ts +11 -0
- package/dist/components/nv-datagriddatacell.js +42 -0
- package/dist/components/nv-datagriddatacell.js.map +1 -0
- package/dist/components/nv-datagridhead.d.ts +11 -0
- package/dist/components/nv-datagridhead.js +38 -0
- package/dist/components/nv-datagridhead.js.map +1 -0
- package/dist/components/nv-datagridrow.d.ts +11 -0
- package/dist/components/nv-datagridrow.js +38 -0
- package/dist/components/nv-datagridrow.js.map +1 -0
- package/dist/components/nv-fieldcheckbox.js +4 -4
- package/dist/components/nv-fielddropdown.js +8 -8
- package/dist/components/nv-fielddropdownitem.js +1 -1
- package/dist/components/nv-fieldnumber.js +4 -4
- package/dist/components/nv-fieldnumber.js.map +1 -1
- package/dist/components/nv-fieldpassword.js +6 -6
- package/dist/components/nv-fieldpassword.js.map +1 -1
- package/dist/components/nv-fieldradio.js +3 -3
- package/dist/components/nv-fieldradio.js.map +1 -1
- package/dist/components/nv-fieldselect.js +6 -6
- package/dist/components/nv-fieldselect.js.map +1 -1
- package/dist/components/nv-fieldtext.js +4 -4
- package/dist/components/nv-fieldtextarea.js +5 -5
- package/dist/components/nv-fieldtextarea.js.map +1 -1
- package/dist/components/nv-fieldtoggle.js +8 -4
- package/dist/components/nv-fieldtoggle.js.map +1 -1
- package/dist/components/nv-icon.js +1 -1
- package/dist/components/nv-iconbutton.js +1 -1
- package/dist/components/nv-loader.js +1 -1
- package/dist/components/nv-menu.js +2 -2
- package/dist/components/nv-menuitem.js +2 -2
- package/dist/components/nv-menuitem.js.map +1 -1
- package/dist/components/nv-popover.js +1 -1
- package/dist/components/nv-row.js +1 -1
- package/dist/components/nv-row.js.map +1 -1
- package/dist/components/nv-stack.js +1 -1
- package/dist/components/nv-stack.js.map +1 -1
- package/dist/components/nv-table.d.ts +11 -0
- package/dist/components/nv-table.js +164 -0
- package/dist/components/nv-table.js.map +1 -0
- package/dist/components/nv-tablebody.d.ts +11 -0
- package/dist/components/nv-tablebody.js +38 -0
- package/dist/components/nv-tablebody.js.map +1 -0
- package/dist/components/nv-tablecolumn.d.ts +11 -0
- package/dist/components/nv-tablecolumn.js +50 -0
- package/dist/components/nv-tablecolumn.js.map +1 -0
- package/dist/components/nv-tabledatacell.d.ts +11 -0
- package/dist/components/nv-tabledatacell.js +46 -0
- package/dist/components/nv-tabledatacell.js.map +1 -0
- package/dist/components/nv-tablehead.d.ts +11 -0
- package/dist/components/nv-tablehead.js +38 -0
- package/dist/components/nv-tablehead.js.map +1 -0
- package/dist/components/nv-tablerow.d.ts +11 -0
- package/dist/components/nv-tablerow.js +38 -0
- package/dist/components/nv-tablerow.js.map +1 -0
- package/dist/components/nv-tooltip.js +2 -2
- package/dist/components/nv-tooltip.js.map +1 -1
- package/dist/components/{p-76eb28db.js → p-45405075.js} +3 -3
- package/dist/components/{p-76eb28db.js.map → p-45405075.js.map} +1 -1
- package/dist/components/{p-9647924f.js → p-45c63143.js} +4 -4
- package/dist/components/{p-9647924f.js.map → p-45c63143.js.map} +1 -1
- package/dist/components/{p-9be1ebd4.js → p-689a7b38.js} +2 -2
- package/dist/components/{p-9be1ebd4.js.map → p-689a7b38.js.map} +1 -1
- package/dist/components/{p-ff97f99e.js → p-89fb6636.js} +2 -2
- package/dist/components/{p-ff97f99e.js.map → p-89fb6636.js.map} +1 -1
- package/dist/components/{p-69cc7819.js → p-8c8cf8ea.js} +2 -2
- package/dist/components/{p-69cc7819.js.map → p-8c8cf8ea.js.map} +1 -1
- package/dist/docs.json +1322 -278
- package/dist/esm/index-e7b35c14.js +48 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/native.js +1 -1
- package/dist/esm/nv-datagrid.entry.js +3222 -0
- package/dist/esm/nv-datagrid.entry.js.map +1 -0
- package/dist/esm/nv-datagridbody.entry.js +20 -0
- package/dist/esm/nv-datagridbody.entry.js.map +1 -0
- package/dist/esm/nv-datagridcolumn.entry.js +23 -0
- package/dist/esm/nv-datagridcolumn.entry.js.map +1 -0
- package/dist/esm/nv-datagriddatacell.entry.js +22 -0
- package/dist/esm/nv-datagriddatacell.entry.js.map +1 -0
- package/dist/esm/nv-datagridhead.entry.js +20 -0
- package/dist/esm/nv-datagridhead.entry.js.map +1 -0
- package/dist/esm/nv-datagridrow.entry.js +20 -0
- package/dist/esm/nv-datagridrow.entry.js.map +1 -0
- package/dist/esm/nv-fieldcheckbox.entry.js +4 -4
- package/dist/esm/nv-fielddropdown.entry.js +3 -3
- package/dist/esm/nv-fielddropdownitem.entry.js +1 -1
- package/dist/esm/nv-fieldnumber.entry.js +3 -3
- package/dist/esm/nv-fieldnumber.entry.js.map +1 -1
- package/dist/esm/nv-fieldpassword.entry.js +3 -3
- package/dist/esm/nv-fieldpassword.entry.js.map +1 -1
- package/dist/esm/nv-fieldradio.entry.js +3 -3
- package/dist/esm/nv-fieldradio.entry.js.map +1 -1
- package/dist/esm/nv-fieldselect.entry.js +5 -5
- package/dist/esm/nv-fieldselect.entry.js.map +1 -1
- package/dist/esm/nv-fieldtext.entry.js +3 -3
- package/dist/esm/nv-fieldtextarea.entry.js +4 -4
- package/dist/esm/nv-fieldtextarea.entry.js.map +1 -1
- package/dist/esm/nv-fieldtoggle.entry.js +8 -4
- package/dist/esm/nv-fieldtoggle.entry.js.map +1 -1
- package/dist/esm/nv-icon.entry.js +1 -1
- package/dist/esm/nv-icon.entry.js.map +1 -1
- package/dist/esm/nv-iconbutton.entry.js +1 -1
- package/dist/esm/nv-iconbutton.entry.js.map +1 -1
- package/dist/esm/nv-loader.entry.js +1 -1
- package/dist/esm/nv-loader.entry.js.map +1 -1
- package/dist/esm/nv-menu.entry.js +1 -1
- package/dist/esm/nv-menuitem.entry.js +1 -1
- package/dist/esm/nv-menuitem.entry.js.map +1 -1
- package/dist/esm/nv-popover.entry.js +1 -1
- package/dist/esm/nv-popover.entry.js.map +1 -1
- package/dist/esm/nv-row.entry.js +1 -1
- package/dist/esm/nv-row.entry.js.map +1 -1
- package/dist/esm/nv-stack.entry.js +1 -1
- package/dist/esm/nv-stack.entry.js.map +1 -1
- package/dist/esm/nv-table.entry.js +130 -0
- package/dist/esm/nv-table.entry.js.map +1 -0
- package/dist/esm/nv-tablebody.entry.js +20 -0
- package/dist/esm/nv-tablebody.entry.js.map +1 -0
- package/dist/esm/nv-tablecolumn.entry.js +26 -0
- package/dist/esm/nv-tablecolumn.entry.js.map +1 -0
- package/dist/esm/nv-tabledatacell.entry.js +24 -0
- package/dist/esm/nv-tabledatacell.entry.js.map +1 -0
- package/dist/esm/nv-tablehead.entry.js +20 -0
- package/dist/esm/nv-tablehead.entry.js.map +1 -0
- package/dist/esm/nv-tablerow.entry.js +20 -0
- package/dist/esm/nv-tablerow.entry.js.map +1 -0
- package/dist/esm/nv-tooltip.entry.js +1 -1
- package/dist/esm/nv-tooltip.entry.js.map +1 -1
- package/dist/native/native.css +1 -1
- package/dist/native/native.esm.js +1 -1
- package/dist/native/native.esm.js.map +1 -1
- package/dist/native/p-01be802d.entry.js +2 -0
- package/dist/native/p-01be802d.entry.js.map +1 -0
- package/dist/native/{p-71fbdb92.entry.js → p-0cfe2048.entry.js} +2 -2
- package/dist/native/{p-71fbdb92.entry.js.map → p-0cfe2048.entry.js.map} +1 -1
- package/dist/native/{p-4a43953f.entry.js → p-13070761.entry.js} +2 -2
- package/dist/native/{p-000749ae.entry.js → p-1edb76e1.entry.js} +2 -2
- package/dist/native/{p-000749ae.entry.js.map → p-1edb76e1.entry.js.map} +1 -1
- package/dist/native/{p-c16a4fbe.entry.js → p-20c7fc4d.entry.js} +2 -2
- package/dist/native/p-20c7fc4d.entry.js.map +1 -0
- package/dist/native/p-28cf537b.entry.js +2 -0
- package/dist/native/{p-4b550f95.entry.js.map → p-28cf537b.entry.js.map} +1 -1
- package/dist/native/p-36d5158c.entry.js +13 -0
- package/dist/native/p-36d5158c.entry.js.map +1 -0
- package/dist/native/{p-396b65bb.entry.js → p-38817aa3.entry.js} +2 -2
- package/dist/native/{p-396b65bb.entry.js.map → p-38817aa3.entry.js.map} +1 -1
- package/dist/native/{p-bb243eaf.entry.js → p-39dbb15b.entry.js} +2 -2
- package/dist/native/p-4b926563.entry.js +2 -0
- package/dist/native/p-4b926563.entry.js.map +1 -0
- package/dist/native/{p-d5c24d8f.entry.js → p-4e351d8e.entry.js} +2 -2
- package/dist/native/p-671699bf.entry.js +2 -0
- package/dist/native/p-671699bf.entry.js.map +1 -0
- package/dist/native/{p-25e1bc94.entry.js → p-75b5fdce.entry.js} +2 -2
- package/dist/native/{p-25e1bc94.entry.js.map → p-75b5fdce.entry.js.map} +1 -1
- package/dist/native/p-7a7b9b95.entry.js +2 -0
- package/dist/native/p-7a7b9b95.entry.js.map +1 -0
- package/dist/native/{p-5172aa15.entry.js → p-808cf007.entry.js} +2 -2
- package/dist/native/{p-23b20b80.entry.js → p-81256924.entry.js} +2 -2
- package/dist/native/{p-23b20b80.entry.js.map → p-81256924.entry.js.map} +1 -1
- package/dist/native/{p-8de6396f.entry.js → p-844f4878.entry.js} +2 -2
- package/dist/native/{p-8de6396f.entry.js.map → p-844f4878.entry.js.map} +1 -1
- package/dist/native/p-861f91d3.entry.js +2 -0
- package/dist/native/p-861f91d3.entry.js.map +1 -0
- package/dist/native/p-9221f72a.entry.js +2 -0
- package/dist/native/p-9221f72a.entry.js.map +1 -0
- package/dist/native/p-982e474f.entry.js +2 -0
- package/dist/native/p-982e474f.entry.js.map +1 -0
- package/dist/native/p-99850272.entry.js +2 -0
- package/dist/native/p-99850272.entry.js.map +1 -0
- package/dist/native/{p-d4e0b6e1.entry.js → p-bdab3562.entry.js} +2 -2
- package/dist/native/{p-4fae1b2c.entry.js → p-c1c661a0.entry.js} +2 -2
- package/dist/native/p-c1c661a0.entry.js.map +1 -0
- package/dist/native/{p-89468485.entry.js → p-c4f7e36d.entry.js} +2 -2
- package/dist/native/{p-89468485.entry.js.map → p-c4f7e36d.entry.js.map} +1 -1
- package/dist/native/{p-20ea1b61.entry.js → p-dba9c57c.entry.js} +2 -2
- package/dist/native/{p-20ea1b61.entry.js.map → p-dba9c57c.entry.js.map} +1 -1
- package/dist/native/p-dbae3920.entry.js +2 -0
- package/dist/native/{p-0d335326.entry.js.map → p-dbae3920.entry.js.map} +1 -1
- package/dist/native/p-de6e0e1f.entry.js +2 -0
- package/dist/native/p-de6e0e1f.entry.js.map +1 -0
- package/dist/native/{p-aeaa326f.entry.js → p-e2df46e2.entry.js} +2 -2
- package/dist/native/{p-aeaa326f.entry.js.map → p-e2df46e2.entry.js.map} +1 -1
- package/dist/native/p-e842220b.entry.js +2 -0
- package/dist/native/p-e842220b.entry.js.map +1 -0
- package/dist/native/{p-a016e4b6.entry.js → p-ea4092a7.entry.js} +2 -2
- package/dist/native/{p-a016e4b6.entry.js.map → p-ea4092a7.entry.js.map} +1 -1
- package/dist/native/p-f7b96c42.entry.js +2 -0
- package/dist/native/p-f7b96c42.entry.js.map +1 -0
- package/dist/types/components/nv-datagrid/nv-datagrid.d.ts +87 -0
- package/dist/types/components/nv-datagrid/nv-datagrid.docs.d.ts +4 -0
- package/dist/types/components/nv-datagridbody/nv-datagridbody.d.ts +7 -0
- package/dist/types/components/nv-datagridbody/nv-datagridbody.docs.d.ts +4 -0
- package/dist/types/components/nv-datagridcolumn/nv-datagridcolumn.d.ts +16 -0
- package/dist/types/components/nv-datagridcolumn/nv-datagridcolumn.docs.d.ts +4 -0
- package/dist/types/components/nv-datagriddatacell/nv-datagriddatacell.d.ts +14 -0
- package/dist/types/components/nv-datagriddatacell/nv-datagriddatacell.docs.d.ts +4 -0
- package/dist/types/components/nv-datagridhead/nv-datagridhead.d.ts +7 -0
- package/dist/types/components/nv-datagridhead/nv-datagridhead.docs.d.ts +4 -0
- package/dist/types/components/nv-datagridrow/nv-datagridrow.d.ts +7 -0
- package/dist/types/components/nv-datagridrow/nv-datagridrow.docs.d.ts +4 -0
- package/dist/types/components/nv-fielddropdownitem/DropdownItemSelectedEventDetail.d.ts +12 -0
- package/dist/types/components/nv-fieldtextarea/nv-fieldtextarea.d.ts +2 -2
- package/dist/types/components/nv-fieldtoggle/nv-fieldtoggle.d.ts +4 -4
- package/dist/types/components/nv-menuitem/nv-menuitem.d.ts +3 -0
- package/dist/types/components/nv-table/nv-table.d.ts +72 -0
- package/dist/types/components/nv-table/nv-table.docs.d.ts +4 -0
- package/dist/types/components/nv-tablebody/nv-tablebody.d.ts +7 -0
- package/dist/types/components/nv-tablebody/nv-tablebody.docs.d.ts +4 -0
- package/dist/types/components/nv-tablecolumn/nv-tablecolumn.d.ts +51 -0
- package/dist/types/components/nv-tablecolumn/nv-tablecolumn.docs.d.ts +4 -0
- package/dist/types/components/nv-tabledatacell/nv-tabledatacell.d.ts +30 -0
- package/dist/types/components/nv-tabledatacell/nv-tabledatacell.docs.d.ts +4 -0
- package/dist/types/components/nv-tablehead/nv-tablehead.d.ts +7 -0
- package/dist/types/components/nv-tablehead/nv-tablehead.docs.d.ts +4 -0
- package/dist/types/components/nv-tablerow/nv-tablerow.d.ts +7 -0
- package/dist/types/components/nv-tablerow/nv-tablerow.docs.d.ts +4 -0
- package/dist/types/components.d.ts +408 -8
- package/dist/types/interfaces/Column.d.ts +13 -0
- package/dist/types/nova-docs.d.ts +18 -0
- package/dist/vscode-data.json +3659 -0
- package/hydrate/index.js +3746 -44
- package/hydrate/index.mjs +3746 -44
- package/package.json +1 -1
- package/dist/native/p-0d335326.entry.js +0 -2
- package/dist/native/p-4b550f95.entry.js +0 -2
- package/dist/native/p-4fae1b2c.entry.js.map +0 -1
- package/dist/native/p-c16a4fbe.entry.js.map +0 -1
- /package/dist/native/{p-4a43953f.entry.js.map → p-13070761.entry.js.map} +0 -0
- /package/dist/native/{p-bb243eaf.entry.js.map → p-39dbb15b.entry.js.map} +0 -0
- /package/dist/native/{p-d5c24d8f.entry.js.map → p-4e351d8e.entry.js.map} +0 -0
- /package/dist/native/{p-5172aa15.entry.js.map → p-808cf007.entry.js.map} +0 -0
- /package/dist/native/{p-d4e0b6e1.entry.js.map → p-bdab3562.entry.js.map} +0 -0
package/hydrate/index.js
CHANGED
|
@@ -2677,9 +2677,9 @@ class NVFieldDropDown {
|
|
|
2677
2677
|
/****************************************************************************/
|
|
2678
2678
|
//#region RENDER
|
|
2679
2679
|
render() {
|
|
2680
|
-
return (hAsync(Host, { key: '
|
|
2681
|
-
this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: '
|
|
2682
|
-
this.el.querySelector('[slot="error-description"]')) && (hAsync("div", { key: '
|
|
2680
|
+
return (hAsync(Host, { key: 'ee220f04cb94b18afa0504938ee269c0edb1d1b5' }, (this.label || this.el.querySelector('[slot="label"]')) && (hAsync("label", { key: '9cf2035bcef627718cb0e9cda9f10d1deb829201', htmlFor: this.inputId }, hAsync("slot", { key: '6fe8d6dadee22c489696fbd94067398f5b22f8a7', name: "label" }, this.label))), hAsync("nv-popover", { key: 'c96697a489ceb13a600f63e1496dcc2cedf6baa7', ref: el => (this.popoverElement = el), triggerMode: "controlled", placement: "bottom-start", open: this.open }, hAsync("div", { key: '0a996e770694e7521e57007f5b3a9272ef9ad485', class: "input-wrapper", slot: "trigger" }, hAsync("slot", { key: '41b6e77ce228cd4aedbffbb440bf375c82e05c30', name: "before-input" }), hAsync("div", { key: 'ffdeba473c57672b13577a225c0b2cc436df2c12', class: "input-container", onClick: this.handleInputContainerClick }, hAsync("slot", { key: '14af93b626704024c44371934cc1b4b49b068ac7', name: "leading-input" }), this.isFilterable || this.disabled || this.readonly ? (hAsync("input", { id: this.inputId, type: "search", ref: e => (this.inputElement = e), autocomplete: this.autocomplete, placeholder: this.placeholder, name: this.name, value: this.value, required: this.required, disabled: this.disabled, readOnly: this.readonly, onInput: this.handleInput, onFocus: this.handleInputFocus, onBlur: this.handleInputBlur, onKeyDown: this.handleKeyDown })) : (hAsync("p", { id: this.inputId, class: "non-filterable-text", onClick: this.handleInputContainerClick, tabIndex: 0, onKeyDown: this.handleKeyDown, onFocus: this.handleInputFocus }, hAsync("span", null, this.value || this.placeholder))), hAsync("nv-iconbutton", { key: '961e3b20bb234ba3c24e8e5389154245ae35fdb9', class: "toggle-dropdown-icon", name: this.open ? 'chevron-top' : 'chevron-down', size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide dropdown' : 'Show dropdown', "aria-pressed": this.open.toString(), onClick: this.togglePopover })), hAsync("slot", { key: '37f6b2288683f0b2e16e553b66e5a534a0d372f6', name: "after-input" })), hAsync("slot", { key: 'd7c7ad38d9f486408858a68c1cba7e9c6ae8788f', name: "content" })), (this.description ||
|
|
2681
|
+
this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: '6a4d137ba434bb2d36bc74b6f4cb442274857716', class: "description" }, hAsync("slot", { key: 'd2e85ddebab03a8a752c0f7558b57f35d2e30b85', name: "description" }, this.description))), (this.errorDescription ||
|
|
2682
|
+
this.el.querySelector('[slot="error-description"]')) && (hAsync("div", { key: 'b05d210c0e0a43ce8bd96849f7556f1accd691fb', hidden: !this.error, class: "error-description" }, hAsync("slot", { key: '7d455d5027589ccad7cdccf5ce0e0cc25a7ac7bd', name: "error-description" }, this.errorDescription)))));
|
|
2683
2683
|
}
|
|
2684
2684
|
static get formAssociated() { return true; }
|
|
2685
2685
|
get el() { return getElement(this); }
|
|
@@ -5479,6 +5479,3391 @@ class NvCol {
|
|
|
5479
5479
|
}; }
|
|
5480
5480
|
}
|
|
5481
5481
|
|
|
5482
|
+
/**
|
|
5483
|
+
* table-core
|
|
5484
|
+
*
|
|
5485
|
+
* Copyright (c) TanStack
|
|
5486
|
+
*
|
|
5487
|
+
* This source code is licensed under the MIT license found in the
|
|
5488
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
5489
|
+
*
|
|
5490
|
+
* @license MIT
|
|
5491
|
+
*/
|
|
5492
|
+
// type Person = {
|
|
5493
|
+
// firstName: string
|
|
5494
|
+
// lastName: string
|
|
5495
|
+
// age: number
|
|
5496
|
+
// visits: number
|
|
5497
|
+
// status: string
|
|
5498
|
+
// progress: number
|
|
5499
|
+
// createdAt: Date
|
|
5500
|
+
// nested: {
|
|
5501
|
+
// foo: [
|
|
5502
|
+
// {
|
|
5503
|
+
// bar: 'bar'
|
|
5504
|
+
// }
|
|
5505
|
+
// ]
|
|
5506
|
+
// bar: { subBar: boolean }[]
|
|
5507
|
+
// baz: {
|
|
5508
|
+
// foo: 'foo'
|
|
5509
|
+
// bar: {
|
|
5510
|
+
// baz: 'baz'
|
|
5511
|
+
// }
|
|
5512
|
+
// }
|
|
5513
|
+
// }
|
|
5514
|
+
// }
|
|
5515
|
+
|
|
5516
|
+
// const test: DeepKeys<Person> = 'nested.foo.0.bar'
|
|
5517
|
+
// const test2: DeepKeys<Person> = 'nested.bar'
|
|
5518
|
+
|
|
5519
|
+
// const helper = createColumnHelper<Person>()
|
|
5520
|
+
|
|
5521
|
+
// helper.accessor('nested.foo', {
|
|
5522
|
+
// cell: info => info.getValue(),
|
|
5523
|
+
// })
|
|
5524
|
+
|
|
5525
|
+
// helper.accessor('nested.foo.0.bar', {
|
|
5526
|
+
// cell: info => info.getValue(),
|
|
5527
|
+
// })
|
|
5528
|
+
|
|
5529
|
+
// helper.accessor('nested.bar', {
|
|
5530
|
+
// cell: info => info.getValue(),
|
|
5531
|
+
// })
|
|
5532
|
+
|
|
5533
|
+
function createColumnHelper() {
|
|
5534
|
+
return {
|
|
5535
|
+
accessor: (accessor, column) => {
|
|
5536
|
+
return typeof accessor === 'function' ? {
|
|
5537
|
+
...column,
|
|
5538
|
+
accessorFn: accessor
|
|
5539
|
+
} : {
|
|
5540
|
+
...column,
|
|
5541
|
+
accessorKey: accessor
|
|
5542
|
+
};
|
|
5543
|
+
},
|
|
5544
|
+
display: column => column,
|
|
5545
|
+
group: column => column
|
|
5546
|
+
};
|
|
5547
|
+
}
|
|
5548
|
+
|
|
5549
|
+
// Is this type a tuple?
|
|
5550
|
+
|
|
5551
|
+
// If this type is a tuple, what indices are allowed?
|
|
5552
|
+
|
|
5553
|
+
///
|
|
5554
|
+
|
|
5555
|
+
function functionalUpdate(updater, input) {
|
|
5556
|
+
return typeof updater === 'function' ? updater(input) : updater;
|
|
5557
|
+
}
|
|
5558
|
+
function makeStateUpdater(key, instance) {
|
|
5559
|
+
return updater => {
|
|
5560
|
+
instance.setState(old => {
|
|
5561
|
+
return {
|
|
5562
|
+
...old,
|
|
5563
|
+
[key]: functionalUpdate(updater, old[key])
|
|
5564
|
+
};
|
|
5565
|
+
});
|
|
5566
|
+
};
|
|
5567
|
+
}
|
|
5568
|
+
function isFunction(d) {
|
|
5569
|
+
return d instanceof Function;
|
|
5570
|
+
}
|
|
5571
|
+
function isNumberArray(d) {
|
|
5572
|
+
return Array.isArray(d) && d.every(val => typeof val === 'number');
|
|
5573
|
+
}
|
|
5574
|
+
function flattenBy(arr, getChildren) {
|
|
5575
|
+
const flat = [];
|
|
5576
|
+
const recurse = subArr => {
|
|
5577
|
+
subArr.forEach(item => {
|
|
5578
|
+
flat.push(item);
|
|
5579
|
+
const children = getChildren(item);
|
|
5580
|
+
if (children != null && children.length) {
|
|
5581
|
+
recurse(children);
|
|
5582
|
+
}
|
|
5583
|
+
});
|
|
5584
|
+
};
|
|
5585
|
+
recurse(arr);
|
|
5586
|
+
return flat;
|
|
5587
|
+
}
|
|
5588
|
+
function memo(getDeps, fn, opts) {
|
|
5589
|
+
let deps = [];
|
|
5590
|
+
let result;
|
|
5591
|
+
return depArgs => {
|
|
5592
|
+
let depTime;
|
|
5593
|
+
if (opts.key && opts.debug) depTime = Date.now();
|
|
5594
|
+
const newDeps = getDeps(depArgs);
|
|
5595
|
+
const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep);
|
|
5596
|
+
if (!depsChanged) {
|
|
5597
|
+
return result;
|
|
5598
|
+
}
|
|
5599
|
+
deps = newDeps;
|
|
5600
|
+
let resultTime;
|
|
5601
|
+
if (opts.key && opts.debug) resultTime = Date.now();
|
|
5602
|
+
result = fn(...newDeps);
|
|
5603
|
+
opts == null || opts.onChange == null || opts.onChange(result);
|
|
5604
|
+
if (opts.key && opts.debug) {
|
|
5605
|
+
if (opts != null && opts.debug()) {
|
|
5606
|
+
const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
|
|
5607
|
+
const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
|
|
5608
|
+
const resultFpsPercentage = resultEndTime / 16;
|
|
5609
|
+
const pad = (str, num) => {
|
|
5610
|
+
str = String(str);
|
|
5611
|
+
while (str.length < num) {
|
|
5612
|
+
str = ' ' + str;
|
|
5613
|
+
}
|
|
5614
|
+
return str;
|
|
5615
|
+
};
|
|
5616
|
+
console.info(`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`, `
|
|
5617
|
+
font-size: .6rem;
|
|
5618
|
+
font-weight: bold;
|
|
5619
|
+
color: hsl(${Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120))}deg 100% 31%);`, opts == null ? void 0 : opts.key);
|
|
5620
|
+
}
|
|
5621
|
+
}
|
|
5622
|
+
return result;
|
|
5623
|
+
};
|
|
5624
|
+
}
|
|
5625
|
+
function getMemoOptions(tableOptions, debugLevel, key, onChange) {
|
|
5626
|
+
return {
|
|
5627
|
+
debug: () => {
|
|
5628
|
+
var _tableOptions$debugAl;
|
|
5629
|
+
return (_tableOptions$debugAl = tableOptions == null ? void 0 : tableOptions.debugAll) != null ? _tableOptions$debugAl : tableOptions[debugLevel];
|
|
5630
|
+
},
|
|
5631
|
+
key: "production" === 'development' ,
|
|
5632
|
+
onChange
|
|
5633
|
+
};
|
|
5634
|
+
}
|
|
5635
|
+
|
|
5636
|
+
function createCell(table, row, column, columnId) {
|
|
5637
|
+
const getRenderValue = () => {
|
|
5638
|
+
var _cell$getValue;
|
|
5639
|
+
return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table.options.renderFallbackValue;
|
|
5640
|
+
};
|
|
5641
|
+
const cell = {
|
|
5642
|
+
id: `${row.id}_${column.id}`,
|
|
5643
|
+
row,
|
|
5644
|
+
column,
|
|
5645
|
+
getValue: () => row.getValue(columnId),
|
|
5646
|
+
renderValue: getRenderValue,
|
|
5647
|
+
getContext: memo(() => [table, column, row, cell], (table, column, row, cell) => ({
|
|
5648
|
+
table,
|
|
5649
|
+
column,
|
|
5650
|
+
row,
|
|
5651
|
+
cell: cell,
|
|
5652
|
+
getValue: cell.getValue,
|
|
5653
|
+
renderValue: cell.renderValue
|
|
5654
|
+
}), getMemoOptions(table.options, 'debugCells'))
|
|
5655
|
+
};
|
|
5656
|
+
table._features.forEach(feature => {
|
|
5657
|
+
feature.createCell == null || feature.createCell(cell, column, row, table);
|
|
5658
|
+
}, {});
|
|
5659
|
+
return cell;
|
|
5660
|
+
}
|
|
5661
|
+
|
|
5662
|
+
function createColumn(table, columnDef, depth, parent) {
|
|
5663
|
+
var _ref, _resolvedColumnDef$id;
|
|
5664
|
+
const defaultColumn = table._getDefaultColumnDef();
|
|
5665
|
+
const resolvedColumnDef = {
|
|
5666
|
+
...defaultColumn,
|
|
5667
|
+
...columnDef
|
|
5668
|
+
};
|
|
5669
|
+
const accessorKey = resolvedColumnDef.accessorKey;
|
|
5670
|
+
let id = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : accessorKey ? typeof String.prototype.replaceAll === 'function' ? accessorKey.replaceAll('.', '_') : accessorKey.replace(/\./g, '_') : undefined) != null ? _ref : typeof resolvedColumnDef.header === 'string' ? resolvedColumnDef.header : undefined;
|
|
5671
|
+
let accessorFn;
|
|
5672
|
+
if (resolvedColumnDef.accessorFn) {
|
|
5673
|
+
accessorFn = resolvedColumnDef.accessorFn;
|
|
5674
|
+
} else if (accessorKey) {
|
|
5675
|
+
// Support deep accessor keys
|
|
5676
|
+
if (accessorKey.includes('.')) {
|
|
5677
|
+
accessorFn = originalRow => {
|
|
5678
|
+
let result = originalRow;
|
|
5679
|
+
for (const key of accessorKey.split('.')) {
|
|
5680
|
+
var _result;
|
|
5681
|
+
result = (_result = result) == null ? void 0 : _result[key];
|
|
5682
|
+
}
|
|
5683
|
+
return result;
|
|
5684
|
+
};
|
|
5685
|
+
} else {
|
|
5686
|
+
accessorFn = originalRow => originalRow[resolvedColumnDef.accessorKey];
|
|
5687
|
+
}
|
|
5688
|
+
}
|
|
5689
|
+
if (!id) {
|
|
5690
|
+
throw new Error();
|
|
5691
|
+
}
|
|
5692
|
+
let column = {
|
|
5693
|
+
id: `${String(id)}`,
|
|
5694
|
+
accessorFn,
|
|
5695
|
+
parent: parent,
|
|
5696
|
+
depth,
|
|
5697
|
+
columnDef: resolvedColumnDef,
|
|
5698
|
+
columns: [],
|
|
5699
|
+
getFlatColumns: memo(() => [true], () => {
|
|
5700
|
+
var _column$columns;
|
|
5701
|
+
return [column, ...((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(d => d.getFlatColumns()))];
|
|
5702
|
+
}, getMemoOptions(table.options, 'debugColumns')),
|
|
5703
|
+
getLeafColumns: memo(() => [table._getOrderColumnsFn()], orderColumns => {
|
|
5704
|
+
var _column$columns2;
|
|
5705
|
+
if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
|
|
5706
|
+
let leafColumns = column.columns.flatMap(column => column.getLeafColumns());
|
|
5707
|
+
return orderColumns(leafColumns);
|
|
5708
|
+
}
|
|
5709
|
+
return [column];
|
|
5710
|
+
}, getMemoOptions(table.options, 'debugColumns'))
|
|
5711
|
+
};
|
|
5712
|
+
for (const feature of table._features) {
|
|
5713
|
+
feature.createColumn == null || feature.createColumn(column, table);
|
|
5714
|
+
}
|
|
5715
|
+
|
|
5716
|
+
// Yes, we have to convert table to unknown, because we know more than the compiler here.
|
|
5717
|
+
return column;
|
|
5718
|
+
}
|
|
5719
|
+
|
|
5720
|
+
const debug = 'debugHeaders';
|
|
5721
|
+
//
|
|
5722
|
+
|
|
5723
|
+
function createHeader(table, column, options) {
|
|
5724
|
+
var _options$id;
|
|
5725
|
+
const id = (_options$id = options.id) != null ? _options$id : column.id;
|
|
5726
|
+
let header = {
|
|
5727
|
+
id,
|
|
5728
|
+
column,
|
|
5729
|
+
index: options.index,
|
|
5730
|
+
isPlaceholder: !!options.isPlaceholder,
|
|
5731
|
+
placeholderId: options.placeholderId,
|
|
5732
|
+
depth: options.depth,
|
|
5733
|
+
subHeaders: [],
|
|
5734
|
+
colSpan: 0,
|
|
5735
|
+
rowSpan: 0,
|
|
5736
|
+
headerGroup: null,
|
|
5737
|
+
getLeafHeaders: () => {
|
|
5738
|
+
const leafHeaders = [];
|
|
5739
|
+
const recurseHeader = h => {
|
|
5740
|
+
if (h.subHeaders && h.subHeaders.length) {
|
|
5741
|
+
h.subHeaders.map(recurseHeader);
|
|
5742
|
+
}
|
|
5743
|
+
leafHeaders.push(h);
|
|
5744
|
+
};
|
|
5745
|
+
recurseHeader(header);
|
|
5746
|
+
return leafHeaders;
|
|
5747
|
+
},
|
|
5748
|
+
getContext: () => ({
|
|
5749
|
+
table,
|
|
5750
|
+
header: header,
|
|
5751
|
+
column
|
|
5752
|
+
})
|
|
5753
|
+
};
|
|
5754
|
+
table._features.forEach(feature => {
|
|
5755
|
+
feature.createHeader == null || feature.createHeader(header, table);
|
|
5756
|
+
});
|
|
5757
|
+
return header;
|
|
5758
|
+
}
|
|
5759
|
+
const Headers = {
|
|
5760
|
+
createTable: table => {
|
|
5761
|
+
// Header Groups
|
|
5762
|
+
|
|
5763
|
+
table.getHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
|
|
5764
|
+
var _left$map$filter, _right$map$filter;
|
|
5765
|
+
const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
|
|
5766
|
+
const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
|
|
5767
|
+
const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
|
|
5768
|
+
const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table);
|
|
5769
|
+
return headerGroups;
|
|
5770
|
+
}, getMemoOptions(table.options, debug));
|
|
5771
|
+
table.getCenterHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
|
|
5772
|
+
leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
|
|
5773
|
+
return buildHeaderGroups(allColumns, leafColumns, table, 'center');
|
|
5774
|
+
}, getMemoOptions(table.options, debug));
|
|
5775
|
+
table.getLeftHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => {
|
|
5776
|
+
var _left$map$filter2;
|
|
5777
|
+
const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
|
|
5778
|
+
return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left');
|
|
5779
|
+
}, getMemoOptions(table.options, debug));
|
|
5780
|
+
table.getRightHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => {
|
|
5781
|
+
var _right$map$filter2;
|
|
5782
|
+
const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
|
|
5783
|
+
return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right');
|
|
5784
|
+
}, getMemoOptions(table.options, debug));
|
|
5785
|
+
|
|
5786
|
+
// Footer Groups
|
|
5787
|
+
|
|
5788
|
+
table.getFooterGroups = memo(() => [table.getHeaderGroups()], headerGroups => {
|
|
5789
|
+
return [...headerGroups].reverse();
|
|
5790
|
+
}, getMemoOptions(table.options, debug));
|
|
5791
|
+
table.getLeftFooterGroups = memo(() => [table.getLeftHeaderGroups()], headerGroups => {
|
|
5792
|
+
return [...headerGroups].reverse();
|
|
5793
|
+
}, getMemoOptions(table.options, debug));
|
|
5794
|
+
table.getCenterFooterGroups = memo(() => [table.getCenterHeaderGroups()], headerGroups => {
|
|
5795
|
+
return [...headerGroups].reverse();
|
|
5796
|
+
}, getMemoOptions(table.options, debug));
|
|
5797
|
+
table.getRightFooterGroups = memo(() => [table.getRightHeaderGroups()], headerGroups => {
|
|
5798
|
+
return [...headerGroups].reverse();
|
|
5799
|
+
}, getMemoOptions(table.options, debug));
|
|
5800
|
+
|
|
5801
|
+
// Flat Headers
|
|
5802
|
+
|
|
5803
|
+
table.getFlatHeaders = memo(() => [table.getHeaderGroups()], headerGroups => {
|
|
5804
|
+
return headerGroups.map(headerGroup => {
|
|
5805
|
+
return headerGroup.headers;
|
|
5806
|
+
}).flat();
|
|
5807
|
+
}, getMemoOptions(table.options, debug));
|
|
5808
|
+
table.getLeftFlatHeaders = memo(() => [table.getLeftHeaderGroups()], left => {
|
|
5809
|
+
return left.map(headerGroup => {
|
|
5810
|
+
return headerGroup.headers;
|
|
5811
|
+
}).flat();
|
|
5812
|
+
}, getMemoOptions(table.options, debug));
|
|
5813
|
+
table.getCenterFlatHeaders = memo(() => [table.getCenterHeaderGroups()], left => {
|
|
5814
|
+
return left.map(headerGroup => {
|
|
5815
|
+
return headerGroup.headers;
|
|
5816
|
+
}).flat();
|
|
5817
|
+
}, getMemoOptions(table.options, debug));
|
|
5818
|
+
table.getRightFlatHeaders = memo(() => [table.getRightHeaderGroups()], left => {
|
|
5819
|
+
return left.map(headerGroup => {
|
|
5820
|
+
return headerGroup.headers;
|
|
5821
|
+
}).flat();
|
|
5822
|
+
}, getMemoOptions(table.options, debug));
|
|
5823
|
+
|
|
5824
|
+
// Leaf Headers
|
|
5825
|
+
|
|
5826
|
+
table.getCenterLeafHeaders = memo(() => [table.getCenterFlatHeaders()], flatHeaders => {
|
|
5827
|
+
return flatHeaders.filter(header => {
|
|
5828
|
+
var _header$subHeaders;
|
|
5829
|
+
return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
|
|
5830
|
+
});
|
|
5831
|
+
}, getMemoOptions(table.options, debug));
|
|
5832
|
+
table.getLeftLeafHeaders = memo(() => [table.getLeftFlatHeaders()], flatHeaders => {
|
|
5833
|
+
return flatHeaders.filter(header => {
|
|
5834
|
+
var _header$subHeaders2;
|
|
5835
|
+
return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
|
|
5836
|
+
});
|
|
5837
|
+
}, getMemoOptions(table.options, debug));
|
|
5838
|
+
table.getRightLeafHeaders = memo(() => [table.getRightFlatHeaders()], flatHeaders => {
|
|
5839
|
+
return flatHeaders.filter(header => {
|
|
5840
|
+
var _header$subHeaders3;
|
|
5841
|
+
return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
|
|
5842
|
+
});
|
|
5843
|
+
}, getMemoOptions(table.options, debug));
|
|
5844
|
+
table.getLeafHeaders = memo(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => {
|
|
5845
|
+
var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
|
|
5846
|
+
return [...((_left$0$headers = (_left$ = left[0]) == null ? void 0 : _left$.headers) != null ? _left$0$headers : []), ...((_center$0$headers = (_center$ = center[0]) == null ? void 0 : _center$.headers) != null ? _center$0$headers : []), ...((_right$0$headers = (_right$ = right[0]) == null ? void 0 : _right$.headers) != null ? _right$0$headers : [])].map(header => {
|
|
5847
|
+
return header.getLeafHeaders();
|
|
5848
|
+
}).flat();
|
|
5849
|
+
}, getMemoOptions(table.options, debug));
|
|
5850
|
+
}
|
|
5851
|
+
};
|
|
5852
|
+
function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
|
|
5853
|
+
var _headerGroups$0$heade, _headerGroups$;
|
|
5854
|
+
// Find the max depth of the columns:
|
|
5855
|
+
// build the leaf column row
|
|
5856
|
+
// build each buffer row going up
|
|
5857
|
+
// placeholder for non-existent level
|
|
5858
|
+
// real column for existing level
|
|
5859
|
+
|
|
5860
|
+
let maxDepth = 0;
|
|
5861
|
+
const findMaxDepth = function (columns, depth) {
|
|
5862
|
+
if (depth === void 0) {
|
|
5863
|
+
depth = 1;
|
|
5864
|
+
}
|
|
5865
|
+
maxDepth = Math.max(maxDepth, depth);
|
|
5866
|
+
columns.filter(column => column.getIsVisible()).forEach(column => {
|
|
5867
|
+
var _column$columns;
|
|
5868
|
+
if ((_column$columns = column.columns) != null && _column$columns.length) {
|
|
5869
|
+
findMaxDepth(column.columns, depth + 1);
|
|
5870
|
+
}
|
|
5871
|
+
}, 0);
|
|
5872
|
+
};
|
|
5873
|
+
findMaxDepth(allColumns);
|
|
5874
|
+
let headerGroups = [];
|
|
5875
|
+
const createHeaderGroup = (headersToGroup, depth) => {
|
|
5876
|
+
// The header group we are creating
|
|
5877
|
+
const headerGroup = {
|
|
5878
|
+
depth,
|
|
5879
|
+
id: [headerFamily, `${depth}`].filter(Boolean).join('_'),
|
|
5880
|
+
headers: []
|
|
5881
|
+
};
|
|
5882
|
+
|
|
5883
|
+
// The parent columns we're going to scan next
|
|
5884
|
+
const pendingParentHeaders = [];
|
|
5885
|
+
|
|
5886
|
+
// Scan each column for parents
|
|
5887
|
+
headersToGroup.forEach(headerToGroup => {
|
|
5888
|
+
// What is the latest (last) parent column?
|
|
5889
|
+
|
|
5890
|
+
const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0];
|
|
5891
|
+
const isLeafHeader = headerToGroup.column.depth === headerGroup.depth;
|
|
5892
|
+
let column;
|
|
5893
|
+
let isPlaceholder = false;
|
|
5894
|
+
if (isLeafHeader && headerToGroup.column.parent) {
|
|
5895
|
+
// The parent header is new
|
|
5896
|
+
column = headerToGroup.column.parent;
|
|
5897
|
+
} else {
|
|
5898
|
+
// The parent header is repeated
|
|
5899
|
+
column = headerToGroup.column;
|
|
5900
|
+
isPlaceholder = true;
|
|
5901
|
+
}
|
|
5902
|
+
if (latestPendingParentHeader && (latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
|
|
5903
|
+
// This column is repeated. Add it as a sub header to the next batch
|
|
5904
|
+
latestPendingParentHeader.subHeaders.push(headerToGroup);
|
|
5905
|
+
} else {
|
|
5906
|
+
// This is a new header. Let's create it
|
|
5907
|
+
const header = createHeader(table, column, {
|
|
5908
|
+
id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),
|
|
5909
|
+
isPlaceholder,
|
|
5910
|
+
placeholderId: isPlaceholder ? `${pendingParentHeaders.filter(d => d.column === column).length}` : undefined,
|
|
5911
|
+
depth,
|
|
5912
|
+
index: pendingParentHeaders.length
|
|
5913
|
+
});
|
|
5914
|
+
|
|
5915
|
+
// Add the headerToGroup as a subHeader of the new header
|
|
5916
|
+
header.subHeaders.push(headerToGroup);
|
|
5917
|
+
// Add the new header to the pendingParentHeaders to get grouped
|
|
5918
|
+
// in the next batch
|
|
5919
|
+
pendingParentHeaders.push(header);
|
|
5920
|
+
}
|
|
5921
|
+
headerGroup.headers.push(headerToGroup);
|
|
5922
|
+
headerToGroup.headerGroup = headerGroup;
|
|
5923
|
+
});
|
|
5924
|
+
headerGroups.push(headerGroup);
|
|
5925
|
+
if (depth > 0) {
|
|
5926
|
+
createHeaderGroup(pendingParentHeaders, depth - 1);
|
|
5927
|
+
}
|
|
5928
|
+
};
|
|
5929
|
+
const bottomHeaders = columnsToGroup.map((column, index) => createHeader(table, column, {
|
|
5930
|
+
depth: maxDepth,
|
|
5931
|
+
index
|
|
5932
|
+
}));
|
|
5933
|
+
createHeaderGroup(bottomHeaders, maxDepth - 1);
|
|
5934
|
+
headerGroups.reverse();
|
|
5935
|
+
|
|
5936
|
+
// headerGroups = headerGroups.filter(headerGroup => {
|
|
5937
|
+
// return !headerGroup.headers.every(header => header.isPlaceholder)
|
|
5938
|
+
// })
|
|
5939
|
+
|
|
5940
|
+
const recurseHeadersForSpans = headers => {
|
|
5941
|
+
const filteredHeaders = headers.filter(header => header.column.getIsVisible());
|
|
5942
|
+
return filteredHeaders.map(header => {
|
|
5943
|
+
let colSpan = 0;
|
|
5944
|
+
let rowSpan = 0;
|
|
5945
|
+
let childRowSpans = [0];
|
|
5946
|
+
if (header.subHeaders && header.subHeaders.length) {
|
|
5947
|
+
childRowSpans = [];
|
|
5948
|
+
recurseHeadersForSpans(header.subHeaders).forEach(_ref => {
|
|
5949
|
+
let {
|
|
5950
|
+
colSpan: childColSpan,
|
|
5951
|
+
rowSpan: childRowSpan
|
|
5952
|
+
} = _ref;
|
|
5953
|
+
colSpan += childColSpan;
|
|
5954
|
+
childRowSpans.push(childRowSpan);
|
|
5955
|
+
});
|
|
5956
|
+
} else {
|
|
5957
|
+
colSpan = 1;
|
|
5958
|
+
}
|
|
5959
|
+
const minChildRowSpan = Math.min(...childRowSpans);
|
|
5960
|
+
rowSpan = rowSpan + minChildRowSpan;
|
|
5961
|
+
header.colSpan = colSpan;
|
|
5962
|
+
header.rowSpan = rowSpan;
|
|
5963
|
+
return {
|
|
5964
|
+
colSpan,
|
|
5965
|
+
rowSpan
|
|
5966
|
+
};
|
|
5967
|
+
});
|
|
5968
|
+
};
|
|
5969
|
+
recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []);
|
|
5970
|
+
return headerGroups;
|
|
5971
|
+
}
|
|
5972
|
+
|
|
5973
|
+
const createRow = (table, id, original, rowIndex, depth, subRows, parentId) => {
|
|
5974
|
+
let row = {
|
|
5975
|
+
id,
|
|
5976
|
+
index: rowIndex,
|
|
5977
|
+
original,
|
|
5978
|
+
depth,
|
|
5979
|
+
parentId,
|
|
5980
|
+
_valuesCache: {},
|
|
5981
|
+
_uniqueValuesCache: {},
|
|
5982
|
+
getValue: columnId => {
|
|
5983
|
+
if (row._valuesCache.hasOwnProperty(columnId)) {
|
|
5984
|
+
return row._valuesCache[columnId];
|
|
5985
|
+
}
|
|
5986
|
+
const column = table.getColumn(columnId);
|
|
5987
|
+
if (!(column != null && column.accessorFn)) {
|
|
5988
|
+
return undefined;
|
|
5989
|
+
}
|
|
5990
|
+
row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
|
|
5991
|
+
return row._valuesCache[columnId];
|
|
5992
|
+
},
|
|
5993
|
+
getUniqueValues: columnId => {
|
|
5994
|
+
if (row._uniqueValuesCache.hasOwnProperty(columnId)) {
|
|
5995
|
+
return row._uniqueValuesCache[columnId];
|
|
5996
|
+
}
|
|
5997
|
+
const column = table.getColumn(columnId);
|
|
5998
|
+
if (!(column != null && column.accessorFn)) {
|
|
5999
|
+
return undefined;
|
|
6000
|
+
}
|
|
6001
|
+
if (!column.columnDef.getUniqueValues) {
|
|
6002
|
+
row._uniqueValuesCache[columnId] = [row.getValue(columnId)];
|
|
6003
|
+
return row._uniqueValuesCache[columnId];
|
|
6004
|
+
}
|
|
6005
|
+
row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(row.original, rowIndex);
|
|
6006
|
+
return row._uniqueValuesCache[columnId];
|
|
6007
|
+
},
|
|
6008
|
+
renderValue: columnId => {
|
|
6009
|
+
var _row$getValue;
|
|
6010
|
+
return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue;
|
|
6011
|
+
},
|
|
6012
|
+
subRows: subRows != null ? subRows : [],
|
|
6013
|
+
getLeafRows: () => flattenBy(row.subRows, d => d.subRows),
|
|
6014
|
+
getParentRow: () => row.parentId ? table.getRow(row.parentId, true) : undefined,
|
|
6015
|
+
getParentRows: () => {
|
|
6016
|
+
let parentRows = [];
|
|
6017
|
+
let currentRow = row;
|
|
6018
|
+
while (true) {
|
|
6019
|
+
const parentRow = currentRow.getParentRow();
|
|
6020
|
+
if (!parentRow) break;
|
|
6021
|
+
parentRows.push(parentRow);
|
|
6022
|
+
currentRow = parentRow;
|
|
6023
|
+
}
|
|
6024
|
+
return parentRows.reverse();
|
|
6025
|
+
},
|
|
6026
|
+
getAllCells: memo(() => [table.getAllLeafColumns()], leafColumns => {
|
|
6027
|
+
return leafColumns.map(column => {
|
|
6028
|
+
return createCell(table, row, column, column.id);
|
|
6029
|
+
});
|
|
6030
|
+
}, getMemoOptions(table.options, 'debugRows')),
|
|
6031
|
+
_getAllCellsByColumnId: memo(() => [row.getAllCells()], allCells => {
|
|
6032
|
+
return allCells.reduce((acc, cell) => {
|
|
6033
|
+
acc[cell.column.id] = cell;
|
|
6034
|
+
return acc;
|
|
6035
|
+
}, {});
|
|
6036
|
+
}, getMemoOptions(table.options, 'debugRows'))
|
|
6037
|
+
};
|
|
6038
|
+
for (let i = 0; i < table._features.length; i++) {
|
|
6039
|
+
const feature = table._features[i];
|
|
6040
|
+
feature == null || feature.createRow == null || feature.createRow(row, table);
|
|
6041
|
+
}
|
|
6042
|
+
return row;
|
|
6043
|
+
};
|
|
6044
|
+
|
|
6045
|
+
//
|
|
6046
|
+
|
|
6047
|
+
const ColumnFaceting = {
|
|
6048
|
+
createColumn: (column, table) => {
|
|
6049
|
+
column._getFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id);
|
|
6050
|
+
column.getFacetedRowModel = () => {
|
|
6051
|
+
if (!column._getFacetedRowModel) {
|
|
6052
|
+
return table.getPreFilteredRowModel();
|
|
6053
|
+
}
|
|
6054
|
+
return column._getFacetedRowModel();
|
|
6055
|
+
};
|
|
6056
|
+
column._getFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id);
|
|
6057
|
+
column.getFacetedUniqueValues = () => {
|
|
6058
|
+
if (!column._getFacetedUniqueValues) {
|
|
6059
|
+
return new Map();
|
|
6060
|
+
}
|
|
6061
|
+
return column._getFacetedUniqueValues();
|
|
6062
|
+
};
|
|
6063
|
+
column._getFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id);
|
|
6064
|
+
column.getFacetedMinMaxValues = () => {
|
|
6065
|
+
if (!column._getFacetedMinMaxValues) {
|
|
6066
|
+
return undefined;
|
|
6067
|
+
}
|
|
6068
|
+
return column._getFacetedMinMaxValues();
|
|
6069
|
+
};
|
|
6070
|
+
}
|
|
6071
|
+
};
|
|
6072
|
+
|
|
6073
|
+
const includesString = (row, columnId, filterValue) => {
|
|
6074
|
+
var _filterValue$toString, _row$getValue;
|
|
6075
|
+
const search = filterValue == null || (_filterValue$toString = filterValue.toString()) == null ? void 0 : _filterValue$toString.toLowerCase();
|
|
6076
|
+
return Boolean((_row$getValue = row.getValue(columnId)) == null || (_row$getValue = _row$getValue.toString()) == null || (_row$getValue = _row$getValue.toLowerCase()) == null ? void 0 : _row$getValue.includes(search));
|
|
6077
|
+
};
|
|
6078
|
+
includesString.autoRemove = val => testFalsey(val);
|
|
6079
|
+
const includesStringSensitive = (row, columnId, filterValue) => {
|
|
6080
|
+
var _row$getValue2;
|
|
6081
|
+
return Boolean((_row$getValue2 = row.getValue(columnId)) == null || (_row$getValue2 = _row$getValue2.toString()) == null ? void 0 : _row$getValue2.includes(filterValue));
|
|
6082
|
+
};
|
|
6083
|
+
includesStringSensitive.autoRemove = val => testFalsey(val);
|
|
6084
|
+
const equalsString = (row, columnId, filterValue) => {
|
|
6085
|
+
var _row$getValue3;
|
|
6086
|
+
return ((_row$getValue3 = row.getValue(columnId)) == null || (_row$getValue3 = _row$getValue3.toString()) == null ? void 0 : _row$getValue3.toLowerCase()) === (filterValue == null ? void 0 : filterValue.toLowerCase());
|
|
6087
|
+
};
|
|
6088
|
+
equalsString.autoRemove = val => testFalsey(val);
|
|
6089
|
+
const arrIncludes = (row, columnId, filterValue) => {
|
|
6090
|
+
var _row$getValue4;
|
|
6091
|
+
return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue);
|
|
6092
|
+
};
|
|
6093
|
+
arrIncludes.autoRemove = val => testFalsey(val) || !(val != null && val.length);
|
|
6094
|
+
const arrIncludesAll = (row, columnId, filterValue) => {
|
|
6095
|
+
return !filterValue.some(val => {
|
|
6096
|
+
var _row$getValue5;
|
|
6097
|
+
return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val));
|
|
6098
|
+
});
|
|
6099
|
+
};
|
|
6100
|
+
arrIncludesAll.autoRemove = val => testFalsey(val) || !(val != null && val.length);
|
|
6101
|
+
const arrIncludesSome = (row, columnId, filterValue) => {
|
|
6102
|
+
return filterValue.some(val => {
|
|
6103
|
+
var _row$getValue6;
|
|
6104
|
+
return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val);
|
|
6105
|
+
});
|
|
6106
|
+
};
|
|
6107
|
+
arrIncludesSome.autoRemove = val => testFalsey(val) || !(val != null && val.length);
|
|
6108
|
+
const equals = (row, columnId, filterValue) => {
|
|
6109
|
+
return row.getValue(columnId) === filterValue;
|
|
6110
|
+
};
|
|
6111
|
+
equals.autoRemove = val => testFalsey(val);
|
|
6112
|
+
const weakEquals = (row, columnId, filterValue) => {
|
|
6113
|
+
return row.getValue(columnId) == filterValue;
|
|
6114
|
+
};
|
|
6115
|
+
weakEquals.autoRemove = val => testFalsey(val);
|
|
6116
|
+
const inNumberRange = (row, columnId, filterValue) => {
|
|
6117
|
+
let [min, max] = filterValue;
|
|
6118
|
+
const rowValue = row.getValue(columnId);
|
|
6119
|
+
return rowValue >= min && rowValue <= max;
|
|
6120
|
+
};
|
|
6121
|
+
inNumberRange.resolveFilterValue = val => {
|
|
6122
|
+
let [unsafeMin, unsafeMax] = val;
|
|
6123
|
+
let parsedMin = typeof unsafeMin !== 'number' ? parseFloat(unsafeMin) : unsafeMin;
|
|
6124
|
+
let parsedMax = typeof unsafeMax !== 'number' ? parseFloat(unsafeMax) : unsafeMax;
|
|
6125
|
+
let min = unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin;
|
|
6126
|
+
let max = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax;
|
|
6127
|
+
if (min > max) {
|
|
6128
|
+
const temp = min;
|
|
6129
|
+
min = max;
|
|
6130
|
+
max = temp;
|
|
6131
|
+
}
|
|
6132
|
+
return [min, max];
|
|
6133
|
+
};
|
|
6134
|
+
inNumberRange.autoRemove = val => testFalsey(val) || testFalsey(val[0]) && testFalsey(val[1]);
|
|
6135
|
+
|
|
6136
|
+
// Export
|
|
6137
|
+
|
|
6138
|
+
const filterFns = {
|
|
6139
|
+
includesString,
|
|
6140
|
+
includesStringSensitive,
|
|
6141
|
+
equalsString,
|
|
6142
|
+
arrIncludes,
|
|
6143
|
+
arrIncludesAll,
|
|
6144
|
+
arrIncludesSome,
|
|
6145
|
+
equals,
|
|
6146
|
+
weakEquals,
|
|
6147
|
+
inNumberRange
|
|
6148
|
+
};
|
|
6149
|
+
// Utils
|
|
6150
|
+
|
|
6151
|
+
function testFalsey(val) {
|
|
6152
|
+
return val === undefined || val === null || val === '';
|
|
6153
|
+
}
|
|
6154
|
+
|
|
6155
|
+
//
|
|
6156
|
+
|
|
6157
|
+
const ColumnFiltering = {
|
|
6158
|
+
getDefaultColumnDef: () => {
|
|
6159
|
+
return {
|
|
6160
|
+
filterFn: 'auto'
|
|
6161
|
+
};
|
|
6162
|
+
},
|
|
6163
|
+
getInitialState: state => {
|
|
6164
|
+
return {
|
|
6165
|
+
columnFilters: [],
|
|
6166
|
+
...state
|
|
6167
|
+
};
|
|
6168
|
+
},
|
|
6169
|
+
getDefaultOptions: table => {
|
|
6170
|
+
return {
|
|
6171
|
+
onColumnFiltersChange: makeStateUpdater('columnFilters', table),
|
|
6172
|
+
filterFromLeafRows: false,
|
|
6173
|
+
maxLeafRowFilterDepth: 100
|
|
6174
|
+
};
|
|
6175
|
+
},
|
|
6176
|
+
createColumn: (column, table) => {
|
|
6177
|
+
column.getAutoFilterFn = () => {
|
|
6178
|
+
const firstRow = table.getCoreRowModel().flatRows[0];
|
|
6179
|
+
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
|
|
6180
|
+
if (typeof value === 'string') {
|
|
6181
|
+
return filterFns.includesString;
|
|
6182
|
+
}
|
|
6183
|
+
if (typeof value === 'number') {
|
|
6184
|
+
return filterFns.inNumberRange;
|
|
6185
|
+
}
|
|
6186
|
+
if (typeof value === 'boolean') {
|
|
6187
|
+
return filterFns.equals;
|
|
6188
|
+
}
|
|
6189
|
+
if (value !== null && typeof value === 'object') {
|
|
6190
|
+
return filterFns.equals;
|
|
6191
|
+
}
|
|
6192
|
+
if (Array.isArray(value)) {
|
|
6193
|
+
return filterFns.arrIncludes;
|
|
6194
|
+
}
|
|
6195
|
+
return filterFns.weakEquals;
|
|
6196
|
+
};
|
|
6197
|
+
column.getFilterFn = () => {
|
|
6198
|
+
var _table$options$filter, _table$options$filter2;
|
|
6199
|
+
return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : // @ts-ignore
|
|
6200
|
+
(_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[column.columnDef.filterFn]) != null ? _table$options$filter : filterFns[column.columnDef.filterFn];
|
|
6201
|
+
};
|
|
6202
|
+
column.getCanFilter = () => {
|
|
6203
|
+
var _column$columnDef$ena, _table$options$enable, _table$options$enable2;
|
|
6204
|
+
return ((_column$columnDef$ena = column.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnFilters) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && !!column.accessorFn;
|
|
6205
|
+
};
|
|
6206
|
+
column.getIsFiltered = () => column.getFilterIndex() > -1;
|
|
6207
|
+
column.getFilterValue = () => {
|
|
6208
|
+
var _table$getState$colum;
|
|
6209
|
+
return (_table$getState$colum = table.getState().columnFilters) == null || (_table$getState$colum = _table$getState$colum.find(d => d.id === column.id)) == null ? void 0 : _table$getState$colum.value;
|
|
6210
|
+
};
|
|
6211
|
+
column.getFilterIndex = () => {
|
|
6212
|
+
var _table$getState$colum2, _table$getState$colum3;
|
|
6213
|
+
return (_table$getState$colum2 = (_table$getState$colum3 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum3.findIndex(d => d.id === column.id)) != null ? _table$getState$colum2 : -1;
|
|
6214
|
+
};
|
|
6215
|
+
column.setFilterValue = value => {
|
|
6216
|
+
table.setColumnFilters(old => {
|
|
6217
|
+
const filterFn = column.getFilterFn();
|
|
6218
|
+
const previousFilter = old == null ? void 0 : old.find(d => d.id === column.id);
|
|
6219
|
+
const newFilter = functionalUpdate(value, previousFilter ? previousFilter.value : undefined);
|
|
6220
|
+
|
|
6221
|
+
//
|
|
6222
|
+
if (shouldAutoRemoveFilter(filterFn, newFilter, column)) {
|
|
6223
|
+
var _old$filter;
|
|
6224
|
+
return (_old$filter = old == null ? void 0 : old.filter(d => d.id !== column.id)) != null ? _old$filter : [];
|
|
6225
|
+
}
|
|
6226
|
+
const newFilterObj = {
|
|
6227
|
+
id: column.id,
|
|
6228
|
+
value: newFilter
|
|
6229
|
+
};
|
|
6230
|
+
if (previousFilter) {
|
|
6231
|
+
var _old$map;
|
|
6232
|
+
return (_old$map = old == null ? void 0 : old.map(d => {
|
|
6233
|
+
if (d.id === column.id) {
|
|
6234
|
+
return newFilterObj;
|
|
6235
|
+
}
|
|
6236
|
+
return d;
|
|
6237
|
+
})) != null ? _old$map : [];
|
|
6238
|
+
}
|
|
6239
|
+
if (old != null && old.length) {
|
|
6240
|
+
return [...old, newFilterObj];
|
|
6241
|
+
}
|
|
6242
|
+
return [newFilterObj];
|
|
6243
|
+
});
|
|
6244
|
+
};
|
|
6245
|
+
},
|
|
6246
|
+
createRow: (row, _table) => {
|
|
6247
|
+
row.columnFilters = {};
|
|
6248
|
+
row.columnFiltersMeta = {};
|
|
6249
|
+
},
|
|
6250
|
+
createTable: table => {
|
|
6251
|
+
table.setColumnFilters = updater => {
|
|
6252
|
+
const leafColumns = table.getAllLeafColumns();
|
|
6253
|
+
const updateFn = old => {
|
|
6254
|
+
var _functionalUpdate;
|
|
6255
|
+
return (_functionalUpdate = functionalUpdate(updater, old)) == null ? void 0 : _functionalUpdate.filter(filter => {
|
|
6256
|
+
const column = leafColumns.find(d => d.id === filter.id);
|
|
6257
|
+
if (column) {
|
|
6258
|
+
const filterFn = column.getFilterFn();
|
|
6259
|
+
if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {
|
|
6260
|
+
return false;
|
|
6261
|
+
}
|
|
6262
|
+
}
|
|
6263
|
+
return true;
|
|
6264
|
+
});
|
|
6265
|
+
};
|
|
6266
|
+
table.options.onColumnFiltersChange == null || table.options.onColumnFiltersChange(updateFn);
|
|
6267
|
+
};
|
|
6268
|
+
table.resetColumnFilters = defaultState => {
|
|
6269
|
+
var _table$initialState$c, _table$initialState;
|
|
6270
|
+
table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []);
|
|
6271
|
+
};
|
|
6272
|
+
table.getPreFilteredRowModel = () => table.getCoreRowModel();
|
|
6273
|
+
table.getFilteredRowModel = () => {
|
|
6274
|
+
if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {
|
|
6275
|
+
table._getFilteredRowModel = table.options.getFilteredRowModel(table);
|
|
6276
|
+
}
|
|
6277
|
+
if (table.options.manualFiltering || !table._getFilteredRowModel) {
|
|
6278
|
+
return table.getPreFilteredRowModel();
|
|
6279
|
+
}
|
|
6280
|
+
return table._getFilteredRowModel();
|
|
6281
|
+
};
|
|
6282
|
+
}
|
|
6283
|
+
};
|
|
6284
|
+
function shouldAutoRemoveFilter(filterFn, value, column) {
|
|
6285
|
+
return (filterFn && filterFn.autoRemove ? filterFn.autoRemove(value, column) : false) || typeof value === 'undefined' || typeof value === 'string' && !value;
|
|
6286
|
+
}
|
|
6287
|
+
|
|
6288
|
+
const sum = (columnId, _leafRows, childRows) => {
|
|
6289
|
+
// It's faster to just add the aggregations together instead of
|
|
6290
|
+
// process leaf nodes individually
|
|
6291
|
+
return childRows.reduce((sum, next) => {
|
|
6292
|
+
const nextValue = next.getValue(columnId);
|
|
6293
|
+
return sum + (typeof nextValue === 'number' ? nextValue : 0);
|
|
6294
|
+
}, 0);
|
|
6295
|
+
};
|
|
6296
|
+
const min$1 = (columnId, _leafRows, childRows) => {
|
|
6297
|
+
let min;
|
|
6298
|
+
childRows.forEach(row => {
|
|
6299
|
+
const value = row.getValue(columnId);
|
|
6300
|
+
if (value != null && (min > value || min === undefined && value >= value)) {
|
|
6301
|
+
min = value;
|
|
6302
|
+
}
|
|
6303
|
+
});
|
|
6304
|
+
return min;
|
|
6305
|
+
};
|
|
6306
|
+
const max$1 = (columnId, _leafRows, childRows) => {
|
|
6307
|
+
let max;
|
|
6308
|
+
childRows.forEach(row => {
|
|
6309
|
+
const value = row.getValue(columnId);
|
|
6310
|
+
if (value != null && (max < value || max === undefined && value >= value)) {
|
|
6311
|
+
max = value;
|
|
6312
|
+
}
|
|
6313
|
+
});
|
|
6314
|
+
return max;
|
|
6315
|
+
};
|
|
6316
|
+
const extent = (columnId, _leafRows, childRows) => {
|
|
6317
|
+
let min;
|
|
6318
|
+
let max;
|
|
6319
|
+
childRows.forEach(row => {
|
|
6320
|
+
const value = row.getValue(columnId);
|
|
6321
|
+
if (value != null) {
|
|
6322
|
+
if (min === undefined) {
|
|
6323
|
+
if (value >= value) min = max = value;
|
|
6324
|
+
} else {
|
|
6325
|
+
if (min > value) min = value;
|
|
6326
|
+
if (max < value) max = value;
|
|
6327
|
+
}
|
|
6328
|
+
}
|
|
6329
|
+
});
|
|
6330
|
+
return [min, max];
|
|
6331
|
+
};
|
|
6332
|
+
const mean = (columnId, leafRows) => {
|
|
6333
|
+
let count = 0;
|
|
6334
|
+
let sum = 0;
|
|
6335
|
+
leafRows.forEach(row => {
|
|
6336
|
+
let value = row.getValue(columnId);
|
|
6337
|
+
if (value != null && (value = +value) >= value) {
|
|
6338
|
+
++count, sum += value;
|
|
6339
|
+
}
|
|
6340
|
+
});
|
|
6341
|
+
if (count) return sum / count;
|
|
6342
|
+
return;
|
|
6343
|
+
};
|
|
6344
|
+
const median = (columnId, leafRows) => {
|
|
6345
|
+
if (!leafRows.length) {
|
|
6346
|
+
return;
|
|
6347
|
+
}
|
|
6348
|
+
const values = leafRows.map(row => row.getValue(columnId));
|
|
6349
|
+
if (!isNumberArray(values)) {
|
|
6350
|
+
return;
|
|
6351
|
+
}
|
|
6352
|
+
if (values.length === 1) {
|
|
6353
|
+
return values[0];
|
|
6354
|
+
}
|
|
6355
|
+
const mid = Math.floor(values.length / 2);
|
|
6356
|
+
const nums = values.sort((a, b) => a - b);
|
|
6357
|
+
return values.length % 2 !== 0 ? nums[mid] : (nums[mid - 1] + nums[mid]) / 2;
|
|
6358
|
+
};
|
|
6359
|
+
const unique = (columnId, leafRows) => {
|
|
6360
|
+
return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values());
|
|
6361
|
+
};
|
|
6362
|
+
const uniqueCount = (columnId, leafRows) => {
|
|
6363
|
+
return new Set(leafRows.map(d => d.getValue(columnId))).size;
|
|
6364
|
+
};
|
|
6365
|
+
const count = (_columnId, leafRows) => {
|
|
6366
|
+
return leafRows.length;
|
|
6367
|
+
};
|
|
6368
|
+
const aggregationFns = {
|
|
6369
|
+
sum,
|
|
6370
|
+
min: min$1,
|
|
6371
|
+
max: max$1,
|
|
6372
|
+
extent,
|
|
6373
|
+
mean,
|
|
6374
|
+
median,
|
|
6375
|
+
unique,
|
|
6376
|
+
uniqueCount,
|
|
6377
|
+
count
|
|
6378
|
+
};
|
|
6379
|
+
|
|
6380
|
+
//
|
|
6381
|
+
|
|
6382
|
+
const ColumnGrouping = {
|
|
6383
|
+
getDefaultColumnDef: () => {
|
|
6384
|
+
return {
|
|
6385
|
+
aggregatedCell: props => {
|
|
6386
|
+
var _toString, _props$getValue;
|
|
6387
|
+
return (_toString = (_props$getValue = props.getValue()) == null || _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null;
|
|
6388
|
+
},
|
|
6389
|
+
aggregationFn: 'auto'
|
|
6390
|
+
};
|
|
6391
|
+
},
|
|
6392
|
+
getInitialState: state => {
|
|
6393
|
+
return {
|
|
6394
|
+
grouping: [],
|
|
6395
|
+
...state
|
|
6396
|
+
};
|
|
6397
|
+
},
|
|
6398
|
+
getDefaultOptions: table => {
|
|
6399
|
+
return {
|
|
6400
|
+
onGroupingChange: makeStateUpdater('grouping', table),
|
|
6401
|
+
groupedColumnMode: 'reorder'
|
|
6402
|
+
};
|
|
6403
|
+
},
|
|
6404
|
+
createColumn: (column, table) => {
|
|
6405
|
+
column.toggleGrouping = () => {
|
|
6406
|
+
table.setGrouping(old => {
|
|
6407
|
+
// Find any existing grouping for this column
|
|
6408
|
+
if (old != null && old.includes(column.id)) {
|
|
6409
|
+
return old.filter(d => d !== column.id);
|
|
6410
|
+
}
|
|
6411
|
+
return [...(old != null ? old : []), column.id];
|
|
6412
|
+
});
|
|
6413
|
+
};
|
|
6414
|
+
column.getCanGroup = () => {
|
|
6415
|
+
var _column$columnDef$ena, _table$options$enable;
|
|
6416
|
+
return ((_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableGrouping) != null ? _table$options$enable : true) && (!!column.accessorFn || !!column.columnDef.getGroupingValue);
|
|
6417
|
+
};
|
|
6418
|
+
column.getIsGrouped = () => {
|
|
6419
|
+
var _table$getState$group;
|
|
6420
|
+
return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id);
|
|
6421
|
+
};
|
|
6422
|
+
column.getGroupedIndex = () => {
|
|
6423
|
+
var _table$getState$group2;
|
|
6424
|
+
return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id);
|
|
6425
|
+
};
|
|
6426
|
+
column.getToggleGroupingHandler = () => {
|
|
6427
|
+
const canGroup = column.getCanGroup();
|
|
6428
|
+
return () => {
|
|
6429
|
+
if (!canGroup) return;
|
|
6430
|
+
column.toggleGrouping();
|
|
6431
|
+
};
|
|
6432
|
+
};
|
|
6433
|
+
column.getAutoAggregationFn = () => {
|
|
6434
|
+
const firstRow = table.getCoreRowModel().flatRows[0];
|
|
6435
|
+
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
|
|
6436
|
+
if (typeof value === 'number') {
|
|
6437
|
+
return aggregationFns.sum;
|
|
6438
|
+
}
|
|
6439
|
+
if (Object.prototype.toString.call(value) === '[object Date]') {
|
|
6440
|
+
return aggregationFns.extent;
|
|
6441
|
+
}
|
|
6442
|
+
};
|
|
6443
|
+
column.getAggregationFn = () => {
|
|
6444
|
+
var _table$options$aggreg, _table$options$aggreg2;
|
|
6445
|
+
if (!column) {
|
|
6446
|
+
throw new Error();
|
|
6447
|
+
}
|
|
6448
|
+
return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_table$options$aggreg = (_table$options$aggreg2 = table.options.aggregationFns) == null ? void 0 : _table$options$aggreg2[column.columnDef.aggregationFn]) != null ? _table$options$aggreg : aggregationFns[column.columnDef.aggregationFn];
|
|
6449
|
+
};
|
|
6450
|
+
},
|
|
6451
|
+
createTable: table => {
|
|
6452
|
+
table.setGrouping = updater => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater);
|
|
6453
|
+
table.resetGrouping = defaultState => {
|
|
6454
|
+
var _table$initialState$g, _table$initialState;
|
|
6455
|
+
table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []);
|
|
6456
|
+
};
|
|
6457
|
+
table.getPreGroupedRowModel = () => table.getFilteredRowModel();
|
|
6458
|
+
table.getGroupedRowModel = () => {
|
|
6459
|
+
if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {
|
|
6460
|
+
table._getGroupedRowModel = table.options.getGroupedRowModel(table);
|
|
6461
|
+
}
|
|
6462
|
+
if (table.options.manualGrouping || !table._getGroupedRowModel) {
|
|
6463
|
+
return table.getPreGroupedRowModel();
|
|
6464
|
+
}
|
|
6465
|
+
return table._getGroupedRowModel();
|
|
6466
|
+
};
|
|
6467
|
+
},
|
|
6468
|
+
createRow: (row, table) => {
|
|
6469
|
+
row.getIsGrouped = () => !!row.groupingColumnId;
|
|
6470
|
+
row.getGroupingValue = columnId => {
|
|
6471
|
+
if (row._groupingValuesCache.hasOwnProperty(columnId)) {
|
|
6472
|
+
return row._groupingValuesCache[columnId];
|
|
6473
|
+
}
|
|
6474
|
+
const column = table.getColumn(columnId);
|
|
6475
|
+
if (!(column != null && column.columnDef.getGroupingValue)) {
|
|
6476
|
+
return row.getValue(columnId);
|
|
6477
|
+
}
|
|
6478
|
+
row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(row.original);
|
|
6479
|
+
return row._groupingValuesCache[columnId];
|
|
6480
|
+
};
|
|
6481
|
+
row._groupingValuesCache = {};
|
|
6482
|
+
},
|
|
6483
|
+
createCell: (cell, column, row, table) => {
|
|
6484
|
+
cell.getIsGrouped = () => column.getIsGrouped() && column.id === row.groupingColumnId;
|
|
6485
|
+
cell.getIsPlaceholder = () => !cell.getIsGrouped() && column.getIsGrouped();
|
|
6486
|
+
cell.getIsAggregated = () => {
|
|
6487
|
+
var _row$subRows;
|
|
6488
|
+
return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
|
|
6489
|
+
};
|
|
6490
|
+
}
|
|
6491
|
+
};
|
|
6492
|
+
function orderColumns(leafColumns, grouping, groupedColumnMode) {
|
|
6493
|
+
if (!(grouping != null && grouping.length) || !groupedColumnMode) {
|
|
6494
|
+
return leafColumns;
|
|
6495
|
+
}
|
|
6496
|
+
const nonGroupingColumns = leafColumns.filter(col => !grouping.includes(col.id));
|
|
6497
|
+
if (groupedColumnMode === 'remove') {
|
|
6498
|
+
return nonGroupingColumns;
|
|
6499
|
+
}
|
|
6500
|
+
const groupingColumns = grouping.map(g => leafColumns.find(col => col.id === g)).filter(Boolean);
|
|
6501
|
+
return [...groupingColumns, ...nonGroupingColumns];
|
|
6502
|
+
}
|
|
6503
|
+
|
|
6504
|
+
//
|
|
6505
|
+
|
|
6506
|
+
const ColumnOrdering = {
|
|
6507
|
+
getInitialState: state => {
|
|
6508
|
+
return {
|
|
6509
|
+
columnOrder: [],
|
|
6510
|
+
...state
|
|
6511
|
+
};
|
|
6512
|
+
},
|
|
6513
|
+
getDefaultOptions: table => {
|
|
6514
|
+
return {
|
|
6515
|
+
onColumnOrderChange: makeStateUpdater('columnOrder', table)
|
|
6516
|
+
};
|
|
6517
|
+
},
|
|
6518
|
+
createColumn: (column, table) => {
|
|
6519
|
+
column.getIndex = memo(position => [_getVisibleLeafColumns(table, position)], columns => columns.findIndex(d => d.id === column.id), getMemoOptions(table.options, 'debugColumns'));
|
|
6520
|
+
column.getIsFirstColumn = position => {
|
|
6521
|
+
var _columns$;
|
|
6522
|
+
const columns = _getVisibleLeafColumns(table, position);
|
|
6523
|
+
return ((_columns$ = columns[0]) == null ? void 0 : _columns$.id) === column.id;
|
|
6524
|
+
};
|
|
6525
|
+
column.getIsLastColumn = position => {
|
|
6526
|
+
var _columns;
|
|
6527
|
+
const columns = _getVisibleLeafColumns(table, position);
|
|
6528
|
+
return ((_columns = columns[columns.length - 1]) == null ? void 0 : _columns.id) === column.id;
|
|
6529
|
+
};
|
|
6530
|
+
},
|
|
6531
|
+
createTable: table => {
|
|
6532
|
+
table.setColumnOrder = updater => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater);
|
|
6533
|
+
table.resetColumnOrder = defaultState => {
|
|
6534
|
+
var _table$initialState$c;
|
|
6535
|
+
table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []);
|
|
6536
|
+
};
|
|
6537
|
+
table._getOrderColumnsFn = memo(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => {
|
|
6538
|
+
// Sort grouped columns to the start of the column list
|
|
6539
|
+
// before the headers are built
|
|
6540
|
+
let orderedColumns = [];
|
|
6541
|
+
|
|
6542
|
+
// If there is no order, return the normal columns
|
|
6543
|
+
if (!(columnOrder != null && columnOrder.length)) {
|
|
6544
|
+
orderedColumns = columns;
|
|
6545
|
+
} else {
|
|
6546
|
+
const columnOrderCopy = [...columnOrder];
|
|
6547
|
+
|
|
6548
|
+
// If there is an order, make a copy of the columns
|
|
6549
|
+
const columnsCopy = [...columns];
|
|
6550
|
+
|
|
6551
|
+
// And make a new ordered array of the columns
|
|
6552
|
+
|
|
6553
|
+
// Loop over the columns and place them in order into the new array
|
|
6554
|
+
while (columnsCopy.length && columnOrderCopy.length) {
|
|
6555
|
+
const targetColumnId = columnOrderCopy.shift();
|
|
6556
|
+
const foundIndex = columnsCopy.findIndex(d => d.id === targetColumnId);
|
|
6557
|
+
if (foundIndex > -1) {
|
|
6558
|
+
orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]);
|
|
6559
|
+
}
|
|
6560
|
+
}
|
|
6561
|
+
|
|
6562
|
+
// If there are any columns left, add them to the end
|
|
6563
|
+
orderedColumns = [...orderedColumns, ...columnsCopy];
|
|
6564
|
+
}
|
|
6565
|
+
return orderColumns(orderedColumns, grouping, groupedColumnMode);
|
|
6566
|
+
}, getMemoOptions(table.options, 'debugTable'));
|
|
6567
|
+
}
|
|
6568
|
+
};
|
|
6569
|
+
|
|
6570
|
+
//
|
|
6571
|
+
|
|
6572
|
+
const getDefaultColumnPinningState = () => ({
|
|
6573
|
+
left: [],
|
|
6574
|
+
right: []
|
|
6575
|
+
});
|
|
6576
|
+
const ColumnPinning = {
|
|
6577
|
+
getInitialState: state => {
|
|
6578
|
+
return {
|
|
6579
|
+
columnPinning: getDefaultColumnPinningState(),
|
|
6580
|
+
...state
|
|
6581
|
+
};
|
|
6582
|
+
},
|
|
6583
|
+
getDefaultOptions: table => {
|
|
6584
|
+
return {
|
|
6585
|
+
onColumnPinningChange: makeStateUpdater('columnPinning', table)
|
|
6586
|
+
};
|
|
6587
|
+
},
|
|
6588
|
+
createColumn: (column, table) => {
|
|
6589
|
+
column.pin = position => {
|
|
6590
|
+
const columnIds = column.getLeafColumns().map(d => d.id).filter(Boolean);
|
|
6591
|
+
table.setColumnPinning(old => {
|
|
6592
|
+
var _old$left3, _old$right3;
|
|
6593
|
+
if (position === 'right') {
|
|
6594
|
+
var _old$left, _old$right;
|
|
6595
|
+
return {
|
|
6596
|
+
left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter(d => !(columnIds != null && columnIds.includes(d))),
|
|
6597
|
+
right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds]
|
|
6598
|
+
};
|
|
6599
|
+
}
|
|
6600
|
+
if (position === 'left') {
|
|
6601
|
+
var _old$left2, _old$right2;
|
|
6602
|
+
return {
|
|
6603
|
+
left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds],
|
|
6604
|
+
right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter(d => !(columnIds != null && columnIds.includes(d)))
|
|
6605
|
+
};
|
|
6606
|
+
}
|
|
6607
|
+
return {
|
|
6608
|
+
left: ((_old$left3 = old == null ? void 0 : old.left) != null ? _old$left3 : []).filter(d => !(columnIds != null && columnIds.includes(d))),
|
|
6609
|
+
right: ((_old$right3 = old == null ? void 0 : old.right) != null ? _old$right3 : []).filter(d => !(columnIds != null && columnIds.includes(d)))
|
|
6610
|
+
};
|
|
6611
|
+
});
|
|
6612
|
+
};
|
|
6613
|
+
column.getCanPin = () => {
|
|
6614
|
+
const leafColumns = column.getLeafColumns();
|
|
6615
|
+
return leafColumns.some(d => {
|
|
6616
|
+
var _d$columnDef$enablePi, _ref, _table$options$enable;
|
|
6617
|
+
return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_ref = (_table$options$enable = table.options.enableColumnPinning) != null ? _table$options$enable : table.options.enablePinning) != null ? _ref : true);
|
|
6618
|
+
});
|
|
6619
|
+
};
|
|
6620
|
+
column.getIsPinned = () => {
|
|
6621
|
+
const leafColumnIds = column.getLeafColumns().map(d => d.id);
|
|
6622
|
+
const {
|
|
6623
|
+
left,
|
|
6624
|
+
right
|
|
6625
|
+
} = table.getState().columnPinning;
|
|
6626
|
+
const isLeft = leafColumnIds.some(d => left == null ? void 0 : left.includes(d));
|
|
6627
|
+
const isRight = leafColumnIds.some(d => right == null ? void 0 : right.includes(d));
|
|
6628
|
+
return isLeft ? 'left' : isRight ? 'right' : false;
|
|
6629
|
+
};
|
|
6630
|
+
column.getPinnedIndex = () => {
|
|
6631
|
+
var _table$getState$colum, _table$getState$colum2;
|
|
6632
|
+
const position = column.getIsPinned();
|
|
6633
|
+
return position ? (_table$getState$colum = (_table$getState$colum2 = table.getState().columnPinning) == null || (_table$getState$colum2 = _table$getState$colum2[position]) == null ? void 0 : _table$getState$colum2.indexOf(column.id)) != null ? _table$getState$colum : -1 : 0;
|
|
6634
|
+
};
|
|
6635
|
+
},
|
|
6636
|
+
createRow: (row, table) => {
|
|
6637
|
+
row.getCenterVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => {
|
|
6638
|
+
const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
|
|
6639
|
+
return allCells.filter(d => !leftAndRight.includes(d.column.id));
|
|
6640
|
+
}, getMemoOptions(table.options, 'debugRows'));
|
|
6641
|
+
row.getLeftVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left], (allCells, left) => {
|
|
6642
|
+
const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({
|
|
6643
|
+
...d,
|
|
6644
|
+
position: 'left'
|
|
6645
|
+
}));
|
|
6646
|
+
return cells;
|
|
6647
|
+
}, getMemoOptions(table.options, 'debugRows'));
|
|
6648
|
+
row.getRightVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {
|
|
6649
|
+
const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({
|
|
6650
|
+
...d,
|
|
6651
|
+
position: 'right'
|
|
6652
|
+
}));
|
|
6653
|
+
return cells;
|
|
6654
|
+
}, getMemoOptions(table.options, 'debugRows'));
|
|
6655
|
+
},
|
|
6656
|
+
createTable: table => {
|
|
6657
|
+
table.setColumnPinning = updater => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater);
|
|
6658
|
+
table.resetColumnPinning = defaultState => {
|
|
6659
|
+
var _table$initialState$c, _table$initialState;
|
|
6660
|
+
return table.setColumnPinning(defaultState ? getDefaultColumnPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultColumnPinningState());
|
|
6661
|
+
};
|
|
6662
|
+
table.getIsSomeColumnsPinned = position => {
|
|
6663
|
+
var _pinningState$positio;
|
|
6664
|
+
const pinningState = table.getState().columnPinning;
|
|
6665
|
+
if (!position) {
|
|
6666
|
+
var _pinningState$left, _pinningState$right;
|
|
6667
|
+
return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length));
|
|
6668
|
+
}
|
|
6669
|
+
return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
|
|
6670
|
+
};
|
|
6671
|
+
table.getLeftLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
|
|
6672
|
+
return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
|
|
6673
|
+
}, getMemoOptions(table.options, 'debugColumns'));
|
|
6674
|
+
table.getRightLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {
|
|
6675
|
+
return (right != null ? right : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
|
|
6676
|
+
}, getMemoOptions(table.options, 'debugColumns'));
|
|
6677
|
+
table.getCenterLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => {
|
|
6678
|
+
const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
|
|
6679
|
+
return allColumns.filter(d => !leftAndRight.includes(d.id));
|
|
6680
|
+
}, getMemoOptions(table.options, 'debugColumns'));
|
|
6681
|
+
}
|
|
6682
|
+
};
|
|
6683
|
+
|
|
6684
|
+
//
|
|
6685
|
+
|
|
6686
|
+
//
|
|
6687
|
+
|
|
6688
|
+
const defaultColumnSizing = {
|
|
6689
|
+
size: 150,
|
|
6690
|
+
minSize: 20,
|
|
6691
|
+
maxSize: Number.MAX_SAFE_INTEGER
|
|
6692
|
+
};
|
|
6693
|
+
const getDefaultColumnSizingInfoState = () => ({
|
|
6694
|
+
startOffset: null,
|
|
6695
|
+
startSize: null,
|
|
6696
|
+
deltaOffset: null,
|
|
6697
|
+
deltaPercentage: null,
|
|
6698
|
+
isResizingColumn: false,
|
|
6699
|
+
columnSizingStart: []
|
|
6700
|
+
});
|
|
6701
|
+
const ColumnSizing = {
|
|
6702
|
+
getDefaultColumnDef: () => {
|
|
6703
|
+
return defaultColumnSizing;
|
|
6704
|
+
},
|
|
6705
|
+
getInitialState: state => {
|
|
6706
|
+
return {
|
|
6707
|
+
columnSizing: {},
|
|
6708
|
+
columnSizingInfo: getDefaultColumnSizingInfoState(),
|
|
6709
|
+
...state
|
|
6710
|
+
};
|
|
6711
|
+
},
|
|
6712
|
+
getDefaultOptions: table => {
|
|
6713
|
+
return {
|
|
6714
|
+
columnResizeMode: 'onEnd',
|
|
6715
|
+
columnResizeDirection: 'ltr',
|
|
6716
|
+
onColumnSizingChange: makeStateUpdater('columnSizing', table),
|
|
6717
|
+
onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', table)
|
|
6718
|
+
};
|
|
6719
|
+
},
|
|
6720
|
+
createColumn: (column, table) => {
|
|
6721
|
+
column.getSize = () => {
|
|
6722
|
+
var _column$columnDef$min, _ref, _column$columnDef$max;
|
|
6723
|
+
const columnSize = table.getState().columnSizing[column.id];
|
|
6724
|
+
return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize);
|
|
6725
|
+
};
|
|
6726
|
+
column.getStart = memo(position => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(0, column.getIndex(position)).reduce((sum, column) => sum + column.getSize(), 0), getMemoOptions(table.options, 'debugColumns'));
|
|
6727
|
+
column.getAfter = memo(position => [position, _getVisibleLeafColumns(table, position), table.getState().columnSizing], (position, columns) => columns.slice(column.getIndex(position) + 1).reduce((sum, column) => sum + column.getSize(), 0), getMemoOptions(table.options, 'debugColumns'));
|
|
6728
|
+
column.resetSize = () => {
|
|
6729
|
+
table.setColumnSizing(_ref2 => {
|
|
6730
|
+
let {
|
|
6731
|
+
[column.id]: _,
|
|
6732
|
+
...rest
|
|
6733
|
+
} = _ref2;
|
|
6734
|
+
return rest;
|
|
6735
|
+
});
|
|
6736
|
+
};
|
|
6737
|
+
column.getCanResize = () => {
|
|
6738
|
+
var _column$columnDef$ena, _table$options$enable;
|
|
6739
|
+
return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true);
|
|
6740
|
+
};
|
|
6741
|
+
column.getIsResizing = () => {
|
|
6742
|
+
return table.getState().columnSizingInfo.isResizingColumn === column.id;
|
|
6743
|
+
};
|
|
6744
|
+
},
|
|
6745
|
+
createHeader: (header, table) => {
|
|
6746
|
+
header.getSize = () => {
|
|
6747
|
+
let sum = 0;
|
|
6748
|
+
const recurse = header => {
|
|
6749
|
+
if (header.subHeaders.length) {
|
|
6750
|
+
header.subHeaders.forEach(recurse);
|
|
6751
|
+
} else {
|
|
6752
|
+
var _header$column$getSiz;
|
|
6753
|
+
sum += (_header$column$getSiz = header.column.getSize()) != null ? _header$column$getSiz : 0;
|
|
6754
|
+
}
|
|
6755
|
+
};
|
|
6756
|
+
recurse(header);
|
|
6757
|
+
return sum;
|
|
6758
|
+
};
|
|
6759
|
+
header.getStart = () => {
|
|
6760
|
+
if (header.index > 0) {
|
|
6761
|
+
const prevSiblingHeader = header.headerGroup.headers[header.index - 1];
|
|
6762
|
+
return prevSiblingHeader.getStart() + prevSiblingHeader.getSize();
|
|
6763
|
+
}
|
|
6764
|
+
return 0;
|
|
6765
|
+
};
|
|
6766
|
+
header.getResizeHandler = _contextDocument => {
|
|
6767
|
+
const column = table.getColumn(header.column.id);
|
|
6768
|
+
const canResize = column == null ? void 0 : column.getCanResize();
|
|
6769
|
+
return e => {
|
|
6770
|
+
if (!column || !canResize) {
|
|
6771
|
+
return;
|
|
6772
|
+
}
|
|
6773
|
+
e.persist == null || e.persist();
|
|
6774
|
+
if (isTouchStartEvent(e)) {
|
|
6775
|
+
// lets not respond to multiple touches (e.g. 2 or 3 fingers)
|
|
6776
|
+
if (e.touches && e.touches.length > 1) {
|
|
6777
|
+
return;
|
|
6778
|
+
}
|
|
6779
|
+
}
|
|
6780
|
+
const startSize = header.getSize();
|
|
6781
|
+
const columnSizingStart = header ? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()]) : [[column.id, column.getSize()]];
|
|
6782
|
+
const clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX;
|
|
6783
|
+
const newColumnSizing = {};
|
|
6784
|
+
const updateOffset = (eventType, clientXPos) => {
|
|
6785
|
+
if (typeof clientXPos !== 'number') {
|
|
6786
|
+
return;
|
|
6787
|
+
}
|
|
6788
|
+
table.setColumnSizingInfo(old => {
|
|
6789
|
+
var _old$startOffset, _old$startSize;
|
|
6790
|
+
const deltaDirection = table.options.columnResizeDirection === 'rtl' ? -1 : 1;
|
|
6791
|
+
const deltaOffset = (clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0)) * deltaDirection;
|
|
6792
|
+
const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999);
|
|
6793
|
+
old.columnSizingStart.forEach(_ref3 => {
|
|
6794
|
+
let [columnId, headerSize] = _ref3;
|
|
6795
|
+
newColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100;
|
|
6796
|
+
});
|
|
6797
|
+
return {
|
|
6798
|
+
...old,
|
|
6799
|
+
deltaOffset,
|
|
6800
|
+
deltaPercentage
|
|
6801
|
+
};
|
|
6802
|
+
});
|
|
6803
|
+
if (table.options.columnResizeMode === 'onChange' || eventType === 'end') {
|
|
6804
|
+
table.setColumnSizing(old => ({
|
|
6805
|
+
...old,
|
|
6806
|
+
...newColumnSizing
|
|
6807
|
+
}));
|
|
6808
|
+
}
|
|
6809
|
+
};
|
|
6810
|
+
const onMove = clientXPos => updateOffset('move', clientXPos);
|
|
6811
|
+
const onEnd = clientXPos => {
|
|
6812
|
+
updateOffset('end', clientXPos);
|
|
6813
|
+
table.setColumnSizingInfo(old => ({
|
|
6814
|
+
...old,
|
|
6815
|
+
isResizingColumn: false,
|
|
6816
|
+
startOffset: null,
|
|
6817
|
+
startSize: null,
|
|
6818
|
+
deltaOffset: null,
|
|
6819
|
+
deltaPercentage: null,
|
|
6820
|
+
columnSizingStart: []
|
|
6821
|
+
}));
|
|
6822
|
+
};
|
|
6823
|
+
const contextDocument = _contextDocument || typeof document !== 'undefined' ? document : null;
|
|
6824
|
+
const mouseEvents = {
|
|
6825
|
+
moveHandler: e => onMove(e.clientX),
|
|
6826
|
+
upHandler: e => {
|
|
6827
|
+
contextDocument == null || contextDocument.removeEventListener('mousemove', mouseEvents.moveHandler);
|
|
6828
|
+
contextDocument == null || contextDocument.removeEventListener('mouseup', mouseEvents.upHandler);
|
|
6829
|
+
onEnd(e.clientX);
|
|
6830
|
+
}
|
|
6831
|
+
};
|
|
6832
|
+
const touchEvents = {
|
|
6833
|
+
moveHandler: e => {
|
|
6834
|
+
if (e.cancelable) {
|
|
6835
|
+
e.preventDefault();
|
|
6836
|
+
e.stopPropagation();
|
|
6837
|
+
}
|
|
6838
|
+
onMove(e.touches[0].clientX);
|
|
6839
|
+
return false;
|
|
6840
|
+
},
|
|
6841
|
+
upHandler: e => {
|
|
6842
|
+
var _e$touches$;
|
|
6843
|
+
contextDocument == null || contextDocument.removeEventListener('touchmove', touchEvents.moveHandler);
|
|
6844
|
+
contextDocument == null || contextDocument.removeEventListener('touchend', touchEvents.upHandler);
|
|
6845
|
+
if (e.cancelable) {
|
|
6846
|
+
e.preventDefault();
|
|
6847
|
+
e.stopPropagation();
|
|
6848
|
+
}
|
|
6849
|
+
onEnd((_e$touches$ = e.touches[0]) == null ? void 0 : _e$touches$.clientX);
|
|
6850
|
+
}
|
|
6851
|
+
};
|
|
6852
|
+
const passiveIfSupported = passiveEventSupported() ? {
|
|
6853
|
+
passive: false
|
|
6854
|
+
} : false;
|
|
6855
|
+
if (isTouchStartEvent(e)) {
|
|
6856
|
+
contextDocument == null || contextDocument.addEventListener('touchmove', touchEvents.moveHandler, passiveIfSupported);
|
|
6857
|
+
contextDocument == null || contextDocument.addEventListener('touchend', touchEvents.upHandler, passiveIfSupported);
|
|
6858
|
+
} else {
|
|
6859
|
+
contextDocument == null || contextDocument.addEventListener('mousemove', mouseEvents.moveHandler, passiveIfSupported);
|
|
6860
|
+
contextDocument == null || contextDocument.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported);
|
|
6861
|
+
}
|
|
6862
|
+
table.setColumnSizingInfo(old => ({
|
|
6863
|
+
...old,
|
|
6864
|
+
startOffset: clientX,
|
|
6865
|
+
startSize,
|
|
6866
|
+
deltaOffset: 0,
|
|
6867
|
+
deltaPercentage: 0,
|
|
6868
|
+
columnSizingStart,
|
|
6869
|
+
isResizingColumn: column.id
|
|
6870
|
+
}));
|
|
6871
|
+
};
|
|
6872
|
+
};
|
|
6873
|
+
},
|
|
6874
|
+
createTable: table => {
|
|
6875
|
+
table.setColumnSizing = updater => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater);
|
|
6876
|
+
table.setColumnSizingInfo = updater => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater);
|
|
6877
|
+
table.resetColumnSizing = defaultState => {
|
|
6878
|
+
var _table$initialState$c;
|
|
6879
|
+
table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {});
|
|
6880
|
+
};
|
|
6881
|
+
table.resetHeaderSizeInfo = defaultState => {
|
|
6882
|
+
var _table$initialState$c2;
|
|
6883
|
+
table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState());
|
|
6884
|
+
};
|
|
6885
|
+
table.getTotalSize = () => {
|
|
6886
|
+
var _table$getHeaderGroup, _table$getHeaderGroup2;
|
|
6887
|
+
return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum, header) => {
|
|
6888
|
+
return sum + header.getSize();
|
|
6889
|
+
}, 0)) != null ? _table$getHeaderGroup : 0;
|
|
6890
|
+
};
|
|
6891
|
+
table.getLeftTotalSize = () => {
|
|
6892
|
+
var _table$getLeftHeaderG, _table$getLeftHeaderG2;
|
|
6893
|
+
return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum, header) => {
|
|
6894
|
+
return sum + header.getSize();
|
|
6895
|
+
}, 0)) != null ? _table$getLeftHeaderG : 0;
|
|
6896
|
+
};
|
|
6897
|
+
table.getCenterTotalSize = () => {
|
|
6898
|
+
var _table$getCenterHeade, _table$getCenterHeade2;
|
|
6899
|
+
return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum, header) => {
|
|
6900
|
+
return sum + header.getSize();
|
|
6901
|
+
}, 0)) != null ? _table$getCenterHeade : 0;
|
|
6902
|
+
};
|
|
6903
|
+
table.getRightTotalSize = () => {
|
|
6904
|
+
var _table$getRightHeader, _table$getRightHeader2;
|
|
6905
|
+
return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum, header) => {
|
|
6906
|
+
return sum + header.getSize();
|
|
6907
|
+
}, 0)) != null ? _table$getRightHeader : 0;
|
|
6908
|
+
};
|
|
6909
|
+
}
|
|
6910
|
+
};
|
|
6911
|
+
let passiveSupported = null;
|
|
6912
|
+
function passiveEventSupported() {
|
|
6913
|
+
if (typeof passiveSupported === 'boolean') return passiveSupported;
|
|
6914
|
+
let supported = false;
|
|
6915
|
+
try {
|
|
6916
|
+
const options = {
|
|
6917
|
+
get passive() {
|
|
6918
|
+
supported = true;
|
|
6919
|
+
return false;
|
|
6920
|
+
}
|
|
6921
|
+
};
|
|
6922
|
+
const noop = () => {};
|
|
6923
|
+
window.addEventListener('test', noop, options);
|
|
6924
|
+
window.removeEventListener('test', noop);
|
|
6925
|
+
} catch (err) {
|
|
6926
|
+
supported = false;
|
|
6927
|
+
}
|
|
6928
|
+
passiveSupported = supported;
|
|
6929
|
+
return passiveSupported;
|
|
6930
|
+
}
|
|
6931
|
+
function isTouchStartEvent(e) {
|
|
6932
|
+
return e.type === 'touchstart';
|
|
6933
|
+
}
|
|
6934
|
+
|
|
6935
|
+
//
|
|
6936
|
+
|
|
6937
|
+
const ColumnVisibility = {
|
|
6938
|
+
getInitialState: state => {
|
|
6939
|
+
return {
|
|
6940
|
+
columnVisibility: {},
|
|
6941
|
+
...state
|
|
6942
|
+
};
|
|
6943
|
+
},
|
|
6944
|
+
getDefaultOptions: table => {
|
|
6945
|
+
return {
|
|
6946
|
+
onColumnVisibilityChange: makeStateUpdater('columnVisibility', table)
|
|
6947
|
+
};
|
|
6948
|
+
},
|
|
6949
|
+
createColumn: (column, table) => {
|
|
6950
|
+
column.toggleVisibility = value => {
|
|
6951
|
+
if (column.getCanHide()) {
|
|
6952
|
+
table.setColumnVisibility(old => ({
|
|
6953
|
+
...old,
|
|
6954
|
+
[column.id]: value != null ? value : !column.getIsVisible()
|
|
6955
|
+
}));
|
|
6956
|
+
}
|
|
6957
|
+
};
|
|
6958
|
+
column.getIsVisible = () => {
|
|
6959
|
+
var _ref, _table$getState$colum;
|
|
6960
|
+
const childColumns = column.columns;
|
|
6961
|
+
return (_ref = childColumns.length ? childColumns.some(c => c.getIsVisible()) : (_table$getState$colum = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum[column.id]) != null ? _ref : true;
|
|
6962
|
+
};
|
|
6963
|
+
column.getCanHide = () => {
|
|
6964
|
+
var _column$columnDef$ena, _table$options$enable;
|
|
6965
|
+
return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true);
|
|
6966
|
+
};
|
|
6967
|
+
column.getToggleVisibilityHandler = () => {
|
|
6968
|
+
return e => {
|
|
6969
|
+
column.toggleVisibility == null || column.toggleVisibility(e.target.checked);
|
|
6970
|
+
};
|
|
6971
|
+
};
|
|
6972
|
+
},
|
|
6973
|
+
createRow: (row, table) => {
|
|
6974
|
+
row._getAllVisibleCells = memo(() => [row.getAllCells(), table.getState().columnVisibility], cells => {
|
|
6975
|
+
return cells.filter(cell => cell.column.getIsVisible());
|
|
6976
|
+
}, getMemoOptions(table.options, 'debugRows'));
|
|
6977
|
+
row.getVisibleCells = memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], getMemoOptions(table.options, 'debugRows'));
|
|
6978
|
+
},
|
|
6979
|
+
createTable: table => {
|
|
6980
|
+
const makeVisibleColumnsMethod = (key, getColumns) => {
|
|
6981
|
+
return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {
|
|
6982
|
+
return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());
|
|
6983
|
+
}, getMemoOptions(table.options, 'debugColumns'));
|
|
6984
|
+
};
|
|
6985
|
+
table.getVisibleFlatColumns = makeVisibleColumnsMethod('getVisibleFlatColumns', () => table.getAllFlatColumns());
|
|
6986
|
+
table.getVisibleLeafColumns = makeVisibleColumnsMethod('getVisibleLeafColumns', () => table.getAllLeafColumns());
|
|
6987
|
+
table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => table.getLeftLeafColumns());
|
|
6988
|
+
table.getRightVisibleLeafColumns = makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => table.getRightLeafColumns());
|
|
6989
|
+
table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => table.getCenterLeafColumns());
|
|
6990
|
+
table.setColumnVisibility = updater => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater);
|
|
6991
|
+
table.resetColumnVisibility = defaultState => {
|
|
6992
|
+
var _table$initialState$c;
|
|
6993
|
+
table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {});
|
|
6994
|
+
};
|
|
6995
|
+
table.toggleAllColumnsVisible = value => {
|
|
6996
|
+
var _value;
|
|
6997
|
+
value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible();
|
|
6998
|
+
table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({
|
|
6999
|
+
...obj,
|
|
7000
|
+
[column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
|
|
7001
|
+
}), {}));
|
|
7002
|
+
};
|
|
7003
|
+
table.getIsAllColumnsVisible = () => !table.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible()));
|
|
7004
|
+
table.getIsSomeColumnsVisible = () => table.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible());
|
|
7005
|
+
table.getToggleAllColumnsVisibilityHandler = () => {
|
|
7006
|
+
return e => {
|
|
7007
|
+
var _target;
|
|
7008
|
+
table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
|
|
7009
|
+
};
|
|
7010
|
+
};
|
|
7011
|
+
}
|
|
7012
|
+
};
|
|
7013
|
+
function _getVisibleLeafColumns(table, position) {
|
|
7014
|
+
return !position ? table.getVisibleLeafColumns() : position === 'center' ? table.getCenterVisibleLeafColumns() : position === 'left' ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns();
|
|
7015
|
+
}
|
|
7016
|
+
|
|
7017
|
+
//
|
|
7018
|
+
|
|
7019
|
+
const GlobalFaceting = {
|
|
7020
|
+
createTable: table => {
|
|
7021
|
+
table._getGlobalFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, '__global__');
|
|
7022
|
+
table.getGlobalFacetedRowModel = () => {
|
|
7023
|
+
if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {
|
|
7024
|
+
return table.getPreFilteredRowModel();
|
|
7025
|
+
}
|
|
7026
|
+
return table._getGlobalFacetedRowModel();
|
|
7027
|
+
};
|
|
7028
|
+
table._getGlobalFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, '__global__');
|
|
7029
|
+
table.getGlobalFacetedUniqueValues = () => {
|
|
7030
|
+
if (!table._getGlobalFacetedUniqueValues) {
|
|
7031
|
+
return new Map();
|
|
7032
|
+
}
|
|
7033
|
+
return table._getGlobalFacetedUniqueValues();
|
|
7034
|
+
};
|
|
7035
|
+
table._getGlobalFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, '__global__');
|
|
7036
|
+
table.getGlobalFacetedMinMaxValues = () => {
|
|
7037
|
+
if (!table._getGlobalFacetedMinMaxValues) {
|
|
7038
|
+
return;
|
|
7039
|
+
}
|
|
7040
|
+
return table._getGlobalFacetedMinMaxValues();
|
|
7041
|
+
};
|
|
7042
|
+
}
|
|
7043
|
+
};
|
|
7044
|
+
|
|
7045
|
+
//
|
|
7046
|
+
|
|
7047
|
+
const GlobalFiltering = {
|
|
7048
|
+
getInitialState: state => {
|
|
7049
|
+
return {
|
|
7050
|
+
globalFilter: undefined,
|
|
7051
|
+
...state
|
|
7052
|
+
};
|
|
7053
|
+
},
|
|
7054
|
+
getDefaultOptions: table => {
|
|
7055
|
+
return {
|
|
7056
|
+
onGlobalFilterChange: makeStateUpdater('globalFilter', table),
|
|
7057
|
+
globalFilterFn: 'auto',
|
|
7058
|
+
getColumnCanGlobalFilter: column => {
|
|
7059
|
+
var _table$getCoreRowMode;
|
|
7060
|
+
const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null || (_table$getCoreRowMode = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode.getValue();
|
|
7061
|
+
return typeof value === 'string' || typeof value === 'number';
|
|
7062
|
+
}
|
|
7063
|
+
};
|
|
7064
|
+
},
|
|
7065
|
+
createColumn: (column, table) => {
|
|
7066
|
+
column.getCanGlobalFilter = () => {
|
|
7067
|
+
var _column$columnDef$ena, _table$options$enable, _table$options$enable2, _table$options$getCol;
|
|
7068
|
+
return ((_column$columnDef$ena = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableGlobalFilter) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && ((_table$options$getCol = table.options.getColumnCanGlobalFilter == null ? void 0 : table.options.getColumnCanGlobalFilter(column)) != null ? _table$options$getCol : true) && !!column.accessorFn;
|
|
7069
|
+
};
|
|
7070
|
+
},
|
|
7071
|
+
createTable: table => {
|
|
7072
|
+
table.getGlobalAutoFilterFn = () => {
|
|
7073
|
+
return filterFns.includesString;
|
|
7074
|
+
};
|
|
7075
|
+
table.getGlobalFilterFn = () => {
|
|
7076
|
+
var _table$options$filter, _table$options$filter2;
|
|
7077
|
+
const {
|
|
7078
|
+
globalFilterFn: globalFilterFn
|
|
7079
|
+
} = table.options;
|
|
7080
|
+
return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn() : (_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[globalFilterFn]) != null ? _table$options$filter : filterFns[globalFilterFn];
|
|
7081
|
+
};
|
|
7082
|
+
table.setGlobalFilter = updater => {
|
|
7083
|
+
table.options.onGlobalFilterChange == null || table.options.onGlobalFilterChange(updater);
|
|
7084
|
+
};
|
|
7085
|
+
table.resetGlobalFilter = defaultState => {
|
|
7086
|
+
table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter);
|
|
7087
|
+
};
|
|
7088
|
+
}
|
|
7089
|
+
};
|
|
7090
|
+
|
|
7091
|
+
//
|
|
7092
|
+
|
|
7093
|
+
const RowExpanding = {
|
|
7094
|
+
getInitialState: state => {
|
|
7095
|
+
return {
|
|
7096
|
+
expanded: {},
|
|
7097
|
+
...state
|
|
7098
|
+
};
|
|
7099
|
+
},
|
|
7100
|
+
getDefaultOptions: table => {
|
|
7101
|
+
return {
|
|
7102
|
+
onExpandedChange: makeStateUpdater('expanded', table),
|
|
7103
|
+
paginateExpandedRows: true
|
|
7104
|
+
};
|
|
7105
|
+
},
|
|
7106
|
+
createTable: table => {
|
|
7107
|
+
let registered = false;
|
|
7108
|
+
let queued = false;
|
|
7109
|
+
table._autoResetExpanded = () => {
|
|
7110
|
+
var _ref, _table$options$autoRe;
|
|
7111
|
+
if (!registered) {
|
|
7112
|
+
table._queue(() => {
|
|
7113
|
+
registered = true;
|
|
7114
|
+
});
|
|
7115
|
+
return;
|
|
7116
|
+
}
|
|
7117
|
+
if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) {
|
|
7118
|
+
if (queued) return;
|
|
7119
|
+
queued = true;
|
|
7120
|
+
table._queue(() => {
|
|
7121
|
+
table.resetExpanded();
|
|
7122
|
+
queued = false;
|
|
7123
|
+
});
|
|
7124
|
+
}
|
|
7125
|
+
};
|
|
7126
|
+
table.setExpanded = updater => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater);
|
|
7127
|
+
table.toggleAllRowsExpanded = expanded => {
|
|
7128
|
+
if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) {
|
|
7129
|
+
table.setExpanded(true);
|
|
7130
|
+
} else {
|
|
7131
|
+
table.setExpanded({});
|
|
7132
|
+
}
|
|
7133
|
+
};
|
|
7134
|
+
table.resetExpanded = defaultState => {
|
|
7135
|
+
var _table$initialState$e, _table$initialState;
|
|
7136
|
+
table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {});
|
|
7137
|
+
};
|
|
7138
|
+
table.getCanSomeRowsExpand = () => {
|
|
7139
|
+
return table.getPrePaginationRowModel().flatRows.some(row => row.getCanExpand());
|
|
7140
|
+
};
|
|
7141
|
+
table.getToggleAllRowsExpandedHandler = () => {
|
|
7142
|
+
return e => {
|
|
7143
|
+
e.persist == null || e.persist();
|
|
7144
|
+
table.toggleAllRowsExpanded();
|
|
7145
|
+
};
|
|
7146
|
+
};
|
|
7147
|
+
table.getIsSomeRowsExpanded = () => {
|
|
7148
|
+
const expanded = table.getState().expanded;
|
|
7149
|
+
return expanded === true || Object.values(expanded).some(Boolean);
|
|
7150
|
+
};
|
|
7151
|
+
table.getIsAllRowsExpanded = () => {
|
|
7152
|
+
const expanded = table.getState().expanded;
|
|
7153
|
+
|
|
7154
|
+
// If expanded is true, save some cycles and return true
|
|
7155
|
+
if (typeof expanded === 'boolean') {
|
|
7156
|
+
return expanded === true;
|
|
7157
|
+
}
|
|
7158
|
+
if (!Object.keys(expanded).length) {
|
|
7159
|
+
return false;
|
|
7160
|
+
}
|
|
7161
|
+
|
|
7162
|
+
// If any row is not expanded, return false
|
|
7163
|
+
if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) {
|
|
7164
|
+
return false;
|
|
7165
|
+
}
|
|
7166
|
+
|
|
7167
|
+
// They must all be expanded :shrug:
|
|
7168
|
+
return true;
|
|
7169
|
+
};
|
|
7170
|
+
table.getExpandedDepth = () => {
|
|
7171
|
+
let maxDepth = 0;
|
|
7172
|
+
const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded);
|
|
7173
|
+
rowIds.forEach(id => {
|
|
7174
|
+
const splitId = id.split('.');
|
|
7175
|
+
maxDepth = Math.max(maxDepth, splitId.length);
|
|
7176
|
+
});
|
|
7177
|
+
return maxDepth;
|
|
7178
|
+
};
|
|
7179
|
+
table.getPreExpandedRowModel = () => table.getSortedRowModel();
|
|
7180
|
+
table.getExpandedRowModel = () => {
|
|
7181
|
+
if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {
|
|
7182
|
+
table._getExpandedRowModel = table.options.getExpandedRowModel(table);
|
|
7183
|
+
}
|
|
7184
|
+
if (table.options.manualExpanding || !table._getExpandedRowModel) {
|
|
7185
|
+
return table.getPreExpandedRowModel();
|
|
7186
|
+
}
|
|
7187
|
+
return table._getExpandedRowModel();
|
|
7188
|
+
};
|
|
7189
|
+
},
|
|
7190
|
+
createRow: (row, table) => {
|
|
7191
|
+
row.toggleExpanded = expanded => {
|
|
7192
|
+
table.setExpanded(old => {
|
|
7193
|
+
var _expanded;
|
|
7194
|
+
const exists = old === true ? true : !!(old != null && old[row.id]);
|
|
7195
|
+
let oldExpanded = {};
|
|
7196
|
+
if (old === true) {
|
|
7197
|
+
Object.keys(table.getRowModel().rowsById).forEach(rowId => {
|
|
7198
|
+
oldExpanded[rowId] = true;
|
|
7199
|
+
});
|
|
7200
|
+
} else {
|
|
7201
|
+
oldExpanded = old;
|
|
7202
|
+
}
|
|
7203
|
+
expanded = (_expanded = expanded) != null ? _expanded : !exists;
|
|
7204
|
+
if (!exists && expanded) {
|
|
7205
|
+
return {
|
|
7206
|
+
...oldExpanded,
|
|
7207
|
+
[row.id]: true
|
|
7208
|
+
};
|
|
7209
|
+
}
|
|
7210
|
+
if (exists && !expanded) {
|
|
7211
|
+
const {
|
|
7212
|
+
[row.id]: _,
|
|
7213
|
+
...rest
|
|
7214
|
+
} = oldExpanded;
|
|
7215
|
+
return rest;
|
|
7216
|
+
}
|
|
7217
|
+
return old;
|
|
7218
|
+
});
|
|
7219
|
+
};
|
|
7220
|
+
row.getIsExpanded = () => {
|
|
7221
|
+
var _table$options$getIsR;
|
|
7222
|
+
const expanded = table.getState().expanded;
|
|
7223
|
+
return !!((_table$options$getIsR = table.options.getIsRowExpanded == null ? void 0 : table.options.getIsRowExpanded(row)) != null ? _table$options$getIsR : expanded === true || (expanded == null ? void 0 : expanded[row.id]));
|
|
7224
|
+
};
|
|
7225
|
+
row.getCanExpand = () => {
|
|
7226
|
+
var _table$options$getRow, _table$options$enable, _row$subRows;
|
|
7227
|
+
return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
|
|
7228
|
+
};
|
|
7229
|
+
row.getIsAllParentsExpanded = () => {
|
|
7230
|
+
let isFullyExpanded = true;
|
|
7231
|
+
let currentRow = row;
|
|
7232
|
+
while (isFullyExpanded && currentRow.parentId) {
|
|
7233
|
+
currentRow = table.getRow(currentRow.parentId, true);
|
|
7234
|
+
isFullyExpanded = currentRow.getIsExpanded();
|
|
7235
|
+
}
|
|
7236
|
+
return isFullyExpanded;
|
|
7237
|
+
};
|
|
7238
|
+
row.getToggleExpandedHandler = () => {
|
|
7239
|
+
const canExpand = row.getCanExpand();
|
|
7240
|
+
return () => {
|
|
7241
|
+
if (!canExpand) return;
|
|
7242
|
+
row.toggleExpanded();
|
|
7243
|
+
};
|
|
7244
|
+
};
|
|
7245
|
+
}
|
|
7246
|
+
};
|
|
7247
|
+
|
|
7248
|
+
//
|
|
7249
|
+
|
|
7250
|
+
const defaultPageIndex = 0;
|
|
7251
|
+
const defaultPageSize = 10;
|
|
7252
|
+
const getDefaultPaginationState = () => ({
|
|
7253
|
+
pageIndex: defaultPageIndex,
|
|
7254
|
+
pageSize: defaultPageSize
|
|
7255
|
+
});
|
|
7256
|
+
const RowPagination = {
|
|
7257
|
+
getInitialState: state => {
|
|
7258
|
+
return {
|
|
7259
|
+
...state,
|
|
7260
|
+
pagination: {
|
|
7261
|
+
...getDefaultPaginationState(),
|
|
7262
|
+
...(state == null ? void 0 : state.pagination)
|
|
7263
|
+
}
|
|
7264
|
+
};
|
|
7265
|
+
},
|
|
7266
|
+
getDefaultOptions: table => {
|
|
7267
|
+
return {
|
|
7268
|
+
onPaginationChange: makeStateUpdater('pagination', table)
|
|
7269
|
+
};
|
|
7270
|
+
},
|
|
7271
|
+
createTable: table => {
|
|
7272
|
+
let registered = false;
|
|
7273
|
+
let queued = false;
|
|
7274
|
+
table._autoResetPageIndex = () => {
|
|
7275
|
+
var _ref, _table$options$autoRe;
|
|
7276
|
+
if (!registered) {
|
|
7277
|
+
table._queue(() => {
|
|
7278
|
+
registered = true;
|
|
7279
|
+
});
|
|
7280
|
+
return;
|
|
7281
|
+
}
|
|
7282
|
+
if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) {
|
|
7283
|
+
if (queued) return;
|
|
7284
|
+
queued = true;
|
|
7285
|
+
table._queue(() => {
|
|
7286
|
+
table.resetPageIndex();
|
|
7287
|
+
queued = false;
|
|
7288
|
+
});
|
|
7289
|
+
}
|
|
7290
|
+
};
|
|
7291
|
+
table.setPagination = updater => {
|
|
7292
|
+
const safeUpdater = old => {
|
|
7293
|
+
let newState = functionalUpdate(updater, old);
|
|
7294
|
+
return newState;
|
|
7295
|
+
};
|
|
7296
|
+
return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater);
|
|
7297
|
+
};
|
|
7298
|
+
table.resetPagination = defaultState => {
|
|
7299
|
+
var _table$initialState$p;
|
|
7300
|
+
table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState());
|
|
7301
|
+
};
|
|
7302
|
+
table.setPageIndex = updater => {
|
|
7303
|
+
table.setPagination(old => {
|
|
7304
|
+
let pageIndex = functionalUpdate(updater, old.pageIndex);
|
|
7305
|
+
const maxPageIndex = typeof table.options.pageCount === 'undefined' || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1;
|
|
7306
|
+
pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex));
|
|
7307
|
+
return {
|
|
7308
|
+
...old,
|
|
7309
|
+
pageIndex
|
|
7310
|
+
};
|
|
7311
|
+
});
|
|
7312
|
+
};
|
|
7313
|
+
table.resetPageIndex = defaultState => {
|
|
7314
|
+
var _table$initialState$p2, _table$initialState;
|
|
7315
|
+
table.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = (_table$initialState = table.initialState) == null || (_table$initialState = _table$initialState.pagination) == null ? void 0 : _table$initialState.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex);
|
|
7316
|
+
};
|
|
7317
|
+
table.resetPageSize = defaultState => {
|
|
7318
|
+
var _table$initialState$p3, _table$initialState2;
|
|
7319
|
+
table.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p3 = (_table$initialState2 = table.initialState) == null || (_table$initialState2 = _table$initialState2.pagination) == null ? void 0 : _table$initialState2.pageSize) != null ? _table$initialState$p3 : defaultPageSize);
|
|
7320
|
+
};
|
|
7321
|
+
table.setPageSize = updater => {
|
|
7322
|
+
table.setPagination(old => {
|
|
7323
|
+
const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize));
|
|
7324
|
+
const topRowIndex = old.pageSize * old.pageIndex;
|
|
7325
|
+
const pageIndex = Math.floor(topRowIndex / pageSize);
|
|
7326
|
+
return {
|
|
7327
|
+
...old,
|
|
7328
|
+
pageIndex,
|
|
7329
|
+
pageSize
|
|
7330
|
+
};
|
|
7331
|
+
});
|
|
7332
|
+
};
|
|
7333
|
+
//deprecated
|
|
7334
|
+
table.setPageCount = updater => table.setPagination(old => {
|
|
7335
|
+
var _table$options$pageCo;
|
|
7336
|
+
let newPageCount = functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1);
|
|
7337
|
+
if (typeof newPageCount === 'number') {
|
|
7338
|
+
newPageCount = Math.max(-1, newPageCount);
|
|
7339
|
+
}
|
|
7340
|
+
return {
|
|
7341
|
+
...old,
|
|
7342
|
+
pageCount: newPageCount
|
|
7343
|
+
};
|
|
7344
|
+
});
|
|
7345
|
+
table.getPageOptions = memo(() => [table.getPageCount()], pageCount => {
|
|
7346
|
+
let pageOptions = [];
|
|
7347
|
+
if (pageCount && pageCount > 0) {
|
|
7348
|
+
pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i);
|
|
7349
|
+
}
|
|
7350
|
+
return pageOptions;
|
|
7351
|
+
}, getMemoOptions(table.options, 'debugTable'));
|
|
7352
|
+
table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0;
|
|
7353
|
+
table.getCanNextPage = () => {
|
|
7354
|
+
const {
|
|
7355
|
+
pageIndex
|
|
7356
|
+
} = table.getState().pagination;
|
|
7357
|
+
const pageCount = table.getPageCount();
|
|
7358
|
+
if (pageCount === -1) {
|
|
7359
|
+
return true;
|
|
7360
|
+
}
|
|
7361
|
+
if (pageCount === 0) {
|
|
7362
|
+
return false;
|
|
7363
|
+
}
|
|
7364
|
+
return pageIndex < pageCount - 1;
|
|
7365
|
+
};
|
|
7366
|
+
table.previousPage = () => {
|
|
7367
|
+
return table.setPageIndex(old => old - 1);
|
|
7368
|
+
};
|
|
7369
|
+
table.nextPage = () => {
|
|
7370
|
+
return table.setPageIndex(old => {
|
|
7371
|
+
return old + 1;
|
|
7372
|
+
});
|
|
7373
|
+
};
|
|
7374
|
+
table.firstPage = () => {
|
|
7375
|
+
return table.setPageIndex(0);
|
|
7376
|
+
};
|
|
7377
|
+
table.lastPage = () => {
|
|
7378
|
+
return table.setPageIndex(table.getPageCount() - 1);
|
|
7379
|
+
};
|
|
7380
|
+
table.getPrePaginationRowModel = () => table.getExpandedRowModel();
|
|
7381
|
+
table.getPaginationRowModel = () => {
|
|
7382
|
+
if (!table._getPaginationRowModel && table.options.getPaginationRowModel) {
|
|
7383
|
+
table._getPaginationRowModel = table.options.getPaginationRowModel(table);
|
|
7384
|
+
}
|
|
7385
|
+
if (table.options.manualPagination || !table._getPaginationRowModel) {
|
|
7386
|
+
return table.getPrePaginationRowModel();
|
|
7387
|
+
}
|
|
7388
|
+
return table._getPaginationRowModel();
|
|
7389
|
+
};
|
|
7390
|
+
table.getPageCount = () => {
|
|
7391
|
+
var _table$options$pageCo2;
|
|
7392
|
+
return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getRowCount() / table.getState().pagination.pageSize);
|
|
7393
|
+
};
|
|
7394
|
+
table.getRowCount = () => {
|
|
7395
|
+
var _table$options$rowCou;
|
|
7396
|
+
return (_table$options$rowCou = table.options.rowCount) != null ? _table$options$rowCou : table.getPrePaginationRowModel().rows.length;
|
|
7397
|
+
};
|
|
7398
|
+
}
|
|
7399
|
+
};
|
|
7400
|
+
|
|
7401
|
+
//
|
|
7402
|
+
|
|
7403
|
+
const getDefaultRowPinningState = () => ({
|
|
7404
|
+
top: [],
|
|
7405
|
+
bottom: []
|
|
7406
|
+
});
|
|
7407
|
+
const RowPinning = {
|
|
7408
|
+
getInitialState: state => {
|
|
7409
|
+
return {
|
|
7410
|
+
rowPinning: getDefaultRowPinningState(),
|
|
7411
|
+
...state
|
|
7412
|
+
};
|
|
7413
|
+
},
|
|
7414
|
+
getDefaultOptions: table => {
|
|
7415
|
+
return {
|
|
7416
|
+
onRowPinningChange: makeStateUpdater('rowPinning', table)
|
|
7417
|
+
};
|
|
7418
|
+
},
|
|
7419
|
+
createRow: (row, table) => {
|
|
7420
|
+
row.pin = (position, includeLeafRows, includeParentRows) => {
|
|
7421
|
+
const leafRowIds = includeLeafRows ? row.getLeafRows().map(_ref => {
|
|
7422
|
+
let {
|
|
7423
|
+
id
|
|
7424
|
+
} = _ref;
|
|
7425
|
+
return id;
|
|
7426
|
+
}) : [];
|
|
7427
|
+
const parentRowIds = includeParentRows ? row.getParentRows().map(_ref2 => {
|
|
7428
|
+
let {
|
|
7429
|
+
id
|
|
7430
|
+
} = _ref2;
|
|
7431
|
+
return id;
|
|
7432
|
+
}) : [];
|
|
7433
|
+
const rowIds = new Set([...parentRowIds, row.id, ...leafRowIds]);
|
|
7434
|
+
table.setRowPinning(old => {
|
|
7435
|
+
var _old$top3, _old$bottom3;
|
|
7436
|
+
if (position === 'bottom') {
|
|
7437
|
+
var _old$top, _old$bottom;
|
|
7438
|
+
return {
|
|
7439
|
+
top: ((_old$top = old == null ? void 0 : old.top) != null ? _old$top : []).filter(d => !(rowIds != null && rowIds.has(d))),
|
|
7440
|
+
bottom: [...((_old$bottom = old == null ? void 0 : old.bottom) != null ? _old$bottom : []).filter(d => !(rowIds != null && rowIds.has(d))), ...Array.from(rowIds)]
|
|
7441
|
+
};
|
|
7442
|
+
}
|
|
7443
|
+
if (position === 'top') {
|
|
7444
|
+
var _old$top2, _old$bottom2;
|
|
7445
|
+
return {
|
|
7446
|
+
top: [...((_old$top2 = old == null ? void 0 : old.top) != null ? _old$top2 : []).filter(d => !(rowIds != null && rowIds.has(d))), ...Array.from(rowIds)],
|
|
7447
|
+
bottom: ((_old$bottom2 = old == null ? void 0 : old.bottom) != null ? _old$bottom2 : []).filter(d => !(rowIds != null && rowIds.has(d)))
|
|
7448
|
+
};
|
|
7449
|
+
}
|
|
7450
|
+
return {
|
|
7451
|
+
top: ((_old$top3 = old == null ? void 0 : old.top) != null ? _old$top3 : []).filter(d => !(rowIds != null && rowIds.has(d))),
|
|
7452
|
+
bottom: ((_old$bottom3 = old == null ? void 0 : old.bottom) != null ? _old$bottom3 : []).filter(d => !(rowIds != null && rowIds.has(d)))
|
|
7453
|
+
};
|
|
7454
|
+
});
|
|
7455
|
+
};
|
|
7456
|
+
row.getCanPin = () => {
|
|
7457
|
+
var _ref3;
|
|
7458
|
+
const {
|
|
7459
|
+
enableRowPinning,
|
|
7460
|
+
enablePinning
|
|
7461
|
+
} = table.options;
|
|
7462
|
+
if (typeof enableRowPinning === 'function') {
|
|
7463
|
+
return enableRowPinning(row);
|
|
7464
|
+
}
|
|
7465
|
+
return (_ref3 = enableRowPinning != null ? enableRowPinning : enablePinning) != null ? _ref3 : true;
|
|
7466
|
+
};
|
|
7467
|
+
row.getIsPinned = () => {
|
|
7468
|
+
const rowIds = [row.id];
|
|
7469
|
+
const {
|
|
7470
|
+
top,
|
|
7471
|
+
bottom
|
|
7472
|
+
} = table.getState().rowPinning;
|
|
7473
|
+
const isTop = rowIds.some(d => top == null ? void 0 : top.includes(d));
|
|
7474
|
+
const isBottom = rowIds.some(d => bottom == null ? void 0 : bottom.includes(d));
|
|
7475
|
+
return isTop ? 'top' : isBottom ? 'bottom' : false;
|
|
7476
|
+
};
|
|
7477
|
+
row.getPinnedIndex = () => {
|
|
7478
|
+
var _ref4, _visiblePinnedRowIds$;
|
|
7479
|
+
const position = row.getIsPinned();
|
|
7480
|
+
if (!position) return -1;
|
|
7481
|
+
const visiblePinnedRowIds = (_ref4 = position === 'top' ? table.getTopRows() : table.getBottomRows()) == null ? void 0 : _ref4.map(_ref5 => {
|
|
7482
|
+
let {
|
|
7483
|
+
id
|
|
7484
|
+
} = _ref5;
|
|
7485
|
+
return id;
|
|
7486
|
+
});
|
|
7487
|
+
return (_visiblePinnedRowIds$ = visiblePinnedRowIds == null ? void 0 : visiblePinnedRowIds.indexOf(row.id)) != null ? _visiblePinnedRowIds$ : -1;
|
|
7488
|
+
};
|
|
7489
|
+
},
|
|
7490
|
+
createTable: table => {
|
|
7491
|
+
table.setRowPinning = updater => table.options.onRowPinningChange == null ? void 0 : table.options.onRowPinningChange(updater);
|
|
7492
|
+
table.resetRowPinning = defaultState => {
|
|
7493
|
+
var _table$initialState$r, _table$initialState;
|
|
7494
|
+
return table.setRowPinning(defaultState ? getDefaultRowPinningState() : (_table$initialState$r = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.rowPinning) != null ? _table$initialState$r : getDefaultRowPinningState());
|
|
7495
|
+
};
|
|
7496
|
+
table.getIsSomeRowsPinned = position => {
|
|
7497
|
+
var _pinningState$positio;
|
|
7498
|
+
const pinningState = table.getState().rowPinning;
|
|
7499
|
+
if (!position) {
|
|
7500
|
+
var _pinningState$top, _pinningState$bottom;
|
|
7501
|
+
return Boolean(((_pinningState$top = pinningState.top) == null ? void 0 : _pinningState$top.length) || ((_pinningState$bottom = pinningState.bottom) == null ? void 0 : _pinningState$bottom.length));
|
|
7502
|
+
}
|
|
7503
|
+
return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
|
|
7504
|
+
};
|
|
7505
|
+
table._getPinnedRows = (visibleRows, pinnedRowIds, position) => {
|
|
7506
|
+
var _table$options$keepPi;
|
|
7507
|
+
const rows = ((_table$options$keepPi = table.options.keepPinnedRows) != null ? _table$options$keepPi : true) ?
|
|
7508
|
+
//get all rows that are pinned even if they would not be otherwise visible
|
|
7509
|
+
//account for expanded parent rows, but not pagination or filtering
|
|
7510
|
+
(pinnedRowIds != null ? pinnedRowIds : []).map(rowId => {
|
|
7511
|
+
const row = table.getRow(rowId, true);
|
|
7512
|
+
return row.getIsAllParentsExpanded() ? row : null;
|
|
7513
|
+
}) :
|
|
7514
|
+
//else get only visible rows that are pinned
|
|
7515
|
+
(pinnedRowIds != null ? pinnedRowIds : []).map(rowId => visibleRows.find(row => row.id === rowId));
|
|
7516
|
+
return rows.filter(Boolean).map(d => ({
|
|
7517
|
+
...d,
|
|
7518
|
+
position
|
|
7519
|
+
}));
|
|
7520
|
+
};
|
|
7521
|
+
table.getTopRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.top], (allRows, topPinnedRowIds) => table._getPinnedRows(allRows, topPinnedRowIds, 'top'), getMemoOptions(table.options, 'debugRows'));
|
|
7522
|
+
table.getBottomRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.bottom], (allRows, bottomPinnedRowIds) => table._getPinnedRows(allRows, bottomPinnedRowIds, 'bottom'), getMemoOptions(table.options, 'debugRows'));
|
|
7523
|
+
table.getCenterRows = memo(() => [table.getRowModel().rows, table.getState().rowPinning.top, table.getState().rowPinning.bottom], (allRows, top, bottom) => {
|
|
7524
|
+
const topAndBottom = new Set([...(top != null ? top : []), ...(bottom != null ? bottom : [])]);
|
|
7525
|
+
return allRows.filter(d => !topAndBottom.has(d.id));
|
|
7526
|
+
}, getMemoOptions(table.options, 'debugRows'));
|
|
7527
|
+
}
|
|
7528
|
+
};
|
|
7529
|
+
|
|
7530
|
+
//
|
|
7531
|
+
|
|
7532
|
+
const RowSelection = {
|
|
7533
|
+
getInitialState: state => {
|
|
7534
|
+
return {
|
|
7535
|
+
rowSelection: {},
|
|
7536
|
+
...state
|
|
7537
|
+
};
|
|
7538
|
+
},
|
|
7539
|
+
getDefaultOptions: table => {
|
|
7540
|
+
return {
|
|
7541
|
+
onRowSelectionChange: makeStateUpdater('rowSelection', table),
|
|
7542
|
+
enableRowSelection: true,
|
|
7543
|
+
enableMultiRowSelection: true,
|
|
7544
|
+
enableSubRowSelection: true
|
|
7545
|
+
// enableGroupingRowSelection: false,
|
|
7546
|
+
// isAdditiveSelectEvent: (e: unknown) => !!e.metaKey,
|
|
7547
|
+
// isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey,
|
|
7548
|
+
};
|
|
7549
|
+
},
|
|
7550
|
+
createTable: table => {
|
|
7551
|
+
table.setRowSelection = updater => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater);
|
|
7552
|
+
table.resetRowSelection = defaultState => {
|
|
7553
|
+
var _table$initialState$r;
|
|
7554
|
+
return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {});
|
|
7555
|
+
};
|
|
7556
|
+
table.toggleAllRowsSelected = value => {
|
|
7557
|
+
table.setRowSelection(old => {
|
|
7558
|
+
value = typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected();
|
|
7559
|
+
const rowSelection = {
|
|
7560
|
+
...old
|
|
7561
|
+
};
|
|
7562
|
+
const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows;
|
|
7563
|
+
|
|
7564
|
+
// We don't use `mutateRowIsSelected` here for performance reasons.
|
|
7565
|
+
// All of the rows are flat already, so it wouldn't be worth it
|
|
7566
|
+
if (value) {
|
|
7567
|
+
preGroupedFlatRows.forEach(row => {
|
|
7568
|
+
if (!row.getCanSelect()) {
|
|
7569
|
+
return;
|
|
7570
|
+
}
|
|
7571
|
+
rowSelection[row.id] = true;
|
|
7572
|
+
});
|
|
7573
|
+
} else {
|
|
7574
|
+
preGroupedFlatRows.forEach(row => {
|
|
7575
|
+
delete rowSelection[row.id];
|
|
7576
|
+
});
|
|
7577
|
+
}
|
|
7578
|
+
return rowSelection;
|
|
7579
|
+
});
|
|
7580
|
+
};
|
|
7581
|
+
table.toggleAllPageRowsSelected = value => table.setRowSelection(old => {
|
|
7582
|
+
const resolvedValue = typeof value !== 'undefined' ? value : !table.getIsAllPageRowsSelected();
|
|
7583
|
+
const rowSelection = {
|
|
7584
|
+
...old
|
|
7585
|
+
};
|
|
7586
|
+
table.getRowModel().rows.forEach(row => {
|
|
7587
|
+
mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table);
|
|
7588
|
+
});
|
|
7589
|
+
return rowSelection;
|
|
7590
|
+
});
|
|
7591
|
+
|
|
7592
|
+
// addRowSelectionRange: rowId => {
|
|
7593
|
+
// const {
|
|
7594
|
+
// rows,
|
|
7595
|
+
// rowsById,
|
|
7596
|
+
// options: { selectGroupingRows, selectSubRows },
|
|
7597
|
+
// } = table
|
|
7598
|
+
|
|
7599
|
+
// const findSelectedRow = (rows: Row[]) => {
|
|
7600
|
+
// let found
|
|
7601
|
+
// rows.find(d => {
|
|
7602
|
+
// if (d.getIsSelected()) {
|
|
7603
|
+
// found = d
|
|
7604
|
+
// return true
|
|
7605
|
+
// }
|
|
7606
|
+
// const subFound = findSelectedRow(d.subRows || [])
|
|
7607
|
+
// if (subFound) {
|
|
7608
|
+
// found = subFound
|
|
7609
|
+
// return true
|
|
7610
|
+
// }
|
|
7611
|
+
// return false
|
|
7612
|
+
// })
|
|
7613
|
+
// return found
|
|
7614
|
+
// }
|
|
7615
|
+
|
|
7616
|
+
// const firstRow = findSelectedRow(rows) || rows[0]
|
|
7617
|
+
// const lastRow = rowsById[rowId]
|
|
7618
|
+
|
|
7619
|
+
// let include = false
|
|
7620
|
+
// const selectedRowIds = {}
|
|
7621
|
+
|
|
7622
|
+
// const addRow = (row: Row) => {
|
|
7623
|
+
// mutateRowIsSelected(selectedRowIds, row.id, true, {
|
|
7624
|
+
// rowsById,
|
|
7625
|
+
// selectGroupingRows: selectGroupingRows!,
|
|
7626
|
+
// selectSubRows: selectSubRows!,
|
|
7627
|
+
// })
|
|
7628
|
+
// }
|
|
7629
|
+
|
|
7630
|
+
// table.rows.forEach(row => {
|
|
7631
|
+
// const isFirstRow = row.id === firstRow.id
|
|
7632
|
+
// const isLastRow = row.id === lastRow.id
|
|
7633
|
+
|
|
7634
|
+
// if (isFirstRow || isLastRow) {
|
|
7635
|
+
// if (!include) {
|
|
7636
|
+
// include = true
|
|
7637
|
+
// } else if (include) {
|
|
7638
|
+
// addRow(row)
|
|
7639
|
+
// include = false
|
|
7640
|
+
// }
|
|
7641
|
+
// }
|
|
7642
|
+
|
|
7643
|
+
// if (include) {
|
|
7644
|
+
// addRow(row)
|
|
7645
|
+
// }
|
|
7646
|
+
// })
|
|
7647
|
+
|
|
7648
|
+
// table.setRowSelection(selectedRowIds)
|
|
7649
|
+
// },
|
|
7650
|
+
table.getPreSelectedRowModel = () => table.getCoreRowModel();
|
|
7651
|
+
table.getSelectedRowModel = memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => {
|
|
7652
|
+
if (!Object.keys(rowSelection).length) {
|
|
7653
|
+
return {
|
|
7654
|
+
rows: [],
|
|
7655
|
+
flatRows: [],
|
|
7656
|
+
rowsById: {}
|
|
7657
|
+
};
|
|
7658
|
+
}
|
|
7659
|
+
return selectRowsFn(table, rowModel);
|
|
7660
|
+
}, getMemoOptions(table.options, 'debugTable'));
|
|
7661
|
+
table.getFilteredSelectedRowModel = memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {
|
|
7662
|
+
if (!Object.keys(rowSelection).length) {
|
|
7663
|
+
return {
|
|
7664
|
+
rows: [],
|
|
7665
|
+
flatRows: [],
|
|
7666
|
+
rowsById: {}
|
|
7667
|
+
};
|
|
7668
|
+
}
|
|
7669
|
+
return selectRowsFn(table, rowModel);
|
|
7670
|
+
}, getMemoOptions(table.options, 'debugTable'));
|
|
7671
|
+
table.getGroupedSelectedRowModel = memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {
|
|
7672
|
+
if (!Object.keys(rowSelection).length) {
|
|
7673
|
+
return {
|
|
7674
|
+
rows: [],
|
|
7675
|
+
flatRows: [],
|
|
7676
|
+
rowsById: {}
|
|
7677
|
+
};
|
|
7678
|
+
}
|
|
7679
|
+
return selectRowsFn(table, rowModel);
|
|
7680
|
+
}, getMemoOptions(table.options, 'debugTable'));
|
|
7681
|
+
|
|
7682
|
+
///
|
|
7683
|
+
|
|
7684
|
+
// getGroupingRowCanSelect: rowId => {
|
|
7685
|
+
// const row = table.getRow(rowId)
|
|
7686
|
+
|
|
7687
|
+
// if (!row) {
|
|
7688
|
+
// throw new Error()
|
|
7689
|
+
// }
|
|
7690
|
+
|
|
7691
|
+
// if (typeof table.options.enableGroupingRowSelection === 'function') {
|
|
7692
|
+
// return table.options.enableGroupingRowSelection(row)
|
|
7693
|
+
// }
|
|
7694
|
+
|
|
7695
|
+
// return table.options.enableGroupingRowSelection ?? false
|
|
7696
|
+
// },
|
|
7697
|
+
|
|
7698
|
+
table.getIsAllRowsSelected = () => {
|
|
7699
|
+
const preGroupedFlatRows = table.getFilteredRowModel().flatRows;
|
|
7700
|
+
const {
|
|
7701
|
+
rowSelection
|
|
7702
|
+
} = table.getState();
|
|
7703
|
+
let isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length);
|
|
7704
|
+
if (isAllRowsSelected) {
|
|
7705
|
+
if (preGroupedFlatRows.some(row => row.getCanSelect() && !rowSelection[row.id])) {
|
|
7706
|
+
isAllRowsSelected = false;
|
|
7707
|
+
}
|
|
7708
|
+
}
|
|
7709
|
+
return isAllRowsSelected;
|
|
7710
|
+
};
|
|
7711
|
+
table.getIsAllPageRowsSelected = () => {
|
|
7712
|
+
const paginationFlatRows = table.getPaginationRowModel().flatRows.filter(row => row.getCanSelect());
|
|
7713
|
+
const {
|
|
7714
|
+
rowSelection
|
|
7715
|
+
} = table.getState();
|
|
7716
|
+
let isAllPageRowsSelected = !!paginationFlatRows.length;
|
|
7717
|
+
if (isAllPageRowsSelected && paginationFlatRows.some(row => !rowSelection[row.id])) {
|
|
7718
|
+
isAllPageRowsSelected = false;
|
|
7719
|
+
}
|
|
7720
|
+
return isAllPageRowsSelected;
|
|
7721
|
+
};
|
|
7722
|
+
table.getIsSomeRowsSelected = () => {
|
|
7723
|
+
var _table$getState$rowSe;
|
|
7724
|
+
const totalSelected = Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length;
|
|
7725
|
+
return totalSelected > 0 && totalSelected < table.getFilteredRowModel().flatRows.length;
|
|
7726
|
+
};
|
|
7727
|
+
table.getIsSomePageRowsSelected = () => {
|
|
7728
|
+
const paginationFlatRows = table.getPaginationRowModel().flatRows;
|
|
7729
|
+
return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.filter(row => row.getCanSelect()).some(d => d.getIsSelected() || d.getIsSomeSelected());
|
|
7730
|
+
};
|
|
7731
|
+
table.getToggleAllRowsSelectedHandler = () => {
|
|
7732
|
+
return e => {
|
|
7733
|
+
table.toggleAllRowsSelected(e.target.checked);
|
|
7734
|
+
};
|
|
7735
|
+
};
|
|
7736
|
+
table.getToggleAllPageRowsSelectedHandler = () => {
|
|
7737
|
+
return e => {
|
|
7738
|
+
table.toggleAllPageRowsSelected(e.target.checked);
|
|
7739
|
+
};
|
|
7740
|
+
};
|
|
7741
|
+
},
|
|
7742
|
+
createRow: (row, table) => {
|
|
7743
|
+
row.toggleSelected = (value, opts) => {
|
|
7744
|
+
const isSelected = row.getIsSelected();
|
|
7745
|
+
table.setRowSelection(old => {
|
|
7746
|
+
var _opts$selectChildren;
|
|
7747
|
+
value = typeof value !== 'undefined' ? value : !isSelected;
|
|
7748
|
+
if (row.getCanSelect() && isSelected === value) {
|
|
7749
|
+
return old;
|
|
7750
|
+
}
|
|
7751
|
+
const selectedRowIds = {
|
|
7752
|
+
...old
|
|
7753
|
+
};
|
|
7754
|
+
mutateRowIsSelected(selectedRowIds, row.id, value, (_opts$selectChildren = opts == null ? void 0 : opts.selectChildren) != null ? _opts$selectChildren : true, table);
|
|
7755
|
+
return selectedRowIds;
|
|
7756
|
+
});
|
|
7757
|
+
};
|
|
7758
|
+
row.getIsSelected = () => {
|
|
7759
|
+
const {
|
|
7760
|
+
rowSelection
|
|
7761
|
+
} = table.getState();
|
|
7762
|
+
return isRowSelected(row, rowSelection);
|
|
7763
|
+
};
|
|
7764
|
+
row.getIsSomeSelected = () => {
|
|
7765
|
+
const {
|
|
7766
|
+
rowSelection
|
|
7767
|
+
} = table.getState();
|
|
7768
|
+
return isSubRowSelected(row, rowSelection) === 'some';
|
|
7769
|
+
};
|
|
7770
|
+
row.getIsAllSubRowsSelected = () => {
|
|
7771
|
+
const {
|
|
7772
|
+
rowSelection
|
|
7773
|
+
} = table.getState();
|
|
7774
|
+
return isSubRowSelected(row, rowSelection) === 'all';
|
|
7775
|
+
};
|
|
7776
|
+
row.getCanSelect = () => {
|
|
7777
|
+
var _table$options$enable;
|
|
7778
|
+
if (typeof table.options.enableRowSelection === 'function') {
|
|
7779
|
+
return table.options.enableRowSelection(row);
|
|
7780
|
+
}
|
|
7781
|
+
return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true;
|
|
7782
|
+
};
|
|
7783
|
+
row.getCanSelectSubRows = () => {
|
|
7784
|
+
var _table$options$enable2;
|
|
7785
|
+
if (typeof table.options.enableSubRowSelection === 'function') {
|
|
7786
|
+
return table.options.enableSubRowSelection(row);
|
|
7787
|
+
}
|
|
7788
|
+
return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true;
|
|
7789
|
+
};
|
|
7790
|
+
row.getCanMultiSelect = () => {
|
|
7791
|
+
var _table$options$enable3;
|
|
7792
|
+
if (typeof table.options.enableMultiRowSelection === 'function') {
|
|
7793
|
+
return table.options.enableMultiRowSelection(row);
|
|
7794
|
+
}
|
|
7795
|
+
return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true;
|
|
7796
|
+
};
|
|
7797
|
+
row.getToggleSelectedHandler = () => {
|
|
7798
|
+
const canSelect = row.getCanSelect();
|
|
7799
|
+
return e => {
|
|
7800
|
+
var _target;
|
|
7801
|
+
if (!canSelect) return;
|
|
7802
|
+
row.toggleSelected((_target = e.target) == null ? void 0 : _target.checked);
|
|
7803
|
+
};
|
|
7804
|
+
};
|
|
7805
|
+
}
|
|
7806
|
+
};
|
|
7807
|
+
const mutateRowIsSelected = (selectedRowIds, id, value, includeChildren, table) => {
|
|
7808
|
+
var _row$subRows;
|
|
7809
|
+
const row = table.getRow(id, true);
|
|
7810
|
+
|
|
7811
|
+
// const isGrouped = row.getIsGrouped()
|
|
7812
|
+
|
|
7813
|
+
// if ( // TODO: enforce grouping row selection rules
|
|
7814
|
+
// !isGrouped ||
|
|
7815
|
+
// (isGrouped && table.options.enableGroupingRowSelection)
|
|
7816
|
+
// ) {
|
|
7817
|
+
if (value) {
|
|
7818
|
+
if (!row.getCanMultiSelect()) {
|
|
7819
|
+
Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key]);
|
|
7820
|
+
}
|
|
7821
|
+
if (row.getCanSelect()) {
|
|
7822
|
+
selectedRowIds[id] = true;
|
|
7823
|
+
}
|
|
7824
|
+
} else {
|
|
7825
|
+
delete selectedRowIds[id];
|
|
7826
|
+
}
|
|
7827
|
+
// }
|
|
7828
|
+
|
|
7829
|
+
if (includeChildren && (_row$subRows = row.subRows) != null && _row$subRows.length && row.getCanSelectSubRows()) {
|
|
7830
|
+
row.subRows.forEach(row => mutateRowIsSelected(selectedRowIds, row.id, value, includeChildren, table));
|
|
7831
|
+
}
|
|
7832
|
+
};
|
|
7833
|
+
function selectRowsFn(table, rowModel) {
|
|
7834
|
+
const rowSelection = table.getState().rowSelection;
|
|
7835
|
+
const newSelectedFlatRows = [];
|
|
7836
|
+
const newSelectedRowsById = {};
|
|
7837
|
+
|
|
7838
|
+
// Filters top level and nested rows
|
|
7839
|
+
const recurseRows = function (rows, depth) {
|
|
7840
|
+
return rows.map(row => {
|
|
7841
|
+
var _row$subRows2;
|
|
7842
|
+
const isSelected = isRowSelected(row, rowSelection);
|
|
7843
|
+
if (isSelected) {
|
|
7844
|
+
newSelectedFlatRows.push(row);
|
|
7845
|
+
newSelectedRowsById[row.id] = row;
|
|
7846
|
+
}
|
|
7847
|
+
if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
|
|
7848
|
+
row = {
|
|
7849
|
+
...row,
|
|
7850
|
+
subRows: recurseRows(row.subRows)
|
|
7851
|
+
};
|
|
7852
|
+
}
|
|
7853
|
+
if (isSelected) {
|
|
7854
|
+
return row;
|
|
7855
|
+
}
|
|
7856
|
+
}).filter(Boolean);
|
|
7857
|
+
};
|
|
7858
|
+
return {
|
|
7859
|
+
rows: recurseRows(rowModel.rows),
|
|
7860
|
+
flatRows: newSelectedFlatRows,
|
|
7861
|
+
rowsById: newSelectedRowsById
|
|
7862
|
+
};
|
|
7863
|
+
}
|
|
7864
|
+
function isRowSelected(row, selection) {
|
|
7865
|
+
var _selection$row$id;
|
|
7866
|
+
return (_selection$row$id = selection[row.id]) != null ? _selection$row$id : false;
|
|
7867
|
+
}
|
|
7868
|
+
function isSubRowSelected(row, selection, table) {
|
|
7869
|
+
var _row$subRows3;
|
|
7870
|
+
if (!((_row$subRows3 = row.subRows) != null && _row$subRows3.length)) return false;
|
|
7871
|
+
let allChildrenSelected = true;
|
|
7872
|
+
let someSelected = false;
|
|
7873
|
+
row.subRows.forEach(subRow => {
|
|
7874
|
+
// Bail out early if we know both of these
|
|
7875
|
+
if (someSelected && !allChildrenSelected) {
|
|
7876
|
+
return;
|
|
7877
|
+
}
|
|
7878
|
+
if (subRow.getCanSelect()) {
|
|
7879
|
+
if (isRowSelected(subRow, selection)) {
|
|
7880
|
+
someSelected = true;
|
|
7881
|
+
} else {
|
|
7882
|
+
allChildrenSelected = false;
|
|
7883
|
+
}
|
|
7884
|
+
}
|
|
7885
|
+
|
|
7886
|
+
// Check row selection of nested subrows
|
|
7887
|
+
if (subRow.subRows && subRow.subRows.length) {
|
|
7888
|
+
const subRowChildrenSelected = isSubRowSelected(subRow, selection);
|
|
7889
|
+
if (subRowChildrenSelected === 'all') {
|
|
7890
|
+
someSelected = true;
|
|
7891
|
+
} else if (subRowChildrenSelected === 'some') {
|
|
7892
|
+
someSelected = true;
|
|
7893
|
+
allChildrenSelected = false;
|
|
7894
|
+
} else {
|
|
7895
|
+
allChildrenSelected = false;
|
|
7896
|
+
}
|
|
7897
|
+
}
|
|
7898
|
+
});
|
|
7899
|
+
return allChildrenSelected ? 'all' : someSelected ? 'some' : false;
|
|
7900
|
+
}
|
|
7901
|
+
|
|
7902
|
+
const reSplitAlphaNumeric = /([0-9]+)/gm;
|
|
7903
|
+
const alphanumeric = (rowA, rowB, columnId) => {
|
|
7904
|
+
return compareAlphanumeric(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase());
|
|
7905
|
+
};
|
|
7906
|
+
const alphanumericCaseSensitive = (rowA, rowB, columnId) => {
|
|
7907
|
+
return compareAlphanumeric(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId)));
|
|
7908
|
+
};
|
|
7909
|
+
|
|
7910
|
+
// The text filter is more basic (less numeric support)
|
|
7911
|
+
// but is much faster
|
|
7912
|
+
const text = (rowA, rowB, columnId) => {
|
|
7913
|
+
return compareBasic(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase());
|
|
7914
|
+
};
|
|
7915
|
+
|
|
7916
|
+
// The text filter is more basic (less numeric support)
|
|
7917
|
+
// but is much faster
|
|
7918
|
+
const textCaseSensitive = (rowA, rowB, columnId) => {
|
|
7919
|
+
return compareBasic(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId)));
|
|
7920
|
+
};
|
|
7921
|
+
const datetime = (rowA, rowB, columnId) => {
|
|
7922
|
+
const a = rowA.getValue(columnId);
|
|
7923
|
+
const b = rowB.getValue(columnId);
|
|
7924
|
+
|
|
7925
|
+
// Can handle nullish values
|
|
7926
|
+
// Use > and < because == (and ===) doesn't work with
|
|
7927
|
+
// Date objects (would require calling getTime()).
|
|
7928
|
+
return a > b ? 1 : a < b ? -1 : 0;
|
|
7929
|
+
};
|
|
7930
|
+
const basic = (rowA, rowB, columnId) => {
|
|
7931
|
+
return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId));
|
|
7932
|
+
};
|
|
7933
|
+
|
|
7934
|
+
// Utils
|
|
7935
|
+
|
|
7936
|
+
function compareBasic(a, b) {
|
|
7937
|
+
return a === b ? 0 : a > b ? 1 : -1;
|
|
7938
|
+
}
|
|
7939
|
+
function toString(a) {
|
|
7940
|
+
if (typeof a === 'number') {
|
|
7941
|
+
if (isNaN(a) || a === Infinity || a === -Infinity) {
|
|
7942
|
+
return '';
|
|
7943
|
+
}
|
|
7944
|
+
return String(a);
|
|
7945
|
+
}
|
|
7946
|
+
if (typeof a === 'string') {
|
|
7947
|
+
return a;
|
|
7948
|
+
}
|
|
7949
|
+
return '';
|
|
7950
|
+
}
|
|
7951
|
+
|
|
7952
|
+
// Mixed sorting is slow, but very inclusive of many edge cases.
|
|
7953
|
+
// It handles numbers, mixed alphanumeric combinations, and even
|
|
7954
|
+
// null, undefined, and Infinity
|
|
7955
|
+
function compareAlphanumeric(aStr, bStr) {
|
|
7956
|
+
// Split on number groups, but keep the delimiter
|
|
7957
|
+
// Then remove falsey split values
|
|
7958
|
+
const a = aStr.split(reSplitAlphaNumeric).filter(Boolean);
|
|
7959
|
+
const b = bStr.split(reSplitAlphaNumeric).filter(Boolean);
|
|
7960
|
+
|
|
7961
|
+
// While
|
|
7962
|
+
while (a.length && b.length) {
|
|
7963
|
+
const aa = a.shift();
|
|
7964
|
+
const bb = b.shift();
|
|
7965
|
+
const an = parseInt(aa, 10);
|
|
7966
|
+
const bn = parseInt(bb, 10);
|
|
7967
|
+
const combo = [an, bn].sort();
|
|
7968
|
+
|
|
7969
|
+
// Both are string
|
|
7970
|
+
if (isNaN(combo[0])) {
|
|
7971
|
+
if (aa > bb) {
|
|
7972
|
+
return 1;
|
|
7973
|
+
}
|
|
7974
|
+
if (bb > aa) {
|
|
7975
|
+
return -1;
|
|
7976
|
+
}
|
|
7977
|
+
continue;
|
|
7978
|
+
}
|
|
7979
|
+
|
|
7980
|
+
// One is a string, one is a number
|
|
7981
|
+
if (isNaN(combo[1])) {
|
|
7982
|
+
return isNaN(an) ? -1 : 1;
|
|
7983
|
+
}
|
|
7984
|
+
|
|
7985
|
+
// Both are numbers
|
|
7986
|
+
if (an > bn) {
|
|
7987
|
+
return 1;
|
|
7988
|
+
}
|
|
7989
|
+
if (bn > an) {
|
|
7990
|
+
return -1;
|
|
7991
|
+
}
|
|
7992
|
+
}
|
|
7993
|
+
return a.length - b.length;
|
|
7994
|
+
}
|
|
7995
|
+
|
|
7996
|
+
// Exports
|
|
7997
|
+
|
|
7998
|
+
const sortingFns = {
|
|
7999
|
+
alphanumeric,
|
|
8000
|
+
alphanumericCaseSensitive,
|
|
8001
|
+
text,
|
|
8002
|
+
textCaseSensitive,
|
|
8003
|
+
datetime,
|
|
8004
|
+
basic
|
|
8005
|
+
};
|
|
8006
|
+
|
|
8007
|
+
//
|
|
8008
|
+
|
|
8009
|
+
const RowSorting = {
|
|
8010
|
+
getInitialState: state => {
|
|
8011
|
+
return {
|
|
8012
|
+
sorting: [],
|
|
8013
|
+
...state
|
|
8014
|
+
};
|
|
8015
|
+
},
|
|
8016
|
+
getDefaultColumnDef: () => {
|
|
8017
|
+
return {
|
|
8018
|
+
sortingFn: 'auto',
|
|
8019
|
+
sortUndefined: 1
|
|
8020
|
+
};
|
|
8021
|
+
},
|
|
8022
|
+
getDefaultOptions: table => {
|
|
8023
|
+
return {
|
|
8024
|
+
onSortingChange: makeStateUpdater('sorting', table),
|
|
8025
|
+
isMultiSortEvent: e => {
|
|
8026
|
+
return e.shiftKey;
|
|
8027
|
+
}
|
|
8028
|
+
};
|
|
8029
|
+
},
|
|
8030
|
+
createColumn: (column, table) => {
|
|
8031
|
+
column.getAutoSortingFn = () => {
|
|
8032
|
+
const firstRows = table.getFilteredRowModel().flatRows.slice(10);
|
|
8033
|
+
let isString = false;
|
|
8034
|
+
for (const row of firstRows) {
|
|
8035
|
+
const value = row == null ? void 0 : row.getValue(column.id);
|
|
8036
|
+
if (Object.prototype.toString.call(value) === '[object Date]') {
|
|
8037
|
+
return sortingFns.datetime;
|
|
8038
|
+
}
|
|
8039
|
+
if (typeof value === 'string') {
|
|
8040
|
+
isString = true;
|
|
8041
|
+
if (value.split(reSplitAlphaNumeric).length > 1) {
|
|
8042
|
+
return sortingFns.alphanumeric;
|
|
8043
|
+
}
|
|
8044
|
+
}
|
|
8045
|
+
}
|
|
8046
|
+
if (isString) {
|
|
8047
|
+
return sortingFns.text;
|
|
8048
|
+
}
|
|
8049
|
+
return sortingFns.basic;
|
|
8050
|
+
};
|
|
8051
|
+
column.getAutoSortDir = () => {
|
|
8052
|
+
const firstRow = table.getFilteredRowModel().flatRows[0];
|
|
8053
|
+
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
|
|
8054
|
+
if (typeof value === 'string') {
|
|
8055
|
+
return 'asc';
|
|
8056
|
+
}
|
|
8057
|
+
return 'desc';
|
|
8058
|
+
};
|
|
8059
|
+
column.getSortingFn = () => {
|
|
8060
|
+
var _table$options$sortin, _table$options$sortin2;
|
|
8061
|
+
if (!column) {
|
|
8062
|
+
throw new Error();
|
|
8063
|
+
}
|
|
8064
|
+
return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : (_table$options$sortin = (_table$options$sortin2 = table.options.sortingFns) == null ? void 0 : _table$options$sortin2[column.columnDef.sortingFn]) != null ? _table$options$sortin : sortingFns[column.columnDef.sortingFn];
|
|
8065
|
+
};
|
|
8066
|
+
column.toggleSorting = (desc, multi) => {
|
|
8067
|
+
// if (column.columns.length) {
|
|
8068
|
+
// column.columns.forEach((c, i) => {
|
|
8069
|
+
// if (c.id) {
|
|
8070
|
+
// table.toggleColumnSorting(c.id, undefined, multi || !!i)
|
|
8071
|
+
// }
|
|
8072
|
+
// })
|
|
8073
|
+
// return
|
|
8074
|
+
// }
|
|
8075
|
+
|
|
8076
|
+
// this needs to be outside of table.setSorting to be in sync with rerender
|
|
8077
|
+
const nextSortingOrder = column.getNextSortingOrder();
|
|
8078
|
+
const hasManualValue = typeof desc !== 'undefined' && desc !== null;
|
|
8079
|
+
table.setSorting(old => {
|
|
8080
|
+
// Find any existing sorting for this column
|
|
8081
|
+
const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
|
|
8082
|
+
const existingIndex = old == null ? void 0 : old.findIndex(d => d.id === column.id);
|
|
8083
|
+
let newSorting = [];
|
|
8084
|
+
|
|
8085
|
+
// What should we do with this sort action?
|
|
8086
|
+
let sortAction;
|
|
8087
|
+
let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc';
|
|
8088
|
+
|
|
8089
|
+
// Multi-mode
|
|
8090
|
+
if (old != null && old.length && column.getCanMultiSort() && multi) {
|
|
8091
|
+
if (existingSorting) {
|
|
8092
|
+
sortAction = 'toggle';
|
|
8093
|
+
} else {
|
|
8094
|
+
sortAction = 'add';
|
|
8095
|
+
}
|
|
8096
|
+
} else {
|
|
8097
|
+
// Normal mode
|
|
8098
|
+
if (old != null && old.length && existingIndex !== old.length - 1) {
|
|
8099
|
+
sortAction = 'replace';
|
|
8100
|
+
} else if (existingSorting) {
|
|
8101
|
+
sortAction = 'toggle';
|
|
8102
|
+
} else {
|
|
8103
|
+
sortAction = 'replace';
|
|
8104
|
+
}
|
|
8105
|
+
}
|
|
8106
|
+
|
|
8107
|
+
// Handle toggle states that will remove the sorting
|
|
8108
|
+
if (sortAction === 'toggle') {
|
|
8109
|
+
// If we are "actually" toggling (not a manual set value), should we remove the sorting?
|
|
8110
|
+
if (!hasManualValue) {
|
|
8111
|
+
// Is our intention to remove?
|
|
8112
|
+
if (!nextSortingOrder) {
|
|
8113
|
+
sortAction = 'remove';
|
|
8114
|
+
}
|
|
8115
|
+
}
|
|
8116
|
+
}
|
|
8117
|
+
if (sortAction === 'add') {
|
|
8118
|
+
var _table$options$maxMul;
|
|
8119
|
+
newSorting = [...old, {
|
|
8120
|
+
id: column.id,
|
|
8121
|
+
desc: nextDesc
|
|
8122
|
+
}];
|
|
8123
|
+
// Take latest n columns
|
|
8124
|
+
newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER));
|
|
8125
|
+
} else if (sortAction === 'toggle') {
|
|
8126
|
+
// This flips (or sets) the
|
|
8127
|
+
newSorting = old.map(d => {
|
|
8128
|
+
if (d.id === column.id) {
|
|
8129
|
+
return {
|
|
8130
|
+
...d,
|
|
8131
|
+
desc: nextDesc
|
|
8132
|
+
};
|
|
8133
|
+
}
|
|
8134
|
+
return d;
|
|
8135
|
+
});
|
|
8136
|
+
} else if (sortAction === 'remove') {
|
|
8137
|
+
newSorting = old.filter(d => d.id !== column.id);
|
|
8138
|
+
} else {
|
|
8139
|
+
newSorting = [{
|
|
8140
|
+
id: column.id,
|
|
8141
|
+
desc: nextDesc
|
|
8142
|
+
}];
|
|
8143
|
+
}
|
|
8144
|
+
return newSorting;
|
|
8145
|
+
});
|
|
8146
|
+
};
|
|
8147
|
+
column.getFirstSortDir = () => {
|
|
8148
|
+
var _ref, _column$columnDef$sor;
|
|
8149
|
+
const sortDescFirst = (_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === 'desc';
|
|
8150
|
+
return sortDescFirst ? 'desc' : 'asc';
|
|
8151
|
+
};
|
|
8152
|
+
column.getNextSortingOrder = multi => {
|
|
8153
|
+
var _table$options$enable, _table$options$enable2;
|
|
8154
|
+
const firstSortDirection = column.getFirstSortDir();
|
|
8155
|
+
const isSorted = column.getIsSorted();
|
|
8156
|
+
if (!isSorted) {
|
|
8157
|
+
return firstSortDirection;
|
|
8158
|
+
}
|
|
8159
|
+
if (isSorted !== firstSortDirection && ((_table$options$enable = table.options.enableSortingRemoval) != null ? _table$options$enable : true) && (
|
|
8160
|
+
// If enableSortRemove, enable in general
|
|
8161
|
+
multi ? (_table$options$enable2 = table.options.enableMultiRemove) != null ? _table$options$enable2 : true : true) // If multi, don't allow if enableMultiRemove))
|
|
8162
|
+
) {
|
|
8163
|
+
return false;
|
|
8164
|
+
}
|
|
8165
|
+
return isSorted === 'desc' ? 'asc' : 'desc';
|
|
8166
|
+
};
|
|
8167
|
+
column.getCanSort = () => {
|
|
8168
|
+
var _column$columnDef$ena, _table$options$enable3;
|
|
8169
|
+
return ((_column$columnDef$ena = column.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_table$options$enable3 = table.options.enableSorting) != null ? _table$options$enable3 : true) && !!column.accessorFn;
|
|
8170
|
+
};
|
|
8171
|
+
column.getCanMultiSort = () => {
|
|
8172
|
+
var _ref2, _column$columnDef$ena2;
|
|
8173
|
+
return (_ref2 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column.accessorFn;
|
|
8174
|
+
};
|
|
8175
|
+
column.getIsSorted = () => {
|
|
8176
|
+
var _table$getState$sorti;
|
|
8177
|
+
const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find(d => d.id === column.id);
|
|
8178
|
+
return !columnSort ? false : columnSort.desc ? 'desc' : 'asc';
|
|
8179
|
+
};
|
|
8180
|
+
column.getSortIndex = () => {
|
|
8181
|
+
var _table$getState$sorti2, _table$getState$sorti3;
|
|
8182
|
+
return (_table$getState$sorti2 = (_table$getState$sorti3 = table.getState().sorting) == null ? void 0 : _table$getState$sorti3.findIndex(d => d.id === column.id)) != null ? _table$getState$sorti2 : -1;
|
|
8183
|
+
};
|
|
8184
|
+
column.clearSorting = () => {
|
|
8185
|
+
//clear sorting for just 1 column
|
|
8186
|
+
table.setSorting(old => old != null && old.length ? old.filter(d => d.id !== column.id) : []);
|
|
8187
|
+
};
|
|
8188
|
+
column.getToggleSortingHandler = () => {
|
|
8189
|
+
const canSort = column.getCanSort();
|
|
8190
|
+
return e => {
|
|
8191
|
+
if (!canSort) return;
|
|
8192
|
+
e.persist == null || e.persist();
|
|
8193
|
+
column.toggleSorting == null || column.toggleSorting(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false);
|
|
8194
|
+
};
|
|
8195
|
+
};
|
|
8196
|
+
},
|
|
8197
|
+
createTable: table => {
|
|
8198
|
+
table.setSorting = updater => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater);
|
|
8199
|
+
table.resetSorting = defaultState => {
|
|
8200
|
+
var _table$initialState$s, _table$initialState;
|
|
8201
|
+
table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []);
|
|
8202
|
+
};
|
|
8203
|
+
table.getPreSortedRowModel = () => table.getGroupedRowModel();
|
|
8204
|
+
table.getSortedRowModel = () => {
|
|
8205
|
+
if (!table._getSortedRowModel && table.options.getSortedRowModel) {
|
|
8206
|
+
table._getSortedRowModel = table.options.getSortedRowModel(table);
|
|
8207
|
+
}
|
|
8208
|
+
if (table.options.manualSorting || !table._getSortedRowModel) {
|
|
8209
|
+
return table.getPreSortedRowModel();
|
|
8210
|
+
}
|
|
8211
|
+
return table._getSortedRowModel();
|
|
8212
|
+
};
|
|
8213
|
+
}
|
|
8214
|
+
};
|
|
8215
|
+
|
|
8216
|
+
const builtInFeatures = [Headers, ColumnVisibility, ColumnOrdering, ColumnPinning, ColumnFaceting, ColumnFiltering, GlobalFaceting,
|
|
8217
|
+
//depends on ColumnFaceting
|
|
8218
|
+
GlobalFiltering,
|
|
8219
|
+
//depends on ColumnFiltering
|
|
8220
|
+
RowSorting, ColumnGrouping,
|
|
8221
|
+
//depends on RowSorting
|
|
8222
|
+
RowExpanding, RowPagination, RowPinning, RowSelection, ColumnSizing];
|
|
8223
|
+
|
|
8224
|
+
//
|
|
8225
|
+
|
|
8226
|
+
function createTable(options) {
|
|
8227
|
+
var _options$_features, _options$initialState;
|
|
8228
|
+
const _features = [...builtInFeatures, ...((_options$_features = options._features) != null ? _options$_features : [])];
|
|
8229
|
+
let table = {
|
|
8230
|
+
_features
|
|
8231
|
+
};
|
|
8232
|
+
const defaultOptions = table._features.reduce((obj, feature) => {
|
|
8233
|
+
return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table));
|
|
8234
|
+
}, {});
|
|
8235
|
+
const mergeOptions = options => {
|
|
8236
|
+
if (table.options.mergeOptions) {
|
|
8237
|
+
return table.options.mergeOptions(defaultOptions, options);
|
|
8238
|
+
}
|
|
8239
|
+
return {
|
|
8240
|
+
...defaultOptions,
|
|
8241
|
+
...options
|
|
8242
|
+
};
|
|
8243
|
+
};
|
|
8244
|
+
const coreInitialState = {};
|
|
8245
|
+
let initialState = {
|
|
8246
|
+
...coreInitialState,
|
|
8247
|
+
...((_options$initialState = options.initialState) != null ? _options$initialState : {})
|
|
8248
|
+
};
|
|
8249
|
+
table._features.forEach(feature => {
|
|
8250
|
+
var _feature$getInitialSt;
|
|
8251
|
+
initialState = (_feature$getInitialSt = feature.getInitialState == null ? void 0 : feature.getInitialState(initialState)) != null ? _feature$getInitialSt : initialState;
|
|
8252
|
+
});
|
|
8253
|
+
const queued = [];
|
|
8254
|
+
let queuedTimeout = false;
|
|
8255
|
+
const coreInstance = {
|
|
8256
|
+
_features,
|
|
8257
|
+
options: {
|
|
8258
|
+
...defaultOptions,
|
|
8259
|
+
...options
|
|
8260
|
+
},
|
|
8261
|
+
initialState,
|
|
8262
|
+
_queue: cb => {
|
|
8263
|
+
queued.push(cb);
|
|
8264
|
+
if (!queuedTimeout) {
|
|
8265
|
+
queuedTimeout = true;
|
|
8266
|
+
|
|
8267
|
+
// Schedule a microtask to run the queued callbacks after
|
|
8268
|
+
// the current call stack (render, etc) has finished.
|
|
8269
|
+
Promise.resolve().then(() => {
|
|
8270
|
+
while (queued.length) {
|
|
8271
|
+
queued.shift()();
|
|
8272
|
+
}
|
|
8273
|
+
queuedTimeout = false;
|
|
8274
|
+
}).catch(error => setTimeout(() => {
|
|
8275
|
+
throw error;
|
|
8276
|
+
}));
|
|
8277
|
+
}
|
|
8278
|
+
},
|
|
8279
|
+
reset: () => {
|
|
8280
|
+
table.setState(table.initialState);
|
|
8281
|
+
},
|
|
8282
|
+
setOptions: updater => {
|
|
8283
|
+
const newOptions = functionalUpdate(updater, table.options);
|
|
8284
|
+
table.options = mergeOptions(newOptions);
|
|
8285
|
+
},
|
|
8286
|
+
getState: () => {
|
|
8287
|
+
return table.options.state;
|
|
8288
|
+
},
|
|
8289
|
+
setState: updater => {
|
|
8290
|
+
table.options.onStateChange == null || table.options.onStateChange(updater);
|
|
8291
|
+
},
|
|
8292
|
+
_getRowId: (row, index, parent) => {
|
|
8293
|
+
var _table$options$getRow;
|
|
8294
|
+
return (_table$options$getRow = table.options.getRowId == null ? void 0 : table.options.getRowId(row, index, parent)) != null ? _table$options$getRow : `${parent ? [parent.id, index].join('.') : index}`;
|
|
8295
|
+
},
|
|
8296
|
+
getCoreRowModel: () => {
|
|
8297
|
+
if (!table._getCoreRowModel) {
|
|
8298
|
+
table._getCoreRowModel = table.options.getCoreRowModel(table);
|
|
8299
|
+
}
|
|
8300
|
+
return table._getCoreRowModel();
|
|
8301
|
+
},
|
|
8302
|
+
// The final calls start at the bottom of the model,
|
|
8303
|
+
// expanded rows, which then work their way up
|
|
8304
|
+
|
|
8305
|
+
getRowModel: () => {
|
|
8306
|
+
return table.getPaginationRowModel();
|
|
8307
|
+
},
|
|
8308
|
+
//in next version, we should just pass in the row model as the optional 2nd arg
|
|
8309
|
+
getRow: (id, searchAll) => {
|
|
8310
|
+
let row = (searchAll ? table.getPrePaginationRowModel() : table.getRowModel()).rowsById[id];
|
|
8311
|
+
if (!row) {
|
|
8312
|
+
row = table.getCoreRowModel().rowsById[id];
|
|
8313
|
+
if (!row) {
|
|
8314
|
+
throw new Error();
|
|
8315
|
+
}
|
|
8316
|
+
}
|
|
8317
|
+
return row;
|
|
8318
|
+
},
|
|
8319
|
+
_getDefaultColumnDef: memo(() => [table.options.defaultColumn], defaultColumn => {
|
|
8320
|
+
var _defaultColumn;
|
|
8321
|
+
defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
|
|
8322
|
+
return {
|
|
8323
|
+
header: props => {
|
|
8324
|
+
const resolvedColumnDef = props.header.column.columnDef;
|
|
8325
|
+
if (resolvedColumnDef.accessorKey) {
|
|
8326
|
+
return resolvedColumnDef.accessorKey;
|
|
8327
|
+
}
|
|
8328
|
+
if (resolvedColumnDef.accessorFn) {
|
|
8329
|
+
return resolvedColumnDef.id;
|
|
8330
|
+
}
|
|
8331
|
+
return null;
|
|
8332
|
+
},
|
|
8333
|
+
// footer: props => props.header.column.id,
|
|
8334
|
+
cell: props => {
|
|
8335
|
+
var _props$renderValue$to, _props$renderValue;
|
|
8336
|
+
return (_props$renderValue$to = (_props$renderValue = props.renderValue()) == null || _props$renderValue.toString == null ? void 0 : _props$renderValue.toString()) != null ? _props$renderValue$to : null;
|
|
8337
|
+
},
|
|
8338
|
+
...table._features.reduce((obj, feature) => {
|
|
8339
|
+
return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
|
|
8340
|
+
}, {}),
|
|
8341
|
+
...defaultColumn
|
|
8342
|
+
};
|
|
8343
|
+
}, getMemoOptions(options, 'debugColumns')),
|
|
8344
|
+
_getColumnDefs: () => table.options.columns,
|
|
8345
|
+
getAllColumns: memo(() => [table._getColumnDefs()], columnDefs => {
|
|
8346
|
+
const recurseColumns = function (columnDefs, parent, depth) {
|
|
8347
|
+
if (depth === void 0) {
|
|
8348
|
+
depth = 0;
|
|
8349
|
+
}
|
|
8350
|
+
return columnDefs.map(columnDef => {
|
|
8351
|
+
const column = createColumn(table, columnDef, depth, parent);
|
|
8352
|
+
const groupingColumnDef = columnDef;
|
|
8353
|
+
column.columns = groupingColumnDef.columns ? recurseColumns(groupingColumnDef.columns, column, depth + 1) : [];
|
|
8354
|
+
return column;
|
|
8355
|
+
});
|
|
8356
|
+
};
|
|
8357
|
+
return recurseColumns(columnDefs);
|
|
8358
|
+
}, getMemoOptions(options, 'debugColumns')),
|
|
8359
|
+
getAllFlatColumns: memo(() => [table.getAllColumns()], allColumns => {
|
|
8360
|
+
return allColumns.flatMap(column => {
|
|
8361
|
+
return column.getFlatColumns();
|
|
8362
|
+
});
|
|
8363
|
+
}, getMemoOptions(options, 'debugColumns')),
|
|
8364
|
+
_getAllFlatColumnsById: memo(() => [table.getAllFlatColumns()], flatColumns => {
|
|
8365
|
+
return flatColumns.reduce((acc, column) => {
|
|
8366
|
+
acc[column.id] = column;
|
|
8367
|
+
return acc;
|
|
8368
|
+
}, {});
|
|
8369
|
+
}, getMemoOptions(options, 'debugColumns')),
|
|
8370
|
+
getAllLeafColumns: memo(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns) => {
|
|
8371
|
+
let leafColumns = allColumns.flatMap(column => column.getLeafColumns());
|
|
8372
|
+
return orderColumns(leafColumns);
|
|
8373
|
+
}, getMemoOptions(options, 'debugColumns')),
|
|
8374
|
+
getColumn: columnId => {
|
|
8375
|
+
const column = table._getAllFlatColumnsById()[columnId];
|
|
8376
|
+
return column;
|
|
8377
|
+
}
|
|
8378
|
+
};
|
|
8379
|
+
Object.assign(table, coreInstance);
|
|
8380
|
+
for (let index = 0; index < table._features.length; index++) {
|
|
8381
|
+
const feature = table._features[index];
|
|
8382
|
+
feature == null || feature.createTable == null || feature.createTable(table);
|
|
8383
|
+
}
|
|
8384
|
+
return table;
|
|
8385
|
+
}
|
|
8386
|
+
|
|
8387
|
+
function getCoreRowModel() {
|
|
8388
|
+
return table => memo(() => [table.options.data], data => {
|
|
8389
|
+
const rowModel = {
|
|
8390
|
+
rows: [],
|
|
8391
|
+
flatRows: [],
|
|
8392
|
+
rowsById: {}
|
|
8393
|
+
};
|
|
8394
|
+
const accessRows = function (originalRows, depth, parentRow) {
|
|
8395
|
+
if (depth === void 0) {
|
|
8396
|
+
depth = 0;
|
|
8397
|
+
}
|
|
8398
|
+
const rows = [];
|
|
8399
|
+
for (let i = 0; i < originalRows.length; i++) {
|
|
8400
|
+
// This could be an expensive check at scale, so we should move it somewhere else, but where?
|
|
8401
|
+
// if (!id) {
|
|
8402
|
+
// if ("production" !== 'production') {
|
|
8403
|
+
// throw new Error(`getRowId expected an ID, but got ${id}`)
|
|
8404
|
+
// }
|
|
8405
|
+
// }
|
|
8406
|
+
|
|
8407
|
+
// Make the row
|
|
8408
|
+
const row = createRow(table, table._getRowId(originalRows[i], i, parentRow), originalRows[i], i, depth, undefined, parentRow == null ? void 0 : parentRow.id);
|
|
8409
|
+
|
|
8410
|
+
// Keep track of every row in a flat array
|
|
8411
|
+
rowModel.flatRows.push(row);
|
|
8412
|
+
// Also keep track of every row by its ID
|
|
8413
|
+
rowModel.rowsById[row.id] = row;
|
|
8414
|
+
// Push table row into parent
|
|
8415
|
+
rows.push(row);
|
|
8416
|
+
|
|
8417
|
+
// Get the original subrows
|
|
8418
|
+
if (table.options.getSubRows) {
|
|
8419
|
+
var _row$originalSubRows;
|
|
8420
|
+
row.originalSubRows = table.options.getSubRows(originalRows[i], i);
|
|
8421
|
+
|
|
8422
|
+
// Then recursively access them
|
|
8423
|
+
if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) {
|
|
8424
|
+
row.subRows = accessRows(row.originalSubRows, depth + 1, row);
|
|
8425
|
+
}
|
|
8426
|
+
}
|
|
8427
|
+
}
|
|
8428
|
+
return rows;
|
|
8429
|
+
};
|
|
8430
|
+
rowModel.rows = accessRows(data);
|
|
8431
|
+
return rowModel;
|
|
8432
|
+
}, getMemoOptions(table.options, 'debugTable', 'getRowModel', () => table._autoResetPageIndex()));
|
|
8433
|
+
}
|
|
8434
|
+
|
|
8435
|
+
const nvDatagridCss = "nv-datagrid table{border-collapse:collapse;border-color:inherit;text-indent:0}";
|
|
8436
|
+
var NvDatagridStyle0 = nvDatagridCss;
|
|
8437
|
+
|
|
8438
|
+
/**
|
|
8439
|
+
* A flexible data grid component powered by `@tanstack/table-core`.
|
|
8440
|
+
* @slot default - Use this slot to insert HTML into the data grid content.
|
|
8441
|
+
* @slot head - Use this slot to insert HTML into the data grid header.
|
|
8442
|
+
* @slot before - Use this slot to insert HTML before the data grid.
|
|
8443
|
+
* @slot after - Use this slot to insert HTML after the data grid.
|
|
8444
|
+
* @slot body - Use this slot to insert HTML into the data grid body.
|
|
8445
|
+
*/
|
|
8446
|
+
class NvDatagrid {
|
|
8447
|
+
constructor(hostRef) {
|
|
8448
|
+
registerInstance(this, hostRef);
|
|
8449
|
+
this.table = null;
|
|
8450
|
+
this.parsedColumns = [];
|
|
8451
|
+
this.parsedData = [];
|
|
8452
|
+
this.hasSlotHead = false;
|
|
8453
|
+
this.hasSlotBody = false;
|
|
8454
|
+
this.columns = [];
|
|
8455
|
+
this.columnsJson = undefined;
|
|
8456
|
+
this.data = [];
|
|
8457
|
+
this.dataJson = undefined;
|
|
8458
|
+
this.noDataMessage = 'No data available';
|
|
8459
|
+
this.noColumnsNoDataMessage = 'No data or columns available to display.';
|
|
8460
|
+
}
|
|
8461
|
+
//#endregion PROPERTIES
|
|
8462
|
+
/****************************************************************************/
|
|
8463
|
+
//#region WATCHERS
|
|
8464
|
+
parseColumns(newValue, oldValue) {
|
|
8465
|
+
this.parseColumnsArray(newValue, oldValue);
|
|
8466
|
+
}
|
|
8467
|
+
parseJsonColumns(newValue) {
|
|
8468
|
+
try {
|
|
8469
|
+
const newItems = newValue ? JSON.parse(newValue) : [];
|
|
8470
|
+
this.parseColumnsArray(newItems, this.parsedColumns);
|
|
8471
|
+
}
|
|
8472
|
+
catch (e) {
|
|
8473
|
+
console.error('Invalid JSON format for columnsJson:', e.message);
|
|
8474
|
+
this.parsedColumns = [];
|
|
8475
|
+
}
|
|
8476
|
+
}
|
|
8477
|
+
parseData(newValue, oldValue) {
|
|
8478
|
+
this.parseDataArray(newValue, oldValue);
|
|
8479
|
+
}
|
|
8480
|
+
parseJsonData(newValue) {
|
|
8481
|
+
try {
|
|
8482
|
+
const newItems = newValue ? JSON.parse(newValue) : [];
|
|
8483
|
+
this.parseDataArray(newItems, this.parsedData);
|
|
8484
|
+
}
|
|
8485
|
+
catch (e) {
|
|
8486
|
+
console.error('Invalid JSON format for dataJson:', e.message);
|
|
8487
|
+
this.parsedData = [];
|
|
8488
|
+
}
|
|
8489
|
+
}
|
|
8490
|
+
handleParsedChange() {
|
|
8491
|
+
this.initializeTable();
|
|
8492
|
+
}
|
|
8493
|
+
//#endregion WATCHERS
|
|
8494
|
+
/****************************************************************************/
|
|
8495
|
+
//#region METHODS
|
|
8496
|
+
initializeTable() {
|
|
8497
|
+
// Clear the previous table instance (if any)
|
|
8498
|
+
this.table = null;
|
|
8499
|
+
// Set default options for the table
|
|
8500
|
+
const tableOptions = {
|
|
8501
|
+
columns: [],
|
|
8502
|
+
data: [],
|
|
8503
|
+
getCoreRowModel: getCoreRowModel(),
|
|
8504
|
+
debugAll: true,
|
|
8505
|
+
onStateChange: state => console.log('Table state changed:', state),
|
|
8506
|
+
renderFallbackValue: 'No rows to display',
|
|
8507
|
+
state: {
|
|
8508
|
+
sorting: [], // Default: no active sorting
|
|
8509
|
+
columnVisibility: {}, // Default: all columns visible
|
|
8510
|
+
columnFilters: [], // Default: no column filters
|
|
8511
|
+
columnPinning: {}, // Default: no column pinning
|
|
8512
|
+
columnSizing: {}, // Default: no column sizing
|
|
8513
|
+
columnOrder: [], // Default: as defined in the `columns`
|
|
8514
|
+
pagination: null, // Default: no pagination
|
|
8515
|
+
grouping: [], // Default: no active grouping
|
|
8516
|
+
expanded: {}, // Default: no expanded rows
|
|
8517
|
+
rowPinning: {}, // Default: no row pinning
|
|
8518
|
+
rowSelection: {}, // Default: no row selection
|
|
8519
|
+
globalFilter: null, // Default: no global filter
|
|
8520
|
+
columnSizingInfo: {
|
|
8521
|
+
columnSizingStart: null,
|
|
8522
|
+
deltaOffset: null,
|
|
8523
|
+
deltaPercentage: null,
|
|
8524
|
+
isResizingColumn: false,
|
|
8525
|
+
startOffset: null,
|
|
8526
|
+
startSize: null,
|
|
8527
|
+
}, // Default: no column sizing info
|
|
8528
|
+
},
|
|
8529
|
+
};
|
|
8530
|
+
// Validate and generate column definitions
|
|
8531
|
+
const validColumns = this.parsedColumns.filter(column => (column === null || column === void 0 ? void 0 : column.accessor) && (column === null || column === void 0 ? void 0 : column.header));
|
|
8532
|
+
// Helper function to generate column definitions
|
|
8533
|
+
const generateColumns = () => {
|
|
8534
|
+
const columnHelper = createColumnHelper();
|
|
8535
|
+
if (validColumns.length > 0) {
|
|
8536
|
+
// Use defined columns
|
|
8537
|
+
return validColumns.map(column => columnHelper.accessor(column.accessor, {
|
|
8538
|
+
header: column.header,
|
|
8539
|
+
cell: info => info.getValue(),
|
|
8540
|
+
}));
|
|
8541
|
+
}
|
|
8542
|
+
else if (tableOptions.data && tableOptions.data.length > 0) {
|
|
8543
|
+
// Generate columns from data keys
|
|
8544
|
+
const sampleRow = tableOptions.data[0];
|
|
8545
|
+
return Object.keys(sampleRow).map(key => columnHelper.accessor(key, {
|
|
8546
|
+
header: key.charAt(0).toUpperCase() + key.slice(1), // Capitalize key for header
|
|
8547
|
+
cell: info => info.getValue(),
|
|
8548
|
+
}));
|
|
8549
|
+
}
|
|
8550
|
+
else {
|
|
8551
|
+
// No columns and no data
|
|
8552
|
+
return [];
|
|
8553
|
+
}
|
|
8554
|
+
};
|
|
8555
|
+
const setTableData = () => {
|
|
8556
|
+
if (this.parsedData &&
|
|
8557
|
+
Array.isArray(this.parsedData) &&
|
|
8558
|
+
this.parsedData.length > 0) {
|
|
8559
|
+
return [...this.parsedData];
|
|
8560
|
+
}
|
|
8561
|
+
else {
|
|
8562
|
+
return [];
|
|
8563
|
+
}
|
|
8564
|
+
};
|
|
8565
|
+
// Update tableOptions based on parsed data and columns
|
|
8566
|
+
const hasColumns = validColumns && Array.isArray(validColumns) && validColumns.length > 0;
|
|
8567
|
+
const hasData = (this.parsedData &&
|
|
8568
|
+
Array.isArray(this.parsedData) &&
|
|
8569
|
+
this.parsedData.length > 0) ||
|
|
8570
|
+
this.hasSlotBody;
|
|
8571
|
+
if (!hasColumns && !hasData) ;
|
|
8572
|
+
else if (hasColumns && !hasData) {
|
|
8573
|
+
tableOptions.columns = generateColumns();
|
|
8574
|
+
}
|
|
8575
|
+
else {
|
|
8576
|
+
// Both columns and data are available
|
|
8577
|
+
// No columns and data is available
|
|
8578
|
+
tableOptions.data = setTableData();
|
|
8579
|
+
tableOptions.columns = generateColumns();
|
|
8580
|
+
}
|
|
8581
|
+
// Initialize the table
|
|
8582
|
+
this.table = createTable(tableOptions);
|
|
8583
|
+
}
|
|
8584
|
+
/**
|
|
8585
|
+
* Parses the columns array.
|
|
8586
|
+
* @param {Column[]} newValue - The new value of the columns array.
|
|
8587
|
+
* @param {Column[]} oldValue - The old value of the columns array.
|
|
8588
|
+
*/
|
|
8589
|
+
parseColumnsArray(newValue, oldValue) {
|
|
8590
|
+
if (JSON.stringify(newValue) === JSON.stringify(oldValue))
|
|
8591
|
+
return; // Deep comparison
|
|
8592
|
+
this.parsedColumns = Array.isArray(newValue) ? newValue : [];
|
|
8593
|
+
}
|
|
8594
|
+
/**
|
|
8595
|
+
* Parses the data array.
|
|
8596
|
+
* @param {any[]} newValue - The new value of the data array.
|
|
8597
|
+
* @param {any[]} oldValue - The old value of the data array.
|
|
8598
|
+
*/
|
|
8599
|
+
parseDataArray(newValue, oldValue) {
|
|
8600
|
+
if (JSON.stringify(newValue) === JSON.stringify(oldValue))
|
|
8601
|
+
return; // Deep comparison
|
|
8602
|
+
this.parsedData = Array.isArray(newValue) ? newValue : [];
|
|
8603
|
+
}
|
|
8604
|
+
//#endregion METHODS
|
|
8605
|
+
/****************************************************************************/
|
|
8606
|
+
//#region LIFECYCLE
|
|
8607
|
+
componentWillLoad() {
|
|
8608
|
+
this.hasSlotHead = !!this.el.querySelector('[slot="head"]');
|
|
8609
|
+
if (this.hasSlotHead) {
|
|
8610
|
+
const headSlot = this.el.querySelector('[slot="head"]');
|
|
8611
|
+
const headSlotRows = this.hasSlotHead
|
|
8612
|
+
? Array.from(headSlot.querySelectorAll('nv-datagridrow'))
|
|
8613
|
+
: [];
|
|
8614
|
+
const mappedRows = headSlotRows.map(row => {
|
|
8615
|
+
const cells = Array.from(row.querySelectorAll('nv-datagridcolumn'));
|
|
8616
|
+
return cells.map(cell => ({
|
|
8617
|
+
header: cell.getAttribute('header') || '',
|
|
8618
|
+
accessor: cell.getAttribute('accessor') || '',
|
|
8619
|
+
}));
|
|
8620
|
+
});
|
|
8621
|
+
// Flatten the nested arrays into a single array of columns
|
|
8622
|
+
const flatMappedColumns = mappedRows.flat();
|
|
8623
|
+
this.parsedColumns = flatMappedColumns;
|
|
8624
|
+
}
|
|
8625
|
+
this.hasSlotBody = !!this.el.querySelector('[slot="body"]');
|
|
8626
|
+
if (this.hasSlotBody) {
|
|
8627
|
+
const bodySlot = this.el.querySelector('[slot="body"]');
|
|
8628
|
+
const bodySlotRows = this.hasSlotBody
|
|
8629
|
+
? Array.from(bodySlot.querySelectorAll('nv-datagridrow'))
|
|
8630
|
+
: [];
|
|
8631
|
+
const mappedRows = bodySlotRows.map(row => {
|
|
8632
|
+
const cells = Array.from(row.querySelectorAll('nv-datagriddatacell'));
|
|
8633
|
+
return cells.map(cell => {
|
|
8634
|
+
return {
|
|
8635
|
+
accessor: cell.accessor,
|
|
8636
|
+
value: cell.innerHTML,
|
|
8637
|
+
};
|
|
8638
|
+
});
|
|
8639
|
+
});
|
|
8640
|
+
// Flatten the nested arrays into a single array of data
|
|
8641
|
+
const flatMappedData = mappedRows.map(row => row.reduce((acc, cell) => {
|
|
8642
|
+
acc[cell.accessor] = cell.value;
|
|
8643
|
+
return acc;
|
|
8644
|
+
}, {}));
|
|
8645
|
+
this.parsedData = flatMappedData;
|
|
8646
|
+
}
|
|
8647
|
+
if (this.columnsJson) {
|
|
8648
|
+
this.parseJsonColumns(this.columnsJson);
|
|
8649
|
+
}
|
|
8650
|
+
else if (this.columns && this.columns.length > 0) {
|
|
8651
|
+
this.parseColumns(this.columns, this.parsedColumns);
|
|
8652
|
+
}
|
|
8653
|
+
if (this.dataJson) {
|
|
8654
|
+
this.parseJsonData(this.dataJson);
|
|
8655
|
+
}
|
|
8656
|
+
else if (this.data && this.data.length > 0) {
|
|
8657
|
+
this.parseData(this.data, this.parsedData);
|
|
8658
|
+
}
|
|
8659
|
+
}
|
|
8660
|
+
componentDidLoad() {
|
|
8661
|
+
this.initializeTable();
|
|
8662
|
+
}
|
|
8663
|
+
//#endregion LIFECYCLE
|
|
8664
|
+
/****************************************************************************/
|
|
8665
|
+
//#region RENDER
|
|
8666
|
+
render() {
|
|
8667
|
+
var _a, _b, _c;
|
|
8668
|
+
const headerGroups = !this.table ||
|
|
8669
|
+
this.table === undefined ||
|
|
8670
|
+
(this.parsedColumns.length === 0 && !this.hasSlotHead)
|
|
8671
|
+
? []
|
|
8672
|
+
: (_a = this.table) === null || _a === void 0 ? void 0 : _a.getHeaderGroups();
|
|
8673
|
+
const rows = !this.table ||
|
|
8674
|
+
this.table === undefined ||
|
|
8675
|
+
(this.parsedData.length === 0 && !this.hasSlotBody)
|
|
8676
|
+
? []
|
|
8677
|
+
: (_c = (_b = this.table) === null || _b === void 0 ? void 0 : _b.getRowModel()) === null || _c === void 0 ? void 0 : _c.rows;
|
|
8678
|
+
return (hAsync(Host, { key: '7f3244baba5487f57ba32b6f5e68cbb5794efce9' }, hAsync("div", { key: '35cbeed33a37393ee16dbd06a43fd75e8affb0d6', class: "hidden" }, hAsync("slot", { key: '03458f585639fb906e74c3124f74c38fb2d9d96f' }), hAsync("slot", { key: 'e4862ff4ba814bd34c1d39081be83d11e3884b4a', name: "head" }), hAsync("slot", { key: 'd0d77e8d159590531760052d842b4e461c6e0652', name: "body" })), hAsync("slot", { key: '57150feaf6ac865d838e31edeae0af6d92a9dedb', name: "before" }), this.parsedColumns.length === 0 &&
|
|
8679
|
+
this.parsedData.length === 0 &&
|
|
8680
|
+
!this.hasSlotHead &&
|
|
8681
|
+
!this.hasSlotBody ? (hAsync("p", null, this.noColumnsNoDataMessage)) : (hAsync("table", null, this.parsedColumns.length > 0 && headerGroups.length > 0 && (hAsync("thead", null, this.parsedColumns.length > 0 && headerGroups
|
|
8682
|
+
? headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.map(headerGroup => (hAsync("tr", { key: headerGroup.id }, headerGroup.headers.map(header => (hAsync("th", { key: header.id }, header.isPlaceholder
|
|
8683
|
+
? null
|
|
8684
|
+
: header.column.columnDef.header))))))
|
|
8685
|
+
: null)), hAsync("tbody", null, !rows || rows.length === 0 ? (hAsync("tr", null, hAsync("td", { colSpan: this.parsedColumns.length || 12 }, this.noDataMessage))) : (rows.map(row => {
|
|
8686
|
+
const rowId = row.id;
|
|
8687
|
+
const visibleCells = row === null || row === void 0 ? void 0 : row.getVisibleCells();
|
|
8688
|
+
const cells = visibleCells === null || visibleCells === void 0 ? void 0 : visibleCells.map(cell => {
|
|
8689
|
+
const cellValue = cell.getValue();
|
|
8690
|
+
return `<td key="${cell.id}" data-row-id="${rowId}">${cellValue}</td>`;
|
|
8691
|
+
}).join('');
|
|
8692
|
+
return hAsync("tr", { key: rowId, innerHTML: cells });
|
|
8693
|
+
}))))), hAsync("slot", { key: '35b4438cfaa83c045d49da21aeb4dc13356242ad', name: "after" })));
|
|
8694
|
+
}
|
|
8695
|
+
get el() { return getElement(this); }
|
|
8696
|
+
static get watchers() { return {
|
|
8697
|
+
"columns": ["parseColumns"],
|
|
8698
|
+
"columnsJson": ["parseJsonColumns"],
|
|
8699
|
+
"data": ["parseData"],
|
|
8700
|
+
"dataJson": ["parseJsonData"],
|
|
8701
|
+
"parsedColumns": ["handleParsedChange"],
|
|
8702
|
+
"parsedData": ["handleParsedChange"]
|
|
8703
|
+
}; }
|
|
8704
|
+
static get style() { return NvDatagridStyle0; }
|
|
8705
|
+
static get cmpMeta() { return {
|
|
8706
|
+
"$flags$": 4,
|
|
8707
|
+
"$tagName$": "nv-datagrid",
|
|
8708
|
+
"$members$": {
|
|
8709
|
+
"columns": [16],
|
|
8710
|
+
"columnsJson": [513, "columns-json"],
|
|
8711
|
+
"data": [16],
|
|
8712
|
+
"dataJson": [513, "data-json"],
|
|
8713
|
+
"noDataMessage": [1, "no-data-message"],
|
|
8714
|
+
"noColumnsNoDataMessage": [1, "no-columns-no-data-message"],
|
|
8715
|
+
"table": [32],
|
|
8716
|
+
"parsedColumns": [32],
|
|
8717
|
+
"parsedData": [32],
|
|
8718
|
+
"hasSlotHead": [32],
|
|
8719
|
+
"hasSlotBody": [32]
|
|
8720
|
+
},
|
|
8721
|
+
"$listeners$": undefined,
|
|
8722
|
+
"$lazyBundleId$": "-",
|
|
8723
|
+
"$attrsToReflect$": [["columnsJson", "columns-json"], ["dataJson", "data-json"]]
|
|
8724
|
+
}; }
|
|
8725
|
+
}
|
|
8726
|
+
|
|
8727
|
+
const nvDatagridbodyCss = "";
|
|
8728
|
+
var NvDatagridbodyStyle0 = nvDatagridbodyCss;
|
|
8729
|
+
|
|
8730
|
+
/**
|
|
8731
|
+
* @slot default - Use this slot to insert HTML into the data grid body.
|
|
8732
|
+
*/
|
|
8733
|
+
class NvDatagridbody {
|
|
8734
|
+
constructor(hostRef) {
|
|
8735
|
+
registerInstance(this, hostRef);
|
|
8736
|
+
}
|
|
8737
|
+
/****************************************************************************/
|
|
8738
|
+
//#region RENDER
|
|
8739
|
+
render() {
|
|
8740
|
+
return (hAsync(Host, { key: 'c24bf0e6d18d00b39b6e0382b0268ee24e6e7567' }, hAsync("tbody", { key: '1fae4b6126134317bd2dc7d4819ed861e8915761' }, hAsync("slot", { key: 'a6a537e6ed6c8b831da5294c1bce7010038b6291' }))));
|
|
8741
|
+
}
|
|
8742
|
+
static get style() { return NvDatagridbodyStyle0; }
|
|
8743
|
+
static get cmpMeta() { return {
|
|
8744
|
+
"$flags$": 4,
|
|
8745
|
+
"$tagName$": "nv-datagridbody",
|
|
8746
|
+
"$members$": undefined,
|
|
8747
|
+
"$listeners$": undefined,
|
|
8748
|
+
"$lazyBundleId$": "-",
|
|
8749
|
+
"$attrsToReflect$": []
|
|
8750
|
+
}; }
|
|
8751
|
+
}
|
|
8752
|
+
|
|
8753
|
+
const nvDatagridcolumnCss = "";
|
|
8754
|
+
var NvDatagridcolumnStyle0 = nvDatagridcolumnCss;
|
|
8755
|
+
|
|
8756
|
+
/**
|
|
8757
|
+
* @slot default - Use this slot to insert HTML into the data grid column.
|
|
8758
|
+
*/
|
|
8759
|
+
class NvDatagridcolumn {
|
|
8760
|
+
constructor(hostRef) {
|
|
8761
|
+
registerInstance(this, hostRef);
|
|
8762
|
+
this.header = undefined;
|
|
8763
|
+
this.accessor = undefined;
|
|
8764
|
+
}
|
|
8765
|
+
//#endregion PROPERTIES
|
|
8766
|
+
/****************************************************************************/
|
|
8767
|
+
//#region RENDER
|
|
8768
|
+
render() {
|
|
8769
|
+
return (hAsync(Host, { key: '4607ea5be4f54aec289b09e40f980aaf33c304c7' }, hAsync("th", { key: '5a24f302d8b01c8ed44fb3c015d9701967d2833f' }, hAsync("slot", { key: '272e390027621eb09b17baa1529fbdaba40eb74a' }))));
|
|
8770
|
+
}
|
|
8771
|
+
static get style() { return NvDatagridcolumnStyle0; }
|
|
8772
|
+
static get cmpMeta() { return {
|
|
8773
|
+
"$flags$": 4,
|
|
8774
|
+
"$tagName$": "nv-datagridcolumn",
|
|
8775
|
+
"$members$": {
|
|
8776
|
+
"header": [1],
|
|
8777
|
+
"accessor": [1]
|
|
8778
|
+
},
|
|
8779
|
+
"$listeners$": undefined,
|
|
8780
|
+
"$lazyBundleId$": "-",
|
|
8781
|
+
"$attrsToReflect$": []
|
|
8782
|
+
}; }
|
|
8783
|
+
}
|
|
8784
|
+
|
|
8785
|
+
const nvDatagriddatacellCss = "";
|
|
8786
|
+
var NvDatagriddatacellStyle0 = nvDatagriddatacellCss;
|
|
8787
|
+
|
|
8788
|
+
/**
|
|
8789
|
+
* @slot default - Use this slot to insert HTML into the data grid data cell.
|
|
8790
|
+
*/
|
|
8791
|
+
class NvDatagriddatacell {
|
|
8792
|
+
constructor(hostRef) {
|
|
8793
|
+
registerInstance(this, hostRef);
|
|
8794
|
+
this.accessor = undefined;
|
|
8795
|
+
}
|
|
8796
|
+
//#endregion PROPERTIES
|
|
8797
|
+
/****************************************************************************/
|
|
8798
|
+
//#region RENDER
|
|
8799
|
+
render() {
|
|
8800
|
+
return (hAsync(Host, { key: 'bf3caf31ee31fdba6254c1907883474a84610dda' }, hAsync("td", { key: '709febb6ab666afd3841c7d0086f889309f31fbd' }, hAsync("slot", { key: 'c309eda6f57527a3ca1bba68983521121944a156' }))));
|
|
8801
|
+
}
|
|
8802
|
+
static get style() { return NvDatagriddatacellStyle0; }
|
|
8803
|
+
static get cmpMeta() { return {
|
|
8804
|
+
"$flags$": 4,
|
|
8805
|
+
"$tagName$": "nv-datagriddatacell",
|
|
8806
|
+
"$members$": {
|
|
8807
|
+
"accessor": [1]
|
|
8808
|
+
},
|
|
8809
|
+
"$listeners$": undefined,
|
|
8810
|
+
"$lazyBundleId$": "-",
|
|
8811
|
+
"$attrsToReflect$": []
|
|
8812
|
+
}; }
|
|
8813
|
+
}
|
|
8814
|
+
|
|
8815
|
+
const nvDatagridheadCss = "";
|
|
8816
|
+
var NvDatagridheadStyle0 = nvDatagridheadCss;
|
|
8817
|
+
|
|
8818
|
+
/**
|
|
8819
|
+
* @slot default - Use this slot to insert HTML into the table head.
|
|
8820
|
+
*/
|
|
8821
|
+
class NvDatagridhead {
|
|
8822
|
+
constructor(hostRef) {
|
|
8823
|
+
registerInstance(this, hostRef);
|
|
8824
|
+
}
|
|
8825
|
+
/****************************************************************************/
|
|
8826
|
+
//#region RENDER
|
|
8827
|
+
render() {
|
|
8828
|
+
return (hAsync(Host, { key: '272ab6e598f1edfc53fd99372acd64c3834c0fd0' }, hAsync("thead", { key: '66d5e24d5d0757be7b0190bc4c156e476e0f748e' }, hAsync("slot", { key: 'b41ac2580003d1df53595d66837ed51d597bee8c' }))));
|
|
8829
|
+
}
|
|
8830
|
+
static get style() { return NvDatagridheadStyle0; }
|
|
8831
|
+
static get cmpMeta() { return {
|
|
8832
|
+
"$flags$": 4,
|
|
8833
|
+
"$tagName$": "nv-datagridhead",
|
|
8834
|
+
"$members$": undefined,
|
|
8835
|
+
"$listeners$": undefined,
|
|
8836
|
+
"$lazyBundleId$": "-",
|
|
8837
|
+
"$attrsToReflect$": []
|
|
8838
|
+
}; }
|
|
8839
|
+
}
|
|
8840
|
+
|
|
8841
|
+
const nvDatagridrowCss = "";
|
|
8842
|
+
var NvDatagridrowStyle0 = nvDatagridrowCss;
|
|
8843
|
+
|
|
8844
|
+
/**
|
|
8845
|
+
* @slot default - Use this slot to insert HTML into the data grid row.
|
|
8846
|
+
*/
|
|
8847
|
+
class NvDatagridrow {
|
|
8848
|
+
constructor(hostRef) {
|
|
8849
|
+
registerInstance(this, hostRef);
|
|
8850
|
+
}
|
|
8851
|
+
/****************************************************************************/
|
|
8852
|
+
//#region RENDER
|
|
8853
|
+
render() {
|
|
8854
|
+
return (hAsync(Host, { key: 'f136ccd96f48d5743cc1c08c26029421af4ab2c0' }, hAsync("tr", { key: '21787f1823a778ab6433cbcc5bff0596e2257485' }, hAsync("slot", { key: 'edfc2d36e247097eaddfd694bf9de44f001a8219' }))));
|
|
8855
|
+
}
|
|
8856
|
+
static get style() { return NvDatagridrowStyle0; }
|
|
8857
|
+
static get cmpMeta() { return {
|
|
8858
|
+
"$flags$": 4,
|
|
8859
|
+
"$tagName$": "nv-datagridrow",
|
|
8860
|
+
"$members$": undefined,
|
|
8861
|
+
"$listeners$": undefined,
|
|
8862
|
+
"$lazyBundleId$": "-",
|
|
8863
|
+
"$attrsToReflect$": []
|
|
8864
|
+
}; }
|
|
8865
|
+
}
|
|
8866
|
+
|
|
5482
8867
|
const nvFieldcheckboxCss = "nv-fieldcheckbox{--nv-fieldcheckbox-border-default:var(--components-form-field-border-default);--nv-fieldcheckbox-border-hover:var(--components-form-field-border-hover);--nv-fieldcheckbox-border-focus:var(--components-form-field-border-default);--nv-fieldcheckbox-background-default:var(--components-form-field-background-default);--nv-fieldcheckbox-background-checked:var(--components-form-field-background-checked);--nv-fieldcheckbox-background-disabled:var(--components-form-field-background-disabled);--nv-fieldcheckbox-focus-box-shadow:var(--color-focus-brand);--nv-fieldcheckbox-color-checked:var(--components-form-shape-foreground-default);--nv-fieldcheckbox-color-disabled:var(--components-form-shape-foreground-disabled);--nv-fieldcheckbox-outline-color:var(--color-focus-brand);display:inline-flex;align-items:flex-start;gap:var(--form-gap-x);position:relative}nv-fieldcheckbox:not([disabled],[readonly]) input,nv-fieldcheckbox:not([disabled],[readonly]) label{cursor:pointer}nv-fieldcheckbox.error .input-container{--nv-fieldcheckbox-border-default:var(--components-form-field-border-error);--nv-fieldcheckbox-border-hover:var(--nv-fieldcheckbox-border-default);--nv-fieldcheckbox-border-focus:var(--components-form-field-border-error);--nv-fieldcheckbox-focus-box-shadow:var(--color-focus-destructive);--nv-fieldcheckbox-color-disabled:var(--components-form-shape-foreground-disabled-error);--nv-fieldcheckbox-background-checked:var(--components-form-field-background-error);--nv-fieldcheckbox-outline-color:var(--color-focus-destructive)}nv-fieldcheckbox.label-placement-before{flex-direction:row-reverse}nv-fieldcheckbox[disabled]{opacity:0.5}nv-fieldcheckbox label{align-self:stretch;color:var(--components-form-text-label-default);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-label-font-size);font-style:normal;font-weight:var(--form-label-font-weight);line-height:var(--form-label-line-height)}nv-fieldcheckbox .input-container{position:relative;color:var(--nv-fieldcheckbox-color-checked)}nv-fieldcheckbox .input-container input[type=checkbox][readonly]{opacity:0.5}nv-fieldcheckbox .input-container:has(input[type=checkbox]:disabled:not([readonly])){color:var(--nv-fieldcheckbox-color-disabled)}nv-fieldcheckbox .input-container input[type=checkbox]{appearance:none;position:relative;display:flex;width:var(--form-checkbox-size);height:var(--form-checkbox-size);flex-direction:column;align-items:flex-start;border-radius:var(--form-checkbox-radius);border-width:var(--form-checkbox-border-width);border-style:solid;border-color:var(--nv-fieldcheckbox-border-default);background:var(--nv-fieldcheckbox-background-default)}nv-fieldcheckbox .input-container input[type=checkbox]:hover{border-color:var(--nv-fieldcheckbox-border-hover)}nv-fieldcheckbox .input-container input[type=checkbox]:focus{border-color:var(--nv-fieldcheckbox-border-focus)}nv-fieldcheckbox .input-container input[type=checkbox]:focus,nv-fieldcheckbox .input-container input[type=checkbox]:focus-within{outline:none}nv-fieldcheckbox .input-container input[type=checkbox]:focus-visible,nv-fieldcheckbox .input-container input[type=checkbox]:has(:focus-visible){outline:var(--focus-outline-stroke) solid var(--nv-fieldcheckbox-outline-color);outline-offset:calc(var(--focus-outline-offset) * 1)}nv-fieldcheckbox .input-container input[type=checkbox]:checked,nv-fieldcheckbox .input-container input[type=checkbox]:indeterminate{background:var(--nv-fieldcheckbox-background-checked);border-color:var(--nv-fieldcheckbox-background-checked)}nv-fieldcheckbox .input-container input[type=checkbox]:disabled:not([readonly]){background:var(--nv-fieldcheckbox-background-disabled);border-color:var(--nv-fieldcheckbox-border-default)}nv-fieldcheckbox .input-container input[type=checkbox][readonly]{opacity:0.5}nv-fieldcheckbox .input-container .icon{pointer-events:none;position:absolute;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center}nv-fieldcheckbox .input-container .icon svg{width:var(--form-checkbox-icon-size);height:var(--form-checkbox-icon-size);fill:none;stroke:currentcolor;stroke-width:var(--form-checkbox-icon-stroke);flex-shrink:0}nv-fieldcheckbox .description{align-self:stretch;color:var(--components-form-text-description-default);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-description-font-size);font-style:normal;font-weight:var(--form-description-font-weight);line-height:var(--form-description-line-height)}nv-fieldcheckbox .error-description{align-self:stretch;color:var(--components-form-text-description-default);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-description-font-size);font-style:normal;font-weight:var(--form-description-font-weight);line-height:var(--form-description-line-height);color:var(--components-form-text-description-error)}nv-fieldcheckbox .text-container{display:flex;flex-direction:column;align-items:flex-start;flex:1 0 0}";
|
|
5483
8868
|
var NvFieldcheckboxStyle0 = nvFieldcheckboxCss;
|
|
5484
8869
|
|
|
@@ -5554,13 +8939,13 @@ class NvFieldcheckbox {
|
|
|
5554
8939
|
/****************************************************************************/
|
|
5555
8940
|
//#region RENDER
|
|
5556
8941
|
render() {
|
|
5557
|
-
return (hAsync(Host, { key: '
|
|
8942
|
+
return (hAsync(Host, { key: 'c87c2b3e3a4b81c9d6eb6c3784919a5fcb78e38b', class: clsx(this.labelPlacement === 'before' && 'label-placement-before', this.error && 'error') }, hAsync("div", { key: '8e43a91fec01b02dfa6b27408e1c1fd252558014', class: "input-container" }, hAsync("input", { key: 'bffbfc1ac879fb70e1c7b436c3a9845150b78bca', type: "checkbox", id: this.inputId, name: this.name, autocomplete: "off", value: this.value, checked: Boolean(this.checked), disabled: this.disabled || this.readonly, readonly: this.readonly && !this.required, required: this.required, indeterminate: this.indeterminate, ref: el => {
|
|
5558
8943
|
if (el) {
|
|
5559
8944
|
el.indeterminate = this.indeterminate;
|
|
5560
8945
|
}
|
|
5561
|
-
} }), hAsync("span", { key: '
|
|
5562
|
-
this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: '
|
|
5563
|
-
this.el.querySelector('[slot="error-description"]')) && (hAsync("div", { key: '
|
|
8946
|
+
} }), hAsync("span", { key: 'b100feee33694f72c59496f09f5ecbbf9358d7c6', class: "icon" }, this.checked && !this.indeterminate && (hAsync("slot", { key: 'a5f5159aff04c111e4b944123686f00f817ecb1e', name: "checked-icon" }, hAsync("svg", { key: '26a750b600fa0857ec9adf17f9d4dcd9ce0e2aad', xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 14 14", fill: "none" }, hAsync("path", { key: 'ddf0155de05297d7ec966bdaf9633ceb1ee413d7', d: "M11.6667 3.5L5.25004 9.91667L2.33337 7", "stroke-linecap": "round", "stroke-linejoin": "round" })))), this.indeterminate && (hAsync("slot", { key: 'e64681ce70326348083402f7996eaf6134aaca3e', name: "indeterminate-icon" }, hAsync("svg", { key: '9cfcd8118bb6f208278614711fd726fe29c9070a', class: "indeterminate-svg", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 14 14", fill: "none" }, hAsync("path", { key: '8d88be8c4bd195982bf0024e4f67f30601ddfb80', d: "M2.9165 7H11.0832", "stroke-linecap": "round", "stroke-linejoin": "round" })))))), hAsync("div", { key: '061d18d589ef2a8efd0fb73f70d5c0a6013c497d', class: "text-container" }, (this.label || this.el.querySelector('[slot="label"]')) && (hAsync("label", { key: '129013f8e60d1aaae82b97321c4cc26ab6229bbb', htmlFor: this.inputId, class: clsx(this.hideLabel && 'visually-hidden') }, hAsync("slot", { key: 'e134c0683e4c4c410c78d45f3537d8ed1491c67e', name: "label" }, this.label))), (this.description ||
|
|
8947
|
+
this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: '78166f4fb7d1e5dc20f13ce5b4ca567a90862493', class: "description" }, hAsync("slot", { key: '6bced15913e4a22371520818343de5598c5a5e6d', name: "description" }, this.description))), (this.errorDescription ||
|
|
8948
|
+
this.el.querySelector('[slot="error-description"]')) && (hAsync("div", { key: '88f4ceaef2412ce5f4bb08b19485fc27d9842792', hidden: !this.error, class: "error-description" }, hAsync("slot", { key: '96a581ce5d0e66416d24bf52219a87d3c39457d8', name: "error-description" }, this.errorDescription))))));
|
|
5564
8949
|
}
|
|
5565
8950
|
get el() { return getElement(this); }
|
|
5566
8951
|
static get watchers() { return {
|
|
@@ -5645,7 +9030,7 @@ class NvFielddropdownitem {
|
|
|
5645
9030
|
//#region RENDER
|
|
5646
9031
|
render() {
|
|
5647
9032
|
const showDefaultLayout = this.isNullOrEmptyOrWhitespace(this.label);
|
|
5648
|
-
return (hAsync(Host, { key: '
|
|
9033
|
+
return (hAsync(Host, { key: '0b0070ad824841f49bf5c24423131c46c41ef4ef', role: "menuitem", tabindex: this.disabled ? '-1' : '0', onClick: this.handleClick, class: { selected: this.selected } }, showDefaultLayout ? (hAsync("slot", null)) : (hAsync("div", { class: "flex gap-2" }, hAsync("span", { "data-scope": "text" }, this.label), this.selected && (hAsync("nv-icon", { name: "check", "aria-hidden": "true", class: "selection-icon" }))))));
|
|
5649
9034
|
}
|
|
5650
9035
|
get el() { return getElement(this); }
|
|
5651
9036
|
static get style() { return NvFielddropdownitemStyle0; }
|
|
@@ -5743,9 +9128,9 @@ class NvFieldnumber {
|
|
|
5743
9128
|
/****************************************************************************/
|
|
5744
9129
|
//#region RENDER
|
|
5745
9130
|
render() {
|
|
5746
|
-
return (hAsync(Host, { key: '
|
|
5747
|
-
this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: '
|
|
5748
|
-
this.el.querySelector('[slot="error-description"]')) && (hAsync("div", { key: '
|
|
9131
|
+
return (hAsync(Host, { key: '5d63f2dca1678d7ea971b52a40f55481eae421d6' }, (this.label || this.el.querySelector('[slot="label"]')) && (hAsync("label", { key: '145560063839b6fe34e3c8431003d5f5fb5eb65d', htmlFor: this.inputId }, hAsync("slot", { key: 'd36ca2394cf3ce62c7d5f6177480a41979d7d1cb', name: "label" }, this.label))), hAsync("div", { key: 'c53243b5f2019033a24b22120e1bd5209c415075', class: "input-wrapper" }, hAsync("slot", { key: 'e32e0fdd6b0e27cbb719b3d962fb6417eb2f3e1b', name: "before-input" }), hAsync("div", { key: 'b9de75924bde8a2cd1108e34173d0f867f0bdcea', class: "input-container", onClick: this.handleInputContainerClick }, hAsync("slot", { key: '4d0bbdce8201370f1f62d06eabb5a2bd3b248c1f', name: "leading-input" }), hAsync("input", { key: '0c85ade03f9ca7e6c3aca788b3a107d0807d7b70', id: this.inputId, ref: e => (this.inputElement = e), placeholder: this.placeholder, name: this.name, type: "number", required: this.required, max: this.max, min: this.min, step: this.step, value: this.value, disabled: this.disabled, readOnly: this.readonly, onInput: this.handleInput }), this.error && (hAsync("nv-icon", { key: '5da0668775a6841bf01c662009ec7bf9048b1622', name: "alert-circle", class: "validation", size: "md" })), this.success && (hAsync("nv-icon", { key: 'be8e6e9e3c5428885aed216f49f1510b0fb29201', name: "circle-check", class: "validation", size: "md" })), hAsync("div", { key: '84ddbc5eb7e35ea216e0c9650dcbcb865e3bd726', class: "stepper-spacer" }), hAsync("div", { key: '9ba5a8087ef4fa46614d1c7492c80781af5c4a40', class: "stepper" }, hAsync("nv-icon", { key: 'a3b5adffd9b7a5a266711f02ed2862e84f2a5839', name: "minus", size: "md", onClick: this.handleMinus, class: clsx({ disabled: this.isMinValueReached() }) }), hAsync("nv-icon", { key: '1a37933cfeab32a057807173a3b411e23a3c93b0', name: "plus", size: "md", onClick: this.handlePlus, class: clsx({ disabled: this.isMaxValueReached() }) }))), hAsync("slot", { key: '99c9105e0f46dfb5e56fa3949dd99264f61e7be5', name: "after-input" })), (this.description ||
|
|
9132
|
+
this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: '3b9df6f1e03117123b376c637840e4219ee4e45d', class: "description" }, hAsync("slot", { key: 'deb7681e9d6fe583e418f6d25248b667c4b2fcf0', name: "description" }, this.description))), (this.errorDescription ||
|
|
9133
|
+
this.el.querySelector('[slot="error-description"]')) && (hAsync("div", { key: '6848cf6e73924df0552ed71078d19cc1423b6d72', hidden: !this.error, class: "error-description" }, hAsync("slot", { key: 'cf5526311207e2fca942ba84a5480cae6917060d', name: "error-description" }, this.errorDescription)))));
|
|
5749
9134
|
}
|
|
5750
9135
|
static get formAssociated() { return true; }
|
|
5751
9136
|
get el() { return getElement(this); }
|
|
@@ -5846,9 +9231,9 @@ class NvFieldpassword {
|
|
|
5846
9231
|
/****************************************************************************/
|
|
5847
9232
|
//#region RENDER
|
|
5848
9233
|
render() {
|
|
5849
|
-
return (hAsync(Host, { key: '
|
|
5850
|
-
this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: '
|
|
5851
|
-
this.el.querySelector('[slot="error-description"]')) && (hAsync("div", { key: '
|
|
9234
|
+
return (hAsync(Host, { key: '40f6d172ebe46636a4240e010cc1dd9eb9e90e79' }, (this.label || this.el.querySelector('[slot="label"]')) && (hAsync("label", { key: 'dc7b47c5796cfc862e1dafbe6720fe725662dd2c', htmlFor: this.inputId }, hAsync("slot", { key: 'a5696e12f593408bb20b92e49c0c5a6b21fef9b1', name: "label" }, this.label))), hAsync("div", { key: 'a1856e68415b5685982e936588791d36c9188d29', class: "input-wrapper" }, hAsync("slot", { key: 'ee701f5efbc0f7dcdbfd8d8494eb660ed9081f80', name: "before-input" }), hAsync("div", { key: '3a2b900d7fadac36538d936cc6853fe855713f26', class: "input-container", onClick: this.handleInputContainerClick }, hAsync("slot", { key: 'b59c93d7457f00ff7b7cb4fcd7caca927a197dc4', name: "leading-input" }), hAsync("input", { key: '67755bdf835476b8511083ba6e35ed5eca8868e5', id: this.inputId, ref: e => (this.inputElement = e), autocomplete: this.autocomplete, placeholder: this.placeholder, name: this.name, type: this.showPasswordState ? 'text' : 'password', inputMode: this.mode, value: this.value, required: this.required, maxlength: this.maxlength, minlength: this.minlength, pattern: this.pattern, disabled: this.disabled, readOnly: this.readonly, onInput: this.handleInput }), !this.hidePasswordIcon && (hAsync("nv-iconbutton", { key: 'd9ffdbb9a4bd76d30c6adbb5ada4a989c6bdc092', class: "toggle-password-icon", name: this.showPasswordState ? 'eye' : 'eye-off', size: "md", emphasis: "lower", onClick: this.togglePasswordVisibility, onKeyDown: this.handleKeyDown, "aria-label": this.showPasswordState ? 'Hide password' : 'Show password', "aria-pressed": this.showPasswordState.toString() })), (this.success || this.error) && (hAsync("nv-icon", { key: '40b2376b0cf815998eede9c8917f1126cda51d28', name: this.success ? 'circle-check' : 'alert-circle', class: "validation", size: "md" }))), hAsync("slot", { key: '6ae6f802256ac343a232bb24f7b7ec7e21ee5dd0', name: "after-input" })), (this.description ||
|
|
9235
|
+
this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: 'e08e5965bebe38262e5efd30f0ab3d3a905083ff', class: "description" }, hAsync("slot", { key: '8554c3620920efc3dd108b5e4f0e79dddc55c845', name: "description" }, this.description))), (this.errorDescription ||
|
|
9236
|
+
this.el.querySelector('[slot="error-description"]')) && (hAsync("div", { key: 'cf40170d0e1c8de40601b1ef2d3a8260a07cf7e9', hidden: !this.error, class: "error-description" }, hAsync("slot", { key: 'e3b0ff01a8ffd569d2eb2c2e3a188cb6e53f0f6f', name: "error-description" }, this.errorDescription)))));
|
|
5852
9237
|
}
|
|
5853
9238
|
static get formAssociated() { return true; }
|
|
5854
9239
|
get el() { return getElement(this); }
|
|
@@ -5950,9 +9335,9 @@ class NvFieldradio {
|
|
|
5950
9335
|
/****************************************************************************/
|
|
5951
9336
|
//#region RENDER
|
|
5952
9337
|
render() {
|
|
5953
|
-
return (hAsync(Host, { key: '
|
|
5954
|
-
this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: '
|
|
5955
|
-
this.el.querySelector('[slot="error-description"]')) && (hAsync("div", { key: '
|
|
9338
|
+
return (hAsync(Host, { key: '5c03f0c1423eb932aa9d2022e9d6a30bdbbb08ca', class: clsx(this.labelPlacement === 'before' && 'label-placement-before', this.error && 'error') }, hAsync("input", { key: '3ffb0990423348725ded997c26b12b41f10a8f0d', type: "radio", id: this.inputId, name: this.name, autocomplete: "off", value: this.value, checked: this.checked, disabled: this.disabled }), hAsync("div", { key: 'f862a9040abe14402fa352006c1cdedaba81a1af', class: "text-container" }, (this.label || this.el.querySelector('[slot="label"]')) && (hAsync("label", { key: '07269171f02fc8a9621d958b0997728162fda439', htmlFor: this.inputId }, hAsync("slot", { key: '5e66a1ac747ed1462e948c35b96cbca4e4c037b3', name: "label" }, this.label))), (this.description ||
|
|
9339
|
+
this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: 'cfa36a9cd3958511abf407027ec9432addd7cc1a', class: "description" }, hAsync("slot", { key: '1e86daa3580d6f99091950acb1fda3eeeb742ad5', name: "description" }, this.description))), (this.errorDescription ||
|
|
9340
|
+
this.el.querySelector('[slot="error-description"]')) && (hAsync("div", { key: 'c1c1e7ecae6edc43b5a7793c180c0dd28fc09a67', hidden: !this.error, class: "error-description" }, hAsync("slot", { key: '51f217f3465720fd73371dcd420492b2cdf00802', name: "error-description" }, this.errorDescription))))));
|
|
5956
9341
|
}
|
|
5957
9342
|
static get formAssociated() { return true; }
|
|
5958
9343
|
get el() { return getElement(this); }
|
|
@@ -6254,13 +9639,13 @@ class NvFieldselect {
|
|
|
6254
9639
|
* @returns {HTMLStencilElement} The HTML element to render.
|
|
6255
9640
|
*/
|
|
6256
9641
|
render() {
|
|
6257
|
-
return (hAsync(Host, { key: '
|
|
9642
|
+
return (hAsync(Host, { key: 'e1333260c8fa6eebf9078f7497d2d0b30f555068' }, (this.label || this.el.querySelector('[slot="label"]')) && (hAsync("label", { key: '42d18737d174df03ac92c2cd178e372fed4bde1a', htmlFor: this.selectId }, hAsync("slot", { key: '675f7d4d5089bebb8104d848f1953445c79b584f', name: "label" }, this.label))), hAsync("div", { key: '59f13a05173ee15cffa6afca296da0333568cea4', class: "select-wrapper" }, hAsync("slot", { key: '1c2fe2ec6e84b95a47dc4c2668afd5d0ea899aee', name: "before-input" }), hAsync("div", { key: 'f6bd0c186ac6fa781e52329fc8a4622b740066f2', class: "select-container", onClick: this.handleSelectContainerClick }, hAsync("slot", { key: 'fbf25811a89197b11a4d4ea6dd1020b44fd14f73', name: "leading-input" }), this.internalReadonly && (hAsync("input", { key: 'c05413ddedb713944ad7f128a866d761e38080c6', id: this.selectId + '-readonly', type: "text", value: this.computedDisplayValue, readOnly: true, class: "readonly-input", "aria-readonly": "true", "aria-label": this.label, "aria-describedby": this.error
|
|
6258
9643
|
? `${this.selectId}-error`
|
|
6259
|
-
: `${this.selectId}-description` })), hAsync("select", { key: '
|
|
9644
|
+
: `${this.selectId}-description` })), hAsync("select", { key: '6bd95875e397c69c0297fe0c3bc9703c7872f477', id: this.selectId, ref: el => (this.selectElement = el), name: this.name, disabled: this.disabled, required: this.required, multiple: this.multiple, onChange: this.handleSelectChange, class: this.internalReadonly ? 'hidden' : '', "aria-label": this.label, "aria-describedby": this.error
|
|
6260
9645
|
? `${this.selectId}-error`
|
|
6261
|
-
: `${this.selectId}-description` }, hAsync("slot", { key: '
|
|
6262
|
-
this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: '
|
|
6263
|
-
this.el.querySelector('[slot="error-description"]')) && (hAsync("div", { key: '
|
|
9646
|
+
: `${this.selectId}-description` }, hAsync("slot", { key: '22798124b2b743ee1b8ffc22f4e8fffc6704be66' })), this.internalReadonly && (hAsync("nv-icon", { key: '6fb4193bf131fce928d0e5d0346eb7fe62fcf77e', name: "chevron-down", class: "readonly-icon", size: "sm" })), this.error && (hAsync("nv-icon", { key: '4a84c2b8eece45c6247c7c58f74696fbc5b8ff4c', name: "alert-circle", class: "validation", size: "sm" })), this.success && (hAsync("nv-icon", { key: '84af6db55127c516538f0df4d19f09f4570800f4', name: "circle-check", class: "validation", size: "sm" }))), hAsync("slot", { key: '11dd18fc96e0360ac62b80d3d295895051a914d1', name: "after-input" })), (this.description ||
|
|
9647
|
+
this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: '142d57ab7ba7aaef8ae0929b94716d37dd151e1c', class: "description", id: `${this.selectId}-description` }, hAsync("slot", { key: '0ce2c8c5bfa0966b1017cfea79461df6630773b4', name: "description" }, this.description))), (this.errorDescription ||
|
|
9648
|
+
this.el.querySelector('[slot="error-description"]')) && (hAsync("div", { key: 'a06402c222f5f377ef314c66317c98df4b72e4b0', class: "error-description", id: `${this.selectId}-error` }, hAsync("slot", { key: '0d9e63fd9b8fa53a4ea037e5cb720a42206ee49d', name: "error-description" }, this.errorDescription)))));
|
|
6264
9649
|
}
|
|
6265
9650
|
static get formAssociated() { return true; }
|
|
6266
9651
|
get el() { return getElement(this); }
|
|
@@ -6370,9 +9755,9 @@ class NvFieldtext {
|
|
|
6370
9755
|
/****************************************************************************/
|
|
6371
9756
|
//#region RENDER
|
|
6372
9757
|
render() {
|
|
6373
|
-
return (hAsync(Host, { key: '
|
|
6374
|
-
this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: '
|
|
6375
|
-
this.el.querySelector('[slot="error-description"]')) && (hAsync("div", { key: '
|
|
9758
|
+
return (hAsync(Host, { key: '8c9c791ef7164a3d1dc248242ced345652fae05d' }, (this.label || this.el.querySelector('[slot="label"]')) && (hAsync("label", { key: '8e768c2299d48e0ec4f2f4052503b38ec07367e9', htmlFor: this.inputId }, hAsync("slot", { key: '316e1beffe5534bd1386c9a85818a4fc134de595', name: "label" }, this.label))), hAsync("div", { key: '9a52ffcbcf9ef514c108c0f64ab09b0f1c70f80b', class: "input-wrapper" }, hAsync("slot", { key: 'bcb5d42ea25518e7d4408f6044ec70343476bd80', name: "before-input" }), hAsync("div", { key: '478c7770b2d00c7a0a4182cc4e23b426d74924b9', class: "input-container", onClick: this.handleInputContainerClick }, hAsync("slot", { key: '0b9538c630b6d1e27b439c54e47c31c39cce6001', name: "leading-input" }), hAsync("input", { key: '3a3ccf0c9fb16ef47f1c143c4d54a73e400e2b29', id: this.inputId, ref: e => (this.inputElement = e), placeholder: this.placeholder, name: this.name, type: this.type, disabled: this.disabled, readOnly: this.readonly, required: this.required, maxlength: this.maxlength, minlength: this.minlength, pattern: this.pattern, autocomplete: this.autocomplete, multiple: this.multiple, value: this.value, onInput: this.handleInput }), this.error && (hAsync("nv-icon", { key: 'cd45c694b5480e3ee92d58ac05e51c97a1dd12f6', name: "alert-circle", class: "validation", size: "sm" })), this.success && (hAsync("nv-icon", { key: '6fca533bbceb8c4f4f9ed7dbcd9373df54d8496d', name: "circle-check", class: "validation", size: "sm" }))), hAsync("slot", { key: '0ee33ded353265eeed3253b5c9f039b739508a82', name: "after-input" })), (this.description ||
|
|
9759
|
+
this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: '12bd5f917245feb4562dd8903c157429ef72dae9', class: "description" }, hAsync("slot", { key: '37894343aa3ad21d37dc93f47a27723fdc7cc89a', name: "description" }, this.description))), (this.errorDescription ||
|
|
9760
|
+
this.el.querySelector('[slot="error-description"]')) && (hAsync("div", { key: '04253d575a1c987f48a95e32c41a38e0fe10c3a4', hidden: !this.error, class: "error-description" }, hAsync("slot", { key: '2db01455b977c68638271427283d95b811f41d54', name: "error-description" }, this.errorDescription)))));
|
|
6376
9761
|
}
|
|
6377
9762
|
static get formAssociated() { return true; }
|
|
6378
9763
|
get el() { return getElement(this); }
|
|
@@ -6437,7 +9822,7 @@ class NvFieldtextarea {
|
|
|
6437
9822
|
};
|
|
6438
9823
|
this.message = undefined;
|
|
6439
9824
|
this.validation = undefined;
|
|
6440
|
-
this.
|
|
9825
|
+
this.textareaId = v4();
|
|
6441
9826
|
this.label = undefined;
|
|
6442
9827
|
this.description = undefined;
|
|
6443
9828
|
this.placeholder = undefined;
|
|
@@ -6541,9 +9926,9 @@ class NvFieldtextarea {
|
|
|
6541
9926
|
/****************************************************************************/
|
|
6542
9927
|
//#region RENDER
|
|
6543
9928
|
render() {
|
|
6544
|
-
return (hAsync(Host, { key: '
|
|
6545
|
-
this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: '
|
|
6546
|
-
this.el.querySelector('[slot="error-description"]')) && (hAsync("div", { key: '
|
|
9929
|
+
return (hAsync(Host, { key: 'f5b311b7b6ce4ad9d6ff0a63103018a065d8ff66' }, (this.label || this.el.querySelector('[slot="label"]')) && (hAsync("label", { key: '377483fb782672a29a9a9b3824e102587eb166b1', htmlFor: this.textareaId }, hAsync("slot", { key: '2705fb3d2736caef5b289fb3338790e62d758d56', name: "label" }, this.label))), hAsync("div", { key: '49d270fed9367b58eb1197a9e91d86c36cee90a8', class: "textarea-wrapper" }, hAsync("div", { key: '28e591c39cff80eeb5fa6105bafa2423f02b8da9', class: "textarea-container", onClick: this.handleTextareaContainerClick }, hAsync("textarea", { key: '0dc54edc1a23221287810ecff5b51c7b91fe2b7b', id: this.textareaId, ref: e => (this.textareaElement = e), placeholder: this.placeholder, name: this.name, disabled: this.disabled, readOnly: this.readonly, required: this.required, maxlength: this.maxlength, minlength: this.minlength, autocomplete: "off", value: this.value, onInput: this.handleTextarea, rows: this.rows, class: clsx(this.getResize()) }))), (this.description ||
|
|
9930
|
+
this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: '32f6d57c4c3fa1fb937c8b92ef630280bc4238e1', class: "description" }, hAsync("slot", { key: '1896e7a524753172cdeb19aa21fc83afd394c1a7', name: "description" }, this.description))), (this.errorDescription ||
|
|
9931
|
+
this.el.querySelector('[slot="error-description"]')) && (hAsync("div", { key: '94757defcafe57f7074871f81987a2733f509f88', hidden: !this.error, class: "error-description" }, hAsync("slot", { key: '561620515caa5c115c9bd8bb9139bf7fa29e22fb', name: "error-description" }, this.errorDescription)))));
|
|
6547
9932
|
}
|
|
6548
9933
|
static get formAssociated() { return true; }
|
|
6549
9934
|
get el() { return getElement(this); }
|
|
@@ -6558,7 +9943,7 @@ class NvFieldtextarea {
|
|
|
6558
9943
|
"$members$": {
|
|
6559
9944
|
"message": [1],
|
|
6560
9945
|
"validation": [1],
|
|
6561
|
-
"
|
|
9946
|
+
"textareaId": [513, "textarea-id"],
|
|
6562
9947
|
"label": [513],
|
|
6563
9948
|
"description": [1537],
|
|
6564
9949
|
"placeholder": [513],
|
|
@@ -6578,7 +9963,7 @@ class NvFieldtextarea {
|
|
|
6578
9963
|
},
|
|
6579
9964
|
"$listeners$": undefined,
|
|
6580
9965
|
"$lazyBundleId$": "-",
|
|
6581
|
-
"$attrsToReflect$": [["
|
|
9966
|
+
"$attrsToReflect$": [["textareaId", "textarea-id"], ["label", "label"], ["description", "description"], ["placeholder", "placeholder"], ["name", "name"], ["value", "value"], ["disabled", "disabled"], ["readonly", "readonly"], ["required", "required"], ["error", "error"], ["errorDescription", "error-description"], ["success", "success"], ["maxlength", "maxlength"], ["minlength", "minlength"], ["rows", "rows"], ["resize", "resize"], ["autosize", "autosize"]]
|
|
6582
9967
|
}; }
|
|
6583
9968
|
}
|
|
6584
9969
|
|
|
@@ -6604,7 +9989,9 @@ class NvFieldtoggle {
|
|
|
6604
9989
|
this.disabled = false;
|
|
6605
9990
|
this.readonly = false;
|
|
6606
9991
|
}
|
|
6607
|
-
|
|
9992
|
+
//#endregion EVENTS
|
|
9993
|
+
/****************************************************************************/
|
|
9994
|
+
//#region WATCHERS
|
|
6608
9995
|
/**
|
|
6609
9996
|
* Watches for changes to the checked state and emits the new value.
|
|
6610
9997
|
* @param {boolean} checked - The new value of the checked state.
|
|
@@ -6627,10 +10014,12 @@ class NvFieldtoggle {
|
|
|
6627
10014
|
this.checked = target.checked;
|
|
6628
10015
|
}
|
|
6629
10016
|
}
|
|
6630
|
-
|
|
10017
|
+
//#endregion WATCHERS
|
|
10018
|
+
/****************************************************************************/
|
|
10019
|
+
//#region RENDER
|
|
6631
10020
|
render() {
|
|
6632
|
-
return (hAsync(Host, { key: '
|
|
6633
|
-
this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: '
|
|
10021
|
+
return (hAsync(Host, { key: '18603a99c814b19f77a3e78f4a7dd3960bdc0841', class: clsx(this.labelPlacement === 'before' && 'label-placement-before') }, hAsync("div", { key: '3fb419bde30424ee2abdb63d75ef8ef3c78754c8', class: "input-container" }, hAsync("input", { key: '2c6d98d5c1e05bb33832c48fbe4b2e68f133a70f', type: "checkbox", id: this.inputId, name: this.name, autocomplete: "off", value: this.value, checked: Boolean(this.checked), disabled: this.disabled || this.readonly, readonly: this.readonly })), hAsync("div", { key: 'cc81c4e259750d75fb4e799365da64cedb71304c', class: "text-container" }, (this.label || this.el.querySelector('[slot="label"]')) && (hAsync("label", { key: '44177bd0153a833d5b5ef7a4e2e1d6dedfea3c91', htmlFor: this.inputId, class: clsx(this.hideLabel && 'visually-hidden') }, hAsync("slot", { key: '05719cf662559b26b3074e4b9bd67ed908e4c9bf', name: "label" }, this.label))), (this.description ||
|
|
10022
|
+
this.el.querySelector('[slot="description"]')) && (hAsync("div", { key: 'db2e5122431af687ce42c85476bb38bca868ee26', class: "description" }, hAsync("slot", { key: '68256d968071f13d7441b1801d17162b91021a8b', name: "description" }, this.description))))));
|
|
6634
10023
|
}
|
|
6635
10024
|
get el() { return getElement(this); }
|
|
6636
10025
|
static get watchers() { return {
|
|
@@ -6708,7 +10097,7 @@ class NvIcon {
|
|
|
6708
10097
|
//#region RENDER
|
|
6709
10098
|
render() {
|
|
6710
10099
|
//const iconSprite = getAssetPath('assets/icon-sprite.svg');
|
|
6711
|
-
return (hAsync(Host, { key: '
|
|
10100
|
+
return (hAsync(Host, { key: '1862efaf5cb956c36b1dad264518f7eb37a10c34', class: clsx(this.color && `${this.color}`), role: "img", "aria-label": `${this.name}-icon` }, hAsync("svg", { key: '7beb3a4697c73a42e28b8d59128cea93978ba282', stroke: "currentColor", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", class: `nv-icon-${this.size}` }, hAsync("use", { key: '50e901a1dc92fb8ada8489e9be15c1bf069df5e6', href: `${this.spriteUrl}#${this.name}` }))));
|
|
6712
10101
|
}
|
|
6713
10102
|
static get style() { return NvIconStyle0; }
|
|
6714
10103
|
static get cmpMeta() { return {
|
|
@@ -6805,7 +10194,7 @@ class NvIconbutton {
|
|
|
6805
10194
|
/****************************************************************************/
|
|
6806
10195
|
//#region RENDER
|
|
6807
10196
|
render() {
|
|
6808
|
-
return (hAsync(Host, { key: '
|
|
10197
|
+
return (hAsync(Host, { key: '7d785e95270a8ebcf303a345a887005774295ee6', role: "button", type: this.type, tabindex: "0", disabled: this.disabled ? true : undefined, class: clsx('root', `size-${this.size}`, `emphasis-${this.emphasis}`, this.loading && 'loading', `shape-${this.shape}`), onClick: this.handleClick }, this.loading && hAsync("nv-loader", { key: '028836989901ce6f625f325d368c661b31477e62', size: this.size }), !this.loading && hAsync("nv-icon", { key: '5184638cc9dd4550c65eca5b2492806e5e77e43e', name: this.name, size: this.size }), hAsync("slot", { key: '36ab315cb2ac6741c4debb5bfa84eb2e05e3abc8' })));
|
|
6809
10198
|
}
|
|
6810
10199
|
static get formAssociated() { return true; }
|
|
6811
10200
|
get el() { return getElement(this); }
|
|
@@ -6847,7 +10236,7 @@ class NvLoader {
|
|
|
6847
10236
|
//#region RENDER
|
|
6848
10237
|
/* <slot> empty to force rendering change */
|
|
6849
10238
|
render() {
|
|
6850
|
-
return (hAsync(Host, { key: '
|
|
10239
|
+
return (hAsync(Host, { key: '9d70fed6bfe41c8e1a87bd7eb2d83a1bb6af69ab', class: clsx(this.size && `size-${this.size}`, this.color && `color-${this.color}`) }));
|
|
6851
10240
|
}
|
|
6852
10241
|
static get style() { return NvLoaderStyle0; }
|
|
6853
10242
|
static get cmpMeta() { return {
|
|
@@ -7041,7 +10430,7 @@ class NvMenu {
|
|
|
7041
10430
|
/****************************************************************************/
|
|
7042
10431
|
//#region RENDER
|
|
7043
10432
|
render() {
|
|
7044
|
-
return (hAsync(Host, { key: '
|
|
10433
|
+
return (hAsync(Host, { key: '23fdff061d4aa8364590e2486c60b26684400a34' }, hAsync("slot", { key: '50ff6d6a5b84ad83a9b9deefed42335e663c989d', name: "trigger" }), hAsync("nv-popover", { key: 'ee15458289098254b7074452b2c25a32a7e82b3e', ref: el => (this.popoverElement = el), triggerMode: "click", triggerElement: this.triggerElement, placement: this.placement, nested: this.nested, open: this.open }, hAsync("slot", { key: 'bccea8f6469c29bad2e764c6628b6a783890d10d', name: "content" }))));
|
|
7045
10434
|
}
|
|
7046
10435
|
get el() { return getElement(this); }
|
|
7047
10436
|
static get style() { return NvMenuStyle0; }
|
|
@@ -7080,7 +10469,7 @@ class NvMenuitem {
|
|
|
7080
10469
|
/****************************************************************************/
|
|
7081
10470
|
//#region RENDER
|
|
7082
10471
|
render() {
|
|
7083
|
-
return (hAsync(Host, { key: '
|
|
10472
|
+
return (hAsync(Host, { key: 'c2d22d3d9da87cf9397d53bc1d04664f2b2fdaf6', role: "menuitem", tabindex: this.disabled ? '-1' : '0' }, this.icon && hAsync("nv-icon", { key: '1e058e4ab0d0d8a38e832bbfecc89b68f308c5b3', name: this.icon }), hAsync("span", { key: 'c2320e9145f09aa561103e594b8921aa067f50ac', "data-scope": "text" }, hAsync("slot", { key: '4783773cfc252c76ff5e23a776cc81b3ddefaa08' })), this.shortcut && !this.hasSubmenu && hAsync("kbd", { key: '5ae203ed4236966e3f72e587d047f5d6e3a1ebbd' }, this.shortcut), this.hasSubmenu && hAsync("nv-icon", { key: 'a92df958241abeb73584d780777afb5967a45753', name: "chevron-right" })));
|
|
7084
10473
|
}
|
|
7085
10474
|
get el() { return getElement(this); }
|
|
7086
10475
|
static get style() { return NvMenuitemStyle0; }
|
|
@@ -9429,7 +12818,7 @@ class NvPopover {
|
|
|
9429
12818
|
/****************************************************************************/
|
|
9430
12819
|
//#region RENDER
|
|
9431
12820
|
render() {
|
|
9432
|
-
return (hAsync(Host, { key: '
|
|
12821
|
+
return (hAsync(Host, { key: 'ee70da5a68b34bf289f79b6d18ffac777f8d807f' }, hAsync("slot", { key: '64bd478a06c4ccf9f656a9ea617bbe39d2ce78d8', name: "trigger" }), hAsync("div", { key: '5d024ffd7c1e00f8f476164da19d231edafa96ec', "data-scope": "popover", hidden: true, ref: el => (this.popoverElement = el) }, this.hasArrow && (hAsync("div", { key: '63116e165f54dc018dfee0a8b56eeda96523f16f', "data-scope": "arrow", ref: el => (this.arrowElement = el) })), hAsync("slot", { key: '6a7a400135aaea61ed5f1b0cb492ab962598ad16', name: "content" }))));
|
|
9433
12822
|
}
|
|
9434
12823
|
get el() { return getElement(this); }
|
|
9435
12824
|
static get watchers() { return {
|
|
@@ -9474,7 +12863,7 @@ class NvRow {
|
|
|
9474
12863
|
/****************************************************************************/
|
|
9475
12864
|
//#region RENDER
|
|
9476
12865
|
render() {
|
|
9477
|
-
return (hAsync(Host, { key: '
|
|
12866
|
+
return (hAsync(Host, { key: '559c93b3961fdee5d278df42693dd4faae1f1eaf' }, hAsync("slot", { key: '3cbf2c0ed7a07e23537ae6fb3cc999fef27561ea' })));
|
|
9478
12867
|
}
|
|
9479
12868
|
static get style() { return NvRowStyle0; }
|
|
9480
12869
|
static get cmpMeta() { return {
|
|
@@ -9507,7 +12896,7 @@ class NvStack {
|
|
|
9507
12896
|
/****************************************************************************/
|
|
9508
12897
|
//#region RENDER
|
|
9509
12898
|
render() {
|
|
9510
|
-
return (hAsync(Host, { key: '
|
|
12899
|
+
return (hAsync(Host, { key: '900b3afd3b0394433a719769797b4275998be59d', class: clsx(this.fill && 'nv-stack-fill', this.flex && 'nv-stack-flex', this.full && 'w-full', this.gutter && !this.vertical && `gutter-x-${this.gutter}`, this.gutter && this.vertical && `gutter-y-${this.gutter}`, this.vertical && 'nv-stack-vertical') }, hAsync("slot", { key: 'de28519746e3c18f04bdaea3f13258bc3d3d49a9' })));
|
|
9511
12900
|
}
|
|
9512
12901
|
static get style() { return NvStackStyle0; }
|
|
9513
12902
|
static get cmpMeta() { return {
|
|
@@ -9526,6 +12915,307 @@ class NvStack {
|
|
|
9526
12915
|
}; }
|
|
9527
12916
|
}
|
|
9528
12917
|
|
|
12918
|
+
const nvTableCss = "nv-table table{border-collapse:collapse;border-color:inherit;text-indent:0}";
|
|
12919
|
+
var NvTableStyle0 = nvTableCss;
|
|
12920
|
+
|
|
12921
|
+
/**
|
|
12922
|
+
* @slot default - Use this slot to insert HTML into the table content.
|
|
12923
|
+
* @slot head - Use this slot to insert HTML into the table header.
|
|
12924
|
+
* @slot before - Use this slot to insert HTML before the table.
|
|
12925
|
+
* @slot after - Use this slot to insert HTML after the table.
|
|
12926
|
+
* @slot body - Use this slot to insert HTML into the table body.
|
|
12927
|
+
*/
|
|
12928
|
+
class NvTable {
|
|
12929
|
+
constructor(hostRef) {
|
|
12930
|
+
registerInstance(this, hostRef);
|
|
12931
|
+
this.parsedColumns = [];
|
|
12932
|
+
this.parsedData = [];
|
|
12933
|
+
this.hasSlotHead = false;
|
|
12934
|
+
this.hasSlotBody = false;
|
|
12935
|
+
this.columns = [];
|
|
12936
|
+
this.columnsJson = undefined;
|
|
12937
|
+
this.data = [];
|
|
12938
|
+
this.dataJson = undefined;
|
|
12939
|
+
this.noDataMessage = 'No data available';
|
|
12940
|
+
this.noColumnsNoDataMessage = 'No data or columns available to display.';
|
|
12941
|
+
}
|
|
12942
|
+
//#endregion PROPERTIES
|
|
12943
|
+
/****************************************************************************/
|
|
12944
|
+
//#region WATCHERS
|
|
12945
|
+
parseColumns(newValue, oldValue) {
|
|
12946
|
+
this.parseColumnsArray(newValue, oldValue);
|
|
12947
|
+
}
|
|
12948
|
+
parseJsonColumns(newValue) {
|
|
12949
|
+
try {
|
|
12950
|
+
const newItems = newValue ? JSON.parse(newValue) : [];
|
|
12951
|
+
this.parseColumnsArray(newItems, this.parsedColumns);
|
|
12952
|
+
}
|
|
12953
|
+
catch (e) {
|
|
12954
|
+
console.error('Invalid JSON format for columnsJson:', e.message);
|
|
12955
|
+
this.parsedColumns = [];
|
|
12956
|
+
}
|
|
12957
|
+
}
|
|
12958
|
+
parseData(newValue, oldValue) {
|
|
12959
|
+
this.parseDataArray(newValue, oldValue);
|
|
12960
|
+
}
|
|
12961
|
+
parseJsonData(newValue) {
|
|
12962
|
+
try {
|
|
12963
|
+
const newItems = newValue ? JSON.parse(newValue) : [];
|
|
12964
|
+
this.parseDataArray(newItems, this.parsedData);
|
|
12965
|
+
}
|
|
12966
|
+
catch (e) {
|
|
12967
|
+
console.error('Invalid JSON format for dataJson:', e.message);
|
|
12968
|
+
this.parsedData = [];
|
|
12969
|
+
}
|
|
12970
|
+
}
|
|
12971
|
+
//#endregion WATCHERS
|
|
12972
|
+
/****************************************************************************/
|
|
12973
|
+
//#region METHODS
|
|
12974
|
+
/**
|
|
12975
|
+
* Parses the columns array.
|
|
12976
|
+
* @param {string[]} newValue - The new value of the columns array.
|
|
12977
|
+
* @param {string[]} oldValue - The old value of the columns array.
|
|
12978
|
+
*/
|
|
12979
|
+
parseColumnsArray(newValue, oldValue) {
|
|
12980
|
+
if (JSON.stringify(newValue) === JSON.stringify(oldValue))
|
|
12981
|
+
return; // Deep comparison
|
|
12982
|
+
this.parsedColumns = Array.isArray(newValue) ? newValue : [];
|
|
12983
|
+
}
|
|
12984
|
+
/**
|
|
12985
|
+
* Parses the data array.
|
|
12986
|
+
* @param {any[]} newValue - The new value of the data array.
|
|
12987
|
+
* @param {any[]} oldValue - The old value of the data array.
|
|
12988
|
+
*/
|
|
12989
|
+
parseDataArray(newValue, oldValue) {
|
|
12990
|
+
if (JSON.stringify(newValue) === JSON.stringify(oldValue))
|
|
12991
|
+
return; // Deep comparison
|
|
12992
|
+
this.parsedData = Array.isArray(newValue) ? newValue : [];
|
|
12993
|
+
}
|
|
12994
|
+
//#endregion METHODS
|
|
12995
|
+
/****************************************************************************/
|
|
12996
|
+
//#region LIFECYCLE
|
|
12997
|
+
componentWillLoad() {
|
|
12998
|
+
this.hasSlotHead = !!this.el.querySelector('[slot="head"]');
|
|
12999
|
+
this.hasSlotBody = !!this.el.querySelector('[slot="body"]');
|
|
13000
|
+
if (this.columnsJson) {
|
|
13001
|
+
this.parseJsonColumns(this.columnsJson);
|
|
13002
|
+
}
|
|
13003
|
+
else {
|
|
13004
|
+
this.parseColumns(this.columns, this.parsedColumns);
|
|
13005
|
+
}
|
|
13006
|
+
if (this.dataJson) {
|
|
13007
|
+
this.parseJsonData(this.dataJson);
|
|
13008
|
+
}
|
|
13009
|
+
else {
|
|
13010
|
+
this.parseData(this.data, this.parsedData);
|
|
13011
|
+
}
|
|
13012
|
+
}
|
|
13013
|
+
//#endregion LIFECYCLE
|
|
13014
|
+
/****************************************************************************/
|
|
13015
|
+
//#region RENDER
|
|
13016
|
+
render() {
|
|
13017
|
+
const headerRows = this.hasSlotHead
|
|
13018
|
+
? Array.from(this.el
|
|
13019
|
+
.querySelector('[slot="head"]')
|
|
13020
|
+
.querySelectorAll('nv-tablerow'))
|
|
13021
|
+
: [];
|
|
13022
|
+
const bodyRows = this.hasSlotBody
|
|
13023
|
+
? Array.from(this.el
|
|
13024
|
+
.querySelector('[slot="body"]')
|
|
13025
|
+
.querySelectorAll('nv-tablerow'))
|
|
13026
|
+
: [];
|
|
13027
|
+
return (hAsync(Host, { key: 'ab2f459ea80c9f134a537b62298ffd55ad7b719f' }, hAsync("div", { key: '081211573d87749e8b133b89e9da2a201b9e8bf3', class: "hidden" }, hAsync("slot", { key: '7dd2c168d379818e1456eb2117e14cf79e44f33e' }), hAsync("slot", { key: '7c8e1b4cf0b223257148459d753c2eb325a7cd17', name: "head" }), hAsync("slot", { key: 'd107814f31a82e3fd6e22dbccff319c5baf2b3db', name: "body" })), hAsync("slot", { key: 'd704c43a322b073ed459947f23950bc719402656', name: "before" }), this.parsedColumns.length === 0 &&
|
|
13028
|
+
this.parsedData.length === 0 &&
|
|
13029
|
+
headerRows.length === 0 &&
|
|
13030
|
+
bodyRows.length === 0 ? (hAsync("p", null, this.noColumnsNoDataMessage)) : (hAsync("table", null, this.parsedColumns.length > 0 ? (hAsync("thead", null, hAsync("tr", null, this.parsedColumns.map(column => (hAsync("th", null, column)))))) : headerRows.length > 0 ? (hAsync("thead", null, headerRows.map(row => {
|
|
13031
|
+
const cells = Array.from(row.querySelectorAll('nv-tablecolumn'));
|
|
13032
|
+
return (hAsync("tr", null, cells.map(cell => (hAsync("th", { colSpan: cell.colspan, rowSpan: cell.rowspan, headers: cell.headers, scope: cell.scope, innerHTML: cell.innerHTML })))));
|
|
13033
|
+
}))) : null, hAsync("tbody", null, this.parsedData.length === 0 && bodyRows.length === 0 ? (hAsync("tr", null, hAsync("td", { colSpan: this.parsedColumns.length || 12 }, this.noDataMessage))) : this.parsedData.length > 0 ? (this.parsedData.map(row => (hAsync("tr", null, this.parsedColumns.length > 0
|
|
13034
|
+
? this.parsedColumns.map(column => (hAsync("td", null, row[column.toLowerCase()] || '')))
|
|
13035
|
+
: Object.values(row).map(value => hAsync("td", null, value)))))) : bodyRows.length > 0 ? (bodyRows.map(row => {
|
|
13036
|
+
const cells = Array.from(row.querySelectorAll('nv-tabledatacell'));
|
|
13037
|
+
return (hAsync("tr", null, cells.map(cell => (hAsync("td", { colSpan: cell.colspan, rowSpan: cell.rowspan, headers: cell.headers, innerHTML: cell.innerHTML })))));
|
|
13038
|
+
})) : null))), hAsync("slot", { key: '727d2040bec14d6632d062637b86b3a79e30b88d', name: "after" })));
|
|
13039
|
+
}
|
|
13040
|
+
get el() { return getElement(this); }
|
|
13041
|
+
static get watchers() { return {
|
|
13042
|
+
"columns": ["parseColumns"],
|
|
13043
|
+
"columnsJson": ["parseJsonColumns"],
|
|
13044
|
+
"data": ["parseData"],
|
|
13045
|
+
"dataJson": ["parseJsonData"]
|
|
13046
|
+
}; }
|
|
13047
|
+
static get style() { return NvTableStyle0; }
|
|
13048
|
+
static get cmpMeta() { return {
|
|
13049
|
+
"$flags$": 4,
|
|
13050
|
+
"$tagName$": "nv-table",
|
|
13051
|
+
"$members$": {
|
|
13052
|
+
"columns": [16],
|
|
13053
|
+
"columnsJson": [513, "columns-json"],
|
|
13054
|
+
"data": [16],
|
|
13055
|
+
"dataJson": [513, "data-json"],
|
|
13056
|
+
"noDataMessage": [1, "no-data-message"],
|
|
13057
|
+
"noColumnsNoDataMessage": [1, "no-columns-no-data-message"],
|
|
13058
|
+
"parsedColumns": [32],
|
|
13059
|
+
"parsedData": [32],
|
|
13060
|
+
"hasSlotHead": [32],
|
|
13061
|
+
"hasSlotBody": [32]
|
|
13062
|
+
},
|
|
13063
|
+
"$listeners$": undefined,
|
|
13064
|
+
"$lazyBundleId$": "-",
|
|
13065
|
+
"$attrsToReflect$": [["columnsJson", "columns-json"], ["dataJson", "data-json"]]
|
|
13066
|
+
}; }
|
|
13067
|
+
}
|
|
13068
|
+
|
|
13069
|
+
const nvTablebodyCss = "";
|
|
13070
|
+
var NvTablebodyStyle0 = nvTablebodyCss;
|
|
13071
|
+
|
|
13072
|
+
/**
|
|
13073
|
+
* @slot default - Use this slot to insert HTML into the table body.
|
|
13074
|
+
*/
|
|
13075
|
+
class NvTablebody {
|
|
13076
|
+
constructor(hostRef) {
|
|
13077
|
+
registerInstance(this, hostRef);
|
|
13078
|
+
}
|
|
13079
|
+
/****************************************************************************/
|
|
13080
|
+
//#region RENDER
|
|
13081
|
+
render() {
|
|
13082
|
+
return (hAsync(Host, { key: '033046403a927a4e738ee0b17491436872845375' }, hAsync("tbody", { key: 'e9dd64ba4c4463b64f7c48ea01aa8d577d1abddd' }, hAsync("slot", { key: '3790e34a3f1c0c870e41f5259edf956253cf031d' }))));
|
|
13083
|
+
}
|
|
13084
|
+
static get style() { return NvTablebodyStyle0; }
|
|
13085
|
+
static get cmpMeta() { return {
|
|
13086
|
+
"$flags$": 4,
|
|
13087
|
+
"$tagName$": "nv-tablebody",
|
|
13088
|
+
"$members$": undefined,
|
|
13089
|
+
"$listeners$": undefined,
|
|
13090
|
+
"$lazyBundleId$": "-",
|
|
13091
|
+
"$attrsToReflect$": []
|
|
13092
|
+
}; }
|
|
13093
|
+
}
|
|
13094
|
+
|
|
13095
|
+
const nvTablecolumnCss = "";
|
|
13096
|
+
var NvTablecolumnStyle0 = nvTablecolumnCss;
|
|
13097
|
+
|
|
13098
|
+
/**
|
|
13099
|
+
* @slot default - Use this slot to insert HTML into the table column.
|
|
13100
|
+
*/
|
|
13101
|
+
class NvTablecolumn {
|
|
13102
|
+
constructor(hostRef) {
|
|
13103
|
+
registerInstance(this, hostRef);
|
|
13104
|
+
this.abbr = undefined;
|
|
13105
|
+
this.colspan = 1;
|
|
13106
|
+
this.rowspan = 1;
|
|
13107
|
+
this.headers = undefined;
|
|
13108
|
+
this.scope = undefined;
|
|
13109
|
+
}
|
|
13110
|
+
//#endregion PROPERTIES
|
|
13111
|
+
/****************************************************************************/
|
|
13112
|
+
//#region RENDER
|
|
13113
|
+
render() {
|
|
13114
|
+
return (hAsync(Host, { key: '9e3e12375467e02e9e964b3f008aaee842704132' }, hAsync("th", { key: '9e4ee5f486d53a6200bd73652d35783da9d56eae', abbr: this.abbr, colSpan: this.colspan, headers: this.headers, rowSpan: this.rowspan, scope: this.scope }, hAsync("slot", { key: 'b59a867f3fad0e30e475f730aaaf482564969807' }))));
|
|
13115
|
+
}
|
|
13116
|
+
static get style() { return NvTablecolumnStyle0; }
|
|
13117
|
+
static get cmpMeta() { return {
|
|
13118
|
+
"$flags$": 4,
|
|
13119
|
+
"$tagName$": "nv-tablecolumn",
|
|
13120
|
+
"$members$": {
|
|
13121
|
+
"abbr": [1],
|
|
13122
|
+
"colspan": [2],
|
|
13123
|
+
"rowspan": [2],
|
|
13124
|
+
"headers": [1],
|
|
13125
|
+
"scope": [1]
|
|
13126
|
+
},
|
|
13127
|
+
"$listeners$": undefined,
|
|
13128
|
+
"$lazyBundleId$": "-",
|
|
13129
|
+
"$attrsToReflect$": []
|
|
13130
|
+
}; }
|
|
13131
|
+
}
|
|
13132
|
+
|
|
13133
|
+
const nvTabledatacellCss = "";
|
|
13134
|
+
var NvTabledatacellStyle0 = nvTabledatacellCss;
|
|
13135
|
+
|
|
13136
|
+
/**
|
|
13137
|
+
* @slot default - Use this slot to insert HTML into the table data cell.
|
|
13138
|
+
*/
|
|
13139
|
+
class NvTabledatacell {
|
|
13140
|
+
constructor(hostRef) {
|
|
13141
|
+
registerInstance(this, hostRef);
|
|
13142
|
+
this.colspan = 1;
|
|
13143
|
+
this.rowspan = 1;
|
|
13144
|
+
this.headers = undefined;
|
|
13145
|
+
}
|
|
13146
|
+
//#endregion PROPERTIES
|
|
13147
|
+
/****************************************************************************/
|
|
13148
|
+
//#region RENDER
|
|
13149
|
+
render() {
|
|
13150
|
+
return (hAsync(Host, { key: '2b8dd0b288e8771055c061f42bae406e35618394' }, hAsync("td", { key: '4c77b5ddb3e992816a9f74097b184cf0a4299a1d', colSpan: this.colspan, rowSpan: this.rowspan, headers: this.headers }, hAsync("slot", { key: '9698292b649e85f9d1a6578ae6b6166c33594eab' }))));
|
|
13151
|
+
}
|
|
13152
|
+
static get style() { return NvTabledatacellStyle0; }
|
|
13153
|
+
static get cmpMeta() { return {
|
|
13154
|
+
"$flags$": 4,
|
|
13155
|
+
"$tagName$": "nv-tabledatacell",
|
|
13156
|
+
"$members$": {
|
|
13157
|
+
"colspan": [2],
|
|
13158
|
+
"rowspan": [2],
|
|
13159
|
+
"headers": [1]
|
|
13160
|
+
},
|
|
13161
|
+
"$listeners$": undefined,
|
|
13162
|
+
"$lazyBundleId$": "-",
|
|
13163
|
+
"$attrsToReflect$": []
|
|
13164
|
+
}; }
|
|
13165
|
+
}
|
|
13166
|
+
|
|
13167
|
+
const nvTableheadCss = "";
|
|
13168
|
+
var NvTableheadStyle0 = nvTableheadCss;
|
|
13169
|
+
|
|
13170
|
+
/**
|
|
13171
|
+
* @slot default - Use this slot to insert HTML into the table head.
|
|
13172
|
+
*/
|
|
13173
|
+
class NvTablehead {
|
|
13174
|
+
constructor(hostRef) {
|
|
13175
|
+
registerInstance(this, hostRef);
|
|
13176
|
+
}
|
|
13177
|
+
/****************************************************************************/
|
|
13178
|
+
//#region RENDER
|
|
13179
|
+
render() {
|
|
13180
|
+
return (hAsync(Host, { key: '664bc779e57e372c4939f34e79be34672c701b9b' }, hAsync("thead", { key: '772dfe48aea949fa05229f036589947dcf097992' }, hAsync("slot", { key: 'bc76551105f0f0dfb4d6639bbe5b304b5b824328' }))));
|
|
13181
|
+
}
|
|
13182
|
+
static get style() { return NvTableheadStyle0; }
|
|
13183
|
+
static get cmpMeta() { return {
|
|
13184
|
+
"$flags$": 4,
|
|
13185
|
+
"$tagName$": "nv-tablehead",
|
|
13186
|
+
"$members$": undefined,
|
|
13187
|
+
"$listeners$": undefined,
|
|
13188
|
+
"$lazyBundleId$": "-",
|
|
13189
|
+
"$attrsToReflect$": []
|
|
13190
|
+
}; }
|
|
13191
|
+
}
|
|
13192
|
+
|
|
13193
|
+
const nvTablerowCss = "";
|
|
13194
|
+
var NvTablerowStyle0 = nvTablerowCss;
|
|
13195
|
+
|
|
13196
|
+
/**
|
|
13197
|
+
* @slot default - Use this slot to insert HTML into the table row.
|
|
13198
|
+
*/
|
|
13199
|
+
class NvTablerow {
|
|
13200
|
+
constructor(hostRef) {
|
|
13201
|
+
registerInstance(this, hostRef);
|
|
13202
|
+
}
|
|
13203
|
+
/****************************************************************************/
|
|
13204
|
+
//#region RENDER
|
|
13205
|
+
render() {
|
|
13206
|
+
return (hAsync(Host, { key: '2b24e970bb04d2ce5e9a95a136127fbdaa84a677' }, hAsync("tr", { key: 'd6c6a5ca230a5282a152db23885f200c04c43be4' }, hAsync("slot", { key: '84d7b5452772f4ff37e481fa14bd28b25cb0fd77' }))));
|
|
13207
|
+
}
|
|
13208
|
+
static get style() { return NvTablerowStyle0; }
|
|
13209
|
+
static get cmpMeta() { return {
|
|
13210
|
+
"$flags$": 4,
|
|
13211
|
+
"$tagName$": "nv-tablerow",
|
|
13212
|
+
"$members$": undefined,
|
|
13213
|
+
"$listeners$": undefined,
|
|
13214
|
+
"$lazyBundleId$": "-",
|
|
13215
|
+
"$attrsToReflect$": []
|
|
13216
|
+
}; }
|
|
13217
|
+
}
|
|
13218
|
+
|
|
9529
13219
|
const nvTooltipCss = "nv-tooltip{display:inline-block;position:relative}nv-tooltip:has([fluid]:not([fluid=false])){display:block}nv-tooltip [data-scope=popover]{background:var(--components-tooltip-background);color:var(--components-tooltip-text);font-weight:var(--font-weight-medium-emphasis);padding:var(--tooltip-padding-y) var(--tooltip-padding-x);font-size:var(--tooltip-font-size);border-radius:var(--tooltip-radius);border:none;box-shadow:0px var(--shadow-y-axis-lg-1) var(--shadow-blur-lg-1) var(--shadow-spread-lg-1) var(--shadow-color-opacity-1), 0px var(--shadow-y-axis-lg-2) var(--shadow-blur-lg-2) var(--shadow-spread-lg-2) var(--shadow-color-opacity-2)}nv-tooltip [data-scope=arrow]{background:var(--components-tooltip-background);box-shadow:none;border:none}";
|
|
9530
13220
|
var NvTooltipStyle0 = nvTooltipCss;
|
|
9531
13221
|
|
|
@@ -9552,7 +13242,7 @@ class NvTooltip {
|
|
|
9552
13242
|
/****************************************************************************/
|
|
9553
13243
|
//#region RENDER
|
|
9554
13244
|
render() {
|
|
9555
|
-
return (hAsync(Host, { key: '
|
|
13245
|
+
return (hAsync(Host, { key: '590d897c7012f9020f6ac6e9f49acb840b4067ca' }, hAsync("slot", { key: '9479477482e361a042d464311a90dc3b0babb9e5' }), hAsync("nv-popover", { key: '89a2903946a89074201b5eb61a64b0595d831512', triggerMode: "hover", hasArrow: true, placement: this.placement, triggerElement: this.triggerElement, groupName: 'tooltip', enterDelay: this.enterDelay }, hAsync("p", { key: '5a6097b56440b06c33b20d5c06054f6aad9c9a42', slot: "content" }, this.message), hAsync("slot", { key: '595f1185183da50e916b243276c38a10a84e5712', name: "content" }))));
|
|
9556
13246
|
}
|
|
9557
13247
|
get el() { return getElement(this); }
|
|
9558
13248
|
static get style() { return NvTooltipStyle0; }
|
|
@@ -9578,6 +13268,12 @@ registerComponents([
|
|
|
9578
13268
|
NvBaseComponent,
|
|
9579
13269
|
NvButton,
|
|
9580
13270
|
NvCol,
|
|
13271
|
+
NvDatagrid,
|
|
13272
|
+
NvDatagridbody,
|
|
13273
|
+
NvDatagridcolumn,
|
|
13274
|
+
NvDatagriddatacell,
|
|
13275
|
+
NvDatagridhead,
|
|
13276
|
+
NvDatagridrow,
|
|
9581
13277
|
NvFieldcheckbox,
|
|
9582
13278
|
NvFielddropdownitem,
|
|
9583
13279
|
NvFieldnumber,
|
|
@@ -9595,6 +13291,12 @@ registerComponents([
|
|
|
9595
13291
|
NvPopover,
|
|
9596
13292
|
NvRow,
|
|
9597
13293
|
NvStack,
|
|
13294
|
+
NvTable,
|
|
13295
|
+
NvTablebody,
|
|
13296
|
+
NvTablecolumn,
|
|
13297
|
+
NvTabledatacell,
|
|
13298
|
+
NvTablehead,
|
|
13299
|
+
NvTablerow,
|
|
9598
13300
|
NvTooltip,
|
|
9599
13301
|
]);
|
|
9600
13302
|
|