@qynpm/ui 1.0.10 → 1.0.12
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/README.md +297 -48
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +30 -23
- package/dist/qy-action-bar/index.cjs +1 -1
- package/dist/qy-action-bar/index.mjs +1 -1
- package/dist/qy-autocomplete/index.cjs +1 -0
- package/dist/qy-autocomplete/index.mjs +4 -0
- package/dist/qy-checkbox/index.cjs +1 -0
- package/dist/qy-checkbox/index.mjs +4 -0
- package/dist/qy-date-picker/index.cjs +1 -1
- package/dist/qy-date-picker/index.mjs +2 -2
- package/dist/qy-dialog/index.cjs +1 -1
- package/dist/qy-dialog/index.mjs +2 -2
- package/dist/qy-form-section/index.cjs +1 -1
- package/dist/qy-form-section/index.mjs +2 -2
- package/dist/qy-image/index.cjs +1 -0
- package/dist/qy-image/index.mjs +4 -0
- package/dist/qy-image-preview/index.cjs +1 -0
- package/dist/qy-image-preview/index.mjs +5 -0
- package/dist/qy-image-upload/index.cjs +1 -1
- package/dist/qy-image-upload/index.mjs +1 -1
- package/dist/qy-input/index.cjs +1 -1
- package/dist/qy-input/index.mjs +1 -1
- package/dist/qy-input-number/index.cjs +1 -1
- package/dist/qy-input-number/index.mjs +2 -2
- package/dist/qy-legacy-selection-dialog/index.cjs +1 -1
- package/dist/qy-legacy-selection-dialog/index.mjs +1 -1
- package/dist/qy-menu-actions/index.cjs +1 -0
- package/dist/qy-menu-actions/index.mjs +7 -0
- package/dist/qy-money-input/index.cjs +1 -1
- package/dist/qy-money-input/index.mjs +1 -1
- package/dist/qy-radio-group/index.cjs +1 -1
- package/dist/qy-radio-group/index.mjs +1 -1
- package/dist/qy-record-quote-search/index.cjs +1 -1
- package/dist/qy-record-quote-search/index.mjs +2 -2
- package/dist/qy-remark-image/index.cjs +1 -1
- package/dist/qy-remark-image/index.mjs +1 -1
- package/dist/qy-remote-select/index.cjs +1 -1
- package/dist/qy-remote-select/index.mjs +1 -1
- package/dist/qy-search-input/index.cjs +1 -1
- package/dist/qy-search-input/index.mjs +2 -2
- package/dist/qy-select/index.cjs +1 -1
- package/dist/qy-select/index.mjs +1 -1
- package/dist/qy-selection-dialog/index.cjs +1 -1
- package/dist/qy-selection-dialog/index.mjs +2 -2
- package/dist/qy-table-column-settings/index.cjs +1 -0
- package/dist/qy-table-column-settings/index.mjs +10 -0
- package/dist/qy-tree-select/index.cjs +1 -1
- package/dist/qy-tree-select/index.mjs +1 -1
- package/dist/qy-upload/index.cjs +1 -1
- package/dist/qy-upload/index.mjs +1 -1
- package/dist/shared/index-B4JNbDHG.mjs +153 -0
- package/dist/shared/index-B7ZgDgHR.cjs +1 -0
- package/dist/shared/index-BWIOoRpy.mjs +293 -0
- package/dist/shared/index-CQPIT5by.cjs +1 -0
- package/dist/shared/index-ClPd2qa5.cjs +1 -0
- package/dist/shared/index-D9hV_AKF.mjs +4330 -0
- package/dist/shared/install-DMq9RQ-h.mjs +15 -0
- package/dist/shared/install-DNgKRKb2.cjs +1 -0
- package/index.d.ts +31 -11
- package/package.json +38 -1
- package/qy-autocomplete/index.d.ts +5 -0
- package/qy-autocomplete/index.js +1 -0
- package/qy-checkbox/index.d.ts +5 -0
- package/qy-checkbox/index.js +1 -0
- package/qy-image/index.d.ts +28 -0
- package/qy-image/index.js +1 -0
- package/qy-image-preview/index.d.ts +20 -0
- package/qy-image-preview/index.js +1 -0
- package/qy-menu-actions/index.d.ts +29 -0
- package/qy-menu-actions/index.js +7 -0
- package/qy-table-column-settings/index.d.ts +18 -0
- package/qy-table-column-settings/index.js +10 -0
- package/dist/shared/index-Bk5wZECl.cjs +0 -1
- package/dist/shared/index-CulYemoD.mjs +0 -3904
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { ElPopover as I } from "element-plus/es";
|
|
2
|
+
import { defineComponent as E, computed as h, ref as w, onBeforeUnmount as $, openBlock as r, createElementBlock as s, normalizeClass as q, createBlock as D, withCtx as T, createElementVNode as c, Fragment as C, renderList as M, normalizeStyle as A, createCommentVNode as m, toDisplayString as y } from "vue";
|
|
3
|
+
import { _ as N } from "./install-DMq9RQ-h.mjs";
|
|
4
|
+
const P = { class: "qy-menu-actions__panel" }, U = ["disabled", "data-action-key", "onClick"], W = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "qy-menu-actions__loading"
|
|
7
|
+
}, F = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "qy-menu-actions__empty"
|
|
10
|
+
}, H = {
|
|
11
|
+
key: 1,
|
|
12
|
+
class: "qy-menu-actions__inline"
|
|
13
|
+
}, K = ["disabled", "data-action-key", "onClick"], Q = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "qy-menu-actions__loading"
|
|
16
|
+
}, j = {
|
|
17
|
+
key: 0,
|
|
18
|
+
class: "qy-menu-actions__empty"
|
|
19
|
+
}, G = /* @__PURE__ */ E({
|
|
20
|
+
name: "QyMenuActions",
|
|
21
|
+
__name: "index",
|
|
22
|
+
props: {
|
|
23
|
+
actions: { default: () => [] },
|
|
24
|
+
row: {},
|
|
25
|
+
rowIndex: {},
|
|
26
|
+
context: {},
|
|
27
|
+
mode: { default: "inline" },
|
|
28
|
+
emptyText: { default: "无数据" },
|
|
29
|
+
popoverWidth: { default: 150 },
|
|
30
|
+
confirmMethod: {}
|
|
31
|
+
},
|
|
32
|
+
emits: ["action", "confirm-required"],
|
|
33
|
+
setup(a, { emit: z }) {
|
|
34
|
+
const i = a, g = z, k = h(() => {
|
|
35
|
+
var e, o;
|
|
36
|
+
return {
|
|
37
|
+
...i.context,
|
|
38
|
+
row: i.row ?? ((e = i.context) == null ? void 0 : e.row),
|
|
39
|
+
rowIndex: i.rowIndex ?? ((o = i.context) == null ? void 0 : o.rowIndex)
|
|
40
|
+
};
|
|
41
|
+
}), p = w(!1), u = w(/* @__PURE__ */ new Set()), B = (e, o) => ({
|
|
42
|
+
...k.value,
|
|
43
|
+
target: o.currentTarget,
|
|
44
|
+
hide: S,
|
|
45
|
+
setLoading: (n) => V(e, n)
|
|
46
|
+
}), f = (e) => typeof e == "function" ? e(k.value) : !!e, d = h(
|
|
47
|
+
() => i.actions.filter((e) => !f(e.hidden))
|
|
48
|
+
), L = h(
|
|
49
|
+
() => d.value.some((e) => l(e))
|
|
50
|
+
), v = (e) => f(e.disabled) || l(e), l = (e) => u.value.has(e.key) || f(e.loading), x = (e, o) => {
|
|
51
|
+
const n = e.type || o;
|
|
52
|
+
return {
|
|
53
|
+
default: "var(--el-text-color-primary)",
|
|
54
|
+
primary: "var(--el-color-primary)",
|
|
55
|
+
success: "var(--el-color-success)",
|
|
56
|
+
warning: "var(--el-color-warning)",
|
|
57
|
+
danger: "var(--el-color-danger)"
|
|
58
|
+
}[n];
|
|
59
|
+
}, b = async (e, o) => {
|
|
60
|
+
if (o.stopPropagation(), v(e)) return;
|
|
61
|
+
const n = B(e, o);
|
|
62
|
+
if (e.confirm) {
|
|
63
|
+
if (!i.confirmMethod) {
|
|
64
|
+
g("confirm-required", e, n);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (!await i.confirmMethod(e, n)) return;
|
|
68
|
+
}
|
|
69
|
+
g("action", e, n);
|
|
70
|
+
};
|
|
71
|
+
function S() {
|
|
72
|
+
p.value = !1;
|
|
73
|
+
}
|
|
74
|
+
function V(e, o) {
|
|
75
|
+
const n = new Set(u.value);
|
|
76
|
+
o ? n.add(e.key) : n.delete(e.key), u.value = n;
|
|
77
|
+
}
|
|
78
|
+
return $(() => {
|
|
79
|
+
u.value = /* @__PURE__ */ new Set();
|
|
80
|
+
}), (e, o) => {
|
|
81
|
+
const n = I;
|
|
82
|
+
return r(), s("div", {
|
|
83
|
+
class: q(["qy-menu-actions", `is-${a.mode}`])
|
|
84
|
+
}, [
|
|
85
|
+
a.mode === "popover" ? (r(), D(n, {
|
|
86
|
+
key: 0,
|
|
87
|
+
visible: p.value,
|
|
88
|
+
"onUpdate:visible": o[0] || (o[0] = (t) => p.value = t),
|
|
89
|
+
trigger: "hover",
|
|
90
|
+
placement: "left",
|
|
91
|
+
width: a.popoverWidth,
|
|
92
|
+
"hide-after": L.value ? 999999 : 100,
|
|
93
|
+
"show-arrow": !1,
|
|
94
|
+
"popper-class": "qy-menu-actions__popover"
|
|
95
|
+
}, {
|
|
96
|
+
reference: T(() => [...o[1] || (o[1] = [
|
|
97
|
+
c("button", {
|
|
98
|
+
class: "qy-menu-actions__trigger",
|
|
99
|
+
type: "button",
|
|
100
|
+
"aria-label": "行操作"
|
|
101
|
+
}, [
|
|
102
|
+
c("svg", {
|
|
103
|
+
class: "qy-menu-actions__trigger-icon",
|
|
104
|
+
viewBox: "0 0 24 24",
|
|
105
|
+
"aria-hidden": "true"
|
|
106
|
+
}, [
|
|
107
|
+
c("path", {
|
|
108
|
+
fill: "currentColor",
|
|
109
|
+
d: "M8 17q.425 0 .713-.288T9 16q0-.425-.288-.712T8 15q-.425 0-.712.288T7 16q0 .425.288.713T8 17m0-4q.425 0 .713-.288T9 12q0-.425-.288-.712T8 11q-.425 0-.712.288T7 12q0 .425.288.713T8 13m0-4q.425 0 .713-.288T9 8q0-.425-.288-.712T8 7q-.425 0-.712.288T7 8q0 .425.288.713T8 9m3 8h6v-2h-6zm0-4h6v-2h-6zm0-4h6V7h-6zM5 21q-.825 0-1.412-.587T3 19V5q0-.825.588-1.412T5 3h14q.825 0 1.413.588T21 5v14q0 .825-.587 1.413T19 21zm0-2h14V5H5z"
|
|
110
|
+
})
|
|
111
|
+
])
|
|
112
|
+
], -1)
|
|
113
|
+
])]),
|
|
114
|
+
default: T(() => [
|
|
115
|
+
c("div", P, [
|
|
116
|
+
(r(!0), s(C, null, M(d.value, (t) => (r(), s("button", {
|
|
117
|
+
key: t.key,
|
|
118
|
+
class: q(["qy-menu-actions__item", [`is-${t.type || "default"}`, { "is-loading": l(t) }]]),
|
|
119
|
+
disabled: v(t),
|
|
120
|
+
"data-action-key": t.key,
|
|
121
|
+
style: A({ color: x(t, "default") }),
|
|
122
|
+
type: "button",
|
|
123
|
+
onClick: (_) => b(t, _)
|
|
124
|
+
}, [
|
|
125
|
+
l(t) ? (r(), s("span", W)) : m("", !0),
|
|
126
|
+
c("span", null, y(t.label), 1)
|
|
127
|
+
], 14, U))), 128)),
|
|
128
|
+
d.value.length ? m("", !0) : (r(), s("div", F, y(a.emptyText), 1))
|
|
129
|
+
])
|
|
130
|
+
]),
|
|
131
|
+
_: 1
|
|
132
|
+
}, 8, ["visible", "width", "hide-after"])) : (r(), s("div", H, [
|
|
133
|
+
(r(!0), s(C, null, M(d.value, (t) => (r(), s("button", {
|
|
134
|
+
key: t.key,
|
|
135
|
+
class: q(["qy-menu-actions__item", [`is-${t.type || "primary"}`, { "is-loading": l(t) }]]),
|
|
136
|
+
disabled: v(t),
|
|
137
|
+
"data-action-key": t.key,
|
|
138
|
+
style: A({ color: x(t, "primary") }),
|
|
139
|
+
type: "button",
|
|
140
|
+
onClick: (_) => b(t, _)
|
|
141
|
+
}, [
|
|
142
|
+
l(t) ? (r(), s("span", Q)) : m("", !0),
|
|
143
|
+
c("span", null, y(t.label), 1)
|
|
144
|
+
], 14, K))), 128)),
|
|
145
|
+
d.value.length ? m("", !0) : (r(), s("span", j, y(a.emptyText), 1))
|
|
146
|
+
]))
|
|
147
|
+
], 2);
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
}), X = /* @__PURE__ */ N(G, [["__scopeId", "data-v-484879c4"]]);
|
|
151
|
+
export {
|
|
152
|
+
X as M
|
|
153
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const m=require("element-plus/es"),e=require("vue"),F=require("./install-DNgKRKb2.cjs"),K={class:"qy-table-column-settings"},L={class:"qy-table-column-settings__table-wrap"},Q=["data-testid","onClick"],R={class:"qy-table-column-settings__side","data-testid":"settings-side-actions"},W={class:"qy-table-column-settings__side-main"},j={key:0,class:"qy-table-column-settings__selected is-empty"},A={key:1,class:"qy-table-column-settings__selected"},G={class:"qy-table-column-settings__side-footer"},H=e.defineComponent({name:"QyTableColumnSettings",__name:"index",props:{modelValue:{type:Boolean},settings:{default:()=>[]},defaultSettings:{default:void 0},title:{default:"列设置"},width:{default:"700px"},showDeleteCache:{type:Boolean,default:!0},unconfigurableTypes:{default:()=>["index","selection","expand","setup"]}},emits:["update:modelValue","confirm","reset","cancel","delete-cache","change"],setup(p,{emit:w}){const c=p,u=w,s=e.ref([]),r=e.ref(""),b=l=>l.map(t=>({...t})),h=()=>{var l;s.value=b(c.settings),r.value=((l=s.value[0])==null?void 0:l.key)||""};e.watch(()=>c.modelValue,l=>{l&&h()},{immediate:!0});const v=()=>{u("change",b(s.value))},f=l=>s.value.find(t=>t.key===l),o=e.computed(()=>f(r.value)),d=e.computed(()=>s.value.findIndex(l=>l.key===r.value)),N=l=>!!(l.type&&c.unconfigurableTypes.includes(l.type)),E=l=>l==="left"?"left":l==="right"?"right":"none",k=l=>l.type==="index"?"序号":l.type==="selection"?"多选":l.type==="expand"?"展开":l.type==="setup"?"设置":l.label||l.prop||l.key,V=l=>{l&&(r.value=l.key)},C=l=>{o.value&&q(o.value.key,l)},q=(l,t)=>{const n=f(l);n&&(n.fixed=t,v())},S=(l,t)=>{const n=f(l);!n||N(n)||(n.visible=t,v())},B=(l,t)=>{const n=f(l);n&&(n.width=t,v())},g=(l,t)=>{if(l===t||l<0||l>=s.value.length||t<0||t>=s.value.length)return;const n=[...s.value],[y]=n.splice(l,1);n.splice(t,0,y),s.value=n,r.value=y.key,v()},$=()=>{var t,n;const l=(t=c.defaultSettings)!=null&&t.length?c.defaultSettings:c.settings;s.value=b(l),r.value=((n=s.value[0])==null?void 0:n.key)||"",u("reset",b(s.value)),v()},x=()=>{u("cancel"),u("update:modelValue",!1)},T=()=>{u("confirm",b(s.value)),u("update:modelValue",!1)};return(l,t)=>{const n=m.ElTableColumn,y=m.ElInput,D=m.ElSwitch,U=m.ElTable,i=m.ElButton,z=m.ElDialog;return e.openBlock(),e.createBlock(z,{"model-value":p.modelValue,title:p.title,width:p.width,"append-to-body":"",onClose:x},{footer:e.withCtx(()=>[e.createVNode(i,{"data-action":"cancel",onClick:x},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode(" 取消 ",-1)])]),_:1}),e.createVNode(i,{type:"primary","data-action":"confirm",onClick:T},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode(" 确定 ",-1)])]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",K,[e.createElementVNode("div",L,[e.createVNode(U,{data:s.value,"row-key":"key",height:"400px",border:"","highlight-current-row":"","data-testid":"settings-table",onCurrentChange:V,onRowClick:V},{default:e.withCtx(()=>[e.createVNode(n,{label:"列名",prop:"label","show-overflow-tooltip":""},{default:e.withCtx(({row:a})=>[e.createElementVNode("div",{class:"qy-table-column-settings__name","data-testid":`table-row-${a.key}`,onClick:_=>V(a)},[e.createElementVNode("span",{class:e.normalizeClass(["qy-table-column-settings__fixed-mark",`is-${E(a.fixed)}`]),"aria-hidden":"true"},null,2),e.createElementVNode("span",null,e.toDisplayString(k(a)),1)],8,Q)]),_:1}),e.createVNode(n,{label:"列宽(px)",prop:"width",width:"150"},{default:e.withCtx(({row:a})=>[e.createVNode(y,{"model-value":a.width,size:"small",placeholder:"留空自动设置宽度","data-testid":"width","onUpdate:modelValue":_=>B(a.key,_)},null,8,["model-value","onUpdate:modelValue"])]),_:1}),e.createVNode(n,{label:"列显示",prop:"visible",width:"100"},{default:e.withCtx(({row:a})=>[e.createVNode(D,{"model-value":a.visible,disabled:N(a),style:{"--el-switch-on-color":"rgb(99 102 241)"},"data-testid":"visible-switch","onUpdate:modelValue":_=>S(a.key,!!_)},null,8,["model-value","disabled","onUpdate:modelValue"])]),_:1})]),_:1},8,["data"])]),e.createElementVNode("div",R,[e.createElementVNode("div",W,[o.value?(e.openBlock(),e.createElementBlock("div",A,e.toDisplayString(k(o.value)),1)):(e.openBlock(),e.createElementBlock("div",j," 请选择列 ")),e.createVNode(i,{class:"qy-table-column-settings__side-button",disabled:!o.value||d.value===0,"data-action":"top",onClick:t[0]||(t[0]=a=>g(d.value,0))},{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createElementVNode("span",{class:"qy-table-column-settings__action-icon is-top"},null,-1),e.createElementVNode("span",null,"置顶",-1)])]),_:1},8,["disabled"]),e.createVNode(i,{class:"qy-table-column-settings__side-button",disabled:!o.value||d.value===0,"data-action":"up",onClick:t[1]||(t[1]=a=>g(d.value,d.value-1))},{default:e.withCtx(()=>[...t[9]||(t[9]=[e.createElementVNode("span",{class:"qy-table-column-settings__action-icon is-up"},null,-1),e.createElementVNode("span",null,"上移",-1)])]),_:1},8,["disabled"]),e.createVNode(i,{class:"qy-table-column-settings__side-button",disabled:!o.value||d.value===s.value.length-1,"data-action":"down",onClick:t[2]||(t[2]=a=>g(d.value,d.value+1))},{default:e.withCtx(()=>[...t[10]||(t[10]=[e.createElementVNode("span",{class:"qy-table-column-settings__action-icon is-down"},null,-1),e.createElementVNode("span",null,"下移",-1)])]),_:1},8,["disabled"]),e.createVNode(i,{class:"qy-table-column-settings__side-button",disabled:!o.value||d.value===s.value.length-1,"data-action":"bottom",onClick:t[3]||(t[3]=a=>g(d.value,s.value.length-1))},{default:e.withCtx(()=>[...t[11]||(t[11]=[e.createElementVNode("span",{class:"qy-table-column-settings__action-icon is-bottom"},null,-1),e.createElementVNode("span",null,"置底",-1)])]),_:1},8,["disabled"]),e.createVNode(i,{class:"qy-table-column-settings__side-button",disabled:!o.value,"data-action":"fixed-left",onClick:t[4]||(t[4]=a=>C("left"))},{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createElementVNode("span",{class:"qy-table-column-settings__action-icon is-fixed-left"},null,-1),e.createElementVNode("span",null,"固定左边",-1)])]),_:1},8,["disabled"]),e.createVNode(i,{class:"qy-table-column-settings__side-button",disabled:!o.value,"data-action":"fixed-right",onClick:t[5]||(t[5]=a=>C("right"))},{default:e.withCtx(()=>[...t[13]||(t[13]=[e.createElementVNode("span",{class:"qy-table-column-settings__action-icon is-fixed-right"},null,-1),e.createElementVNode("span",null,"固定右边",-1)])]),_:1},8,["disabled"]),e.createVNode(i,{class:"qy-table-column-settings__side-button",disabled:!o.value,"data-action":"clear-fixed",onClick:t[6]||(t[6]=a=>C(!1))},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createElementVNode("span",{class:"qy-table-column-settings__action-icon is-clear-fixed"},null,-1),e.createElementVNode("span",null,"取消固定",-1)])]),_:1},8,["disabled"])]),e.createElementVNode("div",G,[e.createVNode(i,{"data-action":"reset",onClick:$},{default:e.withCtx(()=>[...t[15]||(t[15]=[e.createElementVNode("span",{class:"qy-table-column-settings__action-icon is-reset"},null,-1),e.createElementVNode("span",null,"恢复默认",-1)])]),_:1}),p.showDeleteCache?(e.openBlock(),e.createBlock(i,{key:0,type:"danger",plain:"","data-action":"delete-cache",onClick:t[7]||(t[7]=a=>u("delete-cache"))},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createElementVNode("span",{class:"qy-table-column-settings__action-icon is-reset"},null,-1),e.createElementVNode("span",null,"删除缓存",-1)])]),_:1})):e.createCommentVNode("",!0)])])])]),_:1},8,["model-value","title","width"])}}}),J=F._export_sfc(H,[["__scopeId","data-v-56d579b9"]]);exports.TableColumnSettings=J;
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { ElDialog as G, ElTable as H, ElTableColumn as J, ElInput as M, ElSwitch as O, ElButton as P } from "element-plus/es";
|
|
2
|
+
import { defineComponent as X, ref as S, watch as Y, computed as $, openBlock as C, createBlock as B, withCtx as i, createElementVNode as l, createVNode as o, normalizeClass as Z, toDisplayString as E, createElementBlock as T, createCommentVNode as I, createTextVNode as D } from "vue";
|
|
3
|
+
import { _ as ee } from "./install-DMq9RQ-h.mjs";
|
|
4
|
+
const te = { class: "qy-table-column-settings" }, le = { class: "qy-table-column-settings__table-wrap" }, ne = ["data-testid", "onClick"], se = {
|
|
5
|
+
class: "qy-table-column-settings__side",
|
|
6
|
+
"data-testid": "settings-side-actions"
|
|
7
|
+
}, ae = { class: "qy-table-column-settings__side-main" }, ie = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "qy-table-column-settings__selected is-empty"
|
|
10
|
+
}, oe = {
|
|
11
|
+
key: 1,
|
|
12
|
+
class: "qy-table-column-settings__selected"
|
|
13
|
+
}, ue = { class: "qy-table-column-settings__side-footer" }, de = /* @__PURE__ */ X({
|
|
14
|
+
name: "QyTableColumnSettings",
|
|
15
|
+
__name: "index",
|
|
16
|
+
props: {
|
|
17
|
+
modelValue: { type: Boolean },
|
|
18
|
+
settings: { default: () => [] },
|
|
19
|
+
defaultSettings: { default: void 0 },
|
|
20
|
+
title: { default: "列设置" },
|
|
21
|
+
width: { default: "700px" },
|
|
22
|
+
showDeleteCache: { type: Boolean, default: !0 },
|
|
23
|
+
unconfigurableTypes: { default: () => ["index", "selection", "expand", "setup"] }
|
|
24
|
+
},
|
|
25
|
+
emits: ["update:modelValue", "confirm", "reset", "cancel", "delete-cache", "change"],
|
|
26
|
+
setup(b, { emit: U }) {
|
|
27
|
+
const m = b, r = U, a = S([]), p = S(""), f = (t) => t.map((e) => ({ ...e })), N = () => {
|
|
28
|
+
var t;
|
|
29
|
+
a.value = f(m.settings), p.value = ((t = a.value[0]) == null ? void 0 : t.key) || "";
|
|
30
|
+
};
|
|
31
|
+
Y(
|
|
32
|
+
() => m.modelValue,
|
|
33
|
+
(t) => {
|
|
34
|
+
t && N();
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
immediate: !0
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
const v = () => {
|
|
41
|
+
r("change", f(a.value));
|
|
42
|
+
}, _ = (t) => a.value.find((e) => e.key === t), u = $(() => _(p.value)), c = $(
|
|
43
|
+
() => a.value.findIndex((t) => t.key === p.value)
|
|
44
|
+
), w = (t) => !!(t.type && m.unconfigurableTypes.includes(t.type)), z = (t) => t === "left" ? "left" : t === "right" ? "right" : "none", h = (t) => t.type === "index" ? "序号" : t.type === "selection" ? "多选" : t.type === "expand" ? "展开" : t.type === "setup" ? "设置" : t.label || t.prop || t.key, q = (t) => {
|
|
45
|
+
t && (p.value = t.key);
|
|
46
|
+
}, x = (t) => {
|
|
47
|
+
u.value && F(u.value.key, t);
|
|
48
|
+
}, F = (t, e) => {
|
|
49
|
+
const n = _(t);
|
|
50
|
+
n && (n.fixed = e, v());
|
|
51
|
+
}, K = (t, e) => {
|
|
52
|
+
const n = _(t);
|
|
53
|
+
!n || w(n) || (n.visible = e, v());
|
|
54
|
+
}, L = (t, e) => {
|
|
55
|
+
const n = _(t);
|
|
56
|
+
n && (n.width = e, v());
|
|
57
|
+
}, y = (t, e) => {
|
|
58
|
+
if (t === e || t < 0 || t >= a.value.length || e < 0 || e >= a.value.length) return;
|
|
59
|
+
const n = [...a.value], [g] = n.splice(t, 1);
|
|
60
|
+
n.splice(e, 0, g), a.value = n, p.value = g.key, v();
|
|
61
|
+
}, Q = () => {
|
|
62
|
+
var e, n;
|
|
63
|
+
const t = (e = m.defaultSettings) != null && e.length ? m.defaultSettings : m.settings;
|
|
64
|
+
a.value = f(t), p.value = ((n = a.value[0]) == null ? void 0 : n.key) || "", r("reset", f(a.value)), v();
|
|
65
|
+
}, V = () => {
|
|
66
|
+
r("cancel"), r("update:modelValue", !1);
|
|
67
|
+
}, R = () => {
|
|
68
|
+
r("confirm", f(a.value)), r("update:modelValue", !1);
|
|
69
|
+
};
|
|
70
|
+
return (t, e) => {
|
|
71
|
+
const n = J, g = M, W = O, j = H, d = P, A = G;
|
|
72
|
+
return C(), B(A, {
|
|
73
|
+
"model-value": b.modelValue,
|
|
74
|
+
title: b.title,
|
|
75
|
+
width: b.width,
|
|
76
|
+
"append-to-body": "",
|
|
77
|
+
onClose: V
|
|
78
|
+
}, {
|
|
79
|
+
footer: i(() => [
|
|
80
|
+
o(d, {
|
|
81
|
+
"data-action": "cancel",
|
|
82
|
+
onClick: V
|
|
83
|
+
}, {
|
|
84
|
+
default: i(() => [...e[17] || (e[17] = [
|
|
85
|
+
D(" 取消 ", -1)
|
|
86
|
+
])]),
|
|
87
|
+
_: 1
|
|
88
|
+
}),
|
|
89
|
+
o(d, {
|
|
90
|
+
type: "primary",
|
|
91
|
+
"data-action": "confirm",
|
|
92
|
+
onClick: R
|
|
93
|
+
}, {
|
|
94
|
+
default: i(() => [...e[18] || (e[18] = [
|
|
95
|
+
D(" 确定 ", -1)
|
|
96
|
+
])]),
|
|
97
|
+
_: 1
|
|
98
|
+
})
|
|
99
|
+
]),
|
|
100
|
+
default: i(() => [
|
|
101
|
+
l("div", te, [
|
|
102
|
+
l("div", le, [
|
|
103
|
+
o(j, {
|
|
104
|
+
data: a.value,
|
|
105
|
+
"row-key": "key",
|
|
106
|
+
height: "400px",
|
|
107
|
+
border: "",
|
|
108
|
+
"highlight-current-row": "",
|
|
109
|
+
"data-testid": "settings-table",
|
|
110
|
+
onCurrentChange: q,
|
|
111
|
+
onRowClick: q
|
|
112
|
+
}, {
|
|
113
|
+
default: i(() => [
|
|
114
|
+
o(n, {
|
|
115
|
+
label: "列名",
|
|
116
|
+
prop: "label",
|
|
117
|
+
"show-overflow-tooltip": ""
|
|
118
|
+
}, {
|
|
119
|
+
default: i(({ row: s }) => [
|
|
120
|
+
l("div", {
|
|
121
|
+
class: "qy-table-column-settings__name",
|
|
122
|
+
"data-testid": `table-row-${s.key}`,
|
|
123
|
+
onClick: (k) => q(s)
|
|
124
|
+
}, [
|
|
125
|
+
l("span", {
|
|
126
|
+
class: Z(["qy-table-column-settings__fixed-mark", `is-${z(s.fixed)}`]),
|
|
127
|
+
"aria-hidden": "true"
|
|
128
|
+
}, null, 2),
|
|
129
|
+
l("span", null, E(h(s)), 1)
|
|
130
|
+
], 8, ne)
|
|
131
|
+
]),
|
|
132
|
+
_: 1
|
|
133
|
+
}),
|
|
134
|
+
o(n, {
|
|
135
|
+
label: "列宽(px)",
|
|
136
|
+
prop: "width",
|
|
137
|
+
width: "150"
|
|
138
|
+
}, {
|
|
139
|
+
default: i(({ row: s }) => [
|
|
140
|
+
o(g, {
|
|
141
|
+
"model-value": s.width,
|
|
142
|
+
size: "small",
|
|
143
|
+
placeholder: "留空自动设置宽度",
|
|
144
|
+
"data-testid": "width",
|
|
145
|
+
"onUpdate:modelValue": (k) => L(s.key, k)
|
|
146
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"])
|
|
147
|
+
]),
|
|
148
|
+
_: 1
|
|
149
|
+
}),
|
|
150
|
+
o(n, {
|
|
151
|
+
label: "列显示",
|
|
152
|
+
prop: "visible",
|
|
153
|
+
width: "100"
|
|
154
|
+
}, {
|
|
155
|
+
default: i(({ row: s }) => [
|
|
156
|
+
o(W, {
|
|
157
|
+
"model-value": s.visible,
|
|
158
|
+
disabled: w(s),
|
|
159
|
+
style: { "--el-switch-on-color": "rgb(99 102 241)" },
|
|
160
|
+
"data-testid": "visible-switch",
|
|
161
|
+
"onUpdate:modelValue": (k) => K(s.key, !!k)
|
|
162
|
+
}, null, 8, ["model-value", "disabled", "onUpdate:modelValue"])
|
|
163
|
+
]),
|
|
164
|
+
_: 1
|
|
165
|
+
})
|
|
166
|
+
]),
|
|
167
|
+
_: 1
|
|
168
|
+
}, 8, ["data"])
|
|
169
|
+
]),
|
|
170
|
+
l("div", se, [
|
|
171
|
+
l("div", ae, [
|
|
172
|
+
u.value ? (C(), T("div", oe, E(h(u.value)), 1)) : (C(), T("div", ie, " 请选择列 ")),
|
|
173
|
+
o(d, {
|
|
174
|
+
class: "qy-table-column-settings__side-button",
|
|
175
|
+
disabled: !u.value || c.value === 0,
|
|
176
|
+
"data-action": "top",
|
|
177
|
+
onClick: e[0] || (e[0] = (s) => y(c.value, 0))
|
|
178
|
+
}, {
|
|
179
|
+
default: i(() => [...e[8] || (e[8] = [
|
|
180
|
+
l("span", { class: "qy-table-column-settings__action-icon is-top" }, null, -1),
|
|
181
|
+
l("span", null, "置顶", -1)
|
|
182
|
+
])]),
|
|
183
|
+
_: 1
|
|
184
|
+
}, 8, ["disabled"]),
|
|
185
|
+
o(d, {
|
|
186
|
+
class: "qy-table-column-settings__side-button",
|
|
187
|
+
disabled: !u.value || c.value === 0,
|
|
188
|
+
"data-action": "up",
|
|
189
|
+
onClick: e[1] || (e[1] = (s) => y(c.value, c.value - 1))
|
|
190
|
+
}, {
|
|
191
|
+
default: i(() => [...e[9] || (e[9] = [
|
|
192
|
+
l("span", { class: "qy-table-column-settings__action-icon is-up" }, null, -1),
|
|
193
|
+
l("span", null, "上移", -1)
|
|
194
|
+
])]),
|
|
195
|
+
_: 1
|
|
196
|
+
}, 8, ["disabled"]),
|
|
197
|
+
o(d, {
|
|
198
|
+
class: "qy-table-column-settings__side-button",
|
|
199
|
+
disabled: !u.value || c.value === a.value.length - 1,
|
|
200
|
+
"data-action": "down",
|
|
201
|
+
onClick: e[2] || (e[2] = (s) => y(c.value, c.value + 1))
|
|
202
|
+
}, {
|
|
203
|
+
default: i(() => [...e[10] || (e[10] = [
|
|
204
|
+
l("span", { class: "qy-table-column-settings__action-icon is-down" }, null, -1),
|
|
205
|
+
l("span", null, "下移", -1)
|
|
206
|
+
])]),
|
|
207
|
+
_: 1
|
|
208
|
+
}, 8, ["disabled"]),
|
|
209
|
+
o(d, {
|
|
210
|
+
class: "qy-table-column-settings__side-button",
|
|
211
|
+
disabled: !u.value || c.value === a.value.length - 1,
|
|
212
|
+
"data-action": "bottom",
|
|
213
|
+
onClick: e[3] || (e[3] = (s) => y(c.value, a.value.length - 1))
|
|
214
|
+
}, {
|
|
215
|
+
default: i(() => [...e[11] || (e[11] = [
|
|
216
|
+
l("span", { class: "qy-table-column-settings__action-icon is-bottom" }, null, -1),
|
|
217
|
+
l("span", null, "置底", -1)
|
|
218
|
+
])]),
|
|
219
|
+
_: 1
|
|
220
|
+
}, 8, ["disabled"]),
|
|
221
|
+
o(d, {
|
|
222
|
+
class: "qy-table-column-settings__side-button",
|
|
223
|
+
disabled: !u.value,
|
|
224
|
+
"data-action": "fixed-left",
|
|
225
|
+
onClick: e[4] || (e[4] = (s) => x("left"))
|
|
226
|
+
}, {
|
|
227
|
+
default: i(() => [...e[12] || (e[12] = [
|
|
228
|
+
l("span", { class: "qy-table-column-settings__action-icon is-fixed-left" }, null, -1),
|
|
229
|
+
l("span", null, "固定左边", -1)
|
|
230
|
+
])]),
|
|
231
|
+
_: 1
|
|
232
|
+
}, 8, ["disabled"]),
|
|
233
|
+
o(d, {
|
|
234
|
+
class: "qy-table-column-settings__side-button",
|
|
235
|
+
disabled: !u.value,
|
|
236
|
+
"data-action": "fixed-right",
|
|
237
|
+
onClick: e[5] || (e[5] = (s) => x("right"))
|
|
238
|
+
}, {
|
|
239
|
+
default: i(() => [...e[13] || (e[13] = [
|
|
240
|
+
l("span", { class: "qy-table-column-settings__action-icon is-fixed-right" }, null, -1),
|
|
241
|
+
l("span", null, "固定右边", -1)
|
|
242
|
+
])]),
|
|
243
|
+
_: 1
|
|
244
|
+
}, 8, ["disabled"]),
|
|
245
|
+
o(d, {
|
|
246
|
+
class: "qy-table-column-settings__side-button",
|
|
247
|
+
disabled: !u.value,
|
|
248
|
+
"data-action": "clear-fixed",
|
|
249
|
+
onClick: e[6] || (e[6] = (s) => x(!1))
|
|
250
|
+
}, {
|
|
251
|
+
default: i(() => [...e[14] || (e[14] = [
|
|
252
|
+
l("span", { class: "qy-table-column-settings__action-icon is-clear-fixed" }, null, -1),
|
|
253
|
+
l("span", null, "取消固定", -1)
|
|
254
|
+
])]),
|
|
255
|
+
_: 1
|
|
256
|
+
}, 8, ["disabled"])
|
|
257
|
+
]),
|
|
258
|
+
l("div", ue, [
|
|
259
|
+
o(d, {
|
|
260
|
+
"data-action": "reset",
|
|
261
|
+
onClick: Q
|
|
262
|
+
}, {
|
|
263
|
+
default: i(() => [...e[15] || (e[15] = [
|
|
264
|
+
l("span", { class: "qy-table-column-settings__action-icon is-reset" }, null, -1),
|
|
265
|
+
l("span", null, "恢复默认", -1)
|
|
266
|
+
])]),
|
|
267
|
+
_: 1
|
|
268
|
+
}),
|
|
269
|
+
b.showDeleteCache ? (C(), B(d, {
|
|
270
|
+
key: 0,
|
|
271
|
+
type: "danger",
|
|
272
|
+
plain: "",
|
|
273
|
+
"data-action": "delete-cache",
|
|
274
|
+
onClick: e[7] || (e[7] = (s) => r("delete-cache"))
|
|
275
|
+
}, {
|
|
276
|
+
default: i(() => [...e[16] || (e[16] = [
|
|
277
|
+
l("span", { class: "qy-table-column-settings__action-icon is-reset" }, null, -1),
|
|
278
|
+
l("span", null, "删除缓存", -1)
|
|
279
|
+
])]),
|
|
280
|
+
_: 1
|
|
281
|
+
})) : I("", !0)
|
|
282
|
+
])
|
|
283
|
+
])
|
|
284
|
+
])
|
|
285
|
+
]),
|
|
286
|
+
_: 1
|
|
287
|
+
}, 8, ["model-value", "title", "width"]);
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
}), pe = /* @__PURE__ */ ee(de, [["__scopeId", "data-v-56d579b9"]]);
|
|
291
|
+
export {
|
|
292
|
+
pe as T
|
|
293
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const x=require("element-plus/es"),e=require("vue"),w=require("./install-DNgKRKb2.cjs"),b={class:"qy-menu-actions__panel"},T=["disabled","data-action-key","onClick"],C={key:0,class:"qy-menu-actions__loading"},E={key:0,class:"qy-menu-actions__empty"},V={key:1,class:"qy-menu-actions__inline"},z=["disabled","data-action-key","onClick"],A={key:0,class:"qy-menu-actions__loading"},M={key:0,class:"qy-menu-actions__empty"},N=e.defineComponent({name:"QyMenuActions",__name:"index",props:{actions:{default:()=>[]},row:{},rowIndex:{},context:{},mode:{default:"inline"},emptyText:{default:"无数据"},popoverWidth:{default:150},confirmMethod:{}},emits:["action","confirm-required"],setup(s,{emit:_}){const r=s,y=_,k=e.computed(()=>{var t,n;return{...r.context,row:r.row??((t=r.context)==null?void 0:t.row),rowIndex:r.rowIndex??((n=r.context)==null?void 0:n.rowIndex)}}),d=e.ref(!1),i=e.ref(new Set),h=(t,n)=>({...k.value,target:n.currentTarget,hide:q,setLoading:l=>B(t,l)}),m=t=>typeof t=="function"?t(k.value):!!t,c=e.computed(()=>r.actions.filter(t=>!m(t.hidden))),g=e.computed(()=>c.value.some(t=>a(t))),u=t=>m(t.disabled)||a(t),a=t=>i.value.has(t.key)||m(t.loading),v=(t,n)=>{const l=t.type||n;return{default:"var(--el-text-color-primary)",primary:"var(--el-color-primary)",success:"var(--el-color-success)",warning:"var(--el-color-warning)",danger:"var(--el-color-danger)"}[l]},f=async(t,n)=>{if(n.stopPropagation(),u(t))return;const l=h(t,n);if(t.confirm){if(!r.confirmMethod){y("confirm-required",t,l);return}if(!await r.confirmMethod(t,l))return}y("action",t,l)};function q(){d.value=!1}function B(t,n){const l=new Set(i.value);n?l.add(t.key):l.delete(t.key),i.value=l}return e.onBeforeUnmount(()=>{i.value=new Set}),(t,n)=>{const l=x.ElPopover;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["qy-menu-actions",`is-${s.mode}`])},[s.mode==="popover"?(e.openBlock(),e.createBlock(l,{key:0,visible:d.value,"onUpdate:visible":n[0]||(n[0]=o=>d.value=o),trigger:"hover",placement:"left",width:s.popoverWidth,"hide-after":g.value?999999:100,"show-arrow":!1,"popper-class":"qy-menu-actions__popover"},{reference:e.withCtx(()=>[...n[1]||(n[1]=[e.createElementVNode("button",{class:"qy-menu-actions__trigger",type:"button","aria-label":"行操作"},[e.createElementVNode("svg",{class:"qy-menu-actions__trigger-icon",viewBox:"0 0 24 24","aria-hidden":"true"},[e.createElementVNode("path",{fill:"currentColor",d:"M8 17q.425 0 .713-.288T9 16q0-.425-.288-.712T8 15q-.425 0-.712.288T7 16q0 .425.288.713T8 17m0-4q.425 0 .713-.288T9 12q0-.425-.288-.712T8 11q-.425 0-.712.288T7 12q0 .425.288.713T8 13m0-4q.425 0 .713-.288T9 8q0-.425-.288-.712T8 7q-.425 0-.712.288T7 8q0 .425.288.713T8 9m3 8h6v-2h-6zm0-4h6v-2h-6zm0-4h6V7h-6zM5 21q-.825 0-1.412-.587T3 19V5q0-.825.588-1.412T5 3h14q.825 0 1.413.588T21 5v14q0 .825-.587 1.413T19 21zm0-2h14V5H5z"})])],-1)])]),default:e.withCtx(()=>[e.createElementVNode("div",b,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,o=>(e.openBlock(),e.createElementBlock("button",{key:o.key,class:e.normalizeClass(["qy-menu-actions__item",[`is-${o.type||"default"}`,{"is-loading":a(o)}]]),disabled:u(o),"data-action-key":o.key,style:e.normalizeStyle({color:v(o,"default")}),type:"button",onClick:p=>f(o,p)},[a(o)?(e.openBlock(),e.createElementBlock("span",C)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(o.label),1)],14,T))),128)),c.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",E,e.toDisplayString(s.emptyText),1))])]),_:1},8,["visible","width","hide-after"])):(e.openBlock(),e.createElementBlock("div",V,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,o=>(e.openBlock(),e.createElementBlock("button",{key:o.key,class:e.normalizeClass(["qy-menu-actions__item",[`is-${o.type||"primary"}`,{"is-loading":a(o)}]]),disabled:u(o),"data-action-key":o.key,style:e.normalizeStyle({color:v(o,"primary")}),type:"button",onClick:p=>f(o,p)},[a(o)?(e.openBlock(),e.createElementBlock("span",A)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(o.label),1)],14,z))),128)),c.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",M,e.toDisplayString(s.emptyText),1))]))],2)}}}),S=w._export_sfc(N,[["__scopeId","data-v-484879c4"]]);exports.MenuActions=S;
|