@simple-table/angular 3.9.7 → 3.9.8

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,p=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)p=Reflect.decorate(e,t,o,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(p=(r<3?i(p):r>3?i(t,o,p):i(t,o))||p);return r>3&&p&&Object.defineProperty(t,o,p),p}function n(t,o,n,i){return r=>{const p=document.createElement("div"),s=e.createComponent(t,{environmentInjector:n,hostElement:p});return Object.assign(s.instance,r),o.attachView(s.hostView),s.changeDetectorRef.detectChanges(),i?.register(p,()=>{o.detachView(s.hostView),s.destroy()}),p}}function i(e,t,o,r){const{defaultHeaders:p,rows:s,footerRenderer:l,emptyStateRenderer:d,errorStateRenderer:a,loadingStateRenderer:h,tableEmptyStateRenderer:m,headerDropdown:u,columnEditorConfig:c,icons:C,rowButtons:v,onColumnOrderChange:g,onColumnWidthChange:S,onHeaderEdit:b,onColumnSelect:y,...x}=e,R=e=>n(e,o,r,t),I={...x,rows:s,defaultHeaders:p.map(function e(n){const{cellRenderer:p,headerRenderer:s,children:l,nestedTable:d,...a}=n,h={...a};if(p&&(h.cellRenderer=p.ɵcmp?R(p):p),s&&(h.headerRenderer=s.ɵcmp?R(s):s),l&&(h.children=l.map(e)),d){const e={...d,rows:[]};h.nestedTable=i(e,t,o,r)}return h}),onRendererHostDiscard:t.disposeHost,...g?{onColumnOrderChange:e=>g(e)}:{},...S?{onColumnWidthChange:e=>S(e)}:{},...b?{onHeaderEdit:(e,t)=>b(e,t)}:{},...y?{onColumnSelect:e=>y(e)}:{}};return void 0!==l&&(I.footerRenderer=l.ɵcmp?R(l):l),void 0!==d&&(I.emptyStateRenderer=d.ɵcmp?R(d):d),void 0!==a&&(I.errorStateRenderer=a.ɵcmp?R(a):a),void 0!==h&&(I.loadingStateRenderer=h.ɵcmp?R(h):h),void 0!==m&&(I.tableEmptyStateRenderer=m),void 0!==u&&(I.headerDropdown=R(u)),void 0!==c&&(I.columnEditorConfig=function(e){const{rowRenderer:t,customRenderer:o,...n}=e;return{...n,...t?{rowRenderer:R(t)}:{},...o?{customRenderer:R(o)}:{}}}(c)),void 0!==C&&(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?R(n)({}):n);return t}(C)),void 0!==v&&(I.rowButtons=v.map(e=>R(e))),I}"function"==typeof SuppressedError&&SuppressedError;const r="data-st-mount-id";class p{constructor(){this.entries=new Map,this.nextId=0,this.disposeHost=e=>{if("function"!=typeof e.getAttribute)return;const t=[],o=e.getAttribute(r);null!==o&&t.push(o),e.querySelectorAll(`[${r}]`).forEach(e=>{const o=e.getAttribute(r);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(r,o),this.entries.set(o,t)}clear(){for(const e of this.entries.values())e();this.entries.clear()}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");e&&(this.instance=new t.SimpleTableVanilla(e,i(this.getProps(),this.registry,this.appRef,this.envInjector)),this.instance.mount(),this.tableReady.emit(this.instance.getAPI()))}ngOnChanges(){this.instance?.update(i(this.getProps(),this.registry,this.appRef,this.envInjector))}ngOnDestroy(){this.instance?.destroy(),this.instance=null,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: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;
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 l,makeEnvironmentProviders as a}from"@angular/core";import{SimpleTableVanilla as h}from"simple-table-core";export{asRows}from"simple-table-core";function p(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 c(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 u(e,t,o,i){const{defaultHeaders:n,rows:r,footerRenderer:s,emptyStateRenderer:d,errorStateRenderer:l,loadingStateRenderer:a,tableEmptyStateRenderer:h,headerDropdown:p,columnEditorConfig:v,icons:g,rowButtons:m,onColumnOrderChange:y,onColumnWidthChange:C,onHeaderEdit:R,onColumnSelect:f,...S}=e,w=e=>c(e,o,i,t),b={...S,rows:r,defaultHeaders:n.map(function e(n){const{cellRenderer:r,headerRenderer:s,children:d,nestedTable:l,...a}=n,h={...a};if(r&&(h.cellRenderer=r.ɵcmp?w(r):r),s&&(h.headerRenderer=s.ɵcmp?w(s):s),d&&(h.children=d.map(e)),l){const e={...l,rows:[]};h.nestedTable=u(e,t,o,i)}return h}),onRendererHostDiscard:t.disposeHost,...y?{onColumnOrderChange:e=>y(e)}:{},...C?{onColumnWidthChange:e=>C(e)}:{},...R?{onHeaderEdit:(e,t)=>R(e,t)}:{},...f?{onColumnSelect:e=>f(e)}:{}};return void 0!==s&&(b.footerRenderer=s.ɵcmp?w(s):s),void 0!==d&&(b.emptyStateRenderer=d.ɵcmp?w(d):d),void 0!==l&&(b.errorStateRenderer=l.ɵcmp?w(l):l),void 0!==a&&(b.loadingStateRenderer=a.ɵcmp?w(a):a),void 0!==h&&(b.tableEmptyStateRenderer=h),void 0!==p&&(b.headerDropdown=w(p)),void 0!==v&&(b.columnEditorConfig=function(e){const{rowRenderer:t,customRenderer:o,...i}=e;return{...i,...t?{rowRenderer:w(t)}:{},...o?{customRenderer:w(o)}:{}}}(v)),void 0!==g&&(b.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?w(i)({}):i);return t}(g)),void 0!==m&&(b.rowButtons=m.map(e=>w(e))),b}"function"==typeof SuppressedError&&SuppressedError;const v="data-st-mount-id";class g{constructor(){this.entries=new Map,this.nextId=0,this.disposeHost=e=>{if("function"!=typeof e.getAttribute)return;const t=[],o=e.getAttribute(v);null!==o&&t.push(o),e.querySelectorAll(`[${v}]`).forEach(e=>{const o=e.getAttribute(v);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(v,o),this.entries.set(o,t)}clear(){for(const e of this.entries.values())e();this.entries.clear()}get size(){return this.entries.size}}let m=class{constructor(){this.tableReady=new n,this.instance=null,this.registry=new g,this.hostEl=r(s),this.appRef=r(d),this.envInjector=r(l)}ngOnInit(){const e=this.hostEl.nativeElement.querySelector("div");e&&(this.instance=new h(e,u(this.getProps(),this.registry,this.appRef,this.envInjector)),this.instance.mount(),this.tableReady.emit(this.instance.getAPI()))}ngOnChanges(){this.instance?.update(u(this.getProps(),this.registry,this.appRef,this.envInjector))}ngOnDestroy(){this.instance?.destroy(),this.instance=null,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 y(){return a([])}p([t({required:!0})],m.prototype,"rows",void 0),p([t({required:!0})],m.prototype,"defaultHeaders",void 0),p([t()],m.prototype,"footerRenderer",void 0),p([t()],m.prototype,"loadingStateRenderer",void 0),p([t()],m.prototype,"errorStateRenderer",void 0),p([t()],m.prototype,"emptyStateRenderer",void 0),p([t()],m.prototype,"tableEmptyStateRenderer",void 0),p([t()],m.prototype,"headerDropdown",void 0),p([t()],m.prototype,"columnEditorConfig",void 0),p([t()],m.prototype,"onCellClick",void 0),p([t()],m.prototype,"onCellEdit",void 0),p([t()],m.prototype,"onSortChange",void 0),p([t()],m.prototype,"onFilterChange",void 0),p([t()],m.prototype,"onRowSelectionChange",void 0),p([t()],m.prototype,"onRowGroupExpand",void 0),p([t()],m.prototype,"onColumnOrderChange",void 0),p([t()],m.prototype,"onColumnVisibilityChange",void 0),p([t()],m.prototype,"onColumnWidthChange",void 0),p([t()],m.prototype,"onPageChange",void 0),p([t()],m.prototype,"onLoadMore",void 0),p([t()],m.prototype,"onGridReady",void 0),p([t()],m.prototype,"rowGrouping",void 0),p([t()],m.prototype,"enableRowSelection",void 0),p([t()],m.prototype,"theme",void 0),p([t()],m.prototype,"quickFilter",void 0),p([t()],m.prototype,"isLoading",void 0),p([t()],m.prototype,"getRowId",void 0),p([t()],m.prototype,"shouldPaginate",void 0),p([t()],m.prototype,"rowsPerPage",void 0),p([t()],m.prototype,"serverSidePagination",void 0),p([t()],m.prototype,"totalRowCount",void 0),p([t()],m.prototype,"height",void 0),p([t()],m.prototype,"maxHeight",void 0),p([t()],m.prototype,"scrollParent",void 0),p([t()],m.prototype,"infiniteScrollThreshold",void 0),p([t()],m.prototype,"columnResizing",void 0),p([t()],m.prototype,"columnReordering",void 0),p([t()],m.prototype,"editColumns",void 0),p([t()],m.prototype,"editColumnsInitOpen",void 0),p([t()],m.prototype,"selectableCells",void 0),p([t()],m.prototype,"selectableColumns",void 0),p([t()],m.prototype,"enableHeaderEditing",void 0),p([t()],m.prototype,"onHeaderEdit",void 0),p([t()],m.prototype,"customTheme",void 0),p([t()],m.prototype,"icons",void 0),p([t()],m.prototype,"externalFilterHandling",void 0),p([t()],m.prototype,"externalSortHandling",void 0),p([t()],m.prototype,"columnBorders",void 0),p([t()],m.prototype,"rowButtons",void 0),p([t()],m.prototype,"hideFooter",void 0),p([t()],m.prototype,"footerPosition",void 0),p([t()],m.prototype,"initialSortColumn",void 0),p([t()],m.prototype,"initialSortDirection",void 0),p([t()],m.prototype,"expandAll",void 0),p([t()],m.prototype,"autoExpandColumns",void 0),p([t()],m.prototype,"animations",void 0),p([o()],m.prototype,"tableReady",void 0),m=p([i({selector:"simple-table",standalone:!0,template:"<div #host></div>",styles:[":host { display: block; }"]})],m);export{m as SimpleTableComponent,y as provideSimpleTable,c 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,...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};
2
2
  //# sourceMappingURL=index.es.js.map
@@ -1,18 +1,15 @@
1
+ export type CachedRendererSlot<T = unknown> = {
2
+ component: T;
3
+ wrapped: unknown;
4
+ };
1
5
  export declare class MountRegistry {
2
6
  private entries;
3
7
  private nextId;
4
- /**
5
- * Register a dispose callback for a mount container. Tags the container so
6
- * {@link disposeHost} can find it when core discards an ancestor host.
7
- */
8
+ readonly cellRendererCache: Map<string, CachedRendererSlot<unknown>>;
9
+ readonly headerRendererCache: Map<string, CachedRendererSlot<unknown>>;
8
10
  register(container: HTMLElement, dispose: () => void): void;
9
- /**
10
- * Tear down mounts owned by a host element core is permanently discarding.
11
- * Collects `host` itself plus every descendant tagged with {@link MOUNT_ID_ATTR}.
12
- */
13
11
  disposeHost: (host: HTMLElement) => void;
14
- /** Dispose every tracked mount (used on table teardown). */
15
12
  clear(): void;
16
- /** Test helper — number of live mounts. */
13
+ pruneRendererCaches(liveAccessors: ReadonlySet<string>): void;
17
14
  get size(): number;
18
15
  }
@@ -74,6 +74,8 @@ export declare class SimpleTableComponent implements OnInit, OnChanges, OnDestro
74
74
  tableReady: EventEmitter<TableAPI>;
75
75
  private instance;
76
76
  private registry;
77
+ private syncedDefaultHeaders;
78
+ private syncedRows;
77
79
  private hostEl;
78
80
  private appRef;
79
81
  private envInjector;
@@ -19,3 +19,8 @@ import type { MountRegistry } from "../MountRegistry";
19
19
  * `provideSimpleTable()` in their application providers.
20
20
  */
21
21
  export declare function wrapAngularRenderer<P extends object>(component: Type<P>, appRef: ApplicationRef, injector: EnvironmentInjector, registry?: MountRegistry): (props: Partial<P>) => HTMLElement;
22
+ /**
23
+ * Like {@link wrapAngularRenderer}, but reuses one wrapper per accessor so
24
+ * unstable column rebuilds keep a stable function identity on HeaderObject.
25
+ */
26
+ export declare function wrapCachedAngularRenderer<P extends object>(component: Type<P>, appRef: ApplicationRef, injector: EnvironmentInjector, registry: MountRegistry, accessor: string, kind: "cell" | "header"): (props: Partial<P>) => HTMLElement;
@@ -69,6 +69,14 @@ export declare class SimpleTableVanilla {
69
69
  private headerRegistry;
70
70
  private rowIndexMap;
71
71
  private animationCoordinator;
72
+ /**
73
+ * When true, the sort subscriber skips `captureAnimationSnapshot` so
74
+ * live-update-driven reorder/visibility changes don't FLIP-animate.
75
+ * User-initiated sorts leave this false and keep FLIP.
76
+ */
77
+ private suppressNextAnimationSnapshot;
78
+ /** Lazily created once — callers often invoke getAPI() every live tick. */
79
+ private cachedAPI;
72
80
  private autoScaleManager;
73
81
  private dimensionManager;
74
82
  private scrollManager;
@@ -41,6 +41,8 @@ export interface TableAPIContext {
41
41
  * re-render once the animation settles.
42
42
  */
43
43
  isCellAnimating?: (cellId: string) => boolean;
44
+ /** True while any FLIP cell transition is in flight (blocks live re-sort/re-filter). */
45
+ hasAnimatingCells?: () => boolean;
44
46
  columnEditorOpen: boolean;
45
47
  expandedDepthsManager: any;
46
48
  selectionManager: SelectionManager | null;
@@ -50,6 +52,17 @@ export interface TableAPIContext {
50
52
  getCachedFlattenResult?: () => FlattenRowsResult | null;
51
53
  getCachedProcessedResult?: () => ProcessRowsResult | null;
52
54
  onRender: () => void;
55
+ /**
56
+ * Bust the flatten / body row caches so the next render re-runs quick filter
57
+ * (and related processing) against in-place mutated row values.
58
+ */
59
+ invalidateRowsCache?: () => void;
60
+ /**
61
+ * Run `fn` without capturing a FLIP snapshot when sort/filter subscribers
62
+ * fire. Used for live-update-driven reorder/visibility changes so high-
63
+ * frequency ticks don't spam sort animations.
64
+ */
65
+ runWithoutAnimationSnapshot?: (fn: () => void) => void;
53
66
  setHeaders: (headers: HeaderObject[]) => void;
54
67
  setCurrentPage: (page: number) => void;
55
68
  setColumnEditorOpen: (open: boolean) => void;
@@ -49,4 +49,6 @@ import type { RowId } from "./types/RowId";
49
49
  import type { PinnedSectionsState } from "./types/PinnedSectionsState";
50
50
  export { SimpleTableVanilla };
51
51
  export { asRows } from "./utils/asRows";
52
+ export { headersStructurallyEqual, collectHeaderAccessors, rowsShallowUnchanged, shallowEqualRow, SHALLOW_ROW_COMPARE_MAX, } from "./utils/propSyncEqual";
53
+ export type { HeaderStructureLike, GetRowIdLike } from "./utils/propSyncEqual";
52
54
  export type { Accessor, AggregationConfig, AggregationType, AnimationsConfig, BoundingBox, Cell, CellChangeProps, CellClickProps, CellRenderer, CellRendererProps, CellValue, ChartOptions, ColumnEditorConfig, ColumnEditorCustomRenderer, ColumnEditorCustomRendererProps, ColumnEditorRowRenderer, ColumnEditorRowRendererComponents, 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, FooterPosition, GetRowId, GetRowIdParams, IconsConfig, LoadingStateRenderer, LoadingStateRendererProps, HeaderDropdown, HeaderDropdownProps, HeaderObject, HeaderRenderer, HeaderRendererProps, HeaderRendererComponents, OnRowGroupExpandProps, OnSortProps, QuickFilterConfig, QuickFilterGetter, QuickFilterGetterProps, QuickFilterMode, Row, RowButtonProps, RowId, RowSelectionChangeProps, RowSelectionMode, RowState, SetHeaderRenameProps, SharedTableProps, ShowWhen, SimpleTableConfig, SimpleTableProps, SortColumn, TableAPI, TableFilterState, TableHeaderProps, TableRowProps, Theme, PinnedSectionsState, UpdateDataProps, ValueFormatter, ValueFormatterProps, ValueGetter, ValueGetterProps, };
@@ -117,6 +117,8 @@ export declare class AnimationCoordinator {
117
117
  setEasing(easing: string): void;
118
118
  isEnabled(): boolean;
119
119
  isInFlight(cellId: string): boolean;
120
+ /** True while any FLIP / retained-cell transition is still running. */
121
+ hasInFlight(): boolean;
120
122
  getDuration(): number;
121
123
  getEasing(): string;
122
124
  /**
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Shared prop-sync helpers for framework adapters.
3
+ * Used to skip no-op `defaultHeaders` / `rows` updates when consumers rebuild
4
+ * column configs or shallow-clone rows every render.
5
+ */
6
+ /** Minimal header shape for structural comparison (renderers ignored). */
7
+ export type HeaderStructureLike = {
8
+ accessor: string | number | symbol;
9
+ width?: number | string;
10
+ minWidth?: number | string;
11
+ maxWidth?: number | string;
12
+ label?: string;
13
+ type?: string;
14
+ pinned?: string | boolean | null;
15
+ hide?: boolean;
16
+ isSortable?: boolean;
17
+ filterable?: boolean;
18
+ align?: string;
19
+ collapsible?: boolean;
20
+ collapseDefault?: boolean;
21
+ showWhen?: string;
22
+ isEditable?: boolean;
23
+ isEssential?: boolean;
24
+ disableReorder?: boolean;
25
+ expandable?: boolean;
26
+ excludeFromRender?: boolean;
27
+ autoSizeMode?: string;
28
+ tooltip?: string;
29
+ quickFilterable?: boolean;
30
+ filterOperators?: ReadonlyArray<string>;
31
+ children?: ReadonlyArray<HeaderStructureLike>;
32
+ };
33
+ /**
34
+ * True when two header trees describe the same columns (accessors, widths,
35
+ * flags, nesting). Ignores renderer identity.
36
+ */
37
+ export declare function headersStructurallyEqual(a: ReadonlyArray<HeaderStructureLike> | undefined, b: ReadonlyArray<HeaderStructureLike> | undefined): boolean;
38
+ /** Collect every accessor in a header tree (for renderer-cache pruning). */
39
+ export declare function collectHeaderAccessors(headers: ReadonlyArray<HeaderStructureLike>, into?: Set<string>): Set<string>;
40
+ /**
41
+ * Shallow equality of a single row object (own enumerable keys, `===` values).
42
+ * Identical references are equal. In-place mutation on a shared object is
43
+ * invisible — callers must pass new object identities when data changes.
44
+ */
45
+ export declare function shallowEqualRow(a: object, b: object): boolean;
46
+ export type GetRowIdLike = (params: {
47
+ row: unknown;
48
+ depth?: number;
49
+ index?: number;
50
+ rowPath?: (string | number)[];
51
+ rowIndexPath?: number[];
52
+ groupingKey?: string;
53
+ }) => string | number | undefined;
54
+ /**
55
+ * Above this length, skip per-field shallow compares when row object identity
56
+ * differs. Same-array-ref and same-row-object cases stay O(1) / O(n) pointer
57
+ * checks. Protects huge client datasets from O(n × fields) scans.
58
+ */
59
+ export declare const SHALLOW_ROW_COMPARE_MAX = 50000;
60
+ /**
61
+ * True when `next` is a no-op relative to `prev` for table sync:
62
+ * same length, matching `getRowId` sequence (when provided), and each row
63
+ * either the same object or shallow-equal (for modest list sizes).
64
+ */
65
+ export declare function rowsShallowUnchanged(prev: ReadonlyArray<object> | undefined, next: ReadonlyArray<object> | undefined, getRowId?: GetRowIdLike): boolean;
@@ -55,6 +55,13 @@ export declare const calculateNestedTableHeight: ({ calculatedHeight, customHeig
55
55
  * getNestedValue(row, "releaseDate[0]") returns row.releaseDate[0]
56
56
  */
57
57
  export declare const getNestedValue: (obj: Row, path: Accessor) => CellValue;
58
+ /**
59
+ * True when both arrays have the same length and the same row object references
60
+ * at each index. Used by FilterManager / SortManager so in-place live updates
61
+ * that recompute filter/sort only notify subscribers when membership or order
62
+ * actually changed (`.filter()` / `handleSort` always allocate new arrays).
63
+ */
64
+ export declare const rowsOrderEqual: (a: Row[], b: Row[]) => boolean;
58
65
  /**
59
66
  * Set a nested property value in an object using dot notation and array bracket notation
60
67
  * Examples:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simple-table/angular",
3
- "version": "3.9.7",
3
+ "version": "3.9.8",
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.7"
33
+ "simple-table-core": "3.9.8"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@angular/common": "^20.0.0",