solely 0.4.12 → 0.4.14
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/dist/compiler/ir/buildIR.cjs +1 -1
- package/dist/compiler/ir/buildIR.js +1 -1
- package/dist/components/commands/modal/index.cjs +1 -1
- package/dist/components/commands/modal/index.js +1 -1
- package/dist/components/commands/modal/types.d.ts +4 -2
- package/dist/components/elements/alert/index.cjs +1 -1
- package/dist/components/elements/alert/index.d.ts +2 -0
- package/dist/components/elements/alert/index.html.cjs +1 -1
- package/dist/components/elements/alert/index.html.js +1 -1
- package/dist/components/elements/alert/index.js +1 -1
- package/dist/components/elements/backtop/index.cjs +1 -1
- package/dist/components/elements/backtop/index.html.cjs +1 -1
- package/dist/components/elements/backtop/index.html.js +1 -1
- package/dist/components/elements/backtop/index.js +1 -1
- package/dist/components/elements/badge/index.cjs +1 -1
- package/dist/components/elements/badge/index.html.cjs +1 -1
- package/dist/components/elements/badge/index.html.js +1 -1
- package/dist/components/elements/badge/index.js +1 -1
- package/dist/components/elements/breadcrumb/index.cjs +1 -1
- package/dist/components/elements/breadcrumb/index.html.cjs +1 -1
- package/dist/components/elements/breadcrumb/index.html.js +1 -1
- package/dist/components/elements/breadcrumb/index.js +1 -1
- package/dist/components/elements/button/index.cjs +1 -1
- package/dist/components/elements/button/index.html.cjs +1 -1
- package/dist/components/elements/button/index.html.js +1 -1
- package/dist/components/elements/button/index.js +1 -1
- package/dist/components/elements/card/index.cjs +1 -1
- package/dist/components/elements/card/index.html.cjs +1 -1
- package/dist/components/elements/card/index.html.js +1 -1
- package/dist/components/elements/card/index.js +1 -1
- package/dist/components/elements/checkbox/index.cjs +1 -1
- package/dist/components/elements/checkbox/index.html.cjs +1 -1
- package/dist/components/elements/checkbox/index.html.js +1 -1
- package/dist/components/elements/checkbox/index.js +1 -1
- package/dist/components/elements/coordinate-input/index.cjs +1 -1
- package/dist/components/elements/coordinate-input/index.d.ts +2 -2
- package/dist/components/elements/coordinate-input/index.html.cjs +1 -1
- package/dist/components/elements/coordinate-input/index.html.js +1 -1
- package/dist/components/elements/coordinate-input/index.js +1 -1
- package/dist/components/elements/divider/index.cjs +1 -1
- package/dist/components/elements/divider/index.html.cjs +1 -1
- package/dist/components/elements/divider/index.html.js +1 -1
- package/dist/components/elements/divider/index.js +1 -1
- package/dist/components/elements/empty/index.cjs +1 -1
- package/dist/components/elements/empty/index.html.cjs +1 -1
- package/dist/components/elements/empty/index.html.js +1 -1
- package/dist/components/elements/empty/index.js +1 -1
- package/dist/components/elements/fab/index.cjs +1 -1
- package/dist/components/elements/fab/index.html.cjs +1 -1
- package/dist/components/elements/fab/index.html.js +1 -1
- package/dist/components/elements/fab/index.js +1 -1
- package/dist/components/elements/icon/index.cjs +1 -1
- package/dist/components/elements/icon/index.html.cjs +1 -1
- package/dist/components/elements/icon/index.html.js +1 -1
- package/dist/components/elements/icon/index.js +1 -1
- package/dist/components/elements/input/index.cjs +1 -1
- package/dist/components/elements/input/index.d.ts +1 -1
- package/dist/components/elements/input/index.html.cjs +1 -1
- package/dist/components/elements/input/index.html.js +1 -1
- package/dist/components/elements/input/index.js +1 -1
- package/dist/components/elements/not-found/index.cjs +1 -1
- package/dist/components/elements/not-found/index.html.cjs +1 -1
- package/dist/components/elements/not-found/index.html.js +1 -1
- package/dist/components/elements/not-found/index.js +1 -1
- package/dist/components/elements/pagination/index.cjs +1 -1
- package/dist/components/elements/pagination/index.html.cjs +1 -1
- package/dist/components/elements/pagination/index.html.js +1 -1
- package/dist/components/elements/pagination/index.js +1 -1
- package/dist/components/elements/progress/index.cjs +1 -1
- package/dist/components/elements/progress/index.html.cjs +1 -1
- package/dist/components/elements/progress/index.html.js +1 -1
- package/dist/components/elements/progress/index.js +1 -1
- package/dist/components/elements/radio/index.cjs +1 -1
- package/dist/components/elements/radio/index.d.ts +3 -0
- package/dist/components/elements/radio/index.html.cjs +1 -1
- package/dist/components/elements/radio/index.html.js +1 -1
- package/dist/components/elements/radio/index.js +1 -1
- package/dist/components/elements/rate/index.cjs +1 -1
- package/dist/components/elements/rate/index.d.ts +4 -0
- package/dist/components/elements/rate/index.html.cjs +1 -1
- package/dist/components/elements/rate/index.html.js +1 -1
- package/dist/components/elements/rate/index.js +1 -1
- package/dist/components/elements/select/index.cjs +1 -1
- package/dist/components/elements/select/index.d.ts +2 -0
- package/dist/components/elements/select/index.html.cjs +1 -1
- package/dist/components/elements/select/index.html.js +1 -1
- package/dist/components/elements/select/index.js +1 -1
- package/dist/components/elements/skeleton/index.cjs +1 -1
- package/dist/components/elements/skeleton/index.html.cjs +1 -1
- package/dist/components/elements/skeleton/index.html.js +1 -1
- package/dist/components/elements/skeleton/index.js +1 -1
- package/dist/components/elements/slider/index.cjs +1 -1
- package/dist/components/elements/slider/index.d.ts +8 -1
- package/dist/components/elements/slider/index.html.cjs +1 -1
- package/dist/components/elements/slider/index.html.js +1 -1
- package/dist/components/elements/slider/index.js +1 -1
- package/dist/components/elements/steps/index.cjs +1 -1
- package/dist/components/elements/steps/index.d.ts +1 -0
- package/dist/components/elements/steps/index.html.cjs +1 -1
- package/dist/components/elements/steps/index.html.js +1 -1
- package/dist/components/elements/steps/index.js +1 -1
- package/dist/components/elements/switch/index.cjs +1 -1
- package/dist/components/elements/switch/index.html.cjs +1 -1
- package/dist/components/elements/switch/index.html.js +1 -1
- package/dist/components/elements/switch/index.js +1 -1
- package/dist/components/elements/table/index.cjs +1 -1
- package/dist/components/elements/table/index.html.cjs +1 -1
- package/dist/components/elements/table/index.html.js +1 -1
- package/dist/components/elements/table/index.js +1 -1
- package/dist/components/elements/tabs/index.cjs +1 -1
- package/dist/components/elements/tabs/index.html.cjs +1 -1
- package/dist/components/elements/tabs/index.html.js +1 -1
- package/dist/components/elements/tabs/index.js +1 -1
- package/dist/components/elements/tag/index.cjs +1 -1
- package/dist/components/elements/tag/index.html.cjs +1 -1
- package/dist/components/elements/tag/index.html.js +1 -1
- package/dist/components/elements/tag/index.js +1 -1
- package/dist/components/elements/timeline/index.cjs +1 -1
- package/dist/components/elements/timeline/index.html.cjs +1 -1
- package/dist/components/elements/timeline/index.html.js +1 -1
- package/dist/components/elements/timeline/index.js +1 -1
- package/dist/components/elements/tooltip/index.d.ts +4 -0
- package/dist/components/elements/tree/index.cjs +1 -1
- package/dist/components/elements/tree/index.html.cjs +1 -1
- package/dist/components/elements/tree/index.html.js +1 -1
- package/dist/components/elements/tree/index.js +1 -1
- package/dist/components/elements/upload/index.cjs +1 -1
- package/dist/components/elements/upload/index.d.ts +3 -0
- package/dist/components/elements/upload/index.html.cjs +1 -1
- package/dist/components/elements/upload/index.html.js +1 -1
- package/dist/components/elements/upload/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/router/router-link.cjs +1 -1
- package/dist/router/router-link.html.cjs +1 -0
- package/dist/router/router-link.html.js +1 -0
- package/dist/router/router-link.js +1 -1
- package/dist/runtime/component/decorators.cjs +1 -1
- package/dist/runtime/component/decorators.js +1 -1
- package/dist/shared/functions.cjs +1 -1
- package/dist/shared/functions.d.ts +1 -0
- package/dist/shared/functions.js +1 -1
- package/dist/shared/index.cjs +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/shared/templateError.cjs +1 -1
- package/dist/shared/templateError.js +1 -1
- package/package.json +2 -1
- package/dist/icons/LICENSE.txt +0 -14
- package/dist/icons/bootstrap-icons.svg +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t from"./style.css.js";import{__SOLELY_IR__ as a}from"./index.html.js";import e from"../../../runtime/component/base-element.js";import{CustomElement as s}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let r=class extends e{getRateClasses(){return{"is-disabled":!!this.$data.disabled,"is-readonly":!!this.$data.readonly}}get value(){return this.$data.value||0}set value(t){this.$data.disabled||this.$data.readonly||this.setValue(t)}getStarClasses(t){const a=this.$data.hoverValue,e=this.$data.value||0,s=void 0!==a?a:e;return{"rate__star--full":t<=s,"rate__star--half":!!this.$data.allowHalf&&t-.5===s,"rate__star--zero":t>s}}mounted(){this.refresh(),this.$data.hoverValue=void 0,this.generateStarCount()}updated(){this.updateAriaAttributes()}updateAriaAttributes(){var t;const a=null==(t=this.shadowRoot)?void 0:t.querySelector(".rate");a&&(a.setAttribute("aria-valuenow",String(this.$data.value||0)),a.setAttribute("aria-valuemin","0"),a.setAttribute("aria-valuemax",String(this.$data.count||5)),a.setAttribute("aria-disabled",this.$data.disabled?"true":"false"),a.setAttribute("aria-readonly",this.$data.readonly?"true":"false"))}generateStarCount(){const t=this.$data.count||5;this.$data.starCount=Array.from({length:t},(t,a)=>a+1)}handleClick(t){if(this.$data.disabled||this.$data.readonly)return;const a=this.$data.allowHalf&&this.$data.hoverValue||t;this.$data.allowClear&&a===this.$data.value?this.$data.value=0:this.$data.value=a,this.$data.hoverValue=void 0,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}handleMouseEnter(t){this.$data.disabled||this.$data.readonly||(this.$data.hoverValue=t)}handleMouseLeave(){this.$data.disabled||this.$data.readonly||(this.$data.hoverValue=void 0)}handleKeyDown(t){if(this.$data.disabled||this.$data.readonly)return;const a=this.$data.count||5,e=this.$data.value||0;if("ArrowRight"===t.key||"ArrowUp"===t.key){t.preventDefault();const s=this.$data.allowHalf?.5:1,r=Math.min(a,e+s);this.$data.value=r,this.dispatchChangeEvent()}else if("ArrowLeft"===t.key||"ArrowDown"===t.key){t.preventDefault();const a=this.$data.allowHalf?.5:1,s=Math.max(0,e-a);this.$data.value=s,this.dispatchChangeEvent()}}dispatchChangeEvent(){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}setValue(t){this.$data.value=t}getValue(){return this.$data.value}};r=((t,a)=>{for(var e,s=a,r=t.length-1;r>=0;r--)(e=t[r])&&(s=e(s)||s);return s})([s({tagName:"solely-rate",template:a,styles:t,shadowDOM:{use:!0,mode:"open"},props:[{name:"value",type:"number",default:0},{name:"count",type:"number"},{name:"allowHalf",type:"boolean",default:!1},{name:"disabled",type:"boolean",default:!1},{name:"allowClear",type:"boolean",default:!1},{name:"character",type:"string"},{name:"readonly",type:"boolean",default:!1}]})],r);export{r as SolelyRate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=Object.defineProperty,e=(e,a
|
|
1
|
+
"use strict";var t=Object.defineProperty,e=(e,s,a)=>((e,s,a)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[s]=a)(e,"symbol"!=typeof s?s+"":s,a);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./style.css.cjs"),a=require("./index.html.cjs"),l=require("../../../runtime/component/base-element.cjs"),i=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelySelect=class extends l.default{constructor(){super(...arguments),e(this,"clickOutsideHandler"),e(this,"slotObserver"),e(this,"closeTimer")}get value(){return this.$data.value||""}set value(t){this.$data.disabled||this.setValue(t)}getSelectClasses(){const t={};return"small"===this.$data.size?t["select--sm"]=!0:"large"===this.$data.size?t["select--lg"]=!0:t["select--md"]=!0,t["is-disabled"]=!!this.$data.disabled,t["is-focused"]=!!this.$data.focused,t["is-open"]=!!this.$data.isOpen,t["use-slot"]=this.$data.useSlot,t}getDropdownClasses(){return{"select__dropdown--closing":!!this.$data.closing,"select__dropdown--top":"top"===this.$data.dropdownPlacement,"select__dropdown--bottom":"bottom"===this.$data.dropdownPlacement}}getOptionClasses(t){return{"select__option--selected":t.value===this.$data.value,"select__option--disabled":!!t.disabled}}calculateDropdownPlacement(){const t=this.getBoundingClientRect(),e=window.innerHeight-t.bottom,s=t.top;this.$data.dropdownPlacement=e<256&&s>e?"top":"bottom"}collectSlotOptions(){const t=Array.from(this.children);this.$data.hasHeaderSlot=t.some(t=>"header"===t.getAttribute("slot")),this.$data.hasFooterSlot=t.some(t=>"footer"===t.getAttribute("slot"));const e=t.filter(t=>!t.getAttribute("slot")&&t.hasAttribute("data-value"));0!==e.length?(this.$data.useSlot=!0,this.$data.slotOptions=e.map(t=>{var e;const s=t;return{value:s.getAttribute("data-value")||"",label:s.getAttribute("data-label")||(null==(e=s.textContent)?void 0:e.trim())||"",disabled:s.hasAttribute("disabled"),element:t}}),this.updateSelectedLabelFromSlot()):this.$data.useSlot=!1}updateSelectedLabelFromSlot(){if(!this.$data.slotOptions.length)return;const t=this.$data.slotOptions.find(t=>t.value===this.$data.value);this.$data.selectedLabel=(null==t?void 0:t.label)||""}mounted(){this.refresh(),this.parseOptions(),this.setupSlotObserver(),this.clickOutsideHandler=t=>{t.composedPath().some(t=>t===this)||this.closeDropdown()},document.addEventListener("click",this.clickOutsideHandler)}setupSlotObserver(){setTimeout(()=>{this.collectSlotOptions()},0),this.slotObserver=new MutationObserver(()=>{this.collectSlotOptions()}),this.slotObserver.observe(this,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["data-value","data-label","disabled"]})}unmounted(){this.clickOutsideHandler&&document.removeEventListener("click",this.clickOutsideHandler),this.slotObserver&&this.slotObserver.disconnect(),this.closeTimer&&(clearTimeout(this.closeTimer),this.closeTimer=void 0)}updated(){const t=this.$data.selectedLabel,e=this.getCurrentLabel();t!==e&&(this.$data.selectedLabel=e),this.updateAriaAttributes()}updateAriaAttributes(){var t;const e=null==(t=this.shadowRoot)?void 0:t.querySelector(".select__trigger");e&&(e.setAttribute("aria-expanded",this.$data.isOpen?"true":"false"),e.setAttribute("aria-disabled",this.$data.disabled?"true":"false"))}getCurrentLabel(){if(this.$data.useSlot){const t=this.$data.slotOptions.find(t=>t.value===this.$data.value);return(null==t?void 0:t.label)||""}{const t=this.$data.parsedOptions.find(t=>t.value===this.$data.value);return(null==t?void 0:t.label)||""}}parseOptions(){this.$data.parsedOptions=Array.isArray(this.$data.options)?this.$data.options:[],this.$data.useSlot||this.updateSelectedLabel()}updateSelectedLabel(){if(!this.$data.parsedOptions.length)return;const t=this.$data.parsedOptions.find(t=>t.value===this.$data.value);this.$data.selectedLabel=(null==t?void 0:t.label)||""}handleClick(){if(this.$data.disabled)return;const t=!this.$data.isOpen;this.$data.isOpen=t,this.$data.focused=t,t&&this.calculateDropdownPlacement()}handleSelect(t,e){t.disabled||(this.$data.value=t.value,this.updateSelectedLabel(),this.closeDropdown(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleSlotClick(t){var e;const s=t.target.closest("[data-value]");if(!s)return;if(s.hasAttribute("data-group"))return void t.stopPropagation();const a=s.getAttribute("data-value")||"",l=s.getAttribute("data-label")||(null==(e=s.textContent)?void 0:e.trim())||"";s.hasAttribute("disabled")||(this.$data.value=a,this.$data.selectedLabel=l,this.closeDropdown(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleHeaderFooterClick(t){t.stopPropagation()}handleClear(t){t.stopPropagation(),this.$data.value="",this.$data.selectedLabel="",this.dispatchEvent(new Event("clear",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}closeDropdown(){this.$data.isOpen&&(this.$data.closing=!0,this.closeTimer=setTimeout(()=>{this.$data.isOpen=!1,this.$data.closing=!1,this.$data.focused=!1,this.closeTimer=void 0},200))}setValue(t,e=!1){this.$data.value=t,this.$data.useSlot?this.updateSelectedLabelFromSlot():this.updateSelectedLabel(),e||this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}getValue(){return this.$data.value||""}setOptions(t){this.$data.options=t,this.$data.useSlot=!1,this.parseOptions()}},exports.SolelySelect=((t,e)=>{for(var s,a=e,l=t.length-1;l>=0;l--)(s=t[l])&&(a=s(a)||a);return a})([i.CustomElement({tagName:"solely-select",template:a.__SOLELY_IR__,styles:s.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"value",type:"string",default:""},{name:"placeholder",type:"string",default:"请选择"},{name:"disabled",type:"boolean",default:!1},{name:"size",type:"string",default:"medium"},{name:"clearable",type:"boolean",default:!1},{name:"options",type:"array",default:[]},{name:"multiple",type:"boolean",default:!1},{name:"block",type:"boolean",default:!1}]})],exports.SolelySelect);
|
|
@@ -19,6 +19,7 @@ declare class SolelySelect extends BaseElement<SelectProps & {
|
|
|
19
19
|
}> {
|
|
20
20
|
clickOutsideHandler?: (event: MouseEvent) => void;
|
|
21
21
|
slotObserver?: MutationObserver;
|
|
22
|
+
private closeTimer?;
|
|
22
23
|
/**
|
|
23
24
|
* 暴露 value 属性,使外部可通过 event.target.value 访问
|
|
24
25
|
*/
|
|
@@ -63,6 +64,7 @@ declare class SolelySelect extends BaseElement<SelectProps & {
|
|
|
63
64
|
* 当 s-model 等外部方式修改 value 时,需要更新 selectedLabel
|
|
64
65
|
*/
|
|
65
66
|
updated(): void;
|
|
67
|
+
private updateAriaAttributes;
|
|
66
68
|
/**
|
|
67
69
|
* 获取当前选中值对应的标签
|
|
68
70
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:a}=this;return this.getSelectClasses()},function(t){const{$data:a}=this;return a.isOpen?"true":"false"},function(t){const{$data:a}=this;return a.disabled?"true":"false"},function(t,a){const{$data:e}=this,{value:d,checked:s}=(null==t?void 0:t.target)||{};this.handleClick(t)},function(t){const{$data:a}=this;return!a.selectedLabel},function(t){const{$data:a}=this;return`${a.placeholder||"请选择"}`},function(t){const{$data:a}=this;return a.selectedLabel},function(t){const{$data:a}=this;return`${a.selectedLabel}`},function(t){const{$data:a}=this;return a.clearable&&a.selectedLabel&&!a.disabled},function(t,a){const{$data:e}=this,{value:d,checked:s}=(null==t?void 0:t.target)||{};this.handleClear(t)},function(t){const{$data:a}=this;return a.isOpen},function(t){const{$data:a}=this;return this.getDropdownClasses()},function(t){const{$data:a}=this;return a.hasHeaderSlot},function(t,a){const{$data:e}=this,{value:d,checked:s}=(null==t?void 0:t.target)||{};this.handleHeaderFooterClick(t)},function(t){const{$data:a}=this;return!a.useSlot},function(t){const{$data:a}=this;return 0===a.parsedOptions.length},function(t){const{$data:a}=this;return a.parsedOptions},function(t){const{$data:a}=this;var[e]=t.map(t=>t.itmVal),[d]=t.map(t=>t.idxVal);return this.getOptionClasses(e)},function(t){const{$data:a}=this;var[e]=t.map(t=>t.itmVal),[d]=t.map(t=>t.idxVal);return e.value===a.value?"true":"false"},function(t,a){const{$data:e}=this,{value:d,checked:s}=(null==t?void 0:t.target)||{};var[c]=a.map(t=>t.itmVal),[n]=a.map(t=>t.idxVal);this.handleSelect(c,t)},function(t){const{$data:a}=this;var[e]=t.map(t=>t.itmVal),[d]=t.map(t=>t.idxVal);return`${e.label}`},function(t){const{$data:a}=this;return a.useSlot},function(t,a){const{$data:e}=this,{value:d,checked:s}=(null==t?void 0:t.target)||{};this.handleSlotClick(t)},function(t){const{$data:a}=this;return a.hasFooterSlot}],n:[{t:0,d:1,g:"div",a:[{k:"part",v:"base",d:0},{k:"class",v:"select",d:0},{k:":class",f:1,d:1},{k:"role",v:"combobox",d:0},{k:":aria-expanded",f:2,d:1},{k:":aria-disabled",f:3,d:1},{k:"@click",f:4,d:1}],c:[{t:0,d:0,g:"div",a:[{k:"part",v:"selector",d:0},{k:"class",v:"select__selector",d:0}],c:[{t:7,d:1,b:[{f:5,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"placeholder",d:0},{k:"class",v:"select__placeholder",d:0}],c:[{t:1,d:1,f:6}]}]}]},{t:7,d:1,b:[{f:7,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"value",d:0},{k:"class",v:"select__value",d:0}],c:[{t:1,d:1,f:8}]}]}]},{t:7,d:1,b:[{f:9,c:[{t:0,d:1,g:"span",a:[{k:"part",v:"clear",d:0},{k:"class",v:"select__clear",d:0},{k:"@click",f:10,d:1}],c:[{t:1,d:0,s:1,x:"×"}]}]}]},{t:0,d:0,s:1,g:"span",a:[{k:"part",v:"arrow",d:0},{k:"class",v:"select__arrow",d:0}],c:[{t:1,d:0,s:1,x:"▼"}]}]},{t:2,d:0,x:" 下拉菜单 "},{t:7,d:1,b:[{f:11,c:[{t:0,d:1,g:"div",a:[{k:"part",v:"dropdown",d:0},{k:"class",v:"select__dropdown",d:0},{k:":class",f:12,d:1},{k:"role",v:"listbox",d:0}],c:[{t:2,d:0,x:" header 插槽 - 固定顶部 "},{t:7,d:1,b:[{f:13,c:[{t:0,d:1,g:"div",a:[{k:"part",v:"header",d:0},{k:"class",v:"select__header",d:0},{k:"@click",f:14,d:1}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"header",d:0}],c:[]}]}]}]},{t:2,d:0,x:" 滚动内容区域 "},{t:0,d:0,g:"div",a:[{k:"part",v:"dropdown-content",d:0},{k:"class",v:"select__dropdown-content",d:0}],c:[{t:2,d:0,x:" 使用 options 属性时的渲染 "},{t:7,d:1,b:[{f:15,c:[{t:7,d:1,b:[{f:16,c:[{t:0,d:0,s:1,g:"div",a:[{k:"part",v:"empty",d:0},{k:"class",v:"select__empty",d:0}],c:[{t:1,d:0,s:1,x:"暂无数据"}]}]}]},{t:6,d:1,f:17,i:"option",n:"index",a:[],c:[{t:0,d:1,g:"div",a:[{k:"part",v:"option",d:0},{k:"class",v:"select__option",d:0},{k:":class",f:18,d:1},{k:"role",v:"option",d:0},{k:":aria-selected",f:19,d:1},{k:"@click",f:20,d:1}],c:[{t:0,d:0,g:"span",a:[{k:"part",v:"option-label",d:0},{k:"class",v:"select__option-label",d:0}],c:[{t:1,d:1,f:21}]}]}]}]}]},{t:2,d:0,x:" 使用插槽时的渲染 "},{t:7,d:1,b:[{f:22,c:[{t:0,d:1,g:"div",a:[{k:"part",v:"slot-options",d:0},{k:"class",v:"select__slot-options",d:0},{k:"@click",f:23,d:1}],c:[{t:0,d:0,s:1,g:"slot",a:[],c:[]}]}]}]}]},{t:2,d:0,x:" footer 插槽 - 固定底部 "},{t:7,d:1,b:[{f:24,c:[{t:0,d:1,g:"div",a:[{k:"part",v:"footer",d:0},{k:"class",v:"select__footer",d:0},{k:"@click",f:14,d:1}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"footer",d:0}],c:[]}]}]}]}]}]}]}]}],s:{tf:24,cf:24,dn:1,tn:1,sn:0}};exports.__SOLELY_IR__=t,exports.default=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:a}=this;return this.getSelectClasses()},function(t){const{$data:a}=this;return a.isOpen?"true":"false"},function(t){const{$data:a}=this;return a.disabled?"true":"false"},function(t,a){const{$data:d}=this,{value:e,checked:s}=(null==t?void 0:t.target)||{};this.handleClick(t)},function(t){const{$data:a}=this;return!a.selectedLabel},function(t){const{$data:a}=this;return`${a.placeholder||"请选择"}`},function(t){const{$data:a}=this;return a.selectedLabel},function(t){const{$data:a}=this;return`${a.selectedLabel}`},function(t){const{$data:a}=this;return a.clearable&&a.selectedLabel&&!a.disabled},function(t,a){const{$data:d}=this,{value:e,checked:s}=(null==t?void 0:t.target)||{};this.handleClear(t)},function(t){const{$data:a}=this;return a.isOpen},function(t){const{$data:a}=this;return this.getDropdownClasses()},function(t){const{$data:a}=this;return a.hasHeaderSlot},function(t,a){const{$data:d}=this,{value:e,checked:s}=(null==t?void 0:t.target)||{};this.handleHeaderFooterClick(t)},function(t){const{$data:a}=this;return!a.useSlot},function(t){const{$data:a}=this;return 0===a.parsedOptions.length},function(t){const{$data:a}=this;return a.parsedOptions},function(t){const{$data:a}=this;var[d]=t.map(t=>t.itmVal),[e]=t.map(t=>t.idxVal);return this.getOptionClasses(d)},function(t){const{$data:a}=this;var[d]=t.map(t=>t.itmVal),[e]=t.map(t=>t.idxVal);return d.value===a.value?"true":"false"},function(t,a){const{$data:d}=this,{value:e,checked:s}=(null==t?void 0:t.target)||{};var[c]=a.map(t=>t.itmVal),[n]=a.map(t=>t.idxVal);this.handleSelect(c,t)},function(t){const{$data:a}=this;var[d]=t.map(t=>t.itmVal),[e]=t.map(t=>t.idxVal);return`${d.label}`},function(t){const{$data:a}=this;return a.useSlot},function(t,a){const{$data:d}=this,{value:e,checked:s}=(null==t?void 0:t.target)||{};this.handleSlotClick(t)},function(t){const{$data:a}=this;return a.hasFooterSlot}],n:[{t:0,d:1,g:"div",a:[{k:"part",v:"base",d:0},{k:"class",v:"select",d:0},{k:":class",f:1,d:1},{k:"role",v:"combobox",d:0},{k:":aria-expanded",f:2,d:1},{k:":aria-disabled",f:3,d:1},{k:"@click",f:4,d:1}],c:[{t:0,d:0,g:"div",a:[{k:"part",v:"selector",d:0},{k:"class",v:"select__selector",d:0}],c:[{t:7,d:1,b:[{f:5,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"placeholder",d:0},{k:"class",v:"select__placeholder",d:0}],c:[{t:1,d:1,f:6}]}]}]},{t:7,d:1,b:[{f:7,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"value",d:0},{k:"class",v:"select__value",d:0}],c:[{t:1,d:1,f:8}]}]}]},{t:7,d:1,b:[{f:9,c:[{t:0,d:1,g:"span",a:[{k:"part",v:"clear",d:0},{k:"class",v:"select__clear",d:0},{k:"@click",f:10,d:1}],c:[{t:1,d:0,s:1,x:"×"}]}]}]},{t:0,d:0,s:1,g:"span",a:[{k:"part",v:"arrow",d:0},{k:"class",v:"select__arrow",d:0}],c:[{t:1,d:0,s:1,x:"▼"}]}]},{t:2,d:0,x:" 下拉菜单 "},{t:7,d:1,b:[{f:11,c:[{t:0,d:1,g:"div",a:[{k:"part",v:"dropdown",d:0},{k:"class",v:"select__dropdown",d:0},{k:":class",f:12,d:1},{k:"role",v:"listbox",d:0}],c:[{t:2,d:0,x:" header 插槽 - 固定顶部 "},{t:7,d:1,b:[{f:13,c:[{t:0,d:1,g:"div",a:[{k:"part",v:"header",d:0},{k:"class",v:"select__header",d:0},{k:"@click",f:14,d:1}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"header",d:0}],c:[]}]}]}]},{t:2,d:0,x:" 滚动内容区域 "},{t:0,d:0,g:"div",a:[{k:"part",v:"dropdown-content",d:0},{k:"class",v:"select__dropdown-content",d:0}],c:[{t:2,d:0,x:" 使用 options 属性时的渲染 "},{t:7,d:1,b:[{f:15,c:[{t:7,d:1,b:[{f:16,c:[{t:0,d:0,s:1,g:"div",a:[{k:"part",v:"empty",d:0},{k:"class",v:"select__empty",d:0}],c:[{t:1,d:0,s:1,x:"暂无数据"}]}]}]},{t:6,d:1,f:17,i:"option",n:"index",a:[],c:[{t:0,d:1,g:"div",a:[{k:"part",v:"option",d:0},{k:"class",v:"select__option",d:0},{k:":class",f:18,d:1},{k:"role",v:"option",d:0},{k:":aria-selected",f:19,d:1},{k:"@click",f:20,d:1}],c:[{t:0,d:0,g:"span",a:[{k:"part",v:"option-label",d:0},{k:"class",v:"select__option-label",d:0}],c:[{t:1,d:1,f:21}]}]}]}]}]},{t:2,d:0,x:" 使用插槽时的渲染 "},{t:7,d:1,b:[{f:22,c:[{t:0,d:1,g:"div",a:[{k:"part",v:"slot-options",d:0},{k:"class",v:"select__slot-options",d:0},{k:"@click",f:23,d:1}],c:[{t:0,d:0,s:1,g:"slot",a:[],c:[]}]}]}]}]},{t:2,d:0,x:" footer 插槽 - 固定底部 "},{t:7,d:1,b:[{f:24,c:[{t:0,d:1,g:"div",a:[{k:"part",v:"footer",d:0},{k:"class",v:"select__footer",d:0},{k:"@click",f:14,d:1}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"footer",d:0}],c:[]}]}]}]}]}]}]}]}],s:{tf:24,cf:24,dn:1,tn:1,sn:0}};export{t as __SOLELY_IR__,t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=Object.defineProperty,e=(e,a,s)=>((e,a,s)=>a in e?t(e,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[a]=s)(e,"symbol"!=typeof a?a+"":a,s);import a from"./style.css.js";import s
|
|
1
|
+
var t=Object.defineProperty,e=(e,a,s)=>((e,a,s)=>a in e?t(e,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[a]=s)(e,"symbol"!=typeof a?a+"":a,s);import a from"./style.css.js";import{__SOLELY_IR__ as s}from"./index.html.js";import i from"../../../runtime/component/base-element.js";import{CustomElement as l}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let o=class extends i{constructor(){super(...arguments),e(this,"clickOutsideHandler"),e(this,"slotObserver"),e(this,"closeTimer")}get value(){return this.$data.value||""}set value(t){this.$data.disabled||this.setValue(t)}getSelectClasses(){const t={};return"small"===this.$data.size?t["select--sm"]=!0:"large"===this.$data.size?t["select--lg"]=!0:t["select--md"]=!0,t["is-disabled"]=!!this.$data.disabled,t["is-focused"]=!!this.$data.focused,t["is-open"]=!!this.$data.isOpen,t["use-slot"]=this.$data.useSlot,t}getDropdownClasses(){return{"select__dropdown--closing":!!this.$data.closing,"select__dropdown--top":"top"===this.$data.dropdownPlacement,"select__dropdown--bottom":"bottom"===this.$data.dropdownPlacement}}getOptionClasses(t){return{"select__option--selected":t.value===this.$data.value,"select__option--disabled":!!t.disabled}}calculateDropdownPlacement(){const t=this.getBoundingClientRect(),e=window.innerHeight-t.bottom,a=t.top;this.$data.dropdownPlacement=e<256&&a>e?"top":"bottom"}collectSlotOptions(){const t=Array.from(this.children);this.$data.hasHeaderSlot=t.some(t=>"header"===t.getAttribute("slot")),this.$data.hasFooterSlot=t.some(t=>"footer"===t.getAttribute("slot"));const e=t.filter(t=>!t.getAttribute("slot")&&t.hasAttribute("data-value"));0!==e.length?(this.$data.useSlot=!0,this.$data.slotOptions=e.map(t=>{var e;const a=t;return{value:a.getAttribute("data-value")||"",label:a.getAttribute("data-label")||(null==(e=a.textContent)?void 0:e.trim())||"",disabled:a.hasAttribute("disabled"),element:t}}),this.updateSelectedLabelFromSlot()):this.$data.useSlot=!1}updateSelectedLabelFromSlot(){if(!this.$data.slotOptions.length)return;const t=this.$data.slotOptions.find(t=>t.value===this.$data.value);this.$data.selectedLabel=(null==t?void 0:t.label)||""}mounted(){this.refresh(),this.parseOptions(),this.setupSlotObserver(),this.clickOutsideHandler=t=>{t.composedPath().some(t=>t===this)||this.closeDropdown()},document.addEventListener("click",this.clickOutsideHandler)}setupSlotObserver(){setTimeout(()=>{this.collectSlotOptions()},0),this.slotObserver=new MutationObserver(()=>{this.collectSlotOptions()}),this.slotObserver.observe(this,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["data-value","data-label","disabled"]})}unmounted(){this.clickOutsideHandler&&document.removeEventListener("click",this.clickOutsideHandler),this.slotObserver&&this.slotObserver.disconnect(),this.closeTimer&&(clearTimeout(this.closeTimer),this.closeTimer=void 0)}updated(){const t=this.$data.selectedLabel,e=this.getCurrentLabel();t!==e&&(this.$data.selectedLabel=e),this.updateAriaAttributes()}updateAriaAttributes(){var t;const e=null==(t=this.shadowRoot)?void 0:t.querySelector(".select__trigger");e&&(e.setAttribute("aria-expanded",this.$data.isOpen?"true":"false"),e.setAttribute("aria-disabled",this.$data.disabled?"true":"false"))}getCurrentLabel(){if(this.$data.useSlot){const t=this.$data.slotOptions.find(t=>t.value===this.$data.value);return(null==t?void 0:t.label)||""}{const t=this.$data.parsedOptions.find(t=>t.value===this.$data.value);return(null==t?void 0:t.label)||""}}parseOptions(){this.$data.parsedOptions=Array.isArray(this.$data.options)?this.$data.options:[],this.$data.useSlot||this.updateSelectedLabel()}updateSelectedLabel(){if(!this.$data.parsedOptions.length)return;const t=this.$data.parsedOptions.find(t=>t.value===this.$data.value);this.$data.selectedLabel=(null==t?void 0:t.label)||""}handleClick(){if(this.$data.disabled)return;const t=!this.$data.isOpen;this.$data.isOpen=t,this.$data.focused=t,t&&this.calculateDropdownPlacement()}handleSelect(t,e){t.disabled||(this.$data.value=t.value,this.updateSelectedLabel(),this.closeDropdown(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleSlotClick(t){var e;const a=t.target.closest("[data-value]");if(!a)return;if(a.hasAttribute("data-group"))return void t.stopPropagation();const s=a.getAttribute("data-value")||"",i=a.getAttribute("data-label")||(null==(e=a.textContent)?void 0:e.trim())||"";a.hasAttribute("disabled")||(this.$data.value=s,this.$data.selectedLabel=i,this.closeDropdown(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleHeaderFooterClick(t){t.stopPropagation()}handleClear(t){t.stopPropagation(),this.$data.value="",this.$data.selectedLabel="",this.dispatchEvent(new Event("clear",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}closeDropdown(){this.$data.isOpen&&(this.$data.closing=!0,this.closeTimer=setTimeout(()=>{this.$data.isOpen=!1,this.$data.closing=!1,this.$data.focused=!1,this.closeTimer=void 0},200))}setValue(t,e=!1){this.$data.value=t,this.$data.useSlot?this.updateSelectedLabelFromSlot():this.updateSelectedLabel(),e||this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}getValue(){return this.$data.value||""}setOptions(t){this.$data.options=t,this.$data.useSlot=!1,this.parseOptions()}};o=((t,e)=>{for(var a,s=e,i=t.length-1;i>=0;i--)(a=t[i])&&(s=a(s)||s);return s})([l({tagName:"solely-select",template:s,styles:a,shadowDOM:{use:!0,mode:"open"},props:[{name:"value",type:"string",default:""},{name:"placeholder",type:"string",default:"请选择"},{name:"disabled",type:"boolean",default:!1},{name:"size",type:"string",default:"medium"},{name:"clearable",type:"boolean",default:!1},{name:"options",type:"array",default:[]},{name:"multiple",type:"boolean",default:!1},{name:"block",type:"boolean",default:!1}]})],o);export{o as SolelySelect};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),a=require("../../../runtime/component/base-element.cjs"),r=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelySkeleton=class extends a.default{getSkeletonClasses(){return{"is-active":!!this.$data.active}}getAvatarClasses(){const e={};return this.$data.avatarShape&&(e[`skeleton__avatar--${this.$data.avatarShape}`]=!0),e}mounted(){this.refresh()}getHeaderClasses(){return{"skeleton__header--right":"right"===this.$data.avatarPosition}}startLoading(){this.$data.loading=!0}finishLoading(){this.$data.loading=!1}setLoading(e){this.$data.loading=e}},exports.SolelySkeleton=((e,t)=>{for(var a,r=t,s=e.length-1;s>=0;s--)(a=e[s])&&(r=a(r)||r);return r})([r.CustomElement({tagName:"solely-skeleton",template:t.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),a=require("../../../runtime/component/base-element.cjs"),r=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelySkeleton=class extends a.default{getSkeletonClasses(){return{"is-active":!!this.$data.active}}getAvatarClasses(){const e={};return this.$data.avatarShape&&(e[`skeleton__avatar--${this.$data.avatarShape}`]=!0),e}mounted(){this.refresh()}getHeaderClasses(){return{"skeleton__header--right":"right"===this.$data.avatarPosition}}startLoading(){this.$data.loading=!0}finishLoading(){this.$data.loading=!1}setLoading(e){this.$data.loading=e}},exports.SolelySkeleton=((e,t)=>{for(var a,r=t,s=e.length-1;s>=0;s--)(a=e[s])&&(r=a(r)||r);return r})([r.CustomElement({tagName:"solely-skeleton",template:t.__SOLELY_IR__,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"active",type:"boolean",default:!1},{name:"avatar",type:"boolean",default:!1},{name:"avatarShape",type:"string",default:"circle"},{name:"avatarSize",type:"number",default:40},{name:"avatarPosition",type:"string",default:"left"},{name:"title",type:"boolean",default:!1},{name:"titleWidth",type:"string",default:""},{name:"paragraphRows",type:"number",default:3},{name:"loading",type:"boolean",default:!0}]})],exports.SolelySkeleton);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:a}=this;return this.getSkeletonClasses()},function(t){const{$data:a}=this;return a.loading},function(t){const{$data:a}=this;return a.avatar||a.title},function(t){const{$data:a}=this;return this.getHeaderClasses()},function(t){const{$data:a}=this;return a.avatar},function(t){const{$data:a}=this;return this.getAvatarClasses()},function(t){const{$data:a}=this;return"width: "+(a.avatarSize||40)+"px; height: "+(a.avatarSize||40)+"px"},function(t){const{$data:a}=this;return a.title},function(t){const{$data:a}=this;return a.titleWidth?"width: "+("number"==typeof a.titleWidth?a.titleWidth+"px":a.titleWidth):""},function(t){const{$data:a}=this;return a.paragraphRows>0},function(t){const{$data:a}=this;return Array.from({length:a.paragraphRows})},function(t){const{$data:a}=this;return!a.avatar&&!a.title&&a.paragraphRows>0},function(t){const{$data:a}=this;return!a.loading}],n:[{t:0,d:1,g:"div",a:[{k:"part",v:"base",d:0},{k:"class",v:"skeleton",d:0},{k:":class",f:1,d:1}],c:[{t:2,d:0,x:" 加载中显示骨架屏 "},{t:7,d:1,b:[{f:2,c:[{t:7,d:1,b:[{f:3,c:[{t:2,d:0,x:" 有头像或标题时显示头部 "},{t:0,d:1,g:"div",a:[{k:"part",v:"header",d:0},{k:"class",v:"skeleton__header",d:0},{k:":class",f:4,d:1}],c:[{t:7,d:1,b:[{f:5,c:[{t:0,d:1,g:"div",a:[{k:"part",v:"avatar",d:0},{k:"class",v:"skeleton__element skeleton__avatar",d:0},{k:":class",f:6,d:1},{k:":style",f:7,d:1}],c:[]}]}]},{t:0,d:0,g:"div",a:[{k:"part",v:"content",d:0},{k:"class",v:"skeleton__content",d:0}],c:[{t:7,d:1,b:[{f:8,c:[{t:0,d:1,g:"div",a:[{k:"part",v:"title",d:0},{k:"class",v:"skeleton__element skeleton__title",d:0},{k:":style",f:9,d:1}],c:[]}]}]},{t:7,d:1,b:[{f:10,c:[{t:0,d:0,g:"div",a:[{k:"part",v:"paragraph",d:0},{k:"class",v:"skeleton__paragraph",d:0}],c:[{t:6,d:1,f:11,i:"i",n:"index",a:[],c:[{t:0,d:0,s:1,g:"div",a:[{k:"part",v:"row",d:0},{k:"class",v:"skeleton__element skeleton__row",d:0}],c:[]}]}]}]}]}]}]}]}]},{t:7,d:1,b:[{f:12,c:[{t:2,d:0,x:" 只有段落时显示段落 "},{t:0,d:0,g:"div",a:[{k:"part",v:"paragraph",d:0},{k:"class",v:"skeleton__paragraph",d:0}],c:[{t:6,d:1,f:11,i:"i",n:"index",a:[],c:[{t:0,d:0,s:1,g:"div",a:[{k:"part",v:"row",d:0},{k:"class",v:"skeleton__element skeleton__row",d:0}],c:[]}]}]}]}]}]}]},{t:2,d:0,x:" 加载完成显示真实内容 "},{t:7,d:1,b:[{f:13,c:[{t:0,d:0,s:1,g:"div",a:[{k:"part",v:"real-content",d:0},{k:"class",v:"skeleton__real-content",d:0}],c:[{t:0,d:0,s:1,g:"slot",a:[],c:[]}]}]}]}]}],s:{tf:13,cf:13,dn:1,tn:1,sn:0}};exports.__SOLELY_IR__=t,exports.default=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:a}=this;return this.getSkeletonClasses()},function(t){const{$data:a}=this;return a.loading},function(t){const{$data:a}=this;return a.avatar||a.title},function(t){const{$data:a}=this;return this.getHeaderClasses()},function(t){const{$data:a}=this;return a.avatar},function(t){const{$data:a}=this;return this.getAvatarClasses()},function(t){const{$data:a}=this;return"width: "+(a.avatarSize||40)+"px; height: "+(a.avatarSize||40)+"px"},function(t){const{$data:a}=this;return a.title},function(t){const{$data:a}=this;return a.titleWidth?"width: "+("number"==typeof a.titleWidth?a.titleWidth+"px":a.titleWidth):""},function(t){const{$data:a}=this;return a.paragraphRows>0},function(t){const{$data:a}=this;return Array.from({length:a.paragraphRows})},function(t){const{$data:a}=this;return!a.avatar&&!a.title&&a.paragraphRows>0},function(t){const{$data:a}=this;return!a.loading}],n:[{t:0,d:1,g:"div",a:[{k:"part",v:"base",d:0},{k:"class",v:"skeleton",d:0},{k:":class",f:1,d:1}],c:[{t:2,d:0,x:" 加载中显示骨架屏 "},{t:7,d:1,b:[{f:2,c:[{t:7,d:1,b:[{f:3,c:[{t:2,d:0,x:" 有头像或标题时显示头部 "},{t:0,d:1,g:"div",a:[{k:"part",v:"header",d:0},{k:"class",v:"skeleton__header",d:0},{k:":class",f:4,d:1}],c:[{t:7,d:1,b:[{f:5,c:[{t:0,d:1,g:"div",a:[{k:"part",v:"avatar",d:0},{k:"class",v:"skeleton__element skeleton__avatar",d:0},{k:":class",f:6,d:1},{k:":style",f:7,d:1}],c:[]}]}]},{t:0,d:0,g:"div",a:[{k:"part",v:"content",d:0},{k:"class",v:"skeleton__content",d:0}],c:[{t:7,d:1,b:[{f:8,c:[{t:0,d:1,g:"div",a:[{k:"part",v:"title",d:0},{k:"class",v:"skeleton__element skeleton__title",d:0},{k:":style",f:9,d:1}],c:[]}]}]},{t:7,d:1,b:[{f:10,c:[{t:0,d:0,g:"div",a:[{k:"part",v:"paragraph",d:0},{k:"class",v:"skeleton__paragraph",d:0}],c:[{t:6,d:1,f:11,i:"i",n:"index",a:[],c:[{t:0,d:0,s:1,g:"div",a:[{k:"part",v:"row",d:0},{k:"class",v:"skeleton__element skeleton__row",d:0}],c:[]}]}]}]}]}]}]}]}]},{t:7,d:1,b:[{f:12,c:[{t:2,d:0,x:" 只有段落时显示段落 "},{t:0,d:0,g:"div",a:[{k:"part",v:"paragraph",d:0},{k:"class",v:"skeleton__paragraph",d:0}],c:[{t:6,d:1,f:11,i:"i",n:"index",a:[],c:[{t:0,d:0,s:1,g:"div",a:[{k:"part",v:"row",d:0},{k:"class",v:"skeleton__element skeleton__row",d:0}],c:[]}]}]}]}]}]}]},{t:2,d:0,x:" 加载完成显示真实内容 "},{t:7,d:1,b:[{f:13,c:[{t:0,d:0,s:1,g:"div",a:[{k:"part",v:"real-content",d:0},{k:"class",v:"skeleton__real-content",d:0}],c:[{t:0,d:0,s:1,g:"slot",a:[],c:[]}]}]}]}]}],s:{tf:13,cf:13,dn:1,tn:1,sn:0}};export{t as __SOLELY_IR__,t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./style.css.js";import t
|
|
1
|
+
import e from"./style.css.js";import{__SOLELY_IR__ as t}from"./index.html.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as r}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let s=class extends a{getSkeletonClasses(){return{"is-active":!!this.$data.active}}getAvatarClasses(){const e={};return this.$data.avatarShape&&(e[`skeleton__avatar--${this.$data.avatarShape}`]=!0),e}mounted(){this.refresh()}getHeaderClasses(){return{"skeleton__header--right":"right"===this.$data.avatarPosition}}startLoading(){this.$data.loading=!0}finishLoading(){this.$data.loading=!1}setLoading(e){this.$data.loading=e}};s=((e,t)=>{for(var a,r=t,s=e.length-1;s>=0;s--)(a=e[s])&&(r=a(r)||r);return r})([r({tagName:"solely-skeleton",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"active",type:"boolean",default:!1},{name:"avatar",type:"boolean",default:!1},{name:"avatarShape",type:"string",default:"circle"},{name:"avatarSize",type:"number",default:40},{name:"avatarPosition",type:"string",default:"left"},{name:"title",type:"boolean",default:!1},{name:"titleWidth",type:"string",default:""},{name:"paragraphRows",type:"number",default:3},{name:"loading",type:"boolean",default:!0}]})],s);export{s as SolelySkeleton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=Object.defineProperty,e=(e,a,i)=>((e,a,i)=>a in e?t(e,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[a]=i)(e,"symbol"!=typeof a?a+"":a,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./style.css.cjs"),i=require("./index.html.cjs"),s=require("../../../runtime/component/base-element.cjs"),n=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelySlider=class extends s.default{constructor(){super(...arguments),e(this,"railElement"),e(this,"railRect")}getSliderClasses(){return{"slider--vertical":!!this.$data.vertical,"is-disabled":!!this.$data.disabled}}get value(){return this.$data.value??this.$data.min??0}set value(t){this.$data.disabled||this.setValue(t)}getHandleClasses(){return{"slider__handle--dragging":!!this.$data.isDragging}}mounted(){this.$data.isDragging=!1,void 0===this.$data.min&&(this.$data.min=0),void 0===this.$data.max&&(this.$data.max=100),void 0===this.$data.step&&(this.$data.step=1),void 0===this.$data.value&&(this.$data.value=this.$data.min),this.refresh()}
|
|
1
|
+
"use strict";var t=Object.defineProperty,e=(e,a,i)=>((e,a,i)=>a in e?t(e,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[a]=i)(e,"symbol"!=typeof a?a+"":a,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./style.css.cjs"),i=require("./index.html.cjs"),s=require("../../../runtime/component/base-element.cjs"),n=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelySlider=class extends s.default{constructor(){super(...arguments),e(this,"railElement"),e(this,"dragMoveHandler"),e(this,"dragUpHandler"),e(this,"touchMoveHandler"),e(this,"touchEndHandler"),e(this,"railRect")}getSliderClasses(){return{"slider--vertical":!!this.$data.vertical,"is-disabled":!!this.$data.disabled}}get value(){return this.$data.value??this.$data.min??0}set value(t){this.$data.disabled||this.setValue(t)}getHandleClasses(){return{"slider__handle--dragging":!!this.$data.isDragging}}mounted(){var t;this.$data.isDragging=!1,void 0===this.$data.min&&(this.$data.min=0),void 0===this.$data.max&&(this.$data.max=100),void 0===this.$data.step&&(this.$data.step=1),void 0===this.$data.value&&(this.$data.value=this.$data.min),this.refresh(),this.railElement=null==(t=this.shadowRoot)?void 0:t.querySelector(".slider__rail")}unmounted(){this.cleanupDragListeners()}cleanupDragListeners(){this.dragMoveHandler&&(document.removeEventListener("mousemove",this.dragMoveHandler),this.dragMoveHandler=void 0),this.dragUpHandler&&(document.removeEventListener("mouseup",this.dragUpHandler),this.dragUpHandler=void 0),this.touchMoveHandler&&(document.removeEventListener("touchmove",this.touchMoveHandler),this.touchMoveHandler=void 0),this.touchEndHandler&&(document.removeEventListener("touchend",this.touchEndHandler),this.touchEndHandler=void 0)}updated(){this.updateAriaAttributes()}updateAriaAttributes(){var t;const e=null==(t=this.shadowRoot)?void 0:t.querySelector(".slider__handle");e&&(e.setAttribute("aria-valuenow",String(this.$data.value??this.$data.min??0)),e.setAttribute("aria-valuemin",String(this.$data.min??0)),e.setAttribute("aria-valuemax",String(this.$data.max??100)),e.setAttribute("aria-disabled",this.$data.disabled?"true":"false"))}getParsedMarks(){if(!this.$data.marks)return[];try{const t=this.$data.marksData||{};return Object.entries(t).map(([t,e])=>({value:parseFloat(t),label:String(e)}))}catch{return[]}}getTrackStyle(){const t=this.getPercent();return this.$data.vertical?`height: ${t}%;`:`width: ${t}%;`}getHandleStyle(){const t=this.getPercent();return this.$data.vertical?`bottom: ${t}%;`:`left: ${t}%;`}getMarkStyle(t){const e=this.$data.min??0,a=(t-e)/((this.$data.max??100)-e)*100;return this.$data.vertical?`bottom: ${a}%;`:`left: ${a}%;`}getPercent(){const t=this.$data.min??0,e=this.$data.max??100;return(Math.max(t,Math.min(e,this.$data.value??t))-t)/(e-t)*100}handleMouseDown(t){this.$data.disabled||(t.preventDefault(),this.$data.isDragging=!0,this.railElement&&(this.railRect=this.railElement.getBoundingClientRect()),this.updateValueFromRect(t),this.cleanupDragListeners(),this.dragMoveHandler=t=>{this.$data.isDragging&&this.updateValueFromRect(t)},this.dragUpHandler=()=>{this.$data.isDragging=!1,this.railRect=void 0,this.cleanupDragListeners(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},document.addEventListener("mousemove",this.dragMoveHandler),document.addEventListener("mouseup",this.dragUpHandler))}handleTouchStart(t){this.$data.disabled||0!==t.touches.length&&(t.preventDefault(),this.$data.isDragging=!0,this.railElement&&(this.railRect=this.railElement.getBoundingClientRect()),this.updateValueFromRect(t.touches[0]),this.cleanupDragListeners(),this.touchMoveHandler=t=>{this.$data.isDragging&&t.touches.length>0&&this.updateValueFromRect(t.touches[0])},this.touchEndHandler=()=>{this.$data.isDragging=!1,this.railRect=void 0,this.cleanupDragListeners(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},document.addEventListener("touchmove",this.touchMoveHandler),document.addEventListener("touchend",this.touchEndHandler))}updateValueFromRect(t){if(!this.railRect)return void this.updateValue(t);const e=this.railRect;let a;a=this.$data.vertical?1-(t.clientY-e.top)/e.height:(t.clientX-e.left)/e.width,a=Math.max(0,Math.min(1,a));const i=this.$data.min??0,s=this.$data.max??100,n=i+a*(s-i),r=this.$data.step||1,d=Math.round(n/r)*r,l=Math.max(i,Math.min(s,d));this.$data.value!==l&&(this.$data.value=l,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})))}updateValue(t){var e;if(this.railElement||(this.railElement=null==(e=this.shadowRoot)?void 0:e.querySelector(".slider__rail")),!this.railElement)return;const a=this.railElement.getBoundingClientRect();let i;i=this.$data.vertical?1-(t.clientY-a.top)/a.height:(t.clientX-a.left)/a.width,i=Math.max(0,Math.min(1,i));const s=this.$data.min??0,n=this.$data.max??100,r=s+i*(n-s),d=this.$data.step||1,l=Math.round(r/d)*d,h=Math.max(s,Math.min(n,l));this.$data.value!==h&&(this.$data.value=h,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})))}setValue(t){const e=this.$data.min??0,a=this.$data.max??100;this.$data.value=Math.max(e,Math.min(a,t))}getValue(){return this.$data.value??this.$data.min??0}},exports.SolelySlider=((t,e)=>{for(var a,i=e,s=t.length-1;s>=0;s--)(a=t[s])&&(i=a(i)||i);return i})([n.CustomElement({tagName:"solely-slider",template:i.__SOLELY_IR__,styles:a.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"value",type:"number"},{name:"min",type:"number"},{name:"max",type:"number"},{name:"step",type:"number"},{name:"disabled",type:"boolean",default:!1},{name:"tooltipVisible",type:"boolean",default:!0},{name:"marks",type:"boolean",default:!1},{name:"marksData",type:"object",default:{}},{name:"vertical",type:"boolean",default:!1},{name:"block",type:"boolean",default:!1}]})],exports.SolelySlider);
|
|
@@ -8,6 +8,10 @@ declare class SolelySlider extends BaseElement<SliderProps & {
|
|
|
8
8
|
}>;
|
|
9
9
|
}> {
|
|
10
10
|
railElement?: HTMLElement;
|
|
11
|
+
private dragMoveHandler?;
|
|
12
|
+
private dragUpHandler?;
|
|
13
|
+
private touchMoveHandler?;
|
|
14
|
+
private touchEndHandler?;
|
|
11
15
|
/**
|
|
12
16
|
* 获取 slider class 对象
|
|
13
17
|
*/
|
|
@@ -22,7 +26,10 @@ declare class SolelySlider extends BaseElement<SliderProps & {
|
|
|
22
26
|
*/
|
|
23
27
|
getHandleClasses(): Record<string, boolean>;
|
|
24
28
|
mounted(): void;
|
|
25
|
-
|
|
29
|
+
unmounted(): void;
|
|
30
|
+
private cleanupDragListeners;
|
|
31
|
+
updated(): void;
|
|
32
|
+
private updateAriaAttributes;
|
|
26
33
|
/**
|
|
27
34
|
* 获取解析后的刻度标记
|
|
28
35
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:a}=this;return this.getSliderClasses()},function(t){const{$data:a}=this;return a.min??0},function(t){const{$data:a}=this;return a.max??100},function(t){const{$data:a}=this;return a.value??a.min??0},function(t){const{$data:a}=this;return a.disabled?"true":"false"},function(t){const{$data:a}=this;return a.vertical?"vertical":"horizontal"},function(t,a){const{$data:d}=this,{value:s,checked:i}=(null==t?void 0:t.target)||{};this.handleMouseDown(t)},function(t,a){const{$data:d}=this,{value:s,checked:i}=(null==t?void 0:t.target)||{};this.handleTouchStart(t)},function(t){const{$data:a}=this;return this.getTrackStyle()},function(t){const{$data:a}=this;return this.getHandleClasses()},function(t){const{$data:a}=this;return this.getHandleStyle()},function(t){const{$data:a}=this;return!1!==a.tooltipVisible},function(t){const{$data:a}=this;return`${a.value}`},function(t){const{$data:a}=this;return a.marks},function(t){const{$data:a}=this;return this.getParsedMarks()},function(t){const{$data:a}=this;var[d]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return this.getMarkStyle(d.value)},function(t){const{$data:a}=this;var[d]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return{"slider__mark-dot--active":d.value<=(a.value??a.min??0)}},function(t){const{$data:a}=this;var[d]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return`${d.label}`}],n:[{t:0,d:1,g:"div",a:[{k:"part",v:"base",d:0},{k:"class",v:"slider",d:0},{k:":class",f:1,d:1}],c:[{t:0,d:1,g:"div",a:[{k:"part",v:"rail",d:0},{k:"class",v:"slider__rail",d:0},{k:"ref",v:"rail",d:0},{k:"role",v:"slider",d:0},{k:":aria-valuemin",f:2,d:1},{k:":aria-valuemax",f:3,d:1},{k:":aria-valuenow",f:4,d:1},{k:":aria-valuetext",f:4,d:1},{k:":aria-disabled",f:5,d:1},{k:":aria-orientation",f:6,d:1},{k:"tabindex",v:"0",d:0},{k:"@mousedown",f:7,d:1},{k:"@touchstart",f:8,d:1}],c:[{t:0,d:1,g:"div",a:[{k:"part",v:"track",d:0},{k:"class",v:"slider__track",d:0},{k:":style",f:9,d:1}],c:[]},{t:0,d:1,g:"div",a:[{k:"part",v:"handle",d:0},{k:"class",v:"slider__handle",d:0},{k:":class",f:10,d:1},{k:":style",f:11,d:1}],c:[{t:7,d:1,b:[{f:12,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"tooltip",d:0},{k:"class",v:"slider__tooltip",d:0}],c:[{t:1,d:1,f:13}]}]}]}]},{t:2,d:0,x:" 刻度标记 "},{t:7,d:1,b:[{f:14,c:[{t:0,d:0,g:"div",a:[{k:"part",v:"marks",d:0},{k:"class",v:"slider__marks",d:0},{k:"aria-hidden",v:"true",d:0}],c:[{t:6,d:1,f:15,i:"mark",n:"index",a:[],c:[{t:0,d:1,g:"span",a:[{k:"part",v:"mark",d:0},{k:"class",v:"slider__mark",d:0},{k:":style",f:16,d:1}],c:[{t:0,d:1,g:"span",a:[{k:"part",v:"mark-dot",d:0},{k:"class",v:"slider__mark-dot",d:0},{k:":class",f:17,d:1}],c:[]},{t:0,d:0,g:"span",a:[{k:"part",v:"mark-label",d:0},{k:"class",v:"slider__mark-label",d:0}],c:[{t:1,d:1,f:18}]}]}]}]}]}]}]}]}],s:{tf:18,cf:18,dn:1,tn:1,sn:0}};exports.__SOLELY_IR__=t,exports.default=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a=
|
|
1
|
+
const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:a}=this;return this.getSliderClasses()},function(t){const{$data:a}=this;return a.min??0},function(t){const{$data:a}=this;return a.max??100},function(t){const{$data:a}=this;return a.value??a.min??0},function(t){const{$data:a}=this;return a.disabled?"true":"false"},function(t){const{$data:a}=this;return a.vertical?"vertical":"horizontal"},function(t,a){const{$data:d}=this,{value:s,checked:n}=(null==t?void 0:t.target)||{};this.handleMouseDown(t)},function(t,a){const{$data:d}=this,{value:s,checked:n}=(null==t?void 0:t.target)||{};this.handleTouchStart(t)},function(t){const{$data:a}=this;return this.getTrackStyle()},function(t){const{$data:a}=this;return this.getHandleClasses()},function(t){const{$data:a}=this;return this.getHandleStyle()},function(t){const{$data:a}=this;return!1!==a.tooltipVisible},function(t){const{$data:a}=this;return`${a.value}`},function(t){const{$data:a}=this;return a.marks},function(t){const{$data:a}=this;return this.getParsedMarks()},function(t){const{$data:a}=this;var[d]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return this.getMarkStyle(d.value)},function(t){const{$data:a}=this;var[d]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return{"slider__mark-dot--active":d.value<=(a.value??a.min??0)}},function(t){const{$data:a}=this;var[d]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return`${d.label}`}],n:[{t:0,d:1,g:"div",a:[{k:"part",v:"base",d:0},{k:"class",v:"slider",d:0},{k:":class",f:1,d:1}],c:[{t:0,d:1,g:"div",a:[{k:"part",v:"rail",d:0},{k:"class",v:"slider__rail",d:0},{k:"ref",v:"rail",d:0},{k:"role",v:"slider",d:0},{k:":aria-valuemin",f:2,d:1},{k:":aria-valuemax",f:3,d:1},{k:":aria-valuenow",f:4,d:1},{k:":aria-valuetext",f:4,d:1},{k:":aria-disabled",f:5,d:1},{k:":aria-orientation",f:6,d:1},{k:"tabindex",v:"0",d:0},{k:"@mousedown",f:7,d:1},{k:"@touchstart",f:8,d:1}],c:[{t:0,d:1,g:"div",a:[{k:"part",v:"track",d:0},{k:"class",v:"slider__track",d:0},{k:":style",f:9,d:1}],c:[]},{t:0,d:1,g:"div",a:[{k:"part",v:"handle",d:0},{k:"class",v:"slider__handle",d:0},{k:":class",f:10,d:1},{k:":style",f:11,d:1}],c:[{t:7,d:1,b:[{f:12,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"tooltip",d:0},{k:"class",v:"slider__tooltip",d:0}],c:[{t:1,d:1,f:13}]}]}]}]},{t:2,d:0,x:" 刻度标记 "},{t:7,d:1,b:[{f:14,c:[{t:0,d:0,g:"div",a:[{k:"part",v:"marks",d:0},{k:"class",v:"slider__marks",d:0},{k:"aria-hidden",v:"true",d:0}],c:[{t:6,d:1,f:15,i:"mark",n:"index",a:[],c:[{t:0,d:1,g:"span",a:[{k:"part",v:"mark",d:0},{k:"class",v:"slider__mark",d:0},{k:":style",f:16,d:1}],c:[{t:0,d:1,g:"span",a:[{k:"part",v:"mark-dot",d:0},{k:"class",v:"slider__mark-dot",d:0},{k:":class",f:17,d:1}],c:[]},{t:0,d:0,g:"span",a:[{k:"part",v:"mark-label",d:0},{k:"class",v:"slider__mark-label",d:0}],c:[{t:1,d:1,f:18}]}]}]}]}]}]}]}]}],s:{tf:18,cf:18,dn:1,tn:1,sn:0}};export{t as __SOLELY_IR__,t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=Object.defineProperty,e=(e,a,i)=>((e,a,i)=>a in e?t(e,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[a]=i)(e,"symbol"!=typeof a?a+"":a,i);import a from"./style.css.js";import i
|
|
1
|
+
var t=Object.defineProperty,e=(e,a,i)=>((e,a,i)=>a in e?t(e,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[a]=i)(e,"symbol"!=typeof a?a+"":a,i);import a from"./style.css.js";import{__SOLELY_IR__ as i}from"./index.html.js";import s from"../../../runtime/component/base-element.js";import{CustomElement as n}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let r=class extends s{constructor(){super(...arguments),e(this,"railElement"),e(this,"dragMoveHandler"),e(this,"dragUpHandler"),e(this,"touchMoveHandler"),e(this,"touchEndHandler"),e(this,"railRect")}getSliderClasses(){return{"slider--vertical":!!this.$data.vertical,"is-disabled":!!this.$data.disabled}}get value(){return this.$data.value??this.$data.min??0}set value(t){this.$data.disabled||this.setValue(t)}getHandleClasses(){return{"slider__handle--dragging":!!this.$data.isDragging}}mounted(){var t;this.$data.isDragging=!1,void 0===this.$data.min&&(this.$data.min=0),void 0===this.$data.max&&(this.$data.max=100),void 0===this.$data.step&&(this.$data.step=1),void 0===this.$data.value&&(this.$data.value=this.$data.min),this.refresh(),this.railElement=null==(t=this.shadowRoot)?void 0:t.querySelector(".slider__rail")}unmounted(){this.cleanupDragListeners()}cleanupDragListeners(){this.dragMoveHandler&&(document.removeEventListener("mousemove",this.dragMoveHandler),this.dragMoveHandler=void 0),this.dragUpHandler&&(document.removeEventListener("mouseup",this.dragUpHandler),this.dragUpHandler=void 0),this.touchMoveHandler&&(document.removeEventListener("touchmove",this.touchMoveHandler),this.touchMoveHandler=void 0),this.touchEndHandler&&(document.removeEventListener("touchend",this.touchEndHandler),this.touchEndHandler=void 0)}updated(){this.updateAriaAttributes()}updateAriaAttributes(){var t;const e=null==(t=this.shadowRoot)?void 0:t.querySelector(".slider__handle");e&&(e.setAttribute("aria-valuenow",String(this.$data.value??this.$data.min??0)),e.setAttribute("aria-valuemin",String(this.$data.min??0)),e.setAttribute("aria-valuemax",String(this.$data.max??100)),e.setAttribute("aria-disabled",this.$data.disabled?"true":"false"))}getParsedMarks(){if(!this.$data.marks)return[];try{const t=this.$data.marksData||{};return Object.entries(t).map(([t,e])=>({value:parseFloat(t),label:String(e)}))}catch{return[]}}getTrackStyle(){const t=this.getPercent();return this.$data.vertical?`height: ${t}%;`:`width: ${t}%;`}getHandleStyle(){const t=this.getPercent();return this.$data.vertical?`bottom: ${t}%;`:`left: ${t}%;`}getMarkStyle(t){const e=this.$data.min??0,a=(t-e)/((this.$data.max??100)-e)*100;return this.$data.vertical?`bottom: ${a}%;`:`left: ${a}%;`}getPercent(){const t=this.$data.min??0,e=this.$data.max??100;return(Math.max(t,Math.min(e,this.$data.value??t))-t)/(e-t)*100}handleMouseDown(t){this.$data.disabled||(t.preventDefault(),this.$data.isDragging=!0,this.railElement&&(this.railRect=this.railElement.getBoundingClientRect()),this.updateValueFromRect(t),this.cleanupDragListeners(),this.dragMoveHandler=t=>{this.$data.isDragging&&this.updateValueFromRect(t)},this.dragUpHandler=()=>{this.$data.isDragging=!1,this.railRect=void 0,this.cleanupDragListeners(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},document.addEventListener("mousemove",this.dragMoveHandler),document.addEventListener("mouseup",this.dragUpHandler))}handleTouchStart(t){this.$data.disabled||0!==t.touches.length&&(t.preventDefault(),this.$data.isDragging=!0,this.railElement&&(this.railRect=this.railElement.getBoundingClientRect()),this.updateValueFromRect(t.touches[0]),this.cleanupDragListeners(),this.touchMoveHandler=t=>{this.$data.isDragging&&t.touches.length>0&&this.updateValueFromRect(t.touches[0])},this.touchEndHandler=()=>{this.$data.isDragging=!1,this.railRect=void 0,this.cleanupDragListeners(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},document.addEventListener("touchmove",this.touchMoveHandler),document.addEventListener("touchend",this.touchEndHandler))}updateValueFromRect(t){if(!this.railRect)return void this.updateValue(t);const e=this.railRect;let a;a=this.$data.vertical?1-(t.clientY-e.top)/e.height:(t.clientX-e.left)/e.width,a=Math.max(0,Math.min(1,a));const i=this.$data.min??0,s=this.$data.max??100,n=i+a*(s-i),r=this.$data.step||1,d=Math.round(n/r)*r,l=Math.max(i,Math.min(s,d));this.$data.value!==l&&(this.$data.value=l,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})))}updateValue(t){var e;if(this.railElement||(this.railElement=null==(e=this.shadowRoot)?void 0:e.querySelector(".slider__rail")),!this.railElement)return;const a=this.railElement.getBoundingClientRect();let i;i=this.$data.vertical?1-(t.clientY-a.top)/a.height:(t.clientX-a.left)/a.width,i=Math.max(0,Math.min(1,i));const s=this.$data.min??0,n=this.$data.max??100,r=s+i*(n-s),d=this.$data.step||1,l=Math.round(r/d)*d,h=Math.max(s,Math.min(n,l));this.$data.value!==h&&(this.$data.value=h,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})))}setValue(t){const e=this.$data.min??0,a=this.$data.max??100;this.$data.value=Math.max(e,Math.min(a,t))}getValue(){return this.$data.value??this.$data.min??0}};r=((t,e)=>{for(var a,i=e,s=t.length-1;s>=0;s--)(a=t[s])&&(i=a(i)||i);return i})([n({tagName:"solely-slider",template:i,styles:a,shadowDOM:{use:!0,mode:"open"},props:[{name:"value",type:"number"},{name:"min",type:"number"},{name:"max",type:"number"},{name:"step",type:"number"},{name:"disabled",type:"boolean",default:!1},{name:"tooltipVisible",type:"boolean",default:!0},{name:"marks",type:"boolean",default:!1},{name:"marksData",type:"object",default:{}},{name:"vertical",type:"boolean",default:!1},{name:"block",type:"boolean",default:!1}]})],r);export{r as SolelySlider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=Object.defineProperty;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";var t=Object.defineProperty,e=(e,s,r)=>((e,s,r)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r)(e,"symbol"!=typeof s?s+"":s,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./style.css.cjs"),r=require("./index.html.cjs"),i=require("../utils/helpers.cjs"),o=require("../../../runtime/component/base-element.cjs"),a=require("../../../runtime/component/decorators.cjs");var n,l,d,c=Object.defineProperty;Object.getOwnPropertyDescriptor;exports.SolelySteps=class extends o.default{constructor(){super(...arguments),e(this,"slotObserver"),e(this,"slotInitTimer")}get current(){return this.$data.current}set current(t){this.$data.current=t,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:t}}))}getStepsClasses(){const t={};return this.$data.direction&&(t[`steps--${this.$data.direction}`]=!0),t["steps--dot"]=!!this.$data.progressDot,"small"===this.$data.size?t["steps--sm"]=!0:"large"===this.$data.size&&(t["steps--lg"]=!0),t["use-slot"]=this.$data.useSlot,t}getStepClasses(t,e){const s=this.getStepStatus(e);return{"step--wait":"wait"===s,"step--process":"process"===s,"step--finish":"finish"===s,"step--error":"error"===s,"step--disabled":!!t.disabled}}getSlotStepClasses(t,e){const s=this.getSlotStepStatus(e);return{"step--wait":"wait"===s,"step--process":"process"===s,"step--finish":"finish"===s,"step--error":"error"===s,"step--disabled":!!t.disabled}}getIconClasses(t){const e={};return t.icon&&t.color&&exports.SolelySteps.PRESET_COLORS.includes(t.color)&&(e[`step__icon-wrapper--${t.color}`]=!0),e}getIconStyle(t){return t.icon&&t.color?exports.SolelySteps.PRESET_COLORS.includes(t.color)?"":`color: ${t.color}; background-color: ${t.color}15;`:""}collectSlotItems(){const t=Array.from(this.children).filter(t=>t.hasAttribute("data-step"));0!==t.length?(this.$data.useSlot=!0,this.$data.slotItems=t.map((t,e)=>{var s;const r=t;return{step:r.getAttribute("data-step")||String(e+1),title:r.getAttribute("data-title")||(null==(s=r.textContent)?void 0:s.trim())||"",description:r.getAttribute("data-description")||void 0,disabled:r.hasAttribute("disabled"),iconHtml:r.innerHTML}})):this.$data.useSlot=!1}mounted(){this.refresh(),this.setupSlotObserver()}getParsedItems(){const t=this.$data.items;return Array.isArray(t)?t:"string"==typeof t&&t?i.safeJsonParse(t,[]):[]}setupSlotObserver(){this.slotInitTimer=setTimeout(()=>{this.collectSlotItems(),this.slotInitTimer=void 0},0),this.slotObserver=new MutationObserver(()=>{this.collectSlotItems()}),this.slotObserver.observe(this,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["data-step","data-title","data-description","disabled"]})}unmounted(){this.slotObserver&&this.slotObserver.disconnect(),this.slotInitTimer&&(clearTimeout(this.slotInitTimer),this.slotInitTimer=void 0)}getStepStatus(t){const e=this.$data.current||0,s=this.getParsedItems();if(!Array.isArray(s)||t<0||t>=s.length)return"wait";const r=s[t];return(null==r?void 0:r.status)?r.status:t<e?"finish":t===e?"process":"wait"}getSlotStepStatus(t){const e=this.$data.current||0;return t<e?"finish":t===e?"process":"wait"}getStepIcon(t,e){if(t.icon)return t.icon;const s=this.getStepStatus(e);return"finish"===s?"✓":"error"===s?"✕":String(e+1)}handleStepClick(t,e){t.disabled||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:e,item:t}})))}handleSlotStepClick(t,e){t.disabled||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:e,item:t}})))}setCurrent(t){this.$data.current=t}getCurrent(){return this.$data.current}next(){const t=this.$data.useSlot?this.$data.slotItems.length-1:this.getParsedItems().length-1;this.$data.current<t&&this.$data.current++}prev(){this.$data.current>0&&this.$data.current--}setItems(t){this.$data.items=JSON.stringify(t),this.$data.useSlot=!1,this.refresh()}},n=exports.SolelySteps,d=["blue","green","red","orange","gray"],(l="PRESET_COLORS")in n?c(n,l,{enumerable:!0,configurable:!0,writable:!0,value:d}):n[l]=d,exports.SolelySteps=((t,e)=>{for(var s,r=e,i=t.length-1;i>=0;i--)(s=t[i])&&(r=s(r)||r);return r})([a.CustomElement({tagName:"solely-steps",template:r.__SOLELY_IR__,styles:s.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"current",type:"number",default:0},{name:"direction",type:"string",default:"horizontal"},{name:"size",type:"string",default:"default"},{name:"items",type:"string",default:"[]"},{name:"progressDot",type:"boolean",default:!1}]})],exports.SolelySteps);
|
|
@@ -6,6 +6,7 @@ declare class SolelySteps extends BaseElement<StepsProps & {
|
|
|
6
6
|
}> {
|
|
7
7
|
private static readonly PRESET_COLORS;
|
|
8
8
|
slotObserver?: MutationObserver;
|
|
9
|
+
private slotInitTimer?;
|
|
9
10
|
get current(): number;
|
|
10
11
|
set current(value: number);
|
|
11
12
|
getStepsClasses(): Record<string, boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:a}=this;return this.getStepsClasses()},function(t){const{$data:a}=this;return!a.useSlot},function(t){const{$data:a}=this;return this.getParsedItems()},function(t){const{$data:a}=this;var[s]=t.map(t=>t.itmVal),[i]=t.map(t=>t.idxVal);return this.getStepClasses(s,i)},function(t){const{$data:a}=this;var[s]=t.map(t=>t.itmVal),[i]=t.map(t=>t.idxVal);return"process"===this.getStepStatus(i)?"step":void 0},function(t){const{$data:a}=this;var[s]=t.map(t=>t.itmVal),[i]=t.map(t=>t.idxVal);return s.disabled?"true":"false"},function(t,a){const{$data:s}=this,{value:i,checked:d}=(null==t?void 0:t.target)||{};var[n]=a.map(t=>t.itmVal),[e]=a.map(t=>t.idxVal);this.handleStepClick(n,e)},function(t){const{$data:a}=this;var[s]=t.map(t=>t.itmVal),[i]=t.map(t=>t.idxVal);return this.getIconClasses(s)},function(t){const{$data:a}=this;var[s]=t.map(t=>t.itmVal),[i]=t.map(t=>t.idxVal);return s.icon?this.getIconStyle(s):""},function(t){const{$data:a}=this;var[s]=t.map(t=>t.itmVal),[i]=t.map(t=>t.idxVal);return!a.progressDot},function(t){const{$data:a}=this;var[s]=t.map(t=>t.itmVal),[i]=t.map(t=>t.idxVal);return s.icon||"finish"===this.getStepStatus(i)||"error"===this.getStepStatus(i)},function(t){const{$data:a}=this;var[s]=t.map(t=>t.itmVal),[i]=t.map(t=>t.idxVal);return`${this.getStepIcon(s,i)}`},function(t){const{$data:a}=this;var[s]=t.map(t=>t.itmVal),[i]=t.map(t=>t.idxVal);return`${i+1}`},function(t){const{$data:a}=this;var[s]=t.map(t=>t.itmVal),[i]=t.map(t=>t.idxVal);return`${s.title}`},function(t){const{$data:a}=this;var[s]=t.map(t=>t.itmVal),[i]=t.map(t=>t.idxVal);return s.description},function(t){const{$data:a}=this;var[s]=t.map(t=>t.itmVal),[i]=t.map(t=>t.idxVal);return`${s.description}`},function(t){const{$data:a}=this;return a.useSlot},function(t){const{$data:a}=this;return a.slotItems},function(t){const{$data:a}=this;var[s]=t.map(t=>t.itmVal),[i]=t.map(t=>t.idxVal);return this.getSlotStepClasses(s,i)},function(t){const{$data:a}=this;var[s]=t.map(t=>t.itmVal),[i]=t.map(t=>t.idxVal);return"process"===this.getSlotStepStatus(i)?"step":void 0},function(t){const{$data:a}=this;var[s]=t.map(t=>t.itmVal),[i]=t.map(t=>t.idxVal);return s.disabled?"true":"false"},function(t,a){const{$data:s}=this,{value:i,checked:d}=(null==t?void 0:t.target)||{};var[n]=a.map(t=>t.itmVal),[e]=a.map(t=>t.idxVal);this.handleSlotStepClick(n,e)},function(t){const{$data:a}=this;var[s]=t.map(t=>t.itmVal),[i]=t.map(t=>t.idxVal);return s.iconHtml},function(t){const{$data:a}=this;var[s]=t.map(t=>t.itmVal),[i]=t.map(t=>t.idxVal);return`${s.title}`},function(t){const{$data:a}=this;var[s]=t.map(t=>t.itmVal),[i]=t.map(t=>t.idxVal);return s.description},function(t){const{$data:a}=this;var[s]=t.map(t=>t.itmVal),[i]=t.map(t=>t.idxVal);return`${s.description}`}],n:[{t:0,d:1,g:"div",a:[{k:"part",v:"base",d:0},{k:"class",v:"steps",d:0},{k:":class",f:1,d:1},{k:"role",v:"list",d:0},{k:"aria-label",v:"步骤条",d:0}],c:[{t:2,d:0,x:" 使用 items 属性时的渲染 "},{t:7,d:1,b:[{f:2,c:[{t:6,d:1,f:3,i:"item",n:"index",a:[],c:[{t:0,d:1,g:"div",a:[{k:"part",v:"step",d:0},{k:"class",v:"step",d:0},{k:":class",f:4,d:1},{k:"role",v:"listitem",d:0},{k:":aria-current",f:5,d:1},{k:":aria-disabled",f:6,d:1},{k:"@click",f:7,d:1}],c:[{t:0,d:0,s:1,g:"div",a:[{k:"part",v:"tail",d:0},{k:"class",v:"step__tail",d:0}],c:[]},{t:0,d:0,g:"div",a:[{k:"part",v:"wrapper",d:0},{k:"class",v:"step__wrapper",d:0}],c:[{t:0,d:1,g:"div",a:[{k:"part",v:"icon-wrapper",d:0},{k:"class",v:"step__icon-wrapper",d:0},{k:":class",f:8,d:1},{k:":style",f:9,d:1}],c:[{t:0,d:0,g:"div",a:[{k:"part",v:"icon",d:0},{k:"class",v:"step__icon",d:0}],c:[{t:7,d:1,b:[{f:10,c:[{t:7,d:1,b:[{f:11,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"icon-substitution",d:0},{k:"class",v:"step__icon-substitution",d:0}],c:[{t:1,d:1,f:12}]}]},{f:null,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"icon-text",d:0},{k:"class",v:"step__icon-text",d:0}],c:[{t:1,d:1,f:13}]}]}]}]}]}]}]},{t:0,d:0,g:"div",a:[{k:"part",v:"content",d:0},{k:"class",v:"step__content",d:0}],c:[{t:0,d:0,g:"div",a:[{k:"part",v:"title",d:0},{k:"class",v:"step__title",d:0}],c:[{t:1,d:1,f:14}]},{t:7,d:1,b:[{f:15,c:[{t:0,d:0,g:"div",a:[{k:"part",v:"description",d:0},{k:"class",v:"step__description",d:0}],c:[{t:1,d:1,f:16}]}]}]}]}]}]}]}]}]},{t:2,d:0,x:" 使用插槽时的渲染 "},{t:7,d:1,b:[{f:17,c:[{t:6,d:1,f:18,i:"slotItem",n:"index",a:[],c:[{t:0,d:1,g:"div",a:[{k:"part",v:"step",d:0},{k:"class",v:"step",d:0},{k:":class",f:19,d:1},{k:"role",v:"listitem",d:0},{k:":aria-current",f:20,d:1},{k:":aria-disabled",f:21,d:1},{k:"@click",f:22,d:1}],c:[{t:0,d:0,s:1,g:"div",a:[{k:"part",v:"tail",d:0},{k:"class",v:"step__tail",d:0}],c:[]},{t:0,d:0,g:"div",a:[{k:"part",v:"wrapper",d:0},{k:"class",v:"step__wrapper",d:0}],c:[{t:0,d:0,g:"div",a:[{k:"part",v:"icon-wrapper",d:0},{k:"class",v:"step__icon-wrapper",d:0}],c:[{t:0,d:0,g:"div",a:[{k:"part",v:"icon",d:0},{k:"class",v:"step__icon",d:0}],c:[{t:7,d:1,b:[{f:10,c:[{t:2,d:0,x:" 使用插槽元素的 innerHTML 作为图标内容 "},{t:0,d:1,g:"span",a:[{k:"part",v:"icon-substitution",d:0},{k:"class",v:"step__icon-substitution",d:0},{k:":innerHTML",f:23,d:1}],c:[]}]}]}]}]},{t:0,d:0,g:"div",a:[{k:"part",v:"content",d:0},{k:"class",v:"step__content",d:0}],c:[{t:0,d:0,g:"div",a:[{k:"part",v:"title",d:0},{k:"class",v:"step__title",d:0}],c:[{t:1,d:1,f:24}]},{t:7,d:1,b:[{f:25,c:[{t:0,d:0,g:"div",a:[{k:"part",v:"description",d:0},{k:"class",v:"step__description",d:0}],c:[{t:1,d:1,f:26}]}]}]}]}]}]}]}]}]}]}],s:{tf:26,cf:26,dn:1,tn:1,sn:0}};exports.__SOLELY_IR__=t,exports.default=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t=
|
|
1
|
+
const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:a}=this;return this.getStepsClasses()},function(t){const{$data:a}=this;return!a.useSlot},function(t){const{$data:a}=this;return this.getParsedItems()},function(t){const{$data:a}=this;var[i]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return this.getStepClasses(i,s)},function(t){const{$data:a}=this;var[i]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return"process"===this.getStepStatus(s)?"step":void 0},function(t){const{$data:a}=this;var[i]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return i.disabled?"true":"false"},function(t,a){const{$data:i}=this,{value:s,checked:d}=(null==t?void 0:t.target)||{};var[n]=a.map(t=>t.itmVal),[c]=a.map(t=>t.idxVal);this.handleStepClick(n,c)},function(t){const{$data:a}=this;var[i]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return this.getIconClasses(i)},function(t){const{$data:a}=this;var[i]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return i.icon?this.getIconStyle(i):""},function(t){const{$data:a}=this;var[i]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return!a.progressDot},function(t){const{$data:a}=this;var[i]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return i.icon||"finish"===this.getStepStatus(s)||"error"===this.getStepStatus(s)},function(t){const{$data:a}=this;var[i]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return`${this.getStepIcon(i,s)}`},function(t){const{$data:a}=this;var[i]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return`${s+1}`},function(t){const{$data:a}=this;var[i]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return`${i.title}`},function(t){const{$data:a}=this;var[i]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return i.description},function(t){const{$data:a}=this;var[i]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return`${i.description}`},function(t){const{$data:a}=this;return a.useSlot},function(t){const{$data:a}=this;return a.slotItems},function(t){const{$data:a}=this;var[i]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return this.getSlotStepClasses(i,s)},function(t){const{$data:a}=this;var[i]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return"process"===this.getSlotStepStatus(s)?"step":void 0},function(t){const{$data:a}=this;var[i]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return i.disabled?"true":"false"},function(t,a){const{$data:i}=this,{value:s,checked:d}=(null==t?void 0:t.target)||{};var[n]=a.map(t=>t.itmVal),[c]=a.map(t=>t.idxVal);this.handleSlotStepClick(n,c)},function(t){const{$data:a}=this;var[i]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return i.iconHtml},function(t){const{$data:a}=this;var[i]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return`${i.title}`},function(t){const{$data:a}=this;var[i]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return i.description},function(t){const{$data:a}=this;var[i]=t.map(t=>t.itmVal),[s]=t.map(t=>t.idxVal);return`${i.description}`}],n:[{t:0,d:1,g:"div",a:[{k:"part",v:"base",d:0},{k:"class",v:"steps",d:0},{k:":class",f:1,d:1},{k:"role",v:"list",d:0},{k:"aria-label",v:"步骤条",d:0}],c:[{t:2,d:0,x:" 使用 items 属性时的渲染 "},{t:7,d:1,b:[{f:2,c:[{t:6,d:1,f:3,i:"item",n:"index",a:[],c:[{t:0,d:1,g:"div",a:[{k:"part",v:"step",d:0},{k:"class",v:"step",d:0},{k:":class",f:4,d:1},{k:"role",v:"listitem",d:0},{k:":aria-current",f:5,d:1},{k:":aria-disabled",f:6,d:1},{k:"@click",f:7,d:1}],c:[{t:0,d:0,s:1,g:"div",a:[{k:"part",v:"tail",d:0},{k:"class",v:"step__tail",d:0}],c:[]},{t:0,d:0,g:"div",a:[{k:"part",v:"wrapper",d:0},{k:"class",v:"step__wrapper",d:0}],c:[{t:0,d:1,g:"div",a:[{k:"part",v:"icon-wrapper",d:0},{k:"class",v:"step__icon-wrapper",d:0},{k:":class",f:8,d:1},{k:":style",f:9,d:1}],c:[{t:0,d:0,g:"div",a:[{k:"part",v:"icon",d:0},{k:"class",v:"step__icon",d:0}],c:[{t:7,d:1,b:[{f:10,c:[{t:7,d:1,b:[{f:11,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"icon-substitution",d:0},{k:"class",v:"step__icon-substitution",d:0}],c:[{t:1,d:1,f:12}]}]},{f:null,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"icon-text",d:0},{k:"class",v:"step__icon-text",d:0}],c:[{t:1,d:1,f:13}]}]}]}]}]}]}]},{t:0,d:0,g:"div",a:[{k:"part",v:"content",d:0},{k:"class",v:"step__content",d:0}],c:[{t:0,d:0,g:"div",a:[{k:"part",v:"title",d:0},{k:"class",v:"step__title",d:0}],c:[{t:1,d:1,f:14}]},{t:7,d:1,b:[{f:15,c:[{t:0,d:0,g:"div",a:[{k:"part",v:"description",d:0},{k:"class",v:"step__description",d:0}],c:[{t:1,d:1,f:16}]}]}]}]}]}]}]}]}]},{t:2,d:0,x:" 使用插槽时的渲染 "},{t:7,d:1,b:[{f:17,c:[{t:6,d:1,f:18,i:"slotItem",n:"index",a:[],c:[{t:0,d:1,g:"div",a:[{k:"part",v:"step",d:0},{k:"class",v:"step",d:0},{k:":class",f:19,d:1},{k:"role",v:"listitem",d:0},{k:":aria-current",f:20,d:1},{k:":aria-disabled",f:21,d:1},{k:"@click",f:22,d:1}],c:[{t:0,d:0,s:1,g:"div",a:[{k:"part",v:"tail",d:0},{k:"class",v:"step__tail",d:0}],c:[]},{t:0,d:0,g:"div",a:[{k:"part",v:"wrapper",d:0},{k:"class",v:"step__wrapper",d:0}],c:[{t:0,d:0,g:"div",a:[{k:"part",v:"icon-wrapper",d:0},{k:"class",v:"step__icon-wrapper",d:0}],c:[{t:0,d:0,g:"div",a:[{k:"part",v:"icon",d:0},{k:"class",v:"step__icon",d:0}],c:[{t:7,d:1,b:[{f:10,c:[{t:2,d:0,x:" 使用插槽元素的 innerHTML 作为图标内容 "},{t:0,d:1,g:"span",a:[{k:"part",v:"icon-substitution",d:0},{k:"class",v:"step__icon-substitution",d:0},{k:":innerHTML",f:23,d:1}],c:[]}]}]}]}]},{t:0,d:0,g:"div",a:[{k:"part",v:"content",d:0},{k:"class",v:"step__content",d:0}],c:[{t:0,d:0,g:"div",a:[{k:"part",v:"title",d:0},{k:"class",v:"step__title",d:0}],c:[{t:1,d:1,f:24}]},{t:7,d:1,b:[{f:25,c:[{t:0,d:0,g:"div",a:[{k:"part",v:"description",d:0},{k:"class",v:"step__description",d:0}],c:[{t:1,d:1,f:26}]}]}]}]}]}]}]}]}]}]}],s:{tf:26,cf:26,dn:1,tn:1,sn:0}};export{t as __SOLELY_IR__,t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=Object.defineProperty;import
|
|
1
|
+
var t=Object.defineProperty,e=(e,s,r)=>((e,s,r)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r)(e,"symbol"!=typeof s?s+"":s,r);import s from"./style.css.js";import{__SOLELY_IR__ as r}from"./index.html.js";import{safeJsonParse as i}from"../utils/helpers.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as o}from"../../../runtime/component/decorators.js";var n=Object.defineProperty;Object.getOwnPropertyDescriptor;let l=class extends a{constructor(){super(...arguments),e(this,"slotObserver"),e(this,"slotInitTimer")}get current(){return this.$data.current}set current(t){this.$data.current=t,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:t}}))}getStepsClasses(){const t={};return this.$data.direction&&(t[`steps--${this.$data.direction}`]=!0),t["steps--dot"]=!!this.$data.progressDot,"small"===this.$data.size?t["steps--sm"]=!0:"large"===this.$data.size&&(t["steps--lg"]=!0),t["use-slot"]=this.$data.useSlot,t}getStepClasses(t,e){const s=this.getStepStatus(e);return{"step--wait":"wait"===s,"step--process":"process"===s,"step--finish":"finish"===s,"step--error":"error"===s,"step--disabled":!!t.disabled}}getSlotStepClasses(t,e){const s=this.getSlotStepStatus(e);return{"step--wait":"wait"===s,"step--process":"process"===s,"step--finish":"finish"===s,"step--error":"error"===s,"step--disabled":!!t.disabled}}getIconClasses(t){const e={};return t.icon&&t.color&&l.PRESET_COLORS.includes(t.color)&&(e[`step__icon-wrapper--${t.color}`]=!0),e}getIconStyle(t){return t.icon&&t.color?l.PRESET_COLORS.includes(t.color)?"":`color: ${t.color}; background-color: ${t.color}15;`:""}collectSlotItems(){const t=Array.from(this.children).filter(t=>t.hasAttribute("data-step"));0!==t.length?(this.$data.useSlot=!0,this.$data.slotItems=t.map((t,e)=>{var s;const r=t;return{step:r.getAttribute("data-step")||String(e+1),title:r.getAttribute("data-title")||(null==(s=r.textContent)?void 0:s.trim())||"",description:r.getAttribute("data-description")||void 0,disabled:r.hasAttribute("disabled"),iconHtml:r.innerHTML}})):this.$data.useSlot=!1}mounted(){this.refresh(),this.setupSlotObserver()}getParsedItems(){const t=this.$data.items;return Array.isArray(t)?t:"string"==typeof t&&t?i(t,[]):[]}setupSlotObserver(){this.slotInitTimer=setTimeout(()=>{this.collectSlotItems(),this.slotInitTimer=void 0},0),this.slotObserver=new MutationObserver(()=>{this.collectSlotItems()}),this.slotObserver.observe(this,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["data-step","data-title","data-description","disabled"]})}unmounted(){this.slotObserver&&this.slotObserver.disconnect(),this.slotInitTimer&&(clearTimeout(this.slotInitTimer),this.slotInitTimer=void 0)}getStepStatus(t){const e=this.$data.current||0,s=this.getParsedItems();if(!Array.isArray(s)||t<0||t>=s.length)return"wait";const r=s[t];return(null==r?void 0:r.status)?r.status:t<e?"finish":t===e?"process":"wait"}getSlotStepStatus(t){const e=this.$data.current||0;return t<e?"finish":t===e?"process":"wait"}getStepIcon(t,e){if(t.icon)return t.icon;const s=this.getStepStatus(e);return"finish"===s?"✓":"error"===s?"✕":String(e+1)}handleStepClick(t,e){t.disabled||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:e,item:t}})))}handleSlotStepClick(t,e){t.disabled||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:e,item:t}})))}setCurrent(t){this.$data.current=t}getCurrent(){return this.$data.current}next(){const t=this.$data.useSlot?this.$data.slotItems.length-1:this.getParsedItems().length-1;this.$data.current<t&&this.$data.current++}prev(){this.$data.current>0&&this.$data.current--}setItems(t){this.$data.items=JSON.stringify(t),this.$data.useSlot=!1,this.refresh()}};var d,c,u;u=["blue","green","red","orange","gray"],(c="PRESET_COLORS")in(d=l)?n(d,c,{enumerable:!0,configurable:!0,writable:!0,value:u}):d[c]=u,l=((t,e)=>{for(var s,r=e,i=t.length-1;i>=0;i--)(s=t[i])&&(r=s(r)||r);return r})([o({tagName:"solely-steps",template:r,styles:s,shadowDOM:{use:!0,mode:"open"},props:[{name:"current",type:"number",default:0},{name:"direction",type:"string",default:"horizontal"},{name:"size",type:"string",default:"default"},{name:"items",type:"string",default:"[]"},{name:"progressDot",type:"boolean",default:!1}]})],l);export{l as SolelySteps};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),s=require("../../../runtime/component/base-element.cjs"),a=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelySwitch=class extends s.default{getSwitchClasses(){const e={},t=this.$data.size||"medium",s=this.$data.type||"primary";return"small"===t?e["switch--sm"]=!0:"large"===t?e["switch--lg"]=!0:e["switch--md"]=!0,e[`switch--${s}`]=!0,e["is-checked"]=!!this.$data.checked,e["is-disabled"]=!!this.$data.disabled,e["is-loading"]=!!this.$data.loading,e}handleClick(){this.$data.disabled||this.$data.loading||this.toggle()}handleKeyDown(e){this.$data.disabled||this.$data.loading||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.toggle())}toggle(){if(this.$data.disabled||this.$data.loading)return;const e=!this.$data.checked;this.setChecked(e),this.dispatchChangeEvent()}dispatchChangeEvent(){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}setChecked(e){this.$data.checked=e}getChecked(){return this.$data.checked}get checked(){return this.$data.checked}set checked(e){this.setChecked(e)}focus(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".switch");t&&t.focus()}blur(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".switch");t&&t.blur()}hasCheckedSlot(){return null!==this.querySelector('[slot="checked"]')}hasUncheckedSlot(){return null!==this.querySelector('[slot="unchecked"]')}mounted(){this.refresh(),this.updateAriaAttributes()}updated(){this.updateAriaAttributes()}updateAriaAttributes(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".switch");t&&(t.setAttribute("aria-checked",this.$data.checked?"true":"false"),t.setAttribute("aria-disabled",this.$data.disabled?"true":"false"))}},exports.SolelySwitch=((e,t)=>{for(var s,a=t,d=e.length-1;d>=0;d--)(s=e[d])&&(a=s(a)||a);return a})([a.CustomElement({tagName:"solely-switch",template:t.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),s=require("../../../runtime/component/base-element.cjs"),a=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelySwitch=class extends s.default{getSwitchClasses(){const e={},t=this.$data.size||"medium",s=this.$data.type||"primary";return"small"===t?e["switch--sm"]=!0:"large"===t?e["switch--lg"]=!0:e["switch--md"]=!0,e[`switch--${s}`]=!0,e["is-checked"]=!!this.$data.checked,e["is-disabled"]=!!this.$data.disabled,e["is-loading"]=!!this.$data.loading,e}handleClick(){this.$data.disabled||this.$data.loading||this.toggle()}handleKeyDown(e){this.$data.disabled||this.$data.loading||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.toggle())}toggle(){if(this.$data.disabled||this.$data.loading)return;const e=!this.$data.checked;this.setChecked(e),this.dispatchChangeEvent()}dispatchChangeEvent(){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}setChecked(e){this.$data.checked=e}getChecked(){return this.$data.checked}get checked(){return this.$data.checked}set checked(e){this.setChecked(e)}focus(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".switch");t&&t.focus()}blur(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".switch");t&&t.blur()}hasCheckedSlot(){return null!==this.querySelector('[slot="checked"]')}hasUncheckedSlot(){return null!==this.querySelector('[slot="unchecked"]')}mounted(){this.refresh(),this.updateAriaAttributes()}updated(){this.updateAriaAttributes()}updateAriaAttributes(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".switch");t&&(t.setAttribute("aria-checked",this.$data.checked?"true":"false"),t.setAttribute("aria-disabled",this.$data.disabled?"true":"false"))}},exports.SolelySwitch=((e,t)=>{for(var s,a=t,d=e.length-1;d>=0;d--)(s=e[d])&&(a=s(a)||a);return a})([a.CustomElement({tagName:"solely-switch",template:t.__SOLELY_IR__,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"checked",type:"boolean",default:!1},{name:"size",type:"string",default:"medium"},{name:"type",type:"string",default:"primary"},{name:"disabled",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"checkedChildren",type:"string",default:""},{name:"unCheckedChildren",type:"string",default:""}],model:{prop:"checked",event:"change"}})],exports.SolelySwitch);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={t:"root",v:"1.2.0",fns:[function(t){const{$data:c}=this;return this.getSwitchClasses()},function(t,c){const{$data:d}=this,{value:e,checked:n}=(null==t?void 0:t.target)||{};this.handleClick()},function(t,c){const{$data:d}=this,{value:e,checked:n}=(null==t?void 0:t.target)||{};this.handleKeyDown(t)},function(t){const{$data:c}=this;return c.checked?"true":"false"},function(t){const{$data:c}=this;return c.disabled?"true":"false"},function(t){const{$data:c}=this;return this.hasCheckedSlot()},function(t){const{$data:c}=this;return c.checkedChildren},function(t){const{$data:c}=this;return`${c.checkedChildren}`},function(t){const{$data:c}=this;return this.hasUncheckedSlot()},function(t){const{$data:c}=this;return c.unCheckedChildren},function(t){const{$data:c}=this;return`${c.unCheckedChildren}`},function(t){const{$data:c}=this;return c.loading}],n:[{t:0,d:1,g:"div",a:[{k:"part",v:"base",d:0},{k:"class",v:"switch",d:0},{k:":class",f:1,d:1},{k:"@click",f:2,d:1},{k:"tabindex",v:"0",d:0},{k:"@keydown",f:3,d:1},{k:"role",v:"switch",d:0},{k:":aria-checked",f:4,d:1},{k:":aria-disabled",f:5,d:1}],c:[{t:0,d:0,g:"div",a:[{k:"part",v:"track",d:0},{k:"class",v:"switch__track",d:0}],c:[{t:0,d:0,g:"div",a:[{k:"part",v:"inner",d:0},{k:"class",v:"switch__inner",d:0}],c:[{t:7,d:1,b:[{f:6,c:[{t:0,d:0,s:1,g:"span",a:[{k:"part",v:"checked-text",d:0},{k:"class",v:"switch__inner-checked",d:0}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"checked",d:0}],c:[]}]}]},{f:7,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"checked-text",d:0},{k:"class",v:"switch__inner-checked",d:0}],c:[{t:1,d:1,f:8}]}]}]},{t:7,d:1,b:[{f:9,c:[{t:0,d:0,s:1,g:"span",a:[{k:"part",v:"unchecked-text",d:0},{k:"class",v:"switch__inner-unchecked",d:0}],c:[{t:0,d:0,s:1,g:"slot",a:[{k:"name",v:"unchecked",d:0}],c:[]}]}]},{f:10,c:[{t:0,d:0,g:"span",a:[{k:"part",v:"unchecked-text",d:0},{k:"class",v:"switch__inner-unchecked",d:0}],c:[{t:1,d:1,f:11}]}]}]}]},{t:0,d:0,g:"div",a:[{k:"part",v:"handle",d:0},{k:"class",v:"switch__handle",d:0}],c:[{t:7,d:1,b:[{f:12,c:[{t:0,d:0,s:1,g:"span",a:[{k:"part",v:"loading-icon",d:0},{k:"class",v:"switch__loading-icon",d:0}],c:[]}]}]}]}]}]}],s:{tf:12,cf:12,dn:1,tn:1,sn:0}};exports.__SOLELY_IR__=t,exports.default=t;
|