@internetarchive/ads-table 1.2.0 → 1.2.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.
- package/.rollup.cache/Users/jeffwklein/work/archive/ads-common/packages/ads-table/dist/ads-table.d.ts +2 -2
- package/.rollup.cache/Users/jeffwklein/work/archive/ads-common/packages/ads-table/dist/ads-table.js +43 -26
- package/.rollup.cache/Users/jeffwklein/work/archive/ads-common/packages/ads-table/dist/ads-table.js.map +1 -1
- package/.rollup.cache/Users/jeffwklein/work/archive/ads-common/packages/ads-table/dist/index.d.ts +1 -1
- package/.rollup.cache/Users/jeffwklein/work/archive/ads-common/packages/ads-table/dist/index.js +1 -1
- package/.rollup.cache/Users/jeffwklein/work/archive/ads-common/packages/ads-table/dist/index.js.map +1 -1
- package/.rollup.cache/Users/jeffwklein/work/archive/ads-common/packages/ads-table/tsconfig.tsbuildinfo +1 -1
- package/dist/ads-table.d.ts +2 -2
- package/dist/ads-table.js +43 -26
- package/dist/ads-table.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +162 -211
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/ads-table.ts +45 -34
- package/src/index.ts +0 -1
- package/tsconfig.json +2 -1
- package/tsconfig.tsbuildinfo +1 -1
package/dist/index.js
CHANGED
|
@@ -32,65 +32,58 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
32
32
|
* Copyright 2019 Google LLC
|
|
33
33
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
34
34
|
*/
|
|
35
|
-
const t$2=globalThis,e$
|
|
35
|
+
const t$2=globalThis,e$4=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$2=Symbol(),o$4=new WeakMap;let n$3 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$2)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$4&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$4.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$4.set(s,t));}return t}toString(){return this.cssText}};const r$4=t=>new n$3("string"==typeof t?t:t+"",void 0,s$2),i$3=(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$3(o,t,s$2)},S$1=(s,o)=>{if(e$4)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$2=e$4?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$4(e)})(t):t;
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* @license
|
|
39
39
|
* Copyright 2017 Google LLC
|
|
40
40
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
41
|
-
*/const{is:i$2,defineProperty:e$
|
|
41
|
+
*/const{is:i$2,defineProperty:e$3,getOwnPropertyDescriptor:h$1,getOwnPropertyNames:r$3,getOwnPropertySymbols:o$3,getPrototypeOf:n$2}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.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$1=(t,s)=>!i$2(t,s),b={attribute:true,type:String,converter:u$1,reflect:false,useDefault:false,hasChanged:f$1};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){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$3(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$1(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}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$2(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$3(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$2(s));}else void 0!==s&&i.push(c$2(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){if(void 0!==t){const e=this.constructor,h=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??f$1)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(e._$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.1");
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
* @license
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
47
|
*/
|
|
48
|
-
const t$1=globalThis,i$1=t
|
|
48
|
+
const t$1=globalThis,i$1=t$1.trustedTypes,s$1=i$1?i$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$2="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$2="?"+h,n$1=`<${o$2}>`,r$2=document,l=()=>r$2.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r$2.createTreeWalker(r$2,129);function P(t,i){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$1?s$1.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n$1:d>=0?(o.push(a),s.slice(0,d)+e$2+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$2)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H:"?"===e[1]?I:"@"===e[1]?L:k}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$1?i$1.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),C.nextNode(),d.push({type:2,index:++c});r.append(t[s],l());}}}else if(8===r.nodeType)if(r.data===o$2)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h,t+1));)d.push({type:7,index:c}),t+=h.length-1;}c++;}}static createElement(t,i){const s=r$2.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){if(i===T)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(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=S(t,h._$AS(t,i.values),h,e)),i}class M{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??r$2).importNode(i,true);C.currentNode=e;let h=C.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new z(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C.nextNode(),o++);}return C.currentNode=r$2,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 R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=E,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=S(this,t,i),c(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(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!==E&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r$2.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=N.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new N(t)),i}k(t){a(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 R(this.O(l()),this.O(l()),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,i){for(this._$AP?.(false,true,i);t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=E,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=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=S(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S(this,e[s+n],i,n),r===T&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===E?t=E:t!==E&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class H extends k{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}}class I extends k{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S(this,t,i,0)??E)===T)return;const s=this._$AH,e=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==E&&(s===E||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){S(this,t);}}const j=t$1.litHtmlPolyfillSupport;j?.(N,R),(t$1.litHtmlVersions??=[]).push("3.3.1");const B=(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 R(i.insertBefore(l(),t),t,void 0,s??{});}return h._$AI(t),h};
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* @license
|
|
52
52
|
* Copyright 2017 Google LLC
|
|
53
53
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
54
|
-
*/const s=globalThis;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=
|
|
54
|
+
*/const s=globalThis;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=B(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return T}}i._$litElement$=true,i["finalized"]=true,s.litElementHydrateSupport?.({LitElement:i});const o$1=s.litElementPolyfillSupport;o$1?.({LitElement:i});(s.litElementVersions??=[]).push("4.2.1");
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
57
|
* @license
|
|
58
58
|
* Copyright 2017 Google LLC
|
|
59
59
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
60
60
|
*/
|
|
61
|
-
const t=t=>(e,o)=>{ void 0!==o?o.addInitializer(()=>{customElements.define(t,e);}):customElements.define(t,e);};
|
|
61
|
+
const t=t=>(e,o)=>{ void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
64
|
* @license
|
|
65
65
|
* Copyright 2017 Google LLC
|
|
66
66
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
67
|
-
*/const o={attribute:true,type:String,converter:u$1,reflect:false,hasChanged:f$1},r$
|
|
67
|
+
*/const o={attribute:true,type:String,converter:u$1,reflect:false,hasChanged:f$1},r$1=(t=o,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=true),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t);},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t);}}throw Error("Unsupported decorator location: "+n)};function n(t){return (e,o)=>"object"==typeof o?r$1(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
70
|
* @license
|
|
71
71
|
* Copyright 2017 Google LLC
|
|
72
72
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
73
|
-
*/function r
|
|
73
|
+
*/function r(r){return n({...r,state:true,attribute:false})}
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* @license
|
|
77
77
|
* Copyright 2017 Google LLC
|
|
78
78
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
79
79
|
*/
|
|
80
|
-
const e$
|
|
80
|
+
const e$1=(e,t,c)=>(c.configurable=true,c.enumerable=true,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
83
|
* @license
|
|
84
84
|
* Copyright 2017 Google LLC
|
|
85
85
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
86
|
-
*/function e
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* @license
|
|
90
|
-
* Copyright 2017 Google LLC
|
|
91
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
92
|
-
*/
|
|
93
|
-
let e;function r(r){return (n,o)=>e$2(n,o,{get(){return (this.renderRoot??(e??=document.createDocumentFragment())).querySelectorAll(r)}})}
|
|
86
|
+
*/function e(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;return e$1(n,s,{get(){return o(this)}})}}
|
|
94
87
|
|
|
95
88
|
// static class that encapsulates shorthands and utilities for emitting events.
|
|
96
89
|
class EventHelpers {
|
|
@@ -109,13 +102,6 @@ EventHelpers.defaultEventOptions = {
|
|
|
109
102
|
};
|
|
110
103
|
|
|
111
104
|
class QuickLRU extends Map {
|
|
112
|
-
#size = 0;
|
|
113
|
-
#cache = new Map();
|
|
114
|
-
#oldCache = new Map();
|
|
115
|
-
#maxSize;
|
|
116
|
-
#maxAge;
|
|
117
|
-
#onEviction;
|
|
118
|
-
|
|
119
105
|
constructor(options = {}) {
|
|
120
106
|
super();
|
|
121
107
|
|
|
@@ -127,30 +113,30 @@ class QuickLRU extends Map {
|
|
|
127
113
|
throw new TypeError('`maxAge` must be a number greater than 0');
|
|
128
114
|
}
|
|
129
115
|
|
|
130
|
-
|
|
131
|
-
this
|
|
132
|
-
this
|
|
116
|
+
// TODO: Use private class fields when ESLint supports them.
|
|
117
|
+
this.maxSize = options.maxSize;
|
|
118
|
+
this.maxAge = options.maxAge || Number.POSITIVE_INFINITY;
|
|
119
|
+
this.onEviction = options.onEviction;
|
|
120
|
+
this.cache = new Map();
|
|
121
|
+
this.oldCache = new Map();
|
|
122
|
+
this._size = 0;
|
|
133
123
|
}
|
|
134
124
|
|
|
135
|
-
//
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
#emitEvictions(cache) {
|
|
141
|
-
if (typeof this.#onEviction !== 'function') {
|
|
125
|
+
// TODO: Use private class methods when targeting Node.js 16.
|
|
126
|
+
_emitEvictions(cache) {
|
|
127
|
+
if (typeof this.onEviction !== 'function') {
|
|
142
128
|
return;
|
|
143
129
|
}
|
|
144
130
|
|
|
145
131
|
for (const [key, item] of cache) {
|
|
146
|
-
this
|
|
132
|
+
this.onEviction(key, item.value);
|
|
147
133
|
}
|
|
148
134
|
}
|
|
149
135
|
|
|
150
|
-
|
|
136
|
+
_deleteIfExpired(key, item) {
|
|
151
137
|
if (typeof item.expiry === 'number' && item.expiry <= Date.now()) {
|
|
152
|
-
if (typeof this
|
|
153
|
-
this
|
|
138
|
+
if (typeof this.onEviction === 'function') {
|
|
139
|
+
this.onEviction(key, item.value);
|
|
154
140
|
}
|
|
155
141
|
|
|
156
142
|
return this.delete(key);
|
|
@@ -159,53 +145,54 @@ class QuickLRU extends Map {
|
|
|
159
145
|
return false;
|
|
160
146
|
}
|
|
161
147
|
|
|
162
|
-
|
|
163
|
-
const deleted = this
|
|
148
|
+
_getOrDeleteIfExpired(key, item) {
|
|
149
|
+
const deleted = this._deleteIfExpired(key, item);
|
|
164
150
|
if (deleted === false) {
|
|
165
151
|
return item.value;
|
|
166
152
|
}
|
|
167
153
|
}
|
|
168
154
|
|
|
169
|
-
|
|
170
|
-
return item.expiry ? this
|
|
155
|
+
_getItemValue(key, item) {
|
|
156
|
+
return item.expiry ? this._getOrDeleteIfExpired(key, item) : item.value;
|
|
171
157
|
}
|
|
172
158
|
|
|
173
|
-
|
|
159
|
+
_peek(key, cache) {
|
|
174
160
|
const item = cache.get(key);
|
|
175
|
-
|
|
161
|
+
|
|
162
|
+
return this._getItemValue(key, item);
|
|
176
163
|
}
|
|
177
164
|
|
|
178
|
-
|
|
179
|
-
this
|
|
180
|
-
this
|
|
165
|
+
_set(key, value) {
|
|
166
|
+
this.cache.set(key, value);
|
|
167
|
+
this._size++;
|
|
181
168
|
|
|
182
|
-
if (this
|
|
183
|
-
this
|
|
184
|
-
this
|
|
185
|
-
this
|
|
186
|
-
this
|
|
169
|
+
if (this._size >= this.maxSize) {
|
|
170
|
+
this._size = 0;
|
|
171
|
+
this._emitEvictions(this.oldCache);
|
|
172
|
+
this.oldCache = this.cache;
|
|
173
|
+
this.cache = new Map();
|
|
187
174
|
}
|
|
188
175
|
}
|
|
189
176
|
|
|
190
|
-
|
|
191
|
-
this
|
|
192
|
-
this
|
|
177
|
+
_moveToRecent(key, item) {
|
|
178
|
+
this.oldCache.delete(key);
|
|
179
|
+
this._set(key, item);
|
|
193
180
|
}
|
|
194
181
|
|
|
195
|
-
*
|
|
196
|
-
for (const item of this
|
|
182
|
+
* _entriesAscending() {
|
|
183
|
+
for (const item of this.oldCache) {
|
|
197
184
|
const [key, value] = item;
|
|
198
|
-
if (!this
|
|
199
|
-
const deleted = this
|
|
185
|
+
if (!this.cache.has(key)) {
|
|
186
|
+
const deleted = this._deleteIfExpired(key, value);
|
|
200
187
|
if (deleted === false) {
|
|
201
188
|
yield item;
|
|
202
189
|
}
|
|
203
190
|
}
|
|
204
191
|
}
|
|
205
192
|
|
|
206
|
-
for (const item of this
|
|
193
|
+
for (const item of this.cache) {
|
|
207
194
|
const [key, value] = item;
|
|
208
|
-
const deleted = this
|
|
195
|
+
const deleted = this._deleteIfExpired(key, value);
|
|
209
196
|
if (deleted === false) {
|
|
210
197
|
yield item;
|
|
211
198
|
}
|
|
@@ -213,79 +200,73 @@ class QuickLRU extends Map {
|
|
|
213
200
|
}
|
|
214
201
|
|
|
215
202
|
get(key) {
|
|
216
|
-
if (this
|
|
217
|
-
const item = this
|
|
218
|
-
|
|
203
|
+
if (this.cache.has(key)) {
|
|
204
|
+
const item = this.cache.get(key);
|
|
205
|
+
|
|
206
|
+
return this._getItemValue(key, item);
|
|
219
207
|
}
|
|
220
208
|
|
|
221
|
-
if (this
|
|
222
|
-
const item = this
|
|
223
|
-
if (this
|
|
224
|
-
this
|
|
209
|
+
if (this.oldCache.has(key)) {
|
|
210
|
+
const item = this.oldCache.get(key);
|
|
211
|
+
if (this._deleteIfExpired(key, item) === false) {
|
|
212
|
+
this._moveToRecent(key, item);
|
|
225
213
|
return item.value;
|
|
226
214
|
}
|
|
227
215
|
}
|
|
228
216
|
}
|
|
229
217
|
|
|
230
|
-
set(key, value, {maxAge = this
|
|
231
|
-
const expiry =
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
if (this
|
|
236
|
-
this
|
|
218
|
+
set(key, value, {maxAge = this.maxAge} = {}) {
|
|
219
|
+
const expiry =
|
|
220
|
+
typeof maxAge === 'number' && maxAge !== Number.POSITIVE_INFINITY ?
|
|
221
|
+
Date.now() + maxAge :
|
|
222
|
+
undefined;
|
|
223
|
+
if (this.cache.has(key)) {
|
|
224
|
+
this.cache.set(key, {
|
|
237
225
|
value,
|
|
238
|
-
expiry
|
|
226
|
+
expiry
|
|
239
227
|
});
|
|
240
228
|
} else {
|
|
241
|
-
this
|
|
229
|
+
this._set(key, {value, expiry});
|
|
242
230
|
}
|
|
243
231
|
|
|
244
232
|
return this;
|
|
245
233
|
}
|
|
246
234
|
|
|
247
235
|
has(key) {
|
|
248
|
-
if (this
|
|
249
|
-
return !this
|
|
236
|
+
if (this.cache.has(key)) {
|
|
237
|
+
return !this._deleteIfExpired(key, this.cache.get(key));
|
|
250
238
|
}
|
|
251
239
|
|
|
252
|
-
if (this
|
|
253
|
-
return !this
|
|
240
|
+
if (this.oldCache.has(key)) {
|
|
241
|
+
return !this._deleteIfExpired(key, this.oldCache.get(key));
|
|
254
242
|
}
|
|
255
243
|
|
|
256
244
|
return false;
|
|
257
245
|
}
|
|
258
246
|
|
|
259
247
|
peek(key) {
|
|
260
|
-
if (this
|
|
261
|
-
return this
|
|
248
|
+
if (this.cache.has(key)) {
|
|
249
|
+
return this._peek(key, this.cache);
|
|
262
250
|
}
|
|
263
251
|
|
|
264
|
-
if (this
|
|
265
|
-
return this
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
expiresIn(key) {
|
|
270
|
-
const item = this.#cache.get(key) ?? this.#oldCache.get(key);
|
|
271
|
-
if (item) {
|
|
272
|
-
return item.expiry ? item.expiry - Date.now() : Number.POSITIVE_INFINITY;
|
|
252
|
+
if (this.oldCache.has(key)) {
|
|
253
|
+
return this._peek(key, this.oldCache);
|
|
273
254
|
}
|
|
274
255
|
}
|
|
275
256
|
|
|
276
257
|
delete(key) {
|
|
277
|
-
const deleted = this
|
|
258
|
+
const deleted = this.cache.delete(key);
|
|
278
259
|
if (deleted) {
|
|
279
|
-
this
|
|
260
|
+
this._size--;
|
|
280
261
|
}
|
|
281
262
|
|
|
282
|
-
return this
|
|
263
|
+
return this.oldCache.delete(key) || deleted;
|
|
283
264
|
}
|
|
284
265
|
|
|
285
266
|
clear() {
|
|
286
|
-
this
|
|
287
|
-
this
|
|
288
|
-
this
|
|
267
|
+
this.cache.clear();
|
|
268
|
+
this.oldCache.clear();
|
|
269
|
+
this._size = 0;
|
|
289
270
|
}
|
|
290
271
|
|
|
291
272
|
resize(newSize) {
|
|
@@ -293,41 +274,23 @@ class QuickLRU extends Map {
|
|
|
293
274
|
throw new TypeError('`maxSize` must be a number greater than 0');
|
|
294
275
|
}
|
|
295
276
|
|
|
296
|
-
const items = [...this
|
|
277
|
+
const items = [...this._entriesAscending()];
|
|
297
278
|
const removeCount = items.length - newSize;
|
|
298
279
|
if (removeCount < 0) {
|
|
299
|
-
this
|
|
300
|
-
this
|
|
301
|
-
this
|
|
280
|
+
this.cache = new Map(items);
|
|
281
|
+
this.oldCache = new Map();
|
|
282
|
+
this._size = items.length;
|
|
302
283
|
} else {
|
|
303
284
|
if (removeCount > 0) {
|
|
304
|
-
this
|
|
285
|
+
this._emitEvictions(items.slice(0, removeCount));
|
|
305
286
|
}
|
|
306
287
|
|
|
307
|
-
this
|
|
308
|
-
this
|
|
309
|
-
this
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
this.#maxSize = newSize;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
evict(count = 1) {
|
|
316
|
-
const requested = Number(count);
|
|
317
|
-
if (!requested || requested <= 0) {
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
const items = [...this.#entriesAscending()];
|
|
322
|
-
const evictCount = Math.trunc(Math.min(requested, Math.max(items.length - 1, 0)));
|
|
323
|
-
if (evictCount <= 0) {
|
|
324
|
-
return;
|
|
288
|
+
this.oldCache = new Map(items.slice(removeCount));
|
|
289
|
+
this.cache = new Map();
|
|
290
|
+
this._size = 0;
|
|
325
291
|
}
|
|
326
292
|
|
|
327
|
-
this
|
|
328
|
-
this.#oldCache = new Map(items.slice(evictCount));
|
|
329
|
-
this.#cache = new Map();
|
|
330
|
-
this.#size = 0;
|
|
293
|
+
this.maxSize = newSize;
|
|
331
294
|
}
|
|
332
295
|
|
|
333
296
|
* keys() {
|
|
@@ -343,18 +306,18 @@ class QuickLRU extends Map {
|
|
|
343
306
|
}
|
|
344
307
|
|
|
345
308
|
* [Symbol.iterator]() {
|
|
346
|
-
for (const item of this
|
|
309
|
+
for (const item of this.cache) {
|
|
347
310
|
const [key, value] = item;
|
|
348
|
-
const deleted = this
|
|
311
|
+
const deleted = this._deleteIfExpired(key, value);
|
|
349
312
|
if (deleted === false) {
|
|
350
313
|
yield [key, value.value];
|
|
351
314
|
}
|
|
352
315
|
}
|
|
353
316
|
|
|
354
|
-
for (const item of this
|
|
317
|
+
for (const item of this.oldCache) {
|
|
355
318
|
const [key, value] = item;
|
|
356
|
-
if (!this
|
|
357
|
-
const deleted = this
|
|
319
|
+
if (!this.cache.has(key)) {
|
|
320
|
+
const deleted = this._deleteIfExpired(key, value);
|
|
358
321
|
if (deleted === false) {
|
|
359
322
|
yield [key, value.value];
|
|
360
323
|
}
|
|
@@ -363,22 +326,22 @@ class QuickLRU extends Map {
|
|
|
363
326
|
}
|
|
364
327
|
|
|
365
328
|
* entriesDescending() {
|
|
366
|
-
let items = [...this
|
|
329
|
+
let items = [...this.cache];
|
|
367
330
|
for (let i = items.length - 1; i >= 0; --i) {
|
|
368
331
|
const item = items[i];
|
|
369
332
|
const [key, value] = item;
|
|
370
|
-
const deleted = this
|
|
333
|
+
const deleted = this._deleteIfExpired(key, value);
|
|
371
334
|
if (deleted === false) {
|
|
372
335
|
yield [key, value.value];
|
|
373
336
|
}
|
|
374
337
|
}
|
|
375
338
|
|
|
376
|
-
items = [...this
|
|
339
|
+
items = [...this.oldCache];
|
|
377
340
|
for (let i = items.length - 1; i >= 0; --i) {
|
|
378
341
|
const item = items[i];
|
|
379
342
|
const [key, value] = item;
|
|
380
|
-
if (!this
|
|
381
|
-
const deleted = this
|
|
343
|
+
if (!this.cache.has(key)) {
|
|
344
|
+
const deleted = this._deleteIfExpired(key, value);
|
|
382
345
|
if (deleted === false) {
|
|
383
346
|
yield [key, value.value];
|
|
384
347
|
}
|
|
@@ -387,32 +350,24 @@ class QuickLRU extends Map {
|
|
|
387
350
|
}
|
|
388
351
|
|
|
389
352
|
* entriesAscending() {
|
|
390
|
-
for (const [key, value] of this
|
|
353
|
+
for (const [key, value] of this._entriesAscending()) {
|
|
391
354
|
yield [key, value.value];
|
|
392
355
|
}
|
|
393
356
|
}
|
|
394
357
|
|
|
395
358
|
get size() {
|
|
396
|
-
if (!this
|
|
397
|
-
return this
|
|
359
|
+
if (!this._size) {
|
|
360
|
+
return this.oldCache.size;
|
|
398
361
|
}
|
|
399
362
|
|
|
400
363
|
let oldCacheSize = 0;
|
|
401
|
-
for (const key of this
|
|
402
|
-
if (!this
|
|
364
|
+
for (const key of this.oldCache.keys()) {
|
|
365
|
+
if (!this.cache.has(key)) {
|
|
403
366
|
oldCacheSize++;
|
|
404
367
|
}
|
|
405
368
|
}
|
|
406
369
|
|
|
407
|
-
return Math.min(this
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
get maxSize() {
|
|
411
|
-
return this.#maxSize;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
get maxAge() {
|
|
415
|
-
return this.#maxAge;
|
|
370
|
+
return Math.min(this._size + oldCacheSize, this.maxSize);
|
|
416
371
|
}
|
|
417
372
|
|
|
418
373
|
entries() {
|
|
@@ -426,15 +381,7 @@ class QuickLRU extends Map {
|
|
|
426
381
|
}
|
|
427
382
|
|
|
428
383
|
get [Symbol.toStringTag]() {
|
|
429
|
-
return
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
toString() {
|
|
433
|
-
return `QuickLRU(${this.size}/${this.maxSize})`;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
[Symbol.for('nodejs.util.inspect.custom')]() {
|
|
437
|
-
return this.toString();
|
|
384
|
+
return JSON.stringify([...this.entriesAscending()]);
|
|
438
385
|
}
|
|
439
386
|
}
|
|
440
387
|
|
|
@@ -521,9 +468,6 @@ class AdsTable extends i {
|
|
|
521
468
|
this.selectedRowIds = [];
|
|
522
469
|
this.isLoading = false;
|
|
523
470
|
}
|
|
524
|
-
getTableRowElementById(id) {
|
|
525
|
-
return Array.from(this.tableRows || []).find((row) => row.id === `row-${id}`);
|
|
526
|
-
}
|
|
527
471
|
updated(changedProperties) {
|
|
528
472
|
super.updated(changedProperties);
|
|
529
473
|
if (changedProperties.has("selectedRowIds")) {
|
|
@@ -654,13 +598,13 @@ class AdsTable extends i {
|
|
|
654
598
|
}
|
|
655
599
|
renderArrowIcon(columnKey) {
|
|
656
600
|
if (columnKey !== this.sortKey) {
|
|
657
|
-
return
|
|
601
|
+
return x ``;
|
|
658
602
|
}
|
|
659
603
|
else if (this.sortDirection === "ascending") {
|
|
660
|
-
return
|
|
604
|
+
return x `▲`;
|
|
661
605
|
}
|
|
662
606
|
else {
|
|
663
|
-
return
|
|
607
|
+
return x `▼`;
|
|
664
608
|
}
|
|
665
609
|
}
|
|
666
610
|
get selectedRowIdsSet() {
|
|
@@ -752,7 +696,21 @@ class AdsTable extends i {
|
|
|
752
696
|
return this.onUpDownArrowKey(event);
|
|
753
697
|
}
|
|
754
698
|
}
|
|
755
|
-
// listener applies
|
|
699
|
+
// listener applies only after table has focus
|
|
700
|
+
onTableKeyDown(event) {
|
|
701
|
+
if (this.disableKeyboardNavigation) {
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
// on esc or delete, emit an event
|
|
705
|
+
switch (event.key) {
|
|
706
|
+
case "Escape":
|
|
707
|
+
return this.emitEvent("table-navigate-back");
|
|
708
|
+
case "Backspace":
|
|
709
|
+
return this.emitEvent("table-navigate-back");
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
// listener applies when column has focus - does nothing since
|
|
713
|
+
// column header cannot get focus right now.
|
|
756
714
|
onColumnKeyDown(event, column) {
|
|
757
715
|
if (this.disableKeyboardNavigation) {
|
|
758
716
|
return;
|
|
@@ -781,21 +739,22 @@ class AdsTable extends i {
|
|
|
781
739
|
}
|
|
782
740
|
}
|
|
783
741
|
}
|
|
784
|
-
|
|
742
|
+
focusTableElement() {
|
|
785
743
|
var _a;
|
|
744
|
+
(_a = this.tableElement) === null || _a === void 0 ? void 0 : _a.focus();
|
|
745
|
+
}
|
|
746
|
+
onUpDownArrowKey(event) {
|
|
786
747
|
if (this.rows.length === 0) {
|
|
787
748
|
// there are no rows to navigate or select with arrows. avoids array out of bounds.
|
|
788
749
|
return;
|
|
789
750
|
}
|
|
751
|
+
// focus the main table element with each arrow key press
|
|
752
|
+
this.focusTableElement();
|
|
790
753
|
const indexOffset = event.key === "ArrowUp" ? -1 : 1;
|
|
791
754
|
const newSelectedRowIndex = this.constrainIndex(this.indexOfLastSelectedRow + indexOffset);
|
|
792
755
|
const newSelectedRowId = this.rows[newSelectedRowIndex].id;
|
|
793
|
-
if (
|
|
794
|
-
//
|
|
795
|
-
this.groupRowSelect(newSelectedRowIndex);
|
|
796
|
-
}
|
|
797
|
-
else if (this.selectedRowIds.length === 0) {
|
|
798
|
-
// select the first row if none are selected
|
|
756
|
+
if (this.selectedRowIds.length === 0) {
|
|
757
|
+
// if none are selected, select the first row
|
|
799
758
|
const firstRowId = this.rows[0] ? this.rows[0].id : undefined;
|
|
800
759
|
if (firstRowId) {
|
|
801
760
|
this.selectedRowIds = [firstRowId];
|
|
@@ -805,8 +764,6 @@ class AdsTable extends i {
|
|
|
805
764
|
// offset in the proper direction of the arrow
|
|
806
765
|
this.selectedRowIds = [newSelectedRowId];
|
|
807
766
|
}
|
|
808
|
-
// always try to focus the next element in the direction of the arrow if you can
|
|
809
|
-
(_a = this.getTableRowElementById(newSelectedRowId)) === null || _a === void 0 ? void 0 : _a.focus();
|
|
810
767
|
}
|
|
811
768
|
// ensures index values are kept to the closest in-bounds index
|
|
812
769
|
constrainIndex(index) {
|
|
@@ -818,21 +775,27 @@ class AdsTable extends i {
|
|
|
818
775
|
window.addEventListener("keydown", (e) => this.onKeyDown(e));
|
|
819
776
|
}
|
|
820
777
|
render() {
|
|
821
|
-
return
|
|
822
|
-
<table
|
|
778
|
+
return x `
|
|
779
|
+
<table
|
|
780
|
+
tabindex="0"
|
|
781
|
+
role="treegrid"
|
|
782
|
+
id="main-table"
|
|
783
|
+
@keydown=${(e) => this.onTableKeyDown(e)}
|
|
784
|
+
>
|
|
823
785
|
<thead>
|
|
824
|
-
<tr>
|
|
825
|
-
${this.visibleColumns.map((column) =>
|
|
786
|
+
<tr role="row">
|
|
787
|
+
${this.visibleColumns.map((column) => x `
|
|
826
788
|
<th
|
|
789
|
+
role="gridcell"
|
|
790
|
+
aria-label=${column.label}
|
|
827
791
|
@click=${() => this.onColumnClick(column)}
|
|
828
792
|
@keydown=${(e) => this.onColumnKeyDown(e, column)}
|
|
829
793
|
class=${column.dataType.compare ? "sortable" : ""}
|
|
830
794
|
style=${`flex: ${column.flexRatio}`}
|
|
831
|
-
tabindex="0"
|
|
832
795
|
>
|
|
833
796
|
${column.label}
|
|
834
797
|
${column.dataType.compare
|
|
835
|
-
?
|
|
798
|
+
? x `<span>${this.renderArrowIcon(column.key)}</span>`
|
|
836
799
|
: ""}
|
|
837
800
|
</th>
|
|
838
801
|
`)}
|
|
@@ -840,33 +803,37 @@ class AdsTable extends i {
|
|
|
840
803
|
</thead>
|
|
841
804
|
<tbody>
|
|
842
805
|
${!this.isLoading
|
|
843
|
-
? this.sortedRows.map((row, index) =>
|
|
806
|
+
? this.sortedRows.map((row, index) => x `
|
|
844
807
|
<tr
|
|
808
|
+
role="row"
|
|
845
809
|
@click=${(e) => this.onRowClick(e, row, index)}
|
|
846
810
|
@dblclick=${() => this.onRowDoubleClick(row)}
|
|
847
811
|
@keydown=${(e) => this.onRowKeyDown(e, row, index)}
|
|
848
812
|
class=${this.isSelected(row) ? "row-selected" : ""}
|
|
813
|
+
aria-selected=${this.isSelected(row)}
|
|
849
814
|
data-row-selected=${this.isSelected(row)}
|
|
850
815
|
data-id=${row.id}
|
|
851
816
|
id=${"row-" + row.id}
|
|
852
|
-
tabindex="0"
|
|
853
817
|
>
|
|
854
|
-
${this.visibleColumns.map((column) =>
|
|
855
|
-
<td
|
|
818
|
+
${this.visibleColumns.map((column) => x `
|
|
819
|
+
<td
|
|
820
|
+
role="gridcell"
|
|
821
|
+
style=${`flex: ${column.flexRatio}`}
|
|
822
|
+
>
|
|
856
823
|
${column.dataType.format(row.data)}
|
|
857
824
|
</td>
|
|
858
825
|
`)}
|
|
859
826
|
</tr>
|
|
860
827
|
`)
|
|
861
|
-
:
|
|
862
|
-
<tr>
|
|
863
|
-
<td class="no-data">Loading...</td>
|
|
828
|
+
: x `
|
|
829
|
+
<tr role="row">
|
|
830
|
+
<td role="gridcell" class="no-data">Loading...</td>
|
|
864
831
|
</tr>
|
|
865
832
|
`}
|
|
866
833
|
${!this.isLoading && this.sortedRows.length === 0
|
|
867
|
-
?
|
|
868
|
-
<tr>
|
|
869
|
-
<td class="no-data">${this.noDataText}</td>
|
|
834
|
+
? x `
|
|
835
|
+
<tr role="row">
|
|
836
|
+
<td role="gridcell" class="no-data">${this.noDataText}</td>
|
|
870
837
|
</tr>
|
|
871
838
|
`
|
|
872
839
|
: null}
|
|
@@ -949,11 +916,8 @@ AdsTable.styles = i$3 `
|
|
|
949
916
|
}
|
|
950
917
|
`;
|
|
951
918
|
__decorate([
|
|
952
|
-
e
|
|
919
|
+
e("#main-table")
|
|
953
920
|
], AdsTable.prototype, "tableElement", void 0);
|
|
954
|
-
__decorate([
|
|
955
|
-
r("table tr")
|
|
956
|
-
], AdsTable.prototype, "tableRows", void 0);
|
|
957
921
|
__decorate([
|
|
958
922
|
n({ type: Array })
|
|
959
923
|
], AdsTable.prototype, "rows", void 0);
|
|
@@ -961,13 +925,13 @@ __decorate([
|
|
|
961
925
|
n({ type: Boolean })
|
|
962
926
|
], AdsTable.prototype, "disableKeyboardNavigation", void 0);
|
|
963
927
|
__decorate([
|
|
964
|
-
r
|
|
928
|
+
r()
|
|
965
929
|
], AdsTable.prototype, "sortDirection", void 0);
|
|
966
930
|
__decorate([
|
|
967
|
-
r
|
|
931
|
+
r()
|
|
968
932
|
], AdsTable.prototype, "selectedRowIds", void 0);
|
|
969
933
|
__decorate([
|
|
970
|
-
r
|
|
934
|
+
r()
|
|
971
935
|
], AdsTable.prototype, "isLoading", void 0);
|
|
972
936
|
// a simple, generic, out-of-the box implementation of AdsTable
|
|
973
937
|
let AdsSimpleTable = class AdsSimpleTable extends AdsTable {
|
|
@@ -995,7 +959,7 @@ __decorate([
|
|
|
995
959
|
n({ type: String })
|
|
996
960
|
], AdsSimpleTable.prototype, "secondarySortKey", void 0);
|
|
997
961
|
__decorate([
|
|
998
|
-
r
|
|
962
|
+
r()
|
|
999
963
|
], AdsSimpleTable.prototype, "sortKey", void 0);
|
|
1000
964
|
AdsSimpleTable = __decorate([
|
|
1001
965
|
t("ads-simple-table")
|
|
@@ -1013,19 +977,6 @@ const StringDataType = {
|
|
|
1013
977
|
return value;
|
|
1014
978
|
},
|
|
1015
979
|
};
|
|
1016
|
-
// for basic boolean comparison
|
|
1017
|
-
const BooleanDataType = {
|
|
1018
|
-
compare: (a, b) => {
|
|
1019
|
-
if (a !== b) {
|
|
1020
|
-
return a ? 1 : -1;
|
|
1021
|
-
}
|
|
1022
|
-
return 0;
|
|
1023
|
-
},
|
|
1024
|
-
format(value) {
|
|
1025
|
-
return value.toString();
|
|
1026
|
-
},
|
|
1027
|
-
defaultSortDirection: "descending",
|
|
1028
|
-
};
|
|
1029
980
|
// for basic number comparison
|
|
1030
981
|
const NumberDataType = {
|
|
1031
982
|
compare: (a, b) => {
|
|
@@ -1089,5 +1040,5 @@ const NonSortable = (dataType) => ({
|
|
|
1089
1040
|
compare: undefined,
|
|
1090
1041
|
});
|
|
1091
1042
|
|
|
1092
|
-
export { AdsSimpleTable, AdsTable,
|
|
1043
|
+
export { AdsSimpleTable, AdsTable, BytesDataType, DateDataType, FromKey, NonSortable, NumberDataType, StringDataType, UndefinedHelpers };
|
|
1093
1044
|
//# sourceMappingURL=index.js.map
|