@simple-table/angular 4.0.3 → 4.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/types/buildVanillaConfig.d.ts +4 -4
- package/dist/types/index.d.ts +2 -2
- package/dist/types/lib/SimpleTableComponent.d.ts +0 -9
- package/dist/types/types.d.ts +13 -20
- package/dist/types/utils/wrapAngularRenderer.d.ts +1 -1
- package/package.json +2 -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,s=r<3?o:null===n?n=Object.getOwnPropertyDescriptor(o,t):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,o,t,n);else for(var p=e.length-1;p>=0;p--)(i=e[p])&&(s=(r<3?i(s):r>3?i(o,t,s):i(o,t))||s);return r>3&&s&&Object.defineProperty(o,t,s),s}function n(o,t,n,i){return r=>{const s=document.createElement("div"),p=e.createComponent(o,{environmentInjector:n,hostElement:s});return Object.assign(p.instance,r),t.attachView(p.hostView),p.changeDetectorRef.detectChanges(),i?.register(s,()=>{t.detachView(p.hostView),p.destroy()}),s}}function i(o,t,n,i,r,s){const p="cell"===s?i.cellRendererCache:i.headerRendererCache,l=p.get(r);if(l)return l.component=o,l.wrapped;const d={component:o,wrapped:null},a=o=>{const r=document.createElement("div"),s=e.createComponent(d.component,{environmentInjector:n,hostElement:r});return Object.assign(s.instance,o),t.attachView(s.hostView),s.changeDetectorRef.detectChanges(),i.register(r,()=>{t.detachView(s.hostView),s.destroy()}),r};return d.wrapped=a,p.set(r,d),a}function r(e){const o=e.columns??e.defaultHeaders;if(!o)throw new Error("SimpleTable requires `columns` or `defaultHeaders`");return o}function s(e,t,p,l){const{defaultHeaders:d,columns:a,rows:u,footerRenderer:h,emptyStateRenderer:m,errorStateRenderer:c,loadingStateRenderer:C,tableEmptyStateRenderer:v,headerDropdown:g,columnEditorConfig:b,icons:S,rowButtons:R,onColumnOrderChange:y,onColumnWidthChange:I,onHeaderEdit:x,onColumnSelect:w,enableColumnEditor:T,editColumns:f,enableColumnEditorInitOpen:E,editColumnsInitOpen:P,enablePagination:O,shouldPaginate:H,onTableReady:B,onGridReady:k,hoverRowBackground:A,useHoverRowBackground:V,oddColumnBackground:j,useOddColumnBackground:D,oddEvenRowBackground:_,useOddEvenRowBackground:L,...F}=e,G=e=>n(e,p,l,t),q=r(e);t.pruneRendererCaches(o.collectHeaderAccessors(q));const z={...F,rows:u,defaultHeaders:q.map(function e(o){const{cellRenderer:n,headerRenderer:r,children:d,nestedTable:a,...u}=o,h=String(o.accessor),m={...u};if(n&&(m.cellRenderer=n.ɵcmp?i(n,p,l,t,h,"cell"):n),r&&(m.headerRenderer=r.ɵcmp?i(r,p,l,t,h,"header"):r),d&&(m.children=d.map(e)),a){const e={...a,rows:[]};m.nestedTable=s(e,t,p,l)}return m}),editColumns:T??f,editColumnsInitOpen:E??P,shouldPaginate:O??H,onGridReady:B??k,useHoverRowBackground:A??V,useOddColumnBackground:j??D,useOddEvenRowBackground:_??L,onRendererHostDiscard:t.disposeHost,...y?{onColumnOrderChange:e=>y(e)}:{},...I?{onColumnWidthChange:e=>I(e)}:{},...x?{onHeaderEdit:(e,o)=>x(e,o)}:{},...w?{onColumnSelect:e=>w(e)}:{}};return void 0!==h&&(z.footerRenderer=h.ɵcmp?G(h):h),void 0!==m&&(z.emptyStateRenderer=m.ɵcmp?G(m):m),void 0!==c&&(z.errorStateRenderer=c.ɵcmp?G(c):c),void 0!==C&&(z.loadingStateRenderer=C.ɵcmp?G(C):C),void 0!==v&&(z.tableEmptyStateRenderer=v),void 0!==g&&(z.headerDropdown=G(g)),void 0!==b&&(z.columnEditorConfig=function(e){const{rowRenderer:o,customRenderer:t,...n}=e;return{...n,...o?{rowRenderer:G(o)}:{},...t?{customRenderer:G(t)}:{}}}(b)),void 0!==S&&(z.icons=function(e){const o={};for(const[t,n]of Object.entries(e))null!=n&&(o[t]="string"==typeof n||n instanceof HTMLElement||n instanceof SVGSVGElement?n:n.ɵcmp?G(n)({}):n);return o}(S)),void 0!==R&&(z.rowButtons=R.map(e=>G(e))),z}"function"==typeof SuppressedError&&SuppressedError;const p="data-st-mount-id";class l{constructor(){this.entries=new Map,this.nextId=0,this.cellRendererCache=new Map,this.headerRendererCache=new Map,this.disposeHost=e=>{if("function"!=typeof e.getAttribute)return;const o=[],t=e.getAttribute(p);null!==t&&o.push(t),e.querySelectorAll(`[${p}]`).forEach(e=>{const t=e.getAttribute(p);null!==t&&o.push(t)});for(const e of o){const o=this.entries.get(e);o&&(this.entries.delete(e),o())}}}register(e,o){const t="st-mount-"+this.nextId++;e.setAttribute(p,t),this.entries.set(t,o)}clear(){this.cellRendererCache.clear(),this.headerRendererCache.clear();for(const e of this.entries.values())e();this.entries.clear()}pruneRendererCaches(e){for(const o of this.cellRendererCache.keys())e.has(o)||this.cellRendererCache.delete(o);for(const o of this.headerRendererCache.keys())e.has(o)||this.headerRendererCache.delete(o)}get size(){return this.entries.size}}exports.SimpleTableComponent=class{constructor(){this.tableReady=new e.EventEmitter,this.instance=null,this.registry=new l,this.hostEl=e.inject(e.ElementRef),this.appRef=e.inject(e.ApplicationRef),this.envInjector=e.inject(e.EnvironmentInjector)}ngOnInit(){const e=this.hostEl.nativeElement.querySelector("div");if(!e)return;const t=this.getProps();this.instance=new o.SimpleTableVanilla(e,s(t,this.registry,this.appRef,this.envInjector)),this.instance.mount(),this.syncedDefaultHeaders=r(t),this.syncedRows=t.rows,this.tableReady.emit(this.instance.getAPI())}ngOnChanges(){if(!this.instance)return;const e=this.getProps(),t={...s(e,this.registry,this.appRef,this.envInjector)},n=r(e),i=o.headersStructurallyEqual(this.syncedDefaultHeaders,n);this.syncedDefaultHeaders=n,i&&delete t.defaultHeaders;const p=o.rowsShallowUnchanged(this.syncedRows,e.rows,e.getRowId);this.syncedRows=e.rows,p&&delete t.rows,this.instance.update(t)}ngOnDestroy(){this.instance?.destroy(),this.instance=null,this.syncedDefaultHeaders=void 0,this.syncedRows=void 0,this.registry.clear()}getAPI(){return this.instance?.getAPI()??null}getProps(){const e={rows:this.rows};return void 0!==this.defaultHeaders&&(e.defaultHeaders=this.defaultHeaders),void 0!==this.columns&&(e.columns=this.columns),void 0!==this.footerRenderer&&(e.footerRenderer=this.footerRenderer),void 0!==this.loadingStateRenderer&&(e.loadingStateRenderer=this.loadingStateRenderer),void 0!==this.errorStateRenderer&&(e.errorStateRenderer=this.errorStateRenderer),void 0!==this.emptyStateRenderer&&(e.emptyStateRenderer=this.emptyStateRenderer),void 0!==this.tableEmptyStateRenderer&&(e.tableEmptyStateRenderer=this.tableEmptyStateRenderer),void 0!==this.headerDropdown&&(e.headerDropdown=this.headerDropdown),void 0!==this.columnEditorConfig&&(e.columnEditorConfig=this.columnEditorConfig),void 0!==this.onCellClick&&(e.onCellClick=this.onCellClick),void 0!==this.onCellEdit&&(e.onCellEdit=this.onCellEdit),void 0!==this.onSortChange&&(e.onSortChange=this.onSortChange),void 0!==this.onFilterChange&&(e.onFilterChange=this.onFilterChange),void 0!==this.onRowSelectionChange&&(e.onRowSelectionChange=this.onRowSelectionChange),void 0!==this.onRowGroupExpand&&(e.onRowGroupExpand=this.onRowGroupExpand),void 0!==this.onColumnOrderChange&&(e.onColumnOrderChange=this.onColumnOrderChange),void 0!==this.onColumnVisibilityChange&&(e.onColumnVisibilityChange=this.onColumnVisibilityChange),void 0!==this.onColumnWidthChange&&(e.onColumnWidthChange=this.onColumnWidthChange),void 0!==this.onPageChange&&(e.onPageChange=this.onPageChange),void 0!==this.onLoadMore&&(e.onLoadMore=this.onLoadMore),void 0!==this.onGridReady&&(e.onGridReady=this.onGridReady),void 0!==this.onTableReady&&(e.onTableReady=this.onTableReady),void 0!==this.rowGrouping&&(e.rowGrouping=this.rowGrouping),void 0!==this.pivot&&(e.pivot=this.pivot),void 0!==this.onPivotChange&&(e.onPivotChange=this.onPivotChange),void 0!==this.enableRowSelection&&(e.enableRowSelection=this.enableRowSelection),void 0!==this.theme&&(e.theme=this.theme),void 0!==this.quickFilter&&(e.quickFilter=this.quickFilter),void 0!==this.isLoading&&(e.isLoading=this.isLoading),void 0!==this.getRowId&&(e.getRowId=this.getRowId),void 0!==this.shouldPaginate&&(e.shouldPaginate=this.shouldPaginate),void 0!==this.enablePagination&&(e.enablePagination=this.enablePagination),void 0!==this.rowsPerPage&&(e.rowsPerPage=this.rowsPerPage),void 0!==this.serverSidePagination&&(e.serverSidePagination=this.serverSidePagination),void 0!==this.totalRowCount&&(e.totalRowCount=this.totalRowCount),void 0!==this.height&&(e.height=this.height),void 0!==this.maxHeight&&(e.maxHeight=this.maxHeight),void 0!==this.scrollParent&&(e.scrollParent=this.scrollParent),void 0!==this.infiniteScrollThreshold&&(e.infiniteScrollThreshold=this.infiniteScrollThreshold),void 0!==this.columnResizing&&(e.columnResizing=this.columnResizing),void 0!==this.columnReordering&&(e.columnReordering=this.columnReordering),void 0!==this.editColumns&&(e.editColumns=this.editColumns),void 0!==this.enableColumnEditor&&(e.enableColumnEditor=this.enableColumnEditor),void 0!==this.editColumnsInitOpen&&(e.editColumnsInitOpen=this.editColumnsInitOpen),void 0!==this.enableColumnEditorInitOpen&&(e.enableColumnEditorInitOpen=this.enableColumnEditorInitOpen),void 0!==this.selectableCells&&(e.selectableCells=this.selectableCells),void 0!==this.selectableColumns&&(e.selectableColumns=this.selectableColumns),void 0!==this.enableHeaderEditing&&(e.enableHeaderEditing=this.enableHeaderEditing),void 0!==this.onHeaderEdit&&(e.onHeaderEdit=this.onHeaderEdit),void 0!==this.customTheme&&(e.customTheme=this.customTheme),void 0!==this.icons&&(e.icons=this.icons),void 0!==this.externalFilterHandling&&(e.externalFilterHandling=this.externalFilterHandling),void 0!==this.externalSortHandling&&(e.externalSortHandling=this.externalSortHandling),void 0!==this.columnBorders&&(e.columnBorders=this.columnBorders),void 0!==this.rowButtons&&(e.rowButtons=this.rowButtons),void 0!==this.hideFooter&&(e.hideFooter=this.hideFooter),void 0!==this.footerPosition&&(e.footerPosition=this.footerPosition),void 0!==this.initialSortColumn&&(e.initialSortColumn=this.initialSortColumn),void 0!==this.initialSortDirection&&(e.initialSortDirection=this.initialSortDirection),void 0!==this.expandAll&&(e.expandAll=this.expandAll),void 0!==this.autoExpandColumns&&(e.autoExpandColumns=this.autoExpandColumns),void 0!==this.animations&&(e.animations=this.animations),void 0!==this.enableVirtualization&&(e.enableVirtualization=this.enableVirtualization),void 0!==this.hoverRowBackground&&(e.hoverRowBackground=this.hoverRowBackground),void 0!==this.useHoverRowBackground&&(e.useHoverRowBackground=this.useHoverRowBackground),void 0!==this.oddColumnBackground&&(e.oddColumnBackground=this.oddColumnBackground),void 0!==this.useOddColumnBackground&&(e.useOddColumnBackground=this.useOddColumnBackground),void 0!==this.oddEvenRowBackground&&(e.oddEvenRowBackground=this.oddEvenRowBackground),void 0!==this.useOddEvenRowBackground&&(e.useOddEvenRowBackground=this.useOddEvenRowBackground),e}},t([e.Input({required:!0})],exports.SimpleTableComponent.prototype,"rows",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"defaultHeaders",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"columns",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"footerRenderer",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"loadingStateRenderer",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"errorStateRenderer",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"emptyStateRenderer",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"tableEmptyStateRenderer",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"headerDropdown",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"columnEditorConfig",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onCellClick",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onCellEdit",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onSortChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onFilterChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onRowSelectionChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onRowGroupExpand",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onColumnOrderChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onColumnVisibilityChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onColumnWidthChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onPageChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onLoadMore",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onGridReady",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onTableReady",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"rowGrouping",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"pivot",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onPivotChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"enableRowSelection",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"theme",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"quickFilter",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"isLoading",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"getRowId",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"shouldPaginate",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"enablePagination",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"rowsPerPage",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"serverSidePagination",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"totalRowCount",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"height",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"maxHeight",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"scrollParent",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"infiniteScrollThreshold",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"columnResizing",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"columnReordering",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"editColumns",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"enableColumnEditor",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"editColumnsInitOpen",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"enableColumnEditorInitOpen",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"selectableCells",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"selectableColumns",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"enableHeaderEditing",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onHeaderEdit",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"customTheme",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"icons",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"externalFilterHandling",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"externalSortHandling",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"columnBorders",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"rowButtons",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"hideFooter",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"footerPosition",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"initialSortColumn",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"initialSortDirection",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"expandAll",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"autoExpandColumns",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"animations",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"enableVirtualization",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"hoverRowBackground",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"useHoverRowBackground",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"oddColumnBackground",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"useOddColumnBackground",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"oddEvenRowBackground",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"useOddEvenRowBackground",void 0),t([e.Output()],exports.SimpleTableComponent.prototype,"tableReady",void 0),exports.SimpleTableComponent=t([e.Component({selector:"simple-table",standalone:!0,template:"<div #host></div>",styles:[":host { display: block; }"]})],exports.SimpleTableComponent),Object.defineProperty(exports,"PIVOT_ACCESSOR_PREFIX",{enumerable:!0,get:function(){return o.PIVOT_ACCESSOR_PREFIX}}),Object.defineProperty(exports,"PIVOT_BLANK_LABEL",{enumerable:!0,get:function(){return o.PIVOT_BLANK_LABEL}}),Object.defineProperty(exports,"PIVOT_CHILDREN_KEY",{enumerable:!0,get:function(){return o.PIVOT_CHILDREN_KEY}}),Object.defineProperty(exports,"PIVOT_IS_TOTAL_KEY",{enumerable:!0,get:function(){return o.PIVOT_IS_TOTAL_KEY}}),Object.defineProperty(exports,"asRows",{enumerable:!0,get:function(){return o.asRows}}),Object.defineProperty(exports,"buildPivotAccessor",{enumerable:!0,get:function(){return o.buildPivotAccessor}}),Object.defineProperty(exports,"buildPivotRowTotalAccessor",{enumerable:!0,get:function(){return o.buildPivotRowTotalAccessor}}),Object.defineProperty(exports,"pivotRows",{enumerable:!0,get:function(){return o.pivotRows}}),exports.provideSimpleTable=function(){return e.makeEnvironmentProviders([])},exports.wrapAngularRenderer=n;
|
|
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 s=e.length-1;s>=0;s--)(i=e[s])&&(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,i){return r=>{const p=document.createElement("div"),s=e.createComponent(o,{environmentInjector:n,hostElement:p});return Object.assign(s.instance,r),t.attachView(s.hostView),s.changeDetectorRef.detectChanges(),i?.register(p,()=>{t.detachView(s.hostView),s.destroy()}),p}}function i(o,t,n,i,r,p){const s="cell"===p?i.cellRendererCache:i.headerRendererCache,l=s.get(r);if(l)return l.component=o,l.wrapped;const a={component:o,wrapped:null},d=o=>{const r=document.createElement("div"),p=e.createComponent(a.component,{environmentInjector:n,hostElement:r});return Object.assign(p.instance,o),t.attachView(p.hostView),p.changeDetectorRef.detectChanges(),i.register(r,()=>{t.detachView(p.hostView),p.destroy()}),r};return a.wrapped=d,s.set(r,a),d}function r(e){const o=e.columns;if(!o)throw new Error("SimpleTable requires `columns`");return o}function p(e,t,s,l){const{columns:a,rows:d,footerRenderer:h,emptyStateRenderer:u,errorStateRenderer:m,loadingStateRenderer:c,tableEmptyStateRenderer:C,headerDropdown:v,columnEditorConfig:g,icons:b,rowButtons:S,onColumnOrderChange:R,onColumnWidthChange:y,onHeaderEdit:w,onColumnSelect:x,enableColumnEditor:I,enableColumnEditorInitOpen:T,enablePagination:f,onTableReady:E,hoverRowBackground:P,oddColumnBackground:O,oddEvenRowBackground:B,...k}=e,H=e=>n(e,s,l,t),A=r(e);t.pruneRendererCaches(o.collectHeaderAccessors(A));const V={...k,rows:d,columns:A.map(function e(o){const{cellRenderer:n,headerRenderer:r,children:a,nestedTable:d,...h}=o,u=String(o.accessor),m={...h};if(n&&(m.cellRenderer=n.ɵcmp?i(n,s,l,t,u,"cell"):n),r&&(m.headerRenderer=r.ɵcmp?i(r,s,l,t,u,"header"):r),a&&(m.children=a.map(e)),d){const e={...d,rows:[]};m.nestedTable=p(e,t,s,l)}return m}),enableColumnEditor:I,enableColumnEditorInitOpen:T,enablePagination:f,onTableReady:E,hoverRowBackground:P,oddColumnBackground:O,oddEvenRowBackground:B,onRendererHostDiscard:t.disposeHost,...R?{onColumnOrderChange:e=>R(e)}:{},...y?{onColumnWidthChange:e=>y(e)}:{},...w?{onHeaderEdit:(e,o)=>w(e,o)}:{},...x?{onColumnSelect:e=>x(e)}:{}};return void 0!==h&&(V.footerRenderer=h.ɵcmp?H(h):h),void 0!==u&&(V.emptyStateRenderer=u.ɵcmp?H(u):u),void 0!==m&&(V.errorStateRenderer=m.ɵcmp?H(m):m),void 0!==c&&(V.loadingStateRenderer=c.ɵcmp?H(c):c),void 0!==C&&(V.tableEmptyStateRenderer=C),void 0!==v&&(V.headerDropdown=H(v)),void 0!==g&&(V.columnEditorConfig=function(e){const{rowRenderer:o,customRenderer:t,...n}=e;return{...n,...o?{rowRenderer:H(o)}:{},...t?{customRenderer:H(t)}:{}}}(g)),void 0!==b&&(V.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?H(n)({}):n);return o}(b)),void 0!==S&&(V.rowButtons=S.map(e=>H(e))),V}"function"==typeof SuppressedError&&SuppressedError;const s="data-st-mount-id";class l{constructor(){this.entries=new Map,this.nextId=0,this.cellRendererCache=new Map,this.headerRendererCache=new Map,this.disposeHost=e=>{if("function"!=typeof e.getAttribute)return;const o=[],t=e.getAttribute(s);null!==t&&o.push(t),e.querySelectorAll(`[${s}]`).forEach(e=>{const t=e.getAttribute(s);null!==t&&o.push(t)});for(const e of o){const o=this.entries.get(e);o&&(this.entries.delete(e),o())}}}register(e,o){const t="st-mount-"+this.nextId++;e.setAttribute(s,t),this.entries.set(t,o)}clear(){this.cellRendererCache.clear(),this.headerRendererCache.clear();for(const e of this.entries.values())e();this.entries.clear()}pruneRendererCaches(e){for(const o of this.cellRendererCache.keys())e.has(o)||this.cellRendererCache.delete(o);for(const o of this.headerRendererCache.keys())e.has(o)||this.headerRendererCache.delete(o)}get size(){return this.entries.size}}exports.SimpleTableComponent=class{constructor(){this.tableReady=new e.EventEmitter,this.instance=null,this.registry=new l,this.hostEl=e.inject(e.ElementRef),this.appRef=e.inject(e.ApplicationRef),this.envInjector=e.inject(e.EnvironmentInjector)}ngOnInit(){const e=this.hostEl.nativeElement.querySelector("div");if(!e)return;const t=this.getProps();this.instance=new o.SimpleTableVanilla(e,p(t,this.registry,this.appRef,this.envInjector)),this.instance.mount(),this.syncedDefaultHeaders=r(t),this.syncedRows=t.rows,this.tableReady.emit(this.instance.getAPI())}ngOnChanges(){if(!this.instance)return;const e=this.getProps(),t={...p(e,this.registry,this.appRef,this.envInjector)},n=r(e),i=o.headersStructurallyEqual(this.syncedDefaultHeaders,n);this.syncedDefaultHeaders=n,i&&delete t.columns;const s=o.rowsShallowUnchanged(this.syncedRows,e.rows,e.getRowId);this.syncedRows=e.rows,s&&delete t.rows,this.instance.update(t)}ngOnDestroy(){this.instance?.destroy(),this.instance=null,this.syncedDefaultHeaders=void 0,this.syncedRows=void 0,this.registry.clear()}getAPI(){return this.instance?.getAPI()??null}getProps(){const e={rows:this.rows};return void 0!==this.columns&&(e.columns=this.columns),void 0!==this.footerRenderer&&(e.footerRenderer=this.footerRenderer),void 0!==this.loadingStateRenderer&&(e.loadingStateRenderer=this.loadingStateRenderer),void 0!==this.errorStateRenderer&&(e.errorStateRenderer=this.errorStateRenderer),void 0!==this.emptyStateRenderer&&(e.emptyStateRenderer=this.emptyStateRenderer),void 0!==this.tableEmptyStateRenderer&&(e.tableEmptyStateRenderer=this.tableEmptyStateRenderer),void 0!==this.headerDropdown&&(e.headerDropdown=this.headerDropdown),void 0!==this.columnEditorConfig&&(e.columnEditorConfig=this.columnEditorConfig),void 0!==this.onCellClick&&(e.onCellClick=this.onCellClick),void 0!==this.onCellEdit&&(e.onCellEdit=this.onCellEdit),void 0!==this.onSortChange&&(e.onSortChange=this.onSortChange),void 0!==this.onFilterChange&&(e.onFilterChange=this.onFilterChange),void 0!==this.onRowSelectionChange&&(e.onRowSelectionChange=this.onRowSelectionChange),void 0!==this.onRowGroupExpand&&(e.onRowGroupExpand=this.onRowGroupExpand),void 0!==this.onColumnOrderChange&&(e.onColumnOrderChange=this.onColumnOrderChange),void 0!==this.onColumnVisibilityChange&&(e.onColumnVisibilityChange=this.onColumnVisibilityChange),void 0!==this.onColumnWidthChange&&(e.onColumnWidthChange=this.onColumnWidthChange),void 0!==this.onPageChange&&(e.onPageChange=this.onPageChange),void 0!==this.onLoadMore&&(e.onLoadMore=this.onLoadMore),void 0!==this.onTableReady&&(e.onTableReady=this.onTableReady),void 0!==this.rowGrouping&&(e.rowGrouping=this.rowGrouping),void 0!==this.pivot&&(e.pivot=this.pivot),void 0!==this.onPivotChange&&(e.onPivotChange=this.onPivotChange),void 0!==this.enableRowSelection&&(e.enableRowSelection=this.enableRowSelection),void 0!==this.theme&&(e.theme=this.theme),void 0!==this.quickFilter&&(e.quickFilter=this.quickFilter),void 0!==this.isLoading&&(e.isLoading=this.isLoading),void 0!==this.getRowId&&(e.getRowId=this.getRowId),void 0!==this.enablePagination&&(e.enablePagination=this.enablePagination),void 0!==this.rowsPerPage&&(e.rowsPerPage=this.rowsPerPage),void 0!==this.serverSidePagination&&(e.serverSidePagination=this.serverSidePagination),void 0!==this.totalRowCount&&(e.totalRowCount=this.totalRowCount),void 0!==this.height&&(e.height=this.height),void 0!==this.maxHeight&&(e.maxHeight=this.maxHeight),void 0!==this.scrollParent&&(e.scrollParent=this.scrollParent),void 0!==this.infiniteScrollThreshold&&(e.infiniteScrollThreshold=this.infiniteScrollThreshold),void 0!==this.columnResizing&&(e.columnResizing=this.columnResizing),void 0!==this.columnReordering&&(e.columnReordering=this.columnReordering),void 0!==this.enableColumnEditor&&(e.enableColumnEditor=this.enableColumnEditor),void 0!==this.enableColumnEditorInitOpen&&(e.enableColumnEditorInitOpen=this.enableColumnEditorInitOpen),void 0!==this.enableColumnEditorInitOpen&&(e.enableColumnEditorInitOpen=this.enableColumnEditorInitOpen),void 0!==this.selectableCells&&(e.selectableCells=this.selectableCells),void 0!==this.selectableColumns&&(e.selectableColumns=this.selectableColumns),void 0!==this.enableHeaderEditing&&(e.enableHeaderEditing=this.enableHeaderEditing),void 0!==this.onHeaderEdit&&(e.onHeaderEdit=this.onHeaderEdit),void 0!==this.customTheme&&(e.customTheme=this.customTheme),void 0!==this.icons&&(e.icons=this.icons),void 0!==this.externalFilterHandling&&(e.externalFilterHandling=this.externalFilterHandling),void 0!==this.externalSortHandling&&(e.externalSortHandling=this.externalSortHandling),void 0!==this.columnBorders&&(e.columnBorders=this.columnBorders),void 0!==this.rowButtons&&(e.rowButtons=this.rowButtons),void 0!==this.hideFooter&&(e.hideFooter=this.hideFooter),void 0!==this.footerPosition&&(e.footerPosition=this.footerPosition),void 0!==this.initialSortColumn&&(e.initialSortColumn=this.initialSortColumn),void 0!==this.initialSortDirection&&(e.initialSortDirection=this.initialSortDirection),void 0!==this.expandAll&&(e.expandAll=this.expandAll),void 0!==this.autoExpandColumns&&(e.autoExpandColumns=this.autoExpandColumns),void 0!==this.animations&&(e.animations=this.animations),void 0!==this.enableVirtualization&&(e.enableVirtualization=this.enableVirtualization),void 0!==this.hoverRowBackground&&(e.hoverRowBackground=this.hoverRowBackground),void 0!==this.hoverRowBackground&&(e.hoverRowBackground=this.hoverRowBackground),void 0!==this.oddColumnBackground&&(e.oddColumnBackground=this.oddColumnBackground),void 0!==this.oddColumnBackground&&(e.oddColumnBackground=this.oddColumnBackground),void 0!==this.oddEvenRowBackground&&(e.oddEvenRowBackground=this.oddEvenRowBackground),void 0!==this.oddEvenRowBackground&&(e.oddEvenRowBackground=this.oddEvenRowBackground),e}},t([e.Input({required:!0})],exports.SimpleTableComponent.prototype,"rows",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"columns",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"footerRenderer",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"loadingStateRenderer",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"errorStateRenderer",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"emptyStateRenderer",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"tableEmptyStateRenderer",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"headerDropdown",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"columnEditorConfig",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onCellClick",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onCellEdit",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onSortChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onFilterChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onRowSelectionChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onRowGroupExpand",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onColumnOrderChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onColumnVisibilityChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onColumnWidthChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onPageChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onLoadMore",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onTableReady",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"rowGrouping",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"pivot",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onPivotChange",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"enableRowSelection",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"theme",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"quickFilter",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"isLoading",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"getRowId",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"enablePagination",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"rowsPerPage",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"serverSidePagination",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"totalRowCount",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"height",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"maxHeight",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"scrollParent",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"infiniteScrollThreshold",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"columnResizing",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"columnReordering",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"enableColumnEditor",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"enableColumnEditorInitOpen",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"selectableCells",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"selectableColumns",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"enableHeaderEditing",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"onHeaderEdit",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"customTheme",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"icons",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"externalFilterHandling",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"externalSortHandling",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"columnBorders",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"rowButtons",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"hideFooter",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"footerPosition",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"initialSortColumn",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"initialSortDirection",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"expandAll",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"autoExpandColumns",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"animations",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"enableVirtualization",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"hoverRowBackground",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"oddColumnBackground",void 0),t([e.Input()],exports.SimpleTableComponent.prototype,"oddEvenRowBackground",void 0),t([e.Output()],exports.SimpleTableComponent.prototype,"tableReady",void 0),exports.SimpleTableComponent=t([e.Component({selector:"simple-table",standalone:!0,template:"<div #host></div>",styles:[":host { display: block; }"]})],exports.SimpleTableComponent),Object.defineProperty(exports,"PIVOT_ACCESSOR_PREFIX",{enumerable:!0,get:function(){return o.PIVOT_ACCESSOR_PREFIX}}),Object.defineProperty(exports,"PIVOT_BLANK_LABEL",{enumerable:!0,get:function(){return o.PIVOT_BLANK_LABEL}}),Object.defineProperty(exports,"PIVOT_CHILDREN_KEY",{enumerable:!0,get:function(){return o.PIVOT_CHILDREN_KEY}}),Object.defineProperty(exports,"PIVOT_IS_TOTAL_KEY",{enumerable:!0,get:function(){return o.PIVOT_IS_TOTAL_KEY}}),Object.defineProperty(exports,"asRows",{enumerable:!0,get:function(){return o.asRows}}),Object.defineProperty(exports,"buildPivotAccessor",{enumerable:!0,get:function(){return o.buildPivotAccessor}}),Object.defineProperty(exports,"buildPivotRowTotalAccessor",{enumerable:!0,get:function(){return o.buildPivotRowTotalAccessor}}),Object.defineProperty(exports,"pivotRows",{enumerable:!0,get:function(){return o.pivotRows}}),exports.provideSimpleTable=function(){return e.makeEnvironmentProviders([])},exports.wrapAngularRenderer=n;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.es.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createComponent as e,Input as o,Output as t,Component as i,EventEmitter as n,inject as r,ElementRef as d,ApplicationRef as s,EnvironmentInjector as a,makeEnvironmentProviders as l}from"@angular/core";import{collectHeaderAccessors as h,SimpleTableVanilla as u,headersStructurallyEqual as c,rowsShallowUnchanged as p}from"simple-table-core";export{PIVOT_ACCESSOR_PREFIX,PIVOT_BLANK_LABEL,PIVOT_CHILDREN_KEY,PIVOT_IS_TOTAL_KEY,asRows,buildPivotAccessor,buildPivotRowTotalAccessor,pivotRows}from"simple-table-core";function v(e,o,t,i){var n,r=arguments.length,d=r<3?o:null===i?i=Object.getOwnPropertyDescriptor(o,t):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)d=Reflect.decorate(e,o,t,i);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(d=(r<3?n(d):r>3?n(o,t,d):n(o,t))||d);return r>3&&d&&Object.defineProperty(o,t,d),d}function g(o,t,i,n){return r=>{const d=document.createElement("div"),s=e(o,{environmentInjector:i,hostElement:d});return Object.assign(s.instance,r),t.attachView(s.hostView),s.changeDetectorRef.detectChanges(),n?.register(d,()=>{t.detachView(s.hostView),s.destroy()}),d}}function m(o,t,i,n,r,d){const s="cell"===d?n.cellRendererCache:n.headerRendererCache,a=s.get(r);if(a)return a.component=o,a.wrapped;const l={component:o,wrapped:null},h=o=>{const r=document.createElement("div"),d=e(l.component,{environmentInjector:i,hostElement:r});return Object.assign(d.instance,o),t.attachView(d.hostView),d.changeDetectorRef.detectChanges(),n.register(r,()=>{t.detachView(d.hostView),d.destroy()}),r};return l.wrapped=h,s.set(r,l),h}function C(e){const o=e.columns??e.defaultHeaders;if(!o)throw new Error("SimpleTable requires `columns` or `defaultHeaders`");return o}function R(e,o,t,i){const{defaultHeaders:n,columns:r,rows:d,footerRenderer:s,emptyStateRenderer:a,errorStateRenderer:l,loadingStateRenderer:u,tableEmptyStateRenderer:c,headerDropdown:p,columnEditorConfig:v,icons:y,rowButtons:w,onColumnOrderChange:f,onColumnWidthChange:E,onHeaderEdit:b,onColumnSelect:S,enableColumnEditor:P,editColumns:H,enableColumnEditorInitOpen:B,editColumnsInitOpen:k,enablePagination:O,shouldPaginate:I,onTableReady:x,onGridReady:T,hoverRowBackground:V,useHoverRowBackground:D,oddColumnBackground:A,useOddColumnBackground:F,oddEvenRowBackground:G,useOddEvenRowBackground:L,...j}=e,z=e=>g(e,t,i,o),_=C(e);o.pruneRendererCaches(h(_));const q={...j,rows:d,defaultHeaders:_.map(function e(n){const{cellRenderer:r,headerRenderer:d,children:s,nestedTable:a,...l}=n,h=String(n.accessor),u={...l};if(r&&(u.cellRenderer=r.ɵcmp?m(r,t,i,o,h,"cell"):r),d&&(u.headerRenderer=d.ɵcmp?m(d,t,i,o,h,"header"):d),s&&(u.children=s.map(e)),a){const e={...a,rows:[]};u.nestedTable=R(e,o,t,i)}return u}),editColumns:P??H,editColumnsInitOpen:B??k,shouldPaginate:O??I,onGridReady:x??T,useHoverRowBackground:V??D,useOddColumnBackground:A??F,useOddEvenRowBackground:G??L,onRendererHostDiscard:o.disposeHost,...f?{onColumnOrderChange:e=>f(e)}:{},...E?{onColumnWidthChange:e=>E(e)}:{},...b?{onHeaderEdit:(e,o)=>b(e,o)}:{},...S?{onColumnSelect:e=>S(e)}:{}};return void 0!==s&&(q.footerRenderer=s.ɵcmp?z(s):s),void 0!==a&&(q.emptyStateRenderer=a.ɵcmp?z(a):a),void 0!==l&&(q.errorStateRenderer=l.ɵcmp?z(l):l),void 0!==u&&(q.loadingStateRenderer=u.ɵcmp?z(u):u),void 0!==c&&(q.tableEmptyStateRenderer=c),void 0!==p&&(q.headerDropdown=z(p)),void 0!==v&&(q.columnEditorConfig=function(e){const{rowRenderer:o,customRenderer:t,...i}=e;return{...i,...o?{rowRenderer:z(o)}:{},...t?{customRenderer:z(t)}:{}}}(v)),void 0!==y&&(q.icons=function(e){const o={};for(const[t,i]of Object.entries(e))null!=i&&(o[t]="string"==typeof i||i instanceof HTMLElement||i instanceof SVGSVGElement?i:i.ɵcmp?z(i)({}):i);return o}(y)),void 0!==w&&(q.rowButtons=w.map(e=>z(e))),q}"function"==typeof SuppressedError&&SuppressedError;const y="data-st-mount-id";class w{constructor(){this.entries=new Map,this.nextId=0,this.cellRendererCache=new Map,this.headerRendererCache=new Map,this.disposeHost=e=>{if("function"!=typeof e.getAttribute)return;const o=[],t=e.getAttribute(y);null!==t&&o.push(t),e.querySelectorAll(`[${y}]`).forEach(e=>{const t=e.getAttribute(y);null!==t&&o.push(t)});for(const e of o){const o=this.entries.get(e);o&&(this.entries.delete(e),o())}}}register(e,o){const t="st-mount-"+this.nextId++;e.setAttribute(y,t),this.entries.set(t,o)}clear(){this.cellRendererCache.clear(),this.headerRendererCache.clear();for(const e of this.entries.values())e();this.entries.clear()}pruneRendererCaches(e){for(const o of this.cellRendererCache.keys())e.has(o)||this.cellRendererCache.delete(o);for(const o of this.headerRendererCache.keys())e.has(o)||this.headerRendererCache.delete(o)}get size(){return this.entries.size}}let f=class{constructor(){this.tableReady=new n,this.instance=null,this.registry=new w,this.hostEl=r(d),this.appRef=r(s),this.envInjector=r(a)}ngOnInit(){const e=this.hostEl.nativeElement.querySelector("div");if(!e)return;const o=this.getProps();this.instance=new u(e,R(o,this.registry,this.appRef,this.envInjector)),this.instance.mount(),this.syncedDefaultHeaders=C(o),this.syncedRows=o.rows,this.tableReady.emit(this.instance.getAPI())}ngOnChanges(){if(!this.instance)return;const e=this.getProps(),o={...R(e,this.registry,this.appRef,this.envInjector)},t=C(e),i=c(this.syncedDefaultHeaders,t);this.syncedDefaultHeaders=t,i&&delete o.defaultHeaders;const n=p(this.syncedRows,e.rows,e.getRowId);this.syncedRows=e.rows,n&&delete o.rows,this.instance.update(o)}ngOnDestroy(){this.instance?.destroy(),this.instance=null,this.syncedDefaultHeaders=void 0,this.syncedRows=void 0,this.registry.clear()}getAPI(){return this.instance?.getAPI()??null}getProps(){const e={rows:this.rows};return void 0!==this.defaultHeaders&&(e.defaultHeaders=this.defaultHeaders),void 0!==this.columns&&(e.columns=this.columns),void 0!==this.footerRenderer&&(e.footerRenderer=this.footerRenderer),void 0!==this.loadingStateRenderer&&(e.loadingStateRenderer=this.loadingStateRenderer),void 0!==this.errorStateRenderer&&(e.errorStateRenderer=this.errorStateRenderer),void 0!==this.emptyStateRenderer&&(e.emptyStateRenderer=this.emptyStateRenderer),void 0!==this.tableEmptyStateRenderer&&(e.tableEmptyStateRenderer=this.tableEmptyStateRenderer),void 0!==this.headerDropdown&&(e.headerDropdown=this.headerDropdown),void 0!==this.columnEditorConfig&&(e.columnEditorConfig=this.columnEditorConfig),void 0!==this.onCellClick&&(e.onCellClick=this.onCellClick),void 0!==this.onCellEdit&&(e.onCellEdit=this.onCellEdit),void 0!==this.onSortChange&&(e.onSortChange=this.onSortChange),void 0!==this.onFilterChange&&(e.onFilterChange=this.onFilterChange),void 0!==this.onRowSelectionChange&&(e.onRowSelectionChange=this.onRowSelectionChange),void 0!==this.onRowGroupExpand&&(e.onRowGroupExpand=this.onRowGroupExpand),void 0!==this.onColumnOrderChange&&(e.onColumnOrderChange=this.onColumnOrderChange),void 0!==this.onColumnVisibilityChange&&(e.onColumnVisibilityChange=this.onColumnVisibilityChange),void 0!==this.onColumnWidthChange&&(e.onColumnWidthChange=this.onColumnWidthChange),void 0!==this.onPageChange&&(e.onPageChange=this.onPageChange),void 0!==this.onLoadMore&&(e.onLoadMore=this.onLoadMore),void 0!==this.onGridReady&&(e.onGridReady=this.onGridReady),void 0!==this.onTableReady&&(e.onTableReady=this.onTableReady),void 0!==this.rowGrouping&&(e.rowGrouping=this.rowGrouping),void 0!==this.pivot&&(e.pivot=this.pivot),void 0!==this.onPivotChange&&(e.onPivotChange=this.onPivotChange),void 0!==this.enableRowSelection&&(e.enableRowSelection=this.enableRowSelection),void 0!==this.theme&&(e.theme=this.theme),void 0!==this.quickFilter&&(e.quickFilter=this.quickFilter),void 0!==this.isLoading&&(e.isLoading=this.isLoading),void 0!==this.getRowId&&(e.getRowId=this.getRowId),void 0!==this.shouldPaginate&&(e.shouldPaginate=this.shouldPaginate),void 0!==this.enablePagination&&(e.enablePagination=this.enablePagination),void 0!==this.rowsPerPage&&(e.rowsPerPage=this.rowsPerPage),void 0!==this.serverSidePagination&&(e.serverSidePagination=this.serverSidePagination),void 0!==this.totalRowCount&&(e.totalRowCount=this.totalRowCount),void 0!==this.height&&(e.height=this.height),void 0!==this.maxHeight&&(e.maxHeight=this.maxHeight),void 0!==this.scrollParent&&(e.scrollParent=this.scrollParent),void 0!==this.infiniteScrollThreshold&&(e.infiniteScrollThreshold=this.infiniteScrollThreshold),void 0!==this.columnResizing&&(e.columnResizing=this.columnResizing),void 0!==this.columnReordering&&(e.columnReordering=this.columnReordering),void 0!==this.editColumns&&(e.editColumns=this.editColumns),void 0!==this.enableColumnEditor&&(e.enableColumnEditor=this.enableColumnEditor),void 0!==this.editColumnsInitOpen&&(e.editColumnsInitOpen=this.editColumnsInitOpen),void 0!==this.enableColumnEditorInitOpen&&(e.enableColumnEditorInitOpen=this.enableColumnEditorInitOpen),void 0!==this.selectableCells&&(e.selectableCells=this.selectableCells),void 0!==this.selectableColumns&&(e.selectableColumns=this.selectableColumns),void 0!==this.enableHeaderEditing&&(e.enableHeaderEditing=this.enableHeaderEditing),void 0!==this.onHeaderEdit&&(e.onHeaderEdit=this.onHeaderEdit),void 0!==this.customTheme&&(e.customTheme=this.customTheme),void 0!==this.icons&&(e.icons=this.icons),void 0!==this.externalFilterHandling&&(e.externalFilterHandling=this.externalFilterHandling),void 0!==this.externalSortHandling&&(e.externalSortHandling=this.externalSortHandling),void 0!==this.columnBorders&&(e.columnBorders=this.columnBorders),void 0!==this.rowButtons&&(e.rowButtons=this.rowButtons),void 0!==this.hideFooter&&(e.hideFooter=this.hideFooter),void 0!==this.footerPosition&&(e.footerPosition=this.footerPosition),void 0!==this.initialSortColumn&&(e.initialSortColumn=this.initialSortColumn),void 0!==this.initialSortDirection&&(e.initialSortDirection=this.initialSortDirection),void 0!==this.expandAll&&(e.expandAll=this.expandAll),void 0!==this.autoExpandColumns&&(e.autoExpandColumns=this.autoExpandColumns),void 0!==this.animations&&(e.animations=this.animations),void 0!==this.enableVirtualization&&(e.enableVirtualization=this.enableVirtualization),void 0!==this.hoverRowBackground&&(e.hoverRowBackground=this.hoverRowBackground),void 0!==this.useHoverRowBackground&&(e.useHoverRowBackground=this.useHoverRowBackground),void 0!==this.oddColumnBackground&&(e.oddColumnBackground=this.oddColumnBackground),void 0!==this.useOddColumnBackground&&(e.useOddColumnBackground=this.useOddColumnBackground),void 0!==this.oddEvenRowBackground&&(e.oddEvenRowBackground=this.oddEvenRowBackground),void 0!==this.useOddEvenRowBackground&&(e.useOddEvenRowBackground=this.useOddEvenRowBackground),e}};function E(){return l([])}v([o({required:!0})],f.prototype,"rows",void 0),v([o()],f.prototype,"defaultHeaders",void 0),v([o()],f.prototype,"columns",void 0),v([o()],f.prototype,"footerRenderer",void 0),v([o()],f.prototype,"loadingStateRenderer",void 0),v([o()],f.prototype,"errorStateRenderer",void 0),v([o()],f.prototype,"emptyStateRenderer",void 0),v([o()],f.prototype,"tableEmptyStateRenderer",void 0),v([o()],f.prototype,"headerDropdown",void 0),v([o()],f.prototype,"columnEditorConfig",void 0),v([o()],f.prototype,"onCellClick",void 0),v([o()],f.prototype,"onCellEdit",void 0),v([o()],f.prototype,"onSortChange",void 0),v([o()],f.prototype,"onFilterChange",void 0),v([o()],f.prototype,"onRowSelectionChange",void 0),v([o()],f.prototype,"onRowGroupExpand",void 0),v([o()],f.prototype,"onColumnOrderChange",void 0),v([o()],f.prototype,"onColumnVisibilityChange",void 0),v([o()],f.prototype,"onColumnWidthChange",void 0),v([o()],f.prototype,"onPageChange",void 0),v([o()],f.prototype,"onLoadMore",void 0),v([o()],f.prototype,"onGridReady",void 0),v([o()],f.prototype,"onTableReady",void 0),v([o()],f.prototype,"rowGrouping",void 0),v([o()],f.prototype,"pivot",void 0),v([o()],f.prototype,"onPivotChange",void 0),v([o()],f.prototype,"enableRowSelection",void 0),v([o()],f.prototype,"theme",void 0),v([o()],f.prototype,"quickFilter",void 0),v([o()],f.prototype,"isLoading",void 0),v([o()],f.prototype,"getRowId",void 0),v([o()],f.prototype,"shouldPaginate",void 0),v([o()],f.prototype,"enablePagination",void 0),v([o()],f.prototype,"rowsPerPage",void 0),v([o()],f.prototype,"serverSidePagination",void 0),v([o()],f.prototype,"totalRowCount",void 0),v([o()],f.prototype,"height",void 0),v([o()],f.prototype,"maxHeight",void 0),v([o()],f.prototype,"scrollParent",void 0),v([o()],f.prototype,"infiniteScrollThreshold",void 0),v([o()],f.prototype,"columnResizing",void 0),v([o()],f.prototype,"columnReordering",void 0),v([o()],f.prototype,"editColumns",void 0),v([o()],f.prototype,"enableColumnEditor",void 0),v([o()],f.prototype,"editColumnsInitOpen",void 0),v([o()],f.prototype,"enableColumnEditorInitOpen",void 0),v([o()],f.prototype,"selectableCells",void 0),v([o()],f.prototype,"selectableColumns",void 0),v([o()],f.prototype,"enableHeaderEditing",void 0),v([o()],f.prototype,"onHeaderEdit",void 0),v([o()],f.prototype,"customTheme",void 0),v([o()],f.prototype,"icons",void 0),v([o()],f.prototype,"externalFilterHandling",void 0),v([o()],f.prototype,"externalSortHandling",void 0),v([o()],f.prototype,"columnBorders",void 0),v([o()],f.prototype,"rowButtons",void 0),v([o()],f.prototype,"hideFooter",void 0),v([o()],f.prototype,"footerPosition",void 0),v([o()],f.prototype,"initialSortColumn",void 0),v([o()],f.prototype,"initialSortDirection",void 0),v([o()],f.prototype,"expandAll",void 0),v([o()],f.prototype,"autoExpandColumns",void 0),v([o()],f.prototype,"animations",void 0),v([o()],f.prototype,"enableVirtualization",void 0),v([o()],f.prototype,"hoverRowBackground",void 0),v([o()],f.prototype,"useHoverRowBackground",void 0),v([o()],f.prototype,"oddColumnBackground",void 0),v([o()],f.prototype,"useOddColumnBackground",void 0),v([o()],f.prototype,"oddEvenRowBackground",void 0),v([o()],f.prototype,"useOddEvenRowBackground",void 0),v([t()],f.prototype,"tableReady",void 0),f=v([i({selector:"simple-table",standalone:!0,template:"<div #host></div>",styles:[":host { display: block; }"]})],f);export{f as SimpleTableComponent,E as provideSimpleTable,g as wrapAngularRenderer};
|
|
1
|
+
import{createComponent as e,Input as o,Output as t,Component as i,EventEmitter as n,inject as r,ElementRef as d,ApplicationRef as s,EnvironmentInjector as a,makeEnvironmentProviders as l}from"@angular/core";import{collectHeaderAccessors as h,SimpleTableVanilla as c,headersStructurallyEqual as p,rowsShallowUnchanged as u}from"simple-table-core";export{PIVOT_ACCESSOR_PREFIX,PIVOT_BLANK_LABEL,PIVOT_CHILDREN_KEY,PIVOT_IS_TOTAL_KEY,asRows,buildPivotAccessor,buildPivotRowTotalAccessor,pivotRows}from"simple-table-core";function v(e,o,t,i){var n,r=arguments.length,d=r<3?o:null===i?i=Object.getOwnPropertyDescriptor(o,t):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)d=Reflect.decorate(e,o,t,i);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(d=(r<3?n(d):r>3?n(o,t,d):n(o,t))||d);return r>3&&d&&Object.defineProperty(o,t,d),d}function g(o,t,i,n){return r=>{const d=document.createElement("div"),s=e(o,{environmentInjector:i,hostElement:d});return Object.assign(s.instance,r),t.attachView(s.hostView),s.changeDetectorRef.detectChanges(),n?.register(d,()=>{t.detachView(s.hostView),s.destroy()}),d}}function m(o,t,i,n,r,d){const s="cell"===d?n.cellRendererCache:n.headerRendererCache,a=s.get(r);if(a)return a.component=o,a.wrapped;const l={component:o,wrapped:null},h=o=>{const r=document.createElement("div"),d=e(l.component,{environmentInjector:i,hostElement:r});return Object.assign(d.instance,o),t.attachView(d.hostView),d.changeDetectorRef.detectChanges(),n.register(r,()=>{t.detachView(d.hostView),d.destroy()}),r};return l.wrapped=h,s.set(r,l),h}function C(e){const o=e.columns;if(!o)throw new Error("SimpleTable requires `columns`");return o}function R(e,o,t,i){const{columns:n,rows:r,footerRenderer:d,emptyStateRenderer:s,errorStateRenderer:a,loadingStateRenderer:l,tableEmptyStateRenderer:c,headerDropdown:p,columnEditorConfig:u,icons:v,rowButtons:y,onColumnOrderChange:w,onColumnWidthChange:b,onHeaderEdit:E,onColumnSelect:f,enableColumnEditor:S,enableColumnEditorInitOpen:P,enablePagination:B,onTableReady:k,hoverRowBackground:I,oddColumnBackground:H,oddEvenRowBackground:O,...x}=e,T=e=>g(e,t,i,o),V=C(e);o.pruneRendererCaches(h(V));const D={...x,rows:r,columns:V.map(function e(n){const{cellRenderer:r,headerRenderer:d,children:s,nestedTable:a,...l}=n,h=String(n.accessor),c={...l};if(r&&(c.cellRenderer=r.ɵcmp?m(r,t,i,o,h,"cell"):r),d&&(c.headerRenderer=d.ɵcmp?m(d,t,i,o,h,"header"):d),s&&(c.children=s.map(e)),a){const e={...a,rows:[]};c.nestedTable=R(e,o,t,i)}return c}),enableColumnEditor:S,enableColumnEditorInitOpen:P,enablePagination:B,onTableReady:k,hoverRowBackground:I,oddColumnBackground:H,oddEvenRowBackground:O,onRendererHostDiscard:o.disposeHost,...w?{onColumnOrderChange:e=>w(e)}:{},...b?{onColumnWidthChange:e=>b(e)}:{},...E?{onHeaderEdit:(e,o)=>E(e,o)}:{},...f?{onColumnSelect:e=>f(e)}:{}};return void 0!==d&&(D.footerRenderer=d.ɵcmp?T(d):d),void 0!==s&&(D.emptyStateRenderer=s.ɵcmp?T(s):s),void 0!==a&&(D.errorStateRenderer=a.ɵcmp?T(a):a),void 0!==l&&(D.loadingStateRenderer=l.ɵcmp?T(l):l),void 0!==c&&(D.tableEmptyStateRenderer=c),void 0!==p&&(D.headerDropdown=T(p)),void 0!==u&&(D.columnEditorConfig=function(e){const{rowRenderer:o,customRenderer:t,...i}=e;return{...i,...o?{rowRenderer:T(o)}:{},...t?{customRenderer:T(t)}:{}}}(u)),void 0!==v&&(D.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?T(i)({}):i);return o}(v)),void 0!==y&&(D.rowButtons=y.map(e=>T(e))),D}"function"==typeof SuppressedError&&SuppressedError;const y="data-st-mount-id";class w{constructor(){this.entries=new Map,this.nextId=0,this.cellRendererCache=new Map,this.headerRendererCache=new Map,this.disposeHost=e=>{if("function"!=typeof e.getAttribute)return;const o=[],t=e.getAttribute(y);null!==t&&o.push(t),e.querySelectorAll(`[${y}]`).forEach(e=>{const t=e.getAttribute(y);null!==t&&o.push(t)});for(const e of o){const o=this.entries.get(e);o&&(this.entries.delete(e),o())}}}register(e,o){const t="st-mount-"+this.nextId++;e.setAttribute(y,t),this.entries.set(t,o)}clear(){this.cellRendererCache.clear(),this.headerRendererCache.clear();for(const e of this.entries.values())e();this.entries.clear()}pruneRendererCaches(e){for(const o of this.cellRendererCache.keys())e.has(o)||this.cellRendererCache.delete(o);for(const o of this.headerRendererCache.keys())e.has(o)||this.headerRendererCache.delete(o)}get size(){return this.entries.size}}let b=class{constructor(){this.tableReady=new n,this.instance=null,this.registry=new w,this.hostEl=r(d),this.appRef=r(s),this.envInjector=r(a)}ngOnInit(){const e=this.hostEl.nativeElement.querySelector("div");if(!e)return;const o=this.getProps();this.instance=new c(e,R(o,this.registry,this.appRef,this.envInjector)),this.instance.mount(),this.syncedDefaultHeaders=C(o),this.syncedRows=o.rows,this.tableReady.emit(this.instance.getAPI())}ngOnChanges(){if(!this.instance)return;const e=this.getProps(),o={...R(e,this.registry,this.appRef,this.envInjector)},t=C(e),i=p(this.syncedDefaultHeaders,t);this.syncedDefaultHeaders=t,i&&delete o.columns;const n=u(this.syncedRows,e.rows,e.getRowId);this.syncedRows=e.rows,n&&delete o.rows,this.instance.update(o)}ngOnDestroy(){this.instance?.destroy(),this.instance=null,this.syncedDefaultHeaders=void 0,this.syncedRows=void 0,this.registry.clear()}getAPI(){return this.instance?.getAPI()??null}getProps(){const e={rows:this.rows};return void 0!==this.columns&&(e.columns=this.columns),void 0!==this.footerRenderer&&(e.footerRenderer=this.footerRenderer),void 0!==this.loadingStateRenderer&&(e.loadingStateRenderer=this.loadingStateRenderer),void 0!==this.errorStateRenderer&&(e.errorStateRenderer=this.errorStateRenderer),void 0!==this.emptyStateRenderer&&(e.emptyStateRenderer=this.emptyStateRenderer),void 0!==this.tableEmptyStateRenderer&&(e.tableEmptyStateRenderer=this.tableEmptyStateRenderer),void 0!==this.headerDropdown&&(e.headerDropdown=this.headerDropdown),void 0!==this.columnEditorConfig&&(e.columnEditorConfig=this.columnEditorConfig),void 0!==this.onCellClick&&(e.onCellClick=this.onCellClick),void 0!==this.onCellEdit&&(e.onCellEdit=this.onCellEdit),void 0!==this.onSortChange&&(e.onSortChange=this.onSortChange),void 0!==this.onFilterChange&&(e.onFilterChange=this.onFilterChange),void 0!==this.onRowSelectionChange&&(e.onRowSelectionChange=this.onRowSelectionChange),void 0!==this.onRowGroupExpand&&(e.onRowGroupExpand=this.onRowGroupExpand),void 0!==this.onColumnOrderChange&&(e.onColumnOrderChange=this.onColumnOrderChange),void 0!==this.onColumnVisibilityChange&&(e.onColumnVisibilityChange=this.onColumnVisibilityChange),void 0!==this.onColumnWidthChange&&(e.onColumnWidthChange=this.onColumnWidthChange),void 0!==this.onPageChange&&(e.onPageChange=this.onPageChange),void 0!==this.onLoadMore&&(e.onLoadMore=this.onLoadMore),void 0!==this.onTableReady&&(e.onTableReady=this.onTableReady),void 0!==this.rowGrouping&&(e.rowGrouping=this.rowGrouping),void 0!==this.pivot&&(e.pivot=this.pivot),void 0!==this.onPivotChange&&(e.onPivotChange=this.onPivotChange),void 0!==this.enableRowSelection&&(e.enableRowSelection=this.enableRowSelection),void 0!==this.theme&&(e.theme=this.theme),void 0!==this.quickFilter&&(e.quickFilter=this.quickFilter),void 0!==this.isLoading&&(e.isLoading=this.isLoading),void 0!==this.getRowId&&(e.getRowId=this.getRowId),void 0!==this.enablePagination&&(e.enablePagination=this.enablePagination),void 0!==this.rowsPerPage&&(e.rowsPerPage=this.rowsPerPage),void 0!==this.serverSidePagination&&(e.serverSidePagination=this.serverSidePagination),void 0!==this.totalRowCount&&(e.totalRowCount=this.totalRowCount),void 0!==this.height&&(e.height=this.height),void 0!==this.maxHeight&&(e.maxHeight=this.maxHeight),void 0!==this.scrollParent&&(e.scrollParent=this.scrollParent),void 0!==this.infiniteScrollThreshold&&(e.infiniteScrollThreshold=this.infiniteScrollThreshold),void 0!==this.columnResizing&&(e.columnResizing=this.columnResizing),void 0!==this.columnReordering&&(e.columnReordering=this.columnReordering),void 0!==this.enableColumnEditor&&(e.enableColumnEditor=this.enableColumnEditor),void 0!==this.enableColumnEditorInitOpen&&(e.enableColumnEditorInitOpen=this.enableColumnEditorInitOpen),void 0!==this.enableColumnEditorInitOpen&&(e.enableColumnEditorInitOpen=this.enableColumnEditorInitOpen),void 0!==this.selectableCells&&(e.selectableCells=this.selectableCells),void 0!==this.selectableColumns&&(e.selectableColumns=this.selectableColumns),void 0!==this.enableHeaderEditing&&(e.enableHeaderEditing=this.enableHeaderEditing),void 0!==this.onHeaderEdit&&(e.onHeaderEdit=this.onHeaderEdit),void 0!==this.customTheme&&(e.customTheme=this.customTheme),void 0!==this.icons&&(e.icons=this.icons),void 0!==this.externalFilterHandling&&(e.externalFilterHandling=this.externalFilterHandling),void 0!==this.externalSortHandling&&(e.externalSortHandling=this.externalSortHandling),void 0!==this.columnBorders&&(e.columnBorders=this.columnBorders),void 0!==this.rowButtons&&(e.rowButtons=this.rowButtons),void 0!==this.hideFooter&&(e.hideFooter=this.hideFooter),void 0!==this.footerPosition&&(e.footerPosition=this.footerPosition),void 0!==this.initialSortColumn&&(e.initialSortColumn=this.initialSortColumn),void 0!==this.initialSortDirection&&(e.initialSortDirection=this.initialSortDirection),void 0!==this.expandAll&&(e.expandAll=this.expandAll),void 0!==this.autoExpandColumns&&(e.autoExpandColumns=this.autoExpandColumns),void 0!==this.animations&&(e.animations=this.animations),void 0!==this.enableVirtualization&&(e.enableVirtualization=this.enableVirtualization),void 0!==this.hoverRowBackground&&(e.hoverRowBackground=this.hoverRowBackground),void 0!==this.hoverRowBackground&&(e.hoverRowBackground=this.hoverRowBackground),void 0!==this.oddColumnBackground&&(e.oddColumnBackground=this.oddColumnBackground),void 0!==this.oddColumnBackground&&(e.oddColumnBackground=this.oddColumnBackground),void 0!==this.oddEvenRowBackground&&(e.oddEvenRowBackground=this.oddEvenRowBackground),void 0!==this.oddEvenRowBackground&&(e.oddEvenRowBackground=this.oddEvenRowBackground),e}};function E(){return l([])}v([o({required:!0})],b.prototype,"rows",void 0),v([o()],b.prototype,"columns",void 0),v([o()],b.prototype,"footerRenderer",void 0),v([o()],b.prototype,"loadingStateRenderer",void 0),v([o()],b.prototype,"errorStateRenderer",void 0),v([o()],b.prototype,"emptyStateRenderer",void 0),v([o()],b.prototype,"tableEmptyStateRenderer",void 0),v([o()],b.prototype,"headerDropdown",void 0),v([o()],b.prototype,"columnEditorConfig",void 0),v([o()],b.prototype,"onCellClick",void 0),v([o()],b.prototype,"onCellEdit",void 0),v([o()],b.prototype,"onSortChange",void 0),v([o()],b.prototype,"onFilterChange",void 0),v([o()],b.prototype,"onRowSelectionChange",void 0),v([o()],b.prototype,"onRowGroupExpand",void 0),v([o()],b.prototype,"onColumnOrderChange",void 0),v([o()],b.prototype,"onColumnVisibilityChange",void 0),v([o()],b.prototype,"onColumnWidthChange",void 0),v([o()],b.prototype,"onPageChange",void 0),v([o()],b.prototype,"onLoadMore",void 0),v([o()],b.prototype,"onTableReady",void 0),v([o()],b.prototype,"rowGrouping",void 0),v([o()],b.prototype,"pivot",void 0),v([o()],b.prototype,"onPivotChange",void 0),v([o()],b.prototype,"enableRowSelection",void 0),v([o()],b.prototype,"theme",void 0),v([o()],b.prototype,"quickFilter",void 0),v([o()],b.prototype,"isLoading",void 0),v([o()],b.prototype,"getRowId",void 0),v([o()],b.prototype,"enablePagination",void 0),v([o()],b.prototype,"rowsPerPage",void 0),v([o()],b.prototype,"serverSidePagination",void 0),v([o()],b.prototype,"totalRowCount",void 0),v([o()],b.prototype,"height",void 0),v([o()],b.prototype,"maxHeight",void 0),v([o()],b.prototype,"scrollParent",void 0),v([o()],b.prototype,"infiniteScrollThreshold",void 0),v([o()],b.prototype,"columnResizing",void 0),v([o()],b.prototype,"columnReordering",void 0),v([o()],b.prototype,"enableColumnEditor",void 0),v([o()],b.prototype,"enableColumnEditorInitOpen",void 0),v([o()],b.prototype,"selectableCells",void 0),v([o()],b.prototype,"selectableColumns",void 0),v([o()],b.prototype,"enableHeaderEditing",void 0),v([o()],b.prototype,"onHeaderEdit",void 0),v([o()],b.prototype,"customTheme",void 0),v([o()],b.prototype,"icons",void 0),v([o()],b.prototype,"externalFilterHandling",void 0),v([o()],b.prototype,"externalSortHandling",void 0),v([o()],b.prototype,"columnBorders",void 0),v([o()],b.prototype,"rowButtons",void 0),v([o()],b.prototype,"hideFooter",void 0),v([o()],b.prototype,"footerPosition",void 0),v([o()],b.prototype,"initialSortColumn",void 0),v([o()],b.prototype,"initialSortDirection",void 0),v([o()],b.prototype,"expandAll",void 0),v([o()],b.prototype,"autoExpandColumns",void 0),v([o()],b.prototype,"animations",void 0),v([o()],b.prototype,"enableVirtualization",void 0),v([o()],b.prototype,"hoverRowBackground",void 0),v([o()],b.prototype,"oddColumnBackground",void 0),v([o()],b.prototype,"oddEvenRowBackground",void 0),v([t()],b.prototype,"tableReady",void 0),b=v([i({selector:"simple-table",standalone:!0,template:"<div #host></div>",styles:[":host { display: block; }"]})],b);export{b as SimpleTableComponent,E as provideSimpleTable,g as wrapAngularRenderer};
|
|
2
2
|
//# sourceMappingURL=index.es.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ApplicationRef, EnvironmentInjector } from "@angular/core";
|
|
2
|
-
import type { SimpleTableConfig,
|
|
3
|
-
import type { SimpleTableAngularProps,
|
|
2
|
+
import type { SimpleTableConfig, ColumnDef } from "simple-table-core";
|
|
3
|
+
import type { SimpleTableAngularProps, AngularColumnDef } from "./types";
|
|
4
4
|
import type { MountRegistry } from "./MountRegistry";
|
|
5
|
-
/** Resolve
|
|
6
|
-
export declare function resolveAngularColumns(config: Pick<SimpleTableAngularProps, "columns"
|
|
5
|
+
/** Resolve column definitions. */
|
|
6
|
+
export declare function resolveAngularColumns(config: Pick<SimpleTableAngularProps, "columns">): ReadonlyArray<ColumnDef | AngularColumnDef>;
|
|
7
7
|
export declare function buildVanillaConfig(config: SimpleTableAngularProps, registry: MountRegistry, appRef: ApplicationRef, injector: EnvironmentInjector): SimpleTableConfig;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ export { asRows } from "simple-table-core";
|
|
|
3
3
|
export { provideSimpleTable } from "./lib/provideSimpleTable";
|
|
4
4
|
/** Wrap a standalone component as an HTMLElement (e.g. for `tableEmptyStateRenderer`). */
|
|
5
5
|
export { wrapAngularRenderer } from "./utils/wrapAngularRenderer";
|
|
6
|
-
export type { SimpleTableAngularProps, TableInstance,
|
|
7
|
-
export type { Accessor, AggregationConfig, AggregationType, AnimationsConfig, AutoSizeMode, ColumnDef, Cell, CellChangeProps, CellClickProps, CellRenderer, CellRendererProps, CellValue, ChartOptions, ColumnEditorConfig, ColumnEditorRowRenderer, ColumnEditorRowRendererComponents, ColumnEditorCustomRenderer, ColumnEditorCustomRendererProps, ColumnEditorRowRendererProps, ColumnEditorSearchFunction, ColumnType, ColumnVisibilityState, Comparator, ComparatorProps, CustomTheme, CustomThemeProps, EmptyStateRenderer, EmptyStateRendererProps, EnumOption, ErrorStateRenderer, ErrorStateRendererProps, ExportToCSVProps, ExportValueGetter, ExportValueProps, FilterCondition, FilterOperator, StringFilterOperator, NumberFilterOperator, BooleanFilterOperator, DateFilterOperator, EnumFilterOperator, FooterRendererProps, FooterPosition, GetRowId, GetRowIdParams, HeaderDropdown, HeaderDropdownProps,
|
|
6
|
+
export type { SimpleTableAngularProps, TableInstance, AngularColumnDef, AngularIconsConfig, AngularIconSlot, AngularColumnEditorConfig, AngularCellRenderer, AngularHeaderRenderer, AngularFooterRenderer, AngularHeaderDropdown, AngularColumnEditorRowRenderer, AngularColumnEditorCustomRenderer, AngularLoadingStateRenderer, AngularErrorStateRenderer, AngularEmptyStateRenderer, AngularRowButton, } from "./types";
|
|
7
|
+
export type { Accessor, AggregationConfig, AggregationType, AnimationsConfig, AutoSizeMode, ColumnDef, Cell, CellChangeProps, CellClickProps, CellRenderer, CellRendererProps, CellValue, ChartOptions, ColumnEditorConfig, ColumnEditorRowRenderer, ColumnEditorRowRendererComponents, ColumnEditorCustomRenderer, ColumnEditorCustomRendererProps, ColumnEditorRowRendererProps, ColumnEditorSearchFunction, ColumnType, ColumnVisibilityState, Comparator, ComparatorProps, CustomTheme, CustomThemeProps, EmptyStateRenderer, EmptyStateRendererProps, EnumOption, ErrorStateRenderer, ErrorStateRendererProps, ExportToCSVProps, ExportValueGetter, ExportValueProps, FilterCondition, FilterOperator, StringFilterOperator, NumberFilterOperator, BooleanFilterOperator, DateFilterOperator, EnumFilterOperator, FooterRendererProps, FooterPosition, GetRowId, GetRowIdParams, HeaderDropdown, HeaderDropdownProps, HeaderRenderer, HeaderRendererComponents, HeaderRendererProps, IconsConfig, LoadingStateRenderer, LoadingStateRendererProps, OnRowGroupExpandProps, Pinned, PinnedSectionsState, PivotConfig, PivotValueConfig, PivotResult, QuickFilterConfig, QuickFilterGetter, QuickFilterGetterProps, QuickFilterMode, Row, RowButtonProps, RowId, RowSelectionChangeProps, RowSelectionMode, RowState, SetHeaderRenameProps, ShowWhen, SimpleTableConfig, SimpleTableProps, SortColumn, TableAPI, TableFilterState, TableRow, Theme, UpdateDataProps, ValueFormatter, ValueFormatterProps, ValueGetter, ValueGetterProps, } from "simple-table-core";
|
|
8
8
|
export { pivotRows, buildPivotAccessor, buildPivotRowTotalAccessor, PIVOT_CHILDREN_KEY, PIVOT_IS_TOTAL_KEY, PIVOT_ACCESSOR_PREFIX, PIVOT_BLANK_LABEL, } from "simple-table-core";
|
|
@@ -15,8 +15,6 @@ import type { SimpleTableAngularProps } from "../types";
|
|
|
15
15
|
*/
|
|
16
16
|
export declare class SimpleTableComponent implements OnInit, OnChanges, OnDestroy {
|
|
17
17
|
rows: SimpleTableAngularProps["rows"];
|
|
18
|
-
/** @deprecated Prefer {@link columns} */
|
|
19
|
-
defaultHeaders?: SimpleTableAngularProps["defaultHeaders"];
|
|
20
18
|
columns?: SimpleTableAngularProps["columns"];
|
|
21
19
|
footerRenderer?: SimpleTableAngularProps["footerRenderer"];
|
|
22
20
|
loadingStateRenderer?: SimpleTableAngularProps["loadingStateRenderer"];
|
|
@@ -36,7 +34,6 @@ export declare class SimpleTableComponent implements OnInit, OnChanges, OnDestro
|
|
|
36
34
|
onColumnWidthChange?: SimpleTableAngularProps["onColumnWidthChange"];
|
|
37
35
|
onPageChange?: SimpleTableAngularProps["onPageChange"];
|
|
38
36
|
onLoadMore?: SimpleTableAngularProps["onLoadMore"];
|
|
39
|
-
onGridReady?: SimpleTableAngularProps["onGridReady"];
|
|
40
37
|
onTableReady?: SimpleTableAngularProps["onTableReady"];
|
|
41
38
|
rowGrouping?: SimpleTableAngularProps["rowGrouping"];
|
|
42
39
|
pivot?: SimpleTableAngularProps["pivot"];
|
|
@@ -46,7 +43,6 @@ export declare class SimpleTableComponent implements OnInit, OnChanges, OnDestro
|
|
|
46
43
|
quickFilter?: SimpleTableAngularProps["quickFilter"];
|
|
47
44
|
isLoading?: SimpleTableAngularProps["isLoading"];
|
|
48
45
|
getRowId?: SimpleTableAngularProps["getRowId"];
|
|
49
|
-
shouldPaginate?: SimpleTableAngularProps["shouldPaginate"];
|
|
50
46
|
enablePagination?: SimpleTableAngularProps["enablePagination"];
|
|
51
47
|
rowsPerPage?: SimpleTableAngularProps["rowsPerPage"];
|
|
52
48
|
serverSidePagination?: SimpleTableAngularProps["serverSidePagination"];
|
|
@@ -57,9 +53,7 @@ export declare class SimpleTableComponent implements OnInit, OnChanges, OnDestro
|
|
|
57
53
|
infiniteScrollThreshold?: SimpleTableAngularProps["infiniteScrollThreshold"];
|
|
58
54
|
columnResizing?: SimpleTableAngularProps["columnResizing"];
|
|
59
55
|
columnReordering?: SimpleTableAngularProps["columnReordering"];
|
|
60
|
-
editColumns?: SimpleTableAngularProps["editColumns"];
|
|
61
56
|
enableColumnEditor?: SimpleTableAngularProps["enableColumnEditor"];
|
|
62
|
-
editColumnsInitOpen?: SimpleTableAngularProps["editColumnsInitOpen"];
|
|
63
57
|
enableColumnEditorInitOpen?: SimpleTableAngularProps["enableColumnEditorInitOpen"];
|
|
64
58
|
selectableCells?: SimpleTableAngularProps["selectableCells"];
|
|
65
59
|
selectableColumns?: SimpleTableAngularProps["selectableColumns"];
|
|
@@ -80,11 +74,8 @@ export declare class SimpleTableComponent implements OnInit, OnChanges, OnDestro
|
|
|
80
74
|
animations?: SimpleTableAngularProps["animations"];
|
|
81
75
|
enableVirtualization?: SimpleTableAngularProps["enableVirtualization"];
|
|
82
76
|
hoverRowBackground?: SimpleTableAngularProps["hoverRowBackground"];
|
|
83
|
-
useHoverRowBackground?: SimpleTableAngularProps["useHoverRowBackground"];
|
|
84
77
|
oddColumnBackground?: SimpleTableAngularProps["oddColumnBackground"];
|
|
85
|
-
useOddColumnBackground?: SimpleTableAngularProps["useOddColumnBackground"];
|
|
86
78
|
oddEvenRowBackground?: SimpleTableAngularProps["oddEvenRowBackground"];
|
|
87
|
-
useOddEvenRowBackground?: SimpleTableAngularProps["useOddEvenRowBackground"];
|
|
88
79
|
/** Emits the TableAPI once the table has mounted. */
|
|
89
80
|
tableReady: EventEmitter<TableAPI>;
|
|
90
81
|
private instance;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Type } from "@angular/core";
|
|
2
|
-
import type { SimpleTableProps, SimpleTableConfig,
|
|
2
|
+
import type { SimpleTableProps, SimpleTableConfig, ColumnDef, Row, TableAPI, CellRenderer, CellRendererProps, HeaderRenderer, HeaderRendererProps, FooterRendererProps, LoadingStateRendererProps, ErrorStateRendererProps, EmptyStateRendererProps, HeaderDropdownProps, ColumnEditorRowRendererProps, ColumnEditorCustomRendererProps, ColumnEditorConfig } from "simple-table-core";
|
|
3
3
|
export interface TableInstance {
|
|
4
4
|
mount(): void;
|
|
5
5
|
update(config: Partial<SimpleTableConfig>): void;
|
|
@@ -45,32 +45,25 @@ export interface AngularColumnEditorConfig extends Omit<ColumnEditorConfig, "row
|
|
|
45
45
|
customRenderer?: AngularColumnEditorCustomRenderer;
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
|
-
* Column definition for `columns
|
|
49
|
-
* Angular-only renderer fields. `columns`
|
|
50
|
-
* `
|
|
48
|
+
* Column definition for `columns`: core column metadata with
|
|
49
|
+
* Angular-only renderer fields. `columns` also accept plain
|
|
50
|
+
* `ColumnDef[]` from shared configs.
|
|
51
51
|
*/
|
|
52
|
-
export interface
|
|
52
|
+
export interface AngularColumnDef extends Omit<ColumnDef, "cellRenderer" | "headerRenderer" | "children" | "nestedTable"> {
|
|
53
53
|
cellRenderer?: AngularCellRenderer;
|
|
54
54
|
headerRenderer?: AngularHeaderRenderer;
|
|
55
|
-
children?:
|
|
55
|
+
children?: AngularColumnDef[];
|
|
56
56
|
nestedTable?: Omit<SimpleTableAngularProps, "rows" | "loadingStateRenderer" | "errorStateRenderer" | "emptyStateRenderer" | "tableEmptyStateRenderer">;
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Column definitions.
|
|
63
|
-
* @deprecated Prefer {@link columns}
|
|
64
|
-
*/
|
|
65
|
-
defaultHeaders?: ReadonlyArray<HeaderObject | AngularHeaderObject>;
|
|
66
|
-
/** Column definitions. Preferred over `defaultHeaders`. */
|
|
67
|
-
columns?: ReadonlyArray<HeaderObject | AngularHeaderObject>;
|
|
58
|
+
export interface SimpleTableAngularProps extends Omit<SimpleTableProps, "rows" | "columns" | "footerRenderer" | "emptyStateRenderer" | "errorStateRenderer" | "loadingStateRenderer" | "tableEmptyStateRenderer" | "headerDropdown" | "columnEditorConfig" | "icons" | "rowButtons" | "onColumnOrderChange" | "onColumnWidthChange" | "onHeaderEdit" | "onColumnSelect"> {
|
|
59
|
+
/** Column definitions. */
|
|
60
|
+
columns?: ReadonlyArray<ColumnDef | AngularColumnDef>;
|
|
68
61
|
/** Row data: domain objects or core `Row[]`; cast inside the adapter. */
|
|
69
62
|
rows: ReadonlyArray<Row> | ReadonlyArray<object>;
|
|
70
|
-
onColumnOrderChange?: (newHeaders:
|
|
71
|
-
onColumnWidthChange?: (headers:
|
|
72
|
-
onHeaderEdit?: (header:
|
|
73
|
-
onColumnSelect?: (header:
|
|
63
|
+
onColumnOrderChange?: (newHeaders: AngularColumnDef[]) => void;
|
|
64
|
+
onColumnWidthChange?: (headers: AngularColumnDef[]) => void;
|
|
65
|
+
onHeaderEdit?: (header: AngularColumnDef, newLabel: string) => void;
|
|
66
|
+
onColumnSelect?: (header: AngularColumnDef) => void;
|
|
74
67
|
footerRenderer?: AngularFooterRenderer;
|
|
75
68
|
loadingStateRenderer?: AngularLoadingStateRenderer;
|
|
76
69
|
errorStateRenderer?: AngularErrorStateRenderer;
|
|
@@ -21,6 +21,6 @@ import type { MountRegistry } from "../MountRegistry";
|
|
|
21
21
|
export declare function wrapAngularRenderer<P extends object>(component: Type<P>, appRef: ApplicationRef, injector: EnvironmentInjector, registry?: MountRegistry): (props: Partial<P>) => HTMLElement;
|
|
22
22
|
/**
|
|
23
23
|
* Like {@link wrapAngularRenderer}, but reuses one wrapper per accessor so
|
|
24
|
-
* unstable column rebuilds keep a stable function identity on
|
|
24
|
+
* unstable column rebuilds keep a stable function identity on ColumnDef.
|
|
25
25
|
*/
|
|
26
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simple-table/angular",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.5",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/index.es.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@angular/core": ">=17.0.0 <22.0.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"simple-table-core": "4.0.
|
|
36
|
+
"simple-table-core": "4.0.5"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@angular/common": "^20.0.0",
|