@guiexpert/solid-table 1.0.2 → 1.0.3

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.
@@ -1,4 +1,4 @@
1
- import { AreaIdent, AreaModelIf, CellRendererIf, DomServiceIf, RendererCleanupFnType } from "@guiexpert/table";
1
+ import { AreaIdent, AreaModelIf, CellRendererIf, DomServiceIf, RendererCleanupFnType } from '../../table/src/index.ts';
2
2
  import { JSX } from "solid-js/jsx-runtime";
3
3
  export declare class ComponentRendererWrapper implements CellRendererIf {
4
4
  private readonly code;
@@ -0,0 +1,8 @@
1
+ import { AreaIdent, AreaModelIf } from '../../table/src/index.ts';
2
+ export interface RendererPropsIf {
3
+ rowIndex: number;
4
+ columnIndex: number;
5
+ areaIdent: AreaIdent;
6
+ areaModel: AreaModelIf;
7
+ cellValue: any;
8
+ }
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const me=(l,e)=>l===e,q=Symbol("solid-proxy"),ne={equals:me};let de=ce;const L=1,k=2,he={owned:null,cleanups:null,context:null,owner:null};var A=null;let Y=null,b=null,E=null,O=null,z=0;function be(l,e){const t=b,s=A,i=l.length===0,o=e===void 0?s:e,r=i?he:{owned:null,cleanups:null,context:o?o.context:null,owner:o},n=i?l:()=>l(()=>$(()=>X(r)));A=r,b=null;try{return V(n,!0)}finally{b=t,A=s}}function J(l,e,t){const s=te(l,e,!1,L);H(s)}function ye(l,e,t){de=Re;const s=te(l,e,!1,L);(!t||!t.render)&&(s.user=!0),O?O.push(s):H(s)}function we(l,e,t){t=t?Object.assign({},ne,t):ne;const s=te(l,e,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=t.equals||void 0,H(s),xe.bind(s)}function $(l){if(b===null)return l();const e=b;b=null;try{return l()}finally{b=e}}function ve(l){ye(()=>$(l))}function xe(){if(this.sources&&this.state)if(this.state===L)H(this);else{const l=E;E=null,V(()=>N(this),!1),E=l}if(b){const l=this.observers?this.observers.length:0;b.sources?(b.sources.push(this),b.sourceSlots.push(l)):(b.sources=[this],b.sourceSlots=[l]),this.observers?(this.observers.push(b),this.observerSlots.push(b.sources.length-1)):(this.observers=[b],this.observerSlots=[b.sources.length-1])}return this.value}function Ce(l,e,t){let s=l.value;return(!l.comparator||!l.comparator(s,e))&&(l.value=e,l.observers&&l.observers.length&&V(()=>{for(let i=0;i<l.observers.length;i+=1){const o=l.observers[i],r=Y&&Y.running;r&&Y.disposed.has(o),(r?!o.tState:!o.state)&&(o.pure?E.push(o):O.push(o),o.observers&&ue(o)),r||(o.state=L)}if(E.length>1e6)throw E=[],new Error},!1)),e}function H(l){if(!l.fn)return;X(l);const e=A,t=b,s=z;b=A=l,Ee(l,l.value,s),b=t,A=e}function Ee(l,e,t){let s;try{s=l.fn(e)}catch(i){return l.pure&&(l.state=L,l.owned&&l.owned.forEach(X),l.owned=null),l.updatedAt=t+1,pe(i)}(!l.updatedAt||l.updatedAt<=t)&&(l.updatedAt!=null&&"observers"in l?Ce(l,s):l.value=s,l.updatedAt=t)}function te(l,e,t,s=L,i){const o={fn:l,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:e,owner:A,context:A?A.context:null,pure:t};return A===null||A!==he&&(A.owned?A.owned.push(o):A.owned=[o]),o}function G(l){if(l.state===0)return;if(l.state===k)return N(l);if(l.suspense&&$(l.suspense.inFallback))return l.suspense.effects.push(l);const e=[l];for(;(l=l.owner)&&(!l.updatedAt||l.updatedAt<z);)l.state&&e.push(l);for(let t=e.length-1;t>=0;t--)if(l=e[t],l.state===L)H(l);else if(l.state===k){const s=E;E=null,V(()=>N(l,e[0]),!1),E=s}}function V(l,e){if(E)return l();let t=!1;e||(E=[]),O?t=!0:O=[],z++;try{const s=l();return Ae(t),s}catch(s){t||(O=null),E=null,pe(s)}}function Ae(l){if(E&&(ce(E),E=null),l)return;const e=O;O=null,e.length&&V(()=>de(e),!1)}function ce(l){for(let e=0;e<l.length;e++)G(l[e])}function Re(l){let e,t=0;for(e=0;e<l.length;e++){const s=l[e];s.user?l[t++]=s:G(s)}for(e=0;e<t;e++)G(l[e])}function N(l,e){l.state=0;for(let t=0;t<l.sources.length;t+=1){const s=l.sources[t];if(s.sources){const i=s.state;i===L?s!==e&&(!s.updatedAt||s.updatedAt<z)&&G(s):i===k&&N(s,e)}}}function ue(l){for(let e=0;e<l.observers.length;e+=1){const t=l.observers[e];t.state||(t.state=k,t.pure?E.push(t):O.push(t),t.observers&&ue(t))}}function X(l){let e;if(l.sources)for(;l.sources.length;){const t=l.sources.pop(),s=l.sourceSlots.pop(),i=t.observers;if(i&&i.length){const o=i.pop(),r=t.observerSlots.pop();s<i.length&&(o.sourceSlots[r]=s,i[s]=o,t.observerSlots[s]=r)}}if(l.owned){for(e=l.owned.length-1;e>=0;e--)X(l.owned[e]);l.owned=null}if(l.cleanups){for(e=l.cleanups.length-1;e>=0;e--)l.cleanups[e]();l.cleanups=null}l.state=0}function Me(l){return l instanceof Error?l:new Error(typeof l=="string"?l:"Unknown error",{cause:l})}function pe(l,e=A){throw Me(l)}function W(){return!0}const Te={get(l,e,t){return e===q?t:l.get(e)},has(l,e){return e===q?!0:l.has(e)},set:W,deleteProperty:W,getOwnPropertyDescriptor(l,e){return{configurable:!0,enumerable:!0,get(){return l.get(e)},set:W,deleteProperty:W}},ownKeys(l){return l.keys()}};function U(l){return(l=typeof l=="function"?l():l)?l:{}}function De(){for(let l=0,e=this.length;l<e;++l){const t=this[l]();if(t!==void 0)return t}}function fe(...l){let e=!1;for(let o=0;o<l.length;o++){const r=l[o];e=e||!!r&&q in r,l[o]=typeof r=="function"?(e=!0,we(r)):r}if(e)return new Proxy({get(o){for(let r=l.length-1;r>=0;r--){const n=U(l[r])[o];if(n!==void 0)return n}},has(o){for(let r=l.length-1;r>=0;r--)if(o in U(l[r]))return!0;return!1},keys(){const o=[];for(let r=0;r<l.length;r++)o.push(...Object.keys(U(l[r])));return[...new Set(o)]}},Te);const t={},s={},i=new Set;for(let o=l.length-1;o>=0;o--){const r=l[o];if(!r)continue;const n=Object.getOwnPropertyNames(r);for(let a=0,h=n.length;a<h;a++){const d=n[a];if(d==="__proto__"||d==="constructor")continue;const c=Object.getOwnPropertyDescriptor(r,d);if(!i.has(d))c.get?(i.add(d),Object.defineProperty(t,d,{enumerable:!0,configurable:!0,get:De.bind(s[d]=[c.get.bind(r)])})):(c.value!==void 0&&i.add(d),t[d]=c.value);else{const p=s[d];p?c.get?p.push(c.get.bind(r)):c.value!==void 0&&p.push(()=>c.value):t[d]===void 0&&(t[d]=c.value)}}}return t}function Ie(l,e,t){let s=t.length,i=e.length,o=s,r=0,n=0,a=e[i-1].nextSibling,h=null;for(;r<i||n<o;){if(e[r]===t[n]){r++,n++;continue}for(;e[i-1]===t[o-1];)i--,o--;if(i===r){const d=o<s?n?t[n-1].nextSibling:t[o-n]:a;for(;n<o;)l.insertBefore(t[n++],d)}else if(o===n)for(;r<i;)(!h||!h.has(e[r]))&&e[r].remove(),r++;else if(e[r]===t[o-1]&&t[n]===e[i-1]){const d=e[--i].nextSibling;l.insertBefore(t[n++],e[r++].nextSibling),l.insertBefore(t[--o],d),e[i]=t[o]}else{if(!h){h=new Map;let c=n;for(;c<o;)h.set(t[c],c++)}const d=h.get(e[r]);if(d!=null)if(n<d&&d<o){let c=r,p=1,S;for(;++c<i&&c<o&&!((S=h.get(e[c]))==null||S!==d+p);)p++;if(p>d-n){const u=e[r];for(;n<d;)l.insertBefore(t[n++],u)}else l.replaceChild(t[n++],e[r++])}else r++;else e[r++].remove()}}}function Fe(l,e,t,s={}){let i;return be(o=>{i=o,e===document?l():Be(e,l(),e.firstChild?null:void 0,t)},s.owner),()=>{i(),e.textContent=""}}function Oe(l,e,t){let s;const i=()=>{const r=document.createElement("template");return r.innerHTML=l,t?r.content.firstChild.firstChild:r.content.firstChild},o=e?()=>$(()=>document.importNode(s||(s=i()),!0)):()=>(s||(s=i())).cloneNode(!0);return o.cloneNode=o,o}function Le(l,e,t){return $(()=>l(e,t))}function Be(l,e,t,s){if(t!==void 0&&!s&&(s=[]),typeof e!="function")return j(l,e,s,t);J(i=>j(l,e(),i,t),s)}function j(l,e,t,s,i){for(;typeof t=="function";)t=t();if(e===t)return t;const o=typeof e,r=s!==void 0;if(l=r&&t[0]&&t[0].parentNode||l,o==="string"||o==="number")if(o==="number"&&(e=e.toString()),r){let n=t[0];n&&n.nodeType===3?n.data=e:n=document.createTextNode(e),t=P(l,t,s,n)}else t!==""&&typeof t=="string"?t=l.firstChild.data=e:t=l.textContent=e;else if(e==null||o==="boolean")t=P(l,t,s);else{if(o==="function")return J(()=>{let n=e();for(;typeof n=="function";)n=n();t=j(l,n,t,s)}),()=>t;if(Array.isArray(e)){const n=[],a=t&&Array.isArray(t);if(Q(n,e,t,i))return J(()=>t=j(l,n,t,s,!0)),()=>t;if(n.length===0){if(t=P(l,t,s),r)return t}else a?t.length===0?ae(l,n,s):Ie(l,t,n):(t&&P(l),ae(l,n));t=n}else if(e.nodeType){if(Array.isArray(t)){if(r)return t=P(l,t,s,e);P(l,t,null,e)}else t==null||t===""||!l.firstChild?l.appendChild(e):l.replaceChild(e,l.firstChild);t=e}else console.warn("Unrecognized value. Skipped inserting",e)}return t}function Q(l,e,t,s){let i=!1;for(let o=0,r=e.length;o<r;o++){let n=e[o],a=t&&t[o],h;if(!(n==null||n===!0||n===!1))if((h=typeof n)=="object"&&n.nodeType)l.push(n);else if(Array.isArray(n))i=Q(l,n,a)||i;else if(h==="function")if(s){for(;typeof n=="function";)n=n();i=Q(l,Array.isArray(n)?n:[n],Array.isArray(a)?a:[a])||i}else l.push(n),i=!0;else{const d=String(n);a&&a.nodeType===3&&a.data===d?l.push(a):l.push(document.createTextNode(d))}}return i}function ae(l,e,t=null){for(let s=0,i=e.length;s<i;s++)l.insertBefore(e[s],t)}function P(l,e,t,s){if(t===void 0)return l.textContent="";const i=s||document.createTextNode("");if(e.length){let o=!1;for(let r=e.length-1;r>=0;r--){const n=e[r];if(i!==n){const a=n.parentNode===l;!o&&!r?a?l.replaceChild(i,n):l.insertBefore(i,t):a&&n.remove()}else o=!0}}else l.insertBefore(i,t);return[i]}class Pe{constructor(e){this.code=e}render(e,t,s,i,o,r,n){const a=fe({rowIndex:t,columnIndex:s,areaIdent:i,areaModel:o,cellValue:r});Fe(()=>this.code(a),e)}}class se{constructor(e=-1,t=-1,s=-1,i=-1,o,r,n,a=0,h=0,d=0,c=""){this.rowIndex=e,this.rowTop=t,this.columnIndex=s,this.columnLeft=i,this.areaIdent=o,this.sideIdent=r,this.originalEvent=n,this.clickCount=a,this.draggingX=h,this.draggingY=d,this.action=c}clone(){return new se(this.rowIndex,this.rowTop,this.columnIndex,this.columnLeft,this.areaIdent,this.sideIdent,this.originalEvent,this.clickCount,this.draggingX,this.draggingY,this.action)}}class B{constructor(e=">",t="",s=[]){this.content=e,this.style=t,this.classes=s}}class ge{constructor(e=new B(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),t=new B(">","",["ge-table-tree-arrow-collapsed"]),s=new B(">","color:transparent;",["gt-table-tree-arrow-hidden"]),i=new B("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=t,this.arrowPlaceholder=s,this.arrowExpandCollapseAll=i}}class Se{constructor(e=new B("↑","",["ge-header-sorted-asc"]),t=new B("↓","",["ge-header-sorted-desc"]),s=new B("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=t,this.iconPlaceholder=s}}class $e{constructor(e){this.domService=e}setStyle(e,t,s){return this.domService.setStyle(e,t,s),e}applyStyle(e,t){for(const s in t)this.domService.setStyle(e,s,t[s]);return e}applyDisplayNoneStyle(e){return this.domService.setStyle(e,"display","none"),e}applyDisplayBlockStyle(e){return this.domService.setStyle(e,"display","block"),e}applyStyleInPx(e,t){return Object.entries(t).forEach(([s,i])=>this.domService.setStyle(e,s,i+"px")),e}applyStylePosistionRelative(e){return this.domService.setStyle(e,"position","relative"),this.domService.setStyle(e,"overflow","clip"),e}applyStylePosistionAbsolute(e){return this.domService.setStyle(e,"position","absolute"),e}applyStyleFullSize(e){return this.domService.setStyle(e,"width","100%"),this.domService.setStyle(e,"height","100%"),e}applyStyleOverflowAuto(e="auto",t="auto",s){return this.domService.setStyle(s,"overflow-x",e),this.domService.setStyle(s,"overflow-y",t),s}applyStyleNoPadding(e){return this.domService.setStyle(e,"padding","0"),this.domService.setStyle(e,"margin","0"),this.domService.setStyle(e,"border","0"),e}appendRelativeChildDiv(e){const t=this.applyStylePosistionRelative(this.applyStyleFullSize(this.applyStyleNoPadding(this.domService.createElement("div"))));return this.domService.appendChild(e,t),this.applyStylePosistionAbsolute(e),{parent:e,child:t,cache:{}}}appendText(e,t){const s=this.domService.createText(t);return this.domService.appendChild(e,s),s}addClass(e,t){return e.includes(" ")?e.split(" ").forEach(s=>this.domService.addClass(t,s)):this.domService.addClass(t,e),t}addClasses(e,t){if(e)for(const s of e)this.domService.addClass(t,s);return t}setAttribute(e,t,s){return t&&s&&this.domService.setAttribute(e,t,s),e}createAreaDivWithClass(e,t,s,i){const o=this.domService.createElement("div");return this.addClass(e,o),this.domService.setAttribute(o,"data-area",s),this.domService.setAttribute(o,"data-side",i),this.domService.appendChild(t,o),o}createDivWithClass(e,t){const s=this.domService.createElement("div");return this.addClass(e,s),this.domService.appendChild(t,s),s}addRowDiv(e,t,s=-1,i,o,r=""){const n=t.index??-1,a=this.getDivOrCreateDiv(n,e);if(this.domService.addClass(a,"ge-table-row-div"),this.domService.addClass(a,`ge-table-row-div-${t.index}`),i==="body"&&o==="center"){const h=((t==null?void 0:t.index)??0)%2===0?"even":"odd";this.domService.addClass(a,`ge-table-row-${h}`)}if(this.domService.setStyle(a,"display","clip"),this.domService.setStyle(a,"position","absolute"),this.domService.setStyle(a,"left",`${t.left}px`),this.domService.setStyle(a,"top",`${t.top}px`),this.domService.setStyle(a,"width",`${t.width}px`),this.domService.setStyle(a,"height",`${t.height}px`),this.domService.setAttribute(a,"data-row-index",`${s}`),this.domService.setAttribute(a,"data-area",`${i}`),r){const h=this.domService.createText(r);this.domService.appendChild(a,h)}return this.domService.appendChild(e.child,a),a}addColumnDiv(e,t,s=-1,i=-1,o,r,n="",a,h,d=void 0,c){const p=h==null?void 0:h.treeOptions,S=h==null?void 0:h.showCheckboxWihoutExtraColumn,u=this.domService.createElement("div");this.domService.addClass(u,"ge-table-col-div"),this.domService.addClass(u,`ge-table-col-div-${t.index}`),this.domService.setAttribute(u,"data-col-index",`${t.index}`),this.domService.setAttribute(u,"data-row-index",`${s}`),this.domService.setAttribute(u,"data-area",`${o}`);const y=((t==null?void 0:t.index)??0)%2===0?"even":"odd";if(o==="body"&&r==="center"&&this.domService.addClass(u,`ge-table-column-${y}`),this.domService.setStyle(u,"display","clip"),this.domService.setStyle(u,"position","absolute"),this.domService.setStyle(u,"left",`${t.left}px`),this.domService.setStyle(u,"top",`${t.top}px`),this.domService.setStyle(u,"width",`${t.width}px`),this.domService.setStyle(u,"height",`${t.height}px`),a&&a!=="none"&&(this.domService.addClass(u,"ge-table-col-tree"),this.addArrowDiv(u,a,p,s,i,o)),S&&i===0&&d&&this.addCheckboxToDiv(u,d,o,s),n){const f=a!=="none"&&i===0;this.addLabelDiv(u,n,f,s,i,o)}return c&&this.addSortedIcon(u,c,h==null?void 0:h.sortedOptions,i),this.domService.appendChild(e,u),u}addCheckboxToDiv(e,t,s,i){const o=this.domService.createElement("div"),r=t==="full"?"checked":"";return o.innerHTML=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const me=(l,e)=>l===e,q=Symbol("solid-proxy"),ne={equals:me};let de=ce;const L=1,k=2,he={owned:null,cleanups:null,context:null,owner:null};var A=null;let Y=null,b=null,E=null,O=null,z=0;function be(l,e){const t=b,s=A,i=l.length===0,o=e===void 0?s:e,r=i?he:{owned:null,cleanups:null,context:o?o.context:null,owner:o},n=i?l:()=>l(()=>$(()=>X(r)));A=r,b=null;try{return V(n,!0)}finally{b=t,A=s}}function J(l,e,t){const s=te(l,e,!1,L);H(s)}function ye(l,e,t){de=Re;const s=te(l,e,!1,L);(!t||!t.render)&&(s.user=!0),O?O.push(s):H(s)}function we(l,e,t){t=t?Object.assign({},ne,t):ne;const s=te(l,e,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=t.equals||void 0,H(s),xe.bind(s)}function $(l){if(b===null)return l();const e=b;b=null;try{return l()}finally{b=e}}function ve(l){ye(()=>$(l))}function xe(){if(this.sources&&this.state)if(this.state===L)H(this);else{const l=E;E=null,V(()=>N(this),!1),E=l}if(b){const l=this.observers?this.observers.length:0;b.sources?(b.sources.push(this),b.sourceSlots.push(l)):(b.sources=[this],b.sourceSlots=[l]),this.observers?(this.observers.push(b),this.observerSlots.push(b.sources.length-1)):(this.observers=[b],this.observerSlots=[b.sources.length-1])}return this.value}function Ce(l,e,t){let s=l.value;return(!l.comparator||!l.comparator(s,e))&&(l.value=e,l.observers&&l.observers.length&&V(()=>{for(let i=0;i<l.observers.length;i+=1){const o=l.observers[i],r=Y&&Y.running;r&&Y.disposed.has(o),(r?!o.tState:!o.state)&&(o.pure?E.push(o):O.push(o),o.observers&&ue(o)),r||(o.state=L)}if(E.length>1e6)throw E=[],new Error},!1)),e}function H(l){if(!l.fn)return;X(l);const e=A,t=b,s=z;b=A=l,Ee(l,l.value,s),b=t,A=e}function Ee(l,e,t){let s;try{s=l.fn(e)}catch(i){return l.pure&&(l.state=L,l.owned&&l.owned.forEach(X),l.owned=null),l.updatedAt=t+1,pe(i)}(!l.updatedAt||l.updatedAt<=t)&&(l.updatedAt!=null&&"observers"in l?Ce(l,s):l.value=s,l.updatedAt=t)}function te(l,e,t,s=L,i){const o={fn:l,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:e,owner:A,context:A?A.context:null,pure:t};return A===null||A!==he&&(A.owned?A.owned.push(o):A.owned=[o]),o}function G(l){if(l.state===0)return;if(l.state===k)return N(l);if(l.suspense&&$(l.suspense.inFallback))return l.suspense.effects.push(l);const e=[l];for(;(l=l.owner)&&(!l.updatedAt||l.updatedAt<z);)l.state&&e.push(l);for(let t=e.length-1;t>=0;t--)if(l=e[t],l.state===L)H(l);else if(l.state===k){const s=E;E=null,V(()=>N(l,e[0]),!1),E=s}}function V(l,e){if(E)return l();let t=!1;e||(E=[]),O?t=!0:O=[],z++;try{const s=l();return Ae(t),s}catch(s){t||(O=null),E=null,pe(s)}}function Ae(l){if(E&&(ce(E),E=null),l)return;const e=O;O=null,e.length&&V(()=>de(e),!1)}function ce(l){for(let e=0;e<l.length;e++)G(l[e])}function Re(l){let e,t=0;for(e=0;e<l.length;e++){const s=l[e];s.user?l[t++]=s:G(s)}for(e=0;e<t;e++)G(l[e])}function N(l,e){l.state=0;for(let t=0;t<l.sources.length;t+=1){const s=l.sources[t];if(s.sources){const i=s.state;i===L?s!==e&&(!s.updatedAt||s.updatedAt<z)&&G(s):i===k&&N(s,e)}}}function ue(l){for(let e=0;e<l.observers.length;e+=1){const t=l.observers[e];t.state||(t.state=k,t.pure?E.push(t):O.push(t),t.observers&&ue(t))}}function X(l){let e;if(l.sources)for(;l.sources.length;){const t=l.sources.pop(),s=l.sourceSlots.pop(),i=t.observers;if(i&&i.length){const o=i.pop(),r=t.observerSlots.pop();s<i.length&&(o.sourceSlots[r]=s,i[s]=o,t.observerSlots[s]=r)}}if(l.owned){for(e=l.owned.length-1;e>=0;e--)X(l.owned[e]);l.owned=null}if(l.cleanups){for(e=l.cleanups.length-1;e>=0;e--)l.cleanups[e]();l.cleanups=null}l.state=0}function Me(l){return l instanceof Error?l:new Error(typeof l=="string"?l:"Unknown error",{cause:l})}function pe(l,e=A){throw Me(l)}function W(){return!0}const Te={get(l,e,t){return e===q?t:l.get(e)},has(l,e){return e===q?!0:l.has(e)},set:W,deleteProperty:W,getOwnPropertyDescriptor(l,e){return{configurable:!0,enumerable:!0,get(){return l.get(e)},set:W,deleteProperty:W}},ownKeys(l){return l.keys()}};function U(l){return(l=typeof l=="function"?l():l)?l:{}}function De(){for(let l=0,e=this.length;l<e;++l){const t=this[l]();if(t!==void 0)return t}}function fe(...l){let e=!1;for(let o=0;o<l.length;o++){const r=l[o];e=e||!!r&&q in r,l[o]=typeof r=="function"?(e=!0,we(r)):r}if(e)return new Proxy({get(o){for(let r=l.length-1;r>=0;r--){const n=U(l[r])[o];if(n!==void 0)return n}},has(o){for(let r=l.length-1;r>=0;r--)if(o in U(l[r]))return!0;return!1},keys(){const o=[];for(let r=0;r<l.length;r++)o.push(...Object.keys(U(l[r])));return[...new Set(o)]}},Te);const t={},s={},i=new Set;for(let o=l.length-1;o>=0;o--){const r=l[o];if(!r)continue;const n=Object.getOwnPropertyNames(r);for(let a=0,h=n.length;a<h;a++){const d=n[a];if(d==="__proto__"||d==="constructor")continue;const c=Object.getOwnPropertyDescriptor(r,d);if(!i.has(d))c.get?(i.add(d),Object.defineProperty(t,d,{enumerable:!0,configurable:!0,get:De.bind(s[d]=[c.get.bind(r)])})):(c.value!==void 0&&i.add(d),t[d]=c.value);else{const p=s[d];p?c.get?p.push(c.get.bind(r)):c.value!==void 0&&p.push(()=>c.value):t[d]===void 0&&(t[d]=c.value)}}}return t}function Ie(l,e,t){let s=t.length,i=e.length,o=s,r=0,n=0,a=e[i-1].nextSibling,h=null;for(;r<i||n<o;){if(e[r]===t[n]){r++,n++;continue}for(;e[i-1]===t[o-1];)i--,o--;if(i===r){const d=o<s?n?t[n-1].nextSibling:t[o-n]:a;for(;n<o;)l.insertBefore(t[n++],d)}else if(o===n)for(;r<i;)(!h||!h.has(e[r]))&&e[r].remove(),r++;else if(e[r]===t[o-1]&&t[n]===e[i-1]){const d=e[--i].nextSibling;l.insertBefore(t[n++],e[r++].nextSibling),l.insertBefore(t[--o],d),e[i]=t[o]}else{if(!h){h=new Map;let c=n;for(;c<o;)h.set(t[c],c++)}const d=h.get(e[r]);if(d!=null)if(n<d&&d<o){let c=r,p=1,S;for(;++c<i&&c<o&&!((S=h.get(e[c]))==null||S!==d+p);)p++;if(p>d-n){const u=e[r];for(;n<d;)l.insertBefore(t[n++],u)}else l.replaceChild(t[n++],e[r++])}else r++;else e[r++].remove()}}}function Fe(l,e,t,s={}){let i;return be(o=>{i=o,e===document?l():Be(e,l(),e.firstChild?null:void 0,t)},s.owner),()=>{i(),e.textContent=""}}function Oe(l,e,t){let s;const i=()=>{const r=document.createElement("template");return r.innerHTML=l,t?r.content.firstChild.firstChild:r.content.firstChild},o=e?()=>$(()=>document.importNode(s||(s=i()),!0)):()=>(s||(s=i())).cloneNode(!0);return o.cloneNode=o,o}function Le(l,e,t){return $(()=>l(e,t))}function Be(l,e,t,s){if(t!==void 0&&!s&&(s=[]),typeof e!="function")return j(l,e,s,t);J(i=>j(l,e(),i,t),s)}function j(l,e,t,s,i){for(;typeof t=="function";)t=t();if(e===t)return t;const o=typeof e,r=s!==void 0;if(l=r&&t[0]&&t[0].parentNode||l,o==="string"||o==="number")if(o==="number"&&(e=e.toString()),r){let n=t[0];n&&n.nodeType===3?n.data=e:n=document.createTextNode(e),t=P(l,t,s,n)}else t!==""&&typeof t=="string"?t=l.firstChild.data=e:t=l.textContent=e;else if(e==null||o==="boolean")t=P(l,t,s);else{if(o==="function")return J(()=>{let n=e();for(;typeof n=="function";)n=n();t=j(l,n,t,s)}),()=>t;if(Array.isArray(e)){const n=[],a=t&&Array.isArray(t);if(Q(n,e,t,i))return J(()=>t=j(l,n,t,s,!0)),()=>t;if(n.length===0){if(t=P(l,t,s),r)return t}else a?t.length===0?ae(l,n,s):Ie(l,t,n):(t&&P(l),ae(l,n));t=n}else if(e.nodeType){if(Array.isArray(t)){if(r)return t=P(l,t,s,e);P(l,t,null,e)}else t==null||t===""||!l.firstChild?l.appendChild(e):l.replaceChild(e,l.firstChild);t=e}}return t}function Q(l,e,t,s){let i=!1;for(let o=0,r=e.length;o<r;o++){let n=e[o],a=t&&t[o],h;if(!(n==null||n===!0||n===!1))if((h=typeof n)=="object"&&n.nodeType)l.push(n);else if(Array.isArray(n))i=Q(l,n,a)||i;else if(h==="function")if(s){for(;typeof n=="function";)n=n();i=Q(l,Array.isArray(n)?n:[n],Array.isArray(a)?a:[a])||i}else l.push(n),i=!0;else{const d=String(n);a&&a.nodeType===3&&a.data===d?l.push(a):l.push(document.createTextNode(d))}}return i}function ae(l,e,t=null){for(let s=0,i=e.length;s<i;s++)l.insertBefore(e[s],t)}function P(l,e,t,s){if(t===void 0)return l.textContent="";const i=s||document.createTextNode("");if(e.length){let o=!1;for(let r=e.length-1;r>=0;r--){const n=e[r];if(i!==n){const a=n.parentNode===l;!o&&!r?a?l.replaceChild(i,n):l.insertBefore(i,t):a&&n.remove()}else o=!0}}else l.insertBefore(i,t);return[i]}class Pe{constructor(e){this.code=e}render(e,t,s,i,o,r,n){const a=fe({rowIndex:t,columnIndex:s,areaIdent:i,areaModel:o,cellValue:r});Fe(()=>this.code(a),e)}}class se{constructor(e=-1,t=-1,s=-1,i=-1,o,r,n,a=0,h=0,d=0,c=""){this.rowIndex=e,this.rowTop=t,this.columnIndex=s,this.columnLeft=i,this.areaIdent=o,this.sideIdent=r,this.originalEvent=n,this.clickCount=a,this.draggingX=h,this.draggingY=d,this.action=c}clone(){return new se(this.rowIndex,this.rowTop,this.columnIndex,this.columnLeft,this.areaIdent,this.sideIdent,this.originalEvent,this.clickCount,this.draggingX,this.draggingY,this.action)}}class B{constructor(e=">",t="",s=[]){this.content=e,this.style=t,this.classes=s}}class ge{constructor(e=new B(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),t=new B(">","",["ge-table-tree-arrow-collapsed"]),s=new B(">","color:transparent;",["gt-table-tree-arrow-hidden"]),i=new B("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=t,this.arrowPlaceholder=s,this.arrowExpandCollapseAll=i}}class Se{constructor(e=new B("↑","",["ge-header-sorted-asc"]),t=new B("↓","",["ge-header-sorted-desc"]),s=new B("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=t,this.iconPlaceholder=s}}class $e{constructor(e){this.domService=e}setStyle(e,t,s){return this.domService.setStyle(e,t,s),e}applyStyle(e,t){for(const s in t)this.domService.setStyle(e,s,t[s]);return e}applyDisplayNoneStyle(e){return this.domService.setStyle(e,"display","none"),e}applyDisplayBlockStyle(e){return this.domService.setStyle(e,"display","block"),e}applyStyleInPx(e,t){return Object.entries(t).forEach(([s,i])=>this.domService.setStyle(e,s,i+"px")),e}applyStylePosistionRelative(e){return this.domService.setStyle(e,"position","relative"),this.domService.setStyle(e,"overflow","clip"),e}applyStylePosistionAbsolute(e){return this.domService.setStyle(e,"position","absolute"),e}applyStyleFullSize(e){return this.domService.setStyle(e,"width","100%"),this.domService.setStyle(e,"height","100%"),e}applyStyleOverflowAuto(e="auto",t="auto",s){return this.domService.setStyle(s,"overflow-x",e),this.domService.setStyle(s,"overflow-y",t),s}applyStyleNoPadding(e){return this.domService.setStyle(e,"padding","0"),this.domService.setStyle(e,"margin","0"),this.domService.setStyle(e,"border","0"),e}appendRelativeChildDiv(e){const t=this.applyStylePosistionRelative(this.applyStyleFullSize(this.applyStyleNoPadding(this.domService.createElement("div"))));return this.domService.appendChild(e,t),this.applyStylePosistionAbsolute(e),{parent:e,child:t,cache:{}}}appendText(e,t){const s=this.domService.createText(t);return this.domService.appendChild(e,s),s}addClass(e,t){return e.includes(" ")?e.split(" ").forEach(s=>this.domService.addClass(t,s)):this.domService.addClass(t,e),t}addClasses(e,t){if(e)for(const s of e)this.domService.addClass(t,s);return t}setAttribute(e,t,s){return t&&s&&this.domService.setAttribute(e,t,s),e}createAreaDivWithClass(e,t,s,i){const o=this.domService.createElement("div");return this.addClass(e,o),this.domService.setAttribute(o,"data-area",s),this.domService.setAttribute(o,"data-side",i),this.domService.appendChild(t,o),o}createDivWithClass(e,t){const s=this.domService.createElement("div");return this.addClass(e,s),this.domService.appendChild(t,s),s}addRowDiv(e,t,s=-1,i,o,r=""){const n=t.index??-1,a=this.getDivOrCreateDiv(n,e);if(this.domService.addClass(a,"ge-table-row-div"),this.domService.addClass(a,`ge-table-row-div-${t.index}`),i==="body"&&o==="center"){const h=((t==null?void 0:t.index)??0)%2===0?"even":"odd";this.domService.addClass(a,`ge-table-row-${h}`)}if(this.domService.setStyle(a,"display","clip"),this.domService.setStyle(a,"position","absolute"),this.domService.setStyle(a,"left",`${t.left}px`),this.domService.setStyle(a,"top",`${t.top}px`),this.domService.setStyle(a,"width",`${t.width}px`),this.domService.setStyle(a,"height",`${t.height}px`),this.domService.setAttribute(a,"data-row-index",`${s}`),this.domService.setAttribute(a,"data-area",`${i}`),r){const h=this.domService.createText(r);this.domService.appendChild(a,h)}return this.domService.appendChild(e.child,a),a}addColumnDiv(e,t,s=-1,i=-1,o,r,n="",a,h,d=void 0,c){const p=h==null?void 0:h.treeOptions,S=h==null?void 0:h.showCheckboxWihoutExtraColumn,u=this.domService.createElement("div");this.domService.addClass(u,"ge-table-col-div"),this.domService.addClass(u,`ge-table-col-div-${t.index}`),this.domService.setAttribute(u,"data-col-index",`${t.index}`),this.domService.setAttribute(u,"data-row-index",`${s}`),this.domService.setAttribute(u,"data-area",`${o}`);const y=((t==null?void 0:t.index)??0)%2===0?"even":"odd";if(o==="body"&&r==="center"&&this.domService.addClass(u,`ge-table-column-${y}`),this.domService.setStyle(u,"display","clip"),this.domService.setStyle(u,"position","absolute"),this.domService.setStyle(u,"left",`${t.left}px`),this.domService.setStyle(u,"top",`${t.top}px`),this.domService.setStyle(u,"width",`${t.width}px`),this.domService.setStyle(u,"height",`${t.height}px`),a&&a!=="none"&&(this.domService.addClass(u,"ge-table-col-tree"),this.addArrowDiv(u,a,p,s,i,o)),S&&i===0&&d&&this.addCheckboxToDiv(u,d,o,s),n){const f=a!=="none"&&i===0;this.addLabelDiv(u,n,f,s,i,o)}return c&&this.addSortedIcon(u,c,h==null?void 0:h.sortedOptions,i),this.domService.appendChild(e,u),u}addCheckboxToDiv(e,t,s,i){const o=this.domService.createElement("div"),r=t==="full"?"checked":"";return o.innerHTML=`
2
2
  <input
3
3
  type="checkbox"
4
4
  data-area="${s}"
package/index.mjs CHANGED
@@ -82,11 +82,7 @@ function H(l) {
82
82
  return;
83
83
  X(l);
84
84
  const e = A, t = b, s = z;
85
- b = A = l, Ee(
86
- l,
87
- l.value,
88
- s
89
- ), b = t, A = e;
85
+ b = A = l, Ee(l, l.value, s), b = t, A = e;
90
86
  }
91
87
  function Ee(l, e, t) {
92
88
  let s;
@@ -252,30 +248,27 @@ function fe(...l) {
252
248
  e = e || !!r && q in r, l[o] = typeof r == "function" ? (e = !0, we(r)) : r;
253
249
  }
254
250
  if (e)
255
- return new Proxy(
256
- {
257
- get(o) {
258
- for (let r = l.length - 1; r >= 0; r--) {
259
- const n = U(l[r])[o];
260
- if (n !== void 0)
261
- return n;
262
- }
263
- },
264
- has(o) {
265
- for (let r = l.length - 1; r >= 0; r--)
266
- if (o in U(l[r]))
267
- return !0;
268
- return !1;
269
- },
270
- keys() {
271
- const o = [];
272
- for (let r = 0; r < l.length; r++)
273
- o.push(...Object.keys(U(l[r])));
274
- return [...new Set(o)];
251
+ return new Proxy({
252
+ get(o) {
253
+ for (let r = l.length - 1; r >= 0; r--) {
254
+ const n = U(l[r])[o];
255
+ if (n !== void 0)
256
+ return n;
275
257
  }
276
258
  },
277
- Te
278
- );
259
+ has(o) {
260
+ for (let r = l.length - 1; r >= 0; r--)
261
+ if (o in U(l[r]))
262
+ return !0;
263
+ return !1;
264
+ },
265
+ keys() {
266
+ const o = [];
267
+ for (let r = 0; r < l.length; r++)
268
+ o.push(...Object.keys(U(l[r])));
269
+ return [...new Set(o)];
270
+ }
271
+ }, Te);
279
272
  const t = {}, s = {}, i = /* @__PURE__ */ new Set();
280
273
  for (let o = l.length - 1; o >= 0; o--) {
281
274
  const r = l[o];
@@ -410,8 +403,7 @@ function j(l, e, t, s, i) {
410
403
  } else
411
404
  t == null || t === "" || !l.firstChild ? l.appendChild(e) : l.replaceChild(e, l.firstChild);
412
405
  t = e;
413
- } else
414
- console.warn("Unrecognized value. Skipped inserting", e);
406
+ }
415
407
  }
416
408
  return t;
417
409
  }
@@ -428,11 +420,7 @@ function Q(l, e, t, s) {
428
420
  if (s) {
429
421
  for (; typeof n == "function"; )
430
422
  n = n();
431
- i = Q(
432
- l,
433
- Array.isArray(n) ? n : [n],
434
- Array.isArray(a) ? a : [a]
435
- ) || i;
423
+ i = Q(l, Array.isArray(n) ? n : [n], Array.isArray(a) ? a : [a]) || i;
436
424
  } else
437
425
  l.push(n), i = !0;
438
426
  else {
package/package.json CHANGED
@@ -1,9 +1,6 @@
1
1
  {
2
2
  "name": "@guiexpert/solid-table",
3
- "version": "1.0.2",
4
- "scripts": {
5
- "publish": "npm publish --access=public"
6
- },
3
+ "version": "1.0.3",
7
4
  "main": "./index.js",
8
5
  "types": "./index.d.ts",
9
6
  "exports": {