@rft-rc/recycle-ui 0.0.2-rc.1 → 0.0.2-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/search-area/index.vue.d.ts +31 -9
- package/dist/components/search-area/index.vue.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +647 -479
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -10,10 +10,22 @@ export interface FilterItem {
|
|
|
10
10
|
key: string;
|
|
11
11
|
/** 选项列表 */
|
|
12
12
|
options: FilterOption[] | string[];
|
|
13
|
-
/** 筛选类型:single 单选,multiple
|
|
14
|
-
type?: 'single' | 'multiple';
|
|
13
|
+
/** 筛选类型:single 单选,multiple 多选,tree-single 树形单选,tree-multiple 树形多选,input 输入框(默认 multiple) */
|
|
14
|
+
type?: 'single' | 'multiple' | 'tree-single' | 'tree-multiple' | 'input';
|
|
15
15
|
/** 多选时的列数(默认 2) */
|
|
16
16
|
column?: number;
|
|
17
|
+
/** 格式化 value,默认返回原始数据。为 string 时,会作为 key 从原始数据中获取值,相当于 (d) => d[format]。为函数时,以函数返回结果作为 value */
|
|
18
|
+
format?: ((data: FilterOption) => any) | string;
|
|
19
|
+
/** 渲染选项内容。为 string 时,返回 d[string]。为 function 时,返回函数结果 */
|
|
20
|
+
renderItem?: ((data: FilterOption) => any) | string;
|
|
21
|
+
/** 选中后在结果中显示的内容,默认和 renderItem 相同 */
|
|
22
|
+
renderResult?: ((data: FilterOption) => any) | string;
|
|
23
|
+
/** 树形数据下,指定子数据的属性名,有值时可以展示树形结构 */
|
|
24
|
+
childrenKey?: string;
|
|
25
|
+
/** 输入框类型的占位符(仅 type='input' 时有效) */
|
|
26
|
+
placeholder?: string;
|
|
27
|
+
/** 是否使用插槽自定义渲染,为 true 时使用名为 key 的插槽 */
|
|
28
|
+
slot?: boolean;
|
|
17
29
|
}
|
|
18
30
|
type __VLS_Props = {
|
|
19
31
|
/** 筛选项配置 */
|
|
@@ -22,8 +34,17 @@ type __VLS_Props = {
|
|
|
22
34
|
modelValue?: Record<string, any>;
|
|
23
35
|
/** 是否显示蒙层 */
|
|
24
36
|
showMask?: boolean;
|
|
37
|
+
/** 是否自动确认:为 true 时,每次修改立即触发 change 事件并关闭弹窗,不显示确定和重置按钮 */
|
|
38
|
+
autoConfirm?: boolean;
|
|
25
39
|
};
|
|
26
|
-
declare
|
|
40
|
+
declare var __VLS_14: string, __VLS_15: {
|
|
41
|
+
value: any;
|
|
42
|
+
'update:value': (val: any) => void;
|
|
43
|
+
};
|
|
44
|
+
type __VLS_Slots = {} & {
|
|
45
|
+
[K in NonNullable<typeof __VLS_14>]?: (props: typeof __VLS_15) => any;
|
|
46
|
+
};
|
|
47
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {
|
|
27
48
|
/** 获取当前筛选值 */
|
|
28
49
|
getValues: () => {
|
|
29
50
|
[x: string]: any;
|
|
@@ -33,19 +54,20 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {
|
|
|
33
54
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
34
55
|
"update:modelValue": (values: Record<string, any>) => any;
|
|
35
56
|
change: (values: Record<string, any>, item: FilterItem) => any;
|
|
36
|
-
confirm: (values: Record<string, any>, item: FilterItem) => any;
|
|
37
|
-
reset: (key?: string | undefined) => any;
|
|
38
|
-
"item-change": (key: string, value: any) => any;
|
|
39
57
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
40
58
|
"onUpdate:modelValue"?: ((values: Record<string, any>) => any) | undefined;
|
|
41
59
|
onChange?: ((values: Record<string, any>, item: FilterItem) => any) | undefined;
|
|
42
|
-
onConfirm?: ((values: Record<string, any>, item: FilterItem) => any) | undefined;
|
|
43
|
-
onReset?: ((key?: string | undefined) => any) | undefined;
|
|
44
|
-
"onItem-change"?: ((key: string, value: any) => any) | undefined;
|
|
45
60
|
}>, {
|
|
46
61
|
items: FilterItem[];
|
|
47
62
|
modelValue: Record<string, any>;
|
|
48
63
|
showMask: boolean;
|
|
64
|
+
autoConfirm: boolean;
|
|
49
65
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
66
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
50
67
|
export default _default;
|
|
68
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
69
|
+
new (): {
|
|
70
|
+
$slots: S;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
51
73
|
//# sourceMappingURL=index.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.vue.d.ts","sourceRoot":"","sources":["../../../src/components/search-area/index.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.vue.d.ts","sourceRoot":"","sources":["../../../src/components/search-area/index.vue"],"names":[],"mappings":"AAqoCA,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,GAAG,CAAC;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,YAAY;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,cAAc;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW;IACX,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,EAAE,CAAC;IACnC,4FAA4F;IAC5F,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,aAAa,GAAG,eAAe,GAAG,OAAO,CAAC;IACzE,mBAAmB;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gGAAgG;IAChG,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,KAAK,GAAG,CAAC,GAAG,MAAM,CAAC;IAChD,yDAAyD;IACzD,UAAU,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,KAAK,GAAG,CAAC,GAAG,MAAM,CAAC;IACpD,qCAAqC;IACrC,YAAY,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,KAAK,GAAG,CAAC,GAAG,MAAM,CAAC;IACtD,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uCAAuC;IACvC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,KAAK,WAAW,GAAG;IACjB,YAAY;IACZ,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,wBAAwB;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,aAAa;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yDAAyD;IACzD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAkhCF,QAAA,IAAI,QAAQ,QAAW,EAAE,QAAQ;;0BAvRV,GAAG;CAuRmB,CAAE;AAC/C,KAAK,WAAW,GAAG,EAAE,GACnB;KAAG,CAAC,IAAI,WAAW,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG;CAAE,CAAC;AAgD5E,QAAA,MAAM,eAAe;IAvcnB,cAAc;;;;IAEd,aAAa;;;;;;;;;WAtoBN,UAAU,EAAE;gBAEN,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;cAErB,OAAO;iBAEJ,OAAO;6EA8kCrB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAa1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),me={key:0,class:"rc-icon__unicode"},fe=e.defineComponent({name:"rc-icon",__name:"index",props:{name:{},size:{default:16},color:{default:""},spin:{type:Boolean,default:!1},code:{default:""}},setup(t){const n=t,a=e.inject(W,{}),i=e.computed(()=>(a==null?void 0:a.iconClass)||"iconfont"),f=e.computed(()=>n.name||""),m=e.computed(()=>typeof n.size=="number"?`${n.size}px`:n.size||"16px"),u=e.computed(()=>({fontSize:m.value,color:n.color||void 0,lineHeight:1,fontFamily:(a==null?void 0:a.iconClass)||"iconfont"})),c=e.computed(()=>{const r=n.code;if(r==null||r===""||r===0)return"";if(typeof r=="number")return String.fromCharCode(r);const s=String(r).replace(/^0x/i,""),g=parseInt(s,16);return Number.isNaN(g)?"":String.fromCharCode(g)});return e.onMounted(()=>{if(typeof window>"u")return;const r=a&&a.iconCssUrl||H.iconCssUrl;if(!r)return;const s=`link[rel="stylesheet"][data-rcui-icon="true"][href="${r}"]`;if(!document.head.querySelector(s)){const v=document.createElement("link");v.rel="stylesheet",v.href=r,v.setAttribute("data-rcui-icon","true"),document.head.appendChild(v)}}),(r,s)=>(e.openBlock(),e.createElementBlock("i",{class:e.normalizeClass(["rc-icon",[i.value,f.value,{"rc-icon--spin":t.spin}]]),style:e.normalizeStyle(u.value),"aria-hidden":"true"},[c.value?(e.openBlock(),e.createElementBlock("span",me,e.toDisplayString(c.value),1)):e.createCommentVNode("",!0)],6))}}),E=(t,n)=>{const a=t.__vccOpts||t;for(const[i,f]of n)a[i]=f;return a},b=E(fe,[["__scopeId","data-v-3857a892"]]),pe=["disabled"],ve={key:0,class:"rc-button__spinner"},ye={key:0,class:"rc-button__icon rc-button__icon--prefix"},ke={key:2,class:"rc-button__icon rc-button__icon--suffix"},ge=e.defineComponent({__name:"index",props:{type:{default:"default"},size:{default:"medium"},mode:{default:void 0},block:{type:Boolean,default:!1},label:{default:""},round:{type:[Number,String,Boolean],default:6},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},preIcon:{default:""},suffixIcon:{default:""}},emits:["click"],setup(t,{emit:n}){const a=t,i=n,f=u=>{!a.disabled&&!a.loading&&i("click",u)},m=e.computed(()=>{const u=a.round;return typeof u=="boolean"?u?"999px":"6px":typeof u=="number"?`${u}px`:String(u)});return(u,c)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["rc-button",[`rc-button--${t.type}`,`rc-button--${t.size}`,t.mode?`rc-button--${t.mode}`:"",{"is-block":t.block,"is-disabled":t.disabled,"is-loading":t.loading}]]),style:e.normalizeStyle({borderRadius:m.value}),disabled:t.disabled||t.loading,onClick:f},[t.loading?(e.openBlock(),e.createElementBlock("span",ve)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.preIcon||u.$slots.preIcon?(e.openBlock(),e.createElementBlock("span",ye,[e.renderSlot(u.$slots,"preIcon",{},()=>[t.preIcon?(e.openBlock(),e.createBlock(b,{key:0,name:t.preIcon},null,8,["name"])):e.createCommentVNode("",!0)],!0)])):e.createCommentVNode("",!0)],64)),e.renderSlot(u.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)],!0),!t.loading&&(t.suffixIcon||u.$slots.suffixIcon)?(e.openBlock(),e.createElementBlock("span",ke,[e.renderSlot(u.$slots,"suffixIcon",{},()=>[t.suffixIcon?(e.openBlock(),e.createBlock(b,{key:0,name:t.suffixIcon},null,8,["name"])):e.createCommentVNode("",!0)],!0)])):e.createCommentVNode("",!0)],14,pe))}}),I=E(ge,[["__scopeId","data-v-3ed3109f"]]);I.name="rc-button";function U(t){return t.component(I.name,I),t}const he={class:"rc-desc-item__value"},_e=e.defineComponent({name:"rc-descriptions-item",__name:"item",props:{label:{default:""},value:{default:""},labelWidth:{default:""},span:{default:1}},setup(t){const n=t;e.inject("rcDescItemWidth",void 0),e.inject("rcDescSingleWidth",""),e.inject("rcDescGap","0px");const a=e.inject("rcDescGapPx",0),i=e.inject("rcDescColCount",1),f=e.inject("rcDescLabelWidth",""),m=e.computed(()=>{const r=typeof n.span=="string"?parseInt(n.span,10):n.span,s=typeof(i==null?void 0:i.value)=="number"?i.value:i,g=!Number.isNaN(r)&&r>0?r:1;return Math.min(g,s||1)}),u=e.computed(()=>{const r=typeof(i==null?void 0:i.value)=="number"?i.value:i,s=typeof(a==null?void 0:a.value)=="number"?a.value:a,g=m.value;if(!r||r<=1||g>=r)return"100%";const v=(r-1)*s,k=(g-1)*s;return`calc((100% - ${v}px) * ${g} / ${r} + ${k}px)`}),c=e.computed(()=>{const r=typeof(f==null?void 0:f.value)=="string"?f.value:f,s=n.labelWidth!==""?n.labelWidth:r||"";return s?{width:typeof s=="number"?`${s}px`:String(s),flex:"0 0 auto"}:{}});return(r,s)=>(e.openBlock(),e.createElementBlock("div",{class:"rc-desc-item",style:e.normalizeStyle({width:u.value,flex:`0 0 ${u.value}`})},[e.createElementVNode("div",{class:"rc-desc-item__label",style:e.normalizeStyle(c.value)},[e.renderSlot(r.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)],!0)],4),e.createElementVNode("div",he,[e.renderSlot(r.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.value),1)],!0)])],4))}}),N=E(_e,[["__scopeId","data-v-970d0b99"]]),be={class:"rc-descriptions"},Be={key:0,class:"rc-descriptions__title"},Ce=e.defineComponent({name:"rc-descriptions",__name:"index",props:{title:{},column:{default:2},gap:{default:4},labelWidth:{default:""},data:{default:()=>[]},keyMap:{}},setup(t){const n=t,a=e.ref(null),i=e.computed(()=>typeof n.gap=="number"?`${n.gap}px`:String(n.gap)),f=e.computed(()=>{const s=typeof n.column=="string"?Number.parseInt(n.column,10):n.column??1;return!Number.isNaN(s)&&s>0?s:1}),m=e.ref("100%"),u=e.ref("100%");e.watchEffect(()=>{const s=f.value;if(s<=1)m.value="100%",u.value="100%";else{const g=typeof n.gap=="number"?n.gap:parseFloat(String(n.gap))||0,k=`calc((100% - ${(s-1)*g}px) / ${s})`;u.value=k,m.value=k}}),e.provide("rcDescItemWidth",m),e.provide("rcDescSingleWidth",u),e.provide("rcDescColCount",f),e.provide("rcDescGapPx",e.computed(()=>typeof n.gap=="number"?n.gap:parseFloat(String(n.gap))||0));const c=e.computed(()=>n.labelWidth===""||n.labelWidth===void 0?"":typeof n.labelWidth=="number"?`${n.labelWidth}px`:String(n.labelWidth));e.provide("rcDescLabelWidth",c),e.provide("rcDescGap",e.computed(()=>typeof n.gap=="number"?`${n.gap}px`:String(n.gap)));const r=e.computed(()=>{var v,k,y;const s=((v=n.keyMap)==null?void 0:v.key)??"label",g=((k=n.keyMap)==null?void 0:k.value)??"value";return(y=n.data)!=null&&y.length?n.data.map(C=>({label:C==null?void 0:C[s],value:C==null?void 0:C[g]})):[]});return(s,g)=>(e.openBlock(),e.createElementBlock("div",be,[s.$slots.title||t.title?(e.openBlock(),e.createElementBlock("div",Be,[e.renderSlot(s.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)],!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"rc-descriptions__body",style:e.normalizeStyle({gap:i.value}),ref_key:"wrapEl",ref:a},[r.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(r.value,(v,k)=>(e.openBlock(),e.createBlock(N,{key:k,label:v.label,value:v.value,"label-width":t.labelWidth},null,8,["label","value","label-width"]))),128)):e.renderSlot(s.$slots,"default",{key:1},void 0,!0)],4)]))}}),D=E(Ce,[["__scopeId","data-v-5fcaa235"]]);D.name="rc-descriptions";N.name="rc-descriptions-item";function O(t){return t.component(D.name,D),t.component("RcDescriptions",D),t.component(N.name,N),t.component("RcDescriptionsItem",N),t}const ee=D,te=N,$e={class:"rc-card__title"},Se={class:"rc-card__title-text"},Ee={key:0,class:"rc-card__status"},Ve={key:1,class:"rc-card__divider"},xe={key:2,class:"rc-card__action"},Ne=e.defineComponent({name:"rc-card",__name:"index",props:{color:{default:"var(--rc-white)"},topBgColor:{default:"rgba(29, 133, 252, 0.05)"},title:{default:""},status:{default:""},statusColor:{default:"var(--rc-primary)"},round:{default:8},bordered:{type:Boolean,default:!1},elevation:{default:2},padding:{default:"16px"},gap:{default:12},width:{default:"100%"},height:{default:""}},setup(t){const n=t,a=e.computed(()=>{const c=typeof n.round=="boolean"?n.round?"12px":"0":typeof n.round=="number"?`${n.round}px`:String(n.round);return{backgroundColor:n.color||"var(--rc-white)",borderRadius:c,boxShadow:u(n.elevation),width:m(n.width),height:m(n.height)}}),i=e.computed(()=>n.padding||"16px"),f=e.computed(()=>typeof n.gap=="number"?`${n.gap}px`:String(n.gap));function m(c){return c==null||c===""?"":typeof c=="number"?`${c}px`:String(c)}function u(c){if(!c||c<=0)return"none";const r=4*c;return`0 ${Math.round(r/2)}px ${r}px rgba(0,0,0,0.06), 0 ${Math.round(r/4)}px ${Math.round(r/2)}px rgba(0,0,0,0.04)`}return(c,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["rc-card",[{"rc-card--bordered":t.bordered}]]),style:e.normalizeStyle(a.value)},[c.$slots.title||t.title||c.$slots.status||t.status?(e.openBlock(),e.createElementBlock("div",{key:0,class:"rc-card__top",style:e.normalizeStyle({backgroundColor:t.topBgColor||"rgba(29, 133, 252, 0.05)"})},[e.createElementVNode("div",$e,[e.renderSlot(c.$slots,"title",{},()=>[e.createElementVNode("span",Se,e.toDisplayString(t.title),1)],!0)]),c.$slots.status||t.status?(e.openBlock(),e.createElementBlock("div",Ee,[e.renderSlot(c.$slots,"status",{},()=>[e.createElementVNode("span",{class:"rc-card__status-text",style:e.normalizeStyle({color:t.statusColor||"var(--rc-primary)"})},e.toDisplayString(t.status),5)],!0)])):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"rc-card__body",style:e.normalizeStyle({padding:i.value,gap:f.value})},[e.renderSlot(c.$slots,"content",{},()=>[e.renderSlot(c.$slots,"default",{},void 0,!0)],!0)],4),c.$slots.action?(e.openBlock(),e.createElementBlock("div",Ve)):e.createCommentVNode("",!0),c.$slots.action?(e.openBlock(),e.createElementBlock("div",xe,[e.renderSlot(c.$slots,"action",{},void 0,!0)])):e.createCommentVNode("",!0)],6))}}),R=E(Ne,[["__scopeId","data-v-a7b95214"]]);R.name="rc-card";const we="RcCard";function j(t){return t.component(R.name,R),t.component(we,R),t}const Ie={key:0,class:"rc-toast__mask"},De={class:"rc-toast__content"},Re={key:0,class:"rc-toast__spinner"},ze={key:1,class:"rc-toast__icon rc-toast__icon--success"},Ae={key:2,class:"rc-toast__icon rc-toast__icon--fail"},Te={class:"rc-toast__text"},Le=e.defineComponent({__name:"index",props:{message:{default:""},type:{default:"text"},duration:{default:2e3},mask:{type:Boolean,default:!1},onAfterLeave:{}},setup(t,{expose:n}){const a=t,i=e.ref(!0);let f;function m(){f&&(clearTimeout(f),f=null)}function u(){m(),i.value=!1}return n({close:u}),e.onMounted(()=>{a.duration&&a.duration>0&&(f=setTimeout(()=>{u()},a.duration))}),e.onUnmounted(()=>{m()}),(c,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"rc-toast-fade",onAfterLeave:t.onAfterLeave},{default:e.withCtx(()=>[i.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["rc-toast",[`rc-toast--${t.type}`]])},[t.mask?(e.openBlock(),e.createElementBlock("div",Ie)):e.createCommentVNode("",!0),e.createElementVNode("div",De,[t.type==="loading"?(e.openBlock(),e.createElementBlock("div",Re)):t.type==="success"?(e.openBlock(),e.createElementBlock("div",ze)):t.type==="fail"?(e.openBlock(),e.createElementBlock("div",Ae)):e.createCommentVNode("",!0),e.createElementVNode("div",Te,e.toDisplayString(t.message),1)])],2)):e.createCommentVNode("",!0)]),_:1},8,["onAfterLeave"])])),e.renderSlot(c.$slots,"default",{},void 0,!0)],64))}}),z=E(Le,[["__scopeId","data-v-d234c9c5"]]);let V=null,w=null;function X(){V&&(V.unmount(),V=null),w&&(document.body.removeChild(w),w=null)}function We(t){const n=typeof t=="string"?{message:t}:t||{};X(),w=document.createElement("div"),document.body.appendChild(w);const a={message:n.message,type:n.type??"text",duration:n.duration??2e3,mask:n.mask??!1,onAfterLeave:()=>{var i;X(),(i=n.onClose)==null||i.call(n)}};return V=e.createApp(z,a),V.mount(w),{close:ne}}function ne(){var t,n,a;V&&((a=(n=(t=V._instance)==null?void 0:t.exposed)==null?void 0:n.close)==null||a.call(n))}z.name="rc-toast";function Z(t){return t.component(z.name,z),t}const Me={class:"rc-message",role:"alert","aria-live":"polite"},Fe={class:"rc-message__content"},Ue=e.defineComponent({__name:"index",setup(t,{expose:n}){const a=e.reactive([]);let i=1;function f(u){const c=a.findIndex(r=>r.id===u);c>=0&&a.splice(c,1)}function m(u,c,r){const s=i++;return a.push({id:s,type:u,content:c,duration:r}),r>0&&window.setTimeout(()=>f(s),r),s}return n({add:m,remove:f}),(u,c)=>(e.openBlock(),e.createElementBlock("div",Me,[e.createVNode(e.TransitionGroup,{name:"rc-message-fade",tag:"div"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a,r=>(e.openBlock(),e.createElementBlock("div",{key:r.id,class:e.normalizeClass(["rc-message__item",`rc-message--${r.type}`])},[e.createElementVNode("span",Fe,e.toDisplayString(r.content),1)],2))),128))]),_:1})]))}}),Oe=E(Ue,[["__scopeId","data-v-87811df0"]]);let S=null,$=null;function je(){var n;if(S&&$)return;S=document.createElement("div"),document.body.appendChild(S);const t=e.createVNode(Oe,{});e.render(t,S),$=(n=t.component)==null?void 0:n.exposed}function x(t,n,a){var f;je();const i=typeof a=="number"?a:t==="loading"?0:2e3;return(f=$==null?void 0:$.add)==null?void 0:f.call($,t,n,i)}const oe={open(t){return x(t.type||"info",t.content,t.duration)},info(t,n){return x("info",t,n)},success(t,n){return x("success",t,n)},warning(t,n){return x("warning",t,n)},error(t,n){return x("error",t,n)},loading(t,n){return x("loading",t,n)},destroy(){S&&(e.render(null,S),S.remove(),S=null,$=null)}};function G(t){return t.config.globalProperties.$message=oe,t}b.name="rc-icon";function P(t){return t.component(b.name,b),t.component("RcIcon",b),t}const Ge={class:"rc-search-area"},Pe={class:"rc-search-area__bar"},Ye=["onClick"],qe={class:"rc-search-area__item-label"},He={class:"rc-search-area__panel-content"},Ke={key:0,class:"rc-search-area__options-grid"},Je=["onClick"],Qe={class:"rc-search-area__option-label"},Xe={key:1,class:"rc-search-area__options-grid"},Ze=["onClick"],et={class:"rc-search-area__option-label"},tt={key:2,class:"rc-search-area__empty"},nt={class:"rc-search-area__panel-footer"},ot=e.defineComponent({name:"rc-search-area",__name:"index",props:{items:{default:()=>[]},modelValue:{default:()=>({})},showMask:{type:Boolean,default:!0}},emits:["update:modelValue","change","confirm","reset","item-change"],setup(t,{expose:n,emit:a}){const i=t,f=a,m=e.ref(null),u=e.ref(null),c=e.ref(null),r=e.ref({top:"0px"}),s=async()=>{if(m.value===null||!u.value)return;await e.nextTick();const l=u.value.getBoundingClientRect().top;r.value={top:`${l}px`}},g=o=>{if(m.value===null||!u.value)return;const l=o.target;if(u.value.contains(l))return;const d=u.value.closest(".rc-search-area");if(d){const p=d.querySelector(".rc-search-area__bar");if(p&&p.contains(l))return}M()};e.watch(m,async o=>{o!==null?(await e.nextTick(),s(),window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),document.addEventListener("click",g,!0)):(window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0),document.removeEventListener("click",g,!0))}),e.onUnmounted(()=>{window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0),document.removeEventListener("click",g,!0)});const v=e.ref({}),k=e.ref({...i.modelValue});e.watch(()=>i.modelValue,o=>{k.value={...o||{}}},{deep:!0,immediate:!0});const y=e.computed(()=>m.value===null?null:i.items[m.value]),C=e.computed(()=>{if(!y.value)return"";const o=ue(y.value);return o>0?`(${o}项)`:""}),le=o=>{const l=k.value[o.key];if(l==null||l==="")return o.label;if(o.type==="single"){const d=J(o,l);if(d)return`${o.label}: ${A(d)}`}else{const d=Array.isArray(l)?l:[l];if(d.length>0){const p=d.map(h=>{const _=J(o,h);return _?A(_):null}).filter(h=>h!==null);if(p.length>0)return`${o.label}: ${p.join("、")}`}}return o.label},ae=o=>{const l=i.items[o];if(!l)return;if(m.value===o){m.value=null;return}const d=k.value[l.key];l.type==="single"?v.value[l.key]=d!==void 0?d:null:v.value[l.key]=d!==void 0?Array.isArray(d)?[...d]:[d]:[],m.value=o},M=()=>{m.value=null},A=o=>typeof o=="string"?o:o.label||String(o.value),T=o=>typeof o=="string"?o:o.value!==void 0?o.value:o,J=(o,l)=>o.options.find(d=>{const p=T(d);return p===l||String(p)===String(l)})||null,L=o=>{if(!y.value)return!1;const l=y.value.key,d=v.value[l],p=T(o);return y.value.type==="single"?d!=null&&d===p:(Array.isArray(d)?d:[]).some(_=>_===p||String(_)===String(p))},re=o=>{if(!y.value)return;const l=y.value.key,d=T(o);v.value[l]===d?v.value[l]=null:v.value[l]=d},ce=o=>{if(!y.value)return;const l=y.value.key,d=T(o),p=Array.isArray(v.value[l])?[...v.value[l]]:[],h=p.findIndex(_=>_===d||String(_)===String(d));h>=0?p.splice(h,1):p.push(d),v.value[l]=p},se=()=>{if(!y.value)return;const o=y.value.key;y.value.type==="single"?v.value[o]=null:v.value[o]=[]},ie=()=>{if(!y.value)return;const o=y.value.key,l=v.value[o],d=k.value[o];let p;y.value.type==="single"?(p=l??void 0,k.value[o]=p):(p=Array.isArray(l)&&l.length>0?l:void 0,k.value[o]=p),f("update:modelValue",{...k.value}),f("change",{...k.value},y.value),f("confirm",{...k.value},y.value),JSON.stringify(d)!==JSON.stringify(p)&&f("item-change",o,p),M()},Q=o=>{const l=k.value[o.key];return l==null||l===""?0:o.type==="single"?1:Array.isArray(l)?l.length:l?1:0},ue=o=>{const l=v.value[o.key];return l==null||l===""?0:o.type==="single"?1:Array.isArray(l)?l.length:0};return n({getValues:()=>({...k.value}),reset:()=>{k.value={},v.value={},f("update:modelValue",{}),f("change",{},null),f("reset")}}),(o,l)=>(e.openBlock(),e.createElementBlock("div",Ge,[e.createElementVNode("div",Pe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.items,(d,p)=>(e.openBlock(),e.createElementBlock("div",{key:p,class:e.normalizeClass(["rc-search-area__item",{"is-active":m.value===p,"has-value":Q(d)>0}]),onClick:h=>ae(p)},[e.createElementVNode("span",qe,e.toDisplayString(le(d)),1),e.createVNode(e.unref(b),{name:"icon_a-xiala2",color:m.value!==p&&Q(d)>0?"#1677ff":"#969799",class:e.normalizeClass(["rc-search-area__item-arrow",{"is-up":m.value===p}])},null,8,["color","class"])],10,Ye))),128))]),e.createVNode(e.Transition,{name:"rc-search-area-fade"},{default:e.withCtx(()=>[m.value!==null&&i.showMask?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"maskRef",ref:c,class:"rc-search-area__mask",style:e.normalizeStyle(r.value),onClick:M},null,4)):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{name:"rc-search-area-slide"},{default:e.withCtx(()=>{var d,p,h,_;return[m.value!==null?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"panelRef",ref:u,class:"rc-search-area__panel"},[e.createElementVNode("div",He,[((d=y.value)==null?void 0:d.type)==="single"?(e.openBlock(),e.createElementBlock("div",Ke,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value.options,(B,F)=>(e.openBlock(),e.createElementBlock("div",{key:F,class:e.normalizeClass(["rc-search-area__option",{"is-selected":L(B)}]),onClick:de=>re(B)},[e.createElementVNode("span",Qe,e.toDisplayString(A(B)),1),L(B)?(e.openBlock(),e.createBlock(e.unref(b),{key:0,name:"icon_select",class:"rc-search-area__option-check"})):e.createCommentVNode("",!0)],10,Je))),128))])):(e.openBlock(),e.createElementBlock("div",Xe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(((p=y.value)==null?void 0:p.options)||[],(B,F)=>(e.openBlock(),e.createElementBlock("div",{key:F,class:e.normalizeClass(["rc-search-area__option",{"is-selected":L(B)}]),onClick:de=>ce(B)},[e.createElementVNode("span",et,e.toDisplayString(A(B)),1),L(B)?(e.openBlock(),e.createBlock(e.unref(b),{key:0,name:"icon_select",class:"rc-search-area__option-check"})):e.createCommentVNode("",!0)],10,Ze))),128))])),((_=(h=y.value)==null?void 0:h.options)==null?void 0:_.length)===0?(e.openBlock(),e.createElementBlock("div",tt,[...l[0]||(l[0]=[e.createElementVNode("p",null,"暂无选项",-1)])])):e.createCommentVNode("",!0)]),e.createElementVNode("div",nt,[e.createVNode(e.unref(I),{block:"",onClick:se},{default:e.withCtx(()=>[...l[1]||(l[1]=[e.createTextVNode(" 重置 ",-1)])]),_:1}),e.createVNode(e.unref(I),{type:"primary",block:"",onClick:ie},{default:e.withCtx(()=>[e.createTextVNode(" 确定"+e.toDisplayString(C.value),1)]),_:1})])],512)):e.createCommentVNode("",!0)]}),_:1})]))}}),Y=E(ot,[["__scopeId","data-v-6a70650d"]]),q=t=>{t.component("RcSearchArea",Y),t.component("rc-search-area",Y)},W=Symbol("RECYCLE_UI_CONFIG"),H={prefix:"rc",autoRegister:!0,provideKey:W,theme:{},iconCssUrl:"//at.alicdn.com/t/c/font_4252799_9vcnw0pnmkh.css",iconClass:"iconfont"};function lt(t,n){n.autoRegister!==!1&&(typeof U=="function"&&U(t),typeof O=="function"&&O(t),typeof j=="function"&&j(t),typeof Z=="function"&&Z(t),typeof P=="function"&&P(t),typeof G=="function"&&G(t),typeof q=="function"&&q(t))}const K=(t,n)=>{const a={...H,...n||{}};if(t.provide(a.provideKey??W,a),t.config.globalProperties.$recycleUI=a,typeof window<"u"&&a.iconCssUrl){const i=`link[rel="stylesheet"][data-rcui-icon="true"][href="${a.iconCssUrl}"]`;if(!document.head.querySelector(i)){const m=document.createElement("link");m.rel="stylesheet",m.href=a.iconCssUrl,m.setAttribute("data-rcui-icon","true"),document.head.appendChild(m)}}return lt(t,a),t},at={install:K};function rt(t){return{install(n){K(n,t)}}}exports.RECYCLE_UI_SYMBOL=W;exports.RcButton=I;exports.RcCard=R;exports.RcDescriptions=ee;exports.RcDescriptionsItem=te;exports.RcIcon=b;exports.RcSearchArea=Y;exports.RcToast=z;exports.createRecycleUI=rt;exports.default=at;exports.defaultRecycleUIConfig=H;exports.hideToast=ne;exports.install=K;exports.installButton=U;exports.installCard=j;exports.installDescriptions=O;exports.installIcon=P;exports.installMessage=G;exports.installSearchArea=q;exports.message=oe;exports.rcDescriptions=ee;exports.rcDescriptionsItem=te;exports.showToast=We;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),Ie={key:0,class:"rc-icon__unicode"},De=e.defineComponent({name:"rc-icon",__name:"index",props:{name:{},size:{default:16},color:{default:""},spin:{type:Boolean,default:!1},code:{default:""}},setup(n){const r=n,c=e.inject(O,{}),u=e.computed(()=>(c==null?void 0:c.iconClass)||"iconfont"),m=e.computed(()=>r.name||""),v=e.computed(()=>typeof r.size=="number"?`${r.size}px`:r.size||"16px"),p=e.computed(()=>({fontSize:v.value,color:r.color||void 0,lineHeight:1,fontFamily:(c==null?void 0:c.iconClass)||"iconfont"})),d=e.computed(()=>{const s=r.code;if(s==null||s===""||s===0)return"";if(typeof s=="number")return String.fromCharCode(s);const f=String(s).replace(/^0x/i,""),B=parseInt(f,16);return Number.isNaN(B)?"":String.fromCharCode(B)});return e.onMounted(()=>{if(typeof window>"u")return;const s=c&&c.iconCssUrl||te.iconCssUrl;if(!s)return;const f=`link[rel="stylesheet"][data-rcui-icon="true"][href="${s}"]`;if(!document.head.querySelector(f)){const k=document.createElement("link");k.rel="stylesheet",k.href=s,k.setAttribute("data-rcui-icon","true"),document.head.appendChild(k)}}),(s,f)=>(e.openBlock(),e.createElementBlock("i",{class:e.normalizeClass(["rc-icon",[u.value,m.value,{"rc-icon--spin":n.spin}]]),style:e.normalizeStyle(p.value),"aria-hidden":"true"},[d.value?(e.openBlock(),e.createElementBlock("span",Ie,e.toDisplayString(d.value),1)):e.createCommentVNode("",!0)],6))}}),w=(n,r)=>{const c=n.__vccOpts||n;for(const[u,m]of r)c[u]=m;return c},C=w(De,[["__scopeId","data-v-3857a892"]]),Ae=["disabled"],Re={key:0,class:"rc-button__spinner"},ze={key:0,class:"rc-button__icon rc-button__icon--prefix"},Le={key:2,class:"rc-button__icon rc-button__icon--suffix"},Te=e.defineComponent({__name:"index",props:{type:{default:"default"},size:{default:"medium"},mode:{default:void 0},block:{type:Boolean,default:!1},label:{default:""},round:{type:[Number,String,Boolean],default:6},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},preIcon:{default:""},suffixIcon:{default:""}},emits:["click"],setup(n,{emit:r}){const c=n,u=r,m=p=>{!c.disabled&&!c.loading&&u("click",p)},v=e.computed(()=>{const p=c.round;return typeof p=="boolean"?p?"999px":"6px":typeof p=="number"?`${p}px`:String(p)});return(p,d)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["rc-button",[`rc-button--${n.type}`,`rc-button--${n.size}`,n.mode?`rc-button--${n.mode}`:"",{"is-block":n.block,"is-disabled":n.disabled,"is-loading":n.loading}]]),style:e.normalizeStyle({borderRadius:v.value}),disabled:n.disabled||n.loading,onClick:m},[n.loading?(e.openBlock(),e.createElementBlock("span",Re)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[n.preIcon||p.$slots.preIcon?(e.openBlock(),e.createElementBlock("span",ze,[e.renderSlot(p.$slots,"preIcon",{},()=>[n.preIcon?(e.openBlock(),e.createBlock(C,{key:0,name:n.preIcon},null,8,["name"])):e.createCommentVNode("",!0)],!0)])):e.createCommentVNode("",!0)],64)),e.renderSlot(p.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(n.label),1)],!0),!n.loading&&(n.suffixIcon||p.$slots.suffixIcon)?(e.openBlock(),e.createElementBlock("span",Le,[e.renderSlot(p.$slots,"suffixIcon",{},()=>[n.suffixIcon?(e.openBlock(),e.createBlock(C,{key:0,name:n.suffixIcon},null,8,["name"])):e.createCommentVNode("",!0)],!0)])):e.createCommentVNode("",!0)],14,Ae))}}),M=w(Te,[["__scopeId","data-v-3ed3109f"]]);M.name="rc-button";function q(n){return n.component(M.name,M),n}const Fe={class:"rc-desc-item__value"},Me=e.defineComponent({name:"rc-descriptions-item",__name:"item",props:{label:{default:""},value:{default:""},labelWidth:{default:""},span:{default:1}},setup(n){const r=n;e.inject("rcDescItemWidth",void 0),e.inject("rcDescSingleWidth",""),e.inject("rcDescGap","0px");const c=e.inject("rcDescGapPx",0),u=e.inject("rcDescColCount",1),m=e.inject("rcDescLabelWidth",""),v=e.computed(()=>{const s=typeof r.span=="string"?parseInt(r.span,10):r.span,f=typeof(u==null?void 0:u.value)=="number"?u.value:u,B=!Number.isNaN(s)&&s>0?s:1;return Math.min(B,f||1)}),p=e.computed(()=>{const s=typeof(u==null?void 0:u.value)=="number"?u.value:u,f=typeof(c==null?void 0:c.value)=="number"?c.value:c,B=v.value;if(!s||s<=1||B>=s)return"100%";const k=(s-1)*f,b=(B-1)*f;return`calc((100% - ${k}px) * ${B} / ${s} + ${b}px)`}),d=e.computed(()=>{const s=typeof(m==null?void 0:m.value)=="string"?m.value:m,f=r.labelWidth!==""?r.labelWidth:s||"";return f?{width:typeof f=="number"?`${f}px`:String(f),flex:"0 0 auto"}:{}});return(s,f)=>(e.openBlock(),e.createElementBlock("div",{class:"rc-desc-item",style:e.normalizeStyle({width:p.value,flex:`0 0 ${p.value}`})},[e.createElementVNode("div",{class:"rc-desc-item__label",style:e.normalizeStyle(d.value)},[e.renderSlot(s.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(n.label),1)],!0)],4),e.createElementVNode("div",Fe,[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(n.value),1)],!0)])],4))}}),T=w(Me,[["__scopeId","data-v-970d0b99"]]),We={class:"rc-descriptions"},Ue={key:0,class:"rc-descriptions__title"},je=e.defineComponent({name:"rc-descriptions",__name:"index",props:{title:{},column:{default:2},gap:{default:4},labelWidth:{default:""},data:{default:()=>[]},keyMap:{}},setup(n){const r=n,c=e.ref(null),u=e.computed(()=>typeof r.gap=="number"?`${r.gap}px`:String(r.gap)),m=e.computed(()=>{const f=typeof r.column=="string"?Number.parseInt(r.column,10):r.column??1;return!Number.isNaN(f)&&f>0?f:1}),v=e.ref("100%"),p=e.ref("100%");e.watchEffect(()=>{const f=m.value;if(f<=1)v.value="100%",p.value="100%";else{const B=typeof r.gap=="number"?r.gap:parseFloat(String(r.gap))||0,b=`calc((100% - ${(f-1)*B}px) / ${f})`;p.value=b,v.value=b}}),e.provide("rcDescItemWidth",v),e.provide("rcDescSingleWidth",p),e.provide("rcDescColCount",m),e.provide("rcDescGapPx",e.computed(()=>typeof r.gap=="number"?r.gap:parseFloat(String(r.gap))||0));const d=e.computed(()=>r.labelWidth===""||r.labelWidth===void 0?"":typeof r.labelWidth=="number"?`${r.labelWidth}px`:String(r.labelWidth));e.provide("rcDescLabelWidth",d),e.provide("rcDescGap",e.computed(()=>typeof r.gap=="number"?`${r.gap}px`:String(r.gap)));const s=e.computed(()=>{var k,b,S;const f=((k=r.keyMap)==null?void 0:k.key)??"label",B=((b=r.keyMap)==null?void 0:b.value)??"value";return(S=r.data)!=null&&S.length?r.data.map(y=>({label:y==null?void 0:y[f],value:y==null?void 0:y[B]})):[]});return(f,B)=>(e.openBlock(),e.createElementBlock("div",We,[f.$slots.title||n.title?(e.openBlock(),e.createElementBlock("div",Ue,[e.renderSlot(f.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(n.title),1)],!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"rc-descriptions__body",style:e.normalizeStyle({gap:u.value}),ref_key:"wrapEl",ref:c},[s.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(s.value,(k,b)=>(e.openBlock(),e.createBlock(T,{key:b,label:k.label,value:k.value,"label-width":n.labelWidth},null,8,["label","value","label-width"]))),128)):e.renderSlot(f.$slots,"default",{key:1},void 0,!0)],4)]))}}),U=w(je,[["__scopeId","data-v-5fcaa235"]]);U.name="rc-descriptions";T.name="rc-descriptions-item";function H(n){return n.component(U.name,U),n.component("RcDescriptions",U),n.component(T.name,T),n.component("RcDescriptionsItem",T),n}const ke=U,he=T,Ke={class:"rc-card__title"},Ge={class:"rc-card__title-text"},Oe={key:0,class:"rc-card__status"},Pe={key:1,class:"rc-card__divider"},Ye={key:2,class:"rc-card__action"},qe=e.defineComponent({name:"rc-card",__name:"index",props:{color:{default:"var(--rc-white)"},topBgColor:{default:"rgba(29, 133, 252, 0.05)"},title:{default:""},status:{default:""},statusColor:{default:"var(--rc-primary)"},round:{default:8},bordered:{type:Boolean,default:!1},elevation:{default:2},padding:{default:"16px"},gap:{default:12},width:{default:"100%"},height:{default:""}},setup(n){const r=n,c=e.computed(()=>{const d=typeof r.round=="boolean"?r.round?"12px":"0":typeof r.round=="number"?`${r.round}px`:String(r.round);return{backgroundColor:r.color||"var(--rc-white)",borderRadius:d,boxShadow:p(r.elevation),width:v(r.width),height:v(r.height)}}),u=e.computed(()=>r.padding||"16px"),m=e.computed(()=>typeof r.gap=="number"?`${r.gap}px`:String(r.gap));function v(d){return d==null||d===""?"":typeof d=="number"?`${d}px`:String(d)}function p(d){if(!d||d<=0)return"none";const s=4*d;return`0 ${Math.round(s/2)}px ${s}px rgba(0,0,0,0.06), 0 ${Math.round(s/4)}px ${Math.round(s/2)}px rgba(0,0,0,0.04)`}return(d,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["rc-card",[{"rc-card--bordered":n.bordered}]]),style:e.normalizeStyle(c.value)},[d.$slots.title||n.title||d.$slots.status||n.status?(e.openBlock(),e.createElementBlock("div",{key:0,class:"rc-card__top",style:e.normalizeStyle({backgroundColor:n.topBgColor||"rgba(29, 133, 252, 0.05)"})},[e.createElementVNode("div",Ke,[e.renderSlot(d.$slots,"title",{},()=>[e.createElementVNode("span",Ge,e.toDisplayString(n.title),1)],!0)]),d.$slots.status||n.status?(e.openBlock(),e.createElementBlock("div",Oe,[e.renderSlot(d.$slots,"status",{},()=>[e.createElementVNode("span",{class:"rc-card__status-text",style:e.normalizeStyle({color:n.statusColor||"var(--rc-primary)"})},e.toDisplayString(n.status),5)],!0)])):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"rc-card__body",style:e.normalizeStyle({padding:u.value,gap:m.value})},[e.renderSlot(d.$slots,"content",{},()=>[e.renderSlot(d.$slots,"default",{},void 0,!0)],!0)],4),d.$slots.action?(e.openBlock(),e.createElementBlock("div",Pe)):e.createCommentVNode("",!0),d.$slots.action?(e.openBlock(),e.createElementBlock("div",Ye,[e.renderSlot(d.$slots,"action",{},void 0,!0)])):e.createCommentVNode("",!0)],6))}}),j=w(qe,[["__scopeId","data-v-a7b95214"]]);j.name="rc-card";const He="RcCard";function J(n){return n.component(j.name,j),n.component(He,j),n}const Je={key:0,class:"rc-toast__mask"},Qe={class:"rc-toast__content"},Xe={key:0,class:"rc-toast__spinner"},Ze={key:1,class:"rc-toast__icon rc-toast__icon--success"},et={key:2,class:"rc-toast__icon rc-toast__icon--fail"},tt={class:"rc-toast__text"},nt=e.defineComponent({__name:"index",props:{message:{default:""},type:{default:"text"},duration:{default:2e3},mask:{type:Boolean,default:!1},onAfterLeave:{}},setup(n,{expose:r}){const c=n,u=e.ref(!0);let m;function v(){m&&(clearTimeout(m),m=null)}function p(){v(),u.value=!1}return r({close:p}),e.onMounted(()=>{c.duration&&c.duration>0&&(m=setTimeout(()=>{p()},c.duration))}),e.onUnmounted(()=>{v()}),(d,s)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"rc-toast-fade",onAfterLeave:n.onAfterLeave},{default:e.withCtx(()=>[u.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["rc-toast",[`rc-toast--${n.type}`]])},[n.mask?(e.openBlock(),e.createElementBlock("div",Je)):e.createCommentVNode("",!0),e.createElementVNode("div",Qe,[n.type==="loading"?(e.openBlock(),e.createElementBlock("div",Xe)):n.type==="success"?(e.openBlock(),e.createElementBlock("div",Ze)):n.type==="fail"?(e.openBlock(),e.createElementBlock("div",et)):e.createCommentVNode("",!0),e.createElementVNode("div",tt,e.toDisplayString(n.message),1)])],2)):e.createCommentVNode("",!0)]),_:1},8,["onAfterLeave"])])),e.renderSlot(d.$slots,"default",{},void 0,!0)],64))}}),K=w(nt,[["__scopeId","data-v-d234c9c5"]]);let R=null,F=null;function ve(){R&&(R.unmount(),R=null),F&&(document.body.removeChild(F),F=null)}function lt(n){const r=typeof n=="string"?{message:n}:n||{};ve(),F=document.createElement("div"),document.body.appendChild(F);const c={message:r.message,type:r.type??"text",duration:r.duration??2e3,mask:r.mask??!1,onAfterLeave:()=>{var u;ve(),(u=r.onClose)==null||u.call(r)}};return R=e.createApp(K,c),R.mount(F),{close:ge}}function ge(){var n,r,c;R&&((c=(r=(n=R._instance)==null?void 0:n.exposed)==null?void 0:r.close)==null||c.call(r))}K.name="rc-toast";function ye(n){return n.component(K.name,K),n}const rt={class:"rc-message",role:"alert","aria-live":"polite"},ot={class:"rc-message__content"},at=e.defineComponent({__name:"index",setup(n,{expose:r}){const c=e.reactive([]);let u=1;function m(p){const d=c.findIndex(s=>s.id===p);d>=0&&c.splice(d,1)}function v(p,d,s){const f=u++;return c.push({id:f,type:p,content:d,duration:s}),s>0&&window.setTimeout(()=>m(f),s),f}return r({add:v,remove:m}),(p,d)=>(e.openBlock(),e.createElementBlock("div",rt,[e.createVNode(e.TransitionGroup,{name:"rc-message-fade",tag:"div"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c,s=>(e.openBlock(),e.createElementBlock("div",{key:s.id,class:e.normalizeClass(["rc-message__item",`rc-message--${s.type}`])},[e.createElementVNode("span",ot,e.toDisplayString(s.content),1)],2))),128))]),_:1})]))}}),ct=w(at,[["__scopeId","data-v-87811df0"]]);let x=null,N=null;function st(){var r;if(x&&N)return;x=document.createElement("div"),document.body.appendChild(x);const n=e.createVNode(ct,{});e.render(n,x),N=(r=n.component)==null?void 0:r.exposed}function L(n,r,c){var m;st();const u=typeof c=="number"?c:n==="loading"?0:2e3;return(m=N==null?void 0:N.add)==null?void 0:m.call(N,n,r,u)}const _e={open(n){return L(n.type||"info",n.content,n.duration)},info(n,r){return L("info",n,r)},success(n,r){return L("success",n,r)},warning(n,r){return L("warning",n,r)},error(n,r){return L("error",n,r)},loading(n,r){return L("loading",n,r)},destroy(){x&&(e.render(null,x),x.remove(),x=null,N=null)}};function Q(n){return n.config.globalProperties.$message=_e,n}C.name="rc-icon";function X(n){return n.component(C.name,C),n.component("RcIcon",C),n}const it={class:"rc-search-area"},ut={class:"rc-search-area__bar"},dt=["onClick"],ft={class:"rc-search-area__item-label"},mt={class:"rc-search-area__panel-content"},pt={key:1,class:"rc-search-area__input-wrapper"},vt=["placeholder"],yt={key:2,class:"rc-search-area__tree-container"},kt={class:"rc-search-area__tree-group-title"},ht={class:"rc-search-area__tree-group-options"},gt=["onClick"],_t={class:"rc-search-area__option-label"},Bt={key:3,class:"rc-search-area__tree-container"},bt={class:"rc-search-area__tree-group-title"},Ct={class:"rc-search-area__tree-group-options"},St=["onClick"],$t={class:"rc-search-area__option-label"},Et={key:4,class:"rc-search-area__options-grid"},Vt=["onClick"],Nt={class:"rc-search-area__option-label"},xt={key:5,class:"rc-search-area__options-grid"},wt=["onClick"],It={class:"rc-search-area__option-label"},Dt={key:6,class:"rc-search-area__empty"},At={key:0,class:"rc-search-area__panel-footer"},Rt=e.defineComponent({name:"rc-search-area",__name:"index",props:{items:{default:()=>[]},modelValue:{default:()=>({})},showMask:{type:Boolean,default:!0},autoConfirm:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(n,{expose:r,emit:c}){const u=n,m=c,v=e.ref(null),p=e.ref(null),d=e.ref(null),s=e.ref({top:"0px"}),f=async()=>{if(v.value===null||!p.value)return;await e.nextTick();const l=p.value.getBoundingClientRect().top;s.value={top:`${l}px`}},B=t=>{if(v.value===null||!p.value)return;const l=t.target;if(p.value.contains(l))return;const o=p.value.closest(".rc-search-area");if(o){const i=o.querySelector(".rc-search-area__bar");if(i&&i.contains(l))return}I()};e.watch(v,async t=>{t!==null?(await e.nextTick(),f(),window.addEventListener("resize",f),window.addEventListener("scroll",f,!0),document.addEventListener("click",B,!0)):(window.removeEventListener("resize",f),window.removeEventListener("scroll",f,!0),document.removeEventListener("click",B,!0))}),e.onUnmounted(()=>{window.removeEventListener("resize",f),window.removeEventListener("scroll",f,!0),document.removeEventListener("click",B,!0)});const k=e.ref({}),b=e.ref(""),S=e.ref({}),y=e.ref({...u.modelValue});e.watch(()=>u.modelValue,t=>{y.value={...t||{}}},{deep:!0,immediate:!0});const a=e.computed(()=>v.value===null?null:u.items[v.value]),Be=e.computed(()=>{if(!a.value)return"";const t=xe(a.value);return t>0?`(${t}项)`:""}),be=t=>{const l=y.value[t.key];if(l==null||l===""||t.slot)return t.label;if(t.type==="input"){if(l&&String(l).trim())return`${t.label}: ${l}`}else if(t.type==="single"||t.type==="tree-single"){const o=P(t,l);if(o)return`${t.label}: ${le(o,t)}`}else{const o=Array.isArray(l)?l:[l];if(o.length>0){const i=o.map(g=>{const h=P(t,g);return h?le(h,t):null}).filter(g=>g!==null);if(i.length>0)return`${t.label}: ${i.join("、")}`}}return t.label},Ce=t=>{const l=u.items[t];if(!l)return;if(v.value===t){v.value=null;return}const o=y.value[l.key];l.slot?S.value[l.key]=o!==void 0?typeof o=="object"&&o!==null?{...o}:o:void 0:l.type==="input"?b.value=o!=null?String(o):"":l.type==="single"||l.type==="tree-single"?k.value[l.key]=o!==void 0?o:null:k.value[l.key]=o!==void 0?Array.isArray(o)?[...o]:[o]:[],v.value=t},I=()=>{v.value=null},D=(t,l)=>{if(!l)return typeof t=="string"?t:t.label||String(t.value);const o=t;if(l.renderItem){if(typeof l.renderItem=="string")return String(typeof o=="object"&&o!==null?o[l.renderItem]??"":o);{const i=l.renderItem(o);return i!=null?String(i):""}}return typeof t=="string"?t:t.label||String(t.value)},G=(t,l)=>{if(!l)return typeof t=="string"?t:t.value!==void 0?t.value:t;const o=t;return l.format?typeof l.format=="string"?typeof o=="object"&&o!==null?o[l.format]:o:l.format(o):typeof t=="string"?t:t.value!==void 0?t.value:t},le=(t,l)=>{const o=t,i=l.renderResult||l.renderItem;if(i){if(typeof i=="string")return String(typeof o=="object"&&o!==null?o[i]??"":o);{const g=i(o);return g!=null?String(g):""}}return D(t,l)},P=(t,l,o)=>{const i=o||t.options,g=t.childrenKey||"children";for(const h of i){const E=G(h,t);if(E===l||String(E)===String(l))return h;if(t.childrenKey&&typeof h=="object"&&h!==null){const z=h[g];if(Array.isArray(z)&&z.length>0){const W=P(t,l,z);if(W)return W}}}return null},re=(t,l)=>{const o=l||t.options,i=t.childrenKey||"children",g=[];for(const h of o)if(g.push(h),t.childrenKey&&typeof h=="object"&&h!==null){const E=h[i];Array.isArray(E)&&E.length>0&&g.push(...re(t,E))}return g},V=t=>{if(!a.value)return!1;const l=a.value.key,o=k.value[l],i=G(t,a.value);return a.value.type==="single"||a.value.type==="tree-single"?o!=null&&o===i:(Array.isArray(o)?o:[]).some(h=>h===i||String(h)===String(i))},oe=t=>t?t.childrenKey?re(t):t.options:[],ae=t=>{if(!t)return[];const l=t.childrenKey||"children";return(t.options||[]).filter(o=>{if(typeof o=="string")return!1;const i=o[l];return Array.isArray(i)&&i.length>0})},ce=(t,l)=>{if(!l||typeof t=="string")return[];const o=l.childrenKey||"children",i=t[o];return Array.isArray(i)?i:[]},Se=t=>{if(t)return S.value[t.key]!==void 0?S.value[t.key]:y.value[t.key]},$e=(t,l)=>{if(t&&(S.value[t.key]=l,u.autoConfirm)){const o=t.key;y.value[o]=l,m("update:modelValue",{...y.value}),m("change",{...y.value},t),I()}},se=t=>{if(!a.value)return;const l=a.value.key,o=G(t,a.value);y.value[l];let i;k.value[l]===o?i=void 0:i=o,y.value[l]=i,m("update:modelValue",{...y.value}),m("change",{...y.value},a.value),I()},ie=t=>{if(!a.value)return;const l=a.value.key,o=G(t,a.value),i=Array.isArray(k.value[l])?[...k.value[l]]:[],g=i.findIndex(h=>h===o||String(h)===String(o));if(g>=0?i.splice(g,1):i.push(o),k.value[l]=i,u.autoConfirm){const h=i.length>0?i:void 0;y.value[l]=h,m("update:modelValue",{...y.value}),m("change",{...y.value},a.value),I()}},Ee=()=>{if(!a.value)return;const t=a.value.key;a.value.slot?S.value[t]=void 0:a.value.type==="input"?b.value="":a.value.type==="single"||a.value.type==="tree-single"?k.value[t]=null:k.value[t]=[]},Ve=()=>{if(u.autoConfirm&&a.value){const t=a.value.key,l=b.value.trim()||void 0;y.value[t]=l,m("update:modelValue",{...y.value}),m("change",{...y.value},a.value),I()}},Ne=()=>{if(!a.value)return;const t=a.value.key;y.value[t];let l;if(a.value.slot)l=S.value[t],y.value[t]=l;else if(a.value.type==="input")l=b.value.trim()||void 0,y.value[t]=l;else if(a.value.type==="single"||a.value.type==="tree-single"){const o=k.value[t];l=o??void 0,y.value[t]=l}else{const o=k.value[t];l=Array.isArray(o)&&o.length>0?o:void 0,y.value[t]=l}m("update:modelValue",{...y.value}),m("change",{...y.value},a.value),I()},ue=t=>{const l=y.value[t.key];return l==null||l===""?0:t.slot?1:t.type==="input"?String(l).trim()?1:0:t.type==="single"||t.type==="tree-single"?1:Array.isArray(l)?l.length:l?1:0},xe=t=>{if(t.slot){const o=S.value[t.key];return o!=null&&o!==""?1:0}else if(t.type==="input")return b.value.trim()?1:0;const l=k.value[t.key];return l==null||l===""?0:t.type==="single"||t.type==="tree-single"?1:Array.isArray(l)?l.length:0};return r({getValues:()=>({...y.value}),reset:()=>{y.value={},k.value={},S.value={},m("update:modelValue",{})}}),(t,l)=>(e.openBlock(),e.createElementBlock("div",it,[e.createElementVNode("div",ut,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.items,(o,i)=>(e.openBlock(),e.createElementBlock("div",{key:i,class:e.normalizeClass(["rc-search-area__item",{"is-active":v.value===i,"has-value":ue(o)>0}]),onClick:g=>Ce(i)},[e.createElementVNode("span",ft,e.toDisplayString(be(o)),1),e.createVNode(e.unref(C),{name:"icon_a-xiala2",color:v.value!==i&&ue(o)>0?"#1677ff":"#969799",class:e.normalizeClass(["rc-search-area__item-arrow",{"is-up":v.value===i}])},null,8,["color","class"])],10,dt))),128))]),e.createVNode(e.Transition,{name:"rc-search-area-fade"},{default:e.withCtx(()=>[v.value!==null&&u.showMask?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"maskRef",ref:d,class:"rc-search-area__mask",style:e.normalizeStyle(s.value),onClick:I},null,4)):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{name:"rc-search-area-slide"},{default:e.withCtx(()=>{var o,i,g,h,E,z,W,de,fe,me,pe;return[v.value!==null?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"panelRef",ref:p,class:"rc-search-area__panel"},[e.createElementVNode("div",mt,[(o=a.value)!=null&&o.slot&&t.$slots[a.value.key]?e.renderSlot(t.$slots,a.value.key,{key:0,value:Se(a.value),"update:value":_=>$e(a.value,_)},void 0,!0):((i=a.value)==null?void 0:i.type)==="input"?(e.openBlock(),e.createElementBlock("div",pt,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":l[0]||(l[0]=_=>b.value=_),type:"text",class:"rc-search-area__input",placeholder:a.value.placeholder||"请输入",onInput:Ve},null,40,vt),[[e.vModelText,b.value]])])):((g=a.value)==null?void 0:g.type)==="tree-single"?(e.openBlock(),e.createElementBlock("div",yt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(ae(a.value),(_,A)=>(e.openBlock(),e.createElementBlock("div",{key:A,class:"rc-search-area__tree-group"},[e.createElementVNode("div",kt,e.toDisplayString(D(_,a.value||void 0)),1),e.createElementVNode("div",ht,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(ce(_,a.value),($,Y)=>(e.openBlock(),e.createElementBlock("div",{key:Y,class:e.normalizeClass(["rc-search-area__option",{"is-selected":V($)}]),onClick:we=>se($)},[e.createElementVNode("span",_t,e.toDisplayString(D($,a.value||void 0)),1),V($)?(e.openBlock(),e.createBlock(e.unref(C),{key:0,name:"icon_select",class:"rc-search-area__option-check"})):e.createCommentVNode("",!0)],10,gt))),128))])]))),128))])):((h=a.value)==null?void 0:h.type)==="tree-multiple"?(e.openBlock(),e.createElementBlock("div",Bt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(ae(a.value),(_,A)=>(e.openBlock(),e.createElementBlock("div",{key:A,class:"rc-search-area__tree-group"},[e.createElementVNode("div",bt,e.toDisplayString(D(_,a.value||void 0)),1),e.createElementVNode("div",Ct,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(ce(_,a.value),($,Y)=>(e.openBlock(),e.createElementBlock("div",{key:Y,class:e.normalizeClass(["rc-search-area__option",{"is-selected":V($)}]),onClick:we=>ie($)},[e.createElementVNode("span",$t,e.toDisplayString(D($,a.value||void 0)),1),V($)?(e.openBlock(),e.createBlock(e.unref(C),{key:0,name:"icon_select",class:"rc-search-area__option-check"})):e.createCommentVNode("",!0)],10,St))),128))])]))),128))])):((E=a.value)==null?void 0:E.type)==="single"?(e.openBlock(),e.createElementBlock("div",Et,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(oe(a.value),(_,A)=>(e.openBlock(),e.createElementBlock("div",{key:A,class:e.normalizeClass(["rc-search-area__option",{"is-selected":V(_)}]),onClick:$=>se(_)},[e.createElementVNode("span",Nt,e.toDisplayString(D(_,a.value||void 0)),1),V(_)?(e.openBlock(),e.createBlock(e.unref(C),{key:0,name:"icon_select",class:"rc-search-area__option-check"})):e.createCommentVNode("",!0)],10,Vt))),128))])):(e.openBlock(),e.createElementBlock("div",xt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(oe(a.value),(_,A)=>(e.openBlock(),e.createElementBlock("div",{key:A,class:e.normalizeClass(["rc-search-area__option",{"is-selected":V(_)}]),onClick:$=>ie(_)},[e.createElementVNode("span",It,e.toDisplayString(D(_,a.value||void 0)),1),V(_)?(e.openBlock(),e.createBlock(e.unref(C),{key:0,name:"icon_select",class:"rc-search-area__option-check"})):e.createCommentVNode("",!0)],10,wt))),128))])),((z=a.value)==null?void 0:z.type)!=="input"&&!((W=a.value)!=null&&W.slot)&&((fe=(de=a.value)==null?void 0:de.options)==null?void 0:fe.length)===0?(e.openBlock(),e.createElementBlock("div",Dt,[...l[1]||(l[1]=[e.createElementVNode("p",null,"暂无选项",-1)])])):e.createCommentVNode("",!0)]),!u.autoConfirm&&((me=a.value)==null?void 0:me.type)!=="single"&&((pe=a.value)==null?void 0:pe.type)!=="tree-single"?(e.openBlock(),e.createElementBlock("div",At,[e.createVNode(e.unref(M),{block:"",onClick:Ee},{default:e.withCtx(()=>[...l[2]||(l[2]=[e.createTextVNode(" 重置 ",-1)])]),_:1}),e.createVNode(e.unref(M),{type:"primary",block:"",onClick:Ne},{default:e.withCtx(()=>[e.createTextVNode(" 确定"+e.toDisplayString(Be.value),1)]),_:1})])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0)]}),_:3})]))}}),Z=w(Rt,[["__scopeId","data-v-2252d02c"]]),ee=n=>{n.component("RcSearchArea",Z),n.component("rc-search-area",Z)},O=Symbol("RECYCLE_UI_CONFIG"),te={prefix:"rc",autoRegister:!0,provideKey:O,theme:{},iconCssUrl:"//at.alicdn.com/t/c/font_4252799_9vcnw0pnmkh.css",iconClass:"iconfont"};function zt(n,r){r.autoRegister!==!1&&(typeof q=="function"&&q(n),typeof H=="function"&&H(n),typeof J=="function"&&J(n),typeof ye=="function"&&ye(n),typeof X=="function"&&X(n),typeof Q=="function"&&Q(n),typeof ee=="function"&&ee(n))}const ne=(n,r)=>{const c={...te,...r||{}};if(n.provide(c.provideKey??O,c),n.config.globalProperties.$recycleUI=c,typeof window<"u"&&c.iconCssUrl){const u=`link[rel="stylesheet"][data-rcui-icon="true"][href="${c.iconCssUrl}"]`;if(!document.head.querySelector(u)){const v=document.createElement("link");v.rel="stylesheet",v.href=c.iconCssUrl,v.setAttribute("data-rcui-icon","true"),document.head.appendChild(v)}}return zt(n,c),n},Lt={install:ne};function Tt(n){return{install(r){ne(r,n)}}}exports.RECYCLE_UI_SYMBOL=O;exports.RcButton=M;exports.RcCard=j;exports.RcDescriptions=ke;exports.RcDescriptionsItem=he;exports.RcIcon=C;exports.RcSearchArea=Z;exports.RcToast=K;exports.createRecycleUI=Tt;exports.default=Lt;exports.defaultRecycleUIConfig=te;exports.hideToast=ge;exports.install=ne;exports.installButton=q;exports.installCard=J;exports.installDescriptions=H;exports.installIcon=X;exports.installMessage=Q;exports.installSearchArea=ee;exports.message=_e;exports.rcDescriptions=ke;exports.rcDescriptionsItem=he;exports.showToast=lt;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|