@duxweb/dvha-pro 1.0.27 → 1.0.28
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/cjs/components/layout/table.cjs +1 -1
- package/dist/cjs/components/table/tablePage.cjs +1 -1
- package/dist/cjs/hooks/action.cjs +1 -1
- package/dist/cjs/theme/uno.css.cjs +1 -1
- package/dist/esm/components/layout/table.js +24 -24
- package/dist/esm/components/table/tablePage.js +9 -8
- package/dist/esm/hooks/action.js +49 -48
- package/dist/esm/theme/uno.css.js +1 -1
- package/dist/types/components/table/tablePage.d.ts +1 -0
- package/dist/types/hooks/table/types.d.ts +2 -2
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),p=require("@duxweb/dvha-core"),E=require("@vueuse/core"),a=require("naive-ui"),F=require("../../hooks/action.cjs");require("@overlastic/vue");require("clsx");require("vue-echarts");require("vue3-ace-editor");require("ace-builds/src-noconflict/mode-vue");require("ace-builds/src-noconflict/mode-javascript");require("ace-builds/src-noconflict/mode-html");require("ace-builds/src-noconflict/mode-json");require("ace-builds/src-noconflict/mode-json5");require("ace-builds/src-noconflict/theme-tomorrow_night");require("ace-builds/src-noconflict/theme-tomorrow");require("ace-builds/src-noconflict/ext-searchbox");require("ace-builds/src-noconflict/ext-language_tools");require("ace-builds/src-noconflict/mode-snippets");require("vue-cropper");const W=require("../modal/modalPage.cjs");require("jinrishici");require("lodash-es");require("vue-draggable-plus");const I=require("./filter.cjs"),J=require("./filterLayout.cjs");require("@vee-validate/i18n");require("colorizr");require("echarts");require("@ant-design/colors");require("@unocss/preset-icons/browser");require("@unocss/preset-typography");require("unocss/preset-wind4");require("@vee-validate/i18n/dist/locale/en.json");require("@vee-validate/i18n/dist/locale/zh_CN.json");require("vee-validate");require("vue-router");require("vue-command-palette");require("@duxweb/dvha-naiveui");const M=require("../../pages/page.cjs");require("../../pages/page404.cjs");const v=require("../drawer/drawerPage.cjs"),_=require("./tools.cjs");require("short-unique-id");require("aieditor");require("@iconify-json/tabler/icons.json");require("../posterEditor/elements/index.cjs");require("fabric");require("mime");require("dayjs");require("@tanstack/vue-query");const $=require("../../hooks/table.cjs");require("pinia");function K(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!e.isVNode(t)}const G=e.defineComponent({name:"DuxTableLayout",props:{path:{type:String,required:!0},filter:{type:Object},filterSchema:{type:Array},filterNumber:{type:Number,default:1},columns:{type:Array},pagination:{type:[Boolean,Object],default:!0},tabs:{type:Array},actions:{type:Array,default:()=>[]},tools:{type:Object},sideLeftTitle:{type:String,default:""},sideRightTitle:{type:String,default:""},hookTableProps:{type:Object}},setup(t,{slots:o}){const f=e.toRef(t,"filter",{}),q=e.toRef(t,"columns",[]),{t:l}=p.useI18n(),{renderAction:w}=F.useAction(),b=$.useTable({path:t.path,filters:f.value,columns:q,pagination:t.pagination,...t.hookTableProps}),{columns:N,tablePagination:y,table:V,onUpdateColumnSelected:x,onUpdateChecked:T,columnSelected:k,autoRefetch:C,autoCountdown:m,onAutoRefetch:R,isExporting:S,isExportingRows:j,isImporting:L,onExport:P,onExportRows:D,onImport:z}=b,B=e.computed(()=>N.value.filter(r=>"title"in r&&"key"in r).map(r=>({label:r.title,value:r.key}))),{width:n}=E.useWindowSize(),O=e.computed(()=>N.value.reduce((i,d)=>i+(Number(d?.width)||Number(d?.minWidth)||110),0)),u=e.reactive({show:!1}),c=e.reactive({show:!1}),s=e.reactive({show:!1}),h=e.computed(()=>(t.filterSchema||[]).map(r=>{const{label:i,...d}=r;return{tag:I.DuxTableFilter,attrs:{label:i},children:d}})),{render:U}=p.useJsonSchema({data:e.computed(()=>h.value?.slice(t.filterNumber))}),{render:A}=p.useJsonSchema({data:e.computed(()=>h.value?.slice(0,t.filterNumber))}),g=e.computed(()=>({import:!1,export:!0,refresh:!0,...t.tools}));return()=>e.createVNode(M.DuxPage,{actions:t.actions,scrollbar:!1},{sideLeft:()=>o?.sideLeft&&n.value>=1024?o?.sideLeft?.():void 0,sideRight:()=>o?.sideRight&&n.value>=1024?o?.sideRight?.():void 0,default:()=>e.createVNode("div",{class:"flex flex-col gap-2 h-full relative"},[e.createVNode("div",{class:"flex gap-2 justify-between flex-col lg:flex-row"},[t.tabs&&e.createVNode("div",{class:"flex flex-none"},[e.createVNode(a.NTabs,{type:"segment",size:"small",style:{"--n-tab-padding":"4px 10px"},"default-value":t.tabs?.[0]?.value,value:f.value?.tab,onUpdateValue:r=>{f.value.tab=r}},{default:()=>[t.tabs?.map(r=>e.createVNode(a.NTab,{name:r.value,tab:r.label},null))]})]),e.createVNode("div",{class:["overflow-hidden flex-1 flex gap-2"]},[o?.sideLeft&&n.value<1024&&e.createVNode(a.NButton,{class:"flex-none",secondary:!0,onClick:()=>{c.show=!c.show}},{icon:()=>e.createVNode("div",{class:"i-tabler:layout-sidebar-inactive size-4"},null)}),e.createVNode("div",{class:["flex-1 flex flex-col lg:flex-row gap-2 flex-wrap",t.tabs?"justify-end":"justify-start"]},[e.h(A)]),o?.sideRight&&n.value<1024&&e.createVNode(a.NButton,{class:"flex-none",secondary:!0,onClick:()=>{s.show=!s.show}},{icon:()=>e.createVNode("div",{class:"i-tabler:layout-sidebar-right-inactive size-4"},null)})]),e.createVNode("div",{class:"flex gap-2 justify-between lg:justify-end"},[e.createVNode("div",{class:"flex gap-2 items-center"},[h.value.length>t.filterNumber&&e.createVNode(a.NButton,{iconPlacement:"right",onClick:()=>{u.show=!u.show}},{default:()=>l("components.button.filter"),icon:()=>e.createVNode("div",{class:["i-tabler:chevrons-down size-4 transition-all"]},null)}),o?.tools?.(),e.createVNode(a.NPopselect,{options:B.value,value:k.value,onUpdateValue:r=>{x(r)},multiple:!0,placement:"bottom-start",trigger:"click"},{default:()=>[e.createVNode(a.NTooltip,null,{trigger:()=>e.createVNode(a.NButton,{secondary:!0,"icon-placement":"right"},{icon:()=>e.createVNode("div",{class:"i-tabler:columns size-4"},null)}),default:()=>l("components.list.columnSetting")})]}),g.value.export&&e.createVNode(a.NTooltip,null,{trigger:()=>e.createVNode(a.NButton,{secondary:!0,loading:S.value,onClick:P},{icon:()=>e.createVNode("div",{class:"i-tabler:database-export size-4"},null)}),default:()=>l("components.button.export")}),g.value.import&&e.createVNode(a.NTooltip,null,{trigger:()=>e.createVNode(a.NButton,{secondary:!0,loading:L.value,onClick:z},{icon:()=>e.createVNode("div",{class:"i-tabler:database-import size-4"},null)}),default:()=>l("components.button.import")}),g.value.refresh&&e.createVNode(a.NTooltip,null,{trigger:()=>e.createVNode(a.NButton,{secondary:!0,onClick:R},{icon:()=>C.value?e.createVNode(a.NProgress,{class:"size-4",type:"circle",percentage:m.value*10,strokeWidth:20,color:"rgba(var(--ui-color-primary))"},{default:()=>[e.createVNode("span",{class:"text-8px"},[m.value])]}):e.createVNode("div",{class:"i-tabler:refresh size-4"},null)}),default:()=>l("components.button.autoRefresh")})]),e.createVNode("div",{class:"flex gap-2 justify-end"},[o.actions?.(),t.actions?.length>0&&w({type:n.value<1024?"dropdown":"button",items:t.actions})])])]),o?.header?.(),e.createVNode("div",{class:"flex-1 min-h-0"},[o?.default?.({...b,width:O.value})]),e.createVNode("div",{class:"flex justify-between"},[e.createVNode("div",null,[o?.bottom?.()]),e.createVNode("div",null,[t.pagination&&e.createVNode(a.NPagination,e.mergeProps(y.value,{simple:n.value<768}),{prefix:()=>e.createVNode("div",null,[l("components.list.total",{total:b.total.value||0})])})])]),e.createVNode(_.DuxTableTools,{number:V.value.checkedRowKeys?.length||0||0,group:[[{icon:"i-tabler:x",onClick:()=>{T?.([])}}],[{label:l("components.button.export"),icon:"i-tabler:file-export",loading:j.value,onClick:D},{label:l("components.button.delete"),type:"error",icon:"i-tabler:trash"}]]},null),e.createVNode(a.NModal,{draggable:!0,class:"bg-white rounded dark:shadow-gray-950/80 dark:bg-gray-800/60 backdrop-blur min-w-110",show:u.show,onUpdateShow:r=>u.show=r},{default:({draggableClass:r})=>{let i;return e.createVNode(W.default,{title:l("components.button.filter"),handle:r,onClose:()=>u.show=!1},{default:()=>[e.createVNode(J.DuxFilterLayout,{showLabel:!0,labelPlacement:"top"},K(i=e.h(U))?i:{default:()=>[i]})]})}}),e.createVNode(a.NDrawer,{show:c.show,onUpdateShow:r=>c.show=r,autoFocus:!1,placement:"left"},{default:()=>[e.createVNode(v.DuxDrawerPage,{title:t.sideLeftTitle||l("components.button.sideLeft"),onClose:()=>c.show=!1,scrollbar:!1},{default:()=>[o?.sideLeft?.()]})]}),e.createVNode(a.NDrawer,{show:s.show,onUpdateShow:r=>s.show=r,autoFocus:!1,placement:"right"},{default:()=>[e.createVNode(v.DuxDrawerPage,{title:t.sideRightTitle||l("components.button.sideRight"),onClose:()=>s.show=!1,scrollbar:!1},{default:()=>[o?.sideRight?.()]})]})])})}});exports.DuxTableLayout=G;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("vue"),u=require("naive-ui"),i=require("../layout/table.cjs");require("@duxweb/dvha-core");require("clsx");const n=require("../status/listEmpty.cjs"),d=r.defineComponent({name:"DuxTablePage",props:{tableProps:{type:Object}},extends:i.DuxTableLayout,slots:Object,setup(o,{slots:t}){const l=r.computed(()=>{const{tableProps:a,...e}=o;return e});return()=>r.createVNode(i.DuxTableLayout,l.value,{default:a=>r.createVNode(u.NDataTable,r.mergeProps(a.table.value,o.tableProps,{class:"h-full",minHeight:200,tableLayout:"fixed",flexHeight:!0,rowKey:e=>e.id,bordered:!1,scrollX:a.width,renderCell:e=>e==null||e===""?"-":e}),{empty:()=>r.createVNode(n.DuxListEmpty,{bordered:!1},null)}),bottom:t?.bottom,tools:t?.tools,actions:t?.actions,sideLeft:t?.sideLeft,sideRight:t?.sideRight,header:t?.header})}});exports.DuxTablePage=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@duxweb/dvha-core"),f=require("naive-ui"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@duxweb/dvha-core"),f=require("naive-ui"),s=require("vue"),S=require("vue-router"),M=require("./dialog.cjs"),$=require("./drawer.cjs"),D=require("./modal.cjs");function I(o){const h=D.useModal(),i=$.useDrawer(),u=M.useDialog(),{t:n}=r.useI18n(),d=f.useMessage(),y=r.useManage(),k=S.useRouter(),v=r.useCustomMutation({onSuccess:t=>{d.success(t.message||n("common.success"))},onError:t=>{d.error(t.message||n("common.error"))}}),q=r.useDelete({onSuccess:t=>{d.success(t.message||n("common.success"))},onError:t=>{d.error(t.message||n("common.error"))}}),m=o?.path||y.getPath(),g=t=>{const c=n(t.item.title||"",{},t.item.title),l=n(t.item.label||"",{},t.item.label);if(t.item.type==="modal"){const e=t.item,a=typeof e.componentProps=="function"?e.componentProps(t.data):e.componentProps;h.show({title:c||l,component:e.component,componentProps:{id:t.id,...a},width:e.width,draggable:e.draggable!==void 0?e.draggable:!0})}if(t.item.type==="drawer"){const e=t.item,a=typeof e.componentProps=="function"?e.componentProps(t.data):e.componentProps;i.show({title:c||l,component:e.component,componentProps:{id:t.id,...a},width:e.width,maxWidth:e.maxWidth})}if(t.item.type==="confirm"){const e=t.item;u.confirm({title:c||l,content:e.content}).then(a=>{a&&e.callback?.(t.id,t.data)})}if(t.item.type==="request"){const e=t.item;u.confirm({title:c||l,content:e.content}).then(()=>{const a=typeof e.data=="function"?e.data(t.id,t.data):e.data,A=(e.method||"post").toLowerCase(),j=typeof e.path=="function"?e.path(t.id,t.data):e.path||m;v.mutate({path:j,method:A,payload:a})})}if(t.item.type==="delete"){const e=t.item;u.confirm({title:c||l,content:e.content}).then(()=>{q.mutate({id:t.id,path:typeof e.path=="function"?e.path(t.id,t.data):e.path||m})})}if(t.item.type==="link"){const e=t.item;let a=typeof e.path=="function"?e.path?.(t.id,t.data):t.id?`${e.path||m}${t.data===void 0?"":`/${t.id}`}`:e.path||m;a.startsWith("/")||(a=y.getRoutePath(a)),k.push(a)}t.item.type==="callback"&&t.item.callback?.(t.id,t.data)},b=w(),x=P();return{target:g,renderTable:t=>(c,l)=>{const e={id:c[t.key||o?.key||"id"],data:c,index:l,target:g,text:t.text!==void 0?t.text:o?.text||!1,align:t.align!==void 0?t.align:o?.align||"left"};return(t.type||o?.type)==="button"?b.render({...e,action:t||o}):x.render({...e,action:t||o})},renderAction:t=>{const c={target:g,text:t.text!==void 0?t.text:o?.text||!1,align:t.align!==void 0?t.align:o?.align||"left"};return(t.type||o?.type)==="button"?b.render({...c,action:t||o}):x.render({...c,action:t||o})}}}function w(){const{t:o}=r.useI18n();return{render:i=>{const u=i.action.items?.filter(n=>!n.show||n.show?.(i.data,i.index)).map((n,d)=>s.h(f.NButton,{key:d,type:n.color||(n.type==="delete"?"error":"primary"),text:i.text,secondary:!i.text,onClick:()=>{i?.target?.({id:i.id,data:i.data,item:n})},renderIcon:n.icon?()=>s.h("div",{class:["n-icon",n.icon]}):void 0},()=>o(n.label||"",{},n.label)));return s.h("div",{class:["flex gap-2 flex-wrap items-center",i.align==="right"?"justify-end":i.align==="center"?"justify-center":"justify-start"]},u)}}}function P(){const{t:o}=r.useI18n();return{render:i=>{const u=i.action.items?.filter(n=>!n.show||n.show?.(i.data,i.index)).map((n,d)=>({label:o(n.label||"",{},n.label),key:d,icon:n.icon?()=>s.h("div",{class:["n-icon",n.icon]}):void 0,onSelect:()=>{i?.target?.({id:i.id,data:i.data,item:n})}}));return s.h(f.NDropdown,{trigger:"click",options:u,onSelect:(n,d)=>{d?.onSelect?.()}},()=>[s.h("div",{class:["flex items-center",i.align==="right"?"justify-end":i.align==="center"?"justify-center":"justify-start"]},s.h(f.NButton,{type:"default",text:i.text,secondary:!i.text,renderIcon:()=>s.h("div",{class:["n-icon","i-tabler:dots-vertical"]})}))])}}}exports.useAction=I;exports.useActionButton=w;exports.useActionDropdown=P;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=`/* layer: properties */
|
|
2
|
-
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*, ::before, ::after, ::backdrop{--un-
|
|
2
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*, ::before, ::after, ::backdrop{--un-text-opacity:100%;--un-bg-opacity:100%;--un-from-opacity:100%;--un-divide-y-reverse:initial;--un-border-style:solid;--un-divide-x-reverse:initial;--un-divide-opacity:100%;--un-shadow-opacity:100%;--un-ease:initial;--un-translate-x:initial;--un-translate-y:initial;--un-translate-z:initial;--un-border-opacity:100%;--un-to-opacity:100%;--un-fill-opacity:100%;--un-outline-style:solid;}}
|
|
3
3
|
@property --un-text-opacity{syntax:"<percentage>";inherits:false;initial-value:100%;}
|
|
4
4
|
@property --un-outline-style{syntax:"*";inherits:false;initial-value:solid;}
|
|
5
5
|
@property --un-border-opacity{syntax:"<percentage>";inherits:false;initial-value:100%;}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as J, toRef as x, computed as
|
|
1
|
+
import { defineComponent as J, toRef as x, computed as s, reactive as v, createVNode as e, h as k, mergeProps as K, isVNode as G } from "vue";
|
|
2
2
|
import { useI18n as H, useJsonSchema as C } from "@duxweb/dvha-core";
|
|
3
3
|
import { useWindowSize as Q } from "@vueuse/core";
|
|
4
4
|
import { NTabs as X, NTab as Y, NButton as r, NPopselect as Z, NTooltip as f, NProgress as $, NPagination as ee, NModal as te, NDrawer as N } from "naive-ui";
|
|
@@ -129,38 +129,38 @@ const ut = /* @__PURE__ */ J({
|
|
|
129
129
|
onExport: V,
|
|
130
130
|
onExportRows: W,
|
|
131
131
|
onImport: I
|
|
132
|
-
} = b, B =
|
|
132
|
+
} = b, B = s(() => w.value.filter((o) => "title" in o && "key" in o).map((o) => ({
|
|
133
133
|
label: o.title,
|
|
134
134
|
value: o.key
|
|
135
135
|
}))), {
|
|
136
136
|
width: n
|
|
137
|
-
} = Q(), M =
|
|
138
|
-
show: !1
|
|
139
|
-
}), u = v({
|
|
137
|
+
} = Q(), M = s(() => w.value.reduce((a, m) => a + (Number(m?.width) || Number(m?.minWidth) || 110), 0)), u = v({
|
|
140
138
|
show: !1
|
|
141
139
|
}), c = v({
|
|
142
140
|
show: !1
|
|
143
|
-
}),
|
|
141
|
+
}), d = v({
|
|
142
|
+
show: !1
|
|
143
|
+
}), h = s(() => (t.filterSchema || []).map((o) => {
|
|
144
144
|
const {
|
|
145
145
|
label: a,
|
|
146
|
-
...
|
|
146
|
+
...m
|
|
147
147
|
} = o;
|
|
148
148
|
return {
|
|
149
149
|
tag: ie,
|
|
150
150
|
attrs: {
|
|
151
151
|
label: a
|
|
152
152
|
},
|
|
153
|
-
children:
|
|
153
|
+
children: m
|
|
154
154
|
};
|
|
155
155
|
})), {
|
|
156
156
|
render: _
|
|
157
157
|
} = C({
|
|
158
|
-
data: h.value?.slice(t.filterNumber)
|
|
158
|
+
data: s(() => h.value?.slice(t.filterNumber))
|
|
159
159
|
}), {
|
|
160
160
|
render: q
|
|
161
161
|
} = C({
|
|
162
|
-
data: h.value?.slice(0, t.filterNumber)
|
|
163
|
-
}), g =
|
|
162
|
+
data: s(() => h.value?.slice(0, t.filterNumber))
|
|
163
|
+
}), g = s(() => ({
|
|
164
164
|
import: !1,
|
|
165
165
|
export: !0,
|
|
166
166
|
refresh: !0,
|
|
@@ -200,7 +200,7 @@ const ut = /* @__PURE__ */ J({
|
|
|
200
200
|
class: "flex-none",
|
|
201
201
|
secondary: !0,
|
|
202
202
|
onClick: () => {
|
|
203
|
-
|
|
203
|
+
c.show = !c.show;
|
|
204
204
|
}
|
|
205
205
|
}, {
|
|
206
206
|
icon: () => e("div", {
|
|
@@ -212,7 +212,7 @@ const ut = /* @__PURE__ */ J({
|
|
|
212
212
|
class: "flex-none",
|
|
213
213
|
secondary: !0,
|
|
214
214
|
onClick: () => {
|
|
215
|
-
|
|
215
|
+
d.show = !d.show;
|
|
216
216
|
}
|
|
217
217
|
}, {
|
|
218
218
|
icon: () => e("div", {
|
|
@@ -225,7 +225,7 @@ const ut = /* @__PURE__ */ J({
|
|
|
225
225
|
}, [h.value.length > t.filterNumber && e(r, {
|
|
226
226
|
iconPlacement: "right",
|
|
227
227
|
onClick: () => {
|
|
228
|
-
|
|
228
|
+
u.show = !u.show;
|
|
229
229
|
}
|
|
230
230
|
}, {
|
|
231
231
|
default: () => i("components.button.filter"),
|
|
@@ -300,7 +300,7 @@ const ut = /* @__PURE__ */ J({
|
|
|
300
300
|
}, [l.actions?.(), t.actions?.length > 0 && T({
|
|
301
301
|
type: n.value < 1024 ? "dropdown" : "button",
|
|
302
302
|
items: t.actions
|
|
303
|
-
})])])]), e("div", {
|
|
303
|
+
})])])]), l?.header?.(), e("div", {
|
|
304
304
|
class: "flex-1 min-h-0"
|
|
305
305
|
}, [l?.default?.({
|
|
306
306
|
...b,
|
|
@@ -333,8 +333,8 @@ const ut = /* @__PURE__ */ J({
|
|
|
333
333
|
}, null), e(te, {
|
|
334
334
|
draggable: !0,
|
|
335
335
|
class: "bg-white rounded dark:shadow-gray-950/80 dark:bg-gray-800/60 backdrop-blur min-w-110",
|
|
336
|
-
show:
|
|
337
|
-
onUpdateShow: (o) =>
|
|
336
|
+
show: u.show,
|
|
337
|
+
onUpdateShow: (o) => u.show = o
|
|
338
338
|
}, {
|
|
339
339
|
default: ({
|
|
340
340
|
draggableClass: o
|
|
@@ -343,7 +343,7 @@ const ut = /* @__PURE__ */ J({
|
|
|
343
343
|
return e(le, {
|
|
344
344
|
title: i("components.button.filter"),
|
|
345
345
|
handle: o,
|
|
346
|
-
onClose: () =>
|
|
346
|
+
onClose: () => u.show = !1
|
|
347
347
|
}, {
|
|
348
348
|
default: () => [e(ae, {
|
|
349
349
|
showLabel: !0,
|
|
@@ -354,27 +354,27 @@ const ut = /* @__PURE__ */ J({
|
|
|
354
354
|
});
|
|
355
355
|
}
|
|
356
356
|
}), e(N, {
|
|
357
|
-
show:
|
|
358
|
-
onUpdateShow: (o) =>
|
|
357
|
+
show: c.show,
|
|
358
|
+
onUpdateShow: (o) => c.show = o,
|
|
359
359
|
autoFocus: !1,
|
|
360
360
|
placement: "left"
|
|
361
361
|
}, {
|
|
362
362
|
default: () => [e(R, {
|
|
363
363
|
title: t.sideLeftTitle || i("components.button.sideLeft"),
|
|
364
|
-
onClose: () =>
|
|
364
|
+
onClose: () => c.show = !1,
|
|
365
365
|
scrollbar: !1
|
|
366
366
|
}, {
|
|
367
367
|
default: () => [l?.sideLeft?.()]
|
|
368
368
|
})]
|
|
369
369
|
}), e(N, {
|
|
370
|
-
show:
|
|
371
|
-
onUpdateShow: (o) =>
|
|
370
|
+
show: d.show,
|
|
371
|
+
onUpdateShow: (o) => d.show = o,
|
|
372
372
|
autoFocus: !1,
|
|
373
373
|
placement: "right"
|
|
374
374
|
}, {
|
|
375
375
|
default: () => [e(R, {
|
|
376
376
|
title: t.sideRightTitle || i("components.button.sideRight"),
|
|
377
|
-
onClose: () =>
|
|
377
|
+
onClose: () => d.show = !1,
|
|
378
378
|
scrollbar: !1
|
|
379
379
|
}, {
|
|
380
380
|
default: () => [l?.sideRight?.()]
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as l, computed as m, createVNode as r, mergeProps as n } from "vue";
|
|
2
2
|
import { NDataTable as p } from "naive-ui";
|
|
3
3
|
import { DuxTableLayout as i } from "../layout/table.js";
|
|
4
4
|
import "@duxweb/dvha-core";
|
|
5
5
|
import "clsx";
|
|
6
|
-
import { DuxListEmpty as
|
|
7
|
-
const
|
|
6
|
+
import { DuxListEmpty as b } from "../status/listEmpty.js";
|
|
7
|
+
const g = /* @__PURE__ */ l({
|
|
8
8
|
name: "DuxTablePage",
|
|
9
9
|
props: {
|
|
10
10
|
tableProps: {
|
|
@@ -16,14 +16,14 @@ const P = /* @__PURE__ */ d({
|
|
|
16
16
|
setup(a, {
|
|
17
17
|
slots: t
|
|
18
18
|
}) {
|
|
19
|
-
const
|
|
19
|
+
const d = m(() => {
|
|
20
20
|
const {
|
|
21
21
|
tableProps: o,
|
|
22
22
|
...e
|
|
23
23
|
} = a;
|
|
24
24
|
return e;
|
|
25
25
|
});
|
|
26
|
-
return () => r(i,
|
|
26
|
+
return () => r(i, d.value, {
|
|
27
27
|
default: (o) => r(p, n(o.table.value, a.tableProps, {
|
|
28
28
|
class: "h-full",
|
|
29
29
|
minHeight: 200,
|
|
@@ -34,7 +34,7 @@ const P = /* @__PURE__ */ d({
|
|
|
34
34
|
scrollX: o.width,
|
|
35
35
|
renderCell: (e) => e == null || e === "" ? "-" : e
|
|
36
36
|
}), {
|
|
37
|
-
empty: () => r(
|
|
37
|
+
empty: () => r(b, {
|
|
38
38
|
bordered: !1
|
|
39
39
|
}, null)
|
|
40
40
|
}),
|
|
@@ -42,10 +42,11 @@ const P = /* @__PURE__ */ d({
|
|
|
42
42
|
tools: t?.tools,
|
|
43
43
|
actions: t?.actions,
|
|
44
44
|
sideLeft: t?.sideLeft,
|
|
45
|
-
sideRight: t?.sideRight
|
|
45
|
+
sideRight: t?.sideRight,
|
|
46
|
+
header: t?.header
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
49
|
});
|
|
49
50
|
export {
|
|
50
|
-
|
|
51
|
+
g as DuxTablePage
|
|
51
52
|
};
|
package/dist/esm/hooks/action.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { useI18n as
|
|
1
|
+
import { useI18n as h, useManage as A, useCustomMutation as M, useDelete as S } from "@duxweb/dvha-core";
|
|
2
2
|
import { useMessage as D, NButton as b, NDropdown as C } from "naive-ui";
|
|
3
3
|
import { h as l } from "vue";
|
|
4
4
|
import { useRouter as I } from "vue-router";
|
|
5
5
|
import { useDialog as N } from "./dialog.js";
|
|
6
|
-
import { useDrawer as
|
|
7
|
-
import { useModal as
|
|
6
|
+
import { useDrawer as W } from "./drawer.js";
|
|
7
|
+
import { useModal as $ } from "./modal.js";
|
|
8
8
|
function K(o) {
|
|
9
|
-
const u =
|
|
9
|
+
const u = $(), i = W(), m = N(), {
|
|
10
10
|
t: n
|
|
11
|
-
} =
|
|
11
|
+
} = h(), d = D(), g = A(), w = I(), P = M({
|
|
12
12
|
onSuccess: (t) => {
|
|
13
|
-
|
|
13
|
+
d.success(t.message || n("common.success"));
|
|
14
14
|
},
|
|
15
15
|
onError: (t) => {
|
|
16
|
-
|
|
16
|
+
d.error(t.message || n("common.error"));
|
|
17
17
|
}
|
|
18
18
|
}), k = S({
|
|
19
19
|
onSuccess: (t) => {
|
|
20
|
-
|
|
20
|
+
d.success(t.message || n("common.success"));
|
|
21
21
|
},
|
|
22
22
|
onError: (t) => {
|
|
23
|
-
|
|
23
|
+
d.error(t.message || n("common.error"));
|
|
24
24
|
}
|
|
25
|
-
}), r = o?.path ||
|
|
26
|
-
const
|
|
25
|
+
}), r = o?.path || g.getPath(), f = (t) => {
|
|
26
|
+
const c = n(t.item.title || "", {}, t.item.title), s = n(t.item.label || "", {}, t.item.label);
|
|
27
27
|
if (t.item.type === "modal") {
|
|
28
|
-
const e = t.item,
|
|
28
|
+
const e = t.item, a = typeof e.componentProps == "function" ? e.componentProps(t.data) : e.componentProps;
|
|
29
29
|
u.show({
|
|
30
|
-
title:
|
|
30
|
+
title: c || s,
|
|
31
31
|
component: e.component,
|
|
32
32
|
componentProps: {
|
|
33
33
|
id: t.id,
|
|
34
|
-
...
|
|
34
|
+
...a
|
|
35
35
|
},
|
|
36
36
|
width: e.width,
|
|
37
37
|
draggable: e.draggable !== void 0 ? e.draggable : !0
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
if (t.item.type === "drawer") {
|
|
41
|
-
const e = t.item,
|
|
41
|
+
const e = t.item, a = typeof e.componentProps == "function" ? e.componentProps(t.data) : e.componentProps;
|
|
42
42
|
i.show({
|
|
43
|
-
title:
|
|
43
|
+
title: c || s,
|
|
44
44
|
component: e.component,
|
|
45
45
|
componentProps: {
|
|
46
46
|
id: t.id,
|
|
47
|
-
...
|
|
47
|
+
...a
|
|
48
48
|
},
|
|
49
49
|
width: e.width,
|
|
50
50
|
maxWidth: e.maxWidth
|
|
@@ -53,30 +53,30 @@ function K(o) {
|
|
|
53
53
|
if (t.item.type === "confirm") {
|
|
54
54
|
const e = t.item;
|
|
55
55
|
m.confirm({
|
|
56
|
-
title:
|
|
56
|
+
title: c || s,
|
|
57
57
|
content: e.content
|
|
58
|
-
}).then((
|
|
59
|
-
|
|
58
|
+
}).then((a) => {
|
|
59
|
+
a && e.callback?.(t.id, t.data);
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
if (t.item.type === "request") {
|
|
63
63
|
const e = t.item;
|
|
64
64
|
m.confirm({
|
|
65
|
-
title:
|
|
65
|
+
title: c || s,
|
|
66
66
|
content: e.content
|
|
67
67
|
}).then(() => {
|
|
68
|
-
const
|
|
68
|
+
const a = typeof e.data == "function" ? e.data(t.id, t.data) : e.data, j = (e.method || "post").toLowerCase(), v = typeof e.path == "function" ? e.path(t.id, t.data) : e.path || r;
|
|
69
69
|
P.mutate({
|
|
70
70
|
path: v,
|
|
71
71
|
method: j,
|
|
72
|
-
payload:
|
|
72
|
+
payload: a
|
|
73
73
|
});
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
if (t.item.type === "delete") {
|
|
77
77
|
const e = t.item;
|
|
78
78
|
m.confirm({
|
|
79
|
-
title:
|
|
79
|
+
title: c || s,
|
|
80
80
|
content: e.content
|
|
81
81
|
}).then(() => {
|
|
82
82
|
k.mutate({
|
|
@@ -86,19 +86,20 @@ function K(o) {
|
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
if (t.item.type === "link") {
|
|
89
|
-
const e = t.item
|
|
90
|
-
|
|
89
|
+
const e = t.item;
|
|
90
|
+
let a = typeof e.path == "function" ? e.path?.(t.id, t.data) : t.id ? `${e.path || r}${t.data === void 0 ? "" : `/${t.id}`}` : e.path || r;
|
|
91
|
+
a.startsWith("/") || (a = g.getRoutePath(a)), w.push(a);
|
|
91
92
|
}
|
|
92
93
|
t.item.type === "callback" && t.item.callback?.(t.id, t.data);
|
|
93
|
-
}, y =
|
|
94
|
+
}, y = B(), x = E();
|
|
94
95
|
return {
|
|
95
|
-
target:
|
|
96
|
-
renderTable: (t) => (
|
|
96
|
+
target: f,
|
|
97
|
+
renderTable: (t) => (c, s) => {
|
|
97
98
|
const e = {
|
|
98
|
-
id:
|
|
99
|
-
data:
|
|
99
|
+
id: c[t.key || o?.key || "id"],
|
|
100
|
+
data: c,
|
|
100
101
|
index: s,
|
|
101
|
-
target:
|
|
102
|
+
target: f,
|
|
102
103
|
text: t.text !== void 0 ? t.text : o?.text || !1,
|
|
103
104
|
align: t.align !== void 0 ? t.align : o?.align || "left"
|
|
104
105
|
};
|
|
@@ -111,29 +112,29 @@ function K(o) {
|
|
|
111
112
|
});
|
|
112
113
|
},
|
|
113
114
|
renderAction: (t) => {
|
|
114
|
-
const
|
|
115
|
-
target:
|
|
115
|
+
const c = {
|
|
116
|
+
target: f,
|
|
116
117
|
text: t.text !== void 0 ? t.text : o?.text || !1,
|
|
117
118
|
align: t.align !== void 0 ? t.align : o?.align || "left"
|
|
118
119
|
};
|
|
119
120
|
return (t.type || o?.type) === "button" ? y.render({
|
|
120
|
-
...
|
|
121
|
+
...c,
|
|
121
122
|
action: t || o
|
|
122
123
|
}) : x.render({
|
|
123
|
-
...
|
|
124
|
+
...c,
|
|
124
125
|
action: t || o
|
|
125
126
|
});
|
|
126
127
|
}
|
|
127
128
|
};
|
|
128
129
|
}
|
|
129
|
-
function
|
|
130
|
+
function B() {
|
|
130
131
|
const {
|
|
131
132
|
t: o
|
|
132
|
-
} =
|
|
133
|
+
} = h();
|
|
133
134
|
return {
|
|
134
135
|
render: (i) => {
|
|
135
|
-
const m = i.action.items?.filter((n) => !n.show || n.show?.(i.data, i.index)).map((n,
|
|
136
|
-
key:
|
|
136
|
+
const m = i.action.items?.filter((n) => !n.show || n.show?.(i.data, i.index)).map((n, d) => l(b, {
|
|
137
|
+
key: d,
|
|
137
138
|
type: n.color || (n.type === "delete" ? "error" : "primary"),
|
|
138
139
|
text: i.text,
|
|
139
140
|
secondary: !i.text,
|
|
@@ -154,15 +155,15 @@ function E() {
|
|
|
154
155
|
}
|
|
155
156
|
};
|
|
156
157
|
}
|
|
157
|
-
function
|
|
158
|
+
function E() {
|
|
158
159
|
const {
|
|
159
160
|
t: o
|
|
160
|
-
} =
|
|
161
|
+
} = h();
|
|
161
162
|
return {
|
|
162
163
|
render: (i) => {
|
|
163
|
-
const m = i.action.items?.filter((n) => !n.show || n.show?.(i.data, i.index)).map((n,
|
|
164
|
+
const m = i.action.items?.filter((n) => !n.show || n.show?.(i.data, i.index)).map((n, d) => ({
|
|
164
165
|
label: o(n.label || "", {}, n.label),
|
|
165
|
-
key:
|
|
166
|
+
key: d,
|
|
166
167
|
icon: n.icon ? () => l("div", {
|
|
167
168
|
class: ["n-icon", n.icon]
|
|
168
169
|
}) : void 0,
|
|
@@ -177,8 +178,8 @@ function T() {
|
|
|
177
178
|
return l(C, {
|
|
178
179
|
trigger: "click",
|
|
179
180
|
options: m,
|
|
180
|
-
onSelect: (n,
|
|
181
|
-
|
|
181
|
+
onSelect: (n, d) => {
|
|
182
|
+
d?.onSelect?.();
|
|
182
183
|
}
|
|
183
184
|
}, () => [l("div", {
|
|
184
185
|
class: ["flex items-center", i.align === "right" ? "justify-end" : i.align === "center" ? "justify-center" : "justify-start"]
|
|
@@ -195,6 +196,6 @@ function T() {
|
|
|
195
196
|
}
|
|
196
197
|
export {
|
|
197
198
|
K as useAction,
|
|
198
|
-
|
|
199
|
-
|
|
199
|
+
B as useActionButton,
|
|
200
|
+
E as useActionDropdown
|
|
200
201
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const r = `/* layer: properties */
|
|
2
|
-
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*, ::before, ::after, ::backdrop{--un-
|
|
2
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*, ::before, ::after, ::backdrop{--un-text-opacity:100%;--un-bg-opacity:100%;--un-from-opacity:100%;--un-divide-y-reverse:initial;--un-border-style:solid;--un-divide-x-reverse:initial;--un-divide-opacity:100%;--un-shadow-opacity:100%;--un-ease:initial;--un-translate-x:initial;--un-translate-y:initial;--un-translate-z:initial;--un-border-opacity:100%;--un-to-opacity:100%;--un-fill-opacity:100%;--un-outline-style:solid;}}
|
|
3
3
|
@property --un-text-opacity{syntax:"<percentage>";inherits:false;initial-value:100%;}
|
|
4
4
|
@property --un-outline-style{syntax:"*";inherits:false;initial-value:solid;}
|
|
5
5
|
@property --un-border-opacity{syntax:"<percentage>";inherits:false;initial-value:100%;}
|
|
@@ -23,7 +23,7 @@ export interface DrawerActionItem extends BaseActionItem {
|
|
|
23
23
|
}
|
|
24
24
|
export interface LinkActionItem extends BaseActionItem {
|
|
25
25
|
type: 'link';
|
|
26
|
-
path
|
|
26
|
+
path?: string | ((id?: unknown, item?: Record<string, any>) => string);
|
|
27
27
|
}
|
|
28
28
|
export interface ConfirmActionItem extends BaseActionItem {
|
|
29
29
|
type: 'confirm';
|
|
@@ -40,7 +40,7 @@ export interface RequestActionItem extends BaseActionItem {
|
|
|
40
40
|
export interface DeleteActionItem extends BaseActionItem {
|
|
41
41
|
type: 'delete';
|
|
42
42
|
content?: string;
|
|
43
|
-
path
|
|
43
|
+
path?: string | ((id?: unknown, item?: Record<string, any>) => string);
|
|
44
44
|
}
|
|
45
45
|
export interface CallbackActionItem extends BaseActionItem {
|
|
46
46
|
type: 'callback';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duxweb/dvha-pro",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.28",
|
|
5
5
|
"author": "DuxWeb",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@ant-design/colors": "^7.2.1",
|
|
36
|
-
"@duxweb/dvha-core": "^1.0.
|
|
37
|
-
"@duxweb/dvha-naiveui": "^1.0.
|
|
36
|
+
"@duxweb/dvha-core": "^1.0.28",
|
|
37
|
+
"@duxweb/dvha-naiveui": "^1.0.28",
|
|
38
38
|
"@iconify-json/tabler": "^1.2.18",
|
|
39
39
|
"@overlastic/vue": "^0.8.1",
|
|
40
40
|
"@tanstack/vue-query": "^5.80.7",
|