@kodaris/krubble-components 1.0.51 → 1.0.53
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 +1811 -192
- package/dist/button/button.js +1 -1
- package/dist/form/select-field/select-field.js +1 -1
- package/dist/index.d.ts +3 -1
- 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 +3749 -1866
- package/dist/krubble-components.bundled.js.map +1 -1
- package/dist/krubble-components.bundled.min.js +874 -396
- package/dist/krubble-components.bundled.min.js.map +1 -1
- package/dist/krubble-components.umd.js +4564 -2678
- package/dist/krubble-components.umd.js.map +1 -1
- package/dist/krubble-components.umd.min.js +876 -398
- package/dist/krubble-components.umd.min.js.map +1 -1
- package/dist/table/query.d.ts +63 -0
- package/dist/table/query.d.ts.map +1 -0
- package/dist/table/query.js +1015 -0
- package/dist/table/query.js.map +1 -0
- package/dist/table/table.d.ts +63 -10
- package/dist/table/table.d.ts.map +1 -1
- package/dist/table/table.js +986 -113
- package/dist/table/table.js.map +1 -1
- package/package.json +1 -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(),
|
|
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 o=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 r=(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 o(s,e,i)},a=t?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new o("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:l,defineProperty:
|
|
11
|
+
*/,{is:l,defineProperty:n,getOwnPropertyDescriptor:d,getOwnPropertyNames:c,getOwnPropertySymbols:h,getPrototypeOf:p}=Object,u=globalThis,f=u.trustedTypes,g=f?f.emptyScript:"",v=u.reactiveElementPolyfillSupport,b=(e,t)=>e,m={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}},_=(e,t)=>!l(e,t),y={attribute:!0,type:String,converter:m,reflect:!1,useDefault:!1,hasChanged:_};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:o}=d(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:s,set(t){const r=s?.call(this);o?.call(this,t),this.requestUpdate(e,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??y}static _$Ei(){if(this.hasOwnProperty(b("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(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...c(e),...h(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(a(e))}else void 0!==e&&t.push(a(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"),o=e.litNonce;void 0!==o&&s.setAttribute("nonce",o),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 o=(void 0!==i.converter?.toAttribute?i.converter:m).toAttribute(t,i.type);this._$Em=e,null==o?this.removeAttribute(s):this.setAttribute(s,o),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),o="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:m;this._$Em=s;const r=o.fromAttribute(t,e.type);this[s]=r??this._$Ej?.get(s)??r,this._$Em=null}}requestUpdate(e,t,i,s=!1,o){if(void 0!==e){const r=this.constructor;if(!1===s&&(o=this[e]),i??=r.getPropertyOptions(e),!((i.hasChanged??_)(o,t)||i.useDefault&&i.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,i))))return;this.C(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:s,wrapped:o},r){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,r??t??this[e]),!0!==o||void 0!==r)||(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[b("elementProperties")]=new Map,x[b("finalized")]=new Map,v?.({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$",
|
|
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)}$`,E="?"+S,z=`<${E}>`,T=document,O=()=>T.createComment(""),P=e=>null===e||"object"!=typeof e&&"function"!=typeof e,A=Array.isArray,D="[ \t\n\f\r]",L=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,M=/-->/g,I=/>/g,R=RegExp(`>|${D}(?:([^\\s"'>=/]+)(${D}*=${D}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),q=/'/g,H=/"/g,j=/^(?:script|style|textarea|title)$/i,V=(e=>(t,...i)=>({_$litType$:e,strings:t,values:i}))(1),U=Symbol.for("lit-noChange"),B=Symbol.for("lit-nothing"),N=new WeakMap,F=T.createTreeWalker(T,129);function K(e,t){if(!A(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==$?$.createHTML(t):t}const W=(e,t)=>{const i=e.length-1,s=[];let o,r=2===t?"<svg>":3===t?"<math>":"",a=L;for(let t=0;t<i;t++){const i=e[t];let l,n,d=-1,c=0;for(;c<i.length&&(a.lastIndex=c,n=a.exec(i),null!==n);)c=a.lastIndex,a===L?"!--"===n[1]?a=M:void 0!==n[1]?a=I:void 0!==n[2]?(j.test(n[2])&&(o=RegExp("</"+n[2],"g")),a=R):void 0!==n[3]&&(a=R):a===R?">"===n[0]?(a=o??L,d=-1):void 0===n[1]?d=-2:(d=a.lastIndex-n[2].length,l=n[1],a=void 0===n[3]?R:'"'===n[3]?H:q):a===H||a===q?a=R:a===M||a===I?a=L:(a=R,o=void 0);const h=a===R&&e[t+1].startsWith("/>")?" ":"";r+=a===L?i+z:d>=0?(s.push(l),i.slice(0,d)+C+i.slice(d)+S+h):i+S+(-2===d?t:h)}return[K(e,r+(e[i]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),s]};class X{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let o=0,r=0;const a=e.length-1,l=this.parts,[n,d]=W(e,t);if(this.el=X.createElement(n,i),F.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(s=F.nextNode())&&l.length<a;){if(1===s.nodeType){if(s.hasAttributes())for(const e of s.getAttributeNames())if(e.endsWith(C)){const t=d[r++],i=s.getAttribute(e).split(S),a=/([.?@])?(.*)/.exec(t);l.push({type:1,index:o,name:a[2],strings:i,ctor:"."===a[1]?J:"?"===a[1]?ee:"@"===a[1]?te:G}),s.removeAttribute(e)}else e.startsWith(S)&&(l.push({type:6,index:o}),s.removeAttribute(e));if(j.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],O()),F.nextNode(),l.push({type:2,index:++o});s.append(e[t],O())}}}else if(8===s.nodeType)if(s.data===E)l.push({type:2,index:o});else{let e=-1;for(;-1!==(e=s.data.indexOf(S,e+1));)l.push({type:7,index:o}),e+=S.length-1}o++}}static createElement(e,t){const i=T.createElement("template");return i.innerHTML=e,i}}function Y(e,t,i=e,s){if(t===U)return t;let o=void 0!==s?i._$Co?.[s]:i._$Cl;const r=P(t)?void 0:t._$litDirective$;return o?.constructor!==r&&(o?._$AO?.(!1),void 0===r?o=void 0:(o=new r(e),o._$AT(e,i,s)),void 0!==s?(i._$Co??=[])[s]=o:i._$Cl=o),void 0!==o&&(t=Y(e,o._$AS(e,t.values),o,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??T).importNode(t,!0);F.currentNode=s;let o=F.nextNode(),r=0,a=0,l=i[0];for(;void 0!==l;){if(r===l.index){let t;2===l.type?t=new Q(o,o.nextSibling,this,e):1===l.type?t=new l.ctor(o,l.name,l.strings,this,e):6===l.type&&(t=new ie(o,this,e)),this._$AV.push(t),l=i[++a]}r!==l?.index&&(o=F.nextNode(),r++)}return F.currentNode=T,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=B,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),P(e)?e===B||null==e||""===e?(this._$AH!==B&&this._$AR(),this._$AH=B):e!==this._$AH&&e!==U&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>A(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!==B&&P(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.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(K(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=N.get(e.strings);return void 0===t&&N.set(e.strings,t=new X(e)),t}k(e){A(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,s=0;for(const o of e)s===t.length?t.push(i=new Q(this.O(O()),this.O(O()),this,this.options)):i=t[s],i._$AI(o),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,o){this.type=1,this._$AH=B,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=o,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=B}_$AI(e,t=this,i,s){const o=this.strings;let r=!1;if(void 0===o)e=Y(this,e,t,0),r=!P(e)||e!==this._$AH&&e!==U,r&&(this._$AH=e);else{const s=e;let a,l;for(e=o[0],a=0;a<o.length-1;a++)l=Y(this,s[i+a],t,a),l===U&&(l=this._$AH[a]),r||=!P(l)||l!==this._$AH[a],l===B?e=B:e!==B&&(e+=(l??"")+o[a+1]),this._$AH[a]=l}r&&!s&&this.j(e)}j(e){e===B?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===B?void 0:e}}class ee extends G{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==B)}}class te extends G{constructor(e,t,i,s,o){super(e,t,i,s,o),this.type=5}_$AI(e,t=this){if((e=Y(this,e,t,0)??B)===U)return;const i=this._$AH,s=e===B&&i!==B||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,o=e!==B&&(i===B||s);s&&this.element.removeEventListener(this.name,this,i),o&&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 oe=(e,t,i)=>{const s=i?.renderBefore??t;let o=s._$litPart$;if(void 0===o){const e=i?.renderBefore??null;s._$litPart$=o=new Q(t.insertBefore(O(),e),e,void 0,i??{})}return o._$AI(e),o
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/},re=globalThis;let
|
|
22
|
+
*/},re=globalThis;let ae=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=oe(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};ae._$litElement$=!0,ae.finalized=!0,re.litElementHydrateSupport?.({LitElement:ae});const le=re.litElementPolyfillSupport;le?.({LitElement:ae}),(re.litElementVersions??=[]).push("4.2.2");const ne=r`
|
|
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
|
-
*/,ce={attribute:!0,type:String,converter:m,reflect:!1,hasChanged:
|
|
59
|
+
*/,ce={attribute:!0,type:String,converter:m,reflect:!1,hasChanged:_},he=(e=ce,t,i)=>{const{kind:s,metadata:o}=i;let r=globalThis.litPropertyMetadata.get(o);if(void 0===r&&globalThis.litPropertyMetadata.set(o,r=new Map),"setter"===s&&((e=Object.create(e)).wrapped=!0),r.set(i.name,e),"accessor"===s){const{name:s}=i;return{set(i){const o=t.get.call(this);t.set.call(this,i),this.requestUpdate(s,o,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 o=this[s];t.call(this,i),this.requestUpdate(s,o,e,!0,i)}}throw Error("Unsupported decorator location: "+s)};function pe(e){return(t,i)=>"object"==typeof i?he(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
|
|
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,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 ve=class extends ae{constructor(){super(...arguments),this.header="",this.expanded=!1}toggle(){this.expanded=!this.expanded}render(){return V`
|
|
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">
|
|
@@ -138,30 +138,30 @@ function ge(e,t){return(t,i,o)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
|
138
138
|
.content__body {
|
|
139
139
|
padding: 16px 16px 8px 16px;
|
|
140
140
|
}
|
|
141
|
-
`,
|
|
141
|
+
`,ge([pe({type:String})],ve.prototype,"header",void 0),ge([pe({type:Boolean,reflect:!0})],ve.prototype,"expanded",void 0),ve=ge([de("kr-accordion")],ve);
|
|
142
142
|
/**
|
|
143
143
|
* @license
|
|
144
144
|
* Copyright 2017 Google LLC
|
|
145
145
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
146
146
|
*/
|
|
147
|
-
const be=1,me=2,
|
|
147
|
+
const be=1,me=2,_e=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!==be||"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
|
|
152
|
+
*/const we=xe(class extends ke{constructor(e){if(super(e),e.type!==be||"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 U}});var $e=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 Ce=class extends ae{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:V`<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:V`<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:V`<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:V`<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 V`
|
|
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?
|
|
159
|
+
${this.title?V`<h4 class="header">${this.title}</h4>`:B}
|
|
160
160
|
<div class="message">
|
|
161
161
|
<slot></slot>
|
|
162
162
|
</div>
|
|
163
163
|
</div>
|
|
164
|
-
${this.dismissible?
|
|
164
|
+
${this.dismissible?V`
|
|
165
165
|
<button
|
|
166
166
|
class="dismiss"
|
|
167
167
|
type="button"
|
|
@@ -172,7 +172,7 @@ const be=1,me=2,ye=3,_e=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
|
+
`:B}
|
|
176
176
|
</div>
|
|
177
177
|
`}};Ce.styles=r`
|
|
178
178
|
:host {
|
|
@@ -290,26 +290,26 @@ const be=1,me=2,ye=3,_e=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
|
|
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,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 Ee=class extends ae{constructor(){super(...arguments),this.variant="flat",this.color="primary",this.size="medium",this.disabled=!1,this.options=[],this.iconPosition="left",this._state="idle",this._stateText="",this._dropdownOpened=!1,this._handleHostClick=e=>{this.options.length&&(e.stopPropagation(),this._toggleDropdown())},this._handleKeydown=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.options.length?this._toggleDropdown():this.click()),"Escape"===e.key&&this._dropdownOpened&&(this._dropdownOpened=!1)},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)}_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";const i=e.getBoundingClientRect();i.bottom>window.innerHeight?(e.style.top="",e.style.bottom=window.innerHeight-t.top+4+"px",e.style.transformOrigin="bottom left",e.classList.add("dropdown--above")):e.classList.remove("dropdown--above"),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)}render(){const e=V`
|
|
294
294
|
<span class="content">
|
|
295
295
|
<slot name="icon"></slot>
|
|
296
296
|
<slot></slot>
|
|
297
297
|
</span>
|
|
298
|
-
${this.options.length?
|
|
299
|
-
${"idle"!==this._state?
|
|
300
|
-
${"loading"===this._state?
|
|
301
|
-
</span>`:
|
|
302
|
-
${this.options.length?
|
|
298
|
+
${this.options.length?V`<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>`:B}
|
|
299
|
+
${"idle"!==this._state?V`<span class="state-overlay">
|
|
300
|
+
${"loading"===this._state?V`<span class="spinner"></span>`:this._stateText}
|
|
301
|
+
</span>`:B}
|
|
302
|
+
${this.options.length?V`
|
|
303
303
|
<div class="dropdown ${this._dropdownOpened?"dropdown--opened":""}">
|
|
304
|
-
${this.options.map((e=>
|
|
304
|
+
${this.options.map((e=>V`
|
|
305
305
|
<button
|
|
306
306
|
class="dropdown-item"
|
|
307
307
|
@click=${t=>this._handleOptionClick(e,t)}
|
|
308
308
|
>${e.label}</button>
|
|
309
309
|
`))}
|
|
310
310
|
</div>
|
|
311
|
-
`:
|
|
312
|
-
`;return this.href?
|
|
311
|
+
`:B}
|
|
312
|
+
`;return this.href?V`<a class="link" href=${this.href} target=${this.target||B}>${e}</a>`:e}};Ee.styles=r`
|
|
313
313
|
:host {
|
|
314
314
|
display: inline-flex;
|
|
315
315
|
position: relative;
|
|
@@ -410,7 +410,7 @@ const be=1,me=2,ye=3,_e=4,xe=e=>(...t)=>({_$litDirective$:e,values:t});let ke=cl
|
|
|
410
410
|
/* Sizes */
|
|
411
411
|
:host(.kr-button--small) {
|
|
412
412
|
font-size: 13px;
|
|
413
|
-
height:
|
|
413
|
+
height: 30px;
|
|
414
414
|
padding: 0 16px;
|
|
415
415
|
}
|
|
416
416
|
|
|
@@ -579,13 +579,13 @@ const be=1,me=2,ye=3,_e=4,xe=e=>(...t)=>({_$litDirective$:e,values:t});let ke=cl
|
|
|
579
579
|
width: 22px;
|
|
580
580
|
height: 22px;
|
|
581
581
|
}
|
|
582
|
-
`,
|
|
582
|
+
`,Se([pe({type:String,reflect:!0})],Ee.prototype,"variant",void 0),Se([pe({type:String,reflect:!0})],Ee.prototype,"color",void 0),Se([pe({type:String,reflect:!0})],Ee.prototype,"size",void 0),Se([pe({type:Boolean,reflect:!0})],Ee.prototype,"disabled",void 0),Se([pe({type:String})],Ee.prototype,"href",void 0),Se([pe({type:String})],Ee.prototype,"target",void 0),Se([pe({type:Array})],Ee.prototype,"options",void 0),Se([pe({type:String,reflect:!0,attribute:"icon-position"})],Ee.prototype,"iconPosition",void 0),Se([ue()],Ee.prototype,"_state",void 0),Se([ue()],Ee.prototype,"_stateText",void 0),Se([ue()],Ee.prototype,"_dropdownOpened",void 0),Ee=Se([de("kr-button")],Ee);
|
|
583
583
|
/**
|
|
584
584
|
* @license
|
|
585
585
|
* Copyright 2017 Google LLC
|
|
586
586
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
587
587
|
*/
|
|
588
|
-
class
|
|
588
|
+
class ze extends ke{constructor(e){if(super(e),this.it=B,e.type!==me)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===B||null==e)return this._t=void 0,this.it=e;if(e===U)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:[]}}}ze.directiveName="unsafeHTML",ze.resultType=1;const Te=xe(ze);var Oe=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 Pe=class extends ae{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 V`
|
|
589
589
|
<div class="tabs">
|
|
590
590
|
<button
|
|
591
591
|
class=${we({tab:!0,"tab--active":"preview"===this.activeTab})}
|
|
@@ -604,7 +604,7 @@ class Ee extends ke{constructor(e){if(super(e),this.it=U,e.type!==me)throw Error
|
|
|
604
604
|
@click=${this.copyCode}
|
|
605
605
|
title=${this.copied?"Copied!":"Copy code"}
|
|
606
606
|
>
|
|
607
|
-
${this.copied?
|
|
607
|
+
${this.copied?V`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>`:V`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>`}
|
|
608
608
|
</button>
|
|
609
609
|
</div>
|
|
610
610
|
|
|
@@ -613,10 +613,10 @@ class Ee extends ke{constructor(e){if(super(e),this.it=U,e.type!==me)throw Error
|
|
|
613
613
|
</div>
|
|
614
614
|
|
|
615
615
|
<div class=${we({panel:!0,"panel--active":"code"===this.activeTab,"panel--code":!0})}>
|
|
616
|
-
<pre class="code"><code>${
|
|
616
|
+
<pre class="code"><code>${Te(this.highlightedCode)}</code></pre>
|
|
617
617
|
</div>
|
|
618
618
|
|
|
619
|
-
`}};
|
|
619
|
+
`}};Pe.styles=[ne,r`
|
|
620
620
|
:host {
|
|
621
621
|
display: block;
|
|
622
622
|
border: 1px solid #d5dbdb;
|
|
@@ -738,20 +738,20 @@ class Ee extends ke{constructor(e){if(super(e),this.it=U,e.type!==me)throw Error
|
|
|
738
738
|
.hljs-attribute { color: #005cc5; }
|
|
739
739
|
.hljs-property { color: #005cc5; }
|
|
740
740
|
|
|
741
|
-
`],
|
|
741
|
+
`],Oe([pe({type:String})],Pe.prototype,"language",void 0),Oe([ue()],Pe.prototype,"code",void 0),Oe([ue()],Pe.prototype,"activeTab",void 0),Oe([ue()],Pe.prototype,"copied",void 0),Oe([ue()],Pe.prototype,"highlightedCode",void 0),Pe=Oe([de("kr-code-demo")],Pe);var Ae=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 De=class extends ae{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 V`
|
|
742
742
|
<div class="menu">
|
|
743
|
-
${this.items.map((e=>e.divider?
|
|
743
|
+
${this.items.map((e=>e.divider?V`<div class="menu__divider"></div>`:V`
|
|
744
744
|
<button
|
|
745
745
|
class="menu__item"
|
|
746
746
|
?disabled=${e.disabled}
|
|
747
747
|
@click=${()=>this.handleItemClick(e)}
|
|
748
748
|
>
|
|
749
|
-
${e.icon?
|
|
749
|
+
${e.icon?V`<span class="menu__item-icon">${e.icon}</span>`:null}
|
|
750
750
|
${e.label}
|
|
751
751
|
</button>
|
|
752
752
|
`))}
|
|
753
753
|
</div>
|
|
754
|
-
`}};
|
|
754
|
+
`}};De.styles=r`
|
|
755
755
|
:host {
|
|
756
756
|
position: fixed;
|
|
757
757
|
z-index: 10000;
|
|
@@ -806,13 +806,13 @@ class Ee extends ke{constructor(e){if(super(e),this.it=U,e.type!==me)throw Error
|
|
|
806
806
|
background: rgba(255, 255, 255, 0.1);
|
|
807
807
|
margin: 4px 0;
|
|
808
808
|
}
|
|
809
|
-
`,
|
|
809
|
+
`,Ae([ue()],De.prototype,"items",void 0),De=Ae([de("kr-context-menu")],De);
|
|
810
810
|
/**
|
|
811
811
|
* @license
|
|
812
812
|
* Copyright 2018 Google LLC
|
|
813
813
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
814
814
|
*/
|
|
815
|
-
const
|
|
815
|
+
const Le="important",Me=" !"+Le,Ie=xe(class extends ke{constructor(e){if(super(e),e.type!==be||"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(Me);e.includes("-")||t?i.setProperty(e,t?s.slice(0,-11):s,t?Le:""):i[e]=s}}return U}});var Re=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 qe=class extends ae{render(){return V`<slot></slot>`}};qe.styles=r`
|
|
816
816
|
:host {
|
|
817
817
|
display: flex;
|
|
818
818
|
padding: 0 24px;
|
|
@@ -827,14 +827,14 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
827
827
|
font-size: 18px;
|
|
828
828
|
font-weight: 600;
|
|
829
829
|
}
|
|
830
|
-
`,
|
|
830
|
+
`,qe=Re([de("kr-dialog-header")],qe);let He=class extends ae{render(){return V`<slot></slot>`}};He.styles=r`
|
|
831
831
|
:host {
|
|
832
832
|
display: block;
|
|
833
833
|
padding: 24px;
|
|
834
834
|
overflow: auto;
|
|
835
835
|
flex: 1 1 auto;
|
|
836
836
|
}
|
|
837
|
-
`,
|
|
837
|
+
`,He=Re([de("kr-dialog-content")],He);let je=class extends ae{render(){return V`<slot></slot>`}};je.styles=r`
|
|
838
838
|
:host {
|
|
839
839
|
display: flex;
|
|
840
840
|
padding: 0 24px;
|
|
@@ -845,13 +845,13 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
845
845
|
gap: 12px;
|
|
846
846
|
justify-content: flex-end;
|
|
847
847
|
}
|
|
848
|
-
`,
|
|
848
|
+
`,je=Re([de("kr-dialog-footer")],je);class Ve{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 Ue=class extends ae{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 Ve,s=document.createElement("kr-dialog");i.setDialogElement(s),s._dialogRef=i;const o=new e;return o.dialogRef=i,t?.data&&(o.data=t.data),t?.label&&(s.label=t.label),t?.width&&(s.width=t.width),s._contentElement=o,s.opened=!0,document.body.appendChild(s),i}_handleBackdropClick(e){e.target.classList.contains("backdrop")&&this.close()}render(){return V`
|
|
849
849
|
<div class="backdrop" @click=${this._handleBackdropClick}></div>
|
|
850
|
-
<div class="dialog" style=${
|
|
851
|
-
${this.label?
|
|
852
|
-
${this._contentElement?this._contentElement:
|
|
850
|
+
<div class="dialog" style=${Ie({width:this.width})}>
|
|
851
|
+
${this.label?V`<div class="dialog__header"><div class="dialog__header-label">${this.label}</div></div>`:""}
|
|
852
|
+
${this._contentElement?this._contentElement:V`<slot></slot>`}
|
|
853
853
|
</div>
|
|
854
|
-
`}};
|
|
854
|
+
`}};Ue.styles=r`
|
|
855
855
|
:host {
|
|
856
856
|
position: fixed;
|
|
857
857
|
inset: 0;
|
|
@@ -909,10 +909,10 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
909
909
|
font-size: 18px;
|
|
910
910
|
font-weight: 600;
|
|
911
911
|
}
|
|
912
|
-
`,
|
|
912
|
+
`,Re([ue()],Ue.prototype,"_contentElement",void 0),Re([pe({type:Boolean,reflect:!0})],Ue.prototype,"opened",void 0),Re([pe({type:String})],Ue.prototype,"label",void 0),Re([pe({type:String})],Ue.prototype,"width",void 0),Ue=Re([de("kr-dialog")],Ue);var Be,Ne=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 Fe=Be=class extends ae{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"),Be.activeSnackbars.push(this),this.duration>0&&(this.dismissTimeout=window.setTimeout((()=>{this.dismiss()}),this.duration))}disconnectedCallback(){super.disconnectedCallback();const e=Be.activeSnackbars.indexOf(this);e>-1&&Be.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:V`<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:V`<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:V`<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:V`<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 V`
|
|
913
913
|
${e[this.type]}
|
|
914
914
|
<div class="content">
|
|
915
|
-
${this.title?
|
|
915
|
+
${this.title?V`<div class="title">${this.title}</div>`:""}
|
|
916
916
|
<div class="message">${this.message}</div>
|
|
917
917
|
</div>
|
|
918
918
|
<button
|
|
@@ -1073,9 +1073,9 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
1073
1073
|
outline: 2px solid #3b82f6;
|
|
1074
1074
|
outline-offset: 2px;
|
|
1075
1075
|
}
|
|
1076
|
-
`,Fe.activeSnackbars=[],Ne([pe({type:String})],Fe.prototype,"type",void 0),Ne([pe({type:String})],Fe.prototype,"title",void 0),Ne([pe({type:String})],Fe.prototype,"message",void 0),Ne([pe({type:Number})],Fe.prototype,"duration",void 0),Fe=
|
|
1076
|
+
`,Fe.activeSnackbars=[],Ne([pe({type:String})],Fe.prototype,"type",void 0),Ne([pe({type:String})],Fe.prototype,"title",void 0),Ne([pe({type:String})],Fe.prototype,"message",void 0),Ne([pe({type:Number})],Fe.prototype,"duration",void 0),Fe=Be=Ne([de("kr-snackbar")],Fe);var Ke=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 We=class extends ae{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 o=this.shadowRoot?.querySelectorAll(".label"),r=Array.from(o||[]).find((e=>e.getAttribute("data-tab-id")===i.id));r?.focus()}}_renderTabIcon(e){const t=e.getIconElement();if(!t)return B;const i=t.cloneNode(!0);return i.removeAttribute("slot"),V`<span class="label-icon">${i}</span>`}render(){return V`
|
|
1077
1077
|
<div class="header" role="tablist" @keydown=${this._handleKeyDown}>
|
|
1078
|
-
${this._getTabs().map((e=>
|
|
1078
|
+
${this._getTabs().map((e=>V`
|
|
1079
1079
|
<button
|
|
1080
1080
|
class=${we({label:!0,"label--active":e.id===this.activeTabId,"label--justified":this.justified})}
|
|
1081
1081
|
role="tab"
|
|
@@ -1088,8 +1088,8 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
1088
1088
|
>
|
|
1089
1089
|
${this._renderTabIcon(e)}
|
|
1090
1090
|
<span>${e.label}</span>
|
|
1091
|
-
${e.badge?
|
|
1092
|
-
${e.dismissible?
|
|
1091
|
+
${e.badge?V`<span class="label-badge" style=${Ie({backgroundColor:e.badgeBackground,color:e.badgeColor})}>${e.badge}</span>`:B}
|
|
1092
|
+
${e.dismissible?V`
|
|
1093
1093
|
<button
|
|
1094
1094
|
class="label-dismiss"
|
|
1095
1095
|
type="button"
|
|
@@ -1098,14 +1098,14 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
1098
1098
|
>
|
|
1099
1099
|
<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>
|
|
1100
1100
|
</button>
|
|
1101
|
-
`:
|
|
1101
|
+
`:B}
|
|
1102
1102
|
</button>
|
|
1103
1103
|
`))}
|
|
1104
1104
|
</div>
|
|
1105
1105
|
<div class="content" role="tabpanel" aria-labelledby=${this.activeTabId||""}>
|
|
1106
1106
|
<slot @slotchange=${this._updateActiveTab}></slot>
|
|
1107
1107
|
</div>
|
|
1108
|
-
`}};
|
|
1108
|
+
`}};We.styles=[ne,r`
|
|
1109
1109
|
:host {
|
|
1110
1110
|
display: flex;
|
|
1111
1111
|
flex-direction: column;
|
|
@@ -1238,7 +1238,7 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
1238
1238
|
::slotted(kr-tab[active]) {
|
|
1239
1239
|
display: block;
|
|
1240
1240
|
}
|
|
1241
|
-
`],
|
|
1241
|
+
`],Ke([pe({type:String,attribute:"active-tab-id"})],We.prototype,"activeTabId",void 0),Ke([pe({type:Boolean})],We.prototype,"justified",void 0),Ke([pe({type:String,reflect:!0})],We.prototype,"size",void 0),We=Ke([de("kr-tab-group")],We);var Xe=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 Ye=class extends ae{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"]')}render(){return console.log("tab render"),V`<slot></slot>`}};Ye.styles=[ne,r`
|
|
1242
1242
|
:host {
|
|
1243
1243
|
display: none;
|
|
1244
1244
|
}
|
|
@@ -1248,7 +1248,238 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
1248
1248
|
width: 100%;
|
|
1249
1249
|
height: 100%;
|
|
1250
1250
|
}
|
|
1251
|
-
`],Xe([pe({type:String,reflect:!0})],Ye.prototype,"id",void 0),Xe([pe({type:String})],Ye.prototype,"label",void 0),Xe([pe({type:String})],Ye.prototype,"badge",void 0),Xe([pe({type:String,attribute:"badge-background"})],Ye.prototype,"badgeBackground",void 0),Xe([pe({type:String,attribute:"badge-color"})],Ye.prototype,"badgeColor",void 0),Xe([pe({type:Boolean})],Ye.prototype,"disabled",void 0),Xe([pe({type:Boolean})],Ye.prototype,"dismissible",void 0),Xe([pe({type:Boolean,reflect:!0})],Ye.prototype,"active",void 0),Ye=Xe([de("kr-tab")],Ye);var Ze=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};const Qe=['"',"+","-","&&","||","!","(",")","{","}","[","]","^","~","*","?",":"],Ge=['\\"',"\\+","\\-","\\&\\&","\\|\\|","\\!","\\(","\\)","\\{","\\}","\\[","\\]","\\^","\\~","\\*","\\?","\\:"];function Je(e){let t=e;for(let e=0;e<Qe.length;e++)t=t.split(Qe[e]).join(Ge[e]);return t}let et=class extends ne{constructor(){super(...arguments),this._scrollStyle="overlay",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._displayedColumns=[],this._resizing=null,this._resizeObserver=null,this._searchPositionLocked=!1,this._def={columns:[]},this.def={columns:[]},this._handleClickOutsideColumnPicker=e=>{if(!this._columnPickerOpen)return;const t=e.composedPath(),i=this.shadowRoot?.querySelector(".column-picker-wrapper");i&&!t.includes(i)&&(this._columnPickerOpen=!1)},this._handleResizeMove=e=>{if(!this._resizing)return;const t=this._def.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._handleClickOutsideColumnPicker),this._resizeObserver=new ResizeObserver((()=>{this._searchPositionLocked=!1,this._updateSearchPosition()})),this._resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this._refreshTimer),document.removeEventListener("click",this._handleClickOutsideColumnPicker),this._resizeObserver?.disconnect()}willUpdate(e){e.has("def")&&(this._def={...this.def,columns:this.def.columns.map((e=>"actions"===e.type?{...e,label:e.label??"",sticky:"right",resizable:!1}:{...e}))},this._displayedColumns=this._def.displayedColumns||this._def.columns.map((e=>e.id)),this._fetch(),this._initRefresh())}updated(e){this._updateScrollFlags(),this._syncSlottedContent()}_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 o=e.render(t);if(!o)return;const s=document.createElement("span");s.slot=`cell-${i}-${e.id}`,"actions"===e.type&&(s.style.display="flex",s.style.gap="8px"),"string"==typeof o?s.innerHTML=o:se(o,s),this.appendChild(s)}))})))}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())}_fetch(){if(!this._def.dataSource)return;let e;switch(this._dataState="loading",this._def.dataSource.mode){case"opensearch":throw Error("Opensearch not supported yet");case"db":e={page:this._page-1,size:this._pageSize,sorts:[],filterFields:[],queryFields:[],facetFields:[]},this._searchQuery?.trim().length&&this._def.columns.filter((e=>e.searchable)).forEach((t=>{e.queryFields.push({name:t.id,operation:"CONTAINS",value:this._searchQuery,and:!1})}));break;default:e={page:this._page-1,size:this._pageSize,sorts:[],filterFields:[],queryFields:[],facetFields:[]},this._searchQuery?.trim().length&&e.queryFields.push({name:"_text_",operation:"IS",value:Je(this._searchQuery)})}this._def.dataSource.fetch(e).then((e=>{switch(this._def.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._dataState="success",this._updateSearchPosition()})).catch((e=>{this._dataState="error",Fe.show({message:e instanceof Error?e.message:"Failed to load data",type:"error"})}))}_initRefresh(){clearInterval(this._refreshTimer),this._def.refreshInterval&&this._def.refreshInterval>0&&(this._refreshTimer=window.setInterval((()=>{this._fetch()}),this._def.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;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(),o=t.getBoundingClientRect().left-i.left;e.style.justifyContent="flex-start",t.style.marginLeft=`${o}px`,this._searchPositionLocked=!0})))}_toggleColumnPicker(){this._columnPickerOpen=!this._columnPickerOpen}_toggleColumn(e){this._displayedColumns.includes(e)?this._displayedColumns=this._displayedColumns.filter((t=>t!==e)):this._displayedColumns=[...this._displayedColumns,e]}_handleRowMouseDown(){this._def.rowClickable&&window.getSelection()?.removeAllRanges()}_handleRowClick(e,t){if(!this._def.rowClickable)return;const i=window.getSelection();i&&i.toString().length>0||this.dispatchEvent(new CustomEvent("row-click",{detail:{row:e,rowIndex:t},bubbles:!0,composed:!0}))}getDisplayedColumns(){return this._displayedColumns.map((e=>this._def.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)}_handleAction(e){e.href||this.dispatchEvent(new CustomEvent("action",{detail:{action:e.id},bubbles:!0,composed:!0}))}_renderCellContent(e,t,i){const o=t[e.id];if(e.render)return B`<slot name="cell-${i}-${e.id}"></slot>`;if(null==o)return"";switch(e.type){case"number":return"number"==typeof o?o.toLocaleString():String(o);case"currency":return"number"==typeof o?o.toLocaleString("en-US",{style:"currency",currency:"USD"}):String(o);case"date":{let e;if(o instanceof Date)e=o;else if("string"==typeof o&&/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/.test(o)){const t=o.replace(/(\d{2}:\d{2}:\d{2}):(\d+)$/,"$1.$2").replace(" ","T")+"Z";e=new Date(t)}else e=new Date(o);return e.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}case"boolean":return!0===o?"Yes":!1===o?"No":"";default:return String(o)}}_getHeaderCellClasses(e,t){return{"header-cell":!0,"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 B`
|
|
1251
|
+
`],Xe([pe({type:String,reflect:!0})],Ye.prototype,"id",void 0),Xe([pe({type:String})],Ye.prototype,"label",void 0),Xe([pe({type:String})],Ye.prototype,"badge",void 0),Xe([pe({type:String,attribute:"badge-background"})],Ye.prototype,"badgeBackground",void 0),Xe([pe({type:String,attribute:"badge-color"})],Ye.prototype,"badgeColor",void 0),Xe([pe({type:Boolean})],Ye.prototype,"disabled",void 0),Xe([pe({type:Boolean})],Ye.prototype,"dismissible",void 0),Xe([pe({type:Boolean,reflect:!0})],Ye.prototype,"active",void 0),Ye=Xe([de("kr-tab")],Ye);var Ze=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 Qe=class extends ae{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 V`
|
|
1252
|
+
<div class="wrapper">
|
|
1253
|
+
${this.label?V`
|
|
1254
|
+
<label>
|
|
1255
|
+
${this.label}
|
|
1256
|
+
${this.required?V`<span class="required" aria-hidden="true">*</span>`:""}
|
|
1257
|
+
</label>
|
|
1258
|
+
`:B}
|
|
1259
|
+
<div class="select-wrapper">
|
|
1260
|
+
<button
|
|
1261
|
+
class=${we({"select-trigger":!0,"select-trigger--open":this._isOpen,"select-trigger--invalid":this._touched&&this.required&&!this.value})}
|
|
1262
|
+
type="button"
|
|
1263
|
+
?disabled=${this.disabled}
|
|
1264
|
+
aria-haspopup="listbox"
|
|
1265
|
+
aria-expanded=${this._isOpen}
|
|
1266
|
+
@click=${this._toggle}
|
|
1267
|
+
@blur=${this._handleBlur}
|
|
1268
|
+
>
|
|
1269
|
+
<span class=${we({"select-value":!0,"select-placeholder":!t})}>
|
|
1270
|
+
${t||this.placeholder}
|
|
1271
|
+
</span>
|
|
1272
|
+
<svg
|
|
1273
|
+
class=${we({"chevron-icon":!0,"select-icon":!0,"select-icon--open":this._isOpen})}
|
|
1274
|
+
viewBox="0 0 24 24"
|
|
1275
|
+
fill="currentColor"
|
|
1276
|
+
>
|
|
1277
|
+
<path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6z"/>
|
|
1278
|
+
</svg>
|
|
1279
|
+
</button>
|
|
1280
|
+
|
|
1281
|
+
<div class=${we({"select-dropdown":!0,hidden:!this._isOpen})} role="listbox">
|
|
1282
|
+
<div class="select-options">
|
|
1283
|
+
${0===e.length?V`<div class="select-empty">No options available</div>`:e.map(((e,t)=>{const i=e.value===this.value;return V`
|
|
1284
|
+
<div
|
|
1285
|
+
class=${we({"select-option":!0,"select-option--selected":i,"select-option--disabled":e.disabled,"select-option--highlighted":t===this._highlightedIndex})}
|
|
1286
|
+
role="option"
|
|
1287
|
+
aria-selected=${i}
|
|
1288
|
+
@click=${()=>this._selectOption(e)}
|
|
1289
|
+
@mouseenter=${()=>this._highlightedIndex=t}
|
|
1290
|
+
>
|
|
1291
|
+
${e.label}
|
|
1292
|
+
</div>
|
|
1293
|
+
`}))}
|
|
1294
|
+
</div>
|
|
1295
|
+
</div>
|
|
1296
|
+
</div>
|
|
1297
|
+
${this._touched&&this.required&&!this.value?V`<div class="validation-message">Please select an option</div>`:this.hint?V`<div class="hint">${this.hint}</div>`:""}
|
|
1298
|
+
</div>
|
|
1299
|
+
<div class="options-slot">
|
|
1300
|
+
<slot @slotchange=${()=>this.requestUpdate()}></slot>
|
|
1301
|
+
</div>
|
|
1302
|
+
`}focus(){this._triggerElement?.focus()}blur(){this._triggerElement?.blur()}};Qe.styles=[ne,r`
|
|
1303
|
+
:host {
|
|
1304
|
+
display: block;
|
|
1305
|
+
font-family: inherit;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
.wrapper {
|
|
1309
|
+
display: flex;
|
|
1310
|
+
flex-direction: column;
|
|
1311
|
+
gap: 6px;
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
label {
|
|
1315
|
+
font-size: 14px;
|
|
1316
|
+
font-weight: 500;
|
|
1317
|
+
color: black;
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
.required {
|
|
1321
|
+
color: var(--kr-select-required-color, #ef4444);
|
|
1322
|
+
margin-left: 0.125rem;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
.select-wrapper {
|
|
1326
|
+
position: relative;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
.select-trigger {
|
|
1330
|
+
display: flex;
|
|
1331
|
+
align-items: center;
|
|
1332
|
+
justify-content: space-between;
|
|
1333
|
+
width: 100%;
|
|
1334
|
+
padding: var(--kr-select-padding, 10px 12px);
|
|
1335
|
+
font-family: inherit;
|
|
1336
|
+
font-size: 14px;
|
|
1337
|
+
line-height: 1.5;
|
|
1338
|
+
color: #000000;
|
|
1339
|
+
background-color: var(--kr-select-bg, #fff);
|
|
1340
|
+
border: 1px solid var(--kr-select-border-color, #0000003d);
|
|
1341
|
+
border-radius: 8px;
|
|
1342
|
+
cursor: pointer;
|
|
1343
|
+
transition: border-color 0.2s, box-shadow 0.2s;
|
|
1344
|
+
text-align: left;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
.select-trigger:hover:not(:disabled) {
|
|
1348
|
+
border-color: var(--kr-select-hover-border-color, #9ca3af);
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
.select-trigger:focus {
|
|
1352
|
+
outline: none;
|
|
1353
|
+
border-color: var(--kr-primary);
|
|
1354
|
+
box-shadow: 0 0 0 3px rgba(22, 48, 82, 0.1);
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
.select-trigger:disabled {
|
|
1358
|
+
background-color: var(--kr-select-disabled-bg, #f3f4f6);
|
|
1359
|
+
color: var(--kr-select-disabled-color, #9ca3af);
|
|
1360
|
+
cursor: not-allowed;
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
.select-trigger--invalid {
|
|
1364
|
+
border-color: var(--kr-select-error-border-color, #ef4444);
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
.select-trigger--invalid:focus {
|
|
1368
|
+
border-color: var(--kr-select-error-border-color, #ef4444);
|
|
1369
|
+
box-shadow: 0 0 0 3px var(--kr-select-error-ring-color, rgba(239, 68, 68, 0.1));
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
.select-trigger--open {
|
|
1373
|
+
border-color: var(--kr-primary);
|
|
1374
|
+
box-shadow: 0 0 0 3px rgba(22, 48, 82, 0.1);
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
.select-value {
|
|
1378
|
+
flex: 1;
|
|
1379
|
+
overflow: hidden;
|
|
1380
|
+
text-overflow: ellipsis;
|
|
1381
|
+
white-space: nowrap;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
.select-placeholder {
|
|
1385
|
+
color: #9ca3af;
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
.select-icon {
|
|
1389
|
+
flex-shrink: 0;
|
|
1390
|
+
margin-left: 0.5rem;
|
|
1391
|
+
color: #6b7280;
|
|
1392
|
+
transition: transform 0.2s;
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
.select-icon--open {
|
|
1396
|
+
transform: rotate(180deg);
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
.select-dropdown {
|
|
1400
|
+
position: fixed;
|
|
1401
|
+
z-index: 10000;
|
|
1402
|
+
background: white;
|
|
1403
|
+
border: 1px solid #9ba7b6;
|
|
1404
|
+
border-radius: 8px;
|
|
1405
|
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
|
|
1406
|
+
padding: 8px 0;
|
|
1407
|
+
overflow-y: auto;
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
.select-options {
|
|
1411
|
+
padding: 0;
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
.select-option {
|
|
1415
|
+
display: flex;
|
|
1416
|
+
align-items: center;
|
|
1417
|
+
min-height: 36px;
|
|
1418
|
+
padding: 8px 16px;
|
|
1419
|
+
font-size: 14px;
|
|
1420
|
+
color: #000000;
|
|
1421
|
+
cursor: pointer;
|
|
1422
|
+
border-radius: 4px;
|
|
1423
|
+
transition: background-color 0.15s;
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
.select-option:hover:not(.select-option--disabled) {
|
|
1427
|
+
background-color: var(--kr-select-option-hover-bg, #f3f4f6);
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
.select-option--selected {
|
|
1431
|
+
background-color: rgba(22, 48, 82, 0.08);
|
|
1432
|
+
color: var(--kr-primary);
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
.select-option--selected:hover {
|
|
1436
|
+
background-color: rgba(22, 48, 82, 0.12);
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
.select-option--disabled {
|
|
1440
|
+
color: var(--kr-select-option-disabled-color, #9ca3af);
|
|
1441
|
+
cursor: not-allowed;
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
.select-option--highlighted {
|
|
1445
|
+
background-color: var(--kr-select-option-hover-bg, #f3f4f6);
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
.select-empty {
|
|
1449
|
+
padding: 1rem;
|
|
1450
|
+
text-align: center;
|
|
1451
|
+
color: var(--kr-select-empty-color, #6b7280);
|
|
1452
|
+
font-size: 14px;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
.hint {
|
|
1456
|
+
font-size: 0.75rem;
|
|
1457
|
+
color: var(--kr-select-helper-color, #6b7280);
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
.validation-message {
|
|
1461
|
+
font-size: 0.75rem;
|
|
1462
|
+
color: var(--kr-select-error-color, #ef4444);
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
.hidden {
|
|
1466
|
+
display: none;
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
.chevron-icon {
|
|
1470
|
+
width: 20px;
|
|
1471
|
+
height: 20px;
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
/* Hide the slot - options are rendered in dropdown */
|
|
1475
|
+
.options-slot {
|
|
1476
|
+
display: none;
|
|
1477
|
+
}
|
|
1478
|
+
`],Qe.formAssociated=!0,Ze([pe({type:String})],Qe.prototype,"label",void 0),Ze([pe({type:String})],Qe.prototype,"name",void 0),Ze([pe({type:String})],Qe.prototype,"value",void 0),Ze([pe({type:String})],Qe.prototype,"placeholder",void 0),Ze([pe({type:Boolean})],Qe.prototype,"disabled",void 0),Ze([pe({type:Boolean})],Qe.prototype,"required",void 0),Ze([pe({type:Boolean})],Qe.prototype,"readonly",void 0),Ze([pe({type:String})],Qe.prototype,"hint",void 0),Ze([ue()],Qe.prototype,"_isOpen",void 0),Ze([ue()],Qe.prototype,"_highlightedIndex",void 0),Ze([ue()],Qe.prototype,"_touched",void 0),Ze([fe(".select-trigger")],Qe.prototype,"_triggerElement",void 0),Qe=Ze([de("kr-select-field")],Qe);var Ge=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 Je=class extends ae{constructor(){super(...arguments),this.value="",this.disabled=!1}get label(){return this.textContent?.trim()||""}render(){return V`<slot></slot>`}};Je.styles=r`
|
|
1479
|
+
:host {
|
|
1480
|
+
display: none;
|
|
1481
|
+
}
|
|
1482
|
+
`,Ge([pe({type:String})],Je.prototype,"value",void 0),Ge([pe({type:Boolean})],Je.prototype,"disabled",void 0),Je=Ge([de("kr-select-option")],Je);const et={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"},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 tt(e){const t=[];for(const i of Object.values(et))i.dataTypes.includes(e)&&t.push({key:i.key,label:i.label});return t}const it=['"',"+","-","&&","||","!","(",")","{","}","[","]","^","~","*","?",":"],st=['\\"',"\\+","\\-","\\&\\&","\\|\\|","\\!","\\(","\\)","\\{","\\}","\\[","\\]","\\^","\\~","\\*","\\?","\\:"];function ot(e,t=!0){return!0===e||!1===e?e.toString():null===e?"(*:* NOT *)":"number"==typeof e?e.toString():"string"==typeof e?(it.forEach(((t,i)=>{var s;e=e.replace(new RegExp(`${s=t,"string"!=typeof s?s:s.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}`,"g"),st[i])})),t?`"${e}"`:e.replace(/ /g,"\\ ")):e}function rt(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 at(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 lt(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 nt(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 dt{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=[nt(this.text)];else if(e.startsWith("!="))this.operator="n_equals",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[nt(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=[nt(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=[nt(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=[nt(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=[nt(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=[nt(this.text)];else if(e.startsWith("<"))this.operator="less_than",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[nt(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=[nt(this.text)];else if(e.startsWith(">"))this.operator="greater_than",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[nt(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=[nt(i),nt(s)]}else 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=[nt(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=[nt(this.text)]):(this.operator="contains",this.text=e,this.value=this._parse(this.text),this.specificity=[nt(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&&(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&&(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?!this.value?.length:void 0===this.value||null===this.value||""===this.value}has(e){return!("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&&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?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=at(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=at(this.value,this.specificity)):(e.operation="IS",e.not=!0,e.value=this.value);break;case"contains":e.operation="EXPRESSION",e.value=`*${ot(this.value,!1)}*`;break;case"n_contains":e.operation="EXPRESSION",e.not=!0,e.value=`*${ot(this.value,!1)}*`;break;case"starts_with":e.operation="EXPRESSION",e.value=`${ot(this.value,!1)}*`;break;case"ends_with":e.operation="EXPRESSION",e.value=`*${ot(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 ${rt(this.value)}}`):(e.operation="EXPRESSION",e.value=`[* TO ${ot(this.value,!0)}}`);break;case"less_than_equal":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[* TO ${rt(this.value,!0)}]`):(e.operation="EXPRESSION",e.value=`[* TO ${ot(this.value,!0)}]`);break;case"greater_than":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`{${rt(this.value,!0)} TO *]`):(e.operation="EXPRESSION",e.value=`{${ot(this.value,!0)} TO *]`);break;case"greater_than_equal":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[${rt(this.value)} TO *]`):(e.operation="EXPRESSION",e.value=`[${ot(this.value,!0)} TO *]`);break;case"between":this.value?.start instanceof Date&&this.value?.end instanceof Date?(e.operation="EXPRESSION",e.value=at(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=>ot(e,!0))).join(" OR ")})`):(e.operation="EXPRESSION",e.value=ot(this.value,!0));break;default:e.operation="EXPRESSION",e.value=ot(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=lt(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=lt(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=lt(this.value,this.specificity):e.values=[this.value.start,this.value.end];break;case"in":e.operation="IN",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?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;default:throw Error(`Unknown operator ${this.operator}`)}}}var ct=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 ht{constructor(){this.title="",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 pt=class extends ae{constructor(){super(...arguments),this._scrollStyle="overlay",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._resizing=null,this._resizeObserver=null,this._searchPositionLocked=!1,this._model=new ht,this.def={columns:[]},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._model=new ht,this.def.title&&(this._model.title=this.def.title),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.def.rowClickable&&(this._model.rowClickable=this.def.rowClickable),this.def.rowHref&&(this._model.rowHref=this.def.rowHref),this._model.columns=this.def.columns.map((e=>{const t={...e,filter:null};return t.type||(t.type="string"),"actions"===t.type?(t.label=e.label??"",t.sticky="right",t.resizable=!1,t):((e.filterable||e.facetable)&&(t.filter=new dt,t.filter.field=e.id,t.filter.type=t.type,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._updateScrollFlags(),this._syncSlottedContent()}_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:[],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&&(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:ot(this._searchQuery,!1)}),e}_toDbParams(){const e={page:this._page-1,size:this._pageSize,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",Fe.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&&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;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]}_handleRowMouseDown(){this._model.rowClickable&&window.getSelection()?.removeAllRanges()}_handleRowClick(e,t){if(!this._model.rowClickable)return;const i=window.getSelection();i&&i.toString().length>0||this.dispatchEvent(new CustomEvent("row-click",{detail:{row:e,rowIndex:t},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)}_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();this._filterPanelPos={top:i.bottom+4,left:i.left},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 V`<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--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 V`
|
|
1252
1483
|
<div class="pagination">
|
|
1253
1484
|
<span
|
|
1254
1485
|
class="pagination-icon ${1===this._page?"pagination-icon--disabled":""}"
|
|
@@ -1264,10 +1495,10 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
1264
1495
|
<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>
|
|
1265
1496
|
</span>
|
|
1266
1497
|
</div>
|
|
1267
|
-
`}_renderHeader(){return!this.
|
|
1498
|
+
`}_renderHeader(){return!this._model.title&&!this._model.actions?.length&&this._totalPages<=1?B:V`
|
|
1268
1499
|
<div class="header">
|
|
1269
|
-
<div class="title">${this.
|
|
1270
|
-
${"db"!==this.
|
|
1500
|
+
<div class="title">${this._model.title??""}</div>
|
|
1501
|
+
${"db"!==this._model.dataSource?.mode||this._model.columns.some((e=>e.searchable))?V`
|
|
1271
1502
|
<div class="search">
|
|
1272
1503
|
<!-- TODO: Saved views dropdown
|
|
1273
1504
|
<div class="views">
|
|
@@ -1286,7 +1517,7 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
1286
1517
|
/>
|
|
1287
1518
|
</div>
|
|
1288
1519
|
</div>
|
|
1289
|
-
`:
|
|
1520
|
+
`:V`<div class="search"></div>`}
|
|
1290
1521
|
<div class="tools">
|
|
1291
1522
|
${this._renderPagination()}
|
|
1292
1523
|
<span class="refresh" title="Refresh" @click=${()=>this.refresh()}>
|
|
@@ -1297,9 +1528,9 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
1297
1528
|
<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>
|
|
1298
1529
|
</span>
|
|
1299
1530
|
<div class="column-picker ${this._columnPickerOpen?"open":""}">
|
|
1300
|
-
${[...this.
|
|
1531
|
+
${[...this._model.columns].filter((e=>"actions"!==e.type)).sort(((e,t)=>(e.label??e.id).localeCompare(t.label??t.id))).map((e=>V`
|
|
1301
1532
|
<div class="column-picker-item" @click=${()=>this._toggleColumn(e.id)}>
|
|
1302
|
-
<div class="column-picker-checkbox ${this.
|
|
1533
|
+
<div class="column-picker-checkbox ${this._model.displayedColumns.includes(e.id)?"checked":""}">
|
|
1303
1534
|
<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>
|
|
1304
1535
|
</div>
|
|
1305
1536
|
<span class="column-picker-label">${e.label??e.id}</span>
|
|
@@ -1307,27 +1538,206 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
1307
1538
|
`))}
|
|
1308
1539
|
</div>
|
|
1309
1540
|
</div>
|
|
1310
|
-
${1===this.
|
|
1541
|
+
${1===this._model.actions?.length?V`
|
|
1311
1542
|
<kr-button
|
|
1312
1543
|
class="actions"
|
|
1313
|
-
.href=${this.
|
|
1314
|
-
.target=${this.
|
|
1315
|
-
@click=${()=>this._handleAction(this.
|
|
1544
|
+
.href=${this._model.actions[0].href}
|
|
1545
|
+
.target=${this._model.actions[0].target}
|
|
1546
|
+
@click=${()=>this._handleAction(this._model.actions[0])}
|
|
1316
1547
|
>
|
|
1317
|
-
${this.
|
|
1548
|
+
${this._model.actions[0].label}
|
|
1318
1549
|
</kr-button>
|
|
1319
|
-
`:this.
|
|
1550
|
+
`:this._model.actions?.length?V`
|
|
1320
1551
|
<kr-button
|
|
1321
1552
|
class="actions"
|
|
1322
|
-
.options=${this.
|
|
1553
|
+
.options=${this._model.actions.map((e=>({id:e.id,label:e.label})))}
|
|
1323
1554
|
@option-select=${e=>this._handleAction({id:e.detail.id,label:e.detail.label})}
|
|
1324
1555
|
>
|
|
1325
1556
|
Actions
|
|
1326
1557
|
</kr-button>
|
|
1327
|
-
`:
|
|
1558
|
+
`:B}
|
|
1328
1559
|
</div>
|
|
1329
1560
|
</div>
|
|
1330
|
-
`}_renderStatus(){return"loading"===this._dataState&&0===this._data.length?
|
|
1561
|
+
`}_renderStatus(){return"loading"===this._dataState&&0===this._data.length?V`<div class="status">Loading...</div>`:"error"===this._dataState&&0===this._data.length?V`<div class="status status--error">Error loading data</div>`:0===this._data.length?V`<div class="status">No data available</div>`:B}_renderFilterPanel(){if(!this._filterPanelOpened)return B;const e=this._model.columns.find((e=>e.id===this._filterPanelOpened));let t=V``;t="empty"===e.filter.operator||"n_empty"===e.filter.operator?V`
|
|
1562
|
+
<input
|
|
1563
|
+
type="text"
|
|
1564
|
+
class="filter-panel__input"
|
|
1565
|
+
disabled
|
|
1566
|
+
.value=${e.filter.text}
|
|
1567
|
+
/>
|
|
1568
|
+
`:"between"===e.filter.operator&&"date"===e.type?V`
|
|
1569
|
+
<input
|
|
1570
|
+
type="date"
|
|
1571
|
+
class="filter-panel__input"
|
|
1572
|
+
.valueAsDate=${e.filter.value?.start??null}
|
|
1573
|
+
@change=${t=>this._handleFilterDateStartChange(t,e)}
|
|
1574
|
+
/>
|
|
1575
|
+
<input
|
|
1576
|
+
type="date"
|
|
1577
|
+
class="filter-panel__input"
|
|
1578
|
+
.valueAsDate=${e.filter.value?.end??null}
|
|
1579
|
+
@change=${t=>this._handleFilterDateEndChange(t,e)}
|
|
1580
|
+
/>
|
|
1581
|
+
`:"between"===e.filter.operator&&"number"===e.type?V`
|
|
1582
|
+
<input
|
|
1583
|
+
type="number"
|
|
1584
|
+
class="filter-panel__input"
|
|
1585
|
+
placeholder="Start"
|
|
1586
|
+
.value=${e.filter.value?.start??""}
|
|
1587
|
+
@input=${t=>this._handleFilterNumberStartChange(t,e)}
|
|
1588
|
+
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
1589
|
+
/>
|
|
1590
|
+
<input
|
|
1591
|
+
type="number"
|
|
1592
|
+
class="filter-panel__input"
|
|
1593
|
+
placeholder="End"
|
|
1594
|
+
.value=${e.filter.value?.end??""}
|
|
1595
|
+
@input=${t=>this._handleFilterNumberEndChange(t,e)}
|
|
1596
|
+
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
1597
|
+
/>
|
|
1598
|
+
`:"in"===e.filter.operator?V`
|
|
1599
|
+
<textarea
|
|
1600
|
+
class="filter-panel__textarea"
|
|
1601
|
+
rows="3"
|
|
1602
|
+
placeholder="Values (comma-separated)"
|
|
1603
|
+
.value=${e.filter.text}
|
|
1604
|
+
@input=${t=>this._handleFilterListChange(t,e)}
|
|
1605
|
+
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
1606
|
+
></textarea>
|
|
1607
|
+
`:"boolean"===e.type?V`
|
|
1608
|
+
<kr-select-field
|
|
1609
|
+
placeholder="Value"
|
|
1610
|
+
.value=${String(e.filter.value??"")}
|
|
1611
|
+
@change=${t=>this._handleFilterBooleanChange(t,e)}
|
|
1612
|
+
>
|
|
1613
|
+
<kr-select-option value="true">Yes</kr-select-option>
|
|
1614
|
+
<kr-select-option value="false">No</kr-select-option>
|
|
1615
|
+
</kr-select-field>
|
|
1616
|
+
`:"date"===e.type?V`
|
|
1617
|
+
<input
|
|
1618
|
+
type="date"
|
|
1619
|
+
class="filter-panel__input"
|
|
1620
|
+
.valueAsDate=${e.filter.value}
|
|
1621
|
+
@change=${t=>this._handleFilterDateChange(t,e)}
|
|
1622
|
+
/>
|
|
1623
|
+
`:"number"===e.type?V`
|
|
1624
|
+
<input
|
|
1625
|
+
type="number"
|
|
1626
|
+
class="filter-panel__input"
|
|
1627
|
+
placeholder="Value"
|
|
1628
|
+
min="0"
|
|
1629
|
+
.value=${e.filter.text}
|
|
1630
|
+
@input=${t=>this._handleFilterNumberChange(t,e)}
|
|
1631
|
+
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
1632
|
+
/>
|
|
1633
|
+
`:V`
|
|
1634
|
+
<input
|
|
1635
|
+
type="text"
|
|
1636
|
+
class="filter-panel__input"
|
|
1637
|
+
placeholder="Value"
|
|
1638
|
+
.value=${e.filter.text}
|
|
1639
|
+
@input=${t=>this._handleFilterStringChange(t,e)}
|
|
1640
|
+
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
1641
|
+
/>
|
|
1642
|
+
`;const i=V`
|
|
1643
|
+
<div class="filter-panel__content">
|
|
1644
|
+
<kr-select-field
|
|
1645
|
+
.value=${e.filter.operator}
|
|
1646
|
+
@change=${t=>this._handleOperatorChange(t,e)}
|
|
1647
|
+
>
|
|
1648
|
+
${tt(e.type).map((e=>V`
|
|
1649
|
+
<kr-select-option value=${e.key}>${e.label}</kr-select-option>
|
|
1650
|
+
`))}
|
|
1651
|
+
</kr-select-field>
|
|
1652
|
+
${t}
|
|
1653
|
+
</div>
|
|
1654
|
+
`,s=this._buckets.get(e.id)||[];let o,r;return o=s.length?V`
|
|
1655
|
+
<div class="buckets">
|
|
1656
|
+
${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=B;return e.filter.has(t.val)&&(s=V`
|
|
1657
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
1658
|
+
<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/>
|
|
1659
|
+
</svg>
|
|
1660
|
+
`),V`
|
|
1661
|
+
<div
|
|
1662
|
+
class="bucket"
|
|
1663
|
+
@click=${i=>this._handleBucketToggle(i,e,t)}
|
|
1664
|
+
>
|
|
1665
|
+
<div class=${we({bucket__checkbox:!0,"bucket__checkbox--checked":e.filter.has(t.val)})}>
|
|
1666
|
+
${s}
|
|
1667
|
+
</div>
|
|
1668
|
+
<span class="bucket__label">${i}</span>
|
|
1669
|
+
<span class="bucket__count">${t.count}</span>
|
|
1670
|
+
</div>
|
|
1671
|
+
`}))}
|
|
1672
|
+
</div>
|
|
1673
|
+
`:V`<div class="bucket-empty">No data</div>`,r=e.facetable&&e.filterable?V`
|
|
1674
|
+
<kr-tab-group
|
|
1675
|
+
size="small"
|
|
1676
|
+
active-tab-id=${this._filterPanelTab}
|
|
1677
|
+
@tab-change=${e=>this._handleFilterPanelTabChange(e)}
|
|
1678
|
+
>
|
|
1679
|
+
<kr-tab id="filter" label="Filter">
|
|
1680
|
+
${i}
|
|
1681
|
+
</kr-tab>
|
|
1682
|
+
<kr-tab id="counts" label="Counts">
|
|
1683
|
+
${o}
|
|
1684
|
+
</kr-tab>
|
|
1685
|
+
</kr-tab-group>
|
|
1686
|
+
`:e.facetable?o:i,V`
|
|
1687
|
+
<div
|
|
1688
|
+
class="filter-panel"
|
|
1689
|
+
style=${Ie({top:this._filterPanelPos.top+"px",left:this._filterPanelPos.left+"px"})}
|
|
1690
|
+
>
|
|
1691
|
+
${r}
|
|
1692
|
+
<div class="filter-panel__actions">
|
|
1693
|
+
<kr-button variant="outline" color="secondary" size="small" @click=${this._handleFilterClear}>
|
|
1694
|
+
Clear
|
|
1695
|
+
</kr-button>
|
|
1696
|
+
<kr-button size="small" @click=${this._handleFilterApply}>
|
|
1697
|
+
Apply
|
|
1698
|
+
</kr-button>
|
|
1699
|
+
</div>
|
|
1700
|
+
</div>
|
|
1701
|
+
`}_renderFilterRow(){const e=this.getDisplayedColumns();return e.some((e=>e.filterable||e.facetable))?V`
|
|
1702
|
+
<div class="filter-row">
|
|
1703
|
+
${e.map(((t,i)=>t.filterable||t.facetable?V`
|
|
1704
|
+
<div
|
|
1705
|
+
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))})}
|
|
1706
|
+
style=${Ie(this._getCellStyle(t,i))}
|
|
1707
|
+
>
|
|
1708
|
+
<div class="filter-cell__wrapper">
|
|
1709
|
+
<input
|
|
1710
|
+
type="text"
|
|
1711
|
+
class=${we({"filter-cell__input":!0,"filter-cell__input--invalid":!t.filter.isValid()})}
|
|
1712
|
+
.value=${t.filter.kql}
|
|
1713
|
+
@change=${e=>this._handleKqlChange(e,t)}
|
|
1714
|
+
/>
|
|
1715
|
+
${t.filter?.kql?.length>0?V`
|
|
1716
|
+
<button
|
|
1717
|
+
class="filter-cell__clear"
|
|
1718
|
+
@click=${()=>this._handleKqlClear(t)}
|
|
1719
|
+
>
|
|
1720
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
1721
|
+
<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"/>
|
|
1722
|
+
</svg>
|
|
1723
|
+
</button>
|
|
1724
|
+
`:B}
|
|
1725
|
+
<button
|
|
1726
|
+
class=${we({"filter-cell__advanced":!0,"filter-cell__advanced--opened":this._filterPanelOpened===t.id})}
|
|
1727
|
+
@click=${e=>this._handleFilterPanelToggle(e,t)}
|
|
1728
|
+
>
|
|
1729
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
1730
|
+
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
|
|
1731
|
+
</svg>
|
|
1732
|
+
</button>
|
|
1733
|
+
</div>
|
|
1734
|
+
</div>
|
|
1735
|
+
`:V`<div
|
|
1736
|
+
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))})}
|
|
1737
|
+
style=${Ie(this._getCellStyle(t,i))}
|
|
1738
|
+
></div>`))}
|
|
1739
|
+
</div>
|
|
1740
|
+
`:B}_renderTable(){return V`
|
|
1331
1741
|
<div class="wrapper">
|
|
1332
1742
|
<div class="overlay-left"></div>
|
|
1333
1743
|
<div class="overlay-right"></div>
|
|
@@ -1335,35 +1745,36 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
1335
1745
|
<div class="content" @scroll=${this._handleScroll}>
|
|
1336
1746
|
<div class="table" style="grid-template-columns: ${this._getGridTemplateColumns()}">
|
|
1337
1747
|
<div class="header-row">
|
|
1338
|
-
${this.getDisplayedColumns().map(((e,t)=>
|
|
1748
|
+
${this.getDisplayedColumns().map(((e,t)=>V`
|
|
1339
1749
|
<div
|
|
1340
1750
|
class=${we(this._getHeaderCellClasses(e,t))}
|
|
1341
|
-
style=${
|
|
1751
|
+
style=${Ie(this._getCellStyle(e,t))}
|
|
1342
1752
|
data-column-id=${e.id}
|
|
1343
|
-
>${e.label??e.id}${!1!==e.resizable?
|
|
1753
|
+
>${e.label??e.id}${!1!==e.resizable?V`<div
|
|
1344
1754
|
class="header-cell__resize"
|
|
1345
1755
|
@mousedown=${t=>this._handleResizeStart(t,e.id)}
|
|
1346
|
-
></div>`:
|
|
1756
|
+
></div>`:B}</div>
|
|
1347
1757
|
`))}
|
|
1348
1758
|
</div>
|
|
1349
|
-
${this.
|
|
1759
|
+
${this._renderFilterRow()}
|
|
1760
|
+
${this._data.map(((e,t)=>{const i=this.getDisplayedColumns().map(((i,s)=>V`
|
|
1350
1761
|
<div
|
|
1351
|
-
class=${we(this._getCellClasses(i,
|
|
1352
|
-
style=${
|
|
1762
|
+
class=${we(this._getCellClasses(i,s))}
|
|
1763
|
+
style=${Ie(this._getCellStyle(i,s))}
|
|
1353
1764
|
data-column-id=${i.id}
|
|
1354
1765
|
>
|
|
1355
1766
|
${this._renderCellContent(i,e,t)}
|
|
1356
1767
|
</div>
|
|
1357
|
-
`));return this.
|
|
1768
|
+
`));return this._model.rowHref?V`
|
|
1358
1769
|
<a
|
|
1359
|
-
href=${this.
|
|
1770
|
+
href=${this._model.rowHref(e)}
|
|
1360
1771
|
class=${we({row:!0,"row--clickable":!0,"row--link":!0})}
|
|
1361
1772
|
@mousedown=${()=>this._handleRowMouseDown()}
|
|
1362
1773
|
@click=${()=>this._handleRowClick(e,t)}
|
|
1363
1774
|
>${i}</a>
|
|
1364
|
-
`:
|
|
1775
|
+
`:V`
|
|
1365
1776
|
<div
|
|
1366
|
-
class=${we({row:!0,"row--clickable":!!this.
|
|
1777
|
+
class=${we({row:!0,"row--clickable":!!this._model.rowClickable})}
|
|
1367
1778
|
@mousedown=${()=>this._handleRowMouseDown()}
|
|
1368
1779
|
@click=${()=>this._handleRowClick(e,t)}
|
|
1369
1780
|
>${i}</div>
|
|
@@ -1371,10 +1782,11 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
1371
1782
|
</div>
|
|
1372
1783
|
</div>
|
|
1373
1784
|
</div>
|
|
1374
|
-
`}render(){return this.
|
|
1785
|
+
`}render(){return this._model.columns.length?V`
|
|
1375
1786
|
${this._renderHeader()}
|
|
1376
1787
|
${this._renderTable()}
|
|
1377
|
-
|
|
1788
|
+
${this._renderFilterPanel()}
|
|
1789
|
+
`:V`<slot></slot>`}};pt.styles=[ne,r`
|
|
1378
1790
|
/* -------------------------------------------------------------------------
|
|
1379
1791
|
* Host
|
|
1380
1792
|
* ----------------------------------------------------------------------- */
|
|
@@ -1719,6 +2131,7 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
1719
2131
|
overflow: hidden;
|
|
1720
2132
|
text-overflow: ellipsis;
|
|
1721
2133
|
box-sizing: border-box;
|
|
2134
|
+
border-right: 1px solid #e5e7ebba;
|
|
1722
2135
|
}
|
|
1723
2136
|
|
|
1724
2137
|
.cell--actions {
|
|
@@ -1735,7 +2148,9 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
1735
2148
|
white-space: nowrap;
|
|
1736
2149
|
box-sizing: border-box;
|
|
1737
2150
|
background: #f9fafb;
|
|
2151
|
+
border-top: 1px solid #e5e7eb;
|
|
1738
2152
|
border-bottom: 2px solid #e5e7eb;
|
|
2153
|
+
border-right: 1px solid #e5e7ebba;
|
|
1739
2154
|
font-weight: 600;
|
|
1740
2155
|
color: #374151;
|
|
1741
2156
|
overflow: hidden;
|
|
@@ -1833,7 +2248,6 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
1833
2248
|
* ----------------------------------------------------------------------- */
|
|
1834
2249
|
:host(.kr-table--scroll-overlay) .content {
|
|
1835
2250
|
padding-left: 24px;
|
|
1836
|
-
padding-right: 24px;
|
|
1837
2251
|
}
|
|
1838
2252
|
|
|
1839
2253
|
.overlay-left,
|
|
@@ -1863,36 +2277,331 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
1863
2277
|
background: #fff;
|
|
1864
2278
|
}
|
|
1865
2279
|
|
|
1866
|
-
:host(.kr-table--scroll-overlay.kr-table--scroll-left-available:not(.kr-table--sticky-left)) .overlay-left {
|
|
1867
|
-
border-right: 1px solid #d1d5db54;
|
|
2280
|
+
:host(.kr-table--scroll-overlay.kr-table--scroll-left-available:not(.kr-table--sticky-left)) .overlay-left {
|
|
2281
|
+
border-right: 1px solid #d1d5db54;
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
:host(.kr-table--scroll-overlay.kr-table--scroll-right-available:not(.kr-table--sticky-right)) .overlay-right {
|
|
2285
|
+
border-left: 1px solid #d1d5db54;
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
/* -------------------------------------------------------------------------
|
|
2289
|
+
* Status (Loading, Error, Empty)
|
|
2290
|
+
* ----------------------------------------------------------------------- */
|
|
2291
|
+
.status {
|
|
2292
|
+
position: absolute;
|
|
2293
|
+
top: 0;
|
|
2294
|
+
left: 0;
|
|
2295
|
+
right: 0;
|
|
2296
|
+
bottom: 0;
|
|
2297
|
+
display: flex;
|
|
2298
|
+
align-items: center;
|
|
2299
|
+
justify-content: center;
|
|
2300
|
+
font-size: 14px;
|
|
2301
|
+
font-weight: 400;
|
|
2302
|
+
color: #5f6368;
|
|
2303
|
+
pointer-events: none;
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
.status--error {
|
|
2307
|
+
color: #dc2626;
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
/* -------------------------------------------------------------------------
|
|
2311
|
+
* Filter Row
|
|
2312
|
+
* ----------------------------------------------------------------------- */
|
|
2313
|
+
.filter-row {
|
|
2314
|
+
display: contents;
|
|
2315
|
+
}
|
|
2316
|
+
|
|
2317
|
+
.filter-cell {
|
|
2318
|
+
position: sticky;
|
|
2319
|
+
top: 48px;
|
|
2320
|
+
z-index: 2;
|
|
2321
|
+
height: 40px;
|
|
2322
|
+
padding: 4px 8px;
|
|
2323
|
+
display: flex;
|
|
2324
|
+
align-items: center;
|
|
2325
|
+
background: #fafbfc;
|
|
2326
|
+
border-bottom: 1px solid #e5e7eb;
|
|
2327
|
+
border-right: 1px solid #e5e7ebba;
|
|
2328
|
+
box-sizing: border-box;
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
|
|
2332
|
+
.filter-cell--sticky-left,
|
|
2333
|
+
.filter-cell--sticky-right {
|
|
2334
|
+
position: sticky;
|
|
2335
|
+
z-index: 3;
|
|
2336
|
+
}
|
|
2337
|
+
|
|
2338
|
+
.filter-cell--sticky-right-first {
|
|
2339
|
+
border-left: 1px solid #d1d5db;
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2342
|
+
.filter-cell__wrapper {
|
|
2343
|
+
position: relative;
|
|
2344
|
+
display: flex;
|
|
2345
|
+
align-items: center;
|
|
2346
|
+
gap: 4px;
|
|
2347
|
+
width: 100%;
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
.filter-cell__input {
|
|
2351
|
+
width: 100%;
|
|
2352
|
+
height: 32px;
|
|
2353
|
+
padding: 0 52px 0 8px;
|
|
2354
|
+
border: 1px solid #d1d5db;
|
|
2355
|
+
border-radius: 6px;
|
|
2356
|
+
font-size: 14px;
|
|
2357
|
+
font-family: inherit;
|
|
2358
|
+
color: #111827;
|
|
2359
|
+
background: #fff;
|
|
2360
|
+
outline: none;
|
|
2361
|
+
transition: border-color 0.2s, box-shadow 0.2s;
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2364
|
+
.filter-cell__input:focus {
|
|
2365
|
+
border-color: #163052;
|
|
2366
|
+
box-shadow: 0 0 0 2px rgba(22, 48, 82, 0.1);
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2369
|
+
.filter-cell__input--invalid {
|
|
2370
|
+
border-color: #dc2626;
|
|
2371
|
+
}
|
|
2372
|
+
|
|
2373
|
+
.filter-cell__input--invalid:focus {
|
|
2374
|
+
border-color: #dc2626;
|
|
2375
|
+
box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.1);
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2378
|
+
.filter-cell__input::placeholder {
|
|
2379
|
+
color: #9ca3af;
|
|
2380
|
+
font-size: 13px;
|
|
2381
|
+
}
|
|
2382
|
+
|
|
2383
|
+
.filter-cell__clear {
|
|
2384
|
+
position: absolute;
|
|
2385
|
+
right: 28px;
|
|
2386
|
+
top: 50%;
|
|
2387
|
+
transform: translateY(-50%);
|
|
2388
|
+
display: flex;
|
|
2389
|
+
align-items: center;
|
|
2390
|
+
justify-content: center;
|
|
2391
|
+
width: 24px;
|
|
2392
|
+
height: 24px;
|
|
2393
|
+
padding: 0;
|
|
2394
|
+
border: none;
|
|
2395
|
+
border-radius: 4px;
|
|
2396
|
+
background: transparent;
|
|
2397
|
+
color: #6b7280;
|
|
2398
|
+
cursor: pointer;
|
|
2399
|
+
transition: background 0.15s, color 0.15s;
|
|
2400
|
+
}
|
|
2401
|
+
|
|
2402
|
+
.filter-cell__clear:hover {
|
|
2403
|
+
background: #e5e7eb;
|
|
2404
|
+
color: #374151;
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2407
|
+
.filter-cell__clear svg {
|
|
2408
|
+
width: 16px;
|
|
2409
|
+
height: 16px;
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2412
|
+
.filter-cell__advanced {
|
|
2413
|
+
position: absolute;
|
|
2414
|
+
right: 4px;
|
|
2415
|
+
top: 50%;
|
|
2416
|
+
transform: translateY(-50%);
|
|
2417
|
+
display: flex;
|
|
2418
|
+
align-items: center;
|
|
2419
|
+
justify-content: center;
|
|
2420
|
+
width: 24px;
|
|
2421
|
+
height: 24px;
|
|
2422
|
+
padding: 0;
|
|
2423
|
+
border: none;
|
|
2424
|
+
border-radius: 4px;
|
|
2425
|
+
background: transparent;
|
|
2426
|
+
color: #163052;
|
|
2427
|
+
cursor: pointer;
|
|
2428
|
+
transition: background 0.15s, color 0.15s;
|
|
2429
|
+
}
|
|
2430
|
+
|
|
2431
|
+
.filter-cell__advanced:hover {
|
|
2432
|
+
background: #e5e7eb;
|
|
2433
|
+
}
|
|
2434
|
+
|
|
2435
|
+
.filter-cell__advanced svg {
|
|
2436
|
+
width: 16px;
|
|
2437
|
+
height: 16px;
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
.filter-cell__advanced--opened {
|
|
2441
|
+
background: #163052;
|
|
2442
|
+
color: #fff;
|
|
2443
|
+
}
|
|
2444
|
+
|
|
2445
|
+
.filter-cell__advanced--opened:hover {
|
|
2446
|
+
background: #1a3a5f;
|
|
2447
|
+
color: #fff;
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2450
|
+
/* -------------------------------------------------------------------------
|
|
2451
|
+
* Filter Panel (Advanced)
|
|
2452
|
+
* ----------------------------------------------------------------------- */
|
|
2453
|
+
.filter-panel {
|
|
2454
|
+
position: fixed;
|
|
2455
|
+
min-width: 320px;
|
|
2456
|
+
background: white;
|
|
2457
|
+
border: 1px solid #9ba7b6;
|
|
2458
|
+
border-radius: 8px;
|
|
2459
|
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
|
|
2460
|
+
z-index: 100;
|
|
2461
|
+
animation: filter-panel-fade-in 150ms ease-out;
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2464
|
+
@keyframes filter-panel-fade-in {
|
|
2465
|
+
from {
|
|
2466
|
+
opacity: 0;
|
|
2467
|
+
transform: translateY(-4px);
|
|
2468
|
+
}
|
|
2469
|
+
to {
|
|
2470
|
+
opacity: 1;
|
|
2471
|
+
transform: translateY(0);
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2475
|
+
.filter-panel__content {
|
|
2476
|
+
padding: 16px;
|
|
2477
|
+
display: flex;
|
|
2478
|
+
flex-direction: column;
|
|
2479
|
+
gap: 12px;
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
.filter-panel__actions {
|
|
2483
|
+
padding: 12px 16px;
|
|
2484
|
+
border-top: 1px solid #e5e7eb;
|
|
2485
|
+
display: flex;
|
|
2486
|
+
justify-content: flex-end;
|
|
2487
|
+
align-items: center;
|
|
2488
|
+
gap: 12px;
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
|
|
2492
|
+
.filter-panel__input {
|
|
2493
|
+
width: 100%;
|
|
2494
|
+
padding: 10px 12px;
|
|
2495
|
+
border: 1px solid #d1d5db;
|
|
2496
|
+
border-radius: 8px;
|
|
2497
|
+
font-size: 14px;
|
|
2498
|
+
font-family: inherit;
|
|
2499
|
+
color: #111827;
|
|
2500
|
+
background: #fff;
|
|
2501
|
+
outline: none;
|
|
2502
|
+
transition: border-color 0.2s, box-shadow 0.2s;
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2505
|
+
.filter-panel__input:focus {
|
|
2506
|
+
border-color: #163052;
|
|
2507
|
+
box-shadow: 0 0 0 2px rgba(22, 48, 82, 0.1);
|
|
2508
|
+
}
|
|
2509
|
+
|
|
2510
|
+
.filter-panel__input::placeholder {
|
|
2511
|
+
color: #9ca3af;
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2514
|
+
.filter-panel__textarea {
|
|
2515
|
+
width: 100%;
|
|
2516
|
+
padding: 10px 12px;
|
|
2517
|
+
border: 1px solid #d1d5db;
|
|
2518
|
+
border-radius: 8px;
|
|
2519
|
+
font-size: 14px;
|
|
2520
|
+
font-family: inherit;
|
|
2521
|
+
color: #111827;
|
|
2522
|
+
background: #fff;
|
|
2523
|
+
outline: none;
|
|
2524
|
+
resize: vertical;
|
|
2525
|
+
transition: border-color 0.2s, box-shadow 0.2s;
|
|
2526
|
+
}
|
|
2527
|
+
|
|
2528
|
+
.filter-panel__textarea:focus {
|
|
2529
|
+
border-color: #163052;
|
|
2530
|
+
box-shadow: 0 0 0 2px rgba(22, 48, 82, 0.1);
|
|
2531
|
+
}
|
|
2532
|
+
|
|
2533
|
+
.filter-panel__textarea::placeholder {
|
|
2534
|
+
color: #9ca3af;
|
|
2535
|
+
}
|
|
2536
|
+
|
|
2537
|
+
/* -------------------------------------------------------------------------
|
|
2538
|
+
* Bucket List
|
|
2539
|
+
* ----------------------------------------------------------------------- */
|
|
2540
|
+
.buckets {
|
|
2541
|
+
max-height: 280px;
|
|
2542
|
+
overflow-y: auto;
|
|
2543
|
+
padding: 8px 0;
|
|
2544
|
+
}
|
|
2545
|
+
|
|
2546
|
+
.bucket {
|
|
2547
|
+
display: flex;
|
|
2548
|
+
align-items: center;
|
|
2549
|
+
gap: 16px;
|
|
2550
|
+
height: 32px;
|
|
2551
|
+
padding: 0 16px;
|
|
2552
|
+
cursor: pointer;
|
|
2553
|
+
transition: background 0.1s;
|
|
2554
|
+
}
|
|
2555
|
+
|
|
2556
|
+
.bucket:hover {
|
|
2557
|
+
background: #f3f4f6;
|
|
2558
|
+
}
|
|
2559
|
+
|
|
2560
|
+
.bucket__checkbox {
|
|
2561
|
+
width: 16px;
|
|
2562
|
+
height: 16px;
|
|
2563
|
+
border: 1.5px solid #9ca3af;
|
|
2564
|
+
border-radius: 3px;
|
|
2565
|
+
display: flex;
|
|
2566
|
+
align-items: center;
|
|
2567
|
+
justify-content: center;
|
|
2568
|
+
flex-shrink: 0;
|
|
2569
|
+
transition: all 0.15s;
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2572
|
+
.bucket__checkbox--checked {
|
|
2573
|
+
background: var(--kr-primary, #163052);
|
|
2574
|
+
border-color: var(--kr-primary, #163052);
|
|
2575
|
+
}
|
|
2576
|
+
|
|
2577
|
+
.bucket__checkbox svg {
|
|
2578
|
+
width: 12px;
|
|
2579
|
+
height: 12px;
|
|
2580
|
+
color: white;
|
|
2581
|
+
}
|
|
2582
|
+
|
|
2583
|
+
.bucket__label {
|
|
2584
|
+
flex: 1;
|
|
2585
|
+
font-size: 14px;
|
|
2586
|
+
color: #000;
|
|
2587
|
+
overflow: hidden;
|
|
2588
|
+
text-overflow: ellipsis;
|
|
2589
|
+
white-space: nowrap;
|
|
1868
2590
|
}
|
|
1869
2591
|
|
|
1870
|
-
|
|
1871
|
-
|
|
2592
|
+
.bucket__count {
|
|
2593
|
+
font-size: 14px;
|
|
2594
|
+
color: #000;
|
|
2595
|
+
flex-shrink: 0;
|
|
1872
2596
|
}
|
|
1873
2597
|
|
|
1874
|
-
|
|
1875
|
-
* Status (Loading, Error, Empty)
|
|
1876
|
-
* ----------------------------------------------------------------------- */
|
|
1877
|
-
.status {
|
|
1878
|
-
position: absolute;
|
|
1879
|
-
top: 0;
|
|
1880
|
-
left: 0;
|
|
1881
|
-
right: 0;
|
|
1882
|
-
bottom: 0;
|
|
1883
|
-
display: flex;
|
|
1884
|
-
align-items: center;
|
|
1885
|
-
justify-content: center;
|
|
2598
|
+
.bucket-empty {
|
|
1886
2599
|
font-size: 14px;
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
pointer-events: none;
|
|
2600
|
+
color: #000;
|
|
2601
|
+
padding: 16px;
|
|
1890
2602
|
}
|
|
1891
2603
|
|
|
1892
|
-
|
|
1893
|
-
color: #dc2626;
|
|
1894
|
-
}
|
|
1895
|
-
`],Ze([ue()],et.prototype,"_data",void 0),Ze([ue()],et.prototype,"_dataState",void 0),Ze([ue()],et.prototype,"_page",void 0),Ze([ue()],et.prototype,"_pageSize",void 0),Ze([ue()],et.prototype,"_totalItems",void 0),Ze([ue()],et.prototype,"_totalPages",void 0),Ze([ue()],et.prototype,"_searchQuery",void 0),Ze([ue()],et.prototype,"_canScrollLeft",void 0),Ze([ue()],et.prototype,"_canScrollRight",void 0),Ze([ue()],et.prototype,"_canScrollHorizontal",void 0),Ze([ue()],et.prototype,"_columnPickerOpen",void 0),Ze([ue()],et.prototype,"_displayedColumns",void 0),Ze([pe({type:Object})],et.prototype,"def",void 0),et=Ze([de("kr-table")],et);var tt=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};let it=class extends ne{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,B`
|
|
2604
|
+
`],ct([ue()],pt.prototype,"_data",void 0),ct([ue()],pt.prototype,"_dataState",void 0),ct([ue()],pt.prototype,"_page",void 0),ct([ue()],pt.prototype,"_pageSize",void 0),ct([ue()],pt.prototype,"_totalItems",void 0),ct([ue()],pt.prototype,"_totalPages",void 0),ct([ue()],pt.prototype,"_searchQuery",void 0),ct([ue()],pt.prototype,"_canScrollLeft",void 0),ct([ue()],pt.prototype,"_canScrollRight",void 0),ct([ue()],pt.prototype,"_canScrollHorizontal",void 0),ct([ue()],pt.prototype,"_columnPickerOpen",void 0),ct([ue()],pt.prototype,"_filterPanelOpened",void 0),ct([ue()],pt.prototype,"_filterPanelTab",void 0),ct([ue()],pt.prototype,"_buckets",void 0),ct([pe({type:Object})],pt.prototype,"def",void 0),pt=ct([de("kr-table")],pt);var ut=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 ft=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,V`
|
|
1896
2605
|
<svg
|
|
1897
2606
|
class="spinner"
|
|
1898
2607
|
style=${`width: ${e}; height: ${e}; color: ${t}`}
|
|
@@ -1909,7 +2618,7 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
1909
2618
|
stroke-width="4"
|
|
1910
2619
|
/>
|
|
1911
2620
|
</svg>
|
|
1912
|
-
`}};
|
|
2621
|
+
`}};ft.styles=r`
|
|
1913
2622
|
:host {
|
|
1914
2623
|
display: inline-flex;
|
|
1915
2624
|
align-items: center;
|
|
@@ -1952,7 +2661,7 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
1952
2661
|
stroke: currentColor;
|
|
1953
2662
|
stroke-linecap: round;
|
|
1954
2663
|
}
|
|
1955
|
-
`,
|
|
2664
|
+
`,ut([pe({type:String,reflect:!0})],ft.prototype,"size",void 0),ut([pe({type:String,reflect:!0})],ft.prototype,"color",void 0),ft=ut([de("kr-spinner")],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 vt=class extends ae{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",V`
|
|
1956
2665
|
<div
|
|
1957
2666
|
class="progress-bar"
|
|
1958
2667
|
style=${`background: ${t}`}
|
|
@@ -1961,7 +2670,7 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
1961
2670
|
>
|
|
1962
2671
|
<div class="fill" style=${`background: ${e}`}></div>
|
|
1963
2672
|
</div>
|
|
1964
|
-
`}};
|
|
2673
|
+
`}};vt.styles=r`
|
|
1965
2674
|
:host {
|
|
1966
2675
|
display: block;
|
|
1967
2676
|
width: 100%;
|
|
@@ -1993,13 +2702,13 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
1993
2702
|
left: 100%;
|
|
1994
2703
|
}
|
|
1995
2704
|
}
|
|
1996
|
-
`,
|
|
2705
|
+
`,gt([pe({type:String,reflect:!0})],vt.prototype,"color",void 0),gt([pe({type:String,reflect:!0})],vt.prototype,"trackColor",void 0),vt=gt([de("kr-progress-bar")],vt);var bt,mt=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 _t=bt=class extends ae{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})),bt._activePreview===this&&(bt._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))),o=[];for(let e=0;e<s;e++){let t=0;for(const s of i){const i=(s[e]||"").length;i>t&&(t=i)}o.push(t)}return i.map((e=>e.map(((e,t)=>e.padEnd(o[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)?V`<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)?V`<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)?V`<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>`:V`<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,o=this._zoomLevel>100?"grab":"default";e=V`<img
|
|
1997
2706
|
class="body__image"
|
|
1998
2707
|
src="${this.src}"
|
|
1999
2708
|
alt="${this.name}"
|
|
2000
|
-
style="transform: scale(${t}) translate(${i}px, ${
|
|
2709
|
+
style="transform: scale(${t}) translate(${i}px, ${s}px); cursor: ${o}"
|
|
2001
2710
|
@mousedown=${this._handleDragStart}
|
|
2002
|
-
/>`}else if(this._isPdf())e=
|
|
2711
|
+
/>`}else if(this._isPdf())e=V`<iframe class="body__iframe" src="${this.src}"></iframe>`;else if(this._isText())e=null===this._textContent?V`<div class="body__text-loading">Loading...</div>`:V`<pre class="body__text">${this._textContent}</pre>`;else{const t=this._getExtension();e=V`
|
|
2003
2712
|
<div class="fallback">
|
|
2004
2713
|
<div class="fallback__icon ${this._getFallbackIconClass(t)}">
|
|
2005
2714
|
${this._getFallbackIcon(t)}
|
|
@@ -2011,11 +2720,11 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
2011
2720
|
Download
|
|
2012
2721
|
</kr-button>
|
|
2013
2722
|
</div>
|
|
2014
|
-
`}return
|
|
2723
|
+
`}return V`
|
|
2015
2724
|
<div class="toolbar">
|
|
2016
2725
|
<div class="toolbar__name">${this.name}</div>
|
|
2017
2726
|
<div class="toolbar__controls">
|
|
2018
|
-
${this._isImage()?
|
|
2727
|
+
${this._isImage()?V`
|
|
2019
2728
|
<button class="toolbar__btn" @click=${this._handleZoomOut} title="Zoom out">
|
|
2020
2729
|
<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 14zM7 9h5v1H7V9z"/></svg>
|
|
2021
2730
|
</button>
|
|
@@ -2024,7 +2733,7 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
2024
2733
|
<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>
|
|
2025
2734
|
</button>
|
|
2026
2735
|
<div class="toolbar__separator"></div>
|
|
2027
|
-
`:
|
|
2736
|
+
`:B}
|
|
2028
2737
|
<button class="toolbar__btn" @click=${this._handleDownload} title="Download">
|
|
2029
2738
|
<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>
|
|
2030
2739
|
</button>
|
|
@@ -2036,7 +2745,7 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
2036
2745
|
<div class="body" @click=${this._handleBackdropClick}>
|
|
2037
2746
|
${e}
|
|
2038
2747
|
</div>
|
|
2039
|
-
`}};
|
|
2748
|
+
`}};_t.styles=r`
|
|
2040
2749
|
*,
|
|
2041
2750
|
*::after,
|
|
2042
2751
|
*::before,
|
|
@@ -2216,14 +2925,14 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
2216
2925
|
height: 18px;
|
|
2217
2926
|
fill: currentColor;
|
|
2218
2927
|
}
|
|
2219
|
-
`,
|
|
2928
|
+
`,_t._activePreview=null,mt([pe({type:String})],_t.prototype,"src",void 0),mt([pe({type:String})],_t.prototype,"name",void 0),mt([ue()],_t.prototype,"_zoomLevel",void 0),mt([ue()],_t.prototype,"_textContent",void 0),_t=bt=mt([de("kr-file-preview")],_t);var yt=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 xt=class extends ae{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)?V`<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)?V`<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)?V`<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)?V`<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)?V`<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>`:V`<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?V`
|
|
2220
2929
|
<div class="file-list">
|
|
2221
|
-
${this.files.map((e=>{const t=this._getExtension(e.name),i=e.meta||e.date||"";return
|
|
2930
|
+
${this.files.map((e=>{const t=this._getExtension(e.name),i=e.meta||e.date||"";return V`
|
|
2222
2931
|
<div class="file-list__item">
|
|
2223
2932
|
<div class="file-list__ext ${this._getExtClass(t)}">${this._getExtIcon(t)}</div>
|
|
2224
2933
|
<div class="file-list__info">
|
|
2225
2934
|
<a class="file-list__name" @click=${()=>this._handleFileClick(e)}>${e.name}</a>
|
|
2226
|
-
${i?
|
|
2935
|
+
${i?V`<div class="file-list__meta">${i}</div>`:""}
|
|
2227
2936
|
</div>
|
|
2228
2937
|
<div class="file-list__actions">
|
|
2229
2938
|
<svg class="file-list__action" @click=${()=>this._handleDownload(e)} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" title="Download"><path d="M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5v-2z"/></svg>
|
|
@@ -2232,7 +2941,7 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
2232
2941
|
</div>
|
|
2233
2942
|
`}))}
|
|
2234
2943
|
</div>
|
|
2235
|
-
`:
|
|
2944
|
+
`:V`<div class="file-list__empty">${this.emptyMessage}</div>`}};xt.styles=r`
|
|
2236
2945
|
*,
|
|
2237
2946
|
*::after,
|
|
2238
2947
|
*::before,
|
|
@@ -2346,28 +3055,28 @@ const Re="important",je=" !"+Re,Me=xe(class extends ke{constructor(e){if(super(e
|
|
|
2346
3055
|
font-style: italic;
|
|
2347
3056
|
padding: 20px;
|
|
2348
3057
|
}
|
|
2349
|
-
`,
|
|
3058
|
+
`,yt([pe({type:Array})],xt.prototype,"files",void 0),yt([pe({type:String,attribute:"empty-message"})],xt.prototype,"emptyMessage",void 0),xt=yt([de("kr-file-list")],xt);
|
|
2350
3059
|
/**
|
|
2351
3060
|
* @license
|
|
2352
3061
|
* Copyright 2018 Google LLC
|
|
2353
3062
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2354
3063
|
*/
|
|
2355
|
-
const
|
|
3064
|
+
const kt=e=>e??B
|
|
2356
3065
|
/**
|
|
2357
3066
|
* @license
|
|
2358
3067
|
* Copyright 2020 Google LLC
|
|
2359
3068
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2360
|
-
*/,
|
|
3069
|
+
*/,wt={},$t=xe(class extends ke{constructor(e){if(super(e),e.type!==_e&&e.type!==be&&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===U||t===B)return t;const i=e.element,s=e.name;if(e.type===_e){if(t===i[s])return U}else if(e.type===ye){if(!!t===i.hasAttribute(s))return U}else if(e.type===be&&i.getAttribute(s)===t+"")return U;return((e,t=wt)=>{e._$AH=t;
|
|
2361
3070
|
/**
|
|
2362
3071
|
* @license
|
|
2363
3072
|
* Copyright 2020 Google LLC
|
|
2364
3073
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2365
|
-
*/})(e),t}});var
|
|
3074
|
+
*/})(e),t}});var Ct=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 St=class extends ae{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),V`
|
|
2366
3075
|
<div class="wrapper">
|
|
2367
|
-
${this.label?
|
|
3076
|
+
${this.label?V`
|
|
2368
3077
|
<label for="input">
|
|
2369
3078
|
${this.label}
|
|
2370
|
-
${this.required?
|
|
3079
|
+
${this.required?V`<span class="required" aria-hidden="true">*</span>`:""}
|
|
2371
3080
|
</label>
|
|
2372
3081
|
`:""}
|
|
2373
3082
|
<input
|
|
@@ -2375,22 +3084,22 @@ const ct=e=>e??U
|
|
|
2375
3084
|
class=${we({"input--invalid":this._touched&&this._input&&!this._input.validity.valid})}
|
|
2376
3085
|
type=${this.type}
|
|
2377
3086
|
name=${this.name}
|
|
2378
|
-
.value=${
|
|
3087
|
+
.value=${$t(this.value)}
|
|
2379
3088
|
placeholder=${this.placeholder}
|
|
2380
3089
|
?required=${this.required}
|
|
2381
3090
|
?disabled=${this.disabled}
|
|
2382
3091
|
?readonly=${this.readonly}
|
|
2383
|
-
minlength=${
|
|
2384
|
-
maxlength=${
|
|
2385
|
-
pattern=${
|
|
2386
|
-
autocomplete=${
|
|
3092
|
+
minlength=${kt(this.minlength)}
|
|
3093
|
+
maxlength=${kt(this.maxlength)}
|
|
3094
|
+
pattern=${kt(this.pattern)}
|
|
3095
|
+
autocomplete=${kt(this.autocomplete||void 0)}
|
|
2387
3096
|
@input=${this._handleInput}
|
|
2388
3097
|
@change=${this._handleChange}
|
|
2389
3098
|
@blur=${this._handleBlur}
|
|
2390
3099
|
/>
|
|
2391
|
-
${e?
|
|
3100
|
+
${e?V`<div class="validation-message">${e}</div>`:this.hint?V`<div class="hint">${this.hint}</div>`:""}
|
|
2392
3101
|
</div>
|
|
2393
|
-
`}focus(){this._input?.focus()}blur(){this._input?.blur()}select(){this._input?.select()}};
|
|
3102
|
+
`}focus(){this._input?.focus()}blur(){this._input?.blur()}select(){this._input?.select()}};St.styles=r`
|
|
2394
3103
|
:host {
|
|
2395
3104
|
display: block;
|
|
2396
3105
|
font-family: inherit;
|
|
@@ -2457,266 +3166,35 @@ const ct=e=>e??U
|
|
|
2457
3166
|
font-size: 0.75rem;
|
|
2458
3167
|
color: var(--kr-text-field-helper-color, #6b7280);
|
|
2459
3168
|
}
|
|
2460
|
-
`,
|
|
2461
|
-
<div class="wrapper">
|
|
2462
|
-
${this.label?B`
|
|
2463
|
-
<label>
|
|
2464
|
-
${this.label}
|
|
2465
|
-
${this.required?B`<span class="required" aria-hidden="true">*</span>`:""}
|
|
2466
|
-
</label>
|
|
2467
|
-
`:U}
|
|
2468
|
-
<div class="select-wrapper">
|
|
2469
|
-
<button
|
|
2470
|
-
class=${we({"select-trigger":!0,"select-trigger--open":this._isOpen,"select-trigger--invalid":this._touched&&this.required&&!this.value})}
|
|
2471
|
-
type="button"
|
|
2472
|
-
?disabled=${this.disabled}
|
|
2473
|
-
aria-haspopup="listbox"
|
|
2474
|
-
aria-expanded=${this._isOpen}
|
|
2475
|
-
@click=${this._toggle}
|
|
2476
|
-
@blur=${this._handleBlur}
|
|
2477
|
-
>
|
|
2478
|
-
<span class=${we({"select-value":!0,"select-placeholder":!t})}>
|
|
2479
|
-
${t||this.placeholder}
|
|
2480
|
-
</span>
|
|
2481
|
-
<svg
|
|
2482
|
-
class=${we({"chevron-icon":!0,"select-icon":!0,"select-icon--open":this._isOpen})}
|
|
2483
|
-
viewBox="0 0 24 24"
|
|
2484
|
-
fill="currentColor"
|
|
2485
|
-
>
|
|
2486
|
-
<path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6z"/>
|
|
2487
|
-
</svg>
|
|
2488
|
-
</button>
|
|
2489
|
-
|
|
2490
|
-
<div class=${we({"select-dropdown":!0,hidden:!this._isOpen})} role="listbox">
|
|
2491
|
-
<div class="select-options">
|
|
2492
|
-
${0===e.length?B`<div class="select-empty">No options available</div>`:e.map(((e,t)=>{const i=e.value===this.value;return B`
|
|
2493
|
-
<div
|
|
2494
|
-
class=${we({"select-option":!0,"select-option--selected":i,"select-option--disabled":e.disabled,"select-option--highlighted":t===this._highlightedIndex})}
|
|
2495
|
-
role="option"
|
|
2496
|
-
aria-selected=${i}
|
|
2497
|
-
@click=${()=>this._selectOption(e)}
|
|
2498
|
-
@mouseenter=${()=>this._highlightedIndex=t}
|
|
2499
|
-
>
|
|
2500
|
-
${e.label}
|
|
2501
|
-
</div>
|
|
2502
|
-
`}))}
|
|
2503
|
-
</div>
|
|
2504
|
-
</div>
|
|
2505
|
-
</div>
|
|
2506
|
-
${this._touched&&this.required&&!this.value?B`<div class="validation-message">Please select an option</div>`:this.hint?B`<div class="hint">${this.hint}</div>`:""}
|
|
2507
|
-
</div>
|
|
2508
|
-
<div class="options-slot">
|
|
2509
|
-
<slot @slotchange=${()=>this.requestUpdate()}></slot>
|
|
2510
|
-
</div>
|
|
2511
|
-
`}focus(){this._triggerElement?.focus()}blur(){this._triggerElement?.blur()}};vt.styles=[ae,r`
|
|
2512
|
-
:host {
|
|
2513
|
-
display: block;
|
|
2514
|
-
font-family: inherit;
|
|
2515
|
-
}
|
|
2516
|
-
|
|
2517
|
-
.wrapper {
|
|
2518
|
-
display: flex;
|
|
2519
|
-
flex-direction: column;
|
|
2520
|
-
gap: 6px;
|
|
2521
|
-
}
|
|
2522
|
-
|
|
2523
|
-
label {
|
|
2524
|
-
font-size: 14px;
|
|
2525
|
-
font-weight: 500;
|
|
2526
|
-
color: black;
|
|
2527
|
-
}
|
|
2528
|
-
|
|
2529
|
-
.required {
|
|
2530
|
-
color: var(--kr-select-required-color, #ef4444);
|
|
2531
|
-
margin-left: 0.125rem;
|
|
2532
|
-
}
|
|
2533
|
-
|
|
2534
|
-
.select-wrapper {
|
|
2535
|
-
position: relative;
|
|
2536
|
-
}
|
|
2537
|
-
|
|
2538
|
-
.select-trigger {
|
|
2539
|
-
display: flex;
|
|
2540
|
-
align-items: center;
|
|
2541
|
-
justify-content: space-between;
|
|
2542
|
-
width: 100%;
|
|
2543
|
-
padding: 10px 12px;
|
|
2544
|
-
font-family: inherit;
|
|
2545
|
-
font-size: 14px;
|
|
2546
|
-
line-height: 1.5;
|
|
2547
|
-
color: #000000;
|
|
2548
|
-
background-color: var(--kr-select-bg, #fff);
|
|
2549
|
-
border: 1px solid var(--kr-select-border-color, #0000003d);
|
|
2550
|
-
border-radius: 8px;
|
|
2551
|
-
cursor: pointer;
|
|
2552
|
-
transition: border-color 0.2s, box-shadow 0.2s;
|
|
2553
|
-
text-align: left;
|
|
2554
|
-
}
|
|
2555
|
-
|
|
2556
|
-
.select-trigger:hover:not(:disabled) {
|
|
2557
|
-
border-color: var(--kr-select-hover-border-color, #9ca3af);
|
|
2558
|
-
}
|
|
2559
|
-
|
|
2560
|
-
.select-trigger:focus {
|
|
2561
|
-
outline: none;
|
|
2562
|
-
border-color: var(--kr-primary);
|
|
2563
|
-
box-shadow: 0 0 0 3px rgba(22, 48, 82, 0.1);
|
|
2564
|
-
}
|
|
2565
|
-
|
|
2566
|
-
.select-trigger:disabled {
|
|
2567
|
-
background-color: var(--kr-select-disabled-bg, #f3f4f6);
|
|
2568
|
-
color: var(--kr-select-disabled-color, #9ca3af);
|
|
2569
|
-
cursor: not-allowed;
|
|
2570
|
-
}
|
|
2571
|
-
|
|
2572
|
-
.select-trigger--invalid {
|
|
2573
|
-
border-color: var(--kr-select-error-border-color, #ef4444);
|
|
2574
|
-
}
|
|
2575
|
-
|
|
2576
|
-
.select-trigger--invalid:focus {
|
|
2577
|
-
border-color: var(--kr-select-error-border-color, #ef4444);
|
|
2578
|
-
box-shadow: 0 0 0 3px var(--kr-select-error-ring-color, rgba(239, 68, 68, 0.1));
|
|
2579
|
-
}
|
|
2580
|
-
|
|
2581
|
-
.select-trigger--open {
|
|
2582
|
-
border-color: var(--kr-primary);
|
|
2583
|
-
box-shadow: 0 0 0 3px rgba(22, 48, 82, 0.1);
|
|
2584
|
-
}
|
|
2585
|
-
|
|
2586
|
-
.select-value {
|
|
2587
|
-
flex: 1;
|
|
2588
|
-
overflow: hidden;
|
|
2589
|
-
text-overflow: ellipsis;
|
|
2590
|
-
white-space: nowrap;
|
|
2591
|
-
}
|
|
2592
|
-
|
|
2593
|
-
.select-placeholder {
|
|
2594
|
-
color: #9ca3af;
|
|
2595
|
-
}
|
|
2596
|
-
|
|
2597
|
-
.select-icon {
|
|
2598
|
-
flex-shrink: 0;
|
|
2599
|
-
margin-left: 0.5rem;
|
|
2600
|
-
color: #6b7280;
|
|
2601
|
-
transition: transform 0.2s;
|
|
2602
|
-
}
|
|
2603
|
-
|
|
2604
|
-
.select-icon--open {
|
|
2605
|
-
transform: rotate(180deg);
|
|
2606
|
-
}
|
|
2607
|
-
|
|
2608
|
-
.select-dropdown {
|
|
2609
|
-
position: fixed;
|
|
2610
|
-
z-index: 10000;
|
|
2611
|
-
background: white;
|
|
2612
|
-
border: 1px solid #9ba7b6;
|
|
2613
|
-
border-radius: 8px;
|
|
2614
|
-
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
|
|
2615
|
-
padding: 8px 0;
|
|
2616
|
-
overflow-y: auto;
|
|
2617
|
-
}
|
|
2618
|
-
|
|
2619
|
-
.select-options {
|
|
2620
|
-
padding: 0;
|
|
2621
|
-
}
|
|
2622
|
-
|
|
2623
|
-
.select-option {
|
|
2624
|
-
display: flex;
|
|
2625
|
-
align-items: center;
|
|
2626
|
-
min-height: 36px;
|
|
2627
|
-
padding: 8px 16px;
|
|
2628
|
-
font-size: 14px;
|
|
2629
|
-
color: #000000;
|
|
2630
|
-
cursor: pointer;
|
|
2631
|
-
border-radius: 4px;
|
|
2632
|
-
transition: background-color 0.15s;
|
|
2633
|
-
}
|
|
2634
|
-
|
|
2635
|
-
.select-option:hover:not(.select-option--disabled) {
|
|
2636
|
-
background-color: var(--kr-select-option-hover-bg, #f3f4f6);
|
|
2637
|
-
}
|
|
2638
|
-
|
|
2639
|
-
.select-option--selected {
|
|
2640
|
-
background-color: rgba(22, 48, 82, 0.08);
|
|
2641
|
-
color: var(--kr-primary);
|
|
2642
|
-
}
|
|
2643
|
-
|
|
2644
|
-
.select-option--selected:hover {
|
|
2645
|
-
background-color: rgba(22, 48, 82, 0.12);
|
|
2646
|
-
}
|
|
2647
|
-
|
|
2648
|
-
.select-option--disabled {
|
|
2649
|
-
color: var(--kr-select-option-disabled-color, #9ca3af);
|
|
2650
|
-
cursor: not-allowed;
|
|
2651
|
-
}
|
|
2652
|
-
|
|
2653
|
-
.select-option--highlighted {
|
|
2654
|
-
background-color: var(--kr-select-option-hover-bg, #f3f4f6);
|
|
2655
|
-
}
|
|
2656
|
-
|
|
2657
|
-
.select-empty {
|
|
2658
|
-
padding: 1rem;
|
|
2659
|
-
text-align: center;
|
|
2660
|
-
color: var(--kr-select-empty-color, #6b7280);
|
|
2661
|
-
font-size: 14px;
|
|
2662
|
-
}
|
|
2663
|
-
|
|
2664
|
-
.hint {
|
|
2665
|
-
font-size: 0.75rem;
|
|
2666
|
-
color: var(--kr-select-helper-color, #6b7280);
|
|
2667
|
-
}
|
|
2668
|
-
|
|
2669
|
-
.validation-message {
|
|
2670
|
-
font-size: 0.75rem;
|
|
2671
|
-
color: var(--kr-select-error-color, #ef4444);
|
|
2672
|
-
}
|
|
2673
|
-
|
|
2674
|
-
.hidden {
|
|
2675
|
-
display: none;
|
|
2676
|
-
}
|
|
2677
|
-
|
|
2678
|
-
.chevron-icon {
|
|
2679
|
-
width: 20px;
|
|
2680
|
-
height: 20px;
|
|
2681
|
-
}
|
|
2682
|
-
|
|
2683
|
-
/* Hide the slot - options are rendered in dropdown */
|
|
2684
|
-
.options-slot {
|
|
2685
|
-
display: none;
|
|
2686
|
-
}
|
|
2687
|
-
`],vt.formAssociated=!0,ft([pe({type:String})],vt.prototype,"label",void 0),ft([pe({type:String})],vt.prototype,"name",void 0),ft([pe({type:String})],vt.prototype,"value",void 0),ft([pe({type:String})],vt.prototype,"placeholder",void 0),ft([pe({type:Boolean})],vt.prototype,"disabled",void 0),ft([pe({type:Boolean})],vt.prototype,"required",void 0),ft([pe({type:Boolean})],vt.prototype,"readonly",void 0),ft([pe({type:String})],vt.prototype,"hint",void 0),ft([ue()],vt.prototype,"_isOpen",void 0),ft([ue()],vt.prototype,"_highlightedIndex",void 0),ft([ue()],vt.prototype,"_touched",void 0),ft([ge(".select-trigger")],vt.prototype,"_triggerElement",void 0),vt=ft([de("kr-select-field")],vt);var bt=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};let mt=class extends ne{constructor(){super(...arguments),this.value="",this.disabled=!1}get label(){return this.textContent?.trim()||""}render(){return B`<slot></slot>`}};mt.styles=r`
|
|
2688
|
-
:host {
|
|
2689
|
-
display: none;
|
|
2690
|
-
}
|
|
2691
|
-
`,bt([pe({type:String})],mt.prototype,"value",void 0),bt([pe({type:Boolean})],mt.prototype,"disabled",void 0),mt=bt([de("kr-select-option")],mt);var yt=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};let _t=class extends ne{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),B`
|
|
3169
|
+
`,St.formAssociated=!0,Ct([pe({type:String})],St.prototype,"label",void 0),Ct([pe({type:String})],St.prototype,"name",void 0),Ct([pe({type:String})],St.prototype,"value",void 0),Ct([pe({type:String})],St.prototype,"placeholder",void 0),Ct([pe({type:String})],St.prototype,"type",void 0),Ct([pe({type:Boolean})],St.prototype,"required",void 0),Ct([pe({type:Boolean})],St.prototype,"disabled",void 0),Ct([pe({type:Boolean})],St.prototype,"readonly",void 0),Ct([pe({type:Number})],St.prototype,"minlength",void 0),Ct([pe({type:Number})],St.prototype,"maxlength",void 0),Ct([pe({type:String})],St.prototype,"pattern",void 0),Ct([pe({type:String})],St.prototype,"autocomplete",void 0),Ct([pe({type:String})],St.prototype,"hint",void 0),Ct([fe("input")],St.prototype,"_input",void 0),Ct([ue()],St.prototype,"_touched",void 0),Ct([ue()],St.prototype,"_dirty",void 0),St=Ct([de("kr-text-field")],St);var Et=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 zt=class extends ae{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),V`
|
|
2692
3170
|
<div class="wrapper">
|
|
2693
|
-
${this.label?
|
|
3171
|
+
${this.label?V`
|
|
2694
3172
|
<label for="textarea">
|
|
2695
3173
|
${this.label}
|
|
2696
|
-
${this.required?
|
|
3174
|
+
${this.required?V`<span class="required" aria-hidden="true">*</span>`:B}
|
|
2697
3175
|
</label>
|
|
2698
|
-
`:
|
|
3176
|
+
`:B}
|
|
2699
3177
|
<textarea
|
|
2700
3178
|
id="textarea"
|
|
2701
3179
|
class=${we({"textarea--invalid":this._touched&&this._textarea&&!this._textarea.validity.valid})}
|
|
2702
3180
|
name=${this.name}
|
|
2703
|
-
.value=${
|
|
3181
|
+
.value=${$t(this.value)}
|
|
2704
3182
|
placeholder=${this.placeholder}
|
|
2705
3183
|
?required=${this.required}
|
|
2706
3184
|
?disabled=${this.disabled}
|
|
2707
3185
|
?readonly=${this.readonly}
|
|
2708
3186
|
rows=${this.rows}
|
|
2709
|
-
cols=${
|
|
2710
|
-
minlength=${
|
|
2711
|
-
maxlength=${
|
|
2712
|
-
autocomplete=${
|
|
3187
|
+
cols=${kt(this.cols)}
|
|
3188
|
+
minlength=${kt(this.minlength)}
|
|
3189
|
+
maxlength=${kt(this.maxlength)}
|
|
3190
|
+
autocomplete=${kt(this.autocomplete||void 0)}
|
|
2713
3191
|
@input=${this._handleInput}
|
|
2714
3192
|
@change=${this._handleChange}
|
|
2715
3193
|
@blur=${this._handleBlur}
|
|
2716
3194
|
></textarea>
|
|
2717
|
-
${e?
|
|
3195
|
+
${e?V`<div class="validation-message">${e}</div>`:this.hint?V`<div class="hint">${this.hint}</div>`:B}
|
|
2718
3196
|
</div>
|
|
2719
|
-
`}focus(){this._textarea?.focus()}blur(){this._textarea?.blur()}select(){this._textarea?.select()}};
|
|
3197
|
+
`}focus(){this._textarea?.focus()}blur(){this._textarea?.blur()}select(){this._textarea?.select()}};zt.styles=r`
|
|
2720
3198
|
:host {
|
|
2721
3199
|
display: block;
|
|
2722
3200
|
font-family: inherit;
|
|
@@ -2786,12 +3264,12 @@ const ct=e=>e??U
|
|
|
2786
3264
|
font-size: 0.75rem;
|
|
2787
3265
|
color: var(--kr-textarea-field-helper-color, #6b7280);
|
|
2788
3266
|
}
|
|
2789
|
-
`,
|
|
3267
|
+
`,zt.formAssociated=!0,Et([pe({type:String})],zt.prototype,"label",void 0),Et([pe({type:String})],zt.prototype,"name",void 0),Et([pe({type:String})],zt.prototype,"value",void 0),Et([pe({type:String})],zt.prototype,"placeholder",void 0),Et([pe({type:Boolean})],zt.prototype,"required",void 0),Et([pe({type:Boolean})],zt.prototype,"disabled",void 0),Et([pe({type:Boolean})],zt.prototype,"readonly",void 0),Et([pe({type:Number})],zt.prototype,"rows",void 0),Et([pe({type:Number})],zt.prototype,"cols",void 0),Et([pe({type:Number})],zt.prototype,"minlength",void 0),Et([pe({type:Number})],zt.prototype,"maxlength",void 0),Et([pe({type:String})],zt.prototype,"autocomplete",void 0),Et([pe({type:String})],zt.prototype,"hint",void 0),Et([fe("textarea")],zt.prototype,"_textarea",void 0),Et([ue()],zt.prototype,"_touched",void 0),Et([ue()],zt.prototype,"_dirty",void 0),zt=Et([de("kr-textarea-field")],zt);var Tt=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 Ot=class extends ae{constructor(){super(...arguments),this.label="",this.value=""}render(){return V`
|
|
2790
3268
|
<div class="wrapper">
|
|
2791
|
-
${this.label?
|
|
3269
|
+
${this.label?V`<label>${this.label}</label>`:B}
|
|
2792
3270
|
<div class="value">${this.value}</div>
|
|
2793
3271
|
</div>
|
|
2794
|
-
`}};
|
|
3272
|
+
`}};Ot.styles=r`
|
|
2795
3273
|
:host {
|
|
2796
3274
|
display: block;
|
|
2797
3275
|
font-family: inherit;
|
|
@@ -2813,7 +3291,7 @@ const ct=e=>e??U
|
|
|
2813
3291
|
font-size: 14px;
|
|
2814
3292
|
color: black;
|
|
2815
3293
|
}
|
|
2816
|
-
`,
|
|
3294
|
+
`,Tt([pe({type:String})],Ot.prototype,"label",void 0),Tt([pe({type:String})],Ot.prototype,"value",void 0),Ot=Tt([de("kr-detail-field")],Ot);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};function At(e){return"options"in e}let Dt=class extends ae{constructor(){super(),this.label="",this.name="",this.value="",this.placeholder="",this.disabled=!1,this.readonly=!1,this.required=!1,this.hint="",this.options=[],this.statusType="finished",this.loadingText="Loading...",this.errorText="Error loading options",this.emptyText="No matches found",this.filteringType="auto",this.highlightMatches=!0,this._isOpen=!1,this._highlightedIndex=-1,this._touched=!1,this._dirty=!1,this._handleDocumentClick=this._onDocumentClick.bind(this),this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleDocumentClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleDocumentClick)}firstUpdated(){this._updateFormValue()}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._dirty=!1,this._isOpen=!1,this._highlightedIndex=-1,this._updateFormValue()}formStateRestoreCallback(e){this.value=e}get _filteredOptions(){if("manual"===this.filteringType||!this.value)return this.options;const e=this.value.toLowerCase(),t=[];for(const i of this.options)if(At(i)){const s=i.options.filter((t=>{const i=(t.label||t.value).toLowerCase(),s=t.filteringTags?.join(" ").toLowerCase()||"";return i.includes(e)||s.includes(e)}));s.length>0&&t.push({...i,options:s})}else{const s=(i.label||i.value).toLowerCase(),o=i.filteringTags?.join(" ").toLowerCase()||"";(s.includes(e)||o.includes(e))&&t.push(i)}return t}get _flatOptions(){const e=[];for(const t of this._filteredOptions)At(t)?e.push(...t.options):e.push(t);return e}_updateFormValue(){this._internals.setFormValue(this.value),this.required&&!this.value?this._internals.setValidity({valueMissing:!0},"This field is required",this._input):this._internals.setValidity({})}_onInput(e){const t=e.target;this.value=t.value,this._dirty=!0,this._isOpen=!0,this._highlightedIndex=-1,this._updateFormValue(),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0})),"manual"===this.filteringType&&this.dispatchEvent(new CustomEvent("load-items",{detail:{filteringText:this.value},bubbles:!0,composed:!0}))}_onFocus(){this._isOpen=!0,"manual"===this.filteringType&&this.dispatchEvent(new CustomEvent("load-items",{detail:{filteringText:this.value},bubbles:!0,composed:!0}))}_onBlur(){this._touched=!0,setTimeout((()=>{this._isOpen=!1,this._highlightedIndex=-1}),200),this._updateFormValue()}_onKeyDown(e){const t=this._flatOptions;switch(e.key){case"ArrowDown":e.preventDefault(),this._isOpen=!0,this._highlightedIndex=Math.min(this._highlightedIndex+1,t.length-1),this._scrollToHighlighted();break;case"ArrowUp":e.preventDefault(),this._highlightedIndex=Math.max(this._highlightedIndex-1,-1),this._scrollToHighlighted();break;case"Enter":this._highlightedIndex>=0&&t[this._highlightedIndex]&&(e.preventDefault(),this._selectOption(t[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.is-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.label||e.value,this._isOpen=!1,this._highlightedIndex=-1,this._dirty=!0,this._updateFormValue(),this.dispatchEvent(new CustomEvent("select",{detail:{value:e.value,selectedOption:e},bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}_handleClear(){this.value="",this._updateFormValue(),this.dispatchEvent(new CustomEvent("change",{detail:{value:""},bubbles:!0,composed:!0})),this._input?.focus()}_onDocumentClick(e){e.composedPath().includes(this)||(this._isOpen=!1)}_highlightMatch(e){if(!this.value||"manual"===this.filteringType||!this.highlightMatches)return V`${e}`;const t=this.value.toLowerCase(),i=e.toLowerCase().indexOf(t);if(-1===i)return V`${e}`;const s=e.slice(0,i),o=e.slice(i,i+this.value.length),r=e.slice(i+this.value.length);return V`${s}<span class="highlight">${o}</span>${r}`}_renderOption(e,t){const i=t===this._highlightedIndex;return V`
|
|
2817
3295
|
<button
|
|
2818
3296
|
class=${we({option:!0,"is-highlighted":i})}
|
|
2819
3297
|
type="button"
|
|
@@ -2826,22 +3304,22 @@ const ct=e=>e??U
|
|
|
2826
3304
|
<div class="option-content">
|
|
2827
3305
|
<div class="option-label">
|
|
2828
3306
|
${this._highlightMatch(e.label||e.value)}
|
|
2829
|
-
${e.labelTag?
|
|
3307
|
+
${e.labelTag?V`<span class="option-tag">${e.labelTag}</span>`:B}
|
|
2830
3308
|
</div>
|
|
2831
|
-
${e.description?
|
|
2832
|
-
${e.tags&&e.tags.length>0?
|
|
3309
|
+
${e.description?V`<div class="option-description">${e.description}</div>`:B}
|
|
3310
|
+
${e.tags&&e.tags.length>0?V`
|
|
2833
3311
|
<div class="option-tags">
|
|
2834
|
-
${e.tags.map((e=>
|
|
3312
|
+
${e.tags.map((e=>V`<span class="option-tag">${e}</span>`))}
|
|
2835
3313
|
</div>
|
|
2836
|
-
`:
|
|
3314
|
+
`:B}
|
|
2837
3315
|
</div>
|
|
2838
3316
|
</button>
|
|
2839
|
-
`}_renderDropdownContent(){if("loading"===this.statusType)return
|
|
3317
|
+
`}_renderDropdownContent(){if("loading"===this.statusType)return V`
|
|
2840
3318
|
<div class="status">
|
|
2841
3319
|
<div class="spinner"></div>
|
|
2842
3320
|
${this.loadingText}
|
|
2843
3321
|
</div>
|
|
2844
|
-
`;if("error"===this.statusType)return
|
|
3322
|
+
`;if("error"===this.statusType)return V`
|
|
2845
3323
|
<div class="status is-error">
|
|
2846
3324
|
<svg width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
|
|
2847
3325
|
<path
|
|
@@ -2850,30 +3328,30 @@ const ct=e=>e??U
|
|
|
2850
3328
|
</svg>
|
|
2851
3329
|
${this.errorText}
|
|
2852
3330
|
</div>
|
|
2853
|
-
`;const e=this._filteredOptions;if(0===e.length)return
|
|
2854
|
-
${e.map((e=>{if(
|
|
3331
|
+
`;const e=this._filteredOptions;if(0===e.length)return V`<div class="empty">${this.emptyText}</div>`;let t=0;return V`
|
|
3332
|
+
${e.map((e=>{if(At(e)){const i=e.options.map((e=>{const i=this._renderOption(e,t);return t++,i}));return V`
|
|
2855
3333
|
<div class="group-label">${e.label}</div>
|
|
2856
3334
|
${i}
|
|
2857
3335
|
`}const i=this._renderOption(e,t);return t++,i}))}
|
|
2858
|
-
`}render(){const e=this._touched&&!this.validity.valid;return
|
|
3336
|
+
`}render(){const e=this._touched&&!this.validity.valid;return V`
|
|
2859
3337
|
<div class="field-wrapper">
|
|
2860
|
-
${this.label?
|
|
3338
|
+
${this.label?V`
|
|
2861
3339
|
<label>
|
|
2862
3340
|
${this.label}
|
|
2863
|
-
${this.required?
|
|
3341
|
+
${this.required?V`<span class="required">*</span>`:B}
|
|
2864
3342
|
</label>
|
|
2865
|
-
`:
|
|
3343
|
+
`:B}
|
|
2866
3344
|
|
|
2867
3345
|
<div class="input-container">
|
|
2868
3346
|
<div class="input-wrapper">
|
|
2869
3347
|
<input
|
|
2870
3348
|
type="text"
|
|
2871
|
-
.value=${
|
|
2872
|
-
placeholder=${
|
|
3349
|
+
.value=${$t(this.value)}
|
|
3350
|
+
placeholder=${kt(this.placeholder||void 0)}
|
|
2873
3351
|
?disabled=${this.disabled}
|
|
2874
3352
|
?readonly=${this.readonly}
|
|
2875
3353
|
?required=${this.required}
|
|
2876
|
-
name=${
|
|
3354
|
+
name=${kt(this.name||void 0)}
|
|
2877
3355
|
autocomplete="off"
|
|
2878
3356
|
role="combobox"
|
|
2879
3357
|
aria-autocomplete="list"
|
|
@@ -2886,7 +3364,7 @@ const ct=e=>e??U
|
|
|
2886
3364
|
@keydown=${this._onKeyDown}
|
|
2887
3365
|
/>
|
|
2888
3366
|
<div class="icon-container">
|
|
2889
|
-
${!this.value||this.disabled||this.readonly?"":
|
|
3367
|
+
${!this.value||this.disabled||this.readonly?"":V`
|
|
2890
3368
|
<button
|
|
2891
3369
|
class="clear-button"
|
|
2892
3370
|
type="button"
|
|
@@ -2900,7 +3378,7 @@ const ct=e=>e??U
|
|
|
2900
3378
|
</svg>
|
|
2901
3379
|
</button>
|
|
2902
3380
|
`}
|
|
2903
|
-
${this.value||this.disabled||this.readonly?"":
|
|
3381
|
+
${this.value||this.disabled||this.readonly?"":V`
|
|
2904
3382
|
<svg class="search-icon" fill="currentColor" viewBox="0 0 16 16">
|
|
2905
3383
|
<path
|
|
2906
3384
|
d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"
|
|
@@ -2919,9 +3397,9 @@ const ct=e=>e??U
|
|
|
2919
3397
|
</div>
|
|
2920
3398
|
</div>
|
|
2921
3399
|
|
|
2922
|
-
${e?
|
|
3400
|
+
${e?V`<div class="validation-message">${this.validationMessage}</div>`:this.hint?V`<div class="hint">${this.hint}</div>`:B}
|
|
2923
3401
|
</div>
|
|
2924
|
-
`}};
|
|
3402
|
+
`}};Dt.styles=r`
|
|
2925
3403
|
:host {
|
|
2926
3404
|
display: block;
|
|
2927
3405
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
|
|
@@ -3185,5 +3663,5 @@ const ct=e=>e??U
|
|
|
3185
3663
|
color: var(--kr-text-field-error-border-color, #ef4444);
|
|
3186
3664
|
margin-top: 2px;
|
|
3187
3665
|
}
|
|
3188
|
-
`,
|
|
3666
|
+
`,Dt.formAssociated=!0,Pt([pe({type:String})],Dt.prototype,"label",void 0),Pt([pe({type:String})],Dt.prototype,"name",void 0),Pt([pe({type:String})],Dt.prototype,"value",void 0),Pt([pe({type:String})],Dt.prototype,"placeholder",void 0),Pt([pe({type:Boolean})],Dt.prototype,"disabled",void 0),Pt([pe({type:Boolean})],Dt.prototype,"readonly",void 0),Pt([pe({type:Boolean})],Dt.prototype,"required",void 0),Pt([pe({type:String})],Dt.prototype,"hint",void 0),Pt([pe({type:Array})],Dt.prototype,"options",void 0),Pt([pe({type:String,attribute:"status-type"})],Dt.prototype,"statusType",void 0),Pt([pe({type:String,attribute:"loading-text"})],Dt.prototype,"loadingText",void 0),Pt([pe({type:String,attribute:"error-text"})],Dt.prototype,"errorText",void 0),Pt([pe({type:String,attribute:"empty-text"})],Dt.prototype,"emptyText",void 0),Pt([pe({type:String,attribute:"filtering-type"})],Dt.prototype,"filteringType",void 0),Pt([pe({type:Boolean,attribute:"highlight-matches"})],Dt.prototype,"highlightMatches",void 0),Pt([ue()],Dt.prototype,"_isOpen",void 0),Pt([ue()],Dt.prototype,"_highlightedIndex",void 0),Pt([ue()],Dt.prototype,"_touched",void 0),Pt([ue()],Dt.prototype,"_dirty",void 0),Pt([fe("input")],Dt.prototype,"_input",void 0),Dt=Pt([de("kr-auto-suggest")],Dt);export{ve as KRAccordion,Ce as KRAlert,Dt as KRAutoSuggest,Ee as KRButton,Pe as KRCodeDemo,De as KRContextMenu,Ue as KRDialog,Ve as KRDialogRef,xt as KRFileList,_t as KRFilePreview,vt as KRProgressBar,dt as KRQuery,Qe as KRSelectField,Je as KRSelectOption,Fe as KRSnackbar,ft as KRSpinner,Ye as KRTab,We as KRTabGroup,pt as KRTable,St as KRTextField,zt as KRTextareaField,et as KR_OPERATORS,tt as getOperatorsForType,ne as krBaseCSS};
|
|
3189
3667
|
//# sourceMappingURL=krubble-components.bundled.min.js.map
|