@simple-table/angular 3.9.0 → 3.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/types/angular/src/MountRegistry.d.ts +18 -0
- package/dist/types/angular/src/buildVanillaConfig.d.ts +2 -1
- package/dist/types/angular/src/lib/SimpleTableComponent.d.ts +1 -0
- package/dist/types/angular/src/utils/wrapAngularRenderer.d.ts +7 -1
- package/dist/types/core/src/consts/general-consts.d.ts +2 -0
- package/dist/types/core/src/managers/DimensionManager.d.ts +11 -0
- package/dist/types/core/src/types/AnimationsConfig.d.ts +2 -0
- package/dist/types/core/src/utils/bodyCell/styling.d.ts +2 -0
- package/dist/types/core/src/utils/headerCell/eventTracking.d.ts +1 -1
- package/dist/types/core/src/utils/headerCell/types.d.ts +6 -0
- package/dist/types/core/src/utils/headerWidthUtils.d.ts +6 -0
- package/dist/types/core/src/utils/horizontalScrollbarRenderer.d.ts +7 -0
- package/package.json +5 -2
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@angular/core"),o=require("simple-table-core");function t(e,o,t,n){var i,r=arguments.length,p=r<3?o:null===n?n=Object.getOwnPropertyDescriptor(o,t):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)p=Reflect.decorate(e,o,t,n);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(p=(r<3?i(p):r>3?i(o,t,p):i(o,t))||p);return r>3&&p&&Object.defineProperty(o,t,p),p}function n(o,t,n){return i=>{const r=document.createElement("div"),p=e.createComponent(o,{environmentInjector:n,hostElement:r});return Object.assign(p.instance,i),t.attachView(p.hostView),p.changeDetectorRef.detectChanges(),r}}function i(e,o,t){const{defaultHeaders:r,rows:p,footerRenderer:l,emptyStateRenderer:s,errorStateRenderer:d,loadingStateRenderer:a,tableEmptyStateRenderer:m,headerDropdown:h,columnEditorConfig:u,icons:C,rowButtons:c,onColumnOrderChange:v,onColumnWidthChange:S,onHeaderEdit:g,onColumnSelect:b,...y}=e,x=e=>n(e,o,t),R={...y,rows:p,defaultHeaders:r.map(function e(n){const{cellRenderer:r,headerRenderer:p,children:l,nestedTable:s,...d}=n,a={...d};if(r&&(a.cellRenderer=r.ɵcmp?x(r):r),p&&(a.headerRenderer=p.ɵcmp?x(p):p),l&&(a.children=l.map(e)),s){const e={...s,rows:[]};a.nestedTable=i(e,o,t)}return a}),...v?{onColumnOrderChange:e=>v(e)}:{},...S?{onColumnWidthChange:e=>S(e)}:{},...g?{onHeaderEdit:(e,o)=>g(e,o)}:{},...b?{onColumnSelect:e=>b(e)}:{}};return void 0!==l&&(R.footerRenderer=l.ɵcmp?x(l):l),void 0!==s&&(R.emptyStateRenderer=s.ɵcmp?x(s):s),void 0!==d&&(R.errorStateRenderer=d.ɵcmp?x(d):d),void 0!==a&&(R.loadingStateRenderer=a.ɵcmp?x(a):a),void 0!==m&&(R.tableEmptyStateRenderer=m),void 0!==h&&(R.headerDropdown=x(h)),void 0!==u&&(R.columnEditorConfig=function(e){const{rowRenderer:o,customRenderer:t,...n}=e;return{...n,...o?{rowRenderer:x(o)}:{},...t?{customRenderer:x(t)}:{}}}(u)),void 0!==C&&(R.icons=function(e){const o={};for(const[t,n]of Object.entries(e))null!=n&&(o[t]="string"==typeof n||n instanceof HTMLElement||n instanceof SVGSVGElement?n:n.ɵcmp?x(n)({}):n);return o}(C)),void 0!==c&&(R.rowButtons=c.map(e=>x(e))),R}"function"==typeof SuppressedError&&SuppressedError,exports.SimpleTableComponent=class{constructor(){this.tableReady=new e.EventEmitter,this.instance=null,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 o.SimpleTableVanilla(e,i(this.getProps(),this.appRef,this.envInjector)),this.instance.mount(),this.tableReady.emit(this.instance.getAPI()))}ngOnChanges(){this.instance?.update(i(this.getProps(),this.appRef,this.envInjector))}ngOnDestroy(){this.instance?.destroy(),this.instance=null}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}},t([e.Input({required:!0})],exports.SimpleTableComponent.prototype,"rows",void 0),t([e.Input({required:!0})],exports.SimpleTableComponent.prototype,"defaultHeaders",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"footerRenderer",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"loadingStateRenderer",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"errorStateRenderer",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"emptyStateRenderer",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"tableEmptyStateRenderer",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"headerDropdown",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"columnEditorConfig",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onCellClick",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onCellEdit",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onSortChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onFilterChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onRowSelectionChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onRowGroupExpand",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onColumnOrderChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onColumnVisibilityChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onColumnWidthChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onPageChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onLoadMore",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onGridReady",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"rowGrouping",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"enableRowSelection",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"theme",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"quickFilter",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"isLoading",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"getRowId",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"shouldPaginate",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"rowsPerPage",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"serverSidePagination",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"totalRowCount",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"height",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"maxHeight",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"scrollParent",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"infiniteScrollThreshold",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"columnResizing",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"columnReordering",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"editColumns",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"editColumnsInitOpen",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"selectableCells",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"selectableColumns",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"enableHeaderEditing",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onHeaderEdit",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"customTheme",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"icons",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"externalFilterHandling",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"externalSortHandling",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"columnBorders",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"rowButtons",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"hideFooter",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"footerPosition",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"initialSortColumn",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"initialSortDirection",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"expandAll",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"autoExpandColumns",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"animations",void 0),t([e.Output()],exports.SimpleTableComponent.prototype,"tableReady",void 0),exports.SimpleTableComponent=t([e.Component({selector:"simple-table",standalone:!0,template:"<div #host></div>",styles:[":host { display: block; }"]})],exports.SimpleTableComponent),Object.defineProperty(exports,"asRows",{enumerable:!0,get:function(){return o.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,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;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.es.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createComponent as e,Input as o,Output as t,Component as i,EventEmitter as n,inject as r,ElementRef as d,ApplicationRef as s,EnvironmentInjector as l,makeEnvironmentProviders as a}from"@angular/core";import{SimpleTableVanilla as h}from"simple-table-core";export{asRows}from"simple-table-core";function p(e,o,t,i){var n,r=arguments.length,d=r<3?o:null===i?i=Object.getOwnPropertyDescriptor(o,t):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)d=Reflect.decorate(e,o,t,i);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(d=(r<3?n(d):r>3?n(o,t,d):n(o,t))||d);return r>3&&d&&Object.defineProperty(o,t,d),d}function c(o,t,i){return n=>{const r=document.createElement("div"),d=e(o,{environmentInjector:i,hostElement:r});return Object.assign(d.instance,n),t.attachView(d.hostView),d.changeDetectorRef.detectChanges(),r}}function v(e,o,t){const{defaultHeaders:i,rows:n,footerRenderer:r,emptyStateRenderer:d,errorStateRenderer:s,loadingStateRenderer:l,tableEmptyStateRenderer:a,headerDropdown:h,columnEditorConfig:p,icons:u,rowButtons:g,onColumnOrderChange:m,onColumnWidthChange:C,onHeaderEdit:y,onColumnSelect:R,...S}=e,f=e=>c(e,o,t),w={...S,rows:n,defaultHeaders:i.map(function e(i){const{cellRenderer:n,headerRenderer:r,children:d,nestedTable:s,...l}=i,a={...l};if(n&&(a.cellRenderer=n.ɵcmp?f(n):n),r&&(a.headerRenderer=r.ɵcmp?f(r):r),d&&(a.children=d.map(e)),s){const e={...s,rows:[]};a.nestedTable=v(e,o,t)}return a}),...m?{onColumnOrderChange:e=>m(e)}:{},...C?{onColumnWidthChange:e=>C(e)}:{},...y?{onHeaderEdit:(e,o)=>y(e,o)}:{},...R?{onColumnSelect:e=>R(e)}:{}};return void 0!==r&&(w.footerRenderer=r.ɵcmp?f(r):r),void 0!==d&&(w.emptyStateRenderer=d.ɵcmp?f(d):d),void 0!==s&&(w.errorStateRenderer=s.ɵcmp?f(s):s),void 0!==l&&(w.loadingStateRenderer=l.ɵcmp?f(l):l),void 0!==a&&(w.tableEmptyStateRenderer=a),void 0!==h&&(w.headerDropdown=f(h)),void 0!==p&&(w.columnEditorConfig=function(e){const{rowRenderer:o,customRenderer:t,...i}=e;return{...i,...o?{rowRenderer:f(o)}:{},...t?{customRenderer:f(t)}:{}}}(p)),void 0!==u&&(w.icons=function(e){const o={};for(const[t,i]of Object.entries(e))null!=i&&(o[t]="string"==typeof i||i instanceof HTMLElement||i instanceof SVGSVGElement?i:i.ɵcmp?f(i)({}):i);return o}(u)),void 0!==g&&(w.rowButtons=g.map(e=>f(e))),w}"function"==typeof SuppressedError&&SuppressedError;let u=class{constructor(){this.tableReady=new n,this.instance=null,this.hostEl=r(d),this.appRef=r(s),this.envInjector=r(l)}ngOnInit(){const e=this.hostEl.nativeElement.querySelector("div");e&&(this.instance=new h(e,v(this.getProps(),this.appRef,this.envInjector)),this.instance.mount(),this.tableReady.emit(this.instance.getAPI()))}ngOnChanges(){this.instance?.update(v(this.getProps(),this.appRef,this.envInjector))}ngOnDestroy(){this.instance?.destroy(),this.instance=null}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 g(){return a([])}p([o({required:!0})],u.prototype,"rows",void 0),p([o({required:!0})],u.prototype,"defaultHeaders",void 0),p([o()],u.prototype,"footerRenderer",void 0),p([o()],u.prototype,"loadingStateRenderer",void 0),p([o()],u.prototype,"errorStateRenderer",void 0),p([o()],u.prototype,"emptyStateRenderer",void 0),p([o()],u.prototype,"tableEmptyStateRenderer",void 0),p([o()],u.prototype,"headerDropdown",void 0),p([o()],u.prototype,"columnEditorConfig",void 0),p([o()],u.prototype,"onCellClick",void 0),p([o()],u.prototype,"onCellEdit",void 0),p([o()],u.prototype,"onSortChange",void 0),p([o()],u.prototype,"onFilterChange",void 0),p([o()],u.prototype,"onRowSelectionChange",void 0),p([o()],u.prototype,"onRowGroupExpand",void 0),p([o()],u.prototype,"onColumnOrderChange",void 0),p([o()],u.prototype,"onColumnVisibilityChange",void 0),p([o()],u.prototype,"onColumnWidthChange",void 0),p([o()],u.prototype,"onPageChange",void 0),p([o()],u.prototype,"onLoadMore",void 0),p([o()],u.prototype,"onGridReady",void 0),p([o()],u.prototype,"rowGrouping",void 0),p([o()],u.prototype,"enableRowSelection",void 0),p([o()],u.prototype,"theme",void 0),p([o()],u.prototype,"quickFilter",void 0),p([o()],u.prototype,"isLoading",void 0),p([o()],u.prototype,"getRowId",void 0),p([o()],u.prototype,"shouldPaginate",void 0),p([o()],u.prototype,"rowsPerPage",void 0),p([o()],u.prototype,"serverSidePagination",void 0),p([o()],u.prototype,"totalRowCount",void 0),p([o()],u.prototype,"height",void 0),p([o()],u.prototype,"maxHeight",void 0),p([o()],u.prototype,"scrollParent",void 0),p([o()],u.prototype,"infiniteScrollThreshold",void 0),p([o()],u.prototype,"columnResizing",void 0),p([o()],u.prototype,"columnReordering",void 0),p([o()],u.prototype,"editColumns",void 0),p([o()],u.prototype,"editColumnsInitOpen",void 0),p([o()],u.prototype,"selectableCells",void 0),p([o()],u.prototype,"selectableColumns",void 0),p([o()],u.prototype,"enableHeaderEditing",void 0),p([o()],u.prototype,"onHeaderEdit",void 0),p([o()],u.prototype,"customTheme",void 0),p([o()],u.prototype,"icons",void 0),p([o()],u.prototype,"externalFilterHandling",void 0),p([o()],u.prototype,"externalSortHandling",void 0),p([o()],u.prototype,"columnBorders",void 0),p([o()],u.prototype,"rowButtons",void 0),p([o()],u.prototype,"hideFooter",void 0),p([o()],u.prototype,"footerPosition",void 0),p([o()],u.prototype,"initialSortColumn",void 0),p([o()],u.prototype,"initialSortDirection",void 0),p([o()],u.prototype,"expandAll",void 0),p([o()],u.prototype,"autoExpandColumns",void 0),p([o()],u.prototype,"animations",void 0),p([t()],u.prototype,"tableReady",void 0),u=p([i({selector:"simple-table",standalone:!0,template:"<div #host></div>",styles:[":host { display: block; }"]})],u);export{u as SimpleTableComponent,g 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 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};
|
|
2
2
|
//# sourceMappingURL=index.es.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare class MountRegistry {
|
|
2
|
+
private entries;
|
|
3
|
+
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
|
+
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
|
+
disposeHost: (host: HTMLElement) => void;
|
|
14
|
+
/** Dispose every tracked mount (used on table teardown). */
|
|
15
|
+
clear(): void;
|
|
16
|
+
/** Test helper — number of live mounts. */
|
|
17
|
+
get size(): number;
|
|
18
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ApplicationRef, EnvironmentInjector } from "@angular/core";
|
|
2
2
|
import type { SimpleTableConfig } from "simple-table-core";
|
|
3
3
|
import type { SimpleTableAngularProps } from "./types";
|
|
4
|
-
|
|
4
|
+
import type { MountRegistry } from "./MountRegistry";
|
|
5
|
+
export declare function buildVanillaConfig(config: SimpleTableAngularProps, registry: MountRegistry, appRef: ApplicationRef, injector: EnvironmentInjector): SimpleTableConfig;
|
|
@@ -73,6 +73,7 @@ export declare class SimpleTableComponent implements OnInit, OnChanges, OnDestro
|
|
|
73
73
|
/** Emits the TableAPI once the table has mounted. */
|
|
74
74
|
tableReady: EventEmitter<TableAPI>;
|
|
75
75
|
private instance;
|
|
76
|
+
private registry;
|
|
76
77
|
private hostEl;
|
|
77
78
|
private appRef;
|
|
78
79
|
private envInjector;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ApplicationRef, EnvironmentInjector, type Type } from "@angular/core";
|
|
2
|
+
import type { MountRegistry } from "../MountRegistry";
|
|
2
3
|
/**
|
|
3
4
|
* Wraps an Angular standalone component into a function that returns an
|
|
4
5
|
* HTMLElement, matching the vanilla renderer contract expected by
|
|
@@ -9,7 +10,12 @@ import { ApplicationRef, EnvironmentInjector, type Type } from "@angular/core";
|
|
|
9
10
|
* to the change detection tree and trigger a synchronous flush before
|
|
10
11
|
* returning the element to the vanilla rendering pipeline.
|
|
11
12
|
*
|
|
13
|
+
* Pass an optional {@link MountRegistry} so core's `onRendererHostDiscard` can
|
|
14
|
+
* destroy the ComponentRef (including any CDK Overlay / floating UI) when the
|
|
15
|
+
* host is discarded. The table adapter always supplies a registry; the public
|
|
16
|
+
* helper used for one-shot static slots (e.g. `tableEmptyStateRenderer`) may omit it.
|
|
17
|
+
*
|
|
12
18
|
* These are injected automatically when the consumer uses
|
|
13
19
|
* `provideSimpleTable()` in their application providers.
|
|
14
20
|
*/
|
|
15
|
-
export declare function wrapAngularRenderer<P extends object>(component: Type<P>, appRef: ApplicationRef, injector: EnvironmentInjector): (props: Partial<P>) => HTMLElement;
|
|
21
|
+
export declare function wrapAngularRenderer<P extends object>(component: Type<P>, appRef: ApplicationRef, injector: EnvironmentInjector, registry?: MountRegistry): (props: Partial<P>) => HTMLElement;
|
|
@@ -19,3 +19,5 @@ export declare const AUTO_SIZE_OUTLIER_PERCENTILE = 95;
|
|
|
19
19
|
export declare const AUTO_SIZE_OUTLIER_THRESHOLD = 0.5;
|
|
20
20
|
export declare const AUTO_SIZE_MIN_SAMPLE_FOR_CLIP = 20;
|
|
21
21
|
export declare const AUTO_SIZE_WIDTH_BUFFER = 2;
|
|
22
|
+
/** Extra padding reserved around header icons (sort / collapse) during auto-size. */
|
|
23
|
+
export declare const AUTO_SIZE_HEADER_ICON_PADDING = 4;
|
|
@@ -21,12 +21,20 @@ export interface DimensionManagerState {
|
|
|
21
21
|
contentHeight: number | undefined;
|
|
22
22
|
}
|
|
23
23
|
type StateChangeCallback = (state: DimensionManagerState) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Wait this long after the last container-width ResizeObserver tick before
|
|
26
|
+
* notifying subscribers. Coalesces CSS-transition / animated layout shifts
|
|
27
|
+
* (e.g. a collapsible nav) into a single trailing update instead of one full
|
|
28
|
+
* table render per animation frame.
|
|
29
|
+
*/
|
|
30
|
+
export declare const CONTAINER_RESIZE_NOTIFY_DEBOUNCE_MS = 50;
|
|
24
31
|
export declare class DimensionManager {
|
|
25
32
|
private config;
|
|
26
33
|
private state;
|
|
27
34
|
private subscribers;
|
|
28
35
|
private resizeObserver;
|
|
29
36
|
private rafId;
|
|
37
|
+
private resizeNotifyDebounceId;
|
|
30
38
|
/** Set when applyContainerWidthSync updates state before any subscriber exists. */
|
|
31
39
|
private initialNotifyPending;
|
|
32
40
|
constructor(config: DimensionManagerConfig);
|
|
@@ -35,6 +43,9 @@ export declare class DimensionManager {
|
|
|
35
43
|
private calculateHeaderHeight;
|
|
36
44
|
private convertHeightToPixels;
|
|
37
45
|
private calculateContentHeight;
|
|
46
|
+
private cancelPendingResizeNotify;
|
|
47
|
+
/** Trailing debounce for animated / continuous container resizes. */
|
|
48
|
+
private scheduleResizeNotify;
|
|
38
49
|
private observeContainer;
|
|
39
50
|
private applyContainerWidthSync;
|
|
40
51
|
updateConfig(config: Partial<DimensionManagerConfig>): void;
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The animation coordinator runs FLIP-style transitions when cells move between
|
|
5
5
|
* positions. All fields are optional; omit the prop entirely to use defaults.
|
|
6
|
+
*
|
|
7
|
+
* Row group expand/collapse never animates when `rowGrouping` is configured.
|
|
6
8
|
*/
|
|
7
9
|
export interface AnimationsConfig {
|
|
8
10
|
/** Master toggle. Defaults to `true`. When `false`, no other field has effect. */
|
|
@@ -2,6 +2,8 @@ import { AbsoluteBodyCell, CellRegistryEntry, CellRenderContext } from "./types"
|
|
|
2
2
|
import { CellLiveRef, cellLiveRefMap } from "./cellLiveRef";
|
|
3
3
|
export { cellLiveRefMap };
|
|
4
4
|
export type { CellLiveRef };
|
|
5
|
+
/** Drop the content memo so the next `updateBodyCellElement` rebuilds. */
|
|
6
|
+
export declare const invalidateBodyCellContentMemo: (cellElement: HTMLElement) => void;
|
|
5
7
|
export declare const untrackCellByRow: (rowId: string, cellElement: HTMLElement) => void;
|
|
6
8
|
export declare const unregisterCellFromRegistry: (cellElement: HTMLElement, cellRegistry?: Map<string, CellRegistryEntry>) => void;
|
|
7
9
|
export declare const createBodyCellElement: (cell: AbsoluteBodyCell, context: CellRenderContext) => HTMLElement;
|
|
@@ -25,4 +25,4 @@ export declare const addTrackedEventListener: (element: HTMLElement, event: stri
|
|
|
25
25
|
/** Header tooltips are portaled under .simple-table-root; remove them when header DOM is torn down
|
|
26
26
|
* without pointer leave (e.g. sort/filter invalidates context cache and removes header cells). */
|
|
27
27
|
export declare const removeFloatingHeaderTooltips: (fromElement: HTMLElement) => void;
|
|
28
|
-
export declare const cleanupHeaderCellRendering: (container?: HTMLElement) => void;
|
|
28
|
+
export declare const cleanupHeaderCellRendering: (container?: HTMLElement, onHostDiscard?: (host: HTMLElement) => void) => void;
|
|
@@ -96,5 +96,11 @@ export interface HeaderRenderContext {
|
|
|
96
96
|
* driving the unfold animation.
|
|
97
97
|
*/
|
|
98
98
|
animationCoordinator?: AnimationCoordinator;
|
|
99
|
+
/**
|
|
100
|
+
* Called immediately before a header host (or its label content) is permanently
|
|
101
|
+
* discarded so adapters can tear down renderer subtrees (e.g. React portals).
|
|
102
|
+
* Mirrors {@link CellRenderContext.onRendererHostDiscard}.
|
|
103
|
+
*/
|
|
104
|
+
onRendererHostDiscard?: (host: HTMLElement) => void;
|
|
99
105
|
}
|
|
100
106
|
export {};
|
|
@@ -96,4 +96,10 @@ export declare const calculateHeaderContentWidth: (accessor: Accessor, options?:
|
|
|
96
96
|
* column), so sorting later does not push the label into ellipsis.
|
|
97
97
|
*/
|
|
98
98
|
sortIcon?: string | HTMLElement | SVGSVGElement;
|
|
99
|
+
/**
|
|
100
|
+
* The table's resolved expand/collapse icon. Used to reserve space on
|
|
101
|
+
* collapsible headers when the header cell is virtualized out of the
|
|
102
|
+
* horizontal band (so the icon is not in the DOM to measure directly).
|
|
103
|
+
*/
|
|
104
|
+
expandIcon?: string | HTMLElement | SVGSVGElement;
|
|
99
105
|
}) => number;
|
|
@@ -9,6 +9,13 @@ export interface HorizontalScrollbarProps {
|
|
|
9
9
|
tableBodyContainerRef: HTMLDivElement;
|
|
10
10
|
editColumns: boolean;
|
|
11
11
|
sectionScrollController?: SectionScrollController | null;
|
|
12
|
+
/**
|
|
13
|
+
* When true, skip the DOM scrollWidth check and always build the scrollbar.
|
|
14
|
+
* Used after the caller has already verified content overflow (e.g. empty
|
|
15
|
+
* tables where the header scrollport is sized to content and reports no
|
|
16
|
+
* DOM overflow even though columns exceed the viewport).
|
|
17
|
+
*/
|
|
18
|
+
forceScrollable?: boolean;
|
|
12
19
|
}
|
|
13
20
|
export declare const createHorizontalScrollbar: (props: HorizontalScrollbarProps) => HTMLElement | null;
|
|
14
21
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simple-table/angular",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.2",
|
|
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.
|
|
33
|
+
"simple-table-core": "3.9.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@angular/common": "^20.0.0",
|
|
@@ -40,12 +40,14 @@
|
|
|
40
40
|
"@rollup/plugin-alias": "4.0.0",
|
|
41
41
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
42
42
|
"@types/node": "^16.18.126",
|
|
43
|
+
"jsdom": "^24.1.3",
|
|
43
44
|
"rollup": "^2.79.2",
|
|
44
45
|
"rollup-plugin-delete": "^2.1.0",
|
|
45
46
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
46
47
|
"rollup-plugin-terser": "^7.0.2",
|
|
47
48
|
"rollup-plugin-typescript2": "^0.37.0",
|
|
48
49
|
"typescript": "^5.9.0",
|
|
50
|
+
"vitest": "^2.1.9",
|
|
49
51
|
"zone.js": "^0.15.0"
|
|
50
52
|
},
|
|
51
53
|
"description": "Angular adapter for simple-table-core — use the Simple Table data grid with full Angular component support for renderers.",
|
|
@@ -96,6 +98,7 @@
|
|
|
96
98
|
"scripts": {
|
|
97
99
|
"build": "rollup -c",
|
|
98
100
|
"preview": "rollup -c -w",
|
|
101
|
+
"test": "vitest run",
|
|
99
102
|
"version:patch": "npm version patch && git push && git push --tags",
|
|
100
103
|
"version:minor": "npm version minor && git push && git push --tags",
|
|
101
104
|
"version:major": "npm version major && git push && git push --tags"
|