@kodaris/krubble-components 1.0.74 → 1.0.75
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/custom-elements.json +1109 -47
- package/dist/grid/grid.d.ts +187 -0
- package/dist/grid/grid.d.ts.map +1 -0
- package/dist/grid/grid.js +2419 -0
- package/dist/grid/grid.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/krubble-components.bundled.js +2521 -116
- package/dist/krubble-components.bundled.js.map +1 -1
- package/dist/krubble-components.bundled.min.js +1361 -131
- package/dist/krubble-components.bundled.min.js.map +1 -1
- package/dist/krubble-components.umd.js +2520 -115
- package/dist/krubble-components.umd.js.map +1 -1
- package/dist/krubble-components.umd.min.js +1319 -89
- package/dist/krubble-components.umd.min.js.map +1 -1
- package/package.json +5 -1
|
@@ -3,23 +3,23 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),s=new WeakMap;let
|
|
6
|
+
const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),s=new WeakMap;let r=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const i=this.t;if(t&&void 0===e){const t=void 0!==i&&1===i.length;t&&(e=s.get(i)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),t&&s.set(i,e))}return e}toString(){return this.cssText}};const o=(e,...t)=>{const s=1===e.length?e[0]:t.reduce(((t,i,s)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[s+1]),e[0]);return new r(s,e,i)},l=t?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new r("string"==typeof e?e:e+"",void 0,i))(t)})(e):e
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2017 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/,{is:
|
|
11
|
+
*/,{is:a,defineProperty:n,getOwnPropertyDescriptor:d,getOwnPropertyNames:h,getOwnPropertySymbols:c,getPrototypeOf:p}=Object,u=globalThis,f=u.trustedTypes,g=f?f.emptyScript:"",b=u.reactiveElementPolyfillSupport,v=(e,t)=>e,_={toAttribute(e,t){switch(t){case Boolean:e=e?g:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},m=(e,t)=>!a(e,t),y={attribute:!0,type:String,converter:_,reflect:!1,useDefault:!1,hasChanged:m};Symbol.metadata??=Symbol("metadata"),u.litPropertyMetadata??=new WeakMap;let x=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=y){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(e,i,t);void 0!==s&&n(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){const{get:s,set:r}=d(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:s,set(t){const o=s?.call(this);r?.call(this,t),this.requestUpdate(e,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??y}static _$Ei(){if(this.hasOwnProperty(v("elementProperties")))return;const e=p(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(v("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(v("properties"))){const e=this.properties,t=[...h(e),...c(e)];for(const i of t)this.createProperty(i,e[i])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,i]of t)this.elementProperties.set(e,i)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const i=this._$Eu(e,t);void 0!==i&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(l(e))}else void 0!==e&&t.push(l(e));return t}static _$Eu(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((i,s)=>{if(t)i.adoptedStyleSheets=s.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const t of s){const s=document.createElement("style"),r=e.litNonce;void 0!==r&&s.setAttribute("nonce",r),s.textContent=t.cssText,i.appendChild(s)}})(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){const i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(void 0!==s&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:_).toAttribute(t,i.type);this._$Em=e,null==r?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(e,t){const i=this.constructor,s=i._$Eh.get(e);if(void 0!==s&&this._$Em!==s){const e=i.getPropertyOptions(s),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:_;this._$Em=s;const o=r.fromAttribute(t,e.type);this[s]=o??this._$Ej?.get(s)??o,this._$Em=null}}requestUpdate(e,t,i,s=!1,r){if(void 0!==e){const o=this.constructor;if(!1===s&&(r=this[e]),i??=o.getPropertyOptions(e),!((i.hasChanged??m)(r,t)||i.useDefault&&i.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,i))))return;this.C(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:s,wrapped:r},o){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),!0!==r||void 0!==o)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),!0===s&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,i]of e){const{wrapped:e}=i,s=this[t];!0!==e||this._$AL.has(t)||void 0===s||this.C(t,void 0,i,s)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(e){}firstUpdated(e){}};x.elementStyles=[],x.shadowRootOptions={mode:"open"},x[v("elementProperties")]=new Map,x[v("finalized")]=new Map,b?.({ReactiveElement:x}),(u.reactiveElementVersions??=[]).push("2.1.2");
|
|
12
12
|
/**
|
|
13
13
|
* @license
|
|
14
14
|
* Copyright 2017 Google LLC
|
|
15
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
16
|
*/
|
|
17
|
-
const k=globalThis,w=k.trustedTypes,$=w?w.createPolicy("lit-html",{createHTML:e=>e}):void 0,C="$lit$",S=`lit$${Math.random().toFixed(9).slice(2)}$`,
|
|
17
|
+
const k=globalThis,w=k.trustedTypes,$=w?w.createPolicy("lit-html",{createHTML:e=>e}):void 0,C="$lit$",S=`lit$${Math.random().toFixed(9).slice(2)}$`,z="?"+S,E=`<${z}>`,O=document,T=()=>O.createComment(""),D=e=>null===e||"object"!=typeof e&&"function"!=typeof e,P=Array.isArray,A="[ \t\n\f\r]",q=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,I=/-->/g,L=/>/g,R=RegExp(`>|${A}(?:([^\\s"'>=/]+)(${A}*=${A}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),M=/'/g,H=/"/g,V=/^(?:script|style|textarea|title)$/i,j=(e=>(t,...i)=>({_$litType$:e,strings:t,values:i}))(1),B=Symbol.for("lit-noChange"),F=Symbol.for("lit-nothing"),U=new WeakMap,N=O.createTreeWalker(O,129);function W(e,t){if(!P(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==$?$.createHTML(t):t}const K=(e,t)=>{const i=e.length-1,s=[];let r,o=2===t?"<svg>":3===t?"<math>":"",l=q;for(let t=0;t<i;t++){const i=e[t];let a,n,d=-1,h=0;for(;h<i.length&&(l.lastIndex=h,n=l.exec(i),null!==n);)h=l.lastIndex,l===q?"!--"===n[1]?l=I:void 0!==n[1]?l=L:void 0!==n[2]?(V.test(n[2])&&(r=RegExp("</"+n[2],"g")),l=R):void 0!==n[3]&&(l=R):l===R?">"===n[0]?(l=r??q,d=-1):void 0===n[1]?d=-2:(d=l.lastIndex-n[2].length,a=n[1],l=void 0===n[3]?R:'"'===n[3]?H:M):l===H||l===M?l=R:l===I||l===L?l=q:(l=R,r=void 0);const c=l===R&&e[t+1].startsWith("/>")?" ":"";o+=l===q?i+E:d>=0?(s.push(a),i.slice(0,d)+C+i.slice(d)+S+c):i+S+(-2===d?t:c)}return[W(e,o+(e[i]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),s]};class X{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let r=0,o=0;const l=e.length-1,a=this.parts,[n,d]=K(e,t);if(this.el=X.createElement(n,i),N.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(s=N.nextNode())&&a.length<l;){if(1===s.nodeType){if(s.hasAttributes())for(const e of s.getAttributeNames())if(e.endsWith(C)){const t=d[o++],i=s.getAttribute(e).split(S),l=/([.?@])?(.*)/.exec(t);a.push({type:1,index:r,name:l[2],strings:i,ctor:"."===l[1]?J:"?"===l[1]?ee:"@"===l[1]?te:G}),s.removeAttribute(e)}else e.startsWith(S)&&(a.push({type:6,index:r}),s.removeAttribute(e));if(V.test(s.tagName)){const e=s.textContent.split(S),t=e.length-1;if(t>0){s.textContent=w?w.emptyScript:"";for(let i=0;i<t;i++)s.append(e[i],T()),N.nextNode(),a.push({type:2,index:++r});s.append(e[t],T())}}}else if(8===s.nodeType)if(s.data===z)a.push({type:2,index:r});else{let e=-1;for(;-1!==(e=s.data.indexOf(S,e+1));)a.push({type:7,index:r}),e+=S.length-1}r++}}static createElement(e,t){const i=O.createElement("template");return i.innerHTML=e,i}}function Y(e,t,i=e,s){if(t===B)return t;let r=void 0!==s?i._$Co?.[s]:i._$Cl;const o=D(t)?void 0:t._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),void 0===o?r=void 0:(r=new o(e),r._$AT(e,i,s)),void 0!==s?(i._$Co??=[])[s]=r:i._$Cl=r),void 0!==r&&(t=Y(e,r._$AS(e,t.values),r,s)),t}class Z{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,s=(e?.creationScope??O).importNode(t,!0);N.currentNode=s;let r=N.nextNode(),o=0,l=0,a=i[0];for(;void 0!==a;){if(o===a.index){let t;2===a.type?t=new Q(r,r.nextSibling,this,e):1===a.type?t=new a.ctor(r,a.name,a.strings,this,e):6===a.type&&(t=new ie(r,this,e)),this._$AV.push(t),a=i[++l]}o!==a?.index&&(r=N.nextNode(),o++)}return N.currentNode=O,s}p(e){let t=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class Q{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,s){this.type=2,this._$AH=F,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Y(this,e,t),D(e)?e===F||null==e||""===e?(this._$AH!==F&&this._$AR(),this._$AH=F):e!==this._$AH&&e!==B&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>P(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==F&&D(this._$AH)?this._$AA.nextSibling.data=e:this.T(O.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:i}=e,s="number"==typeof i?this._$AC(e):(void 0===i.el&&(i.el=X.createElement(W(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(t);else{const e=new Z(s,this),i=e.u(this.options);e.p(t),this.T(i),this._$AH=e}}_$AC(e){let t=U.get(e.strings);return void 0===t&&U.set(e.strings,t=new X(e)),t}k(e){P(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,s=0;for(const r of e)s===t.length?t.push(i=new Q(this.O(T()),this.O(T()),this,this.options)):i=t[s],i._$AI(r),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class G{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,r){this.type=1,this._$AH=F,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=F}_$AI(e,t=this,i,s){const r=this.strings;let o=!1;if(void 0===r)e=Y(this,e,t,0),o=!D(e)||e!==this._$AH&&e!==B,o&&(this._$AH=e);else{const s=e;let l,a;for(e=r[0],l=0;l<r.length-1;l++)a=Y(this,s[i+l],t,l),a===B&&(a=this._$AH[l]),o||=!D(a)||a!==this._$AH[l],a===F?e=F:e!==F&&(e+=(a??"")+r[l+1]),this._$AH[l]=a}o&&!s&&this.j(e)}j(e){e===F?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class J extends G{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===F?void 0:e}}class ee extends G{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==F)}}class te extends G{constructor(e,t,i,s,r){super(e,t,i,s,r),this.type=5}_$AI(e,t=this){if((e=Y(this,e,t,0)??F)===B)return;const i=this._$AH,s=e===F&&i!==F||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,r=e!==F&&(i===F||s);s&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class ie{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){Y(this,e)}}const se=k.litHtmlPolyfillSupport;se?.(X,Q),(k.litHtmlVersions??=[]).push("3.3.2");const re=(e,t,i)=>{const s=i?.renderBefore??t;let r=s._$litPart$;if(void 0===r){const e=i?.renderBefore??null;s._$litPart$=r=new Q(t.insertBefore(T(),e),e,void 0,i??{})}return r._$AI(e),r
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/},
|
|
22
|
+
*/},oe=globalThis;let le=class extends x{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=re(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return B}};le._$litElement$=!0,le.finalized=!0,oe.litElementHydrateSupport?.({LitElement:le});const ae=oe.litElementPolyfillSupport;ae?.({LitElement:le}),(oe.litElementVersions??=[]).push("4.2.2");const ne=o`
|
|
23
23
|
:host,
|
|
24
24
|
*,
|
|
25
25
|
*::before,
|
|
@@ -56,7 +56,7 @@ const k=globalThis,w=k.trustedTypes,$=w?w.createPolicy("lit-html",{createHTML:e=
|
|
|
56
56
|
* @license
|
|
57
57
|
* Copyright 2017 Google LLC
|
|
58
58
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
59
|
-
*/,he={attribute:!0,type:String,converter:_,reflect:!1,hasChanged:
|
|
59
|
+
*/,he={attribute:!0,type:String,converter:_,reflect:!1,hasChanged:m},ce=(e=he,t,i)=>{const{kind:s,metadata:r}=i;let o=globalThis.litPropertyMetadata.get(r);if(void 0===o&&globalThis.litPropertyMetadata.set(r,o=new Map),"setter"===s&&((e=Object.create(e)).wrapped=!0),o.set(i.name,e),"accessor"===s){const{name:s}=i;return{set(i){const r=t.get.call(this);t.set.call(this,i),this.requestUpdate(s,r,e,!0,i)},init(t){return void 0!==t&&this.C(s,void 0,e,t),t}}}if("setter"===s){const{name:s}=i;return function(i){const r=this[s];t.call(this,i),this.requestUpdate(s,r,e,!0,i)}}throw Error("Unsupported decorator location: "+s)};function pe(e){return(t,i)=>"object"==typeof i?ce(e,t,i):((e,t,i)=>{const s=t.hasOwnProperty(i);return t.constructor.createProperty(i,e),s?Object.getOwnPropertyDescriptor(t,i):void 0})(e,t,i)
|
|
60
60
|
/**
|
|
61
61
|
* @license
|
|
62
62
|
* Copyright 2017 Google LLC
|
|
@@ -72,7 +72,7 @@ const k=globalThis,w=k.trustedTypes,$=w?w.createPolicy("lit-html",{createHTML:e=
|
|
|
72
72
|
* Copyright 2017 Google LLC
|
|
73
73
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
74
74
|
*/
|
|
75
|
-
function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i))(t,i,{get(){return(t=>t.renderRoot?.querySelector(e)??null)(this)}})}var ge=function(e,t,i,s){var o
|
|
75
|
+
function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i))(t,i,{get(){return(t=>t.renderRoot?.querySelector(e)??null)(this)}})}var ge=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let be=class extends le{constructor(){super(...arguments),this.header="",this.expanded=!1}toggle(){this.expanded=!this.expanded}render(){return j`
|
|
76
76
|
<div class="header" @click=${this.toggle}>
|
|
77
77
|
<span class="header__title">${this.header}</span>
|
|
78
78
|
<svg class="header__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
@@ -86,7 +86,7 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
|
86
86
|
</div>
|
|
87
87
|
</div>
|
|
88
88
|
</div>
|
|
89
|
-
`}};be.styles=
|
|
89
|
+
`}};be.styles=o`
|
|
90
90
|
:host {
|
|
91
91
|
display: block;
|
|
92
92
|
margin-bottom: 16px;
|
|
@@ -144,19 +144,19 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
|
144
144
|
* Copyright 2017 Google LLC
|
|
145
145
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
146
146
|
*/
|
|
147
|
-
const ve=1,_e=2,
|
|
147
|
+
const ve=1,_e=2,me=3,ye=4,xe=e=>(...t)=>({_$litDirective$:e,values:t});let ke=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};
|
|
148
148
|
/**
|
|
149
149
|
* @license
|
|
150
150
|
* Copyright 2018 Google LLC
|
|
151
151
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
152
|
-
*/const we=xe(class extends ke{constructor(e){if(super(e),e.type!==ve||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const i=e.element.classList;for(const e of this.st)e in t||(i.remove(e),this.st.delete(e));for(const e in t){const s=!!t[e];s===this.st.has(e)||this.nt?.has(e)||(s?(i.add(e),this.st.add(e)):(i.remove(e),this.st.delete(e)))}return B}});var $e=function(e,t,i,s){var o
|
|
152
|
+
*/const we=xe(class extends ke{constructor(e){if(super(e),e.type!==ve||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const i=e.element.classList;for(const e of this.st)e in t||(i.remove(e),this.st.delete(e));for(const e in t){const s=!!t[e];s===this.st.has(e)||this.nt?.has(e)||(s?(i.add(e),this.st.add(e)):(i.remove(e),this.st.delete(e)))}return B}});var $e=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let Ce=class extends le{constructor(){super(...arguments),this.type="info",this.title="",this.dismissible=!1,this.visible=!0}_handleDismiss(){this.visible=!1,this.dispatchEvent(new CustomEvent("dismiss",{bubbles:!0,composed:!0}))}render(){const e={info:j`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/></svg>`,success:j`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/></svg>`,warning:j`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"/></svg>`,error:j`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/></svg>`};return j`
|
|
153
153
|
<div
|
|
154
154
|
class=${we({alert:!0,["alert--"+this.type]:!0,"alert--has-header":!!this.title,"alert--hidden":!this.visible})}
|
|
155
155
|
role="alert"
|
|
156
156
|
>
|
|
157
157
|
${e[this.type]}
|
|
158
158
|
<div class="content">
|
|
159
|
-
${this.title?j`<h4 class="header">${this.title}</h4>`:
|
|
159
|
+
${this.title?j`<h4 class="header">${this.title}</h4>`:F}
|
|
160
160
|
<div class="message">
|
|
161
161
|
<slot></slot>
|
|
162
162
|
</div>
|
|
@@ -172,9 +172,9 @@ const ve=1,_e=2,ye=3,me=4,xe=e=>(...t)=>({_$litDirective$:e,values:t});let ke=cl
|
|
|
172
172
|
<path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"/>
|
|
173
173
|
</svg>
|
|
174
174
|
</button>
|
|
175
|
-
`:
|
|
175
|
+
`:F}
|
|
176
176
|
</div>
|
|
177
|
-
`}};Ce.styles=
|
|
177
|
+
`}};Ce.styles=o`
|
|
178
178
|
:host {
|
|
179
179
|
display: block;
|
|
180
180
|
}
|
|
@@ -290,7 +290,7 @@ const ve=1,_e=2,ye=3,me=4,xe=e=>(...t)=>({_$litDirective$:e,values:t});let ke=cl
|
|
|
290
290
|
outline: 2px solid #3b82f6;
|
|
291
291
|
outline-offset: 2px;
|
|
292
292
|
}
|
|
293
|
-
`,$e([pe({type:String})],Ce.prototype,"type",void 0),$e([pe({type:String})],Ce.prototype,"title",void 0),$e([pe({type:Boolean})],Ce.prototype,"dismissible",void 0),$e([pe({type:Boolean})],Ce.prototype,"visible",void 0),Ce=$e([de("kr-alert")],Ce);var Se=function(e,t,i,s){var o
|
|
293
|
+
`,$e([pe({type:String})],Ce.prototype,"type",void 0),$e([pe({type:String})],Ce.prototype,"title",void 0),$e([pe({type:Boolean})],Ce.prototype,"dismissible",void 0),$e([pe({type:Boolean})],Ce.prototype,"visible",void 0),Ce=$e([de("kr-alert")],Ce);var Se=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let ze=class extends le{constructor(){super(...arguments),this.variant="flat",this.color="primary",this.size="medium",this.disabled=!1,this.options=[],this.iconPosition="left",this.split=!1,this._state="idle",this._stateText="",this._dropdownOpened=!1,this._handleHostClick=e=>{this.split&&this.options.length||this.options.length&&(e.stopPropagation(),this._toggleDropdown())},this._handleKeydown=e=>{if("Escape"===e.key&&this._dropdownOpened)this._dropdownOpened=!1;else{if("Enter"===e.key||" "===e.key){if(e.preventDefault(),this.split&&this.options.length)return void this.dispatchEvent(new MouseEvent("click",{bubbles:!0,composed:!0}));this.options.length?this._toggleDropdown():this.click()}this.split&&this.options.length&&"ArrowDown"===e.key&&(e.preventDefault(),this._dropdownOpened||this._toggleDropdown())}},this._handleClickOutside=e=>{this._dropdownOpened&&!this.contains(e.target)&&(this._dropdownOpened=!1)}}connectedCallback(){super.connectedCallback(),this.setAttribute("role",this.href?"link":"button"),this.setAttribute("tabindex","0"),this.addEventListener("keydown",this._handleKeydown),this.addEventListener("click",this._handleHostClick),document.addEventListener("click",this._handleClickOutside)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._handleKeydown),this.removeEventListener("click",this._handleHostClick),document.removeEventListener("click",this._handleClickOutside)}_handleSplitPrimaryClick(e){e.stopPropagation(),this._dropdownOpened&&(this._dropdownOpened=!1),this.dispatchEvent(new MouseEvent("click",{bubbles:!0,composed:!0}))}_handleSplitTriggerClick(e){e.stopPropagation(),this._toggleDropdown()}_toggleDropdown(){this._dropdownOpened=!this._dropdownOpened,this._dropdownOpened&&requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".dropdown");if(e){const t=this.getBoundingClientRect();e.style.top=t.bottom+4+"px",e.style.bottom="",e.style.left=t.left+"px",e.style.right="",e.style.minWidth=t.width+"px",e.style.transformOrigin="top left",e.style.maxHeight="",e.style.overflowY="";const i=e.getBoundingClientRect();i.height>window.innerHeight-t.bottom-8&&t.top>window.innerHeight-t.bottom?(e.style.top="",e.style.bottom=window.innerHeight-t.top+4+"px",e.style.transformOrigin="bottom left",e.classList.add("dropdown--above"),i.height>t.top-8&&(e.style.maxHeight=t.top-8+"px",e.style.overflowY="auto")):(e.classList.remove("dropdown--above"),i.height>window.innerHeight-t.bottom-8&&(e.style.maxHeight=window.innerHeight-t.bottom-8+"px",e.style.overflowY="auto")),i.right>window.innerWidth&&(e.style.left="",e.style.right=window.innerWidth-t.right+"px",i.bottom>window.innerHeight?e.style.transformOrigin="bottom right":e.style.transformOrigin="top right")}}))}_handleOptionClick(e,t){t.stopPropagation(),this._dropdownOpened=!1,this.dispatchEvent(new CustomEvent("option-select",{detail:{id:e.id,label:e.label},bubbles:!0,composed:!0}))}showLoading(){this._clearStateTimeout(),this._state="loading",this._stateText=""}showSuccess(e="Success",t=2e3){this._clearStateTimeout(),this._state="success",this._stateText=e,t>0&&(this._stateTimeout=window.setTimeout((()=>this.reset()),t))}showError(e="Error",t=2e3){this._clearStateTimeout(),this._state="error",this._stateText=e,t>0&&(this._stateTimeout=window.setTimeout((()=>this.reset()),t))}isLoading(){return"loading"===this._state}reset(){this._clearStateTimeout(),this._state="idle",this._stateText=""}_clearStateTimeout(){this._stateTimeout&&(clearTimeout(this._stateTimeout),this._stateTimeout=void 0)}updated(e){this.classList.toggle("kr-button--loading","loading"===this._state),this.classList.toggle("kr-button--success","success"===this._state),this.classList.toggle("kr-button--error","error"===this._state),this.classList.toggle(`kr-button--${this.variant}`,!0),this.classList.toggle(`kr-button--${this.color}`,!0),this.classList.toggle("kr-button--small","small"===this.size),this.classList.toggle("kr-button--large","large"===this.size),this.classList.toggle("kr-button--split",this.split&&!!this.options.length)}render(){if(this.split&&this.options.length)return j`
|
|
294
294
|
<div class="split-primary" @click=${e=>this._handleSplitPrimaryClick(e)}>
|
|
295
295
|
<span class="content">
|
|
296
296
|
<slot name="icon"></slot>
|
|
@@ -298,7 +298,7 @@ const ve=1,_e=2,ye=3,me=4,xe=e=>(...t)=>({_$litDirective$:e,values:t});let ke=cl
|
|
|
298
298
|
</span>
|
|
299
299
|
${"idle"!==this._state?j`<span class="state-overlay">
|
|
300
300
|
${"loading"===this._state?j`<span class="spinner"></span>`:this._stateText}
|
|
301
|
-
</span>`:
|
|
301
|
+
</span>`:F}
|
|
302
302
|
</div>
|
|
303
303
|
<div class="split-divider"></div>
|
|
304
304
|
<div class="split-trigger" @click=${e=>this._handleSplitTriggerClick(e)}>
|
|
@@ -317,10 +317,10 @@ const ve=1,_e=2,ye=3,me=4,xe=e=>(...t)=>({_$litDirective$:e,values:t});let ke=cl
|
|
|
317
317
|
<slot name="icon"></slot>
|
|
318
318
|
<slot></slot>
|
|
319
319
|
</span>
|
|
320
|
-
${this.options.length?j`<svg class="caret" xmlns="http://www.w3.org/2000/svg" height="20" width="20" viewBox="0 0 24 24" fill="currentColor"><path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"/></svg>`:
|
|
320
|
+
${this.options.length?j`<svg class="caret" xmlns="http://www.w3.org/2000/svg" height="20" width="20" viewBox="0 0 24 24" fill="currentColor"><path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"/></svg>`:F}
|
|
321
321
|
${"idle"!==this._state?j`<span class="state-overlay">
|
|
322
322
|
${"loading"===this._state?j`<span class="spinner"></span>`:this._stateText}
|
|
323
|
-
</span>`:
|
|
323
|
+
</span>`:F}
|
|
324
324
|
${this.options.length?j`
|
|
325
325
|
<div class="dropdown ${this._dropdownOpened?"dropdown--opened":""}">
|
|
326
326
|
${this.options.map((e=>j`
|
|
@@ -330,8 +330,8 @@ const ve=1,_e=2,ye=3,me=4,xe=e=>(...t)=>({_$litDirective$:e,values:t});let ke=cl
|
|
|
330
330
|
>${e.label}</button>
|
|
331
331
|
`))}
|
|
332
332
|
</div>
|
|
333
|
-
`:
|
|
334
|
-
`;return this.href?j`<a class="link" href=${this.href} target=${this.target||
|
|
333
|
+
`:F}
|
|
334
|
+
`;return this.href?j`<a class="link" href=${this.href} target=${this.target||F}>${e}</a>`:e}};ze.styles=o`
|
|
335
335
|
:host {
|
|
336
336
|
display: inline-flex;
|
|
337
337
|
position: relative;
|
|
@@ -750,13 +750,13 @@ const ve=1,_e=2,ye=3,me=4,xe=e=>(...t)=>({_$litDirective$:e,values:t});let ke=cl
|
|
|
750
750
|
pointer-events: none;
|
|
751
751
|
opacity: 0.6;
|
|
752
752
|
}
|
|
753
|
-
`,Se([pe({type:String,reflect:!0})],
|
|
753
|
+
`,Se([pe({type:String,reflect:!0})],ze.prototype,"variant",void 0),Se([pe({type:String,reflect:!0})],ze.prototype,"color",void 0),Se([pe({type:String,reflect:!0})],ze.prototype,"size",void 0),Se([pe({type:Boolean,reflect:!0})],ze.prototype,"disabled",void 0),Se([pe({type:String})],ze.prototype,"href",void 0),Se([pe({type:String})],ze.prototype,"target",void 0),Se([pe({type:Array})],ze.prototype,"options",void 0),Se([pe({type:String,reflect:!0,attribute:"icon-position"})],ze.prototype,"iconPosition",void 0),Se([pe({type:Boolean,reflect:!0})],ze.prototype,"split",void 0),Se([ue()],ze.prototype,"_state",void 0),Se([ue()],ze.prototype,"_stateText",void 0),Se([ue()],ze.prototype,"_dropdownOpened",void 0),ze=Se([de("kr-button")],ze);
|
|
754
754
|
/**
|
|
755
755
|
* @license
|
|
756
756
|
* Copyright 2017 Google LLC
|
|
757
757
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
758
758
|
*/
|
|
759
|
-
class
|
|
759
|
+
class Ee extends ke{constructor(e){if(super(e),this.it=F,e.type!==_e)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===F||null==e)return this._t=void 0,this.it=e;if(e===B)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}Ee.directiveName="unsafeHTML",Ee.resultType=1;const Oe=xe(Ee);var Te=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let De=class extends le{constructor(){super(...arguments),this.language="html",this.code="",this.activeTab="preview",this.copied=!1,this.highlightedCode=""}connectedCallback(){super.connectedCallback(),requestAnimationFrame((()=>{this.code||(this.code=this.innerHTML.trim().replace(/=""(?=[\s>])/g,"")),this.querySelectorAll("script").forEach((e=>{const t=document.createElement("script");t.textContent=e.textContent,e.replaceWith(t)})),this.code&&window.hljs&&window.hljs.getLanguage(this.language)?this.highlightedCode=window.hljs.highlight(this.code,{language:this.language}).value:this.highlightedCode=this.code.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}))}activateTab(e){this.activeTab=e}copyCode(){this.code&&navigator.clipboard.writeText(this.code).then((()=>{this.copied=!0,setTimeout((()=>{this.copied=!1}),2e3)}))}render(){return j`
|
|
760
760
|
<div class="tabs">
|
|
761
761
|
<button
|
|
762
762
|
class=${we({tab:!0,"tab--active":"preview"===this.activeTab})}
|
|
@@ -787,7 +787,7 @@ class ze extends ke{constructor(e){if(super(e),this.it=U,e.type!==_e)throw Error
|
|
|
787
787
|
<pre class="code"><code>${Oe(this.highlightedCode)}</code></pre>
|
|
788
788
|
</div>
|
|
789
789
|
|
|
790
|
-
`}};De.styles=[ne,
|
|
790
|
+
`}};De.styles=[ne,o`
|
|
791
791
|
:host {
|
|
792
792
|
display: block;
|
|
793
793
|
border: 1px solid #d5dbdb;
|
|
@@ -909,7 +909,7 @@ class ze extends ke{constructor(e){if(super(e),this.it=U,e.type!==_e)throw Error
|
|
|
909
909
|
.hljs-attribute { color: #005cc5; }
|
|
910
910
|
.hljs-property { color: #005cc5; }
|
|
911
911
|
|
|
912
|
-
`],Te([pe({type:String})],De.prototype,"language",void 0),Te([ue()],De.prototype,"code",void 0),Te([ue()],De.prototype,"activeTab",void 0),Te([ue()],De.prototype,"copied",void 0),Te([ue()],De.prototype,"highlightedCode",void 0),De=Te([de("kr-code-demo")],De);var
|
|
912
|
+
`],Te([pe({type:String})],De.prototype,"language",void 0),Te([ue()],De.prototype,"code",void 0),Te([ue()],De.prototype,"activeTab",void 0),Te([ue()],De.prototype,"copied",void 0),Te([ue()],De.prototype,"highlightedCode",void 0),De=Te([de("kr-code-demo")],De);var Pe=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let Ae=class extends le{constructor(){super(...arguments),this.items=[],this.resolvePromise=null,this.boundHandleOutsideClick=this.handleOutsideClick.bind(this),this.boundHandleKeyDown=this.handleKeyDown.bind(this)}static async open(e){const t=document.querySelector("kr-context-menu");t&&t.remove();const i=document.createElement("kr-context-menu");return document.body.appendChild(i),i.show(e)}async show(e){this.items=e.items,this.style.left=`${e.x}px`,this.style.top=`${e.y}px`,await this.updateComplete;const t=this.getBoundingClientRect();return t.right>window.innerWidth&&(this.style.left=e.x-t.width+"px"),t.bottom>window.innerHeight&&(this.style.top=e.y-t.height+"px"),requestAnimationFrame((()=>{document.addEventListener("click",this.boundHandleOutsideClick),document.addEventListener("contextmenu",this.boundHandleOutsideClick),document.addEventListener("keydown",this.boundHandleKeyDown)})),new Promise((e=>{this.resolvePromise=e}))}handleOutsideClick(e){this.contains(e.target)||this.close(null)}handleKeyDown(e){"Escape"===e.key&&this.close(null)}handleItemClick(e){e.disabled||e.divider||this.close(e)}close(e){document.removeEventListener("click",this.boundHandleOutsideClick),document.removeEventListener("contextmenu",this.boundHandleOutsideClick),document.removeEventListener("keydown",this.boundHandleKeyDown),this.resolvePromise&&(this.resolvePromise(e),this.resolvePromise=null),this.remove()}render(){return j`
|
|
913
913
|
<div class="menu">
|
|
914
914
|
${this.items.map((e=>e.divider?j`<div class="menu__divider"></div>`:j`
|
|
915
915
|
<button
|
|
@@ -922,7 +922,7 @@ class ze extends ke{constructor(e){if(super(e),this.it=U,e.type!==_e)throw Error
|
|
|
922
922
|
</button>
|
|
923
923
|
`))}
|
|
924
924
|
</div>
|
|
925
|
-
`}};
|
|
925
|
+
`}};Ae.styles=o`
|
|
926
926
|
:host {
|
|
927
927
|
position: fixed;
|
|
928
928
|
z-index: 10000;
|
|
@@ -977,13 +977,13 @@ class ze extends ke{constructor(e){if(super(e),this.it=U,e.type!==_e)throw Error
|
|
|
977
977
|
background: rgba(255, 255, 255, 0.1);
|
|
978
978
|
margin: 4px 0;
|
|
979
979
|
}
|
|
980
|
-
`,
|
|
980
|
+
`,Pe([ue()],Ae.prototype,"items",void 0),Ae=Pe([de("kr-context-menu")],Ae);
|
|
981
981
|
/**
|
|
982
982
|
* @license
|
|
983
983
|
* Copyright 2018 Google LLC
|
|
984
984
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
985
985
|
*/
|
|
986
|
-
const
|
|
986
|
+
const qe="important",Ie=" !"+qe,Le=xe(class extends ke{constructor(e){if(super(e),e.type!==ve||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,i)=>{const s=e[i];return null==s?t:t+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`}),"")}update(e,[t]){const{style:i}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?i.removeProperty(e):i[e]=null);for(const e in t){const s=t[e];if(null!=s){this.ft.add(e);const t="string"==typeof s&&s.endsWith(Ie);e.includes("-")||t?i.setProperty(e,t?s.slice(0,-11):s,t?qe:""):i[e]=s}}return B}});var Re=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let Me=class extends le{render(){return j`<slot></slot>`}};Me.styles=o`
|
|
987
987
|
:host {
|
|
988
988
|
display: flex;
|
|
989
989
|
padding: 0 24px;
|
|
@@ -998,14 +998,14 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
998
998
|
font-size: 18px;
|
|
999
999
|
font-weight: 600;
|
|
1000
1000
|
}
|
|
1001
|
-
`,Me=
|
|
1001
|
+
`,Me=Re([de("kr-dialog-header")],Me);let He=class extends le{render(){return j`<slot></slot>`}};He.styles=o`
|
|
1002
1002
|
:host {
|
|
1003
1003
|
display: block;
|
|
1004
1004
|
padding: 24px;
|
|
1005
1005
|
overflow: auto;
|
|
1006
1006
|
flex: 1 1 auto;
|
|
1007
1007
|
}
|
|
1008
|
-
`,
|
|
1008
|
+
`,He=Re([de("kr-dialog-content")],He);let Ve=class extends le{render(){return j`<slot></slot>`}};Ve.styles=o`
|
|
1009
1009
|
:host {
|
|
1010
1010
|
display: flex;
|
|
1011
1011
|
padding: 0 24px;
|
|
@@ -1016,13 +1016,13 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
1016
1016
|
gap: 12px;
|
|
1017
1017
|
justify-content: flex-end;
|
|
1018
1018
|
}
|
|
1019
|
-
`,
|
|
1019
|
+
`,Ve=Re([de("kr-dialog-footer")],Ve);class je{constructor(){this._resolvePromise=null,this._dialogElement=null,this._promise=new Promise((e=>{this._resolvePromise=e}))}setDialogElement(e){this._dialogElement=e}close(e){this._resolvePromise&&(this._resolvePromise(e),this._resolvePromise=null),this._dialogElement?.remove()}afterClosed(){return this._promise}}let Be=class extends le{constructor(){super(...arguments),this._dialogRef=null,this._contentElement=null,this.opened=!1,this.label="",this.width="560px",this._handleDocumentKeyDown=e=>{"Escape"===e.key&&this.close()}}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this._handleDocumentKeyDown)}updated(e){super.updated(e),e.has("opened")&&(this.opened?document.addEventListener("keydown",this._handleDocumentKeyDown):document.removeEventListener("keydown",this._handleDocumentKeyDown))}open(){this.opened=!0}close(){this._dialogRef?this._dialogRef.close(void 0):(this.opened=!1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))}static open(e,t){document.querySelectorAll("kr-dialog").forEach((e=>{e._dialogRef&&e.remove()}));const i=new je,s=document.createElement("kr-dialog");i.setDialogElement(s),s._dialogRef=i;const r=new e;return r.dialogRef=i,t?.data&&(r.data=t.data),t?.label&&(s.label=t.label),t?.width&&(s.width=t.width),s._contentElement=r,s.opened=!0,document.body.appendChild(s),i}_handleBackdropClick(e){e.target.classList.contains("backdrop")&&this.close()}render(){return j`
|
|
1020
1020
|
<div class="backdrop" @click=${this._handleBackdropClick}></div>
|
|
1021
|
-
<div class="dialog" style=${
|
|
1021
|
+
<div class="dialog" style=${Le({width:this.width})}>
|
|
1022
1022
|
${this.label?j`<div class="dialog__header"><div class="dialog__header-label">${this.label}</div></div>`:""}
|
|
1023
1023
|
<div class="dialog__body">${this._contentElement?this._contentElement:j`<slot></slot>`}</div>
|
|
1024
1024
|
</div>
|
|
1025
|
-
`}};Be.styles=
|
|
1025
|
+
`}};Be.styles=o`
|
|
1026
1026
|
:host {
|
|
1027
1027
|
position: fixed;
|
|
1028
1028
|
inset: 0;
|
|
@@ -1088,7 +1088,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
1088
1088
|
display: flex;
|
|
1089
1089
|
flex-direction: column;
|
|
1090
1090
|
}
|
|
1091
|
-
`,
|
|
1091
|
+
`,Re([ue()],Be.prototype,"_contentElement",void 0),Re([pe({type:Boolean,reflect:!0})],Be.prototype,"opened",void 0),Re([pe({type:String})],Be.prototype,"label",void 0),Re([pe({type:String})],Be.prototype,"width",void 0),Be=Re([de("kr-dialog")],Be);var Fe=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let Ue=class extends le{constructor(){super(...arguments),this.relativeOptions=[{key:"last-5-minutes",amount:5,unit:"minute",type:"relative"},{key:"last-30-minutes",amount:30,unit:"minute",type:"relative"},{key:"last-1-hour",amount:1,unit:"hour",type:"relative"},{key:"last-6-hours",amount:6,unit:"hour",type:"relative"},{key:"last-1-day",amount:1,unit:"day",type:"relative"},{key:"last-7-days",amount:7,unit:"day",type:"relative"},{key:"last-30-days",amount:30,unit:"day",type:"relative"}],this.disabled=!1,this.invalid=!1,this.placeholder="Select a date range",this.startDate="",this.endDate="",this._isOpen=!1,this._activeTab="relative",this._tempStartDate="",this._tempEndDate="",this._handleClickOutside=e=>{e.composedPath().includes(this)||(this._isOpen=!1)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleClickOutside),this.startDate&&(this._tempStartDate=this.startDate),this.endDate&&(this._tempEndDate=this.endDate),"relative"===this.mode?this._activeTab="relative":"absolute"===this.mode&&(this._activeTab="absolute")}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleClickOutside)}_handleTriggerClick(){this.disabled||(this._isOpen=!this._isOpen)}_handleTabClick(e){this._activeTab=e}_handleRelativeSelect(e){this.value={type:"relative",amount:e.amount,unit:e.unit},this._isOpen=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))}_handleApplyAbsolute(){this._tempStartDate&&this._tempEndDate&&(this._tempStartDate>=this._tempEndDate||(this.value={type:"absolute",startDate:this._tempStartDate,endDate:this._tempEndDate},this.startDate=this._tempStartDate,this.endDate=this._tempEndDate,this._isOpen=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))))}_handleCancel(){this._isOpen=!1,this._tempStartDate=this.startDate,this._tempEndDate=this.endDate}_formatRelativeOption(e){if(0===e.amount)return"day"===e.unit?"Today":`This ${e.unit}`;const t={second:1===e.amount?"second":"seconds",minute:1===e.amount?"minute":"minutes",hour:1===e.amount?"hour":"hours",day:1===e.amount?"day":"days",week:1===e.amount?"week":"weeks",month:1===e.amount?"month":"months",year:1===e.amount?"year":"years"};return`Last ${e.amount} ${t[e.unit]}`}_getDisplayValue(){return this.value?"relative"===this.value.type&&void 0!==this.value.amount&&this.value.unit?this._formatRelativeOption({key:"",amount:this.value.amount,unit:this.value.unit,type:"relative"}):"absolute"===this.value.type&&this.value.startDate&&this.value.endDate?`${this.value.startDate} - ${this.value.endDate}`:"":""}_renderTriggerText(){const e=this._getDisplayValue();return e?j`${e}`:j`<span class="trigger-placeholder">${this.placeholder}</span>`}_renderContent(){return"relative"===this.mode?this._renderRelativeContent():"absolute"===this.mode?this._renderAbsoluteContent():"relative"===this._activeTab?this._renderRelativeContent():this._renderAbsoluteContent()}_renderRelativeContent(){return j`
|
|
1092
1092
|
<div class="relative-options">
|
|
1093
1093
|
${this.relativeOptions.map((e=>j`
|
|
1094
1094
|
<button
|
|
@@ -1135,7 +1135,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
1135
1135
|
Apply
|
|
1136
1136
|
</kr-button>
|
|
1137
1137
|
</div>
|
|
1138
|
-
`:"relative"===this.mode?
|
|
1138
|
+
`:"relative"===this.mode?F:"absolute"===this._activeTab?j`
|
|
1139
1139
|
<div class="footer">
|
|
1140
1140
|
<kr-button variant="outline" size="small" @click=${this._handleCancel}>
|
|
1141
1141
|
Cancel
|
|
@@ -1149,7 +1149,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
1149
1149
|
Apply
|
|
1150
1150
|
</kr-button>
|
|
1151
1151
|
</div>
|
|
1152
|
-
`:
|
|
1152
|
+
`:F}_handleStartDateChange(e){this._tempStartDate=e.target.value}_handleEndDateChange(e){this._tempEndDate=e.target.value}render(){return j`
|
|
1153
1153
|
<button
|
|
1154
1154
|
part="trigger"
|
|
1155
1155
|
class=${we({trigger:!0,"trigger--invalid":this.invalid})}
|
|
@@ -1179,7 +1179,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
1179
1179
|
</button>
|
|
1180
1180
|
|
|
1181
1181
|
<div part="dropdown" class=${we({dropdown:!0,"dropdown--open":this._isOpen})}>
|
|
1182
|
-
${this.mode?
|
|
1182
|
+
${this.mode?F:j`
|
|
1183
1183
|
<div class="tabs">
|
|
1184
1184
|
<button
|
|
1185
1185
|
class=${we({tab:!0,"tab--active":"relative"===this._activeTab})}
|
|
@@ -1204,7 +1204,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
1204
1204
|
|
|
1205
1205
|
${this._renderFooter()}
|
|
1206
1206
|
</div>
|
|
1207
|
-
`}};
|
|
1207
|
+
`}};Ue.styles=o`
|
|
1208
1208
|
:host {
|
|
1209
1209
|
display: inline-block;
|
|
1210
1210
|
position: relative;
|
|
@@ -1382,7 +1382,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
1382
1382
|
padding: 0.75rem 1rem;
|
|
1383
1383
|
border-top: 1px solid #e5e7eb;
|
|
1384
1384
|
}
|
|
1385
|
-
`,
|
|
1385
|
+
`,Fe([pe({type:Object})],Ue.prototype,"value",void 0),Fe([pe({type:Array})],Ue.prototype,"relativeOptions",void 0),Fe([pe({type:Boolean})],Ue.prototype,"disabled",void 0),Fe([pe({type:Boolean})],Ue.prototype,"invalid",void 0),Fe([pe({type:String})],Ue.prototype,"placeholder",void 0),Fe([pe({type:String})],Ue.prototype,"startDate",void 0),Fe([pe({type:String})],Ue.prototype,"endDate",void 0),Fe([pe({type:String})],Ue.prototype,"mode",void 0),Fe([ue()],Ue.prototype,"_isOpen",void 0),Fe([ue()],Ue.prototype,"_activeTab",void 0),Fe([ue()],Ue.prototype,"_tempStartDate",void 0),Fe([ue()],Ue.prototype,"_tempEndDate",void 0),Ue=Fe([de("kr-date-range-picker")],Ue);var Ne,We=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let Ke=Ne=class extends le{constructor(){super(...arguments),this.dismissTimeout=null,this.type="info",this.title="",this.message="",this.duration=5e3}static show(e){for(const e of this.activeSnackbars)e.dismiss();const t=document.createElement("kr-snackbar");return t.message=e.message,t.title=e.title??"",t.type=e.type??"info",void 0!==e.duration?t.duration=e.duration:"error"===t.type?t.duration=0:t.duration=5e3,document.body.appendChild(t),t}connectedCallback(){super.connectedCallback(),this.setAttribute("role","alert"),this.classList.add(`kr-snackbar--${this.type}`),this.title&&this.classList.add("kr-snackbar--has-title"),Ne.activeSnackbars.push(this),this.duration>0&&(this.dismissTimeout=window.setTimeout((()=>{this.dismiss()}),this.duration))}disconnectedCallback(){super.disconnectedCallback();const e=Ne.activeSnackbars.indexOf(this);e>-1&&Ne.activeSnackbars.splice(e,1),this.dismissTimeout&&clearTimeout(this.dismissTimeout)}dismiss(){this.dismissTimeout&&(clearTimeout(this.dismissTimeout),this.dismissTimeout=null),this.classList.add("kr-snackbar--closing"),this.addEventListener("animationend",(()=>{this.dispatchEvent(new CustomEvent("dismiss",{bubbles:!0,composed:!0})),this.remove()}),{once:!0})}render(){const e={info:j`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/></svg>`,success:j`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/></svg>`,warning:j`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"/></svg>`,error:j`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/></svg>`};return j`
|
|
1386
1386
|
${e[this.type]}
|
|
1387
1387
|
<div class="content">
|
|
1388
1388
|
${this.title?j`<div class="title">${this.title}</div>`:""}
|
|
@@ -1398,7 +1398,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
1398
1398
|
<path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"/>
|
|
1399
1399
|
</svg>
|
|
1400
1400
|
</button>
|
|
1401
|
-
`}};Ke.styles=
|
|
1401
|
+
`}};Ke.styles=o`
|
|
1402
1402
|
:host,
|
|
1403
1403
|
*,
|
|
1404
1404
|
*::before,
|
|
@@ -1546,7 +1546,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
1546
1546
|
outline: 2px solid #3b82f6;
|
|
1547
1547
|
outline-offset: 2px;
|
|
1548
1548
|
}
|
|
1549
|
-
`,Ke.activeSnackbars=[],We([pe({type:String})],Ke.prototype,"type",void 0),We([pe({type:String})],Ke.prototype,"title",void 0),We([pe({type:String})],Ke.prototype,"message",void 0),We([pe({type:Number})],Ke.prototype,"duration",void 0),Ke=
|
|
1549
|
+
`,Ke.activeSnackbars=[],We([pe({type:String})],Ke.prototype,"type",void 0),We([pe({type:String})],Ke.prototype,"title",void 0),We([pe({type:String})],Ke.prototype,"message",void 0),We([pe({type:Number})],Ke.prototype,"duration",void 0),Ke=Ne=We([de("kr-snackbar")],Ke);var Xe=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let Ye=class extends le{constructor(){super(...arguments),this.justified=!1,this.size="medium"}updated(e){e.has("activeTabId")&&this._updateActiveTab()}firstUpdated(){this._updateActiveTab()}_getTabs(){return Array.from(this.querySelectorAll("kr-tab"))}_updateActiveTab(){const e=this._getTabs();0!==e.length&&(this.activeTabId||(this.activeTabId=e[0]?.id),e.forEach((e=>{e.active=e.id===this.activeTabId})),this.requestUpdate())}_handleTabClick(e){e.disabled||(this.activeTabId=e.id,this.dispatchEvent(new CustomEvent("tab-change",{detail:{activeTabId:e.id},bubbles:!0,composed:!0})))}_handleTabDismiss(e,t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("tab-dismiss",{detail:{tabId:e.id},bubbles:!0,composed:!0}))}_handleKeyDown(e){const t=this._getTabs().filter((e=>!e.disabled)),i=t.findIndex((e=>e.id===this.activeTabId));let s=-1;switch(e.key){case"ArrowLeft":s=i>0?i-1:t.length-1;break;case"ArrowRight":s=i<t.length-1?i+1:0;break;case"Home":s=0;break;case"End":s=t.length-1}if(s>=0){e.preventDefault();const i=t[s];this.activeTabId=i.id,this.dispatchEvent(new CustomEvent("tab-change",{detail:{activeTabId:i.id},bubbles:!0,composed:!0}));const r=this.shadowRoot?.querySelectorAll(".label"),o=Array.from(r||[]).find((e=>e.getAttribute("data-tab-id")===i.id));o?.focus()}}_renderTabIcon(e){const t=e.getIconElement();if(!t)return F;const i=t.cloneNode(!0);return i.removeAttribute("slot"),j`<span class="label-icon">${i}</span>`}render(){return j`
|
|
1550
1550
|
<div class="header" role="tablist" @keydown=${this._handleKeyDown}>
|
|
1551
1551
|
${this._getTabs().map((e=>j`
|
|
1552
1552
|
<button
|
|
@@ -1561,7 +1561,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
1561
1561
|
>
|
|
1562
1562
|
${this._renderTabIcon(e)}
|
|
1563
1563
|
<span>${e.label}</span>
|
|
1564
|
-
${e.badge?j`<span class="label-badge" style=${
|
|
1564
|
+
${e.badge?j`<span class="label-badge" style=${Le({backgroundColor:e.badgeBackground,color:e.badgeColor})}>${e.badge}</span>`:F}
|
|
1565
1565
|
${e.dismissible?j`
|
|
1566
1566
|
<button
|
|
1567
1567
|
class="label-dismiss"
|
|
@@ -1571,14 +1571,14 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
1571
1571
|
>
|
|
1572
1572
|
<svg viewBox="0 0 20 20" fill="currentColor" width="12" height="12"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"/></svg>
|
|
1573
1573
|
</button>
|
|
1574
|
-
`:
|
|
1574
|
+
`:F}
|
|
1575
1575
|
</button>
|
|
1576
1576
|
`))}
|
|
1577
1577
|
</div>
|
|
1578
1578
|
<div class="content" role="tabpanel" aria-labelledby=${this.activeTabId||""}>
|
|
1579
1579
|
<slot @slotchange=${this._updateActiveTab}></slot>
|
|
1580
1580
|
</div>
|
|
1581
|
-
`}};Ye.styles=[ne,
|
|
1581
|
+
`}};Ye.styles=[ne,o`
|
|
1582
1582
|
:host {
|
|
1583
1583
|
display: flex;
|
|
1584
1584
|
flex-direction: column;
|
|
@@ -1711,7 +1711,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
1711
1711
|
::slotted(kr-tab[active]) {
|
|
1712
1712
|
display: block;
|
|
1713
1713
|
}
|
|
1714
|
-
`],Xe([pe({type:String,attribute:"active-tab-id"})],Ye.prototype,"activeTabId",void 0),Xe([pe({type:Boolean})],Ye.prototype,"justified",void 0),Xe([pe({type:String,reflect:!0})],Ye.prototype,"size",void 0),Ye=Xe([de("kr-tab-group")],Ye);var Ze=function(e,t,i,s){var o
|
|
1714
|
+
`],Xe([pe({type:String,attribute:"active-tab-id"})],Ye.prototype,"activeTabId",void 0),Xe([pe({type:Boolean})],Ye.prototype,"justified",void 0),Xe([pe({type:String,reflect:!0})],Ye.prototype,"size",void 0),Ye=Xe([de("kr-tab-group")],Ye);var Ze=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let Qe=class extends le{constructor(){super(...arguments),this.id="",this.label="",this.badge="",this.badgeBackground="",this.badgeColor="",this.disabled=!1,this.dismissible=!1,this.active=!1}getIconElement(){return this.querySelector('[slot="icon"]')}updated(){const e=this.closest("kr-tab-group");e&&e.requestUpdate()}render(){return j`<slot></slot>`}};Qe.styles=[ne,o`
|
|
1715
1715
|
:host {
|
|
1716
1716
|
display: none;
|
|
1717
1717
|
}
|
|
@@ -1721,14 +1721,14 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
1721
1721
|
width: 100%;
|
|
1722
1722
|
height: 100%;
|
|
1723
1723
|
}
|
|
1724
|
-
`],Ze([pe({type:String,reflect:!0})],Qe.prototype,"id",void 0),Ze([pe({type:String})],Qe.prototype,"label",void 0),Ze([pe({type:String})],Qe.prototype,"badge",void 0),Ze([pe({type:String,attribute:"badge-background"})],Qe.prototype,"badgeBackground",void 0),Ze([pe({type:String,attribute:"badge-color"})],Qe.prototype,"badgeColor",void 0),Ze([pe({type:Boolean})],Qe.prototype,"disabled",void 0),Ze([pe({type:Boolean})],Qe.prototype,"dismissible",void 0),Ze([pe({type:Boolean,reflect:!0})],Qe.prototype,"active",void 0),Qe=Ze([de("kr-tab")],Qe);var Ge=function(e,t,i,s){var o
|
|
1724
|
+
`],Ze([pe({type:String,reflect:!0})],Qe.prototype,"id",void 0),Ze([pe({type:String})],Qe.prototype,"label",void 0),Ze([pe({type:String})],Qe.prototype,"badge",void 0),Ze([pe({type:String,attribute:"badge-background"})],Qe.prototype,"badgeBackground",void 0),Ze([pe({type:String,attribute:"badge-color"})],Qe.prototype,"badgeColor",void 0),Ze([pe({type:Boolean})],Qe.prototype,"disabled",void 0),Ze([pe({type:Boolean})],Qe.prototype,"dismissible",void 0),Ze([pe({type:Boolean,reflect:!0})],Qe.prototype,"active",void 0),Qe=Ze([de("kr-tab")],Qe);var Ge=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let Je=class extends le{constructor(){super(),this.label="",this.name="",this.value="",this.placeholder="Select an option",this.disabled=!1,this.required=!1,this.readonly=!1,this.hint="",this._isOpen=!1,this._highlightedIndex=-1,this._touched=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._handleOutsideClick=e=>{e.composedPath().includes(this)||this._close()},this._handleKeyDown=e=>{if(!this._isOpen)return;const t=Array.from(this.querySelectorAll("kr-select-option"));switch(e.key){case"Escape":this._close(),this._triggerElement?.focus();break;case"ArrowDown":if(e.preventDefault(),t.some((e=>!e.disabled))){let e=this._highlightedIndex+1;for(;e<t.length&&t[e]?.disabled;)e++;e<t.length&&(this._highlightedIndex=e)}break;case"ArrowUp":e.preventDefault();{let e=this._highlightedIndex-1;for(;e>=0&&t[e]?.disabled;)e--;e>=0&&(this._highlightedIndex=e)}break;case"Enter":e.preventDefault(),this._highlightedIndex>=0&&this._highlightedIndex<t.length&&this._selectOption(t[this._highlightedIndex])}},this._internals=this.attachInternals()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value="",this._touched=!1,this._internals.setFormValue(""),this._internals.setValidity({})}formStateRestoreCallback(e){this.value=e}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick),document.addEventListener("keydown",this._handleKeyDown),this.addEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity()}updated(e){(e.has("required")||e.has("value"))&&this._updateValidity()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick),document.removeEventListener("keydown",this._handleKeyDown),this.removeEventListener("invalid",this._handleInvalid)}_toggle(){if(!this.disabled&&!this.readonly)if(this._isOpen)this._close();else{this._isOpen=!0;const e=Array.from(this.querySelectorAll("kr-select-option"));this._highlightedIndex=e.findIndex((e=>e.value===this.value)),requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".select-dropdown");if(e){const t=this._triggerElement.getBoundingClientRect(),i=window.innerHeight-t.bottom-4-8;e.style.top=t.bottom+4+"px",e.style.left=t.left+"px",e.style.width=t.width+"px",e.style.maxHeight=i+"px"}}))}}_close(){this._isOpen=!1,this._highlightedIndex=-1}_selectOption(e){e.disabled||(this.value=e.value,this._internals.setFormValue(this.value),this._updateValidity(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this._close(),this._triggerElement?.focus())}_handleBlur(){this._touched=!0,this._updateValidity()}_updateValidity(){this.required&&!this.value?this._internals.setValidity({valueMissing:!0},"Please select an option",this._triggerElement):this._internals.setValidity({})}render(){const e=Array.from(this.querySelectorAll("kr-select-option")),t=e.find((e=>e.value===this.value))?.label;return j`
|
|
1725
1725
|
<div class="wrapper">
|
|
1726
1726
|
${this.label?j`
|
|
1727
1727
|
<label>
|
|
1728
1728
|
${this.label}
|
|
1729
1729
|
${this.required?j`<span class="required" aria-hidden="true">*</span>`:""}
|
|
1730
1730
|
</label>
|
|
1731
|
-
`:
|
|
1731
|
+
`:F}
|
|
1732
1732
|
<div class="select-wrapper">
|
|
1733
1733
|
<button
|
|
1734
1734
|
class=${we({"select-trigger":!0,"select-trigger--open":this._isOpen,"select-trigger--invalid":this._touched&&this.required&&!this.value})}
|
|
@@ -1772,7 +1772,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
1772
1772
|
<div class="options-slot">
|
|
1773
1773
|
<slot @slotchange=${()=>this.requestUpdate()}></slot>
|
|
1774
1774
|
</div>
|
|
1775
|
-
`}focus(){this._triggerElement?.focus()}blur(){this._triggerElement?.blur()}};Je.styles=[ne,
|
|
1775
|
+
`}focus(){this._triggerElement?.focus()}blur(){this._triggerElement?.blur()}};Je.styles=[ne,o`
|
|
1776
1776
|
:host {
|
|
1777
1777
|
display: block;
|
|
1778
1778
|
font-family: inherit;
|
|
@@ -1948,11 +1948,11 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
1948
1948
|
.options-slot {
|
|
1949
1949
|
display: none;
|
|
1950
1950
|
}
|
|
1951
|
-
`],Je.formAssociated=!0,Ge([pe({type:String})],Je.prototype,"label",void 0),Ge([pe({type:String})],Je.prototype,"name",void 0),Ge([pe({type:String})],Je.prototype,"value",void 0),Ge([pe({type:String})],Je.prototype,"placeholder",void 0),Ge([pe({type:Boolean})],Je.prototype,"disabled",void 0),Ge([pe({type:Boolean})],Je.prototype,"required",void 0),Ge([pe({type:Boolean})],Je.prototype,"readonly",void 0),Ge([pe({type:String})],Je.prototype,"hint",void 0),Ge([ue()],Je.prototype,"_isOpen",void 0),Ge([ue()],Je.prototype,"_highlightedIndex",void 0),Ge([ue()],Je.prototype,"_touched",void 0),Ge([fe(".select-trigger")],Je.prototype,"_triggerElement",void 0),Je=Ge([de("kr-select-field")],Je);var et=function(e,t,i,s){var o
|
|
1951
|
+
`],Je.formAssociated=!0,Ge([pe({type:String})],Je.prototype,"label",void 0),Ge([pe({type:String})],Je.prototype,"name",void 0),Ge([pe({type:String})],Je.prototype,"value",void 0),Ge([pe({type:String})],Je.prototype,"placeholder",void 0),Ge([pe({type:Boolean})],Je.prototype,"disabled",void 0),Ge([pe({type:Boolean})],Je.prototype,"required",void 0),Ge([pe({type:Boolean})],Je.prototype,"readonly",void 0),Ge([pe({type:String})],Je.prototype,"hint",void 0),Ge([ue()],Je.prototype,"_isOpen",void 0),Ge([ue()],Je.prototype,"_highlightedIndex",void 0),Ge([ue()],Je.prototype,"_touched",void 0),Ge([fe(".select-trigger")],Je.prototype,"_triggerElement",void 0),Je=Ge([de("kr-select-field")],Je);var et=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let tt=class extends le{constructor(){super(...arguments),this.value="",this.disabled=!1}get label(){return this.textContent?.trim()||""}render(){return j`<slot></slot>`}};tt.styles=o`
|
|
1952
1952
|
:host {
|
|
1953
1953
|
display: none;
|
|
1954
1954
|
}
|
|
1955
|
-
`,et([pe({type:String})],tt.prototype,"value",void 0),et([pe({type:Boolean})],tt.prototype,"disabled",void 0),tt=et([de("kr-select-option")],tt);const it={equals:{key:"equals",type:"comparison",dataTypes:["string","number","date","boolean"],label:"Equals"},n_equals:{key:"n_equals",type:"comparison",dataTypes:["string","number","date","boolean"],label:"Doesn't equal"},contains:{key:"contains",type:"comparison",dataTypes:["string"],label:"Contains"},n_contains:{key:"n_contains",type:"comparison",dataTypes:["string"],label:"Doesn't contain"},starts_with:{key:"starts_with",type:"comparison",dataTypes:["string"],label:"Starts with"},ends_with:{key:"ends_with",type:"comparison",dataTypes:["string"],label:"Ends with"},less_than:{key:"less_than",type:"comparison",dataTypes:["number","date"],label:"Less than"},less_than_equal:{key:"less_than_equal",type:"comparison",dataTypes:["number","date"],label:"Less than or equal"},greater_than:{key:"greater_than",type:"comparison",dataTypes:["number","date"],label:"Greater than"},greater_than_equal:{key:"greater_than_equal",type:"comparison",dataTypes:["number","date"],label:"Greater than or equal"},between:{key:"between",type:"range",dataTypes:["number","date"],label:"Between"},in:{key:"in",type:"list",dataTypes:["string","number"],label:"In"},n_in:{key:"n_in",type:"list",dataTypes:["string","number","date","boolean"],label:"Not In"},empty:{key:"empty",type:"nil",dataTypes:["string","number","date","boolean"],label:"Empty"},n_empty:{key:"n_empty",type:"nil",dataTypes:["string","number","date","boolean"],label:"Not empty"}};function st(e){const t=[];for(const i of Object.values(it))i.dataTypes.includes(e)&&t.push({key:i.key,label:i.label});return t}const ot=['"',"+","-","&&","||","!","(",")","{","}","[","]","^","~","*","?",":"],rt=['\\"',"\\+","\\-","\\&\\&","\\|\\|","\\!","\\(","\\)","\\{","\\}","\\[","\\]","\\^","\\~","\\*","\\?","\\:"];function at(e,t=!0){return!0===e||!1===e?e.toString():null===e?"(*:* NOT *)":"number"==typeof e?e.toString():"string"==typeof e?(ot.forEach(((t,i)=>{var s;e=e.replace(new RegExp(`${s=t,"string"!=typeof s?s:s.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}`,"g"),rt[i])})),t?`"${e}"`:e.replace(/ /g,"\\ ")):e}function lt(e,t=!1){const i=new Date(e);return i.setMinutes(i.getMinutes()-i.getTimezoneOffset()),t&&(i.setUTCHours(23),i.setUTCMinutes(59),i.setUTCSeconds(59),i.setUTCMilliseconds(999)),i.toISOString().replace(/:/g,"\\:")}function nt(e,t){let i,s,o,r;if(e&&"start"in e&&"end"in e)i=new Date(e.start),s=new Date(e.end),o=t[0],r=t[1];else{if(!(e instanceof Date))return"[* TO *]";i=new Date(e),s=new Date(e),o=t[0],r=t[0]}return"year"===o?(i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0)):"month"===o?(i.setUTCDate(1),i.setUTCHours(0,0,0,0)):"day"===o?i.setUTCHours(0,0,0,0):"time"===o&&i.setUTCSeconds(0,0),"year"===r?(s.setUTCMonth(11,31),s.setUTCHours(23,59,59,999)):"month"===r?(s.setUTCMonth(s.getUTCMonth()+1),s.setUTCDate(0),s.setUTCHours(23,59,59,999)):"day"===r?s.setUTCHours(23,59,59,999):"time"===r&&s.setUTCSeconds(59,999),`[${i.toISOString().replace(/:/g,"\\:")} TO ${s.toISOString().replace(/:/g,"\\:")}]`}function dt(e,t){let i,s,o,r,a,l;return e&&"start"in e&&"end"in e?(i=new Date(e.start),s=new Date(e.end),o=t[0],r=t[1]):(i=new Date(e),s=new Date(e),o=t[0],r=t[0]),"year"===o?(i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0),a=i):"month"===o?(i.setUTCDate(1),i.setUTCHours(0,0,0,0),a=i):"day"===o?(i.setUTCHours(0,0,0,0),a=i):"time"===o?(i.setUTCSeconds(0,0),a=i):a=i,"year"===r?(s.setUTCMonth(11,31),s.setUTCHours(23,59,59,999),l=s):"month"===r?(s.setUTCMonth(s.getUTCMonth()+1),s.setUTCDate(0),s.setUTCHours(23,59,59,999),l=s):"day"===r?(s.setUTCHours(23,59,59,999),l=s):"time"===r?(s.setUTCSeconds(59,999),l=s):l=s,[a.toISOString().replace(/\..+/,"").replace("T"," "),l.toISOString().replace(/\..+/,"").replace("T"," ")]}function ht(e){return e=e.trim(),/^(\d{1,2})\/(\d{1,2})\/(\d{2})$/.test(e)||/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.test(e)?"day":/^(\d{1,2})\/(\d{1,2})\/(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i.test(e)||/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i.test(e)?"time":/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4})$/.test(e)?"day":/^(\d{2})$/.test(e)||/^(\d{4})$/.test(e)?"year":/^([A-Za-z]+)\s+(\d{4})$/.test(e)?"month":null}class ct{constructor(){this.field="",this.operator="equals",this.value=null,this.kql="",this.text="",this.type="",this.specificity=[]}setKql(e){if(this.kql=e.trim(),this.text="",this.specificity=[],this.value=null,this.kql)if(e.startsWith("="))this.operator="equals",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[ht(this.text)];else if(e.startsWith("!="))this.operator="n_equals",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[ht(this.text)];else if(e.startsWith("~")&&"string"===this.type)this.operator="contains",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[ht(this.text)];else if(e.startsWith("!~")&&"string"===this.type)this.operator="n_contains",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[ht(this.text)];else if(e.endsWith("*")&&"string"===this.type)this.operator="starts_with",this.text=e.substring(0,e.length-1),this.value=this._parse(this.text),this.specificity=[ht(this.text)];else if(e.startsWith("*")&&"string"===this.type)this.operator="ends_with",this.text=e.substring(1),this.value=this._parse(this.text),this.specificity=[ht(this.text)];else if("EMPTY"===e)this.operator="empty",this.value=null,this.specificity=[];else if("NOT EMPTY"===e)this.operator="n_empty",this.value=null,this.specificity=[];else if(e.startsWith("<="))this.operator="less_than_equal",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[ht(this.text)];else if(e.startsWith("<"))this.operator="less_than",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[ht(this.text)];else if(e.startsWith(">="))this.operator="greater_than_equal",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[ht(this.text)];else if(e.startsWith(">"))this.operator="greater_than",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[ht(this.text)];else if(e.startsWith("[")&&e.endsWith("]")&&e.indexOf(" TO ")>-1){this.operator="between";const t=e.indexOf(" TO "),i=e.substring(1,t).trim(),s=e.substring(t+4,e.length-1).trim();this.text=`${i} - ${s}`,this.value={start:this._parse(i),end:this._parse(s)},this.specificity=[ht(i),ht(s)]}else e.startsWith("!(")&&e.endsWith(")")?(this.operator="n_in",this.text=e.substring(2,e.length-1).trim(),this.value=this.text.split(",").map((e=>e.trim())).map((e=>this._parse(e))),this.specificity=[ht(this.text)]):e.startsWith("(")&&e.endsWith(")")?(this.operator="in",this.text=e.substring(1,e.length-1).trim(),this.value=this.text.split(",").map((e=>e.trim())).map((e=>this._parse(e))),this.specificity=[ht(this.text)]):"date"===this.type||"boolean"===this.type||"number"===this.type?(this.operator="equals",this.text=this.kql,this.value=this._parse(this.text),this.specificity=[ht(this.text)]):(this.operator="contains",this.text=e,this.value=this._parse(this.text),this.specificity=[ht(this.text)]);else"string"===this.type?this.operator="contains":this.operator="equals"}setOperator(e){"empty"===this.operator||"n_empty"===this.operator||"between"===this.operator?(this.value=null,this.text=""):"in"!==this.operator&&"n_in"!==this.operator||(this.value=[],this.text=""),this.operator=e,"empty"===this.operator?(this.value="EMPTY",this.text="EMPTY"):"n_empty"===this.operator?(this.value="NOT EMPTY",this.text="NOT EMPTY"):"between"===this.operator?(this.value=null,this.text=""):"in"!==this.operator&&"n_in"!==this.operator||(this.value=[],this.text=""),this._buildKql()}setValue(e,t){this.value=e,t?this.specificity=[t]:e instanceof Date?this.specificity=["time"]:this.specificity=[],this._buildText(),this._buildKql()}setStart(e,t){void 0===this.value?.start&&(this.value={start:null,end:null}),this.value.start=e,t?this.specificity[0]=t:e instanceof Date&&(this.specificity[0]="time"),this._buildText(),this._buildKql()}setEnd(e,t){void 0===this.value?.end&&(this.value={start:null,end:null}),this.value.end=e,t?this.specificity[1]=t:e instanceof Date&&(this.specificity[1]="time"),this._buildText(),this._buildKql()}clear(){"string"===this.type?this.operator="contains":this.operator="equals",this.value=null,this.kql="",this.text="",this.specificity=[]}isEmpty(){return"empty"===this.operator||"n_empty"===this.operator?!this.text:"between"===this.operator?!this.value?.start&&!this.value?.end:"in"===this.operator||"n_in"===this.operator?!this.value?.length:void 0===this.value||null===this.value||""===this.value}has(e){return!("in"!==this.operator&&"n_in"!==this.operator||!Array.isArray(this.value))&&("boolean"===this.type&&"string"==typeof e&&("true"===e?e=!0:"false"===e&&(e=!1)),this.value.indexOf(e)>=0)}toggle(e){"in"!==this.operator&&"n_in"!==this.operator&&this.setOperator("in"),"boolean"===this.type&&"string"==typeof e&&("true"===e?e=!0:"false"===e&&(e=!1));const t=this.value.indexOf(e);t>=0?this.value.splice(t,1):this.value.push(e),this._buildText(),this._buildKql()}isValid(){return!this.kql||!!this.field&&(!!this.operator&&("empty"===this.operator||("n_empty"===this.operator||("in"===this.operator||"n_in"===this.operator?Array.isArray(this.value)&&this.value.length>0:"date"===this.type?"between"===this.operator?this.value?.start instanceof Date&&this.value?.end instanceof Date&&!isNaN(this.value.start.getTime())&&!isNaN(this.value.end.getTime()):this.value instanceof Date&&!isNaN(this.value.getTime()):"number"===this.type?"between"===this.operator?"number"==typeof this.value?.start&&"number"==typeof this.value?.end:"number"==typeof this.value:"boolean"===this.type?"boolean"==typeof this.value:"string"==typeof this.value&&!!this.value.trim().length))))}toSolrData(){const e={boost:null,fuzzy:null,not:!1,name:null,operation:null,tagged:!1,value:null};switch(e.name=this.field,this.operator){case"equals":this.value instanceof Date?(e.operation="EXPRESSION",e.value=nt(this.value,this.specificity)):(e.operation="IS",e.value=this.value);break;case"n_equals":this.value instanceof Date?(e.operation="EXPRESSION",e.not=!0,e.value=nt(this.value,this.specificity)):(e.operation="IS",e.not=!0,e.value=this.value);break;case"contains":e.operation="EXPRESSION",e.value=`*${at(this.value,!1)}*`;break;case"n_contains":e.operation="EXPRESSION",e.not=!0,e.value=`*${at(this.value,!1)}*`;break;case"starts_with":e.operation="EXPRESSION",e.value=`${at(this.value,!1)}*`;break;case"ends_with":e.operation="EXPRESSION",e.value=`*${at(this.value,!1)}`;break;case"empty":e.operation="EXPRESSION",e.not=!0,e.value="[* TO *]";break;case"n_empty":e.operation="EXPRESSION",e.value="[* TO *]";break;case"less_than":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[* TO ${lt(this.value)}}`):(e.operation="EXPRESSION",e.value=`[* TO ${at(this.value,!0)}}`);break;case"less_than_equal":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[* TO ${lt(this.value,!0)}]`):(e.operation="EXPRESSION",e.value=`[* TO ${at(this.value,!0)}]`);break;case"greater_than":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`{${lt(this.value,!0)} TO *]`):(e.operation="EXPRESSION",e.value=`{${at(this.value,!0)} TO *]`);break;case"greater_than_equal":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[${lt(this.value)} TO *]`):(e.operation="EXPRESSION",e.value=`[${at(this.value,!0)} TO *]`);break;case"between":this.value?.start instanceof Date&&this.value?.end instanceof Date?(e.operation="EXPRESSION",e.value=nt(this.value,this.specificity)):(e.operation="EXPRESSION",e.value=`[${this.value.start} TO ${this.value.end}]`);break;case"in":Array.isArray(this.value)&&this.value.length>0?(e.operation="EXPRESSION",e.value=`(${this.value.map((e=>at(e,!0))).join(" OR ")})`):(e.operation="EXPRESSION",e.value=at(this.value,!0));break;case"n_in":Array.isArray(this.value)&&this.value.length>0?(e.operation="EXPRESSION",e.not=!0,e.value=`(${this.value.map((e=>at(e,!0))).join(" OR ")})`):(e.operation="EXPRESSION",e.not=!0,e.value=at(this.value,!0));break;default:e.operation="EXPRESSION",e.value=at(this.value,!0)}return e}toDbParams(){const e={boost:null,fuzzy:null,not:!1,name:null,operation:null,tagged:!1,value:null,values:null};switch(e.name=this.field,this.operator){case"equals":"date"===this.type?(e.operation="BETWEEN",e.values=dt(this.value,this.specificity)):(e.operation="IS",e.value=this.value);break;case"n_equals":"date"===this.type?(e.operation="BETWEEN",e.not=!0,e.values=dt(this.value,this.specificity)):(e.operation="IS",e.value=this.value,e.not=!0);break;case"contains":e.operation="CONTAINS",e.value=this.value;break;case"n_contains":e.operation="CONTAINS",e.value=this.value,e.not=!0;break;case"starts_with":e.operation="STARTS_WITH",e.value=this.value;break;case"ends_with":e.operation="ENDS_WITH",e.value=this.value;break;case"empty":e.operation="IS_BLANK";break;case"n_empty":e.operation="IS_NOT_BLANK";break;case"less_than":e.operation="LESS_THAN",e.value=this.value;break;case"less_than_equal":e.operation="LESS_THAN_EQUAL",e.value=this.value;break;case"greater_than":e.operation="GREATER_THAN",e.value=this.value;break;case"greater_than_equal":e.operation="GREATER_THAN_EQUAL",e.value=this.value;break;case"between":e.operation="BETWEEN","date"===this.type?e.values=dt(this.value,this.specificity):e.values=[this.value.start,this.value.end];break;case"in":e.operation="IN",e.values=this.value??[];break;case"n_in":e.operation="IN",e.not=!0,e.values=this.value??[];break;default:throw Error(`${this.operator} operator not supported by db params.`)}return e}_buildText(){this.isEmpty()?this.text="":"between"===this.operator?this.text=`${this._format(this.value?.start)} - ${this._format(this.value?.end)}`:"in"===this.operator||"n_in"===this.operator?this.text=this.value.map((e=>this._format(e))).join(","):this.text=this._format(this.value)}_format(e){if(e instanceof Date&&!isNaN(e.getTime())){return`${String(e.getUTCMonth()+1).padStart(2,"0")}/${String(e.getUTCDate()).padStart(2,"0")}/${e.getUTCFullYear()}`}return"boolean"==typeof e?e?"Yes":"No":String(e??"")}_parse(e){if(null==e||""===e)return null;if(this.type)switch(this.type){case"boolean":{const t=e.toString().toLowerCase();return!0===e||!1!==e&&("yes"===t||"no"!==t&&("1"===t||"0"!==t&&null))}case"date":return this._parseDate(e);case"number":{const t=Number(e.toString().replace(/[$,]+/g,""));return isNaN(t)?null:t}default:return e.toString()}return e}_parseDate(e){if(null==e||""===e)return null;const t={jan:0,january:0,feb:1,february:1,mar:2,march:2,apr:3,april:3,may:4,jun:5,june:5,jul:6,july:6,aug:7,august:7,sep:8,september:8,oct:9,october:9,nov:10,november:10,dec:11,december:11};let i;if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{2})$/),i)return new Date(Date.UTC(2e3+parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2])));if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/),i)return new Date(Date.UTC(parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2])));if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i),i){let e=parseInt(i[4]);return i[6]&&("PM"===i[6].toUpperCase()&&12!==e&&(e+=12),"AM"===i[6].toUpperCase()&&12===e&&(e=0)),new Date(Date.UTC(parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2]),e,parseInt(i[5])))}if(i=e.match(/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i),i){const e=t[i[1].toLowerCase()];if(void 0!==e){let t=parseInt(i[4]);return i[6]&&("PM"===i[6].toUpperCase()&&12!==t&&(t+=12),"AM"===i[6].toUpperCase()&&12===t&&(t=0)),new Date(Date.UTC(parseInt(i[3]),e,parseInt(i[2]),t,parseInt(i[5])))}}if(i=e.match(/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4})$/),i){const e=t[i[1].toLowerCase()];if(void 0!==e)return new Date(Date.UTC(parseInt(i[3]),e,parseInt(i[2])))}if(i=e.match(/^(\d{2})$/),i)return new Date(Date.UTC(2e3+parseInt(i[1]),0,1));if(i=e.match(/^(\d{4})$/),i)return new Date(Date.UTC(parseInt(i[1]),0,1));if(i=e.match(/^([A-Za-z]+)\s+(\d{4})$/),i){const e=t[i[1].toLowerCase()];if(void 0!==e)return new Date(Date.UTC(parseInt(i[2]),e,1))}return null}_buildKql(){if(this.isEmpty())this.kql="";else switch(this.operator){case"equals":this.kql=`= ${this.text}`;break;case"n_equals":this.kql=`!= ${this.text}`;break;case"contains":this.kql=`~ ${this.text}`;break;case"n_contains":this.kql=`!~ ${this.text}`;break;case"starts_with":this.kql=`${this.text}*`;break;case"ends_with":this.kql=`*${this.text}`;break;case"empty":this.kql="EMPTY";break;case"n_empty":this.kql="NOT EMPTY";break;case"less_than":this.kql=`< ${this.text}`;break;case"less_than_equal":this.kql=`<= ${this.text}`;break;case"greater_than":this.kql=`> ${this.text}`;break;case"greater_than_equal":this.kql=`>= ${this.text}`;break;case"between":this.kql=`[${this._format(this.value?.start??"")} TO ${this._format(this.value?.end??"")}]`;break;case"in":this.kql=`(${this.value.map((e=>this._format(e))).join(",")})`;break;case"n_in":this.kql=`!(${this.value.map((e=>this._format(e))).join(",")})`;break;default:throw Error(`Unknown operator ${this.operator}`)}}}var pt=function(e,t,i,s){var o,r=arguments.length,a=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class ut{constructor(){this.title="",this.description="",this.actions=[],this.columns=[],this.displayedColumns=[],this.data=null,this.dataSource=null,this.refreshInterval=0,this.pageSize=0,this.rowClickable=!1,this.rowHref=null}}let ft=class extends ae{constructor(){super(...arguments),this._scrollStyle="edge",this._data=[],this._dataState="idle",this._page=1,this._pageSize=50,this._totalItems=0,this._totalPages=0,this._searchQuery="",this._canScrollLeft=!1,this._canScrollRight=!1,this._canScrollHorizontal=!1,this._columnPickerOpen=!1,this._filterPanelOpened=null,this._filterPanelTab="filter",this._buckets=new Map,this._filterPanelPos={top:0,left:0},this._sorts=[],this._resizing=null,this._resizeObserver=null,this._searchPositionLocked=!1,this._columnWidthsLocked=!1,this._model=new ut,this.def={columns:[]},this.variant="default",this._handleClickOutside=e=>{const t=e.composedPath();if(this._columnPickerOpen){const e=this.shadowRoot?.querySelector(".column-picker-wrapper");e&&!t.includes(e)&&(this._columnPickerOpen=!1)}this._filterPanelOpened&&(t.some((e=>e.classList?.contains("filter-panel")))||this._handleFilterApply())},this._handleResizeMove=e=>{if(!this._resizing)return;const t=this._model.columns.find((e=>e.id===this._resizing.columnId));if(t){const i=this._resizing.startWidth+(e.clientX-this._resizing.startX);t.width=`${Math.min(900,Math.max(50,i))}px`,this.requestUpdate()}},this._handleResizeEnd=()=>{this._resizing=null,document.removeEventListener("mousemove",this._handleResizeMove),document.removeEventListener("mouseup",this._handleResizeEnd)}}connectedCallback(){super.connectedCallback(),this.classList.toggle("kr-table--scroll-overlay","overlay"===this._scrollStyle),this.classList.toggle("kr-table--scroll-edge","edge"===this._scrollStyle),this._fetch(),this._initRefresh(),document.addEventListener("click",this._handleClickOutside),this._resizeObserver=new ResizeObserver((()=>{this._searchPositionLocked=!1,this._updateSearchPosition()})),this._resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this._refreshTimer),document.removeEventListener("click",this._handleClickOutside),this._resizeObserver?.disconnect()}willUpdate(e){e.has("def")&&(this._columnWidthsLocked=!1,this._model=new ut,this.def.title&&(this._model.title=this.def.title),this.def.description&&(this._model.description=this.def.description),this.def.actions&&(this._model.actions=this.def.actions),this.def.data&&(this._model.data=this.def.data),this.def.dataSource&&(this._model.dataSource=this.def.dataSource),"number"==typeof this.def.refreshInterval&&(this._model.refreshInterval=this.def.refreshInterval),"number"==typeof this.def.pageSize&&(this._model.pageSize=this.def.pageSize,this._pageSize=this.def.pageSize),this.def.rowClickable&&(this._model.rowClickable=this.def.rowClickable),this.def.rowHref&&(this._model.rowHref=this.def.rowHref),this._sorts=[],this._model.columns=this.def.columns.map((e=>{const t={...e,filter:null};return t.type||(t.type="string"),e.sort&&this._sorts.push({sortBy:e.id,sortDirection:e.sort}),"actions"===t.type?(t.label=e.label??"",t.sticky="right",t.resizable=!1,t):((e.filterable||e.facetable)&&(t.filter=new ct,t.filter.field=e.id,t.filter.type=t.type,e.filter?(t.filter.setOperator(e.filter.operator),t.filter.setValue(e.filter.value)):e.facetable&&!e.filterable?(t.filter.operator="in",t.filter.value=[]):"string"===t.filter.type&&(t.filter.operator="contains")),t)})),this.def.displayedColumns?this._model.displayedColumns=this.def.displayedColumns:this._model.displayedColumns=this._model.columns.map((e=>e.id)),this._fetch(),this._initRefresh())}updated(e){this.classList.toggle("kr-table--card","card"===this.variant),this._updateScrollFlags(),this._syncSlottedContent(),this._lockColumnWidths()}_lockColumnWidths(){if(this._columnWidthsLocked||0===this._data.length)return;const e=this.shadowRoot?.querySelectorAll(".header-row > .header-cell");if(!e)return;const t=this.getDisplayedColumns();e.forEach(((e,i)=>{const s=e.offsetWidth;i<t.length&&!t[i].width&&"actions"!==t[i].type&&s>0&&(t[i].width=`${s}px`,this._columnWidthsLocked=!0)}))}_syncSlottedContent(){const e=this.getDisplayedColumns().filter((e=>e.render));e.length&&(this.querySelectorAll('[slot^="cell-"]').forEach((e=>e.remove())),this._data.forEach(((t,i)=>{e.forEach((e=>{const s=e.render(t);if(!s)return;const o=document.createElement("span");o.slot=`cell-${i}-${e.id}`,"actions"===e.type&&(o.style.display="flex",o.style.gap="8px"),"string"==typeof s?o.innerHTML=s:oe(s,o),this.appendChild(o)}))})))}refresh(){this._fetch()}goToPrevPage(){this._page>1&&(this._page--,this._fetch())}goToNextPage(){this._page<this._totalPages&&(this._page++,this._fetch())}goToPage(e){e>=1&&e<=this._totalPages&&(this._page=e,this._fetch())}_toSolrData(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns){if(!t.filter||t.filter.isEmpty()||!t.filter.isValid())continue;const i=t.filter.toSolrData();!t.facetable||"in"!==t.filter.operator&&"n_in"!==t.filter.operator||(i.tagged=!0),e.filterFields.push(i)}for(const t of this._model.columns)t.facetable&&e.facetFields.push({name:t.id,type:"FIELD",limit:100,sort:"count",minimumCount:1});return this._searchQuery?.trim().length&&e.queryFields.push({name:"_text_",operation:"IS",value:at(this._searchQuery,!1)}),e}_toDbParams(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns)t.filter&&!t.filter.isEmpty()&&t.filter.isValid()&&e.filterFields.push(t.filter.toDbParams());return this._searchQuery?.trim().length&&this._model.columns.filter((e=>e.searchable)).forEach((t=>{e.queryFields.push({name:t.id,operation:"CONTAINS",value:this._searchQuery,and:!1})})),e}_fetch(){if(this._model.data)return this._data=this._model.data,this._totalItems=this._model.data.length,this._totalPages=Math.ceil(this._model.data.length/this._pageSize),void(this._dataState="success");if(!this._model.dataSource)return;let e;this._dataState="loading",e="db"===this._model.dataSource.mode?this._toDbParams():this._toSolrData(),this._model.dataSource.fetch(e).then((e=>{switch(this._model.dataSource?.mode){case"opensearch":throw Error("Opensearch not supported yet");case"db":{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size;break}default:{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size,this._parseFacetResults(t)}}this._dataState="success",this._updateSearchPosition()})).catch((e=>{this._dataState="error",Ke.show({message:e instanceof Error?e.message:"Failed to load data",type:"error"})}))}_parseFacetResults(e){if(e.data.facetFields){for(const t of this._model.columns){if(!t.facetable)continue;const i=e.data.facetFields[t.id];if(!i){this._buckets.set(t.id,[]);continue}const s=[];for(const e of i){let i=e.name;"boolean"===t.type&&"string"==typeof e.name&&("true"===e.name?i=!0:"false"===e.name&&(i=!1)),null===e.name&&e.count>0&&s.unshift({val:null,count:e.count}),null!==e.name&&s.push({val:i,count:e.count})}if(t.filter&&("in"===t.filter.operator||"n_in"===t.filter.operator)&&Array.isArray(t.filter.value))for(const e of t.filter.value)s.some((t=>t.val===e))||s.push({val:e,count:0});this._buckets.set(t.id,s)}this._buckets=new Map(this._buckets)}}_initRefresh(){clearInterval(this._refreshTimer),this._model.refreshInterval&&this._model.refreshInterval>0&&(this._refreshTimer=window.setInterval((()=>{this._fetch()}),this._model.refreshInterval))}_handleSearch(e){const t=e.target;this._searchQuery=t.value,this._page=1,this._fetch()}_getGridTemplateColumns(){return this.getDisplayedColumns().map((e=>e.width?e.width:"actions"===e.type?"max-content":"minmax(80px, auto)")).join(" ")}_updateSearchPosition(){if(this._searchPositionLocked)return;if("card"===this.variant)return;const e=this.shadowRoot?.querySelector(".search"),t=e?.querySelector(".search-field");e&&t&&(e.style.justifyContent="center",t.style.marginLeft="",requestAnimationFrame((()=>{const i=e.getBoundingClientRect(),s=t.getBoundingClientRect().left-i.left;e.style.justifyContent="flex-start",t.style.marginLeft=`${s}px`,this._searchPositionLocked=!0})))}_toggleColumnPicker(){this._columnPickerOpen=!this._columnPickerOpen}_toggleColumn(e){this._model.displayedColumns.includes(e)?this._model.displayedColumns=this._model.displayedColumns.filter((t=>t!==e)):this._model.displayedColumns=[...this._model.displayedColumns,e],this.requestUpdate()}_handleRowMouseDown(){(this._model.rowClickable||this._model.rowHref)&&window.getSelection()?.removeAllRanges()}_handleRowClick(e,t,i){if(!this._model.rowClickable&&!this._model.rowHref)return;const s=window.getSelection();s&&s.toString().length>0?e.preventDefault():this.dispatchEvent(new CustomEvent("row-click",{detail:{row:t,rowIndex:i},bubbles:!0,composed:!0}))}getDisplayedColumns(){return this._model.displayedColumns.map((e=>this._model.columns.find((t=>t.id===e)))).sort(((e,t)=>"actions"===e.type&&"actions"!==t.type?1:"actions"!==e.type&&"actions"===t.type?-1:0))}_handleScroll(e){const t=e.target;this._canScrollLeft=t.scrollLeft>0,this._canScrollRight=t.scrollLeft<t.scrollWidth-t.clientWidth-1}_updateScrollFlags(){const e=this.shadowRoot?.querySelector(".content");e&&(this._canScrollLeft=e.scrollLeft>0,this._canScrollRight=e.scrollWidth>e.clientWidth&&e.scrollLeft<e.scrollWidth-e.clientWidth-1,this._canScrollHorizontal=e.scrollWidth>e.clientWidth),this.classList.toggle("kr-table--scroll-left-available",this._canScrollLeft),this.classList.toggle("kr-table--scroll-right-available",this._canScrollRight),this.classList.toggle("kr-table--scroll-horizontal-available",this._canScrollHorizontal),this.classList.toggle("kr-table--sticky-left",this.getDisplayedColumns().some((e=>"left"===e.sticky))),this.classList.toggle("kr-table--sticky-right",this.getDisplayedColumns().some((e=>"right"===e.sticky)))}_handleResizeStart(e,t){e.preventDefault();const i=this.shadowRoot?.querySelector(`.header-cell[data-column-id="${t}"]`);this._resizing={columnId:t,startX:e.clientX,startWidth:i?.offsetWidth||200},document.addEventListener("mousemove",this._handleResizeMove),document.addEventListener("mouseup",this._handleResizeEnd)}_handleSortClick(e,t){if(e.shiftKey){const e=this._sorts.findIndex((e=>e.sortBy===t.id));if(-1===e)this._sorts.push({sortBy:t.id,sortDirection:"asc"});else{const t=this._sorts[e];"asc"===t.sortDirection?t.sortDirection="desc":this._sorts.splice(e,1)}this.requestUpdate()}else{let e=null;1===this._sorts.length&&(e=this._sorts.find((e=>e.sortBy===t.id))),e?"asc"===e.sortDirection?this._sorts=[{sortBy:t.id,sortDirection:"desc"}]:this._sorts=[]:this._sorts=[{sortBy:t.id,sortDirection:"asc"}]}this._page=1,this._fetch()}_renderSortIndicator(e){if(!e.sortable)return U;const t=this._sorts.findIndex((t=>t.sortBy===e.id));if(-1===t)return j`
|
|
1955
|
+
`,et([pe({type:String})],tt.prototype,"value",void 0),et([pe({type:Boolean})],tt.prototype,"disabled",void 0),tt=et([de("kr-select-option")],tt);const it={equals:{key:"equals",type:"comparison",dataTypes:["string","number","date","boolean"],label:"Equals"},n_equals:{key:"n_equals",type:"comparison",dataTypes:["string","number","date","boolean"],label:"Doesn't equal"},contains:{key:"contains",type:"comparison",dataTypes:["string"],label:"Contains"},n_contains:{key:"n_contains",type:"comparison",dataTypes:["string"],label:"Doesn't contain"},starts_with:{key:"starts_with",type:"comparison",dataTypes:["string"],label:"Starts with"},ends_with:{key:"ends_with",type:"comparison",dataTypes:["string"],label:"Ends with"},less_than:{key:"less_than",type:"comparison",dataTypes:["number","date"],label:"Less than"},less_than_equal:{key:"less_than_equal",type:"comparison",dataTypes:["number","date"],label:"Less than or equal"},greater_than:{key:"greater_than",type:"comparison",dataTypes:["number","date"],label:"Greater than"},greater_than_equal:{key:"greater_than_equal",type:"comparison",dataTypes:["number","date"],label:"Greater than or equal"},between:{key:"between",type:"range",dataTypes:["number","date"],label:"Between"},in:{key:"in",type:"list",dataTypes:["string","number"],label:"In"},n_in:{key:"n_in",type:"list",dataTypes:["string","number","date","boolean"],label:"Not In"},empty:{key:"empty",type:"nil",dataTypes:["string","number","date","boolean"],label:"Empty"},n_empty:{key:"n_empty",type:"nil",dataTypes:["string","number","date","boolean"],label:"Not empty"}};function st(e){const t=[];for(const i of Object.values(it))i.dataTypes.includes(e)&&t.push({key:i.key,label:i.label});return t}const rt=['"',"+","-","&&","||","!","(",")","{","}","[","]","^","~","*","?",":"],ot=['\\"',"\\+","\\-","\\&\\&","\\|\\|","\\!","\\(","\\)","\\{","\\}","\\[","\\]","\\^","\\~","\\*","\\?","\\:"];function lt(e,t=!0){return!0===e||!1===e?e.toString():null===e?"(*:* NOT *)":"number"==typeof e?e.toString():"string"==typeof e?(rt.forEach(((t,i)=>{var s;e=e.replace(new RegExp(`${s=t,"string"!=typeof s?s:s.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}`,"g"),ot[i])})),t?`"${e}"`:e.replace(/ /g,"\\ ")):e}function at(e,t=!1){const i=new Date(e);return i.setMinutes(i.getMinutes()-i.getTimezoneOffset()),t&&(i.setUTCHours(23),i.setUTCMinutes(59),i.setUTCSeconds(59),i.setUTCMilliseconds(999)),i.toISOString().replace(/:/g,"\\:")}function nt(e,t){let i,s,r,o;if(e&&"start"in e&&"end"in e)i=new Date(e.start),s=new Date(e.end),r=t[0],o=t[1];else{if(!(e instanceof Date))return"[* TO *]";i=new Date(e),s=new Date(e),r=t[0],o=t[0]}return"year"===r?(i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0)):"month"===r?(i.setUTCDate(1),i.setUTCHours(0,0,0,0)):"day"===r?i.setUTCHours(0,0,0,0):"time"===r&&i.setUTCSeconds(0,0),"year"===o?(s.setUTCMonth(11,31),s.setUTCHours(23,59,59,999)):"month"===o?(s.setUTCMonth(s.getUTCMonth()+1),s.setUTCDate(0),s.setUTCHours(23,59,59,999)):"day"===o?s.setUTCHours(23,59,59,999):"time"===o&&s.setUTCSeconds(59,999),`[${i.toISOString().replace(/:/g,"\\:")} TO ${s.toISOString().replace(/:/g,"\\:")}]`}function dt(e,t){let i,s,r,o,l,a;return e&&"start"in e&&"end"in e?(i=new Date(e.start),s=new Date(e.end),r=t[0],o=t[1]):(i=new Date(e),s=new Date(e),r=t[0],o=t[0]),"year"===r?(i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0),l=i):"month"===r?(i.setUTCDate(1),i.setUTCHours(0,0,0,0),l=i):"day"===r?(i.setUTCHours(0,0,0,0),l=i):"time"===r?(i.setUTCSeconds(0,0),l=i):l=i,"year"===o?(s.setUTCMonth(11,31),s.setUTCHours(23,59,59,999),a=s):"month"===o?(s.setUTCMonth(s.getUTCMonth()+1),s.setUTCDate(0),s.setUTCHours(23,59,59,999),a=s):"day"===o?(s.setUTCHours(23,59,59,999),a=s):"time"===o?(s.setUTCSeconds(59,999),a=s):a=s,[l.toISOString().replace(/\..+/,"").replace("T"," "),a.toISOString().replace(/\..+/,"").replace("T"," ")]}function ht(e){return e=e.trim(),/^(\d{1,2})\/(\d{1,2})\/(\d{2})$/.test(e)||/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.test(e)?"day":/^(\d{1,2})\/(\d{1,2})\/(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i.test(e)||/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i.test(e)?"time":/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4})$/.test(e)?"day":/^(\d{2})$/.test(e)||/^(\d{4})$/.test(e)?"year":/^([A-Za-z]+)\s+(\d{4})$/.test(e)?"month":null}class ct{constructor(){this.field="",this.operator="equals",this.value=null,this.kql="",this.text="",this.type="",this.specificity=[]}setKql(e){if(this.kql=e.trim(),this.text="",this.specificity=[],this.value=null,this.kql)if(e.startsWith("="))this.operator="equals",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[ht(this.text)];else if(e.startsWith("!="))this.operator="n_equals",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[ht(this.text)];else if(e.startsWith("~")&&"string"===this.type)this.operator="contains",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[ht(this.text)];else if(e.startsWith("!~")&&"string"===this.type)this.operator="n_contains",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[ht(this.text)];else if(e.endsWith("*")&&"string"===this.type)this.operator="starts_with",this.text=e.substring(0,e.length-1),this.value=this._parse(this.text),this.specificity=[ht(this.text)];else if(e.startsWith("*")&&"string"===this.type)this.operator="ends_with",this.text=e.substring(1),this.value=this._parse(this.text),this.specificity=[ht(this.text)];else if("EMPTY"===e)this.operator="empty",this.value=null,this.specificity=[];else if("NOT EMPTY"===e)this.operator="n_empty",this.value=null,this.specificity=[];else if(e.startsWith("<="))this.operator="less_than_equal",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[ht(this.text)];else if(e.startsWith("<"))this.operator="less_than",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[ht(this.text)];else if(e.startsWith(">="))this.operator="greater_than_equal",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[ht(this.text)];else if(e.startsWith(">"))this.operator="greater_than",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[ht(this.text)];else if(e.startsWith("[")&&e.endsWith("]")&&e.indexOf(" TO ")>-1){this.operator="between";const t=e.indexOf(" TO "),i=e.substring(1,t).trim(),s=e.substring(t+4,e.length-1).trim();this.text=`${i} - ${s}`,this.value={start:this._parse(i),end:this._parse(s)},this.specificity=[ht(i),ht(s)]}else e.startsWith("!(")&&e.endsWith(")")?(this.operator="n_in",this.text=e.substring(2,e.length-1).trim(),this.value=this.text.split(",").map((e=>e.trim())).map((e=>this._parse(e))),this.specificity=[ht(this.text)]):e.startsWith("(")&&e.endsWith(")")?(this.operator="in",this.text=e.substring(1,e.length-1).trim(),this.value=this.text.split(",").map((e=>e.trim())).map((e=>this._parse(e))),this.specificity=[ht(this.text)]):"date"===this.type||"boolean"===this.type||"number"===this.type?(this.operator="equals",this.text=this.kql,this.value=this._parse(this.text),this.specificity=[ht(this.text)]):(this.operator="contains",this.text=e,this.value=this._parse(this.text),this.specificity=[ht(this.text)]);else"string"===this.type?this.operator="contains":this.operator="equals"}setOperator(e){"empty"===this.operator||"n_empty"===this.operator||"between"===this.operator?(this.value=null,this.text=""):"in"!==this.operator&&"n_in"!==this.operator||(this.value=[],this.text=""),this.operator=e,"empty"===this.operator?(this.value="EMPTY",this.text="EMPTY"):"n_empty"===this.operator?(this.value="NOT EMPTY",this.text="NOT EMPTY"):"between"===this.operator?(this.value=null,this.text=""):"in"!==this.operator&&"n_in"!==this.operator||(this.value=[],this.text=""),this._buildKql()}setValue(e,t){this.value=e,t?this.specificity=[t]:e instanceof Date?this.specificity=["time"]:this.specificity=[],this._buildText(),this._buildKql()}setStart(e,t){void 0===this.value?.start&&(this.value={start:null,end:null}),this.value.start=e,t?this.specificity[0]=t:e instanceof Date&&(this.specificity[0]="time"),this._buildText(),this._buildKql()}setEnd(e,t){void 0===this.value?.end&&(this.value={start:null,end:null}),this.value.end=e,t?this.specificity[1]=t:e instanceof Date&&(this.specificity[1]="time"),this._buildText(),this._buildKql()}clear(){"string"===this.type?this.operator="contains":this.operator="equals",this.value=null,this.kql="",this.text="",this.specificity=[]}isEmpty(){return"empty"===this.operator||"n_empty"===this.operator?!this.text:"between"===this.operator?!this.value?.start&&!this.value?.end:"in"===this.operator||"n_in"===this.operator?!this.value?.length:void 0===this.value||null===this.value||""===this.value}has(e){return!("in"!==this.operator&&"n_in"!==this.operator||!Array.isArray(this.value))&&("boolean"===this.type&&"string"==typeof e&&("true"===e?e=!0:"false"===e&&(e=!1)),this.value.indexOf(e)>=0)}toggle(e){"in"!==this.operator&&"n_in"!==this.operator&&this.setOperator("in"),"boolean"===this.type&&"string"==typeof e&&("true"===e?e=!0:"false"===e&&(e=!1));const t=this.value.indexOf(e);t>=0?this.value.splice(t,1):this.value.push(e),this._buildText(),this._buildKql()}isValid(){return!this.kql||!!this.field&&(!!this.operator&&("empty"===this.operator||("n_empty"===this.operator||("in"===this.operator||"n_in"===this.operator?Array.isArray(this.value)&&this.value.length>0:"date"===this.type?"between"===this.operator?this.value?.start instanceof Date&&this.value?.end instanceof Date&&!isNaN(this.value.start.getTime())&&!isNaN(this.value.end.getTime()):this.value instanceof Date&&!isNaN(this.value.getTime()):"number"===this.type?"between"===this.operator?"number"==typeof this.value?.start&&"number"==typeof this.value?.end:"number"==typeof this.value:"boolean"===this.type?"boolean"==typeof this.value:"string"==typeof this.value&&!!this.value.trim().length))))}toSolrData(){const e={boost:null,fuzzy:null,not:!1,name:null,operation:null,tagged:!1,value:null};switch(e.name=this.field,this.operator){case"equals":this.value instanceof Date?(e.operation="EXPRESSION",e.value=nt(this.value,this.specificity)):(e.operation="IS",e.value=this.value);break;case"n_equals":this.value instanceof Date?(e.operation="EXPRESSION",e.not=!0,e.value=nt(this.value,this.specificity)):(e.operation="IS",e.not=!0,e.value=this.value);break;case"contains":e.operation="EXPRESSION",e.value=`*${lt(this.value,!1)}*`;break;case"n_contains":e.operation="EXPRESSION",e.not=!0,e.value=`*${lt(this.value,!1)}*`;break;case"starts_with":e.operation="EXPRESSION",e.value=`${lt(this.value,!1)}*`;break;case"ends_with":e.operation="EXPRESSION",e.value=`*${lt(this.value,!1)}`;break;case"empty":e.operation="EXPRESSION",e.not=!0,e.value="[* TO *]";break;case"n_empty":e.operation="EXPRESSION",e.value="[* TO *]";break;case"less_than":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[* TO ${at(this.value)}}`):(e.operation="EXPRESSION",e.value=`[* TO ${lt(this.value,!0)}}`);break;case"less_than_equal":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[* TO ${at(this.value,!0)}]`):(e.operation="EXPRESSION",e.value=`[* TO ${lt(this.value,!0)}]`);break;case"greater_than":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`{${at(this.value,!0)} TO *]`):(e.operation="EXPRESSION",e.value=`{${lt(this.value,!0)} TO *]`);break;case"greater_than_equal":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[${at(this.value)} TO *]`):(e.operation="EXPRESSION",e.value=`[${lt(this.value,!0)} TO *]`);break;case"between":this.value?.start instanceof Date&&this.value?.end instanceof Date?(e.operation="EXPRESSION",e.value=nt(this.value,this.specificity)):(e.operation="EXPRESSION",e.value=`[${this.value.start} TO ${this.value.end}]`);break;case"in":Array.isArray(this.value)&&this.value.length>0?(e.operation="EXPRESSION",e.value=`(${this.value.map((e=>lt(e,!0))).join(" OR ")})`):(e.operation="EXPRESSION",e.value=lt(this.value,!0));break;case"n_in":Array.isArray(this.value)&&this.value.length>0?(e.operation="EXPRESSION",e.not=!0,e.value=`(${this.value.map((e=>lt(e,!0))).join(" OR ")})`):(e.operation="EXPRESSION",e.not=!0,e.value=lt(this.value,!0));break;default:e.operation="EXPRESSION",e.value=lt(this.value,!0)}return e}toDbParams(){const e={boost:null,fuzzy:null,not:!1,name:null,operation:null,tagged:!1,value:null,values:null};switch(e.name=this.field,this.operator){case"equals":"date"===this.type?(e.operation="BETWEEN",e.values=dt(this.value,this.specificity)):(e.operation="IS",e.value=this.value);break;case"n_equals":"date"===this.type?(e.operation="BETWEEN",e.not=!0,e.values=dt(this.value,this.specificity)):(e.operation="IS",e.value=this.value,e.not=!0);break;case"contains":e.operation="CONTAINS",e.value=this.value;break;case"n_contains":e.operation="CONTAINS",e.value=this.value,e.not=!0;break;case"starts_with":e.operation="STARTS_WITH",e.value=this.value;break;case"ends_with":e.operation="ENDS_WITH",e.value=this.value;break;case"empty":e.operation="IS_BLANK";break;case"n_empty":e.operation="IS_NOT_BLANK";break;case"less_than":e.operation="LESS_THAN",e.value=this.value;break;case"less_than_equal":e.operation="LESS_THAN_EQUAL",e.value=this.value;break;case"greater_than":e.operation="GREATER_THAN",e.value=this.value;break;case"greater_than_equal":e.operation="GREATER_THAN_EQUAL",e.value=this.value;break;case"between":e.operation="BETWEEN","date"===this.type?e.values=dt(this.value,this.specificity):e.values=[this.value.start,this.value.end];break;case"in":e.operation="IN",e.values=this.value??[];break;case"n_in":e.operation="IN",e.not=!0,e.values=this.value??[];break;default:throw Error(`${this.operator} operator not supported by db params.`)}return e}_buildText(){this.isEmpty()?this.text="":"between"===this.operator?this.text=`${this._format(this.value?.start)} - ${this._format(this.value?.end)}`:"in"===this.operator||"n_in"===this.operator?this.text=this.value.map((e=>this._format(e))).join(","):this.text=this._format(this.value)}_format(e){if(e instanceof Date&&!isNaN(e.getTime())){return`${String(e.getUTCMonth()+1).padStart(2,"0")}/${String(e.getUTCDate()).padStart(2,"0")}/${e.getUTCFullYear()}`}return"boolean"==typeof e?e?"Yes":"No":String(e??"")}_parse(e){if(null==e||""===e)return null;if(this.type)switch(this.type){case"boolean":{const t=e.toString().toLowerCase();return!0===e||!1!==e&&("yes"===t||"no"!==t&&("1"===t||"0"!==t&&null))}case"date":return this._parseDate(e);case"number":{const t=Number(e.toString().replace(/[$,]+/g,""));return isNaN(t)?null:t}default:return e.toString()}return e}_parseDate(e){if(null==e||""===e)return null;const t={jan:0,january:0,feb:1,february:1,mar:2,march:2,apr:3,april:3,may:4,jun:5,june:5,jul:6,july:6,aug:7,august:7,sep:8,september:8,oct:9,october:9,nov:10,november:10,dec:11,december:11};let i;if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{2})$/),i)return new Date(Date.UTC(2e3+parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2])));if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/),i)return new Date(Date.UTC(parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2])));if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i),i){let e=parseInt(i[4]);return i[6]&&("PM"===i[6].toUpperCase()&&12!==e&&(e+=12),"AM"===i[6].toUpperCase()&&12===e&&(e=0)),new Date(Date.UTC(parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2]),e,parseInt(i[5])))}if(i=e.match(/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i),i){const e=t[i[1].toLowerCase()];if(void 0!==e){let t=parseInt(i[4]);return i[6]&&("PM"===i[6].toUpperCase()&&12!==t&&(t+=12),"AM"===i[6].toUpperCase()&&12===t&&(t=0)),new Date(Date.UTC(parseInt(i[3]),e,parseInt(i[2]),t,parseInt(i[5])))}}if(i=e.match(/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4})$/),i){const e=t[i[1].toLowerCase()];if(void 0!==e)return new Date(Date.UTC(parseInt(i[3]),e,parseInt(i[2])))}if(i=e.match(/^(\d{2})$/),i)return new Date(Date.UTC(2e3+parseInt(i[1]),0,1));if(i=e.match(/^(\d{4})$/),i)return new Date(Date.UTC(parseInt(i[1]),0,1));if(i=e.match(/^([A-Za-z]+)\s+(\d{4})$/),i){const e=t[i[1].toLowerCase()];if(void 0!==e)return new Date(Date.UTC(parseInt(i[2]),e,1))}return null}_buildKql(){if(this.isEmpty())this.kql="";else switch(this.operator){case"equals":this.kql=`= ${this.text}`;break;case"n_equals":this.kql=`!= ${this.text}`;break;case"contains":this.kql=`~ ${this.text}`;break;case"n_contains":this.kql=`!~ ${this.text}`;break;case"starts_with":this.kql=`${this.text}*`;break;case"ends_with":this.kql=`*${this.text}`;break;case"empty":this.kql="EMPTY";break;case"n_empty":this.kql="NOT EMPTY";break;case"less_than":this.kql=`< ${this.text}`;break;case"less_than_equal":this.kql=`<= ${this.text}`;break;case"greater_than":this.kql=`> ${this.text}`;break;case"greater_than_equal":this.kql=`>= ${this.text}`;break;case"between":this.kql=`[${this._format(this.value?.start??"")} TO ${this._format(this.value?.end??"")}]`;break;case"in":this.kql=`(${this.value.map((e=>this._format(e))).join(",")})`;break;case"n_in":this.kql=`!(${this.value.map((e=>this._format(e))).join(",")})`;break;default:throw Error(`Unknown operator ${this.operator}`)}}}var pt=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};class ut{constructor(){this.title="",this.description="",this.actions=[],this.columns=[],this.displayedColumns=[],this.data=null,this.dataSource=null,this.refreshInterval=0,this.pageSize=0,this.rowClickable=!1,this.rowHref=null}}let ft=class extends le{constructor(){super(...arguments),this._scrollStyle="edge",this._data=[],this._dataState="idle",this._page=1,this._pageSize=50,this._totalItems=0,this._totalPages=0,this._searchQuery="",this._canScrollLeft=!1,this._canScrollRight=!1,this._canScrollHorizontal=!1,this._columnPickerOpen=!1,this._filterPanelOpened=null,this._filterPanelTab="filter",this._buckets=new Map,this._filterPanelPos={top:0,left:0},this._sorts=[],this._resizing=null,this._resizeObserver=null,this._searchPositionLocked=!1,this._columnWidthsLocked=!1,this._model=new ut,this.def={columns:[]},this.variant="default",this._handleClickOutside=e=>{const t=e.composedPath();if(this._columnPickerOpen){const e=this.shadowRoot?.querySelector(".column-picker-wrapper");e&&!t.includes(e)&&(this._columnPickerOpen=!1)}this._filterPanelOpened&&(t.some((e=>e.classList?.contains("filter-panel")))||this._handleFilterApply())},this._handleResizeMove=e=>{if(!this._resizing)return;const t=this._model.columns.find((e=>e.id===this._resizing.columnId));if(t){const i=this._resizing.startWidth+(e.clientX-this._resizing.startX);t.width=`${Math.min(900,Math.max(50,i))}px`,this.requestUpdate()}},this._handleResizeEnd=()=>{this._resizing=null,document.removeEventListener("mousemove",this._handleResizeMove),document.removeEventListener("mouseup",this._handleResizeEnd)}}connectedCallback(){super.connectedCallback(),this.classList.toggle("kr-table--scroll-overlay","overlay"===this._scrollStyle),this.classList.toggle("kr-table--scroll-edge","edge"===this._scrollStyle),this._fetch(),this._initRefresh(),document.addEventListener("click",this._handleClickOutside),this._resizeObserver=new ResizeObserver((()=>{this._searchPositionLocked=!1,this._updateSearchPosition()})),this._resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this._refreshTimer),document.removeEventListener("click",this._handleClickOutside),this._resizeObserver?.disconnect()}willUpdate(e){e.has("def")&&(this._columnWidthsLocked=!1,this._model=new ut,this.def.title&&(this._model.title=this.def.title),this.def.description&&(this._model.description=this.def.description),this.def.actions&&(this._model.actions=this.def.actions),this.def.data&&(this._model.data=this.def.data),this.def.dataSource&&(this._model.dataSource=this.def.dataSource),"number"==typeof this.def.refreshInterval&&(this._model.refreshInterval=this.def.refreshInterval),"number"==typeof this.def.pageSize&&(this._model.pageSize=this.def.pageSize,this._pageSize=this.def.pageSize),this.def.rowClickable&&(this._model.rowClickable=this.def.rowClickable),this.def.rowHref&&(this._model.rowHref=this.def.rowHref),this._sorts=[],this._model.columns=this.def.columns.map((e=>{const t={...e,filter:null};return t.type||(t.type="string"),e.sort&&this._sorts.push({sortBy:e.id,sortDirection:e.sort}),"actions"===t.type?(t.label=e.label??"",t.sticky="right",t.resizable=!1,t):((e.filterable||e.facetable)&&(t.filter=new ct,t.filter.field=e.id,t.filter.type=t.type,e.filter?(t.filter.setOperator(e.filter.operator),t.filter.setValue(e.filter.value)):e.facetable&&!e.filterable?(t.filter.operator="in",t.filter.value=[]):"string"===t.filter.type&&(t.filter.operator="contains")),t)})),this.def.displayedColumns?this._model.displayedColumns=this.def.displayedColumns:this._model.displayedColumns=this._model.columns.map((e=>e.id)),this._fetch(),this._initRefresh())}updated(e){this.classList.toggle("kr-table--card","card"===this.variant),this._updateScrollFlags(),this._syncSlottedContent(),this._lockColumnWidths()}_lockColumnWidths(){if(this._columnWidthsLocked||0===this._data.length)return;const e=this.shadowRoot?.querySelectorAll(".header-row > .header-cell");if(!e)return;const t=this.getDisplayedColumns();e.forEach(((e,i)=>{const s=e.offsetWidth;i<t.length&&!t[i].width&&"actions"!==t[i].type&&s>0&&(t[i].width=`${s}px`,this._columnWidthsLocked=!0)}))}_syncSlottedContent(){const e=this.getDisplayedColumns().filter((e=>e.render));e.length&&(this.querySelectorAll('[slot^="cell-"]').forEach((e=>e.remove())),this._data.forEach(((t,i)=>{e.forEach((e=>{const s=e.render(t);if(!s)return;const r=document.createElement("span");r.slot=`cell-${i}-${e.id}`,"actions"===e.type&&(r.style.display="flex",r.style.gap="8px"),"string"==typeof s?r.innerHTML=s:re(s,r),this.appendChild(r)}))})))}refresh(){this._fetch()}goToPrevPage(){this._page>1&&(this._page--,this._fetch())}goToNextPage(){this._page<this._totalPages&&(this._page++,this._fetch())}goToPage(e){e>=1&&e<=this._totalPages&&(this._page=e,this._fetch())}_toSolrData(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns){if(!t.filter||t.filter.isEmpty()||!t.filter.isValid())continue;const i=t.filter.toSolrData();!t.facetable||"in"!==t.filter.operator&&"n_in"!==t.filter.operator||(i.tagged=!0),e.filterFields.push(i)}for(const t of this._model.columns)t.facetable&&e.facetFields.push({name:t.id,type:"FIELD",limit:100,sort:"count",minimumCount:1});return this._searchQuery?.trim().length&&e.queryFields.push({name:"_text_",operation:"IS",value:lt(this._searchQuery,!1)}),e}_toDbParams(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns)t.filter&&!t.filter.isEmpty()&&t.filter.isValid()&&e.filterFields.push(t.filter.toDbParams());return this._searchQuery?.trim().length&&this._model.columns.filter((e=>e.searchable)).forEach((t=>{e.queryFields.push({name:t.id,operation:"CONTAINS",value:this._searchQuery,and:!1})})),e}_fetch(){if(this._model.data)return this._data=this._model.data,this._totalItems=this._model.data.length,this._totalPages=Math.ceil(this._model.data.length/this._pageSize),void(this._dataState="success");if(!this._model.dataSource)return;let e;this._dataState="loading",e="db"===this._model.dataSource.mode?this._toDbParams():this._toSolrData(),this._model.dataSource.fetch(e).then((e=>{switch(this._model.dataSource?.mode){case"opensearch":throw Error("Opensearch not supported yet");case"db":{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size;break}default:{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size,this._parseFacetResults(t)}}this._dataState="success",this._updateSearchPosition()})).catch((e=>{this._dataState="error",Ke.show({message:e instanceof Error?e.message:"Failed to load data",type:"error"})}))}_parseFacetResults(e){if(e.data.facetFields){for(const t of this._model.columns){if(!t.facetable)continue;const i=e.data.facetFields[t.id];if(!i){this._buckets.set(t.id,[]);continue}const s=[];for(const e of i){let i=e.name;"boolean"===t.type&&"string"==typeof e.name&&("true"===e.name?i=!0:"false"===e.name&&(i=!1)),null===e.name&&e.count>0&&s.unshift({val:null,count:e.count}),null!==e.name&&s.push({val:i,count:e.count})}if(t.filter&&("in"===t.filter.operator||"n_in"===t.filter.operator)&&Array.isArray(t.filter.value))for(const e of t.filter.value)s.some((t=>t.val===e))||s.push({val:e,count:0});this._buckets.set(t.id,s)}this._buckets=new Map(this._buckets)}}_initRefresh(){clearInterval(this._refreshTimer),this._model.refreshInterval&&this._model.refreshInterval>0&&(this._refreshTimer=window.setInterval((()=>{this._fetch()}),this._model.refreshInterval))}_handleSearch(e){const t=e.target;this._searchQuery=t.value,this._page=1,this._fetch()}_getGridTemplateColumns(){return this.getDisplayedColumns().map((e=>e.width?e.width:"actions"===e.type?"max-content":"minmax(80px, auto)")).join(" ")}_updateSearchPosition(){if(this._searchPositionLocked)return;if("card"===this.variant)return;const e=this.shadowRoot?.querySelector(".search"),t=e?.querySelector(".search-field");e&&t&&(e.style.justifyContent="center",t.style.marginLeft="",requestAnimationFrame((()=>{const i=e.getBoundingClientRect(),s=t.getBoundingClientRect().left-i.left;e.style.justifyContent="flex-start",t.style.marginLeft=`${s}px`,this._searchPositionLocked=!0})))}_toggleColumnPicker(){this._columnPickerOpen=!this._columnPickerOpen}_toggleColumn(e){this._model.displayedColumns.includes(e)?this._model.displayedColumns=this._model.displayedColumns.filter((t=>t!==e)):this._model.displayedColumns=[...this._model.displayedColumns,e],this.requestUpdate()}_handleRowMouseDown(){(this._model.rowClickable||this._model.rowHref)&&window.getSelection()?.removeAllRanges()}_handleRowClick(e,t,i){if(!this._model.rowClickable&&!this._model.rowHref)return;const s=window.getSelection();s&&s.toString().length>0?e.preventDefault():this.dispatchEvent(new CustomEvent("row-click",{detail:{row:t,rowIndex:i},bubbles:!0,composed:!0}))}getDisplayedColumns(){return this._model.displayedColumns.map((e=>this._model.columns.find((t=>t.id===e)))).sort(((e,t)=>"actions"===e.type&&"actions"!==t.type?1:"actions"!==e.type&&"actions"===t.type?-1:0))}_handleScroll(e){const t=e.target;this._canScrollLeft=t.scrollLeft>0,this._canScrollRight=t.scrollLeft<t.scrollWidth-t.clientWidth-1}_updateScrollFlags(){const e=this.shadowRoot?.querySelector(".content");e&&(this._canScrollLeft=e.scrollLeft>0,this._canScrollRight=e.scrollWidth>e.clientWidth&&e.scrollLeft<e.scrollWidth-e.clientWidth-1,this._canScrollHorizontal=e.scrollWidth>e.clientWidth),this.classList.toggle("kr-table--scroll-left-available",this._canScrollLeft),this.classList.toggle("kr-table--scroll-right-available",this._canScrollRight),this.classList.toggle("kr-table--scroll-horizontal-available",this._canScrollHorizontal),this.classList.toggle("kr-table--sticky-left",this.getDisplayedColumns().some((e=>"left"===e.sticky))),this.classList.toggle("kr-table--sticky-right",this.getDisplayedColumns().some((e=>"right"===e.sticky)))}_handleResizeStart(e,t){e.preventDefault();const i=this.shadowRoot?.querySelector(`.header-cell[data-column-id="${t}"]`);this._resizing={columnId:t,startX:e.clientX,startWidth:i?.offsetWidth||200},document.addEventListener("mousemove",this._handleResizeMove),document.addEventListener("mouseup",this._handleResizeEnd)}_handleSortClick(e,t){if(e.shiftKey){const e=this._sorts.findIndex((e=>e.sortBy===t.id));if(-1===e)this._sorts.push({sortBy:t.id,sortDirection:"asc"});else{const t=this._sorts[e];"asc"===t.sortDirection?t.sortDirection="desc":this._sorts.splice(e,1)}this.requestUpdate()}else{let e=null;1===this._sorts.length&&(e=this._sorts.find((e=>e.sortBy===t.id))),e?"asc"===e.sortDirection?this._sorts=[{sortBy:t.id,sortDirection:"desc"}]:this._sorts=[]:this._sorts=[{sortBy:t.id,sortDirection:"asc"}]}this._page=1,this._fetch()}_renderSortIndicator(e){if(!e.sortable)return F;const t=this._sorts.findIndex((t=>t.sortBy===e.id));if(-1===t)return j`
|
|
1956
1956
|
<span class="header-cell__sort" @click=${t=>this._handleSortClick(t,e)}>
|
|
1957
1957
|
<svg class="header-cell__sort-arrow header-cell__sort-arrow--ghost" viewBox="0 0 24 24" fill="currentColor">
|
|
1958
1958
|
<path d="M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"/>
|
|
@@ -1960,12 +1960,12 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
1960
1960
|
</span>
|
|
1961
1961
|
`;let i={};return"desc"===this._sorts[t].sortDirection&&(i={transform:"rotate(180deg)"}),j`
|
|
1962
1962
|
<span class="header-cell__sort" @click=${t=>this._handleSortClick(t,e)}>
|
|
1963
|
-
<svg class="header-cell__sort-arrow" viewBox="0 0 24 24" fill="currentColor" style=${
|
|
1963
|
+
<svg class="header-cell__sort-arrow" viewBox="0 0 24 24" fill="currentColor" style=${Le(i)}>
|
|
1964
1964
|
<path d="M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"/>
|
|
1965
1965
|
</svg>
|
|
1966
1966
|
${this._sorts.length>1?j`
|
|
1967
1967
|
<span class="header-cell__sort-priority">${t+1}</span>
|
|
1968
|
-
`:
|
|
1968
|
+
`:F}
|
|
1969
1969
|
</span>
|
|
1970
1970
|
`}_handleAction(e){e.href||this.dispatchEvent(new CustomEvent("action",{detail:{action:e.id},bubbles:!0,composed:!0}))}_handleKqlChange(e,t){const i=e.target.value.trim();if(i){if(t.filter.setKql(i),this.requestUpdate(),!t.filter.isValid())return}else t.filter.clear(),this.requestUpdate();this._page=1,this._fetch()}_handleFilterPanelToggle(e,t){if(e.stopPropagation(),this._filterPanelOpened===t.id)this._filterPanelOpened=null;else{const i=e.currentTarget.getBoundingClientRect();let s=i.left;s+328>window.innerWidth&&(s=window.innerWidth-328),this._filterPanelPos={top:i.bottom+4,left:s},this._filterPanelOpened=t.id,t.facetable?this._filterPanelTab="counts":this._filterPanelTab="filter"}}_handleKqlClear(e){e.filter.clear(),this._page=1,this._fetch()}_handleFilterClear(){const e=this._model.columns.find((e=>e.id===this._filterPanelOpened));e&&(e.filter.clear(),e.facetable&&!e.filterable&&(e.filter.operator="in",e.filter.value=[])),this._filterPanelOpened=null,this._page=1,this._fetch()}_handleFilterTextKeydown(e,t){"Enter"===e.key&&(e.preventDefault(),this._handleFilterApply())}_handleOperatorChange(e,t){t.filter.setOperator(e.target.value),this.requestUpdate()}_handleFilterStringChange(e,t){t.filter.setValue(e.target.value),this.requestUpdate()}_handleFilterNumberChange(e,t){t.filter.setValue(Number(e.target.value)),this.requestUpdate()}_handleFilterDateChange(e,t){t.filter.setValue(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterBooleanChange(e,t){t.filter.setValue("true"===e.target.value),this.requestUpdate()}_handleFilterDateStartChange(e,t){t.filter.setStart(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterDateEndChange(e,t){t.filter.setEnd(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterNumberStartChange(e,t){t.filter.setStart(Number(e.target.value)),this.requestUpdate()}_handleFilterNumberEndChange(e,t){t.filter.setEnd(Number(e.target.value)),this.requestUpdate()}_handleFilterListChange(e,t){const i=e.target.value.split(",").map((e=>e.trim())).filter((e=>""!==e));"number"===t.type?t.filter.setValue(i.map((e=>Number(e)))):t.filter.setValue(i),this.requestUpdate()}_handleFilterApply(){this._filterPanelOpened=null,this._page=1,this._fetch()}_handleFilterPanelTabChange(e){this._filterPanelTab=e.detail.activeTabId}_handleBucketToggle(e,t,i){t.filter.toggle(i.val),this._page=1,this._fetch()}_renderCellContent(e,t,i){const s=t[e.id];if(e.render)return j`<slot name="cell-${i}-${e.id}"></slot>`;if(null==s)return"";switch(e.type){case"number":return"currency"===e.format&&"number"==typeof s?s.toLocaleString("en-US",{style:"currency",currency:"USD"}):String(s);case"date":{let e;if(s instanceof Date)e=s;else if("string"==typeof s&&/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/.test(s)){const t=s.replace(/(\d{2}:\d{2}:\d{2}):(\d+)$/,"$1.$2").replace(" ","T")+"Z";e=new Date(t)}else e=new Date(s);return e.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZone:"UTC"})}case"boolean":return!0===s?"Yes":!1===s?"No":"";default:return String(s)}}_getHeaderCellClasses(e,t){return{"header-cell":!0,"header-cell--sortable":!!e.sortable,"header-cell--align-center":"center"===e.align,"header-cell--align-right":"right"===e.align,"header-cell--sticky-left":"left"===e.sticky,"header-cell--sticky-left-last":"left"===e.sticky&&!this.getDisplayedColumns().slice(t+1).some((e=>"left"===e.sticky)),"header-cell--sticky-right":"right"===e.sticky,"header-cell--sticky-right-first":"right"===e.sticky&&!this.getDisplayedColumns().slice(0,t).some((e=>"right"===e.sticky))}}_getCellClasses(e,t){return{cell:!0,"cell--actions":"actions"===e.type,"cell--align-center":"center"===e.align,"cell--align-right":"right"===e.align,"cell--sticky-left":"left"===e.sticky,"cell--sticky-left-last":"left"===e.sticky&&!this.getDisplayedColumns().slice(t+1).some((e=>"left"===e.sticky)),"cell--sticky-right":"right"===e.sticky,"cell--sticky-right-first":"right"===e.sticky&&!this.getDisplayedColumns().slice(0,t).some((e=>"right"===e.sticky))}}_getCellStyle(e,t){const i={};if("left"===e.sticky){let e=0;for(let i=0;i<t;i++){const t=this.getDisplayedColumns()[i];"left"===t.sticky&&(e+=parseInt(t.width||"0",10))}i.left=`${e}px`}if("right"===e.sticky){let e=0;for(let i=t+1;i<this.getDisplayedColumns().length;i++){const t=this.getDisplayedColumns()[i];"right"===t.sticky&&(e+=parseInt(t.width||"0",10))}i.right=`${e}px`}return i}_renderPagination(){const e=(this._page-1)*this._pageSize+1,t=Math.min(this._page*this._pageSize,this._totalItems);return j`
|
|
1971
1971
|
<div class="pagination">
|
|
@@ -1983,14 +1983,14 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
1983
1983
|
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
|
|
1984
1984
|
</span>
|
|
1985
1985
|
</div>
|
|
1986
|
-
`}_renderCardHeader(){return"card"!==this.variant?
|
|
1986
|
+
`}_renderCardHeader(){return"card"!==this.variant?F:this._model.title||this._model.description?j`
|
|
1987
1987
|
<div class="card-header">
|
|
1988
|
-
${this._model.title?j`<h2 class="card-header__title">${this._model.title}</h2>`:
|
|
1989
|
-
${this._model.description?j`<p class="card-header__description">${this._model.description}</p>`:
|
|
1988
|
+
${this._model.title?j`<h2 class="card-header__title">${this._model.title}</h2>`:F}
|
|
1989
|
+
${this._model.description?j`<p class="card-header__description">${this._model.description}</p>`:F}
|
|
1990
1990
|
</div>
|
|
1991
|
-
`:
|
|
1991
|
+
`:F}_renderHeader(){return!this._model.title&&!this._model.actions?.length&&this._totalPages<=1?F:j`
|
|
1992
1992
|
<div class="header">
|
|
1993
|
-
${this._model.title&&"card"!==this.variant?j`<div class="title">${this._model.title}</div>`:
|
|
1993
|
+
${this._model.title&&"card"!==this.variant?j`<div class="title">${this._model.title}</div>`:F}
|
|
1994
1994
|
${"db"!==this._model.dataSource?.mode||this._model.columns.some((e=>e.searchable))?j`
|
|
1995
1995
|
<div class="search">
|
|
1996
1996
|
<!-- TODO: Saved views dropdown
|
|
@@ -2048,10 +2048,10 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
2048
2048
|
>
|
|
2049
2049
|
Actions
|
|
2050
2050
|
</kr-button>
|
|
2051
|
-
`:
|
|
2051
|
+
`:F}
|
|
2052
2052
|
</div>
|
|
2053
2053
|
</div>
|
|
2054
|
-
`}_renderStatus(){return"loading"===this._dataState&&0===this._data.length?j`<div class="status">Loading...</div>`:"error"===this._dataState&&0===this._data.length?j`<div class="status status--error">Error loading data</div>`:0===this._data.length?j`<div class="status">No data available</div>`:
|
|
2054
|
+
`}_renderStatus(){return"loading"===this._dataState&&0===this._data.length?j`<div class="status">Loading...</div>`:"error"===this._dataState&&0===this._data.length?j`<div class="status status--error">Error loading data</div>`:0===this._data.length?j`<div class="status">No data available</div>`:F}_renderFilterPanel(){if(!this._filterPanelOpened)return F;const e=this._model.columns.find((e=>e.id===this._filterPanelOpened));let t=j``;t="empty"===e.filter.operator||"n_empty"===e.filter.operator?j`
|
|
2055
2055
|
<input
|
|
2056
2056
|
type="text"
|
|
2057
2057
|
class="filter-panel__input"
|
|
@@ -2144,9 +2144,9 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
2144
2144
|
</kr-select-field>
|
|
2145
2145
|
${t}
|
|
2146
2146
|
</div>
|
|
2147
|
-
`,s=this._buckets.get(e.id)||[];let o
|
|
2147
|
+
`,s=this._buckets.get(e.id)||[];let r,o;return r=s.length?j`
|
|
2148
2148
|
<div class="buckets">
|
|
2149
|
-
${s.map((t=>{let i="(Empty)";null!==t.val&&void 0!==t.val&&(i="boolean"===e.type?!0===t.val||"true"===t.val?"Yes":"No":String(t.val));let s=e.filter.has(t.val);"n_in"===e.filter.operator&&(s=!s);let
|
|
2149
|
+
${s.map((t=>{let i="(Empty)";null!==t.val&&void 0!==t.val&&(i="boolean"===e.type?!0===t.val||"true"===t.val?"Yes":"No":String(t.val));let s=e.filter.has(t.val);"n_in"===e.filter.operator&&(s=!s);let r=F;return s&&(r=j`
|
|
2150
2150
|
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
2151
2151
|
<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/>
|
|
2152
2152
|
</svg>
|
|
@@ -2156,14 +2156,14 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
2156
2156
|
@click=${i=>this._handleBucketToggle(i,e,t)}
|
|
2157
2157
|
>
|
|
2158
2158
|
<div class=${we({bucket__checkbox:!0,"bucket__checkbox--checked":s})}>
|
|
2159
|
-
${
|
|
2159
|
+
${r}
|
|
2160
2160
|
</div>
|
|
2161
2161
|
<span class="bucket__label">${i}</span>
|
|
2162
2162
|
<span class="bucket__count">${t.count}</span>
|
|
2163
2163
|
</div>
|
|
2164
2164
|
`}))}
|
|
2165
2165
|
</div>
|
|
2166
|
-
`:j`<div class="bucket-empty">No data</div>`,
|
|
2166
|
+
`:j`<div class="bucket-empty">No data</div>`,o=e.facetable&&e.filterable?j`
|
|
2167
2167
|
<kr-tab-group
|
|
2168
2168
|
size="small"
|
|
2169
2169
|
active-tab-id=${this._filterPanelTab}
|
|
@@ -2173,15 +2173,15 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
2173
2173
|
${i}
|
|
2174
2174
|
</kr-tab>
|
|
2175
2175
|
<kr-tab id="counts" label="Counts">
|
|
2176
|
-
${
|
|
2176
|
+
${r}
|
|
2177
2177
|
</kr-tab>
|
|
2178
2178
|
</kr-tab-group>
|
|
2179
|
-
`:e.facetable?
|
|
2179
|
+
`:e.facetable?r:i,j`
|
|
2180
2180
|
<div
|
|
2181
2181
|
class="filter-panel"
|
|
2182
|
-
style=${
|
|
2182
|
+
style=${Le({top:this._filterPanelPos.top+"px",left:this._filterPanelPos.left+"px"})}
|
|
2183
2183
|
>
|
|
2184
|
-
${
|
|
2184
|
+
${o}
|
|
2185
2185
|
<div class="filter-panel__actions">
|
|
2186
2186
|
<kr-button variant="outline" color="secondary" size="small" @click=${this._handleFilterClear}>
|
|
2187
2187
|
Clear
|
|
@@ -2196,7 +2196,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
2196
2196
|
${e.map(((t,i)=>t.filterable||t.facetable?j`
|
|
2197
2197
|
<div
|
|
2198
2198
|
class=${we({"filter-cell":!0,"filter-cell--sticky-left":"left"===t.sticky,"filter-cell--sticky-right":"right"===t.sticky,"filter-cell--sticky-right-first":"right"===t.sticky&&!e.slice(0,i).some((e=>"right"===e.sticky))})}
|
|
2199
|
-
style=${
|
|
2199
|
+
style=${Le(this._getCellStyle(t,i))}
|
|
2200
2200
|
>
|
|
2201
2201
|
<div class="filter-cell__wrapper">
|
|
2202
2202
|
<input
|
|
@@ -2214,7 +2214,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
2214
2214
|
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
|
|
2215
2215
|
</svg>
|
|
2216
2216
|
</button>
|
|
2217
|
-
`:
|
|
2217
|
+
`:F}
|
|
2218
2218
|
<button
|
|
2219
2219
|
class=${we({"filter-cell__advanced":!0,"filter-cell__advanced--opened":this._filterPanelOpened===t.id})}
|
|
2220
2220
|
@click=${e=>this._handleFilterPanelToggle(e,t)}
|
|
@@ -2227,10 +2227,10 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
2227
2227
|
</div>
|
|
2228
2228
|
`:j`<div
|
|
2229
2229
|
class=${we({"filter-cell":!0,"filter-cell--sticky-left":"left"===t.sticky,"filter-cell--sticky-right":"right"===t.sticky,"filter-cell--sticky-right-first":"right"===t.sticky&&!e.slice(0,i).some((e=>"right"===e.sticky))})}
|
|
2230
|
-
style=${
|
|
2230
|
+
style=${Le(this._getCellStyle(t,i))}
|
|
2231
2231
|
></div>`))}
|
|
2232
2232
|
</div>
|
|
2233
|
-
`:
|
|
2233
|
+
`:F}_renderTable(){return j`
|
|
2234
2234
|
<div class="wrapper">
|
|
2235
2235
|
<div class="overlay-left"></div>
|
|
2236
2236
|
<div class="overlay-right"></div>
|
|
@@ -2241,7 +2241,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
2241
2241
|
${this.getDisplayedColumns().map(((e,t)=>j`
|
|
2242
2242
|
<div
|
|
2243
2243
|
class=${we(this._getHeaderCellClasses(e,t))}
|
|
2244
|
-
style=${
|
|
2244
|
+
style=${Le(this._getCellStyle(e,t))}
|
|
2245
2245
|
data-column-id=${e.id}
|
|
2246
2246
|
>
|
|
2247
2247
|
<span class="header-cell__label">${e.label??e.id}</span>
|
|
@@ -2249,7 +2249,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
2249
2249
|
${!1!==e.resizable?j`<div
|
|
2250
2250
|
class="header-cell__resize"
|
|
2251
2251
|
@mousedown=${t=>this._handleResizeStart(t,e.id)}
|
|
2252
|
-
></div>`:
|
|
2252
|
+
></div>`:F}
|
|
2253
2253
|
</div>
|
|
2254
2254
|
`))}
|
|
2255
2255
|
</div>
|
|
@@ -2257,7 +2257,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
2257
2257
|
${this._data.map(((e,t)=>{const i=this.getDisplayedColumns().map(((i,s)=>j`
|
|
2258
2258
|
<div
|
|
2259
2259
|
class=${we(this._getCellClasses(i,s))}
|
|
2260
|
-
style=${
|
|
2260
|
+
style=${Le(this._getCellStyle(i,s))}
|
|
2261
2261
|
data-column-id=${i.id}
|
|
2262
2262
|
>
|
|
2263
2263
|
${this._renderCellContent(i,e,t)}
|
|
@@ -2285,7 +2285,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
2285
2285
|
${this._renderHeader()}
|
|
2286
2286
|
${this._renderTable()}
|
|
2287
2287
|
${this._renderFilterPanel()}
|
|
2288
|
-
`:j`<slot></slot>`}};ft.styles=[ne,
|
|
2288
|
+
`:j`<slot></slot>`}};ft.styles=[ne,o`
|
|
2289
2289
|
/* -------------------------------------------------------------------------
|
|
2290
2290
|
* Host
|
|
2291
2291
|
* ----------------------------------------------------------------------- */
|
|
@@ -3189,7 +3189,1237 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
3189
3189
|
height: auto;
|
|
3190
3190
|
}
|
|
3191
3191
|
|
|
3192
|
-
`],pt([ue()],ft.prototype,"_data",void 0),pt([ue()],ft.prototype,"_dataState",void 0),pt([ue()],ft.prototype,"_page",void 0),pt([ue()],ft.prototype,"_pageSize",void 0),pt([ue()],ft.prototype,"_totalItems",void 0),pt([ue()],ft.prototype,"_totalPages",void 0),pt([ue()],ft.prototype,"_searchQuery",void 0),pt([ue()],ft.prototype,"_canScrollLeft",void 0),pt([ue()],ft.prototype,"_canScrollRight",void 0),pt([ue()],ft.prototype,"_canScrollHorizontal",void 0),pt([ue()],ft.prototype,"_columnPickerOpen",void 0),pt([ue()],ft.prototype,"_filterPanelOpened",void 0),pt([ue()],ft.prototype,"_filterPanelTab",void 0),pt([ue()],ft.prototype,"_buckets",void 0),pt([ue()],ft.prototype,"_sorts",void 0),pt([pe({type:Object})],ft.prototype,"def",void 0),pt([pe({type:String,reflect:!0})],ft.prototype,"variant",void 0),ft=pt([de("kr-table")],ft);var gt=function(e,t,i,s){var o,r=arguments.length,a=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let bt=class extends ae{constructor(){super(...arguments),this.size="md",this.color="dark"}render(){var e="",t="";return e="sm"==this.size?"16px":"md"==this.size?"24px":"lg"==this.size?"32px":"xl"==this.size?"48px":this.size,t="dark"==this.color?"#163052":"light"==this.color?"#ffffff":this.color,j`
|
|
3192
|
+
`],pt([ue()],ft.prototype,"_data",void 0),pt([ue()],ft.prototype,"_dataState",void 0),pt([ue()],ft.prototype,"_page",void 0),pt([ue()],ft.prototype,"_pageSize",void 0),pt([ue()],ft.prototype,"_totalItems",void 0),pt([ue()],ft.prototype,"_totalPages",void 0),pt([ue()],ft.prototype,"_searchQuery",void 0),pt([ue()],ft.prototype,"_canScrollLeft",void 0),pt([ue()],ft.prototype,"_canScrollRight",void 0),pt([ue()],ft.prototype,"_canScrollHorizontal",void 0),pt([ue()],ft.prototype,"_columnPickerOpen",void 0),pt([ue()],ft.prototype,"_filterPanelOpened",void 0),pt([ue()],ft.prototype,"_filterPanelTab",void 0),pt([ue()],ft.prototype,"_buckets",void 0),pt([ue()],ft.prototype,"_sorts",void 0),pt([pe({type:Object})],ft.prototype,"def",void 0),pt([pe({type:String,reflect:!0})],ft.prototype,"variant",void 0),ft=pt([de("kr-table")],ft);var gt=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};class bt{constructor(){this.title="",this.description="",this.actions=[],this.columns=[],this.displayedColumns=[],this.data=null,this.dataSource=null,this.refreshInterval=0,this.pageSize=0,this.rowClickable=!1,this.rowHref=null}}let vt=class extends le{constructor(){super(...arguments),this._scrollStyle="edge",this._data=[],this._dataState="idle",this._page=1,this._pageSize=50,this._totalItems=0,this._totalPages=0,this._searchQuery="",this._canScrollLeft=!1,this._canScrollRight=!1,this._canScrollHorizontal=!1,this._columnPickerOpen=!1,this._filterPanelOpened=null,this._filterPanelTab="filter",this._buckets=new Map,this._filterPanelPos={top:0,left:0},this._sorts=[],this._resizing=null,this._resizeObserver=null,this._searchPositionLocked=!1,this._columnWidthsLocked=!1,this._model=new bt,this.def={columns:[]},this.variant="default",this._handleClickOutside=e=>{const t=e.composedPath();if(this._columnPickerOpen){const e=this.shadowRoot?.querySelector(".column-picker-wrapper");e&&!t.includes(e)&&(this._columnPickerOpen=!1)}this._filterPanelOpened&&(t.some((e=>e.classList?.contains("filter-panel")))||this._handleFilterApply())},this._handleResizeMove=e=>{if(!this._resizing)return;const t=this._model.columns.find((e=>e.id===this._resizing.columnId));if(t){const i=this._resizing.startWidth+(e.clientX-this._resizing.startX);t.width=`${Math.min(900,Math.max(50,i))}px`,this.requestUpdate()}},this._handleResizeEnd=()=>{this._resizing=null,document.removeEventListener("mousemove",this._handleResizeMove),document.removeEventListener("mouseup",this._handleResizeEnd)}}connectedCallback(){super.connectedCallback(),this.classList.toggle("kr-table--scroll-overlay","overlay"===this._scrollStyle),this.classList.toggle("kr-table--scroll-edge","edge"===this._scrollStyle),this._fetch(),this._initRefresh(),document.addEventListener("click",this._handleClickOutside),this._resizeObserver=new ResizeObserver((()=>{this._searchPositionLocked=!1,this._updateSearchPosition()})),this._resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this._refreshTimer),document.removeEventListener("click",this._handleClickOutside),this._resizeObserver?.disconnect()}willUpdate(e){e.has("def")&&(this._columnWidthsLocked=!1,this._model=new bt,this.def.title&&(this._model.title=this.def.title),this.def.description&&(this._model.description=this.def.description),this.def.actions&&(this._model.actions=this.def.actions),this.def.data&&(this._model.data=this.def.data),this.def.dataSource&&(this._model.dataSource=this.def.dataSource),"number"==typeof this.def.refreshInterval&&(this._model.refreshInterval=this.def.refreshInterval),"number"==typeof this.def.pageSize&&(this._model.pageSize=this.def.pageSize,this._pageSize=this.def.pageSize),this.def.rowClickable&&(this._model.rowClickable=this.def.rowClickable),this.def.rowHref&&(this._model.rowHref=this.def.rowHref),this._sorts=[],this._model.columns=this.def.columns.map((e=>{const t={...e,filter:null};return t.type||(t.type="string"),e.sort&&this._sorts.push({sortBy:e.id,sortDirection:e.sort}),"actions"===t.type?(t.label=e.label??"",t.sticky="right",t.resizable=!1,t):((e.filterable||e.facetable)&&(t.filter=new ct,t.filter.field=e.id,t.filter.type=t.type,e.filter?(t.filter.setOperator(e.filter.operator),t.filter.setValue(e.filter.value)):e.facetable&&!e.filterable?(t.filter.operator="in",t.filter.value=[]):"string"===t.filter.type&&(t.filter.operator="contains")),t)})),this.def.displayedColumns?this._model.displayedColumns=this.def.displayedColumns:this._model.displayedColumns=this._model.columns.map((e=>e.id)),this._fetch(),this._initRefresh())}updated(e){this.classList.toggle("kr-table--card","card"===this.variant),this._updateScrollFlags(),this._syncSlottedContent(),this._lockColumnWidths()}_lockColumnWidths(){if(this._columnWidthsLocked||0===this._data.length)return;const e=this.shadowRoot?.querySelectorAll(".header-row > .header-cell");if(!e)return;const t=this.getDisplayedColumns();e.forEach(((e,i)=>{const s=e.offsetWidth;i<t.length&&!t[i].width&&"actions"!==t[i].type&&s>0&&(t[i].width=`${s}px`,this._columnWidthsLocked=!0)}))}_syncSlottedContent(){const e=this.getDisplayedColumns().filter((e=>e.render));e.length&&(this.querySelectorAll('[slot^="cell-"]').forEach((e=>e.remove())),this._data.forEach(((t,i)=>{e.forEach((e=>{const s=e.render(t);if(!s)return;const r=document.createElement("span");r.slot=`cell-${i}-${e.id}`,"actions"===e.type&&(r.style.display="flex",r.style.gap="8px"),"string"==typeof s?r.innerHTML=s:re(s,r),this.appendChild(r)}))})))}refresh(){this._fetch()}goToPrevPage(){this._page>1&&(this._page--,this._fetch())}goToNextPage(){this._page<this._totalPages&&(this._page++,this._fetch())}goToPage(e){e>=1&&e<=this._totalPages&&(this._page=e,this._fetch())}_toSolrData(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns){if(!t.filter||t.filter.isEmpty()||!t.filter.isValid())continue;const i=t.filter.toSolrData();!t.facetable||"in"!==t.filter.operator&&"n_in"!==t.filter.operator||(i.tagged=!0),e.filterFields.push(i)}for(const t of this._model.columns)t.facetable&&e.facetFields.push({name:t.id,type:"FIELD",limit:100,sort:"count",minimumCount:1});return this._searchQuery?.trim().length&&e.queryFields.push({name:"_text_",operation:"IS",value:lt(this._searchQuery,!1)}),e}_toDbParams(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns)t.filter&&!t.filter.isEmpty()&&t.filter.isValid()&&e.filterFields.push(t.filter.toDbParams());return this._searchQuery?.trim().length&&this._model.columns.filter((e=>e.searchable)).forEach((t=>{e.queryFields.push({name:t.id,operation:"CONTAINS",value:this._searchQuery,and:!1})})),e}_fetch(){if(this._model.data)return this._data=this._model.data,this._totalItems=this._model.data.length,this._totalPages=Math.ceil(this._model.data.length/this._pageSize),void(this._dataState="success");if(!this._model.dataSource)return;let e;this._dataState="loading",e="db"===this._model.dataSource.mode?this._toDbParams():this._toSolrData(),this._model.dataSource.fetch(e).then((e=>{switch(this._model.dataSource?.mode){case"opensearch":throw Error("Opensearch not supported yet");case"db":{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size;break}default:{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size,this._parseFacetResults(t)}}this._dataState="success",this._updateSearchPosition()})).catch((e=>{this._dataState="error",Ke.show({message:e instanceof Error?e.message:"Failed to load data",type:"error"})}))}_parseFacetResults(e){if(e.data.facetFields){for(const t of this._model.columns){if(!t.facetable)continue;const i=e.data.facetFields[t.id];if(!i){this._buckets.set(t.id,[]);continue}const s=[];for(const e of i){let i=e.name;"boolean"===t.type&&"string"==typeof e.name&&("true"===e.name?i=!0:"false"===e.name&&(i=!1)),null===e.name&&e.count>0&&s.unshift({val:null,count:e.count}),null!==e.name&&s.push({val:i,count:e.count})}if(t.filter&&("in"===t.filter.operator||"n_in"===t.filter.operator)&&Array.isArray(t.filter.value))for(const e of t.filter.value)s.some((t=>t.val===e))||s.push({val:e,count:0});this._buckets.set(t.id,s)}this._buckets=new Map(this._buckets)}}_initRefresh(){clearInterval(this._refreshTimer),this._model.refreshInterval&&this._model.refreshInterval>0&&(this._refreshTimer=window.setInterval((()=>{this._fetch()}),this._model.refreshInterval))}_handleSearch(e){const t=e.target;this._searchQuery=t.value,this._page=1,this._fetch()}_getGridTemplateColumns(){return this.getDisplayedColumns().map((e=>e.width?e.width:"actions"===e.type?"max-content":"minmax(80px, auto)")).join(" ")}_updateSearchPosition(){if(this._searchPositionLocked)return;if("card"===this.variant)return;const e=this.shadowRoot?.querySelector(".search"),t=e?.querySelector(".search-field");e&&t&&(e.style.justifyContent="center",t.style.marginLeft="",requestAnimationFrame((()=>{const i=e.getBoundingClientRect(),s=t.getBoundingClientRect().left-i.left;e.style.justifyContent="flex-start",t.style.marginLeft=`${s}px`,this._searchPositionLocked=!0})))}_toggleColumnPicker(){this._columnPickerOpen=!this._columnPickerOpen}_toggleColumn(e){this._model.displayedColumns.includes(e)?this._model.displayedColumns=this._model.displayedColumns.filter((t=>t!==e)):this._model.displayedColumns=[...this._model.displayedColumns,e],this.requestUpdate()}_handleRowMouseDown(){(this._model.rowClickable||this._model.rowHref)&&window.getSelection()?.removeAllRanges()}_handleRowClick(e,t,i){if(!this._model.rowClickable&&!this._model.rowHref)return;const s=window.getSelection();s&&s.toString().length>0?e.preventDefault():this.dispatchEvent(new CustomEvent("row-click",{detail:{row:t,rowIndex:i},bubbles:!0,composed:!0}))}getDisplayedColumns(){return this._model.displayedColumns.map((e=>this._model.columns.find((t=>t.id===e)))).sort(((e,t)=>"actions"===e.type&&"actions"!==t.type?1:"actions"!==e.type&&"actions"===t.type?-1:0))}_handleScroll(e){const t=e.target;this._canScrollLeft=t.scrollLeft>0,this._canScrollRight=t.scrollLeft<t.scrollWidth-t.clientWidth-1}_updateScrollFlags(){const e=this.shadowRoot?.querySelector(".content");e&&(this._canScrollLeft=e.scrollLeft>0,this._canScrollRight=e.scrollWidth>e.clientWidth&&e.scrollLeft<e.scrollWidth-e.clientWidth-1,this._canScrollHorizontal=e.scrollWidth>e.clientWidth),this.classList.toggle("kr-table--scroll-left-available",this._canScrollLeft),this.classList.toggle("kr-table--scroll-right-available",this._canScrollRight),this.classList.toggle("kr-table--scroll-horizontal-available",this._canScrollHorizontal),this.classList.toggle("kr-table--sticky-left",this.getDisplayedColumns().some((e=>"left"===e.sticky))),this.classList.toggle("kr-table--sticky-right",this.getDisplayedColumns().some((e=>"right"===e.sticky)))}_handleResizeStart(e,t){e.preventDefault();const i=this.shadowRoot?.querySelector(`.header-cell[data-column-id="${t}"]`);this._resizing={columnId:t,startX:e.clientX,startWidth:i?.offsetWidth||200},document.addEventListener("mousemove",this._handleResizeMove),document.addEventListener("mouseup",this._handleResizeEnd)}_handleSortClick(e,t){if(e.shiftKey){const e=this._sorts.findIndex((e=>e.sortBy===t.id));if(-1===e)this._sorts.push({sortBy:t.id,sortDirection:"asc"});else{const t=this._sorts[e];"asc"===t.sortDirection?t.sortDirection="desc":this._sorts.splice(e,1)}this.requestUpdate()}else{let e=null;1===this._sorts.length&&(e=this._sorts.find((e=>e.sortBy===t.id))),e?"asc"===e.sortDirection?this._sorts=[{sortBy:t.id,sortDirection:"desc"}]:this._sorts=[]:this._sorts=[{sortBy:t.id,sortDirection:"asc"}]}this._page=1,this._fetch()}_renderSortIndicator(e){if(!e.sortable)return F;const t=this._sorts.findIndex((t=>t.sortBy===e.id));if(-1===t)return j`
|
|
3193
|
+
<span class="header-cell__sort" @click=${t=>this._handleSortClick(t,e)}>
|
|
3194
|
+
<svg class="header-cell__sort-arrow header-cell__sort-arrow--ghost" viewBox="0 0 24 24" fill="currentColor">
|
|
3195
|
+
<path d="M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"/>
|
|
3196
|
+
</svg>
|
|
3197
|
+
</span>
|
|
3198
|
+
`;let i={};return"desc"===this._sorts[t].sortDirection&&(i={transform:"rotate(180deg)"}),j`
|
|
3199
|
+
<span class="header-cell__sort" @click=${t=>this._handleSortClick(t,e)}>
|
|
3200
|
+
<svg class="header-cell__sort-arrow" viewBox="0 0 24 24" fill="currentColor" style=${Le(i)}>
|
|
3201
|
+
<path d="M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"/>
|
|
3202
|
+
</svg>
|
|
3203
|
+
${this._sorts.length>1?j`
|
|
3204
|
+
<span class="header-cell__sort-priority">${t+1}</span>
|
|
3205
|
+
`:F}
|
|
3206
|
+
</span>
|
|
3207
|
+
`}_handleAction(e){e.href||this.dispatchEvent(new CustomEvent("action",{detail:{action:e.id},bubbles:!0,composed:!0}))}_handleKqlChange(e,t){const i=e.target.value.trim();if(i){if(t.filter.setKql(i),this.requestUpdate(),!t.filter.isValid())return}else t.filter.clear(),this.requestUpdate();this._page=1,this._fetch()}_handleFilterPanelToggle(e,t){if(e.stopPropagation(),this._filterPanelOpened===t.id)this._filterPanelOpened=null;else{const i=e.currentTarget.getBoundingClientRect();let s=i.left;s+328>window.innerWidth&&(s=window.innerWidth-328),this._filterPanelPos={top:i.bottom+4,left:s},this._filterPanelOpened=t.id,t.facetable?this._filterPanelTab="counts":this._filterPanelTab="filter"}}_handleKqlClear(e){e.filter.clear(),this._page=1,this._fetch()}_handleFilterClear(){const e=this._model.columns.find((e=>e.id===this._filterPanelOpened));e&&(e.filter.clear(),e.facetable&&!e.filterable&&(e.filter.operator="in",e.filter.value=[])),this._filterPanelOpened=null,this._page=1,this._fetch()}_handleFilterTextKeydown(e,t){"Enter"===e.key&&(e.preventDefault(),this._handleFilterApply())}_handleOperatorChange(e,t){t.filter.setOperator(e.target.value),this.requestUpdate()}_handleFilterStringChange(e,t){t.filter.setValue(e.target.value),this.requestUpdate()}_handleFilterNumberChange(e,t){t.filter.setValue(Number(e.target.value)),this.requestUpdate()}_handleFilterDateChange(e,t){t.filter.setValue(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterBooleanChange(e,t){t.filter.setValue("true"===e.target.value),this.requestUpdate()}_handleFilterDateStartChange(e,t){t.filter.setStart(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterDateEndChange(e,t){t.filter.setEnd(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterNumberStartChange(e,t){t.filter.setStart(Number(e.target.value)),this.requestUpdate()}_handleFilterNumberEndChange(e,t){t.filter.setEnd(Number(e.target.value)),this.requestUpdate()}_handleFilterListChange(e,t){const i=e.target.value.split(",").map((e=>e.trim())).filter((e=>""!==e));"number"===t.type?t.filter.setValue(i.map((e=>Number(e)))):t.filter.setValue(i),this.requestUpdate()}_handleFilterApply(){this._filterPanelOpened=null,this._page=1,this._fetch()}_handleFilterPanelTabChange(e){this._filterPanelTab=e.detail.activeTabId}_handleBucketToggle(e,t,i){t.filter.toggle(i.val),this._page=1,this._fetch()}_renderCellContent(e,t,i){const s=t[e.id];if(e.render)return j`<slot name="cell-${i}-${e.id}"></slot>`;if(null==s)return"";switch(e.type){case"number":return"currency"===e.format&&"number"==typeof s?s.toLocaleString("en-US",{style:"currency",currency:"USD"}):String(s);case"date":{let e;if(s instanceof Date)e=s;else if("string"==typeof s&&/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/.test(s)){const t=s.replace(/(\d{2}:\d{2}:\d{2}):(\d+)$/,"$1.$2").replace(" ","T")+"Z";e=new Date(t)}else e=new Date(s);return e.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZone:"UTC"})}case"boolean":return!0===s?"Yes":!1===s?"No":"";default:return String(s)}}_getHeaderCellClasses(e,t){return{"header-cell":!0,"header-cell--sortable":!!e.sortable,"header-cell--align-center":"center"===e.align,"header-cell--align-right":"right"===e.align,"header-cell--sticky-left":"left"===e.sticky,"header-cell--sticky-left-last":"left"===e.sticky&&!this.getDisplayedColumns().slice(t+1).some((e=>"left"===e.sticky)),"header-cell--sticky-right":"right"===e.sticky,"header-cell--sticky-right-first":"right"===e.sticky&&!this.getDisplayedColumns().slice(0,t).some((e=>"right"===e.sticky))}}_getCellClasses(e,t){return{cell:!0,"cell--actions":"actions"===e.type,"cell--align-center":"center"===e.align,"cell--align-right":"right"===e.align,"cell--sticky-left":"left"===e.sticky,"cell--sticky-left-last":"left"===e.sticky&&!this.getDisplayedColumns().slice(t+1).some((e=>"left"===e.sticky)),"cell--sticky-right":"right"===e.sticky,"cell--sticky-right-first":"right"===e.sticky&&!this.getDisplayedColumns().slice(0,t).some((e=>"right"===e.sticky))}}_getCellStyle(e,t){const i={};if("left"===e.sticky){let e=0;for(let i=0;i<t;i++){const t=this.getDisplayedColumns()[i];"left"===t.sticky&&(e+=parseInt(t.width||"0",10))}i.left=`${e}px`}if("right"===e.sticky){let e=0;for(let i=t+1;i<this.getDisplayedColumns().length;i++){const t=this.getDisplayedColumns()[i];"right"===t.sticky&&(e+=parseInt(t.width||"0",10))}i.right=`${e}px`}return i}_renderPagination(){const e=(this._page-1)*this._pageSize+1,t=Math.min(this._page*this._pageSize,this._totalItems);return j`
|
|
3208
|
+
<div class="pagination">
|
|
3209
|
+
<span
|
|
3210
|
+
class="pagination-icon ${1===this._page?"pagination-icon--disabled":""}"
|
|
3211
|
+
@click=${this.goToPrevPage}
|
|
3212
|
+
>
|
|
3213
|
+
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/></svg>
|
|
3214
|
+
</span>
|
|
3215
|
+
<span class="pagination-info">${e}-${t} of ${this._totalItems}</span>
|
|
3216
|
+
<span
|
|
3217
|
+
class="pagination-icon ${this._page===this._totalPages?"pagination-icon--disabled":""}"
|
|
3218
|
+
@click=${this.goToNextPage}
|
|
3219
|
+
>
|
|
3220
|
+
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
|
|
3221
|
+
</span>
|
|
3222
|
+
</div>
|
|
3223
|
+
`}_renderCardHeader(){return"card"!==this.variant?F:this._model.title||this._model.description?j`
|
|
3224
|
+
<div class="card-header">
|
|
3225
|
+
${this._model.title?j`<h2 class="card-header__title">${this._model.title}</h2>`:F}
|
|
3226
|
+
${this._model.description?j`<p class="card-header__description">${this._model.description}</p>`:F}
|
|
3227
|
+
</div>
|
|
3228
|
+
`:F}_renderHeader(){return!this._model.title&&!this._model.actions?.length&&this._totalPages<=1?F:j`
|
|
3229
|
+
<div class="header">
|
|
3230
|
+
${this._model.title&&"card"!==this.variant?j`<div class="title">${this._model.title}</div>`:F}
|
|
3231
|
+
${"db"!==this._model.dataSource?.mode||this._model.columns.some((e=>e.searchable))?j`
|
|
3232
|
+
<div class="search">
|
|
3233
|
+
<!-- TODO: Saved views dropdown
|
|
3234
|
+
<div class="views">
|
|
3235
|
+
<span>Default View</span>
|
|
3236
|
+
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"/></svg>
|
|
3237
|
+
</div>
|
|
3238
|
+
-->
|
|
3239
|
+
<div class="search-field">
|
|
3240
|
+
<svg class="search-icon" viewBox="0 -960 960 960" fill="currentColor"><path d="M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"/></svg>
|
|
3241
|
+
<input
|
|
3242
|
+
type="text"
|
|
3243
|
+
class="search-input"
|
|
3244
|
+
placeholder="Search..."
|
|
3245
|
+
.value=${this._searchQuery}
|
|
3246
|
+
@input=${this._handleSearch}
|
|
3247
|
+
/>
|
|
3248
|
+
</div>
|
|
3249
|
+
</div>
|
|
3250
|
+
`:j`<div class="search"></div>`}
|
|
3251
|
+
<div class="tools">
|
|
3252
|
+
${this._renderPagination()}
|
|
3253
|
+
<span class="refresh" title="Refresh" @click=${()=>this.refresh()}>
|
|
3254
|
+
<svg viewBox="0 -960 960 960" fill="currentColor"><path d="M480-160q-134 0-227-93t-93-227q0-134 93-227t227-93q69 0 132 28.5T720-690v-110h80v280H520v-80h168q-32-56-87.5-88T480-720q-100 0-170 70t-70 170q0 100 70 170t170 70q77 0 139-44t87-116h84q-28 106-114 173t-196 67Z"/></svg>
|
|
3255
|
+
</span>
|
|
3256
|
+
<div class="column-picker-wrapper">
|
|
3257
|
+
<span class="header-icon" title="Columns" @click=${this._toggleColumnPicker}>
|
|
3258
|
+
<svg viewBox="0 -960 960 960" fill="currentColor"><path d="M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z"/></svg>
|
|
3259
|
+
</span>
|
|
3260
|
+
<div class="column-picker ${this._columnPickerOpen?"open":""}">
|
|
3261
|
+
${[...this._model.columns].filter((e=>"actions"!==e.type)).sort(((e,t)=>(e.label??e.id).localeCompare(t.label??t.id))).map((e=>j`
|
|
3262
|
+
<div class="column-picker-item" @click=${()=>this._toggleColumn(e.id)}>
|
|
3263
|
+
<div class="column-picker-checkbox ${this._model.displayedColumns.includes(e.id)?"checked":""}">
|
|
3264
|
+
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>
|
|
3265
|
+
</div>
|
|
3266
|
+
<span class="column-picker-label">${e.label??e.id}</span>
|
|
3267
|
+
</div>
|
|
3268
|
+
`))}
|
|
3269
|
+
</div>
|
|
3270
|
+
</div>
|
|
3271
|
+
${1===this._model.actions?.length?j`
|
|
3272
|
+
<kr-button
|
|
3273
|
+
class="actions"
|
|
3274
|
+
.href=${this._model.actions[0].href}
|
|
3275
|
+
.target=${this._model.actions[0].target}
|
|
3276
|
+
@click=${()=>this._handleAction(this._model.actions[0])}
|
|
3277
|
+
>
|
|
3278
|
+
${this._model.actions[0].label}
|
|
3279
|
+
</kr-button>
|
|
3280
|
+
`:this._model.actions?.length?j`
|
|
3281
|
+
<kr-button
|
|
3282
|
+
class="actions"
|
|
3283
|
+
.options=${this._model.actions.map((e=>({id:e.id,label:e.label})))}
|
|
3284
|
+
@option-select=${e=>this._handleAction({id:e.detail.id,label:e.detail.label})}
|
|
3285
|
+
>
|
|
3286
|
+
Actions
|
|
3287
|
+
</kr-button>
|
|
3288
|
+
`:F}
|
|
3289
|
+
</div>
|
|
3290
|
+
</div>
|
|
3291
|
+
`}_renderStatus(){return"loading"===this._dataState&&0===this._data.length?j`<div class="status">Loading...</div>`:"error"===this._dataState&&0===this._data.length?j`<div class="status status--error">Error loading data</div>`:0===this._data.length?j`<div class="status">No data available</div>`:F}_renderFilterPanel(){if(!this._filterPanelOpened)return F;const e=this._model.columns.find((e=>e.id===this._filterPanelOpened));let t=j``;t="empty"===e.filter.operator||"n_empty"===e.filter.operator?j`
|
|
3292
|
+
<input
|
|
3293
|
+
type="text"
|
|
3294
|
+
class="filter-panel__input"
|
|
3295
|
+
disabled
|
|
3296
|
+
.value=${e.filter.text}
|
|
3297
|
+
/>
|
|
3298
|
+
`:"between"===e.filter.operator&&"date"===e.type?j`
|
|
3299
|
+
<input
|
|
3300
|
+
type="date"
|
|
3301
|
+
class="filter-panel__input"
|
|
3302
|
+
.valueAsDate=${e.filter.value?.start??null}
|
|
3303
|
+
@change=${t=>this._handleFilterDateStartChange(t,e)}
|
|
3304
|
+
/>
|
|
3305
|
+
<input
|
|
3306
|
+
type="date"
|
|
3307
|
+
class="filter-panel__input"
|
|
3308
|
+
.valueAsDate=${e.filter.value?.end??null}
|
|
3309
|
+
@change=${t=>this._handleFilterDateEndChange(t,e)}
|
|
3310
|
+
/>
|
|
3311
|
+
`:"between"===e.filter.operator&&"number"===e.type?j`
|
|
3312
|
+
<input
|
|
3313
|
+
type="number"
|
|
3314
|
+
class="filter-panel__input"
|
|
3315
|
+
placeholder="Start"
|
|
3316
|
+
.value=${e.filter.value?.start??""}
|
|
3317
|
+
@input=${t=>this._handleFilterNumberStartChange(t,e)}
|
|
3318
|
+
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
3319
|
+
/>
|
|
3320
|
+
<input
|
|
3321
|
+
type="number"
|
|
3322
|
+
class="filter-panel__input"
|
|
3323
|
+
placeholder="End"
|
|
3324
|
+
.value=${e.filter.value?.end??""}
|
|
3325
|
+
@input=${t=>this._handleFilterNumberEndChange(t,e)}
|
|
3326
|
+
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
3327
|
+
/>
|
|
3328
|
+
`:"in"===e.filter.operator||"n_in"===e.filter.operator?j`
|
|
3329
|
+
<textarea
|
|
3330
|
+
class="filter-panel__textarea"
|
|
3331
|
+
rows="3"
|
|
3332
|
+
placeholder="Values (comma-separated)"
|
|
3333
|
+
.value=${e.filter.text}
|
|
3334
|
+
@input=${t=>this._handleFilterListChange(t,e)}
|
|
3335
|
+
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
3336
|
+
></textarea>
|
|
3337
|
+
`:"boolean"===e.type?j`
|
|
3338
|
+
<kr-select-field
|
|
3339
|
+
placeholder="Value"
|
|
3340
|
+
.value=${String(e.filter.value??"")}
|
|
3341
|
+
@change=${t=>this._handleFilterBooleanChange(t,e)}
|
|
3342
|
+
>
|
|
3343
|
+
<kr-select-option value="true">Yes</kr-select-option>
|
|
3344
|
+
<kr-select-option value="false">No</kr-select-option>
|
|
3345
|
+
</kr-select-field>
|
|
3346
|
+
`:"date"===e.type?j`
|
|
3347
|
+
<input
|
|
3348
|
+
type="date"
|
|
3349
|
+
class="filter-panel__input"
|
|
3350
|
+
.valueAsDate=${e.filter.value}
|
|
3351
|
+
@change=${t=>this._handleFilterDateChange(t,e)}
|
|
3352
|
+
/>
|
|
3353
|
+
`:"number"===e.type?j`
|
|
3354
|
+
<input
|
|
3355
|
+
type="number"
|
|
3356
|
+
class="filter-panel__input"
|
|
3357
|
+
placeholder="Value"
|
|
3358
|
+
min="0"
|
|
3359
|
+
.value=${e.filter.text}
|
|
3360
|
+
@input=${t=>this._handleFilterNumberChange(t,e)}
|
|
3361
|
+
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
3362
|
+
/>
|
|
3363
|
+
`:j`
|
|
3364
|
+
<input
|
|
3365
|
+
type="text"
|
|
3366
|
+
class="filter-panel__input"
|
|
3367
|
+
placeholder="Value"
|
|
3368
|
+
.value=${e.filter.text}
|
|
3369
|
+
@input=${t=>this._handleFilterStringChange(t,e)}
|
|
3370
|
+
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
3371
|
+
/>
|
|
3372
|
+
`;const i=j`
|
|
3373
|
+
<div class="filter-panel__content">
|
|
3374
|
+
<kr-select-field
|
|
3375
|
+
.value=${e.filter.operator}
|
|
3376
|
+
@change=${t=>this._handleOperatorChange(t,e)}
|
|
3377
|
+
>
|
|
3378
|
+
${st(e.type).map((e=>j`
|
|
3379
|
+
<kr-select-option value=${e.key}>${e.label}</kr-select-option>
|
|
3380
|
+
`))}
|
|
3381
|
+
</kr-select-field>
|
|
3382
|
+
${t}
|
|
3383
|
+
</div>
|
|
3384
|
+
`,s=this._buckets.get(e.id)||[];let r,o;return r=s.length?j`
|
|
3385
|
+
<div class="buckets">
|
|
3386
|
+
${s.map((t=>{let i="(Empty)";null!==t.val&&void 0!==t.val&&(i="boolean"===e.type?!0===t.val||"true"===t.val?"Yes":"No":String(t.val));let s=e.filter.has(t.val);"n_in"===e.filter.operator&&(s=!s);let r=F;return s&&(r=j`
|
|
3387
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
3388
|
+
<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/>
|
|
3389
|
+
</svg>
|
|
3390
|
+
`),j`
|
|
3391
|
+
<div
|
|
3392
|
+
class="bucket"
|
|
3393
|
+
@click=${i=>this._handleBucketToggle(i,e,t)}
|
|
3394
|
+
>
|
|
3395
|
+
<div class=${we({bucket__checkbox:!0,"bucket__checkbox--checked":s})}>
|
|
3396
|
+
${r}
|
|
3397
|
+
</div>
|
|
3398
|
+
<span class="bucket__label">${i}</span>
|
|
3399
|
+
<span class="bucket__count">${t.count}</span>
|
|
3400
|
+
</div>
|
|
3401
|
+
`}))}
|
|
3402
|
+
</div>
|
|
3403
|
+
`:j`<div class="bucket-empty">No data</div>`,o=e.facetable&&e.filterable?j`
|
|
3404
|
+
<kr-tab-group
|
|
3405
|
+
size="small"
|
|
3406
|
+
active-tab-id=${this._filterPanelTab}
|
|
3407
|
+
@tab-change=${e=>this._handleFilterPanelTabChange(e)}
|
|
3408
|
+
>
|
|
3409
|
+
<kr-tab id="filter" label="Filter">
|
|
3410
|
+
${i}
|
|
3411
|
+
</kr-tab>
|
|
3412
|
+
<kr-tab id="counts" label="Counts">
|
|
3413
|
+
${r}
|
|
3414
|
+
</kr-tab>
|
|
3415
|
+
</kr-tab-group>
|
|
3416
|
+
`:e.facetable?r:i,j`
|
|
3417
|
+
<div
|
|
3418
|
+
class="filter-panel"
|
|
3419
|
+
style=${Le({top:this._filterPanelPos.top+"px",left:this._filterPanelPos.left+"px"})}
|
|
3420
|
+
>
|
|
3421
|
+
${o}
|
|
3422
|
+
<div class="filter-panel__actions">
|
|
3423
|
+
<kr-button variant="outline" color="secondary" size="small" @click=${this._handleFilterClear}>
|
|
3424
|
+
Clear
|
|
3425
|
+
</kr-button>
|
|
3426
|
+
<kr-button size="small" @click=${this._handleFilterApply}>
|
|
3427
|
+
Apply
|
|
3428
|
+
</kr-button>
|
|
3429
|
+
</div>
|
|
3430
|
+
</div>
|
|
3431
|
+
`}_renderFilterRow(){const e=this.getDisplayedColumns();return e.some((e=>e.filterable||e.facetable))?j`
|
|
3432
|
+
<div class="filter-row">
|
|
3433
|
+
${e.map(((t,i)=>t.filterable||t.facetable?j`
|
|
3434
|
+
<div
|
|
3435
|
+
class=${we({"filter-cell":!0,"filter-cell--sticky-left":"left"===t.sticky,"filter-cell--sticky-right":"right"===t.sticky,"filter-cell--sticky-right-first":"right"===t.sticky&&!e.slice(0,i).some((e=>"right"===e.sticky))})}
|
|
3436
|
+
style=${Le(this._getCellStyle(t,i))}
|
|
3437
|
+
>
|
|
3438
|
+
<div class="filter-cell__wrapper">
|
|
3439
|
+
<input
|
|
3440
|
+
type="text"
|
|
3441
|
+
class=${we({"filter-cell__input":!0,"filter-cell__input--invalid":!t.filter.isValid()})}
|
|
3442
|
+
.value=${t.filter.kql}
|
|
3443
|
+
@change=${e=>this._handleKqlChange(e,t)}
|
|
3444
|
+
/>
|
|
3445
|
+
${t.filter?.kql?.length>0?j`
|
|
3446
|
+
<button
|
|
3447
|
+
class="filter-cell__clear"
|
|
3448
|
+
@click=${()=>this._handleKqlClear(t)}
|
|
3449
|
+
>
|
|
3450
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
3451
|
+
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
|
|
3452
|
+
</svg>
|
|
3453
|
+
</button>
|
|
3454
|
+
`:F}
|
|
3455
|
+
<button
|
|
3456
|
+
class=${we({"filter-cell__advanced":!0,"filter-cell__advanced--opened":this._filterPanelOpened===t.id})}
|
|
3457
|
+
@click=${e=>this._handleFilterPanelToggle(e,t)}
|
|
3458
|
+
>
|
|
3459
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
3460
|
+
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
|
|
3461
|
+
</svg>
|
|
3462
|
+
</button>
|
|
3463
|
+
</div>
|
|
3464
|
+
</div>
|
|
3465
|
+
`:j`<div
|
|
3466
|
+
class=${we({"filter-cell":!0,"filter-cell--sticky-left":"left"===t.sticky,"filter-cell--sticky-right":"right"===t.sticky,"filter-cell--sticky-right-first":"right"===t.sticky&&!e.slice(0,i).some((e=>"right"===e.sticky))})}
|
|
3467
|
+
style=${Le(this._getCellStyle(t,i))}
|
|
3468
|
+
></div>`))}
|
|
3469
|
+
</div>
|
|
3470
|
+
`:F}_renderTable(){return j`
|
|
3471
|
+
<div class="wrapper">
|
|
3472
|
+
<div class="overlay-left"></div>
|
|
3473
|
+
<div class="overlay-right"></div>
|
|
3474
|
+
${this._renderStatus()}
|
|
3475
|
+
<div class="content" @scroll=${this._handleScroll}>
|
|
3476
|
+
<div class="table" style="grid-template-columns: ${this._getGridTemplateColumns()}">
|
|
3477
|
+
<div class="header-row">
|
|
3478
|
+
${this.getDisplayedColumns().map(((e,t)=>j`
|
|
3479
|
+
<div
|
|
3480
|
+
class=${we(this._getHeaderCellClasses(e,t))}
|
|
3481
|
+
style=${Le(this._getCellStyle(e,t))}
|
|
3482
|
+
data-column-id=${e.id}
|
|
3483
|
+
>
|
|
3484
|
+
<span class="header-cell__label">${e.label??e.id}</span>
|
|
3485
|
+
${this._renderSortIndicator(e)}
|
|
3486
|
+
${!1!==e.resizable?j`<div
|
|
3487
|
+
class="header-cell__resize"
|
|
3488
|
+
@mousedown=${t=>this._handleResizeStart(t,e.id)}
|
|
3489
|
+
></div>`:F}
|
|
3490
|
+
</div>
|
|
3491
|
+
`))}
|
|
3492
|
+
</div>
|
|
3493
|
+
${this._renderFilterRow()}
|
|
3494
|
+
${this._data.map(((e,t)=>{const i=this.getDisplayedColumns().map(((i,s)=>j`
|
|
3495
|
+
<div
|
|
3496
|
+
class=${we(this._getCellClasses(i,s))}
|
|
3497
|
+
style=${Le(this._getCellStyle(i,s))}
|
|
3498
|
+
data-column-id=${i.id}
|
|
3499
|
+
>
|
|
3500
|
+
${this._renderCellContent(i,e,t)}
|
|
3501
|
+
</div>
|
|
3502
|
+
`));return this._model.rowHref?j`
|
|
3503
|
+
<a
|
|
3504
|
+
href=${this._model.rowHref(e)}
|
|
3505
|
+
draggable="false"
|
|
3506
|
+
class=${we({row:!0,"row--clickable":!0,"row--link":!0})}
|
|
3507
|
+
@mousedown=${()=>this._handleRowMouseDown()}
|
|
3508
|
+
@click=${i=>this._handleRowClick(i,e,t)}
|
|
3509
|
+
>${i}</a>
|
|
3510
|
+
`:j`
|
|
3511
|
+
<div
|
|
3512
|
+
class=${we({row:!0,"row--clickable":!!this._model.rowClickable})}
|
|
3513
|
+
@mousedown=${()=>this._handleRowMouseDown()}
|
|
3514
|
+
@click=${i=>this._handleRowClick(i,e,t)}
|
|
3515
|
+
>${i}</div>
|
|
3516
|
+
`}))}
|
|
3517
|
+
</div>
|
|
3518
|
+
</div>
|
|
3519
|
+
</div>
|
|
3520
|
+
`}render(){return this._model.columns.length?j`
|
|
3521
|
+
${this._renderCardHeader()}
|
|
3522
|
+
${this._renderHeader()}
|
|
3523
|
+
${this._renderTable()}
|
|
3524
|
+
${this._renderFilterPanel()}
|
|
3525
|
+
`:j`<slot></slot>`}};vt.styles=[ne,o`
|
|
3526
|
+
/* -------------------------------------------------------------------------
|
|
3527
|
+
* Host
|
|
3528
|
+
* ----------------------------------------------------------------------- */
|
|
3529
|
+
:host {
|
|
3530
|
+
display: flex;
|
|
3531
|
+
flex-direction: column;
|
|
3532
|
+
width: 100%;
|
|
3533
|
+
height: 100%;
|
|
3534
|
+
overflow: hidden;
|
|
3535
|
+
container-type: inline-size;
|
|
3536
|
+
}
|
|
3537
|
+
|
|
3538
|
+
/* -------------------------------------------------------------------------
|
|
3539
|
+
* Header
|
|
3540
|
+
* ----------------------------------------------------------------------- */
|
|
3541
|
+
.header {
|
|
3542
|
+
flex-shrink: 0;
|
|
3543
|
+
display: flex;
|
|
3544
|
+
align-items: center;
|
|
3545
|
+
gap: 16px;
|
|
3546
|
+
margin: 0 24px;
|
|
3547
|
+
height: 64px;
|
|
3548
|
+
border-bottom: 1px solid #e5e7eb;
|
|
3549
|
+
background: #fff;
|
|
3550
|
+
}
|
|
3551
|
+
|
|
3552
|
+
:host(.kr-table--scroll-edge) .header {
|
|
3553
|
+
border-bottom: none;
|
|
3554
|
+
}
|
|
3555
|
+
|
|
3556
|
+
.title {
|
|
3557
|
+
font-size: 18px;
|
|
3558
|
+
font-weight: 600;
|
|
3559
|
+
color: #000;
|
|
3560
|
+
}
|
|
3561
|
+
|
|
3562
|
+
/* -------------------------------------------------------------------------
|
|
3563
|
+
* Content
|
|
3564
|
+
* ----------------------------------------------------------------------- */
|
|
3565
|
+
.wrapper {
|
|
3566
|
+
flex: 1;
|
|
3567
|
+
position: relative;
|
|
3568
|
+
overflow: hidden;
|
|
3569
|
+
}
|
|
3570
|
+
|
|
3571
|
+
.content {
|
|
3572
|
+
height: 100%;
|
|
3573
|
+
overflow: auto;
|
|
3574
|
+
}
|
|
3575
|
+
|
|
3576
|
+
/* -------------------------------------------------------------------------
|
|
3577
|
+
* Search
|
|
3578
|
+
* ----------------------------------------------------------------------- */
|
|
3579
|
+
.search {
|
|
3580
|
+
flex: 1;
|
|
3581
|
+
display: flex;
|
|
3582
|
+
align-items: center;
|
|
3583
|
+
justify-content: center;
|
|
3584
|
+
min-width: 0;
|
|
3585
|
+
}
|
|
3586
|
+
|
|
3587
|
+
/* In card mode, align search left instead of center */
|
|
3588
|
+
:host(.kr-table--card) .search {
|
|
3589
|
+
justify-content: flex-start;
|
|
3590
|
+
}
|
|
3591
|
+
|
|
3592
|
+
.search-field {
|
|
3593
|
+
width: 100%;
|
|
3594
|
+
max-width: 400px;
|
|
3595
|
+
position: relative;
|
|
3596
|
+
display: flex;
|
|
3597
|
+
align-items: center;
|
|
3598
|
+
border: 1px solid #00000038;
|
|
3599
|
+
border-radius: 18px;
|
|
3600
|
+
transition: border-color 0.2s, box-shadow 0.2s;
|
|
3601
|
+
}
|
|
3602
|
+
|
|
3603
|
+
.search-field:focus-within {
|
|
3604
|
+
border-color: #163052;
|
|
3605
|
+
box-shadow: 0 0 0 3px rgba(22, 48, 82, 0.1);
|
|
3606
|
+
}
|
|
3607
|
+
|
|
3608
|
+
/* TODO: Uncomment when views dropdown is added
|
|
3609
|
+
.search-field:focus-within .views {
|
|
3610
|
+
border-color: #163052;
|
|
3611
|
+
}
|
|
3612
|
+
*/
|
|
3613
|
+
|
|
3614
|
+
.search-icon {
|
|
3615
|
+
position: absolute;
|
|
3616
|
+
left: 16px;
|
|
3617
|
+
width: 20px;
|
|
3618
|
+
height: 20px;
|
|
3619
|
+
color: #656871;
|
|
3620
|
+
pointer-events: none;
|
|
3621
|
+
}
|
|
3622
|
+
|
|
3623
|
+
.search-input {
|
|
3624
|
+
height: 36px;
|
|
3625
|
+
padding: 0 16px 0 42px;
|
|
3626
|
+
border: none;
|
|
3627
|
+
border-radius: 16px;
|
|
3628
|
+
font-size: 14px;
|
|
3629
|
+
font-weight: 400;
|
|
3630
|
+
font-family: inherit;
|
|
3631
|
+
color: #163052;
|
|
3632
|
+
background: transparent;
|
|
3633
|
+
outline: none;
|
|
3634
|
+
flex: 1;
|
|
3635
|
+
min-width: 0;
|
|
3636
|
+
width: 100%;
|
|
3637
|
+
}
|
|
3638
|
+
|
|
3639
|
+
.search-input::placeholder {
|
|
3640
|
+
color: #656871;
|
|
3641
|
+
font-weight: 400;
|
|
3642
|
+
}
|
|
3643
|
+
|
|
3644
|
+
.search-input:focus {
|
|
3645
|
+
outline: none;
|
|
3646
|
+
}
|
|
3647
|
+
|
|
3648
|
+
@container (max-width: 800px) {
|
|
3649
|
+
.search-field {
|
|
3650
|
+
max-width: 250px;
|
|
3651
|
+
}
|
|
3652
|
+
}
|
|
3653
|
+
|
|
3654
|
+
.views {
|
|
3655
|
+
display: flex;
|
|
3656
|
+
align-items: center;
|
|
3657
|
+
gap: 4px;
|
|
3658
|
+
height: 36px;
|
|
3659
|
+
padding: 0 16px;
|
|
3660
|
+
border: 1px solid #00000038;
|
|
3661
|
+
border-right: none;
|
|
3662
|
+
border-radius: 16px 0 0 16px;
|
|
3663
|
+
font-size: 14px;
|
|
3664
|
+
font-family: inherit;
|
|
3665
|
+
color: #163052;
|
|
3666
|
+
background: transparent;
|
|
3667
|
+
cursor: pointer;
|
|
3668
|
+
white-space: nowrap;
|
|
3669
|
+
transition: border-color 0.2s;
|
|
3670
|
+
}
|
|
3671
|
+
|
|
3672
|
+
.views:hover {
|
|
3673
|
+
background: #e8f0f8;
|
|
3674
|
+
}
|
|
3675
|
+
|
|
3676
|
+
.views svg {
|
|
3677
|
+
width: 16px;
|
|
3678
|
+
height: 16px;
|
|
3679
|
+
color: #163052;
|
|
3680
|
+
}
|
|
3681
|
+
|
|
3682
|
+
/* -------------------------------------------------------------------------
|
|
3683
|
+
* Pagination
|
|
3684
|
+
* ----------------------------------------------------------------------- */
|
|
3685
|
+
.tools {
|
|
3686
|
+
display: flex;
|
|
3687
|
+
align-items: center;
|
|
3688
|
+
gap: 8px;
|
|
3689
|
+
}
|
|
3690
|
+
|
|
3691
|
+
.pagination {
|
|
3692
|
+
display: flex;
|
|
3693
|
+
align-items: center;
|
|
3694
|
+
gap: 2px;
|
|
3695
|
+
}
|
|
3696
|
+
|
|
3697
|
+
.pagination-info {
|
|
3698
|
+
font-size: 13px;
|
|
3699
|
+
color: var(--kr-primary);
|
|
3700
|
+
white-space: nowrap;
|
|
3701
|
+
}
|
|
3702
|
+
|
|
3703
|
+
.pagination-icon {
|
|
3704
|
+
display: flex;
|
|
3705
|
+
color: var(--kr-primary);
|
|
3706
|
+
cursor: pointer;
|
|
3707
|
+
}
|
|
3708
|
+
|
|
3709
|
+
.pagination-icon--disabled {
|
|
3710
|
+
opacity: 0.3;
|
|
3711
|
+
pointer-events: none;
|
|
3712
|
+
}
|
|
3713
|
+
|
|
3714
|
+
.pagination-icon svg {
|
|
3715
|
+
width: 24px;
|
|
3716
|
+
height: 24px;
|
|
3717
|
+
}
|
|
3718
|
+
|
|
3719
|
+
/* -------------------------------------------------------------------------
|
|
3720
|
+
* Header Icons
|
|
3721
|
+
* ----------------------------------------------------------------------- */
|
|
3722
|
+
.refresh,
|
|
3723
|
+
.header-icon {
|
|
3724
|
+
display: flex;
|
|
3725
|
+
align-items: center;
|
|
3726
|
+
justify-content: center;
|
|
3727
|
+
color: var(--kr-primary);
|
|
3728
|
+
background: #EBF1FA;
|
|
3729
|
+
cursor: pointer;
|
|
3730
|
+
padding: 6px;
|
|
3731
|
+
border-radius: 50%;
|
|
3732
|
+
transition: background 0.15s;
|
|
3733
|
+
}
|
|
3734
|
+
|
|
3735
|
+
.refresh:hover,
|
|
3736
|
+
.header-icon:hover {
|
|
3737
|
+
background: #e8f0f8;
|
|
3738
|
+
}
|
|
3739
|
+
|
|
3740
|
+
.refresh svg,
|
|
3741
|
+
.header-icon svg {
|
|
3742
|
+
width: 24px;
|
|
3743
|
+
height: 24px;
|
|
3744
|
+
}
|
|
3745
|
+
|
|
3746
|
+
/* -------------------------------------------------------------------------
|
|
3747
|
+
* Column Picker
|
|
3748
|
+
* ----------------------------------------------------------------------- */
|
|
3749
|
+
.column-picker-wrapper {
|
|
3750
|
+
position: relative;
|
|
3751
|
+
}
|
|
3752
|
+
|
|
3753
|
+
.column-picker {
|
|
3754
|
+
position: absolute;
|
|
3755
|
+
top: 100%;
|
|
3756
|
+
right: 0;
|
|
3757
|
+
margin-top: 4px;
|
|
3758
|
+
min-width: 200px;
|
|
3759
|
+
max-height: calc(100vh - 120px);
|
|
3760
|
+
overflow-y: auto;
|
|
3761
|
+
background: white;
|
|
3762
|
+
border: 1px solid #9ba7b6;
|
|
3763
|
+
border-radius: 8px;
|
|
3764
|
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
|
|
3765
|
+
padding: 8px 0;
|
|
3766
|
+
z-index: 100;
|
|
3767
|
+
display: none;
|
|
3768
|
+
transform-origin: top;
|
|
3769
|
+
}
|
|
3770
|
+
|
|
3771
|
+
.column-picker.open {
|
|
3772
|
+
display: block;
|
|
3773
|
+
animation: column-picker-fade-in 150ms ease-out;
|
|
3774
|
+
}
|
|
3775
|
+
|
|
3776
|
+
@keyframes column-picker-fade-in {
|
|
3777
|
+
from {
|
|
3778
|
+
opacity: 0;
|
|
3779
|
+
transform: translateY(-4px);
|
|
3780
|
+
}
|
|
3781
|
+
to {
|
|
3782
|
+
opacity: 1;
|
|
3783
|
+
transform: translateY(0);
|
|
3784
|
+
}
|
|
3785
|
+
}
|
|
3786
|
+
|
|
3787
|
+
.column-picker-item {
|
|
3788
|
+
display: flex;
|
|
3789
|
+
align-items: center;
|
|
3790
|
+
gap: 10px;
|
|
3791
|
+
padding: 8px 16px;
|
|
3792
|
+
cursor: pointer;
|
|
3793
|
+
white-space: nowrap;
|
|
3794
|
+
}
|
|
3795
|
+
|
|
3796
|
+
.column-picker-item:hover {
|
|
3797
|
+
background: #f3f4f6;
|
|
3798
|
+
}
|
|
3799
|
+
|
|
3800
|
+
.column-picker-checkbox {
|
|
3801
|
+
width: 16px;
|
|
3802
|
+
height: 16px;
|
|
3803
|
+
border: 1.5px solid #9ca3af;
|
|
3804
|
+
border-radius: 3px;
|
|
3805
|
+
display: flex;
|
|
3806
|
+
align-items: center;
|
|
3807
|
+
justify-content: center;
|
|
3808
|
+
flex-shrink: 0;
|
|
3809
|
+
transition: all 0.15s;
|
|
3810
|
+
}
|
|
3811
|
+
|
|
3812
|
+
.column-picker-checkbox.checked {
|
|
3813
|
+
background: var(--kr-primary);
|
|
3814
|
+
border-color: var(--kr-primary);
|
|
3815
|
+
}
|
|
3816
|
+
|
|
3817
|
+
.column-picker-checkbox svg {
|
|
3818
|
+
width: 12px;
|
|
3819
|
+
height: 12px;
|
|
3820
|
+
color: white;
|
|
3821
|
+
opacity: 0;
|
|
3822
|
+
}
|
|
3823
|
+
|
|
3824
|
+
.column-picker-checkbox.checked svg {
|
|
3825
|
+
opacity: 1;
|
|
3826
|
+
}
|
|
3827
|
+
|
|
3828
|
+
.column-picker-label {
|
|
3829
|
+
font-size: 14px;
|
|
3830
|
+
color: #374151;
|
|
3831
|
+
}
|
|
3832
|
+
|
|
3833
|
+
/* -------------------------------------------------------------------------
|
|
3834
|
+
* Table Structure
|
|
3835
|
+
* ----------------------------------------------------------------------- */
|
|
3836
|
+
.table {
|
|
3837
|
+
display: grid;
|
|
3838
|
+
width: max-content;
|
|
3839
|
+
min-width: 100%;
|
|
3840
|
+
font-size: 13px;
|
|
3841
|
+
}
|
|
3842
|
+
|
|
3843
|
+
.row {
|
|
3844
|
+
display: contents;
|
|
3845
|
+
}
|
|
3846
|
+
|
|
3847
|
+
.row:hover .cell {
|
|
3848
|
+
background: #f8f9fa;
|
|
3849
|
+
}
|
|
3850
|
+
|
|
3851
|
+
.row--clickable {
|
|
3852
|
+
cursor: pointer;
|
|
3853
|
+
}
|
|
3854
|
+
|
|
3855
|
+
.row--link {
|
|
3856
|
+
color: inherit;
|
|
3857
|
+
text-decoration: none;
|
|
3858
|
+
}
|
|
3859
|
+
|
|
3860
|
+
.header-row {
|
|
3861
|
+
display: contents;
|
|
3862
|
+
}
|
|
3863
|
+
|
|
3864
|
+
.cell {
|
|
3865
|
+
padding: 8px 12px;
|
|
3866
|
+
display: flex;
|
|
3867
|
+
align-items: center;
|
|
3868
|
+
white-space: nowrap;
|
|
3869
|
+
overflow: hidden;
|
|
3870
|
+
text-overflow: ellipsis;
|
|
3871
|
+
box-sizing: border-box;
|
|
3872
|
+
}
|
|
3873
|
+
|
|
3874
|
+
.cell--actions {
|
|
3875
|
+
gap: 8px;
|
|
3876
|
+
}
|
|
3877
|
+
|
|
3878
|
+
.header-cell {
|
|
3879
|
+
position: sticky;
|
|
3880
|
+
top: 0;
|
|
3881
|
+
padding: 10px 12px;
|
|
3882
|
+
white-space: nowrap;
|
|
3883
|
+
box-sizing: border-box;
|
|
3884
|
+
background: #173153;
|
|
3885
|
+
color: #fff;
|
|
3886
|
+
font-weight: 600;
|
|
3887
|
+
font-size: 12px;
|
|
3888
|
+
text-transform: uppercase;
|
|
3889
|
+
letter-spacing: 0.5px;
|
|
3890
|
+
display: flex;
|
|
3891
|
+
align-items: center;
|
|
3892
|
+
}
|
|
3893
|
+
|
|
3894
|
+
.header-cell__resize {
|
|
3895
|
+
position: absolute;
|
|
3896
|
+
right: -7px;
|
|
3897
|
+
top: 0;
|
|
3898
|
+
bottom: 0;
|
|
3899
|
+
width: 14px;
|
|
3900
|
+
cursor: col-resize;
|
|
3901
|
+
z-index: 10;
|
|
3902
|
+
}
|
|
3903
|
+
|
|
3904
|
+
.header-cell--sortable {
|
|
3905
|
+
user-select: none;
|
|
3906
|
+
}
|
|
3907
|
+
|
|
3908
|
+
.header-cell__label {
|
|
3909
|
+
overflow: hidden;
|
|
3910
|
+
text-overflow: ellipsis;
|
|
3911
|
+
min-width: 0;
|
|
3912
|
+
line-height: 20px;
|
|
3913
|
+
}
|
|
3914
|
+
|
|
3915
|
+
.header-cell__sort {
|
|
3916
|
+
flex-grow: 1;
|
|
3917
|
+
display: flex;
|
|
3918
|
+
align-items: center;
|
|
3919
|
+
height: 100%;
|
|
3920
|
+
margin-left: 6px;
|
|
3921
|
+
cursor: pointer;
|
|
3922
|
+
}
|
|
3923
|
+
|
|
3924
|
+
.header-cell__sort-arrow {
|
|
3925
|
+
width: 16px;
|
|
3926
|
+
height: 16px;
|
|
3927
|
+
color: #fff;
|
|
3928
|
+
stroke: currentColor;
|
|
3929
|
+
stroke-width: 1px;
|
|
3930
|
+
}
|
|
3931
|
+
|
|
3932
|
+
.header-cell__sort-arrow--ghost {
|
|
3933
|
+
opacity: 0;
|
|
3934
|
+
color: rgba(255, 255, 255, 0.6);
|
|
3935
|
+
transition: opacity 0.15s;
|
|
3936
|
+
}
|
|
3937
|
+
|
|
3938
|
+
.header-cell--sortable:hover .header-cell__sort-arrow--ghost {
|
|
3939
|
+
opacity: 0.4;
|
|
3940
|
+
}
|
|
3941
|
+
|
|
3942
|
+
.header-cell__sort-priority {
|
|
3943
|
+
font-size: 10px;
|
|
3944
|
+
font-weight: 600;
|
|
3945
|
+
color: #fff;
|
|
3946
|
+
line-height: 1;
|
|
3947
|
+
}
|
|
3948
|
+
|
|
3949
|
+
.cell {
|
|
3950
|
+
background: #fff;
|
|
3951
|
+
border-bottom: 1px solid rgb(238, 239, 241);
|
|
3952
|
+
color: #1f2937;
|
|
3953
|
+
}
|
|
3954
|
+
|
|
3955
|
+
.cell--align-center {
|
|
3956
|
+
text-align: center;
|
|
3957
|
+
}
|
|
3958
|
+
|
|
3959
|
+
.cell--align-right {
|
|
3960
|
+
text-align: right;
|
|
3961
|
+
}
|
|
3962
|
+
|
|
3963
|
+
.cell--sticky-left,
|
|
3964
|
+
.cell--sticky-right {
|
|
3965
|
+
position: sticky;
|
|
3966
|
+
z-index: 1;
|
|
3967
|
+
}
|
|
3968
|
+
|
|
3969
|
+
.header-cell--sticky-left,
|
|
3970
|
+
.header-cell--sticky-right {
|
|
3971
|
+
position: sticky;
|
|
3972
|
+
z-index: 3;
|
|
3973
|
+
}
|
|
3974
|
+
|
|
3975
|
+
.header-cell--align-center {
|
|
3976
|
+
text-align: center;
|
|
3977
|
+
}
|
|
3978
|
+
|
|
3979
|
+
.header-cell--align-right {
|
|
3980
|
+
text-align: right;
|
|
3981
|
+
}
|
|
3982
|
+
|
|
3983
|
+
.header-cell--sticky-left-last,
|
|
3984
|
+
.cell--sticky-left-last {
|
|
3985
|
+
border-right: 1px solid #d1d5db;
|
|
3986
|
+
}
|
|
3987
|
+
|
|
3988
|
+
.header-cell--sticky-right-first,
|
|
3989
|
+
.cell--sticky-right-first {
|
|
3990
|
+
border-left: 1px solid #d1d5db;
|
|
3991
|
+
}
|
|
3992
|
+
|
|
3993
|
+
/* -------------------------------------------------------------------------
|
|
3994
|
+
* Scroll Mode: Edge
|
|
3995
|
+
* Padding scrolls with content, table can reach edges when scrolling
|
|
3996
|
+
* ----------------------------------------------------------------------- */
|
|
3997
|
+
/* Only add right padding when no horizontal scroll is needed */
|
|
3998
|
+
:host(.kr-table--scroll-edge):not(.kr-table--scroll-horizontal-available) .table {
|
|
3999
|
+
padding-right: 24px;
|
|
4000
|
+
}
|
|
4001
|
+
|
|
4002
|
+
:host(.kr-table--scroll-edge) .header-row .header-cell:first-child,
|
|
4003
|
+
:host(.kr-table--scroll-edge) .row .cell:first-child {
|
|
4004
|
+
padding-left: 24px;
|
|
4005
|
+
}
|
|
4006
|
+
|
|
4007
|
+
:host(.kr-table--scroll-edge) .header-row .header-cell:last-child,
|
|
4008
|
+
:host(.kr-table--scroll-edge) .row .cell:last-child {
|
|
4009
|
+
padding-right: 24px;
|
|
4010
|
+
}
|
|
4011
|
+
|
|
4012
|
+
:host(.kr-table--scroll-edge) .filter-row .filter-cell:first-child .filter-cell__input {
|
|
4013
|
+
padding-left: 24px;
|
|
4014
|
+
}
|
|
4015
|
+
|
|
4016
|
+
:host(.kr-table--scroll-edge) .filter-row .filter-cell:last-child .filter-cell__input {
|
|
4017
|
+
padding-right: 52px;
|
|
4018
|
+
}
|
|
4019
|
+
|
|
4020
|
+
/* -------------------------------------------------------------------------
|
|
4021
|
+
* Scroll Mode: Overlay
|
|
4022
|
+
* Fixed padding with overlay elements that hide content at edges
|
|
4023
|
+
* ----------------------------------------------------------------------- */
|
|
4024
|
+
:host(.kr-table--scroll-overlay) .content {
|
|
4025
|
+
padding-left: 24px;
|
|
4026
|
+
}
|
|
4027
|
+
|
|
4028
|
+
.overlay-left,
|
|
4029
|
+
.overlay-right {
|
|
4030
|
+
display: none;
|
|
4031
|
+
position: absolute;
|
|
4032
|
+
top: 0;
|
|
4033
|
+
bottom: 0;
|
|
4034
|
+
width: 24px;
|
|
4035
|
+
z-index: 5;
|
|
4036
|
+
pointer-events: none;
|
|
4037
|
+
transition: box-shadow 0.15s ease;
|
|
4038
|
+
}
|
|
4039
|
+
|
|
4040
|
+
:host(.kr-table--scroll-overlay) .overlay-left,
|
|
4041
|
+
:host(.kr-table--scroll-overlay) .overlay-right {
|
|
4042
|
+
display: block;
|
|
4043
|
+
}
|
|
4044
|
+
|
|
4045
|
+
.overlay-left {
|
|
4046
|
+
left: 0;
|
|
4047
|
+
background: #fff;
|
|
4048
|
+
}
|
|
4049
|
+
|
|
4050
|
+
.overlay-right {
|
|
4051
|
+
right: 0;
|
|
4052
|
+
background: #fff;
|
|
4053
|
+
}
|
|
4054
|
+
|
|
4055
|
+
:host(.kr-table--scroll-overlay.kr-table--scroll-left-available:not(.kr-table--sticky-left)) .overlay-left {
|
|
4056
|
+
border-right: 1px solid #d1d5db54;
|
|
4057
|
+
}
|
|
4058
|
+
|
|
4059
|
+
:host(.kr-table--scroll-overlay.kr-table--scroll-right-available:not(.kr-table--sticky-right)) .overlay-right {
|
|
4060
|
+
border-left: 1px solid #d1d5db54;
|
|
4061
|
+
}
|
|
4062
|
+
|
|
4063
|
+
/* -------------------------------------------------------------------------
|
|
4064
|
+
* Status (Loading, Error, Empty)
|
|
4065
|
+
* ----------------------------------------------------------------------- */
|
|
4066
|
+
.status {
|
|
4067
|
+
position: absolute;
|
|
4068
|
+
top: 0;
|
|
4069
|
+
left: 0;
|
|
4070
|
+
right: 0;
|
|
4071
|
+
bottom: 0;
|
|
4072
|
+
display: flex;
|
|
4073
|
+
align-items: center;
|
|
4074
|
+
justify-content: center;
|
|
4075
|
+
font-size: 14px;
|
|
4076
|
+
font-weight: 400;
|
|
4077
|
+
color: #5f6368;
|
|
4078
|
+
pointer-events: none;
|
|
4079
|
+
}
|
|
4080
|
+
|
|
4081
|
+
.status--error {
|
|
4082
|
+
color: #dc2626;
|
|
4083
|
+
}
|
|
4084
|
+
|
|
4085
|
+
/* -------------------------------------------------------------------------
|
|
4086
|
+
* Filter Row
|
|
4087
|
+
* ----------------------------------------------------------------------- */
|
|
4088
|
+
.filter-row {
|
|
4089
|
+
display: contents;
|
|
4090
|
+
}
|
|
4091
|
+
|
|
4092
|
+
.filter-cell {
|
|
4093
|
+
position: sticky;
|
|
4094
|
+
top: 40px;
|
|
4095
|
+
z-index: 2;
|
|
4096
|
+
height: 36px;
|
|
4097
|
+
padding: 0;
|
|
4098
|
+
display: flex;
|
|
4099
|
+
align-items: center;
|
|
4100
|
+
background: #fff;
|
|
4101
|
+
border-bottom: 1px solid #d1d5db;
|
|
4102
|
+
border-right: 1px solid #e5e7ebba;
|
|
4103
|
+
box-sizing: border-box;
|
|
4104
|
+
box-shadow: inset 0 0 0 0 #163052;
|
|
4105
|
+
transition: box-shadow 0.15s;
|
|
4106
|
+
}
|
|
4107
|
+
|
|
4108
|
+
.filter-cell:focus-within {
|
|
4109
|
+
box-shadow: inset 0 0 0 1px #163052;
|
|
4110
|
+
}
|
|
4111
|
+
|
|
4112
|
+
|
|
4113
|
+
.filter-cell--sticky-left,
|
|
4114
|
+
.filter-cell--sticky-right {
|
|
4115
|
+
position: sticky;
|
|
4116
|
+
z-index: 3;
|
|
4117
|
+
}
|
|
4118
|
+
|
|
4119
|
+
.filter-cell--sticky-right-first {
|
|
4120
|
+
border-left: 1px solid #d1d5db;
|
|
4121
|
+
}
|
|
4122
|
+
|
|
4123
|
+
.filter-cell__wrapper {
|
|
4124
|
+
position: relative;
|
|
4125
|
+
display: flex;
|
|
4126
|
+
align-items: center;
|
|
4127
|
+
width: 100%;
|
|
4128
|
+
height: 100%;
|
|
4129
|
+
}
|
|
4130
|
+
|
|
4131
|
+
.filter-cell__input {
|
|
4132
|
+
width: 100%;
|
|
4133
|
+
height: 100%;
|
|
4134
|
+
padding: 0 60px 0 16px;
|
|
4135
|
+
border: none;
|
|
4136
|
+
border-radius: 0;
|
|
4137
|
+
font-size: 14px;
|
|
4138
|
+
font-family: inherit;
|
|
4139
|
+
color: #111827;
|
|
4140
|
+
background: transparent;
|
|
4141
|
+
outline: none;
|
|
4142
|
+
}
|
|
4143
|
+
|
|
4144
|
+
.filter-cell__input--invalid {
|
|
4145
|
+
border-color: #dc2626;
|
|
4146
|
+
}
|
|
4147
|
+
|
|
4148
|
+
.filter-cell__input--invalid:focus {
|
|
4149
|
+
border-color: #dc2626;
|
|
4150
|
+
box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.1);
|
|
4151
|
+
}
|
|
4152
|
+
|
|
4153
|
+
.filter-cell__input::placeholder {
|
|
4154
|
+
color: #9ca3af;
|
|
4155
|
+
font-size: 13px;
|
|
4156
|
+
}
|
|
4157
|
+
|
|
4158
|
+
.filter-cell__clear {
|
|
4159
|
+
position: absolute;
|
|
4160
|
+
right: 36px;
|
|
4161
|
+
top: 50%;
|
|
4162
|
+
transform: translateY(-50%);
|
|
4163
|
+
display: flex;
|
|
4164
|
+
align-items: center;
|
|
4165
|
+
justify-content: center;
|
|
4166
|
+
width: 24px;
|
|
4167
|
+
height: 24px;
|
|
4168
|
+
padding: 0;
|
|
4169
|
+
border: none;
|
|
4170
|
+
border-radius: 4px;
|
|
4171
|
+
background: transparent;
|
|
4172
|
+
color: #6b7280;
|
|
4173
|
+
cursor: pointer;
|
|
4174
|
+
transition: background 0.15s, color 0.15s;
|
|
4175
|
+
}
|
|
4176
|
+
|
|
4177
|
+
.filter-cell__clear:hover {
|
|
4178
|
+
background: #e5e7eb;
|
|
4179
|
+
color: #374151;
|
|
4180
|
+
}
|
|
4181
|
+
|
|
4182
|
+
.filter-cell__clear svg {
|
|
4183
|
+
width: 16px;
|
|
4184
|
+
height: 16px;
|
|
4185
|
+
}
|
|
4186
|
+
|
|
4187
|
+
.filter-cell__advanced {
|
|
4188
|
+
position: absolute;
|
|
4189
|
+
right: 12px;
|
|
4190
|
+
top: 50%;
|
|
4191
|
+
transform: translateY(-50%);
|
|
4192
|
+
display: flex;
|
|
4193
|
+
align-items: center;
|
|
4194
|
+
justify-content: center;
|
|
4195
|
+
width: 24px;
|
|
4196
|
+
height: 24px;
|
|
4197
|
+
padding: 0;
|
|
4198
|
+
border: none;
|
|
4199
|
+
border-radius: 4px;
|
|
4200
|
+
background: transparent;
|
|
4201
|
+
color: #163052;
|
|
4202
|
+
cursor: pointer;
|
|
4203
|
+
transition: background 0.15s, color 0.15s;
|
|
4204
|
+
}
|
|
4205
|
+
|
|
4206
|
+
.filter-cell__advanced:hover {
|
|
4207
|
+
background: #e5e7eb;
|
|
4208
|
+
}
|
|
4209
|
+
|
|
4210
|
+
.filter-cell__advanced svg {
|
|
4211
|
+
width: 16px;
|
|
4212
|
+
height: 16px;
|
|
4213
|
+
}
|
|
4214
|
+
|
|
4215
|
+
.filter-cell__advanced--opened {
|
|
4216
|
+
background: #163052;
|
|
4217
|
+
color: #fff;
|
|
4218
|
+
}
|
|
4219
|
+
|
|
4220
|
+
.filter-cell__advanced--opened:hover {
|
|
4221
|
+
background: #1a3a5f;
|
|
4222
|
+
color: #fff;
|
|
4223
|
+
}
|
|
4224
|
+
|
|
4225
|
+
/* -------------------------------------------------------------------------
|
|
4226
|
+
* Filter Panel (Advanced)
|
|
4227
|
+
* ----------------------------------------------------------------------- */
|
|
4228
|
+
.filter-panel {
|
|
4229
|
+
position: fixed;
|
|
4230
|
+
min-width: 320px;
|
|
4231
|
+
background: white;
|
|
4232
|
+
border: 1px solid #9ba7b6;
|
|
4233
|
+
border-radius: 8px;
|
|
4234
|
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
|
|
4235
|
+
z-index: 100;
|
|
4236
|
+
animation: filter-panel-fade-in 150ms ease-out;
|
|
4237
|
+
}
|
|
4238
|
+
|
|
4239
|
+
@keyframes filter-panel-fade-in {
|
|
4240
|
+
from {
|
|
4241
|
+
opacity: 0;
|
|
4242
|
+
transform: translateY(-4px);
|
|
4243
|
+
}
|
|
4244
|
+
to {
|
|
4245
|
+
opacity: 1;
|
|
4246
|
+
transform: translateY(0);
|
|
4247
|
+
}
|
|
4248
|
+
}
|
|
4249
|
+
|
|
4250
|
+
.filter-panel__content {
|
|
4251
|
+
padding: 16px;
|
|
4252
|
+
display: flex;
|
|
4253
|
+
flex-direction: column;
|
|
4254
|
+
gap: 12px;
|
|
4255
|
+
}
|
|
4256
|
+
|
|
4257
|
+
.filter-panel__actions {
|
|
4258
|
+
padding: 12px 16px;
|
|
4259
|
+
border-top: 1px solid #e5e7eb;
|
|
4260
|
+
display: flex;
|
|
4261
|
+
justify-content: flex-end;
|
|
4262
|
+
align-items: center;
|
|
4263
|
+
gap: 12px;
|
|
4264
|
+
}
|
|
4265
|
+
|
|
4266
|
+
|
|
4267
|
+
.filter-panel__input {
|
|
4268
|
+
width: 100%;
|
|
4269
|
+
padding: 10px 12px;
|
|
4270
|
+
border: 1px solid #d1d5db;
|
|
4271
|
+
border-radius: 8px;
|
|
4272
|
+
font-size: 14px;
|
|
4273
|
+
font-family: inherit;
|
|
4274
|
+
color: #111827;
|
|
4275
|
+
background: #fff;
|
|
4276
|
+
outline: none;
|
|
4277
|
+
transition: border-color 0.2s, box-shadow 0.2s;
|
|
4278
|
+
}
|
|
4279
|
+
|
|
4280
|
+
.filter-panel__input:focus {
|
|
4281
|
+
border-color: #163052;
|
|
4282
|
+
box-shadow: 0 0 0 2px rgba(22, 48, 82, 0.1);
|
|
4283
|
+
}
|
|
4284
|
+
|
|
4285
|
+
.filter-panel__input::placeholder {
|
|
4286
|
+
color: #9ca3af;
|
|
4287
|
+
}
|
|
4288
|
+
|
|
4289
|
+
.filter-panel__textarea {
|
|
4290
|
+
width: 100%;
|
|
4291
|
+
padding: 10px 12px;
|
|
4292
|
+
border: 1px solid #d1d5db;
|
|
4293
|
+
border-radius: 8px;
|
|
4294
|
+
font-size: 14px;
|
|
4295
|
+
font-family: inherit;
|
|
4296
|
+
color: #111827;
|
|
4297
|
+
background: #fff;
|
|
4298
|
+
outline: none;
|
|
4299
|
+
resize: vertical;
|
|
4300
|
+
transition: border-color 0.2s, box-shadow 0.2s;
|
|
4301
|
+
}
|
|
4302
|
+
|
|
4303
|
+
.filter-panel__textarea:focus {
|
|
4304
|
+
border-color: #163052;
|
|
4305
|
+
box-shadow: 0 0 0 2px rgba(22, 48, 82, 0.1);
|
|
4306
|
+
}
|
|
4307
|
+
|
|
4308
|
+
.filter-panel__textarea::placeholder {
|
|
4309
|
+
color: #9ca3af;
|
|
4310
|
+
}
|
|
4311
|
+
|
|
4312
|
+
/* -------------------------------------------------------------------------
|
|
4313
|
+
* Bucket List
|
|
4314
|
+
* ----------------------------------------------------------------------- */
|
|
4315
|
+
.buckets {
|
|
4316
|
+
max-height: 280px;
|
|
4317
|
+
overflow-y: auto;
|
|
4318
|
+
padding: 8px 0;
|
|
4319
|
+
}
|
|
4320
|
+
|
|
4321
|
+
.bucket {
|
|
4322
|
+
display: flex;
|
|
4323
|
+
align-items: center;
|
|
4324
|
+
gap: 16px;
|
|
4325
|
+
height: 32px;
|
|
4326
|
+
padding: 0 16px;
|
|
4327
|
+
cursor: pointer;
|
|
4328
|
+
transition: background 0.1s;
|
|
4329
|
+
}
|
|
4330
|
+
|
|
4331
|
+
.bucket:hover {
|
|
4332
|
+
background: #f3f4f6;
|
|
4333
|
+
}
|
|
4334
|
+
|
|
4335
|
+
.bucket__checkbox {
|
|
4336
|
+
width: 16px;
|
|
4337
|
+
height: 16px;
|
|
4338
|
+
border: 1.5px solid #9ca3af;
|
|
4339
|
+
border-radius: 3px;
|
|
4340
|
+
display: flex;
|
|
4341
|
+
align-items: center;
|
|
4342
|
+
justify-content: center;
|
|
4343
|
+
flex-shrink: 0;
|
|
4344
|
+
transition: all 0.15s;
|
|
4345
|
+
}
|
|
4346
|
+
|
|
4347
|
+
.bucket__checkbox--checked {
|
|
4348
|
+
background: var(--kr-primary, #163052);
|
|
4349
|
+
border-color: var(--kr-primary, #163052);
|
|
4350
|
+
}
|
|
4351
|
+
|
|
4352
|
+
.bucket__checkbox svg {
|
|
4353
|
+
width: 12px;
|
|
4354
|
+
height: 12px;
|
|
4355
|
+
color: white;
|
|
4356
|
+
}
|
|
4357
|
+
|
|
4358
|
+
.bucket__label {
|
|
4359
|
+
flex: 1;
|
|
4360
|
+
font-size: 14px;
|
|
4361
|
+
color: #000;
|
|
4362
|
+
overflow: hidden;
|
|
4363
|
+
text-overflow: ellipsis;
|
|
4364
|
+
white-space: nowrap;
|
|
4365
|
+
}
|
|
4366
|
+
|
|
4367
|
+
.bucket__count {
|
|
4368
|
+
font-size: 14px;
|
|
4369
|
+
color: #000;
|
|
4370
|
+
flex-shrink: 0;
|
|
4371
|
+
}
|
|
4372
|
+
|
|
4373
|
+
.bucket-empty {
|
|
4374
|
+
font-size: 14px;
|
|
4375
|
+
color: #000;
|
|
4376
|
+
padding: 16px;
|
|
4377
|
+
}
|
|
4378
|
+
|
|
4379
|
+
/* Card variant — self-contained card with border, auto height, left-aligned search */
|
|
4380
|
+
:host(.kr-table--card) {
|
|
4381
|
+
height: auto;
|
|
4382
|
+
/* overflow: visible; */
|
|
4383
|
+
overflow: hidden;
|
|
4384
|
+
/* border: 1px solid #e5e7eb; */
|
|
4385
|
+
/* border-radius: 8px; */
|
|
4386
|
+
border: 1px solid #c6c6cd;
|
|
4387
|
+
border-radius: 12px;
|
|
4388
|
+
background: #fff;
|
|
4389
|
+
}
|
|
4390
|
+
|
|
4391
|
+
.card-header {
|
|
4392
|
+
padding: 24px 24px 16px;
|
|
4393
|
+
}
|
|
4394
|
+
|
|
4395
|
+
.card-header__title {
|
|
4396
|
+
font-size: 18px;
|
|
4397
|
+
font-weight: 600;
|
|
4398
|
+
color: #1f2937;
|
|
4399
|
+
margin: 0;
|
|
4400
|
+
}
|
|
4401
|
+
|
|
4402
|
+
.card-header__description {
|
|
4403
|
+
font-size: 14px;
|
|
4404
|
+
color: #1f2937;
|
|
4405
|
+
margin: 12px 0 0;
|
|
4406
|
+
}
|
|
4407
|
+
|
|
4408
|
+
:host(.kr-table--card) .header {
|
|
4409
|
+
margin: 0 24px;
|
|
4410
|
+
}
|
|
4411
|
+
|
|
4412
|
+
:host(.kr-table--card) .wrapper {
|
|
4413
|
+
flex: none;
|
|
4414
|
+
overflow: visible;
|
|
4415
|
+
min-height: 200px;
|
|
4416
|
+
}
|
|
4417
|
+
|
|
4418
|
+
:host(.kr-table--card) .content {
|
|
4419
|
+
height: auto;
|
|
4420
|
+
}
|
|
4421
|
+
|
|
4422
|
+
`],gt([ue()],vt.prototype,"_data",void 0),gt([ue()],vt.prototype,"_dataState",void 0),gt([ue()],vt.prototype,"_page",void 0),gt([ue()],vt.prototype,"_pageSize",void 0),gt([ue()],vt.prototype,"_totalItems",void 0),gt([ue()],vt.prototype,"_totalPages",void 0),gt([ue()],vt.prototype,"_searchQuery",void 0),gt([ue()],vt.prototype,"_canScrollLeft",void 0),gt([ue()],vt.prototype,"_canScrollRight",void 0),gt([ue()],vt.prototype,"_canScrollHorizontal",void 0),gt([ue()],vt.prototype,"_columnPickerOpen",void 0),gt([ue()],vt.prototype,"_filterPanelOpened",void 0),gt([ue()],vt.prototype,"_filterPanelTab",void 0),gt([ue()],vt.prototype,"_buckets",void 0),gt([ue()],vt.prototype,"_sorts",void 0),gt([pe({type:Object})],vt.prototype,"def",void 0),gt([pe({type:String,reflect:!0})],vt.prototype,"variant",void 0),vt=gt([de("kr-grid")],vt);var _t=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let mt=class extends le{constructor(){super(...arguments),this.size="md",this.color="dark"}render(){var e="",t="";return e="sm"==this.size?"16px":"md"==this.size?"24px":"lg"==this.size?"32px":"xl"==this.size?"48px":this.size,t="dark"==this.color?"#163052":"light"==this.color?"#ffffff":this.color,j`
|
|
3193
4423
|
<svg
|
|
3194
4424
|
class="spinner"
|
|
3195
4425
|
style=${`width: ${e}; height: ${e}; color: ${t}`}
|
|
@@ -3206,7 +4436,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
3206
4436
|
stroke-width="4"
|
|
3207
4437
|
/>
|
|
3208
4438
|
</svg>
|
|
3209
|
-
`}};
|
|
4439
|
+
`}};mt.styles=o`
|
|
3210
4440
|
:host {
|
|
3211
4441
|
display: inline-flex;
|
|
3212
4442
|
align-items: center;
|
|
@@ -3249,7 +4479,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
3249
4479
|
stroke: currentColor;
|
|
3250
4480
|
stroke-linecap: round;
|
|
3251
4481
|
}
|
|
3252
|
-
`,
|
|
4482
|
+
`,_t([pe({type:String,reflect:!0})],mt.prototype,"size",void 0),_t([pe({type:String,reflect:!0})],mt.prototype,"color",void 0),mt=_t([de("kr-spinner")],mt);var yt=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let xt=class extends le{constructor(){super(...arguments),this.color="dark"}render(){let e="",t="";return e="dark"===this.color?"#163052":"light"===this.color?"#ffffff":this.color,t=this.trackColor?this.trackColor:"light"===this.color?"#ffffff4d":"#0000001a",j`
|
|
3253
4483
|
<div
|
|
3254
4484
|
class="progress-bar"
|
|
3255
4485
|
style=${`background: ${t}`}
|
|
@@ -3258,7 +4488,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
3258
4488
|
>
|
|
3259
4489
|
<div class="fill" style=${`background: ${e}`}></div>
|
|
3260
4490
|
</div>
|
|
3261
|
-
`}};
|
|
4491
|
+
`}};xt.styles=o`
|
|
3262
4492
|
:host {
|
|
3263
4493
|
display: block;
|
|
3264
4494
|
width: 100%;
|
|
@@ -3290,11 +4520,11 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
3290
4520
|
left: 100%;
|
|
3291
4521
|
}
|
|
3292
4522
|
}
|
|
3293
|
-
`,
|
|
4523
|
+
`,yt([pe({type:String,reflect:!0})],xt.prototype,"color",void 0),yt([pe({type:String,reflect:!0})],xt.prototype,"trackColor",void 0),xt=yt([de("kr-progress-bar")],xt);var kt,wt=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let $t=kt=class extends le{constructor(){super(...arguments),this._zoom=100,this._panX=0,this._panY=0,this._dragging=!1,this._dragStartX=0,this._dragStartY=0,this._panStartX=0,this._panStartY=0,this.src="",this.name="",this._zoomLevel=100,this._textContent=null,this._handleKeydown=e=>{"Escape"===e.key&&this._close()},this._handleDragMove=e=>{this._dragging&&(this._panX=this._panStartX+(e.clientX-this._dragStartX),this._panY=this._panStartY+(e.clientY-this._dragStartY),this.requestUpdate())},this._handleDragEnd=()=>{this._dragging=!1,document.removeEventListener("mousemove",this._handleDragMove),document.removeEventListener("mouseup",this._handleDragEnd)}}static open(e){this._activePreview&&this._activePreview._close();const t=document.createElement("kr-file-preview");return t.src=e.src,t.name=e.name,document.body.appendChild(t),this._activePreview=t,t}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this._handleKeydown),this._isText()&&this._loadTextContent()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this._handleKeydown)}_close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})),kt._activePreview===this&&(kt._activePreview=null),this.remove()}_handleDownload(){this.dispatchEvent(new CustomEvent("download",{bubbles:!0,composed:!0,detail:{src:this.src,name:this.name}}))}_handleZoomIn(){this._zoomLevel=Math.min(this._zoomLevel+25,300),this._zoomLevel<=100&&(this._panX=0,this._panY=0)}_handleZoomOut(){this._zoomLevel=Math.max(this._zoomLevel-25,25),this._zoomLevel<=100&&(this._panX=0,this._panY=0)}_handleZoomReset(){this._zoomLevel=100,this._panX=0,this._panY=0}_handleDragStart(e){this._zoomLevel<=100||(e.preventDefault(),this._dragging=!0,this._dragStartX=e.clientX,this._dragStartY=e.clientY,this._panStartX=this._panX,this._panStartY=this._panY,document.addEventListener("mousemove",this._handleDragMove),document.addEventListener("mouseup",this._handleDragEnd))}_handleBackdropClick(e){e.target===e.currentTarget&&this._close()}_getExtension(){return(this.name||"").split(".").pop()?.toLowerCase()||""}_isImage(){return["jpg","jpeg","png","gif","webp","svg","bmp"].includes(this._getExtension())}_isPdf(){return"pdf"===this._getExtension()}_isText(){return["csv","txt","json","xml","log","md","yml","yaml","ini","cfg","conf","env","sh","bat"].includes(this._getExtension())}_isCsv(){return"csv"===this._getExtension()}_loadTextContent(){fetch(this.src).then((e=>e.text())).then((e=>{this._isCsv()?this._textContent=this._formatCsv(e):this._textContent=e})).catch((()=>{this._textContent="Failed to load file content."}))}_formatCsv(e){const t=e.trim().split("\n");if(!t.length)return e;const i=t.map((e=>e.split(",").map((e=>e.trim())))),s=Math.max(...i.map((e=>e.length))),r=[];for(let e=0;e<s;e++){let t=0;for(const s of i){const i=(s[e]||"").length;i>t&&(t=i)}r.push(t)}return i.map((e=>e.map(((e,t)=>e.padEnd(r[t]||0))).join(" "))).join("\n")}_getFallbackIconClass(e){return["doc","docx","rtf","txt"].includes(e)?"fallback__icon--doc":["xls","xlsx","csv"].includes(e)?"fallback__icon--xls":["zip","rar","7z","gz","tar"].includes(e)?"fallback__icon--zip":"fallback__icon--default"}_getFallbackIcon(e){return["doc","docx","rtf","txt"].includes(e)?j`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6zm2-6h8v2H8v-2zm0-4h8v2H8v-2zm0 8h5v2H8v-2z"/></svg>`:["xls","xlsx","csv"].includes(e)?j`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 2v3H5V5h14zm0 5v4H5v-4h14zM5 19v-3h14v3H5zm2-8h4v2H7v-2zm0 5h4v2H7v-2z"/></svg>`:["zip","rar","7z","gz","tar"].includes(e)?j`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V6h5.17l2 2H20v10zm-8-4h2v2h-2v-2zm0-4h2v2h-2v-2zm-2 2h2v2h-2v-2z"/></svg>`:j`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"/></svg>`}render(){let e;if(this._isImage()){const t=this._zoomLevel/100,i=this._panX/t,s=this._panY/t,r=this._zoomLevel>100?"grab":"default";e=j`<img
|
|
3294
4524
|
class="body__image"
|
|
3295
4525
|
src="${this.src}"
|
|
3296
4526
|
alt="${this.name}"
|
|
3297
|
-
style="transform: scale(${t}) translate(${i}px, ${s}px); cursor: ${
|
|
4527
|
+
style="transform: scale(${t}) translate(${i}px, ${s}px); cursor: ${r}"
|
|
3298
4528
|
@mousedown=${this._handleDragStart}
|
|
3299
4529
|
/>`}else if(this._isPdf())e=j`<iframe class="body__iframe" src="${this.src}"></iframe>`;else if(this._isText())e=null===this._textContent?j`<div class="body__text-loading">Loading...</div>`:j`<pre class="body__text">${this._textContent}</pre>`;else{const t=this._getExtension();e=j`
|
|
3300
4530
|
<div class="fallback">
|
|
@@ -3321,7 +4551,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
3321
4551
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zm-2-5h2V7h1v2h2v1h-2v2H9v-2H7V9z"/></svg>
|
|
3322
4552
|
</button>
|
|
3323
4553
|
<div class="toolbar__separator"></div>
|
|
3324
|
-
`:
|
|
4554
|
+
`:F}
|
|
3325
4555
|
<button class="toolbar__btn" @click=${this._handleDownload} title="Download">
|
|
3326
4556
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5v-2z"/></svg>
|
|
3327
4557
|
</button>
|
|
@@ -3333,7 +4563,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
3333
4563
|
<div class="body" @click=${this._handleBackdropClick}>
|
|
3334
4564
|
${e}
|
|
3335
4565
|
</div>
|
|
3336
|
-
`}}
|
|
4566
|
+
`}};$t.styles=o`
|
|
3337
4567
|
*,
|
|
3338
4568
|
*::after,
|
|
3339
4569
|
*::before,
|
|
@@ -3513,7 +4743,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
3513
4743
|
height: 18px;
|
|
3514
4744
|
fill: currentColor;
|
|
3515
4745
|
}
|
|
3516
|
-
|
|
4746
|
+
`,$t._activePreview=null,wt([pe({type:String})],$t.prototype,"src",void 0),wt([pe({type:String})],$t.prototype,"name",void 0),wt([ue()],$t.prototype,"_zoomLevel",void 0),wt([ue()],$t.prototype,"_textContent",void 0),$t=kt=wt([de("kr-file-preview")],$t);var Ct=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let St=class extends le{constructor(){super(...arguments),this.files=[],this.emptyMessage="No files"}_handleFileClick(e){if(this.dispatchEvent(new CustomEvent("file-click",{bubbles:!0,composed:!0,detail:{file:e}})),e.url){$t.open({src:e.url,name:e.name}).addEventListener("download",(()=>{this._handleDownload(e)}))}}_handleDownload(e){this.dispatchEvent(new CustomEvent("download",{bubbles:!0,composed:!0,detail:{file:e}}))}_handleDelete(e){this.dispatchEvent(new CustomEvent("delete",{bubbles:!0,composed:!0,detail:{file:e}}))}_getExtension(e){return e.split(".").pop()?.toLowerCase()||""}_getExtClass(e){return["pdf"].includes(e)?"file-list__ext--pdf":["doc","docx","rtf","txt"].includes(e)?"file-list__ext--doc":["xls","xlsx","csv"].includes(e)?"file-list__ext--xls":["zip","rar","7z","gz","tar"].includes(e)?"file-list__ext--zip":["jpg","jpeg","png","gif","webp","svg","bmp"].includes(e)?"file-list__ext--img":"file-list__ext--default"}_getExtIcon(e){return["jpg","jpeg","png","gif","webp","svg","bmp"].includes(e)?j`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86-3 3.87L9 13.14 6 17h12l-3.86-5.14z"/></svg>`:["pdf"].includes(e)?j`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 7.5c0 .83-.67 1.5-1.5 1.5H9v2H7.5V7H10c.83 0 1.5.67 1.5 1.5v1zm5 2c0 .83-.67 1.5-1.5 1.5h-2.5V7H15c.83 0 1.5.67 1.5 1.5v3zm4-3H19v1h1.5V11H19v2h-1.5V7h3v1.5zM9 9.5h1v-1H9v1zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm10 5.5h1v-3h-1v3z"/></svg>`:["doc","docx","rtf","txt"].includes(e)?j`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6zm2-6h8v2H8v-2zm0-4h8v2H8v-2zm0 8h5v2H8v-2z"/></svg>`:["xls","xlsx","csv"].includes(e)?j`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 2v3H5V5h14zm0 5v4H5v-4h14zM5 19v-3h14v3H5zm2-8h4v2H7v-2zm0 5h4v2H7v-2z"/></svg>`:["zip","rar","7z","gz","tar"].includes(e)?j`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V6h5.17l2 2H20v10zm-8-4h2v2h-2v-2zm0-4h2v2h-2v-2zm-2 2h2v2h-2v-2z"/></svg>`:j`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"/></svg>`}render(){return this.files.length?j`
|
|
3517
4747
|
<div class="file-list">
|
|
3518
4748
|
${this.files.map((e=>{const t=this._getExtension(e.name),i=e.meta||e.date||"";return j`
|
|
3519
4749
|
<div class="file-list__item">
|
|
@@ -3529,7 +4759,7 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
3529
4759
|
</div>
|
|
3530
4760
|
`}))}
|
|
3531
4761
|
</div>
|
|
3532
|
-
`:j`<div class="file-list__empty">${this.emptyMessage}</div>`}};
|
|
4762
|
+
`:j`<div class="file-list__empty">${this.emptyMessage}</div>`}};St.styles=o`
|
|
3533
4763
|
*,
|
|
3534
4764
|
*::after,
|
|
3535
4765
|
*::before,
|
|
@@ -3643,23 +4873,23 @@ const Ie="important",qe=" !"+Ie,Re=xe(class extends ke{constructor(e){if(super(e
|
|
|
3643
4873
|
font-style: italic;
|
|
3644
4874
|
padding: 20px;
|
|
3645
4875
|
}
|
|
3646
|
-
`,
|
|
4876
|
+
`,Ct([pe({type:Array})],St.prototype,"files",void 0),Ct([pe({type:String,attribute:"empty-message"})],St.prototype,"emptyMessage",void 0),St=Ct([de("kr-file-list")],St);
|
|
3647
4877
|
/**
|
|
3648
4878
|
* @license
|
|
3649
4879
|
* Copyright 2018 Google LLC
|
|
3650
4880
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
3651
4881
|
*/
|
|
3652
|
-
const
|
|
4882
|
+
const zt=e=>e??F
|
|
3653
4883
|
/**
|
|
3654
4884
|
* @license
|
|
3655
4885
|
* Copyright 2020 Google LLC
|
|
3656
4886
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
3657
|
-
*/,
|
|
4887
|
+
*/,Et={},Ot=xe(class extends ke{constructor(e){if(super(e),e.type!==me&&e.type!==ve&&e.type!==ye)throw Error("The `live` directive is not allowed on child or event bindings");if(!(e=>void 0===e.strings)(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===B||t===F)return t;const i=e.element,s=e.name;if(e.type===me){if(t===i[s])return B}else if(e.type===ye){if(!!t===i.hasAttribute(s))return B}else if(e.type===ve&&i.getAttribute(s)===t+"")return B;return((e,t=Et)=>{e._$AH=t;
|
|
3658
4888
|
/**
|
|
3659
4889
|
* @license
|
|
3660
4890
|
* Copyright 2020 Google LLC
|
|
3661
4891
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
3662
|
-
*/})(e),t}});var
|
|
4892
|
+
*/})(e),t}});var Tt=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let Dt=class extends le{constructor(){super(),this.label="",this.name="",this.value="",this.placeholder="",this.type="text",this.required=!1,this.disabled=!1,this.readonly=!1,this.autocomplete="",this.hint="",this._touched=!1,this._dirty=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._internals=this.attachInternals()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value="",this._touched=!1,this._dirty=!1,this._internals.setFormValue(""),this._internals.setValidity({})}formStateRestoreCallback(e){this.value=e}connectedCallback(){super.connectedCallback(),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity()}updated(e){(e.has("required")||e.has("value"))&&this._updateValidity()}_updateValidity(){this._input&&this._internals.setValidity(this._input.validity,this._input.validationMessage)}_handleInput(e){this.value=e.target.value,this._dirty=!0,this._internals.setFormValue(this.value),this._internals.setValidity(this._input.validity,this._input.validationMessage)}_handleChange(e){this.value=e.target.value,this._internals.setFormValue(this.value)}_handleBlur(){this._touched=!0,this._internals.setValidity(this._input.validity,this._input.validationMessage)}render(){let e="";return this._touched&&this._input&&!this._input.validity.valid&&(e=this._input.validationMessage),j`
|
|
3663
4893
|
<div class="wrapper">
|
|
3664
4894
|
${this.label?j`
|
|
3665
4895
|
<label for="input">
|
|
@@ -3672,22 +4902,22 @@ const $t=e=>e??U
|
|
|
3672
4902
|
class=${we({"input--invalid":this._touched&&this._input&&!this._input.validity.valid})}
|
|
3673
4903
|
type=${this.type}
|
|
3674
4904
|
name=${this.name}
|
|
3675
|
-
.value=${
|
|
4905
|
+
.value=${Ot(this.value)}
|
|
3676
4906
|
placeholder=${this.placeholder}
|
|
3677
4907
|
?required=${this.required}
|
|
3678
4908
|
?disabled=${this.disabled}
|
|
3679
4909
|
?readonly=${this.readonly}
|
|
3680
|
-
minlength=${
|
|
3681
|
-
maxlength=${
|
|
3682
|
-
pattern=${
|
|
3683
|
-
autocomplete=${
|
|
4910
|
+
minlength=${zt(this.minlength)}
|
|
4911
|
+
maxlength=${zt(this.maxlength)}
|
|
4912
|
+
pattern=${zt(this.pattern)}
|
|
4913
|
+
autocomplete=${zt(this.autocomplete||void 0)}
|
|
3684
4914
|
@input=${this._handleInput}
|
|
3685
4915
|
@change=${this._handleChange}
|
|
3686
4916
|
@blur=${this._handleBlur}
|
|
3687
4917
|
/>
|
|
3688
4918
|
${e?j`<div class="validation-message">${e}</div>`:this.hint?j`<div class="hint">${this.hint}</div>`:""}
|
|
3689
4919
|
</div>
|
|
3690
|
-
`}focus(){this._input?.focus()}blur(){this._input?.blur()}select(){this._input?.select()}};
|
|
4920
|
+
`}focus(){this._input?.focus()}blur(){this._input?.blur()}select(){this._input?.select()}};Dt.styles=o`
|
|
3691
4921
|
:host {
|
|
3692
4922
|
display: block;
|
|
3693
4923
|
font-family: inherit;
|
|
@@ -3754,35 +4984,35 @@ const $t=e=>e??U
|
|
|
3754
4984
|
font-size: 0.75rem;
|
|
3755
4985
|
color: var(--kr-text-field-helper-color, #6b7280);
|
|
3756
4986
|
}
|
|
3757
|
-
`,
|
|
4987
|
+
`,Dt.formAssociated=!0,Tt([pe({type:String})],Dt.prototype,"label",void 0),Tt([pe({type:String})],Dt.prototype,"name",void 0),Tt([pe({type:String})],Dt.prototype,"value",void 0),Tt([pe({type:String})],Dt.prototype,"placeholder",void 0),Tt([pe({type:String})],Dt.prototype,"type",void 0),Tt([pe({type:Boolean})],Dt.prototype,"required",void 0),Tt([pe({type:Boolean})],Dt.prototype,"disabled",void 0),Tt([pe({type:Boolean})],Dt.prototype,"readonly",void 0),Tt([pe({type:Number})],Dt.prototype,"minlength",void 0),Tt([pe({type:Number})],Dt.prototype,"maxlength",void 0),Tt([pe({type:String})],Dt.prototype,"pattern",void 0),Tt([pe({type:String})],Dt.prototype,"autocomplete",void 0),Tt([pe({type:String})],Dt.prototype,"hint",void 0),Tt([fe("input")],Dt.prototype,"_input",void 0),Tt([ue()],Dt.prototype,"_touched",void 0),Tt([ue()],Dt.prototype,"_dirty",void 0),Dt=Tt([de("kr-text-field")],Dt);var Pt=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let At=class extends le{constructor(){super(),this.label="",this.name="",this.value="",this.placeholder="",this.required=!1,this.disabled=!1,this.readonly=!1,this.rows=3,this.autocomplete="",this.hint="",this._touched=!1,this._dirty=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._internals=this.attachInternals()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value="",this._touched=!1,this._dirty=!1,this._internals.setFormValue(""),this._internals.setValidity({})}formStateRestoreCallback(e){this.value=e}connectedCallback(){super.connectedCallback(),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity()}updated(e){(e.has("required")||e.has("value"))&&this._updateValidity()}_updateValidity(){this._textarea&&this._internals.setValidity(this._textarea.validity,this._textarea.validationMessage)}_handleInput(e){this.value=e.target.value,this._dirty=!0,this._internals.setFormValue(this.value),this._internals.setValidity(this._textarea.validity,this._textarea.validationMessage)}_handleChange(e){this.value=e.target.value,this._internals.setFormValue(this.value)}_handleBlur(){this._touched=!0,this._internals.setValidity(this._textarea.validity,this._textarea.validationMessage)}render(){let e="";return this._touched&&this._textarea&&!this._textarea.validity.valid&&(e=this._textarea.validationMessage),j`
|
|
3758
4988
|
<div class="wrapper">
|
|
3759
4989
|
${this.label?j`
|
|
3760
4990
|
<label for="textarea">
|
|
3761
4991
|
${this.label}
|
|
3762
|
-
${this.required?j`<span class="required" aria-hidden="true">*</span>`:
|
|
4992
|
+
${this.required?j`<span class="required" aria-hidden="true">*</span>`:F}
|
|
3763
4993
|
</label>
|
|
3764
|
-
`:
|
|
4994
|
+
`:F}
|
|
3765
4995
|
<textarea
|
|
3766
4996
|
id="textarea"
|
|
3767
4997
|
class=${we({"textarea--invalid":this._touched&&this._textarea&&!this._textarea.validity.valid})}
|
|
3768
4998
|
name=${this.name}
|
|
3769
|
-
.value=${
|
|
4999
|
+
.value=${Ot(this.value)}
|
|
3770
5000
|
placeholder=${this.placeholder}
|
|
3771
5001
|
?required=${this.required}
|
|
3772
5002
|
?disabled=${this.disabled}
|
|
3773
5003
|
?readonly=${this.readonly}
|
|
3774
5004
|
rows=${this.rows}
|
|
3775
|
-
cols=${
|
|
3776
|
-
minlength=${
|
|
3777
|
-
maxlength=${
|
|
3778
|
-
autocomplete=${
|
|
5005
|
+
cols=${zt(this.cols)}
|
|
5006
|
+
minlength=${zt(this.minlength)}
|
|
5007
|
+
maxlength=${zt(this.maxlength)}
|
|
5008
|
+
autocomplete=${zt(this.autocomplete||void 0)}
|
|
3779
5009
|
@input=${this._handleInput}
|
|
3780
5010
|
@change=${this._handleChange}
|
|
3781
5011
|
@blur=${this._handleBlur}
|
|
3782
5012
|
></textarea>
|
|
3783
|
-
${e?j`<div class="validation-message">${e}</div>`:this.hint?j`<div class="hint">${this.hint}</div>`:
|
|
5013
|
+
${e?j`<div class="validation-message">${e}</div>`:this.hint?j`<div class="hint">${this.hint}</div>`:F}
|
|
3784
5014
|
</div>
|
|
3785
|
-
`}focus(){this._textarea?.focus()}blur(){this._textarea?.blur()}select(){this._textarea?.select()}};
|
|
5015
|
+
`}focus(){this._textarea?.focus()}blur(){this._textarea?.blur()}select(){this._textarea?.select()}};At.styles=o`
|
|
3786
5016
|
:host {
|
|
3787
5017
|
display: block;
|
|
3788
5018
|
font-family: inherit;
|
|
@@ -3852,12 +5082,12 @@ const $t=e=>e??U
|
|
|
3852
5082
|
font-size: 0.75rem;
|
|
3853
5083
|
color: var(--kr-textarea-field-helper-color, #6b7280);
|
|
3854
5084
|
}
|
|
3855
|
-
`,
|
|
5085
|
+
`,At.formAssociated=!0,Pt([pe({type:String})],At.prototype,"label",void 0),Pt([pe({type:String})],At.prototype,"name",void 0),Pt([pe({type:String})],At.prototype,"value",void 0),Pt([pe({type:String})],At.prototype,"placeholder",void 0),Pt([pe({type:Boolean})],At.prototype,"required",void 0),Pt([pe({type:Boolean})],At.prototype,"disabled",void 0),Pt([pe({type:Boolean})],At.prototype,"readonly",void 0),Pt([pe({type:Number})],At.prototype,"rows",void 0),Pt([pe({type:Number})],At.prototype,"cols",void 0),Pt([pe({type:Number})],At.prototype,"minlength",void 0),Pt([pe({type:Number})],At.prototype,"maxlength",void 0),Pt([pe({type:String})],At.prototype,"autocomplete",void 0),Pt([pe({type:String})],At.prototype,"hint",void 0),Pt([fe("textarea")],At.prototype,"_textarea",void 0),Pt([ue()],At.prototype,"_touched",void 0),Pt([ue()],At.prototype,"_dirty",void 0),At=Pt([de("kr-textarea-field")],At);var qt=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let It=class extends le{constructor(){super(...arguments),this.label="",this.value=""}render(){return j`
|
|
3856
5086
|
<div class="wrapper">
|
|
3857
|
-
${this.label?j`<label>${this.label}</label>`:
|
|
5087
|
+
${this.label?j`<label>${this.label}</label>`:F}
|
|
3858
5088
|
<div class="value">${this.value}</div>
|
|
3859
5089
|
</div>
|
|
3860
|
-
`}};
|
|
5090
|
+
`}};It.styles=o`
|
|
3861
5091
|
:host {
|
|
3862
5092
|
display: block;
|
|
3863
5093
|
font-family: inherit;
|
|
@@ -3879,7 +5109,7 @@ const $t=e=>e??U
|
|
|
3879
5109
|
font-size: 14px;
|
|
3880
5110
|
color: black;
|
|
3881
5111
|
}
|
|
3882
|
-
`,
|
|
5112
|
+
`,qt([pe({type:String})],It.prototype,"label",void 0),qt([pe({type:String})],It.prototype,"value",void 0),It=qt([de("kr-detail-field")],It);var Lt=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let Rt=class extends le{constructor(){super(),this._requestId=0,this._handleDocumentClick=e=>{e.composedPath().includes(this)||(this._isOpen=!1)},this.label="",this.name="",this.value="",this.placeholder="",this.disabled=!1,this.readonly=!1,this.required=!1,this.hint="",this.options=[],this.fetch=null,this._isOpen=!1,this._highlightedIndex=-1,this._touched=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleDocumentClick),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleDocumentClick),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity()}updated(e){(e.has("required")||e.has("value"))&&this._updateValidity(),e.has("options")&&this._isOpen&&this._positionDropdown()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value="",this._touched=!1,this._isOpen=!1,this._highlightedIndex=-1,this._internals.setFormValue(""),this._internals.setValidity({})}formStateRestoreCallback(e){this.value=e}_updateValidity(){this._input&&this._internals.setValidity(this._input.validity,this._input.validationMessage)}_fetch(){if(!this.fetch)return;this._requestId++;const e=this._requestId;this.fetch(this.value).then((t=>{e===this._requestId&&(this.options=t)})).catch((e=>{console.error("kr-auto-suggest: fetch failed",e)}))}_handleInput(e){this.value=e.target.value,this._isOpen=!0,this._highlightedIndex=-1,this._positionDropdown(),this._internals.setFormValue(this.value),this._internals.setValidity(this._input.validity,this._input.validationMessage),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this._fetch()}_positionDropdown(){requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".dropdown");if(!e)return;const t=this._input.getBoundingClientRect(),i=window.innerHeight-t.bottom-4-8,s=t.top-4-8;e.style.left=t.left+"px",e.style.width=t.width+"px",s>i?(e.style.top="",e.style.bottom=window.innerHeight-t.top+4+"px",e.style.maxHeight=s+"px"):(e.style.bottom="",e.style.top=t.bottom+4+"px",e.style.maxHeight=i+"px")}))}_handleFocus(){this._isOpen=!0,this._positionDropdown(),this._fetch()}_handleBlur(){this._touched=!0,this._internals.setValidity(this._input.validity,this._input.validationMessage),setTimeout((()=>{this._isOpen=!1,this._highlightedIndex=-1}),200)}_handleKeyDown(e){switch(e.key){case"ArrowDown":e.preventDefault(),this._isOpen=!0,this._highlightedIndex=Math.min(this._highlightedIndex+1,this.options.length-1),this._scrollToHighlighted();break;case"ArrowUp":e.preventDefault(),-1===this._highlightedIndex?(this._isOpen=!0,this._highlightedIndex=this.options.length-1):this._highlightedIndex=Math.max(this._highlightedIndex-1,0),this._scrollToHighlighted();break;case"Enter":this._highlightedIndex>=0&&this.options[this._highlightedIndex]&&(e.preventDefault(),this._selectOption(this.options[this._highlightedIndex]));break;case"Escape":e.preventDefault(),this._isOpen=!1,this._highlightedIndex=-1;break;case"Tab":this._isOpen=!1,this._highlightedIndex=-1}}_scrollToHighlighted(){this.updateComplete.then((()=>{const e=this.shadowRoot?.querySelector(".dropdown"),t=this.shadowRoot?.querySelector(".option--highlighted");if(e&&t){const i=e.getBoundingClientRect(),s=t.getBoundingClientRect();(s.bottom>i.bottom||s.top<i.top)&&t.scrollIntoView({block:"nearest"})}}))}_selectOption(e){e.disabled||(this.value=e.value,this._isOpen=!1,this._highlightedIndex=-1,this._internals.setFormValue(this.value),this.dispatchEvent(new CustomEvent("select",{detail:{value:e.value,option:e},bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}_handleClear(){this.value="",this._internals.setFormValue(this.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this._input?.focus()}_handleOptionMouseEnter(e,t){this._highlightedIndex=t}_renderOption(e,t){return j`
|
|
3883
5113
|
<button
|
|
3884
5114
|
class=${we({option:!0,"option--highlighted":t===this._highlightedIndex})}
|
|
3885
5115
|
type="button"
|
|
@@ -3891,19 +5121,19 @@ const $t=e=>e??U
|
|
|
3891
5121
|
>
|
|
3892
5122
|
${e.label||e.value}
|
|
3893
5123
|
</button>
|
|
3894
|
-
`}render(){let e=
|
|
5124
|
+
`}render(){let e=F;return this._touched&&this._input&&!this._input.validity.valid?e=j`<div class="validation-message">${this._input.validationMessage}</div>`:this.hint&&(e=j`<div class="hint">${this.hint}</div>`),j`
|
|
3895
5125
|
<div class="wrapper">
|
|
3896
5126
|
${this.label?j`
|
|
3897
5127
|
<label>
|
|
3898
5128
|
${this.label}
|
|
3899
|
-
${this.required?j`<span class="required">*</span>`:
|
|
5129
|
+
${this.required?j`<span class="required">*</span>`:F}
|
|
3900
5130
|
</label>
|
|
3901
|
-
`:
|
|
5131
|
+
`:F}
|
|
3902
5132
|
|
|
3903
5133
|
<div class="input-wrapper">
|
|
3904
5134
|
<input
|
|
3905
5135
|
type="text"
|
|
3906
|
-
.value=${
|
|
5136
|
+
.value=${Ot(this.value)}
|
|
3907
5137
|
placeholder=${this.placeholder}
|
|
3908
5138
|
?disabled=${this.disabled}
|
|
3909
5139
|
?readonly=${this.readonly}
|
|
@@ -3921,12 +5151,12 @@ const $t=e=>e??U
|
|
|
3921
5151
|
@keydown=${this._handleKeyDown}
|
|
3922
5152
|
/>
|
|
3923
5153
|
<div class="icon-wrapper">
|
|
3924
|
-
${!this.value||this.disabled||this.readonly?
|
|
5154
|
+
${!this.value||this.disabled||this.readonly?F:j`
|
|
3925
5155
|
<svg class="clear" viewBox="0 0 24 24" fill="currentColor" aria-label="Clear" @click=${this._handleClear}>
|
|
3926
5156
|
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
|
|
3927
5157
|
</svg>
|
|
3928
5158
|
`}
|
|
3929
|
-
${this.value||this.disabled||this.readonly?
|
|
5159
|
+
${this.value||this.disabled||this.readonly?F:j`
|
|
3930
5160
|
<svg class="search-icon" viewBox="0 0 24 24" fill="currentColor">
|
|
3931
5161
|
<path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>
|
|
3932
5162
|
</svg>
|
|
@@ -3944,7 +5174,7 @@ const $t=e=>e??U
|
|
|
3944
5174
|
|
|
3945
5175
|
${e}
|
|
3946
5176
|
</div>
|
|
3947
|
-
`}};
|
|
5177
|
+
`}};Rt.styles=o`
|
|
3948
5178
|
:host {
|
|
3949
5179
|
display: block;
|
|
3950
5180
|
font-family: inherit;
|
|
@@ -4101,7 +5331,7 @@ const $t=e=>e??U
|
|
|
4101
5331
|
font-size: 0.75rem;
|
|
4102
5332
|
color: var(--kr-text-field-error-color, #ef4444);
|
|
4103
5333
|
}
|
|
4104
|
-
`,
|
|
5334
|
+
`,Rt.formAssociated=!0,Lt([pe({type:String})],Rt.prototype,"label",void 0),Lt([pe({type:String})],Rt.prototype,"name",void 0),Lt([pe({type:String})],Rt.prototype,"value",void 0),Lt([pe({type:String})],Rt.prototype,"placeholder",void 0),Lt([pe({type:Boolean})],Rt.prototype,"disabled",void 0),Lt([pe({type:Boolean})],Rt.prototype,"readonly",void 0),Lt([pe({type:Boolean})],Rt.prototype,"required",void 0),Lt([pe({type:String})],Rt.prototype,"hint",void 0),Lt([pe({type:Array})],Rt.prototype,"options",void 0),Lt([pe({attribute:!1})],Rt.prototype,"fetch",void 0),Lt([ue()],Rt.prototype,"_isOpen",void 0),Lt([ue()],Rt.prototype,"_highlightedIndex",void 0),Lt([ue()],Rt.prototype,"_touched",void 0),Lt([fe("input")],Rt.prototype,"_input",void 0),Rt=Lt([de("kr-auto-suggest")],Rt);var Mt=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let Ht=class extends le{constructor(){super(),this._requestId=0,this._selectedOption=null,this._handleDocumentClick=e=>{e.composedPath().includes(this)||this._close()},this.label="",this.name="",this.value="",this.placeholder="Select an option",this.disabled=!1,this.readonly=!1,this.required=!1,this.hint="",this.optionValue="value",this.optionLabel="label",this.options=[],this.fetch=null,this.fetchSelection=null,this._isOpen=!1,this._highlightedIndex=-1,this._touched=!1,this._searchQuery="",this._loading=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleDocumentClick),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleDocumentClick),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity(),this.value&&this.fetchSelection&&this._resolveSelection()}updated(e){(e.has("required")||e.has("value"))&&this._updateValidity(),e.has("value")&&(this.value?this._selectedOption&&this._getOptionValue(this._selectedOption)===this.value||this._resolveSelection():this._selectedOption=null),e.has("options")&&this._isOpen&&this._positionDropdown()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value="",this._selectedOption=null,this._touched=!1,this._isOpen=!1,this._highlightedIndex=-1,this._searchQuery="",this._internals.setFormValue(""),this._internals.setValidity({})}formStateRestoreCallback(e){this.value=e}focus(){this._isOpen||this._open()}blur(){this._triggerElement?.blur()}_updateValidity(){this.required&&!this.value?this._internals.setValidity({valueMissing:!0},"Please select an option",this._triggerElement):this._internals.setValidity({})}_handleTriggerClick(){this.disabled||this.readonly||(this._isOpen?this._close():this._open())}_open(){this._isOpen=!0,this._searchQuery="",this._highlightedIndex=-1,this._fetch(),this.updateComplete.then((()=>{this._positionDropdown(),this._searchInput&&this._searchInput.focus()}))}_close(){this._isOpen=!1,this._highlightedIndex=-1,this._searchQuery=""}_positionDropdown(){requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".dropdown");if(!e)return;const t=this._triggerElement.getBoundingClientRect(),i=window.innerHeight-t.bottom-4-8,s=t.top-4-8;e.style.left=t.left+"px",e.style.width=t.width+"px",i<200&&s>i?(e.style.top="",e.style.bottom=window.innerHeight-t.top+4+"px",e.style.maxHeight=s+"px"):(e.style.bottom="",e.style.top=t.bottom+4+"px",e.style.maxHeight=i+"px")}))}_fetch(){if(!this.fetch)return;this._loading=!0,this._requestId++;const e=this._requestId;this.fetch(this._searchQuery).then((t=>{e===this._requestId&&(this.options=t,this._loading=!1)})).catch((e=>{console.error("kr-combo-box: fetch failed",e),this._loading=!1}))}_handleSearchInput(e){this._searchQuery=e.target.value,this._highlightedIndex=-1,this._fetch()}_handleSearchKeyDown(e){switch(e.key){case"ArrowDown":e.preventDefault(),this._highlightedIndex=Math.min(this._highlightedIndex+1,this.options.length-1),this._scrollToHighlighted();break;case"ArrowUp":e.preventDefault(),-1===this._highlightedIndex?this._highlightedIndex=this.options.length-1:this._highlightedIndex=Math.max(this._highlightedIndex-1,0),this._scrollToHighlighted();break;case"Enter":e.preventDefault(),this._highlightedIndex>=0&&this.options[this._highlightedIndex]&&this._selectOption(this.options[this._highlightedIndex]);break;case"Escape":e.preventDefault(),this._close(),this._triggerElement?.focus();break;case"Tab":this._close()}}_handleTriggerKeyDown(e){"ArrowDown"!==e.key&&"ArrowUp"!==e.key&&"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this._isOpen||this._open())}_handleTriggerBlur(){this._touched=!0,this._updateValidity()}_scrollToHighlighted(){this.updateComplete.then((()=>{const e=this.shadowRoot?.querySelector(".options"),t=this.shadowRoot?.querySelector(".option--highlighted");if(e&&t){const i=e.getBoundingClientRect(),s=t.getBoundingClientRect();(s.bottom>i.bottom||s.top<i.top)&&t.scrollIntoView({block:"nearest"})}}))}_getOptionValue(e){return"function"==typeof this.optionValue?this.optionValue(e):e[this.optionValue]}_getOptionLabel(e){let t;return t="function"==typeof this.optionLabel?this.optionLabel(e):e[this.optionLabel],t||this._getOptionValue(e)}_resolveSelection(){if(!this.fetchSelection)return;const e=this.value;this.fetchSelection(this.value).then((t=>{this.value===e&&t&&(this._selectedOption=t,this.requestUpdate())})).catch((e=>{console.error("kr-combo-box: fetchSelection failed",e)}))}_selectOption(e){e.disabled||(this.value=this._getOptionValue(e),this._selectedOption=e,this._close(),this._internals.setFormValue(this.value),this._updateValidity(),this.dispatchEvent(new CustomEvent("select",{detail:{option:e},bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this._triggerElement?.focus())}_handleOptionMouseEnter(e,t){this._highlightedIndex=t}_renderOption(e,t){const i=this._getOptionValue(e);return j`
|
|
4105
5335
|
<button
|
|
4106
5336
|
class=${we({option:!0,"option--highlighted":t===this._highlightedIndex,"option--selected":i===this.value})}
|
|
4107
5337
|
type="button"
|
|
@@ -4113,14 +5343,14 @@ const $t=e=>e??U
|
|
|
4113
5343
|
>
|
|
4114
5344
|
${this._getOptionLabel(e)}
|
|
4115
5345
|
</button>
|
|
4116
|
-
`}render(){let e=
|
|
5346
|
+
`}render(){let e=F;return this._touched&&this.required&&!this.value?e=j`<div class="validation-message">Please select an option</div>`:this.hint&&(e=j`<div class="hint">${this.hint}</div>`),j`
|
|
4117
5347
|
<div class="wrapper">
|
|
4118
5348
|
${this.label?j`
|
|
4119
5349
|
<label>
|
|
4120
5350
|
${this.label}
|
|
4121
|
-
${this.required?j`<span class="required">*</span>`:
|
|
5351
|
+
${this.required?j`<span class="required">*</span>`:F}
|
|
4122
5352
|
</label>
|
|
4123
|
-
`:
|
|
5353
|
+
`:F}
|
|
4124
5354
|
|
|
4125
5355
|
<button
|
|
4126
5356
|
class=${we({trigger:!0,"trigger--open":this._isOpen,"trigger--invalid":this._touched&&this.required&&!this.value})}
|
|
@@ -4171,7 +5401,7 @@ const $t=e=>e??U
|
|
|
4171
5401
|
|
|
4172
5402
|
${e}
|
|
4173
5403
|
</div>
|
|
4174
|
-
`}};
|
|
5404
|
+
`}};Ht.styles=o`
|
|
4175
5405
|
:host {
|
|
4176
5406
|
display: block;
|
|
4177
5407
|
font-family: inherit;
|
|
@@ -4383,14 +5613,14 @@ const $t=e=>e??U
|
|
|
4383
5613
|
font-size: 0.75rem;
|
|
4384
5614
|
color: var(--kr-text-field-error-color, #ef4444);
|
|
4385
5615
|
}
|
|
4386
|
-
`,
|
|
5616
|
+
`,Ht.formAssociated=!0,Mt([pe({type:String})],Ht.prototype,"label",void 0),Mt([pe({type:String})],Ht.prototype,"name",void 0),Mt([pe({type:String})],Ht.prototype,"value",void 0),Mt([pe({type:String})],Ht.prototype,"placeholder",void 0),Mt([pe({type:Boolean})],Ht.prototype,"disabled",void 0),Mt([pe({type:Boolean})],Ht.prototype,"readonly",void 0),Mt([pe({type:Boolean})],Ht.prototype,"required",void 0),Mt([pe({type:String})],Ht.prototype,"hint",void 0),Mt([pe({attribute:"option-value"})],Ht.prototype,"optionValue",void 0),Mt([pe({attribute:"option-label"})],Ht.prototype,"optionLabel",void 0),Mt([pe({type:Array})],Ht.prototype,"options",void 0),Mt([pe({attribute:!1})],Ht.prototype,"fetch",void 0),Mt([pe({attribute:!1})],Ht.prototype,"fetchSelection",void 0),Mt([ue()],Ht.prototype,"_isOpen",void 0),Mt([ue()],Ht.prototype,"_highlightedIndex",void 0),Mt([ue()],Ht.prototype,"_touched",void 0),Mt([ue()],Ht.prototype,"_searchQuery",void 0),Mt([ue()],Ht.prototype,"_loading",void 0),Mt([fe(".trigger")],Ht.prototype,"_triggerElement",void 0),Mt([fe(".search__input")],Ht.prototype,"_searchInput",void 0),Ht=Mt([de("kr-combo-box")],Ht);var Vt=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let jt=class extends le{constructor(){super(),this._focusedIndex=-1,this.label="",this.name="",this.value="",this.options=[],this.disabled=!1,this.required=!1,this.hint="",this.direction="row",this._touched=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._internals=this.attachInternals()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value="",this._touched=!1,this._internals.setFormValue(""),this._internals.setValidity({})}formStateRestoreCallback(e){this.value=e}connectedCallback(){super.connectedCallback(),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity()}updated(e){(e.has("required")||e.has("value"))&&this._updateValidity()}_updateValidity(){this.required&&!this.value?this._internals.setValidity({valueMissing:!0},"Please select an option"):this._internals.setValidity({})}_handleCardClick(e,t){this.disabled||t.disabled||(this.value=t.value,this._touched=!0,this._internals.setFormValue(this.value),this._updateValidity(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}_handleKeyDown(e,t){if(this.disabled)return;if(" "===e.key||"Enter"===e.key)return e.preventDefault(),void(this.options[t].disabled||this._handleCardClick(e,this.options[t]));let i=-1;if("row"===this.direction?"ArrowRight"===e.key?i=this._findNextEnabledIndex(t,1):"ArrowLeft"===e.key&&(i=this._findNextEnabledIndex(t,-1)):"ArrowDown"===e.key?i=this._findNextEnabledIndex(t,1):"ArrowUp"===e.key&&(i=this._findNextEnabledIndex(t,-1)),i>=0){e.preventDefault(),this._focusedIndex=i;const t=this.shadowRoot?.querySelectorAll(".card");t[i]&&t[i].focus()}}_findNextEnabledIndex(e,t){let i=e+t;for(;i>=0&&i<this.options.length;){if(!this.options[i].disabled)return i;i+=t}return-1}render(){return j`
|
|
4387
5617
|
<div class="wrapper">
|
|
4388
5618
|
${this.label?j`
|
|
4389
5619
|
<label>
|
|
4390
5620
|
${this.label}
|
|
4391
|
-
${this.required?j`<span class="required" aria-hidden="true">*</span>`:
|
|
5621
|
+
${this.required?j`<span class="required" aria-hidden="true">*</span>`:F}
|
|
4392
5622
|
</label>
|
|
4393
|
-
`:
|
|
5623
|
+
`:F}
|
|
4394
5624
|
<div
|
|
4395
5625
|
class=${we({cards:!0,"cards--row":"row"===this.direction,"cards--column":"column"===this.direction})}
|
|
4396
5626
|
role="radiogroup"
|
|
@@ -4407,18 +5637,18 @@ const $t=e=>e??U
|
|
|
4407
5637
|
@keydown=${e=>this._handleKeyDown(e,t)}
|
|
4408
5638
|
>
|
|
4409
5639
|
<div class="card__radio">
|
|
4410
|
-
${i?j`<div class="card__radio-dot"></div>`:
|
|
5640
|
+
${i?j`<div class="card__radio-dot"></div>`:F}
|
|
4411
5641
|
</div>
|
|
4412
5642
|
<div class="card__content">
|
|
4413
5643
|
<div class="card__label">${e.label}</div>
|
|
4414
|
-
${e.description?j`<div class="card__description">${e.description}</div>`:
|
|
5644
|
+
${e.description?j`<div class="card__description">${e.description}</div>`:F}
|
|
4415
5645
|
</div>
|
|
4416
5646
|
</div>
|
|
4417
5647
|
`}))}
|
|
4418
5648
|
</div>
|
|
4419
|
-
${this._touched&&this.required&&!this.value?j`<div class="validation-message">Please select an option</div>`:this.hint?j`<div class="hint">${this.hint}</div>`:
|
|
5649
|
+
${this._touched&&this.required&&!this.value?j`<div class="validation-message">Please select an option</div>`:this.hint?j`<div class="hint">${this.hint}</div>`:F}
|
|
4420
5650
|
</div>
|
|
4421
|
-
`}};
|
|
5651
|
+
`}};jt.styles=[ne,o`
|
|
4422
5652
|
:host {
|
|
4423
5653
|
display: block;
|
|
4424
5654
|
font-family: inherit;
|
|
@@ -4541,7 +5771,7 @@ const $t=e=>e??U
|
|
|
4541
5771
|
font-size: 0.75rem;
|
|
4542
5772
|
color: var(--kr-radio-cards-error-color, #ef4444);
|
|
4543
5773
|
}
|
|
4544
|
-
`],
|
|
5774
|
+
`],jt.formAssociated=!0,Vt([pe({type:String})],jt.prototype,"label",void 0),Vt([pe({type:String})],jt.prototype,"name",void 0),Vt([pe({type:String})],jt.prototype,"value",void 0),Vt([pe({attribute:!1})],jt.prototype,"options",void 0),Vt([pe({type:Boolean})],jt.prototype,"disabled",void 0),Vt([pe({type:Boolean})],jt.prototype,"required",void 0),Vt([pe({type:String})],jt.prototype,"hint",void 0),Vt([pe({type:String})],jt.prototype,"direction",void 0),Vt([ue()],jt.prototype,"_touched",void 0),jt=Vt([de("kr-radio-cards")],jt);var Bt=function(e,t,i,s){var r,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(o<3?r(l):o>3?r(t,i,l):r(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};let Ft=class extends le{constructor(){super(),this.label="",this.name="",this.value="on",this.checked=!1,this.disabled=!1,this.required=!1,this.hint="",this._touched=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._internals=this.attachInternals()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.checked=!1,this._touched=!1,this._internals.setFormValue(""),this._internals.setValidity({})}formStateRestoreCallback(e){this.checked=e===this.value}connectedCallback(){super.connectedCallback(),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._syncFormValue(),this._updateValidity()}updated(e){(e.has("checked")||e.has("value"))&&this._syncFormValue(),(e.has("required")||e.has("checked"))&&this._updateValidity()}_syncFormValue(){this.checked?this._internals.setFormValue(this.value):this._internals.setFormValue("")}_updateValidity(){this.required&&!this.checked?this._internals.setValidity({valueMissing:!0},"This field is required"):this._internals.setValidity({})}_handleClick(e){this.disabled||(this.checked=!this.checked,this._touched=!0,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}_handleKeyDown(e){this.disabled||" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),this._handleClick(e))}render(){return j`
|
|
4545
5775
|
<div class="wrapper">
|
|
4546
5776
|
<div
|
|
4547
5777
|
class=${we({checkbox:!0,"checkbox--disabled":this.disabled})}
|
|
@@ -4561,13 +5791,13 @@ const $t=e=>e??U
|
|
|
4561
5791
|
${this.label?j`
|
|
4562
5792
|
<span class="checkbox__label">
|
|
4563
5793
|
${this.label}
|
|
4564
|
-
${this.required?j`<span class="required" aria-hidden="true">*</span>`:
|
|
5794
|
+
${this.required?j`<span class="required" aria-hidden="true">*</span>`:F}
|
|
4565
5795
|
</span>
|
|
4566
|
-
`:
|
|
5796
|
+
`:F}
|
|
4567
5797
|
</div>
|
|
4568
|
-
${this._touched&&this.required&&!this.checked?j`<div class="validation-message">This field is required</div>`:this.hint?j`<div class="hint">${this.hint}</div>`:
|
|
5798
|
+
${this._touched&&this.required&&!this.checked?j`<div class="validation-message">This field is required</div>`:this.hint?j`<div class="hint">${this.hint}</div>`:F}
|
|
4569
5799
|
</div>
|
|
4570
|
-
`}focus(){this.shadowRoot?.querySelector(".checkbox")?.focus()}blur(){this.shadowRoot?.querySelector(".checkbox")?.blur()}};
|
|
5800
|
+
`}focus(){this.shadowRoot?.querySelector(".checkbox")?.focus()}blur(){this.shadowRoot?.querySelector(".checkbox")?.blur()}};Ft.styles=[ne,o`
|
|
4571
5801
|
:host {
|
|
4572
5802
|
display: inline-block;
|
|
4573
5803
|
font-family: inherit;
|
|
@@ -4650,5 +5880,5 @@ const $t=e=>e??U
|
|
|
4650
5880
|
color: var(--kr-checkbox-error-color, #ef4444);
|
|
4651
5881
|
margin-left: 26px;
|
|
4652
5882
|
}
|
|
4653
|
-
`],
|
|
5883
|
+
`],Ft.formAssociated=!0,Bt([pe({type:String})],Ft.prototype,"label",void 0),Bt([pe({type:String})],Ft.prototype,"name",void 0),Bt([pe({type:String})],Ft.prototype,"value",void 0),Bt([pe({type:Boolean})],Ft.prototype,"checked",void 0),Bt([pe({type:Boolean})],Ft.prototype,"disabled",void 0),Bt([pe({type:Boolean})],Ft.prototype,"required",void 0),Bt([pe({type:String})],Ft.prototype,"hint",void 0),Bt([ue()],Ft.prototype,"_touched",void 0),Ft=Bt([de("kr-checkbox")],Ft);export{be as KRAccordion,Ce as KRAlert,Rt as KRAutoSuggest,ze as KRButton,Ft as KRCheckbox,De as KRCodeDemo,Ht as KRComboBox,Ae as KRContextMenu,Ue as KRDateRangePicker,Be as KRDialog,je as KRDialogRef,St as KRFileList,$t as KRFilePreview,vt as KRGrid,xt as KRProgressBar,ct as KRQuery,jt as KRRadioCards,Je as KRSelectField,tt as KRSelectOption,Ke as KRSnackbar,mt as KRSpinner,Qe as KRTab,Ye as KRTabGroup,ft as KRTable,Dt as KRTextField,At as KRTextareaField,it as KR_OPERATORS,st as getOperatorsForType,ne as krBaseCSS};
|
|
4654
5884
|
//# sourceMappingURL=krubble-components.bundled.min.js.map
|