@simple-table/angular 4.0.1 → 4.0.2
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/dist/cjs/index.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/types/buildVanillaConfig.d.ts +7 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/{angular/src/lib → lib}/SimpleTableComponent.d.ts +13 -1
- package/dist/types/{angular/src/types.d.ts → types.d.ts} +17 -7
- package/package.json +12 -7
- package/styles.css.d.ts +1 -0
- package/dist/types/angular/src/buildVanillaConfig.d.ts +0 -5
- package/dist/types/angular/src/index.d.ts +0 -8
- package/dist/types/core/src/consts/column-constraints.d.ts +0 -58
- package/dist/types/core/src/consts/general-consts.d.ts +0 -32
- package/dist/types/core/src/core/SimpleTableVanilla.d.ts +0 -369
- package/dist/types/core/src/core/api/TableAPIImpl.d.ts +0 -78
- package/dist/types/core/src/core/dom/DOMManager.d.ts +0 -52
- package/dist/types/core/src/core/initialization/TableInitializer.d.ts +0 -34
- package/dist/types/core/src/core/rendering/RenderOrchestrator.d.ts +0 -172
- package/dist/types/core/src/core/rendering/SectionRenderer.d.ts +0 -119
- package/dist/types/core/src/core/rendering/TableRenderer.d.ts +0 -120
- package/dist/types/core/src/hooks/ariaAnnouncements.d.ts +0 -37
- package/dist/types/core/src/hooks/contentHeight.d.ts +0 -29
- package/dist/types/core/src/hooks/expandedDepths.d.ts +0 -69
- package/dist/types/core/src/hooks/handleOutsideClick.d.ts +0 -50
- package/dist/types/core/src/hooks/previousValue.d.ts +0 -30
- package/dist/types/core/src/hooks/scrollbarVisibility.d.ts +0 -65
- package/dist/types/core/src/hooks/scrollbarWidth.d.ts +0 -52
- package/dist/types/core/src/hooks/useAggregatedRows.d.ts +0 -14
- package/dist/types/core/src/hooks/useQuickFilter.d.ts +0 -14
- package/dist/types/core/src/hooks/windowResize.d.ts +0 -31
- package/dist/types/core/src/icons/AngleDownIcon.d.ts +0 -1
- package/dist/types/core/src/icons/AngleLeftIcon.d.ts +0 -1
- package/dist/types/core/src/icons/AngleRightIcon.d.ts +0 -1
- package/dist/types/core/src/icons/AngleUpIcon.d.ts +0 -1
- package/dist/types/core/src/icons/AscIcon.d.ts +0 -1
- package/dist/types/core/src/icons/CheckIcon.d.ts +0 -1
- package/dist/types/core/src/icons/DescIcon.d.ts +0 -1
- package/dist/types/core/src/icons/DragIcon.d.ts +0 -1
- package/dist/types/core/src/icons/FilterIcon.d.ts +0 -1
- package/dist/types/core/src/icons/SelectIcon.d.ts +0 -1
- package/dist/types/core/src/icons/index.d.ts +0 -14
- package/dist/types/core/src/index.d.ts +0 -58
- package/dist/types/core/src/managers/AnimationCoordinator.d.ts +0 -356
- package/dist/types/core/src/managers/AutoScaleManager.d.ts +0 -33
- package/dist/types/core/src/managers/DimensionManager.d.ts +0 -84
- package/dist/types/core/src/managers/DragHandlerManager.d.ts +0 -44
- package/dist/types/core/src/managers/FilterManager.d.ts +0 -36
- package/dist/types/core/src/managers/PivotManager.d.ts +0 -35
- package/dist/types/core/src/managers/RowManager.d.ts +0 -56
- package/dist/types/core/src/managers/RowSelectionManager.d.ts +0 -72
- package/dist/types/core/src/managers/ScrollManager.d.ts +0 -38
- package/dist/types/core/src/managers/SectionScrollController.d.ts +0 -74
- package/dist/types/core/src/managers/SelectionManager/SelectionManager.d.ts +0 -251
- package/dist/types/core/src/managers/SelectionManager/index.d.ts +0 -2
- package/dist/types/core/src/managers/SelectionManager/keyboardUtils.d.ts +0 -7
- package/dist/types/core/src/managers/SelectionManager/mouseUtils.d.ts +0 -16
- package/dist/types/core/src/managers/SelectionManager/selectionRangeUtils.d.ts +0 -7
- package/dist/types/core/src/managers/SelectionManager/types.d.ts +0 -28
- package/dist/types/core/src/managers/SortManager.d.ts +0 -42
- package/dist/types/core/src/types/AggregationTypes.d.ts +0 -8
- package/dist/types/core/src/types/AnimationsConfig.d.ts +0 -16
- package/dist/types/core/src/types/BoundingBox.d.ts +0 -11
- package/dist/types/core/src/types/Cell.d.ts +0 -7
- package/dist/types/core/src/types/CellChangeProps.d.ts +0 -9
- package/dist/types/core/src/types/CellClickProps.d.ts +0 -11
- package/dist/types/core/src/types/CellRendererProps.d.ts +0 -32
- package/dist/types/core/src/types/CellValue.d.ts +0 -2
- package/dist/types/core/src/types/ColumnEditorConfig.d.ts +0 -42
- package/dist/types/core/src/types/ColumnEditorCustomRendererProps.d.ts +0 -14
- package/dist/types/core/src/types/ColumnEditorRowRendererProps.d.ts +0 -39
- package/dist/types/core/src/types/ColumnVisibilityTypes.d.ts +0 -4
- package/dist/types/core/src/types/CustomTheme.d.ts +0 -28
- package/dist/types/core/src/types/DragHandlerProps.d.ts +0 -14
- package/dist/types/core/src/types/EnumOption.d.ts +0 -5
- package/dist/types/core/src/types/FilterTypes.d.ts +0 -31
- package/dist/types/core/src/types/FlattenedHeader.d.ts +0 -10
- package/dist/types/core/src/types/FooterPosition.d.ts +0 -3
- package/dist/types/core/src/types/FooterRendererProps.d.ts +0 -17
- package/dist/types/core/src/types/GenerateRowIdParams.d.ts +0 -11
- package/dist/types/core/src/types/GetRowId.d.ts +0 -16
- package/dist/types/core/src/types/HandleResizeStartProps.d.ts +0 -25
- package/dist/types/core/src/types/HeaderDropdownProps.d.ts +0 -14
- package/dist/types/core/src/types/HeaderObject.d.ts +0 -133
- package/dist/types/core/src/types/HeaderRendererProps.d.ts +0 -17
- package/dist/types/core/src/types/IconsConfig.d.ts +0 -19
- package/dist/types/core/src/types/OnNextPage.d.ts +0 -2
- package/dist/types/core/src/types/OnRowGroupExpandProps.d.ts +0 -16
- package/dist/types/core/src/types/OnSortProps.d.ts +0 -3
- package/dist/types/core/src/types/PanelSection.d.ts +0 -1
- package/dist/types/core/src/types/Pinned.d.ts +0 -1
- package/dist/types/core/src/types/PinnedSectionsState.d.ts +0 -6
- package/dist/types/core/src/types/PivotTypes.d.ts +0 -37
- package/dist/types/core/src/types/QuickFilterTypes.d.ts +0 -21
- package/dist/types/core/src/types/Row.d.ts +0 -3
- package/dist/types/core/src/types/RowButton.d.ts +0 -6
- package/dist/types/core/src/types/RowId.d.ts +0 -1
- package/dist/types/core/src/types/RowSelectionChangeProps.d.ts +0 -7
- package/dist/types/core/src/types/RowSelectionMode.d.ts +0 -8
- package/dist/types/core/src/types/RowState.d.ts +0 -12
- package/dist/types/core/src/types/RowStateRendererProps.d.ts +0 -18
- package/dist/types/core/src/types/SharedTableProps.d.ts +0 -24
- package/dist/types/core/src/types/SimpleTableConfig.d.ts +0 -124
- package/dist/types/core/src/types/SimpleTableProps.d.ts +0 -125
- package/dist/types/core/src/types/SortColumn.d.ts +0 -8
- package/dist/types/core/src/types/TableAPI.d.ts +0 -82
- package/dist/types/core/src/types/TableHeaderProps.d.ts +0 -17
- package/dist/types/core/src/types/TableRow.d.ts +0 -39
- package/dist/types/core/src/types/TableRowProps.d.ts +0 -29
- package/dist/types/core/src/types/Theme.d.ts +0 -2
- package/dist/types/core/src/types/UpdateCellProps.d.ts +0 -8
- package/dist/types/core/src/utils/accordionAnimation.d.ts +0 -25
- package/dist/types/core/src/utils/aggregationUtils.d.ts +0 -7
- package/dist/types/core/src/utils/ariaRowOwnership.d.ts +0 -37
- package/dist/types/core/src/utils/asRows.d.ts +0 -7
- package/dist/types/core/src/utils/bodyCell/cellLiveRef.d.ts +0 -9
- package/dist/types/core/src/utils/bodyCell/content.d.ts +0 -5
- package/dist/types/core/src/utils/bodyCell/editing.d.ts +0 -4
- package/dist/types/core/src/utils/bodyCell/editors/booleanDropdown.d.ts +0 -2
- package/dist/types/core/src/utils/bodyCell/editors/datePicker.d.ts +0 -2
- package/dist/types/core/src/utils/bodyCell/editors/dropdown.d.ts +0 -18
- package/dist/types/core/src/utils/bodyCell/editors/enumDropdown.d.ts +0 -2
- package/dist/types/core/src/utils/bodyCell/eventTracking.d.ts +0 -3
- package/dist/types/core/src/utils/bodyCell/expansion.d.ts +0 -12
- package/dist/types/core/src/utils/bodyCell/selection.d.ts +0 -7
- package/dist/types/core/src/utils/bodyCell/styling.d.ts +0 -11
- package/dist/types/core/src/utils/bodyCell/types.d.ts +0 -170
- package/dist/types/core/src/utils/bodyCellRenderer.d.ts +0 -6
- package/dist/types/core/src/utils/cellClipboardUtils.d.ts +0 -25
- package/dist/types/core/src/utils/cellScrollUtils.d.ts +0 -10
- package/dist/types/core/src/utils/cellUtils.d.ts +0 -18
- package/dist/types/core/src/utils/charts/createBarChart.d.ts +0 -20
- package/dist/types/core/src/utils/charts/createLineAreaChart.d.ts +0 -25
- package/dist/types/core/src/utils/collapseUtils.d.ts +0 -31
- package/dist/types/core/src/utils/columnEditor/columnEditorUtils.d.ts +0 -27
- package/dist/types/core/src/utils/columnEditor/createCheckbox.d.ts +0 -21
- package/dist/types/core/src/utils/columnEditor/createColumnEditor.d.ts +0 -26
- package/dist/types/core/src/utils/columnEditor/createColumnEditorPopout.d.ts +0 -23
- package/dist/types/core/src/utils/columnEditor/createColumnEditorRow.d.ts +0 -41
- package/dist/types/core/src/utils/csvExportUtils.d.ts +0 -14
- package/dist/types/core/src/utils/dateUtils.d.ts +0 -18
- package/dist/types/core/src/utils/externalScroll.d.ts +0 -58
- package/dist/types/core/src/utils/filterUtils.d.ts +0 -5
- package/dist/types/core/src/utils/filters/createBooleanFilter.d.ts +0 -15
- package/dist/types/core/src/utils/filters/createCustomSelect.d.ts +0 -20
- package/dist/types/core/src/utils/filters/createDateFilter.d.ts +0 -15
- package/dist/types/core/src/utils/filters/createDatePicker.d.ts +0 -10
- package/dist/types/core/src/utils/filters/createDropdown.d.ts +0 -33
- package/dist/types/core/src/utils/filters/createEnumFilter.d.ts +0 -15
- package/dist/types/core/src/utils/filters/createFilterActions.d.ts +0 -12
- package/dist/types/core/src/utils/filters/createFilterDropdown.d.ts +0 -15
- package/dist/types/core/src/utils/filters/createFilterInput.d.ts +0 -16
- package/dist/types/core/src/utils/filters/createNumberFilter.d.ts +0 -15
- package/dist/types/core/src/utils/filters/createStringFilter.d.ts +0 -15
- package/dist/types/core/src/utils/footer/createTableFooter.d.ts +0 -21
- package/dist/types/core/src/utils/formatters.d.ts +0 -3
- package/dist/types/core/src/utils/generalUtils.d.ts +0 -4
- package/dist/types/core/src/utils/headerCell/collapsing.d.ts +0 -6
- package/dist/types/core/src/utils/headerCell/dragging.d.ts +0 -5
- package/dist/types/core/src/utils/headerCell/editing.d.ts +0 -4
- package/dist/types/core/src/utils/headerCell/eventTracking.d.ts +0 -28
- package/dist/types/core/src/utils/headerCell/filtering.d.ts +0 -3
- package/dist/types/core/src/utils/headerCell/resizing.d.ts +0 -3
- package/dist/types/core/src/utils/headerCell/selection.d.ts +0 -10
- package/dist/types/core/src/utils/headerCell/sorting.d.ts +0 -3
- package/dist/types/core/src/utils/headerCell/styling.d.ts +0 -7
- package/dist/types/core/src/utils/headerCell/types.d.ts +0 -110
- package/dist/types/core/src/utils/headerCellRenderer.d.ts +0 -4
- package/dist/types/core/src/utils/headerUtils.d.ts +0 -41
- package/dist/types/core/src/utils/headerWidthUtils.d.ts +0 -121
- package/dist/types/core/src/utils/horizontalScrollbarRenderer.d.ts +0 -27
- package/dist/types/core/src/utils/infiniteScrollUtils.d.ts +0 -145
- package/dist/types/core/src/utils/loadingPlaceholderUtils.d.ts +0 -11
- package/dist/types/core/src/utils/nestedGridRowRenderer.d.ts +0 -50
- package/dist/types/core/src/utils/pinnedColumnUtils.d.ts +0 -29
- package/dist/types/core/src/utils/pivot/pivotRows.d.ts +0 -16
- package/dist/types/core/src/utils/propSyncEqual.d.ts +0 -60
- package/dist/types/core/src/utils/quickFilterUtils.d.ts +0 -14
- package/dist/types/core/src/utils/resizeUtils/autoExpandResize.d.ts +0 -32
- package/dist/types/core/src/utils/resizeUtils/compensation.d.ts +0 -17
- package/dist/types/core/src/utils/resizeUtils/domUpdates.d.ts +0 -15
- package/dist/types/core/src/utils/resizeUtils/index.d.ts +0 -26
- package/dist/types/core/src/utils/resizeUtils/maxWidth.d.ts +0 -9
- package/dist/types/core/src/utils/resizeUtils/parentHeaderResize.d.ts +0 -11
- package/dist/types/core/src/utils/resizeUtils/sectionWidths.d.ts +0 -36
- package/dist/types/core/src/utils/rowFlattening.d.ts +0 -30
- package/dist/types/core/src/utils/rowProcessing.d.ts +0 -65
- package/dist/types/core/src/utils/rowSelectionUtils.d.ts +0 -62
- package/dist/types/core/src/utils/rowSeparatorRenderer.d.ts +0 -16
- package/dist/types/core/src/utils/rowUtils.d.ts +0 -187
- package/dist/types/core/src/utils/sortUtils.d.ts +0 -8
- package/dist/types/core/src/utils/stateRowRenderer.d.ts +0 -15
- package/dist/types/core/src/utils/stickyParentsRenderer.d.ts +0 -53
- /package/dist/types/{angular/src/MountRegistry.d.ts → MountRegistry.d.ts} +0 -0
- /package/dist/types/{angular/src/lib → lib}/provideSimpleTable.d.ts +0 -0
- /package/dist/types/{angular/src/utils → utils}/wrapAngularRenderer.d.ts +0 -0
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@angular/core"),t=require("simple-table-core");function o(e,t,o,n){var i,r=arguments.length,s=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,n);else for(var p=e.length-1;p>=0;p--)(i=e[p])&&(s=(r<3?i(s):r>3?i(t,o,s):i(t,o))||s);return r>3&&s&&Object.defineProperty(t,o,s),s}function n(t,o,n,i){return r=>{const s=document.createElement("div"),p=e.createComponent(t,{environmentInjector:n,hostElement:s});return Object.assign(p.instance,r),o.attachView(p.hostView),p.changeDetectorRef.detectChanges(),i?.register(s,()=>{o.detachView(p.hostView),p.destroy()}),s}}function i(t,o,n,i,r,s){const p="cell"===s?i.cellRendererCache:i.headerRendererCache,l=p.get(r);if(l)return l.component=t,l.wrapped;const a={component:t,wrapped:null},d=t=>{const r=document.createElement("div"),s=e.createComponent(a.component,{environmentInjector:n,hostElement:r});return Object.assign(s.instance,t),o.attachView(s.hostView),s.changeDetectorRef.detectChanges(),i.register(r,()=>{o.detachView(s.hostView),s.destroy()}),r};return a.wrapped=d,p.set(r,a),d}function r(e,o,s,p){const{defaultHeaders:l,rows:a,footerRenderer:d,emptyStateRenderer:h,errorStateRenderer:u,loadingStateRenderer:m,tableEmptyStateRenderer:c,headerDropdown:C,columnEditorConfig:v,icons:g,rowButtons:S,onColumnOrderChange:b,onColumnWidthChange:y,onHeaderEdit:R,onColumnSelect:x,...f}=e,I=e=>n(e,s,p,o);o.pruneRendererCaches(t.collectHeaderAccessors(l));const T={...f,rows:a,defaultHeaders:l.map(function e(t){const{cellRenderer:n,headerRenderer:l,children:a,nestedTable:d,...h}=t,u=String(t.accessor),m={...h};if(n&&(m.cellRenderer=n.ɵcmp?i(n,s,p,o,u,"cell"):n),l&&(m.headerRenderer=l.ɵcmp?i(l,s,p,o,u,"header"):l),a&&(m.children=a.map(e)),d){const e={...d,rows:[]};m.nestedTable=r(e,o,s,p)}return m}),onRendererHostDiscard:o.disposeHost,...b?{onColumnOrderChange:e=>b(e)}:{},...y?{onColumnWidthChange:e=>y(e)}:{},...R?{onHeaderEdit:(e,t)=>R(e,t)}:{},...x?{onColumnSelect:e=>x(e)}:{}};return void 0!==d&&(T.footerRenderer=d.ɵcmp?I(d):d),void 0!==h&&(T.emptyStateRenderer=h.ɵcmp?I(h):h),void 0!==u&&(T.errorStateRenderer=u.ɵcmp?I(u):u),void 0!==m&&(T.loadingStateRenderer=m.ɵcmp?I(m):m),void 0!==c&&(T.tableEmptyStateRenderer=c),void 0!==C&&(T.headerDropdown=I(C)),void 0!==v&&(T.columnEditorConfig=function(e){const{rowRenderer:t,customRenderer:o,...n}=e;return{...n,...t?{rowRenderer:I(t)}:{},...o?{customRenderer:I(o)}:{}}}(v)),void 0!==g&&(T.icons=function(e){const t={};for(const[o,n]of Object.entries(e))null!=n&&(t[o]="string"==typeof n||n instanceof HTMLElement||n instanceof SVGSVGElement?n:n.ɵcmp?I(n)({}):n);return t}(g)),void 0!==S&&(T.rowButtons=S.map(e=>I(e))),T}"function"==typeof SuppressedError&&SuppressedError;const s="data-st-mount-id";class p{constructor(){this.entries=new Map,this.nextId=0,this.cellRendererCache=new Map,this.headerRendererCache=new Map,this.disposeHost=e=>{if("function"!=typeof e.getAttribute)return;const t=[],o=e.getAttribute(s);null!==o&&t.push(o),e.querySelectorAll(`[${s}]`).forEach(e=>{const o=e.getAttribute(s);null!==o&&t.push(o)});for(const e of t){const t=this.entries.get(e);t&&(this.entries.delete(e),t())}}}register(e,t){const o="st-mount-"+this.nextId++;e.setAttribute(s,o),this.entries.set(o,t)}clear(){this.cellRendererCache.clear(),this.headerRendererCache.clear();for(const e of this.entries.values())e();this.entries.clear()}pruneRendererCaches(e){for(const t of this.cellRendererCache.keys())e.has(t)||this.cellRendererCache.delete(t);for(const t of this.headerRendererCache.keys())e.has(t)||this.headerRendererCache.delete(t)}get size(){return this.entries.size}}exports.SimpleTableComponent=class{constructor(){this.tableReady=new e.EventEmitter,this.instance=null,this.registry=new p,this.hostEl=e.inject(e.ElementRef),this.appRef=e.inject(e.ApplicationRef),this.envInjector=e.inject(e.EnvironmentInjector)}ngOnInit(){const e=this.hostEl.nativeElement.querySelector("div");if(!e)return;const o=this.getProps();this.instance=new t.SimpleTableVanilla(e,r(o,this.registry,this.appRef,this.envInjector)),this.instance.mount(),this.syncedDefaultHeaders=o.defaultHeaders,this.syncedRows=o.rows,this.tableReady.emit(this.instance.getAPI())}ngOnChanges(){if(!this.instance)return;const e=this.getProps(),o={...r(e,this.registry,this.appRef,this.envInjector)},n=t.headersStructurallyEqual(this.syncedDefaultHeaders,e.defaultHeaders);this.syncedDefaultHeaders=e.defaultHeaders,n&&delete o.defaultHeaders;const i=t.rowsShallowUnchanged(this.syncedRows,e.rows,e.getRowId);this.syncedRows=e.rows,i&&delete o.rows,this.instance.update(o)}ngOnDestroy(){this.instance?.destroy(),this.instance=null,this.syncedDefaultHeaders=void 0,this.syncedRows=void 0,this.registry.clear()}getAPI(){return this.instance?.getAPI()??null}getProps(){const e={rows:this.rows,defaultHeaders:this.defaultHeaders};return void 0!==this.footerRenderer&&(e.footerRenderer=this.footerRenderer),void 0!==this.loadingStateRenderer&&(e.loadingStateRenderer=this.loadingStateRenderer),void 0!==this.errorStateRenderer&&(e.errorStateRenderer=this.errorStateRenderer),void 0!==this.emptyStateRenderer&&(e.emptyStateRenderer=this.emptyStateRenderer),void 0!==this.tableEmptyStateRenderer&&(e.tableEmptyStateRenderer=this.tableEmptyStateRenderer),void 0!==this.headerDropdown&&(e.headerDropdown=this.headerDropdown),void 0!==this.columnEditorConfig&&(e.columnEditorConfig=this.columnEditorConfig),void 0!==this.onCellClick&&(e.onCellClick=this.onCellClick),void 0!==this.onCellEdit&&(e.onCellEdit=this.onCellEdit),void 0!==this.onSortChange&&(e.onSortChange=this.onSortChange),void 0!==this.onFilterChange&&(e.onFilterChange=this.onFilterChange),void 0!==this.onRowSelectionChange&&(e.onRowSelectionChange=this.onRowSelectionChange),void 0!==this.onRowGroupExpand&&(e.onRowGroupExpand=this.onRowGroupExpand),void 0!==this.onColumnOrderChange&&(e.onColumnOrderChange=this.onColumnOrderChange),void 0!==this.onColumnVisibilityChange&&(e.onColumnVisibilityChange=this.onColumnVisibilityChange),void 0!==this.onColumnWidthChange&&(e.onColumnWidthChange=this.onColumnWidthChange),void 0!==this.onPageChange&&(e.onPageChange=this.onPageChange),void 0!==this.onLoadMore&&(e.onLoadMore=this.onLoadMore),void 0!==this.onGridReady&&(e.onGridReady=this.onGridReady),void 0!==this.rowGrouping&&(e.rowGrouping=this.rowGrouping),void 0!==this.pivot&&(e.pivot=this.pivot),void 0!==this.onPivotChange&&(e.onPivotChange=this.onPivotChange),void 0!==this.enableRowSelection&&(e.enableRowSelection=this.enableRowSelection),void 0!==this.theme&&(e.theme=this.theme),void 0!==this.quickFilter&&(e.quickFilter=this.quickFilter),void 0!==this.isLoading&&(e.isLoading=this.isLoading),void 0!==this.getRowId&&(e.getRowId=this.getRowId),void 0!==this.shouldPaginate&&(e.shouldPaginate=this.shouldPaginate),void 0!==this.rowsPerPage&&(e.rowsPerPage=this.rowsPerPage),void 0!==this.serverSidePagination&&(e.serverSidePagination=this.serverSidePagination),void 0!==this.totalRowCount&&(e.totalRowCount=this.totalRowCount),void 0!==this.height&&(e.height=this.height),void 0!==this.maxHeight&&(e.maxHeight=this.maxHeight),void 0!==this.scrollParent&&(e.scrollParent=this.scrollParent),void 0!==this.infiniteScrollThreshold&&(e.infiniteScrollThreshold=this.infiniteScrollThreshold),void 0!==this.columnResizing&&(e.columnResizing=this.columnResizing),void 0!==this.columnReordering&&(e.columnReordering=this.columnReordering),void 0!==this.editColumns&&(e.editColumns=this.editColumns),void 0!==this.editColumnsInitOpen&&(e.editColumnsInitOpen=this.editColumnsInitOpen),void 0!==this.selectableCells&&(e.selectableCells=this.selectableCells),void 0!==this.selectableColumns&&(e.selectableColumns=this.selectableColumns),void 0!==this.enableHeaderEditing&&(e.enableHeaderEditing=this.enableHeaderEditing),void 0!==this.onHeaderEdit&&(e.onHeaderEdit=this.onHeaderEdit),void 0!==this.customTheme&&(e.customTheme=this.customTheme),void 0!==this.icons&&(e.icons=this.icons),void 0!==this.externalFilterHandling&&(e.externalFilterHandling=this.externalFilterHandling),void 0!==this.externalSortHandling&&(e.externalSortHandling=this.externalSortHandling),void 0!==this.columnBorders&&(e.columnBorders=this.columnBorders),void 0!==this.rowButtons&&(e.rowButtons=this.rowButtons),void 0!==this.hideFooter&&(e.hideFooter=this.hideFooter),void 0!==this.footerPosition&&(e.footerPosition=this.footerPosition),void 0!==this.initialSortColumn&&(e.initialSortColumn=this.initialSortColumn),void 0!==this.initialSortDirection&&(e.initialSortDirection=this.initialSortDirection),void 0!==this.expandAll&&(e.expandAll=this.expandAll),void 0!==this.autoExpandColumns&&(e.autoExpandColumns=this.autoExpandColumns),void 0!==this.animations&&(e.animations=this.animations),void 0!==this.enableVirtualization&&(e.enableVirtualization=this.enableVirtualization),e}},o([e.Input({required:!0})],exports.SimpleTableComponent.prototype,"rows",void 0),o([e.Input({required:!0})],exports.SimpleTableComponent.prototype,"defaultHeaders",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"footerRenderer",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"loadingStateRenderer",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"errorStateRenderer",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"emptyStateRenderer",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"tableEmptyStateRenderer",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"headerDropdown",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"columnEditorConfig",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"onCellClick",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"onCellEdit",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"onSortChange",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"onFilterChange",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"onRowSelectionChange",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"onRowGroupExpand",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"onColumnOrderChange",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"onColumnVisibilityChange",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"onColumnWidthChange",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"onPageChange",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"onLoadMore",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"onGridReady",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"rowGrouping",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"pivot",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"onPivotChange",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"enableRowSelection",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"theme",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"quickFilter",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"isLoading",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"getRowId",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"shouldPaginate",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"rowsPerPage",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"serverSidePagination",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"totalRowCount",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"height",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"maxHeight",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"scrollParent",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"infiniteScrollThreshold",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"columnResizing",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"columnReordering",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"editColumns",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"editColumnsInitOpen",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"selectableCells",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"selectableColumns",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"enableHeaderEditing",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"onHeaderEdit",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"customTheme",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"icons",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"externalFilterHandling",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"externalSortHandling",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"columnBorders",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"rowButtons",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"hideFooter",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"footerPosition",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"initialSortColumn",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"initialSortDirection",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"expandAll",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"autoExpandColumns",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"animations",void 0),o([e.Input()],exports.SimpleTableComponent.prototype,"enableVirtualization",void 0),o([e.Output()],exports.SimpleTableComponent.prototype,"tableReady",void 0),exports.SimpleTableComponent=o([e.Component({selector:"simple-table",standalone:!0,template:"<div #host></div>",styles:[":host { display: block; }"]})],exports.SimpleTableComponent),Object.defineProperty(exports,"PIVOT_ACCESSOR_PREFIX",{enumerable:!0,get:function(){return t.PIVOT_ACCESSOR_PREFIX}}),Object.defineProperty(exports,"PIVOT_BLANK_LABEL",{enumerable:!0,get:function(){return t.PIVOT_BLANK_LABEL}}),Object.defineProperty(exports,"PIVOT_CHILDREN_KEY",{enumerable:!0,get:function(){return t.PIVOT_CHILDREN_KEY}}),Object.defineProperty(exports,"PIVOT_IS_TOTAL_KEY",{enumerable:!0,get:function(){return t.PIVOT_IS_TOTAL_KEY}}),Object.defineProperty(exports,"asRows",{enumerable:!0,get:function(){return t.asRows}}),Object.defineProperty(exports,"buildPivotAccessor",{enumerable:!0,get:function(){return t.buildPivotAccessor}}),Object.defineProperty(exports,"buildPivotRowTotalAccessor",{enumerable:!0,get:function(){return t.buildPivotRowTotalAccessor}}),Object.defineProperty(exports,"pivotRows",{enumerable:!0,get:function(){return t.pivotRows}}),exports.provideSimpleTable=function(){return e.makeEnvironmentProviders([])},exports.wrapAngularRenderer=n;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@angular/core"),o=require("simple-table-core");function t(e,o,t,n){var i,r=arguments.length,s=r<3?o:null===n?n=Object.getOwnPropertyDescriptor(o,t):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,o,t,n);else for(var p=e.length-1;p>=0;p--)(i=e[p])&&(s=(r<3?i(s):r>3?i(o,t,s):i(o,t))||s);return r>3&&s&&Object.defineProperty(o,t,s),s}function n(o,t,n,i){return r=>{const s=document.createElement("div"),p=e.createComponent(o,{environmentInjector:n,hostElement:s});return Object.assign(p.instance,r),t.attachView(p.hostView),p.changeDetectorRef.detectChanges(),i?.register(s,()=>{t.detachView(p.hostView),p.destroy()}),s}}function i(o,t,n,i,r,s){const p="cell"===s?i.cellRendererCache:i.headerRendererCache,l=p.get(r);if(l)return l.component=o,l.wrapped;const d={component:o,wrapped:null},a=o=>{const r=document.createElement("div"),s=e.createComponent(d.component,{environmentInjector:n,hostElement:r});return Object.assign(s.instance,o),t.attachView(s.hostView),s.changeDetectorRef.detectChanges(),i.register(r,()=>{t.detachView(s.hostView),s.destroy()}),r};return d.wrapped=a,p.set(r,d),a}function r(e){const o=e.columns??e.defaultHeaders;if(!o)throw new Error("SimpleTable requires `columns` or `defaultHeaders`");return o}function s(e,t,p,l){const{defaultHeaders:d,columns:a,rows:u,footerRenderer:h,emptyStateRenderer:m,errorStateRenderer:c,loadingStateRenderer:C,tableEmptyStateRenderer:v,headerDropdown:g,columnEditorConfig:b,icons:S,rowButtons:R,onColumnOrderChange:y,onColumnWidthChange:I,onHeaderEdit:x,onColumnSelect:w,enableColumnEditor:T,editColumns:f,enableColumnEditorInitOpen:E,editColumnsInitOpen:P,enablePagination:O,shouldPaginate:H,onTableReady:B,onGridReady:k,hoverRowBackground:A,useHoverRowBackground:V,oddColumnBackground:j,useOddColumnBackground:D,oddEvenRowBackground:_,useOddEvenRowBackground:L,...F}=e,G=e=>n(e,p,l,t),q=r(e);t.pruneRendererCaches(o.collectHeaderAccessors(q));const z={...F,rows:u,defaultHeaders:q.map(function e(o){const{cellRenderer:n,headerRenderer:r,children:d,nestedTable:a,...u}=o,h=String(o.accessor),m={...u};if(n&&(m.cellRenderer=n.ɵcmp?i(n,p,l,t,h,"cell"):n),r&&(m.headerRenderer=r.ɵcmp?i(r,p,l,t,h,"header"):r),d&&(m.children=d.map(e)),a){const e={...a,rows:[]};m.nestedTable=s(e,t,p,l)}return m}),editColumns:T??f,editColumnsInitOpen:E??P,shouldPaginate:O??H,onGridReady:B??k,useHoverRowBackground:A??V,useOddColumnBackground:j??D,useOddEvenRowBackground:_??L,onRendererHostDiscard:t.disposeHost,...y?{onColumnOrderChange:e=>y(e)}:{},...I?{onColumnWidthChange:e=>I(e)}:{},...x?{onHeaderEdit:(e,o)=>x(e,o)}:{},...w?{onColumnSelect:e=>w(e)}:{}};return void 0!==h&&(z.footerRenderer=h.ɵcmp?G(h):h),void 0!==m&&(z.emptyStateRenderer=m.ɵcmp?G(m):m),void 0!==c&&(z.errorStateRenderer=c.ɵcmp?G(c):c),void 0!==C&&(z.loadingStateRenderer=C.ɵcmp?G(C):C),void 0!==v&&(z.tableEmptyStateRenderer=v),void 0!==g&&(z.headerDropdown=G(g)),void 0!==b&&(z.columnEditorConfig=function(e){const{rowRenderer:o,customRenderer:t,...n}=e;return{...n,...o?{rowRenderer:G(o)}:{},...t?{customRenderer:G(t)}:{}}}(b)),void 0!==S&&(z.icons=function(e){const o={};for(const[t,n]of Object.entries(e))null!=n&&(o[t]="string"==typeof n||n instanceof HTMLElement||n instanceof SVGSVGElement?n:n.ɵcmp?G(n)({}):n);return o}(S)),void 0!==R&&(z.rowButtons=R.map(e=>G(e))),z}"function"==typeof SuppressedError&&SuppressedError;const p="data-st-mount-id";class l{constructor(){this.entries=new Map,this.nextId=0,this.cellRendererCache=new Map,this.headerRendererCache=new Map,this.disposeHost=e=>{if("function"!=typeof e.getAttribute)return;const o=[],t=e.getAttribute(p);null!==t&&o.push(t),e.querySelectorAll(`[${p}]`).forEach(e=>{const t=e.getAttribute(p);null!==t&&o.push(t)});for(const e of o){const o=this.entries.get(e);o&&(this.entries.delete(e),o())}}}register(e,o){const t="st-mount-"+this.nextId++;e.setAttribute(p,t),this.entries.set(t,o)}clear(){this.cellRendererCache.clear(),this.headerRendererCache.clear();for(const e of this.entries.values())e();this.entries.clear()}pruneRendererCaches(e){for(const o of this.cellRendererCache.keys())e.has(o)||this.cellRendererCache.delete(o);for(const o of this.headerRendererCache.keys())e.has(o)||this.headerRendererCache.delete(o)}get size(){return this.entries.size}}exports.SimpleTableComponent=class{constructor(){this.tableReady=new e.EventEmitter,this.instance=null,this.registry=new l,this.hostEl=e.inject(e.ElementRef),this.appRef=e.inject(e.ApplicationRef),this.envInjector=e.inject(e.EnvironmentInjector)}ngOnInit(){const e=this.hostEl.nativeElement.querySelector("div");if(!e)return;const t=this.getProps();this.instance=new o.SimpleTableVanilla(e,s(t,this.registry,this.appRef,this.envInjector)),this.instance.mount(),this.syncedDefaultHeaders=r(t),this.syncedRows=t.rows,this.tableReady.emit(this.instance.getAPI())}ngOnChanges(){if(!this.instance)return;const e=this.getProps(),t={...s(e,this.registry,this.appRef,this.envInjector)},n=r(e),i=o.headersStructurallyEqual(this.syncedDefaultHeaders,n);this.syncedDefaultHeaders=n,i&&delete t.defaultHeaders;const p=o.rowsShallowUnchanged(this.syncedRows,e.rows,e.getRowId);this.syncedRows=e.rows,p&&delete t.rows,this.instance.update(t)}ngOnDestroy(){this.instance?.destroy(),this.instance=null,this.syncedDefaultHeaders=void 0,this.syncedRows=void 0,this.registry.clear()}getAPI(){return this.instance?.getAPI()??null}getProps(){const e={rows:this.rows};return void 0!==this.defaultHeaders&&(e.defaultHeaders=this.defaultHeaders),void 0!==this.columns&&(e.columns=this.columns),void 0!==this.footerRenderer&&(e.footerRenderer=this.footerRenderer),void 0!==this.loadingStateRenderer&&(e.loadingStateRenderer=this.loadingStateRenderer),void 0!==this.errorStateRenderer&&(e.errorStateRenderer=this.errorStateRenderer),void 0!==this.emptyStateRenderer&&(e.emptyStateRenderer=this.emptyStateRenderer),void 0!==this.tableEmptyStateRenderer&&(e.tableEmptyStateRenderer=this.tableEmptyStateRenderer),void 0!==this.headerDropdown&&(e.headerDropdown=this.headerDropdown),void 0!==this.columnEditorConfig&&(e.columnEditorConfig=this.columnEditorConfig),void 0!==this.onCellClick&&(e.onCellClick=this.onCellClick),void 0!==this.onCellEdit&&(e.onCellEdit=this.onCellEdit),void 0!==this.onSortChange&&(e.onSortChange=this.onSortChange),void 0!==this.onFilterChange&&(e.onFilterChange=this.onFilterChange),void 0!==this.onRowSelectionChange&&(e.onRowSelectionChange=this.onRowSelectionChange),void 0!==this.onRowGroupExpand&&(e.onRowGroupExpand=this.onRowGroupExpand),void 0!==this.onColumnOrderChange&&(e.onColumnOrderChange=this.onColumnOrderChange),void 0!==this.onColumnVisibilityChange&&(e.onColumnVisibilityChange=this.onColumnVisibilityChange),void 0!==this.onColumnWidthChange&&(e.onColumnWidthChange=this.onColumnWidthChange),void 0!==this.onPageChange&&(e.onPageChange=this.onPageChange),void 0!==this.onLoadMore&&(e.onLoadMore=this.onLoadMore),void 0!==this.onGridReady&&(e.onGridReady=this.onGridReady),void 0!==this.onTableReady&&(e.onTableReady=this.onTableReady),void 0!==this.rowGrouping&&(e.rowGrouping=this.rowGrouping),void 0!==this.pivot&&(e.pivot=this.pivot),void 0!==this.onPivotChange&&(e.onPivotChange=this.onPivotChange),void 0!==this.enableRowSelection&&(e.enableRowSelection=this.enableRowSelection),void 0!==this.theme&&(e.theme=this.theme),void 0!==this.quickFilter&&(e.quickFilter=this.quickFilter),void 0!==this.isLoading&&(e.isLoading=this.isLoading),void 0!==this.getRowId&&(e.getRowId=this.getRowId),void 0!==this.shouldPaginate&&(e.shouldPaginate=this.shouldPaginate),void 0!==this.enablePagination&&(e.enablePagination=this.enablePagination),void 0!==this.rowsPerPage&&(e.rowsPerPage=this.rowsPerPage),void 0!==this.serverSidePagination&&(e.serverSidePagination=this.serverSidePagination),void 0!==this.totalRowCount&&(e.totalRowCount=this.totalRowCount),void 0!==this.height&&(e.height=this.height),void 0!==this.maxHeight&&(e.maxHeight=this.maxHeight),void 0!==this.scrollParent&&(e.scrollParent=this.scrollParent),void 0!==this.infiniteScrollThreshold&&(e.infiniteScrollThreshold=this.infiniteScrollThreshold),void 0!==this.columnResizing&&(e.columnResizing=this.columnResizing),void 0!==this.columnReordering&&(e.columnReordering=this.columnReordering),void 0!==this.editColumns&&(e.editColumns=this.editColumns),void 0!==this.enableColumnEditor&&(e.enableColumnEditor=this.enableColumnEditor),void 0!==this.editColumnsInitOpen&&(e.editColumnsInitOpen=this.editColumnsInitOpen),void 0!==this.enableColumnEditorInitOpen&&(e.enableColumnEditorInitOpen=this.enableColumnEditorInitOpen),void 0!==this.selectableCells&&(e.selectableCells=this.selectableCells),void 0!==this.selectableColumns&&(e.selectableColumns=this.selectableColumns),void 0!==this.enableHeaderEditing&&(e.enableHeaderEditing=this.enableHeaderEditing),void 0!==this.onHeaderEdit&&(e.onHeaderEdit=this.onHeaderEdit),void 0!==this.customTheme&&(e.customTheme=this.customTheme),void 0!==this.icons&&(e.icons=this.icons),void 0!==this.externalFilterHandling&&(e.externalFilterHandling=this.externalFilterHandling),void 0!==this.externalSortHandling&&(e.externalSortHandling=this.externalSortHandling),void 0!==this.columnBorders&&(e.columnBorders=this.columnBorders),void 0!==this.rowButtons&&(e.rowButtons=this.rowButtons),void 0!==this.hideFooter&&(e.hideFooter=this.hideFooter),void 0!==this.footerPosition&&(e.footerPosition=this.footerPosition),void 0!==this.initialSortColumn&&(e.initialSortColumn=this.initialSortColumn),void 0!==this.initialSortDirection&&(e.initialSortDirection=this.initialSortDirection),void 0!==this.expandAll&&(e.expandAll=this.expandAll),void 0!==this.autoExpandColumns&&(e.autoExpandColumns=this.autoExpandColumns),void 0!==this.animations&&(e.animations=this.animations),void 0!==this.enableVirtualization&&(e.enableVirtualization=this.enableVirtualization),void 0!==this.hoverRowBackground&&(e.hoverRowBackground=this.hoverRowBackground),void 0!==this.useHoverRowBackground&&(e.useHoverRowBackground=this.useHoverRowBackground),void 0!==this.oddColumnBackground&&(e.oddColumnBackground=this.oddColumnBackground),void 0!==this.useOddColumnBackground&&(e.useOddColumnBackground=this.useOddColumnBackground),void 0!==this.oddEvenRowBackground&&(e.oddEvenRowBackground=this.oddEvenRowBackground),void 0!==this.useOddEvenRowBackground&&(e.useOddEvenRowBackground=this.useOddEvenRowBackground),e}},t([e.Input({required:!0})],exports.SimpleTableComponent.prototype,"rows",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"defaultHeaders",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"columns",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"footerRenderer",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"loadingStateRenderer",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"errorStateRenderer",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"emptyStateRenderer",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"tableEmptyStateRenderer",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"headerDropdown",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"columnEditorConfig",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onCellClick",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onCellEdit",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onSortChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onFilterChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onRowSelectionChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onRowGroupExpand",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onColumnOrderChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onColumnVisibilityChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onColumnWidthChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onPageChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onLoadMore",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onGridReady",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onTableReady",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"rowGrouping",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"pivot",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onPivotChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"enableRowSelection",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"theme",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"quickFilter",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"isLoading",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"getRowId",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"shouldPaginate",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"enablePagination",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"rowsPerPage",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"serverSidePagination",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"totalRowCount",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"height",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"maxHeight",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"scrollParent",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"infiniteScrollThreshold",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"columnResizing",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"columnReordering",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"editColumns",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"enableColumnEditor",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"editColumnsInitOpen",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"enableColumnEditorInitOpen",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"selectableCells",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"selectableColumns",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"enableHeaderEditing",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onHeaderEdit",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"customTheme",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"icons",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"externalFilterHandling",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"externalSortHandling",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"columnBorders",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"rowButtons",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"hideFooter",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"footerPosition",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"initialSortColumn",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"initialSortDirection",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"expandAll",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"autoExpandColumns",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"animations",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"enableVirtualization",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"hoverRowBackground",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"useHoverRowBackground",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"oddColumnBackground",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"useOddColumnBackground",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"oddEvenRowBackground",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"useOddEvenRowBackground",void 0),t([e.Output()],exports.SimpleTableComponent.prototype,"tableReady",void 0),exports.SimpleTableComponent=t([e.Component({selector:"simple-table",standalone:!0,template:"<div #host></div>",styles:[":host { display: block; }"]})],exports.SimpleTableComponent),Object.defineProperty(exports,"PIVOT_ACCESSOR_PREFIX",{enumerable:!0,get:function(){return o.PIVOT_ACCESSOR_PREFIX}}),Object.defineProperty(exports,"PIVOT_BLANK_LABEL",{enumerable:!0,get:function(){return o.PIVOT_BLANK_LABEL}}),Object.defineProperty(exports,"PIVOT_CHILDREN_KEY",{enumerable:!0,get:function(){return o.PIVOT_CHILDREN_KEY}}),Object.defineProperty(exports,"PIVOT_IS_TOTAL_KEY",{enumerable:!0,get:function(){return o.PIVOT_IS_TOTAL_KEY}}),Object.defineProperty(exports,"asRows",{enumerable:!0,get:function(){return o.asRows}}),Object.defineProperty(exports,"buildPivotAccessor",{enumerable:!0,get:function(){return o.buildPivotAccessor}}),Object.defineProperty(exports,"buildPivotRowTotalAccessor",{enumerable:!0,get:function(){return o.buildPivotRowTotalAccessor}}),Object.defineProperty(exports,"pivotRows",{enumerable:!0,get:function(){return o.pivotRows}}),exports.provideSimpleTable=function(){return e.makeEnvironmentProviders([])},exports.wrapAngularRenderer=n;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.es.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createComponent as e,Input as t,Output as o,Component as i,EventEmitter as n,inject as r,ElementRef as s,ApplicationRef as d,EnvironmentInjector as a,makeEnvironmentProviders as l}from"@angular/core";import{collectHeaderAccessors as h,SimpleTableVanilla as p,headersStructurallyEqual as c,rowsShallowUnchanged as u}from"simple-table-core";export{PIVOT_ACCESSOR_PREFIX,PIVOT_BLANK_LABEL,PIVOT_CHILDREN_KEY,PIVOT_IS_TOTAL_KEY,asRows,buildPivotAccessor,buildPivotRowTotalAccessor,pivotRows}from"simple-table-core";function v(e,t,o,i){var n,r=arguments.length,s=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,i);else for(var d=e.length-1;d>=0;d--)(n=e[d])&&(s=(r<3?n(s):r>3?n(t,o,s):n(t,o))||s);return r>3&&s&&Object.defineProperty(t,o,s),s}function g(t,o,i,n){return r=>{const s=document.createElement("div"),d=e(t,{environmentInjector:i,hostElement:s});return Object.assign(d.instance,r),o.attachView(d.hostView),d.changeDetectorRef.detectChanges(),n?.register(s,()=>{o.detachView(d.hostView),d.destroy()}),s}}function m(t,o,i,n,r,s){const d="cell"===s?n.cellRendererCache:n.headerRendererCache,a=d.get(r);if(a)return a.component=t,a.wrapped;const l={component:t,wrapped:null},h=t=>{const r=document.createElement("div"),s=e(l.component,{environmentInjector:i,hostElement:r});return Object.assign(s.instance,t),o.attachView(s.hostView),s.changeDetectorRef.detectChanges(),n.register(r,()=>{o.detachView(s.hostView),s.destroy()}),r};return l.wrapped=h,d.set(r,l),h}function C(e,t,o,i){const{defaultHeaders:n,rows:r,footerRenderer:s,emptyStateRenderer:d,errorStateRenderer:a,loadingStateRenderer:l,tableEmptyStateRenderer:p,headerDropdown:c,columnEditorConfig:u,icons:v,rowButtons:y,onColumnOrderChange:R,onColumnWidthChange:f,onHeaderEdit:w,onColumnSelect:S,...E}=e,b=e=>g(e,o,i,t);t.pruneRendererCaches(h(n));const P={...E,rows:r,defaultHeaders:n.map(function e(n){const{cellRenderer:r,headerRenderer:s,children:d,nestedTable:a,...l}=n,h=String(n.accessor),p={...l};if(r&&(p.cellRenderer=r.ɵcmp?m(r,o,i,t,h,"cell"):r),s&&(p.headerRenderer=s.ɵcmp?m(s,o,i,t,h,"header"):s),d&&(p.children=d.map(e)),a){const e={...a,rows:[]};p.nestedTable=C(e,t,o,i)}return p}),onRendererHostDiscard:t.disposeHost,...R?{onColumnOrderChange:e=>R(e)}:{},...f?{onColumnWidthChange:e=>f(e)}:{},...w?{onHeaderEdit:(e,t)=>w(e,t)}:{},...S?{onColumnSelect:e=>S(e)}:{}};return void 0!==s&&(P.footerRenderer=s.ɵcmp?b(s):s),void 0!==d&&(P.emptyStateRenderer=d.ɵcmp?b(d):d),void 0!==a&&(P.errorStateRenderer=a.ɵcmp?b(a):a),void 0!==l&&(P.loadingStateRenderer=l.ɵcmp?b(l):l),void 0!==p&&(P.tableEmptyStateRenderer=p),void 0!==c&&(P.headerDropdown=b(c)),void 0!==u&&(P.columnEditorConfig=function(e){const{rowRenderer:t,customRenderer:o,...i}=e;return{...i,...t?{rowRenderer:b(t)}:{},...o?{customRenderer:b(o)}:{}}}(u)),void 0!==v&&(P.icons=function(e){const t={};for(const[o,i]of Object.entries(e))null!=i&&(t[o]="string"==typeof i||i instanceof HTMLElement||i instanceof SVGSVGElement?i:i.ɵcmp?b(i)({}):i);return t}(v)),void 0!==y&&(P.rowButtons=y.map(e=>b(e))),P}"function"==typeof SuppressedError&&SuppressedError;const y="data-st-mount-id";class R{constructor(){this.entries=new Map,this.nextId=0,this.cellRendererCache=new Map,this.headerRendererCache=new Map,this.disposeHost=e=>{if("function"!=typeof e.getAttribute)return;const t=[],o=e.getAttribute(y);null!==o&&t.push(o),e.querySelectorAll(`[${y}]`).forEach(e=>{const o=e.getAttribute(y);null!==o&&t.push(o)});for(const e of t){const t=this.entries.get(e);t&&(this.entries.delete(e),t())}}}register(e,t){const o="st-mount-"+this.nextId++;e.setAttribute(y,o),this.entries.set(o,t)}clear(){this.cellRendererCache.clear(),this.headerRendererCache.clear();for(const e of this.entries.values())e();this.entries.clear()}pruneRendererCaches(e){for(const t of this.cellRendererCache.keys())e.has(t)||this.cellRendererCache.delete(t);for(const t of this.headerRendererCache.keys())e.has(t)||this.headerRendererCache.delete(t)}get size(){return this.entries.size}}let f=class{constructor(){this.tableReady=new n,this.instance=null,this.registry=new R,this.hostEl=r(s),this.appRef=r(d),this.envInjector=r(a)}ngOnInit(){const e=this.hostEl.nativeElement.querySelector("div");if(!e)return;const t=this.getProps();this.instance=new p(e,C(t,this.registry,this.appRef,this.envInjector)),this.instance.mount(),this.syncedDefaultHeaders=t.defaultHeaders,this.syncedRows=t.rows,this.tableReady.emit(this.instance.getAPI())}ngOnChanges(){if(!this.instance)return;const e=this.getProps(),t={...C(e,this.registry,this.appRef,this.envInjector)},o=c(this.syncedDefaultHeaders,e.defaultHeaders);this.syncedDefaultHeaders=e.defaultHeaders,o&&delete t.defaultHeaders;const i=u(this.syncedRows,e.rows,e.getRowId);this.syncedRows=e.rows,i&&delete t.rows,this.instance.update(t)}ngOnDestroy(){this.instance?.destroy(),this.instance=null,this.syncedDefaultHeaders=void 0,this.syncedRows=void 0,this.registry.clear()}getAPI(){return this.instance?.getAPI()??null}getProps(){const e={rows:this.rows,defaultHeaders:this.defaultHeaders};return void 0!==this.footerRenderer&&(e.footerRenderer=this.footerRenderer),void 0!==this.loadingStateRenderer&&(e.loadingStateRenderer=this.loadingStateRenderer),void 0!==this.errorStateRenderer&&(e.errorStateRenderer=this.errorStateRenderer),void 0!==this.emptyStateRenderer&&(e.emptyStateRenderer=this.emptyStateRenderer),void 0!==this.tableEmptyStateRenderer&&(e.tableEmptyStateRenderer=this.tableEmptyStateRenderer),void 0!==this.headerDropdown&&(e.headerDropdown=this.headerDropdown),void 0!==this.columnEditorConfig&&(e.columnEditorConfig=this.columnEditorConfig),void 0!==this.onCellClick&&(e.onCellClick=this.onCellClick),void 0!==this.onCellEdit&&(e.onCellEdit=this.onCellEdit),void 0!==this.onSortChange&&(e.onSortChange=this.onSortChange),void 0!==this.onFilterChange&&(e.onFilterChange=this.onFilterChange),void 0!==this.onRowSelectionChange&&(e.onRowSelectionChange=this.onRowSelectionChange),void 0!==this.onRowGroupExpand&&(e.onRowGroupExpand=this.onRowGroupExpand),void 0!==this.onColumnOrderChange&&(e.onColumnOrderChange=this.onColumnOrderChange),void 0!==this.onColumnVisibilityChange&&(e.onColumnVisibilityChange=this.onColumnVisibilityChange),void 0!==this.onColumnWidthChange&&(e.onColumnWidthChange=this.onColumnWidthChange),void 0!==this.onPageChange&&(e.onPageChange=this.onPageChange),void 0!==this.onLoadMore&&(e.onLoadMore=this.onLoadMore),void 0!==this.onGridReady&&(e.onGridReady=this.onGridReady),void 0!==this.rowGrouping&&(e.rowGrouping=this.rowGrouping),void 0!==this.pivot&&(e.pivot=this.pivot),void 0!==this.onPivotChange&&(e.onPivotChange=this.onPivotChange),void 0!==this.enableRowSelection&&(e.enableRowSelection=this.enableRowSelection),void 0!==this.theme&&(e.theme=this.theme),void 0!==this.quickFilter&&(e.quickFilter=this.quickFilter),void 0!==this.isLoading&&(e.isLoading=this.isLoading),void 0!==this.getRowId&&(e.getRowId=this.getRowId),void 0!==this.shouldPaginate&&(e.shouldPaginate=this.shouldPaginate),void 0!==this.rowsPerPage&&(e.rowsPerPage=this.rowsPerPage),void 0!==this.serverSidePagination&&(e.serverSidePagination=this.serverSidePagination),void 0!==this.totalRowCount&&(e.totalRowCount=this.totalRowCount),void 0!==this.height&&(e.height=this.height),void 0!==this.maxHeight&&(e.maxHeight=this.maxHeight),void 0!==this.scrollParent&&(e.scrollParent=this.scrollParent),void 0!==this.infiniteScrollThreshold&&(e.infiniteScrollThreshold=this.infiniteScrollThreshold),void 0!==this.columnResizing&&(e.columnResizing=this.columnResizing),void 0!==this.columnReordering&&(e.columnReordering=this.columnReordering),void 0!==this.editColumns&&(e.editColumns=this.editColumns),void 0!==this.editColumnsInitOpen&&(e.editColumnsInitOpen=this.editColumnsInitOpen),void 0!==this.selectableCells&&(e.selectableCells=this.selectableCells),void 0!==this.selectableColumns&&(e.selectableColumns=this.selectableColumns),void 0!==this.enableHeaderEditing&&(e.enableHeaderEditing=this.enableHeaderEditing),void 0!==this.onHeaderEdit&&(e.onHeaderEdit=this.onHeaderEdit),void 0!==this.customTheme&&(e.customTheme=this.customTheme),void 0!==this.icons&&(e.icons=this.icons),void 0!==this.externalFilterHandling&&(e.externalFilterHandling=this.externalFilterHandling),void 0!==this.externalSortHandling&&(e.externalSortHandling=this.externalSortHandling),void 0!==this.columnBorders&&(e.columnBorders=this.columnBorders),void 0!==this.rowButtons&&(e.rowButtons=this.rowButtons),void 0!==this.hideFooter&&(e.hideFooter=this.hideFooter),void 0!==this.footerPosition&&(e.footerPosition=this.footerPosition),void 0!==this.initialSortColumn&&(e.initialSortColumn=this.initialSortColumn),void 0!==this.initialSortDirection&&(e.initialSortDirection=this.initialSortDirection),void 0!==this.expandAll&&(e.expandAll=this.expandAll),void 0!==this.autoExpandColumns&&(e.autoExpandColumns=this.autoExpandColumns),void 0!==this.animations&&(e.animations=this.animations),void 0!==this.enableVirtualization&&(e.enableVirtualization=this.enableVirtualization),e}};function w(){return l([])}v([t({required:!0})],f.prototype,"rows",void 0),v([t({required:!0})],f.prototype,"defaultHeaders",void 0),v([t()],f.prototype,"footerRenderer",void 0),v([t()],f.prototype,"loadingStateRenderer",void 0),v([t()],f.prototype,"errorStateRenderer",void 0),v([t()],f.prototype,"emptyStateRenderer",void 0),v([t()],f.prototype,"tableEmptyStateRenderer",void 0),v([t()],f.prototype,"headerDropdown",void 0),v([t()],f.prototype,"columnEditorConfig",void 0),v([t()],f.prototype,"onCellClick",void 0),v([t()],f.prototype,"onCellEdit",void 0),v([t()],f.prototype,"onSortChange",void 0),v([t()],f.prototype,"onFilterChange",void 0),v([t()],f.prototype,"onRowSelectionChange",void 0),v([t()],f.prototype,"onRowGroupExpand",void 0),v([t()],f.prototype,"onColumnOrderChange",void 0),v([t()],f.prototype,"onColumnVisibilityChange",void 0),v([t()],f.prototype,"onColumnWidthChange",void 0),v([t()],f.prototype,"onPageChange",void 0),v([t()],f.prototype,"onLoadMore",void 0),v([t()],f.prototype,"onGridReady",void 0),v([t()],f.prototype,"rowGrouping",void 0),v([t()],f.prototype,"pivot",void 0),v([t()],f.prototype,"onPivotChange",void 0),v([t()],f.prototype,"enableRowSelection",void 0),v([t()],f.prototype,"theme",void 0),v([t()],f.prototype,"quickFilter",void 0),v([t()],f.prototype,"isLoading",void 0),v([t()],f.prototype,"getRowId",void 0),v([t()],f.prototype,"shouldPaginate",void 0),v([t()],f.prototype,"rowsPerPage",void 0),v([t()],f.prototype,"serverSidePagination",void 0),v([t()],f.prototype,"totalRowCount",void 0),v([t()],f.prototype,"height",void 0),v([t()],f.prototype,"maxHeight",void 0),v([t()],f.prototype,"scrollParent",void 0),v([t()],f.prototype,"infiniteScrollThreshold",void 0),v([t()],f.prototype,"columnResizing",void 0),v([t()],f.prototype,"columnReordering",void 0),v([t()],f.prototype,"editColumns",void 0),v([t()],f.prototype,"editColumnsInitOpen",void 0),v([t()],f.prototype,"selectableCells",void 0),v([t()],f.prototype,"selectableColumns",void 0),v([t()],f.prototype,"enableHeaderEditing",void 0),v([t()],f.prototype,"onHeaderEdit",void 0),v([t()],f.prototype,"customTheme",void 0),v([t()],f.prototype,"icons",void 0),v([t()],f.prototype,"externalFilterHandling",void 0),v([t()],f.prototype,"externalSortHandling",void 0),v([t()],f.prototype,"columnBorders",void 0),v([t()],f.prototype,"rowButtons",void 0),v([t()],f.prototype,"hideFooter",void 0),v([t()],f.prototype,"footerPosition",void 0),v([t()],f.prototype,"initialSortColumn",void 0),v([t()],f.prototype,"initialSortDirection",void 0),v([t()],f.prototype,"expandAll",void 0),v([t()],f.prototype,"autoExpandColumns",void 0),v([t()],f.prototype,"animations",void 0),v([t()],f.prototype,"enableVirtualization",void 0),v([o()],f.prototype,"tableReady",void 0),f=v([i({selector:"simple-table",standalone:!0,template:"<div #host></div>",styles:[":host { display: block; }"]})],f);export{f as SimpleTableComponent,w as provideSimpleTable,g as wrapAngularRenderer};
|
|
1
|
+
import{createComponent as e,Input as o,Output as t,Component as i,EventEmitter as n,inject as r,ElementRef as d,ApplicationRef as s,EnvironmentInjector as a,makeEnvironmentProviders as l}from"@angular/core";import{collectHeaderAccessors as h,SimpleTableVanilla as u,headersStructurallyEqual as c,rowsShallowUnchanged as p}from"simple-table-core";export{PIVOT_ACCESSOR_PREFIX,PIVOT_BLANK_LABEL,PIVOT_CHILDREN_KEY,PIVOT_IS_TOTAL_KEY,asRows,buildPivotAccessor,buildPivotRowTotalAccessor,pivotRows}from"simple-table-core";function v(e,o,t,i){var n,r=arguments.length,d=r<3?o:null===i?i=Object.getOwnPropertyDescriptor(o,t):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)d=Reflect.decorate(e,o,t,i);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(d=(r<3?n(d):r>3?n(o,t,d):n(o,t))||d);return r>3&&d&&Object.defineProperty(o,t,d),d}function g(o,t,i,n){return r=>{const d=document.createElement("div"),s=e(o,{environmentInjector:i,hostElement:d});return Object.assign(s.instance,r),t.attachView(s.hostView),s.changeDetectorRef.detectChanges(),n?.register(d,()=>{t.detachView(s.hostView),s.destroy()}),d}}function m(o,t,i,n,r,d){const s="cell"===d?n.cellRendererCache:n.headerRendererCache,a=s.get(r);if(a)return a.component=o,a.wrapped;const l={component:o,wrapped:null},h=o=>{const r=document.createElement("div"),d=e(l.component,{environmentInjector:i,hostElement:r});return Object.assign(d.instance,o),t.attachView(d.hostView),d.changeDetectorRef.detectChanges(),n.register(r,()=>{t.detachView(d.hostView),d.destroy()}),r};return l.wrapped=h,s.set(r,l),h}function C(e){const o=e.columns??e.defaultHeaders;if(!o)throw new Error("SimpleTable requires `columns` or `defaultHeaders`");return o}function R(e,o,t,i){const{defaultHeaders:n,columns:r,rows:d,footerRenderer:s,emptyStateRenderer:a,errorStateRenderer:l,loadingStateRenderer:u,tableEmptyStateRenderer:c,headerDropdown:p,columnEditorConfig:v,icons:y,rowButtons:w,onColumnOrderChange:f,onColumnWidthChange:E,onHeaderEdit:b,onColumnSelect:S,enableColumnEditor:P,editColumns:H,enableColumnEditorInitOpen:B,editColumnsInitOpen:k,enablePagination:O,shouldPaginate:I,onTableReady:x,onGridReady:T,hoverRowBackground:V,useHoverRowBackground:D,oddColumnBackground:A,useOddColumnBackground:F,oddEvenRowBackground:G,useOddEvenRowBackground:L,...j}=e,z=e=>g(e,t,i,o),_=C(e);o.pruneRendererCaches(h(_));const q={...j,rows:d,defaultHeaders:_.map(function e(n){const{cellRenderer:r,headerRenderer:d,children:s,nestedTable:a,...l}=n,h=String(n.accessor),u={...l};if(r&&(u.cellRenderer=r.ɵcmp?m(r,t,i,o,h,"cell"):r),d&&(u.headerRenderer=d.ɵcmp?m(d,t,i,o,h,"header"):d),s&&(u.children=s.map(e)),a){const e={...a,rows:[]};u.nestedTable=R(e,o,t,i)}return u}),editColumns:P??H,editColumnsInitOpen:B??k,shouldPaginate:O??I,onGridReady:x??T,useHoverRowBackground:V??D,useOddColumnBackground:A??F,useOddEvenRowBackground:G??L,onRendererHostDiscard:o.disposeHost,...f?{onColumnOrderChange:e=>f(e)}:{},...E?{onColumnWidthChange:e=>E(e)}:{},...b?{onHeaderEdit:(e,o)=>b(e,o)}:{},...S?{onColumnSelect:e=>S(e)}:{}};return void 0!==s&&(q.footerRenderer=s.ɵcmp?z(s):s),void 0!==a&&(q.emptyStateRenderer=a.ɵcmp?z(a):a),void 0!==l&&(q.errorStateRenderer=l.ɵcmp?z(l):l),void 0!==u&&(q.loadingStateRenderer=u.ɵcmp?z(u):u),void 0!==c&&(q.tableEmptyStateRenderer=c),void 0!==p&&(q.headerDropdown=z(p)),void 0!==v&&(q.columnEditorConfig=function(e){const{rowRenderer:o,customRenderer:t,...i}=e;return{...i,...o?{rowRenderer:z(o)}:{},...t?{customRenderer:z(t)}:{}}}(v)),void 0!==y&&(q.icons=function(e){const o={};for(const[t,i]of Object.entries(e))null!=i&&(o[t]="string"==typeof i||i instanceof HTMLElement||i instanceof SVGSVGElement?i:i.ɵcmp?z(i)({}):i);return o}(y)),void 0!==w&&(q.rowButtons=w.map(e=>z(e))),q}"function"==typeof SuppressedError&&SuppressedError;const y="data-st-mount-id";class w{constructor(){this.entries=new Map,this.nextId=0,this.cellRendererCache=new Map,this.headerRendererCache=new Map,this.disposeHost=e=>{if("function"!=typeof e.getAttribute)return;const o=[],t=e.getAttribute(y);null!==t&&o.push(t),e.querySelectorAll(`[${y}]`).forEach(e=>{const t=e.getAttribute(y);null!==t&&o.push(t)});for(const e of o){const o=this.entries.get(e);o&&(this.entries.delete(e),o())}}}register(e,o){const t="st-mount-"+this.nextId++;e.setAttribute(y,t),this.entries.set(t,o)}clear(){this.cellRendererCache.clear(),this.headerRendererCache.clear();for(const e of this.entries.values())e();this.entries.clear()}pruneRendererCaches(e){for(const o of this.cellRendererCache.keys())e.has(o)||this.cellRendererCache.delete(o);for(const o of this.headerRendererCache.keys())e.has(o)||this.headerRendererCache.delete(o)}get size(){return this.entries.size}}let f=class{constructor(){this.tableReady=new n,this.instance=null,this.registry=new w,this.hostEl=r(d),this.appRef=r(s),this.envInjector=r(a)}ngOnInit(){const e=this.hostEl.nativeElement.querySelector("div");if(!e)return;const o=this.getProps();this.instance=new u(e,R(o,this.registry,this.appRef,this.envInjector)),this.instance.mount(),this.syncedDefaultHeaders=C(o),this.syncedRows=o.rows,this.tableReady.emit(this.instance.getAPI())}ngOnChanges(){if(!this.instance)return;const e=this.getProps(),o={...R(e,this.registry,this.appRef,this.envInjector)},t=C(e),i=c(this.syncedDefaultHeaders,t);this.syncedDefaultHeaders=t,i&&delete o.defaultHeaders;const n=p(this.syncedRows,e.rows,e.getRowId);this.syncedRows=e.rows,n&&delete o.rows,this.instance.update(o)}ngOnDestroy(){this.instance?.destroy(),this.instance=null,this.syncedDefaultHeaders=void 0,this.syncedRows=void 0,this.registry.clear()}getAPI(){return this.instance?.getAPI()??null}getProps(){const e={rows:this.rows};return void 0!==this.defaultHeaders&&(e.defaultHeaders=this.defaultHeaders),void 0!==this.columns&&(e.columns=this.columns),void 0!==this.footerRenderer&&(e.footerRenderer=this.footerRenderer),void 0!==this.loadingStateRenderer&&(e.loadingStateRenderer=this.loadingStateRenderer),void 0!==this.errorStateRenderer&&(e.errorStateRenderer=this.errorStateRenderer),void 0!==this.emptyStateRenderer&&(e.emptyStateRenderer=this.emptyStateRenderer),void 0!==this.tableEmptyStateRenderer&&(e.tableEmptyStateRenderer=this.tableEmptyStateRenderer),void 0!==this.headerDropdown&&(e.headerDropdown=this.headerDropdown),void 0!==this.columnEditorConfig&&(e.columnEditorConfig=this.columnEditorConfig),void 0!==this.onCellClick&&(e.onCellClick=this.onCellClick),void 0!==this.onCellEdit&&(e.onCellEdit=this.onCellEdit),void 0!==this.onSortChange&&(e.onSortChange=this.onSortChange),void 0!==this.onFilterChange&&(e.onFilterChange=this.onFilterChange),void 0!==this.onRowSelectionChange&&(e.onRowSelectionChange=this.onRowSelectionChange),void 0!==this.onRowGroupExpand&&(e.onRowGroupExpand=this.onRowGroupExpand),void 0!==this.onColumnOrderChange&&(e.onColumnOrderChange=this.onColumnOrderChange),void 0!==this.onColumnVisibilityChange&&(e.onColumnVisibilityChange=this.onColumnVisibilityChange),void 0!==this.onColumnWidthChange&&(e.onColumnWidthChange=this.onColumnWidthChange),void 0!==this.onPageChange&&(e.onPageChange=this.onPageChange),void 0!==this.onLoadMore&&(e.onLoadMore=this.onLoadMore),void 0!==this.onGridReady&&(e.onGridReady=this.onGridReady),void 0!==this.onTableReady&&(e.onTableReady=this.onTableReady),void 0!==this.rowGrouping&&(e.rowGrouping=this.rowGrouping),void 0!==this.pivot&&(e.pivot=this.pivot),void 0!==this.onPivotChange&&(e.onPivotChange=this.onPivotChange),void 0!==this.enableRowSelection&&(e.enableRowSelection=this.enableRowSelection),void 0!==this.theme&&(e.theme=this.theme),void 0!==this.quickFilter&&(e.quickFilter=this.quickFilter),void 0!==this.isLoading&&(e.isLoading=this.isLoading),void 0!==this.getRowId&&(e.getRowId=this.getRowId),void 0!==this.shouldPaginate&&(e.shouldPaginate=this.shouldPaginate),void 0!==this.enablePagination&&(e.enablePagination=this.enablePagination),void 0!==this.rowsPerPage&&(e.rowsPerPage=this.rowsPerPage),void 0!==this.serverSidePagination&&(e.serverSidePagination=this.serverSidePagination),void 0!==this.totalRowCount&&(e.totalRowCount=this.totalRowCount),void 0!==this.height&&(e.height=this.height),void 0!==this.maxHeight&&(e.maxHeight=this.maxHeight),void 0!==this.scrollParent&&(e.scrollParent=this.scrollParent),void 0!==this.infiniteScrollThreshold&&(e.infiniteScrollThreshold=this.infiniteScrollThreshold),void 0!==this.columnResizing&&(e.columnResizing=this.columnResizing),void 0!==this.columnReordering&&(e.columnReordering=this.columnReordering),void 0!==this.editColumns&&(e.editColumns=this.editColumns),void 0!==this.enableColumnEditor&&(e.enableColumnEditor=this.enableColumnEditor),void 0!==this.editColumnsInitOpen&&(e.editColumnsInitOpen=this.editColumnsInitOpen),void 0!==this.enableColumnEditorInitOpen&&(e.enableColumnEditorInitOpen=this.enableColumnEditorInitOpen),void 0!==this.selectableCells&&(e.selectableCells=this.selectableCells),void 0!==this.selectableColumns&&(e.selectableColumns=this.selectableColumns),void 0!==this.enableHeaderEditing&&(e.enableHeaderEditing=this.enableHeaderEditing),void 0!==this.onHeaderEdit&&(e.onHeaderEdit=this.onHeaderEdit),void 0!==this.customTheme&&(e.customTheme=this.customTheme),void 0!==this.icons&&(e.icons=this.icons),void 0!==this.externalFilterHandling&&(e.externalFilterHandling=this.externalFilterHandling),void 0!==this.externalSortHandling&&(e.externalSortHandling=this.externalSortHandling),void 0!==this.columnBorders&&(e.columnBorders=this.columnBorders),void 0!==this.rowButtons&&(e.rowButtons=this.rowButtons),void 0!==this.hideFooter&&(e.hideFooter=this.hideFooter),void 0!==this.footerPosition&&(e.footerPosition=this.footerPosition),void 0!==this.initialSortColumn&&(e.initialSortColumn=this.initialSortColumn),void 0!==this.initialSortDirection&&(e.initialSortDirection=this.initialSortDirection),void 0!==this.expandAll&&(e.expandAll=this.expandAll),void 0!==this.autoExpandColumns&&(e.autoExpandColumns=this.autoExpandColumns),void 0!==this.animations&&(e.animations=this.animations),void 0!==this.enableVirtualization&&(e.enableVirtualization=this.enableVirtualization),void 0!==this.hoverRowBackground&&(e.hoverRowBackground=this.hoverRowBackground),void 0!==this.useHoverRowBackground&&(e.useHoverRowBackground=this.useHoverRowBackground),void 0!==this.oddColumnBackground&&(e.oddColumnBackground=this.oddColumnBackground),void 0!==this.useOddColumnBackground&&(e.useOddColumnBackground=this.useOddColumnBackground),void 0!==this.oddEvenRowBackground&&(e.oddEvenRowBackground=this.oddEvenRowBackground),void 0!==this.useOddEvenRowBackground&&(e.useOddEvenRowBackground=this.useOddEvenRowBackground),e}};function E(){return l([])}v([o({required:!0})],f.prototype,"rows",void 0),v([o()],f.prototype,"defaultHeaders",void 0),v([o()],f.prototype,"columns",void 0),v([o()],f.prototype,"footerRenderer",void 0),v([o()],f.prototype,"loadingStateRenderer",void 0),v([o()],f.prototype,"errorStateRenderer",void 0),v([o()],f.prototype,"emptyStateRenderer",void 0),v([o()],f.prototype,"tableEmptyStateRenderer",void 0),v([o()],f.prototype,"headerDropdown",void 0),v([o()],f.prototype,"columnEditorConfig",void 0),v([o()],f.prototype,"onCellClick",void 0),v([o()],f.prototype,"onCellEdit",void 0),v([o()],f.prototype,"onSortChange",void 0),v([o()],f.prototype,"onFilterChange",void 0),v([o()],f.prototype,"onRowSelectionChange",void 0),v([o()],f.prototype,"onRowGroupExpand",void 0),v([o()],f.prototype,"onColumnOrderChange",void 0),v([o()],f.prototype,"onColumnVisibilityChange",void 0),v([o()],f.prototype,"onColumnWidthChange",void 0),v([o()],f.prototype,"onPageChange",void 0),v([o()],f.prototype,"onLoadMore",void 0),v([o()],f.prototype,"onGridReady",void 0),v([o()],f.prototype,"onTableReady",void 0),v([o()],f.prototype,"rowGrouping",void 0),v([o()],f.prototype,"pivot",void 0),v([o()],f.prototype,"onPivotChange",void 0),v([o()],f.prototype,"enableRowSelection",void 0),v([o()],f.prototype,"theme",void 0),v([o()],f.prototype,"quickFilter",void 0),v([o()],f.prototype,"isLoading",void 0),v([o()],f.prototype,"getRowId",void 0),v([o()],f.prototype,"shouldPaginate",void 0),v([o()],f.prototype,"enablePagination",void 0),v([o()],f.prototype,"rowsPerPage",void 0),v([o()],f.prototype,"serverSidePagination",void 0),v([o()],f.prototype,"totalRowCount",void 0),v([o()],f.prototype,"height",void 0),v([o()],f.prototype,"maxHeight",void 0),v([o()],f.prototype,"scrollParent",void 0),v([o()],f.prototype,"infiniteScrollThreshold",void 0),v([o()],f.prototype,"columnResizing",void 0),v([o()],f.prototype,"columnReordering",void 0),v([o()],f.prototype,"editColumns",void 0),v([o()],f.prototype,"enableColumnEditor",void 0),v([o()],f.prototype,"editColumnsInitOpen",void 0),v([o()],f.prototype,"enableColumnEditorInitOpen",void 0),v([o()],f.prototype,"selectableCells",void 0),v([o()],f.prototype,"selectableColumns",void 0),v([o()],f.prototype,"enableHeaderEditing",void 0),v([o()],f.prototype,"onHeaderEdit",void 0),v([o()],f.prototype,"customTheme",void 0),v([o()],f.prototype,"icons",void 0),v([o()],f.prototype,"externalFilterHandling",void 0),v([o()],f.prototype,"externalSortHandling",void 0),v([o()],f.prototype,"columnBorders",void 0),v([o()],f.prototype,"rowButtons",void 0),v([o()],f.prototype,"hideFooter",void 0),v([o()],f.prototype,"footerPosition",void 0),v([o()],f.prototype,"initialSortColumn",void 0),v([o()],f.prototype,"initialSortDirection",void 0),v([o()],f.prototype,"expandAll",void 0),v([o()],f.prototype,"autoExpandColumns",void 0),v([o()],f.prototype,"animations",void 0),v([o()],f.prototype,"enableVirtualization",void 0),v([o()],f.prototype,"hoverRowBackground",void 0),v([o()],f.prototype,"useHoverRowBackground",void 0),v([o()],f.prototype,"oddColumnBackground",void 0),v([o()],f.prototype,"useOddColumnBackground",void 0),v([o()],f.prototype,"oddEvenRowBackground",void 0),v([o()],f.prototype,"useOddEvenRowBackground",void 0),v([t()],f.prototype,"tableReady",void 0),f=v([i({selector:"simple-table",standalone:!0,template:"<div #host></div>",styles:[":host { display: block; }"]})],f);export{f as SimpleTableComponent,E as provideSimpleTable,g as wrapAngularRenderer};
|
|
2
2
|
//# sourceMappingURL=index.es.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ApplicationRef, EnvironmentInjector } from "@angular/core";
|
|
2
|
+
import type { SimpleTableConfig, HeaderObject } from "simple-table-core";
|
|
3
|
+
import type { SimpleTableAngularProps, AngularHeaderObject } from "./types";
|
|
4
|
+
import type { MountRegistry } from "./MountRegistry";
|
|
5
|
+
/** Resolve preferred `columns` or legacy `defaultHeaders`. */
|
|
6
|
+
export declare function resolveAngularColumns(config: Pick<SimpleTableAngularProps, "columns" | "defaultHeaders">): ReadonlyArray<HeaderObject | AngularHeaderObject>;
|
|
7
|
+
export declare function buildVanillaConfig(config: SimpleTableAngularProps, registry: MountRegistry, appRef: ApplicationRef, injector: EnvironmentInjector): SimpleTableConfig;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { SimpleTableComponent } from "./lib/SimpleTableComponent";
|
|
2
|
+
export { asRows } from "simple-table-core";
|
|
3
|
+
export { provideSimpleTable } from "./lib/provideSimpleTable";
|
|
4
|
+
/** Wrap a standalone component as an HTMLElement (e.g. for `tableEmptyStateRenderer`). */
|
|
5
|
+
export { wrapAngularRenderer } from "./utils/wrapAngularRenderer";
|
|
6
|
+
export type { SimpleTableAngularProps, TableInstance, AngularHeaderObject, AngularColumnDef, AngularIconsConfig, AngularIconSlot, AngularColumnEditorConfig, AngularCellRenderer, AngularHeaderRenderer, AngularFooterRenderer, AngularHeaderDropdown, AngularColumnEditorRowRenderer, AngularColumnEditorCustomRenderer, AngularLoadingStateRenderer, AngularErrorStateRenderer, AngularEmptyStateRenderer, AngularRowButton, } from "./types";
|
|
7
|
+
export type { Accessor, AggregationConfig, AggregationType, AnimationsConfig, AutoSizeMode, ColumnDef, Cell, CellChangeProps, CellClickProps, CellRenderer, CellRendererProps, CellValue, ChartOptions, ColumnEditorConfig, ColumnEditorRowRenderer, ColumnEditorRowRendererComponents, ColumnEditorCustomRenderer, ColumnEditorCustomRendererProps, ColumnEditorRowRendererProps, ColumnEditorSearchFunction, ColumnType, ColumnVisibilityState, Comparator, ComparatorProps, CustomTheme, CustomThemeProps, EmptyStateRenderer, EmptyStateRendererProps, EnumOption, ErrorStateRenderer, ErrorStateRendererProps, ExportToCSVProps, ExportValueGetter, ExportValueProps, FilterCondition, FilterOperator, StringFilterOperator, NumberFilterOperator, BooleanFilterOperator, DateFilterOperator, EnumFilterOperator, FooterRendererProps, FooterPosition, GetRowId, GetRowIdParams, HeaderDropdown, HeaderDropdownProps, HeaderObject, HeaderRenderer, HeaderRendererComponents, HeaderRendererProps, IconsConfig, LoadingStateRenderer, LoadingStateRendererProps, OnRowGroupExpandProps, Pinned, PinnedSectionsState, PivotConfig, PivotValueConfig, PivotResult, QuickFilterConfig, QuickFilterGetter, QuickFilterGetterProps, QuickFilterMode, Row, RowButtonProps, RowId, RowSelectionChangeProps, RowSelectionMode, RowState, SetHeaderRenameProps, ShowWhen, SimpleTableConfig, SimpleTableProps, SortColumn, TableAPI, TableFilterState, TableRow, Theme, UpdateDataProps, ValueFormatter, ValueFormatterProps, ValueGetter, ValueGetterProps, } from "simple-table-core";
|
|
8
|
+
export { pivotRows, buildPivotAccessor, buildPivotRowTotalAccessor, PIVOT_CHILDREN_KEY, PIVOT_IS_TOTAL_KEY, PIVOT_ACCESSOR_PREFIX, PIVOT_BLANK_LABEL, } from "simple-table-core";
|
|
@@ -15,7 +15,9 @@ import type { SimpleTableAngularProps } from "../types";
|
|
|
15
15
|
*/
|
|
16
16
|
export declare class SimpleTableComponent implements OnInit, OnChanges, OnDestroy {
|
|
17
17
|
rows: SimpleTableAngularProps["rows"];
|
|
18
|
-
|
|
18
|
+
/** @deprecated Prefer {@link columns} */
|
|
19
|
+
defaultHeaders?: SimpleTableAngularProps["defaultHeaders"];
|
|
20
|
+
columns?: SimpleTableAngularProps["columns"];
|
|
19
21
|
footerRenderer?: SimpleTableAngularProps["footerRenderer"];
|
|
20
22
|
loadingStateRenderer?: SimpleTableAngularProps["loadingStateRenderer"];
|
|
21
23
|
errorStateRenderer?: SimpleTableAngularProps["errorStateRenderer"];
|
|
@@ -35,6 +37,7 @@ export declare class SimpleTableComponent implements OnInit, OnChanges, OnDestro
|
|
|
35
37
|
onPageChange?: SimpleTableAngularProps["onPageChange"];
|
|
36
38
|
onLoadMore?: SimpleTableAngularProps["onLoadMore"];
|
|
37
39
|
onGridReady?: SimpleTableAngularProps["onGridReady"];
|
|
40
|
+
onTableReady?: SimpleTableAngularProps["onTableReady"];
|
|
38
41
|
rowGrouping?: SimpleTableAngularProps["rowGrouping"];
|
|
39
42
|
pivot?: SimpleTableAngularProps["pivot"];
|
|
40
43
|
onPivotChange?: SimpleTableAngularProps["onPivotChange"];
|
|
@@ -44,6 +47,7 @@ export declare class SimpleTableComponent implements OnInit, OnChanges, OnDestro
|
|
|
44
47
|
isLoading?: SimpleTableAngularProps["isLoading"];
|
|
45
48
|
getRowId?: SimpleTableAngularProps["getRowId"];
|
|
46
49
|
shouldPaginate?: SimpleTableAngularProps["shouldPaginate"];
|
|
50
|
+
enablePagination?: SimpleTableAngularProps["enablePagination"];
|
|
47
51
|
rowsPerPage?: SimpleTableAngularProps["rowsPerPage"];
|
|
48
52
|
serverSidePagination?: SimpleTableAngularProps["serverSidePagination"];
|
|
49
53
|
totalRowCount?: SimpleTableAngularProps["totalRowCount"];
|
|
@@ -54,7 +58,9 @@ export declare class SimpleTableComponent implements OnInit, OnChanges, OnDestro
|
|
|
54
58
|
columnResizing?: SimpleTableAngularProps["columnResizing"];
|
|
55
59
|
columnReordering?: SimpleTableAngularProps["columnReordering"];
|
|
56
60
|
editColumns?: SimpleTableAngularProps["editColumns"];
|
|
61
|
+
enableColumnEditor?: SimpleTableAngularProps["enableColumnEditor"];
|
|
57
62
|
editColumnsInitOpen?: SimpleTableAngularProps["editColumnsInitOpen"];
|
|
63
|
+
enableColumnEditorInitOpen?: SimpleTableAngularProps["enableColumnEditorInitOpen"];
|
|
58
64
|
selectableCells?: SimpleTableAngularProps["selectableCells"];
|
|
59
65
|
selectableColumns?: SimpleTableAngularProps["selectableColumns"];
|
|
60
66
|
enableHeaderEditing?: SimpleTableAngularProps["enableHeaderEditing"];
|
|
@@ -73,6 +79,12 @@ export declare class SimpleTableComponent implements OnInit, OnChanges, OnDestro
|
|
|
73
79
|
autoExpandColumns?: SimpleTableAngularProps["autoExpandColumns"];
|
|
74
80
|
animations?: SimpleTableAngularProps["animations"];
|
|
75
81
|
enableVirtualization?: SimpleTableAngularProps["enableVirtualization"];
|
|
82
|
+
hoverRowBackground?: SimpleTableAngularProps["hoverRowBackground"];
|
|
83
|
+
useHoverRowBackground?: SimpleTableAngularProps["useHoverRowBackground"];
|
|
84
|
+
oddColumnBackground?: SimpleTableAngularProps["oddColumnBackground"];
|
|
85
|
+
useOddColumnBackground?: SimpleTableAngularProps["useOddColumnBackground"];
|
|
86
|
+
oddEvenRowBackground?: SimpleTableAngularProps["oddEvenRowBackground"];
|
|
87
|
+
useOddEvenRowBackground?: SimpleTableAngularProps["useOddEvenRowBackground"];
|
|
76
88
|
/** Emits the TableAPI once the table has mounted. */
|
|
77
89
|
tableReady: EventEmitter<TableAPI>;
|
|
78
90
|
private instance;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Type } from "@angular/core";
|
|
2
|
-
import type { SimpleTableProps, SimpleTableConfig, HeaderObject, Row, TableAPI, CellRendererProps, HeaderRendererProps, FooterRendererProps, LoadingStateRendererProps, ErrorStateRendererProps, EmptyStateRendererProps, HeaderDropdownProps, ColumnEditorRowRendererProps, ColumnEditorCustomRendererProps, ColumnEditorConfig } from "simple-table-core";
|
|
2
|
+
import type { SimpleTableProps, SimpleTableConfig, HeaderObject, Row, TableAPI, CellRenderer, CellRendererProps, HeaderRenderer, HeaderRendererProps, FooterRendererProps, LoadingStateRendererProps, ErrorStateRendererProps, EmptyStateRendererProps, HeaderDropdownProps, ColumnEditorRowRendererProps, ColumnEditorCustomRendererProps, ColumnEditorConfig } from "simple-table-core";
|
|
3
3
|
export interface TableInstance {
|
|
4
4
|
mount(): void;
|
|
5
5
|
update(config: Partial<SimpleTableConfig>): void;
|
|
@@ -14,8 +14,9 @@ export interface TableInstance {
|
|
|
14
14
|
* input contract for each slot remains the matching `*RendererProps` type from
|
|
15
15
|
* `simple-table-core` (re-exported below).
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
|
-
export type
|
|
17
|
+
/** Angular component class, or a core vanilla renderer (non-`ɵcmp` values pass through). */
|
|
18
|
+
export type AngularCellRenderer = Type<unknown> | CellRenderer;
|
|
19
|
+
export type AngularHeaderRenderer = Type<unknown> | HeaderRenderer;
|
|
19
20
|
export type AngularFooterRenderer = Type<unknown>;
|
|
20
21
|
export type AngularHeaderDropdown = Type<unknown>;
|
|
21
22
|
export type AngularColumnEditorRowRenderer = Type<unknown>;
|
|
@@ -44,8 +45,9 @@ export interface AngularColumnEditorConfig extends Omit<ColumnEditorConfig, "row
|
|
|
44
45
|
customRenderer?: AngularColumnEditorCustomRenderer;
|
|
45
46
|
}
|
|
46
47
|
/**
|
|
47
|
-
* Column definition for `defaultHeaders`: core column metadata with
|
|
48
|
-
* renderer fields. `
|
|
48
|
+
* Column definition for `columns` / `defaultHeaders`: core column metadata with
|
|
49
|
+
* Angular-only renderer fields. `columns` / `defaultHeaders` also accept plain
|
|
50
|
+
* `HeaderObject[]` from shared configs.
|
|
49
51
|
*/
|
|
50
52
|
export interface AngularHeaderObject extends Omit<HeaderObject, "cellRenderer" | "headerRenderer" | "children" | "nestedTable"> {
|
|
51
53
|
cellRenderer?: AngularCellRenderer;
|
|
@@ -53,8 +55,16 @@ export interface AngularHeaderObject extends Omit<HeaderObject, "cellRenderer" |
|
|
|
53
55
|
children?: AngularHeaderObject[];
|
|
54
56
|
nestedTable?: Omit<SimpleTableAngularProps, "rows" | "loadingStateRenderer" | "errorStateRenderer" | "emptyStateRenderer" | "tableEmptyStateRenderer">;
|
|
55
57
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
/** Preferred name for Angular column definitions. Alias of {@link AngularHeaderObject}. */
|
|
59
|
+
export type AngularColumnDef = AngularHeaderObject;
|
|
60
|
+
export interface SimpleTableAngularProps extends Omit<SimpleTableProps, "rows" | "defaultHeaders" | "columns" | "footerRenderer" | "emptyStateRenderer" | "errorStateRenderer" | "loadingStateRenderer" | "tableEmptyStateRenderer" | "headerDropdown" | "columnEditorConfig" | "icons" | "rowButtons" | "onColumnOrderChange" | "onColumnWidthChange" | "onHeaderEdit" | "onColumnSelect"> {
|
|
61
|
+
/**
|
|
62
|
+
* Column definitions.
|
|
63
|
+
* @deprecated Prefer {@link columns}
|
|
64
|
+
*/
|
|
65
|
+
defaultHeaders?: ReadonlyArray<HeaderObject | AngularHeaderObject>;
|
|
66
|
+
/** Column definitions. Preferred over `defaultHeaders`. */
|
|
67
|
+
columns?: ReadonlyArray<HeaderObject | AngularHeaderObject>;
|
|
58
68
|
/** Row data: domain objects or core `Row[]`; cast inside the adapter. */
|
|
59
69
|
rows: ReadonlyArray<Row> | ReadonlyArray<object>;
|
|
60
70
|
onColumnOrderChange?: (newHeaders: AngularHeaderObject[]) => void;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simple-table/angular",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/index.es.js",
|
|
6
|
-
"types": "dist/types/
|
|
6
|
+
"types": "dist/types/index.d.ts",
|
|
7
7
|
"sideEffects": [
|
|
8
8
|
"*.css",
|
|
9
9
|
"**/*.css"
|
|
@@ -12,9 +12,12 @@
|
|
|
12
12
|
".": {
|
|
13
13
|
"import": "./dist/index.es.js",
|
|
14
14
|
"require": "./dist/cjs/index.js",
|
|
15
|
-
"types": "./dist/types/
|
|
15
|
+
"types": "./dist/types/index.d.ts"
|
|
16
16
|
},
|
|
17
|
-
"./styles.css":
|
|
17
|
+
"./styles.css": {
|
|
18
|
+
"types": "./styles.css.d.ts",
|
|
19
|
+
"default": "./dist/styles.css"
|
|
20
|
+
}
|
|
18
21
|
},
|
|
19
22
|
"license": "Community",
|
|
20
23
|
"publishConfig": {
|
|
@@ -22,15 +25,15 @@
|
|
|
22
25
|
},
|
|
23
26
|
"files": [
|
|
24
27
|
"dist",
|
|
25
|
-
"LICENSE"
|
|
28
|
+
"LICENSE",
|
|
29
|
+
"styles.css.d.ts"
|
|
26
30
|
],
|
|
27
31
|
"peerDependencies": {
|
|
28
32
|
"@angular/common": ">=17.0.0 <22.0.0",
|
|
29
33
|
"@angular/core": ">=17.0.0 <22.0.0"
|
|
30
34
|
},
|
|
31
35
|
"dependencies": {
|
|
32
|
-
"
|
|
33
|
-
"simple-table-core": "4.0.1"
|
|
36
|
+
"simple-table-core": "4.0.2"
|
|
34
37
|
},
|
|
35
38
|
"devDependencies": {
|
|
36
39
|
"@angular/common": "^20.0.0",
|
|
@@ -46,6 +49,7 @@
|
|
|
46
49
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
47
50
|
"rollup-plugin-terser": "^7.0.2",
|
|
48
51
|
"rollup-plugin-typescript2": "^0.37.0",
|
|
52
|
+
"tslib": "^2.8.1",
|
|
49
53
|
"typescript": "^5.9.0",
|
|
50
54
|
"vitest": "^2.1.9",
|
|
51
55
|
"zone.js": "^0.15.0"
|
|
@@ -98,6 +102,7 @@
|
|
|
98
102
|
"scripts": {
|
|
99
103
|
"build": "rollup -c",
|
|
100
104
|
"preview": "rollup -c -w",
|
|
105
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
101
106
|
"test": "vitest run",
|
|
102
107
|
"version:patch": "npm version patch && git push && git push --tags",
|
|
103
108
|
"version:minor": "npm version minor && git push && git push --tags",
|
package/styles.css.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ApplicationRef, EnvironmentInjector } from "@angular/core";
|
|
2
|
-
import type { SimpleTableConfig } from "simple-table-core";
|
|
3
|
-
import type { SimpleTableAngularProps } from "./types";
|
|
4
|
-
import type { MountRegistry } from "./MountRegistry";
|
|
5
|
-
export declare function buildVanillaConfig(config: SimpleTableAngularProps, registry: MountRegistry, appRef: ApplicationRef, injector: EnvironmentInjector): SimpleTableConfig;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { SimpleTableComponent } from "./lib/SimpleTableComponent";
|
|
2
|
-
export { asRows } from "simple-table-core";
|
|
3
|
-
export { provideSimpleTable } from "./lib/provideSimpleTable";
|
|
4
|
-
/** Wrap a standalone component as an HTMLElement (e.g. for `tableEmptyStateRenderer`). */
|
|
5
|
-
export { wrapAngularRenderer } from "./utils/wrapAngularRenderer";
|
|
6
|
-
export type { SimpleTableAngularProps, TableInstance, AngularHeaderObject, AngularIconsConfig, AngularIconSlot, AngularColumnEditorConfig, AngularCellRenderer, AngularHeaderRenderer, AngularFooterRenderer, AngularHeaderDropdown, AngularColumnEditorRowRenderer, AngularColumnEditorCustomRenderer, AngularLoadingStateRenderer, AngularErrorStateRenderer, AngularEmptyStateRenderer, AngularRowButton, } from "./types";
|
|
7
|
-
export type { Accessor, AggregationConfig, AggregationType, BoundingBox, Cell, CellChangeProps, CellClickProps, CellRenderer, CellRendererProps, CellValue, ChartOptions, ColumnEditorConfig, ColumnEditorRowRenderer, ColumnEditorRowRendererComponents, ColumnEditorCustomRenderer, ColumnEditorCustomRendererProps, ColumnEditorRowRendererProps, ColumnEditorSearchFunction, ColumnType, ColumnVisibilityState, Comparator, ComparatorProps, CustomTheme, CustomThemeProps, DragHandlerProps, EmptyStateRenderer, EmptyStateRendererProps, EnumOption, ErrorStateRenderer, ErrorStateRendererProps, ExportToCSVProps, ExportValueGetter, ExportValueProps, FilterCondition, FilterOperator, StringFilterOperator, NumberFilterOperator, BooleanFilterOperator, DateFilterOperator, EnumFilterOperator, FooterRendererProps, GetRowId, GetRowIdParams, HeaderDropdown, HeaderDropdownProps, HeaderObject, HeaderRenderer, HeaderRendererComponents, HeaderRendererProps, IconsConfig, LoadingStateRenderer, LoadingStateRendererProps, OnRowGroupExpandProps, OnSortProps, PivotConfig, PivotValueConfig, PivotResult, QuickFilterConfig, QuickFilterGetter, QuickFilterGetterProps, QuickFilterMode, Row, RowButtonProps, RowId, RowSelectionChangeProps, RowState, SetHeaderRenameProps, SharedTableProps, ShowWhen, SimpleTableConfig, SimpleTableProps, SortColumn, TableAPI, TableFilterState, TableHeaderProps, TableRowProps, Theme, UpdateDataProps, ValueFormatter, ValueFormatterProps, ValueGetter, ValueGetterProps, } from "simple-table-core";
|
|
8
|
-
export { pivotRows, buildPivotAccessor, buildPivotRowTotalAccessor, PIVOT_CHILDREN_KEY, PIVOT_IS_TOTAL_KEY, PIVOT_ACCESSOR_PREFIX, PIVOT_BLANK_LABEL, } from "simple-table-core";
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Column width constraints for the table
|
|
3
|
-
* These values control minimum and maximum widths for columns and sections
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* MIN_COLUMN_WIDTH
|
|
7
|
-
* The minimum width in pixels that any column can have.
|
|
8
|
-
* This is used as:
|
|
9
|
-
* - The default minimum width when header.minWidth is undefined
|
|
10
|
-
* - The absolute minimum in autoExpandColumns mode to prevent columns from becoming too narrow
|
|
11
|
-
*/
|
|
12
|
-
export declare const MIN_COLUMN_WIDTH = 40;
|
|
13
|
-
/**
|
|
14
|
-
* MAX_SINGLE_PINNED_SECTION_PERCENT
|
|
15
|
-
* Maximum percentage of container width that a single pinned section can occupy.
|
|
16
|
-
* When only one section (left OR right) is pinned, it can take up to 60% of the width.
|
|
17
|
-
* This ensures the main section always has at least 40% of the space.
|
|
18
|
-
*/
|
|
19
|
-
export declare const MAX_SINGLE_PINNED_SECTION_PERCENT = 0.6;
|
|
20
|
-
/**
|
|
21
|
-
* MAX_DUAL_PINNED_SECTION_PERCENT
|
|
22
|
-
* Maximum percentage of container width that each pinned section can occupy
|
|
23
|
-
* when BOTH left and right sections are pinned.
|
|
24
|
-
* With both sections at 40%, the main section is guaranteed at least 20% of the space.
|
|
25
|
-
*/
|
|
26
|
-
export declare const MAX_DUAL_PINNED_SECTION_PERCENT = 0.4;
|
|
27
|
-
/**
|
|
28
|
-
* Mobile breakpoints for responsive pinned section constraints
|
|
29
|
-
*/
|
|
30
|
-
export declare const MOBILE_BREAKPOINT_SMALL = 480;
|
|
31
|
-
export declare const MOBILE_BREAKPOINT_MEDIUM = 768;
|
|
32
|
-
/**
|
|
33
|
-
* Get the maximum allowed width percentage for a single pinned section based on container width.
|
|
34
|
-
* This is used when only ONE section (left OR right) is pinned.
|
|
35
|
-
*
|
|
36
|
-
* @param containerWidth - The table container width in pixels (st-body-container)
|
|
37
|
-
* @returns The maximum percentage (0-1) of container width that the pinned section can occupy
|
|
38
|
-
*/
|
|
39
|
-
export declare const getMaxSinglePinnedPercent: (containerWidth: number) => number;
|
|
40
|
-
/**
|
|
41
|
-
* Get the maximum allowed width percentage for pinned sections based on container width
|
|
42
|
-
* and the number of pinned sections.
|
|
43
|
-
*
|
|
44
|
-
* @param containerWidth - The table container width in pixels (st-body-container)
|
|
45
|
-
* @param hasPinnedLeft - Whether there is a pinned left section
|
|
46
|
-
* @param hasPinnedRight - Whether there is a pinned right section
|
|
47
|
-
* @returns The maximum percentage (0-1) of container width that each pinned section can occupy
|
|
48
|
-
*/
|
|
49
|
-
export declare const getMaxPinnedSectionPercent: (containerWidth: number, hasPinnedLeft: boolean, hasPinnedRight: boolean) => number;
|
|
50
|
-
/**
|
|
51
|
-
* Calculate the maximum width in pixels for a pinned section
|
|
52
|
-
*
|
|
53
|
-
* @param containerWidth - The table container width in pixels (st-body-container)
|
|
54
|
-
* @param hasPinnedLeft - Whether there is a pinned left section
|
|
55
|
-
* @param hasPinnedRight - Whether there is a pinned right section
|
|
56
|
-
* @returns The maximum width in pixels for a pinned section
|
|
57
|
-
*/
|
|
58
|
-
export declare const getMaxPinnedSectionWidth: (containerWidth: number, hasPinnedLeft: boolean, hasPinnedRight: boolean) => number;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export declare const DRAG_THROTTLE_LIMIT = 50;
|
|
2
|
-
export declare const ROW_SEPARATOR_WIDTH = 1;
|
|
3
|
-
export declare const PAGE_SIZE = 20;
|
|
4
|
-
export declare const CSS_VAR_BORDER_WIDTH = "--st-border-width";
|
|
5
|
-
export declare const DEFAULT_BORDER_WIDTH = 1;
|
|
6
|
-
export declare const VIRTUALIZATION_THRESHOLD = 20;
|
|
7
|
-
export declare const UNVIRTUALIZED_ROW_WARNING_THRESHOLD = 500;
|
|
8
|
-
export declare const OVERSCAN_PIXELS = 800;
|
|
9
|
-
export declare const calculateBufferRowCount: (rowHeight: number) => number;
|
|
10
|
-
export declare const COLUMN_EDIT_WIDTH = 29.5;
|
|
11
|
-
/**
|
|
12
|
-
* Horizontal space reserved for the built-in column-editor toggle strip.
|
|
13
|
-
* Returns 0 when editing is off or the strip is hidden via `showToggle: false`.
|
|
14
|
-
*/
|
|
15
|
-
export declare const getColumnEditorStripWidth: (editColumns: boolean | undefined, showToggle?: boolean) => number;
|
|
16
|
-
/**
|
|
17
|
-
* Whether the built-in column-editor toggle strip is visible and takes layout space.
|
|
18
|
-
*/
|
|
19
|
-
export declare const isColumnEditorStripVisible: (editColumns: boolean | undefined, showToggle?: boolean) => boolean;
|
|
20
|
-
export declare const TABLE_HEADER_CELL_WIDTH_DEFAULT = 150;
|
|
21
|
-
export declare const PINNED_BORDER_WIDTH = 1;
|
|
22
|
-
export declare const CHART_COLUMN_TYPES: string[];
|
|
23
|
-
export declare const OPTIMAL_CHART_COLUMN_WIDTH = 150;
|
|
24
|
-
export declare const AUTO_SIZE_HEAD_SAMPLE_SIZE = 25;
|
|
25
|
-
export declare const AUTO_SIZE_STRIDED_SAMPLE_SIZE = 75;
|
|
26
|
-
export declare const AUTO_SIZE_MAX_WIDTH = 500;
|
|
27
|
-
export declare const AUTO_SIZE_OUTLIER_PERCENTILE = 95;
|
|
28
|
-
export declare const AUTO_SIZE_OUTLIER_THRESHOLD = 0.5;
|
|
29
|
-
export declare const AUTO_SIZE_MIN_SAMPLE_FOR_CLIP = 20;
|
|
30
|
-
export declare const AUTO_SIZE_WIDTH_BUFFER = 2;
|
|
31
|
-
/** Extra padding reserved around header icons (sort / collapse) during auto-size. */
|
|
32
|
-
export declare const AUTO_SIZE_HEADER_ICON_PADDING = 4;
|