@simple-table/angular 3.9.8 → 3.9.9

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 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:m,loadingStateRenderer:u,tableEmptyStateRenderer:c,headerDropdown:C,columnEditorConfig:v,icons:g,rowButtons:S,onColumnOrderChange:y,onColumnWidthChange:b,onHeaderEdit:R,onColumnSelect:x,...f}=e,w=e=>n(e,s,p,o);o.pruneRendererCaches(t.collectHeaderAccessors(l));const I={...f,rows:a,defaultHeaders:l.map(function e(t){const{cellRenderer:n,headerRenderer:l,children:a,nestedTable:d,...h}=t,m=String(t.accessor),u={...h};if(n&&(u.cellRenderer=n.ɵcmp?i(n,s,p,o,m,"cell"):n),l&&(u.headerRenderer=l.ɵcmp?i(l,s,p,o,m,"header"):l),a&&(u.children=a.map(e)),d){const e={...d,rows:[]};u.nestedTable=r(e,o,s,p)}return u}),onRendererHostDiscard:o.disposeHost,...y?{onColumnOrderChange:e=>y(e)}:{},...b?{onColumnWidthChange:e=>b(e)}:{},...R?{onHeaderEdit:(e,t)=>R(e,t)}:{},...x?{onColumnSelect:e=>x(e)}:{}};return void 0!==d&&(I.footerRenderer=d.ɵcmp?w(d):d),void 0!==h&&(I.emptyStateRenderer=h.ɵcmp?w(h):h),void 0!==m&&(I.errorStateRenderer=m.ɵcmp?w(m):m),void 0!==u&&(I.loadingStateRenderer=u.ɵcmp?w(u):u),void 0!==c&&(I.tableEmptyStateRenderer=c),void 0!==C&&(I.headerDropdown=w(C)),void 0!==v&&(I.columnEditorConfig=function(e){const{rowRenderer:t,customRenderer:o,...n}=e;return{...n,...t?{rowRenderer:w(t)}:{},...o?{customRenderer:w(o)}:{}}}(v)),void 0!==g&&(I.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?w(n)({}):n);return t}(g)),void 0!==S&&(I.rowButtons=S.map(e=>w(e))),I}"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.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),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,"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.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,"asRows",{enumerable:!0,get:function(){return t.asRows}}),exports.provideSimpleTable=function(){return e.makeEnvironmentProviders([])},exports.wrapAngularRenderer=n;
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:m,loadingStateRenderer:u,tableEmptyStateRenderer:c,headerDropdown:C,columnEditorConfig:v,icons:g,rowButtons:S,onColumnOrderChange:b,onColumnWidthChange:y,onHeaderEdit:R,onColumnSelect:x,...f}=e,w=e=>n(e,s,p,o);o.pruneRendererCaches(t.collectHeaderAccessors(l));const I={...f,rows:a,defaultHeaders:l.map(function e(t){const{cellRenderer:n,headerRenderer:l,children:a,nestedTable:d,...h}=t,m=String(t.accessor),u={...h};if(n&&(u.cellRenderer=n.ɵcmp?i(n,s,p,o,m,"cell"):n),l&&(u.headerRenderer=l.ɵcmp?i(l,s,p,o,m,"header"):l),a&&(u.children=a.map(e)),d){const e={...d,rows:[]};u.nestedTable=r(e,o,s,p)}return u}),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&&(I.footerRenderer=d.ɵcmp?w(d):d),void 0!==h&&(I.emptyStateRenderer=h.ɵcmp?w(h):h),void 0!==m&&(I.errorStateRenderer=m.ɵcmp?w(m):m),void 0!==u&&(I.loadingStateRenderer=u.ɵcmp?w(u):u),void 0!==c&&(I.tableEmptyStateRenderer=c),void 0!==C&&(I.headerDropdown=w(C)),void 0!==v&&(I.columnEditorConfig=function(e){const{rowRenderer:t,customRenderer:o,...n}=e;return{...n,...t?{rowRenderer:w(t)}:{},...o?{customRenderer:w(o)}:{}}}(v)),void 0!==g&&(I.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?w(n)({}):n);return t}(g)),void 0!==S&&(I.rowButtons=S.map(e=>w(e))),I}"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.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,"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,"asRows",{enumerable:!0,get:function(){return t.asRows}}),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{asRows}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 H={...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&&(H.footerRenderer=s.ɵcmp?b(s):s),void 0!==d&&(H.emptyStateRenderer=d.ɵcmp?b(d):d),void 0!==a&&(H.errorStateRenderer=a.ɵcmp?b(a):a),void 0!==l&&(H.loadingStateRenderer=l.ɵcmp?b(l):l),void 0!==p&&(H.tableEmptyStateRenderer=p),void 0!==c&&(H.headerDropdown=b(c)),void 0!==u&&(H.columnEditorConfig=function(e){const{rowRenderer:t,customRenderer:o,...i}=e;return{...i,...t?{rowRenderer:b(t)}:{},...o?{customRenderer:b(o)}:{}}}(u)),void 0!==v&&(H.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&&(H.rowButtons=y.map(e=>b(e))),H}"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.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),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,"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([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 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{asRows}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,...b}=e,E=e=>g(e,o,i,t);t.pruneRendererCaches(h(n));const H={...b,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&&(H.footerRenderer=s.ɵcmp?E(s):s),void 0!==d&&(H.emptyStateRenderer=d.ɵcmp?E(d):d),void 0!==a&&(H.errorStateRenderer=a.ɵcmp?E(a):a),void 0!==l&&(H.loadingStateRenderer=l.ɵcmp?E(l):l),void 0!==p&&(H.tableEmptyStateRenderer=p),void 0!==c&&(H.headerDropdown=E(c)),void 0!==u&&(H.columnEditorConfig=function(e){const{rowRenderer:t,customRenderer:o,...i}=e;return{...i,...t?{rowRenderer:E(t)}:{},...o?{customRenderer:E(o)}:{}}}(u)),void 0!==v&&(H.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?E(i)({}):i);return t}(v)),void 0!==y&&(H.rowButtons=y.map(e=>E(e))),H}"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.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,"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};
2
2
  //# sourceMappingURL=index.es.js.map
@@ -70,6 +70,7 @@ export declare class SimpleTableComponent implements OnInit, OnChanges, OnDestro
70
70
  expandAll?: SimpleTableAngularProps["expandAll"];
71
71
  autoExpandColumns?: SimpleTableAngularProps["autoExpandColumns"];
72
72
  animations?: SimpleTableAngularProps["animations"];
73
+ enableVirtualization?: SimpleTableAngularProps["enableVirtualization"];
73
74
  /** Emits the TableAPI once the table has mounted. */
74
75
  tableReady: EventEmitter<TableAPI>;
75
76
  private instance;
@@ -53,6 +53,8 @@ export interface SimpleTableConfig {
53
53
  /** @see SimpleTableProps.showRowSelectionColumn */
54
54
  showRowSelectionColumn?: boolean;
55
55
  enableStickyParents?: boolean;
56
+ /** @see SimpleTableProps.enableVirtualization */
57
+ enableVirtualization?: boolean;
56
58
  errorStateRenderer?: VanillaErrorStateRenderer;
57
59
  expandAll?: boolean;
58
60
  externalFilterHandling?: boolean;
@@ -57,6 +57,13 @@ export interface SimpleTableProps {
57
57
  */
58
58
  showRowSelectionColumn?: boolean;
59
59
  enableStickyParents?: boolean;
60
+ /**
61
+ * When false, disables both row and column virtualization so every row and
62
+ * column is rendered in the DOM. Useful for print, a11y tooling, or small
63
+ * datasets that still need a fixed `height` / `maxHeight` for layout.
64
+ * Default true.
65
+ */
66
+ enableVirtualization?: boolean;
60
67
  errorStateRenderer?: ErrorStateRenderer;
61
68
  expandAll?: boolean;
62
69
  externalFilterHandling?: boolean;
@@ -108,6 +108,11 @@ export interface CellRenderContext {
108
108
  * here makes every column count as visible, disabling virtualization.
109
109
  */
110
110
  mainSectionViewportWidth?: number;
111
+ /**
112
+ * When false, skip column virtualization and render every body cell in the
113
+ * main section. Default true. Mirrors {@link SimpleTableProps.enableVirtualization}.
114
+ */
115
+ enableVirtualization?: boolean;
111
116
  onCellEdit?: (params: CellEditParams) => void;
112
117
  onCellClick?: (params: CellClickParams) => void;
113
118
  onRowGroupExpand?: (props: OnRowGroupExpandProps) => void | Promise<void>;
@@ -60,6 +60,8 @@ export interface HeaderRenderContext {
60
60
  mainBodyRef: RefObject<HTMLDivElement>;
61
61
  mainSectionContainerWidth?: number; /** Main section *content* width (sum of all non-pinned column widths). NOT the virtualization viewport. */
62
62
  mainSectionViewportWidth?: number; /** Main section *visible* viewport width (container minus pinned); use for getVisibleCells when !pinned */
63
+ /** When false, skip column virtualization and render every header cell in the main section. Default true. */
64
+ enableVirtualization?: boolean;
63
65
  onColumnOrderChange?: (headers: HeaderObject[]) => void;
64
66
  onColumnSelect?: (header: HeaderObject) => void;
65
67
  onColumnWidthChange?: (headers: HeaderObject[]) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simple-table/angular",
3
- "version": "3.9.8",
3
+ "version": "3.9.9",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/index.es.js",
6
6
  "types": "dist/types/angular/src/index.d.ts",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "tslib": "^2.8.1",
33
- "simple-table-core": "3.9.8"
33
+ "simple-table-core": "3.9.9"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@angular/common": "^20.0.0",