@simple-table/vue 4.1.4 → 4.1.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
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),n=require("simple-table-core");function r(e,n){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(t=Object.getOwnPropertySymbols(e);o<t.length;o++)n.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(r[t[o]]=e[t[o]])}return r}function t(n,r){return t=>{const o=document.createElement("div");return e.render(e.h(r,t),o),n.register(o,()=>e.render(null,o)),o}}function o(n,r,t,o){const s="cell"===t?n.cellRendererCache:n.headerRendererCache,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),n=require("simple-table-core");function r(e,n){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(t=Object.getOwnPropertySymbols(e);o<t.length;o++)n.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(r[t[o]]=e[t[o]])}return r}function t(n,r){return t=>{const o=document.createElement("div");return e.render(e.h(r,t),o),n.register(o,()=>e.render(null,o)),o}}function o(n,r,t,o){const s="cell"===t?n.cellRendererCache:n.headerRendererCache,i=s.get(r);if(i)return i.component=o,i.wrapped;const l={component:o,wrapped:null};if("header"===t){let t=null;const o=r=>{const o=e.h(l.component,r);return t&&n.isRegistered(t)?(e.render(o,t),t):(t=document.createElement("div"),e.render(o,t),n.register(t,()=>e.render(null,t)),t)};return l.wrapped=o,s.set(r,l),o}const c=r=>{const t=document.createElement("div");return e.render(e.h(l.component,r),t),n.register(t,()=>e.render(null,t)),t};return l.wrapped=c,s.set(r,l),c}function s(n,r){const t=new Map;return o=>{const s=String(o.accessor),i=t.get(s),l=e.h(r,o);if(i&&n.isRegistered(i))return e.render(l,i),i;const c=document.createElement("div");return e.render(l,c),n.register(c,()=>e.render(null,c)),t.set(s,c),c}}function i(n,r){const t=document.createElement("div");return e.render(r,t),n.register(t,()=>e.render(null,t)),t}function l(n){const r=document.createElement("div");e.render(n,r);const t=r.innerHTML;return e.render(null,r),t}function c(e){return"object"==typeof e||"function"==typeof e}function d(e,n){const{cellRenderer:t,headerRenderer:s,children:i,nestedTable:l}=e,c=r(e,["cellRenderer","headerRenderer","children","nestedTable"]),u=String(e.accessor),f=Object.assign({},c);if(t&&(f.cellRenderer=o(n,u,"cell",t)),s&&(f.headerRenderer=o(n,u,"header",s)),i&&(f.children=i.map(e=>d(e,n))),l){const e=Object.assign(Object.assign({},l),{rows:[]});f.nestedTable=a(e,n)}return f}function u(e){const n=e.columns;if(!n)throw new Error("SimpleTable requires `columns`");return n}function a(e,o){const{rows:a,footerRenderer:f,emptyStateRenderer:p,errorStateRenderer:m,loadingStateRenderer:h,tableEmptyStateRenderer:g,headerDropdown:b,columnEditorConfig:R,icons:w,rowButtons:O,onColumnOrderChange:C,onColumnWidthChange:v,onHeaderEdit:E,onColumnSelect:y,enableColumnEditor:S,enableColumnEditorInitOpen:P,enablePagination:j,onTableReady:T,hoverRowBackground:A,oddColumnBackground:I,oddEvenRowBackground:_}=e,B=r(e,["columns","rows","footerRenderer","emptyStateRenderer","errorStateRenderer","loadingStateRenderer","tableEmptyStateRenderer","headerDropdown","columnEditorConfig","icons","rowButtons","onColumnOrderChange","onColumnWidthChange","onHeaderEdit","onColumnSelect","enableColumnEditor","enableColumnEditorInitOpen","enablePagination","onTableReady","hoverRowBackground","oddColumnBackground","oddEvenRowBackground"]),x=u(e);o.pruneRendererCaches(n.collectHeaderAccessors(x));const L=Object.assign(Object.assign({},B),{rows:n.asRows(a),columns:x.map(e=>d(e,o)),enableColumnEditor:S,enableColumnEditorInitOpen:P,enablePagination:j,onTableReady:T,hoverRowBackground:A,oddColumnBackground:I,oddEvenRowBackground:_,onRendererHostDiscard:o.disposeHost});if(C&&(L.onColumnOrderChange=e=>C(e)),v&&(L.onColumnWidthChange=e=>v(e)),E&&(L.onHeaderEdit=(e,n)=>E(e,n)),y&&(L.onColumnSelect=e=>y(e)),void 0!==f&&(L.footerRenderer=t(o,f)),void 0!==p)if(c(p))L.emptyStateRenderer=t(o,p);else{const e=p;L.emptyStateRenderer=()=>i(o,e)}if(void 0!==m)if(c(m))L.errorStateRenderer=t(o,m);else{const e=m;L.errorStateRenderer=()=>i(o,e)}if(void 0!==h)if(c(h))L.loadingStateRenderer=t(o,h);else{const e=h;L.loadingStateRenderer=()=>i(o,e)}return void 0!==g&&(L.tableEmptyStateRenderer=null===g?null:g instanceof HTMLElement||"string"==typeof g?g:i(o,g)),void 0!==b&&(L.headerDropdown=t(o,b)),void 0!==R&&(L.columnEditorConfig=function(e,n){const{rowRenderer:o,customRenderer:i}=e,l=r(e,["rowRenderer","customRenderer"]);return Object.assign(Object.assign(Object.assign({},l),o?{rowRenderer:s(n,o)}:{}),i?{customRenderer:t(n,i)}:{})}(R,o)),void 0!==w&&(L.icons=function(e){const n={};for(const[r,t]of Object.entries(e))null!=t&&(n[r]="string"==typeof t||t instanceof HTMLElement||t instanceof SVGElement?t:l(t));return n}(w)),void 0!==O&&(L.rowButtons=O.map(e=>t(o,e))),L}"function"==typeof SuppressedError&&SuppressedError;const f="data-st-mount-id";class p{constructor(){this.entries=new Map,this.nextId=0,this.cellRendererCache=new Map,this.headerRendererCache=new Map,this.disposeHost=e=>{if("function"!=typeof e.getAttribute)return;const n=[],r=e.getAttribute(f);null!==r&&n.push(r),e.querySelectorAll(`[${f}]`).forEach(e=>{const r=e.getAttribute(f);null!==r&&n.push(r)});for(const e of n){const n=this.entries.get(e);n&&(this.entries.delete(e),n())}}}register(e,n){const r="st-mount-"+this.nextId++;e.setAttribute(f,r),this.entries.set(r,n)}isRegistered(e){const n=e.getAttribute(f);return null!==n&&this.entries.has(n)}clear(){this.cellRendererCache.clear(),this.headerRendererCache.clear();for(const e of this.entries.values())e();this.entries.clear()}pruneRendererCaches(e){for(const n of this.cellRendererCache.keys())e.has(n)||this.cellRendererCache.delete(n);for(const n of this.headerRendererCache.keys())e.has(n)||this.headerRendererCache.delete(n)}get size(){return this.entries.size}}function m(n){const r={};for(const t in n)r[e.camelize(t)]=""===n[t]||n[t];return r}const h=e.defineComponent({name:"SimpleTable",props:{},inheritAttrs:!1,setup(r,{attrs:t,expose:o}){const s=e.ref(null);let i=null;const l=new p;let c,d,f=null,h=!1,g=!1;function b(e){var n,r;i&&(e?null===(n=i.refitAutoSizeColumns)||void 0===n||n.call(i):!g&&l.size>0&&(g=!0,null===(r=i.refitAutoSizeColumns)||void 0===r||r.call(i)))}return e.onMounted(()=>{if(!s.value)return;const e=m(t);i=new n.SimpleTableVanilla(s.value,a(e,l)),i.mount(),f=e,c=u(e),d=e.rows,h=Boolean(e.isLoading),b(!1)}),e.watch(()=>Object.assign({},t),function(){if(!i)return;const e=m(t);if(null!==f&&!function(e,n){const r=new Set([...Object.keys(e),...Object.keys(n)]);for(const t of r)if(e[t]!==n[t])return!0;return!1}(f,e))return;f=e;const r=a(e,l),o=Object.assign({},r),s=u(e),p=n.headersStructurallyEqual(c,s);c=s,p&&delete o.columns;const g=n.rowsShallowUnchanged(d,e.rows,e.getRowId);d=e.rows,g&&delete o.rows;const R=Boolean(e.isLoading),w=h&&!R;h=R,i.update(o),b(w)}),e.onUnmounted(()=>{null==i||i.destroy(),i=null,c=void 0,d=void 0,f=null,l.clear()}),o({getAPI:()=>{var e;return null!==(e=null==i?void 0:i.getAPI())&&void 0!==e?e:null}}),()=>e.h("div",{ref:s})}});Object.defineProperty(exports,"PIVOT_ACCESSOR_PREFIX",{enumerable:!0,get:function(){return n.PIVOT_ACCESSOR_PREFIX}}),Object.defineProperty(exports,"PIVOT_BLANK_LABEL",{enumerable:!0,get:function(){return n.PIVOT_BLANK_LABEL}}),Object.defineProperty(exports,"PIVOT_CHILDREN_KEY",{enumerable:!0,get:function(){return n.PIVOT_CHILDREN_KEY}}),Object.defineProperty(exports,"PIVOT_IS_TOTAL_KEY",{enumerable:!0,get:function(){return n.PIVOT_IS_TOTAL_KEY}}),Object.defineProperty(exports,"asRows",{enumerable:!0,get:function(){return n.asRows}}),Object.defineProperty(exports,"buildPivotAccessor",{enumerable:!0,get:function(){return n.buildPivotAccessor}}),Object.defineProperty(exports,"buildPivotRowTotalAccessor",{enumerable:!0,get:function(){return n.buildPivotRowTotalAccessor}}),Object.defineProperty(exports,"pivotRows",{enumerable:!0,get:function(){return n.pivotRows}}),exports.SimpleTable=h;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.es.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{render as e,h as n,defineComponent as
|
|
1
|
+
import{render as e,h as n,defineComponent as t,ref as r,onMounted as o,watch as s,onUnmounted as i,camelize as l}from"vue";import{collectHeaderAccessors as c,asRows as d,SimpleTableVanilla as a,headersStructurallyEqual as u,rowsShallowUnchanged as f}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 m(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}function p(t,r){return o=>{const s=document.createElement("div");return e(n(r,o),s),t.register(s,()=>e(null,s)),s}}function h(t,r,o,s){const i="cell"===o?t.cellRendererCache:t.headerRendererCache,l=i.get(r);if(l)return l.component=s,l.wrapped;const c={component:s,wrapped:null};if("header"===o){let o=null;const s=r=>{const s=n(c.component,r);return o&&t.isRegistered(o)?(e(s,o),o):(o=document.createElement("div"),e(s,o),t.register(o,()=>e(null,o)),o)};return c.wrapped=s,i.set(r,c),s}const d=r=>{const o=document.createElement("div");return e(n(c.component,r),o),t.register(o,()=>e(null,o)),o};return c.wrapped=d,i.set(r,c),d}function g(t,r){const o=new Map;return s=>{const i=String(s.accessor),l=o.get(i),c=n(r,s);if(l&&t.isRegistered(l))return e(c,l),l;const d=document.createElement("div");return e(c,d),t.register(d,()=>e(null,d)),o.set(i,d),d}}function R(n,t){const r=document.createElement("div");return e(t,r),n.register(r,()=>e(null,r)),r}function b(n){const t=document.createElement("div");e(n,t);const r=t.innerHTML;return e(null,t),r}function C(e){return"object"==typeof e||"function"==typeof e}function w(e,n){const{cellRenderer:t,headerRenderer:r,children:o,nestedTable:s}=e,i=m(e,["cellRenderer","headerRenderer","children","nestedTable"]),l=String(e.accessor),c=Object.assign({},i);if(t&&(c.cellRenderer=h(n,l,"cell",t)),r&&(c.headerRenderer=h(n,l,"header",r)),o&&(c.children=o.map(e=>w(e,n))),s){const e=Object.assign(Object.assign({},s),{rows:[]});c.nestedTable=E(e,n)}return c}function v(e){const n=e.columns;if(!n)throw new Error("SimpleTable requires `columns`");return n}function E(e,n){const{rows:t,footerRenderer:r,emptyStateRenderer:o,errorStateRenderer:s,loadingStateRenderer:i,tableEmptyStateRenderer:l,headerDropdown:a,columnEditorConfig:u,icons:f,rowButtons:h,onColumnOrderChange:E,onColumnWidthChange:O,onHeaderEdit:S,onColumnSelect:y,enableColumnEditor:j,enableColumnEditorInitOpen:T,enablePagination:A,onTableReady:B,hoverRowBackground:I,oddColumnBackground:P,oddEvenRowBackground:k}=e,H=m(e,["columns","rows","footerRenderer","emptyStateRenderer","errorStateRenderer","loadingStateRenderer","tableEmptyStateRenderer","headerDropdown","columnEditorConfig","icons","rowButtons","onColumnOrderChange","onColumnWidthChange","onHeaderEdit","onColumnSelect","enableColumnEditor","enableColumnEditorInitOpen","enablePagination","onTableReady","hoverRowBackground","oddColumnBackground","oddEvenRowBackground"]),L=v(e);n.pruneRendererCaches(c(L));const _=Object.assign(Object.assign({},H),{rows:d(t),columns:L.map(e=>w(e,n)),enableColumnEditor:j,enableColumnEditorInitOpen:T,enablePagination:A,onTableReady:B,hoverRowBackground:I,oddColumnBackground:P,oddEvenRowBackground:k,onRendererHostDiscard:n.disposeHost});if(E&&(_.onColumnOrderChange=e=>E(e)),O&&(_.onColumnWidthChange=e=>O(e)),S&&(_.onHeaderEdit=(e,n)=>S(e,n)),y&&(_.onColumnSelect=e=>y(e)),void 0!==r&&(_.footerRenderer=p(n,r)),void 0!==o)if(C(o))_.emptyStateRenderer=p(n,o);else{const e=o;_.emptyStateRenderer=()=>R(n,e)}if(void 0!==s)if(C(s))_.errorStateRenderer=p(n,s);else{const e=s;_.errorStateRenderer=()=>R(n,e)}if(void 0!==i)if(C(i))_.loadingStateRenderer=p(n,i);else{const e=i;_.loadingStateRenderer=()=>R(n,e)}return void 0!==l&&(_.tableEmptyStateRenderer=null===l?null:l instanceof HTMLElement||"string"==typeof l?l:R(n,l)),void 0!==a&&(_.headerDropdown=p(n,a)),void 0!==u&&(_.columnEditorConfig=function(e,n){const{rowRenderer:t,customRenderer:r}=e,o=m(e,["rowRenderer","customRenderer"]);return Object.assign(Object.assign(Object.assign({},o),t?{rowRenderer:g(n,t)}:{}),r?{customRenderer:p(n,r)}:{})}(u,n)),void 0!==f&&(_.icons=function(e){const n={};for(const[t,r]of Object.entries(e))null!=r&&(n[t]="string"==typeof r||r instanceof HTMLElement||r instanceof SVGElement?r:b(r));return n}(f)),void 0!==h&&(_.rowButtons=h.map(e=>p(n,e))),_}"function"==typeof SuppressedError&&SuppressedError;const O="data-st-mount-id";class S{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 n=[],t=e.getAttribute(O);null!==t&&n.push(t),e.querySelectorAll(`[${O}]`).forEach(e=>{const t=e.getAttribute(O);null!==t&&n.push(t)});for(const e of n){const n=this.entries.get(e);n&&(this.entries.delete(e),n())}}}register(e,n){const t="st-mount-"+this.nextId++;e.setAttribute(O,t),this.entries.set(t,n)}isRegistered(e){const n=e.getAttribute(O);return null!==n&&this.entries.has(n)}clear(){this.cellRendererCache.clear(),this.headerRendererCache.clear();for(const e of this.entries.values())e();this.entries.clear()}pruneRendererCaches(e){for(const n of this.cellRendererCache.keys())e.has(n)||this.cellRendererCache.delete(n);for(const n of this.headerRendererCache.keys())e.has(n)||this.headerRendererCache.delete(n)}get size(){return this.entries.size}}function y(e){const n={};for(const t in e)n[l(t)]=""===e[t]||e[t];return n}const j=t({name:"SimpleTable",props:{},inheritAttrs:!1,setup(e,{attrs:t,expose:l}){const c=r(null);let d=null;const m=new S;let p,h,g=null,R=!1,b=!1;function C(e){var n,t;d&&(e?null===(n=d.refitAutoSizeColumns)||void 0===n||n.call(d):!b&&m.size>0&&(b=!0,null===(t=d.refitAutoSizeColumns)||void 0===t||t.call(d)))}return o(()=>{if(!c.value)return;const e=y(t);d=new a(c.value,E(e,m)),d.mount(),g=e,p=v(e),h=e.rows,R=Boolean(e.isLoading),C(!1)}),s(()=>Object.assign({},t),function(){if(!d)return;const e=y(t);if(null!==g&&!function(e,n){const t=new Set([...Object.keys(e),...Object.keys(n)]);for(const r of t)if(e[r]!==n[r])return!0;return!1}(g,e))return;g=e;const n=E(e,m),r=Object.assign({},n),o=v(e),s=u(p,o);p=o,s&&delete r.columns;const i=f(h,e.rows,e.getRowId);h=e.rows,i&&delete r.rows;const l=Boolean(e.isLoading),c=R&&!l;R=l,d.update(r),C(c)}),i(()=>{null==d||d.destroy(),d=null,p=void 0,h=void 0,g=null,m.clear()}),l({getAPI:()=>{var e;return null!==(e=null==d?void 0:d.getAPI())&&void 0!==e?e:null}}),()=>n("div",{ref:c})}});export{j as SimpleTable};
|
|
2
2
|
//# sourceMappingURL=index.es.js.map
|
|
@@ -8,6 +8,8 @@ export declare class MountRegistry {
|
|
|
8
8
|
readonly cellRendererCache: Map<string, CachedRendererSlot<unknown>>;
|
|
9
9
|
readonly headerRendererCache: Map<string, CachedRendererSlot<unknown>>;
|
|
10
10
|
register(container: HTMLElement, dispose: () => void): void;
|
|
11
|
+
/** True when `container` is a live registered mount host (not yet disposed). */
|
|
12
|
+
isRegistered(container: HTMLElement): boolean;
|
|
11
13
|
disposeHost: (host: HTMLElement) => void;
|
|
12
14
|
clear(): void;
|
|
13
15
|
pruneRendererCaches(liveAccessors: ReadonlySet<string>): void;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VNode, VNodeChild } from "vue";
|
|
1
|
+
import type { Component, VNode, VNodeChild } from "vue";
|
|
2
2
|
import type { SimpleTableProps, SimpleTableConfig, ColumnDef, TableAPI, CellValue, CellRendererProps, HeaderRendererProps, FooterRendererProps, LoadingStateRendererProps, ErrorStateRendererProps, EmptyStateRendererProps, HeaderDropdownProps, ColumnEditorRowRendererProps, ColumnEditorCustomRendererProps, ColumnEditorConfig, RowButtonProps } from "simple-table-core";
|
|
3
3
|
/**
|
|
4
4
|
* Default `TData` for Vue props bags / helpers: open records so untyped
|
|
@@ -14,6 +14,8 @@ export interface TableInstance {
|
|
|
14
14
|
update(config: Partial<SimpleTableConfig>): void;
|
|
15
15
|
destroy(): void;
|
|
16
16
|
getAPI(): TableAPI;
|
|
17
|
+
/** Re-measure `width: "auto"` columns after custom renderer DOM settles. */
|
|
18
|
+
refitAutoSizeColumns?(): void;
|
|
17
19
|
}
|
|
18
20
|
/**
|
|
19
21
|
* Imperative handle exposed on Vue template refs (`ref="tableRef"`).
|
|
@@ -36,16 +38,16 @@ export interface VueIconsConfig {
|
|
|
36
38
|
pinnedLeftIcon?: VueIconElement;
|
|
37
39
|
pinnedRightIcon?: VueIconElement;
|
|
38
40
|
}
|
|
39
|
-
export type VueCellRenderer<TData extends VueDefaultRowData = VueDefaultRowData, TValue = CellValue> = (props: CellRendererProps<TData, TValue>) => VNodeChild;
|
|
40
|
-
export type VueHeaderRenderer<TData extends VueDefaultRowData = VueDefaultRowData> = (props: HeaderRendererProps<TData>) => VNodeChild;
|
|
41
|
-
export type VueFooterRenderer = (props: FooterRendererProps) => VNodeChild;
|
|
42
|
-
export type VueHeaderDropdown = (props: HeaderDropdownProps) => VNodeChild;
|
|
43
|
-
export type VueColumnEditorRowRenderer = (props: ColumnEditorRowRendererProps) => VNodeChild;
|
|
44
|
-
export type VueColumnEditorCustomRenderer = (props: ColumnEditorCustomRendererProps) => VNodeChild;
|
|
45
|
-
export type VueRowButton<TData extends VueDefaultRowData = VueDefaultRowData> = (props: RowButtonProps<TData>) => VNodeChild;
|
|
46
|
-
export type VueLoadingStateRenderer<TData extends VueDefaultRowData = VueDefaultRowData> = ((props: LoadingStateRendererProps<TData>) => VNodeChild) | VNode;
|
|
47
|
-
export type VueErrorStateRenderer<TData extends VueDefaultRowData = VueDefaultRowData> = ((props: ErrorStateRendererProps<TData>) => VNodeChild) | VNode;
|
|
48
|
-
export type VueEmptyStateRenderer<TData extends VueDefaultRowData = VueDefaultRowData> = ((props: EmptyStateRendererProps<TData>) => VNodeChild) | VNode;
|
|
41
|
+
export type VueCellRenderer<TData extends VueDefaultRowData = VueDefaultRowData, TValue = CellValue> = ((props: CellRendererProps<TData, TValue>) => VNodeChild) | Component;
|
|
42
|
+
export type VueHeaderRenderer<TData extends VueDefaultRowData = VueDefaultRowData> = ((props: HeaderRendererProps<TData>) => VNodeChild) | Component;
|
|
43
|
+
export type VueFooterRenderer = ((props: FooterRendererProps) => VNodeChild) | Component;
|
|
44
|
+
export type VueHeaderDropdown = ((props: HeaderDropdownProps) => VNodeChild) | Component;
|
|
45
|
+
export type VueColumnEditorRowRenderer = ((props: ColumnEditorRowRendererProps) => VNodeChild) | Component;
|
|
46
|
+
export type VueColumnEditorCustomRenderer = ((props: ColumnEditorCustomRendererProps) => VNodeChild) | Component;
|
|
47
|
+
export type VueRowButton<TData extends VueDefaultRowData = VueDefaultRowData> = ((props: RowButtonProps<TData>) => VNodeChild) | Component;
|
|
48
|
+
export type VueLoadingStateRenderer<TData extends VueDefaultRowData = VueDefaultRowData> = ((props: LoadingStateRendererProps<TData>) => VNodeChild) | Component | VNode;
|
|
49
|
+
export type VueErrorStateRenderer<TData extends VueDefaultRowData = VueDefaultRowData> = ((props: ErrorStateRendererProps<TData>) => VNodeChild) | Component | VNode;
|
|
50
|
+
export type VueEmptyStateRenderer<TData extends VueDefaultRowData = VueDefaultRowData> = ((props: EmptyStateRendererProps<TData>) => VNodeChild) | Component | VNode;
|
|
49
51
|
export interface VueColumnEditorConfig extends Omit<ColumnEditorConfig, "rowRenderer" | "customRenderer"> {
|
|
50
52
|
rowRenderer?: VueColumnEditorRowRenderer;
|
|
51
53
|
customRenderer?: VueColumnEditorCustomRenderer;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Component, type VNode } from "vue";
|
|
2
|
+
import type { ColumnEditorRowRendererProps as VanillaColumnEditorRowRendererProps, HeaderRendererProps as VanillaHeaderRendererProps } from "simple-table-core";
|
|
2
3
|
import type { MountRegistry } from "../MountRegistry";
|
|
3
4
|
/**
|
|
4
5
|
* Wraps a Vue 3 component into a function that returns an HTMLElement, matching
|
|
@@ -10,11 +11,26 @@ import type { MountRegistry } from "../MountRegistry";
|
|
|
10
11
|
* (including any `<Teleport>` / floating UI) when the host is discarded.
|
|
11
12
|
*/
|
|
12
13
|
export declare function wrapVueRenderer<P extends object>(registry: MountRegistry, component: Component): (props: P) => HTMLElement;
|
|
14
|
+
/**
|
|
15
|
+
* Header renderer wrapper that reuses one host element so sort/filter icon
|
|
16
|
+
* refreshes update props in place (via `render` patch) instead of remounting
|
|
17
|
+
* the Vue subtree and wiping local state. Mirrors React's
|
|
18
|
+
* {@link wrapReactHeaderRenderer}.
|
|
19
|
+
*/
|
|
20
|
+
export declare function wrapVueHeaderRenderer(registry: MountRegistry, component: Component): (props: VanillaHeaderRendererProps) => HTMLElement;
|
|
13
21
|
/**
|
|
14
22
|
* Like {@link wrapVueRenderer}, but reuses one wrapper per accessor so
|
|
15
23
|
* unstable column rebuilds keep a stable function identity on ColumnDef.
|
|
24
|
+
*
|
|
25
|
+
* For `kind: "header"`, also reuses a single mount host (React
|
|
26
|
+
* {@link wrapCachedHeaderRenderer}) so sort/filter refreshes preserve state.
|
|
16
27
|
*/
|
|
17
28
|
export declare function wrapCachedVueRenderer<P extends object>(registry: MountRegistry, accessor: string, kind: "cell" | "header", component: Component): (props: P) => HTMLElement;
|
|
29
|
+
/**
|
|
30
|
+
* Column-editor row renderer: one host per `accessor` so popout list rebuilds
|
|
31
|
+
* update in place instead of remounting Vue state (mirrors React).
|
|
32
|
+
*/
|
|
33
|
+
export declare function wrapVueColumnEditorRowRenderer(registry: MountRegistry, component: Component): (props: VanillaColumnEditorRowRendererProps) => HTMLElement;
|
|
18
34
|
/**
|
|
19
35
|
* Renders a static VNode into an HTMLElement.
|
|
20
36
|
* Used for props like tableEmptyStateRenderer that are not called with arguments.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simple-table/vue",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.5",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/index.es.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"vue": ">=3.0.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"simple-table-core": "4.1.
|
|
35
|
+
"simple-table-core": "4.1.5"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@rollup/plugin-alias": "4.0.0",
|