@vaebe/ccui 2.0.0-beta.0
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/LICENSE +201 -0
- package/README.md +31 -0
- package/affix/ccui-cli.css +2 -0
- package/affix/index.es.js +132 -0
- package/affix/index.umd.js +1 -0
- package/alert/ccui-cli.css +2 -0
- package/alert/index.es.js +127 -0
- package/alert/index.umd.js +1 -0
- package/anchor/ccui-cli.css +2 -0
- package/anchor/index.es.js +160 -0
- package/anchor/index.umd.js +1 -0
- package/avatar/ccui-cli.css +2 -0
- package/avatar/index.es.js +235 -0
- package/avatar/index.umd.js +1 -0
- package/badge/ccui-cli.css +2 -0
- package/badge/index.es.js +146 -0
- package/badge/index.umd.js +1 -0
- package/breadcrumb/ccui-cli.css +2 -0
- package/breadcrumb/index.es.js +89 -0
- package/breadcrumb/index.umd.js +1 -0
- package/button/ccui-cli.css +2 -0
- package/button/index.es.js +1236 -0
- package/button/index.umd.js +1 -0
- package/button-3d/ccui-cli.css +2 -0
- package/button-3d/index.es.js +80 -0
- package/button-3d/index.umd.js +1 -0
- package/calendar/ccui-cli.css +2 -0
- package/calendar/index.es.js +450 -0
- package/calendar/index.umd.js +1 -0
- package/card/ccui-cli.css +2 -0
- package/card/index.es.js +78 -0
- package/card/index.umd.js +1 -0
- package/ccui-cli.css +2 -0
- package/check-box/ccui-cli.css +2 -0
- package/check-box/index.es.js +173 -0
- package/check-box/index.umd.js +1 -0
- package/collapse/ccui-cli.css +2 -0
- package/collapse/index.es.js +176 -0
- package/collapse/index.umd.js +1 -0
- package/config-provider/index.es.js +204 -0
- package/config-provider/index.umd.js +1 -0
- package/date-picker/ccui-cli.css +2 -0
- package/date-picker/index.es.js +2447 -0
- package/date-picker/index.umd.js +1 -0
- package/descriptions/ccui-cli.css +2 -0
- package/descriptions/index.es.js +175 -0
- package/descriptions/index.umd.js +1 -0
- package/divider/ccui-cli.css +2 -0
- package/divider/index.es.js +78 -0
- package/divider/index.umd.js +1 -0
- package/drawer/ccui-cli.css +2 -0
- package/drawer/index.es.js +1320 -0
- package/drawer/index.umd.js +1 -0
- package/dropdown/ccui-cli.css +2 -0
- package/dropdown/index.es.js +606 -0
- package/dropdown/index.umd.js +1 -0
- package/empty/ccui-cli.css +2 -0
- package/empty/index.es.js +173 -0
- package/empty/index.umd.js +1 -0
- package/flex/ccui-cli.css +2 -0
- package/flex/index.es.js +87 -0
- package/flex/index.umd.js +1 -0
- package/float-button/ccui-cli.css +2 -0
- package/float-button/index.es.js +169 -0
- package/float-button/index.umd.js +1 -0
- package/form/ccui-cli.css +2 -0
- package/form/index.es.js +752 -0
- package/form/index.umd.js +1 -0
- package/grid/ccui-cli.css +2 -0
- package/grid/index.es.js +207 -0
- package/grid/index.umd.js +1 -0
- package/icon/ccui-cli.css +2 -0
- package/icon/index.es.js +1228 -0
- package/icon/index.umd.js +1 -0
- package/image/ccui-cli.css +2 -0
- package/image/index.es.js +276 -0
- package/image/index.umd.js +1 -0
- package/index.d.ts +7 -0
- package/input/ccui-cli.css +2 -0
- package/input/index.es.js +1293 -0
- package/input/index.umd.js +1 -0
- package/input-number/ccui-cli.css +2 -0
- package/input-number/index.es.js +263 -0
- package/input-number/index.umd.js +1 -0
- package/layout/ccui-cli.css +2 -0
- package/layout/index.es.js +184 -0
- package/layout/index.umd.js +1 -0
- package/masonry/ccui-cli.css +2 -0
- package/masonry/index.es.js +119 -0
- package/masonry/index.umd.js +1 -0
- package/menu/ccui-cli.css +2 -0
- package/menu/index.es.js +385 -0
- package/menu/index.umd.js +1 -0
- package/message/ccui-cli.css +2 -0
- package/message/index.es.js +351 -0
- package/message/index.umd.js +1 -0
- package/modal/ccui-cli.css +2 -0
- package/modal/index.es.js +1553 -0
- package/modal/index.umd.js +1 -0
- package/notification/ccui-cli.css +2 -0
- package/notification/index.es.js +347 -0
- package/notification/index.umd.js +1 -0
- package/nuxt/components/category.js +2 -0
- package/nuxt/components/install.js +2 -0
- package/nuxt/components/status.js +2 -0
- package/nuxt/components/title.js +2 -0
- package/nuxt/index.js +13 -0
- package/package.json +53 -0
- package/pagination/ccui-cli.css +2 -0
- package/pagination/index.es.js +296 -0
- package/pagination/index.umd.js +1 -0
- package/popconfirm/ccui-cli.css +2 -0
- package/popconfirm/index.es.js +735 -0
- package/popconfirm/index.umd.js +1 -0
- package/popover/ccui-cli.css +2 -0
- package/popover/index.es.js +530 -0
- package/popover/index.umd.js +1 -0
- package/progress/ccui-cli.css +2 -0
- package/progress/index.es.js +167 -0
- package/progress/index.umd.js +1 -0
- package/radio/ccui-cli.css +2 -0
- package/radio/index.es.js +157 -0
- package/radio/index.umd.js +1 -0
- package/rate/ccui-cli.css +2 -0
- package/rate/index.es.js +115 -0
- package/rate/index.umd.js +1 -0
- package/result/ccui-cli.css +2 -0
- package/result/index.es.js +90 -0
- package/result/index.umd.js +1 -0
- package/segmented/ccui-cli.css +2 -0
- package/segmented/index.es.js +99 -0
- package/segmented/index.umd.js +1 -0
- package/select/ccui-cli.css +2 -0
- package/select/index.es.js +1885 -0
- package/select/index.umd.js +1 -0
- package/skeleton/ccui-cli.css +2 -0
- package/skeleton/index.es.js +117 -0
- package/skeleton/index.umd.js +1 -0
- package/slider/ccui-cli.css +2 -0
- package/slider/index.es.js +1071 -0
- package/slider/index.umd.js +1 -0
- package/space/ccui-cli.css +2 -0
- package/space/index.es.js +108 -0
- package/space/index.umd.js +1 -0
- package/spin/ccui-cli.css +2 -0
- package/spin/index.es.js +86 -0
- package/spin/index.umd.js +1 -0
- package/splitter/ccui-cli.css +2 -0
- package/splitter/index.es.js +198 -0
- package/splitter/index.umd.js +1 -0
- package/status/ccui-cli.css +2 -0
- package/status/index.es.js +44 -0
- package/status/index.umd.js +1 -0
- package/steps/ccui-cli.css +2 -0
- package/steps/index.es.js +118 -0
- package/steps/index.umd.js +1 -0
- package/switch/ccui-cli.css +2 -0
- package/switch/index.es.js +118 -0
- package/switch/index.umd.js +1 -0
- package/table/ccui-cli.css +2 -0
- package/table/index.es.js +553 -0
- package/table/index.umd.js +1 -0
- package/tabs/ccui-cli.css +2 -0
- package/tabs/index.es.js +128 -0
- package/tabs/index.umd.js +1 -0
- package/tag/ccui-cli.css +2 -0
- package/tag/index.es.js +116 -0
- package/tag/index.umd.js +1 -0
- package/theme/darkTheme.css +352 -0
- package/theme/theme.scss +703 -0
- package/timeline/ccui-cli.css +2 -0
- package/timeline/index.es.js +113 -0
- package/timeline/index.umd.js +1 -0
- package/tooltip/ccui-cli.css +2 -0
- package/tooltip/index.es.js +423 -0
- package/tooltip/index.umd.js +1 -0
- package/tree/ccui-cli.css +2 -0
- package/tree/index.es.js +810 -0
- package/tree/index.umd.js +1 -0
- package/typography/ccui-cli.css +2 -0
- package/typography/index.es.js +270 -0
- package/typography/index.umd.js +1 -0
- package/util/index.es.js +78 -0
- package/util/index.umd.js +1 -0
- package/vue-ccui.es.js +18989 -0
- package/vue-ccui.umd.js +1 -0
- package/watermark/ccui-cli.css +2 -0
- package/watermark/index.es.js +179 -0
- package/watermark/index.umd.js +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`)):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.index={},e.Vue))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});function n(e){if(!(e==null||e===``))return typeof e==`number`?`${e}px`:e}function r(e){let{name:r,viewBox:i=`0 0 1024 1024`,path:a}=e,o=Array.isArray(a)?a:[a],s=e=>{let r=n(e.size),a={display:`inline-flex`,lineHeight:0,verticalAlign:`-0.125em`};r&&(a.fontSize=r),e.color&&(a.color=e.color);let s=e.rotate;s!==void 0&&s!==``&&(a.transform=`rotate(${typeof s==`number`?`${s}deg`:s})`,a.transformOrigin=`center`);let c=typeof e.style==`string`?a:{...a,...e.style};return(0,t.h)(`span`,{class:[`ccui-icon`,e.spin&&`ccui-icon--spin`,e.class],style:c,"aria-hidden":`true`},(0,t.h)(`svg`,{viewBox:i,width:`1em`,height:`1em`,fill:`currentColor`},o.map(e=>(0,t.h)(`path`,{d:e}))))};return s.displayName=r,s.props=[`size`,`color`,`rotate`,`spin`,`class`,`style`],s}var i=r({name:`CaretRightOutlined`,path:`M384 192v640l384-320.064z`});function a(e,t,n){let r=e;return t&&(r+=`__${t}`),n&&(r+=`--${n}`),r}function o(e,t=!1){let n=t?`.ccui-${e}`:`ccui-${e}`;return{b:()=>a(n),e:e=>e?a(n,e):``,m:e=>e?a(n,``,e):``,em:(e,t)=>e&&t?a(n,e,t):``,is:e=>`is-${e}`}}function s(e,n){let r=(0,t.ref)(0),i=n.buffer??4,a=(0,t.computed)(()=>e.value.length*n.itemHeight),o=(0,t.computed)(()=>Math.min(n.maxHeight,a.value));return{scrollTop:r,onScroll:e=>{r.value=e.currentTarget.scrollTop},visible:(0,t.computed)(()=>{let t=e.value;if(t.length===0)return[];let a=Math.max(0,Math.floor(r.value/n.itemHeight)-i),s=Math.ceil(o.value/n.itemHeight)+i*2,c=Math.min(t.length,a+s),l=[];for(let e=a;e<c;e+=1)l.push({index:e,data:t[e],top:e*n.itemHeight});return l}),totalHeight:a,containerHeight:o,scrollToIndex:(e,t)=>{if(!t)return;let i=e*n.itemHeight;i<r.value?t.scrollTop=i:i+n.itemHeight>r.value+o.value&&(t.scrollTop=i-o.value+n.itemHeight)}}}function c(e,n,r){return(0,t.computed)(()=>{let{flatAll:t,byKey:i}=e.value;if(r.value)return{checked:new Set(n.value),halfChecked:new Set};let a=new Set,o=new Set,s=new Set(n.value),c=e=>{let t=i.get(e);return!!t&&!t.disableCheckbox&&!t.disabled};for(let e of t)if(s.has(e.key)){let t=[e];for(;t.length;){let e=t.pop();c(e.key)&&a.add(e.key);for(let n of e.childKeys){let e=i.get(n);e&&t.push(e)}}}for(let e=t.length-1;e>=0;--e){let n=t[e];if(!n.hasChildren)continue;let r=n.childKeys.map(e=>i.get(e)).filter(e=>!!e&&c(e.key));if(r.length===0)continue;let s=r.every(e=>a.has(e.key)),l=r.some(e=>a.has(e.key)||o.has(e.key));s?(c(n.key)&&a.add(n.key),o.delete(n.key)):l&&(o.add(n.key),a.delete(n.key))}return{checked:a,halfChecked:o}})}function l(e,t,n,r){let i=e.byKey.get(n);if(!i||i.disabled||i.disableCheckbox)return Array.from(t);let a=t.has(n),o=new Set(t);if(r)return a?o.delete(n):o.add(n),Array.from(o);let s=[],c=[n];for(;c.length;){let t=c.pop();s.push(t);let n=e.byKey.get(t);if(n)for(let e of n.childKeys)c.push(e)}if(a)for(let e of s)o.delete(e);else for(let t of s){let n=e.byKey.get(t);n&&!n.disabled&&!n.disableCheckbox&&o.add(t)}for(let t of[...i.parentKeys].reverse()){let n=e.byKey.get(t);if(!n)continue;let r=n.childKeys.map(t=>e.byKey.get(t)).filter(e=>!!e&&!e.disableCheckbox&&!e.disabled);r.length!==0&&(r.every(e=>o.has(e.key))?o.add(t):o.delete(t))}return Array.from(o)}var u={key:`key`,title:`title`,children:`children`,disabled:`disabled`,disableCheckbox:`disableCheckbox`,isLeaf:`isLeaf`,selectable:`selectable`};function d(e){return{...u,...e}}function f(e,t,n){return e[t.key]??`__auto_${n}`}function p(e,t){let n=e[t.children];return Array.isArray(n)?n:void 0}function m(e,t,n,r,i){let a=p(e,t),o=e[t.isLeaf],s=!!a&&a.length>0,c=o===void 0?!s&&!e.loadable:o,l=f(e,t,i);return{key:l,raw:e,title:e[t.title]??l,level:n,parentKeys:r,isLeaf:c,disabled:!!e[t.disabled],disableCheckbox:!!e[t.disableCheckbox],selectable:e[t.selectable]!==!1,hasChildren:s,childKeys:s?a.map((e,n)=>f(e,t,i*1e3+n)):[]}}function h(e){return e==null?``:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):``}function ee(e,n){return(0,t.computed)(()=>{let t=[],r=new Map,i=new Map,a=[],o=n.value,s=0,c=(e,n,l)=>{let u=[];for(let i of e){s+=1;let e=m(i,o,n,l,s);t.push(e),u.push(e),r.set(e.key,e);let a=p(i,o);a&&c(a,n+1,[...l,e.key])}l.length===0?a.push(...u.map(e=>e.key)):i.set(l[l.length-1],u)};return c(e.value,0,[]),{flatAll:t,byKey:r,childrenByKey:i,rootKeys:a}})}function te(e,n,r,i){return(0,t.computed)(()=>{let{flatAll:t}=e.value,a=n.value,o=r.value.trim(),s=i?.value,c=[],l=new Set;if(o||s){for(let e of t)if(s?s(e.raw,e.parentKeys):o.length>0&&h(e.title).toLowerCase().includes(o.toLowerCase())){l.add(e.key);for(let t of e.parentKeys)l.add(t)}}for(let e of t)l.size>0&&!l.has(e.key)||e.parentKeys.every(e=>a.has(e))&&c.push(e);return c})}function g(e){return new Set(e??[])}function _(e,n,r){let i=(0,t.ref)(g(n.value));return(0,t.watch)(e,e=>{e!==void 0&&(i.value=g(e))}),{current:(0,t.computed)(()=>e.value===void 0?i.value:g(e.value)),setKeys:t=>{e.value===void 0&&(i.value=g(t)),r(t)}}}function ne(e,n,r){let i=(0,t.computed)(()=>e.selectedKeys),a=(0,t.computed)(()=>e.defaultSelectedKeys??[]),o=(0,t.computed)(()=>e.checkedKeys),s=(0,t.computed)(()=>e.defaultCheckedKeys??[]),c=(0,t.computed)(()=>e.expandedKeys),l=(0,t.computed)(()=>e.expandedKeys?e.expandedKeys:n.value.length>0?n.value:e.defaultExpandedKeys??[]),u=_(i,a,e=>r(`update:selectedKeys`,e)),d=_(o,s,e=>r(`update:checkedKeys`,e)),f=_(c,l,e=>r(`update:expandedKeys`,e));return{selectedKeys:u.current,setSelectedKeys:u.setKeys,checkedKeys:d.current,setCheckedKeys:d.setKeys,expandedKeys:f.current,setExpandedKeys:f.setKeys}}var v={data:{type:Array,default:()=>[]},fieldNames:{type:Object,default:()=>({})},selectable:{type:Boolean,default:!0},multiple:{type:Boolean,default:!1},selectedKeys:{type:Array,default:void 0},defaultSelectedKeys:{type:Array,default:()=>[]},checkable:{type:Boolean,default:!1},checkedKeys:{type:Array,default:void 0},defaultCheckedKeys:{type:Array,default:()=>[]},checkStrictly:{type:Boolean,default:!1},expandedKeys:{type:Array,default:void 0},defaultExpandedKeys:{type:Array,default:()=>[]},defaultExpandAll:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loadData:{type:Function,default:void 0},draggable:{type:Boolean,default:!1},showLine:{type:Boolean,default:!1},blockNode:{type:Boolean,default:!1},expandAction:{type:[String,Boolean],default:`click`},searchValue:{type:String,default:``},filterTreeNode:{type:Function,default:void 0},indentSize:{type:Number,default:24},virtualScroll:{type:Boolean,default:!1},virtualItemHeight:{type:Number,default:32},virtualMaxHeight:{type:Number,default:320},focusedKey:{type:[String,Number],default:void 0},dragHoverExpandDelay:{type:Number,default:600},dragAutoScroll:{type:Boolean,default:!0},dragAutoScrollEdge:{type:Number,default:32},dragAutoScrollSpeed:{type:Number,default:12},classNames:{type:Object,default:void 0},styles:{type:Object,default:void 0}};function re(e){return e.filter(e=>e.hasChildren).map(e=>e.key)}function y(e){return e==null?``:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):``}function ie(e,n){let r=y(e);if(!n)return r;let i=r.toLowerCase(),a=n.toLowerCase(),o=i.indexOf(a);return o<0?r:(0,t.h)(`span`,null,[r.slice(0,o),(0,t.h)(`span`,{class:`ccui-tree__highlight`},r.slice(o,o+n.length)),r.slice(o+n.length)])}var b=(0,t.defineComponent)({name:`CTree`,props:v,emits:[`update:selectedKeys`,`update:checkedKeys`,`update:expandedKeys`,`update:focusedKey`,`select`,`check`,`expand`,`load`,`drop`,`dragstart`,`dragenter`,`dragover`,`dragleave`,`focus-change`,`load-error`],setup(e,{emit:n,expose:r,slots:a}){let u=o(`tree`),f=(0,t.computed)(()=>d(e.fieldNames)),p=(0,t.toRef)(e,`data`),m=(0,t.toRef)(e,`searchValue`),h=(0,t.computed)(()=>e.filterTreeNode),g=ee(p,f),_=(0,t.ref)([]);e.defaultExpandAll&&e.expandedKeys===void 0&&(e.defaultExpandedKeys??[]).length===0&&(_.value=re(g.value.flatAll));let{selectedKeys:v,setSelectedKeys:y,checkedKeys:b,setCheckedKeys:ae,expandedKeys:x,setExpandedKeys:oe}=ne(e,_,n),S=c(g,b,(0,t.computed)(()=>e.checkStrictly)),C=te(g,x,m,h),w=(0,t.ref)(new Set),T=(0,t.ref)(new Set),E=(0,t.ref)(new Set),D=(0,t.shallowRef)(null),O=(0,t.shallowRef)(null),k=(0,t.shallowRef)(null),A=(0,t.shallowRef)(null),j=(0,t.shallowRef)(null),M=(0,t.shallowRef)(0),N=(0,t.ref)(e.focusedKey),P=(0,t.computed)(()=>e.focusedKey===void 0?N.value:e.focusedKey),F=t=>{e.focusedKey===void 0&&(N.value=t),n(`update:focusedKey`,t),n(`focus-change`,t)},I=(0,t.ref)(null),L=(0,t.ref)(null),R=(0,t.computed)(()=>{let e=new Map;return C.value.forEach((t,n)=>e.set(t.key,n)),e}),z=(0,t.computed)(()=>e.virtualScroll&&C.value.length>0),B=s(C,{itemHeight:e.virtualItemHeight,maxHeight:e.virtualMaxHeight}),V=async(t,r)=>{if(e.loadData){E.value.delete(t.key),E.value=new Set(E.value),w.value.add(t.key),w.value=new Set(w.value);try{await e.loadData(t.raw),T.value.add(t.key),T.value=new Set(T.value),n(`load`,Array.from(T.value),{event:r,node:t})}catch(e){E.value.add(t.key),E.value=new Set(E.value),n(`load-error`,{error:e,node:t})}finally{w.value.delete(t.key),w.value=new Set(w.value)}}},H=async(t,r)=>{if(e.disabled)return;let i=x.value.has(t.key),a=new Set(x.value);i?a.delete(t.key):(a.add(t.key),e.loadData&&!t.hasChildren&&!t.isLeaf&&!T.value.has(t.key)&&await V(t,r));let o=Array.from(a);oe(o),n(`expand`,o,{expanded:!i,node:t})},U=async t=>{let n=g.value.byKey.get(t);!n||!e.loadData||await V(n)},W=(t,r)=>{if(e.disabled||!e.selectable||!t.selectable||t.disabled)return;let i=v.value.has(t.key),a;a=e.multiple?i?Array.from(v.value).filter(e=>e!==t.key):[...v.value,t.key]:i?[]:[t.key],y(a),n(`select`,a,{selectedKeys:a,selected:!i,node:t,event:r})},G=(t,r)=>{if(e.disabled||!e.checkable||t.disableCheckbox||t.disabled)return;let i=S.value.checked.has(t.key),a=e.checkStrictly?b.value:S.value.checked,o=l(g.value,a,t.key,e.checkStrictly);ae(o),n(`check`,o,{checkedKeys:o,halfCheckedKeys:Array.from(S.value.halfChecked),checked:!i,node:t,event:r})},se=(t,r)=>{if(!e.draggable||r.disabled){t.preventDefault();return}O.value=r.key,t.dataTransfer?.setData(`text/plain`,String(r.key)),n(`dragstart`,{event:t,node:r})},K=(e,t)=>{let n=t.getBoundingClientRect();if(!n.height)return`inside`;let r=(e.clientY-n.top)/n.height;return r<.25?`before`:r>.75?`after`:`inside`},q=()=>{k.value&&=(clearTimeout(k.value),null),A.value=null},ce=(t,n)=>{!e.dragHoverExpandDelay||e.dragHoverExpandDelay<=0||!t.hasChildren&&(!e.loadData||t.isLeaf)||x.value.has(t.key)||A.value!==t.key&&(q(),A.value=t.key,k.value=setTimeout(()=>{O.value!==null&&A.value===t.key&&H(t,n),k.value=null},e.dragHoverExpandDelay))},J=()=>{M.value=0,j.value!==null&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(j.value),j.value=null},Y=()=>{let e=L.value;if(!e||M.value===0){j.value=null;return}e.scrollTop+=M.value,typeof requestAnimationFrame==`function`?j.value=requestAnimationFrame(Y):j.value=null},le=t=>{if(!e.dragAutoScroll)return;let n=L.value;if(!n)return;let r=n.getBoundingClientRect(),i=e.dragAutoScrollEdge,a=e.dragAutoScrollSpeed,o=t.clientY-r.top,s=r.bottom-t.clientY,c=0;o<i&&o>0?c=-a:s<i&&s>0&&(c=a);let l=M.value===0;M.value=c,c!==0&&l&&typeof requestAnimationFrame==`function`?j.value=requestAnimationFrame(Y):c===0&&J()},ue=(t,r)=>{if(!e.draggable||O.value===null)return;t.preventDefault();let i=K(t,t.currentTarget);D.value={key:r.key,position:i},i===`inside`?ce(r,t):A.value!==null&&q(),le(t),n(`dragover`,{event:t,node:r})},de=(t,r)=>{e.draggable&&n(`dragenter`,{event:t,node:r})},fe=(t,r)=>{e.draggable&&(A.value===r.key&&q(),n(`dragleave`,{event:t,node:r}))},pe=(t,r)=>{if(!e.draggable||O.value===null)return;t.preventDefault(),q(),J();let i=g.value.byKey.get(O.value);if(!i||i.key===r.key){O.value=null,D.value=null;return}n(`drop`,{event:t,node:r,dragNode:i,dropPosition:D.value?.key===r.key?D.value.position:`inside`}),O.value=null,D.value=null},me=n=>{if(a.switcher)return a.switcher({expanded:x.value.has(n.key),node:n,loading:w.value.has(n.key),loadFailed:E.value.has(n.key)});let r=x.value.has(n.key),o=w.value.has(n.key),s=E.value.has(n.key);return o?(0,t.h)(`span`,{class:u.e(`switcher-loading`)},`○`):s?(0,t.h)(`span`,{class:u.e(`switcher-error`),role:`button`,title:`Click to retry`,onClick:e=>{e.stopPropagation(),U(n.key)}},`!`):n.isLeaf&&!n.hasChildren?(0,t.h)(`span`,{class:u.e(`switcher-leaf`)}):(0,t.h)(`span`,{class:[u.e(`switcher`),r&&u.em(`switcher`,`open`),e.classNames?.switcher],style:e.styles?.switcher},(0,t.h)(i,{size:12}))},he=n=>{if(!e.checkable)return null;let r=S.value.checked.has(n.key),i=S.value.halfChecked.has(n.key);return(0,t.h)(`span`,{class:[u.e(`checkbox`),r&&u.em(`checkbox`,`checked`),i&&u.em(`checkbox`,`indeterminate`),(n.disabled||n.disableCheckbox)&&u.em(`checkbox`,`disabled`)],role:`checkbox`,"aria-checked":i?`mixed`:r,onClick:e=>{e.stopPropagation(),G(n,e)}},r?`✓`:i?`–`:``)},ge=e=>a.title?a.title({node:e,data:e.raw,expanded:x.value.has(e.key)}):ie(e.title,m.value),_e=e=>a.icon?(0,t.h)(`span`,{class:u.e(`icon`)},a.icon({node:e,expanded:x.value.has(e.key)})):e.raw.icon?(0,t.h)(`span`,{class:u.e(`icon`)},e.raw.icon):null,ve=n=>{if(!e.showLine||n.level===0)return null;let r=[];for(let i=0;i<n.level;i+=1)a.connector?r.push((0,t.h)(`span`,{key:`guide-${i}`,class:u.e(`guide`),style:{left:`${i*e.indentSize+e.indentSize/2}px`}},a.connector({depth:i,node:n}))):r.push((0,t.h)(`span`,{key:`guide-${i}`,class:u.e(`guide`),style:{left:`${i*e.indentSize+e.indentSize/2}px`}}));return r},ye=()=>{q(),J(),O.value=null,D.value=null},X=(n,r)=>{let i={paddingLeft:`${e.indentSize*n.level}px`,...r},a=v.value.has(n.key),o=P.value===n.key,s=D.value?.key===n.key,c=s?D.value.position:null,l=A.value===n.key;return(0,t.h)(`div`,{key:n.key,class:[u.e(`node`),a&&u.em(`node`,`selected`),o&&u.em(`node`,`focused`),n.disabled&&u.em(`node`,`disabled`),s&&c===`inside`&&u.em(`node`,`drop-inside`),s&&c===`before`&&u.em(`node`,`drop-before`),s&&c===`after`&&u.em(`node`,`drop-after`),e.blockNode&&u.em(`node`,`block`),l&&u.em(`node`,`hover-expand`),e.classNames?.node],role:`treeitem`,tabindex:o?0:-1,"aria-selected":a,"aria-expanded":n.hasChildren?x.value.has(n.key):void 0,"aria-disabled":n.disabled||void 0,"data-key":n.key,style:[i,e.styles?.node],draggable:e.draggable&&!n.disabled?!0:void 0,onDragstart:e=>se(e,n),onDragover:e=>ue(e,n),onDragenter:e=>de(e,n),onDragleave:e=>fe(e,n),onDrop:e=>pe(e,n),onDragend:ye,onFocus:()=>{P.value!==n.key&&F(n.key)}},[...ve(n)||[],(0,t.h)(`span`,{class:u.e(`switcher-wrap`),onClick:t=>{t.stopPropagation(),(n.hasChildren||e.loadData&&!n.isLeaf)&&H(n,t)}},me(n)),he(n),(0,t.h)(`span`,{class:[u.e(`content`),e.classNames?.label],style:e.styles?.label,onClick:t=>{W(n,t),e.expandAction===`click`&&!e.disabled&&!n.disabled&&(n.hasChildren||e.loadData&&!n.isLeaf)&&H(n,t)}},[_e(n),(0,t.h)(`span`,{class:u.e(`title`)},ge(n))])])},Z=e=>{let t=C.value;if(t.length===0)return;let n=P.value,r=n===void 0?-1:R.value.get(n)??-1,i=Math.max(0,Math.min(t.length-1,r+e));if(r===i&&n!==void 0)return;let a=t[i].key;F(a)},Q=e=>{let t=C.value;t.length!==0&&F(t[e===1?t.length-1:0].key)},$=t=>{if(e.disabled)return;let n=C.value;if(n.length===0)return;let r=P.value??n[0].key,i=R.value.get(r)??0,a=n[i];switch(t.key){case`ArrowDown`:t.preventDefault(),Z(1);break;case`ArrowUp`:t.preventDefault(),Z(-1);break;case`ArrowRight`:if(t.preventDefault(),a.hasChildren&&!x.value.has(a.key))H(a,t);else if(a.hasChildren){let e=n[i+1];e&&e.parentKeys.includes(a.key)&&F(e.key)}else e.loadData&&!a.isLeaf&&!T.value.has(a.key)&&H(a,t);break;case`ArrowLeft`:if(t.preventDefault(),a.hasChildren&&x.value.has(a.key))H(a,t);else if(a.parentKeys.length>0){let e=a.parentKeys[a.parentKeys.length-1];F(e)}break;case`Home`:t.preventDefault(),Q(-1);break;case`End`:t.preventDefault(),Q(1);break;case`Enter`:case` `:{t.preventDefault();let n=new MouseEvent(`click`);e.checkable?G(a,n):W(a,n);break}}},be=e=>typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/(["\\])/g,`\\$1`),xe=()=>{let e=P.value;if(e===void 0)return;let t=R.value.get(e);t!==void 0&&(z.value?B.scrollToIndex(t,L.value):I.value&&I.value.querySelector(`[data-key="${be(String(e))}"]`)?.focus({preventScroll:!1}))};return(0,t.watch)(P,()=>{(0,t.nextTick)(xe)}),(0,t.onUnmounted)(()=>{q(),J()}),r({retryLoad:U,isNodeLoading:e=>w.value.has(e),hasLoadError:e=>E.value.has(e)}),()=>{let n=[u.b(),e.disabled&&u.m(`disabled`),e.showLine&&u.m(`show-line`),e.draggable&&u.m(`draggable`),e.classNames?.root],r=e.styles?.root;if(C.value.length===0)return(0,t.h)(`div`,{ref:I,class:n,style:r,role:`tree`,onKeydown:$},(0,t.h)(`div`,{class:u.e(`empty`)},`No data`));if(z.value){let i=B.visible.value.map(({data:t,top:n})=>X(t,{position:`absolute`,top:`${n}px`,left:0,right:0,height:`${e.virtualItemHeight}px`}));return(0,t.h)(`div`,{ref:I,class:n,style:r,role:`tree`,onKeydown:$},(0,t.h)(`div`,{ref:L,class:u.e(`virtual`),style:{height:`${B.containerHeight.value}px`,overflow:`auto`,position:`relative`},onScroll:B.onScroll},(0,t.h)(`div`,{style:{height:`${B.totalHeight.value}px`,position:`relative`}},i)))}return(0,t.h)(`div`,{ref:I,class:n,style:r,role:`tree`,onKeydown:$,tabindex:P.value===void 0?0:-1},C.value.map(e=>X(e)))}}});b.install=function(e){e.component(b.name,b)},e.Tree=b,e.default={title:`Tree 树`,category:`数据展示`,status:`100%`,install(e){e.component(b.name,b)}}});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
:root{--ccui-global-bg:#f5f5f5;--ccui-global-bg-normal:#fff;--ccui-base-bg:#fff;--ccui-base-bg-dark:#000000d9;--ccui-brand:#1677ff;--ccui-brand-foil:#e6f4ff;--ccui-brand-hover:#4096ff;--ccui-brand-active:#0958d9;--ccui-brand-active-focus:#003eb3;--ccui-contrast:#ff4d4f;--ccui-text:#000000e0;--ccui-text-weak:#000000a6;--ccui-aide-text:#00000073;--ccui-aide-text-stress:#000000a6;--ccui-placeholder:#00000040;--ccui-light-text:#fff;--ccui-dark-text:#000000e0;--ccui-link:#1677ff;--ccui-link-active:#0958d9;--ccui-link-light:#4096ff;--ccui-link-light-active:#69b1ff;--ccui-line:#d9d9d9;--ccui-dividing-line:#f0f0f0;--ccui-block:#fff;--ccui-area:#fafafa;--ccui-danger:#ff4d4f;--ccui-warning:#faad14;--ccui-waiting:#00000073;--ccui-success:#52c41a;--ccui-info:#1677ff;--ccui-initial:#e6f4ff;--ccui-unavailable:#f5f5f5;--ccui-shadow:#00000026;--ccui-light-shadow:#0000000f;--ccui-icon-text:#000000e0;--ccui-icon-bg:#fff;--ccui-icon-fill:#00000073;--ccui-icon-fill-hover:#000000a6;--ccui-icon-fill-active:#1677ff;--ccui-icon-fill-active-hover:#4096ff;--ccui-form-control-line:#d9d9d9;--ccui-form-control-line-hover:#4096ff;--ccui-form-control-line-active:#1677ff;--ccui-form-control-line-active-hover:#0958d9;--ccui-list-item-active-bg:#1677ff;--ccui-list-item-active-text:#fff;--ccui-list-item-active-hover-bg:#4096ff;--ccui-list-item-hover-bg:#0000000a;--ccui-list-item-hover-text:#1677ff;--ccui-list-item-selected-bg:#e6f4ff;--ccui-list-item-strip-bg:#fafafa;--ccui-disabled-bg:#0000000a;--ccui-disabled-line:#d9d9d9;--ccui-disabled-text:#00000040;--ccui-primary-disabled:#91caff;--ccui-icon-fill-active-disabled:#91caff;--ccui-label-bg:#fafafa;--ccui-connected-overlay-bg:#fff;--ccui-connected-overlay-line:#1677ff;--ccui-fullscreen-overlay-bg:#fff;--ccui-feedback-overlay-bg:#000000d9;--ccui-feedback-overlay-text:#fff;--ccui-embed-search-bg:#fafafa;--ccui-embed-search-bg-hover:#f0f0f0;--ccui-float-block-shadow:#1677ff29;--ccui-highlight-overlay:#fffc;--ccui-range-item-hover-bg:#e6f4ff;--ccui-primary:#1677ff;--ccui-primary-hover:#4096ff;--ccui-primary-active:#0958d9;--ccui-contrast-hover:#ff7875;--ccui-contrast-active:#d9363e;--ccui-secondary:#000000a6;--ccui-danger-line:#ffccc7;--ccui-danger-bg:#fff2f0;--ccui-warning-line:#ffe58f;--ccui-warning-bg:#fffbe6;--ccui-info-line:#91caff;--ccui-info-bg:#e6f4ff;--ccui-success-line:#b7eb8f;--ccui-success-bg:#f6ffed;--ccui-primary-line:#91caff;--ccui-primary-bg:#e6f4ff;--ccui-default-line:#d9d9d9;--ccui-default-bg:#fff;--ccui-font-size:14px;--ccui-font-size-card-title:16px;--ccui-font-size-page-title:20px;--ccui-font-size-modal-title:16px;--ccui-font-size-price:24px;--ccui-font-size-data-overview:30px;--ccui-font-size-icon:16px;--ccui-font-size-sm:12px;--ccui-font-size-md:14px;--ccui-font-size-lg:16px;--ccui-font-title-weight:600;--ccui-font-content-weight:400;--ccui-line-height-base:1.57143;--ccui-border-radius:6px;--ccui-border-radius-feedback:8px;--ccui-border-radius-card:8px;--ccui-shadow-length-base:0 1px 2px 0;--ccui-shadow-length-slide-left:-6px 0 16px 0;--ccui-shadow-length-slide-right:6px 0 16px 0;--ccui-shadow-length-connected-overlay:0 6px 16px 0;--ccui-shadow-length-hover:0 6px 16px 0;--ccui-shadow-length-feedback-overlay:0 6px 16px 0;--ccui-shadow-fullscreen-overlay:0 6px 16px 0;--ccui-animation-duration-slow:.3s;--ccui-animation-duration-base:.2s;--ccui-animation-duration-fast:.1s;--ccui-animation-ease-in:cubic-bezier(.7, 0, .84, 0);--ccui-animation-ease-out:cubic-bezier(.215, .61, .355, 1);--ccui-animation-ease-in-out:cubic-bezier(.78, .14, .15, .86);--ccui-animation-ease-in-smooth:cubic-bezier(.645, .045, .355, 1);--ccui-animation-linear:cubic-bezier(0, 0, 1, 1);--ccui-z-index-full-page-overlay:1080;--ccui-z-index-pop-up:1060;--ccui-z-index-dropdown:1052;--ccui-z-index-modal:1050;--ccui-z-index-drawer:1040;--ccui-z-index-framework:1000;--ccui-size-sm:24px;--ccui-size-md:32px;--ccui-size-lg:40px;--ccui-color-primary:#1677ff;--ccui-color-primary-hover:#4096ff;--ccui-color-primary-active:#0958d9;--ccui-color-primary-bg:#e6f4ff;--ccui-color-primary-bg-hover:#bae0ff;--ccui-color-primary-border:#91caff;--ccui-color-primary-border-hover:#69b1ff;--ccui-color-success:#52c41a;--ccui-color-success-hover:#73d13d;--ccui-color-success-active:#389e0d;--ccui-color-success-bg:#f6ffed;--ccui-color-success-border:#b7eb8f;--ccui-color-warning:#faad14;--ccui-color-warning-hover:#ffc53d;--ccui-color-warning-active:#d48806;--ccui-color-warning-bg:#fffbe6;--ccui-color-warning-border:#ffe58f;--ccui-color-error:#ff4d4f;--ccui-color-error-hover:#ff7875;--ccui-color-error-active:#d9363e;--ccui-color-error-bg:#fff2f0;--ccui-color-error-border:#ffccc7;--ccui-color-info:#1677ff;--ccui-color-info-hover:#4096ff;--ccui-color-info-bg:#e6f4ff;--ccui-color-info-border:#91caff;--ccui-color-text:#000000e0;--ccui-color-text-secondary:#000000a6;--ccui-color-text-tertiary:#00000073;--ccui-color-text-quaternary:#00000040;--ccui-color-text-disabled:#00000040;--ccui-color-text-placeholder:#00000040;--ccui-color-text-heading:#000000e0;--ccui-color-text-light-solid:#fff;--ccui-color-bg-base:#fff;--ccui-color-bg-container:#fff;--ccui-color-bg-elevated:#fff;--ccui-color-bg-layout:#f5f5f5;--ccui-color-bg-spotlight:#000000d9;--ccui-color-bg-mask:#00000073;--ccui-color-bg-text-hover:#0000000f;--ccui-color-bg-text-active:#00000026;--ccui-color-border:#d9d9d9;--ccui-color-border-secondary:#f0f0f0;--ccui-color-border-disabled:#0000000a;--ccui-color-split:#0505050f;--ccui-color-fill:#00000026;--ccui-color-fill-secondary:#0000000f;--ccui-color-fill-tertiary:#0000000a;--ccui-color-fill-quaternary:#00000005;--ccui-control-outline:#0591ff1a;--ccui-control-outline-error:#ff26050f;--ccui-control-outline-warning:#ffd7051a;--ccui-red-1:#fff1f0;--ccui-red-2:#ffccc7;--ccui-red-3:#ffa39e;--ccui-red-4:#ff7875;--ccui-red-5:#ff4d4f;--ccui-red-6:#f5222d;--ccui-red-7:#cf1322;--ccui-red-8:#a8071a;--ccui-red-9:#820014;--ccui-red-10:#5c0011;--ccui-volcano-1:#fff2e8;--ccui-volcano-2:#ffd8bf;--ccui-volcano-3:#ffbb96;--ccui-volcano-4:#ff9c6e;--ccui-volcano-5:#ff7a45;--ccui-volcano-6:#fa541c;--ccui-volcano-7:#d4380d;--ccui-volcano-8:#ad2102;--ccui-volcano-9:#871400;--ccui-volcano-10:#610b00;--ccui-orange-1:#fff7e6;--ccui-orange-2:#ffe7ba;--ccui-orange-3:#ffd591;--ccui-orange-4:#ffc069;--ccui-orange-5:#ffa940;--ccui-orange-6:#fa8c16;--ccui-orange-7:#d46b08;--ccui-orange-8:#ad4e00;--ccui-orange-9:#873800;--ccui-orange-10:#612500;--ccui-gold-1:#fffbe6;--ccui-gold-2:#fff1b8;--ccui-gold-3:#ffe58f;--ccui-gold-4:#ffd666;--ccui-gold-5:#ffc53d;--ccui-gold-6:#faad14;--ccui-gold-7:#d48806;--ccui-gold-8:#ad6800;--ccui-gold-9:#874d00;--ccui-gold-10:#613400;--ccui-yellow-1:#feffe6;--ccui-yellow-2:#ffffb8;--ccui-yellow-3:#fffb8f;--ccui-yellow-4:#fff566;--ccui-yellow-5:#ffec3d;--ccui-yellow-6:#fadb14;--ccui-yellow-7:#d4b106;--ccui-yellow-8:#ad8b00;--ccui-yellow-9:#876800;--ccui-yellow-10:#614700;--ccui-lime-1:#fcffe6;--ccui-lime-2:#f4ffb8;--ccui-lime-3:#eaff8f;--ccui-lime-4:#d3f261;--ccui-lime-5:#bae637;--ccui-lime-6:#a0d911;--ccui-lime-7:#7cb305;--ccui-lime-8:#5b8c00;--ccui-lime-9:#3f6600;--ccui-lime-10:#254000;--ccui-green-1:#f6ffed;--ccui-green-2:#d9f7be;--ccui-green-3:#b7eb8f;--ccui-green-4:#95de64;--ccui-green-5:#73d13d;--ccui-green-6:#52c41a;--ccui-green-7:#389e0d;--ccui-green-8:#237804;--ccui-green-9:#135200;--ccui-green-10:#092b00;--ccui-cyan-1:#e6fffb;--ccui-cyan-2:#b5f5ec;--ccui-cyan-3:#87e8de;--ccui-cyan-4:#5cdbd3;--ccui-cyan-5:#36cfc9;--ccui-cyan-6:#13c2c2;--ccui-cyan-7:#08979c;--ccui-cyan-8:#006d75;--ccui-cyan-9:#00474f;--ccui-cyan-10:#002329;--ccui-blue-1:#e6f4ff;--ccui-blue-2:#bae0ff;--ccui-blue-3:#91caff;--ccui-blue-4:#69b1ff;--ccui-blue-5:#4096ff;--ccui-blue-6:#1677ff;--ccui-blue-7:#0958d9;--ccui-blue-8:#003eb3;--ccui-blue-9:#002c8c;--ccui-blue-10:#001d66;--ccui-geekblue-1:#f0f5ff;--ccui-geekblue-2:#d6e4ff;--ccui-geekblue-3:#adc6ff;--ccui-geekblue-4:#85a5ff;--ccui-geekblue-5:#597ef7;--ccui-geekblue-6:#2f54eb;--ccui-geekblue-7:#1d39c4;--ccui-geekblue-8:#10239e;--ccui-geekblue-9:#061178;--ccui-geekblue-10:#030852;--ccui-purple-1:#f9f0ff;--ccui-purple-2:#efdbff;--ccui-purple-3:#d3adf7;--ccui-purple-4:#b37feb;--ccui-purple-5:#9254de;--ccui-purple-6:#722ed1;--ccui-purple-7:#531dab;--ccui-purple-8:#391085;--ccui-purple-9:#22075e;--ccui-purple-10:#120338;--ccui-magenta-1:#fff0f6;--ccui-magenta-2:#ffd6e7;--ccui-magenta-3:#ffadd2;--ccui-magenta-4:#ff85c0;--ccui-magenta-5:#f759ab;--ccui-magenta-6:#eb2f96;--ccui-magenta-7:#c41d7f;--ccui-magenta-8:#9e1068;--ccui-magenta-9:#780650;--ccui-magenta-10:#520339;--ccui-pink-1:#fff0f6;--ccui-pink-6:#eb2f96;--ccui-border-radius-lg:8px;--ccui-border-radius-sm:4px;--ccui-border-radius-xs:2px;--ccui-border-radius-outer:4px;--ccui-font-size-xl:20px;--ccui-font-size-heading-1:38px;--ccui-font-size-heading-2:30px;--ccui-font-size-heading-3:24px;--ccui-font-size-heading-4:20px;--ccui-font-size-heading-5:16px;--ccui-line-height-lg:1.5;--ccui-line-height-sm:1.66;--ccui-line-height-heading-1:1.21052;--ccui-line-height-heading-2:1.26666;--ccui-line-height-heading-3:1.33333;--ccui-line-height-heading-4:1.4;--ccui-line-height-heading-5:1.5;--ccui-font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--ccui-font-family-code:SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;--ccui-control-height:32px;--ccui-control-height-sm:24px;--ccui-control-height-lg:40px;--ccui-control-height-xs:16px;--ccui-box-shadow:0 6px 16px 0 #00000014, 0 3px 6px -4px #0000001f, 0 9px 28px 8px #0000000d;--ccui-box-shadow-secondary:0 6px 16px 0 #00000014, 0 3px 6px -4px #0000001f, 0 9px 28px 8px #0000000d;--ccui-box-shadow-tertiary:0 1px 2px 0 #00000008, 0 1px 6px -1px #00000005, 0 2px 4px 0 #00000005;--ccui-motion-duration-slow:.3s;--ccui-motion-duration-mid:.2s;--ccui-motion-duration-fast:.1s;--ccui-motion-ease-in-out:cubic-bezier(.645, .045, .355, 1);--ccui-motion-ease-out:cubic-bezier(.215, .61, .355, 1);--ccui-motion-ease-in:cubic-bezier(.55, .055, .675, .19);--ccui-motion-ease-out-back:cubic-bezier(.12, .4, .29, 1.46);--ccui-motion-ease-in-back:cubic-bezier(.71, -.46, .88, .6);--ccui-motion-ease-out-circ:cubic-bezier(.08, .82, .17, 1);--ccui-motion-ease-in-out-circ:cubic-bezier(.78, .14, .15, .86);--ccui-padding-xxs:4px;--ccui-padding-xs:8px;--ccui-padding-sm:12px;--ccui-padding:16px;--ccui-padding-md:20px;--ccui-padding-lg:24px;--ccui-padding-xl:32px;--ccui-margin-xxs:4px;--ccui-margin-xs:8px;--ccui-margin-sm:12px;--ccui-margin:16px;--ccui-margin-md:20px;--ccui-margin-lg:24px;--ccui-margin-xl:32px}.ccui-typography{color:var(--ccui-color-text,#000000e0);word-break:break-word;font-size:var(--ccui-font-size,14px);line-height:var(--ccui-line-height-base,1.57143)}.ccui-typography--secondary{color:var(--ccui-color-text-secondary,#000000a6)}.ccui-typography--success{color:var(--ccui-color-success,#52c41a)}.ccui-typography--warning{color:var(--ccui-color-warning,#faad14)}.ccui-typography--danger{color:var(--ccui-color-error,#ff4d4f)}.ccui-typography--disabled{color:var(--ccui-color-text-disabled,#00000040);cursor:not-allowed;-webkit-user-select:none;user-select:none}.ccui-typography--text{font-size:inherit}.ccui-typography--paragraph{margin-bottom:1em}.ccui-typography--title{color:var(--ccui-color-text-heading,#000000e0);margin-top:1.2em;margin-bottom:.5em;font-weight:600}.ccui-typography--title-1{font-size:var(--ccui-font-size-heading-1,38px);line-height:var(--ccui-line-height-heading-1,1.21052);margin-top:0}.ccui-typography--title-2{font-size:var(--ccui-font-size-heading-2,30px);line-height:var(--ccui-line-height-heading-2,1.26666)}.ccui-typography--title-3{font-size:var(--ccui-font-size-heading-3,24px);line-height:var(--ccui-line-height-heading-3,1.33333)}.ccui-typography--title-4{font-size:var(--ccui-font-size-heading-4,20px);line-height:var(--ccui-line-height-heading-4,1.4)}.ccui-typography--title-5{font-size:var(--ccui-font-size-heading-5,16px);line-height:var(--ccui-line-height-heading-5,1.5)}.ccui-typography--link{color:var(--ccui-color-primary,#1677ff);cursor:pointer;transition:color var(--ccui-motion-duration-mid,.2s);text-decoration:none}.ccui-typography--link:hover{color:var(--ccui-color-primary-hover,#4096ff);text-decoration:underline}.ccui-typography--link:active{color:var(--ccui-color-primary-active,#0958d9)}.ccui-typography code{border-radius:var(--ccui-border-radius-sm,4px);font-size:85%;font-family:var(--ccui-font-family-code,SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace);background:#9696961a;border:1px solid #64646433;margin:0 .2em;padding:.2em .4em}.ccui-typography kbd{border-radius:var(--ccui-border-radius-sm,4px);font-size:90%;font-family:var(--ccui-font-family-code,SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace);background:#9696960f;border:1px solid #64646433;border-bottom-width:2px;margin:0 .2em;padding:.15em .4em .1em}.ccui-typography mark{background-color:#ffe58f;padding:0}.ccui-typography__copy,.ccui-typography__edit{color:var(--ccui-color-primary,#1677ff);cursor:pointer;transition:color var(--ccui-motion-duration-mid,.2s);margin-inline-start:4px;font-size:.9em}.ccui-typography__copy:hover,.ccui-typography__edit:hover{color:var(--ccui-color-primary-hover,#4096ff)}.ccui-typography__copy.is-copied{color:var(--ccui-color-success,#52c41a);cursor:default}.ccui-typography__expand,.ccui-typography__collapse{color:var(--ccui-color-primary,#1677ff);cursor:pointer;margin-inline-start:4px}.ccui-typography__expand:hover,.ccui-typography__collapse:hover{color:var(--ccui-color-primary-hover,#4096ff)}.ccui-typography__edit-input{width:100%;min-width:200px;font:inherit;color:inherit;background:var(--ccui-color-bg-elevated,#fff);border:1px solid var(--ccui-color-border,#d9d9d9);border-radius:var(--ccui-border-radius-sm,4px);resize:vertical;transition:border-color var(--ccui-motion-duration-mid,.2s);outline:none;padding:4px 8px;display:inline-block}.ccui-typography__edit-input:focus{border-color:var(--ccui-color-primary,#1677ff)}.ccui-typography--ellipsis{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.ccui-typography--ellipsis-2,.ccui-typography--ellipsis-3,.ccui-typography--ellipsis-4,.ccui-typography--ellipsis-5,.ccui-typography--ellipsis-6{white-space:normal;text-overflow:ellipsis;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.ccui-typography--ellipsis-2{-webkit-line-clamp:2}.ccui-typography--ellipsis-3{-webkit-line-clamp:3}.ccui-typography--ellipsis-4{-webkit-line-clamp:4}.ccui-typography--ellipsis-5{-webkit-line-clamp:5}.ccui-typography--ellipsis-6{-webkit-line-clamp:6}
|
|
2
|
+
/*$vite$:1*/
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { computed as e, createTextVNode as t, createVNode as n, defineComponent as r, h as i, nextTick as a, onBeforeUnmount as o, ref as s, watch as c } from "vue";
|
|
2
|
+
//#region ../ccui/ui/shared/hooks/use-namespace.ts
|
|
3
|
+
function l(e, t, n) {
|
|
4
|
+
let r = e;
|
|
5
|
+
return t && (r += `__${t}`), n && (r += `--${n}`), r;
|
|
6
|
+
}
|
|
7
|
+
function u(e, t = !1) {
|
|
8
|
+
let n = t ? `.ccui-${e}` : `ccui-${e}`;
|
|
9
|
+
return {
|
|
10
|
+
b: () => l(n),
|
|
11
|
+
e: (e) => e ? l(n, e) : "",
|
|
12
|
+
m: (e) => e ? l(n, "", e) : "",
|
|
13
|
+
em: (e, t) => e && t ? l(n, e, t) : "",
|
|
14
|
+
is: (e) => `is-${e}`
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region ../ccui/ui/typography/src/typography-types.ts
|
|
19
|
+
var d = {
|
|
20
|
+
type: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: void 0
|
|
23
|
+
},
|
|
24
|
+
disabled: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: !1
|
|
27
|
+
},
|
|
28
|
+
mark: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: !1
|
|
31
|
+
},
|
|
32
|
+
code: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: !1
|
|
35
|
+
},
|
|
36
|
+
keyboard: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: !1
|
|
39
|
+
},
|
|
40
|
+
underline: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: !1
|
|
43
|
+
},
|
|
44
|
+
delete: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: !1
|
|
47
|
+
},
|
|
48
|
+
strong: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: !1
|
|
51
|
+
},
|
|
52
|
+
italic: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: !1
|
|
55
|
+
},
|
|
56
|
+
copyable: {
|
|
57
|
+
type: [Boolean, Object],
|
|
58
|
+
default: !1
|
|
59
|
+
},
|
|
60
|
+
editable: {
|
|
61
|
+
type: [Boolean, Object],
|
|
62
|
+
default: !1
|
|
63
|
+
},
|
|
64
|
+
ellipsis: {
|
|
65
|
+
type: [Boolean, Object],
|
|
66
|
+
default: !1
|
|
67
|
+
}
|
|
68
|
+
}, f = d, p = d, m = {
|
|
69
|
+
...d,
|
|
70
|
+
level: {
|
|
71
|
+
type: Number,
|
|
72
|
+
default: 1,
|
|
73
|
+
validator: (e) => e >= 1 && e <= 5
|
|
74
|
+
}
|
|
75
|
+
}, h = {
|
|
76
|
+
...d,
|
|
77
|
+
href: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: void 0
|
|
80
|
+
},
|
|
81
|
+
target: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: void 0
|
|
84
|
+
}
|
|
85
|
+
}, g = u("typography");
|
|
86
|
+
function _(e) {
|
|
87
|
+
return {
|
|
88
|
+
[g.b()]: !0,
|
|
89
|
+
[g.m(e.type)]: !!e.type,
|
|
90
|
+
[g.m("disabled")]: e.disabled
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function v(e, t) {
|
|
94
|
+
let n = e;
|
|
95
|
+
return t.code && (n = i("code", null, [n])), t.keyboard && (n = i("kbd", null, [n])), t.mark && (n = i("mark", null, [n])), t.underline && (n = i("u", null, [n])), t.delete && (n = i("del", null, [n])), t.strong && (n = i("strong", null, [n])), t.italic && (n = i("i", null, [n])), n;
|
|
96
|
+
}
|
|
97
|
+
function y(e, t) {
|
|
98
|
+
let n = e.default?.() ?? [];
|
|
99
|
+
return n.length === 0 ? "" : n.length === 1 ? v(n[0], t) : n.map((e) => v(e, t));
|
|
100
|
+
}
|
|
101
|
+
function b(e, t) {
|
|
102
|
+
return e === !1 || e === void 0 ? null : e === !0 ? t : e;
|
|
103
|
+
}
|
|
104
|
+
function x(e) {
|
|
105
|
+
return (e.default?.() ?? []).map((e) => typeof e == "string" ? e : typeof e.children == "string" ? e.children : "").join("");
|
|
106
|
+
}
|
|
107
|
+
function S(l, u, d, f) {
|
|
108
|
+
return /* @__PURE__ */ r({
|
|
109
|
+
name: l,
|
|
110
|
+
props: u,
|
|
111
|
+
emits: ["update:editable-text"],
|
|
112
|
+
setup(r, { slots: l, emit: u }) {
|
|
113
|
+
let p = r, m = e(() => b(p.copyable, {})), h = s(!1), v = null, S = async () => {
|
|
114
|
+
let e = m.value;
|
|
115
|
+
if (!e) return;
|
|
116
|
+
let t = e.text ?? x(l);
|
|
117
|
+
try {
|
|
118
|
+
typeof navigator < "u" && navigator.clipboard?.writeText && await navigator.clipboard.writeText(t), h.value = !0, e.onCopy?.(t);
|
|
119
|
+
let n = e.copyableDelay ?? 3e3;
|
|
120
|
+
v !== null && clearTimeout(v), v = window.setTimeout(() => {
|
|
121
|
+
h.value = !1, v = null;
|
|
122
|
+
}, n);
|
|
123
|
+
} catch {}
|
|
124
|
+
}, C = e(() => b(p.editable, {})), w = s(!1), T = s(""), E = s(null);
|
|
125
|
+
c(() => C.value?.editing, (e) => {
|
|
126
|
+
typeof e == "boolean" && (w.value = e);
|
|
127
|
+
});
|
|
128
|
+
let D = () => {
|
|
129
|
+
let e = C.value;
|
|
130
|
+
e && (T.value = e.text ?? x(l), w.value = !0, e.onStart?.(), a(() => {
|
|
131
|
+
E.value?.focus();
|
|
132
|
+
}));
|
|
133
|
+
}, O = () => {
|
|
134
|
+
let e = C.value;
|
|
135
|
+
e && (w.value = !1, e.onChange?.(T.value), e.onEnd?.(), u("update:editable-text", T.value));
|
|
136
|
+
}, k = () => {
|
|
137
|
+
w.value = !1, C.value?.onCancel?.();
|
|
138
|
+
}, A = (e) => {
|
|
139
|
+
T.value = e.target.value;
|
|
140
|
+
}, j = (e) => {
|
|
141
|
+
if (e.key === "Escape") {
|
|
142
|
+
k();
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), O());
|
|
146
|
+
}, M = e(() => b(p.ellipsis, {})), N = s(!1), P = e(() => {
|
|
147
|
+
let e = M.value;
|
|
148
|
+
return e && typeof e.expanded == "boolean" ? e.expanded : N.value;
|
|
149
|
+
}), F = e(() => M.value?.rows ?? 1), I = e(() => {
|
|
150
|
+
let e = M.value;
|
|
151
|
+
return e ? e.expandable === !0 || e.expandable === "collapsible" : !1;
|
|
152
|
+
}), L = () => {
|
|
153
|
+
let e = M.value;
|
|
154
|
+
if (!e) return;
|
|
155
|
+
let t = !P.value;
|
|
156
|
+
typeof e.expanded != "boolean" && (N.value = t), e.onExpand?.(t);
|
|
157
|
+
};
|
|
158
|
+
o(() => {
|
|
159
|
+
v !== null && clearTimeout(v);
|
|
160
|
+
});
|
|
161
|
+
let R = e(() => ({
|
|
162
|
+
..._(p),
|
|
163
|
+
...f ? f(p) : {},
|
|
164
|
+
[g.m("ellipsis")]: !!M.value && !P.value,
|
|
165
|
+
[g.m(`ellipsis-${F.value}`)]: !!M.value && !P.value && F.value > 1
|
|
166
|
+
})), z = () => {
|
|
167
|
+
let e = m.value;
|
|
168
|
+
if (!e) return null;
|
|
169
|
+
let t = e.tooltips === !1 ? null : e.tooltips ?? ["复制", "已复制"], r = t ? h.value ? t[1] : t[0] : void 0;
|
|
170
|
+
return l["copy-icon"] ? n("span", {
|
|
171
|
+
class: [g.e("copy"), h.value && g.is("copied")],
|
|
172
|
+
role: "button",
|
|
173
|
+
title: r,
|
|
174
|
+
onClick: S
|
|
175
|
+
}, [l["copy-icon"]({ copied: h.value })]) : n("span", {
|
|
176
|
+
class: [g.e("copy"), h.value && g.is("copied")],
|
|
177
|
+
role: "button",
|
|
178
|
+
title: r,
|
|
179
|
+
onClick: S
|
|
180
|
+
}, [h.value ? "✓" : "⎘"]);
|
|
181
|
+
}, B = () => {
|
|
182
|
+
let e = C.value;
|
|
183
|
+
return !e || !(e.triggerType ?? ["icon"]).includes("icon") ? null : l["edit-icon"] ? n("span", {
|
|
184
|
+
class: g.e("edit"),
|
|
185
|
+
role: "button",
|
|
186
|
+
title: e.tooltip || void 0,
|
|
187
|
+
onClick: D
|
|
188
|
+
}, [l["edit-icon"]()]) : n("span", {
|
|
189
|
+
class: g.e("edit"),
|
|
190
|
+
role: "button",
|
|
191
|
+
title: e.tooltip || void 0,
|
|
192
|
+
onClick: D
|
|
193
|
+
}, [t("✎")]);
|
|
194
|
+
}, V = () => {
|
|
195
|
+
if (!I.value) return null;
|
|
196
|
+
let e = M.value;
|
|
197
|
+
return P.value ? e.expandable !== "collapsible" && e.expandable !== !0 ? null : n("span", {
|
|
198
|
+
class: g.e("collapse"),
|
|
199
|
+
role: "button",
|
|
200
|
+
onClick: L
|
|
201
|
+
}, [l["collapse-text"] ? l["collapse-text"]() : "收起"]) : n("span", {
|
|
202
|
+
class: g.e("expand"),
|
|
203
|
+
role: "button",
|
|
204
|
+
onClick: L
|
|
205
|
+
}, [l["expand-text"] ? l["expand-text"]() : "展开"]);
|
|
206
|
+
}, H = () => {
|
|
207
|
+
let e = C.value;
|
|
208
|
+
return n("textarea", {
|
|
209
|
+
ref: (e) => {
|
|
210
|
+
E.value = e;
|
|
211
|
+
},
|
|
212
|
+
class: g.e("edit-input"),
|
|
213
|
+
value: T.value,
|
|
214
|
+
maxlength: e.maxLength,
|
|
215
|
+
onInput: A,
|
|
216
|
+
onKeydown: j,
|
|
217
|
+
onBlur: O
|
|
218
|
+
}, null);
|
|
219
|
+
}, U = () => {
|
|
220
|
+
let e = C.value;
|
|
221
|
+
e && (e.triggerType ?? ["icon"]).includes("text") && D();
|
|
222
|
+
};
|
|
223
|
+
return () => {
|
|
224
|
+
let e = d(p), t = (() => {
|
|
225
|
+
let e = M.value;
|
|
226
|
+
if (!(!e || !e.tooltip || P.value)) return typeof e.tooltip == "string" ? e.tooltip : x(l);
|
|
227
|
+
})();
|
|
228
|
+
if (w.value) return i(e, { class: R.value }, [H()]);
|
|
229
|
+
let n = {
|
|
230
|
+
class: R.value,
|
|
231
|
+
title: t,
|
|
232
|
+
"data-ellipsis-rows": M.value ? F.value : void 0
|
|
233
|
+
};
|
|
234
|
+
C.value && (C.value.triggerType ?? ["icon"]).includes("text") && (n.onClick = U), e === "a" && (n.href = p.href, n.target = p.target);
|
|
235
|
+
let r = [], a = y(l, p);
|
|
236
|
+
Array.isArray(a) ? r.push(...a) : r.push(a);
|
|
237
|
+
let o = B(), s = z(), c = V();
|
|
238
|
+
return c && r.push(c), o && r.push(o), s && r.push(s), i(e, n, r);
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
var C = S("CTypographyText", f, () => "span", () => ({ [g.m("text")]: !0 })), w = S("CTypographyParagraph", p, () => "div", () => ({ [g.m("paragraph")]: !0 })), T = S("CTypographyTitle", m, (e) => `h${e.level}`, (e) => ({
|
|
244
|
+
[g.m("title")]: !0,
|
|
245
|
+
[g.m(`title-${e.level}`)]: !0
|
|
246
|
+
})), E = S("CTypographyLink", h, () => "a", () => ({ [g.m("link")]: !0 })), D = /* @__PURE__ */ r({
|
|
247
|
+
name: "CTypography",
|
|
248
|
+
setup(e, { slots: t }) {
|
|
249
|
+
return () => i("article", { class: g.b() }, t.default?.());
|
|
250
|
+
}
|
|
251
|
+
}), O = [
|
|
252
|
+
D,
|
|
253
|
+
C,
|
|
254
|
+
w,
|
|
255
|
+
T,
|
|
256
|
+
E
|
|
257
|
+
];
|
|
258
|
+
D.install = function(e) {
|
|
259
|
+
O.forEach((t) => e.component(t.name, t));
|
|
260
|
+
};
|
|
261
|
+
var k = {
|
|
262
|
+
title: "Typography 排版",
|
|
263
|
+
category: "通用",
|
|
264
|
+
status: "100%",
|
|
265
|
+
install(e) {
|
|
266
|
+
O.forEach((t) => e.component(t.name, t));
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
//#endregion
|
|
270
|
+
export { E as Link, w as Paragraph, C as Text, T as Title, D as Typography, k as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`)):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.index={},e.Vue))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});function n(e,t,n){let r=e;return t&&(r+=`__${t}`),n&&(r+=`--${n}`),r}function r(e,t=!1){let r=t?`.ccui-${e}`:`ccui-${e}`;return{b:()=>n(r),e:e=>e?n(r,e):``,m:e=>e?n(r,``,e):``,em:(e,t)=>e&&t?n(r,e,t):``,is:e=>`is-${e}`}}var i={type:{type:String,default:void 0},disabled:{type:Boolean,default:!1},mark:{type:Boolean,default:!1},code:{type:Boolean,default:!1},keyboard:{type:Boolean,default:!1},underline:{type:Boolean,default:!1},delete:{type:Boolean,default:!1},strong:{type:Boolean,default:!1},italic:{type:Boolean,default:!1},copyable:{type:[Boolean,Object],default:!1},editable:{type:[Boolean,Object],default:!1},ellipsis:{type:[Boolean,Object],default:!1}},a=i,o=i,s={...i,level:{type:Number,default:1,validator:e=>e>=1&&e<=5}},c={...i,href:{type:String,default:void 0},target:{type:String,default:void 0}},l=r(`typography`);function u(e){return{[l.b()]:!0,[l.m(e.type)]:!!e.type,[l.m(`disabled`)]:e.disabled}}function d(e,n){let r=e;return n.code&&(r=(0,t.h)(`code`,null,[r])),n.keyboard&&(r=(0,t.h)(`kbd`,null,[r])),n.mark&&(r=(0,t.h)(`mark`,null,[r])),n.underline&&(r=(0,t.h)(`u`,null,[r])),n.delete&&(r=(0,t.h)(`del`,null,[r])),n.strong&&(r=(0,t.h)(`strong`,null,[r])),n.italic&&(r=(0,t.h)(`i`,null,[r])),r}function f(e,t){let n=e.default?.()??[];return n.length===0?``:n.length===1?d(n[0],t):n.map(e=>d(e,t))}function p(e,t){return e===!1||e===void 0?null:e===!0?t:e}function m(e){return(e.default?.()??[]).map(e=>typeof e==`string`?e:typeof e.children==`string`?e.children:``).join(``)}function h(e,n,r,i){return(0,t.defineComponent)({name:e,props:n,emits:[`update:editable-text`],setup(e,{slots:n,emit:a}){let o=e,s=(0,t.computed)(()=>p(o.copyable,{})),c=(0,t.ref)(!1),d=null,h=async()=>{let e=s.value;if(!e)return;let t=e.text??m(n);try{typeof navigator<`u`&&navigator.clipboard?.writeText&&await navigator.clipboard.writeText(t),c.value=!0,e.onCopy?.(t);let n=e.copyableDelay??3e3;d!==null&&clearTimeout(d),d=window.setTimeout(()=>{c.value=!1,d=null},n)}catch{}},g=(0,t.computed)(()=>p(o.editable,{})),_=(0,t.ref)(!1),v=(0,t.ref)(``),y=(0,t.ref)(null);(0,t.watch)(()=>g.value?.editing,e=>{typeof e==`boolean`&&(_.value=e)});let b=()=>{let e=g.value;e&&(v.value=e.text??m(n),_.value=!0,e.onStart?.(),(0,t.nextTick)(()=>{y.value?.focus()}))},x=()=>{let e=g.value;e&&(_.value=!1,e.onChange?.(v.value),e.onEnd?.(),a(`update:editable-text`,v.value))},S=()=>{_.value=!1,g.value?.onCancel?.()},C=e=>{v.value=e.target.value},w=e=>{if(e.key===`Escape`){S();return}e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),x())},T=(0,t.computed)(()=>p(o.ellipsis,{})),E=(0,t.ref)(!1),D=(0,t.computed)(()=>{let e=T.value;return e&&typeof e.expanded==`boolean`?e.expanded:E.value}),O=(0,t.computed)(()=>T.value?.rows??1),k=(0,t.computed)(()=>{let e=T.value;return e?e.expandable===!0||e.expandable===`collapsible`:!1}),A=()=>{let e=T.value;if(!e)return;let t=!D.value;typeof e.expanded!=`boolean`&&(E.value=t),e.onExpand?.(t)};(0,t.onBeforeUnmount)(()=>{d!==null&&clearTimeout(d)});let j=(0,t.computed)(()=>({...u(o),...i?i(o):{},[l.m(`ellipsis`)]:!!T.value&&!D.value,[l.m(`ellipsis-${O.value}`)]:!!T.value&&!D.value&&O.value>1})),M=()=>{let e=s.value;if(!e)return null;let r=e.tooltips===!1?null:e.tooltips??[`复制`,`已复制`],i=r?c.value?r[1]:r[0]:void 0;return n[`copy-icon`]?(0,t.createVNode)(`span`,{class:[l.e(`copy`),c.value&&l.is(`copied`)],role:`button`,title:i,onClick:h},[n[`copy-icon`]({copied:c.value})]):(0,t.createVNode)(`span`,{class:[l.e(`copy`),c.value&&l.is(`copied`)],role:`button`,title:i,onClick:h},[c.value?`✓`:`⎘`])},N=()=>{let e=g.value;return!e||!(e.triggerType??[`icon`]).includes(`icon`)?null:n[`edit-icon`]?(0,t.createVNode)(`span`,{class:l.e(`edit`),role:`button`,title:e.tooltip||void 0,onClick:b},[n[`edit-icon`]()]):(0,t.createVNode)(`span`,{class:l.e(`edit`),role:`button`,title:e.tooltip||void 0,onClick:b},[(0,t.createTextVNode)(`✎`)])},P=()=>{if(!k.value)return null;let e=T.value;return D.value?e.expandable!==`collapsible`&&e.expandable!==!0?null:(0,t.createVNode)(`span`,{class:l.e(`collapse`),role:`button`,onClick:A},[n[`collapse-text`]?n[`collapse-text`]():`收起`]):(0,t.createVNode)(`span`,{class:l.e(`expand`),role:`button`,onClick:A},[n[`expand-text`]?n[`expand-text`]():`展开`])},F=()=>{let e=g.value;return(0,t.createVNode)(`textarea`,{ref:e=>{y.value=e},class:l.e(`edit-input`),value:v.value,maxlength:e.maxLength,onInput:C,onKeydown:w,onBlur:x},null)},I=()=>{let e=g.value;e&&(e.triggerType??[`icon`]).includes(`text`)&&b()};return()=>{let e=r(o),i=(()=>{let e=T.value;if(!(!e||!e.tooltip||D.value))return typeof e.tooltip==`string`?e.tooltip:m(n)})();if(_.value)return(0,t.h)(e,{class:j.value},[F()]);let a={class:j.value,title:i,"data-ellipsis-rows":T.value?O.value:void 0};g.value&&(g.value.triggerType??[`icon`]).includes(`text`)&&(a.onClick=I),e===`a`&&(a.href=o.href,a.target=o.target);let s=[],c=f(n,o);Array.isArray(c)?s.push(...c):s.push(c);let l=N(),u=M(),d=P();return d&&s.push(d),l&&s.push(l),u&&s.push(u),(0,t.h)(e,a,s)}}})}var g=h(`CTypographyText`,a,()=>`span`,()=>({[l.m(`text`)]:!0})),_=h(`CTypographyParagraph`,o,()=>`div`,()=>({[l.m(`paragraph`)]:!0})),v=h(`CTypographyTitle`,s,e=>`h${e.level}`,e=>({[l.m(`title`)]:!0,[l.m(`title-${e.level}`)]:!0})),y=h(`CTypographyLink`,c,()=>`a`,()=>({[l.m(`link`)]:!0})),b=(0,t.defineComponent)({name:`CTypography`,setup(e,{slots:n}){return()=>(0,t.h)(`article`,{class:l.b()},n.default?.())}}),x=[b,g,_,v,y];b.install=function(e){x.forEach(t=>e.component(t.name,t))},e.Link=y,e.Paragraph=_,e.Text=g,e.Title=v,e.Typography=b,e.default={title:`Typography 排版`,category:`通用`,status:`100%`,install(e){x.forEach(t=>e.component(t.name,t))}}});
|
package/util/index.es.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
//#region ../ccui/ui/util/src/dom.ts
|
|
2
|
+
var e = typeof window < "u" && typeof document < "u";
|
|
3
|
+
function t() {
|
|
4
|
+
return e;
|
|
5
|
+
}
|
|
6
|
+
function n(t) {
|
|
7
|
+
if (!e || !t) return {
|
|
8
|
+
top: 0,
|
|
9
|
+
left: 0
|
|
10
|
+
};
|
|
11
|
+
let n = t.getBoundingClientRect();
|
|
12
|
+
return {
|
|
13
|
+
top: n.top + window.scrollY,
|
|
14
|
+
left: n.left + window.scrollX
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function r(t) {
|
|
18
|
+
return !e || !t ? !1 : !!(t.offsetWidth || t.offsetHeight || t.getClientRects().length);
|
|
19
|
+
}
|
|
20
|
+
function i(e, t) {
|
|
21
|
+
return !e || !t ? !1 : e === t || e.contains(t);
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region ../ccui/ui/util/src/func.ts
|
|
25
|
+
function a(e, t = 200) {
|
|
26
|
+
let n = null;
|
|
27
|
+
function r(...r) {
|
|
28
|
+
n && clearTimeout(n), n = setTimeout(() => {
|
|
29
|
+
e.apply(this, r), n = null;
|
|
30
|
+
}, t);
|
|
31
|
+
}
|
|
32
|
+
return r.cancel = () => {
|
|
33
|
+
n &&= (clearTimeout(n), null);
|
|
34
|
+
}, r;
|
|
35
|
+
}
|
|
36
|
+
function o(e, t = 200) {
|
|
37
|
+
let n = 0, r = null;
|
|
38
|
+
function i(...i) {
|
|
39
|
+
let a = Date.now(), o = t - (a - n);
|
|
40
|
+
o <= 0 ? (r &&= (clearTimeout(r), null), n = a, e.apply(this, i)) : r ||= setTimeout(() => {
|
|
41
|
+
n = Date.now(), r = null, e.apply(this, i);
|
|
42
|
+
}, o);
|
|
43
|
+
}
|
|
44
|
+
return i;
|
|
45
|
+
}
|
|
46
|
+
function s() {}
|
|
47
|
+
function c(e) {
|
|
48
|
+
return typeof e == "function";
|
|
49
|
+
}
|
|
50
|
+
function l(e) {
|
|
51
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region ../ccui/ui/util/src/type.ts
|
|
55
|
+
function u(...e) {
|
|
56
|
+
let t = [];
|
|
57
|
+
for (let n of e) if (n) {
|
|
58
|
+
if (typeof n == "string") t.push(n);
|
|
59
|
+
else if (typeof n == "object") for (let e in n) n[e] && t.push(e);
|
|
60
|
+
}
|
|
61
|
+
return t.join(" ");
|
|
62
|
+
}
|
|
63
|
+
function d(e) {
|
|
64
|
+
return e == null;
|
|
65
|
+
}
|
|
66
|
+
function f(e, t, n) {
|
|
67
|
+
return Math.min(n, Math.max(t, e));
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region ../ccui/ui/util/index.ts
|
|
71
|
+
var p = {
|
|
72
|
+
title: "Util 工具集",
|
|
73
|
+
category: "通用",
|
|
74
|
+
status: "100%",
|
|
75
|
+
install(e) {}
|
|
76
|
+
};
|
|
77
|
+
//#endregion
|
|
78
|
+
export { t as canUseDom, f as clamp, u as classNames, i as contains, a as debounce, p as default, n as getOffset, e as inBrowser, c as isFunction, d as isNil, l as isObject, r as isVisible, s as noop, o as throttle };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.index={}))})(this,function(e){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var t=typeof window<`u`&&typeof document<`u`;function n(){return t}function r(e){if(!t||!e)return{top:0,left:0};let n=e.getBoundingClientRect();return{top:n.top+window.scrollY,left:n.left+window.scrollX}}function i(e){return!t||!e?!1:!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)}function a(e,t){return!e||!t?!1:e===t||e.contains(t)}function o(e,t=200){let n=null;function r(...r){n&&clearTimeout(n),n=setTimeout(()=>{e.apply(this,r),n=null},t)}return r.cancel=()=>{n&&=(clearTimeout(n),null)},r}function s(e,t=200){let n=0,r=null;function i(...i){let a=Date.now(),o=t-(a-n);o<=0?(r&&=(clearTimeout(r),null),n=a,e.apply(this,i)):r||=setTimeout(()=>{n=Date.now(),r=null,e.apply(this,i)},o)}return i}function c(){}function l(e){return typeof e==`function`}function u(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function d(...e){let t=[];for(let n of e)if(n){if(typeof n==`string`)t.push(n);else if(typeof n==`object`)for(let e in n)n[e]&&t.push(e)}return t.join(` `)}function f(e){return e==null}function p(e,t,n){return Math.min(n,Math.max(t,e))}e.canUseDom=n,e.clamp=p,e.classNames=d,e.contains=a,e.debounce=o,e.default={title:`Util 工具集`,category:`通用`,status:`100%`,install(e){}},e.getOffset=r,e.inBrowser=t,e.isFunction=l,e.isNil=f,e.isObject=u,e.isVisible=i,e.noop=c,e.throttle=s});
|