solely 0.4.9 → 0.4.10

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.
Files changed (92) hide show
  1. package/dist/components/elements/alert/index.cjs +1 -1
  2. package/dist/components/elements/alert/index.d.ts +4 -0
  3. package/dist/components/elements/alert/index.html.cjs +1 -1
  4. package/dist/components/elements/alert/index.html.js +1 -1
  5. package/dist/components/elements/alert/index.js +1 -1
  6. package/dist/components/elements/alert/style.css.cjs +1 -1
  7. package/dist/components/elements/alert/style.css.js +1 -1
  8. package/dist/components/elements/backtop/index.cjs +1 -1
  9. package/dist/components/elements/backtop/index.js +1 -1
  10. package/dist/components/elements/badge/index.cjs +1 -1
  11. package/dist/components/elements/badge/index.d.ts +4 -0
  12. package/dist/components/elements/badge/index.js +1 -1
  13. package/dist/components/elements/button/index.cjs +1 -1
  14. package/dist/components/elements/button/index.d.ts +9 -1
  15. package/dist/components/elements/button/index.html.cjs +1 -1
  16. package/dist/components/elements/button/index.html.js +1 -1
  17. package/dist/components/elements/button/index.js +1 -1
  18. package/dist/components/elements/button/style.css.cjs +1 -1
  19. package/dist/components/elements/button/style.css.js +1 -1
  20. package/dist/components/elements/card/index.cjs +1 -1
  21. package/dist/components/elements/card/index.d.ts +4 -0
  22. package/dist/components/elements/card/index.js +1 -1
  23. package/dist/components/elements/checkbox/index.cjs +1 -1
  24. package/dist/components/elements/checkbox/index.js +1 -1
  25. package/dist/components/elements/coordinate-input/index.cjs +1 -1
  26. package/dist/components/elements/coordinate-input/index.js +1 -1
  27. package/dist/components/elements/divider/index.cjs +1 -1
  28. package/dist/components/elements/divider/index.js +1 -1
  29. package/dist/components/elements/empty/index.cjs +1 -1
  30. package/dist/components/elements/empty/index.d.ts +4 -0
  31. package/dist/components/elements/empty/index.html.cjs +1 -1
  32. package/dist/components/elements/empty/index.html.js +1 -1
  33. package/dist/components/elements/empty/index.js +1 -1
  34. package/dist/components/elements/fab/index.cjs +1 -1
  35. package/dist/components/elements/fab/index.d.ts +4 -0
  36. package/dist/components/elements/fab/index.js +1 -1
  37. package/dist/components/elements/icon/index.cjs +1 -1
  38. package/dist/components/elements/icon/index.js +1 -1
  39. package/dist/components/elements/input/index.cjs +1 -1
  40. package/dist/components/elements/input/index.js +1 -1
  41. package/dist/components/elements/pagination/index.cjs +1 -1
  42. package/dist/components/elements/pagination/index.js +1 -1
  43. package/dist/components/elements/progress/index.cjs +1 -1
  44. package/dist/components/elements/progress/index.d.ts +4 -0
  45. package/dist/components/elements/progress/index.js +1 -1
  46. package/dist/components/elements/radio/index.cjs +1 -1
  47. package/dist/components/elements/radio/index.d.ts +4 -0
  48. package/dist/components/elements/radio/index.js +1 -1
  49. package/dist/components/elements/rate/index.cjs +1 -1
  50. package/dist/components/elements/rate/index.js +1 -1
  51. package/dist/components/elements/select/index.cjs +1 -1
  52. package/dist/components/elements/select/index.js +1 -1
  53. package/dist/components/elements/skeleton/index.cjs +1 -1
  54. package/dist/components/elements/skeleton/index.d.ts +4 -0
  55. package/dist/components/elements/skeleton/index.js +1 -1
  56. package/dist/components/elements/slider/index.cjs +1 -1
  57. package/dist/components/elements/slider/index.js +1 -1
  58. package/dist/components/elements/steps/index.cjs +1 -1
  59. package/dist/components/elements/steps/index.d.ts +4 -2
  60. package/dist/components/elements/steps/index.html.cjs +1 -1
  61. package/dist/components/elements/steps/index.html.js +1 -1
  62. package/dist/components/elements/steps/index.js +1 -1
  63. package/dist/components/elements/switch/index.cjs +1 -1
  64. package/dist/components/elements/switch/index.d.ts +8 -0
  65. package/dist/components/elements/switch/index.html.cjs +1 -1
  66. package/dist/components/elements/switch/index.html.js +1 -1
  67. package/dist/components/elements/switch/index.js +1 -1
  68. package/dist/components/elements/table/index.cjs +1 -1
  69. package/dist/components/elements/table/index.d.ts +9 -8
  70. package/dist/components/elements/table/index.html.cjs +1 -1
  71. package/dist/components/elements/table/index.html.js +1 -1
  72. package/dist/components/elements/table/index.js +1 -1
  73. package/dist/components/elements/tabs/index.cjs +1 -1
  74. package/dist/components/elements/tabs/index.d.ts +3 -5
  75. package/dist/components/elements/tabs/index.html.cjs +1 -1
  76. package/dist/components/elements/tabs/index.html.js +1 -1
  77. package/dist/components/elements/tabs/index.js +1 -1
  78. package/dist/components/elements/tag/index.cjs +1 -1
  79. package/dist/components/elements/tag/index.d.ts +4 -0
  80. package/dist/components/elements/tag/index.html.cjs +1 -1
  81. package/dist/components/elements/tag/index.html.js +1 -1
  82. package/dist/components/elements/tag/index.js +1 -1
  83. package/dist/components/elements/timeline/index.cjs +1 -1
  84. package/dist/components/elements/timeline/index.d.ts +2 -4
  85. package/dist/components/elements/timeline/index.html.cjs +1 -1
  86. package/dist/components/elements/timeline/index.html.js +1 -1
  87. package/dist/components/elements/timeline/index.js +1 -1
  88. package/dist/components/elements/tree/index.cjs +1 -1
  89. package/dist/components/elements/tree/index.js +1 -1
  90. package/dist/components/elements/upload/index.cjs +1 -1
  91. package/dist/components/elements/upload/index.js +1 -1
  92. package/package.json +1 -1
@@ -1 +1 @@
1
- const t='<div class="empty">\n <div class="empty__image">\n <If test="$data.image">\n <img :src="$data.image" alt="empty" />\n </If>\n <If test="!$data.image">\n <span class="empty__icon">📭</span>\n </If>\n </div>\n <p class="empty__description">{{$data.description || \'暂无数据\'}}</p>\n <div class="empty__footer">\n <slot></slot>\n </div>\n</div>\n';export{t as default};
1
+ const s='<div class="empty">\n <div class="empty__image">\n <If test="this.hasImageSlot()">\n <slot name="image"></slot>\n </If>\n <ElseIf test="$data.image">\n <img :src="$data.image" alt="empty" />\n </ElseIf>\n <Else>\n <span class="empty__icon">📭</span>\n </Else>\n </div>\n <p class="empty__description">{{$data.description || \'暂无数据\'}}</p>\n <div class="empty__footer">\n <slot></slot>\n </div>\n</div>\n';export{s as default};
@@ -1 +1 @@
1
- import e from"./style.css.js";import t from"./index.html.js";import r from"../../../runtime/component/base-element.js";import{CustomElement as o}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let s=class extends r{setDescription(e){this.$data.description=e}};s=((e,t)=>{for(var r,o=t,s=e.length-1;s>=0;s--)(r=e[s])&&(o=r(o)||o);return o})([o({tagName:"solely-empty",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"description",type:"string",default:""},{name:"image",type:"string",default:""}]})],s);export{s as SolelyEmpty};
1
+ import e from"./style.css.js";import t from"./index.html.js";import r from"../../../runtime/component/base-element.js";import{CustomElement as o}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let s=class extends r{hasImageSlot(){return null!==this.querySelector('[slot="image"]')}setDescription(e){this.$data.description=e}};s=((e,t)=>{for(var r,o=t,s=e.length-1;s>=0;s--)(r=e[s])&&(o=r(o)||o);return o})([o({tagName:"solely-empty",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"description",type:"string",default:""},{name:"image",type:"string",default:""}]})],s);export{s as SolelyEmpty};
@@ -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"),s=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyFab=class extends a.default{getFabClasses(){const e={};e[`fab--${this.$data.type||"primary"}`]=!0;const t=this.$data.size||"medium";return"small"===t?e["fab--sm"]=!0:"large"===t?e["fab--lg"]=!0:e["fab--md"]=!0,e[`fab--${this.$data.shape||"circle"}`]=!0,e[`fab--${this.$data.position||"bottom-right"}`]=!0,e["fab--hidden"]=!this.$data.visible,e["fab--absolute"]=!!this.$data.absolute,e}getFabStyles(){const e={};return e["--fab-offset-x"]=`${this.$data.offsetX||24}px`,e["--fab-offset-y"]=`${this.$data.offsetY||24}px`,this.$data.zIndex&&(e["z-index"]=String(this.$data.zIndex)),e}hasIconSlot(){return null!==this.querySelector('[slot="icon"]')}handleClick(e){if(this.$data.disabled)return e.preventDefault(),void e.stopPropagation();this.$data.hideOnClick&&this.hide()}show(){this.$data.visible=!0}hide(){this.$data.visible=!1}toggle(){this.$data.visible=!this.$data.visible}setPosition(e){this.$data.position=e}setOffset(e,t){this.$data.offsetX=e,this.$data.offsetY=t}focus(){var e;null==(e=this.$refs.buttonRef)||e.focus()}blur(){var e;null==(e=this.$refs.buttonRef)||e.blur()}},exports.SolelyFab=((e,t)=>{for(var a,s=t,i=e.length-1;i>=0;i--)(a=e[i])&&(s=a(s)||s);return s})([s.CustomElement({tagName:"solely-fab",template:t.default,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"primary"},{name:"size",type:"string",default:"medium"},{name:"shape",type:"string",default:"circle"},{name:"position",type:"string",default:"bottom-right"},{name:"offsetX",type:"number",default:24},{name:"offsetY",type:"number",default:24},{name:"disabled",type:"boolean",default:!1},{name:"icon",type:"string",default:""},{name:"visible",type:"boolean",default:!0},{name:"hideOnClick",type:"boolean",default:!1},{name:"zIndex",type:"number",default:1e3},{name:"absolute",type:"boolean",default:!1}]})],exports.SolelyFab);
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"),s=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyFab=class extends a.default{getFabClasses(){const e={};e[`fab--${this.$data.type||"primary"}`]=!0;const t=this.$data.size||"medium";return"small"===t?e["fab--sm"]=!0:"large"===t?e["fab--lg"]=!0:e["fab--md"]=!0,e[`fab--${this.$data.shape||"circle"}`]=!0,e[`fab--${this.$data.position||"bottom-right"}`]=!0,e["fab--hidden"]=!this.$data.visible,e["fab--absolute"]=!!this.$data.absolute,e}mounted(){this.refresh()}getFabStyles(){const e={};return e["--fab-offset-x"]=`${this.$data.offsetX||24}px`,e["--fab-offset-y"]=`${this.$data.offsetY||24}px`,this.$data.zIndex&&(e["z-index"]=String(this.$data.zIndex)),e}hasIconSlot(){return null!==this.querySelector('[slot="icon"]')}handleClick(e){if(this.$data.disabled)return e.preventDefault(),void e.stopPropagation();this.$data.hideOnClick&&this.hide()}show(){this.$data.visible=!0}hide(){this.$data.visible=!1}toggle(){this.$data.visible=!this.$data.visible}setPosition(e){this.$data.position=e}setOffset(e,t){this.$data.offsetX=e,this.$data.offsetY=t}focus(){var e;null==(e=this.$refs.buttonRef)||e.focus()}blur(){var e;null==(e=this.$refs.buttonRef)||e.blur()}},exports.SolelyFab=((e,t)=>{for(var a,s=t,i=e.length-1;i>=0;i--)(a=e[i])&&(s=a(s)||s);return s})([s.CustomElement({tagName:"solely-fab",template:t.default,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"primary"},{name:"size",type:"string",default:"medium"},{name:"shape",type:"string",default:"circle"},{name:"position",type:"string",default:"bottom-right"},{name:"offsetX",type:"number",default:24},{name:"offsetY",type:"number",default:24},{name:"disabled",type:"boolean",default:!1},{name:"icon",type:"string",default:""},{name:"visible",type:"boolean",default:!0},{name:"hideOnClick",type:"boolean",default:!1},{name:"zIndex",type:"number",default:1e3},{name:"absolute",type:"boolean",default:!1}]})],exports.SolelyFab);
@@ -5,6 +5,10 @@ declare class SolelyFab extends BaseElement<FabProps, FabRefs> {
5
5
  * 获取 FAB class 对象
6
6
  */
7
7
  getFabClasses(): Record<string, boolean>;
8
+ /**
9
+ * 组件挂载后
10
+ */
11
+ mounted(): void;
8
12
  /**
9
13
  * 获取 FAB 内联样式
10
14
  */
@@ -1 +1 @@
1
- import t from"./style.css.js";import e from"./index.html.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as s}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let i=class extends a{getFabClasses(){const t={};t[`fab--${this.$data.type||"primary"}`]=!0;const e=this.$data.size||"medium";return"small"===e?t["fab--sm"]=!0:"large"===e?t["fab--lg"]=!0:t["fab--md"]=!0,t[`fab--${this.$data.shape||"circle"}`]=!0,t[`fab--${this.$data.position||"bottom-right"}`]=!0,t["fab--hidden"]=!this.$data.visible,t["fab--absolute"]=!!this.$data.absolute,t}getFabStyles(){const t={};return t["--fab-offset-x"]=`${this.$data.offsetX||24}px`,t["--fab-offset-y"]=`${this.$data.offsetY||24}px`,this.$data.zIndex&&(t["z-index"]=String(this.$data.zIndex)),t}hasIconSlot(){return null!==this.querySelector('[slot="icon"]')}handleClick(t){if(this.$data.disabled)return t.preventDefault(),void t.stopPropagation();this.$data.hideOnClick&&this.hide()}show(){this.$data.visible=!0}hide(){this.$data.visible=!1}toggle(){this.$data.visible=!this.$data.visible}setPosition(t){this.$data.position=t}setOffset(t,e){this.$data.offsetX=t,this.$data.offsetY=e}focus(){var t;null==(t=this.$refs.buttonRef)||t.focus()}blur(){var t;null==(t=this.$refs.buttonRef)||t.blur()}};i=((t,e)=>{for(var a,s=e,i=t.length-1;i>=0;i--)(a=t[i])&&(s=a(s)||s);return s})([s({tagName:"solely-fab",template:e,styles:t,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"primary"},{name:"size",type:"string",default:"medium"},{name:"shape",type:"string",default:"circle"},{name:"position",type:"string",default:"bottom-right"},{name:"offsetX",type:"number",default:24},{name:"offsetY",type:"number",default:24},{name:"disabled",type:"boolean",default:!1},{name:"icon",type:"string",default:""},{name:"visible",type:"boolean",default:!0},{name:"hideOnClick",type:"boolean",default:!1},{name:"zIndex",type:"number",default:1e3},{name:"absolute",type:"boolean",default:!1}]})],i);export{i as SolelyFab};
1
+ import t from"./style.css.js";import e from"./index.html.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as s}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let i=class extends a{getFabClasses(){const t={};t[`fab--${this.$data.type||"primary"}`]=!0;const e=this.$data.size||"medium";return"small"===e?t["fab--sm"]=!0:"large"===e?t["fab--lg"]=!0:t["fab--md"]=!0,t[`fab--${this.$data.shape||"circle"}`]=!0,t[`fab--${this.$data.position||"bottom-right"}`]=!0,t["fab--hidden"]=!this.$data.visible,t["fab--absolute"]=!!this.$data.absolute,t}mounted(){this.refresh()}getFabStyles(){const t={};return t["--fab-offset-x"]=`${this.$data.offsetX||24}px`,t["--fab-offset-y"]=`${this.$data.offsetY||24}px`,this.$data.zIndex&&(t["z-index"]=String(this.$data.zIndex)),t}hasIconSlot(){return null!==this.querySelector('[slot="icon"]')}handleClick(t){if(this.$data.disabled)return t.preventDefault(),void t.stopPropagation();this.$data.hideOnClick&&this.hide()}show(){this.$data.visible=!0}hide(){this.$data.visible=!1}toggle(){this.$data.visible=!this.$data.visible}setPosition(t){this.$data.position=t}setOffset(t,e){this.$data.offsetX=t,this.$data.offsetY=e}focus(){var t;null==(t=this.$refs.buttonRef)||t.focus()}blur(){var t;null==(t=this.$refs.buttonRef)||t.blur()}};i=((t,e)=>{for(var a,s=e,i=t.length-1;i>=0;i--)(a=t[i])&&(s=a(s)||s);return s})([s({tagName:"solely-fab",template:e,styles:t,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"primary"},{name:"size",type:"string",default:"medium"},{name:"shape",type:"string",default:"circle"},{name:"position",type:"string",default:"bottom-right"},{name:"offsetX",type:"number",default:24},{name:"offsetY",type:"number",default:24},{name:"disabled",type:"boolean",default:!1},{name:"icon",type:"string",default:""},{name:"visible",type:"boolean",default:!0},{name:"hideOnClick",type:"boolean",default:!1},{name:"zIndex",type:"number",default:1e3},{name:"absolute",type:"boolean",default:!1}]})],i);export{i as SolelyFab};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./style.css.cjs"),e=require("./index.html.cjs"),s=require("../../../runtime/component/base-element.cjs"),n=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;const o=new Map,r=new Map;let i=null;async function a(t){return i||(r.size>0?Promise.resolve():(i=(async()=>{try{const e=await fetch(t),s=await e.text();(new DOMParser).parseFromString(s,"image/svg+xml").querySelectorAll("symbol").forEach(t=>{const e=t.id,s=t.getAttribute("viewBox")||"0 0 16 16",n=t.innerHTML;e&&n&&r.set(e,{viewBox:s,content:n})}),console.info(`[Solely Icon] Loaded ${r.size} icons from sprite`)}catch(e){console.warn("[Solely Icon] Failed to load icon sprite:",e)}})(),i))}function c(t){const e=o.get(t);if(e)return e;const s=r.get(t);return s?s.content:""}function l(t){const e=r.get(t);return e?e.viewBox:"0 0 16 16"}function u(t){return o.has(t)||r.has(t)}exports.SolelyIcon=class extends s.default{getIconContent(){return this.$data.name?c(this.$data.name)||this.getDefaultIcon():""}getViewBox(){return this.$data.name?l(this.$data.name):"0 0 16 16"}getDefaultIcon(){return'<rect x="2" y="2" width="12" height="12" rx="2" fill="none" stroke="currentColor" stroke-width="1.5"/><line x1="6" y1="8" x2="10" y2="8" stroke="currentColor" stroke-width="1.5"/><circle cx="8" cy="11.5" r="0.75" fill="currentColor"/>'}getIconSize(){const t=this.$data.size||"medium",e={small:"12px",medium:"16px",large:"24px"}[t];if(e)return e;const s=Number(t);return!isNaN(s)&&s>0?`${s}px`:String(t)}getSizeStyle(){return`--icon-size: ${this.getIconSize()};`}getSpinStyle(){const t=this.$data.spin;return t?`--spin-direction: ${"counterclockwise"===t?"reverse":"normal"}; --spin-duration: ${this.$data.spinDuration||1}s;`:""}getColorStyle(){const t=this.$data.color;return t?`--icon-color: ${t};`:""}getIconClasses(){const t={icon:!0,"is-spinning":!!this.$data.spin},e=this.$data.size;return"small"!==e&&"medium"!==e&&"large"!==e||(t[`icon--${e}`]=!0),t}hasIcon(){return!(!this.$data.name||!u(this.$data.name)&&!i&&!this.$data.sprite)}updateHostStyles(){this.style.setProperty("--icon-size",this.getIconSize());const t=this.$data.color;t?this.style.setProperty("--icon-color",t):this.style.removeProperty("--icon-color");const e=this.$data.spin;if(e){const t=this.$data.spinDuration||1,s="counterclockwise"===e?"reverse":"normal";this.style.setProperty("--spin-duration",`${t}s`),this.style.setProperty("--spin-direction",s)}else this.style.removeProperty("--spin-duration"),this.style.removeProperty("--spin-direction");this.classList.remove("icon--small","icon--medium","icon--large");const s=this.$data.size;"small"!==s&&"medium"!==s&&"large"!==s||this.classList.add(`icon--${s}`)}async mounted(){this.updateHostStyles();const t=this.$data.sprite;t?(await a(t),this.updateSvgContent()):i?(await i,this.updateSvgContent()):this.updateSvgContent()}updated(){this.updateHostStyles(),this.updateSvgContent()}updateSvgContent(){const t=this.$refs.svgRef;t&&this.hasIcon()&&(t.innerHTML=this.getIconContent())}handleClick(t){if(this.$data.disabled)return t.preventDefault(),void t.stopPropagation()}focus(){var t;null==(t=this.$refs.svgRef)||t.focus()}blur(){var t;null==(t=this.$refs.svgRef)||t.blur()}},exports.SolelyIcon=((t,e)=>{for(var s,n=e,o=t.length-1;o>=0;o--)(s=t[o])&&(n=s(n)||n);return n})([n.CustomElement({tagName:"solely-icon",template:e.default,styles:t.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"name",type:"string",default:""},{name:"size",type:"string",default:"medium"},{name:"color",type:"string",default:""},{name:"spin",type:"string",default:""},{name:"spinDuration",type:"number",default:1},{name:"disabled",type:"boolean",default:!1},{name:"sprite",type:"string",default:""}]})],exports.SolelyIcon),exports.getIcon=c,exports.getIconViewBox=l,exports.getRegisteredIcons=function(){return Array.from(new Set([...o.keys(),...r.keys()]))},exports.hasIcon=u,exports.loadIconSprite=a,exports.registerIcon=function(t,e){o.set(t,e)},exports.registerIcons=function(t){Object.entries(t).forEach(([t,e])=>{o.set(t,e)})};
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"),n=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;const o=new Map,r=new Map;let i=null;async function a(e){return i||(r.size>0?Promise.resolve():(i=(async()=>{try{const t=await fetch(e),s=await t.text();(new DOMParser).parseFromString(s,"image/svg+xml").querySelectorAll("symbol").forEach(e=>{const t=e.id,s=e.getAttribute("viewBox")||"0 0 16 16",n=e.innerHTML;t&&n&&r.set(t,{viewBox:s,content:n})}),console.info(`[Solely Icon] Loaded ${r.size} icons from sprite`)}catch(t){console.warn("[Solely Icon] Failed to load icon sprite:",t)}})(),i))}function c(e){const t=o.get(e);if(t)return t;const s=r.get(e);return s?s.content:""}function l(e){const t=r.get(e);return t?t.viewBox:"0 0 16 16"}function u(e){return o.has(e)||r.has(e)}exports.SolelyIcon=class extends s.default{getIconContent(){return this.$data.name?c(this.$data.name)||this.getDefaultIcon():""}getViewBox(){return this.$data.name?l(this.$data.name):"0 0 16 16"}getDefaultIcon(){return'<rect x="2" y="2" width="12" height="12" rx="2" fill="none" stroke="currentColor" stroke-width="1.5"/><line x1="6" y1="8" x2="10" y2="8" stroke="currentColor" stroke-width="1.5"/><circle cx="8" cy="11.5" r="0.75" fill="currentColor"/>'}getIconSize(){const e=this.$data.size||"medium",t={small:"12px",medium:"16px",large:"24px"}[e];if(t)return t;const s=Number(e);return!isNaN(s)&&s>0?`${s}px`:String(e)}getSizeStyle(){return`--icon-size: ${this.getIconSize()};`}getSpinStyle(){const e=this.$data.spin;return e?`--spin-direction: ${"counterclockwise"===e?"reverse":"normal"}; --spin-duration: ${this.$data.spinDuration||1}s;`:""}getColorStyle(){const e=this.$data.color;return e?`--icon-color: ${e};`:""}getIconClasses(){const e={icon:!0,"is-spinning":!!this.$data.spin},t=this.$data.size;return"small"!==t&&"medium"!==t&&"large"!==t||(e[`icon--${t}`]=!0),e}hasIcon(){return!(!this.$data.name||!u(this.$data.name)&&!i&&!this.$data.sprite)}updateHostStyles(){this.style.setProperty("--icon-size",this.getIconSize());const e=this.$data.color;e?this.style.setProperty("--icon-color",e):this.style.removeProperty("--icon-color");const t=this.$data.spin;if(t){const e=this.$data.spinDuration||1,s="counterclockwise"===t?"reverse":"normal";this.style.setProperty("--spin-duration",`${e}s`),this.style.setProperty("--spin-direction",s)}else this.style.removeProperty("--spin-duration"),this.style.removeProperty("--spin-direction");this.classList.remove("icon--small","icon--medium","icon--large");const s=this.$data.size;"small"!==s&&"medium"!==s&&"large"!==s||this.classList.add(`icon--${s}`)}async mounted(){this.refresh(),this.updateHostStyles();const e=this.$data.sprite;if(e)try{await a(e),this.updateSvgContent(),this.dispatchEvent(new Event("sprite-loaded",{bubbles:!0,composed:!0}))}catch{this.updateSvgContent(),this.dispatchEvent(new Event("sprite-error",{bubbles:!0,composed:!0}))}else if(i)try{await i,this.updateSvgContent(),this.dispatchEvent(new Event("sprite-loaded",{bubbles:!0,composed:!0}))}catch{this.updateSvgContent(),this.dispatchEvent(new Event("sprite-error",{bubbles:!0,composed:!0}))}else this.updateSvgContent()}updated(){this.updateHostStyles(),this.updateSvgContent()}updateSvgContent(){const e=this.$refs.svgRef;e&&this.hasIcon()&&(e.innerHTML=this.getIconContent())}handleClick(e){if(this.$data.disabled)return e.preventDefault(),void e.stopPropagation()}focus(){var e;null==(e=this.$refs.svgRef)||e.focus()}blur(){var e;null==(e=this.$refs.svgRef)||e.blur()}},exports.SolelyIcon=((e,t)=>{for(var s,n=t,o=e.length-1;o>=0;o--)(s=e[o])&&(n=s(n)||n);return n})([n.CustomElement({tagName:"solely-icon",template:t.default,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"name",type:"string",default:""},{name:"size",type:"string",default:"medium"},{name:"color",type:"string",default:""},{name:"spin",type:"string",default:""},{name:"spinDuration",type:"number",default:1},{name:"disabled",type:"boolean",default:!1},{name:"sprite",type:"string",default:""}]})],exports.SolelyIcon),exports.getIcon=c,exports.getIconViewBox=l,exports.getRegisteredIcons=function(){return Array.from(new Set([...o.keys(),...r.keys()]))},exports.hasIcon=u,exports.loadIconSprite=a,exports.registerIcon=function(e,t){o.set(e,t)},exports.registerIcons=function(e){Object.entries(e).forEach(([e,t])=>{o.set(e,t)})};
@@ -1 +1 @@
1
- import t from"./style.css.js";import e from"./index.html.js";import n from"../../../runtime/component/base-element.js";import{CustomElement as s}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;const i=new Map,o=new Map;let r=null;async function a(t){return r||(o.size>0?Promise.resolve():(r=(async()=>{try{const e=await fetch(t),n=await e.text();(new DOMParser).parseFromString(n,"image/svg+xml").querySelectorAll("symbol").forEach(t=>{const e=t.id,n=t.getAttribute("viewBox")||"0 0 16 16",s=t.innerHTML;e&&s&&o.set(e,{viewBox:n,content:s})}),console.info(`[Solely Icon] Loaded ${o.size} icons from sprite`)}catch(e){console.warn("[Solely Icon] Failed to load icon sprite:",e)}})(),r))}function c(t,e){i.set(t,e)}function l(t){Object.entries(t).forEach(([t,e])=>{i.set(t,e)})}function u(t){const e=i.get(t);if(e)return e;const n=o.get(t);return n?n.content:""}function d(t){const e=o.get(t);return e?e.viewBox:"0 0 16 16"}function p(t){return i.has(t)||o.has(t)}function m(){return Array.from(new Set([...i.keys(),...o.keys()]))}let h=class extends n{getIconContent(){return this.$data.name?u(this.$data.name)||this.getDefaultIcon():""}getViewBox(){return this.$data.name?d(this.$data.name):"0 0 16 16"}getDefaultIcon(){return'<rect x="2" y="2" width="12" height="12" rx="2" fill="none" stroke="currentColor" stroke-width="1.5"/><line x1="6" y1="8" x2="10" y2="8" stroke="currentColor" stroke-width="1.5"/><circle cx="8" cy="11.5" r="0.75" fill="currentColor"/>'}getIconSize(){const t=this.$data.size||"medium",e={small:"12px",medium:"16px",large:"24px"}[t];if(e)return e;const n=Number(t);return!isNaN(n)&&n>0?`${n}px`:String(t)}getSizeStyle(){return`--icon-size: ${this.getIconSize()};`}getSpinStyle(){const t=this.$data.spin;return t?`--spin-direction: ${"counterclockwise"===t?"reverse":"normal"}; --spin-duration: ${this.$data.spinDuration||1}s;`:""}getColorStyle(){const t=this.$data.color;return t?`--icon-color: ${t};`:""}getIconClasses(){const t={icon:!0,"is-spinning":!!this.$data.spin},e=this.$data.size;return"small"!==e&&"medium"!==e&&"large"!==e||(t[`icon--${e}`]=!0),t}hasIcon(){return!(!this.$data.name||!p(this.$data.name)&&!r&&!this.$data.sprite)}updateHostStyles(){this.style.setProperty("--icon-size",this.getIconSize());const t=this.$data.color;t?this.style.setProperty("--icon-color",t):this.style.removeProperty("--icon-color");const e=this.$data.spin;if(e){const t=this.$data.spinDuration||1,n="counterclockwise"===e?"reverse":"normal";this.style.setProperty("--spin-duration",`${t}s`),this.style.setProperty("--spin-direction",n)}else this.style.removeProperty("--spin-duration"),this.style.removeProperty("--spin-direction");this.classList.remove("icon--small","icon--medium","icon--large");const n=this.$data.size;"small"!==n&&"medium"!==n&&"large"!==n||this.classList.add(`icon--${n}`)}async mounted(){this.updateHostStyles();const t=this.$data.sprite;t?(await a(t),this.updateSvgContent()):r?(await r,this.updateSvgContent()):this.updateSvgContent()}updated(){this.updateHostStyles(),this.updateSvgContent()}updateSvgContent(){const t=this.$refs.svgRef;t&&this.hasIcon()&&(t.innerHTML=this.getIconContent())}handleClick(t){if(this.$data.disabled)return t.preventDefault(),void t.stopPropagation()}focus(){var t;null==(t=this.$refs.svgRef)||t.focus()}blur(){var t;null==(t=this.$refs.svgRef)||t.blur()}};h=((t,e)=>{for(var n,s=e,i=t.length-1;i>=0;i--)(n=t[i])&&(s=n(s)||s);return s})([s({tagName:"solely-icon",template:e,styles:t,shadowDOM:{use:!0,mode:"open"},props:[{name:"name",type:"string",default:""},{name:"size",type:"string",default:"medium"},{name:"color",type:"string",default:""},{name:"spin",type:"string",default:""},{name:"spinDuration",type:"number",default:1},{name:"disabled",type:"boolean",default:!1},{name:"sprite",type:"string",default:""}]})],h);export{h as SolelyIcon,u as getIcon,d as getIconViewBox,m as getRegisteredIcons,p as hasIcon,a as loadIconSprite,c as registerIcon,l as registerIcons};
1
+ import t from"./style.css.js";import e from"./index.html.js";import s from"../../../runtime/component/base-element.js";import{CustomElement as n}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;const i=new Map,o=new Map;let r=null;async function a(t){return r||(o.size>0?Promise.resolve():(r=(async()=>{try{const e=await fetch(t),s=await e.text();(new DOMParser).parseFromString(s,"image/svg+xml").querySelectorAll("symbol").forEach(t=>{const e=t.id,s=t.getAttribute("viewBox")||"0 0 16 16",n=t.innerHTML;e&&n&&o.set(e,{viewBox:s,content:n})}),console.info(`[Solely Icon] Loaded ${o.size} icons from sprite`)}catch(e){console.warn("[Solely Icon] Failed to load icon sprite:",e)}})(),r))}function c(t,e){i.set(t,e)}function l(t){Object.entries(t).forEach(([t,e])=>{i.set(t,e)})}function d(t){const e=i.get(t);if(e)return e;const s=o.get(t);return s?s.content:""}function u(t){const e=o.get(t);return e?e.viewBox:"0 0 16 16"}function p(t){return i.has(t)||o.has(t)}function h(){return Array.from(new Set([...i.keys(),...o.keys()]))}let m=class extends s{getIconContent(){return this.$data.name?d(this.$data.name)||this.getDefaultIcon():""}getViewBox(){return this.$data.name?u(this.$data.name):"0 0 16 16"}getDefaultIcon(){return'<rect x="2" y="2" width="12" height="12" rx="2" fill="none" stroke="currentColor" stroke-width="1.5"/><line x1="6" y1="8" x2="10" y2="8" stroke="currentColor" stroke-width="1.5"/><circle cx="8" cy="11.5" r="0.75" fill="currentColor"/>'}getIconSize(){const t=this.$data.size||"medium",e={small:"12px",medium:"16px",large:"24px"}[t];if(e)return e;const s=Number(t);return!isNaN(s)&&s>0?`${s}px`:String(t)}getSizeStyle(){return`--icon-size: ${this.getIconSize()};`}getSpinStyle(){const t=this.$data.spin;return t?`--spin-direction: ${"counterclockwise"===t?"reverse":"normal"}; --spin-duration: ${this.$data.spinDuration||1}s;`:""}getColorStyle(){const t=this.$data.color;return t?`--icon-color: ${t};`:""}getIconClasses(){const t={icon:!0,"is-spinning":!!this.$data.spin},e=this.$data.size;return"small"!==e&&"medium"!==e&&"large"!==e||(t[`icon--${e}`]=!0),t}hasIcon(){return!(!this.$data.name||!p(this.$data.name)&&!r&&!this.$data.sprite)}updateHostStyles(){this.style.setProperty("--icon-size",this.getIconSize());const t=this.$data.color;t?this.style.setProperty("--icon-color",t):this.style.removeProperty("--icon-color");const e=this.$data.spin;if(e){const t=this.$data.spinDuration||1,s="counterclockwise"===e?"reverse":"normal";this.style.setProperty("--spin-duration",`${t}s`),this.style.setProperty("--spin-direction",s)}else this.style.removeProperty("--spin-duration"),this.style.removeProperty("--spin-direction");this.classList.remove("icon--small","icon--medium","icon--large");const s=this.$data.size;"small"!==s&&"medium"!==s&&"large"!==s||this.classList.add(`icon--${s}`)}async mounted(){this.refresh(),this.updateHostStyles();const t=this.$data.sprite;if(t)try{await a(t),this.updateSvgContent(),this.dispatchEvent(new Event("sprite-loaded",{bubbles:!0,composed:!0}))}catch{this.updateSvgContent(),this.dispatchEvent(new Event("sprite-error",{bubbles:!0,composed:!0}))}else if(r)try{await r,this.updateSvgContent(),this.dispatchEvent(new Event("sprite-loaded",{bubbles:!0,composed:!0}))}catch{this.updateSvgContent(),this.dispatchEvent(new Event("sprite-error",{bubbles:!0,composed:!0}))}else this.updateSvgContent()}updated(){this.updateHostStyles(),this.updateSvgContent()}updateSvgContent(){const t=this.$refs.svgRef;t&&this.hasIcon()&&(t.innerHTML=this.getIconContent())}handleClick(t){if(this.$data.disabled)return t.preventDefault(),void t.stopPropagation()}focus(){var t;null==(t=this.$refs.svgRef)||t.focus()}blur(){var t;null==(t=this.$refs.svgRef)||t.blur()}};m=((t,e)=>{for(var s,n=e,i=t.length-1;i>=0;i--)(s=t[i])&&(n=s(n)||n);return n})([n({tagName:"solely-icon",template:e,styles:t,shadowDOM:{use:!0,mode:"open"},props:[{name:"name",type:"string",default:""},{name:"size",type:"string",default:"medium"},{name:"color",type:"string",default:""},{name:"spin",type:"string",default:""},{name:"spinDuration",type:"number",default:1},{name:"disabled",type:"boolean",default:!1},{name:"sprite",type:"string",default:""}]})],m);export{m as SolelyIcon,d as getIcon,u as getIconViewBox,h as getRegisteredIcons,p as hasIcon,a as loadIconSprite,c as registerIcon,l as registerIcons};
@@ -1 +1 @@
1
- "use strict";var e=Object.defineProperty,t=(t,a,s)=>((t,a,s)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s)(t,"symbol"!=typeof a?a+"":a,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./style.css.cjs"),s=require("./index.html.cjs"),r=require("../../../runtime/component/base-element.cjs"),l=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyInput=class extends r.default{constructor(){super(...arguments),t(this,"_filteredSuggestions",[]),t(this,"inputElement"),t(this,"searchDebounceTimer")}get filteredSuggestions(){return this._filteredSuggestions}mounted(){this.$data.autofocus&&this.focus()}hasPrefixSlot(){return null!==this.querySelector('[slot="prefix"]')}hasSuffixSlot(){return null!==this.querySelector('[slot="suffix"]')}afterMount(){var e;this.inputElement=null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea")}getWrapperClasses(){const e={};return"small"===this.$data.size?e["form-control--sm"]=!0:"large"===this.$data.size&&(e["form-control--lg"]=!0),"error"===this.$data.status?e["is-error"]=!0:"warning"===this.$data.status?e["is-warning"]=!0:"success"===this.$data.status&&(e["is-success"]=!0),"textarea"===this.$data.type&&(e["form-control--textarea"]=!0),e["is-focused"]=!!this.$data.focused,e["is-disabled"]=!!this.$data.disabled,e["is-readonly"]=!!this.$data.readonly,e["form-control--block"]=!!this.$data.block,e}getCharCount(){var e;return(null==(e=this.$data.value)?void 0:e.length)||0}formatValue(e){if(!e)return"";switch(this.$data.format){case"phone":return e.replace(/(\d{3})(\d{4})(\d{4})/,"$1 $2 $3").trim();case"bankcard":return e.replace(/(\d{4})(?=\d)/g,"$1 ").trim();case"idcard":return e.replace(/(\d{6})(\d{4})(\d{4})(\d{4})(\d{0,4})/,"$1 $2 $3 $4 $5").trim();default:return e}}unformatValue(e){return e?e.replace(/\s/g,""):""}handleInput(e){const t=e.target;let a=t.value;if("none"!==this.$data.format&&"textarea"!==this.$data.type){const e=this.unformatValue(a),s=this.formatValue(e);s!==a&&(t.value=s,a=s)}this.$data.value=a,this.$data.suggestions&&this.$data.suggestions.length>0&&this.updateSuggestions(a)}handleFocus(e){this.$data.focused=!0,this.$data.selectall&&this.$data.value&&this.select()}handleBlur(e){this.$data.focused=!1}handleChange(e){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}handleKeydown(e){"Enter"===e.key&&"search"===this.$data.type&&this.emit("search",{value:this.$data.value})}handleClear(){this.$data.value="",this.dispatchEvent(new Event("clear",{bubbles:!0,composed:!0})),this.focus()}togglePassword(){this.$data.passwordVisible=!this.$data.passwordVisible}async handleCopy(){try{const e=this.unformatValue(this.$data.value);await navigator.clipboard.writeText(e),this.emit("copy",{value:e})}catch(e){this.emit("copy-error",{error:e})}}updateSuggestions(e){this.searchDebounceTimer&&clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=setTimeout(()=>{this._updateSuggestionsImpl(e),this.searchDebounceTimer=void 0},300)}_updateSuggestionsImpl(e){if(!e||!this.$data.suggestions)return this._filteredSuggestions=[],void this.refresh();this._filteredSuggestions=this.$data.suggestions.filter(t=>t.toLowerCase().includes(e.toLowerCase())),this.refresh()}selectSuggestion(e){this.$data.value=e,this._filteredSuggestions=[],this.refresh(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}focus(){var e;null==(e=this.inputElement)||e.focus(),this.$data.focused=!0}blur(){var e;null==(e=this.inputElement)||e.blur(),this.$data.focused=!1}setValue(e){this.$data.value=e}getValue(){return this.unformatValue(this.$data.value)}get value(){return this.getValue()}set value(e){this.setValue(e)}select(){var e;null==(e=this.inputElement)||e.select()}},exports.SolelyInput=((e,t)=>{for(var a,s=t,r=e.length-1;r>=0;r--)(a=e[r])&&(s=a(s)||s);return s})([l.CustomElement({tagName:"solely-input",template:s.default,styles:a.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"text"},{name:"size",type:"string",default:""},{name:"value",type:"string",default:""},{name:"placeholder",type:"string",default:""},{name:"disabled",type:"boolean",default:!1},{name:"readonly",type:"boolean",default:!1},{name:"required",type:"boolean",default:!1},{name:"maxlength",type:"number"},{name:"minlength",type:"number"},{name:"clearable",type:"boolean",default:!1},{name:"showpassword",type:"boolean",default:!1},{name:"passwordVisible",type:"boolean",default:!1},{name:"focused",type:"boolean",default:!1},{name:"prefix",type:"string",default:""},{name:"suffix",type:"string",default:""},{name:"status",type:"string",default:""},{name:"message",type:"string",default:""},{name:"showcount",type:"boolean",default:!1},{name:"rows",type:"number",default:3},{name:"autofocus",type:"boolean",default:!1},{name:"selectall",type:"boolean",default:!1},{name:"copyable",type:"boolean",default:!1},{name:"format",type:"string",default:"none"},{name:"suggestions",type:"array",default:[]},{name:"block",type:"boolean",default:!1}]})],exports.SolelyInput);
1
+ "use strict";var e=Object.defineProperty,t=(t,a,s)=>((t,a,s)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s)(t,"symbol"!=typeof a?a+"":a,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./style.css.cjs"),s=require("./index.html.cjs"),r=require("../../../runtime/component/base-element.cjs"),l=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyInput=class extends r.default{constructor(){super(...arguments),t(this,"_filteredSuggestions",[]),t(this,"inputElement"),t(this,"searchDebounceTimer")}get filteredSuggestions(){return this._filteredSuggestions}mounted(){this.refresh(),this.$data.autofocus&&this.focus()}hasPrefixSlot(){return null!==this.querySelector('[slot="prefix"]')}hasSuffixSlot(){return null!==this.querySelector('[slot="suffix"]')}afterMount(){var e;this.inputElement=null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea")}getWrapperClasses(){const e={};return"small"===this.$data.size?e["form-control--sm"]=!0:"large"===this.$data.size&&(e["form-control--lg"]=!0),"error"===this.$data.status?e["is-error"]=!0:"warning"===this.$data.status?e["is-warning"]=!0:"success"===this.$data.status&&(e["is-success"]=!0),"textarea"===this.$data.type&&(e["form-control--textarea"]=!0),e["is-focused"]=!!this.$data.focused,e["is-disabled"]=!!this.$data.disabled,e["is-readonly"]=!!this.$data.readonly,e["form-control--block"]=!!this.$data.block,e}getCharCount(){var e;return(null==(e=this.$data.value)?void 0:e.length)||0}formatValue(e){if(!e)return"";switch(this.$data.format){case"phone":return e.replace(/(\d{3})(\d{4})(\d{4})/,"$1 $2 $3").trim();case"bankcard":return e.replace(/(\d{4})(?=\d)/g,"$1 ").trim();case"idcard":return e.replace(/(\d{6})(\d{4})(\d{4})(\d{4})(\d{0,4})/,"$1 $2 $3 $4 $5").trim();default:return e}}unformatValue(e){return e?e.replace(/\s/g,""):""}handleInput(e){const t=e.target;let a=t.value;if("none"!==this.$data.format&&"textarea"!==this.$data.type){const e=this.unformatValue(a),s=this.formatValue(e);s!==a&&(t.value=s,a=s)}this.$data.value=a,this.$data.suggestions&&this.$data.suggestions.length>0&&this.updateSuggestions(a)}handleFocus(e){this.$data.focused=!0,this.$data.selectall&&this.$data.value&&this.select()}handleBlur(e){this.$data.focused=!1}handleChange(e){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}handleKeydown(e){"Enter"===e.key&&"search"===this.$data.type&&this.emit("search",{value:this.$data.value})}handleClear(){this.$data.value="",this.dispatchEvent(new Event("clear",{bubbles:!0,composed:!0})),this.focus()}togglePassword(){this.$data.passwordVisible=!this.$data.passwordVisible}async handleCopy(){try{const e=this.unformatValue(this.$data.value);await navigator.clipboard.writeText(e),this.emit("copy",{value:e})}catch(e){this.emit("copy-error",{error:e})}}updateSuggestions(e){this.searchDebounceTimer&&clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=setTimeout(()=>{this._updateSuggestionsImpl(e),this.searchDebounceTimer=void 0},300)}_updateSuggestionsImpl(e){if(!e||!this.$data.suggestions)return this._filteredSuggestions=[],void this.refresh();this._filteredSuggestions=this.$data.suggestions.filter(t=>t.toLowerCase().includes(e.toLowerCase())),this.refresh()}selectSuggestion(e){this.$data.value=e,this._filteredSuggestions=[],this.refresh(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}focus(){var e;null==(e=this.inputElement)||e.focus(),this.$data.focused=!0}blur(){var e;null==(e=this.inputElement)||e.blur(),this.$data.focused=!1}setValue(e){this.$data.value=e}getValue(){return this.unformatValue(this.$data.value)}get value(){return this.getValue()}set value(e){this.setValue(e)}select(){var e;null==(e=this.inputElement)||e.select()}},exports.SolelyInput=((e,t)=>{for(var a,s=t,r=e.length-1;r>=0;r--)(a=e[r])&&(s=a(s)||s);return s})([l.CustomElement({tagName:"solely-input",template:s.default,styles:a.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"text"},{name:"size",type:"string",default:""},{name:"value",type:"string",default:""},{name:"placeholder",type:"string",default:""},{name:"disabled",type:"boolean",default:!1},{name:"readonly",type:"boolean",default:!1},{name:"required",type:"boolean",default:!1},{name:"maxlength",type:"number"},{name:"minlength",type:"number"},{name:"clearable",type:"boolean",default:!1},{name:"showpassword",type:"boolean",default:!1},{name:"passwordVisible",type:"boolean",default:!1},{name:"focused",type:"boolean",default:!1},{name:"prefix",type:"string",default:""},{name:"suffix",type:"string",default:""},{name:"status",type:"string",default:""},{name:"message",type:"string",default:""},{name:"showcount",type:"boolean",default:!1},{name:"rows",type:"number",default:3},{name:"autofocus",type:"boolean",default:!1},{name:"selectall",type:"boolean",default:!1},{name:"copyable",type:"boolean",default:!1},{name:"format",type:"string",default:"none"},{name:"suggestions",type:"array",default:[]},{name:"block",type:"boolean",default:!1}]})],exports.SolelyInput);
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,a,s)=>((t,a,s)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s)(t,"symbol"!=typeof a?a+"":a,s);import a from"./style.css.js";import s from"./index.html.js";import r from"../../../runtime/component/base-element.js";import{CustomElement as i}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let n=class extends r{constructor(){super(...arguments),t(this,"_filteredSuggestions",[]),t(this,"inputElement"),t(this,"searchDebounceTimer")}get filteredSuggestions(){return this._filteredSuggestions}mounted(){this.$data.autofocus&&this.focus()}hasPrefixSlot(){return null!==this.querySelector('[slot="prefix"]')}hasSuffixSlot(){return null!==this.querySelector('[slot="suffix"]')}afterMount(){var e;this.inputElement=null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea")}getWrapperClasses(){const e={};return"small"===this.$data.size?e["form-control--sm"]=!0:"large"===this.$data.size&&(e["form-control--lg"]=!0),"error"===this.$data.status?e["is-error"]=!0:"warning"===this.$data.status?e["is-warning"]=!0:"success"===this.$data.status&&(e["is-success"]=!0),"textarea"===this.$data.type&&(e["form-control--textarea"]=!0),e["is-focused"]=!!this.$data.focused,e["is-disabled"]=!!this.$data.disabled,e["is-readonly"]=!!this.$data.readonly,e["form-control--block"]=!!this.$data.block,e}getCharCount(){var e;return(null==(e=this.$data.value)?void 0:e.length)||0}formatValue(e){if(!e)return"";switch(this.$data.format){case"phone":return e.replace(/(\d{3})(\d{4})(\d{4})/,"$1 $2 $3").trim();case"bankcard":return e.replace(/(\d{4})(?=\d)/g,"$1 ").trim();case"idcard":return e.replace(/(\d{6})(\d{4})(\d{4})(\d{4})(\d{0,4})/,"$1 $2 $3 $4 $5").trim();default:return e}}unformatValue(e){return e?e.replace(/\s/g,""):""}handleInput(e){const t=e.target;let a=t.value;if("none"!==this.$data.format&&"textarea"!==this.$data.type){const e=this.unformatValue(a),s=this.formatValue(e);s!==a&&(t.value=s,a=s)}this.$data.value=a,this.$data.suggestions&&this.$data.suggestions.length>0&&this.updateSuggestions(a)}handleFocus(e){this.$data.focused=!0,this.$data.selectall&&this.$data.value&&this.select()}handleBlur(e){this.$data.focused=!1}handleChange(e){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}handleKeydown(e){"Enter"===e.key&&"search"===this.$data.type&&this.emit("search",{value:this.$data.value})}handleClear(){this.$data.value="",this.dispatchEvent(new Event("clear",{bubbles:!0,composed:!0})),this.focus()}togglePassword(){this.$data.passwordVisible=!this.$data.passwordVisible}async handleCopy(){try{const e=this.unformatValue(this.$data.value);await navigator.clipboard.writeText(e),this.emit("copy",{value:e})}catch(e){this.emit("copy-error",{error:e})}}updateSuggestions(e){this.searchDebounceTimer&&clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=setTimeout(()=>{this._updateSuggestionsImpl(e),this.searchDebounceTimer=void 0},300)}_updateSuggestionsImpl(e){if(!e||!this.$data.suggestions)return this._filteredSuggestions=[],void this.refresh();this._filteredSuggestions=this.$data.suggestions.filter(t=>t.toLowerCase().includes(e.toLowerCase())),this.refresh()}selectSuggestion(e){this.$data.value=e,this._filteredSuggestions=[],this.refresh(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}focus(){var e;null==(e=this.inputElement)||e.focus(),this.$data.focused=!0}blur(){var e;null==(e=this.inputElement)||e.blur(),this.$data.focused=!1}setValue(e){this.$data.value=e}getValue(){return this.unformatValue(this.$data.value)}get value(){return this.getValue()}set value(e){this.setValue(e)}select(){var e;null==(e=this.inputElement)||e.select()}};n=((e,t)=>{for(var a,s=t,r=e.length-1;r>=0;r--)(a=e[r])&&(s=a(s)||s);return s})([i({tagName:"solely-input",template:s,styles:a,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"text"},{name:"size",type:"string",default:""},{name:"value",type:"string",default:""},{name:"placeholder",type:"string",default:""},{name:"disabled",type:"boolean",default:!1},{name:"readonly",type:"boolean",default:!1},{name:"required",type:"boolean",default:!1},{name:"maxlength",type:"number"},{name:"minlength",type:"number"},{name:"clearable",type:"boolean",default:!1},{name:"showpassword",type:"boolean",default:!1},{name:"passwordVisible",type:"boolean",default:!1},{name:"focused",type:"boolean",default:!1},{name:"prefix",type:"string",default:""},{name:"suffix",type:"string",default:""},{name:"status",type:"string",default:""},{name:"message",type:"string",default:""},{name:"showcount",type:"boolean",default:!1},{name:"rows",type:"number",default:3},{name:"autofocus",type:"boolean",default:!1},{name:"selectall",type:"boolean",default:!1},{name:"copyable",type:"boolean",default:!1},{name:"format",type:"string",default:"none"},{name:"suggestions",type:"array",default:[]},{name:"block",type:"boolean",default:!1}]})],n);export{n as SolelyInput};
1
+ var e=Object.defineProperty,t=(t,a,s)=>((t,a,s)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s)(t,"symbol"!=typeof a?a+"":a,s);import a from"./style.css.js";import s from"./index.html.js";import r from"../../../runtime/component/base-element.js";import{CustomElement as i}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let n=class extends r{constructor(){super(...arguments),t(this,"_filteredSuggestions",[]),t(this,"inputElement"),t(this,"searchDebounceTimer")}get filteredSuggestions(){return this._filteredSuggestions}mounted(){this.refresh(),this.$data.autofocus&&this.focus()}hasPrefixSlot(){return null!==this.querySelector('[slot="prefix"]')}hasSuffixSlot(){return null!==this.querySelector('[slot="suffix"]')}afterMount(){var e;this.inputElement=null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea")}getWrapperClasses(){const e={};return"small"===this.$data.size?e["form-control--sm"]=!0:"large"===this.$data.size&&(e["form-control--lg"]=!0),"error"===this.$data.status?e["is-error"]=!0:"warning"===this.$data.status?e["is-warning"]=!0:"success"===this.$data.status&&(e["is-success"]=!0),"textarea"===this.$data.type&&(e["form-control--textarea"]=!0),e["is-focused"]=!!this.$data.focused,e["is-disabled"]=!!this.$data.disabled,e["is-readonly"]=!!this.$data.readonly,e["form-control--block"]=!!this.$data.block,e}getCharCount(){var e;return(null==(e=this.$data.value)?void 0:e.length)||0}formatValue(e){if(!e)return"";switch(this.$data.format){case"phone":return e.replace(/(\d{3})(\d{4})(\d{4})/,"$1 $2 $3").trim();case"bankcard":return e.replace(/(\d{4})(?=\d)/g,"$1 ").trim();case"idcard":return e.replace(/(\d{6})(\d{4})(\d{4})(\d{4})(\d{0,4})/,"$1 $2 $3 $4 $5").trim();default:return e}}unformatValue(e){return e?e.replace(/\s/g,""):""}handleInput(e){const t=e.target;let a=t.value;if("none"!==this.$data.format&&"textarea"!==this.$data.type){const e=this.unformatValue(a),s=this.formatValue(e);s!==a&&(t.value=s,a=s)}this.$data.value=a,this.$data.suggestions&&this.$data.suggestions.length>0&&this.updateSuggestions(a)}handleFocus(e){this.$data.focused=!0,this.$data.selectall&&this.$data.value&&this.select()}handleBlur(e){this.$data.focused=!1}handleChange(e){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}handleKeydown(e){"Enter"===e.key&&"search"===this.$data.type&&this.emit("search",{value:this.$data.value})}handleClear(){this.$data.value="",this.dispatchEvent(new Event("clear",{bubbles:!0,composed:!0})),this.focus()}togglePassword(){this.$data.passwordVisible=!this.$data.passwordVisible}async handleCopy(){try{const e=this.unformatValue(this.$data.value);await navigator.clipboard.writeText(e),this.emit("copy",{value:e})}catch(e){this.emit("copy-error",{error:e})}}updateSuggestions(e){this.searchDebounceTimer&&clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=setTimeout(()=>{this._updateSuggestionsImpl(e),this.searchDebounceTimer=void 0},300)}_updateSuggestionsImpl(e){if(!e||!this.$data.suggestions)return this._filteredSuggestions=[],void this.refresh();this._filteredSuggestions=this.$data.suggestions.filter(t=>t.toLowerCase().includes(e.toLowerCase())),this.refresh()}selectSuggestion(e){this.$data.value=e,this._filteredSuggestions=[],this.refresh(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}focus(){var e;null==(e=this.inputElement)||e.focus(),this.$data.focused=!0}blur(){var e;null==(e=this.inputElement)||e.blur(),this.$data.focused=!1}setValue(e){this.$data.value=e}getValue(){return this.unformatValue(this.$data.value)}get value(){return this.getValue()}set value(e){this.setValue(e)}select(){var e;null==(e=this.inputElement)||e.select()}};n=((e,t)=>{for(var a,s=t,r=e.length-1;r>=0;r--)(a=e[r])&&(s=a(s)||s);return s})([i({tagName:"solely-input",template:s,styles:a,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"text"},{name:"size",type:"string",default:""},{name:"value",type:"string",default:""},{name:"placeholder",type:"string",default:""},{name:"disabled",type:"boolean",default:!1},{name:"readonly",type:"boolean",default:!1},{name:"required",type:"boolean",default:!1},{name:"maxlength",type:"number"},{name:"minlength",type:"number"},{name:"clearable",type:"boolean",default:!1},{name:"showpassword",type:"boolean",default:!1},{name:"passwordVisible",type:"boolean",default:!1},{name:"focused",type:"boolean",default:!1},{name:"prefix",type:"string",default:""},{name:"suffix",type:"string",default:""},{name:"status",type:"string",default:""},{name:"message",type:"string",default:""},{name:"showcount",type:"boolean",default:!1},{name:"rows",type:"number",default:3},{name:"autofocus",type:"boolean",default:!1},{name:"selectall",type:"boolean",default:!1},{name:"copyable",type:"boolean",default:!1},{name:"format",type:"string",default:"none"},{name:"suggestions",type:"array",default:[]},{name:"block",type:"boolean",default:!1}]})],n);export{n as SolelyInput};
@@ -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("../utils/helpers.cjs"),s=require("../../../runtime/component/base-element.cjs"),i=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyPagination=class extends s.default{get current(){return this.$data.current}set current(e){this.$data.current=e,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}get pageSize(){return this.$data.pageSize}set pageSize(e){this.$data.pageSize=e,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}getPaginationClasses(){const e={};return"small"===this.$data.size?e["pagination--sm"]=!0:"large"===this.$data.size?e["pagination--lg"]=!0:e["pagination--md"]=!0,e["is-disabled"]=!!this.$data.disabled,e}getPrevClasses(){return{"pagination__item--disabled":(this.$data.current||1)<=1}}getNextClasses(){return{"pagination__item--disabled":(this.$data.current||1)>=this.totalPages}}getItemClasses(e){return{"pagination__item--active":e===this.$data.current}}mounted(){this.$data.jumperValue="",this.parsePageSizeOptions()}parsePageSizeOptions(){this.$data.parsedPageSizeOptions=a.safeJsonParse(this.$data.pageSizeOptions,[10,20,50,100])}get totalPages(){return Math.ceil((this.$data.total||0)/(this.$data.pageSize||10))}calculateVisiblePages(){const e=this.$data.current||1,t=this.totalPages,a=[];if(t<=7)for(let s=1;s<=t;s++)a.push(s);else e<=3?a.push(1,2,3,4,5,"...",t):e>=t-2?a.push(1,"...",t-4,t-3,t-2,t-1,t):a.push(1,"...",e-1,e,e+1,"...",t);return a}handlePageClick(e){this.$data.disabled||e===this.$data.current||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:e,pageSize:this.$data.pageSize}})))}handlePrev(){this.$data.disabled||this.$data.current<=1||this.handlePageClick(this.$data.current-1)}handleNext(){this.$data.disabled||this.$data.current>=this.totalPages||this.handlePageClick(this.$data.current+1)}handleSizeChange(e){if(this.$data.disabled)return;const t=e.target,a=parseInt(t.value,10);this.$data.pageSize=a,this.$data.current=1,this.dispatchEvent(new CustomEvent("showSizeChange",{bubbles:!0,composed:!0,detail:{current:1,pageSize:a}}))}handleJumperKeydown(e){if("Enter"!==e.key)return;const t=e.target,a=parseInt(t.value,10);a>=1&&a<=this.totalPages&&this.handlePageClick(a),this.$data.jumperValue=""}handleJumperStep(e){if(this.$data.disabled)return;const t=this.$data.current+e;t>=1&&t<=this.totalPages&&(this.handlePageClick(t),this.$data.jumperValue=String(t))}setCurrent(e){this.$data.current=e}getCurrent(){return this.$data.current}},exports.SolelyPagination=((e,t)=>{for(var a,s=t,i=e.length-1;i>=0;i--)(a=e[i])&&(s=a(s)||s);return s})([i.CustomElement({tagName:"solely-pagination",template:t.default,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"current",type:"number",default:1},{name:"total",type:"number",default:0},{name:"pageSize",type:"number",default:10},{name:"size",type:"string",default:"default"},{name:"simple",type:"boolean",default:!1},{name:"showQuickJumper",type:"boolean",default:!1},{name:"showSizeChanger",type:"boolean",default:!1},{name:"pageSizeOptions",type:"string",default:"[10, 20, 50, 100]"},{name:"disabled",type:"boolean",default:!1},{name:"showTotal",type:"boolean",default:!1}]})],exports.SolelyPagination);
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),a=require("../utils/helpers.cjs"),s=require("../../../runtime/component/base-element.cjs"),i=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyPagination=class extends s.default{get current(){return this.$data.current}set current(e){this.$data.current=e,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}get pageSize(){return this.$data.pageSize}set pageSize(e){this.$data.pageSize=e,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}getPaginationClasses(){const e={};return"small"===this.$data.size?e["pagination--sm"]=!0:"large"===this.$data.size?e["pagination--lg"]=!0:e["pagination--md"]=!0,e["is-disabled"]=!!this.$data.disabled,e}getPrevClasses(){return{"pagination__item--disabled":(this.$data.current||1)<=1}}getNextClasses(){return{"pagination__item--disabled":(this.$data.current||1)>=this.totalPages}}getItemClasses(e){return{"pagination__item--active":e===this.$data.current}}mounted(){this.refresh(),this.$data.jumperValue="",this.parsePageSizeOptions()}parsePageSizeOptions(){this.$data.parsedPageSizeOptions=a.safeJsonParse(this.$data.pageSizeOptions,[10,20,50,100])}get totalPages(){return Math.ceil((this.$data.total||0)/(this.$data.pageSize||10))}calculateVisiblePages(){const e=this.$data.current||1,t=this.totalPages,a=[];if(t<=7)for(let s=1;s<=t;s++)a.push(s);else e<=3?a.push(1,2,3,4,5,"...",t):e>=t-2?a.push(1,"...",t-4,t-3,t-2,t-1,t):a.push(1,"...",e-1,e,e+1,"...",t);return a}handlePageClick(e){this.$data.disabled||e===this.$data.current||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:e,pageSize:this.$data.pageSize}})))}handlePrev(){this.$data.disabled||this.$data.current<=1||this.handlePageClick(this.$data.current-1)}handleNext(){this.$data.disabled||this.$data.current>=this.totalPages||this.handlePageClick(this.$data.current+1)}handleSizeChange(e){if(this.$data.disabled)return;const t=e.target,a=parseInt(t.value,10);this.$data.pageSize=a,this.$data.current=1,this.dispatchEvent(new CustomEvent("showSizeChange",{bubbles:!0,composed:!0,detail:{current:1,pageSize:a}}))}handleJumperKeydown(e){if("Enter"!==e.key)return;const t=e.target,a=parseInt(t.value,10);a>=1&&a<=this.totalPages&&this.handlePageClick(a),this.$data.jumperValue=""}handleJumperStep(e){if(this.$data.disabled)return;const t=this.$data.current+e;t>=1&&t<=this.totalPages&&(this.handlePageClick(t),this.$data.jumperValue=String(t))}setCurrent(e){this.$data.current=e}getCurrent(){return this.$data.current}},exports.SolelyPagination=((e,t)=>{for(var a,s=t,i=e.length-1;i>=0;i--)(a=e[i])&&(s=a(s)||s);return s})([i.CustomElement({tagName:"solely-pagination",template:t.default,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"current",type:"number",default:1},{name:"total",type:"number",default:0},{name:"pageSize",type:"number",default:10},{name:"size",type:"string",default:"default"},{name:"simple",type:"boolean",default:!1},{name:"showQuickJumper",type:"boolean",default:!1},{name:"showSizeChanger",type:"boolean",default:!1},{name:"pageSizeOptions",type:"string",default:"[10, 20, 50, 100]"},{name:"disabled",type:"boolean",default:!1},{name:"showTotal",type:"boolean",default:!1}]})],exports.SolelyPagination);
@@ -1 +1 @@
1
- import e from"./style.css.js";import t from"./index.html.js";import{safeJsonParse as a}from"../utils/helpers.js";import s from"../../../runtime/component/base-element.js";import{CustomElement as i}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let n=class extends s{get current(){return this.$data.current}set current(e){this.$data.current=e,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}get pageSize(){return this.$data.pageSize}set pageSize(e){this.$data.pageSize=e,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}getPaginationClasses(){const e={};return"small"===this.$data.size?e["pagination--sm"]=!0:"large"===this.$data.size?e["pagination--lg"]=!0:e["pagination--md"]=!0,e["is-disabled"]=!!this.$data.disabled,e}getPrevClasses(){return{"pagination__item--disabled":(this.$data.current||1)<=1}}getNextClasses(){return{"pagination__item--disabled":(this.$data.current||1)>=this.totalPages}}getItemClasses(e){return{"pagination__item--active":e===this.$data.current}}mounted(){this.$data.jumperValue="",this.parsePageSizeOptions()}parsePageSizeOptions(){this.$data.parsedPageSizeOptions=a(this.$data.pageSizeOptions,[10,20,50,100])}get totalPages(){return Math.ceil((this.$data.total||0)/(this.$data.pageSize||10))}calculateVisiblePages(){const e=this.$data.current||1,t=this.totalPages,a=[];if(t<=7)for(let s=1;s<=t;s++)a.push(s);else e<=3?a.push(1,2,3,4,5,"...",t):e>=t-2?a.push(1,"...",t-4,t-3,t-2,t-1,t):a.push(1,"...",e-1,e,e+1,"...",t);return a}handlePageClick(e){this.$data.disabled||e===this.$data.current||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:e,pageSize:this.$data.pageSize}})))}handlePrev(){this.$data.disabled||this.$data.current<=1||this.handlePageClick(this.$data.current-1)}handleNext(){this.$data.disabled||this.$data.current>=this.totalPages||this.handlePageClick(this.$data.current+1)}handleSizeChange(e){if(this.$data.disabled)return;const t=e.target,a=parseInt(t.value,10);this.$data.pageSize=a,this.$data.current=1,this.dispatchEvent(new CustomEvent("showSizeChange",{bubbles:!0,composed:!0,detail:{current:1,pageSize:a}}))}handleJumperKeydown(e){if("Enter"!==e.key)return;const t=e.target,a=parseInt(t.value,10);a>=1&&a<=this.totalPages&&this.handlePageClick(a),this.$data.jumperValue=""}handleJumperStep(e){if(this.$data.disabled)return;const t=this.$data.current+e;t>=1&&t<=this.totalPages&&(this.handlePageClick(t),this.$data.jumperValue=String(t))}setCurrent(e){this.$data.current=e}getCurrent(){return this.$data.current}};n=((e,t)=>{for(var a,s=t,i=e.length-1;i>=0;i--)(a=e[i])&&(s=a(s)||s);return s})([i({tagName:"solely-pagination",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"current",type:"number",default:1},{name:"total",type:"number",default:0},{name:"pageSize",type:"number",default:10},{name:"size",type:"string",default:"default"},{name:"simple",type:"boolean",default:!1},{name:"showQuickJumper",type:"boolean",default:!1},{name:"showSizeChanger",type:"boolean",default:!1},{name:"pageSizeOptions",type:"string",default:"[10, 20, 50, 100]"},{name:"disabled",type:"boolean",default:!1},{name:"showTotal",type:"boolean",default:!1}]})],n);export{n as SolelyPagination};
1
+ import e from"./style.css.js";import t from"./index.html.js";import{safeJsonParse as a}from"../utils/helpers.js";import s from"../../../runtime/component/base-element.js";import{CustomElement as i}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let n=class extends s{get current(){return this.$data.current}set current(e){this.$data.current=e,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}get pageSize(){return this.$data.pageSize}set pageSize(e){this.$data.pageSize=e,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}getPaginationClasses(){const e={};return"small"===this.$data.size?e["pagination--sm"]=!0:"large"===this.$data.size?e["pagination--lg"]=!0:e["pagination--md"]=!0,e["is-disabled"]=!!this.$data.disabled,e}getPrevClasses(){return{"pagination__item--disabled":(this.$data.current||1)<=1}}getNextClasses(){return{"pagination__item--disabled":(this.$data.current||1)>=this.totalPages}}getItemClasses(e){return{"pagination__item--active":e===this.$data.current}}mounted(){this.refresh(),this.$data.jumperValue="",this.parsePageSizeOptions()}parsePageSizeOptions(){this.$data.parsedPageSizeOptions=a(this.$data.pageSizeOptions,[10,20,50,100])}get totalPages(){return Math.ceil((this.$data.total||0)/(this.$data.pageSize||10))}calculateVisiblePages(){const e=this.$data.current||1,t=this.totalPages,a=[];if(t<=7)for(let s=1;s<=t;s++)a.push(s);else e<=3?a.push(1,2,3,4,5,"...",t):e>=t-2?a.push(1,"...",t-4,t-3,t-2,t-1,t):a.push(1,"...",e-1,e,e+1,"...",t);return a}handlePageClick(e){this.$data.disabled||e===this.$data.current||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:e,pageSize:this.$data.pageSize}})))}handlePrev(){this.$data.disabled||this.$data.current<=1||this.handlePageClick(this.$data.current-1)}handleNext(){this.$data.disabled||this.$data.current>=this.totalPages||this.handlePageClick(this.$data.current+1)}handleSizeChange(e){if(this.$data.disabled)return;const t=e.target,a=parseInt(t.value,10);this.$data.pageSize=a,this.$data.current=1,this.dispatchEvent(new CustomEvent("showSizeChange",{bubbles:!0,composed:!0,detail:{current:1,pageSize:a}}))}handleJumperKeydown(e){if("Enter"!==e.key)return;const t=e.target,a=parseInt(t.value,10);a>=1&&a<=this.totalPages&&this.handlePageClick(a),this.$data.jumperValue=""}handleJumperStep(e){if(this.$data.disabled)return;const t=this.$data.current+e;t>=1&&t<=this.totalPages&&(this.handlePageClick(t),this.$data.jumperValue=String(t))}setCurrent(e){this.$data.current=e}getCurrent(){return this.$data.current}};n=((e,t)=>{for(var a,s=t,i=e.length-1;i>=0;i--)(a=e[i])&&(s=a(s)||s);return s})([i({tagName:"solely-pagination",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"current",type:"number",default:1},{name:"total",type:"number",default:0},{name:"pageSize",type:"number",default:10},{name:"size",type:"string",default:"default"},{name:"simple",type:"boolean",default:!1},{name:"showQuickJumper",type:"boolean",default:!1},{name:"showSizeChanger",type:"boolean",default:!1},{name:"pageSizeOptions",type:"string",default:"[10, 20, 50, 100]"},{name:"disabled",type:"boolean",default:!1},{name:"showTotal",type:"boolean",default:!1}]})],n);export{n as SolelyPagination};
@@ -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"),r=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyProgress=class extends s.default{getProgressClasses(){const e={};return this.$data.type&&(e[`progress--${this.$data.type}`]=!0),e}getInnerClasses(){const e={};return this.$data.status&&(e[`progress__inner--${this.$data.status}`]=!0),e}getCirclePathClasses(){const e={};return this.$data.status&&(e[`progress__circle-path--${this.$data.status}`]=!0),e}get clampedPercent(){return Math.max(0,Math.min(100,this.$data.percent||0))}get circleCircumference(){const e=((this.$data.width||120)-(this.$data.strokeWidth||6))/2;return 2*Math.PI*e}get circleOffset(){return this.circleCircumference*(1-this.clampedPercent/100)}getText(){return"success"===this.$data.status?"✓":"exception"===this.$data.status?"✕":`${Math.round(this.clampedPercent)}%`}setPercent(e){this.$data.percent=e}getPercent(){return this.clampedPercent}},exports.SolelyProgress=((e,t)=>{for(var s,r=t,a=e.length-1;a>=0;a--)(s=e[a])&&(r=s(r)||r);return r})([r.CustomElement({tagName:"solely-progress",template:t.default,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"line"},{name:"percent",type:"number",default:0},{name:"status",type:"string",default:"normal"},{name:"showInfo",type:"boolean",default:!0},{name:"strokeWidth",type:"number",default:8},{name:"width",type:"number",default:120},{name:"format",type:"string",default:""}]})],exports.SolelyProgress);
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"),r=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyProgress=class extends s.default{getProgressClasses(){const e={};return this.$data.type&&(e[`progress--${this.$data.type}`]=!0),e}getInnerClasses(){const e={};return this.$data.status&&(e[`progress__inner--${this.$data.status}`]=!0),e}getCirclePathClasses(){const e={};return this.$data.status&&(e[`progress__circle-path--${this.$data.status}`]=!0),e}get clampedPercent(){return Math.max(0,Math.min(100,this.$data.percent||0))}get circleCircumference(){const e=((this.$data.width||120)-(this.$data.strokeWidth||6))/2;return 2*Math.PI*e}get circleOffset(){return this.circleCircumference*(1-this.clampedPercent/100)}getText(){return"success"===this.$data.status?"✓":"exception"===this.$data.status?"✕":`${Math.round(this.clampedPercent)}%`}mounted(){this.refresh()}setPercent(e){this.$data.percent=e}getPercent(){return this.clampedPercent}},exports.SolelyProgress=((e,t)=>{for(var s,r=t,a=e.length-1;a>=0;a--)(s=e[a])&&(r=s(r)||r);return r})([r.CustomElement({tagName:"solely-progress",template:t.default,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"line"},{name:"percent",type:"number",default:0},{name:"status",type:"string",default:"normal"},{name:"showInfo",type:"boolean",default:!0},{name:"strokeWidth",type:"number",default:8},{name:"width",type:"number",default:120},{name:"format",type:"string",default:""}]})],exports.SolelyProgress);
@@ -29,6 +29,10 @@ declare class SolelyProgress extends BaseElement<ProgressProps> {
29
29
  * 获取显示的文本
30
30
  */
31
31
  getText(): string;
32
+ /**
33
+ * 组件挂载后
34
+ */
35
+ mounted(): void;
32
36
  /**
33
37
  * 设置进度
34
38
  */
@@ -1 +1 @@
1
- import t from"./style.css.js";import e from"./index.html.js";import s from"../../../runtime/component/base-element.js";import{CustomElement as r}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let a=class extends s{getProgressClasses(){const t={};return this.$data.type&&(t[`progress--${this.$data.type}`]=!0),t}getInnerClasses(){const t={};return this.$data.status&&(t[`progress__inner--${this.$data.status}`]=!0),t}getCirclePathClasses(){const t={};return this.$data.status&&(t[`progress__circle-path--${this.$data.status}`]=!0),t}get clampedPercent(){return Math.max(0,Math.min(100,this.$data.percent||0))}get circleCircumference(){const t=((this.$data.width||120)-(this.$data.strokeWidth||6))/2;return 2*Math.PI*t}get circleOffset(){return this.circleCircumference*(1-this.clampedPercent/100)}getText(){return"success"===this.$data.status?"✓":"exception"===this.$data.status?"✕":`${Math.round(this.clampedPercent)}%`}setPercent(t){this.$data.percent=t}getPercent(){return this.clampedPercent}};a=((t,e)=>{for(var s,r=e,a=t.length-1;a>=0;a--)(s=t[a])&&(r=s(r)||r);return r})([r({tagName:"solely-progress",template:e,styles:t,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"line"},{name:"percent",type:"number",default:0},{name:"status",type:"string",default:"normal"},{name:"showInfo",type:"boolean",default:!0},{name:"strokeWidth",type:"number",default:8},{name:"width",type:"number",default:120},{name:"format",type:"string",default:""}]})],a);export{a as SolelyProgress};
1
+ import t from"./style.css.js";import e from"./index.html.js";import s from"../../../runtime/component/base-element.js";import{CustomElement as r}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let a=class extends s{getProgressClasses(){const t={};return this.$data.type&&(t[`progress--${this.$data.type}`]=!0),t}getInnerClasses(){const t={};return this.$data.status&&(t[`progress__inner--${this.$data.status}`]=!0),t}getCirclePathClasses(){const t={};return this.$data.status&&(t[`progress__circle-path--${this.$data.status}`]=!0),t}get clampedPercent(){return Math.max(0,Math.min(100,this.$data.percent||0))}get circleCircumference(){const t=((this.$data.width||120)-(this.$data.strokeWidth||6))/2;return 2*Math.PI*t}get circleOffset(){return this.circleCircumference*(1-this.clampedPercent/100)}getText(){return"success"===this.$data.status?"✓":"exception"===this.$data.status?"✕":`${Math.round(this.clampedPercent)}%`}mounted(){this.refresh()}setPercent(t){this.$data.percent=t}getPercent(){return this.clampedPercent}};a=((t,e)=>{for(var s,r=e,a=t.length-1;a>=0;a--)(s=t[a])&&(r=s(r)||r);return r})([r({tagName:"solely-progress",template:e,styles:t,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"line"},{name:"percent",type:"number",default:0},{name:"status",type:"string",default:"normal"},{name:"showInfo",type:"boolean",default:!0},{name:"strokeWidth",type:"number",default:8},{name:"width",type:"number",default:120},{name:"format",type:"string",default:""}]})],a);export{a as SolelyProgress};
@@ -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"),s=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyRadio=class extends a.default{get checked(){return this.$data.checked}set checked(e){this.setChecked(e)}get value(){return this.$data.value}set value(e){this.$data.value=e}getRadioClasses(){return{"is-checked":!!this.$data.checked,"is-disabled":!!this.$data.disabled,[`radio--${this.$data.type}`]:!!this.$data.type,"radio--block":!!this.$data.block}}handleClick(e){this.$data.disabled||this.$data.checked||(this.$data.name&&this.uncheckSameNameRadios(),this.$data.checked=!0,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}uncheckSameNameRadios(){const e=this.$data.name;e&&this.getRootNode().querySelectorAll("solely-radio").forEach(t=>{if(t!==this&&t.getAttribute("name")===e){const e=t;"function"==typeof(null==e?void 0:e.setChecked)&&e.setChecked(!1)}})}setChecked(e){this.$data.checked=e}getChecked(){return this.$data.checked}},exports.SolelyRadio=((e,t)=>{for(var a,s=t,d=e.length-1;d>=0;d--)(a=e[d])&&(s=a(s)||s);return s})([s.CustomElement({tagName:"solely-radio",template:t.default,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"checked",type:"boolean",default:!1},{name:"disabled",type:"boolean",default:!1},{name:"content",type:"string",default:""},{name:"value",type:"string",default:""},{name:"type",type:"string",default:"primary"},{name:"name",type:"string",default:""},{name:"block",type:"boolean",default:!1}],model:{prop:"checked",event:"change"}})],exports.SolelyRadio);
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"),s=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyRadio=class extends a.default{get checked(){return this.$data.checked}set checked(e){this.setChecked(e)}get value(){return this.$data.value}set value(e){this.$data.value=e}getRadioClasses(){return{"is-checked":!!this.$data.checked,"is-disabled":!!this.$data.disabled,[`radio--${this.$data.type}`]:!!this.$data.type,"radio--block":!!this.$data.block}}mounted(){this.refresh()}handleClick(e){this.$data.disabled||this.$data.checked||(this.$data.name&&this.uncheckSameNameRadios(),this.$data.checked=!0,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}uncheckSameNameRadios(){const e=this.$data.name;e&&this.getRootNode().querySelectorAll("solely-radio").forEach(t=>{if(t!==this&&t.getAttribute("name")===e){const e=t;"function"==typeof(null==e?void 0:e.setChecked)&&e.setChecked(!1)}})}setChecked(e){this.$data.checked=e}getChecked(){return this.$data.checked}},exports.SolelyRadio=((e,t)=>{for(var a,s=t,d=e.length-1;d>=0;d--)(a=e[d])&&(s=a(s)||s);return s})([s.CustomElement({tagName:"solely-radio",template:t.default,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"checked",type:"boolean",default:!1},{name:"disabled",type:"boolean",default:!1},{name:"content",type:"string",default:""},{name:"value",type:"string",default:""},{name:"type",type:"string",default:"primary"},{name:"name",type:"string",default:""},{name:"block",type:"boolean",default:!1}],model:{prop:"checked",event:"change"}})],exports.SolelyRadio);
@@ -21,6 +21,10 @@ declare class SolelyRadio extends BaseElement<RadioProps> {
21
21
  * 获取 radio class 对象
22
22
  */
23
23
  getRadioClasses(): Record<string, boolean>;
24
+ /**
25
+ * 组件挂载后
26
+ */
27
+ mounted(): void;
24
28
  /**
25
29
  * 点击事件处理
26
30
  */
@@ -1 +1 @@
1
- import e from"./style.css.js";import t from"./index.html.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as s}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let d=class extends a{get checked(){return this.$data.checked}set checked(e){this.setChecked(e)}get value(){return this.$data.value}set value(e){this.$data.value=e}getRadioClasses(){return{"is-checked":!!this.$data.checked,"is-disabled":!!this.$data.disabled,[`radio--${this.$data.type}`]:!!this.$data.type,"radio--block":!!this.$data.block}}handleClick(e){this.$data.disabled||this.$data.checked||(this.$data.name&&this.uncheckSameNameRadios(),this.$data.checked=!0,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}uncheckSameNameRadios(){const e=this.$data.name;e&&this.getRootNode().querySelectorAll("solely-radio").forEach(t=>{if(t!==this&&t.getAttribute("name")===e){const e=t;"function"==typeof(null==e?void 0:e.setChecked)&&e.setChecked(!1)}})}setChecked(e){this.$data.checked=e}getChecked(){return this.$data.checked}};d=((e,t)=>{for(var a,s=t,d=e.length-1;d>=0;d--)(a=e[d])&&(s=a(s)||s);return s})([s({tagName:"solely-radio",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"checked",type:"boolean",default:!1},{name:"disabled",type:"boolean",default:!1},{name:"content",type:"string",default:""},{name:"value",type:"string",default:""},{name:"type",type:"string",default:"primary"},{name:"name",type:"string",default:""},{name:"block",type:"boolean",default:!1}],model:{prop:"checked",event:"change"}})],d);export{d as SolelyRadio};
1
+ import e from"./style.css.js";import t from"./index.html.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as s}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let d=class extends a{get checked(){return this.$data.checked}set checked(e){this.setChecked(e)}get value(){return this.$data.value}set value(e){this.$data.value=e}getRadioClasses(){return{"is-checked":!!this.$data.checked,"is-disabled":!!this.$data.disabled,[`radio--${this.$data.type}`]:!!this.$data.type,"radio--block":!!this.$data.block}}mounted(){this.refresh()}handleClick(e){this.$data.disabled||this.$data.checked||(this.$data.name&&this.uncheckSameNameRadios(),this.$data.checked=!0,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}uncheckSameNameRadios(){const e=this.$data.name;e&&this.getRootNode().querySelectorAll("solely-radio").forEach(t=>{if(t!==this&&t.getAttribute("name")===e){const e=t;"function"==typeof(null==e?void 0:e.setChecked)&&e.setChecked(!1)}})}setChecked(e){this.$data.checked=e}getChecked(){return this.$data.checked}};d=((e,t)=>{for(var a,s=t,d=e.length-1;d>=0;d--)(a=e[d])&&(s=a(s)||s);return s})([s({tagName:"solely-radio",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"checked",type:"boolean",default:!1},{name:"disabled",type:"boolean",default:!1},{name:"content",type:"string",default:""},{name:"value",type:"string",default:""},{name:"type",type:"string",default:"primary"},{name:"name",type:"string",default:""},{name:"block",type:"boolean",default:!1}],model:{prop:"checked",event:"change"}})],d);export{d as SolelyRadio};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),a=require("./index.html.cjs"),t=require("../../../runtime/component/base-element.cjs"),l=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyRate=class extends t.default{getRateClasses(){return{"is-disabled":!!this.$data.disabled,"is-readonly":!!this.$data.readonly}}get value(){return this.$data.value||0}set value(e){this.$data.disabled||this.$data.readonly||this.setValue(e)}getStarClasses(e){const a=this.$data.hoverValue,t=this.$data.value||0,l=void 0!==a?a:t;return{"rate__star--full":e<=l,"rate__star--half":!!this.$data.allowHalf&&e-.5===l,"rate__star--zero":e>l}}mounted(){this.$data.hoverValue=void 0,this.generateStarCount()}generateStarCount(){const e=this.$data.count||5;this.$data.starCount=Array.from({length:e},(e,a)=>a+1)}handleClick(e){if(this.$data.disabled||this.$data.readonly)return;const a=this.$data.allowHalf&&this.$data.hoverValue||e;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(e){this.$data.disabled||this.$data.readonly||(this.$data.hoverValue=e)}handleMouseLeave(){this.$data.disabled||this.$data.readonly||(this.$data.hoverValue=void 0)}setValue(e){this.$data.value=e}getValue(){return this.$data.value}},exports.SolelyRate=((e,a)=>{for(var t,l=a,s=e.length-1;s>=0;s--)(t=e[s])&&(l=t(l)||l);return l})([l.CustomElement({tagName:"solely-rate",template:a.default,styles:e.default,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}]})],exports.SolelyRate);
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),a=require("./index.html.cjs"),t=require("../../../runtime/component/base-element.cjs"),s=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyRate=class extends t.default{getRateClasses(){return{"is-disabled":!!this.$data.disabled,"is-readonly":!!this.$data.readonly}}get value(){return this.$data.value||0}set value(e){this.$data.disabled||this.$data.readonly||this.setValue(e)}getStarClasses(e){const a=this.$data.hoverValue,t=this.$data.value||0,s=void 0!==a?a:t;return{"rate__star--full":e<=s,"rate__star--half":!!this.$data.allowHalf&&e-.5===s,"rate__star--zero":e>s}}mounted(){this.refresh(),this.$data.hoverValue=void 0,this.generateStarCount()}generateStarCount(){const e=this.$data.count||5;this.$data.starCount=Array.from({length:e},(e,a)=>a+1)}handleClick(e){if(this.$data.disabled||this.$data.readonly)return;const a=this.$data.allowHalf&&this.$data.hoverValue||e;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(e){this.$data.disabled||this.$data.readonly||(this.$data.hoverValue=e)}handleMouseLeave(){this.$data.disabled||this.$data.readonly||(this.$data.hoverValue=void 0)}setValue(e){this.$data.value=e}getValue(){return this.$data.value}},exports.SolelyRate=((e,a)=>{for(var t,s=a,l=e.length-1;l>=0;l--)(t=e[l])&&(s=t(s)||s);return s})([s.CustomElement({tagName:"solely-rate",template:a.default,styles:e.default,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}]})],exports.SolelyRate);
@@ -1 +1 @@
1
- import a from"./style.css.js";import e from"./index.html.js";import t from"../../../runtime/component/base-element.js";import{CustomElement as s}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let l=class extends t{getRateClasses(){return{"is-disabled":!!this.$data.disabled,"is-readonly":!!this.$data.readonly}}get value(){return this.$data.value||0}set value(a){this.$data.disabled||this.$data.readonly||this.setValue(a)}getStarClasses(a){const e=this.$data.hoverValue,t=this.$data.value||0,s=void 0!==e?e:t;return{"rate__star--full":a<=s,"rate__star--half":!!this.$data.allowHalf&&a-.5===s,"rate__star--zero":a>s}}mounted(){this.$data.hoverValue=void 0,this.generateStarCount()}generateStarCount(){const a=this.$data.count||5;this.$data.starCount=Array.from({length:a},(a,e)=>e+1)}handleClick(a){if(this.$data.disabled||this.$data.readonly)return;const e=this.$data.allowHalf&&this.$data.hoverValue||a;this.$data.allowClear&&e===this.$data.value?this.$data.value=0:this.$data.value=e,this.$data.hoverValue=void 0,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}handleMouseEnter(a){this.$data.disabled||this.$data.readonly||(this.$data.hoverValue=a)}handleMouseLeave(){this.$data.disabled||this.$data.readonly||(this.$data.hoverValue=void 0)}setValue(a){this.$data.value=a}getValue(){return this.$data.value}};l=((a,e)=>{for(var t,s=e,l=a.length-1;l>=0;l--)(t=a[l])&&(s=t(s)||s);return s})([s({tagName:"solely-rate",template:e,styles:a,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}]})],l);export{l as SolelyRate};
1
+ import a from"./style.css.js";import e from"./index.html.js";import t from"../../../runtime/component/base-element.js";import{CustomElement as s}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let l=class extends t{getRateClasses(){return{"is-disabled":!!this.$data.disabled,"is-readonly":!!this.$data.readonly}}get value(){return this.$data.value||0}set value(a){this.$data.disabled||this.$data.readonly||this.setValue(a)}getStarClasses(a){const e=this.$data.hoverValue,t=this.$data.value||0,s=void 0!==e?e:t;return{"rate__star--full":a<=s,"rate__star--half":!!this.$data.allowHalf&&a-.5===s,"rate__star--zero":a>s}}mounted(){this.refresh(),this.$data.hoverValue=void 0,this.generateStarCount()}generateStarCount(){const a=this.$data.count||5;this.$data.starCount=Array.from({length:a},(a,e)=>e+1)}handleClick(a){if(this.$data.disabled||this.$data.readonly)return;const e=this.$data.allowHalf&&this.$data.hoverValue||a;this.$data.allowClear&&e===this.$data.value?this.$data.value=0:this.$data.value=e,this.$data.hoverValue=void 0,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}handleMouseEnter(a){this.$data.disabled||this.$data.readonly||(this.$data.hoverValue=a)}handleMouseLeave(){this.$data.disabled||this.$data.readonly||(this.$data.hoverValue=void 0)}setValue(a){this.$data.value=a}getValue(){return this.$data.value}};l=((a,e)=>{for(var t,s=e,l=a.length-1;l>=0;l--)(t=a[l])&&(s=t(s)||s);return s})([s({tagName:"solely-rate",template:e,styles:a,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}]})],l);export{l as SolelyRate};
@@ -1 +1 @@
1
- "use strict";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);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./style.css.cjs"),s=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")}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.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()}updated(){const t=this.$data.selectedLabel,e=this.getCurrentLabel();t!==e&&(this.$data.selectedLabel=e)}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")||"",l=a.getAttribute("data-label")||(null==(e=a.textContent)?void 0:e.trim())||"";a.hasAttribute("disabled")||(this.$data.value=s,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,setTimeout(()=>{this.$data.isOpen=!1,this.$data.closing=!1,this.$data.focused=!1},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 a,s=e,l=t.length-1;l>=0;l--)(a=t[l])&&(s=a(s)||s);return s})([i.CustomElement({tagName:"solely-select",template:s.default,styles:a.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);
1
+ "use strict";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);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./style.css.cjs"),s=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")}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()}updated(){const t=this.$data.selectedLabel,e=this.getCurrentLabel();t!==e&&(this.$data.selectedLabel=e)}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")||"",l=a.getAttribute("data-label")||(null==(e=a.textContent)?void 0:e.trim())||"";a.hasAttribute("disabled")||(this.$data.value=s,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,setTimeout(()=>{this.$data.isOpen=!1,this.$data.closing=!1,this.$data.focused=!1},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 a,s=e,l=t.length-1;l>=0;l--)(a=t[l])&&(s=a(s)||s);return s})([i.CustomElement({tagName:"solely-select",template:s.default,styles:a.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);
@@ -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 from"./index.html.js";import l from"../../../runtime/component/base-element.js";import{CustomElement as i}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let o=class extends l{constructor(){super(...arguments),e(this,"clickOutsideHandler"),e(this,"slotObserver")}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.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()}updated(){const t=this.$data.selectedLabel,e=this.getCurrentLabel();t!==e&&(this.$data.selectedLabel=e)}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")||"",l=a.getAttribute("data-label")||(null==(e=a.textContent)?void 0:e.trim())||"";a.hasAttribute("disabled")||(this.$data.value=s,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,setTimeout(()=>{this.$data.isOpen=!1,this.$data.closing=!1,this.$data.focused=!1},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,l=t.length-1;l>=0;l--)(a=t[l])&&(s=a(s)||s);return s})([i({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
+ 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 from"./index.html.js";import l from"../../../runtime/component/base-element.js";import{CustomElement as i}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let o=class extends l{constructor(){super(...arguments),e(this,"clickOutsideHandler"),e(this,"slotObserver")}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()}updated(){const t=this.$data.selectedLabel,e=this.getCurrentLabel();t!==e&&(this.$data.selectedLabel=e)}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")||"",l=a.getAttribute("data-label")||(null==(e=a.textContent)?void 0:e.trim())||"";a.hasAttribute("disabled")||(this.$data.value=s,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,setTimeout(()=>{this.$data.isOpen=!1,this.$data.closing=!1,this.$data.focused=!1},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,l=t.length-1;l>=0;l--)(a=t[l])&&(s=a(s)||s);return s})([i({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}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.default,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
+ "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.default,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);
@@ -9,6 +9,10 @@ declare class SolelySkeleton extends BaseElement<SkeletonProps> {
9
9
  * 获取 avatar class 对象
10
10
  */
11
11
  getAvatarClasses(): Record<string, boolean>;
12
+ /**
13
+ * 组件挂载后
14
+ */
15
+ mounted(): void;
12
16
  /**
13
17
  * 获取 header class 对象
14
18
  */
@@ -1 +1 @@
1
- import t from"./style.css.js";import e from"./index.html.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as r}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let n=class extends a{getSkeletonClasses(){return{"is-active":!!this.$data.active}}getAvatarClasses(){const t={};return this.$data.avatarShape&&(t[`skeleton__avatar--${this.$data.avatarShape}`]=!0),t}getHeaderClasses(){return{"skeleton__header--right":"right"===this.$data.avatarPosition}}startLoading(){this.$data.loading=!0}finishLoading(){this.$data.loading=!1}setLoading(t){this.$data.loading=t}};n=((t,e)=>{for(var a,r=e,n=t.length-1;n>=0;n--)(a=t[n])&&(r=a(r)||r);return r})([r({tagName:"solely-skeleton",template:e,styles:t,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}]})],n);export{n as SolelySkeleton};
1
+ import e from"./style.css.js";import 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)}afterMount(){var t;this.railElement=null==(t=this.shadowRoot)?void 0:t.querySelector(".slider__rail")}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){if(this.$data.disabled)return;t.preventDefault(),this.$data.isDragging=!0,this.railElement&&(this.railRect=this.railElement.getBoundingClientRect()),this.updateValueFromRect(t);const e=t=>{this.$data.isDragging&&this.updateValueFromRect(t)},a=()=>{this.$data.isDragging=!1,this.railRect=void 0,document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",a),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))};document.addEventListener("mousemove",e),document.addEventListener("mouseup",a)}handleTouchStart(t){if(this.$data.disabled)return;if(0===t.touches.length)return;t.preventDefault(),this.$data.isDragging=!0,this.railElement&&(this.railRect=this.railElement.getBoundingClientRect()),this.updateValueFromRect(t.touches[0]);const e=t=>{this.$data.isDragging&&t.touches.length>0&&this.updateValueFromRect(t.touches[0])},a=()=>{this.$data.isDragging=!1,this.railRect=void 0,document.removeEventListener("touchmove",e),document.removeEventListener("touchend",a),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))};document.addEventListener("touchmove",e),document.addEventListener("touchend",a)}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,l=Math.round(n/r)*r,d=Math.max(i,Math.min(s,l));this.$data.value!==d&&(this.$data.value=d,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),l=this.$data.step||1,d=Math.round(r/l)*l,o=Math.max(s,Math.min(n,d));this.$data.value!==o&&(this.$data.value=o,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.default,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);
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()}afterMount(){var t;this.railElement=null==(t=this.shadowRoot)?void 0:t.querySelector(".slider__rail")}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){if(this.$data.disabled)return;t.preventDefault(),this.$data.isDragging=!0,this.railElement&&(this.railRect=this.railElement.getBoundingClientRect()),this.updateValueFromRect(t);const e=t=>{this.$data.isDragging&&this.updateValueFromRect(t)},a=()=>{this.$data.isDragging=!1,this.railRect=void 0,document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",a),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))};document.addEventListener("mousemove",e),document.addEventListener("mouseup",a)}handleTouchStart(t){if(this.$data.disabled)return;if(0===t.touches.length)return;t.preventDefault(),this.$data.isDragging=!0,this.railElement&&(this.railRect=this.railElement.getBoundingClientRect()),this.updateValueFromRect(t.touches[0]);const e=t=>{this.$data.isDragging&&t.touches.length>0&&this.updateValueFromRect(t.touches[0])},a=()=>{this.$data.isDragging=!1,this.railRect=void 0,document.removeEventListener("touchmove",e),document.removeEventListener("touchend",a),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))};document.addEventListener("touchmove",e),document.addEventListener("touchend",a)}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,l=Math.round(n/r)*r,d=Math.max(i,Math.min(s,l));this.$data.value!==d&&(this.$data.value=d,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),l=this.$data.step||1,d=Math.round(r/l)*l,o=Math.max(s,Math.min(n,d));this.$data.value!==o&&(this.$data.value=o,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.default,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);
@@ -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 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,"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)}afterMount(){var t;this.railElement=null==(t=this.shadowRoot)?void 0:t.querySelector(".slider__rail")}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){if(this.$data.disabled)return;t.preventDefault(),this.$data.isDragging=!0,this.railElement&&(this.railRect=this.railElement.getBoundingClientRect()),this.updateValueFromRect(t);const e=t=>{this.$data.isDragging&&this.updateValueFromRect(t)},a=()=>{this.$data.isDragging=!1,this.railRect=void 0,document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",a),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))};document.addEventListener("mousemove",e),document.addEventListener("mouseup",a)}handleTouchStart(t){if(this.$data.disabled)return;if(0===t.touches.length)return;t.preventDefault(),this.$data.isDragging=!0,this.railElement&&(this.railRect=this.railElement.getBoundingClientRect()),this.updateValueFromRect(t.touches[0]);const e=t=>{this.$data.isDragging&&t.touches.length>0&&this.updateValueFromRect(t.touches[0])},a=()=>{this.$data.isDragging=!1,this.railRect=void 0,document.removeEventListener("touchmove",e),document.removeEventListener("touchend",a),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))};document.addEventListener("touchmove",e),document.addEventListener("touchend",a)}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,l=Math.round(n/r)*r,d=Math.max(i,Math.min(s,l));this.$data.value!==d&&(this.$data.value=d,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),l=this.$data.step||1,d=Math.round(r/l)*l,h=Math.max(s,Math.min(n,d));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
+ 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 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,"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()}afterMount(){var t;this.railElement=null==(t=this.shadowRoot)?void 0:t.querySelector(".slider__rail")}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){if(this.$data.disabled)return;t.preventDefault(),this.$data.isDragging=!0,this.railElement&&(this.railRect=this.railElement.getBoundingClientRect()),this.updateValueFromRect(t);const e=t=>{this.$data.isDragging&&this.updateValueFromRect(t)},a=()=>{this.$data.isDragging=!1,this.railRect=void 0,document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",a),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))};document.addEventListener("mousemove",e),document.addEventListener("mouseup",a)}handleTouchStart(t){if(this.$data.disabled)return;if(0===t.touches.length)return;t.preventDefault(),this.$data.isDragging=!0,this.railElement&&(this.railRect=this.railElement.getBoundingClientRect()),this.updateValueFromRect(t.touches[0]);const e=t=>{this.$data.isDragging&&t.touches.length>0&&this.updateValueFromRect(t.touches[0])},a=()=>{this.$data.isDragging=!1,this.railRect=void 0,document.removeEventListener("touchmove",e),document.removeEventListener("touchend",a),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))};document.addEventListener("touchmove",e),document.addEventListener("touchend",a)}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,l=Math.round(n/r)*r,d=Math.max(i,Math.min(s,l));this.$data.value!==d&&(this.$data.value=d,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),l=this.$data.step||1,d=Math.round(r/l)*l,h=Math.max(s,Math.min(n,d));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 e=require("./style.css.cjs"),s=require("./index.html.cjs"),r=require("../utils/helpers.cjs"),a=require("../../../runtime/component/base-element.cjs"),i=require("../../../runtime/component/decorators.cjs");var o,n,l,d=Object.defineProperty;Object.getOwnPropertyDescriptor;exports.SolelySteps=class extends a.default{constructor(){var e,s;super(...arguments),((e,s,r)=>{s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r})(this,"symbol"!=typeof(e="slotObserver")?e+"":e,s)}get current(){return this.$data.current}set current(t){this.$data.current=t,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}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.parseItems(),this.setupSlotObserver()}setupSlotObserver(){setTimeout(()=>{this.collectSlotItems()},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()}parseItems(){this.$data.parsedItems=r.safeJsonParse(this.$data.items,[])}getStepStatus(t){const e=this.$data.current||0;if(!Array.isArray(this.$data.parsedItems)||t<0||t>=this.$data.parsedItems.length)return"wait";const s=this.$data.parsedItems[t];return(null==s?void 0:s.status)?s.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.$data.parsedItems.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.parseItems()}},o=exports.SolelySteps,l=["blue","green","red","orange","gray"],(n="PRESET_COLORS")in o?d(o,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):o[n]=l,exports.SolelySteps=((t,e)=>{for(var s,r=e,a=t.length-1;a>=0;a--)(s=t[a])&&(r=s(r)||r);return r})([i.CustomElement({tagName:"solely-steps",template:s.default,styles:e.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);
1
+ "use strict";var t=Object.defineProperty;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),s=require("./index.html.cjs"),r=require("../utils/helpers.cjs"),i=require("../../../runtime/component/base-element.cjs"),a=require("../../../runtime/component/decorators.cjs");var o,n,l,d=Object.defineProperty;Object.getOwnPropertyDescriptor;exports.SolelySteps=class extends i.default{constructor(){var e,s;super(...arguments),((e,s,r)=>{s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r})(this,"symbol"!=typeof(e="slotObserver")?e+"":e,s)}get current(){return this.$data.current}set current(t){this.$data.current=t,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}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?r.safeJsonParse(t,[]):[]}setupSlotObserver(){setTimeout(()=>{this.collectSlotItems()},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()}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()}},o=exports.SolelySteps,l=["blue","green","red","orange","gray"],(n="PRESET_COLORS")in o?d(o,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):o[n]=l,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:s.default,styles:e.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);
@@ -1,7 +1,6 @@
1
1
  import { BaseElement } from '../../../runtime/component';
2
2
  import { StepsProps, StepItem, StepStatus } from './types';
3
3
  declare class SolelySteps extends BaseElement<StepsProps & {
4
- parsedItems: StepItem[];
5
4
  useSlot: boolean;
6
5
  slotItems: Array<{
7
6
  step: string;
@@ -38,12 +37,15 @@ declare class SolelySteps extends BaseElement<StepsProps & {
38
37
  */
39
38
  collectSlotItems(): void;
40
39
  mounted(): void;
40
+ /**
41
+ * 获取解析后的步骤项
42
+ */
43
+ getParsedItems(): StepItem[];
41
44
  /**
42
45
  * 设置插槽观察器
43
46
  */
44
47
  setupSlotObserver(): void;
45
48
  unmounted(): void;
46
- parseItems(): void;
47
49
  getStepStatus(index: number): StepStatus;
48
50
  /**
49
51
  * 获取插槽步骤的状态
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div class="steps" :class="this.getStepsClasses()">\n \x3c!-- 使用 items 属性时的渲染 --\x3e\n <If test="!$data.useSlot">\n <For each="$data.parsedItems" item="item" index="index">\n <div class="step" :class="this.getStepClasses(item, index)" @click="this.handleStepClick(item, index)">\n <div class="step__tail"></div>\n <div class="step__wrapper">\n <div class="step__icon-wrapper" :class="this.getIconClasses(item)"\n :style="item.icon ? this.getIconStyle(item) : \'\'">\n <div class="step__icon">\n <If test="!$data.progressDot">\n <If\n test="item.icon || this.getStepStatus(index) === \'finish\' || this.getStepStatus(index) === \'error\'">\n <span class="step__icon-substitution">{{this.getStepIcon(item, index)}}</span>\n </If>\n <Else>\n <span class="step__icon-text">{{index + 1}}</span>\n </Else>\n </If>\n </div>\n </div>\n <div class="step__content">\n <div class="step__title">{{item.title}}</div>\n <If test="item.description">\n <div class="step__description">{{item.description}}</div>\n </If>\n </div>\n </div>\n </div>\n </For>\n </If>\n\n \x3c!-- 使用插槽时的渲染 --\x3e\n <If test="$data.useSlot">\n <For each="$data.slotItems" item="slotItem" index="index">\n <div class="step" :class="this.getSlotStepClasses(slotItem, index)" @click="this.handleSlotStepClick(slotItem, index)">\n <div class="step__tail"></div>\n <div class="step__wrapper">\n <div class="step__icon-wrapper">\n <div class="step__icon">\n <If test="!$data.progressDot">\n \x3c!-- 使用插槽元素的 innerHTML 作为图标内容 --\x3e\n <span class="step__icon-substitution" :innerHTML="slotItem.iconHtml"></span>\n </If>\n </div>\n </div>\n <div class="step__content">\n <div class="step__title">{{slotItem.title}}</div>\n <If test="slotItem.description">\n <div class="step__description">{{slotItem.description}}</div>\n </If>\n </div>\n </div>\n </div>\n </For>\n </If>\n</div>\n';
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div class="steps" :class="this.getStepsClasses()">\n \x3c!-- 使用 items 属性时的渲染 --\x3e\n <If test="!$data.useSlot">\n <For each="this.getParsedItems()" item="item" index="index">\n <div class="step" :class="this.getStepClasses(item, index)" @click="this.handleStepClick(item, index)">\n <div class="step__tail"></div>\n <div class="step__wrapper">\n <div class="step__icon-wrapper" :class="this.getIconClasses(item)"\n :style="item.icon ? this.getIconStyle(item) : \'\'">\n <div class="step__icon">\n <If test="!$data.progressDot">\n <If\n test="item.icon || this.getStepStatus(index) === \'finish\' || this.getStepStatus(index) === \'error\'">\n <span class="step__icon-substitution">{{this.getStepIcon(item, index)}}</span>\n </If>\n <Else>\n <span class="step__icon-text">{{index + 1}}</span>\n </Else>\n </If>\n </div>\n </div>\n <div class="step__content">\n <div class="step__title">{{item.title}}</div>\n <If test="item.description">\n <div class="step__description">{{item.description}}</div>\n </If>\n </div>\n </div>\n </div>\n </For>\n </If>\n\n \x3c!-- 使用插槽时的渲染 --\x3e\n <If test="$data.useSlot">\n <For each="$data.slotItems" item="slotItem" index="index">\n <div class="step" :class="this.getSlotStepClasses(slotItem, index)" @click="this.handleSlotStepClick(slotItem, index)">\n <div class="step__tail"></div>\n <div class="step__wrapper">\n <div class="step__icon-wrapper">\n <div class="step__icon">\n <If test="!$data.progressDot">\n \x3c!-- 使用插槽元素的 innerHTML 作为图标内容 --\x3e\n <span class="step__icon-substitution" :innerHTML="slotItem.iconHtml"></span>\n </If>\n </div>\n </div>\n <div class="step__content">\n <div class="step__title">{{slotItem.title}}</div>\n <If test="slotItem.description">\n <div class="step__description">{{slotItem.description}}</div>\n </If>\n </div>\n </div>\n </div>\n </For>\n </If>\n</div>\n';