@aurodesignsystem-dev/auro-table 0.0.0-pr161.0 → 0.0.0-pr162.0
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/demo/api.md +142 -154
- package/demo/api.min.js +737 -1
- package/demo/index.md +129 -133
- package/demo/index.min.js +737 -1
- package/demo/readme.md +297 -0
- package/package.json +1 -1
- package/demo/auro-table.min.js +0 -739
package/demo/api.min.js
CHANGED
|
@@ -1,3 +1,739 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
const t$2=globalThis,e$5=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$3=Symbol(),o$5=new WeakMap;let n$4 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$3)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$5&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$5.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$5.set(s,t));}return t}toString(){return this.cssText}};const r$4=t=>new n$4("string"==typeof t?t:t+"",void 0,s$3),i$4=(t,...e)=>{const o=1===t.length?t[0]:e.reduce((e,s,o)=>e+(t=>{if(true===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1],t[0]);return new n$4(o,t,s$3)},S$1=(s,o)=>{if(e$5)s.adoptedStyleSheets=o.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of o){const o=document.createElement("style"),n=t$2.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$3=e$5?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$4(e)})(t):t;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @license
|
|
10
|
+
* Copyright 2017 Google LLC
|
|
11
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
12
|
+
*/const{is:i$3,defineProperty:e$4,getOwnPropertyDescriptor:h$3,getOwnPropertyNames:r$3,getOwnPropertySymbols:o$4,getPrototypeOf:n$3}=Object,a$1=globalThis,c$2=a$1.trustedTypes,l$1=c$2?c$2.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$2=(t,s)=>!i$3(t,s),b$1={attribute:true,type:String,converter:u$1,reflect:false,useDefault:false,hasChanged:f$2};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let y$1 = class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b$1){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$4(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$3(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$3(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...r$3(t),...o$4(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$3(s));}else void 0!==s&&i.push(c$3(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach(t=>t.hostConnected?.());}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.());}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i,e=false,h){if(void 0!==t){const r=this.constructor;if(false===e&&(h=this[t]),i??=r.getPropertyOptions(t),!((i.hasChanged??f$2)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM();}updated(t){}firstUpdated(t){}};y$1.elementStyles=[],y$1.shadowRootOptions={mode:"open"},y$1[d$1("elementProperties")]=new Map,y$1[d$1("finalized")]=new Map,p$1?.({ReactiveElement:y$1}),(a$1.reactiveElementVersions??=[]).push("2.1.2");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @license
|
|
16
|
+
* Copyright 2017 Google LLC
|
|
17
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
18
|
+
*/
|
|
19
|
+
const t$1=globalThis,i$2=t=>t,s$2=t$1.trustedTypes,e$3=s$2?s$2.createPolicy("lit-html",{createHTML:t=>t}):void 0,h$2="$lit$",o$3=`lit$${Math.random().toFixed(9).slice(2)}$`,n$2="?"+o$3,r$2=`<${n$2}>`,l=document,c$1=()=>l.createComment(""),a=t=>null===t||"object"!=typeof t&&"function"!=typeof t,u=Array.isArray,d=t=>u(t)||"function"==typeof t?.[Symbol.iterator],f$1="[ \t\n\f\r]",v=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,m=/>/g,p=RegExp(`>|${f$1}(?:([^\\s"'>=/]+)(${f$1}*=${f$1}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),g=/'/g,$=/"/g,y=/^(?:script|style|textarea|title)$/i,x=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),b=x(1),E=Symbol.for("lit-noChange"),A=Symbol.for("lit-nothing"),C=new WeakMap,P=l.createTreeWalker(l,129);function V(t,i){if(!u(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==e$3?e$3.createHTML(i):i}const N=(t,i)=>{const s=t.length-1,e=[];let n,l=2===i?"<svg>":3===i?"<math>":"",c=v;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,f=0;for(;f<s.length&&(c.lastIndex=f,u=c.exec(s),null!==u);)f=c.lastIndex,c===v?"!--"===u[1]?c=_:void 0!==u[1]?c=m:void 0!==u[2]?(y.test(u[2])&&(n=RegExp("</"+u[2],"g")),c=p):void 0!==u[3]&&(c=p):c===p?">"===u[0]?(c=n??v,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?p:'"'===u[3]?$:g):c===$||c===g?c=p:c===_||c===m?c=v:(c=p,n=void 0);const x=c===p&&t[i+1].startsWith("/>")?" ":"";l+=c===v?s+r$2:d>=0?(e.push(a),s.slice(0,d)+h$2+s.slice(d)+o$3+x):s+o$3+(-2===d?i:x);}return [V(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),e]};class S{constructor({strings:t,_$litType$:i},e){let r;this.parts=[];let l=0,a=0;const u=t.length-1,d=this.parts,[f,v]=N(t,i);if(this.el=S.createElement(f,e),P.currentNode=this.el.content,2===i||3===i){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=P.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(h$2)){const i=v[a++],s=r.getAttribute(t).split(o$3),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:l,name:e[2],strings:s,ctor:"."===e[1]?I:"?"===e[1]?L:"@"===e[1]?z:H}),r.removeAttribute(t);}else t.startsWith(o$3)&&(d.push({type:6,index:l}),r.removeAttribute(t));if(y.test(r.tagName)){const t=r.textContent.split(o$3),i=t.length-1;if(i>0){r.textContent=s$2?s$2.emptyScript:"";for(let s=0;s<i;s++)r.append(t[s],c$1()),P.nextNode(),d.push({type:2,index:++l});r.append(t[i],c$1());}}}else if(8===r.nodeType)if(r.data===n$2)d.push({type:2,index:l});else {let t=-1;for(;-1!==(t=r.data.indexOf(o$3,t+1));)d.push({type:7,index:l}),t+=o$3.length-1;}l++;}}static createElement(t,i){const s=l.createElement("template");return s.innerHTML=t,s}}function M(t,i,s=t,e){if(i===E)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=a(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(false),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=M(t,h._$AS(t,i.values),h,e)),i}class R{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??l).importNode(i,true);P.currentNode=e;let h=P.nextNode(),o=0,n=0,r=s[0];for(;void 0!==r;){if(o===r.index){let i;2===r.type?i=new k(h,h.nextSibling,this,t):1===r.type?i=new r.ctor(h,r.name,r.strings,this,t):6===r.type&&(i=new Z(h,this,t)),this._$AV.push(i),r=s[++n];}o!==r?.index&&(h=P.nextNode(),o++);}return P.currentNode=l,e}p(t){let i=0;for(const s of this._$AV) void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class k{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=A,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??true;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=M(this,t,i),a(t)?t===A||null==t||""===t?(this._$AH!==A&&this._$AR(),this._$AH=A):t!==this._$AH&&t!==E&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):d(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==A&&a(this._$AH)?this._$AA.nextSibling.data=t:this.T(l.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=S.createElement(V(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new R(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=C.get(t.strings);return void 0===i&&C.set(t.strings,i=new S(t)),i}k(t){u(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new k(this.O(c$1()),this.O(c$1()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(false,true,s);t!==this._$AB;){const s=i$2(t).nextSibling;i$2(t).remove(),t=s;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class H{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=A,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=A;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=M(this,t,i,0),o=!a(t)||t!==this._$AH&&t!==E,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=M(this,e[s+n],i,n),r===E&&(r=this._$AH[n]),o||=!a(r)||r!==this._$AH[n],r===A?t=A:t!==A&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class I extends H{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===A?void 0:t;}}class L extends H{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==A);}}class z extends H{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=M(this,t,i,0)??A)===E)return;const s=this._$AH,e=t===A&&s!==A||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==A&&(s===A||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class Z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){M(this,t);}}const B=t$1.litHtmlPolyfillSupport;B?.(S,k),(t$1.litHtmlVersions??=[]).push("3.3.2");const D=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new k(i.insertBefore(c$1(),t),t,void 0,s??{});}return h._$AI(t),h};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @license
|
|
23
|
+
* Copyright 2017 Google LLC
|
|
24
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
25
|
+
*/const s$1=globalThis;let i$1 = class i extends y$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=D(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return E}};i$1._$litElement$=true,i$1["finalized"]=true,s$1.litElementHydrateSupport?.({LitElement:i$1});const o$2=s$1.litElementPolyfillSupport;o$2?.({LitElement:i$1});(s$1.litElementVersions??=[]).push("4.2.2");
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @license
|
|
29
|
+
* Copyright 2020 Google LLC
|
|
30
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
31
|
+
*/const r$1=o=>void 0===o.strings;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @license
|
|
35
|
+
* Copyright 2017 Google LLC
|
|
36
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
37
|
+
*/
|
|
38
|
+
const t={ATTRIBUTE:1,CHILD:2},e$2=t=>(...e)=>({_$litDirective$:t,values:e});class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @license
|
|
42
|
+
* Copyright 2017 Google LLC
|
|
43
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
44
|
+
*/const s=(i,t)=>{const e=i._$AN;if(void 0===e)return false;for(const i of e)i._$AO?.(t,false),s(i,t);return true},o$1=i=>{let t,e;do{if(void 0===(t=i._$AM))break;e=t._$AN,e.delete(i),i=t;}while(0===e?.size)},r=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(void 0===e)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),c(t);}};function h$1(i){ void 0!==this._$AN?(o$1(this),this._$AM=i,r(this)):this._$AM=i;}function n$1(i,t=false,e=0){const r=this._$AH,h=this._$AN;if(void 0!==h&&0!==h.size)if(t)if(Array.isArray(r))for(let i=e;i<r.length;i++)s(r[i],false),o$1(r[i]);else null!=r&&(s(r,false),o$1(r));else s(this,i);}const c=i=>{i.type==t.CHILD&&(i._$AP??=n$1,i._$AQ??=h$1);};class f extends i{constructor(){super(...arguments),this._$AN=void 0;}_$AT(i,t,e){super._$AT(i,t,e),r(this),this.isConnected=i._$AU;}_$AO(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(s(this,i),o$1(this));}setValue(t){if(r$1(this._$Ct))this._$Ct._$AI(t,this);else {const i=[...this._$Ct._$AH];i[this._$Ci]=t,this._$Ct._$AI(i,this,0);}}disconnected(){}reconnected(){}}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @license
|
|
48
|
+
* Copyright 2020 Google LLC
|
|
49
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
50
|
+
*/const e$1=()=>new h;class h{}const o=new WeakMap,n=e$2(class extends f{render(i){return A}update(i,[s]){const e=s!==this.G;return e&&void 0!==this.G&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=s,this.ht=i.options?.host,this.rt(this.ct=i.element)),A}rt(t){if(this.isConnected||(t=void 0),"function"==typeof this.G){const i=this.ht??globalThis;let s=o.get(i);void 0===s&&(s=new WeakMap,o.set(i,s)),void 0!==s.get(this.G)&&this.G.call(this.ht,void 0),s.set(this.G,t),void 0!==t&&this.G.call(this.ht,t);}else this.G.value=t;}get lt(){return "function"==typeof this.G?o.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0);}reconnected(){this.rt(this.ct);}});
|
|
51
|
+
|
|
52
|
+
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
53
|
+
// See LICENSE in the project root for license information.
|
|
54
|
+
|
|
55
|
+
// ---------------------------------------------------------------------
|
|
56
|
+
|
|
57
|
+
/* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
|
|
58
|
+
|
|
59
|
+
class AuroLibraryRuntimeUtils {
|
|
60
|
+
|
|
61
|
+
/* eslint-disable jsdoc/require-param */
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* This will register a new custom element with the browser.
|
|
65
|
+
* @param {String} name - The name of the custom element.
|
|
66
|
+
* @param {Object} componentClass - The class to register as a custom element.
|
|
67
|
+
* @returns {void}
|
|
68
|
+
*/
|
|
69
|
+
registerComponent(name, componentClass) {
|
|
70
|
+
if (!customElements.get(name)) {
|
|
71
|
+
customElements.define(name, class extends componentClass {});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Finds and returns the closest HTML Element based on a selector.
|
|
77
|
+
* @returns {void}
|
|
78
|
+
*/
|
|
79
|
+
closestElement(
|
|
80
|
+
selector, // selector like in .closest()
|
|
81
|
+
base = this, // extra functionality to skip a parent
|
|
82
|
+
__Closest = (el, found = el && el.closest(selector)) =>
|
|
83
|
+
!el || el === document || el === window
|
|
84
|
+
? null // standard .closest() returns null for non-found selectors also
|
|
85
|
+
: found
|
|
86
|
+
? found // found a selector INside this element
|
|
87
|
+
: __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
|
|
88
|
+
) {
|
|
89
|
+
return __Closest(base);
|
|
90
|
+
}
|
|
91
|
+
/* eslint-enable jsdoc/require-param */
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* If the element passed is registered with a different tag name than what is passed in, the tag name is added as an attribute to the element.
|
|
95
|
+
* @param {Object} elem - The element to check.
|
|
96
|
+
* @param {String} tagName - The name of the Auro component to check for or add as an attribute.
|
|
97
|
+
* @returns {void}
|
|
98
|
+
*/
|
|
99
|
+
handleComponentTagRename(elem, tagName) {
|
|
100
|
+
const tag = tagName.toLowerCase();
|
|
101
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
102
|
+
|
|
103
|
+
if (elemTag !== tag) {
|
|
104
|
+
elem.setAttribute(tag, true);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Validates if an element is a specific Auro component.
|
|
110
|
+
* @param {Object} elem - The element to validate.
|
|
111
|
+
* @param {String} tagName - The name of the Auro component to check against.
|
|
112
|
+
* @returns {Boolean} - Returns true if the element is the specified Auro component.
|
|
113
|
+
*/
|
|
114
|
+
elementMatch(elem, tagName) {
|
|
115
|
+
const tag = tagName.toLowerCase();
|
|
116
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
117
|
+
|
|
118
|
+
return elemTag === tag || elem.hasAttribute(tag);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Gets the text content of a named slot.
|
|
123
|
+
* @returns {String}
|
|
124
|
+
* @private
|
|
125
|
+
*/
|
|
126
|
+
getSlotText(elem, name) {
|
|
127
|
+
const slot = elem.shadowRoot?.querySelector(`slot[name="${name}"]`);
|
|
128
|
+
const nodes = slot?.assignedNodes({ flatten: true }) || [];
|
|
129
|
+
const text = nodes.map(n => n.textContent?.trim()).join(' ').trim();
|
|
130
|
+
|
|
131
|
+
return text || null;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
var styleCss = i$4`.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px,1px,1px,1px);width:1px;height:1px;padding:0;border:0}.body-default{font-size:var(--wcss-body-default-font-size, 1rem);line-height:var(--wcss-body-default-line-height, 1.5rem)}.body-default,.body-lg{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0)}.body-lg{font-size:var(--wcss-body-lg-font-size, 1.125rem);line-height:var(--wcss-body-lg-line-height, 1.625rem)}.body-sm{font-size:var(--wcss-body-sm-font-size, .875rem);line-height:var(--wcss-body-sm-line-height, 1.25rem)}.body-sm,.body-xs{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0)}.body-xs{font-size:var(--wcss-body-xs-font-size, .75rem);line-height:var(--wcss-body-xs-line-height, 1rem)}.body-2xs{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-size:var(--wcss-body-2xs-font-size, .625rem);font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);line-height:var(--wcss-body-2xs-line-height, .875rem)}.display-2xl{font-family:var(--wcss-display-2xl-family, "AS Circular"),var(--wcss-display-2xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-2xl-font-size, clamp(3.5rem, 6vw, 5.375rem));font-weight:var(--wcss-display-2xl-weight, 300);letter-spacing:var(--wcss-display-2xl-letter-spacing, 0);line-height:var(--wcss-display-2xl-line-height, 1.3)}.display-xl{font-family:var(--wcss-display-xl-family, "AS Circular"),var(--wcss-display-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-xl-font-size, clamp(3rem, 5.3333333333vw, 4.5rem));font-weight:var(--wcss-display-xl-weight, 300);letter-spacing:var(--wcss-display-xl-letter-spacing, 0);line-height:var(--wcss-display-xl-line-height, 1.3)}.display-lg{font-family:var(--wcss-display-lg-family, "AS Circular"),var(--wcss-display-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-lg-font-size, clamp(2.75rem, 4.6666666667vw, 4rem));font-weight:var(--wcss-display-lg-weight, 300);letter-spacing:var(--wcss-display-lg-letter-spacing, 0);line-height:var(--wcss-display-lg-line-height, 1.3)}.display-md{font-family:var(--wcss-display-md-family, "AS Circular"),var(--wcss-display-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-md-font-size, clamp(2.5rem, 4vw, 3.5rem));font-weight:var(--wcss-display-md-weight, 300);letter-spacing:var(--wcss-display-md-letter-spacing, 0);line-height:var(--wcss-display-md-line-height, 1.3)}.display-sm{font-family:var(--wcss-display-sm-family, "AS Circular"),var(--wcss-display-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-sm-font-size, clamp(2rem, 3.6666666667vw, 3rem));font-weight:var(--wcss-display-sm-weight, 300);letter-spacing:var(--wcss-display-sm-letter-spacing, 0);line-height:var(--wcss-display-sm-line-height, 1.3)}.display-xs{font-family:var(--wcss-display-xs-family, "AS Circular"),var(--wcss-display-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-xs-font-size, clamp(1.75rem, 3vw, 2.375rem));font-weight:var(--wcss-display-xs-weight, 300);letter-spacing:var(--wcss-display-xs-letter-spacing, 0);line-height:var(--wcss-display-xs-line-height, 1.3)}.heading-xl{font-family:var(--wcss-heading-xl-family, "AS Circular"),var(--wcss-heading-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-xl-font-size, clamp(2rem, 3vw, 2.5rem));font-weight:var(--wcss-heading-xl-weight, 300);letter-spacing:var(--wcss-heading-xl-letter-spacing, 0);line-height:var(--wcss-heading-xl-line-height, 1.3)}.heading-lg{font-family:var(--wcss-heading-lg-family, "AS Circular"),var(--wcss-heading-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-lg-font-size, clamp(1.75rem, 2.6666666667vw, 2.25rem));font-weight:var(--wcss-heading-lg-weight, 300);letter-spacing:var(--wcss-heading-lg-letter-spacing, 0);line-height:var(--wcss-heading-lg-line-height, 1.3)}.heading-md{font-family:var(--wcss-heading-md-family, "AS Circular"),var(--wcss-heading-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-md-font-size, clamp(1.625rem, 2.3333333333vw, 1.75rem));font-weight:var(--wcss-heading-md-weight, 300);letter-spacing:var(--wcss-heading-md-letter-spacing, 0);line-height:var(--wcss-heading-md-line-height, 1.3)}.heading-sm{font-family:var(--wcss-heading-sm-family, "AS Circular"),var(--wcss-heading-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-sm-font-size, clamp(1.375rem, 2vw, 1.5rem));font-weight:var(--wcss-heading-sm-weight, 300);letter-spacing:var(--wcss-heading-sm-letter-spacing, 0);line-height:var(--wcss-heading-sm-line-height, 1.3)}.heading-xs{font-family:var(--wcss-heading-xs-family, "AS Circular"),var(--wcss-heading-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-xs-font-size, clamp(1.25rem, 1.6666666667vw, 1.25rem));font-weight:var(--wcss-heading-xs-weight, 450);letter-spacing:var(--wcss-heading-xs-letter-spacing, 0);line-height:var(--wcss-heading-xs-line-height, 1.3)}.heading-2xs{font-family:var(--wcss-heading-2xs-family, "AS Circular"),var(--wcss-heading-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-2xs-font-size, clamp(1.125rem, 1.5vw, 1.125rem));font-weight:var(--wcss-heading-2xs-weight, 450);letter-spacing:var(--wcss-heading-2xs-letter-spacing, 0);line-height:var(--wcss-heading-2xs-line-height, 1.3)}.accent-2xl{font-family:var(--wcss-accent-2xl-family, "Good OT"),var(--wcss-accent-2xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-2xl-font-size, clamp(2rem, 3.1666666667vw, 2.375rem));font-weight:var(--wcss-accent-2xl-weight, 450);letter-spacing:var(--wcss-accent-2xl-letter-spacing, .05em);line-height:var(--wcss-accent-2xl-line-height, 1)}.accent-2xl,.accent-xl{text-transform:uppercase}.accent-xl{font-family:var(--wcss-accent-xl-family, "Good OT"),var(--wcss-accent-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-xl-font-size, clamp(1.625rem, 2.3333333333vw, 2rem));font-weight:var(--wcss-accent-xl-weight, 450);letter-spacing:var(--wcss-accent-xl-letter-spacing, .05em);line-height:var(--wcss-accent-xl-line-height, 1.3)}.accent-lg{font-family:var(--wcss-accent-lg-family, "Good OT"),var(--wcss-accent-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-lg-font-size, clamp(1.5rem, 2.1666666667vw, 1.75rem));font-weight:var(--wcss-accent-lg-weight, 450);letter-spacing:var(--wcss-accent-lg-letter-spacing, .05em);line-height:var(--wcss-accent-lg-line-height, 1.3)}.accent-lg,.accent-md{text-transform:uppercase}.accent-md{font-family:var(--wcss-accent-md-family, "Good OT"),var(--wcss-accent-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-md-font-size, clamp(1.375rem, 1.8333333333vw, 1.5rem));font-weight:var(--wcss-accent-md-weight, 500);letter-spacing:var(--wcss-accent-md-letter-spacing, .05em);line-height:var(--wcss-accent-md-line-height, 1.3)}.accent-sm{font-family:var(--wcss-accent-sm-family, "Good OT"),var(--wcss-accent-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-sm-font-size, clamp(1.125rem, 1.5vw, 1.25rem));font-weight:var(--wcss-accent-sm-weight, 500);letter-spacing:var(--wcss-accent-sm-letter-spacing, .05em);line-height:var(--wcss-accent-sm-line-height, 1.3)}.accent-sm,.accent-xs{text-transform:uppercase}.accent-xs{font-family:var(--wcss-accent-xs-family, "Good OT"),var(--wcss-accent-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-xs-font-size, clamp(1rem, 1.3333333333vw, 1rem));font-weight:var(--wcss-accent-xs-weight, 500);letter-spacing:var(--wcss-accent-xs-letter-spacing, .1em);line-height:var(--wcss-accent-xs-line-height, 1.3)}.accent-2xs{font-family:var(--wcss-accent-2xs-family, "Good OT"),var(--wcss-accent-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-2xs-font-size, clamp(.875rem, 1.1666666667vw, .875rem));font-weight:var(--wcss-accent-2xs-weight, 450);letter-spacing:var(--wcss-accent-2xs-letter-spacing, .1em);line-height:var(--wcss-accent-2xs-line-height, 1.3);text-transform:uppercase}:host,auro-table,[auro-table]{display:block;overflow:auto}:host([nowrap]),auro-table[nowrap],[auro-table][nowrap]{white-space:nowrap}:host table,auro-table table,[auro-table] table{overflow:scroll;width:100%;margin-bottom:var(--ds-size-400, 2rem);border-collapse:collapse;border-spacing:var(--ds-size-100, .5rem)}:host table thead,auro-table table thead,[auro-table] table thead{border-bottom:1px solid var(--ds-auro-table-border-color);border-collapse:collapse}:host table tr:nth-child(2n),auro-table table tr:nth-child(2n),[auro-table] table tr:nth-child(2n){background-color:var(--ds-auro-table-alt-row-container-color)}:host table th,:host table td,auro-table table th,auro-table table td,[auro-table] table th,[auro-table] table td{padding:var(--ds-size-200, 1rem)}:host table th,auro-table table th,[auro-table] table th{text-align:left}
|
|
136
|
+
`;
|
|
137
|
+
|
|
138
|
+
var tokensCss = i$4`:host{--ds-auro-table-alt-row-container-color: var(--ds-basic-color-surface-neutral-subtle, #f7f7f7);--ds-auro-table-border-color: var(--ds-basic-color-border-subtle, #dddddd)}
|
|
139
|
+
`;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @class ChildItemService
|
|
143
|
+
* @description Service class that manages child items and exposes methods to add, remove, and subscribe to changes in the items array.
|
|
144
|
+
* This service allows components to:
|
|
145
|
+
* - Add and remove themselves/items from the service
|
|
146
|
+
* - Subscribe to notifications when items change
|
|
147
|
+
* - Track previous state of items for comparison
|
|
148
|
+
* The service implements a simple pub/sub pattern to notify components when the items collection changes.
|
|
149
|
+
*/
|
|
150
|
+
class ChildItemService {
|
|
151
|
+
/**
|
|
152
|
+
* @property {Array} items - An array to hold the auro-scrolleritems in the scroller.
|
|
153
|
+
* @private
|
|
154
|
+
*/
|
|
155
|
+
#items = [];
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* @property {Array} previousItems - An array to hold the previous items in the scroller.
|
|
159
|
+
* @private
|
|
160
|
+
*/
|
|
161
|
+
#previousItems = [];
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* @property {Array} subscribers - An array to hold the subscribers for item changes.
|
|
165
|
+
* @private
|
|
166
|
+
*/
|
|
167
|
+
#subscribers = [];
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* @property {Object[]} current - A getter to access the current items in the scroller.
|
|
171
|
+
*/
|
|
172
|
+
get current() {
|
|
173
|
+
return this.#items;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
constructor({callback} = {}) {
|
|
177
|
+
if (typeof callback === "function") {
|
|
178
|
+
this.subscribe(callback);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* @param {Function} callback - A callback function that will be called when the items change.
|
|
184
|
+
* @description This method allows you to subscribe to changes in the items array.
|
|
185
|
+
* @returns {Function} - A function to unsubscribe from the changes.
|
|
186
|
+
* @throws {Error} - Throws an error if the callback is not a function.
|
|
187
|
+
*/
|
|
188
|
+
subscribe(callback) {
|
|
189
|
+
if (typeof callback !== "function")
|
|
190
|
+
throw new Error(
|
|
191
|
+
"ChildItemService | subscribe: Callback must be a function",
|
|
192
|
+
);
|
|
193
|
+
this.#subscribers.push(callback);
|
|
194
|
+
|
|
195
|
+
return () => this.unsubscribe(callback);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* @param {Function} callback - A callback function that will be called when the items change.
|
|
200
|
+
* @description This method allows you to unsubscribe from changes in the items array.
|
|
201
|
+
* @returns {Boolean} - Whether or not you were successfully unsubscribed.
|
|
202
|
+
* @throws {Error} - Throws an error if the callback is not a function.
|
|
203
|
+
*/
|
|
204
|
+
unsubscribe(callback) {
|
|
205
|
+
if (typeof callback !== "function")
|
|
206
|
+
throw new Error(
|
|
207
|
+
"ChildItemService | unsubscribe: Callback must be a function",
|
|
208
|
+
);
|
|
209
|
+
this.#subscribers = this.#subscribers.filter(
|
|
210
|
+
(subscriber) => subscriber !== callback,
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
return true;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Notify all subscribers of changes in the items array.
|
|
218
|
+
*/
|
|
219
|
+
#notifySubscribers() {
|
|
220
|
+
for (const callback of this.#subscribers)
|
|
221
|
+
callback({
|
|
222
|
+
items: this.#items,
|
|
223
|
+
previousItems: this.#previousItems,
|
|
224
|
+
addedItems: this.#items.filter(item => !this.#previousItems.includes(item)),
|
|
225
|
+
removedItems: this.#previousItems.filter(item => !this.#items.includes(item))
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* @param {Object} item - An item to add to the scroller.
|
|
231
|
+
* @description This method adds an item to the scroller and notifies subscribers.
|
|
232
|
+
* @returns {void}
|
|
233
|
+
* @throws {Error} - Throws an error if the item is not an object.
|
|
234
|
+
*/
|
|
235
|
+
add(item) {
|
|
236
|
+
if (typeof item !== "object" || item === null)
|
|
237
|
+
throw new Error("ChildItemService | addItem: Item must be an object");
|
|
238
|
+
|
|
239
|
+
this.#previousItems = this.#getPreviousItems();
|
|
240
|
+
this.#items.push(item);
|
|
241
|
+
this.#notifySubscribers();
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* @description This method adds multiple items to the service and notifies subscribers.
|
|
246
|
+
* @param {ArrayLike<any>} items
|
|
247
|
+
* @returns {void}
|
|
248
|
+
* @throws {Error} - Throws an error if the items are not iterable.
|
|
249
|
+
*/
|
|
250
|
+
addMany(items) {
|
|
251
|
+
if (
|
|
252
|
+
!items ||
|
|
253
|
+
typeof items[Symbol.iterator] !== "function" || // otherwise, check if it's iterable
|
|
254
|
+
typeof items === "string" // technically string is iterable ;)
|
|
255
|
+
) {
|
|
256
|
+
throw new Error(
|
|
257
|
+
"ChildItemService | addMany: Items must be iterable (array, etc.)",
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
this.#previousItems = this.#getPreviousItems();
|
|
262
|
+
this.#items.push(...items);
|
|
263
|
+
this.#notifySubscribers();
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* @param {Object} item - An item to remove from the scroller.
|
|
268
|
+
* @description This method removes an item from the scroller and notifies subscribers.
|
|
269
|
+
* @returns {void}
|
|
270
|
+
* @throws {Error} - Throws an error if the item is not an object or not found in the items array.
|
|
271
|
+
*/
|
|
272
|
+
remove(item) {
|
|
273
|
+
if (typeof item !== "object" || item === null)
|
|
274
|
+
throw new Error("ChildItemService | removeItem: Item must be an object");
|
|
275
|
+
|
|
276
|
+
this.#previousItems = this.#getPreviousItems();
|
|
277
|
+
this.#items = this.#items.filter((i) => i !== item);
|
|
278
|
+
this.#notifySubscribers();
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
clear() {
|
|
282
|
+
this.#previousItems = this.#getPreviousItems();
|
|
283
|
+
this.#items = [];
|
|
284
|
+
this.#notifySubscribers();
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Gets an item by its index in the items array.
|
|
289
|
+
* @param {Number} index
|
|
290
|
+
* @returns {HTMLElement}
|
|
291
|
+
*/
|
|
292
|
+
getItemByIndex(index) {
|
|
293
|
+
return this.#items[index];
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Gets an item by its number (1-based index).
|
|
298
|
+
* @param {Number} number
|
|
299
|
+
* @returns {HTMLElement}
|
|
300
|
+
*/
|
|
301
|
+
getItemByNumber(number) {
|
|
302
|
+
if (
|
|
303
|
+
this.#items.length === 0 ||
|
|
304
|
+
typeof number !== "number" ||
|
|
305
|
+
number < 0 ||
|
|
306
|
+
number > this.#items.length
|
|
307
|
+
) {
|
|
308
|
+
throw new Error(
|
|
309
|
+
"ChildItemService | getItemByNumber: Number must be a valid index within the range of items.",
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
return this.#items[number - 1];
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
getPreviousItem(currentNumber) {
|
|
316
|
+
if (
|
|
317
|
+
typeof currentNumber !== "number" ||
|
|
318
|
+
currentNumber < 1 ||
|
|
319
|
+
currentNumber > this.#items.length
|
|
320
|
+
) {
|
|
321
|
+
throw new Error(
|
|
322
|
+
"ChildItemService | getPreviousItem: Index must be a valid number within the range of previous items.",
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
let index = currentNumber - 2; // Convert to 0-based index
|
|
327
|
+
index = index < 0 ? this.#items.length - 1 : index;
|
|
328
|
+
|
|
329
|
+
return this.#items[index];
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
getNextItem(currentNumber) {
|
|
333
|
+
if (
|
|
334
|
+
typeof currentNumber !== "number" ||
|
|
335
|
+
currentNumber < 1 ||
|
|
336
|
+
currentNumber > this.#items.length
|
|
337
|
+
) {
|
|
338
|
+
throw new Error(
|
|
339
|
+
"ChildItemService | getNextItem: Index must be a valid number within the range of previous items.",
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
let index = currentNumber; // Convert to 0-based index
|
|
344
|
+
index = index >= this.#items.length ? 0 : index;
|
|
345
|
+
|
|
346
|
+
return this.#items[index];
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
#getPreviousItems() {
|
|
350
|
+
return [...this.#items];
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* @license
|
|
356
|
+
* Copyright 2018 Google LLC
|
|
357
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
358
|
+
*/const e=e$2(class extends i{constructor(t$1){if(super(t$1),t$1.type!==t.ATTRIBUTE||"class"!==t$1.name||t$1.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter(s=>t[s]).join(" ")+" "}update(s,[i]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(t=>""!==t)));for(const t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.st)t in i||(r.remove(t),this.st.delete(t));for(const t in i){const s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)));}return E}});
|
|
359
|
+
|
|
360
|
+
// Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
361
|
+
// See LICENSE in the project root for license information.
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
*
|
|
367
|
+
* The `auro-table` element supports two types of tables, either a generated table created by providing data for columns and rows via attributes, or by projecting your own custom table into the default slot of the component to be styled.
|
|
368
|
+
* @customElement auro-table
|
|
369
|
+
*
|
|
370
|
+
* The AuroTable component provides two distinct functionalities for rendering and managing HTML tables:
|
|
371
|
+
* 1. **Data-driven Table Rendering**:
|
|
372
|
+
* - When the `columnHeaders` and `componentData` properties are set, the component generates a table structure internally.
|
|
373
|
+
* - Table headers are created from `columnHeaders`, and rows are populated from `componentData`.
|
|
374
|
+
*
|
|
375
|
+
* 2. **Slotted Table**:
|
|
376
|
+
* - When a native `<table>` element is projected into the component's default slot, AuroTable enhances it by:
|
|
377
|
+
* - Injecting design system styles directly into the table.
|
|
378
|
+
* - Tracking and managing child elements (TH, TD, TR, THEAD, TBODY, TABLE) using internal collections.
|
|
379
|
+
* - Observing DOM mutations to dynamically update collections and apply appropriate classes.
|
|
380
|
+
* - This mode allows developers to use their own table markup while benefiting from AuroTable's styling and child management features.
|
|
381
|
+
* @slot - Default slot for projecting a native `<table>` element. Only available when `columnHeaders` and `componentData` are not set.
|
|
382
|
+
*/
|
|
383
|
+
class AuroTable extends i$1 {
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* @property {string} tableStylesTextContent - Combined CSS text content for table styles and design tokens.
|
|
387
|
+
* @static
|
|
388
|
+
* @readonly
|
|
389
|
+
* @private
|
|
390
|
+
*/
|
|
391
|
+
static #tableStylesTextContent = `${styleCss.cssText} ${tokensCss.cssText}`;
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* @private
|
|
395
|
+
*/
|
|
396
|
+
#runtimeUtils = new AuroLibraryRuntimeUtils();
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* @property {MutationObserver} #tableObserver - Observer to watch for mutations in the table element.
|
|
400
|
+
*/
|
|
401
|
+
#tableObserver = null;
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* @property {Ref} #tableTagRef - Reference to the table element.
|
|
405
|
+
*/
|
|
406
|
+
#tableTagRef = e$1();
|
|
407
|
+
get #tableTag() { return this.#tableTagRef.value; }
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* @property {Ref} #tableHeaderRef - Reference to the table header element.
|
|
411
|
+
*/
|
|
412
|
+
#tableHeaderRef = e$1();
|
|
413
|
+
get #tableHeader() { return this.#tableHeaderRef.value; }
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* @property {Ref} #tableBodyRef - Reference to the table body element.
|
|
417
|
+
*/
|
|
418
|
+
#tableBodyRef = e$1();
|
|
419
|
+
get #tableBody() { return this.#tableBodyRef.value; }
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* @property {Object} #elementClasses - Classes to be applied to different table elements referenced by tag name.
|
|
423
|
+
*/
|
|
424
|
+
#elementClasses = {
|
|
425
|
+
'TABLE': ['body-default'],
|
|
426
|
+
'TH': ['heading-2xs'],
|
|
427
|
+
// 'TD': [], // No specific classes for TD as per current requirements
|
|
428
|
+
// 'TR': [], // No specific classes for TR as per current requirements
|
|
429
|
+
// 'THEAD': [], // No specific classes for THEAD as per current requirements
|
|
430
|
+
// 'TBODY': [] // No specific classes for TBODY as per current requirements
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Handles the addition of new elements to the table.
|
|
435
|
+
* Callback function for ChildItemService subscriptions contained in tagCollections.
|
|
436
|
+
* @param {NodeList} addedNodes
|
|
437
|
+
* @private
|
|
438
|
+
*/
|
|
439
|
+
collectionUpdated = ({addedItems}) => {
|
|
440
|
+
if (addedItems?.length) {
|
|
441
|
+
const itemType = addedItems[0].tagName;
|
|
442
|
+
if (!itemType) return;
|
|
443
|
+
const itemClasses = this.#elementClasses[itemType];
|
|
444
|
+
if (itemClasses) addedItems.forEach((item) => item.classList.add(...itemClasses));
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Creates a ChildItemService for each relevant table tag to manage collections of those elements.
|
|
450
|
+
* To create a collection for a new tag, add it to the tagCollections array.
|
|
451
|
+
* @type {Object<string, ChildItemService>}
|
|
452
|
+
* @private
|
|
453
|
+
*/
|
|
454
|
+
#tagCollections = ['TH', 'TD', 'TR', 'THEAD', 'TBODY', 'TABLE']
|
|
455
|
+
.reduce((collections, tag) => {
|
|
456
|
+
collections[tag] = new ChildItemService({ callback: this.collectionUpdated });
|
|
457
|
+
return collections;
|
|
458
|
+
}, {});
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Gets the class map based on this.#elementClasses for a given tag.
|
|
462
|
+
* @param {HTMLElement.tagName} tag
|
|
463
|
+
* @returns {Object} - Class map for use with lit's classMap directive.
|
|
464
|
+
* @private
|
|
465
|
+
*/
|
|
466
|
+
#classMapFor(tag) {
|
|
467
|
+
const normalizedTag = tag?.toUpperCase();
|
|
468
|
+
return this.#elementClasses[normalizedTag]?.reduce((acc, className) => {
|
|
469
|
+
acc[className] = true;
|
|
470
|
+
return acc;
|
|
471
|
+
}, {}) || {};
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
constructor() {
|
|
475
|
+
super();
|
|
476
|
+
|
|
477
|
+
this._initializeDefaults();
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
_initializeDefaults() {
|
|
481
|
+
this.nowrap = false;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
static get properties() {
|
|
485
|
+
return {
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* An array of strings representing the table's column headers.
|
|
489
|
+
*/
|
|
490
|
+
columnHeaders: {
|
|
491
|
+
type: Array,
|
|
492
|
+
reflect: true
|
|
493
|
+
},
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* An array of objects representing the table's data rows.
|
|
497
|
+
*/
|
|
498
|
+
componentData: {
|
|
499
|
+
type: Array,
|
|
500
|
+
reflect: true
|
|
501
|
+
},
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* When true, prevents the table from wrapping its content.
|
|
505
|
+
*/
|
|
506
|
+
nowrap: {
|
|
507
|
+
type: Boolean,
|
|
508
|
+
reflect: true
|
|
509
|
+
},
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
static get styles() {
|
|
514
|
+
return [styleCss, tokensCss];
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* This will register this element with the browser.
|
|
519
|
+
* @param {string} [name="auro-table"] - The name of the element that you want to register.
|
|
520
|
+
*
|
|
521
|
+
* @example
|
|
522
|
+
* AuroTable.register("custom-table") // this will register this element to <custom-table/>
|
|
523
|
+
*
|
|
524
|
+
*/
|
|
525
|
+
static register(name = "auro-table") {
|
|
526
|
+
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroTable);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
updated(changedProperties) {
|
|
530
|
+
if (changedProperties.has("columnHeaders")) {
|
|
531
|
+
this.#extractHeaders();
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
if (changedProperties.has("componentData")) {
|
|
535
|
+
this.#extractRows();
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
firstUpdated() {
|
|
540
|
+
// Add the tag name as an attribute if it is different than the component name
|
|
541
|
+
this.#runtimeUtils.handleComponentTagRename(this, "auro-table");
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
disconnectedCallback() {
|
|
545
|
+
super.disconnectedCallback();
|
|
546
|
+
|
|
547
|
+
if (this.#tableObserver) {
|
|
548
|
+
this.#tableObserver.disconnect();
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* ATTRIBUTE TABLE RENDERING LOGIC
|
|
554
|
+
*/
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* Extracts headers from the columnHeaders property and populates the table header.
|
|
558
|
+
* @returns { void }
|
|
559
|
+
* @private
|
|
560
|
+
*/
|
|
561
|
+
#extractHeaders() {
|
|
562
|
+
if (this.columnHeaders) {
|
|
563
|
+
|
|
564
|
+
if (!this.#tableHeader) {
|
|
565
|
+
console.warn("auro-table: #tableHeader is null or undefined in #extractHeaders(). This may indicate a rendering or initialization issue.");
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
this.#tableHeader.innerHTML = "";
|
|
570
|
+
|
|
571
|
+
const tableHeaderRow = document.createElement("tr");
|
|
572
|
+
this.#tableHeader.appendChild(tableHeaderRow);
|
|
573
|
+
|
|
574
|
+
this.columnHeaders.forEach((header) => {
|
|
575
|
+
const th = document.createElement("th");
|
|
576
|
+
th.classList.add(...this.#elementClasses.TH);
|
|
577
|
+
|
|
578
|
+
th.innerHTML = header;
|
|
579
|
+
tableHeaderRow.appendChild(th);
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Extracts rows from the componentData property and populates the table body.
|
|
586
|
+
* @returns { void }
|
|
587
|
+
* @private
|
|
588
|
+
*/
|
|
589
|
+
#extractRows() {
|
|
590
|
+
if (!this.#tableBody) {
|
|
591
|
+
console.error("auro-table: #tableBody is missing. Unable to extract rows.");
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
// Clear existing table body content
|
|
596
|
+
this.#tableBody.innerHTML = "";
|
|
597
|
+
|
|
598
|
+
if (this.componentData && this.columnHeaders) {
|
|
599
|
+
|
|
600
|
+
// Use DocumentFragment for better performance
|
|
601
|
+
const fragment = document.createDocumentFragment();
|
|
602
|
+
|
|
603
|
+
// Create rows and cells
|
|
604
|
+
this.componentData.forEach((row) => {
|
|
605
|
+
const tr = document.createElement("tr");
|
|
606
|
+
|
|
607
|
+
this.columnHeaders.forEach((column) => {
|
|
608
|
+
const td = document.createElement("td");
|
|
609
|
+
const content = row[column] || "";
|
|
610
|
+
td.innerHTML = content;
|
|
611
|
+
tr.appendChild(td);
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
// Append the row to the fragment
|
|
615
|
+
fragment.appendChild(tr);
|
|
616
|
+
});
|
|
617
|
+
|
|
618
|
+
// Single DOM insertion via fragment
|
|
619
|
+
this.#tableBody.appendChild(fragment);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* SLOTTED TABLE LOGIC
|
|
625
|
+
*/
|
|
626
|
+
|
|
627
|
+
/**
|
|
628
|
+
* Observes mutations to the table element and adds or removes elements from collections accordingly.
|
|
629
|
+
* @param {HTMLTableElement} table
|
|
630
|
+
* @private
|
|
631
|
+
*/
|
|
632
|
+
#observeTableMutations(table) {
|
|
633
|
+
if (this.#tableObserver) {
|
|
634
|
+
this.#tableObserver.disconnect();
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
this.#tableObserver = new MutationObserver((mutationsList) => {
|
|
638
|
+
for (const mutation of mutationsList) {
|
|
639
|
+
mutation.addedNodes.forEach(node => {
|
|
640
|
+
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
641
|
+
this.#tagCollections[node.tagName]?.add(node);
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
mutation.removedNodes.forEach(node => {
|
|
645
|
+
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
646
|
+
this.#tagCollections[node.tagName]?.remove(node);
|
|
647
|
+
}
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
});
|
|
651
|
+
|
|
652
|
+
this.#tableObserver.observe(table, { childList: true, subtree: true });
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* Extracts relevant elements from a slotted table and adds them to collections for tracking.
|
|
657
|
+
* @param {HTMLTableElement} table
|
|
658
|
+
* @private
|
|
659
|
+
*/
|
|
660
|
+
#extractElementsFromSlottedTable(table) {
|
|
661
|
+
const headers = table.querySelectorAll("th");
|
|
662
|
+
const dataCells = table.querySelectorAll("td");
|
|
663
|
+
const rows = table.querySelectorAll("tr");
|
|
664
|
+
const theads = table.querySelectorAll("thead");
|
|
665
|
+
const tbodys = table.querySelectorAll("tbody");
|
|
666
|
+
|
|
667
|
+
[...headers, ...dataCells, ...rows, ...theads, ...tbodys, table].forEach((item) => this.#tagCollections[item.tagName]?.add(item));
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Binds the component to a slotted table element.
|
|
672
|
+
* This includes extracting existing elements and observing for mutations.
|
|
673
|
+
* @param {HTMLTableElement} table
|
|
674
|
+
* @private
|
|
675
|
+
*/
|
|
676
|
+
#bindToSlottedTable(table) {
|
|
677
|
+
|
|
678
|
+
this.#extractElementsFromSlottedTable(table);
|
|
679
|
+
this.#observeTableMutations(table);
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* Injects styles into the slotted table.
|
|
684
|
+
* @param {HTMLTableElement} table
|
|
685
|
+
* @returns { void }
|
|
686
|
+
* @private
|
|
687
|
+
*/
|
|
688
|
+
#injectStylesIntoSlottedTable(table) {
|
|
689
|
+
|
|
690
|
+
// Remove existing style tag to prevent duplicates
|
|
691
|
+
const existingStyleTag = table.querySelector(".auro-table--injected-styles");
|
|
692
|
+
if (existingStyleTag) return;
|
|
693
|
+
|
|
694
|
+
// Create a new style tag with the desired styles
|
|
695
|
+
const styleTag = document.createElement("style");
|
|
696
|
+
styleTag.classList.add("auro-table--injected-styles");
|
|
697
|
+
styleTag.textContent = AuroTable.#tableStylesTextContent;
|
|
698
|
+
table.prepend(styleTag);
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* Handles when elements are projected into the default slot
|
|
703
|
+
* @returns { void }
|
|
704
|
+
* @private
|
|
705
|
+
*/
|
|
706
|
+
#handleExternalTableSlotChange() {
|
|
707
|
+
|
|
708
|
+
// Get the slotted table element
|
|
709
|
+
const slot = this.shadowRoot.querySelector("slot");
|
|
710
|
+
const assignedNodes = slot.assignedNodes({ flatten: true });
|
|
711
|
+
const slottedTable = assignedNodes
|
|
712
|
+
.filter(node => node.nodeType === Node.ELEMENT_NODE)
|
|
713
|
+
.find(node => node.nodeName === "TABLE");
|
|
714
|
+
|
|
715
|
+
if (slottedTable) {
|
|
716
|
+
this.#bindToSlottedTable(slottedTable);
|
|
717
|
+
this.#injectStylesIntoSlottedTable(slottedTable);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
// function that renders the HTML and CSS into the scope of the component
|
|
722
|
+
render() {
|
|
723
|
+
return this.columnHeaders?.length && this.componentData?.length
|
|
724
|
+
|
|
725
|
+
? b`
|
|
726
|
+
<table ${n(this.#tableTagRef)} class=${e(this.#classMapFor('TABLE'))}>
|
|
727
|
+
<thead ${n(this.#tableHeaderRef)}>
|
|
728
|
+
</thead>
|
|
729
|
+
<tbody ${n(this.#tableBodyRef)}>
|
|
730
|
+
</tbody>
|
|
731
|
+
</table>
|
|
732
|
+
`
|
|
733
|
+
: b`
|
|
734
|
+
<slot @slotchange=${this.#handleExternalTableSlotChange}></slot>
|
|
735
|
+
`;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
2
738
|
|
|
3
739
|
AuroTable.register();
|