solely 0.5.2 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/commands/drawer/index.cjs +1 -1
- package/dist/components/commands/drawer/index.js +1 -1
- package/dist/components/commands/drawer/style.css.cjs +1 -1
- package/dist/components/commands/drawer/style.css.js +1 -1
- package/dist/components/commands/drawer/types.d.ts +2 -0
- package/dist/components/commands/index.cjs +1 -1
- package/dist/components/commands/index.d.ts +2 -2
- package/dist/components/commands/index.js +1 -1
- package/dist/components/commands/message/index.cjs +1 -1
- package/dist/components/commands/message/index.js +1 -1
- package/dist/components/commands/message/style.css.cjs +1 -1
- package/dist/components/commands/message/style.css.js +1 -1
- package/dist/components/commands/message/types.d.ts +2 -0
- package/dist/components/commands/modal/index.cjs +1 -1
- package/dist/components/commands/modal/index.js +1 -1
- package/dist/components/commands/modal/style.css.cjs +1 -1
- package/dist/components/commands/modal/style.css.js +1 -1
- package/dist/components/commands/modal/types.d.ts +2 -0
- package/dist/components/commands/popconfirm/index.cjs +1 -1
- package/dist/components/commands/popconfirm/index.d.ts +3 -4
- package/dist/components/commands/popconfirm/index.js +1 -1
- package/dist/components/commands/popconfirm/style.css.cjs +1 -1
- package/dist/components/commands/popconfirm/style.css.js +1 -1
- package/dist/components/commands/popconfirm/types.d.ts +10 -0
- package/dist/components/commands/tooltip/index.cjs +1 -1
- package/dist/components/commands/tooltip/index.d.ts +13 -0
- package/dist/components/commands/tooltip/index.js +1 -1
- package/dist/components/commands/tooltip/style.css.cjs +1 -1
- package/dist/components/commands/tooltip/style.css.js +1 -1
- package/dist/components/commands/tooltip/types.d.ts +2 -0
- package/dist/components/commands/utils.cjs +1 -1
- package/dist/components/commands/utils.d.ts +6 -0
- package/dist/components/commands/utils.js +1 -1
- package/dist/components/elements/button/index.cjs +1 -1
- package/dist/components/elements/button/index.js +1 -1
- package/dist/components/elements/card/index.cjs +1 -1
- package/dist/components/elements/card/index.js +1 -1
- package/dist/components/elements/card/types.d.ts +1 -1
- package/dist/components/elements/input/index.cjs +1 -1
- package/dist/components/elements/input/index.js +1 -1
- package/dist/components/elements/pagination/index.cjs +1 -1
- package/dist/components/elements/pagination/index.js +1 -1
- package/dist/components/elements/pagination/types.d.ts +1 -1
- package/dist/components/elements/steps/index.cjs +1 -1
- package/dist/components/elements/steps/index.js +1 -1
- package/dist/components/elements/steps/types.d.ts +1 -1
- package/dist/components/elements/table/index.cjs +1 -1
- package/dist/components/elements/table/index.js +1 -1
- package/dist/components/elements/table/types.d.ts +1 -1
- package/dist/components/elements/tabs/index.cjs +1 -1
- package/dist/components/elements/tabs/index.js +1 -1
- package/dist/components/elements/tabs/types.d.ts +1 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.js +1 -1
- package/dist/shared/env.cjs +1 -1
- package/dist/shared/env.js +1 -1
- package/package.json +1 -1
|
@@ -27,11 +27,21 @@ export interface PopconfirmOptions {
|
|
|
27
27
|
className?: string;
|
|
28
28
|
/** 自定义样式 */
|
|
29
29
|
style?: Partial<CSSStyleDeclaration>;
|
|
30
|
+
/** 是否克隆传入的 HTMLElement 内容(默认 true) */
|
|
31
|
+
cloneElement?: boolean;
|
|
30
32
|
}
|
|
31
33
|
export interface PopconfirmInstance {
|
|
34
|
+
/** 关闭确认框(与 Modal/Drawer 的 close 保持一致) */
|
|
35
|
+
close: () => void;
|
|
32
36
|
/** 销毁确认框 */
|
|
33
37
|
destroy: () => void;
|
|
34
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* show 方法的返回值类型。
|
|
41
|
+
* 既是 PopconfirmInstance(支持同步使用),又是 PromiseLike<PopconfirmInstance>(兼容 await/.then)。
|
|
42
|
+
* 这是为了向后兼容历史版本中 show 返回 Promise 的用法。
|
|
43
|
+
*/
|
|
44
|
+
export type PopconfirmResult = PopconfirmInstance & PromiseLike<PopconfirmInstance>;
|
|
35
45
|
export interface PopconfirmConfig {
|
|
36
46
|
/** 默认确认按钮文字 */
|
|
37
47
|
okText: string | HTMLElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),o={placement:"top",trigger:"hover",duration:3e3,singleton:!0},n=[],
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),o={placement:"top",trigger:"hover",duration:3e3,singleton:!0},n=[],l=new WeakSet;function r(e,t,o,n=8){const l=e.getBoundingClientRect(),r=t.offsetWidth||250,s=t.offsetHeight||100;let i,c,a=0,d=0;switch(o){case"top":a=l.top-s-n,d=l.left+(l.width-r)/2,i=r/2-4;break;case"topLeft":a=l.top-s-n,d=l.left,i=16;break;case"topRight":a=l.top-s-n,d=l.right-r,i=r-24;break;case"bottom":a=l.bottom+n,d=l.left+(l.width-r)/2,i=r/2-4;break;case"bottomLeft":a=l.bottom+n,d=l.left,i=16;break;case"bottomRight":a=l.bottom+n,d=l.right-r,i=r-24;break;case"left":a=l.top+(l.height-s)/2,d=l.left-r-n,c=s/2-4;break;case"leftTop":a=l.top,d=l.left-r-n,c=16;break;case"leftBottom":a=l.bottom-s,d=l.left-r-n,c=s-24;break;case"right":a=l.top+(l.height-s)/2,d=l.right+n,c=s/2-4;break;case"rightTop":a=l.top,d=l.right+n,c=16;break;case"rightBottom":a=l.bottom-s,d=l.right+n,c=s-24}return a=Math.max(8,Math.min(a,window.innerHeight-s-8)),d=Math.max(8,Math.min(d,window.innerWidth-r-8)),{top:a,left:d,arrowLeft:i,arrowTop:c}}let s=null,i=!1;function c(){s||(s=requestAnimationFrame(()=>{s=null,n.forEach(e=>{const t=e.element;if(!t||!e.target)return;const o=t.querySelector(".solely-tooltip__arrow"),n=r(e.target,t,e.placement);t.style.top=`${n.top}px`,t.style.left=`${n.left}px`,o&&(void 0!==n.arrowLeft&&(o.style.left=`${n.arrowLeft}px`,o.style.top=""),void 0!==n.arrowTop&&(o.style.top=`${n.arrowTop}px`,o.style.left=""))})}))}function a(){i&&(i=!1,window.removeEventListener("resize",c),s&&(cancelAnimationFrame(s),s=null))}async function d(e,t){const o=n.findIndex(t=>t.id===e);if(-1===o)return;const l=n[o];l.element.classList.add("is-closing"),l.element.remove(),l.cleanupTheme(),l.scrollParents.forEach(e=>e.removeEventListener("scroll",c)),n.splice(o,1),0===n.length&&a(),null==t||t()}function m(){if(0===n.length)return;const e=new Set;n.forEach(t=>{t.scrollParents.forEach(t=>e.add(t)),t.element.classList.add("is-closing"),t.element.remove(),t.cleanupTheme()}),e.forEach(e=>e.removeEventListener("scroll",c)),n.length=0,a()}function p(l,s){var a;const d=e.generateId();e.injectStyle("solely-tooltip-styles",t.default);const p=s.placement??o.placement,u=s.cloneElement??!0,f=n.findIndex(e=>e.target===l);if(-1!==f){const e=n[f];e.element.remove(),e.cleanupTheme(),e.scrollParents.forEach(e=>e.removeEventListener("scroll",c)),n.splice(f,1)}o.singleton&&n.length>0&&m();const h=e.createElement("div",{className:`solely-tooltip solely-tooltip--${p}${s.className?` ${s.className}`:""}`,styles:{...s.style,...s.color?{backgroundColor:s.color}:{}}}),v=e.observeTheme(()=>h),g=e.createElement("div",{className:"solely-tooltip__content"});s.content&&("string"==typeof s.content?g.textContent=s.content:s.content instanceof HTMLElement&&g.appendChild(u?s.content.cloneNode(!0):s.content)),h.appendChild(g);const b=e.createElement("div",{className:"solely-tooltip__arrow"});s.color&&(b.style.backgroundColor=s.color),h.appendChild(b),document.body.appendChild(h),requestAnimationFrame(()=>{const e=r(l,h,p);h.style.top=`${e.top}px`,h.style.left=`${e.left}px`,void 0!==e.arrowLeft&&(b.style.left=`${e.arrowLeft}px`),void 0!==e.arrowTop&&(b.style.top=`${e.arrowTop}px`)});const y=function(e){const t=[];let o=e.parentElement;for(;o&&o!==document.body;){const e=getComputedStyle(o);"auto"!==e.overflow&&"scroll"!==e.overflow&&"auto"!==e.overflowY&&"scroll"!==e.overflowY||t.push(o),o=o.parentElement}return t}(l);return y.forEach(e=>e.addEventListener("scroll",c)),i||0===n.length||(i=!0,window.addEventListener("resize",c)),n.push({id:d,element:h,target:l,placement:p,scrollParents:y,cleanupTheme:v}),null==(a=s.onVisibleChange)||a.call(s,!0),d}function u(e,t){const n=p(e,t),l=t.duration??o.duration;l>0&&setTimeout(()=>d(n),l)}const f={bind:function(e,t){if(l.has(e))return{show:()=>{},hide:()=>{},destroy:()=>{}};l.add(e);const n=t.trigger??o.trigger;let r=t.visible??t.defaultVisible??!1,s=null;const i=()=>{r||(r=!0,s=p(e,t))},c=()=>{if(!r||null===s)return;r=!1;const e=s;s=null,d(e,()=>{var e;null==(e=t.onVisibleChange)||e.call(t,!1)})},a=e=>{e.stopPropagation(),r?c():i()},m=t=>{r&&(e.contains(t.target)||c())};return"hover"===n?(e.addEventListener("mouseenter",i),e.addEventListener("mouseleave",c)):"click"===n?(e.addEventListener("click",a),document.addEventListener("click",m)):"focus"===n&&(e.addEventListener("focus",i),e.addEventListener("blur",c)),r&&(s=p(e,t)),{show:i,hide:c,destroy:()=>{c(),l.delete(e),"hover"===n?(e.removeEventListener("mouseenter",i),e.removeEventListener("mouseleave",c)):"click"===n?(e.removeEventListener("click",a),document.removeEventListener("click",m)):"focus"===n&&(e.removeEventListener("focus",i),e.removeEventListener("blur",c))}}},showOnce:u,show:u,hide:async function(e){m(),null==e||e()},destroy:m,config:function(e){Object.assign(o,e)}};exports.Tooltip=f;
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
import { TooltipOptions, TooltipInstance, TooltipConfig } from './types';
|
|
2
|
+
declare function hideAllTooltipsSync(): void;
|
|
2
3
|
declare function hideAllTooltips(callback?: () => void): Promise<void>;
|
|
3
4
|
declare function bind(target: HTMLElement, options: TooltipOptions): TooltipInstance;
|
|
5
|
+
/**
|
|
6
|
+
* 一次性显示 Tooltip(自动隐藏)
|
|
7
|
+
* 如需手动控制显隐,请使用 bind() 方法
|
|
8
|
+
*/
|
|
4
9
|
declare function showOnce(target: HTMLElement, options: TooltipOptions & {
|
|
5
10
|
duration?: number;
|
|
6
11
|
}): void;
|
|
7
12
|
declare function config(options: Partial<TooltipConfig>): void;
|
|
8
13
|
export declare const Tooltip: {
|
|
14
|
+
/** 绑定到目标元素,返回可手动控制的实例 */
|
|
9
15
|
bind: typeof bind;
|
|
16
|
+
/** 一次性显示(自动隐藏)。如需手动控制请用 bind() */
|
|
17
|
+
showOnce: typeof showOnce;
|
|
18
|
+
/** @deprecated show 的别名,仅为向后兼容保留,请使用 showOnce */
|
|
10
19
|
show: typeof showOnce;
|
|
20
|
+
/** 隐藏所有 Tooltip */
|
|
11
21
|
hide: typeof hideAllTooltips;
|
|
22
|
+
/** 销毁所有 Tooltip */
|
|
23
|
+
destroy: typeof hideAllTooltipsSync;
|
|
24
|
+
/** 配置全局默认值 */
|
|
12
25
|
config: typeof config;
|
|
13
26
|
};
|
|
14
27
|
export default Tooltip;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{generateId as e,createElement as t,injectStyle as
|
|
1
|
+
import{generateId as e,createElement as t,observeTheme as o,injectStyle as n}from"../utils.js";import l from"./style.css.js";const r={placement:"top",trigger:"hover",duration:3e3,singleton:!0},s=[],i=new WeakSet;function c(e,t,o,n=8){const l=e.getBoundingClientRect(),r=t.offsetWidth||250,s=t.offsetHeight||100;let i,c,a=0,d=0;switch(o){case"top":a=l.top-s-n,d=l.left+(l.width-r)/2,i=r/2-4;break;case"topLeft":a=l.top-s-n,d=l.left,i=16;break;case"topRight":a=l.top-s-n,d=l.right-r,i=r-24;break;case"bottom":a=l.bottom+n,d=l.left+(l.width-r)/2,i=r/2-4;break;case"bottomLeft":a=l.bottom+n,d=l.left,i=16;break;case"bottomRight":a=l.bottom+n,d=l.right-r,i=r-24;break;case"left":a=l.top+(l.height-s)/2,d=l.left-r-n,c=s/2-4;break;case"leftTop":a=l.top,d=l.left-r-n,c=16;break;case"leftBottom":a=l.bottom-s,d=l.left-r-n,c=s-24;break;case"right":a=l.top+(l.height-s)/2,d=l.right+n,c=s/2-4;break;case"rightTop":a=l.top,d=l.right+n,c=16;break;case"rightBottom":a=l.bottom-s,d=l.right+n,c=s-24}return a=Math.max(8,Math.min(a,window.innerHeight-s-8)),d=Math.max(8,Math.min(d,window.innerWidth-r-8)),{top:a,left:d,arrowLeft:i,arrowTop:c}}let a=null,d=!1;function m(){a||(a=requestAnimationFrame(()=>{a=null,s.forEach(e=>{const t=e.element;if(!t||!e.target)return;const o=t.querySelector(".solely-tooltip__arrow"),n=c(e.target,t,e.placement);t.style.top=`${n.top}px`,t.style.left=`${n.left}px`,o&&(void 0!==n.arrowLeft&&(o.style.left=`${n.arrowLeft}px`,o.style.top=""),void 0!==n.arrowTop&&(o.style.top=`${n.arrowTop}px`,o.style.left=""))})}))}function f(){d&&(d=!1,window.removeEventListener("resize",m),a&&(cancelAnimationFrame(a),a=null))}async function p(e,t){const o=s.findIndex(t=>t.id===e);if(-1===o)return;const n=s[o];n.element.classList.add("is-closing"),n.element.remove(),n.cleanupTheme(),n.scrollParents.forEach(e=>e.removeEventListener("scroll",m)),s.splice(o,1),0===s.length&&f(),null==t||t()}function u(){if(0===s.length)return;const e=new Set;s.forEach(t=>{t.scrollParents.forEach(t=>e.add(t)),t.element.classList.add("is-closing"),t.element.remove(),t.cleanupTheme()}),e.forEach(e=>e.removeEventListener("scroll",m)),s.length=0,f()}function h(i,a){var f;const p=e();n("solely-tooltip-styles",l);const h=a.placement??r.placement,v=a.cloneElement??!0,g=s.findIndex(e=>e.target===i);if(-1!==g){const e=s[g];e.element.remove(),e.cleanupTheme(),e.scrollParents.forEach(e=>e.removeEventListener("scroll",m)),s.splice(g,1)}r.singleton&&s.length>0&&u();const w=t("div",{className:`solely-tooltip solely-tooltip--${h}${a.className?` ${a.className}`:""}`,styles:{...a.style,...a.color?{backgroundColor:a.color}:{}}}),b=o(()=>w),y=t("div",{className:"solely-tooltip__content"});a.content&&("string"==typeof a.content?y.textContent=a.content:a.content instanceof HTMLElement&&y.appendChild(v?a.content.cloneNode(!0):a.content)),w.appendChild(y);const E=t("div",{className:"solely-tooltip__arrow"});a.color&&(E.style.backgroundColor=a.color),w.appendChild(E),document.body.appendChild(w),requestAnimationFrame(()=>{const e=c(i,w,h);w.style.top=`${e.top}px`,w.style.left=`${e.left}px`,void 0!==e.arrowLeft&&(E.style.left=`${e.arrowLeft}px`),void 0!==e.arrowTop&&(E.style.top=`${e.arrowTop}px`)});const L=function(e){const t=[];let o=e.parentElement;for(;o&&o!==document.body;){const e=getComputedStyle(o);"auto"!==e.overflow&&"scroll"!==e.overflow&&"auto"!==e.overflowY&&"scroll"!==e.overflowY||t.push(o),o=o.parentElement}return t}(i);return L.forEach(e=>e.addEventListener("scroll",m)),d||0===s.length||(d=!0,window.addEventListener("resize",m)),s.push({id:p,element:w,target:i,placement:h,scrollParents:L,cleanupTheme:b}),null==(f=a.onVisibleChange)||f.call(a,!0),p}function v(e,t){const o=h(e,t),n=t.duration??r.duration;n>0&&setTimeout(()=>p(o),n)}const g={bind:function(e,t){if(i.has(e))return{show:()=>{},hide:()=>{},destroy:()=>{}};i.add(e);const o=t.trigger??r.trigger;let n=t.visible??t.defaultVisible??!1,l=null;const s=()=>{n||(n=!0,l=h(e,t))},c=()=>{if(!n||null===l)return;n=!1;const e=l;l=null,p(e,()=>{var e;null==(e=t.onVisibleChange)||e.call(t,!1)})},a=e=>{e.stopPropagation(),n?c():s()},d=t=>{n&&(e.contains(t.target)||c())};return"hover"===o?(e.addEventListener("mouseenter",s),e.addEventListener("mouseleave",c)):"click"===o?(e.addEventListener("click",a),document.addEventListener("click",d)):"focus"===o&&(e.addEventListener("focus",s),e.addEventListener("blur",c)),n&&(l=h(e,t)),{show:s,hide:c,destroy:()=>{c(),i.delete(e),"hover"===o?(e.removeEventListener("mouseenter",s),e.removeEventListener("mouseleave",c)):"click"===o?(e.removeEventListener("click",a),document.removeEventListener("click",d)):"focus"===o&&(e.removeEventListener("focus",s),e.removeEventListener("blur",c))}}},showOnce:v,show:v,hide:async function(e){u(),null==e||e()},destroy:u,config:function(e){Object.assign(r,e)}};export{g as Tooltip};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default=".tooltip{position:fixed;background-color:var(--solely-inverted-bg);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-md);padding:var(--solely-spacing-sm) var(--solely-spacing-md);width:max-content;max-width:250px;font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);font-weight:400;line-height:var(--solely-line-height-md);color:var(--solely-inverted-text);text-align:left;text-decoration:none;z-index:var(--solely-z-index-tooltip);pointer-events:auto;animation:tooltip-fade-in var(--solely-transition-duration) var(--solely-transition-timing)}.tooltip.is-closing{animation:tooltip-fade-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.tooltip__content{position:relative;z-index:1;word-wrap:break-word;overflow-wrap:break-word}.tooltip__arrow{position:absolute;width:var(--solely-tooltip-arrow-size, 8px);height:var(--solely-tooltip-arrow-size, 8px);background-color:var(--solely-inverted-bg);transform:rotate(45deg);z-index:0}.tooltip--top .tooltip__arrow,.tooltip--topLeft .tooltip__arrow,.tooltip--topRight .tooltip__arrow{bottom:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.tooltip--bottom .tooltip__arrow,.tooltip--bottomLeft .tooltip__arrow,.tooltip--bottomRight .tooltip__arrow{top:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.tooltip--left .tooltip__arrow,.tooltip--leftTop .tooltip__arrow,.tooltip--leftBottom .tooltip__arrow{right:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.tooltip--right .tooltip__arrow,.tooltip--rightTop .tooltip__arrow,.tooltip--rightBottom .tooltip__arrow{left:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}@keyframes tooltip-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes tooltip-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}";
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default=".solely-tooltip,.solely-tooltip *,.solely-tooltip *:before,.solely-tooltip *:after{box-sizing:border-box}.solely-tooltip{position:fixed;background-color:var(--solely-inverted-bg);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-md);padding:var(--solely-spacing-sm) var(--solely-spacing-md);width:max-content;max-width:250px;font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);font-weight:400;line-height:var(--solely-line-height-md);color:var(--solely-inverted-text);text-align:left;text-decoration:none;z-index:var(--solely-z-index-tooltip);pointer-events:auto;animation:solely-tooltip-fade-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-tooltip.is-closing{animation:solely-tooltip-fade-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-tooltip__content{position:relative;z-index:1;word-wrap:break-word;overflow-wrap:break-word}.solely-tooltip__arrow{position:absolute;width:var(--solely-tooltip-arrow-size, 8px);height:var(--solely-tooltip-arrow-size, 8px);background-color:var(--solely-inverted-bg);transform:rotate(45deg);z-index:0}.solely-tooltip--top .solely-tooltip__arrow,.solely-tooltip--topLeft .solely-tooltip__arrow,.solely-tooltip--topRight .solely-tooltip__arrow{bottom:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.solely-tooltip--bottom .solely-tooltip__arrow,.solely-tooltip--bottomLeft .solely-tooltip__arrow,.solely-tooltip--bottomRight .solely-tooltip__arrow{top:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.solely-tooltip--left .solely-tooltip__arrow,.solely-tooltip--leftTop .solely-tooltip__arrow,.solely-tooltip--leftBottom .solely-tooltip__arrow{right:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.solely-tooltip--right .solely-tooltip__arrow,.solely-tooltip--rightTop .solely-tooltip__arrow,.solely-tooltip--rightBottom .solely-tooltip__arrow{left:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}@keyframes solely-tooltip-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes solely-tooltip-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const o=".tooltip{position:fixed;background-color:var(--solely-inverted-bg);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-md);padding:var(--solely-spacing-sm) var(--solely-spacing-md);width:max-content;max-width:250px;font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);font-weight:400;line-height:var(--solely-line-height-md);color:var(--solely-inverted-text);text-align:left;text-decoration:none;z-index:var(--solely-z-index-tooltip);pointer-events:auto;animation:tooltip-fade-in var(--solely-transition-duration) var(--solely-transition-timing)}.tooltip.is-closing{animation:tooltip-fade-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.tooltip__content{position:relative;z-index:1;word-wrap:break-word;overflow-wrap:break-word}.tooltip__arrow{position:absolute;width:var(--solely-tooltip-arrow-size, 8px);height:var(--solely-tooltip-arrow-size, 8px);background-color:var(--solely-inverted-bg);transform:rotate(45deg);z-index:0}.tooltip--top .tooltip__arrow,.tooltip--topLeft .tooltip__arrow,.tooltip--topRight .tooltip__arrow{bottom:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.tooltip--bottom .tooltip__arrow,.tooltip--bottomLeft .tooltip__arrow,.tooltip--bottomRight .tooltip__arrow{top:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.tooltip--left .tooltip__arrow,.tooltip--leftTop .tooltip__arrow,.tooltip--leftBottom .tooltip__arrow{right:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.tooltip--right .tooltip__arrow,.tooltip--rightTop .tooltip__arrow,.tooltip--rightBottom .tooltip__arrow{left:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}@keyframes tooltip-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes tooltip-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}";export{o as default};
|
|
1
|
+
const o=".solely-tooltip,.solely-tooltip *,.solely-tooltip *:before,.solely-tooltip *:after{box-sizing:border-box}.solely-tooltip{position:fixed;background-color:var(--solely-inverted-bg);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-md);padding:var(--solely-spacing-sm) var(--solely-spacing-md);width:max-content;max-width:250px;font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);font-weight:400;line-height:var(--solely-line-height-md);color:var(--solely-inverted-text);text-align:left;text-decoration:none;z-index:var(--solely-z-index-tooltip);pointer-events:auto;animation:solely-tooltip-fade-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-tooltip.is-closing{animation:solely-tooltip-fade-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-tooltip__content{position:relative;z-index:1;word-wrap:break-word;overflow-wrap:break-word}.solely-tooltip__arrow{position:absolute;width:var(--solely-tooltip-arrow-size, 8px);height:var(--solely-tooltip-arrow-size, 8px);background-color:var(--solely-inverted-bg);transform:rotate(45deg);z-index:0}.solely-tooltip--top .solely-tooltip__arrow,.solely-tooltip--topLeft .solely-tooltip__arrow,.solely-tooltip--topRight .solely-tooltip__arrow{bottom:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.solely-tooltip--bottom .solely-tooltip__arrow,.solely-tooltip--bottomLeft .solely-tooltip__arrow,.solely-tooltip--bottomRight .solely-tooltip__arrow{top:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.solely-tooltip--left .solely-tooltip__arrow,.solely-tooltip--leftTop .solely-tooltip__arrow,.solely-tooltip--leftBottom .solely-tooltip__arrow{right:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.solely-tooltip--right .solely-tooltip__arrow,.solely-tooltip--rightTop .solely-tooltip__arrow,.solely-tooltip--rightBottom .solely-tooltip__arrow{left:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}@keyframes solely-tooltip-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes solely-tooltip-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}";export{o as default};
|
|
@@ -21,6 +21,8 @@ export interface TooltipOptions {
|
|
|
21
21
|
style?: Partial<CSSStyleDeclaration>;
|
|
22
22
|
/** 浮层渲染节点 */
|
|
23
23
|
getPopupContainer?: () => HTMLElement;
|
|
24
|
+
/** 是否克隆传入的 HTMLElement 内容(默认 true) */
|
|
25
|
+
cloneElement?: boolean;
|
|
24
26
|
}
|
|
25
27
|
export interface TooltipInstance {
|
|
26
28
|
/** 显示提示 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t={FAST:200,NORMAL:300,SLOW:500};let e=0;exports.ANIMATION_DURATION=t,exports.Z_INDEX={TOOLTIP:1070,POPOVER:1060,MODAL:1050,TOAST:1100},exports.addClosingAnimation=function(e,o=t.NORMAL){return new Promise(t=>{e.classList.add("is-closing"),setTimeout(()=>t(),o)})},exports.calculatePosition=function(t,e,o="top",n=8){const r=t.getBoundingClientRect(),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t={FAST:200,NORMAL:300,SLOW:500};let e=0,o=null;const n=new Set;exports.ANIMATION_DURATION=t,exports.Z_INDEX={TOOLTIP:1070,POPOVER:1060,MODAL:1050,TOAST:1100},exports.addClosingAnimation=function(e,o=t.NORMAL){return new Promise(t=>{e.classList.add("is-closing"),setTimeout(()=>t(),o)})},exports.calculatePosition=function(t,e,o="top",n=8){const r=t.getBoundingClientRect(),a=(null==e?void 0:e.offsetWidth)??250,s=(null==e?void 0:e.offsetHeight)??100,i=window.pageYOffset||document.documentElement.scrollTop,c=window.pageXOffset||document.documentElement.scrollLeft;let l,m,u=0,d=0;switch(o){case"top":u=r.top+i-s-n,d=r.left+c+(r.width-a)/2,l=a/2-4;break;case"topLeft":u=r.top+i-s-n,d=r.left+c,l=16;break;case"topRight":u=r.top+i-s-n,d=r.right+c-a,l=a-24;break;case"bottom":u=r.bottom+i+n,d=r.left+c+(r.width-a)/2,l=a/2-4;break;case"bottomLeft":u=r.bottom+i+n,d=r.left+c,l=16;break;case"bottomRight":u=r.bottom+i+n,d=r.right+c-a,l=a-24;break;case"left":u=r.top+i+(r.height-s)/2,d=r.left+c-a-n,m=s/2-4;break;case"leftTop":u=r.top+i,d=r.left+c-a-n,m=16;break;case"leftBottom":u=r.bottom+i-s,d=r.left+c-a-n,m=s-24;break;case"right":u=r.top+i+(r.height-s)/2,d=r.right+c+n,m=s/2-4;break;case"rightTop":u=r.top+i,d=r.right+c+n,m=16;break;case"rightBottom":u=r.bottom+i-s,d=r.right+c+n,m=s-24}return u=Math.max(8,Math.min(u,window.innerHeight+i-s-8)),d=Math.max(8,Math.min(d,window.innerWidth+c-a-8)),{top:u,left:d,arrowLeft:l,arrowTop:m}},exports.createElement=function(t,e){const o=document.createElement(t);return(null==e?void 0:e.className)&&(o.className=e.className),void 0!==(null==e?void 0:e.textContent)&&(o.textContent=e.textContent),(null==e?void 0:e.styles)&&Object.assign(o.style,e.styles),(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(([t,e])=>{o.setAttribute(t,e)}),o},exports.generateId=function(){return e=(e+1)%Number.MAX_SAFE_INTEGER,e},exports.injectStyle=function(t,e){if(document.getElementById(t))return;const o=document.createElement("style");o.id=t,o.textContent=e,document.head.appendChild(o)},exports.observeTheme=function(t){const e=()=>{const e=t();if(!e)return;const o=Array.isArray(e)?e:[e],n=document.documentElement.getAttribute("data-theme");o.forEach(t=>{n?t.setAttribute("data-theme",n):t.removeAttribute("data-theme")})};return e(),n.add(e),o||(o=new MutationObserver(()=>{n.forEach(t=>t())}),o.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})),()=>{n.delete(e),0===n.size&&o&&(o.disconnect(),o=null)}},exports.removeStyle=function(t){const e=document.getElementById(t);e&&e.remove()},exports.safeAsyncCallback=async function(t,e){try{return await t()}catch(o){return console.error("[Solely Commands] Async callback error:",o),void(null==e||e())}};
|
|
@@ -38,3 +38,9 @@ export declare function safeAsyncCallback<T>(callback: () => T | Promise<T>, fal
|
|
|
38
38
|
* 添加关闭动画(使用 .is-closing 类)
|
|
39
39
|
*/
|
|
40
40
|
export declare function addClosingAnimation(element: HTMLElement, duration?: number): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* 观察主题变化并同步到指定元素
|
|
43
|
+
* @param getElements 返回需要同步主题的元素(单个、数组或 null)
|
|
44
|
+
* @returns 清理函数(取消观察)
|
|
45
|
+
*/
|
|
46
|
+
export declare function observeTheme(getElements: () => HTMLElement | HTMLElement[] | null): () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t={FAST:200,NORMAL:300,SLOW:500},e={TOOLTIP:1070,POPOVER:1060,MODAL:1050,TOAST:1100};let o=0;function n(){return o=(o+1)%Number.MAX_SAFE_INTEGER,o}function r(t,e){if(document.getElementById(t))return;const o=document.createElement("style");o.id=t,o.textContent=e,document.head.appendChild(o)}function a(t){const e=document.getElementById(t);e&&e.remove()}function i(t,e){const o=document.createElement(t);return(null==e?void 0:e.className)&&(o.className=e.className),void 0!==(null==e?void 0:e.textContent)&&(o.textContent=e.textContent),(null==e?void 0:e.styles)&&Object.assign(o.style,e.styles),(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(([t,e])=>{o.setAttribute(t,e)}),o}function c(t,e,o="top",n=8){const r=t.getBoundingClientRect(),a=(null==e?void 0:e.offsetWidth)??250,i=(null==e?void 0:e.offsetHeight)??100,c=window.pageYOffset||document.documentElement.scrollTop,
|
|
1
|
+
const t={FAST:200,NORMAL:300,SLOW:500},e={TOOLTIP:1070,POPOVER:1060,MODAL:1050,TOAST:1100};let o=0;function n(){return o=(o+1)%Number.MAX_SAFE_INTEGER,o}function r(t,e){if(document.getElementById(t))return;const o=document.createElement("style");o.id=t,o.textContent=e,document.head.appendChild(o)}function a(t){const e=document.getElementById(t);e&&e.remove()}function i(t,e){const o=document.createElement(t);return(null==e?void 0:e.className)&&(o.className=e.className),void 0!==(null==e?void 0:e.textContent)&&(o.textContent=e.textContent),(null==e?void 0:e.styles)&&Object.assign(o.style,e.styles),(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(([t,e])=>{o.setAttribute(t,e)}),o}function c(t,e,o="top",n=8){const r=t.getBoundingClientRect(),a=(null==e?void 0:e.offsetWidth)??250,i=(null==e?void 0:e.offsetHeight)??100,c=window.pageYOffset||document.documentElement.scrollTop,s=window.pageXOffset||document.documentElement.scrollLeft;let l,m,u=0,d=0;switch(o){case"top":u=r.top+c-i-n,d=r.left+s+(r.width-a)/2,l=a/2-4;break;case"topLeft":u=r.top+c-i-n,d=r.left+s,l=16;break;case"topRight":u=r.top+c-i-n,d=r.right+s-a,l=a-24;break;case"bottom":u=r.bottom+c+n,d=r.left+s+(r.width-a)/2,l=a/2-4;break;case"bottomLeft":u=r.bottom+c+n,d=r.left+s,l=16;break;case"bottomRight":u=r.bottom+c+n,d=r.right+s-a,l=a-24;break;case"left":u=r.top+c+(r.height-i)/2,d=r.left+s-a-n,m=i/2-4;break;case"leftTop":u=r.top+c,d=r.left+s-a-n,m=16;break;case"leftBottom":u=r.bottom+c-i,d=r.left+s-a-n,m=i-24;break;case"right":u=r.top+c+(r.height-i)/2,d=r.right+s+n,m=i/2-4;break;case"rightTop":u=r.top+c,d=r.right+s+n,m=16;break;case"rightBottom":u=r.bottom+c-i,d=r.right+s+n,m=i-24}return u=Math.max(8,Math.min(u,window.innerHeight+c-i-8)),d=Math.max(8,Math.min(d,window.innerWidth+s-a-8)),{top:u,left:d,arrowLeft:l,arrowTop:m}}async function s(t,e){try{return await t()}catch(o){return console.error("[Solely Commands] Async callback error:",o),void(null==e||e())}}function l(e,o=t.NORMAL){return new Promise(t=>{e.classList.add("is-closing"),setTimeout(()=>t(),o)})}let m=null;const u=new Set;function d(t){const e=()=>{const e=t();if(!e)return;const o=Array.isArray(e)?e:[e],n=document.documentElement.getAttribute("data-theme");o.forEach(t=>{n?t.setAttribute("data-theme",n):t.removeAttribute("data-theme")})};return e(),u.add(e),m||(m=new MutationObserver(()=>{u.forEach(t=>t())}),m.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})),()=>{u.delete(e),0===u.size&&m&&(m.disconnect(),m=null)}}export{t as ANIMATION_DURATION,e as Z_INDEX,l as addClosingAnimation,c as calculatePosition,i as createElement,n as generateId,r as injectStyle,d as observeTheme,a as removeStyle,s as safeAsyncCallback};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./style.css.cjs"),e=require("./index.html.cjs"),a=require("../../../runtime/component/base-element.cjs"),n=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyButton=class extends a.default{mounted(){this.refresh()}getButtonClasses(){const t={};return this.$data.type&&"default"!==this.$data.type?t[`btn--${this.$data.type}`]=!0:t["btn--default"]=!0,"small"===this.$data.size?t["btn--sm"]=!0:"large"===this.$data.size&&(t["btn--lg"]=!0),this.$data.shape&&"default"!==this.$data.shape&&(t[`btn--shape-${this.$data.shape}`]=!0),t["is-disabled"]=!!this.$data.disabled,t["is-loading"]=!!this.$data.loading,t["btn--ghost"]=!!this.$data.ghost,t["btn--danger"]=!!this.$data.danger,t["btn--icon-only"]=!!this.$data.iconOnly,t["btn--block"]=!!this.$data.block,t}getTagName(){return this.$data.href?"a":"button"}getLinkAttrs(){const t={};return this.$data.href&&(t.href=this.$data.href,this.$data.target&&(t.target=this.$data.target)),t}hasLoadingIconSlot(){return null!==this.querySelector('[slot="loading-icon"]')}getLoadingIcon(){return this.$data.loadingIcon||""}handleClick(t){if(this.$data.loading||this.$data.disabled)return t.preventDefault(),void t.stopPropagation()}setLoading(t){this.$data.loading=t}setDisabled(t){this.$data.disabled=t}focus(){var t;null==(t=this.$refs.buttonRef)||t.focus()}blur(){var t;null==(t=this.$refs.buttonRef)||t.blur()}hasDefaultSlotContent(){return Array.from(this.childNodes).filter(t=>{var e;return t.nodeType===Node.ELEMENT_NODE?!t.hasAttribute("slot"):t.nodeType===Node.TEXT_NODE&&""!==(null==(e=t.textContent)?void 0:e.trim())}).length>0}hasIconSlot(){return null!==this.querySelector('[slot="icon"]')}hasIconRightSlot(){return null!==this.querySelector('[slot="icon-right"]')}},exports.SolelyButton=((t,e)=>{for(var a,n=e,s=t.length-1;s>=0;s--)(a=t[s])&&(n=a(n)||n);return n})([n.CustomElement({tagName:"solely-button",template:e.__SOLELY_IR__,styles:t.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"default"},{name:"size",type:"string",default:""},{name:"shape",type:"string",default:""},{name:"disabled",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"ghost",type:"boolean",default:!1},{name:"danger",type:"boolean",default:!1},{name:"block",type:"boolean",default:!1},{name:"iconOnly",type:"boolean",default:!1},{name:"content",type:"string",default:""},{name:"icon",type:"string",default:""},{name:"iconRight",type:"string",default:""},{name:"loadingIcon",type:"string",default:""},{name:"href",type:"string",default:""},{name:"target",type:"string",default:""}]})],exports.SolelyButton);
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./style.css.cjs"),e=require("./index.html.cjs"),a=require("../../../runtime/component/base-element.cjs"),n=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyButton=class extends a.default{mounted(){this.refresh()}getButtonClasses(){const t={};return this.$data.type&&"default"!==this.$data.type?t[`btn--${this.$data.type}`]=!0:t["btn--default"]=!0,"small"===this.$data.size?t["btn--sm"]=!0:"large"===this.$data.size&&(t["btn--lg"]=!0),this.$data.shape&&"default"!==this.$data.shape&&(t[`btn--shape-${this.$data.shape}`]=!0),t["is-disabled"]=!!this.$data.disabled,t["is-loading"]=!!this.$data.loading,t["btn--ghost"]=!!this.$data.ghost,t["btn--danger"]=!!this.$data.danger,t["btn--icon-only"]=!!this.$data.iconOnly,t["btn--block"]=!!this.$data.block,t}getTagName(){return this.$data.href?"a":"button"}getLinkAttrs(){const t={};return this.$data.href&&(t.href=this.$data.href,this.$data.target&&(t.target=this.$data.target)),t}hasLoadingIconSlot(){return null!==this.querySelector('[slot="loading-icon"]')}getLoadingIcon(){return this.$data.loadingIcon||""}handleClick(t){if(this.$data.loading||this.$data.disabled)return t.preventDefault(),void t.stopPropagation()}setLoading(t){this.$data.loading=t}setDisabled(t){this.$data.disabled=t}focus(){var t;null==(t=this.$refs.buttonRef)||t.focus()}blur(){var t;null==(t=this.$refs.buttonRef)||t.blur()}hasDefaultSlotContent(){return Array.from(this.childNodes).filter(t=>{var e;return t.nodeType===Node.ELEMENT_NODE?!t.hasAttribute("slot"):t.nodeType===Node.TEXT_NODE&&""!==(null==(e=t.textContent)?void 0:e.trim())}).length>0}hasIconSlot(){return null!==this.querySelector('[slot="icon"]')}hasIconRightSlot(){return null!==this.querySelector('[slot="icon-right"]')}},exports.SolelyButton=((t,e)=>{for(var a,n=e,s=t.length-1;s>=0;s--)(a=t[s])&&(n=a(n)||n);return n})([n.CustomElement({tagName:"solely-button",template:e.__SOLELY_IR__,styles:t.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"default"},{name:"size",type:"string",default:"medium"},{name:"shape",type:"string",default:""},{name:"disabled",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"ghost",type:"boolean",default:!1},{name:"danger",type:"boolean",default:!1},{name:"block",type:"boolean",default:!1},{name:"iconOnly",type:"boolean",default:!1},{name:"content",type:"string",default:""},{name:"icon",type:"string",default:""},{name:"iconRight",type:"string",default:""},{name:"loadingIcon",type:"string",default:""},{name:"href",type:"string",default:""},{name:"target",type:"string",default:""}]})],exports.SolelyButton);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"./style.css.js";import{__SOLELY_IR__ as e}from"./index.html.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as n}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let s=class extends a{mounted(){this.refresh()}getButtonClasses(){const t={};return this.$data.type&&"default"!==this.$data.type?t[`btn--${this.$data.type}`]=!0:t["btn--default"]=!0,"small"===this.$data.size?t["btn--sm"]=!0:"large"===this.$data.size&&(t["btn--lg"]=!0),this.$data.shape&&"default"!==this.$data.shape&&(t[`btn--shape-${this.$data.shape}`]=!0),t["is-disabled"]=!!this.$data.disabled,t["is-loading"]=!!this.$data.loading,t["btn--ghost"]=!!this.$data.ghost,t["btn--danger"]=!!this.$data.danger,t["btn--icon-only"]=!!this.$data.iconOnly,t["btn--block"]=!!this.$data.block,t}getTagName(){return this.$data.href?"a":"button"}getLinkAttrs(){const t={};return this.$data.href&&(t.href=this.$data.href,this.$data.target&&(t.target=this.$data.target)),t}hasLoadingIconSlot(){return null!==this.querySelector('[slot="loading-icon"]')}getLoadingIcon(){return this.$data.loadingIcon||""}handleClick(t){if(this.$data.loading||this.$data.disabled)return t.preventDefault(),void t.stopPropagation()}setLoading(t){this.$data.loading=t}setDisabled(t){this.$data.disabled=t}focus(){var t;null==(t=this.$refs.buttonRef)||t.focus()}blur(){var t;null==(t=this.$refs.buttonRef)||t.blur()}hasDefaultSlotContent(){return Array.from(this.childNodes).filter(t=>{var e;return t.nodeType===Node.ELEMENT_NODE?!t.hasAttribute("slot"):t.nodeType===Node.TEXT_NODE&&""!==(null==(e=t.textContent)?void 0:e.trim())}).length>0}hasIconSlot(){return null!==this.querySelector('[slot="icon"]')}hasIconRightSlot(){return null!==this.querySelector('[slot="icon-right"]')}};s=((t,e)=>{for(var a,n=e,s=t.length-1;s>=0;s--)(a=t[s])&&(n=a(n)||n);return n})([n({tagName:"solely-button",template:e,styles:t,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"default"},{name:"size",type:"string",default:""},{name:"shape",type:"string",default:""},{name:"disabled",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"ghost",type:"boolean",default:!1},{name:"danger",type:"boolean",default:!1},{name:"block",type:"boolean",default:!1},{name:"iconOnly",type:"boolean",default:!1},{name:"content",type:"string",default:""},{name:"icon",type:"string",default:""},{name:"iconRight",type:"string",default:""},{name:"loadingIcon",type:"string",default:""},{name:"href",type:"string",default:""},{name:"target",type:"string",default:""}]})],s);export{s as SolelyButton};
|
|
1
|
+
import t from"./style.css.js";import{__SOLELY_IR__ as e}from"./index.html.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as n}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let s=class extends a{mounted(){this.refresh()}getButtonClasses(){const t={};return this.$data.type&&"default"!==this.$data.type?t[`btn--${this.$data.type}`]=!0:t["btn--default"]=!0,"small"===this.$data.size?t["btn--sm"]=!0:"large"===this.$data.size&&(t["btn--lg"]=!0),this.$data.shape&&"default"!==this.$data.shape&&(t[`btn--shape-${this.$data.shape}`]=!0),t["is-disabled"]=!!this.$data.disabled,t["is-loading"]=!!this.$data.loading,t["btn--ghost"]=!!this.$data.ghost,t["btn--danger"]=!!this.$data.danger,t["btn--icon-only"]=!!this.$data.iconOnly,t["btn--block"]=!!this.$data.block,t}getTagName(){return this.$data.href?"a":"button"}getLinkAttrs(){const t={};return this.$data.href&&(t.href=this.$data.href,this.$data.target&&(t.target=this.$data.target)),t}hasLoadingIconSlot(){return null!==this.querySelector('[slot="loading-icon"]')}getLoadingIcon(){return this.$data.loadingIcon||""}handleClick(t){if(this.$data.loading||this.$data.disabled)return t.preventDefault(),void t.stopPropagation()}setLoading(t){this.$data.loading=t}setDisabled(t){this.$data.disabled=t}focus(){var t;null==(t=this.$refs.buttonRef)||t.focus()}blur(){var t;null==(t=this.$refs.buttonRef)||t.blur()}hasDefaultSlotContent(){return Array.from(this.childNodes).filter(t=>{var e;return t.nodeType===Node.ELEMENT_NODE?!t.hasAttribute("slot"):t.nodeType===Node.TEXT_NODE&&""!==(null==(e=t.textContent)?void 0:e.trim())}).length>0}hasIconSlot(){return null!==this.querySelector('[slot="icon"]')}hasIconRightSlot(){return null!==this.querySelector('[slot="icon-right"]')}};s=((t,e)=>{for(var a,n=e,s=t.length-1;s>=0;s--)(a=t[s])&&(n=a(n)||n);return n})([n({tagName:"solely-button",template:e,styles:t,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"default"},{name:"size",type:"string",default:"medium"},{name:"shape",type:"string",default:""},{name:"disabled",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"ghost",type:"boolean",default:!1},{name:"danger",type:"boolean",default:!1},{name:"block",type:"boolean",default:!1},{name:"iconOnly",type:"boolean",default:!1},{name:"content",type:"string",default:""},{name:"icon",type:"string",default:""},{name:"iconRight",type:"string",default:""},{name:"loadingIcon",type:"string",default:""},{name:"href",type:"string",default:""},{name:"target",type:"string",default:""}]})],s);export{s as SolelyButton};
|
|
@@ -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.SolelyCard=class extends a.default{getCardClasses(){const e={"card--bordered":!!this.$data.bordered,"card--hoverable":!!this.$data.hoverable};return"small"===this.$data.size?e["card--sm"]=!0:"large"===this.$data.size&&(e["card--lg"]=!0),e["is-loading"]=!!this.$data.loading,e}mounted(){this.refresh()}setLoading(e){this.$data.loading=e}setTitle(e){this.$data.title=e}getActionItems(){const e=this.$data.actions;return Array.isArray(e)?e.filter(e=>"string"==typeof e):[]}handleActionClick(e,t){const a=this.getActionItems();if(e<0||e>=a.length)return;const r=a[e];this.emit("action",{index:e,action:r})}},exports.SolelyCard=((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-card",template:t.__SOLELY_IR__,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"title",type:"string",default:""},{name:"size",type:"string",default:"
|
|
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.SolelyCard=class extends a.default{getCardClasses(){const e={"card--bordered":!!this.$data.bordered,"card--hoverable":!!this.$data.hoverable};return"small"===this.$data.size?e["card--sm"]=!0:"large"===this.$data.size&&(e["card--lg"]=!0),e["is-loading"]=!!this.$data.loading,e}mounted(){this.refresh()}setLoading(e){this.$data.loading=e}setTitle(e){this.$data.title=e}getActionItems(){const e=this.$data.actions;return Array.isArray(e)?e.filter(e=>"string"==typeof e):[]}handleActionClick(e,t){const a=this.getActionItems();if(e<0||e>=a.length)return;const r=a[e];this.emit("action",{index:e,action:r})}},exports.SolelyCard=((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-card",template:t.__SOLELY_IR__,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"title",type:"string",default:""},{name:"size",type:"string",default:"medium"},{name:"bordered",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"hoverable",type:"boolean",default:!1},{name:"cover",type:"string",default:""},{name:"actions",type:"array",default:[]},{name:"extra",type:"string",default:""}]})],exports.SolelyCard);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./style.css.js";import{__SOLELY_IR__ as t}from"./index.html.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as r}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let s=class extends a{getCardClasses(){const e={"card--bordered":!!this.$data.bordered,"card--hoverable":!!this.$data.hoverable};return"small"===this.$data.size?e["card--sm"]=!0:"large"===this.$data.size&&(e["card--lg"]=!0),e["is-loading"]=!!this.$data.loading,e}mounted(){this.refresh()}setLoading(e){this.$data.loading=e}setTitle(e){this.$data.title=e}getActionItems(){const e=this.$data.actions;return Array.isArray(e)?e.filter(e=>"string"==typeof e):[]}handleActionClick(e,t){const a=this.getActionItems();if(e<0||e>=a.length)return;const r=a[e];this.emit("action",{index:e,action:r})}};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-card",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"title",type:"string",default:""},{name:"size",type:"string",default:"
|
|
1
|
+
import e from"./style.css.js";import{__SOLELY_IR__ as t}from"./index.html.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as r}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let s=class extends a{getCardClasses(){const e={"card--bordered":!!this.$data.bordered,"card--hoverable":!!this.$data.hoverable};return"small"===this.$data.size?e["card--sm"]=!0:"large"===this.$data.size&&(e["card--lg"]=!0),e["is-loading"]=!!this.$data.loading,e}mounted(){this.refresh()}setLoading(e){this.$data.loading=e}setTitle(e){this.$data.title=e}getActionItems(){const e=this.$data.actions;return Array.isArray(e)?e.filter(e=>"string"==typeof e):[]}handleActionClick(e,t){const a=this.getActionItems();if(e<0||e>=a.length)return;const r=a[e];this.emit("action",{index:e,action:r})}};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-card",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"title",type:"string",default:""},{name:"size",type:"string",default:"medium"},{name:"bordered",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"hoverable",type:"boolean",default:!1},{name:"cover",type:"string",default:""},{name:"actions",type:"array",default:[]},{name:"extra",type:"string",default:""}]})],s);export{s as SolelyCard};
|
|
@@ -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"),i=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(){var e;this.refresh(),this.inputElement=null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"),this.$data.autofocus&&this.focus()}unmounted(){this.searchDebounceTimer&&(clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=void 0)}hasPrefixSlot(){return null!==this.querySelector('[slot="prefix"]')}hasSuffixSlot(){return null!==this.querySelector('[slot="suffix"]')}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;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.focus(),this.$data.focused=!0}blur(){var e;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.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;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.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})([i.CustomElement({tagName:"solely-input",template:s.__SOLELY_IR__,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"),i=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(){var e;this.refresh(),this.inputElement=null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"),this.$data.autofocus&&this.focus()}unmounted(){this.searchDebounceTimer&&(clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=void 0)}hasPrefixSlot(){return null!==this.querySelector('[slot="prefix"]')}hasSuffixSlot(){return null!==this.querySelector('[slot="suffix"]')}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;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.focus(),this.$data.focused=!0}blur(){var e;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.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;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.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})([i.CustomElement({tagName:"solely-input",template:s.__SOLELY_IR__,styles:a.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"text"},{name:"size",type:"string",default:"medium"},{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{__SOLELY_IR__ as 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 o=class extends r{constructor(){super(...arguments),t(this,"_filteredSuggestions",[]),t(this,"inputElement"),t(this,"searchDebounceTimer")}get filteredSuggestions(){return this._filteredSuggestions}mounted(){var e;this.refresh(),this.inputElement=null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"),this.$data.autofocus&&this.focus()}unmounted(){this.searchDebounceTimer&&(clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=void 0)}hasPrefixSlot(){return null!==this.querySelector('[slot="prefix"]')}hasSuffixSlot(){return null!==this.querySelector('[slot="suffix"]')}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;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.focus(),this.$data.focused=!0}blur(){var e;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.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;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.select()}};o=((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}]})],o);export{o 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{__SOLELY_IR__ as 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 o=class extends r{constructor(){super(...arguments),t(this,"_filteredSuggestions",[]),t(this,"inputElement"),t(this,"searchDebounceTimer")}get filteredSuggestions(){return this._filteredSuggestions}mounted(){var e;this.refresh(),this.inputElement=null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"),this.$data.autofocus&&this.focus()}unmounted(){this.searchDebounceTimer&&(clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=void 0)}hasPrefixSlot(){return null!==this.querySelector('[slot="prefix"]')}hasSuffixSlot(){return null!==this.querySelector('[slot="suffix"]')}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;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.focus(),this.$data.focused=!0}blur(){var e;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.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;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.select()}};o=((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:"medium"},{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}]})],o);export{o 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 CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:e,pageSize:this.$data.pageSize}}))}get pageSize(){return this.$data.pageSize}set pageSize(e){this.$data.pageSize=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:this.$data.current,pageSize:e}}))}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;const s={current:1,pageSize:a};this.emit("
|
|
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 CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:e,pageSize:this.$data.pageSize}}))}get pageSize(){return this.$data.pageSize}set pageSize(e){this.$data.pageSize=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:this.$data.current,pageSize:e}}))}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;const s={current:1,pageSize:a};this.emit("size-change",s),this.emit("show-size-change",s)}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.__SOLELY_IR__,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:"medium"},{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{__SOLELY_IR__ as 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 CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:e,pageSize:this.$data.pageSize}}))}get pageSize(){return this.$data.pageSize}set pageSize(e){this.$data.pageSize=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:this.$data.current,pageSize:e}}))}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;const s={current:1,pageSize:a};this.emit("
|
|
1
|
+
import e from"./style.css.js";import{__SOLELY_IR__ as 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 CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:e,pageSize:this.$data.pageSize}}))}get pageSize(){return this.$data.pageSize}set pageSize(e){this.$data.pageSize=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:this.$data.current,pageSize:e}}))}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;const s={current:1,pageSize:a};this.emit("size-change",s),this.emit("show-size-change",s)}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:"medium"},{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";var t=Object.defineProperty,e=(e,s,r)=>((e,s,r)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r)(e,"symbol"!=typeof s?s+"":s,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./style.css.cjs"),r=require("./index.html.cjs"),i=require("../utils/helpers.cjs"),o=require("../../../runtime/component/base-element.cjs"),a=require("../../../runtime/component/decorators.cjs");var n,l,d,c=Object.defineProperty;Object.getOwnPropertyDescriptor;exports.SolelySteps=class extends o.default{constructor(){super(...arguments),e(this,"slotObserver"),e(this,"slotInitTimer")}get current(){return this.$data.current}set current(t){this.$data.current=t,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:t}}))}getStepsClasses(){const t={};return this.$data.direction&&(t[`steps--${this.$data.direction}`]=!0),t["steps--dot"]=!!this.$data.progressDot,"small"===this.$data.size?t["steps--sm"]=!0:"large"===this.$data.size
|
|
1
|
+
"use strict";var t=Object.defineProperty,e=(e,s,r)=>((e,s,r)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r)(e,"symbol"!=typeof s?s+"":s,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./style.css.cjs"),r=require("./index.html.cjs"),i=require("../utils/helpers.cjs"),o=require("../../../runtime/component/base-element.cjs"),a=require("../../../runtime/component/decorators.cjs");var n,l,d,c=Object.defineProperty;Object.getOwnPropertyDescriptor;exports.SolelySteps=class extends o.default{constructor(){super(...arguments),e(this,"slotObserver"),e(this,"slotInitTimer")}get current(){return this.$data.current}set current(t){this.$data.current=t,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:t}}))}getStepsClasses(){const t={};return this.$data.direction&&(t[`steps--${this.$data.direction}`]=!0),t["steps--dot"]=!!this.$data.progressDot,"small"===this.$data.size?t["steps--sm"]=!0:"large"===this.$data.size?t["steps--lg"]=!0:t["steps--md"]=!0,t["use-slot"]=this.$data.useSlot,t}getStepClasses(t,e){const s=this.getStepStatus(e);return{"step--wait":"wait"===s,"step--process":"process"===s,"step--finish":"finish"===s,"step--error":"error"===s,"step--disabled":!!t.disabled}}getSlotStepClasses(t,e){const s=this.getSlotStepStatus(e);return{"step--wait":"wait"===s,"step--process":"process"===s,"step--finish":"finish"===s,"step--error":"error"===s,"step--disabled":!!t.disabled}}getIconClasses(t){const e={};return t.icon&&t.color&&exports.SolelySteps.PRESET_COLORS.includes(t.color)&&(e[`step__icon-wrapper--${t.color}`]=!0),e}getIconStyle(t){return t.icon&&t.color?exports.SolelySteps.PRESET_COLORS.includes(t.color)?"":`color: ${t.color}; background-color: ${t.color}15;`:""}collectSlotItems(){const t=Array.from(this.children).filter(t=>t.hasAttribute("data-step"));0!==t.length?(this.$data.useSlot=!0,this.$data.slotItems=t.map((t,e)=>{var s;const r=t;return{step:r.getAttribute("data-step")||String(e+1),title:r.getAttribute("data-title")||(null==(s=r.textContent)?void 0:s.trim())||"",description:r.getAttribute("data-description")||void 0,disabled:r.hasAttribute("disabled"),iconHtml:r.innerHTML}})):this.$data.useSlot=!1}mounted(){this.refresh(),this.setupSlotObserver()}getParsedItems(){const t=this.$data.items;return Array.isArray(t)?t:"string"==typeof t&&t?i.safeJsonParse(t,[]):[]}setupSlotObserver(){this.slotInitTimer=setTimeout(()=>{this.collectSlotItems(),this.slotInitTimer=void 0},0),this.slotObserver=new MutationObserver(()=>{this.collectSlotItems()}),this.slotObserver.observe(this,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["data-step","data-title","data-description","disabled"]})}unmounted(){this.slotObserver&&this.slotObserver.disconnect(),this.slotInitTimer&&(clearTimeout(this.slotInitTimer),this.slotInitTimer=void 0)}getStepStatus(t){const e=this.$data.current||0,s=this.getParsedItems();if(!Array.isArray(s)||t<0||t>=s.length)return"wait";const r=s[t];return(null==r?void 0:r.status)?r.status:t<e?"finish":t===e?"process":"wait"}getSlotStepStatus(t){const e=this.$data.current||0;return t<e?"finish":t===e?"process":"wait"}getStepIcon(t,e){if(t.icon)return t.icon;const s=this.getStepStatus(e);return"finish"===s?"✓":"error"===s?"✕":String(e+1)}handleStepClick(t,e){t.disabled||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:e,item:t}})))}handleSlotStepClick(t,e){t.disabled||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:e,item:t}})))}setCurrent(t){this.$data.current=t}getCurrent(){return this.$data.current}next(){const t=this.$data.useSlot?this.$data.slotItems.length-1:this.getParsedItems().length-1;this.$data.current<t&&this.$data.current++}prev(){this.$data.current>0&&this.$data.current--}setItems(t){this.$data.items=JSON.stringify(t),this.$data.useSlot=!1,this.refresh()}},n=exports.SolelySteps,d=["blue","green","red","orange","gray"],(l="PRESET_COLORS")in n?c(n,l,{enumerable:!0,configurable:!0,writable:!0,value:d}):n[l]=d,exports.SolelySteps=((t,e)=>{for(var s,r=e,i=t.length-1;i>=0;i--)(s=t[i])&&(r=s(r)||r);return r})([a.CustomElement({tagName:"solely-steps",template:r.__SOLELY_IR__,styles:s.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"current",type:"number",default:0},{name:"direction",type:"string",default:"horizontal"},{name:"size",type:"string",default:"medium"},{name:"items",type:"string",default:"[]"},{name:"progressDot",type:"boolean",default:!1}]})],exports.SolelySteps);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=Object.defineProperty,e=(e,s,r)=>((e,s,r)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r)(e,"symbol"!=typeof s?s+"":s,r);import s from"./style.css.js";import{__SOLELY_IR__ as r}from"./index.html.js";import{safeJsonParse as i}from"../utils/helpers.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as o}from"../../../runtime/component/decorators.js";var n=Object.defineProperty;Object.getOwnPropertyDescriptor;let l=class extends a{constructor(){super(...arguments),e(this,"slotObserver"),e(this,"slotInitTimer")}get current(){return this.$data.current}set current(t){this.$data.current=t,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:t}}))}getStepsClasses(){const t={};return this.$data.direction&&(t[`steps--${this.$data.direction}`]=!0),t["steps--dot"]=!!this.$data.progressDot,"small"===this.$data.size?t["steps--sm"]=!0:"large"===this.$data.size
|
|
1
|
+
var t=Object.defineProperty,e=(e,s,r)=>((e,s,r)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r)(e,"symbol"!=typeof s?s+"":s,r);import s from"./style.css.js";import{__SOLELY_IR__ as r}from"./index.html.js";import{safeJsonParse as i}from"../utils/helpers.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as o}from"../../../runtime/component/decorators.js";var n=Object.defineProperty;Object.getOwnPropertyDescriptor;let l=class extends a{constructor(){super(...arguments),e(this,"slotObserver"),e(this,"slotInitTimer")}get current(){return this.$data.current}set current(t){this.$data.current=t,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:t}}))}getStepsClasses(){const t={};return this.$data.direction&&(t[`steps--${this.$data.direction}`]=!0),t["steps--dot"]=!!this.$data.progressDot,"small"===this.$data.size?t["steps--sm"]=!0:"large"===this.$data.size?t["steps--lg"]=!0:t["steps--md"]=!0,t["use-slot"]=this.$data.useSlot,t}getStepClasses(t,e){const s=this.getStepStatus(e);return{"step--wait":"wait"===s,"step--process":"process"===s,"step--finish":"finish"===s,"step--error":"error"===s,"step--disabled":!!t.disabled}}getSlotStepClasses(t,e){const s=this.getSlotStepStatus(e);return{"step--wait":"wait"===s,"step--process":"process"===s,"step--finish":"finish"===s,"step--error":"error"===s,"step--disabled":!!t.disabled}}getIconClasses(t){const e={};return t.icon&&t.color&&l.PRESET_COLORS.includes(t.color)&&(e[`step__icon-wrapper--${t.color}`]=!0),e}getIconStyle(t){return t.icon&&t.color?l.PRESET_COLORS.includes(t.color)?"":`color: ${t.color}; background-color: ${t.color}15;`:""}collectSlotItems(){const t=Array.from(this.children).filter(t=>t.hasAttribute("data-step"));0!==t.length?(this.$data.useSlot=!0,this.$data.slotItems=t.map((t,e)=>{var s;const r=t;return{step:r.getAttribute("data-step")||String(e+1),title:r.getAttribute("data-title")||(null==(s=r.textContent)?void 0:s.trim())||"",description:r.getAttribute("data-description")||void 0,disabled:r.hasAttribute("disabled"),iconHtml:r.innerHTML}})):this.$data.useSlot=!1}mounted(){this.refresh(),this.setupSlotObserver()}getParsedItems(){const t=this.$data.items;return Array.isArray(t)?t:"string"==typeof t&&t?i(t,[]):[]}setupSlotObserver(){this.slotInitTimer=setTimeout(()=>{this.collectSlotItems(),this.slotInitTimer=void 0},0),this.slotObserver=new MutationObserver(()=>{this.collectSlotItems()}),this.slotObserver.observe(this,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["data-step","data-title","data-description","disabled"]})}unmounted(){this.slotObserver&&this.slotObserver.disconnect(),this.slotInitTimer&&(clearTimeout(this.slotInitTimer),this.slotInitTimer=void 0)}getStepStatus(t){const e=this.$data.current||0,s=this.getParsedItems();if(!Array.isArray(s)||t<0||t>=s.length)return"wait";const r=s[t];return(null==r?void 0:r.status)?r.status:t<e?"finish":t===e?"process":"wait"}getSlotStepStatus(t){const e=this.$data.current||0;return t<e?"finish":t===e?"process":"wait"}getStepIcon(t,e){if(t.icon)return t.icon;const s=this.getStepStatus(e);return"finish"===s?"✓":"error"===s?"✕":String(e+1)}handleStepClick(t,e){t.disabled||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:e,item:t}})))}handleSlotStepClick(t,e){t.disabled||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:e,item:t}})))}setCurrent(t){this.$data.current=t}getCurrent(){return this.$data.current}next(){const t=this.$data.useSlot?this.$data.slotItems.length-1:this.getParsedItems().length-1;this.$data.current<t&&this.$data.current++}prev(){this.$data.current>0&&this.$data.current--}setItems(t){this.$data.items=JSON.stringify(t),this.$data.useSlot=!1,this.refresh()}};var d,c,u;u=["blue","green","red","orange","gray"],(c="PRESET_COLORS")in(d=l)?n(d,c,{enumerable:!0,configurable:!0,writable:!0,value:u}):d[c]=u,l=((t,e)=>{for(var s,r=e,i=t.length-1;i>=0;i--)(s=t[i])&&(r=s(r)||r);return r})([o({tagName:"solely-steps",template:r,styles:s,shadowDOM:{use:!0,mode:"open"},props:[{name:"current",type:"number",default:0},{name:"direction",type:"string",default:"horizontal"},{name:"size",type:"string",default:"medium"},{name:"items",type:"string",default:"[]"},{name:"progressDot",type:"boolean",default:!1}]})],l);export{l as SolelySteps};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type StepsDirection = 'horizontal' | 'vertical';
|
|
2
|
-
export type StepsSize = '
|
|
2
|
+
export type StepsSize = 'small' | 'medium' | 'large';
|
|
3
3
|
export type StepStatus = 'wait' | 'process' | 'finish' | 'error';
|
|
4
4
|
export interface StepItem {
|
|
5
5
|
title: string;
|
|
@@ -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"),r=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyTable=class extends s.default{getTableClasses(){const e={};return"small"===this.$data.size?e["table--sm"]=!0:"large"===this.$data.size?e["table--lg"]=!0:e["table--md"]=!0,e["table--bordered"]=!!this.$data.bordered,e["is-loading"]=!!this.$data.loading,e["table--striped"]=!!this.$data.striped,e["table--clickable"]=!!this.$data.rowClickable,e}getParsedColumns(){const e=this.$data.columns;return Array.isArray(e)?e:"string"==typeof e&&e?a.safeJsonParse(e,[]):[]}getParsedDataSource(){const e=this.$data.dataSource;return Array.isArray(e)?e:"string"==typeof e&&e?a.safeJsonParse(e,[]):[]}getThClasses(e){const t={};return"left"===e.fixed&&(t["fixed-left"]=!0),"right"===e.fixed&&(t["fixed-right"]=!0),t[`align-${e.align||"left"}`]=!0,t}getTdClasses(e){const t={};return"left"===e.fixed&&(t["fixed-left"]=!0),"right"===e.fixed&&(t["fixed-right"]=!0),t[`align-${e.align||"left"}`]=!0,t}mounted(){this.refresh()}getCellValue(e,t){return e[t.dataIndex]}handleRowClick(e,t){this.$data.rowClickable&&(this.emit("row-click",{row:e,index:t}),this.dispatchEvent(new Event("click",{bubbles:!0,composed:!0})))}setColumns(e){this.$data.columns=JSON.stringify(e)}setDataSource(e){this.$data.dataSource=JSON.stringify(e)}getDataSource(){return this.getParsedDataSource()}},exports.SolelyTable=((e,t)=>{for(var a,s=t,r=e.length-1;r>=0;r--)(a=e[r])&&(s=a(s)||s);return s})([r.CustomElement({tagName:"solely-table",template:t.__SOLELY_IR__,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"columns",type:"string"},{name:"dataSource",type:"string"},{name:"size",type:"string"},{name:"bordered",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"striped",type:"boolean",default:!1},{name:"rowClickable",type:"boolean",default:!1},{name:"rowKey",type:"string"}]})],exports.SolelyTable);
|
|
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"),r=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyTable=class extends s.default{getTableClasses(){const e={};return"small"===this.$data.size?e["table--sm"]=!0:"large"===this.$data.size?e["table--lg"]=!0:e["table--md"]=!0,e["table--bordered"]=!!this.$data.bordered,e["is-loading"]=!!this.$data.loading,e["table--striped"]=!!this.$data.striped,e["table--clickable"]=!!this.$data.rowClickable,e}getParsedColumns(){const e=this.$data.columns;return Array.isArray(e)?e:"string"==typeof e&&e?a.safeJsonParse(e,[]):[]}getParsedDataSource(){const e=this.$data.dataSource;return Array.isArray(e)?e:"string"==typeof e&&e?a.safeJsonParse(e,[]):[]}getThClasses(e){const t={};return"left"===e.fixed&&(t["fixed-left"]=!0),"right"===e.fixed&&(t["fixed-right"]=!0),t[`align-${e.align||"left"}`]=!0,t}getTdClasses(e){const t={};return"left"===e.fixed&&(t["fixed-left"]=!0),"right"===e.fixed&&(t["fixed-right"]=!0),t[`align-${e.align||"left"}`]=!0,t}mounted(){this.refresh()}getCellValue(e,t){return e[t.dataIndex]}handleRowClick(e,t){this.$data.rowClickable&&(this.emit("row-click",{row:e,index:t}),this.dispatchEvent(new Event("click",{bubbles:!0,composed:!0})))}setColumns(e){this.$data.columns=JSON.stringify(e)}setDataSource(e){this.$data.dataSource=JSON.stringify(e)}getDataSource(){return this.getParsedDataSource()}},exports.SolelyTable=((e,t)=>{for(var a,s=t,r=e.length-1;r>=0;r--)(a=e[r])&&(s=a(s)||s);return s})([r.CustomElement({tagName:"solely-table",template:t.__SOLELY_IR__,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"columns",type:"string"},{name:"dataSource",type:"string"},{name:"size",type:"string",default:"medium"},{name:"bordered",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"striped",type:"boolean",default:!1},{name:"rowClickable",type:"boolean",default:!1},{name:"rowKey",type:"string"}]})],exports.SolelyTable);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./style.css.js";import{__SOLELY_IR__ as t}from"./index.html.js";import{safeJsonParse as a}from"../utils/helpers.js";import r from"../../../runtime/component/base-element.js";import{CustomElement as s}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let i=class extends r{getTableClasses(){const e={};return"small"===this.$data.size?e["table--sm"]=!0:"large"===this.$data.size?e["table--lg"]=!0:e["table--md"]=!0,e["table--bordered"]=!!this.$data.bordered,e["is-loading"]=!!this.$data.loading,e["table--striped"]=!!this.$data.striped,e["table--clickable"]=!!this.$data.rowClickable,e}getParsedColumns(){const e=this.$data.columns;return Array.isArray(e)?e:"string"==typeof e&&e?a(e,[]):[]}getParsedDataSource(){const e=this.$data.dataSource;return Array.isArray(e)?e:"string"==typeof e&&e?a(e,[]):[]}getThClasses(e){const t={};return"left"===e.fixed&&(t["fixed-left"]=!0),"right"===e.fixed&&(t["fixed-right"]=!0),t[`align-${e.align||"left"}`]=!0,t}getTdClasses(e){const t={};return"left"===e.fixed&&(t["fixed-left"]=!0),"right"===e.fixed&&(t["fixed-right"]=!0),t[`align-${e.align||"left"}`]=!0,t}mounted(){this.refresh()}getCellValue(e,t){return e[t.dataIndex]}handleRowClick(e,t){this.$data.rowClickable&&(this.emit("row-click",{row:e,index:t}),this.dispatchEvent(new Event("click",{bubbles:!0,composed:!0})))}setColumns(e){this.$data.columns=JSON.stringify(e)}setDataSource(e){this.$data.dataSource=JSON.stringify(e)}getDataSource(){return this.getParsedDataSource()}};i=((e,t)=>{for(var a,r=t,s=e.length-1;s>=0;s--)(a=e[s])&&(r=a(r)||r);return r})([s({tagName:"solely-table",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"columns",type:"string"},{name:"dataSource",type:"string"},{name:"size",type:"string"},{name:"bordered",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"striped",type:"boolean",default:!1},{name:"rowClickable",type:"boolean",default:!1},{name:"rowKey",type:"string"}]})],i);export{i as SolelyTable};
|
|
1
|
+
import e from"./style.css.js";import{__SOLELY_IR__ as t}from"./index.html.js";import{safeJsonParse as a}from"../utils/helpers.js";import r from"../../../runtime/component/base-element.js";import{CustomElement as s}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let i=class extends r{getTableClasses(){const e={};return"small"===this.$data.size?e["table--sm"]=!0:"large"===this.$data.size?e["table--lg"]=!0:e["table--md"]=!0,e["table--bordered"]=!!this.$data.bordered,e["is-loading"]=!!this.$data.loading,e["table--striped"]=!!this.$data.striped,e["table--clickable"]=!!this.$data.rowClickable,e}getParsedColumns(){const e=this.$data.columns;return Array.isArray(e)?e:"string"==typeof e&&e?a(e,[]):[]}getParsedDataSource(){const e=this.$data.dataSource;return Array.isArray(e)?e:"string"==typeof e&&e?a(e,[]):[]}getThClasses(e){const t={};return"left"===e.fixed&&(t["fixed-left"]=!0),"right"===e.fixed&&(t["fixed-right"]=!0),t[`align-${e.align||"left"}`]=!0,t}getTdClasses(e){const t={};return"left"===e.fixed&&(t["fixed-left"]=!0),"right"===e.fixed&&(t["fixed-right"]=!0),t[`align-${e.align||"left"}`]=!0,t}mounted(){this.refresh()}getCellValue(e,t){return e[t.dataIndex]}handleRowClick(e,t){this.$data.rowClickable&&(this.emit("row-click",{row:e,index:t}),this.dispatchEvent(new Event("click",{bubbles:!0,composed:!0})))}setColumns(e){this.$data.columns=JSON.stringify(e)}setDataSource(e){this.$data.dataSource=JSON.stringify(e)}getDataSource(){return this.getParsedDataSource()}};i=((e,t)=>{for(var a,r=t,s=e.length-1;s>=0;s--)(a=e[s])&&(r=a(r)||r);return r})([s({tagName:"solely-table",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"columns",type:"string"},{name:"dataSource",type:"string"},{name:"size",type:"string",default:"medium"},{name:"bordered",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"striped",type:"boolean",default:!1},{name:"rowClickable",type:"boolean",default:!1},{name:"rowKey",type:"string"}]})],i);export{i as SolelyTable};
|
|
@@ -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("../utils/helpers.cjs"),a=require("../../../runtime/component/base-element.cjs"),i=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyTabs=class extends a.default{get activeKey(){return this.$data.activeKey}set activeKey(e){this.$data.activeKey=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{activeKey:e}}))}getTabsClasses(){const e={};return this.$data.type&&(e[`tabs--${this.$data.type}`]=!0),"small"===this.$data.size?e["tabs--sm"]=!0:"large"===this.$data.size?e["tabs--lg"]=!0:e["tabs--md"]=!0,e}getTabClasses(e){return{"tabs__tab--active":e.key===this.$data.activeKey,"tabs__tab--disabled":!!e.disabled}}getPaneClasses(e){return{"tabs__pane--active":e.key===this.$data.activeKey}}mounted(){this.refresh();const e=this.getParsedItems();if(!this.$data.activeKey&&Array.isArray(e)&&e.length>0){const t=e[0];t&&t.key&&(this.$data.activeKey=t.key)}}getParsedItems(){const e=this.$data.items;return Array.isArray(e)?e:"string"==typeof e&&e?s.safeJsonParse(e,[]):[]}handleTabClick(e){e.disabled||(this.$data.activeKey=e.key,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleClose(e,t){t.stopPropagation();const s=this.getParsedItems(),a=s.findIndex(t=>t.key===e.key);if(a>-1){if(s.splice(a,1),this.$data.activeKey===e.key&&Array.isArray(s)&&s.length>0){const e=s[Math.min(a,s.length-1)];e&&e.key&&(this.$data.activeKey=e.key)}this.$data.items=JSON.stringify(s)}this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0,detail:{key:e.key,label:e.label}}))}handleAdd(){const e=this.getParsedItems(),t=e.length+1,s={key:`new-${Date.now()}`,label:`新标签 ${t}`};e.push(s),this.$data.activeKey=s.key,this.$data.items=JSON.stringify(e),this.dispatchEvent(new CustomEvent("add",{bubbles:!0,composed:!0,detail:{key:s.key,label:s.label}}))}setActiveKey(e){this.$data.activeKey=e}getActiveKey(){return this.$data.activeKey}setItems(e){this.$data.items=JSON.stringify(e),this.refresh()}},exports.SolelyTabs=((e,t)=>{for(var s,a=t,i=e.length-1;i>=0;i--)(s=e[i])&&(a=s(a)||a);return a})([i.CustomElement({tagName:"solely-tabs",template:t.__SOLELY_IR__,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"activeKey",type:"string",default:""},{name:"type",type:"string",default:"line"},{name:"position",type:"string",default:"top"},{name:"size",type:"string",default:"
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),s=require("../utils/helpers.cjs"),a=require("../../../runtime/component/base-element.cjs"),i=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyTabs=class extends a.default{get activeKey(){return this.$data.activeKey}set activeKey(e){this.$data.activeKey=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{activeKey:e}}))}getTabsClasses(){const e={};return this.$data.type&&(e[`tabs--${this.$data.type}`]=!0),"small"===this.$data.size?e["tabs--sm"]=!0:"large"===this.$data.size?e["tabs--lg"]=!0:e["tabs--md"]=!0,e}getTabClasses(e){return{"tabs__tab--active":e.key===this.$data.activeKey,"tabs__tab--disabled":!!e.disabled}}getPaneClasses(e){return{"tabs__pane--active":e.key===this.$data.activeKey}}mounted(){this.refresh();const e=this.getParsedItems();if(!this.$data.activeKey&&Array.isArray(e)&&e.length>0){const t=e[0];t&&t.key&&(this.$data.activeKey=t.key)}}getParsedItems(){const e=this.$data.items;return Array.isArray(e)?e:"string"==typeof e&&e?s.safeJsonParse(e,[]):[]}handleTabClick(e){e.disabled||(this.$data.activeKey=e.key,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleClose(e,t){t.stopPropagation();const s=this.getParsedItems(),a=s.findIndex(t=>t.key===e.key);if(a>-1){if(s.splice(a,1),this.$data.activeKey===e.key&&Array.isArray(s)&&s.length>0){const e=s[Math.min(a,s.length-1)];e&&e.key&&(this.$data.activeKey=e.key)}this.$data.items=JSON.stringify(s)}this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0,detail:{key:e.key,label:e.label}}))}handleAdd(){const e=this.getParsedItems(),t=e.length+1,s={key:`new-${Date.now()}`,label:`新标签 ${t}`};e.push(s),this.$data.activeKey=s.key,this.$data.items=JSON.stringify(e),this.dispatchEvent(new CustomEvent("add",{bubbles:!0,composed:!0,detail:{key:s.key,label:s.label}}))}setActiveKey(e){this.$data.activeKey=e}getActiveKey(){return this.$data.activeKey}setItems(e){this.$data.items=JSON.stringify(e),this.refresh()}},exports.SolelyTabs=((e,t)=>{for(var s,a=t,i=e.length-1;i>=0;i--)(s=e[i])&&(a=s(a)||a);return a})([i.CustomElement({tagName:"solely-tabs",template:t.__SOLELY_IR__,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"activeKey",type:"string",default:""},{name:"type",type:"string",default:"line"},{name:"position",type:"string",default:"top"},{name:"size",type:"string",default:"medium"},{name:"items",type:"string",default:"[]"},{name:"closable",type:"boolean",default:!1},{name:"addable",type:"boolean",default:!1}]})],exports.SolelyTabs);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./style.css.js";import{__SOLELY_IR__ as 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 activeKey(){return this.$data.activeKey}set activeKey(e){this.$data.activeKey=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{activeKey:e}}))}getTabsClasses(){const e={};return this.$data.type&&(e[`tabs--${this.$data.type}`]=!0),"small"===this.$data.size?e["tabs--sm"]=!0:"large"===this.$data.size?e["tabs--lg"]=!0:e["tabs--md"]=!0,e}getTabClasses(e){return{"tabs__tab--active":e.key===this.$data.activeKey,"tabs__tab--disabled":!!e.disabled}}getPaneClasses(e){return{"tabs__pane--active":e.key===this.$data.activeKey}}mounted(){this.refresh();const e=this.getParsedItems();if(!this.$data.activeKey&&Array.isArray(e)&&e.length>0){const t=e[0];t&&t.key&&(this.$data.activeKey=t.key)}}getParsedItems(){const e=this.$data.items;return Array.isArray(e)?e:"string"==typeof e&&e?a(e,[]):[]}handleTabClick(e){e.disabled||(this.$data.activeKey=e.key,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleClose(e,t){t.stopPropagation();const a=this.getParsedItems(),s=a.findIndex(t=>t.key===e.key);if(s>-1){if(a.splice(s,1),this.$data.activeKey===e.key&&Array.isArray(a)&&a.length>0){const e=a[Math.min(s,a.length-1)];e&&e.key&&(this.$data.activeKey=e.key)}this.$data.items=JSON.stringify(a)}this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0,detail:{key:e.key,label:e.label}}))}handleAdd(){const e=this.getParsedItems(),t=e.length+1,a={key:`new-${Date.now()}`,label:`新标签 ${t}`};e.push(a),this.$data.activeKey=a.key,this.$data.items=JSON.stringify(e),this.dispatchEvent(new CustomEvent("add",{bubbles:!0,composed:!0,detail:{key:a.key,label:a.label}}))}setActiveKey(e){this.$data.activeKey=e}getActiveKey(){return this.$data.activeKey}setItems(e){this.$data.items=JSON.stringify(e),this.refresh()}};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-tabs",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"activeKey",type:"string",default:""},{name:"type",type:"string",default:"line"},{name:"position",type:"string",default:"top"},{name:"size",type:"string",default:"
|
|
1
|
+
import e from"./style.css.js";import{__SOLELY_IR__ as 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 activeKey(){return this.$data.activeKey}set activeKey(e){this.$data.activeKey=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{activeKey:e}}))}getTabsClasses(){const e={};return this.$data.type&&(e[`tabs--${this.$data.type}`]=!0),"small"===this.$data.size?e["tabs--sm"]=!0:"large"===this.$data.size?e["tabs--lg"]=!0:e["tabs--md"]=!0,e}getTabClasses(e){return{"tabs__tab--active":e.key===this.$data.activeKey,"tabs__tab--disabled":!!e.disabled}}getPaneClasses(e){return{"tabs__pane--active":e.key===this.$data.activeKey}}mounted(){this.refresh();const e=this.getParsedItems();if(!this.$data.activeKey&&Array.isArray(e)&&e.length>0){const t=e[0];t&&t.key&&(this.$data.activeKey=t.key)}}getParsedItems(){const e=this.$data.items;return Array.isArray(e)?e:"string"==typeof e&&e?a(e,[]):[]}handleTabClick(e){e.disabled||(this.$data.activeKey=e.key,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleClose(e,t){t.stopPropagation();const a=this.getParsedItems(),s=a.findIndex(t=>t.key===e.key);if(s>-1){if(a.splice(s,1),this.$data.activeKey===e.key&&Array.isArray(a)&&a.length>0){const e=a[Math.min(s,a.length-1)];e&&e.key&&(this.$data.activeKey=e.key)}this.$data.items=JSON.stringify(a)}this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0,detail:{key:e.key,label:e.label}}))}handleAdd(){const e=this.getParsedItems(),t=e.length+1,a={key:`new-${Date.now()}`,label:`新标签 ${t}`};e.push(a),this.$data.activeKey=a.key,this.$data.items=JSON.stringify(e),this.dispatchEvent(new CustomEvent("add",{bubbles:!0,composed:!0,detail:{key:a.key,label:a.label}}))}setActiveKey(e){this.$data.activeKey=e}getActiveKey(){return this.$data.activeKey}setItems(e){this.$data.items=JSON.stringify(e),this.refresh()}};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-tabs",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"activeKey",type:"string",default:""},{name:"type",type:"string",default:"line"},{name:"position",type:"string",default:"top"},{name:"size",type:"string",default:"medium"},{name:"items",type:"string",default:"[]"},{name:"closable",type:"boolean",default:!1},{name:"addable",type:"boolean",default:!1}]})],n);export{n as SolelyTabs};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export type TabsType = 'line' | 'card';
|
|
5
5
|
export type TabsPosition = 'top' | 'right' | 'bottom' | 'left';
|
|
6
|
-
export type TabsSize = 'small' | '
|
|
6
|
+
export type TabsSize = 'small' | 'medium' | 'large';
|
|
7
7
|
export interface TabItem {
|
|
8
8
|
/** 标签页标题 */
|
|
9
9
|
label: string;
|