@lazhus/kg-ui 0.8.1 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1809,7 +1809,7 @@
1809
1809
  "name": "_parseDateStr",
1810
1810
  "parameters": [
1811
1811
  {
1812
- "name": "str"
1812
+ "name": "val"
1813
1813
  }
1814
1814
  ]
1815
1815
  },
@@ -1916,7 +1916,7 @@
1916
1916
  "kind": "field",
1917
1917
  "name": "min",
1918
1918
  "type": {
1919
- "text": "string"
1919
+ "text": "string|number"
1920
1920
  },
1921
1921
  "default": "''"
1922
1922
  },
@@ -1924,7 +1924,7 @@
1924
1924
  "kind": "field",
1925
1925
  "name": "max",
1926
1926
  "type": {
1927
- "text": "string"
1927
+ "text": "string|number"
1928
1928
  },
1929
1929
  "default": "''"
1930
1930
  },
@@ -1945,6 +1945,27 @@
1945
1945
  "module": "src/mixins/FormAssociated.js"
1946
1946
  }
1947
1947
  },
1948
+ {
1949
+ "type": {
1950
+ "text": "string"
1951
+ },
1952
+ "name": "label",
1953
+ "kind": "field"
1954
+ },
1955
+ {
1956
+ "type": {
1957
+ "text": "boolean"
1958
+ },
1959
+ "name": "showTime",
1960
+ "kind": "field"
1961
+ },
1962
+ {
1963
+ "type": {
1964
+ "text": "boolean"
1965
+ },
1966
+ "name": "fullwidth",
1967
+ "kind": "field"
1968
+ },
1948
1969
  {
1949
1970
  "kind": "field",
1950
1971
  "name": "formAssociated",
@@ -1,4 +1,4 @@
1
- var e,t=Object.defineProperty;import{LitElement as a,css as s,html as i}from"lit";import{F as r}from"../chunks/FormAssociated-Cx5D8YQA.js";class n extends(r(a)){static get properties(){return{...super.properties,open:{type:Boolean,reflect:!0},placeholder:{type:String},label:{type:String},showTime:{type:Boolean},mode:{type:String},locale:{type:String},min:{type:String},max:{type:String},_viewDate:{type:Object},_selectedDate:{type:Object}}}constructor(){super(),this.open=!1,this.disabled=!1,this.mode="date",this.locale="tr-TR",this.placeholder="Tarih seçiniz...",this.min="",this.max="",this._viewDate=/* @__PURE__ */new Date,this.value="",this._handleOutsideClick=this._handleOutsideClick.bind(this)}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}_handleOutsideClick(e){this.open&&!e.composedPath().includes(this)&&(this.open=!1)}togglePopup(e){e&&e.stopPropagation(),this.disabled||(this.open=!this.open)}_handleInputKeydown(e){["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","Home","End"].includes(e.key)||(e.ctrlKey||e.metaKey)&&["a","c","v","x"].includes(e.key.toLowerCase())||/^\d$/.test(e.key)||e.preventDefault()}_getDateFormat(){const e=new Date(2023,11,31),t=new Intl.DateTimeFormat(this.locale).formatToParts(e),a=t.filter(e=>"literal"!==e.type).map(e=>e.type),s=t.find(e=>"literal"===e.type);let i=s?s.value:".";return i=i.includes(".")?".":i.includes("/")?"/":i.includes("-")?"-":".",{parts:a,separator:i}}_handleManualInput(e){let t=e.detail.value;t=t.replace(/\D/g,"");const{parts:a,separator:s}=this._getDateFormat(),i="year"===a[0];let r="";if(t.length>0&&(i?t.length<=4?r=t:t.length<=6?r=`${t.slice(0,4)}${s}${t.slice(4)}`:t.length<=8&&(r=`${t.slice(0,4)}${s}${t.slice(4,6)}${s}${t.slice(6)}`):t.length<=2?r=t:t.length<=4?r=`${t.slice(0,2)}${s}${t.slice(2)}`:t.length<=8&&(r=`${t.slice(0,2)}${s}${t.slice(2,4)}${s}${t.slice(4)}`),this.showTime&&t.length>8)){const e=r,a=t.slice(8);r=a.length<=2?`${e} ${a}`:`${e} ${a.slice(0,2)}:${a.slice(2,4)}`}if(t.length>=8){let e,n,o;if(i)o=parseInt(t.slice(0,4)),n=parseInt(t.slice(4,6)),e=parseInt(t.slice(6,8));else{const s=parseInt(t.slice(0,2)),i=parseInt(t.slice(2,4)),r=parseInt(t.slice(4,8));"day"===a[0]?(e=s,n=i,o=r):(n=s,e=i,o=r)}e>31&&(e=31),0===e&&(e=1),n>12&&(n=12),0===n&&(n=1),o>2100&&(o=2100);const l=String(e).padStart(2,"0"),c=String(n).padStart(2,"0"),d=String(o);if(r=i?`${d}${s}${c}${s}${l}`:"day"===a[0]?`${l}${s}${c}${s}${d}`:`${c}${s}${l}${s}${d}`,this.showTime&&t.length>8){r.split(" ")[1];let e=parseInt(t.slice(8,10)||"0"),a=parseInt(t.slice(10,12)||"0");e>23&&(e=23),a>59&&(a=59);const s=String(e).padStart(2,"0"),i=String(a).padStart(2,"0");t.length<=10?r+=` ${s}`:r+=` ${s}:${i}`}}if(this.value=r||t,this.value.length>=8){const e=this.value.split(" ")[0].split(s);if(this.value.split(" ")[1]?.split(":"),3===e.length){let e,t,a;if(i){"year"===currentParts[0]?(a=parseInt(dateComponents[0]),t=parseInt(dateComponents[1]),e=parseInt(dateComponents[2])):"day"===currentParts[0]?(e=parseInt(dateComponents[0]),t=parseInt(dateComponents[1]),a=parseInt(dateComponents[2])):(t=parseInt(dateComponents[0]),e=parseInt(dateComponents[1]),a=parseInt(dateComponents[2]));let s=0,i=0;if(timePartStr){const e=timePartStr.split(":");e.length>=2&&(s=parseInt(e[0]),i=parseInt(e[1]))}if(a>999){let r=new Date(a,t-1,e,s,i);if(!isNaN(r.getTime())){if(this.min){const e=this._parseDateStr(this.min);e&&new Date(r.getFullYear(),r.getMonth(),r.getDate())<new Date(e.getFullYear(),e.getMonth(),e.getDate())&&(r=new Date(e))}if(this.max){const e=this._parseDateStr(this.max);e&&new Date(r.getFullYear(),r.getMonth(),r.getDate())>new Date(e.getFullYear(),e.getMonth(),e.getDate())&&(r=new Date(e))}this._viewDate=r,this._selectedDate=r;const e=this._formatValue(r);this.value!==e&&(this.value=e),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,date:this._selectedDate},bubbles:!0,composed:!0}))}}}}}}_changeMonth(e){const t=new Date(this._viewDate);t.setMonth(t.getMonth()+e),this._viewDate=t}_setViewMonth(e){const t=new Date(this._viewDate);t.setMonth(parseInt(e)),this._viewDate=t}_setViewYear(e){const t=new Date(this._viewDate);t.setFullYear(parseInt(e)),this._viewDate=t}_setTime(e,t){const a=new Date(this._viewDate);if("hour"===e&&a.setHours(parseInt(t)),"minute"===e&&a.setMinutes(parseInt(t)),this._viewDate=a,this._selectedDate){const a=new Date(this._selectedDate);"hour"===e&&a.setHours(parseInt(t)),"minute"===e&&a.setMinutes(parseInt(t)),this._selectedDate=a,this.value=this._formatValue(a)}}_formatValue(e){if(!e)return"";const{separator:t,parts:a}=this._getDateFormat(),s=String(e.getDate()).padStart(2,"0"),i=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getFullYear());let n="";return n="year"===a[0]?`${r}${t}${i}${t}${s}`:"day"===a[0]?`${s}${t}${i}${t}${r}`:`${i}${t}${s}${t}${r}`,"year"===this.mode?String(r):"month"===this.mode?`${i}${t}${r}`:(this.showTime&&(n+=` ${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`),n)}_handleToday(e){e&&e.stopPropagation();const t=/* @__PURE__ */new Date;this._viewDate=t,this._selectDate(t.getDate(),!0)}_handleDone(e){e&&e.stopPropagation(),this.open=!1}_handleKeydown(e){if(!this.open)return void("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.open=!0));if("Escape"===e.key)return void(this.open=!1);const t=new Date(this._viewDate);let a=!0;switch(e.key){case"ArrowLeft":t.setDate(t.getDate()-1);break;case"ArrowRight":t.setDate(t.getDate()+1);break;case"ArrowUp":t.setDate(t.getDate()-7);break;case"ArrowDown":t.setDate(t.getDate()+7);break;case"Enter":const e=new Date(this._viewDate);this._isDisabled(e)||this._selectDate(this._viewDate.getDate(),!0);break;default:a=!1}a&&(e.preventDefault(),this._viewDate=t)}_parseDateStr(e){return e?(e.match(/^\d{4}-\d{2}-\d{2}$/),new Date(e)):null}_isDisabled(e){if(!e)return!1;const t=this._parseDateStr(this.min),a=this._parseDateStr(this.max),s=new Date(e.getFullYear(),e.getMonth(),e.getDate());return!!(t&&s<new Date(t.getFullYear(),t.getMonth(),t.getDate()))||!!(a&&s>new Date(a.getFullYear(),a.getMonth(),a.getDate()))}_selectDate(e,t){if(!t)return;const a=new Date(this._viewDate);"date"===this.mode&&a.setDate(e),this._isDisabled(a)||(this._selectedDate=a,this.value=this._formatValue(a),this.showTime&&"date"===this.mode||(this.open=!1),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,date:this._selectedDate},bubbles:!0,composed:!0})))}_selectMonth(e){const t=new Date(this._viewDate);t.setMonth(e),this._viewDate=t,this._selectedDate=t,this.value=this._formatValue(t),this.open=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,date:this._selectedDate},bubbles:!0,composed:!0}))}_selectYear(e){const t=new Date(this._viewDate);t.setFullYear(e),this._viewDate=t,this._selectedDate=t,this.value=this._formatValue(t),this.open=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,date:this._selectedDate},bubbles:!0,composed:!0}))}_renderCalendar(){const e=this._viewDate.getFullYear(),t=this._viewDate.getMonth(),a=this._viewDate.getDate(),s=Array.from({length:12},(e,t)=>{const a=new Date(2e3,t,1);return new Intl.DateTimeFormat(this.locale,{month:"long"}).format(a)});new Intl.DateTimeFormat(this.locale,{weekday:"narrow"}).format(new Date(2024,0,7)),new Intl.DateTimeFormat(this.locale,{weekday:"narrow"}).format(new Date(2024,0,7));let r=1;(this.locale.startsWith("en-US")||this.locale.startsWith("ja")||this.locale.startsWith("zh"))&&(r=0);const n=[];for(let i=0;i<7;i++){const e=new Date(2024,0,7+i+r);n.push(new Intl.DateTimeFormat(this.locale,{weekday:"short"}).format(e))}let o=(new Date(e,t,1).getDay()-r+7)%7;const l=new Date(e,t+1,0).getDate(),c=new Date(e,t,0).getDate(),d=[];for(let i=o-1;i>=0;i--)d.push({day:c-i,current:!1});for(let i=1;i<=l;i++)d.push({day:i,current:!0});const h=42-d.length;for(let i=1;i<=h;i++)d.push({day:i,current:!1});const p=/* @__PURE__ */(new Date).getFullYear(),g=[];for(let i=p-50;i<=p+50;i++)g.push(i);const u=/* @__PURE__ */new Date,m=a=>a===u.getDate()&&t===u.getMonth()&&e===u.getFullYear(),v=a=>!!this._selectedDate&&a===this._selectedDate.getDate()&&t===this._selectedDate.getMonth()&&e===this._selectedDate.getFullYear();return i`
1
+ var e,t=Object.defineProperty;import{LitElement as a,css as s,html as i}from"lit";import{classMap as r}from"lit/directives/class-map.js";import{F as n}from"../chunks/FormAssociated-Cx5D8YQA.js";class o extends(n(a)){static get properties(){return{...super.properties,open:{type:Boolean,reflect:!0},placeholder:{type:String},label:{type:String},showTime:{type:Boolean},fullwidth:{type:Boolean,reflect:!0},mode:{type:String},locale:{type:String},min:{type:String},max:{type:String},_viewDate:{type:Object},_selectedDate:{type:Object}}}constructor(){super(),this.open=!1,this.disabled=!1,this.mode="date",this.locale="tr-TR",this.placeholder="Tarih seçiniz...",this.min="",this.max="",this._viewDate=/* @__PURE__ */new Date,this.value="",this._handleOutsideClick=this._handleOutsideClick.bind(this)}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}_handleOutsideClick(e){this.open&&!e.composedPath().includes(this)&&(this.open=!1)}togglePopup(e){e&&e.stopPropagation(),this.disabled||(this.open=!this.open)}_handleInputKeydown(e){["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","Home","End"].includes(e.key)||(e.ctrlKey||e.metaKey)&&["a","c","v","x"].includes(e.key.toLowerCase())||/^\d$/.test(e.key)||e.preventDefault()}_getDateFormat(){const e=new Date(2023,11,31),t=new Intl.DateTimeFormat(this.locale).formatToParts(e),a=t.filter(e=>"literal"!==e.type).map(e=>e.type),s=t.find(e=>"literal"===e.type);let i=s?s.value:".";return i=i.includes(".")?".":i.includes("/")?"/":i.includes("-")?"-":".",{parts:a,separator:i}}_handleManualInput(e){let t=e.detail.value;t=t.replace(/\D/g,"");const{parts:a,separator:s}=this._getDateFormat(),i="year"===a[0];let r="";if(t.length>0&&(i?t.length<=4?r=t:t.length<=6?r=`${t.slice(0,4)}${s}${t.slice(4)}`:t.length<=8&&(r=`${t.slice(0,4)}${s}${t.slice(4,6)}${s}${t.slice(6)}`):t.length<=2?r=t:t.length<=4?r=`${t.slice(0,2)}${s}${t.slice(2)}`:t.length<=8&&(r=`${t.slice(0,2)}${s}${t.slice(2,4)}${s}${t.slice(4)}`),this.showTime&&t.length>8)){const e=r,a=t.slice(8);r=a.length<=2?`${e} ${a}`:`${e} ${a.slice(0,2)}:${a.slice(2,4)}`}if(t.length>=8){let e,n,o;if(i)o=parseInt(t.slice(0,4)),n=parseInt(t.slice(4,6)),e=parseInt(t.slice(6,8));else{const s=parseInt(t.slice(0,2)),i=parseInt(t.slice(2,4)),r=parseInt(t.slice(4,8));"day"===a[0]?(e=s,n=i,o=r):(n=s,e=i,o=r)}e>31&&(e=31),0===e&&(e=1),n>12&&(n=12),0===n&&(n=1),o>2100&&(o=2100);const l=String(e).padStart(2,"0"),c=String(n).padStart(2,"0"),d=String(o);if(r=i?`${d}${s}${c}${s}${l}`:"day"===a[0]?`${l}${s}${c}${s}${d}`:`${c}${s}${l}${s}${d}`,this.showTime&&t.length>8){r.split(" ")[1];let e=parseInt(t.slice(8,10)||"0"),a=parseInt(t.slice(10,12)||"0");e>23&&(e=23),a>59&&(a=59);const s=String(e).padStart(2,"0"),i=String(a).padStart(2,"0");t.length<=10?r+=` ${s}`:r+=` ${s}:${i}`}}if(this.value=r||t,this.value.length>=8){const e=this.value.split(" ")[0].split(s);if(this.value.split(" ")[1]?.split(":"),3===e.length){let e,t,a;if(i){"year"===currentParts[0]?(a=parseInt(dateComponents[0]),t=parseInt(dateComponents[1]),e=parseInt(dateComponents[2])):"day"===currentParts[0]?(e=parseInt(dateComponents[0]),t=parseInt(dateComponents[1]),a=parseInt(dateComponents[2])):(t=parseInt(dateComponents[0]),e=parseInt(dateComponents[1]),a=parseInt(dateComponents[2]));let s=0,i=0;if(timePartStr){const e=timePartStr.split(":");e.length>=2&&(s=parseInt(e[0]),i=parseInt(e[1]))}if(a>999){let r=new Date(a,t-1,e,s,i);if(!isNaN(r.getTime())){if(this.min){const e=this._parseDateStr(this.min);e&&new Date(r.getFullYear(),r.getMonth(),r.getDate())<new Date(e.getFullYear(),e.getMonth(),e.getDate())&&(r=new Date(e))}if(this.max){const e=this._parseDateStr(this.max);e&&new Date(r.getFullYear(),r.getMonth(),r.getDate())>new Date(e.getFullYear(),e.getMonth(),e.getDate())&&(r=new Date(e))}this._viewDate=r,this._selectedDate=r;const e=this._formatValue(r);this.value!==e&&(this.value=e),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,date:this._selectedDate},bubbles:!0,composed:!0}))}}}}}}_changeMonth(e){const t=new Date(this._viewDate);t.setMonth(t.getMonth()+e),this._viewDate=t}_setViewMonth(e){const t=new Date(this._viewDate);t.setMonth(parseInt(e)),this._viewDate=t}_setViewYear(e){const t=new Date(this._viewDate);t.setFullYear(parseInt(e)),this._viewDate=t}_setTime(e,t){const a=new Date(this._viewDate);if("hour"===e&&a.setHours(parseInt(t)),"minute"===e&&a.setMinutes(parseInt(t)),this._viewDate=a,this._selectedDate){const a=new Date(this._selectedDate);"hour"===e&&a.setHours(parseInt(t)),"minute"===e&&a.setMinutes(parseInt(t)),this._selectedDate=a,this.value=this._formatValue(a)}}_formatValue(e){if(!e)return"";const{separator:t,parts:a}=this._getDateFormat(),s=String(e.getDate()).padStart(2,"0"),i=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getFullYear());let n="";return n="year"===a[0]?`${r}${t}${i}${t}${s}`:"day"===a[0]?`${s}${t}${i}${t}${r}`:`${i}${t}${s}${t}${r}`,"year"===this.mode?String(r):"month"===this.mode?`${i}${t}${r}`:(this.showTime&&(n+=` ${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`),n)}_handleToday(e){e&&e.stopPropagation();const t=/* @__PURE__ */new Date;this._viewDate=t,this._selectDate(t.getDate(),!0)}_handleDone(e){e&&e.stopPropagation(),this.open=!1}_handleKeydown(e){if(!this.open)return void("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.open=!0));if("Escape"===e.key)return void(this.open=!1);const t=new Date(this._viewDate);let a=!0;switch(e.key){case"ArrowLeft":t.setDate(t.getDate()-1);break;case"ArrowRight":t.setDate(t.getDate()+1);break;case"ArrowUp":t.setDate(t.getDate()-7);break;case"ArrowDown":t.setDate(t.getDate()+7);break;case"Enter":const e=new Date(this._viewDate);this._isDisabled(e)||this._selectDate(this._viewDate.getDate(),!0);break;default:a=!1}a&&(e.preventDefault(),this._viewDate=t)}_parseDateStr(e){if(!e)return null;if(e instanceof Date)return e;if("number"==typeof e)return new Date(e);const t=String(e);return t.match(/^\d{4}-\d{2}-\d{2}$/),new Date(t)}_isDisabled(e){if(!e)return!1;const t=this._parseDateStr(this.min),a=this._parseDateStr(this.max),s=new Date(e.getFullYear(),e.getMonth(),e.getDate());return!!(t&&s<new Date(t.getFullYear(),t.getMonth(),t.getDate()))||!!(a&&s>new Date(a.getFullYear(),a.getMonth(),a.getDate()))}_selectDate(e,t){if(!t)return;const a=new Date(this._viewDate);"date"===this.mode&&a.setDate(e),this._isDisabled(a)||(this._selectedDate=a,this.value=this._formatValue(a),this.showTime&&"date"===this.mode||(this.open=!1),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,date:this._selectedDate},bubbles:!0,composed:!0})))}_selectMonth(e){const t=new Date(this._viewDate);t.setMonth(e),this._viewDate=t,this._selectedDate=t,this.value=this._formatValue(t),this.open=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,date:this._selectedDate},bubbles:!0,composed:!0}))}_selectYear(e){const t=new Date(this._viewDate);t.setFullYear(e),this._viewDate=t,this._selectedDate=t,this.value=this._formatValue(t),this.open=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,date:this._selectedDate},bubbles:!0,composed:!0}))}_renderCalendar(){const e=this._viewDate.getFullYear(),t=this._viewDate.getMonth(),a=this._viewDate.getDate(),s=Array.from({length:12},(e,t)=>{const a=new Date(2e3,t,1);return new Intl.DateTimeFormat(this.locale,{month:"long"}).format(a)});new Intl.DateTimeFormat(this.locale,{weekday:"narrow"}).format(new Date(2024,0,7)),new Intl.DateTimeFormat(this.locale,{weekday:"narrow"}).format(new Date(2024,0,7));let n=1;(this.locale.startsWith("en-US")||this.locale.startsWith("ja")||this.locale.startsWith("zh"))&&(n=0);const o=[];for(let i=0;i<7;i++){const e=new Date(2024,0,7+i+n);o.push(new Intl.DateTimeFormat(this.locale,{weekday:"short"}).format(e))}let l=(new Date(e,t,1).getDay()-n+7)%7;const c=new Date(e,t+1,0).getDate(),d=new Date(e,t,0).getDate(),h=[];for(let i=l-1;i>=0;i--)h.push({day:d-i,current:!1});for(let i=1;i<=c;i++)h.push({day:i,current:!0});const p=42-h.length;for(let i=1;i<=p;i++)h.push({day:i,current:!1});const g=/* @__PURE__ */(new Date).getFullYear(),u=[];for(let i=g-50;i<=g+50;i++)u.push(i);const m=/* @__PURE__ */new Date,v=a=>a===m.getDate()&&t===m.getMonth()&&e===m.getFullYear(),w=a=>!!this._selectedDate&&a===this._selectedDate.getDate()&&t===this._selectedDate.getMonth()&&e===this._selectedDate.getFullYear();return i`
2
2
  <div class="calendar-header">
3
3
  <button class="nav-btn" @click="${e=>{e.stopPropagation(),this._changeMonth(-1)}}">←</button>
4
4
  <div class="month-year">
@@ -6,15 +6,15 @@ var e,t=Object.defineProperty;import{LitElement as a,css as s,html as i}from"lit
6
6
  ${s.map((e,a)=>i`<option value="${a}" ?selected="${a===t}">${e}</option>`)}
7
7
  </select>
8
8
  <select class="header-select" @click="${e=>e.stopPropagation()}" @change="${e=>this._setViewYear(e.target.value)}">
9
- ${g.map(t=>i`<option value="${t}" ?selected="${t===e}">${t}</option>`)}
9
+ ${u.map(t=>i`<option value="${t}" ?selected="${t===e}">${t}</option>`)}
10
10
  </select>
11
11
  </div>
12
12
  <button class="nav-btn" @click="${e=>{e.stopPropagation(),this._changeMonth(1)}}">→</button>
13
13
  </div>
14
14
  <div class="calendar-grid">
15
- ${n.map(e=>i`<div class="weekday">${e}</div>`)}
16
- ${d.map(s=>i`
17
- <div class="${classMap({day:!0,"other-month":!s.current,today:s.current&&m(s.day),selected:s.current&&v(s.day),focused:s.current&&s.day===a,disabled:s.current&&this._isDisabled(new Date(e,t,s.day))})}" @click="${e=>{e.stopPropagation(),this._selectDate(s.day,s.current)}}">
15
+ ${o.map(e=>i`<div class="weekday">${e}</div>`)}
16
+ ${h.map(s=>i`
17
+ <div class="${r({day:!0,"other-month":!s.current,today:s.current&&v(s.day),selected:s.current&&w(s.day),focused:s.current&&s.day===a,disabled:s.current&&this._isDisabled(new Date(e,t,s.day))})}" @click="${e=>{e.stopPropagation(),this._selectDate(s.day,s.current)}}">
18
18
  ${s.day}
19
19
  </div>
20
20
  `)}
@@ -90,6 +90,7 @@ var e,t=Object.defineProperty;import{LitElement as a,css as s,html as i}from"lit
90
90
  .label="${this.label}"
91
91
  .errorText="${this.errorText}"
92
92
  ?disabled="${this.disabled}"
93
+ ?fullwidth="${this.fullwidth}"
93
94
  @kg-input="${this._handleManualInput}"
94
95
  @keydown="${this._handleInputKeydown}"
95
96
  @click="${this.togglePopup}"
@@ -105,10 +106,10 @@ var e,t=Object.defineProperty;import{LitElement as a,css as s,html as i}from"lit
105
106
  </kg-input>
106
107
  </div>
107
108
 
108
- <div class="${classMap({"datepicker-popup":!0,open:this.open})}">
109
+ <div class="${r({"datepicker-popup":!0,open:this.open})}">
109
110
  ${e}
110
111
  </div>
111
- `}}((e,a,s)=>{a in e?t(e,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[a]=s})(n,"symbol"!=typeof(e="styles")?e+"":e,s`
112
+ `}}((e,a,s)=>{a in e?t(e,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[a]=s})(o,"symbol"!=typeof(e="styles")?e+"":e,s`
112
113
  :host {
113
114
  display: inline-block;
114
115
  width: 100%;
@@ -347,4 +348,4 @@ var e,t=Object.defineProperty;import{LitElement as a,css as s,html as i}from"lit
347
348
  font-weight: 700;
348
349
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
349
350
  }
350
- `),"undefined"==typeof customElements||customElements.get("kg-datepicker")||customElements.define("kg-datepicker",n);export{n as kgdatepicker};
351
+ `),"undefined"==typeof customElements||customElements.get("kg-datepicker")||customElements.define("kg-datepicker",o);export{o as kgdatepicker};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazhus/kg-ui",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -6,6 +6,8 @@ export class kgaccordionitem extends LitElement {
6
6
  open: boolean;
7
7
  /** */
8
8
  disabled: boolean;
9
+ /** Generated from static properties */
10
+ title: string;
9
11
  }
10
12
 
11
13
  declare global {
@@ -18,6 +20,7 @@ declare global {
18
20
  'kg-accordion-item': {
19
21
  open?: boolean;
20
22
  disabled?: boolean;
23
+ title?: string;
21
24
  [key: string]: any;
22
25
  };
23
26
  }
@@ -8,6 +8,16 @@ export class kgavatar extends LitElement {
8
8
  shape: string;
9
9
  /** */
10
10
  alt: string;
11
+ /** Generated from static properties */
12
+ src: string;
13
+ /** Generated from static properties */
14
+ name: string;
15
+ /** Generated from static properties */
16
+ status: string;
17
+ /** Generated from static properties */
18
+ badge: string;
19
+ /** Generated from static properties */
20
+ color: string;
11
21
  }
12
22
 
13
23
  declare global {
@@ -21,6 +31,11 @@ declare global {
21
31
  size?: string;
22
32
  shape?: string;
23
33
  alt?: string;
34
+ src?: string;
35
+ name?: string;
36
+ status?: string;
37
+ badge?: string;
38
+ color?: string;
24
39
  [key: string]: any;
25
40
  };
26
41
  }
@@ -6,6 +6,8 @@ export class kgbreadcrumbitem extends LitElement {
6
6
  active: boolean;
7
7
  /** */
8
8
  separator: string;
9
+ /** Generated from static properties */
10
+ href: string;
9
11
  }
10
12
 
11
13
  declare global {
@@ -18,6 +20,7 @@ declare global {
18
20
  'kg-breadcrumb-item': {
19
21
  active?: boolean;
20
22
  separator?: string;
23
+ href?: string;
21
24
  [key: string]: any;
22
25
  };
23
26
  }
@@ -26,6 +26,22 @@ export class kgbutton extends LitElement {
26
26
  type: string;
27
27
  /** */
28
28
  form: any;
29
+ /** Generated from static properties */
30
+ fullwidth: boolean;
31
+ /** Generated from static properties */
32
+ circular: boolean;
33
+ /** Generated from static properties */
34
+ square: boolean;
35
+ /** Generated from static properties */
36
+ loading: boolean;
37
+ /** Generated from static properties */
38
+ basic: boolean;
39
+ /** Generated from static properties */
40
+ inverted: boolean;
41
+ /** Generated from static properties */
42
+ active: boolean;
43
+ /** Generated from static properties */
44
+ text: boolean;
29
45
  }
30
46
 
31
47
  declare global {
@@ -48,6 +64,14 @@ declare global {
48
64
  hasRight?: boolean;
49
65
  type?: string;
50
66
  form?: any;
67
+ fullwidth?: boolean;
68
+ circular?: boolean;
69
+ square?: boolean;
70
+ loading?: boolean;
71
+ basic?: boolean;
72
+ inverted?: boolean;
73
+ active?: boolean;
74
+ text?: boolean;
51
75
  [key: string]: any;
52
76
  };
53
77
  }
@@ -10,6 +10,10 @@ export class kgcard extends LitElement {
10
10
  basic: boolean;
11
11
  /** */
12
12
  padded: boolean;
13
+ /** Generated from static properties */
14
+ vertical: boolean;
15
+ /** Generated from static properties */
16
+ color: string;
13
17
  }
14
18
 
15
19
  declare global {
@@ -24,6 +28,8 @@ declare global {
24
28
  inverted?: boolean;
25
29
  basic?: boolean;
26
30
  padded?: boolean;
31
+ vertical?: boolean;
32
+ color?: string;
27
33
  [key: string]: any;
28
34
  };
29
35
  }
@@ -21,9 +21,15 @@ export class kgdatepicker extends LitElement {
21
21
  /** */
22
22
  placeholder: string;
23
23
  /** */
24
- min: string;
24
+ min: string | number;
25
25
  /** */
26
- max: string;
26
+ max: string | number;
27
+ /** */
28
+ label: string;
29
+ /** */
30
+ showTime: boolean;
31
+ /** */
32
+ fullwidth: boolean;
27
33
  /** */
28
34
  form: any;
29
35
  /** */
@@ -47,8 +53,11 @@ declare global {
47
53
  mode?: string;
48
54
  locale?: string;
49
55
  placeholder?: string;
50
- min?: string;
51
- max?: string;
56
+ min?: string | number;
57
+ max?: string | number;
58
+ label?: string;
59
+ showTime?: boolean;
60
+ fullwidth?: boolean;
52
61
  form?: any;
53
62
  type?: string;
54
63
  [key: string]: any;
@@ -10,6 +10,8 @@ export class kgdrawer extends LitElement {
10
10
  size: string;
11
11
  /** */
12
12
  closable: boolean;
13
+ /** Generated from static properties */
14
+ noOverlay: boolean;
13
15
  }
14
16
 
15
17
  declare global {
@@ -24,6 +26,7 @@ declare global {
24
26
  placement?: string;
25
27
  size?: string;
26
28
  closable?: boolean;
29
+ noOverlay?: boolean;
27
30
  [key: string]: any;
28
31
  };
29
32
  }
@@ -2,6 +2,10 @@ import { LitElement } from 'lit';
2
2
 
3
3
  /** @customElement kg-list-item */
4
4
  export class kglistitem extends LitElement {
5
+ /** Generated from static properties */
6
+ active: boolean;
7
+ /** Generated from static properties */
8
+ clickable: boolean;
5
9
  }
6
10
 
7
11
  declare global {
@@ -12,7 +16,8 @@ declare global {
12
16
  namespace JSX {
13
17
  interface IntrinsicElements {
14
18
  'kg-list-item': {
15
-
19
+ active?: boolean;
20
+ clickable?: boolean;
16
21
  [key: string]: any;
17
22
  };
18
23
  }
@@ -5,7 +5,7 @@ export class kgprogress extends LitElement {
5
5
  /** */
6
6
  value: number;
7
7
  /** */
8
- max: number;
8
+ max: string | number;
9
9
  /** */
10
10
  color: string;
11
11
  /** */
@@ -25,7 +25,7 @@ declare global {
25
25
  interface IntrinsicElements {
26
26
  'kg-progress': {
27
27
  value?: number;
28
- max?: number;
28
+ max?: string | number;
29
29
  color?: string;
30
30
  height?: string;
31
31
  showValue?: boolean;
@@ -18,6 +18,10 @@ export class kgradio extends LitElement {
18
18
  form: any;
19
19
  /** */
20
20
  type: string;
21
+ /** Generated from static properties */
22
+ label: string;
23
+ /** Generated from static properties */
24
+ color: string;
21
25
  }
22
26
 
23
27
  declare global {
@@ -36,6 +40,8 @@ declare global {
36
40
  checked?: boolean;
37
41
  form?: any;
38
42
  type?: string;
43
+ label?: string;
44
+ color?: string;
39
45
  [key: string]: any;
40
46
  };
41
47
  }
@@ -8,6 +8,8 @@ export class kgrow extends LitElement {
8
8
  items: string;
9
9
  /** Background color */
10
10
  color: string;
11
+ /** Generated from static properties */
12
+ gap: string;
11
13
  }
12
14
 
13
15
  declare global {
@@ -21,6 +23,7 @@ declare global {
21
23
  justify?: string;
22
24
  items?: string;
23
25
  color?: string;
26
+ gap?: string;
24
27
  [key: string]: any;
25
28
  };
26
29
  }
@@ -13,9 +13,9 @@ export class kgslider extends LitElement {
13
13
  /** Form property */
14
14
  errorText: string;
15
15
  /** */
16
- min: number;
16
+ min: string | number;
17
17
  /** */
18
- max: number;
18
+ max: string | number;
19
19
  /** */
20
20
  step: number;
21
21
  /** */
@@ -41,8 +41,8 @@ declare global {
41
41
  disabled?: boolean;
42
42
  required?: boolean;
43
43
  errorText?: string;
44
- min?: number;
45
- max?: number;
44
+ min?: string | number;
45
+ max?: string | number;
46
46
  step?: number;
47
47
  hideValue?: boolean;
48
48
  showPins?: boolean;
@@ -6,6 +6,12 @@ export class kgtag extends LitElement {
6
6
  size: string;
7
7
  /** */
8
8
  color: string;
9
+ /** Generated from static properties */
10
+ pill: boolean;
11
+ /** Generated from static properties */
12
+ basic: boolean;
13
+ /** Generated from static properties */
14
+ closable: boolean;
9
15
  }
10
16
 
11
17
  declare global {
@@ -18,6 +24,9 @@ declare global {
18
24
  'kg-tag': {
19
25
  size?: string;
20
26
  color?: string;
27
+ pill?: boolean;
28
+ basic?: boolean;
29
+ closable?: boolean;
21
30
  [key: string]: any;
22
31
  };
23
32
  }
@@ -10,6 +10,12 @@ export class kgtext extends LitElement {
10
10
  align: string;
11
11
  /** */
12
12
  dividing: boolean;
13
+ /** Generated from static properties */
14
+ color: string;
15
+ /** Generated from static properties */
16
+ as: string;
17
+ /** Generated from static properties */
18
+ disabled: boolean;
13
19
  }
14
20
 
15
21
  declare global {
@@ -24,6 +30,9 @@ declare global {
24
30
  weight?: string;
25
31
  align?: string;
26
32
  dividing?: boolean;
33
+ color?: string;
34
+ as?: string;
35
+ disabled?: boolean;
27
36
  [key: string]: any;
28
37
  };
29
38
  }
@@ -8,6 +8,10 @@ export class kgtoast extends LitElement {
8
8
  visible: boolean;
9
9
  /** */
10
10
  color: string;
11
+ /** Generated from static properties */
12
+ title: string;
13
+ /** Generated from static properties */
14
+ message: string;
11
15
  }
12
16
 
13
17
  declare global {
@@ -21,6 +25,8 @@ declare global {
21
25
  duration?: number;
22
26
  visible?: boolean;
23
27
  color?: string;
28
+ title?: string;
29
+ message?: string;
24
30
  [key: string]: any;
25
31
  };
26
32
  }
@@ -8,6 +8,10 @@ export class kgtreeitem extends LitElement {
8
8
  selected: boolean;
9
9
  /** */
10
10
  level: number;
11
+ /** Generated from static properties */
12
+ label: string;
13
+ /** Generated from static properties */
14
+ page: string;
11
15
  }
12
16
 
13
17
  declare global {
@@ -21,6 +25,8 @@ declare global {
21
25
  expanded?: boolean;
22
26
  selected?: boolean;
23
27
  level?: number;
28
+ label?: string;
29
+ page?: string;
24
30
  [key: string]: any;
25
31
  };
26
32
  }
package/types/index.d.ts CHANGED
@@ -96,17 +96,24 @@ declare global {
96
96
  'kg-accordion-item': {
97
97
  open?: boolean;
98
98
  disabled?: boolean;
99
+ title?: string;
99
100
  [key: string]: any;
100
101
  };
101
102
  'kg-avatar': {
102
103
  size?: string;
103
104
  shape?: string;
104
105
  alt?: string;
106
+ src?: string;
107
+ name?: string;
108
+ status?: string;
109
+ badge?: string;
110
+ color?: string;
105
111
  [key: string]: any;
106
112
  };
107
113
  'kg-breadcrumb-item': {
108
114
  active?: boolean;
109
115
  separator?: string;
116
+ href?: string;
110
117
  [key: string]: any;
111
118
  };
112
119
  'kg-breadcrumbs': {
@@ -126,6 +133,14 @@ declare global {
126
133
  hasRight?: boolean;
127
134
  type?: string;
128
135
  form?: any;
136
+ fullwidth?: boolean;
137
+ circular?: boolean;
138
+ square?: boolean;
139
+ loading?: boolean;
140
+ basic?: boolean;
141
+ inverted?: boolean;
142
+ active?: boolean;
143
+ text?: boolean;
129
144
  [key: string]: any;
130
145
  };
131
146
  'kg-card': {
@@ -133,6 +148,8 @@ declare global {
133
148
  inverted?: boolean;
134
149
  basic?: boolean;
135
150
  padded?: boolean;
151
+ vertical?: boolean;
152
+ color?: string;
136
153
  [key: string]: any;
137
154
  };
138
155
  'kg-checkbox': {
@@ -190,8 +207,11 @@ declare global {
190
207
  mode?: string;
191
208
  locale?: string;
192
209
  placeholder?: string;
193
- min?: string;
194
- max?: string;
210
+ min?: string | number;
211
+ max?: string | number;
212
+ label?: string;
213
+ showTime?: boolean;
214
+ fullwidth?: boolean;
195
215
  form?: any;
196
216
  type?: string;
197
217
  [key: string]: any;
@@ -209,6 +229,7 @@ declare global {
209
229
  placement?: string;
210
230
  size?: string;
211
231
  closable?: boolean;
232
+ noOverlay?: boolean;
212
233
  [key: string]: any;
213
234
  };
214
235
  'kg-file-upload': {
@@ -269,7 +290,8 @@ declare global {
269
290
  [key: string]: any;
270
291
  };
271
292
  'kg-list-item': {
272
-
293
+ active?: boolean;
294
+ clickable?: boolean;
273
295
  [key: string]: any;
274
296
  };
275
297
  'kg-loader': {
@@ -288,7 +310,7 @@ declare global {
288
310
  };
289
311
  'kg-progress': {
290
312
  value?: number;
291
- max?: number;
313
+ max?: string | number;
292
314
  color?: string;
293
315
  height?: string;
294
316
  showValue?: boolean;
@@ -304,6 +326,8 @@ declare global {
304
326
  checked?: boolean;
305
327
  form?: any;
306
328
  type?: string;
329
+ label?: string;
330
+ color?: string;
307
331
  [key: string]: any;
308
332
  };
309
333
  'kg-radio-group': {
@@ -321,6 +345,7 @@ declare global {
321
345
  justify?: string;
322
346
  items?: string;
323
347
  color?: string;
348
+ gap?: string;
324
349
  [key: string]: any;
325
350
  };
326
351
  'kg-select': {
@@ -351,8 +376,8 @@ declare global {
351
376
  disabled?: boolean;
352
377
  required?: boolean;
353
378
  errorText?: string;
354
- min?: number;
355
- max?: number;
379
+ min?: string | number;
380
+ max?: string | number;
356
381
  step?: number;
357
382
  hideValue?: boolean;
358
383
  showPins?: boolean;
@@ -399,6 +424,9 @@ declare global {
399
424
  'kg-tag': {
400
425
  size?: string;
401
426
  color?: string;
427
+ pill?: boolean;
428
+ basic?: boolean;
429
+ closable?: boolean;
402
430
  [key: string]: any;
403
431
  };
404
432
  'kg-text': {
@@ -406,6 +434,9 @@ declare global {
406
434
  weight?: string;
407
435
  align?: string;
408
436
  dividing?: boolean;
437
+ color?: string;
438
+ as?: string;
439
+ disabled?: boolean;
409
440
  [key: string]: any;
410
441
  };
411
442
  'kg-textarea': {
@@ -428,6 +459,8 @@ declare global {
428
459
  duration?: number;
429
460
  visible?: boolean;
430
461
  color?: string;
462
+ title?: string;
463
+ message?: string;
431
464
  [key: string]: any;
432
465
  };
433
466
  'kg-tree': {
@@ -438,6 +471,8 @@ declare global {
438
471
  expanded?: boolean;
439
472
  selected?: boolean;
440
473
  level?: number;
474
+ label?: string;
475
+ page?: string;
441
476
  [key: string]: any;
442
477
  };
443
478
  }