@ctc-front/components-ui-next 0.1.0 → 0.1.1
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 +68 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +198 -17
- package/dist/index.js +296 -126
- package/dist/style.css +1 -1
- package/package.json +18 -16
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# @ctc-front/components-ui-next
|
|
2
|
+
|
|
3
|
+
面向公司 Web 业务系统的 Vue 3 + TypeScript + Element Plus 团队组件库。
|
|
4
|
+
|
|
5
|
+
当前版本提供:
|
|
6
|
+
|
|
7
|
+
- `CtcDialog`、`CtcDrawer`、`CtcFlex`
|
|
8
|
+
- 配置化 `CtcTable`:多级表头、插槽、render 函数、受控分页、行合并
|
|
9
|
+
- Element Plus 浅色/深色主题兼容
|
|
10
|
+
|
|
11
|
+
## 安装
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add @ctc-front/components-ui-next element-plus vue
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 使用
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { createApp } from 'vue'
|
|
21
|
+
import ElementPlus from 'element-plus'
|
|
22
|
+
import '@ctc-front/components-ui-next/style.css'
|
|
23
|
+
import CtcComponentsUi from '@ctc-front/components-ui-next'
|
|
24
|
+
import App from './App.vue'
|
|
25
|
+
|
|
26
|
+
createApp(App)
|
|
27
|
+
.use(ElementPlus)
|
|
28
|
+
.use(CtcComponentsUi)
|
|
29
|
+
.mount('#app')
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
也可以按组件导入:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { CtcDialog, CtcTable } from '@ctc-front/components-ui-next'
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## CtcTable 行合并
|
|
39
|
+
|
|
40
|
+
每个字段可以配置独立的连续分组规则:
|
|
41
|
+
|
|
42
|
+
```vue
|
|
43
|
+
<CtcTable
|
|
44
|
+
:columns="columns"
|
|
45
|
+
:data="rows"
|
|
46
|
+
:merge="[
|
|
47
|
+
{ prop: 'enterpriseName', by: ['enterpriseId'] },
|
|
48
|
+
{ prop: 'regionName', by: ['enterpriseId', 'regionCode'] },
|
|
49
|
+
]"
|
|
50
|
+
border
|
|
51
|
+
/>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
只有相邻行的 `by` 字段全部相同,目标列才会纵向合并。`selection`、`index`、`expand` 特殊列不参与配置合并;原生 `span-method` 传入后优先使用。当前版本暂不支持横向合并。
|
|
55
|
+
|
|
56
|
+
## 主题
|
|
57
|
+
|
|
58
|
+
组件会跟随宿主 Element Plus 的主题变量。深色模式按 Element Plus 方式配置:
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
document.documentElement.classList.toggle('dark', isDark)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
详细属性、插槽、分页和主题说明见[在线文档](./docs/guide/getting-started.md)。
|
|
65
|
+
|
|
66
|
+
## 版本说明
|
|
67
|
+
|
|
68
|
+
当前为 `0.1.1`,适用于 Vue 3 项目。Vue 2 / Element UI 项目请继续使用原组件库。
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let e=require("vue"),t=require("element-plus");var n=(0,e.defineComponent)({name:`Close`,__name:`close`,setup(t){return(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 1024 1024`},[(0,e.createElementVNode)(`path`,{fill:`currentColor`,d:`M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z`})]))}}),r=(0,e.defineComponent)({name:`FullScreen`,__name:`full-screen`,setup(t){return(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 1024 1024`},[(0,e.createElementVNode)(`path`,{fill:`currentColor`,d:`m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64z`})]))}}),i=(0,e.defineComponent)({name:`Minus`,__name:`minus`,setup(t){return(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 1024 1024`},[(0,e.createElementVNode)(`path`,{fill:`currentColor`,d:`M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64`})]))}});function a(t,n){let r=(0,e.computed)(()=>t.fullscreen??!1);function i(){n(`update:fullscreen`,!r.value)}return{isFullscreen:r,toggleFullscreen:i}}function o(e,t,n){return Math.min(Math.max(e,t),n)}function s(t,n){let r=(0,e.ref)(!1),i=(0,e.ref)({}),a=()=>{};function s(){a(),a=()=>{}}function c(e){if(!t.resizable||e.button!==0)return;let c=e.currentTarget.closest(`.ctc-dialog`);if(!c)return;e.preventDefault(),s();let l=c.getBoundingClientRect(),u=t.minWidth??400,d=t.minHeight??240,f=Math.max(u,window.innerWidth-l.left-32),p=Math.max(d,window.innerHeight-l.top-32),m=e.clientX,h=e.clientY;function g(e){let t=Math.round(o(l.width+e.clientX-m,u,f)),a=Math.round(o(l.height+e.clientY-h,d,p));r.value=!0,i.value={height:`${a}px`,width:`${t}px`},n(`resize`,{width:t,height:a})}function _(){s()}window.addEventListener(`pointermove`,g),window.addEventListener(`pointerup`,_,{once:!0}),a=()=>{window.removeEventListener(`pointermove`,g),window.removeEventListener(`pointerup`,_)}}return(0,e.onBeforeUnmount)(s),{isResized:r,resizeStyle:i,startResize:c}}var c={class:`ctc-dialog__header-content`},l={class:`ctc-dialog__title`},u={class:`ctc-dialog__header-actions`},d=[`aria-label`,`title`],f={class:`ctc-dialog__content`},p=(0,e.defineComponent)({name:`CtcDialog`,inheritAttrs:!1,__name:`index`,props:{modelValue:{type:Boolean,default:!1},fullscreen:{type:Boolean,default:!1},showFullscreen:{type:Boolean,default:!1},resizable:{type:Boolean,default:!1},minWidth:{type:Number,default:400},minHeight:{type:Number,default:240},title:{type:String,default:``},width:{type:[String,Number],default:`640px`},alignCenter:Boolean,appendTo:{type:[String,Object],default:void 0},beforeClose:{type:Function,default:void 0},closeDelay:Number,closeOnClickModal:Boolean,closeOnPressEscape:Boolean,destroyOnClose:Boolean,draggable:Boolean,lockScroll:Boolean,modal:{type:Boolean,default:!0},modalClass:{type:[String,Array,Object],default:void 0},openDelay:Number,overflow:Boolean,showClose:{type:Boolean,default:!0},top:String,trapFocus:Boolean,zIndex:Number},emits:[`update:modelValue`,`update:fullscreen`,`resize`,`open`,`opened`,`close`,`closed`],setup(o,{emit:p}){let m=o,h=p,g=(0,e.useAttrs)(),_=(0,e.useSlots)(),{isFullscreen:v,toggleFullscreen:y}=a(m,h),{isResized:b,resizeStyle:x,startResize:S}=s(m,h),C=(0,e.computed)(()=>v.value?{}:x.value),w=(0,e.computed)(()=>b.value&&!v.value);function T(e){h(`update:modelValue`,e)}function E(){if(m.beforeClose){m.beforeClose(e=>{e||h(`update:modelValue`,!1)});return}h(`update:modelValue`,!1)}return(a,s)=>((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(t.ElDialog),(0,e.mergeProps)((0,e.unref)(g),{class:[`ctc-dialog`,{"ctc-dialog--resizable":o.resizable,"ctc-dialog--resized":w.value}],style:C.value,"model-value":o.modelValue,fullscreen:(0,e.unref)(v),title:o.title,width:o.width,"align-center":o.alignCenter,"append-to":o.appendTo,"before-close":o.beforeClose,"close-delay":o.closeDelay,"close-on-click-modal":o.closeOnClickModal,"close-on-press-escape":o.closeOnPressEscape,"destroy-on-close":o.destroyOnClose,draggable:o.draggable,"lock-scroll":o.lockScroll,modal:o.modal,"modal-class":o.modalClass,"open-delay":o.openDelay,overflow:o.overflow,"show-close":!1,top:o.top,"trap-focus":o.trapFocus,"z-index":o.zIndex,"header-class":`ctc-dialog__header`,"body-class":`ctc-dialog__body`,"footer-class":`ctc-dialog__footer`,"onUpdate:modelValue":T,onOpen:s[2]||=e=>h(`open`),onOpened:s[3]||=e=>h(`opened`),onClose:s[4]||=e=>h(`close`),onClosed:s[5]||=e=>h(`closed`)}),(0,e.createSlots)({header:(0,e.withCtx)(()=>[(0,e.createElementVNode)(`div`,c,[(0,e.renderSlot)(a.$slots,`header`,{},()=>[(0,e.createElementVNode)(`span`,l,(0,e.toDisplayString)(o.title),1)])]),(0,e.createElementVNode)(`div`,u,[o.showFullscreen?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,class:`ctc-dialog__fullscreen-toggle`,type:`button`,"aria-label":(0,e.unref)(v)?`退出全屏`:`全屏显示`,title:(0,e.unref)(v)?`退出全屏`:`全屏显示`,"data-ctc-fullscreen-toggle":``,onClick:s[0]||=(...t)=>(0,e.unref)(y)&&(0,e.unref)(y)(...t)},[(0,e.createVNode)((0,e.unref)(t.ElIcon),{"aria-hidden":`true`},{default:(0,e.withCtx)(()=>[(0,e.unref)(v)?((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(i),{key:0})):((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(r),{key:1}))]),_:1})],8,d)):(0,e.createCommentVNode)(``,!0),o.showClose?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:1,class:`ctc-dialog__close`,type:`button`,"aria-label":`关闭弹窗`,title:`关闭`,"data-ctc-close":``,onClick:E},[(0,e.createVNode)((0,e.unref)(t.ElIcon),{"aria-hidden":`true`},{default:(0,e.withCtx)(()=>[(0,e.createVNode)((0,e.unref)(n))]),_:1})])):(0,e.createCommentVNode)(``,!0)])]),default:(0,e.withCtx)(()=>[(0,e.createElementVNode)(`div`,f,[(0,e.renderSlot)(a.$slots,`default`)]),o.resizable&&!(0,e.unref)(v)?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`ctc-dialog__resize-handle`,"aria-hidden":`true`,"data-ctc-resize-handle":``,onPointerdown:s[1]||=(...t)=>(0,e.unref)(S)&&(0,e.unref)(S)(...t)},null,32)):(0,e.createCommentVNode)(``,!0)]),_:2},[(0,e.unref)(_).footer?{name:`footer`,fn:(0,e.withCtx)(()=>[(0,e.renderSlot)(a.$slots,`footer`)]),key:`0`}:void 0]),1040,[`class`,`style`,`model-value`,`fullscreen`,`title`,`width`,`align-center`,`append-to`,`before-close`,`close-delay`,`close-on-click-modal`,`close-on-press-escape`,`destroy-on-close`,`draggable`,`lock-scroll`,`modal`,`modal-class`,`open-delay`,`overflow`,`top`,`trap-focus`,`z-index`]))}}),m={class:`ctc-drawer__header-content`},h={class:`ctc-drawer__title`},g={class:`ctc-drawer__header-actions`},_=[`aria-label`,`title`],v={class:`ctc-drawer__content`},y={key:0,class:`ctc-drawer__footer`},b=(0,e.defineComponent)({name:`CtcDrawer`,inheritAttrs:!1,__name:`index`,props:{modelValue:{type:Boolean,default:!1},fullscreen:{type:Boolean,default:!1},showFullscreen:{type:Boolean,default:!1},title:{type:String,default:``},size:{type:[String,Number],default:`480px`},direction:{type:String,default:`rtl`},appendTo:{type:[String,Object],default:void 0},beforeClose:{type:Function,default:void 0},closeOnClickModal:Boolean,closeOnPressEscape:Boolean,destroyOnClose:Boolean,lockScroll:Boolean,modal:{type:Boolean,default:!0},modalClass:{type:[String,Array,Object],default:void 0},showClose:{type:Boolean,default:!0},zIndex:Number},emits:[`update:modelValue`,`update:fullscreen`,`open`,`opened`,`close`,`closed`],setup(o,{emit:s}){let c=o,l=s,u=(0,e.useAttrs)(),d=(0,e.useSlots)(),{isFullscreen:f,toggleFullscreen:p}=a(c,l),b=(0,e.computed)(()=>f.value?`100%`:c.size);function x(e){l(`update:modelValue`,e)}function S(){if(c.beforeClose){c.beforeClose(e=>{e||l(`update:modelValue`,!1)});return}l(`update:modelValue`,!1)}return(a,s)=>((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(t.ElDrawer),(0,e.mergeProps)((0,e.unref)(u),{class:[`ctc-drawer`,{"is-fullscreen":(0,e.unref)(f)}],"model-value":o.modelValue,"append-to":o.appendTo,"before-close":o.beforeClose,"close-on-click-modal":o.closeOnClickModal,"close-on-press-escape":o.closeOnPressEscape,"destroy-on-close":o.destroyOnClose,direction:o.direction,"lock-scroll":o.lockScroll,modal:o.modal,"modal-class":o.modalClass,"show-close":!1,size:b.value,"z-index":o.zIndex,"header-class":`ctc-drawer__header`,"body-class":`ctc-drawer__body`,"onUpdate:modelValue":x,onOpen:s[1]||=e=>l(`open`),onOpened:s[2]||=e=>l(`opened`),onClose:s[3]||=e=>l(`close`),onClosed:s[4]||=e=>l(`closed`)}),{header:(0,e.withCtx)(()=>[(0,e.createElementVNode)(`div`,m,[(0,e.renderSlot)(a.$slots,`header`,{},()=>[(0,e.createElementVNode)(`span`,h,(0,e.toDisplayString)(o.title),1)])]),(0,e.createElementVNode)(`div`,g,[o.showFullscreen?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,class:`ctc-drawer__fullscreen-toggle`,type:`button`,"aria-label":(0,e.unref)(f)?`退出全屏`:`全屏显示`,title:(0,e.unref)(f)?`退出全屏`:`全屏显示`,"data-ctc-fullscreen-toggle":``,onClick:s[0]||=(...t)=>(0,e.unref)(p)&&(0,e.unref)(p)(...t)},[(0,e.createVNode)((0,e.unref)(t.ElIcon),{"aria-hidden":`true`},{default:(0,e.withCtx)(()=>[(0,e.unref)(f)?((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(i),{key:0})):((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(r),{key:1}))]),_:1})],8,_)):(0,e.createCommentVNode)(``,!0),o.showClose?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:1,class:`ctc-drawer__close`,type:`button`,"aria-label":`关闭抽屉`,title:`关闭`,"data-ctc-close":``,onClick:S},[(0,e.createVNode)((0,e.unref)(t.ElIcon),{"aria-hidden":`true`},{default:(0,e.withCtx)(()=>[(0,e.createVNode)((0,e.unref)(n))]),_:1})])):(0,e.createCommentVNode)(``,!0)])]),default:(0,e.withCtx)(()=>[(0,e.createElementVNode)(`div`,{class:(0,e.normalizeClass)([`ctc-drawer__layout`,{"has-footer":(0,e.unref)(d).footer}])},[(0,e.createElementVNode)(`div`,v,[(0,e.renderSlot)(a.$slots,`default`)]),(0,e.unref)(d).footer?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,y,[(0,e.renderSlot)(a.$slots,`footer`)])):(0,e.createCommentVNode)(``,!0)],2)]),_:3},16,[`class`,`model-value`,`append-to`,`before-close`,`close-on-click-modal`,`close-on-press-escape`,`destroy-on-close`,`direction`,`lock-scroll`,`modal`,`modal-class`,`size`,`z-index`]))}}),x=(0,e.defineComponent)({name:`CtcFlex`,__name:`index`,props:{direction:{default:`column`},fill:{type:Boolean,default:!1},grow:{default:1},justify:{default:`flex-start`},align:{default:`stretch`},gap:{default:0},scroll:{type:[Boolean,String],default:!1}},setup(t){let n=t,r=(0,e.computed)(()=>{let e={alignItems:n.align,flexDirection:n.direction,justifyContent:n.justify};return n.gap!==0&&n.gap!==``&&(e.gap=typeof n.gap==`number`?`${n.gap}px`:n.gap),n.fill&&(e.flex=n.grow),n.direction===`column`?e.minHeight=`0`:e.minWidth=`0`,n.scroll===`x`?(e.overflowX=`auto`,e.overflowY=`hidden`):n.scroll===`y`?(e.overflowX=`hidden`,e.overflowY=`auto`):n.scroll&&(e.overflow=`auto`),e});return(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`ctc-flex`,style:(0,e.normalizeStyle)(r.value)},[(0,e.renderSlot)(t.$slots,`default`)],4))}}),S=[p,b,x],C={install(e){S.forEach(t=>{e.component(t.name??``,t)})}};exports.CtcComponentsUi=C,exports.default=C,exports.CtcDialog=p,exports.CtcDrawer=b,exports.CtcFlex=x;
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let e=require("vue"),t=require("element-plus");var n=(0,e.defineComponent)({name:`Close`,__name:`close`,setup(t){return(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 1024 1024`},[(0,e.createElementVNode)(`path`,{fill:`currentColor`,d:`M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z`})]))}}),r=(0,e.defineComponent)({name:`FullScreen`,__name:`full-screen`,setup(t){return(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 1024 1024`},[(0,e.createElementVNode)(`path`,{fill:`currentColor`,d:`m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64z`})]))}}),i=(0,e.defineComponent)({name:`Minus`,__name:`minus`,setup(t){return(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 1024 1024`},[(0,e.createElementVNode)(`path`,{fill:`currentColor`,d:`M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64`})]))}});function a(t,n){let r=(0,e.computed)(()=>t.fullscreen??!1);function i(){n(`update:fullscreen`,!r.value)}return{isFullscreen:r,toggleFullscreen:i}}function o(e,t,n){return Math.min(Math.max(e,t),n)}function s(t,n){let r=(0,e.ref)(!1),i=(0,e.ref)({}),a=()=>{};function s(){a(),a=()=>{}}function c(e){if(!t.resizable||e.button!==0)return;let c=e.currentTarget.closest(`.ctc-dialog`);if(!c)return;e.preventDefault(),s();let l=c.getBoundingClientRect(),u=t.minWidth??400,d=t.minHeight??240,f=Math.max(u,window.innerWidth-l.left-32),p=Math.max(d,window.innerHeight-l.top-32),m=e.clientX,h=e.clientY;function g(e){let t=Math.round(o(l.width+e.clientX-m,u,f)),a=Math.round(o(l.height+e.clientY-h,d,p));r.value=!0,i.value={height:`${a}px`,width:`${t}px`},n(`resize`,{width:t,height:a})}function _(){s()}window.addEventListener(`pointermove`,g),window.addEventListener(`pointerup`,_,{once:!0}),a=()=>{window.removeEventListener(`pointermove`,g),window.removeEventListener(`pointerup`,_)}}return(0,e.onBeforeUnmount)(s),{isResized:r,resizeStyle:i,startResize:c}}var c={class:`ctc-dialog__header-content`},l={class:`ctc-dialog__title`},u={class:`ctc-dialog__header-actions`},d=[`aria-label`,`title`],f={class:`ctc-dialog__content`},p=(0,e.defineComponent)({name:`CtcDialog`,inheritAttrs:!1,__name:`index`,props:{modelValue:{type:Boolean,default:!1},fullscreen:{type:Boolean,default:!1},showFullscreen:{type:Boolean,default:!1},resizable:{type:Boolean,default:!1},minWidth:{type:Number,default:400},minHeight:{type:Number,default:240},title:{type:String,default:``},width:{type:[String,Number],default:`640px`},alignCenter:Boolean,appendTo:{type:[String,Object],default:void 0},beforeClose:{type:Function,default:void 0},closeDelay:Number,closeOnClickModal:Boolean,closeOnPressEscape:Boolean,destroyOnClose:Boolean,draggable:Boolean,lockScroll:Boolean,modal:{type:Boolean,default:!0},modalClass:{type:[String,Array,Object],default:void 0},openDelay:Number,overflow:Boolean,showClose:{type:Boolean,default:!0},top:String,trapFocus:Boolean,zIndex:Number},emits:[`update:modelValue`,`update:fullscreen`,`resize`,`open`,`opened`,`close`,`closed`],setup(o,{emit:p}){let m=o,h=p,g=(0,e.useAttrs)(),_=(0,e.useSlots)(),{isFullscreen:v,toggleFullscreen:y}=a(m,h),{isResized:b,resizeStyle:x,startResize:S}=s(m,h),C=(0,e.computed)(()=>v.value?{}:x.value),w=(0,e.computed)(()=>b.value&&!v.value);function T(e){h(`update:modelValue`,e)}function E(){if(m.beforeClose){m.beforeClose(e=>{e||h(`update:modelValue`,!1)});return}h(`update:modelValue`,!1)}return(a,s)=>((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(t.ElDialog),(0,e.mergeProps)((0,e.unref)(g),{class:[`ctc-dialog`,{"ctc-dialog--resizable":o.resizable,"ctc-dialog--resized":w.value}],style:C.value,"model-value":o.modelValue,fullscreen:(0,e.unref)(v),title:o.title,width:o.width,"align-center":o.alignCenter,"append-to":o.appendTo,"before-close":o.beforeClose,"close-delay":o.closeDelay,"close-on-click-modal":o.closeOnClickModal,"close-on-press-escape":o.closeOnPressEscape,"destroy-on-close":o.destroyOnClose,draggable:o.draggable,"lock-scroll":o.lockScroll,modal:o.modal,"modal-class":o.modalClass,"open-delay":o.openDelay,overflow:o.overflow,"show-close":!1,top:o.top,"trap-focus":o.trapFocus,"z-index":o.zIndex,"header-class":`ctc-dialog__header`,"body-class":`ctc-dialog__body`,"footer-class":`ctc-dialog__footer`,"onUpdate:modelValue":T,onOpen:s[2]||=e=>h(`open`),onOpened:s[3]||=e=>h(`opened`),onClose:s[4]||=e=>h(`close`),onClosed:s[5]||=e=>h(`closed`)}),(0,e.createSlots)({header:(0,e.withCtx)(()=>[(0,e.createElementVNode)(`div`,c,[(0,e.renderSlot)(a.$slots,`header`,{},()=>[(0,e.createElementVNode)(`span`,l,(0,e.toDisplayString)(o.title),1)])]),(0,e.createElementVNode)(`div`,u,[o.showFullscreen?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,class:`ctc-dialog__fullscreen-toggle`,type:`button`,"aria-label":(0,e.unref)(v)?`退出全屏`:`全屏显示`,title:(0,e.unref)(v)?`退出全屏`:`全屏显示`,"data-ctc-fullscreen-toggle":``,onClick:s[0]||=(...t)=>(0,e.unref)(y)&&(0,e.unref)(y)(...t)},[(0,e.createVNode)((0,e.unref)(t.ElIcon),{"aria-hidden":`true`},{default:(0,e.withCtx)(()=>[(0,e.unref)(v)?((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(i),{key:0})):((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(r),{key:1}))]),_:1})],8,d)):(0,e.createCommentVNode)(``,!0),o.showClose?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:1,class:`ctc-dialog__close`,type:`button`,"aria-label":`关闭弹窗`,title:`关闭`,"data-ctc-close":``,onClick:E},[(0,e.createVNode)((0,e.unref)(t.ElIcon),{"aria-hidden":`true`},{default:(0,e.withCtx)(()=>[(0,e.createVNode)((0,e.unref)(n))]),_:1})])):(0,e.createCommentVNode)(``,!0)])]),default:(0,e.withCtx)(()=>[(0,e.createElementVNode)(`div`,f,[(0,e.renderSlot)(a.$slots,`default`)]),o.resizable&&!(0,e.unref)(v)?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`ctc-dialog__resize-handle`,"aria-hidden":`true`,"data-ctc-resize-handle":``,onPointerdown:s[1]||=(...t)=>(0,e.unref)(S)&&(0,e.unref)(S)(...t)},null,32)):(0,e.createCommentVNode)(``,!0)]),_:2},[(0,e.unref)(_).footer?{name:`footer`,fn:(0,e.withCtx)(()=>[(0,e.renderSlot)(a.$slots,`footer`)]),key:`0`}:void 0]),1040,[`class`,`style`,`model-value`,`fullscreen`,`title`,`width`,`align-center`,`append-to`,`before-close`,`close-delay`,`close-on-click-modal`,`close-on-press-escape`,`destroy-on-close`,`draggable`,`lock-scroll`,`modal`,`modal-class`,`open-delay`,`overflow`,`top`,`trap-focus`,`z-index`]))}}),m={class:`ctc-drawer__header-content`},h={class:`ctc-drawer__title`},g={class:`ctc-drawer__header-actions`},_=[`aria-label`,`title`],v={class:`ctc-drawer__content`},y={key:0,class:`ctc-drawer__footer`},b=(0,e.defineComponent)({name:`CtcDrawer`,inheritAttrs:!1,__name:`index`,props:{modelValue:{type:Boolean,default:!1},fullscreen:{type:Boolean,default:!1},showFullscreen:{type:Boolean,default:!1},title:{type:String,default:``},size:{type:[String,Number],default:`480px`},direction:{type:String,default:`rtl`},appendTo:{type:[String,Object],default:void 0},beforeClose:{type:Function,default:void 0},closeOnClickModal:Boolean,closeOnPressEscape:Boolean,destroyOnClose:Boolean,lockScroll:Boolean,modal:{type:Boolean,default:!0},modalClass:{type:[String,Array,Object],default:void 0},showClose:{type:Boolean,default:!0},zIndex:Number},emits:[`update:modelValue`,`update:fullscreen`,`open`,`opened`,`close`,`closed`],setup(o,{emit:s}){let c=o,l=s,u=(0,e.useAttrs)(),d=(0,e.useSlots)(),{isFullscreen:f,toggleFullscreen:p}=a(c,l),b=(0,e.computed)(()=>f.value?`100%`:c.size);function x(e){l(`update:modelValue`,e)}function S(){if(c.beforeClose){c.beforeClose(e=>{e||l(`update:modelValue`,!1)});return}l(`update:modelValue`,!1)}return(a,s)=>((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(t.ElDrawer),(0,e.mergeProps)((0,e.unref)(u),{class:[`ctc-drawer`,{"is-fullscreen":(0,e.unref)(f)}],"model-value":o.modelValue,"append-to":o.appendTo,"before-close":o.beforeClose,"close-on-click-modal":o.closeOnClickModal,"close-on-press-escape":o.closeOnPressEscape,"destroy-on-close":o.destroyOnClose,direction:o.direction,"lock-scroll":o.lockScroll,modal:o.modal,"modal-class":o.modalClass,"show-close":!1,size:b.value,"z-index":o.zIndex,"header-class":`ctc-drawer__header`,"body-class":`ctc-drawer__body`,"onUpdate:modelValue":x,onOpen:s[1]||=e=>l(`open`),onOpened:s[2]||=e=>l(`opened`),onClose:s[3]||=e=>l(`close`),onClosed:s[4]||=e=>l(`closed`)}),{header:(0,e.withCtx)(()=>[(0,e.createElementVNode)(`div`,m,[(0,e.renderSlot)(a.$slots,`header`,{},()=>[(0,e.createElementVNode)(`span`,h,(0,e.toDisplayString)(o.title),1)])]),(0,e.createElementVNode)(`div`,g,[o.showFullscreen?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,class:`ctc-drawer__fullscreen-toggle`,type:`button`,"aria-label":(0,e.unref)(f)?`退出全屏`:`全屏显示`,title:(0,e.unref)(f)?`退出全屏`:`全屏显示`,"data-ctc-fullscreen-toggle":``,onClick:s[0]||=(...t)=>(0,e.unref)(p)&&(0,e.unref)(p)(...t)},[(0,e.createVNode)((0,e.unref)(t.ElIcon),{"aria-hidden":`true`},{default:(0,e.withCtx)(()=>[(0,e.unref)(f)?((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(i),{key:0})):((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(r),{key:1}))]),_:1})],8,_)):(0,e.createCommentVNode)(``,!0),o.showClose?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:1,class:`ctc-drawer__close`,type:`button`,"aria-label":`关闭抽屉`,title:`关闭`,"data-ctc-close":``,onClick:S},[(0,e.createVNode)((0,e.unref)(t.ElIcon),{"aria-hidden":`true`},{default:(0,e.withCtx)(()=>[(0,e.createVNode)((0,e.unref)(n))]),_:1})])):(0,e.createCommentVNode)(``,!0)])]),default:(0,e.withCtx)(()=>[(0,e.createElementVNode)(`div`,{class:(0,e.normalizeClass)([`ctc-drawer__layout`,{"has-footer":(0,e.unref)(d).footer}])},[(0,e.createElementVNode)(`div`,v,[(0,e.renderSlot)(a.$slots,`default`)]),(0,e.unref)(d).footer?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,y,[(0,e.renderSlot)(a.$slots,`footer`)])):(0,e.createCommentVNode)(``,!0)],2)]),_:3},16,[`class`,`model-value`,`append-to`,`before-close`,`close-on-click-modal`,`close-on-press-escape`,`destroy-on-close`,`direction`,`lock-scroll`,`modal`,`modal-class`,`size`,`z-index`]))}}),x=(0,e.defineComponent)({name:`CtcFlex`,__name:`index`,props:{direction:{default:`column`},fill:{type:Boolean,default:!1},grow:{default:1},justify:{default:`flex-start`},align:{default:`stretch`},gap:{default:0},scroll:{type:[Boolean,String],default:!1}},setup(t){let n=t,r=(0,e.computed)(()=>{let e={alignItems:n.align,flexDirection:n.direction,justifyContent:n.justify};return n.gap!==0&&n.gap!==``&&(e.gap=typeof n.gap==`number`?`${n.gap}px`:n.gap),n.fill&&(e.flex=n.grow),n.direction===`column`?e.minHeight=`0`:e.minWidth=`0`,n.scroll===`x`?(e.overflowX=`auto`,e.overflowY=`hidden`):n.scroll===`y`?(e.overflowX=`hidden`,e.overflowY=`auto`):n.scroll&&(e.overflow=`auto`),e});return(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`ctc-flex`,style:(0,e.normalizeStyle)(r.value)},[(0,e.renderSlot)(t.$slots,`default`)],4))}}),S=new Set([`selection`,`index`,`expand`]),C=(0,e.defineComponent)({name:`CtcTableColumn`,props:{column:{type:Object,required:!0},slots:{type:Object,required:!0}},setup(n){let r=e=>e.slot??e.prop,i=(e,t)=>{if(t)return t.replace(/\[(?:'([^']*)'|"([^"]*)"|([^\]]+))\]/g,`.$1$2$3`).split(`.`).filter(Boolean).reduce((e,t)=>{if(!(typeof e!=`object`||!e))return e[t]},e)},a=(e,t)=>{let a=r(e),o=a?n.slots[a]:void 0;if(o)return o({...t,config:e});if(e.renderCell)return e.renderCell(t);if(e.formatter){let n=i(t.row,e.prop??e.property);return e.formatter(t.row,t.column,n,t.$index)}},o=(e,t)=>{let r=e.headerSlot?n.slots[e.headerSlot]:void 0;return r?r({...t,config:e}):e.renderHeader?.(t)},s=r=>{let{children:i,slot:c,headerSlot:l,renderCell:u,renderHeader:d,formatter:f,...p}=r,m=!!i?.length,h=c??r.prop,g=!!(h&&n.slots[h]||u||f),_=!!(l&&n.slots[l]||d),v=r.type?S.has(r.type):!1;return(0,e.h)(t.ElTableColumn,p,{default:m?()=>i?.map(s):g&&!v?e=>a(r,e):void 0,header:_?e=>o(r,e):void 0})};return()=>s(n.column)}});function w(e,t){return t.replace(/\[(?:'([^']*)'|"([^"]*)"|([^\]]+))\]/g,`.$1$2$3`).split(`.`).filter(Boolean).reduce((e,t)=>{if(!(typeof e!=`object`||!e))return e[t]},e)}function T(e,t,n){return n.every(n=>Object.is(w(e,n),w(t,n)))}function E(e,t){let n=new Map(t.filter(e=>e.prop&&e.by.length>0).map(e=>[e.prop,e]));return({column:t,rowIndex:r})=>{if(t.type===`selection`||t.type===`index`||t.type===`expand`)return;let i=t.property,a=i?n.get(i):void 0;if(!a)return;let o=e[r];if(!o)return;if(r>0&&T(e[r-1],o,a.by))return{rowspan:0,colspan:0};let s=1;for(;r+s<e.length&&T(o,e[r+s],a.by);)s+=1;return{rowspan:s,colspan:1}}}var D={class:`ctc-table`},O={key:0,class:`ctc-table__pagination`},k=(0,e.defineComponent)({name:`CtcTable`,inheritAttrs:!1,__name:`index`,props:{columns:{default:()=>[]},currentPage:{default:1},data:{default:()=>[]},loading:{type:Boolean,default:!1},merge:{default:()=>[]},pageSize:{default:10},pagination:{type:Boolean,default:!1},paginationProps:{default:()=>({})},total:{default:0}},emits:[`update:currentPage`,`update:pageSize`,`current-change`,`page-change`,`page-size-change`,`prev-click`,`next-click`],setup(n,{expose:r,emit:i}){let a=n,o=i,s=(0,e.useAttrs)(),c=(0,e.useSlots)(),l=(0,e.useTemplateRef)(`tableRef`),u=new Set(`currentPage.pageSize.total.layout.pageSizes.pagerCount.background.disabled.hideOnSinglePage.small.prevText.nextText.prevIcon.nextIcon.popperClass.popperStyle.teleported.appendSizeTo.pageCount.defaultCurrentPage.defaultPageSize.onUpdate:currentPage.onUpdate:pageSize.onCurrentChange.onSizeChange.onPrevClick.onNextClick`.split(`.`)),d=(0,e.computed)(()=>Object.fromEntries(Object.entries(s).filter(([e])=>!u.has(e)&&e!==`spanMethod`))),f=(0,e.computed)(()=>{if(typeof s.spanMethod==`function`)return s.spanMethod;if(a.merge.length!==0)return E(a.data,a.merge)});function p(e,t){o(`current-change`,e,t)}return r({clearSelection:()=>l.value?.clearSelection(),toggleRowSelection:(e,t)=>l.value?.toggleRowSelection(e,t),toggleAllSelection:()=>l.value?.toggleAllSelection(),toggleRowExpansion:(e,t)=>l.value?.toggleRowExpansion(e,t),setCurrentRow:e=>l.value?.setCurrentRow(e),clearSort:()=>l.value?.clearSort(),clearFilter:e=>l.value?.clearFilter(e),doLayout:()=>l.value?.doLayout(),sort:(e,t)=>l.value?.sort(e,t)}),(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,D,[(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(t.ElTable),(0,e.mergeProps)({ref_key:`tableRef`,ref:l},d.value,{data:a.data,"span-method":f.value,onCurrentChange:p}),(0,e.createSlots)({default:(0,e.withCtx)(()=>[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(a.columns,(t,n)=>((0,e.openBlock)(),(0,e.createBlock)(C,{key:t.prop??t.property??t.label??n,column:t,slots:(0,e.unref)(c)},null,8,[`column`,`slots`]))),128))]),_:2},[(0,e.unref)(c).empty?{name:`empty`,fn:(0,e.withCtx)(()=>[(0,e.renderSlot)(n.$slots,`empty`)]),key:`0`}:void 0,(0,e.unref)(c).append?{name:`append`,fn:(0,e.withCtx)(()=>[(0,e.renderSlot)(n.$slots,`append`)]),key:`1`}:void 0]),1040,[`data`,`span-method`])),[[(0,e.unref)(t.vLoading),a.loading]]),a.pagination?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,O,[(0,e.createVNode)((0,e.unref)(t.ElPagination),(0,e.mergeProps)(a.paginationProps,{"current-page":a.currentPage,"page-size":a.pageSize,total:a.total,"onUpdate:currentPage":r[0]||=e=>o(`update:currentPage`,e),"onUpdate:pageSize":r[1]||=e=>o(`update:pageSize`,e),onCurrentChange:r[2]||=e=>o(`page-change`,e),onSizeChange:r[3]||=e=>o(`page-size-change`,e),onPrevClick:r[4]||=e=>o(`prev-click`,e),onNextClick:r[5]||=e=>o(`next-click`,e)}),null,16,[`current-page`,`page-size`,`total`]),(0,e.renderSlot)(n.$slots,`pagination`)])):(0,e.createCommentVNode)(``,!0)]))}}),A=[p,b,x,k],j={install(e){A.forEach(t=>{e.component(t.name??``,t)})}};exports.CtcComponentsUi=j,exports.default=j,exports.CtcDialog=p,exports.CtcDrawer=b,exports.CtcFlex=x,exports.CtcTable=k;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ComponentOptionsMixin } from 'vue';
|
|
2
2
|
import { ComponentProvideOptions } from 'vue';
|
|
3
3
|
import { DefineComponent } from 'vue';
|
|
4
|
-
import {
|
|
5
|
-
import { DialogProps } from 'element-plus';
|
|
6
|
-
import { DrawerProps } from 'element-plus';
|
|
4
|
+
import { EmitsOptions } from 'vue';
|
|
7
5
|
import { ExtractPropTypes } from 'vue';
|
|
8
6
|
import { Plugin as Plugin_2 } from 'vue';
|
|
9
7
|
import { PropType } from 'vue';
|
|
10
8
|
import { PublicProps } from 'vue';
|
|
9
|
+
import { VNode } from 'vue';
|
|
10
|
+
import { VNodeChild } from 'vue';
|
|
11
11
|
|
|
12
12
|
declare const __VLS_component: DefineComponent<ExtractPropTypes< {
|
|
13
13
|
modelValue: {
|
|
@@ -167,9 +167,13 @@ minWidth: number;
|
|
|
167
167
|
width: string | number;
|
|
168
168
|
overflow: boolean;
|
|
169
169
|
title: string;
|
|
170
|
+
modelValue: boolean;
|
|
171
|
+
fullscreen: boolean;
|
|
172
|
+
showFullscreen: boolean;
|
|
173
|
+
resizable: boolean;
|
|
170
174
|
alignCenter: boolean;
|
|
171
175
|
appendTo: string | HTMLElement;
|
|
172
|
-
beforeClose:
|
|
176
|
+
beforeClose: CtcDialogBeforeClose;
|
|
173
177
|
closeOnClickModal: boolean;
|
|
174
178
|
closeOnPressEscape: boolean;
|
|
175
179
|
destroyOnClose: boolean;
|
|
@@ -179,10 +183,6 @@ modal: boolean;
|
|
|
179
183
|
modalClass: string | Record<string, any> | unknown[];
|
|
180
184
|
showClose: boolean;
|
|
181
185
|
trapFocus: boolean;
|
|
182
|
-
modelValue: boolean;
|
|
183
|
-
fullscreen: boolean;
|
|
184
|
-
resizable: boolean;
|
|
185
|
-
showFullscreen: boolean;
|
|
186
186
|
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
187
187
|
|
|
188
188
|
declare const __VLS_component_2: DefineComponent<ExtractPropTypes< {
|
|
@@ -303,8 +303,11 @@ onClosed?: (() => any) | undefined;
|
|
|
303
303
|
direction: "ltr" | "rtl" | "ttb" | "btt";
|
|
304
304
|
title: string;
|
|
305
305
|
size: string | number;
|
|
306
|
+
modelValue: boolean;
|
|
307
|
+
fullscreen: boolean;
|
|
308
|
+
showFullscreen: boolean;
|
|
306
309
|
appendTo: string | HTMLElement;
|
|
307
|
-
beforeClose:
|
|
310
|
+
beforeClose: CtcDialogBeforeClose;
|
|
308
311
|
closeOnClickModal: boolean;
|
|
309
312
|
closeOnPressEscape: boolean;
|
|
310
313
|
destroyOnClose: boolean;
|
|
@@ -312,9 +315,6 @@ lockScroll: boolean;
|
|
|
312
315
|
modal: boolean;
|
|
313
316
|
modalClass: string | Record<string, any> | unknown[];
|
|
314
317
|
showClose: boolean;
|
|
315
|
-
modelValue: boolean;
|
|
316
|
-
fullscreen: boolean;
|
|
317
|
-
showFullscreen: boolean;
|
|
318
318
|
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
319
319
|
|
|
320
320
|
declare const __VLS_component_3: DefineComponent<CtcFlexProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<CtcFlexProps> & Readonly<{}>, {
|
|
@@ -388,25 +388,55 @@ export default CtcComponentsUi;
|
|
|
388
388
|
|
|
389
389
|
export declare const CtcDialog: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
390
390
|
|
|
391
|
-
export declare type CtcDialogBeforeClose =
|
|
391
|
+
export declare type CtcDialogBeforeClose = (done: (cancel?: boolean) => void) => void;
|
|
392
392
|
|
|
393
|
-
export declare interface CtcDialogProps
|
|
393
|
+
export declare interface CtcDialogProps {
|
|
394
|
+
alignCenter?: boolean;
|
|
395
|
+
appendTo?: string | HTMLElement;
|
|
396
|
+
beforeClose?: CtcDialogBeforeClose;
|
|
397
|
+
closeDelay?: number;
|
|
398
|
+
closeOnClickModal?: boolean;
|
|
399
|
+
closeOnPressEscape?: boolean;
|
|
400
|
+
destroyOnClose?: boolean;
|
|
401
|
+
draggable?: boolean;
|
|
402
|
+
lockScroll?: boolean;
|
|
403
|
+
modal?: boolean;
|
|
404
|
+
modalClass?: string | string[] | Record<string, unknown>;
|
|
394
405
|
modelValue?: boolean;
|
|
395
406
|
fullscreen?: boolean;
|
|
396
407
|
minHeight?: number;
|
|
397
408
|
minWidth?: number;
|
|
409
|
+
openDelay?: number;
|
|
410
|
+
overflow?: boolean;
|
|
398
411
|
resizable?: boolean;
|
|
399
412
|
showFullscreen?: boolean;
|
|
413
|
+
showClose?: boolean;
|
|
400
414
|
title?: string;
|
|
415
|
+
top?: string;
|
|
416
|
+
trapFocus?: boolean;
|
|
417
|
+
width?: string | number;
|
|
418
|
+
zIndex?: number;
|
|
401
419
|
}
|
|
402
420
|
|
|
403
421
|
export declare const CtcDrawer: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
|
|
404
422
|
|
|
405
|
-
export declare interface CtcDrawerProps
|
|
423
|
+
export declare interface CtcDrawerProps {
|
|
424
|
+
appendTo?: string | HTMLElement;
|
|
425
|
+
beforeClose?: (done: (cancel?: boolean) => void) => void;
|
|
426
|
+
closeOnClickModal?: boolean;
|
|
427
|
+
closeOnPressEscape?: boolean;
|
|
428
|
+
destroyOnClose?: boolean;
|
|
429
|
+
direction?: 'btt' | 'ltr' | 'rtl' | 'ttb';
|
|
406
430
|
modelValue?: boolean;
|
|
407
431
|
fullscreen?: boolean;
|
|
432
|
+
lockScroll?: boolean;
|
|
433
|
+
modal?: boolean;
|
|
434
|
+
modalClass?: string | string[] | Record<string, unknown>;
|
|
435
|
+
showClose?: boolean;
|
|
408
436
|
showFullscreen?: boolean;
|
|
437
|
+
size?: string | number;
|
|
409
438
|
title?: string;
|
|
439
|
+
zIndex?: number;
|
|
410
440
|
}
|
|
411
441
|
|
|
412
442
|
export declare const CtcFlex: __VLS_WithTemplateSlots_3<typeof __VLS_component_3, __VLS_TemplateResult_3["slots"]>;
|
|
@@ -425,8 +455,159 @@ export declare interface CtcFlexProps {
|
|
|
425
455
|
|
|
426
456
|
export declare type CtcFlexScroll = boolean | 'x' | 'y';
|
|
427
457
|
|
|
428
|
-
declare
|
|
458
|
+
export declare const CtcTable: CtcTableComponent;
|
|
459
|
+
|
|
460
|
+
export declare interface CtcTableCellScope<Row extends object = Record<string, unknown>> {
|
|
461
|
+
row: Row;
|
|
462
|
+
column: CtcTableColumnContext;
|
|
463
|
+
$index: number;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
export declare interface CtcTableColumn<Row extends object = Record<string, unknown>> {
|
|
467
|
+
label?: string;
|
|
468
|
+
prop?: string;
|
|
469
|
+
property?: string;
|
|
470
|
+
type?: 'selection' | 'index' | 'expand';
|
|
471
|
+
className?: string;
|
|
472
|
+
labelClassName?: string;
|
|
473
|
+
width?: string | number;
|
|
474
|
+
minWidth?: string | number;
|
|
475
|
+
sortable?: boolean | 'custom';
|
|
476
|
+
sortMethod?: (a: Row, b: Row) => number;
|
|
477
|
+
sortBy?: string | string[] | ((row: Row, index: number, array?: Row[]) => string);
|
|
478
|
+
resizable?: boolean;
|
|
479
|
+
columnKey?: string;
|
|
480
|
+
align?: 'left' | 'center' | 'right';
|
|
481
|
+
headerAlign?: 'left' | 'center' | 'right';
|
|
482
|
+
showOverflowTooltip?: boolean | CtcTableOverflowTooltipOptions;
|
|
483
|
+
tooltipFormatter?: (scope: CtcTableTooltipFormatterScope<Row>) => VNode | string;
|
|
484
|
+
fixed?: boolean | 'left' | 'right';
|
|
485
|
+
selectable?: (row: Row, index: number) => boolean;
|
|
486
|
+
reserveSelection?: boolean;
|
|
487
|
+
filters?: Array<{
|
|
488
|
+
text: string;
|
|
489
|
+
value: string;
|
|
490
|
+
}>;
|
|
491
|
+
filterMethod?: (value: string, row: Row, column: CtcTableColumnContext) => void;
|
|
492
|
+
filterPlacement?: string;
|
|
493
|
+
filterMultiple?: boolean;
|
|
494
|
+
filterClassName?: string;
|
|
495
|
+
index?: number | ((index: number) => number);
|
|
496
|
+
sortOrders?: Array<'ascending' | 'descending' | null>;
|
|
497
|
+
children?: CtcTableColumn<Row>[];
|
|
498
|
+
slot?: string;
|
|
499
|
+
headerSlot?: string;
|
|
500
|
+
formatter?: (row: Row, column: CtcTableColumnContext, cellValue: unknown, index: number) => string;
|
|
501
|
+
renderCell?: (scope: CtcTableCellScope<Row>) => VNodeChild;
|
|
502
|
+
renderHeader?: (scope: CtcTableHeaderScope) => VNodeChild;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
declare interface CtcTableColumnContext {
|
|
506
|
+
label?: string;
|
|
507
|
+
property?: string;
|
|
508
|
+
type?: string;
|
|
509
|
+
[key: string]: unknown;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
declare type CtcTableComponent = DefineComponent<CtcTablePublicProps, CtcTableInstance, {}, {}, {}, {}, {}, CtcTableEmits>;
|
|
513
|
+
|
|
514
|
+
declare type CtcTableEmits = {
|
|
515
|
+
'update:currentPage': (value: number) => void;
|
|
516
|
+
'update:pageSize': (value: number) => void;
|
|
517
|
+
'current-change': (currentRow: Record<string, unknown> | null, oldCurrentRow: Record<string, unknown> | null) => void;
|
|
518
|
+
'next-click': (value: number) => void;
|
|
519
|
+
'prev-click': (value: number) => void;
|
|
520
|
+
'page-change': (value: number) => void;
|
|
521
|
+
'page-size-change': (value: number) => void;
|
|
522
|
+
} & EmitsOptions;
|
|
523
|
+
|
|
524
|
+
export declare interface CtcTableHeaderScope {
|
|
525
|
+
column: CtcTableColumnContext;
|
|
526
|
+
$index: number;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
export declare interface CtcTableInstance {
|
|
530
|
+
clearSelection: () => void;
|
|
531
|
+
toggleRowSelection: (row: Record<string, unknown>, selected?: boolean) => void;
|
|
532
|
+
toggleAllSelection: () => void;
|
|
533
|
+
toggleRowExpansion: (row: Record<string, unknown>, expanded?: boolean) => void;
|
|
534
|
+
setCurrentRow: (row?: Record<string, unknown>) => void;
|
|
535
|
+
clearSort: () => void;
|
|
536
|
+
clearFilter: (columnKey?: string) => void;
|
|
537
|
+
doLayout: () => void;
|
|
538
|
+
sort: (prop: string, order: 'ascending' | 'descending') => void;
|
|
539
|
+
}
|
|
429
540
|
|
|
430
|
-
declare
|
|
541
|
+
export declare interface CtcTableMergeRule {
|
|
542
|
+
prop: string;
|
|
543
|
+
by: string[];
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
declare interface CtcTableOverflowTooltipOptions {
|
|
547
|
+
appendTo?: string | HTMLElement;
|
|
548
|
+
effect?: 'dark' | 'light';
|
|
549
|
+
enterable?: boolean;
|
|
550
|
+
hideAfter?: number;
|
|
551
|
+
offset?: number;
|
|
552
|
+
placement?: string;
|
|
553
|
+
popperClass?: string;
|
|
554
|
+
showAfter?: number;
|
|
555
|
+
[key: string]: unknown;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export declare interface CtcTablePaginationProps {
|
|
559
|
+
background?: boolean;
|
|
560
|
+
disabled?: boolean;
|
|
561
|
+
hideOnSinglePage?: boolean;
|
|
562
|
+
layout?: string;
|
|
563
|
+
nextText?: string;
|
|
564
|
+
pageCount?: number;
|
|
565
|
+
pagerCount?: number;
|
|
566
|
+
pageSizes?: number[];
|
|
567
|
+
popperClass?: string;
|
|
568
|
+
prevText?: string;
|
|
569
|
+
size?: 'default' | 'large' | 'small';
|
|
570
|
+
small?: boolean;
|
|
571
|
+
[key: string]: unknown;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
export declare interface CtcTableProps<Row extends object = Record<string, unknown>> {
|
|
575
|
+
columns?: CtcTableColumn<Row>[];
|
|
576
|
+
currentPage?: number;
|
|
577
|
+
data?: Row[];
|
|
578
|
+
loading?: boolean;
|
|
579
|
+
merge?: CtcTableMergeRule[];
|
|
580
|
+
pageSize?: number;
|
|
581
|
+
pagination?: boolean;
|
|
582
|
+
paginationProps?: CtcTablePaginationProps;
|
|
583
|
+
total?: number;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
declare interface CtcTablePublicProps<Row extends object = Record<string, unknown>> extends CtcTableProps<Row> {
|
|
587
|
+
border?: boolean;
|
|
588
|
+
rowKey?: string | ((row: Row) => string | number);
|
|
589
|
+
spanMethod?: CtcTableSpanMethod<Row>;
|
|
590
|
+
[attribute: string]: unknown;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
export declare interface CtcTableSpanContext<Row extends object = Record<string, unknown>> {
|
|
594
|
+
row: Row;
|
|
595
|
+
column: CtcTableColumnContext;
|
|
596
|
+
rowIndex: number;
|
|
597
|
+
columnIndex: number;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
export declare type CtcTableSpanMethod<Row extends object = Record<string, unknown>> = (context: CtcTableSpanContext<Row>) => CtcTableSpanResult | undefined;
|
|
601
|
+
|
|
602
|
+
export declare type CtcTableSpanResult = {
|
|
603
|
+
rowspan: number;
|
|
604
|
+
colspan: number;
|
|
605
|
+
} | [rowspan: number, colspan: number];
|
|
606
|
+
|
|
607
|
+
declare interface CtcTableTooltipFormatterScope<Row extends object = Record<string, unknown>> {
|
|
608
|
+
row: Row;
|
|
609
|
+
column: CtcTableColumnContext;
|
|
610
|
+
cellValue: unknown;
|
|
611
|
+
}
|
|
431
612
|
|
|
432
613
|
export { }
|
package/dist/index.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ElDialog as
|
|
1
|
+
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createSlots as o, createVNode as s, defineComponent as c, h as l, mergeProps as u, normalizeClass as d, normalizeStyle as f, onBeforeUnmount as p, openBlock as m, ref as h, renderList as g, renderSlot as _, toDisplayString as v, unref as y, useAttrs as b, useSlots as x, useTemplateRef as S, withCtx as C, withDirectives as w } from "vue";
|
|
2
|
+
import { ElDialog as T, ElDrawer as E, ElIcon as D, ElPagination as O, ElTable as k, ElTableColumn as A, vLoading as j } from "element-plus";
|
|
3
3
|
//#region node_modules/.pnpm/@element-plus+icons-vue@2.3.2_vue@3.5.41_typescript@5.8.3_/node_modules/@element-plus/icons-vue/dist/index.js
|
|
4
|
-
var
|
|
4
|
+
var M = /* @__PURE__ */ c({
|
|
5
5
|
name: "Close",
|
|
6
6
|
__name: "close",
|
|
7
7
|
setup(e) {
|
|
8
|
-
return (e, t) => (
|
|
8
|
+
return (e, t) => (m(), i("svg", {
|
|
9
9
|
xmlns: "http://www.w3.org/2000/svg",
|
|
10
10
|
viewBox: "0 0 1024 1024"
|
|
11
|
-
}, [
|
|
11
|
+
}, [a("path", {
|
|
12
12
|
fill: "currentColor",
|
|
13
13
|
d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
|
|
14
14
|
})]));
|
|
15
15
|
}
|
|
16
|
-
}),
|
|
16
|
+
}), N = /* @__PURE__ */ c({
|
|
17
17
|
name: "FullScreen",
|
|
18
18
|
__name: "full-screen",
|
|
19
19
|
setup(e) {
|
|
20
|
-
return (e, t) => (
|
|
20
|
+
return (e, t) => (m(), i("svg", {
|
|
21
21
|
xmlns: "http://www.w3.org/2000/svg",
|
|
22
22
|
viewBox: "0 0 1024 1024"
|
|
23
|
-
}, [
|
|
23
|
+
}, [a("path", {
|
|
24
24
|
fill: "currentColor",
|
|
25
25
|
d: "m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64z"
|
|
26
26
|
})]));
|
|
27
27
|
}
|
|
28
|
-
}),
|
|
28
|
+
}), P = /* @__PURE__ */ c({
|
|
29
29
|
name: "Minus",
|
|
30
30
|
__name: "minus",
|
|
31
31
|
setup(e) {
|
|
32
|
-
return (e, t) => (
|
|
32
|
+
return (e, t) => (m(), i("svg", {
|
|
33
33
|
xmlns: "http://www.w3.org/2000/svg",
|
|
34
34
|
viewBox: "0 0 1024 1024"
|
|
35
|
-
}, [
|
|
35
|
+
}, [a("path", {
|
|
36
36
|
fill: "currentColor",
|
|
37
37
|
d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64"
|
|
38
38
|
})]));
|
|
@@ -40,8 +40,8 @@ var C = /* @__PURE__ */ s({
|
|
|
40
40
|
});
|
|
41
41
|
//#endregion
|
|
42
42
|
//#region src/components/dialog/src/useFullscreen.ts
|
|
43
|
-
function
|
|
44
|
-
let r =
|
|
43
|
+
function F(e, n) {
|
|
44
|
+
let r = t(() => e.fullscreen ?? !1);
|
|
45
45
|
function i() {
|
|
46
46
|
n("update:fullscreen", !r.value);
|
|
47
47
|
}
|
|
@@ -52,11 +52,11 @@ function E(t, n) {
|
|
|
52
52
|
}
|
|
53
53
|
//#endregion
|
|
54
54
|
//#region src/components/dialog/src/useResizable.ts
|
|
55
|
-
function
|
|
55
|
+
function I(e, t, n) {
|
|
56
56
|
return Math.min(Math.max(e, t), n);
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
let n =
|
|
58
|
+
function L(e, t) {
|
|
59
|
+
let n = h(!1), r = h({}), i = () => {};
|
|
60
60
|
function a() {
|
|
61
61
|
i(), i = () => {};
|
|
62
62
|
}
|
|
@@ -67,7 +67,7 @@ function O(e, t) {
|
|
|
67
67
|
o.preventDefault(), a();
|
|
68
68
|
let c = s.getBoundingClientRect(), l = e.minWidth ?? 400, u = e.minHeight ?? 240, d = Math.max(l, window.innerWidth - c.left - 32), f = Math.max(u, window.innerHeight - c.top - 32), p = o.clientX, m = o.clientY;
|
|
69
69
|
function h(e) {
|
|
70
|
-
let i = Math.round(
|
|
70
|
+
let i = Math.round(I(c.width + e.clientX - p, l, d)), a = Math.round(I(c.height + e.clientY - m, u, f));
|
|
71
71
|
n.value = !0, r.value = {
|
|
72
72
|
height: `${a}px`,
|
|
73
73
|
width: `${i}px`
|
|
@@ -83,7 +83,7 @@ function O(e, t) {
|
|
|
83
83
|
window.removeEventListener("pointermove", h), window.removeEventListener("pointerup", g);
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
|
-
return
|
|
86
|
+
return p(a), {
|
|
87
87
|
isResized: n,
|
|
88
88
|
resizeStyle: r,
|
|
89
89
|
startResize: o
|
|
@@ -91,7 +91,7 @@ function O(e, t) {
|
|
|
91
91
|
}
|
|
92
92
|
//#endregion
|
|
93
93
|
//#region src/components/dialog/src/index.vue?vue&type=script&setup=true&lang.ts
|
|
94
|
-
var
|
|
94
|
+
var R = { class: "ctc-dialog__header-content" }, z = { class: "ctc-dialog__title" }, B = { class: "ctc-dialog__header-actions" }, V = ["aria-label", "title"], H = { class: "ctc-dialog__content" }, U = /* @__PURE__ */ c({
|
|
95
95
|
name: "CtcDialog",
|
|
96
96
|
inheritAttrs: !1,
|
|
97
97
|
__name: "index",
|
|
@@ -174,90 +174,90 @@ var k = { class: "ctc-dialog__header-content" }, A = { class: "ctc-dialog__title
|
|
|
174
174
|
"close",
|
|
175
175
|
"closed"
|
|
176
176
|
],
|
|
177
|
-
setup(
|
|
178
|
-
let
|
|
179
|
-
function
|
|
177
|
+
setup(e, { emit: c }) {
|
|
178
|
+
let l = e, d = c, f = b(), p = x(), { isFullscreen: h, toggleFullscreen: g } = F(l, d), { isResized: S, resizeStyle: w, startResize: E } = L(l, d), O = t(() => h.value ? {} : w.value), k = t(() => S.value && !h.value);
|
|
179
|
+
function A(e) {
|
|
180
180
|
d("update:modelValue", e);
|
|
181
181
|
}
|
|
182
|
-
function
|
|
183
|
-
if (
|
|
184
|
-
|
|
182
|
+
function j() {
|
|
183
|
+
if (l.beforeClose) {
|
|
184
|
+
l.beforeClose((e) => {
|
|
185
185
|
e || d("update:modelValue", !1);
|
|
186
186
|
});
|
|
187
187
|
return;
|
|
188
188
|
}
|
|
189
189
|
d("update:modelValue", !1);
|
|
190
190
|
}
|
|
191
|
-
return (
|
|
191
|
+
return (t, c) => (m(), n(y(T), u(y(f), {
|
|
192
192
|
class: ["ctc-dialog", {
|
|
193
|
-
"ctc-dialog--resizable":
|
|
194
|
-
"ctc-dialog--resized":
|
|
193
|
+
"ctc-dialog--resizable": e.resizable,
|
|
194
|
+
"ctc-dialog--resized": k.value
|
|
195
195
|
}],
|
|
196
|
-
style:
|
|
197
|
-
"model-value":
|
|
198
|
-
fullscreen:
|
|
199
|
-
title:
|
|
200
|
-
width:
|
|
201
|
-
"align-center":
|
|
202
|
-
"append-to":
|
|
203
|
-
"before-close":
|
|
204
|
-
"close-delay":
|
|
205
|
-
"close-on-click-modal":
|
|
206
|
-
"close-on-press-escape":
|
|
207
|
-
"destroy-on-close":
|
|
208
|
-
draggable:
|
|
209
|
-
"lock-scroll":
|
|
210
|
-
modal:
|
|
211
|
-
"modal-class":
|
|
212
|
-
"open-delay":
|
|
213
|
-
overflow:
|
|
196
|
+
style: O.value,
|
|
197
|
+
"model-value": e.modelValue,
|
|
198
|
+
fullscreen: y(h),
|
|
199
|
+
title: e.title,
|
|
200
|
+
width: e.width,
|
|
201
|
+
"align-center": e.alignCenter,
|
|
202
|
+
"append-to": e.appendTo,
|
|
203
|
+
"before-close": e.beforeClose,
|
|
204
|
+
"close-delay": e.closeDelay,
|
|
205
|
+
"close-on-click-modal": e.closeOnClickModal,
|
|
206
|
+
"close-on-press-escape": e.closeOnPressEscape,
|
|
207
|
+
"destroy-on-close": e.destroyOnClose,
|
|
208
|
+
draggable: e.draggable,
|
|
209
|
+
"lock-scroll": e.lockScroll,
|
|
210
|
+
modal: e.modal,
|
|
211
|
+
"modal-class": e.modalClass,
|
|
212
|
+
"open-delay": e.openDelay,
|
|
213
|
+
overflow: e.overflow,
|
|
214
214
|
"show-close": !1,
|
|
215
|
-
top:
|
|
216
|
-
"trap-focus":
|
|
217
|
-
"z-index":
|
|
215
|
+
top: e.top,
|
|
216
|
+
"trap-focus": e.trapFocus,
|
|
217
|
+
"z-index": e.zIndex,
|
|
218
218
|
"header-class": "ctc-dialog__header",
|
|
219
219
|
"body-class": "ctc-dialog__body",
|
|
220
220
|
"footer-class": "ctc-dialog__footer",
|
|
221
|
-
"onUpdate:modelValue":
|
|
222
|
-
onOpen:
|
|
223
|
-
onOpened:
|
|
224
|
-
onClose:
|
|
225
|
-
onClosed:
|
|
226
|
-
}),
|
|
227
|
-
header:
|
|
221
|
+
"onUpdate:modelValue": A,
|
|
222
|
+
onOpen: c[2] ||= (e) => d("open"),
|
|
223
|
+
onOpened: c[3] ||= (e) => d("opened"),
|
|
224
|
+
onClose: c[4] ||= (e) => d("close"),
|
|
225
|
+
onClosed: c[5] ||= (e) => d("closed")
|
|
226
|
+
}), o({
|
|
227
|
+
header: C(() => [a("div", R, [_(t.$slots, "header", {}, () => [a("span", z, v(e.title), 1)])]), a("div", B, [e.showFullscreen ? (m(), i("button", {
|
|
228
228
|
key: 0,
|
|
229
229
|
class: "ctc-dialog__fullscreen-toggle",
|
|
230
230
|
type: "button",
|
|
231
|
-
"aria-label":
|
|
232
|
-
title:
|
|
231
|
+
"aria-label": y(h) ? "退出全屏" : "全屏显示",
|
|
232
|
+
title: y(h) ? "退出全屏" : "全屏显示",
|
|
233
233
|
"data-ctc-fullscreen-toggle": "",
|
|
234
|
-
onClick:
|
|
235
|
-
}, [
|
|
236
|
-
default:
|
|
234
|
+
onClick: c[0] ||= (...e) => y(g) && y(g)(...e)
|
|
235
|
+
}, [s(y(D), { "aria-hidden": "true" }, {
|
|
236
|
+
default: C(() => [y(h) ? (m(), n(y(P), { key: 0 })) : (m(), n(y(N), { key: 1 }))]),
|
|
237
237
|
_: 1
|
|
238
|
-
})], 8,
|
|
238
|
+
})], 8, V)) : r("", !0), e.showClose ? (m(), i("button", {
|
|
239
239
|
key: 1,
|
|
240
240
|
class: "ctc-dialog__close",
|
|
241
241
|
type: "button",
|
|
242
242
|
"aria-label": "关闭弹窗",
|
|
243
243
|
title: "关闭",
|
|
244
244
|
"data-ctc-close": "",
|
|
245
|
-
onClick:
|
|
246
|
-
}, [
|
|
247
|
-
default:
|
|
245
|
+
onClick: j
|
|
246
|
+
}, [s(y(D), { "aria-hidden": "true" }, {
|
|
247
|
+
default: C(() => [s(y(M))]),
|
|
248
248
|
_: 1
|
|
249
|
-
})])) :
|
|
250
|
-
default:
|
|
249
|
+
})])) : r("", !0)])]),
|
|
250
|
+
default: C(() => [a("div", H, [_(t.$slots, "default")]), e.resizable && !y(h) ? (m(), i("div", {
|
|
251
251
|
key: 0,
|
|
252
252
|
class: "ctc-dialog__resize-handle",
|
|
253
253
|
"aria-hidden": "true",
|
|
254
254
|
"data-ctc-resize-handle": "",
|
|
255
|
-
onPointerdown:
|
|
256
|
-
}, null, 32)) :
|
|
255
|
+
onPointerdown: c[1] ||= (...e) => y(E) && y(E)(...e)
|
|
256
|
+
}, null, 32)) : r("", !0)]),
|
|
257
257
|
_: 2
|
|
258
|
-
}, [
|
|
258
|
+
}, [y(p).footer ? {
|
|
259
259
|
name: "footer",
|
|
260
|
-
fn:
|
|
260
|
+
fn: C(() => [_(t.$slots, "footer")]),
|
|
261
261
|
key: "0"
|
|
262
262
|
} : void 0]), 1040, [
|
|
263
263
|
"class",
|
|
@@ -284,10 +284,10 @@ var k = { class: "ctc-dialog__header-content" }, A = { class: "ctc-dialog__title
|
|
|
284
284
|
"z-index"
|
|
285
285
|
]));
|
|
286
286
|
}
|
|
287
|
-
}),
|
|
287
|
+
}), W = { class: "ctc-drawer__header-content" }, G = { class: "ctc-drawer__title" }, K = { class: "ctc-drawer__header-actions" }, q = ["aria-label", "title"], ee = { class: "ctc-drawer__content" }, te = {
|
|
288
288
|
key: 0,
|
|
289
289
|
class: "ctc-drawer__footer"
|
|
290
|
-
},
|
|
290
|
+
}, J = /* @__PURE__ */ c({
|
|
291
291
|
name: "CtcDrawer",
|
|
292
292
|
inheritAttrs: !1,
|
|
293
293
|
__name: "index",
|
|
@@ -354,67 +354,67 @@ var k = { class: "ctc-dialog__header-content" }, A = { class: "ctc-dialog__title
|
|
|
354
354
|
"close",
|
|
355
355
|
"closed"
|
|
356
356
|
],
|
|
357
|
-
setup(
|
|
358
|
-
let
|
|
359
|
-
function
|
|
360
|
-
|
|
357
|
+
setup(e, { emit: o }) {
|
|
358
|
+
let c = e, l = o, f = b(), p = x(), { isFullscreen: h, toggleFullscreen: g } = F(c, l), S = t(() => h.value ? "100%" : c.size);
|
|
359
|
+
function w(e) {
|
|
360
|
+
l("update:modelValue", e);
|
|
361
361
|
}
|
|
362
|
-
function
|
|
363
|
-
if (
|
|
364
|
-
|
|
365
|
-
e ||
|
|
362
|
+
function T() {
|
|
363
|
+
if (c.beforeClose) {
|
|
364
|
+
c.beforeClose((e) => {
|
|
365
|
+
e || l("update:modelValue", !1);
|
|
366
366
|
});
|
|
367
367
|
return;
|
|
368
368
|
}
|
|
369
|
-
|
|
369
|
+
l("update:modelValue", !1);
|
|
370
370
|
}
|
|
371
|
-
return (
|
|
372
|
-
class: ["ctc-drawer", { "is-fullscreen":
|
|
373
|
-
"model-value":
|
|
374
|
-
"append-to":
|
|
375
|
-
"before-close":
|
|
376
|
-
"close-on-click-modal":
|
|
377
|
-
"close-on-press-escape":
|
|
378
|
-
"destroy-on-close":
|
|
379
|
-
direction:
|
|
380
|
-
"lock-scroll":
|
|
381
|
-
modal:
|
|
382
|
-
"modal-class":
|
|
371
|
+
return (t, o) => (m(), n(y(E), u(y(f), {
|
|
372
|
+
class: ["ctc-drawer", { "is-fullscreen": y(h) }],
|
|
373
|
+
"model-value": e.modelValue,
|
|
374
|
+
"append-to": e.appendTo,
|
|
375
|
+
"before-close": e.beforeClose,
|
|
376
|
+
"close-on-click-modal": e.closeOnClickModal,
|
|
377
|
+
"close-on-press-escape": e.closeOnPressEscape,
|
|
378
|
+
"destroy-on-close": e.destroyOnClose,
|
|
379
|
+
direction: e.direction,
|
|
380
|
+
"lock-scroll": e.lockScroll,
|
|
381
|
+
modal: e.modal,
|
|
382
|
+
"modal-class": e.modalClass,
|
|
383
383
|
"show-close": !1,
|
|
384
|
-
size:
|
|
385
|
-
"z-index":
|
|
384
|
+
size: S.value,
|
|
385
|
+
"z-index": e.zIndex,
|
|
386
386
|
"header-class": "ctc-drawer__header",
|
|
387
387
|
"body-class": "ctc-drawer__body",
|
|
388
|
-
"onUpdate:modelValue":
|
|
389
|
-
onOpen:
|
|
390
|
-
onOpened:
|
|
391
|
-
onClose:
|
|
392
|
-
onClosed:
|
|
388
|
+
"onUpdate:modelValue": w,
|
|
389
|
+
onOpen: o[1] ||= (e) => l("open"),
|
|
390
|
+
onOpened: o[2] ||= (e) => l("opened"),
|
|
391
|
+
onClose: o[3] ||= (e) => l("close"),
|
|
392
|
+
onClosed: o[4] ||= (e) => l("closed")
|
|
393
393
|
}), {
|
|
394
|
-
header:
|
|
394
|
+
header: C(() => [a("div", W, [_(t.$slots, "header", {}, () => [a("span", G, v(e.title), 1)])]), a("div", K, [e.showFullscreen ? (m(), i("button", {
|
|
395
395
|
key: 0,
|
|
396
396
|
class: "ctc-drawer__fullscreen-toggle",
|
|
397
397
|
type: "button",
|
|
398
|
-
"aria-label":
|
|
399
|
-
title:
|
|
398
|
+
"aria-label": y(h) ? "退出全屏" : "全屏显示",
|
|
399
|
+
title: y(h) ? "退出全屏" : "全屏显示",
|
|
400
400
|
"data-ctc-fullscreen-toggle": "",
|
|
401
|
-
onClick:
|
|
402
|
-
}, [
|
|
403
|
-
default:
|
|
401
|
+
onClick: o[0] ||= (...e) => y(g) && y(g)(...e)
|
|
402
|
+
}, [s(y(D), { "aria-hidden": "true" }, {
|
|
403
|
+
default: C(() => [y(h) ? (m(), n(y(P), { key: 0 })) : (m(), n(y(N), { key: 1 }))]),
|
|
404
404
|
_: 1
|
|
405
|
-
})], 8,
|
|
405
|
+
})], 8, q)) : r("", !0), e.showClose ? (m(), i("button", {
|
|
406
406
|
key: 1,
|
|
407
407
|
class: "ctc-drawer__close",
|
|
408
408
|
type: "button",
|
|
409
409
|
"aria-label": "关闭抽屉",
|
|
410
410
|
title: "关闭",
|
|
411
411
|
"data-ctc-close": "",
|
|
412
|
-
onClick:
|
|
413
|
-
}, [
|
|
414
|
-
default:
|
|
412
|
+
onClick: T
|
|
413
|
+
}, [s(y(D), { "aria-hidden": "true" }, {
|
|
414
|
+
default: C(() => [s(y(M))]),
|
|
415
415
|
_: 1
|
|
416
|
-
})])) :
|
|
417
|
-
default:
|
|
416
|
+
})])) : r("", !0)])]),
|
|
417
|
+
default: C(() => [a("div", { class: d(["ctc-drawer__layout", { "has-footer": y(p).footer }]) }, [a("div", ee, [_(t.$slots, "default")]), y(p).footer ? (m(), i("div", te, [_(t.$slots, "footer")])) : r("", !0)], 2)]),
|
|
418
418
|
_: 3
|
|
419
419
|
}, 16, [
|
|
420
420
|
"class",
|
|
@@ -432,7 +432,7 @@ var k = { class: "ctc-dialog__header-content" }, A = { class: "ctc-dialog__title
|
|
|
432
432
|
"z-index"
|
|
433
433
|
]));
|
|
434
434
|
}
|
|
435
|
-
}),
|
|
435
|
+
}), Y = /* @__PURE__ */ c({
|
|
436
436
|
name: "CtcFlex",
|
|
437
437
|
__name: "index",
|
|
438
438
|
props: {
|
|
@@ -450,8 +450,8 @@ var k = { class: "ctc-dialog__header-content" }, A = { class: "ctc-dialog__title
|
|
|
450
450
|
default: !1
|
|
451
451
|
}
|
|
452
452
|
},
|
|
453
|
-
setup(
|
|
454
|
-
let n =
|
|
453
|
+
setup(e) {
|
|
454
|
+
let n = e, r = t(() => {
|
|
455
455
|
let e = {
|
|
456
456
|
alignItems: n.align,
|
|
457
457
|
flexDirection: n.direction,
|
|
@@ -459,19 +459,189 @@ var k = { class: "ctc-dialog__header-content" }, A = { class: "ctc-dialog__title
|
|
|
459
459
|
};
|
|
460
460
|
return n.gap !== 0 && n.gap !== "" && (e.gap = typeof n.gap == "number" ? `${n.gap}px` : n.gap), n.fill && (e.flex = n.grow), n.direction === "column" ? e.minHeight = "0" : e.minWidth = "0", n.scroll === "x" ? (e.overflowX = "auto", e.overflowY = "hidden") : n.scroll === "y" ? (e.overflowX = "hidden", e.overflowY = "auto") : n.scroll && (e.overflow = "auto"), e;
|
|
461
461
|
});
|
|
462
|
-
return (e, t) => (
|
|
462
|
+
return (e, t) => (m(), i("div", {
|
|
463
463
|
class: "ctc-flex",
|
|
464
|
-
style:
|
|
465
|
-
}, [
|
|
464
|
+
style: f(r.value)
|
|
465
|
+
}, [_(e.$slots, "default")], 4));
|
|
466
|
+
}
|
|
467
|
+
}), ne = /* @__PURE__ */ new Set([
|
|
468
|
+
"selection",
|
|
469
|
+
"index",
|
|
470
|
+
"expand"
|
|
471
|
+
]), re = c({
|
|
472
|
+
name: "CtcTableColumn",
|
|
473
|
+
props: {
|
|
474
|
+
column: {
|
|
475
|
+
type: Object,
|
|
476
|
+
required: !0
|
|
477
|
+
},
|
|
478
|
+
slots: {
|
|
479
|
+
type: Object,
|
|
480
|
+
required: !0
|
|
481
|
+
}
|
|
482
|
+
},
|
|
483
|
+
setup(e) {
|
|
484
|
+
let t = (e) => e.slot ?? e.prop, n = (e, t) => {
|
|
485
|
+
if (t) return t.replace(/\[(?:'([^']*)'|"([^"]*)"|([^\]]+))\]/g, ".$1$2$3").split(".").filter(Boolean).reduce((e, t) => {
|
|
486
|
+
if (!(typeof e != "object" || !e)) return e[t];
|
|
487
|
+
}, e);
|
|
488
|
+
}, r = (r, i) => {
|
|
489
|
+
let a = t(r), o = a ? e.slots[a] : void 0;
|
|
490
|
+
if (o) return o({
|
|
491
|
+
...i,
|
|
492
|
+
config: r
|
|
493
|
+
});
|
|
494
|
+
if (r.renderCell) return r.renderCell(i);
|
|
495
|
+
if (r.formatter) {
|
|
496
|
+
let e = n(i.row, r.prop ?? r.property);
|
|
497
|
+
return r.formatter(i.row, i.column, e, i.$index);
|
|
498
|
+
}
|
|
499
|
+
}, i = (t, n) => {
|
|
500
|
+
let r = t.headerSlot ? e.slots[t.headerSlot] : void 0;
|
|
501
|
+
return r ? r({
|
|
502
|
+
...n,
|
|
503
|
+
config: t
|
|
504
|
+
}) : t.renderHeader?.(n);
|
|
505
|
+
}, a = (t) => {
|
|
506
|
+
let { children: n, slot: o, headerSlot: s, renderCell: c, renderHeader: u, formatter: d, ...f } = t, p = !!n?.length, m = o ?? t.prop, h = !!(m && e.slots[m] || c || d), g = !!(s && e.slots[s] || u), _ = t.type ? ne.has(t.type) : !1;
|
|
507
|
+
return l(A, f, {
|
|
508
|
+
default: p ? () => n?.map(a) : h && !_ ? (e) => r(t, e) : void 0,
|
|
509
|
+
header: g ? (e) => i(t, e) : void 0
|
|
510
|
+
});
|
|
511
|
+
};
|
|
512
|
+
return () => a(e.column);
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
//#endregion
|
|
516
|
+
//#region src/components/table/src/merge.ts
|
|
517
|
+
function X(e, t) {
|
|
518
|
+
return t.replace(/\[(?:'([^']*)'|"([^"]*)"|([^\]]+))\]/g, ".$1$2$3").split(".").filter(Boolean).reduce((e, t) => {
|
|
519
|
+
if (!(typeof e != "object" || !e)) return e[t];
|
|
520
|
+
}, e);
|
|
521
|
+
}
|
|
522
|
+
function Z(e, t, n) {
|
|
523
|
+
return n.every((n) => Object.is(X(e, n), X(t, n)));
|
|
524
|
+
}
|
|
525
|
+
function ie(e, t) {
|
|
526
|
+
let n = new Map(t.filter((e) => e.prop && e.by.length > 0).map((e) => [e.prop, e]));
|
|
527
|
+
return ({ column: t, rowIndex: r }) => {
|
|
528
|
+
if (t.type === "selection" || t.type === "index" || t.type === "expand") return;
|
|
529
|
+
let i = t.property, a = i ? n.get(i) : void 0;
|
|
530
|
+
if (!a) return;
|
|
531
|
+
let o = e[r];
|
|
532
|
+
if (!o) return;
|
|
533
|
+
if (r > 0 && Z(e[r - 1], o, a.by)) return {
|
|
534
|
+
rowspan: 0,
|
|
535
|
+
colspan: 0
|
|
536
|
+
};
|
|
537
|
+
let s = 1;
|
|
538
|
+
for (; r + s < e.length && Z(o, e[r + s], a.by);) s += 1;
|
|
539
|
+
return {
|
|
540
|
+
rowspan: s,
|
|
541
|
+
colspan: 1
|
|
542
|
+
};
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
//#endregion
|
|
546
|
+
//#region src/components/table/src/index.vue?vue&type=script&setup=true&lang.ts
|
|
547
|
+
var ae = { class: "ctc-table" }, oe = {
|
|
548
|
+
key: 0,
|
|
549
|
+
class: "ctc-table__pagination"
|
|
550
|
+
}, Q = /* @__PURE__ */ c({
|
|
551
|
+
name: "CtcTable",
|
|
552
|
+
inheritAttrs: !1,
|
|
553
|
+
__name: "index",
|
|
554
|
+
props: {
|
|
555
|
+
columns: { default: () => [] },
|
|
556
|
+
currentPage: { default: 1 },
|
|
557
|
+
data: { default: () => [] },
|
|
558
|
+
loading: {
|
|
559
|
+
type: Boolean,
|
|
560
|
+
default: !1
|
|
561
|
+
},
|
|
562
|
+
merge: { default: () => [] },
|
|
563
|
+
pageSize: { default: 10 },
|
|
564
|
+
pagination: {
|
|
565
|
+
type: Boolean,
|
|
566
|
+
default: !1
|
|
567
|
+
},
|
|
568
|
+
paginationProps: { default: () => ({}) },
|
|
569
|
+
total: { default: 0 }
|
|
570
|
+
},
|
|
571
|
+
emits: [
|
|
572
|
+
"update:currentPage",
|
|
573
|
+
"update:pageSize",
|
|
574
|
+
"current-change",
|
|
575
|
+
"page-change",
|
|
576
|
+
"page-size-change",
|
|
577
|
+
"prev-click",
|
|
578
|
+
"next-click"
|
|
579
|
+
],
|
|
580
|
+
setup(a, { expose: c, emit: l }) {
|
|
581
|
+
let d = a, f = l, p = b(), h = x(), v = S("tableRef"), T = /* @__PURE__ */ new Set(/* @__PURE__ */ "currentPage.pageSize.total.layout.pageSizes.pagerCount.background.disabled.hideOnSinglePage.small.prevText.nextText.prevIcon.nextIcon.popperClass.popperStyle.teleported.appendSizeTo.pageCount.defaultCurrentPage.defaultPageSize.onUpdate:currentPage.onUpdate:pageSize.onCurrentChange.onSizeChange.onPrevClick.onNextClick".split(".")), E = t(() => Object.fromEntries(Object.entries(p).filter(([e]) => !T.has(e) && e !== "spanMethod"))), D = t(() => {
|
|
582
|
+
if (typeof p.spanMethod == "function") return p.spanMethod;
|
|
583
|
+
if (d.merge.length !== 0) return ie(d.data, d.merge);
|
|
584
|
+
});
|
|
585
|
+
function A(e, t) {
|
|
586
|
+
f("current-change", e, t);
|
|
587
|
+
}
|
|
588
|
+
return c({
|
|
589
|
+
clearSelection: () => v.value?.clearSelection(),
|
|
590
|
+
toggleRowSelection: (e, t) => v.value?.toggleRowSelection(e, t),
|
|
591
|
+
toggleAllSelection: () => v.value?.toggleAllSelection(),
|
|
592
|
+
toggleRowExpansion: (e, t) => v.value?.toggleRowExpansion(e, t),
|
|
593
|
+
setCurrentRow: (e) => v.value?.setCurrentRow(e),
|
|
594
|
+
clearSort: () => v.value?.clearSort(),
|
|
595
|
+
clearFilter: (e) => v.value?.clearFilter(e),
|
|
596
|
+
doLayout: () => v.value?.doLayout(),
|
|
597
|
+
sort: (e, t) => v.value?.sort(e, t)
|
|
598
|
+
}), (t, a) => (m(), i("div", ae, [w((m(), n(y(k), u({
|
|
599
|
+
ref_key: "tableRef",
|
|
600
|
+
ref: v
|
|
601
|
+
}, E.value, {
|
|
602
|
+
data: d.data,
|
|
603
|
+
"span-method": D.value,
|
|
604
|
+
onCurrentChange: A
|
|
605
|
+
}), o({
|
|
606
|
+
default: C(() => [(m(!0), i(e, null, g(d.columns, (e, t) => (m(), n(re, {
|
|
607
|
+
key: e.prop ?? e.property ?? e.label ?? t,
|
|
608
|
+
column: e,
|
|
609
|
+
slots: y(h)
|
|
610
|
+
}, null, 8, ["column", "slots"]))), 128))]),
|
|
611
|
+
_: 2
|
|
612
|
+
}, [y(h).empty ? {
|
|
613
|
+
name: "empty",
|
|
614
|
+
fn: C(() => [_(t.$slots, "empty")]),
|
|
615
|
+
key: "0"
|
|
616
|
+
} : void 0, y(h).append ? {
|
|
617
|
+
name: "append",
|
|
618
|
+
fn: C(() => [_(t.$slots, "append")]),
|
|
619
|
+
key: "1"
|
|
620
|
+
} : void 0]), 1040, ["data", "span-method"])), [[y(j), d.loading]]), d.pagination ? (m(), i("div", oe, [s(y(O), u(d.paginationProps, {
|
|
621
|
+
"current-page": d.currentPage,
|
|
622
|
+
"page-size": d.pageSize,
|
|
623
|
+
total: d.total,
|
|
624
|
+
"onUpdate:currentPage": a[0] ||= (e) => f("update:currentPage", e),
|
|
625
|
+
"onUpdate:pageSize": a[1] ||= (e) => f("update:pageSize", e),
|
|
626
|
+
onCurrentChange: a[2] ||= (e) => f("page-change", e),
|
|
627
|
+
onSizeChange: a[3] ||= (e) => f("page-size-change", e),
|
|
628
|
+
onPrevClick: a[4] ||= (e) => f("prev-click", e),
|
|
629
|
+
onNextClick: a[5] ||= (e) => f("next-click", e)
|
|
630
|
+
}), null, 16, [
|
|
631
|
+
"current-page",
|
|
632
|
+
"page-size",
|
|
633
|
+
"total"
|
|
634
|
+
]), _(t.$slots, "pagination")])) : r("", !0)]));
|
|
466
635
|
}
|
|
467
|
-
}),
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
636
|
+
}), se = [
|
|
637
|
+
U,
|
|
638
|
+
J,
|
|
639
|
+
Y,
|
|
640
|
+
Q
|
|
641
|
+
], $ = { install(e) {
|
|
642
|
+
se.forEach((t) => {
|
|
473
643
|
e.component(t.name ?? "", t);
|
|
474
644
|
});
|
|
475
645
|
} };
|
|
476
646
|
//#endregion
|
|
477
|
-
export {
|
|
647
|
+
export { $ as CtcComponentsUi, $ as default, U as CtcDialog, J as CtcDrawer, Y as CtcFlex, Q as CtcTable };
|
package/dist/style.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
:root:not(.dark):not([data-ctc-theme]):not([data-ctc-theme-mode=inherit]),[data-ctc-theme=light]{--ctc-color-primary:#1f5eff;--ctc-color-primary-hover:#356fff;--ctc-color-primary-active:#1749c6;--ctc-color-primary-light-3:#5a87ff;--ctc-color-primary-light-5:#7da4ff;--ctc-color-primary-light-7:#a5c0ff;--ctc-color-primary-light-8:#bdcfff;--ctc-color-primary-light-9:#dce7ff;--ctc-color-page:#f8f8f8;--ctc-color-surface:#fff;--ctc-color-surface-elevated:#fff;--ctc-color-fill:#f3f5f9;--ctc-color-fill-light:#f7f8fb;--ctc-color-text:#2e3544;--ctc-color-text-secondary:#667085;--ctc-color-text-placeholder:#98a2b3;--ctc-color-border:#dbdfe7;--ctc-color-border-light:#e9ecf2;--ctc-color-mask:#1118277a;--ctc-radius-small:0;--ctc-radius-base:3px;--ctc-radius-large:0;--ctc-space-2:8px;--ctc-space-3:12px;--ctc-space-4:16px;--ctc-space-5:20px;--ctc-space-6:24px;--el-color-primary:var(--ctc-color-primary);--el-color-primary-dark-2:var(--ctc-color-primary-active);--el-color-primary-light-3:var(--ctc-color-primary-light-3);--el-color-primary-light-5:var(--ctc-color-primary-light-5);--el-color-primary-light-7:var(--ctc-color-primary-light-7);--el-color-primary-light-8:var(--ctc-color-primary-light-8);--el-color-primary-light-9:var(--ctc-color-primary-light-9);--el-bg-color:var(--ctc-color-surface);--el-bg-color-page:var(--ctc-color-page);--el-bg-color-overlay:var(--ctc-color-surface-elevated);--el-fill-color:var(--ctc-color-fill);--el-fill-color-light:var(--ctc-color-fill-light);--el-text-color-primary:var(--ctc-color-text);--el-text-color-regular:var(--ctc-color-text-secondary);--el-text-color-placeholder:var(--ctc-color-text-placeholder);--el-border-color:var(--ctc-color-border);--el-border-color-light:var(--ctc-color-border-light);--el-border-radius-small:var(--ctc-radius-small);--el-border-radius-base:var(--ctc-radius-base);--el-border-radius-round:999px;--el-mask-color:var(--ctc-color-mask)}html.dark:not([data-ctc-theme=light]):not([data-ctc-theme-mode=inherit]),[data-ctc-theme=dark]:not([data-ctc-theme-mode=inherit]){--ctc-color-primary:#4d7dff;--ctc-color-primary-hover:#6993ff;--ctc-color-primary-active:#3569e8;--ctc-color-primary-light-3:#6e94ff;--ctc-color-primary-light-5:#91aeff;--ctc-color-primary-light-7:#b1c5ff;--ctc-color-primary-light-8:#c5d4ff;--ctc-color-primary-light-9:#dde7ff;--ctc-color-page:#071326;--ctc-color-surface:#0e1d33;--ctc-color-surface-elevated:#142541;--ctc-color-fill:#1a2c48;--ctc-color-fill-light:#203552;--ctc-color-text:#f2f6ff;--ctc-color-text-secondary:#b6c2d9;--ctc-color-text-placeholder:#7f90ad;--ctc-color-border:#263955;--ctc-color-border-light:#304762;--ctc-color-mask:#000612b8;--ctc-radius-small:0;--ctc-radius-base:3px;--ctc-radius-large:0;--ctc-space-2:8px;--ctc-space-3:12px;--ctc-space-4:16px;--ctc-space-5:20px;--ctc-space-6:24px;--el-color-primary:var(--ctc-color-primary);--el-color-primary-dark-2:var(--ctc-color-primary-active);--el-color-primary-light-3:var(--ctc-color-primary-light-3);--el-color-primary-light-5:var(--ctc-color-primary-light-5);--el-color-primary-light-7:var(--ctc-color-primary-light-7);--el-color-primary-light-8:var(--ctc-color-primary-light-8);--el-color-primary-light-9:var(--ctc-color-primary-light-9);--el-bg-color:var(--ctc-color-surface);--el-bg-color-page:var(--ctc-color-page);--el-bg-color-overlay:var(--ctc-color-surface-elevated);--el-fill-color:var(--ctc-color-fill);--el-fill-color-light:var(--ctc-color-fill-light);--el-text-color-primary:var(--ctc-color-text);--el-text-color-regular:var(--ctc-color-text-secondary);--el-text-color-placeholder:var(--ctc-color-text-placeholder);--el-border-color:var(--ctc-color-border);--el-border-color-light:var(--ctc-color-border-light);--el-border-radius-small:var(--ctc-radius-small);--el-border-radius-base:var(--ctc-radius-base);--el-border-radius-round:999px;--el-mask-color:var(--ctc-color-mask)}[data-ctc-theme-mode=inherit]{--ctc-color-primary:var(--el-color-primary);--ctc-color-primary-hover:var(--el-color-primary-light-3);--ctc-color-primary-active:var(--el-color-primary-dark-2);--ctc-color-page:var(--el-bg-color-page);--ctc-color-surface:var(--el-bg-color);--ctc-color-surface-elevated:var(--el-bg-color-overlay);--ctc-color-fill:var(--el-fill-color);--ctc-color-fill-light:var(--el-fill-color-light);--ctc-color-text:var(--el-text-color-primary);--ctc-color-text-secondary:var(--el-text-color-regular);--ctc-color-text-placeholder:var(--el-text-color-placeholder);--ctc-color-border:var(--el-border-color);--ctc-color-border-light:var(--el-border-color-light);--ctc-color-mask:var(--el-mask-color);--ctc-radius-small:var(--el-border-radius-small);--ctc-radius-base:var(--el-border-radius-base);--ctc-radius-large:8px;--ctc-space-2:8px;--ctc-space-3:12px;--ctc-space-4:16px;--ctc-space-5:20px;--ctc-space-6:24px}.el-overlay{--el-overlay-color-lighter:var(--ctc-color-mask)}.ctc-dialog{--el-dialog-bg-color:var(--ctc-color-surface);--el-dialog-padding-primary:0;background:var(--ctc-color-surface);border:1px solid var(--ctc-color-border-light);border-radius:var(--ctc-radius-base);position:relative;overflow:hidden;box-shadow:0 18px 48px #0f172a29}.ctc-dialog.is-fullscreen{border-radius:0}.ctc-dialog__header{background:var(--ctc-color-surface);border-bottom:1px solid var(--ctc-color-border-light);box-sizing:border-box;color:var(--ctc-color-text);align-items:center;gap:var(--ctc-space-2);height:48px;padding:0 var(--ctc-space-6);margin:0;line-height:1;display:flex}.ctc-dialog__header-content{align-items:center;gap:var(--ctc-space-2);flex:1;min-width:0;display:flex}.ctc-dialog__header-actions{align-items:center;gap:4px;display:inline-flex}.ctc-dialog__fullscreen-toggle,.ctc-dialog__close{border-radius:var(--ctc-radius-small);color:var(--ctc-color-text-secondary);cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;width:28px;height:28px;padding:0;font-size:18px;transition:background-color .2s,color .2s;display:inline-flex}.ctc-dialog__title{text-overflow:ellipsis;white-space:nowrap;flex:1;font-size:16px;font-weight:600;overflow:hidden}.ctc-dialog__fullscreen-toggle{font-size:16px}.ctc-dialog__fullscreen-toggle:hover,.ctc-dialog__close:hover{background:var(--ctc-color-fill);color:var(--ctc-color-primary)}.ctc-dialog__close{font-size:22px;font-weight:300;line-height:1}.ctc-dialog__body{box-sizing:border-box;max-height:calc(100vh - 144px);padding:0;overflow:auto}.ctc-dialog--resized{flex-direction:column;display:flex}.ctc-dialog--resized .ctc-dialog__body{flex:1;min-height:0;max-height:none}.ctc-dialog__content{box-sizing:border-box;padding:var(--ctc-space-6)}.ctc-dialog__footer{border-top:1px solid var(--ctc-color-border-light);box-sizing:border-box;min-height:64px;padding:var(--ctc-space-4) var(--ctc-space-6);justify-content:flex-end;align-items:center;display:flex}.ctc-dialog__resize-handle{cursor:nwse-resize;touch-action:none;z-index:1;width:18px;height:18px;position:absolute;bottom:0;right:0}.ctc-dialog__resize-handle:before{background:linear-gradient(135deg, transparent 0 46%, var(--ctc-color-border) 47% 53%, transparent 54% 100%);content:"";position:absolute;inset:4px}.ctc-drawer{--el-drawer-bg-color:var(--ctc-color-surface);background:var(--ctc-color-surface);color:var(--ctc-color-text)}.ctc-drawer.is-fullscreen{width:100%;height:100%}.ctc-drawer__header{background:var(--ctc-color-surface);border-bottom:1px solid var(--ctc-color-border-light);box-sizing:border-box;color:var(--ctc-color-text);align-items:center;gap:var(--ctc-space-2);height:48px;padding:0 var(--ctc-space-6);margin:0;display:flex}.ctc-drawer__title{text-overflow:ellipsis;white-space:nowrap;flex:1;font-size:16px;font-weight:600;overflow:hidden}.ctc-drawer__header-content{flex:1;align-items:center;min-width:0;display:flex}.ctc-drawer__header-actions{align-items:center;gap:4px;display:inline-flex}.ctc-drawer__fullscreen-toggle,.ctc-drawer__close{border-radius:var(--ctc-radius-small);color:var(--ctc-color-text-secondary);cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;width:28px;height:28px;padding:0;font-size:18px;transition:background-color .2s,color .2s;display:inline-flex}.ctc-drawer__fullscreen-toggle:hover,.ctc-drawer__close:hover{background:var(--ctc-color-fill);color:var(--ctc-color-primary)}.ctc-drawer__fullscreen-toggle{font-size:16px}.ctc-drawer__close{font-size:22px;font-weight:300;line-height:1}.ctc-drawer__body{box-sizing:border-box;padding:0;overflow:hidden}.ctc-drawer__layout{flex-direction:column;height:100%;min-height:0;display:flex}.ctc-drawer__content{box-sizing:border-box;min-height:0;padding:var(--ctc-space-6);flex:1;overflow:auto}.ctc-drawer__footer{border-top:1px solid var(--ctc-color-border-light);box-sizing:border-box;min-height:64px;padding:var(--ctc-space-4) var(--ctc-space-6);flex-shrink:0;justify-content:flex-end;align-items:center;display:flex}.ctc-flex{box-sizing:border-box;display:flex}
|
|
1
|
+
:root:not(.dark):not([data-ctc-theme]):not([data-ctc-theme-mode=inherit]),[data-ctc-theme=light]{--ctc-color-primary:#1f5eff;--ctc-color-primary-hover:#356fff;--ctc-color-primary-active:#1749c6;--ctc-color-primary-light-3:#5a87ff;--ctc-color-primary-light-5:#7da4ff;--ctc-color-primary-light-7:#a5c0ff;--ctc-color-primary-light-8:#bdcfff;--ctc-color-primary-light-9:#dce7ff;--ctc-color-page:#f8f8f8;--ctc-color-surface:#fff;--ctc-color-surface-elevated:#fff;--ctc-color-fill:#f3f5f9;--ctc-color-fill-light:#f7f8fb;--ctc-color-text:#2e3544;--ctc-color-text-secondary:#667085;--ctc-color-text-placeholder:#98a2b3;--ctc-color-border:#dbdfe7;--ctc-color-border-light:#e9ecf2;--ctc-color-mask:#1118277a;--ctc-radius-small:0;--ctc-radius-base:3px;--ctc-radius-large:0;--ctc-space-2:8px;--ctc-space-3:12px;--ctc-space-4:16px;--ctc-space-5:20px;--ctc-space-6:24px;--el-color-primary:var(--ctc-color-primary);--el-color-primary-dark-2:var(--ctc-color-primary-active);--el-color-primary-light-3:var(--ctc-color-primary-light-3);--el-color-primary-light-5:var(--ctc-color-primary-light-5);--el-color-primary-light-7:var(--ctc-color-primary-light-7);--el-color-primary-light-8:var(--ctc-color-primary-light-8);--el-color-primary-light-9:var(--ctc-color-primary-light-9);--el-bg-color:var(--ctc-color-surface);--el-bg-color-page:var(--ctc-color-page);--el-bg-color-overlay:var(--ctc-color-surface-elevated);--el-fill-color:var(--ctc-color-fill);--el-fill-color-light:var(--ctc-color-fill-light);--el-text-color-primary:var(--ctc-color-text);--el-text-color-regular:var(--ctc-color-text-secondary);--el-text-color-placeholder:var(--ctc-color-text-placeholder);--el-border-color:var(--ctc-color-border);--el-border-color-light:var(--ctc-color-border-light);--el-border-radius-small:var(--ctc-radius-small);--el-border-radius-base:var(--ctc-radius-base);--el-border-radius-round:999px;--el-mask-color:var(--ctc-color-mask)}html.dark:not([data-ctc-theme=light]):not([data-ctc-theme-mode=inherit]),[data-ctc-theme=dark]:not([data-ctc-theme-mode=inherit]){--ctc-color-primary:#4d7dff;--ctc-color-primary-hover:#6993ff;--ctc-color-primary-active:#3569e8;--ctc-color-primary-light-3:#6e94ff;--ctc-color-primary-light-5:#91aeff;--ctc-color-primary-light-7:#b1c5ff;--ctc-color-primary-light-8:#c5d4ff;--ctc-color-primary-light-9:#dde7ff;--ctc-color-page:#071326;--ctc-color-surface:#0e1d33;--ctc-color-surface-elevated:#142541;--ctc-color-fill:#1a2c48;--ctc-color-fill-light:#203552;--ctc-color-text:#f2f6ff;--ctc-color-text-secondary:#b6c2d9;--ctc-color-text-placeholder:#7f90ad;--ctc-color-border:#263955;--ctc-color-border-light:#304762;--ctc-color-mask:#000612b8;--ctc-radius-small:0;--ctc-radius-base:3px;--ctc-radius-large:0;--ctc-space-2:8px;--ctc-space-3:12px;--ctc-space-4:16px;--ctc-space-5:20px;--ctc-space-6:24px;--el-color-primary:var(--ctc-color-primary);--el-color-primary-dark-2:var(--ctc-color-primary-active);--el-color-primary-light-3:var(--ctc-color-primary-light-3);--el-color-primary-light-5:var(--ctc-color-primary-light-5);--el-color-primary-light-7:var(--ctc-color-primary-light-7);--el-color-primary-light-8:var(--ctc-color-primary-light-8);--el-color-primary-light-9:var(--ctc-color-primary-light-9);--el-bg-color:var(--ctc-color-surface);--el-bg-color-page:var(--ctc-color-page);--el-bg-color-overlay:var(--ctc-color-surface-elevated);--el-fill-color:var(--ctc-color-fill);--el-fill-color-light:var(--ctc-color-fill-light);--el-text-color-primary:var(--ctc-color-text);--el-text-color-regular:var(--ctc-color-text-secondary);--el-text-color-placeholder:var(--ctc-color-text-placeholder);--el-border-color:var(--ctc-color-border);--el-border-color-light:var(--ctc-color-border-light);--el-border-radius-small:var(--ctc-radius-small);--el-border-radius-base:var(--ctc-radius-base);--el-border-radius-round:999px;--el-mask-color:var(--ctc-color-mask)}[data-ctc-theme-mode=inherit]{--ctc-color-primary:var(--el-color-primary);--ctc-color-primary-hover:var(--el-color-primary-light-3);--ctc-color-primary-active:var(--el-color-primary-dark-2);--ctc-color-page:var(--el-bg-color-page);--ctc-color-surface:var(--el-bg-color);--ctc-color-surface-elevated:var(--el-bg-color-overlay);--ctc-color-fill:var(--el-fill-color);--ctc-color-fill-light:var(--el-fill-color-light);--ctc-color-text:var(--el-text-color-primary);--ctc-color-text-secondary:var(--el-text-color-regular);--ctc-color-text-placeholder:var(--el-text-color-placeholder);--ctc-color-border:var(--el-border-color);--ctc-color-border-light:var(--el-border-color-light);--ctc-color-mask:var(--el-mask-color);--ctc-radius-small:var(--el-border-radius-small);--ctc-radius-base:var(--el-border-radius-base);--ctc-radius-large:8px;--ctc-space-2:8px;--ctc-space-3:12px;--ctc-space-4:16px;--ctc-space-5:20px;--ctc-space-6:24px}.el-overlay{--el-overlay-color-lighter:var(--ctc-color-mask)}.ctc-dialog{--el-dialog-bg-color:var(--ctc-color-surface);--el-dialog-padding-primary:0;background:var(--ctc-color-surface);border:1px solid var(--ctc-color-border-light);border-radius:var(--ctc-radius-base);position:relative;overflow:hidden;box-shadow:0 18px 48px #0f172a29}.ctc-dialog.is-fullscreen{border-radius:0}.ctc-dialog__header{background:var(--ctc-color-surface);border-bottom:1px solid var(--ctc-color-border-light);box-sizing:border-box;color:var(--ctc-color-text);align-items:center;gap:var(--ctc-space-2);height:48px;padding:0 var(--ctc-space-6);margin:0;line-height:1;display:flex}.ctc-dialog__header-content{align-items:center;gap:var(--ctc-space-2);flex:1;min-width:0;display:flex}.ctc-dialog__header-actions{align-items:center;gap:4px;display:inline-flex}.ctc-dialog__fullscreen-toggle,.ctc-dialog__close{border-radius:var(--ctc-radius-small);color:var(--ctc-color-text-secondary);cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;width:28px;height:28px;padding:0;font-size:18px;transition:background-color .2s,color .2s;display:inline-flex}.ctc-dialog__title{text-overflow:ellipsis;white-space:nowrap;flex:1;font-size:16px;font-weight:600;overflow:hidden}.ctc-dialog__fullscreen-toggle{font-size:16px}.ctc-dialog__fullscreen-toggle:hover,.ctc-dialog__close:hover{background:var(--ctc-color-fill);color:var(--ctc-color-primary)}.ctc-dialog__close{font-size:22px;font-weight:300;line-height:1}.ctc-dialog__body{box-sizing:border-box;max-height:calc(100vh - 144px);padding:0;overflow:auto}.ctc-dialog--resized{flex-direction:column;display:flex}.ctc-dialog--resized .ctc-dialog__body{flex:1;min-height:0;max-height:none}.ctc-dialog__content{box-sizing:border-box;padding:var(--ctc-space-6)}.ctc-dialog__footer{border-top:1px solid var(--ctc-color-border-light);box-sizing:border-box;min-height:64px;padding:var(--ctc-space-4) var(--ctc-space-6);justify-content:flex-end;align-items:center;display:flex}.ctc-dialog__resize-handle{cursor:nwse-resize;touch-action:none;z-index:1;width:18px;height:18px;position:absolute;bottom:0;right:0}.ctc-dialog__resize-handle:before{background:linear-gradient(135deg, transparent 0 46%, var(--ctc-color-border) 47% 53%, transparent 54% 100%);content:"";position:absolute;inset:4px}.ctc-drawer{--el-drawer-bg-color:var(--ctc-color-surface);background:var(--ctc-color-surface);color:var(--ctc-color-text)}.ctc-drawer.is-fullscreen{width:100%;height:100%}.ctc-drawer__header{background:var(--ctc-color-surface);border-bottom:1px solid var(--ctc-color-border-light);box-sizing:border-box;color:var(--ctc-color-text);align-items:center;gap:var(--ctc-space-2);height:48px;padding:0 var(--ctc-space-6);margin:0;display:flex}.ctc-drawer__title{text-overflow:ellipsis;white-space:nowrap;flex:1;font-size:16px;font-weight:600;overflow:hidden}.ctc-drawer__header-content{flex:1;align-items:center;min-width:0;display:flex}.ctc-drawer__header-actions{align-items:center;gap:4px;display:inline-flex}.ctc-drawer__fullscreen-toggle,.ctc-drawer__close{border-radius:var(--ctc-radius-small);color:var(--ctc-color-text-secondary);cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;width:28px;height:28px;padding:0;font-size:18px;transition:background-color .2s,color .2s;display:inline-flex}.ctc-drawer__fullscreen-toggle:hover,.ctc-drawer__close:hover{background:var(--ctc-color-fill);color:var(--ctc-color-primary)}.ctc-drawer__fullscreen-toggle{font-size:16px}.ctc-drawer__close{font-size:22px;font-weight:300;line-height:1}.ctc-drawer__body{box-sizing:border-box;padding:0;overflow:hidden}.ctc-drawer__layout{flex-direction:column;height:100%;min-height:0;display:flex}.ctc-drawer__content{box-sizing:border-box;min-height:0;padding:var(--ctc-space-6);flex:1;overflow:auto}.ctc-drawer__footer{border-top:1px solid var(--ctc-color-border-light);box-sizing:border-box;min-height:64px;padding:var(--ctc-space-4) var(--ctc-space-6);flex-shrink:0;justify-content:flex-end;align-items:center;display:flex}.ctc-flex{box-sizing:border-box;display:flex}.ctc-table{--el-table-bg-color:var(--ctc-color-surface);--el-table-tr-bg-color:var(--ctc-color-surface);--el-table-header-bg-color:var(--ctc-color-fill-light);--el-table-border-color:var(--ctc-color-border-light);--el-table-row-hover-bg-color:var(--ctc-color-fill);--el-table-current-row-bg-color:var(--ctc-color-fill);--el-table-header-text-color:var(--ctc-color-text);--el-table-text-color:var(--ctc-color-text-secondary);background:var(--ctc-color-surface);color:var(--ctc-color-text)}.ctc-table .el-table{background:var(--ctc-color-surface)}.ctc-table .el-table__inner-wrapper:before{background-color:var(--ctc-color-border-light)}.ctc-table .el-table th.el-table__cell{background:var(--ctc-color-fill-light);color:var(--ctc-color-text);font-weight:600}.ctc-table .el-table td.el-table__cell,.ctc-table .el-table tr{background:var(--ctc-color-surface)}.ctc-table .el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell{background:var(--ctc-color-fill)}.ctc-table__pagination{border-top:1px solid var(--ctc-color-border-light);box-sizing:border-box;align-items:center;gap:var(--ctc-space-3);min-height:64px;padding:var(--ctc-space-4) var(--ctc-space-5);flex-wrap:wrap;justify-content:flex-end;display:flex}@media (width<=640px){.ctc-table__pagination{flex-direction:column;justify-content:center;align-items:flex-start}}
|
|
2
2
|
/*$vite$:1*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ctc-front/components-ui-next",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "CTC Vue 3 + Element Plus 团队组件库",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -22,24 +22,37 @@
|
|
|
22
22
|
"**/*.css",
|
|
23
23
|
"**/*.scss"
|
|
24
24
|
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"preinstall": "npx only-allow pnpm",
|
|
27
|
+
"dev": "vite",
|
|
28
|
+
"build": "vite build",
|
|
29
|
+
"type-check": "vue-tsc --noEmit -p tsconfig.app.json",
|
|
30
|
+
"lint": "eslint .",
|
|
31
|
+
"format": "prettier --write .",
|
|
32
|
+
"test": "vitest run",
|
|
33
|
+
"test:watch": "vitest",
|
|
34
|
+
"docs:dev": "vitepress dev docs",
|
|
35
|
+
"docs:build": "vitepress build docs"
|
|
36
|
+
},
|
|
25
37
|
"peerDependencies": {
|
|
26
38
|
"@element-plus/icons-vue": "^2.3.1",
|
|
27
39
|
"element-plus": "^2.14.1",
|
|
28
40
|
"vue": "^3.5.32"
|
|
29
41
|
},
|
|
30
42
|
"devDependencies": {
|
|
31
|
-
"@eslint/js": "^10.0.1",
|
|
32
43
|
"@element-plus/icons-vue": "^2.3.1",
|
|
44
|
+
"@eslint/js": "^10.0.1",
|
|
33
45
|
"@tsconfig/node24": "^24.0.4",
|
|
34
46
|
"@types/node": "^24.12.4",
|
|
35
47
|
"@vitejs/plugin-vue": "^6.0.6",
|
|
48
|
+
"@vitejs/plugin-vue-jsx": "^5.1.6",
|
|
36
49
|
"@vue/test-utils": "^2.4.6",
|
|
37
50
|
"@vue/tsconfig": "^0.9.1",
|
|
38
51
|
"element-plus": "^2.14.1",
|
|
39
52
|
"eslint": "^10.2.1",
|
|
40
53
|
"eslint-plugin-vue": "^10.8.0",
|
|
41
|
-
"jsdom": "^29.0.2",
|
|
42
54
|
"jiti": "^2.6.1",
|
|
55
|
+
"jsdom": "^29.0.2",
|
|
43
56
|
"prettier": "^3.6.2",
|
|
44
57
|
"sass-embedded": "^1.100.0",
|
|
45
58
|
"typescript": "~5.8.3",
|
|
@@ -56,16 +69,5 @@
|
|
|
56
69
|
"node": ">=22.0.0 <24.0.0",
|
|
57
70
|
"pnpm": ">=11.0.0"
|
|
58
71
|
},
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
"dev": "vite",
|
|
62
|
-
"build": "vite build",
|
|
63
|
-
"type-check": "vue-tsc --noEmit -p tsconfig.app.json",
|
|
64
|
-
"lint": "eslint .",
|
|
65
|
-
"format": "prettier --write .",
|
|
66
|
-
"test": "vitest run",
|
|
67
|
-
"test:watch": "vitest",
|
|
68
|
-
"docs:dev": "vitepress dev docs",
|
|
69
|
-
"docs:build": "vitepress build docs"
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
+
"packageManager": "pnpm@11.0.0"
|
|
73
|
+
}
|