geekin-devtoys 0.2.20 → 0.2.22

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),H=require("element-plus"),W=require("../index-il5JtS6o.js"),J=require("../_plugin-vue_export-helper-BHFhmbuH.js"),Q={key:0,class:"g-input-tree-tag__tags"},X=t.defineComponent({__name:"index",props:{modelValue:{default:()=>[]},data:{default:()=>[]},props:{default:()=>({})},nodeKey:{default:"id"},placeholder:{default:"请输入关键字搜索"},width:{default:320},popperMaxHeight:{default:320},popperZIndex:{default:2e3},popperOffset:{default:4},defaultExpandAll:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},closable:{type:Boolean,default:!0},tagType:{default:"info"},tagEffect:{default:"light"},clearInputAfterSelect:{type:Boolean,default:!0},enterToAdd:{type:Boolean,default:!0},showLeafIcon:{type:Boolean,default:!0},valueFormat:{default:"value"},selectable:{},filterMethod:{},duplicateMessage:{default:"该项已添加"},notFoundMessage:{default:"未找到匹配项"}},emits:["update:modelValue","change","add","remove","node-click","duplicate","not-found"],setup(_,{expose:R,emit:z}){const o=_,s=z,$=t.computed(()=>({label:o.props.label||"label",children:o.props.children||"children",disabled:o.props.disabled})),P=t.computed(()=>o.props.value||o.nodeKey||"id"),q=t.computed(()=>o.props.label||"label"),O=t.computed(()=>o.props.children||"children"),k=t.computed(()=>o.props.isLeaf),b=e=>e?e[P.value]:void 0,p=e=>e?e[q.value]:"",N=e=>e?e[O.value]:void 0,f=e=>{if(!e)return!1;if(typeof o.selectable=="function")return o.selectable(e);if(k.value&&e[k.value]!==void 0)return!!e[k.value];const l=N(e);return!l||!l.length},V=t.computed(()=>{const e=new Map,l=(a=[])=>{a.forEach(n=>{f(n)&&e.set(b(n),n);const d=N(n);d?.length&&l(d)})};return l(o.data||[]),e}),c=t.computed(()=>(o.modelValue||[]).map(l=>{const a=o.valueFormat==="object"?l?.value:l,n=V.value.get(a),d=o.valueFormat==="object"?l?.label:void 0;return{value:a,label:n?p(n):d??String(a??""),raw:n}})),B=e=>c.value.some(l=>l.value===e),h=t.ref(""),u=t.ref(!1),x=t.ref(null),F=t.ref(null),I=t.ref(null),E=t.ref(null),T=t.ref({}),C=t.ref("bottom"),K=t.computed(()=>typeof o.width=="number"?`${o.width}px`:o.width),M=()=>{o.disabled||(u.value=!0)},w=()=>{if(!u.value)return;const e=I.value,l=E.value;if(!e||!l)return;const a=e.getBoundingClientRect(),n=l.offsetHeight||o.popperMaxHeight,m=window.innerHeight-a.bottom,r=a.top;let i;m>=n+o.popperOffset||m>=r?(i=a.bottom+o.popperOffset,C.value="bottom"):(i=a.top-n-o.popperOffset,C.value="top"),T.value={position:"fixed",top:`${i}px`,left:`${a.left}px`,width:`${a.width}px`,zIndex:String(o.popperZIndex)}};let v=null;const y=()=>{u.value&&(v&&cancelAnimationFrame(v),v=requestAnimationFrame(()=>{v=null,w()}))};t.watch(u,async e=>{e&&(await t.nextTick(),w(),requestAnimationFrame(w))});const L=e=>{if(!u.value)return;const l=e.target;F.value?.contains(l)||E.value?.contains(l)||(u.value=!1)};t.onMounted(()=>{document.addEventListener("mousedown",L,!0),window.addEventListener("scroll",y,!0),window.addEventListener("resize",y)}),t.onBeforeUnmount(()=>{document.removeEventListener("mousedown",L,!0),window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",y),v&&cancelAnimationFrame(v)});const j=e=>{u.value=!0,x.value?.filter(e),t.nextTick(w)},D=(e,l)=>e?typeof o.filterMethod=="function"?o.filterMethod(e,l):String(p(l)??"").toLowerCase().includes(String(e).toLowerCase()):!0,U=e=>{s("node-click",e),f(e)&&(S(e),u.value=!1)},G=e=>o.valueFormat==="object"?{value:e.value,label:e.label,raw:e.raw}:e.value,S=e=>{const l=b(e);if(l==null||l==="")return;if(B(l)){const d={value:l,label:p(e),raw:e};s("duplicate",d),o.duplicateMessage&&H.ElMessage.warning(o.duplicateMessage);return}const a={value:l,label:p(e),raw:e},n=[...o.modelValue||[],G(a)];s("update:modelValue",n),s("add",a),s("change",n,[...c.value,a]),o.clearInputAfterSelect&&(h.value="")},Z=()=>{if(!o.enterToAdd)return;const e=(h.value||"").trim();if(!e)return;let l=null;for(const a of V.value.values())if(p(a)===e){l=a;break}if(!l){s("not-found",e),o.notFoundMessage&&H.ElMessage.warning(o.notFoundMessage);return}S(l)},A=e=>{const l=c.value[e],a=[...o.modelValue||[]];a.splice(e,1),s("update:modelValue",a),l&&s("remove",l,e);const n=c.value.filter((d,m)=>m!==e);s("change",a,n)};return R({open:M,close:()=>u.value=!1,clear:()=>{s("update:modelValue",[]),s("change",[],[])},addByValue:e=>{const l=V.value.get(e);l&&S(l)}}),(e,l)=>{const a=t.resolveComponent("el-input"),n=t.resolveComponent("el-icon"),d=t.resolveComponent("el-tree"),m=t.resolveComponent("el-tag");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["g-input-tree-tag",{"is-disabled":e.disabled}])},[t.createElementVNode("div",{class:"g-input-tree-tag__wrap",ref_key:"wrapRef",ref:F},[t.createElementVNode("div",{class:"g-input-tree-tag__input-box",ref_key:"inputBoxRef",ref:I,style:t.normalizeStyle({width:K.value})},[t.createVNode(a,{modelValue:h.value,"onUpdate:modelValue":l[0]||(l[0]=r=>h.value=r),placeholder:e.placeholder,clearable:e.clearable,disabled:e.disabled,class:"g-input-tree-tag__input",onFocus:M,onClick:M,onInput:j,onKeyup:t.withKeys(Z,["enter"])},null,8,["modelValue","placeholder","clearable","disabled"])],4),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.withDirectives(t.createElementVNode("div",{ref_key:"popperRef",ref:E,class:t.normalizeClass(["g-input-tree-tag__popover",`is-${C.value}`]),style:t.normalizeStyle(T.value),onMousedown:l[1]||(l[1]=t.withModifiers(()=>{},["prevent"]))},[t.createElementVNode("div",{class:"g-input-tree-tag__tree-wrap",style:t.normalizeStyle({maxHeight:e.popperMaxHeight+"px"})},[t.createVNode(d,{ref_key:"treeRef",ref:x,data:e.data,props:$.value,"node-key":e.nodeKey,"filter-node-method":D,"expand-on-click-node":!1,"default-expand-all":e.defaultExpandAll,onNodeClick:U},{default:t.withCtx(({data:r,node:i})=>[t.renderSlot(e.$slots,"tree-node",{data:r,node:i,selectable:f(r),selected:B(b(r))},()=>[t.createElementVNode("span",{class:t.normalizeClass(["g-input-tree-tag__node",{"is-selectable":f(r),"is-selected":f(r)&&B(b(r))}])},[f(r)&&e.showLeafIcon?(t.openBlock(),t.createBlock(n,{key:0,class:"g-input-tree-tag__node-icon"},{default:t.withCtx(()=>[t.createVNode(t.unref(W.user_default))]),_:1})):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(p(r)),1)],2)],!0)]),_:3},8,["data","props","node-key","default-expand-all"])],4)],38),[[t.vShow,u.value]])])),c.value.length?(t.openBlock(),t.createElementBlock("div",Q,[t.renderSlot(e.$slots,"tags",{items:c.value,remove:A},()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,(r,i)=>(t.openBlock(),t.createBlock(m,{key:r.value,class:"g-input-tree-tag__tag",type:e.tagType,effect:e.tagEffect,closable:e.closable&&!e.disabled,onClose:Y=>A(i)},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"tag",{item:r,index:i},()=>[t.createTextVNode(t.toDisplayString(r.label),1)],!0)]),_:2},1032,["type","effect","closable","onClose"]))),128))],!0)])):t.createCommentVNode("",!0)],512)],2)}}}),g=J._export_sfc(X,[["__scopeId","data-v-f235428c"]]);g.install=_=>{_.component(g.name,g)};exports.GInputTreeTag=g;exports.default=g;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),f=require("element-plus"),J=require("../index-il5JtS6o.js"),Q=require("../_plugin-vue_export-helper-BHFhmbuH.js"),X={key:0,class:"g-input-tree-tag__tags"},Y=t.defineComponent({__name:"index",props:{modelValue:{default:()=>[]},data:{default:()=>[]},props:{default:()=>({})},nodeKey:{default:"id"},placeholder:{default:"请输入关键字搜索"},width:{default:320},popperMaxHeight:{default:320},popperZIndex:{default:2e3},popperOffset:{default:4},defaultExpandAll:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},closable:{type:Boolean,default:!0},tagType:{default:"info"},tagEffect:{default:"light"},clearInputAfterSelect:{type:Boolean,default:!0},enterToAdd:{type:Boolean,default:!0},showLeafIcon:{type:Boolean,default:!0},valueFormat:{default:"value"},selectable:{},filterMethod:{},duplicateMessage:{default:"该项已添加"},notFoundMessage:{default:"未找到匹配项"}},emits:["update:modelValue","change","add","remove","node-click","duplicate","not-found"],setup(y,{expose:H,emit:R}){const o=y,r=R,z=t.computed(()=>({label:o.props.label||"label",children:o.props.children||"children",disabled:o.props.disabled})),$=t.computed(()=>o.props.value||o.nodeKey||"id"),q=t.computed(()=>o.props.label||"label"),O=t.computed(()=>o.props.children||"children"),k=t.computed(()=>o.props.isLeaf),m=e=>e?e[$.value]:void 0,i=e=>e?e[q.value]:"",N=e=>e?e[O.value]:void 0,c=e=>{if(!e)return!1;if(typeof o.selectable=="function")return o.selectable(e);if(k.value&&e[k.value]!==void 0)return!!e[k.value];const l=N(e);return!l||!l.length},E=t.computed(()=>{const e=new Map,l=(a=[])=>{a.forEach(n=>{c(n)&&e.set(m(n),n);const d=N(n);d?.length&&l(d)})};return l(o.data||[]),e}),s=t.computed(()=>(o.modelValue||[]).map(l=>{const a=o.valueFormat==="object"?l?.value:l,n=E.value.get(a),d=o.valueFormat==="object"?l?.label:void 0;return{value:a,label:n?i(n):d??String(a??""),raw:n}})),B=e=>s.value.some(l=>l.value===e),g=t.ref(""),u=t.ref(!1),x=t.ref(null),F=t.ref(null),I=t.ref(null),V=t.ref(null),T=t.ref({}),_=t.ref("bottom"),K=t.computed(()=>typeof o.width=="number"?`${o.width}px`:o.width),C=()=>{o.disabled||(u.value=!0)},b=()=>{if(!u.value)return;const e=I.value,l=V.value;if(!e||!l)return;const a=e.getBoundingClientRect(),n=l.offsetHeight||o.popperMaxHeight,w=window.innerHeight-a.bottom,W=a.top;let S;w>=n+o.popperOffset||w>=W?(S=a.bottom+o.popperOffset,_.value="bottom"):(S=a.top-n-o.popperOffset,_.value="top"),T.value={position:"fixed",top:`${S}px`,left:`${a.left}px`,width:`${a.width}px`,zIndex:String(o.popperZIndex)}};let p=null;const h=()=>{u.value&&(p&&cancelAnimationFrame(p),p=requestAnimationFrame(()=>{p=null,b()}))};t.watch(u,async e=>{e&&(await t.nextTick(),b(),requestAnimationFrame(b))});const L=e=>{if(!u.value)return;const l=e.target;F.value?.contains(l)||V.value?.contains(l)||(u.value=!1)};t.onMounted(()=>{document.addEventListener("mousedown",L,!0),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h)}),t.onBeforeUnmount(()=>{document.removeEventListener("mousedown",L,!0),window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h),p&&cancelAnimationFrame(p)});const j=e=>{u.value=!0,x.value?.filter(e),t.nextTick(b)},D=(e,l)=>e?typeof o.filterMethod=="function"?o.filterMethod(e,l):String(i(l)??"").toLowerCase().includes(String(e).toLowerCase()):!0,U=e=>{r("node-click",e),c(e)&&(M(e),u.value=!1)},G=e=>o.valueFormat==="object"?{value:e.value,label:e.label,raw:e.raw}:e.value,M=e=>{const l=m(e);if(l==null||l==="")return;if(B(l)){const d={value:l,label:i(e),raw:e};r("duplicate",d),o.duplicateMessage&&f.ElMessage.warning(o.duplicateMessage);return}const a={value:l,label:i(e),raw:e},n=[...o.modelValue||[],G(a)];r("update:modelValue",n),r("add",a),r("change",n,[...s.value,a]),o.clearInputAfterSelect&&(g.value="")},Z=()=>{if(!o.enterToAdd)return;const e=(g.value||"").trim();if(!e)return;let l=null;for(const a of E.value.values())if(i(a)===e){l=a;break}if(!l){r("not-found",e),o.notFoundMessage&&f.ElMessage.warning(o.notFoundMessage);return}M(l)},A=e=>{const l=s.value[e],a=[...o.modelValue||[]];a.splice(e,1),r("update:modelValue",a),l&&r("remove",l,e);const n=s.value.filter((d,w)=>w!==e);r("change",a,n)};return H({open:C,close:()=>u.value=!1,clear:()=>{r("update:modelValue",[]),r("change",[],[])},addByValue:e=>{const l=E.value.get(e);l&&M(l)}}),(e,l)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["g-input-tree-tag",{"is-disabled":e.disabled}])},[t.createElementVNode("div",{class:"g-input-tree-tag__wrap",ref_key:"wrapRef",ref:F},[t.createElementVNode("div",{class:"g-input-tree-tag__input-box",ref_key:"inputBoxRef",ref:I,style:t.normalizeStyle({width:K.value})},[t.createVNode(t.unref(f.ElInput),{modelValue:g.value,"onUpdate:modelValue":l[0]||(l[0]=a=>g.value=a),placeholder:e.placeholder,clearable:e.clearable,disabled:e.disabled,class:"g-input-tree-tag__input",onFocus:C,onClick:C,onInput:j,onKeyup:t.withKeys(Z,["enter"])},null,8,["modelValue","placeholder","clearable","disabled"])],4),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.withDirectives(t.createElementVNode("div",{ref_key:"popperRef",ref:V,class:t.normalizeClass(["g-input-tree-tag__popover",`is-${_.value}`]),style:t.normalizeStyle(T.value),onMousedown:l[1]||(l[1]=t.withModifiers(()=>{},["prevent"]))},[t.createElementVNode("div",{class:"g-input-tree-tag__tree-wrap",style:t.normalizeStyle({maxHeight:e.popperMaxHeight+"px"})},[t.createVNode(t.unref(f.ElTree),{ref_key:"treeRef",ref:x,data:e.data,props:z.value,"node-key":e.nodeKey,"filter-node-method":D,"expand-on-click-node":!1,"default-expand-all":e.defaultExpandAll,onNodeClick:U},{default:t.withCtx(a=>[t.renderSlot(e.$slots,"tree-node",{data:a?.data,node:a?.node,selectable:c(a?.data),selected:B(m(a?.data))},()=>[a?.data?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(["g-input-tree-tag__node",{"is-selectable":c(a.data),"is-selected":c(a.data)&&B(m(a.data))}])},[c(a.data)&&e.showLeafIcon?(t.openBlock(),t.createBlock(t.unref(f.ElIcon),{key:0,class:"g-input-tree-tag__node-icon"},{default:t.withCtx(()=>[t.createVNode(t.unref(J.user_default))]),_:1})):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(i(a.data)),1)],2)):t.createCommentVNode("",!0)],!0)]),_:3},8,["data","props","node-key","default-expand-all"])],4)],38),[[t.vShow,u.value]])])),s.value.length?(t.openBlock(),t.createElementBlock("div",X,[t.renderSlot(e.$slots,"tags",{items:s.value,remove:A},()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value,(a,n)=>(t.openBlock(),t.createBlock(t.unref(f.ElTag),{key:a.value,class:"g-input-tree-tag__tag",type:e.tagType,effect:e.tagEffect,closable:e.closable&&!e.disabled,onClose:d=>A(n)},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"tag",{item:a,index:n},()=>[t.createTextVNode(t.toDisplayString(a.label),1)],!0)]),_:2},1032,["type","effect","closable","onClose"]))),128))],!0)])):t.createCommentVNode("",!0)],512)],2))}}),v=Q._export_sfc(Y,[["__scopeId","data-v-6f1283aa"]]);v.install=y=>{y.component(v.name,v)};exports.GInputTreeTag=v;exports.default=v;
@@ -1,11 +1,11 @@
1
- import { defineComponent as de, computed as d, ref as p, watch as pe, nextTick as Z, onMounted as ce, onBeforeUnmount as fe, resolveComponent as V, createElementBlock as S, openBlock as b, normalizeClass as A, createElementVNode as h, createBlock as N, createCommentVNode as G, normalizeStyle as T, createVNode as R, withKeys as ve, Teleport as me, withDirectives as ge, withModifiers as be, withCtx as H, renderSlot as $, createTextVNode as W, unref as he, toDisplayString as J, vShow as we, Fragment as ye, renderList as _e } from "vue";
2
- import { ElMessage as Q } from "element-plus";
3
- import { u as ke } from "../index-CzamRrBC.mjs";
4
- import { _ as Ve } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
5
- const Ee = {
1
+ import { defineComponent as ie, computed as d, ref as s, watch as pe, nextTick as G, onMounted as ce, onBeforeUnmount as fe, createElementBlock as k, openBlock as p, normalizeClass as S, createElementVNode as E, createBlock as T, createCommentVNode as A, normalizeStyle as N, createVNode as R, unref as m, withKeys as ve, Teleport as me, withDirectives as ge, withModifiers as be, withCtx as H, renderSlot as $, createTextVNode as W, toDisplayString as J, vShow as he, Fragment as we, renderList as ye } from "vue";
2
+ import { ElInput as ke, ElTree as Ee, ElIcon as _e, ElTag as Ve, ElMessage as Q } from "element-plus";
3
+ import { u as Fe } from "../index-CzamRrBC.mjs";
4
+ import { _ as Be } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
5
+ const Ie = {
6
6
  key: 0,
7
7
  class: "g-input-tree-tag__tags"
8
- }, Fe = /* @__PURE__ */ de({
8
+ }, Me = /* @__PURE__ */ ie({
9
9
  __name: "index",
10
10
  props: {
11
11
  modelValue: { default: () => [] },
@@ -33,240 +33,238 @@ const Ee = {
33
33
  notFoundMessage: { default: "未找到匹配项" }
34
34
  },
35
35
  emits: ["update:modelValue", "change", "add", "remove", "node-click", "duplicate", "not-found"],
36
- setup(E, { expose: X, emit: Y }) {
37
- const l = E, r = Y, ee = d(() => ({
36
+ setup(_, { expose: X, emit: Y }) {
37
+ const l = _, n = Y, P = d(() => ({
38
38
  label: l.props.label || "label",
39
39
  children: l.props.children || "children",
40
40
  disabled: l.props.disabled
41
- })), te = d(() => l.props.value || l.nodeKey || "id"), le = d(() => l.props.label || "label"), ae = d(() => l.props.children || "children"), F = d(() => l.props.isLeaf), w = (e) => e ? e[te.value] : void 0, f = (e) => e ? e[le.value] : "", K = (e) => e ? e[ae.value] : void 0, v = (e) => {
41
+ })), ee = d(() => l.props.value || l.nodeKey || "id"), te = d(() => l.props.label || "label"), ae = d(() => l.props.children || "children"), V = d(() => l.props.isLeaf), g = (e) => e ? e[ee.value] : void 0, c = (e) => e ? e[te.value] : "", K = (e) => e ? e[ae.value] : void 0, f = (e) => {
42
42
  if (!e) return !1;
43
43
  if (typeof l.selectable == "function") return l.selectable(e);
44
- if (F.value && e[F.value] !== void 0) return !!e[F.value];
44
+ if (V.value && e[V.value] !== void 0) return !!e[V.value];
45
45
  const t = K(e);
46
46
  return !t || !t.length;
47
- }, B = d(() => {
47
+ }, F = d(() => {
48
48
  const e = /* @__PURE__ */ new Map(), t = (a = []) => {
49
49
  a.forEach((o) => {
50
- v(o) && e.set(w(o), o);
50
+ f(o) && e.set(g(o), o);
51
51
  const u = K(o);
52
52
  u?.length && t(u);
53
53
  });
54
54
  };
55
55
  return t(l.data || []), e;
56
- }), c = d(() => (l.modelValue || []).map((t) => {
57
- const a = l.valueFormat === "object" ? t?.value : t, o = B.value.get(a), u = l.valueFormat === "object" ? t?.label : void 0;
56
+ }), i = d(() => (l.modelValue || []).map((t) => {
57
+ const a = l.valueFormat === "object" ? t?.value : t, o = F.value.get(a), u = l.valueFormat === "object" ? t?.label : void 0;
58
58
  return {
59
59
  value: a,
60
- label: o ? f(o) : u ?? String(a ?? ""),
60
+ label: o ? c(o) : u ?? String(a ?? ""),
61
61
  raw: o
62
62
  };
63
- })), M = (e) => c.value.some((t) => t.value === e), y = p(""), s = p(!1), O = p(null), P = p(null), j = p(null), C = p(null), U = p({}), I = p("bottom"), oe = d(
63
+ })), B = (e) => i.value.some((t) => t.value === e), b = s(""), r = s(!1), O = s(null), j = s(null), U = s(null), I = s(null), q = s({}), M = s("bottom"), le = d(
64
64
  () => typeof l.width == "number" ? `${l.width}px` : l.width
65
65
  ), L = () => {
66
- l.disabled || (s.value = !0);
67
- }, _ = () => {
68
- if (!s.value) return;
69
- const e = j.value, t = C.value;
66
+ l.disabled || (r.value = !0);
67
+ }, h = () => {
68
+ if (!r.value) return;
69
+ const e = U.value, t = I.value;
70
70
  if (!e || !t) return;
71
- const a = e.getBoundingClientRect(), o = t.offsetHeight || l.popperMaxHeight, g = window.innerHeight - a.bottom, n = a.top;
72
- let i;
73
- g >= o + l.popperOffset || g >= n ? (i = a.bottom + l.popperOffset, I.value = "bottom") : (i = a.top - o - l.popperOffset, I.value = "top"), U.value = {
71
+ const a = e.getBoundingClientRect(), o = t.offsetHeight || l.popperMaxHeight, y = window.innerHeight - a.bottom, se = a.top;
72
+ let x;
73
+ y >= o + l.popperOffset || y >= se ? (x = a.bottom + l.popperOffset, M.value = "bottom") : (x = a.top - o - l.popperOffset, M.value = "top"), q.value = {
74
74
  position: "fixed",
75
- top: `${i}px`,
75
+ top: `${x}px`,
76
76
  left: `${a.left}px`,
77
77
  width: `${a.width}px`,
78
78
  zIndex: String(l.popperZIndex)
79
79
  };
80
80
  };
81
- let m = null;
82
- const k = () => {
83
- s.value && (m && cancelAnimationFrame(m), m = requestAnimationFrame(() => {
84
- m = null, _();
81
+ let v = null;
82
+ const w = () => {
83
+ r.value && (v && cancelAnimationFrame(v), v = requestAnimationFrame(() => {
84
+ v = null, h();
85
85
  }));
86
86
  };
87
- pe(s, async (e) => {
88
- e && (await Z(), _(), requestAnimationFrame(_));
87
+ pe(r, async (e) => {
88
+ e && (await G(), h(), requestAnimationFrame(h));
89
89
  });
90
- const q = (e) => {
91
- if (!s.value) return;
90
+ const D = (e) => {
91
+ if (!r.value) return;
92
92
  const t = e.target;
93
- P.value?.contains(t) || C.value?.contains(t) || (s.value = !1);
93
+ j.value?.contains(t) || I.value?.contains(t) || (r.value = !1);
94
94
  };
95
95
  ce(() => {
96
- document.addEventListener("mousedown", q, !0), window.addEventListener("scroll", k, !0), window.addEventListener("resize", k);
96
+ document.addEventListener("mousedown", D, !0), window.addEventListener("scroll", w, !0), window.addEventListener("resize", w);
97
97
  }), fe(() => {
98
- document.removeEventListener("mousedown", q, !0), window.removeEventListener("scroll", k, !0), window.removeEventListener("resize", k), m && cancelAnimationFrame(m);
98
+ document.removeEventListener("mousedown", D, !0), window.removeEventListener("scroll", w, !0), window.removeEventListener("resize", w), v && cancelAnimationFrame(v);
99
99
  });
100
- const ne = (e) => {
101
- s.value = !0, O.value?.filter(e), Z(_);
102
- }, re = (e, t) => e ? typeof l.filterMethod == "function" ? l.filterMethod(e, t) : String(f(t) ?? "").toLowerCase().includes(String(e).toLowerCase()) : !0, se = (e) => {
103
- r("node-click", e), v(e) && (x(e), s.value = !1);
104
- }, ue = (e) => l.valueFormat === "object" ? { value: e.value, label: e.label, raw: e.raw } : e.value, x = (e) => {
105
- const t = w(e);
100
+ const oe = (e) => {
101
+ r.value = !0, O.value?.filter(e), G(h);
102
+ }, ne = (e, t) => e ? typeof l.filterMethod == "function" ? l.filterMethod(e, t) : String(c(t) ?? "").toLowerCase().includes(String(e).toLowerCase()) : !0, re = (e) => {
103
+ n("node-click", e), f(e) && (C(e), r.value = !1);
104
+ }, ue = (e) => l.valueFormat === "object" ? { value: e.value, label: e.label, raw: e.raw } : e.value, C = (e) => {
105
+ const t = g(e);
106
106
  if (t == null || t === "") return;
107
- if (M(t)) {
108
- const u = { value: t, label: f(e), raw: e };
109
- r("duplicate", u), l.duplicateMessage && Q.warning(l.duplicateMessage);
107
+ if (B(t)) {
108
+ const u = { value: t, label: c(e), raw: e };
109
+ n("duplicate", u), l.duplicateMessage && Q.warning(l.duplicateMessage);
110
110
  return;
111
111
  }
112
- const a = { value: t, label: f(e), raw: e }, o = [...l.modelValue || [], ue(a)];
113
- r("update:modelValue", o), r("add", a), r("change", o, [...c.value, a]), l.clearInputAfterSelect && (y.value = "");
114
- }, ie = () => {
112
+ const a = { value: t, label: c(e), raw: e }, o = [...l.modelValue || [], ue(a)];
113
+ n("update:modelValue", o), n("add", a), n("change", o, [...i.value, a]), l.clearInputAfterSelect && (b.value = "");
114
+ }, de = () => {
115
115
  if (!l.enterToAdd) return;
116
- const e = (y.value || "").trim();
116
+ const e = (b.value || "").trim();
117
117
  if (!e) return;
118
118
  let t = null;
119
- for (const a of B.value.values())
120
- if (f(a) === e) {
119
+ for (const a of F.value.values())
120
+ if (c(a) === e) {
121
121
  t = a;
122
122
  break;
123
123
  }
124
124
  if (!t) {
125
- r("not-found", e), l.notFoundMessage && Q.warning(l.notFoundMessage);
125
+ n("not-found", e), l.notFoundMessage && Q.warning(l.notFoundMessage);
126
126
  return;
127
127
  }
128
- x(t);
129
- }, D = (e) => {
130
- const t = c.value[e], a = [...l.modelValue || []];
131
- a.splice(e, 1), r("update:modelValue", a), t && r("remove", t, e);
132
- const o = c.value.filter((u, g) => g !== e);
133
- r("change", a, o);
128
+ C(t);
129
+ }, Z = (e) => {
130
+ const t = i.value[e], a = [...l.modelValue || []];
131
+ a.splice(e, 1), n("update:modelValue", a), t && n("remove", t, e);
132
+ const o = i.value.filter((u, y) => y !== e);
133
+ n("change", a, o);
134
134
  };
135
135
  return X({
136
136
  /** 主动打开下拉面板 */
137
137
  open: L,
138
138
  /** 主动关闭下拉面板 */
139
- close: () => s.value = !1,
139
+ close: () => r.value = !1,
140
140
  /** 清空已选 */
141
141
  clear: () => {
142
- r("update:modelValue", []), r("change", [], []);
142
+ n("update:modelValue", []), n("change", [], []);
143
143
  },
144
144
  /** 根据 value 直接添加 */
145
145
  addByValue: (e) => {
146
- const t = B.value.get(e);
147
- t && x(t);
146
+ const t = F.value.get(e);
147
+ t && C(t);
148
148
  }
149
- }), (e, t) => {
150
- const a = V("el-input"), o = V("el-icon"), u = V("el-tree"), g = V("el-tag");
151
- return b(), S("div", {
152
- class: A(["g-input-tree-tag", { "is-disabled": e.disabled }])
149
+ }), (e, t) => (p(), k("div", {
150
+ class: S(["g-input-tree-tag", { "is-disabled": e.disabled }])
151
+ }, [
152
+ E("div", {
153
+ class: "g-input-tree-tag__wrap",
154
+ ref_key: "wrapRef",
155
+ ref: j
153
156
  }, [
154
- h("div", {
155
- class: "g-input-tree-tag__wrap",
156
- ref_key: "wrapRef",
157
- ref: P
157
+ E("div", {
158
+ class: "g-input-tree-tag__input-box",
159
+ ref_key: "inputBoxRef",
160
+ ref: U,
161
+ style: N({ width: le.value })
158
162
  }, [
159
- h("div", {
160
- class: "g-input-tree-tag__input-box",
161
- ref_key: "inputBoxRef",
162
- ref: j,
163
- style: T({ width: oe.value })
163
+ R(m(ke), {
164
+ modelValue: b.value,
165
+ "onUpdate:modelValue": t[0] || (t[0] = (a) => b.value = a),
166
+ placeholder: e.placeholder,
167
+ clearable: e.clearable,
168
+ disabled: e.disabled,
169
+ class: "g-input-tree-tag__input",
170
+ onFocus: L,
171
+ onClick: L,
172
+ onInput: oe,
173
+ onKeyup: ve(de, ["enter"])
174
+ }, null, 8, ["modelValue", "placeholder", "clearable", "disabled"])
175
+ ], 4),
176
+ (p(), T(me, { to: "body" }, [
177
+ ge(E("div", {
178
+ ref_key: "popperRef",
179
+ ref: I,
180
+ class: S(["g-input-tree-tag__popover", `is-${M.value}`]),
181
+ style: N(q.value),
182
+ onMousedown: t[1] || (t[1] = be(() => {
183
+ }, ["prevent"]))
164
184
  }, [
165
- R(a, {
166
- modelValue: y.value,
167
- "onUpdate:modelValue": t[0] || (t[0] = (n) => y.value = n),
168
- placeholder: e.placeholder,
169
- clearable: e.clearable,
170
- disabled: e.disabled,
171
- class: "g-input-tree-tag__input",
172
- onFocus: L,
173
- onClick: L,
174
- onInput: ne,
175
- onKeyup: ve(ie, ["enter"])
176
- }, null, 8, ["modelValue", "placeholder", "clearable", "disabled"])
177
- ], 4),
178
- (b(), N(me, { to: "body" }, [
179
- ge(h("div", {
180
- ref_key: "popperRef",
181
- ref: C,
182
- class: A(["g-input-tree-tag__popover", `is-${I.value}`]),
183
- style: T(U.value),
184
- onMousedown: t[1] || (t[1] = be(() => {
185
- }, ["prevent"]))
185
+ E("div", {
186
+ class: "g-input-tree-tag__tree-wrap",
187
+ style: N({ maxHeight: e.popperMaxHeight + "px" })
186
188
  }, [
187
- h("div", {
188
- class: "g-input-tree-tag__tree-wrap",
189
- style: T({ maxHeight: e.popperMaxHeight + "px" })
190
- }, [
191
- R(u, {
192
- ref_key: "treeRef",
193
- ref: O,
194
- data: e.data,
195
- props: ee.value,
196
- "node-key": e.nodeKey,
197
- "filter-node-method": re,
198
- "expand-on-click-node": !1,
199
- "default-expand-all": e.defaultExpandAll,
200
- onNodeClick: se
201
- }, {
202
- default: H(({ data: n, node: i }) => [
203
- $(e.$slots, "tree-node", {
204
- data: n,
205
- node: i,
206
- selectable: v(n),
207
- selected: M(w(n))
208
- }, () => [
209
- h("span", {
210
- class: A([
211
- "g-input-tree-tag__node",
212
- {
213
- "is-selectable": v(n),
214
- "is-selected": v(n) && M(w(n))
215
- }
216
- ])
217
- }, [
218
- v(n) && e.showLeafIcon ? (b(), N(o, {
219
- key: 0,
220
- class: "g-input-tree-tag__node-icon"
221
- }, {
222
- default: H(() => [
223
- R(he(ke))
224
- ]),
225
- _: 1
226
- })) : G("", !0),
227
- W(" " + J(f(n)), 1)
228
- ], 2)
229
- ], !0)
230
- ]),
231
- _: 3
232
- }, 8, ["data", "props", "node-key", "default-expand-all"])
233
- ], 4)
234
- ], 38), [
235
- [we, s.value]
236
- ])
237
- ])),
238
- c.value.length ? (b(), S("div", Ee, [
239
- $(e.$slots, "tags", {
240
- items: c.value,
241
- remove: D
242
- }, () => [
243
- (b(!0), S(ye, null, _e(c.value, (n, i) => (b(), N(g, {
244
- key: n.value,
245
- class: "g-input-tree-tag__tag",
246
- type: e.tagType,
247
- effect: e.tagEffect,
248
- closable: e.closable && !e.disabled,
249
- onClose: (Be) => D(i)
189
+ R(m(Ee), {
190
+ ref_key: "treeRef",
191
+ ref: O,
192
+ data: e.data,
193
+ props: P.value,
194
+ "node-key": e.nodeKey,
195
+ "filter-node-method": ne,
196
+ "expand-on-click-node": !1,
197
+ "default-expand-all": e.defaultExpandAll,
198
+ onNodeClick: re
250
199
  }, {
251
- default: H(() => [
252
- $(e.$slots, "tag", {
253
- item: n,
254
- index: i
200
+ default: H((a) => [
201
+ $(e.$slots, "tree-node", {
202
+ data: a?.data,
203
+ node: a?.node,
204
+ selectable: f(a?.data),
205
+ selected: B(g(a?.data))
255
206
  }, () => [
256
- W(J(n.label), 1)
207
+ a?.data ? (p(), k("span", {
208
+ key: 0,
209
+ class: S([
210
+ "g-input-tree-tag__node",
211
+ {
212
+ "is-selectable": f(a.data),
213
+ "is-selected": f(a.data) && B(g(a.data))
214
+ }
215
+ ])
216
+ }, [
217
+ f(a.data) && e.showLeafIcon ? (p(), T(m(_e), {
218
+ key: 0,
219
+ class: "g-input-tree-tag__node-icon"
220
+ }, {
221
+ default: H(() => [
222
+ R(m(Fe))
223
+ ]),
224
+ _: 1
225
+ })) : A("", !0),
226
+ W(" " + J(c(a.data)), 1)
227
+ ], 2)) : A("", !0)
257
228
  ], !0)
258
229
  ]),
259
- _: 2
260
- }, 1032, ["type", "effect", "closable", "onClose"]))), 128))
261
- ], !0)
262
- ])) : G("", !0)
263
- ], 512)
264
- ], 2);
265
- };
230
+ _: 3
231
+ }, 8, ["data", "props", "node-key", "default-expand-all"])
232
+ ], 4)
233
+ ], 38), [
234
+ [he, r.value]
235
+ ])
236
+ ])),
237
+ i.value.length ? (p(), k("div", Ie, [
238
+ $(e.$slots, "tags", {
239
+ items: i.value,
240
+ remove: Z
241
+ }, () => [
242
+ (p(!0), k(we, null, ye(i.value, (a, o) => (p(), T(m(Ve), {
243
+ key: a.value,
244
+ class: "g-input-tree-tag__tag",
245
+ type: e.tagType,
246
+ effect: e.tagEffect,
247
+ closable: e.closable && !e.disabled,
248
+ onClose: (u) => Z(o)
249
+ }, {
250
+ default: H(() => [
251
+ $(e.$slots, "tag", {
252
+ item: a,
253
+ index: o
254
+ }, () => [
255
+ W(J(a.label), 1)
256
+ ], !0)
257
+ ]),
258
+ _: 2
259
+ }, 1032, ["type", "effect", "closable", "onClose"]))), 128))
260
+ ], !0)
261
+ ])) : A("", !0)
262
+ ], 512)
263
+ ], 2));
266
264
  }
267
- }), z = /* @__PURE__ */ Ve(Fe, [["__scopeId", "data-v-f235428c"]]);
268
- z.install = (E) => {
269
- E.component(z.name, z);
265
+ }), z = /* @__PURE__ */ Be(Me, [["__scopeId", "data-v-6f1283aa"]]);
266
+ z.install = (_) => {
267
+ _.component(z.name, z);
270
268
  };
271
269
  export {
272
270
  z as GInputTreeTag,
@@ -1 +1 @@
1
- @charset "UTF-8";.g-input-tree-tag[data-v-f235428c]{width:100%}.g-input-tree-tag__wrap[data-v-f235428c]{display:flex;flex-direction:column;align-items:flex-start;gap:8px;width:100%}.g-input-tree-tag__tags[data-v-f235428c]{display:flex;flex-wrap:wrap;gap:8px;width:100%}.g-input-tree-tag__tag[data-v-f235428c]{margin:0}.g-input-tree-tag.is-disabled[data-v-f235428c]{cursor:not-allowed}.g-input-tree-tag__popover{box-sizing:border-box;background:var(--el-bg-color-overlay, #fff);border:1px solid var(--el-border-color-light);border-radius:4px;box-shadow:var(--el-box-shadow-light);padding:8px 0}.g-input-tree-tag__popover .g-input-tree-tag__tree-wrap{overflow:auto}.g-input-tree-tag__popover .g-input-tree-tag__node{display:inline-flex;align-items:center;gap:4px;font-size:13px}.g-input-tree-tag__popover .g-input-tree-tag__node-icon{font-size:14px;color:var(--el-text-color-secondary)}.g-input-tree-tag__popover .g-input-tree-tag__node.is-selectable{cursor:pointer;color:var(--el-text-color-primary)}.g-input-tree-tag__popover .g-input-tree-tag__node.is-selected,.g-input-tree-tag__popover .g-input-tree-tag__node.is-selected .g-input-tree-tag__node-icon{color:var(--el-color-primary)}
1
+ @charset "UTF-8";.g-input-tree-tag[data-v-6f1283aa]{width:100%}.g-input-tree-tag__wrap[data-v-6f1283aa]{display:flex;flex-direction:column;align-items:flex-start;gap:8px;width:100%}.g-input-tree-tag__tags[data-v-6f1283aa]{display:flex;flex-wrap:wrap;gap:8px;width:100%}.g-input-tree-tag__tag[data-v-6f1283aa]{margin:0}.g-input-tree-tag.is-disabled[data-v-6f1283aa]{cursor:not-allowed}.g-input-tree-tag__popover{box-sizing:border-box;background:var(--el-bg-color-overlay, #fff);border:1px solid var(--el-border-color-light);border-radius:4px;box-shadow:var(--el-box-shadow-light);padding:8px 0}.g-input-tree-tag__popover .g-input-tree-tag__tree-wrap{overflow:auto}.g-input-tree-tag__popover .g-input-tree-tag__node{display:inline-flex;align-items:center;gap:4px;font-size:13px}.g-input-tree-tag__popover .g-input-tree-tag__node-icon{font-size:14px;color:var(--el-text-color-secondary)}.g-input-tree-tag__popover .g-input-tree-tag__node.is-selectable{cursor:pointer;color:var(--el-text-color-primary)}.g-input-tree-tag__popover .g-input-tree-tag__node.is-selected,.g-input-tree-tag__popover .g-input-tree-tag__node.is-selected .g-input-tree-tag__node-icon{color:var(--el-color-primary)}
@@ -1,27 +1,11 @@
1
- import { DialogCloseAction, FooterAction } from './const';
2
- interface Props {
3
- /**
4
- * @description 标题名
5
- * @version 0.1.6
6
- * @default ''
7
- */
8
- title: string;
9
- /**
10
- * @description 对话框尺寸
11
- * @version 0.1.6
12
- * @default 'medium'
13
- */
14
- size?: 'small' | 'medium' | 'large' | string;
15
- /**
16
- * @description 是否显示对话框
17
- * @version 0.1.6
18
- * @default false
19
- */
20
- modelValue?: boolean;
21
- /**
22
- * @description 是否隐藏底部操作区(包含取消/重置/保存与自定义 actions)
23
- * @version 0.2.18
24
- * @default false
1
+ import { default as GDialog } from './index';
2
+ import { default as GDialogMinimizedIcon } from './GDialogMinimizedIcon';
3
+ import { createDialogManager, useDialogManager, DialogDescriptor, DialogManager, DialogPosition } from './useDialogManager';
4
+ import { DIALOG_MANAGER_KEY, DIALOG_SIZES, MINIMIZED_LAYOUT, DialogCloseAction, FooterAction } from './const';
5
+ export default GDialog;
6
+ export { GDialog, GDialogMinimizedIcon, createDialogManager, useDialogManager, DIALOG_MANAGER_KEY, DIALOG_SIZES, MINIMIZED_LAYOUT, };
7
+ export type { DialogDescriptor, DialogManager, DialogPosition, DialogCloseAction, FooterAction };
8
+
25
9
  */
26
10
  hideFooter?: boolean;
27
11
  /**