djm-ui 0.0.0-stage → 0.67.2
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/CHANGELOG.md +715 -0
- package/LICENSE +21 -0
- package/README.md +183 -2
- package/dist/djm-ui.cjs +15521 -0
- package/dist/djm-ui.cjs.map +7 -0
- package/dist/djm-ui.css +11817 -0
- package/dist/djm-ui.esm.js +15371 -0
- package/dist/djm-ui.esm.js.map +7 -0
- package/dist/djm-ui.esm.min.js +4059 -0
- package/dist/djm-ui.min.cjs +4059 -0
- package/dist/djm-ui.min.css +2 -0
- package/dist/djm-ui.umd.js +15331 -0
- package/dist/djm-ui.umd.min.js +4059 -0
- package/package.json +90 -4
- package/src/components/affix/index.js +98 -0
- package/src/components/alert/index.js +43 -0
- package/src/components/anchor/index.js +107 -0
- package/src/components/approval-flow/index.js +96 -0
- package/src/components/attachment-list/index.js +155 -0
- package/src/components/autocomplete/index.js +187 -0
- package/src/components/avatar/group.js +22 -0
- package/src/components/avatar/index.js +47 -0
- package/src/components/backtop/index.js +82 -0
- package/src/components/badge/index.js +43 -0
- package/src/components/batch-bar/index.js +52 -0
- package/src/components/breadcrumb/index.js +45 -0
- package/src/components/button/index.js +45 -0
- package/src/components/calendar/index.js +180 -0
- package/src/components/card/index.js +24 -0
- package/src/components/carousel/index.js +136 -0
- package/src/components/cascader/index.js +157 -0
- package/src/components/chat/index.js +157 -0
- package/src/components/checkbox/index.js +109 -0
- package/src/components/collapse/index.js +55 -0
- package/src/components/color-picker/index.js +133 -0
- package/src/components/command-palette/index.js +182 -0
- package/src/components/comment/index.js +149 -0
- package/src/components/config-provider/index.js +41 -0
- package/src/components/confirm-dialog/index.js +66 -0
- package/src/components/context-menu/index.js +148 -0
- package/src/components/date-picker/index.js +448 -0
- package/src/components/date-time-picker/index.js +376 -0
- package/src/components/descriptions/index.js +47 -0
- package/src/components/diff/index.js +172 -0
- package/src/components/divider/index.js +25 -0
- package/src/components/drawer/index.js +131 -0
- package/src/components/dropdown/index.js +236 -0
- package/src/components/editable-table/index.js +264 -0
- package/src/components/empty/index.js +31 -0
- package/src/components/field-list/index.js +221 -0
- package/src/components/filter-tags/index.js +33 -0
- package/src/components/float-button/index.js +97 -0
- package/src/components/floating-window/index.js +171 -0
- package/src/components/form/index.js +130 -0
- package/src/components/form-item/index.js +71 -0
- package/src/components/gantt/index.js +192 -0
- package/src/components/grid/col.js +21 -0
- package/src/components/grid/row.js +16 -0
- package/src/components/icon/index.js +87 -0
- package/src/components/image/index.js +110 -0
- package/src/components/import-wizard/index.js +306 -0
- package/src/components/input/index.js +117 -0
- package/src/components/input-number/index.js +106 -0
- package/src/components/input-tag/index.js +117 -0
- package/src/components/kanban/index.js +223 -0
- package/src/components/layout/content.js +5 -0
- package/src/components/layout/footer.js +5 -0
- package/src/components/layout/header.js +5 -0
- package/src/components/layout/index.js +15 -0
- package/src/components/layout/sider.js +13 -0
- package/src/components/list/index.js +31 -0
- package/src/components/media-picker/index.js +206 -0
- package/src/components/mentions/index.js +193 -0
- package/src/components/menu/index.js +248 -0
- package/src/components/message/index.js +56 -0
- package/src/components/modal/index.js +132 -0
- package/src/components/notification/index.js +140 -0
- package/src/components/org-chart/index.js +190 -0
- package/src/components/org-picker/index.js +414 -0
- package/src/components/page-header/index.js +24 -0
- package/src/components/page-tabs/index.js +80 -0
- package/src/components/pagination/index.js +124 -0
- package/src/components/password/index.js +92 -0
- package/src/components/popconfirm/index.js +161 -0
- package/src/components/popover/index.js +142 -0
- package/src/components/print/index.js +101 -0
- package/src/components/progress/index.js +37 -0
- package/src/components/qrcode/index.js +75 -0
- package/src/components/query-filter/index.js +171 -0
- package/src/components/radio/index.js +83 -0
- package/src/components/rate/index.js +84 -0
- package/src/components/result/index.js +52 -0
- package/src/components/rich-editor/index.js +235 -0
- package/src/components/schedule/index.js +287 -0
- package/src/components/schema-form/index.js +222 -0
- package/src/components/segmented/index.js +40 -0
- package/src/components/select/index.js +614 -0
- package/src/components/signature/index.js +243 -0
- package/src/components/skeleton/index.js +35 -0
- package/src/components/slider/index.js +166 -0
- package/src/components/space/index.js +32 -0
- package/src/components/spin/index.js +42 -0
- package/src/components/splitter/index.js +110 -0
- package/src/components/statistic/index.js +41 -0
- package/src/components/status/index.js +31 -0
- package/src/components/steps/index.js +49 -0
- package/src/components/switch/index.js +40 -0
- package/src/components/table/index.js +847 -0
- package/src/components/tabs/index.js +136 -0
- package/src/components/tag/index.js +56 -0
- package/src/components/time-picker/index.js +165 -0
- package/src/components/timeline/index.js +24 -0
- package/src/components/tooltip/index.js +129 -0
- package/src/components/tour/index.js +144 -0
- package/src/components/transfer/index.js +145 -0
- package/src/components/tree/index.js +485 -0
- package/src/components/tree-select/index.js +406 -0
- package/src/components/tree-table/index.js +318 -0
- package/src/components/upload/index.js +407 -0
- package/src/components/virtual-list/index.js +178 -0
- package/src/components/watermark/index.js +82 -0
- package/src/index.js +356 -0
- package/src/locale/en-US.js +254 -0
- package/src/locale/index.js +32 -0
- package/src/locale/zh-CN.js +254 -0
- package/src/styles/base.css +101 -0
- package/src/styles/components/account.css +230 -0
- package/src/styles/components/affix.css +11 -0
- package/src/styles/components/anchor.css +56 -0
- package/src/styles/components/approval-flow.css +196 -0
- package/src/styles/components/attachment-list.css +172 -0
- package/src/styles/components/autocomplete.css +42 -0
- package/src/styles/components/avatar.css +42 -0
- package/src/styles/components/backtop.css +33 -0
- package/src/styles/components/badge.css +72 -0
- package/src/styles/components/batch-bar.css +51 -0
- package/src/styles/components/breadcrumb.css +74 -0
- package/src/styles/components/button.css +237 -0
- package/src/styles/components/calendar.css +99 -0
- package/src/styles/components/card.css +74 -0
- package/src/styles/components/carousel.css +119 -0
- package/src/styles/components/cascader.css +118 -0
- package/src/styles/components/charts.css +173 -0
- package/src/styles/components/chat.css +162 -0
- package/src/styles/components/color-picker.css +93 -0
- package/src/styles/components/command-palette.css +97 -0
- package/src/styles/components/comment.css +164 -0
- package/src/styles/components/composite.css +353 -0
- package/src/styles/components/console.css +288 -0
- package/src/styles/components/context-menu.css +98 -0
- package/src/styles/components/dashboard.css +245 -0
- package/src/styles/components/date-picker.css +258 -0
- package/src/styles/components/date-time-picker.css +239 -0
- package/src/styles/components/demo.css +432 -0
- package/src/styles/components/descriptions.css +45 -0
- package/src/styles/components/diff.css +178 -0
- package/src/styles/components/divider.css +32 -0
- package/src/styles/components/drawer.css +82 -0
- package/src/styles/components/dropdown.css +97 -0
- package/src/styles/components/feedback.css +270 -0
- package/src/styles/components/field-list.css +132 -0
- package/src/styles/components/filter-tags.css +60 -0
- package/src/styles/components/float-button.css +80 -0
- package/src/styles/components/form.css +688 -0
- package/src/styles/components/frame.css +193 -0
- package/src/styles/components/gantt.css +241 -0
- package/src/styles/components/grid.css +161 -0
- package/src/styles/components/image.css +107 -0
- package/src/styles/components/import-wizard.css +262 -0
- package/src/styles/components/input-number.css +58 -0
- package/src/styles/components/input-tag.css +73 -0
- package/src/styles/components/kanban.css +181 -0
- package/src/styles/components/layout-container.css +59 -0
- package/src/styles/components/layout.css +765 -0
- package/src/styles/components/list.css +73 -0
- package/src/styles/components/lookup.css +142 -0
- package/src/styles/components/media-picker.css +154 -0
- package/src/styles/components/mentions.css +50 -0
- package/src/styles/components/menu.css +200 -0
- package/src/styles/components/modal.css +97 -0
- package/src/styles/components/motion.css +62 -0
- package/src/styles/components/notification.css +179 -0
- package/src/styles/components/org-chart.css +131 -0
- package/src/styles/components/org-picker.css +341 -0
- package/src/styles/components/overlay.css +234 -0
- package/src/styles/components/page-tabs.css +101 -0
- package/src/styles/components/pagination.css +113 -0
- package/src/styles/components/panel.css +99 -0
- package/src/styles/components/password.css +74 -0
- package/src/styles/components/permission.css +118 -0
- package/src/styles/components/placeholder.css +90 -0
- package/src/styles/components/popconfirm.css +51 -0
- package/src/styles/components/popover.css +134 -0
- package/src/styles/components/print.css +20 -0
- package/src/styles/components/qrcode.css +23 -0
- package/src/styles/components/query-filter.css +82 -0
- package/src/styles/components/rate.css +41 -0
- package/src/styles/components/responsive.css +599 -0
- package/src/styles/components/result.css +62 -0
- package/src/styles/components/rich-editor.css +216 -0
- package/src/styles/components/schedule.css +243 -0
- package/src/styles/components/schema-form.css +18 -0
- package/src/styles/components/signature.css +46 -0
- package/src/styles/components/skin.css +108 -0
- package/src/styles/components/slider.css +77 -0
- package/src/styles/components/sort.css +93 -0
- package/src/styles/components/space.css +35 -0
- package/src/styles/components/spin.css +44 -0
- package/src/styles/components/splitter.css +66 -0
- package/src/styles/components/statistic.css +53 -0
- package/src/styles/components/steps.css +123 -0
- package/src/styles/components/table.css +852 -0
- package/src/styles/components/tabs.css +192 -0
- package/src/styles/components/tag.css +74 -0
- package/src/styles/components/template.css +409 -0
- package/src/styles/components/time-picker.css +100 -0
- package/src/styles/components/timeline.css +78 -0
- package/src/styles/components/toast.css +52 -0
- package/src/styles/components/tooltip.css +60 -0
- package/src/styles/components/tour.css +86 -0
- package/src/styles/components/transfer.css +104 -0
- package/src/styles/components/tree-table.css +78 -0
- package/src/styles/components/tree.css +568 -0
- package/src/styles/components/upload.css +274 -0
- package/src/styles/components/virtual-list.css +56 -0
- package/src/styles/components/watermark.css +13 -0
- package/src/styles/index.css +109 -0
- package/src/styles/theme-dark.css +78 -0
- package/src/styles/tokens.css +110 -0
- package/src/theme/index.js +186 -0
- package/src/utils/export.js +14 -0
- package/src/utils/focus-trap.js +45 -0
- package/src/utils/panel.js +73 -0
- package/src/utils/permission.js +52 -0
- package/src/utils/row-move.js +26 -0
- package/src/utils/sanitize-html.js +92 -0
- package/src/utils/scroll-lock.js +39 -0
- package/src/utils/text-diff.js +62 -0
- package/src/utils/tree-move.js +51 -0
- package/types/index.d.ts +1714 -0
- package/types/usage-check.ts +50 -0
- package/vendor/qrcode.esm.js +8 -0
|
@@ -0,0 +1,4059 @@
|
|
|
1
|
+
/*! DJM UI v0.67.2 · MIT · 2026-10-26 */
|
|
2
|
+
var el=Object.defineProperty;var tl=(e,t,a)=>()=>{if(a)throw a[0];try{return e&&(t=e(e=0)),t}catch(n){throw a=[n],n}};var al=(e,t)=>{for(var a in t)el(e,a,{get:t[a],enumerable:!0})};var In={};al(In,{default:()=>$o});var J,wo,Pe,Zt,jo,ko,xo,So,Do,Tn,To,Mo,Co,Mn,Cn,ze,Eo,Io,Lo,Ao,Po,zo,Bo,No,Ro,En,Vo,Ho,Oo,$o,Ln=tl(()=>{"use strict";J=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(a){throw t=0,a}},wo=J((e,t)=>{t.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}}),Pe=J(e=>{var t,a=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return n*4+17},e.getSymbolTotalCodewords=function(n){return a[n]},e.getBCHDigit=function(n){let i=0;for(;n!==0;)i++,n>>>=1;return i},e.setToSJISFunction=function(n){if(typeof n!="function")throw new Error('"toSJISFunc" is not a valid function.');t=n},e.isKanjiModeEnabled=function(){return typeof t<"u"},e.toSJIS=function(n){return t(n)}}),Zt=J(e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(a){if(typeof a!="string")throw new Error("Param is not a string");switch(a.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+a)}}e.isValid=function(a){return a&&typeof a.bit<"u"&&a.bit>=0&&a.bit<4},e.from=function(a,n){if(e.isValid(a))return a;try{return t(a)}catch{return n}}}),jo=J((e,t)=>{function a(){this.buffer=[],this.length=0}a.prototype={get:function(n){let i=Math.floor(n/8);return(this.buffer[i]>>>7-n%8&1)===1},put:function(n,i){for(let l=0;l<i;l++)this.putBit((n>>>i-l-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(n){let i=Math.floor(this.length/8);this.buffer.length<=i&&this.buffer.push(0),n&&(this.buffer[i]|=128>>>this.length%8),this.length++}},t.exports=a}),ko=J((e,t)=>{function a(n){if(!n||n<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=n,this.data=new Uint8Array(n*n),this.reservedBit=new Uint8Array(n*n)}a.prototype.set=function(n,i,l,o){let r=n*this.size+i;this.data[r]=l,o&&(this.reservedBit[r]=!0)},a.prototype.get=function(n,i){return this.data[n*this.size+i]},a.prototype.xor=function(n,i,l){this.data[n*this.size+i]^=l},a.prototype.isReserved=function(n,i){return this.reservedBit[n*this.size+i]},t.exports=a}),xo=J(e=>{var t=Pe().getSymbolSize;e.getRowColCoords=function(a){if(a===1)return[];let n=Math.floor(a/7)+2,i=t(a),l=i===145?26:Math.ceil((i-13)/(2*n-2))*2,o=[i-7];for(let r=1;r<n-1;r++)o[r]=o[r-1]-l;return o.push(6),o.reverse()},e.getPositions=function(a){let n=[],i=e.getRowColCoords(a),l=i.length;for(let o=0;o<l;o++)for(let r=0;r<l;r++)o===0&&r===0||o===0&&r===l-1||o===l-1&&r===0||n.push([i[o],i[r]]);return n}}),So=J(e=>{var t=Pe().getSymbolSize,a=7;e.getPositions=function(n){let i=t(n);return[[0,0],[i-a,0],[0,i-a]]}}),Do=J(e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},e.from=function(n){return e.isValid(n)?parseInt(n,10):void 0},e.getPenaltyN1=function(n){let i=n.size,l=0,o=0,r=0,s=null,d=null;for(let f=0;f<i;f++){o=r=0,s=d=null;for(let c=0;c<i;c++){let p=n.get(f,c);p===s?o++:(o>=5&&(l+=t.N1+(o-5)),s=p,o=1),p=n.get(c,f),p===d?r++:(r>=5&&(l+=t.N1+(r-5)),d=p,r=1)}o>=5&&(l+=t.N1+(o-5)),r>=5&&(l+=t.N1+(r-5))}return l},e.getPenaltyN2=function(n){let i=n.size,l=0;for(let o=0;o<i-1;o++)for(let r=0;r<i-1;r++){let s=n.get(o,r)+n.get(o,r+1)+n.get(o+1,r)+n.get(o+1,r+1);(s===4||s===0)&&l++}return l*t.N2},e.getPenaltyN3=function(n){let i=n.size,l=0,o=0,r=0;for(let s=0;s<i;s++){o=r=0;for(let d=0;d<i;d++)o=o<<1&2047|n.get(s,d),d>=10&&(o===1488||o===93)&&l++,r=r<<1&2047|n.get(d,s),d>=10&&(r===1488||r===93)&&l++}return l*t.N3},e.getPenaltyN4=function(n){let i=0,l=n.data.length;for(let o=0;o<l;o++)i+=n.data[o];return Math.abs(Math.ceil(i*100/l/5)-10)*t.N4};function a(n,i,l){switch(n){case e.Patterns.PATTERN000:return(i+l)%2===0;case e.Patterns.PATTERN001:return i%2===0;case e.Patterns.PATTERN010:return l%3===0;case e.Patterns.PATTERN011:return(i+l)%3===0;case e.Patterns.PATTERN100:return(Math.floor(i/2)+Math.floor(l/3))%2===0;case e.Patterns.PATTERN101:return i*l%2+i*l%3===0;case e.Patterns.PATTERN110:return(i*l%2+i*l%3)%2===0;case e.Patterns.PATTERN111:return(i*l%3+(i+l)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}e.applyMask=function(n,i){let l=i.size;for(let o=0;o<l;o++)for(let r=0;r<l;r++)i.isReserved(r,o)||i.xor(r,o,a(n,r,o))},e.getBestMask=function(n,i){let l=Object.keys(e.Patterns).length,o=0,r=1/0;for(let s=0;s<l;s++){i(s),e.applyMask(s,n);let d=e.getPenaltyN1(n)+e.getPenaltyN2(n)+e.getPenaltyN3(n)+e.getPenaltyN4(n);e.applyMask(s,n),d<r&&(r=d,o=s)}return o}}),Tn=J(e=>{var t=Zt(),a=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],n=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(i,l){switch(l){case t.L:return a[(i-1)*4+0];case t.M:return a[(i-1)*4+1];case t.Q:return a[(i-1)*4+2];case t.H:return a[(i-1)*4+3];default:return}},e.getTotalCodewordsCount=function(i,l){switch(l){case t.L:return n[(i-1)*4+0];case t.M:return n[(i-1)*4+1];case t.Q:return n[(i-1)*4+2];case t.H:return n[(i-1)*4+3];default:return}}}),To=J(e=>{var t=new Uint8Array(512),a=new Uint8Array(256);(function(){let n=1;for(let i=0;i<255;i++)t[i]=n,a[n]=i,n<<=1,n&256&&(n^=285);for(let i=255;i<512;i++)t[i]=t[i-255]})(),e.log=function(n){if(n<1)throw new Error("log("+n+")");return a[n]},e.exp=function(n){return t[n]},e.mul=function(n,i){return n===0||i===0?0:t[a[n]+a[i]]}}),Mo=J(e=>{var t=To();e.mul=function(a,n){let i=new Uint8Array(a.length+n.length-1);for(let l=0;l<a.length;l++)for(let o=0;o<n.length;o++)i[l+o]^=t.mul(a[l],n[o]);return i},e.mod=function(a,n){let i=new Uint8Array(a);for(;i.length-n.length>=0;){let l=i[0];for(let r=0;r<n.length;r++)i[r]^=t.mul(n[r],l);let o=0;for(;o<i.length&&i[o]===0;)o++;i=i.slice(o)}return i},e.generateECPolynomial=function(a){let n=new Uint8Array([1]);for(let i=0;i<a;i++)n=e.mul(n,new Uint8Array([1,t.exp(i)]));return n}}),Co=J((e,t)=>{var a=Mo();function n(i){this.genPoly=void 0,this.degree=i,this.degree&&this.initialize(this.degree)}n.prototype.initialize=function(i){this.degree=i,this.genPoly=a.generateECPolynomial(this.degree)},n.prototype.encode=function(i){if(!this.genPoly)throw new Error("Encoder not initialized");let l=new Uint8Array(i.length+this.degree);l.set(i);let o=a.mod(l,this.genPoly),r=this.degree-o.length;if(r>0){let s=new Uint8Array(this.degree);return s.set(o,r),s}return o},t.exports=n}),Mn=J(e=>{e.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}}),Cn=J(e=>{var t="[0-9]+",a="[A-Z $%*+\\-./:]+",n="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";n=n.replace(/u/g,"\\u");var i="(?:(?![A-Z0-9 $%*+\\-./:]|"+n+`)(?:.|[\r
|
|
3
|
+
]))+`;e.KANJI=new RegExp(n,"g"),e.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),e.BYTE=new RegExp(i,"g"),e.NUMERIC=new RegExp(t,"g"),e.ALPHANUMERIC=new RegExp(a,"g");var l=new RegExp("^"+n+"$"),o=new RegExp("^"+t+"$"),r=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");e.testKanji=function(s){return l.test(s)},e.testNumeric=function(s){return o.test(s)},e.testAlphanumeric=function(s){return r.test(s)}}),ze=J(e=>{var t=Mn(),a=Cn();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(i,l){if(!i.ccBits)throw new Error("Invalid mode: "+i);if(!t.isValid(l))throw new Error("Invalid version: "+l);return l>=1&&l<10?i.ccBits[0]:l<27?i.ccBits[1]:i.ccBits[2]},e.getBestModeForData=function(i){return a.testNumeric(i)?e.NUMERIC:a.testAlphanumeric(i)?e.ALPHANUMERIC:a.testKanji(i)?e.KANJI:e.BYTE},e.toString=function(i){if(i&&i.id)return i.id;throw new Error("Invalid mode")},e.isValid=function(i){return i&&i.bit&&i.ccBits};function n(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+i)}}e.from=function(i,l){if(e.isValid(i))return i;try{return n(i)}catch{return l}}}),Eo=J(e=>{var t=Pe(),a=Tn(),n=Zt(),i=ze(),l=Mn(),o=7973,r=t.getBCHDigit(o);function s(p,g,m){for(let h=1;h<=40;h++)if(g<=e.getCapacity(h,m,p))return h}function d(p,g){return i.getCharCountIndicator(p,g)+4}function f(p,g){let m=0;return p.forEach(function(h){let b=d(h.mode,g);m+=b+h.getBitsLength()}),m}function c(p,g){for(let m=1;m<=40;m++)if(f(p,m)<=e.getCapacity(m,g,i.MIXED))return m}e.from=function(p,g){return l.isValid(p)?parseInt(p,10):g},e.getCapacity=function(p,g,m){if(!l.isValid(p))throw new Error("Invalid QR Code version");typeof m>"u"&&(m=i.BYTE);let h=t.getSymbolTotalCodewords(p),b=a.getTotalCodewordsCount(p,g),j=(h-b)*8;if(m===i.MIXED)return j;let w=j-d(m,p);switch(m){case i.NUMERIC:return Math.floor(w/10*3);case i.ALPHANUMERIC:return Math.floor(w/11*2);case i.KANJI:return Math.floor(w/13);case i.BYTE:default:return Math.floor(w/8)}},e.getBestVersionForData=function(p,g){let m,h=n.from(g,n.M);if(Array.isArray(p)){if(p.length>1)return c(p,h);if(p.length===0)return 1;m=p[0]}else m=p;return s(m.mode,m.getLength(),h)},e.getEncodedBits=function(p){if(!l.isValid(p)||p<7)throw new Error("Invalid QR Code version");let g=p<<12;for(;t.getBCHDigit(g)-r>=0;)g^=o<<t.getBCHDigit(g)-r;return p<<12|g}}),Io=J(e=>{var t=Pe(),a=1335,n=21522,i=t.getBCHDigit(a);e.getEncodedBits=function(l,o){let r=l.bit<<3|o,s=r<<10;for(;t.getBCHDigit(s)-i>=0;)s^=a<<t.getBCHDigit(s)-i;return(r<<10|s)^n}}),Lo=J((e,t)=>{var a=ze();function n(i){this.mode=a.NUMERIC,this.data=i.toString()}n.getBitsLength=function(i){return 10*Math.floor(i/3)+(i%3?i%3*3+1:0)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(i){let l,o,r;for(l=0;l+3<=this.data.length;l+=3)o=this.data.substr(l,3),r=parseInt(o,10),i.put(r,10);let s=this.data.length-l;s>0&&(o=this.data.substr(l),r=parseInt(o,10),i.put(r,s*3+1))},t.exports=n}),Ao=J((e,t)=>{var a=ze(),n=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function i(l){this.mode=a.ALPHANUMERIC,this.data=l}i.getBitsLength=function(l){return 11*Math.floor(l/2)+6*(l%2)},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(l){let o;for(o=0;o+2<=this.data.length;o+=2){let r=n.indexOf(this.data[o])*45;r+=n.indexOf(this.data[o+1]),l.put(r,11)}this.data.length%2&&l.put(n.indexOf(this.data[o]),6)},t.exports=i}),Po=J((e,t)=>{var a=ze();function n(i){this.mode=a.BYTE,typeof i=="string"?this.data=new TextEncoder().encode(i):this.data=new Uint8Array(i)}n.getBitsLength=function(i){return i*8},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(i){for(let l=0,o=this.data.length;l<o;l++)i.put(this.data[l],8)},t.exports=n}),zo=J((e,t)=>{var a=ze(),n=Pe();function i(l){this.mode=a.KANJI,this.data=l}i.getBitsLength=function(l){return l*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(l){let o;for(o=0;o<this.data.length;o++){let r=n.toSJIS(this.data[o]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[o]+`
|
|
4
|
+
Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),l.put(r,13)}},t.exports=i}),Bo=J((e,t)=>{"use strict";var a={single_source_shortest_paths:function(n,i,l){var o={},r={};r[i]=0;var s=a.PriorityQueue.make();s.push(i,0);for(var d,f,c,p,g,m,h,b,j;!s.empty();){d=s.pop(),f=d.value,p=d.cost,g=n[f]||{};for(c in g)g.hasOwnProperty(c)&&(m=g[c],h=p+m,b=r[c],j=typeof r[c]>"u",(j||b>h)&&(r[c]=h,s.push(c,h),o[c]=f))}if(typeof l<"u"&&typeof r[l]>"u"){var w=["Could not find a path from ",i," to ",l,"."].join("");throw new Error(w)}return o},extract_shortest_path_from_predecessor_list:function(n,i){for(var l=[],o=i,r;o;)l.push(o),r=n[o],o=n[o];return l.reverse(),l},find_path:function(n,i,l){var o=a.single_source_shortest_paths(n,i,l);return a.extract_shortest_path_from_predecessor_list(o,l)},PriorityQueue:{make:function(n){var i=a.PriorityQueue,l={},o;n=n||{};for(o in i)i.hasOwnProperty(o)&&(l[o]=i[o]);return l.queue=[],l.sorter=n.sorter||i.default_sorter,l},default_sorter:function(n,i){return n.cost-i.cost},push:function(n,i){var l={value:n,cost:i};this.queue.push(l),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof t<"u"&&(t.exports=a)}),No=J(e=>{var t=ze(),a=Lo(),n=Ao(),i=Po(),l=zo(),o=Cn(),r=Pe(),s=Bo();function d(j){return unescape(encodeURIComponent(j)).length}function f(j,w,y){let u=[],v;for(;(v=j.exec(y))!==null;)u.push({data:v[0],index:v.index,mode:w,length:v[0].length});return u}function c(j){let w=f(o.NUMERIC,t.NUMERIC,j),y=f(o.ALPHANUMERIC,t.ALPHANUMERIC,j),u,v;return r.isKanjiModeEnabled()?(u=f(o.BYTE,t.BYTE,j),v=f(o.KANJI,t.KANJI,j)):(u=f(o.BYTE_KANJI,t.BYTE,j),v=[]),w.concat(y,u,v).sort(function(T,D){return T.index-D.index}).map(function(T){return{data:T.data,mode:T.mode,length:T.length}})}function p(j,w){switch(w){case t.NUMERIC:return a.getBitsLength(j);case t.ALPHANUMERIC:return n.getBitsLength(j);case t.KANJI:return l.getBitsLength(j);case t.BYTE:return i.getBitsLength(j)}}function g(j){return j.reduce(function(w,y){let u=w.length-1>=0?w[w.length-1]:null;return u&&u.mode===y.mode?(w[w.length-1].data+=y.data,w):(w.push(y),w)},[])}function m(j){let w=[];for(let y=0;y<j.length;y++){let u=j[y];switch(u.mode){case t.NUMERIC:w.push([u,{data:u.data,mode:t.ALPHANUMERIC,length:u.length},{data:u.data,mode:t.BYTE,length:u.length}]);break;case t.ALPHANUMERIC:w.push([u,{data:u.data,mode:t.BYTE,length:u.length}]);break;case t.KANJI:w.push([u,{data:u.data,mode:t.BYTE,length:d(u.data)}]);break;case t.BYTE:w.push([{data:u.data,mode:t.BYTE,length:d(u.data)}])}}return w}function h(j,w){let y={},u={start:{}},v=["start"];for(let T=0;T<j.length;T++){let D=j[T],x=[];for(let z=0;z<D.length;z++){let S=D[z],M=""+T+z;x.push(M),y[M]={node:S,lastCount:0},u[M]={};for(let I=0;I<v.length;I++){let A=v[I];y[A]&&y[A].node.mode===S.mode?(u[A][M]=p(y[A].lastCount+S.length,S.mode)-p(y[A].lastCount,S.mode),y[A].lastCount+=S.length):(y[A]&&(y[A].lastCount=S.length),u[A][M]=p(S.length,S.mode)+4+t.getCharCountIndicator(S.mode,w))}}v=x}for(let T=0;T<v.length;T++)u[v[T]].end=0;return{map:u,table:y}}function b(j,w){let y,u=t.getBestModeForData(j);if(y=t.from(w,u),y!==t.BYTE&&y.bit<u.bit)throw new Error('"'+j+'" cannot be encoded with mode '+t.toString(y)+`.
|
|
5
|
+
Suggested mode is: `+t.toString(u));switch(y===t.KANJI&&!r.isKanjiModeEnabled()&&(y=t.BYTE),y){case t.NUMERIC:return new a(j);case t.ALPHANUMERIC:return new n(j);case t.KANJI:return new l(j);case t.BYTE:return new i(j)}}e.fromArray=function(j){return j.reduce(function(w,y){return typeof y=="string"?w.push(b(y,null)):y.data&&w.push(b(y.data,y.mode)),w},[])},e.fromString=function(j,w){let y=c(j,r.isKanjiModeEnabled()),u=m(y),v=h(u,w),T=s.find_path(v.map,"start","end"),D=[];for(let x=1;x<T.length-1;x++)D.push(v.table[T[x]].node);return e.fromArray(g(D))},e.rawSplit=function(j){return e.fromArray(c(j,r.isKanjiModeEnabled()))}}),Ro=J(e=>{var t=Pe(),a=Zt(),n=jo(),i=ko(),l=xo(),o=So(),r=Do(),s=Tn(),d=Co(),f=Eo(),c=Io(),p=ze(),g=No();function m(D,x){let z=D.size,S=o.getPositions(x);for(let M=0;M<S.length;M++){let I=S[M][0],A=S[M][1];for(let V=-1;V<=7;V++)if(!(I+V<=-1||z<=I+V))for(let H=-1;H<=7;H++)A+H<=-1||z<=A+H||(V>=0&&V<=6&&(H===0||H===6)||H>=0&&H<=6&&(V===0||V===6)||V>=2&&V<=4&&H>=2&&H<=4?D.set(I+V,A+H,!0,!0):D.set(I+V,A+H,!1,!0))}}function h(D){let x=D.size;for(let z=8;z<x-8;z++){let S=z%2===0;D.set(z,6,S,!0),D.set(6,z,S,!0)}}function b(D,x){let z=l.getPositions(x);for(let S=0;S<z.length;S++){let M=z[S][0],I=z[S][1];for(let A=-2;A<=2;A++)for(let V=-2;V<=2;V++)A===-2||A===2||V===-2||V===2||A===0&&V===0?D.set(M+A,I+V,!0,!0):D.set(M+A,I+V,!1,!0)}}function j(D,x){let z=D.size,S=f.getEncodedBits(x),M,I,A;for(let V=0;V<18;V++)M=Math.floor(V/3),I=V%3+z-8-3,A=(S>>V&1)===1,D.set(M,I,A,!0),D.set(I,M,A,!0)}function w(D,x,z){let S=D.size,M=c.getEncodedBits(x,z),I,A;for(I=0;I<15;I++)A=(M>>I&1)===1,I<6?D.set(I,8,A,!0):I<8?D.set(I+1,8,A,!0):D.set(S-15+I,8,A,!0),I<8?D.set(8,S-I-1,A,!0):I<9?D.set(8,15-I-1+1,A,!0):D.set(8,15-I-1,A,!0);D.set(S-8,8,1,!0)}function y(D,x){let z=D.size,S=-1,M=z-1,I=7,A=0;for(let V=z-1;V>0;V-=2)for(V===6&&V--;;){for(let H=0;H<2;H++)if(!D.isReserved(M,V-H)){let Y=!1;A<x.length&&(Y=(x[A]>>>I&1)===1),D.set(M,V-H,Y),I--,I===-1&&(A++,I=7)}if(M+=S,M<0||z<=M){M-=S,S=-S;break}}}function u(D,x,z){let S=new n;z.forEach(function(H){S.put(H.mode.bit,4),S.put(H.getLength(),p.getCharCountIndicator(H.mode,D)),H.write(S)});let M=t.getSymbolTotalCodewords(D),I=s.getTotalCodewordsCount(D,x),A=(M-I)*8;for(S.getLengthInBits()+4<=A&&S.put(0,4);S.getLengthInBits()%8!==0;)S.putBit(0);let V=(A-S.getLengthInBits())/8;for(let H=0;H<V;H++)S.put(H%2?17:236,8);return v(S,D,x)}function v(D,x,z){let S=t.getSymbolTotalCodewords(x),M=s.getTotalCodewordsCount(x,z),I=S-M,A=s.getBlocksCount(x,z),V=S%A,H=A-V,Y=Math.floor(S/A),X=Math.floor(I/A),R=X+1,F=Y-X,U=new d(F),te=0,Q=new Array(A),le=new Array(A),P=0,O=new Uint8Array(D.buffer);for(let B=0;B<A;B++){let $=B<H?X:R;Q[B]=O.slice(te,te+$),le[B]=U.encode(Q[B]),te+=$,P=Math.max(P,$)}let W=new Uint8Array(S),ne=0,k,E;for(k=0;k<P;k++)for(E=0;E<A;E++)k<Q[E].length&&(W[ne++]=Q[E][k]);for(k=0;k<F;k++)for(E=0;E<A;E++)W[ne++]=le[E][k];return W}function T(D,x,z,S){let M;if(Array.isArray(D))M=g.fromArray(D);else if(typeof D=="string"){let Y=x;if(!Y){let X=g.rawSplit(D);Y=f.getBestVersionForData(X,z)}M=g.fromString(D,Y||40)}else throw new Error("Invalid data");let I=f.getBestVersionForData(M,z);if(!I)throw new Error("The amount of data is too big to be stored in a QR Code");if(!x)x=I;else if(x<I)throw new Error(`
|
|
6
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
7
|
+
Minimum version required to store current data is: `+I+`.
|
|
8
|
+
`);let A=u(x,z,M),V=t.getSymbolSize(x),H=new i(V);return m(H,x),h(H),b(H,x),w(H,z,0),x>=7&&j(H,x),y(H,A),isNaN(S)&&(S=r.getBestMask(H,w.bind(null,H,z))),r.applyMask(S,H),w(H,z,S),{modules:H,version:x,errorCorrectionLevel:z,maskPattern:S,segments:M}}e.create=function(D,x){if(typeof D>"u"||D==="")throw new Error("No input text");let z=a.M,S,M;return typeof x<"u"&&(z=a.from(x.errorCorrectionLevel,a.M),S=f.from(x.version),M=r.from(x.maskPattern),x.toSJISFunc&&t.setToSJISFunction(x.toSJISFunc)),T(D,S,z,M)}}),En=J(e=>{function t(a){if(typeof a=="number"&&(a=a.toString()),typeof a!="string")throw new Error("Color should be defined as hex string");let n=a.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+a);(n.length===3||n.length===4)&&(n=Array.prototype.concat.apply([],n.map(function(l){return[l,l]}))),n.length===6&&n.push("F","F");let i=parseInt(n.join(""),16);return{r:i>>24&255,g:i>>16&255,b:i>>8&255,a:i&255,hex:"#"+n.slice(0,6).join("")}}e.getOptions=function(a){a||(a={}),a.color||(a.color={});let n=typeof a.margin>"u"||a.margin===null||a.margin<0?4:a.margin,i=a.width&&a.width>=21?a.width:void 0,l=a.scale||4;return{width:i,scale:i?4:l,margin:n,color:{dark:t(a.color.dark||"#000000ff"),light:t(a.color.light||"#ffffffff")},type:a.type,rendererOpts:a.rendererOpts||{}}},e.getScale=function(a,n){return n.width&&n.width>=a+n.margin*2?n.width/(a+n.margin*2):n.scale},e.getImageWidth=function(a,n){let i=e.getScale(a,n);return Math.floor((a+n.margin*2)*i)},e.qrToImageData=function(a,n,i){let l=n.modules.size,o=n.modules.data,r=e.getScale(l,i),s=Math.floor((l+i.margin*2)*r),d=i.margin*r,f=[i.color.light,i.color.dark];for(let c=0;c<s;c++)for(let p=0;p<s;p++){let g=(c*s+p)*4,m=i.color.light;if(c>=d&&p>=d&&c<s-d&&p<s-d){let h=Math.floor((c-d)/r),b=Math.floor((p-d)/r);m=f[o[h*l+b]?1:0]}a[g++]=m.r,a[g++]=m.g,a[g++]=m.b,a[g]=m.a}}}),Vo=J(e=>{var t=En();function a(i,l,o){i.clearRect(0,0,l.width,l.height),l.style||(l.style={}),l.height=o,l.width=o,l.style.height=o+"px",l.style.width=o+"px"}function n(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(i,l,o){let r=o,s=l;typeof r>"u"&&(!l||!l.getContext)&&(r=l,l=void 0),l||(s=n()),r=t.getOptions(r);let d=t.getImageWidth(i.modules.size,r),f=s.getContext("2d"),c=f.createImageData(d,d);return t.qrToImageData(c.data,i,r),a(f,s,d),f.putImageData(c,0,0),s},e.renderToDataURL=function(i,l,o){let r=o;typeof r>"u"&&(!l||!l.getContext)&&(r=l,l=void 0),r||(r={});let s=e.render(i,l,r),d=r.type||"image/png",f=r.rendererOpts||{};return s.toDataURL(d,f.quality)}}),Ho=J(e=>{var t=En();function a(l,o){let r=l.a/255,s=o+'="'+l.hex+'"';return r<1?s+" "+o+'-opacity="'+r.toFixed(2).slice(1)+'"':s}function n(l,o,r){let s=l+o;return typeof r<"u"&&(s+=" "+r),s}function i(l,o,r){let s="",d=0,f=!1,c=0;for(let p=0;p<l.length;p++){let g=Math.floor(p%o),m=Math.floor(p/o);!g&&!f&&(f=!0),l[p]?(c++,p>0&&g>0&&l[p-1]||(s+=f?n("M",g+r,.5+m+r):n("m",d,0),d=0,f=!1),g+1<o&&l[p+1]||(s+=n("h",c),c=0)):d++}return s}e.render=function(l,o,r){let s=t.getOptions(o),d=l.modules.size,f=l.modules.data,c=d+s.margin*2,p=s.color.light.a?"<path "+a(s.color.light,"fill")+' d="M0 0h'+c+"v"+c+'H0z"/>':"",g="<path "+a(s.color.dark,"stroke")+' d="'+i(f,d,s.margin)+'"/>',m='viewBox="0 0 '+c+" "+c+'"',h='<svg xmlns="http://www.w3.org/2000/svg" '+(s.width?'width="'+s.width+'" height="'+s.width+'" ':"")+m+' shape-rendering="crispEdges">'+p+g+`</svg>
|
|
9
|
+
`;return typeof r=="function"&&r(null,h),h}}),Oo=J(e=>{var t=wo(),a=Ro(),n=Vo(),i=Ho();function l(o,r,s,d,f){let c=[].slice.call(arguments,1),p=c.length,g=typeof c[p-1]=="function";if(!g&&!t())throw new Error("Callback required as last argument");if(g){if(p<2)throw new Error("Too few arguments provided");p===2?(f=s,s=r,r=d=void 0):p===3&&(r.getContext&&typeof f>"u"?(f=d,d=void 0):(f=d,d=s,s=r,r=void 0))}else{if(p<1)throw new Error("Too few arguments provided");return p===1?(s=r,r=d=void 0):p===2&&!r.getContext&&(d=s,s=r,r=void 0),new Promise(function(m,h){try{let b=a.create(s,d);m(o(b,r,d))}catch(b){h(b)}})}try{let m=a.create(s,d);f(null,o(m,r,d))}catch(m){f(m)}}e.create=a.create,e.toCanvas=l.bind(null,n.render),e.toDataURL=l.bind(null,n.renderToDataURL),e.toString=l.bind(null,function(o,r,s){return i.render(o,s)})}),$o=Oo()});var nl={grid:"M3 3h7v7H3zM14 3h7v7h-7zM14 14h7v7h-7zM3 14h7v7H3z",users:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M13 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0M22 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75",shield:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10zM9 12l2 2 4-4",search:"M19 11a8 8 0 1 1-16 0 8 8 0 0 1 16 0zM21 21l-4.35-4.35",bell:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9M13.73 21a2 2 0 0 1-3.46 0","chevron-down":"M6 9l6 6 6-6","chevron-up":"M6 15l6-6 6 6","chevron-right":"M9 18l6-6-6-6","chevron-left":"M15 18l-6-6 6-6","chevrons-left":"M11 17l-5-5 5-5M18 17l-5-5 5-5","chevrons-right":"M13 17l5-5-5-5M6 17l5-5-5-5",menu:"M3 6h18M3 12h18M3 18h18",plus:"M12 5v14M5 12h14",minus:"M5 12h14",download:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3",upload:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12",trash:"M3 6h18M8 6V4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6M10 11v6M14 11v6",refresh:"M23 4v6h-6M1 20v-6h6M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15",sliders:"M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1 14h6M9 8h6M17 16h6",x:"M18 6L6 18M6 6l12 12",edit:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7M18.5 2.5a2.12 2.12 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z",lock:"M5 11h14v10H5zM8 11V7a4 4 0 1 1 8 0v4","log-out":"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9",clock:"M12 22a10 10 0 1 1 0-20 10 10 0 0 1 0 20zM12 6v6l4 2",filter:"M22 3H2l8 9.46V19l4 2v-8.54L22 3z",check:"M20 6L9 17l-5-5",info:"M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20M12 16v-5M12 8h.01",alert:"M12 9v4M12 17h.01M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z","arrow-up":"M12 19V5M5 12l7-7 7 7","arrow-down":"M12 5v14M19 12l-7 7-7-7",layers:"M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5",clipboard:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2M9 4h6v3H9zM8 12h8M8 16h5",table:"M3 4h18v16H3zM3 10h18M3 16h18M9 4v16M15 4v16",message:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",calendar:"M4 5h16v16H4zM8 3v4M16 3v4M4 10h16",image:"M3 5h18v14H3zM8.5 11a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M21 15l-5-5L5 21",file:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8zM14 2v6h6",grip:"M9 5h.01M15 5h.01M9 12h.01M15 12h.01M9 19h.01M15 19h.01",printer:"M6 9V3h12v6M6 18H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2M6 14h12v7H6z",code:"M16 18l6-6-6-6M8 6l-6 6 6 6",eye:"M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12zM15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0","eye-off":"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19M14.12 14.12a3 3 0 1 1-4.24-4.24M1 1l22 22",link:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07L12 4.5M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07L14 19.5",folder:"M3 5h6l2 2h10v12H3z",layout:"M3 3h18v18H3zM3 9h18M9 9v12","bar-chart":"M4 20V10M10 20V4M16 20v-6M22 20H2",maximize:"M8 3H5a2 2 0 0 0-2 2v3M16 3h3a2 2 0 0 1 2 2v3M8 21H5a2 2 0 0 1-2-2v-3M16 21h3a2 2 0 0 0 2-2v-3",minimize:"M5 12h14",columns:"M3 4h18v16H3zM9 4v16M15 4v16",monitor:"M3 4h18v12H3zM8 20h8M12 16v4",mail:"M4 5h16v14H4zM4 7l8 6 8-6",phone:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0 1 22 16.92z","user-plus":"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M13 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0M19 8v6M22 11h-6","shield-off":"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10zM4 4l16 16",activity:"M22 12h-4l-3 9L9 3l-3 9H2",database:"M12 8c4.42 0 8-1.34 8-3s-3.58-3-8-3-8 1.34-8 3 3.58 3 8 3zM4 5v14c0 1.66 3.58 3 8 3s8-1.34 8-3V5M4 12c0 1.66 3.58 3 8 3s8-1.34 8-3",sun:"M12 17a5 5 0 1 0 0-10 5 5 0 0 0 0 10zM12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42",moon:"M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"},L={name:"DjmIcon",props:{name:{type:String,required:!0},size:{type:[Number,String],default:16}},computed:{d(){return nl[this.name]||""}},template:`
|
|
10
|
+
<svg
|
|
11
|
+
class="djm-icon"
|
|
12
|
+
:width="size"
|
|
13
|
+
:height="size"
|
|
14
|
+
viewBox="0 0 24 24"
|
|
15
|
+
fill="none"
|
|
16
|
+
stroke="currentColor"
|
|
17
|
+
stroke-width="1.7"
|
|
18
|
+
stroke-linecap="round"
|
|
19
|
+
stroke-linejoin="round"
|
|
20
|
+
aria-hidden="true"
|
|
21
|
+
><path :d="d" /></svg>
|
|
22
|
+
`};var ya={name:"DjmButton",components:{DjmIcon:L},props:{variant:{type:String,default:""},size:{type:String,default:""},icon:{type:String,default:""},loading:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},ariaLabel:{type:String,default:""},nativeType:{type:String,default:"button"}},emits:["click"],computed:{classes(){return["djm-btn",this.variant?"djm-btn-"+this.variant:"",this.size?"djm-btn-"+this.size:""].filter(Boolean)}},template:`
|
|
23
|
+
<button
|
|
24
|
+
:class="classes"
|
|
25
|
+
:type="nativeType"
|
|
26
|
+
:disabled="disabled || loading"
|
|
27
|
+
:aria-label="ariaLabel || undefined"
|
|
28
|
+
@click="$emit('click', $event)"
|
|
29
|
+
>
|
|
30
|
+
<span v-if="loading" class="djm-spinner djm-spinner-light"></span>
|
|
31
|
+
<DjmIcon v-else-if="icon" :name="icon" />
|
|
32
|
+
<slot></slot>
|
|
33
|
+
</button>
|
|
34
|
+
`};var pe={name:"DjmInput",components:{DjmIcon:L},props:{modelValue:{type:[String,Number],default:""},type:{type:String,default:"text"},placeholder:{type:String,default:""},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},invalid:{type:Boolean,default:!1},autocomplete:{type:String,default:"off"},clearable:{type:Boolean,default:!1},maxlength:{type:Number,default:0},showWordLimit:{type:Boolean,default:!1},ariaLabel:{type:String,default:""}},emits:["update:modelValue","input","change","enter","focus","blur","clear"],computed:{classes(){return["djm-input",{"djm-is-invalid":this.invalid,"djm-has-affix":this.hasAffix}]},hasAffix(){return this.clearable||this.maxlength>0&&this.showWordLimit},showClear(){return this.clearable&&!this.disabled&&!this.readonly&&String(this.modelValue??"").length>0},showCount(){return this.maxlength>0&&this.showWordLimit&&!this.showClear},wordCount(){return String(this.modelValue??"").length},maxlengthAttr(){return this.maxlength>0?this.maxlength:void 0}},methods:{onInput(e){this.$emit("update:modelValue",e.target.value),this.$emit("input",e)},clear(){this.$emit("update:modelValue",""),this.$emit("clear"),this.$emit("change",""),this.focus()},focus(){this.$refs.input&&this.$refs.input.focus()},blur(){this.$refs.input&&this.$refs.input.blur()}},template:`
|
|
35
|
+
<div v-if="hasAffix" class="djm-input-wrap">
|
|
36
|
+
<input
|
|
37
|
+
ref="input"
|
|
38
|
+
:class="classes"
|
|
39
|
+
:type="type"
|
|
40
|
+
:value="modelValue"
|
|
41
|
+
:placeholder="placeholder"
|
|
42
|
+
:disabled="disabled"
|
|
43
|
+
:readonly="readonly"
|
|
44
|
+
:autocomplete="autocomplete"
|
|
45
|
+
:maxlength="maxlengthAttr"
|
|
46
|
+
:aria-label="ariaLabel || undefined"
|
|
47
|
+
:aria-invalid="invalid ? 'true' : undefined"
|
|
48
|
+
@input="onInput"
|
|
49
|
+
@change="$emit('change', $event)"
|
|
50
|
+
@keyup.enter="$emit('enter', $event)"
|
|
51
|
+
@focus="$emit('focus', $event)"
|
|
52
|
+
@blur="$emit('blur', $event)"
|
|
53
|
+
/>
|
|
54
|
+
<button
|
|
55
|
+
v-if="showClear"
|
|
56
|
+
class="djm-input-clear"
|
|
57
|
+
type="button"
|
|
58
|
+
aria-label="\u6E05\u7A7A\u8F93\u5165"
|
|
59
|
+
@click="clear"
|
|
60
|
+
>
|
|
61
|
+
<DjmIcon name="x" :size="12" />
|
|
62
|
+
</button>
|
|
63
|
+
<span v-else-if="showCount" class="djm-input-count">{{ wordCount }}/{{ maxlength }}</span>
|
|
64
|
+
</div>
|
|
65
|
+
<input
|
|
66
|
+
v-else
|
|
67
|
+
ref="input"
|
|
68
|
+
:class="classes"
|
|
69
|
+
:type="type"
|
|
70
|
+
:value="modelValue"
|
|
71
|
+
:placeholder="placeholder"
|
|
72
|
+
:disabled="disabled"
|
|
73
|
+
:readonly="readonly"
|
|
74
|
+
:autocomplete="autocomplete"
|
|
75
|
+
:maxlength="maxlengthAttr"
|
|
76
|
+
:aria-label="ariaLabel || undefined"
|
|
77
|
+
:aria-invalid="invalid ? 'true' : undefined"
|
|
78
|
+
@input="onInput"
|
|
79
|
+
@change="$emit('change', $event)"
|
|
80
|
+
@keyup.enter="$emit('enter', $event)"
|
|
81
|
+
@focus="$emit('focus', $event)"
|
|
82
|
+
@blur="$emit('blur', $event)"
|
|
83
|
+
/>
|
|
84
|
+
`};import{computed as re,nextTick as nt,onBeforeUnmount as ol,ref as be,watch as rl}from"vue";import{reactive as il}from"vue";var Qe={"common.close":"\u5173\u95ED","common.cancel":"\u53D6\u6D88","common.confirm":"\u786E\u5B9A","common.selected":"\u5DF2\u9009 {count} \u9879","common.dialog":"\u5BF9\u8BDD\u6846","common.noOptions":"\u6682\u65E0\u9009\u9879","common.removeTag":"\u79FB\u9664\u6807\u7B7E","pagination.total":"\u5171 {total} \u6761","pagination.pageSize":"\u6BCF\u9875 {size} \u6761","pagination.jump":"\u8DF3\u81F3","pagination.pageUnit":"\u9875","pagination.first":"\u9996\u9875","pagination.prev":"\u4E0A\u4E00\u9875","pagination.next":"\u4E0B\u4E00\u9875","pagination.last":"\u672B\u9875","pagination.page":"\u7B2C {page} \u9875","pagination.pageSizeLabel":"\u6BCF\u9875\u6761\u6570","pagination.jumpLabel":"\u8DF3\u81F3\u9875\u7801","table.loading":"\u6B63\u5728\u52A0\u8F7D\u6570\u636E\u2026","table.empty":"\u6682\u65E0\u6570\u636E","table.selectAll":"\u5168\u9009\u5F53\u524D\u9875","table.selectRow":"\u9009\u62E9\u8BE5\u884C","table.scrollRegion":"\u8868\u683C\u6570\u636E\u533A","empty.title":"\u6682\u65E0\u6570\u636E","datePicker.placeholder":"\u9009\u62E9\u65E5\u671F","datePicker.rangePlaceholder":"\u9009\u62E9\u65E5\u671F\u8303\u56F4","datePicker.rangeEnd":"\u7ED3\u675F\u65E5\u671F","datePicker.today":"\u4ECA\u5929","datePicker.clear":"\u6E05\u7A7A","datePicker.title":"{year} \u5E74 {month} \u6708","datePicker.weeks":"\u4E00,\u4E8C,\u4E09,\u56DB,\u4E94,\u516D,\u65E5","calendar.title":"{year} \u5E74 {month} \u6708","calendar.prevMonth":"\u4E0A\u4E00\u6708","calendar.nextMonth":"\u4E0B\u4E00\u6708","calendar.grid":"\u65E5\u671F","treeSelect.placeholder":"\u8BF7\u9009\u62E9","treeSelect.search":"\u641C\u7D22\u8282\u70B9","treeSelect.empty":"\u6CA1\u6709\u5339\u914D\u7684\u8282\u70B9","treeSelect.clear":"\u6E05\u7A7A","treeSelect.clearSearch":"\u6E05\u7A7A\u641C\u7D22","treeSelect.remove":"\u79FB\u9664 {label}","treeSelect.expand":"\u5C55\u5F00","treeSelect.collapse":"\u6536\u8D77","cascader.empty":"\u6682\u65E0\u9009\u9879","steps.order":"\u7B2C {index} \u6B65","password.aria":"\u5BC6\u7801","password.show":"\u663E\u793A\u5BC6\u7801","password.hide":"\u9690\u85CF\u5BC6\u7801","password.weak":"\u5F31","password.medium":"\u4E2D","password.strong":"\u5F3A","password.hint":"\u81F3\u5C11 8 \u4F4D\uFF0C\u5EFA\u8BAE\u6DF7\u5408\u5927\u5C0F\u5199\u4E0E\u7B26\u53F7","password.strength":"\u5BC6\u7801\u5F3A\u5EA6\uFF1A{level}","contextMenu.empty":"\u6CA1\u6709\u53EF\u6267\u884C\u7684\u64CD\u4F5C","tree.empty":"\u6682\u65E0\u8282\u70B9","confirm.title":"\u64CD\u4F5C\u786E\u8BA4","confirm.confirm":"\u786E\u5B9A","confirm.cancel":"\u53D6\u6D88","upload.dropText":"\u62D6\u62FD\u6587\u4EF6\u5230\u8FD9\u91CC\uFF0C\u6216\u70B9\u51FB\u9009\u62E9","upload.dropHint":"\u652F\u6301\u591A\u9009\uFF0C\u53EF\u62D6\u62FD\u6216\u70B9\u51FB\u4E0A\u4F20","upload.select":"\u9009\u62E9\u6587\u4EF6","upload.count":"\u5DF2\u6DFB\u52A0 {count} \u4E2A\u6587\u4EF6","upload.clear":"\u5168\u90E8\u79FB\u9664","upload.empty":"\u5C1A\u672A\u9009\u62E9\u6587\u4EF6","upload.uploading":"\u4E0A\u4F20\u4E2D {percent}%","upload.done":"\u4E0A\u4F20\u5B8C\u6210","upload.ready":"\u5F85\u4E0A\u4F20","upload.failed":"\u4E0A\u4F20\u5931\u8D25","upload.retry":"\u91CD\u8BD5","upload.start":"\u4E0A\u4F20","upload.remove":"\u79FB\u9664","upload.limitHint":"\u6700\u591A {count} \u4E2A\u6587\u4EF6","upload.sizeHint":"\u5355\u4E2A\u4E0D\u8D85\u8FC7 {size}","select.placeholder":"\u8BF7\u9009\u62E9","select.empty":"\u65E0\u5339\u914D\u9879","select.clear":"\u6E05\u7A7A","orgPicker.placeholder":"\u9009\u62E9\u4EBA\u5458","orgPicker.title":"\u9009\u62E9\u4EBA\u5458","orgPicker.search":"\u641C\u7D22\u59D3\u540D\u6216\u804C\u4F4D","orgPicker.deptTree":"\u90E8\u95E8","orgPicker.allStaff":"\u5168\u90E8\u4EBA\u5458","orgPicker.expand":"\u5C55\u5F00\u6216\u6536\u8D77\u90E8\u95E8","orgPicker.selected":"\u5DF2\u9009 {count} \u4EBA","orgPicker.clearSelected":"\u6E05\u7A7A\u5DF2\u9009","orgPicker.clear":"\u6E05\u7A7A","orgPicker.empty":"\u6CA1\u6709\u5339\u914D\u7684\u4EBA\u5458","queryFilter.search":"\u67E5\u8BE2","queryFilter.reset":"\u91CD\u7F6E","queryFilter.expand":"\u5C55\u5F00","queryFilter.collapse":"\u6536\u8D77","mediaPicker.select":"\u9009\u62E9\u7D20\u6750","mediaPicker.title":"\u5A92\u4F53\u5E93","mediaPicker.search":"\u641C\u7D22\u7D20\u6750\u540D\u79F0","mediaPicker.empty":"\u6CA1\u6709\u5339\u914D\u7684\u7D20\u6750","mediaPicker.total":"\u5171 {total} \u4E2A\u7D20\u6750","mediaPicker.limit":"\u6700\u591A\u9009 {limit} \u4E2A","image.preview":"\u9884\u89C8\u56FE\u7247","image.close":"\u5173\u95ED\u9884\u89C8","image.dialog":"\u56FE\u7247\u9884\u89C8","image.failed":"\u56FE\u7247\u52A0\u8F7D\u5931\u8D25","tour.label":"\u64CD\u4F5C\u5F15\u5BFC","tour.close":"\u5173\u95ED\u5F15\u5BFC","tour.prev":"\u4E0A\u4E00\u6B65","tour.next":"\u4E0B\u4E00\u6B65","tour.finish":"\u5B8C\u6210","richEditor.aria":"\u5BCC\u6587\u672C\u7F16\u8F91\u5668","richEditor.placeholder":"\u8BF7\u8F93\u5165\u5185\u5BB9\u2026","richEditor.bold":"\u52A0\u7C97","richEditor.italic":"\u659C\u4F53","richEditor.underline":"\u4E0B\u5212\u7EBF","richEditor.strike":"\u5220\u9664\u7EBF","richEditor.heading":"\u4E8C\u7EA7\u6807\u9898","richEditor.paragraph":"\u6B63\u6587","richEditor.bulletList":"\u65E0\u5E8F\u5217\u8868","richEditor.numberList":"\u6709\u5E8F\u5217\u8868","richEditor.link":"\u63D2\u5165\u94FE\u63A5","richEditor.linkPrompt":"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740","richEditor.clearFormat":"\u6E05\u9664","richEditor.undo":"\u64A4\u9500","richEditor.redo":"\u91CD\u505A","richEditor.source":"\u6E90\u7801","richEditor.visual":"\u53EF\u89C6\u5316","approval.start":"\u53D1\u8D77","approval.cc":"\u6284\u9001","approval.approved":"\u5DF2\u901A\u8FC7","approval.rejected":"\u5DF2\u9A73\u56DE","approval.pending":"\u5BA1\u6279\u4E2D","approval.waiting":"\u5F85\u5904\u7406","approval.empty":"\u6682\u65E0\u5BA1\u6279\u8BB0\u5F55","kanban.board":"\u770B\u677F","kanban.empty":"\u6682\u65E0\u5361\u7247","kanban.addCard":"\u65B0\u5EFA\u5361\u7247","attachment.empty":"\u6682\u65E0\u9644\u4EF6","attachment.preview":"\u9884\u89C8","attachment.download":"\u4E0B\u8F7D","attachment.remove":"\u5220\u9664","notification.unread":"\u672A\u8BFB {count} \u6761","notification.readAll":"\u5168\u90E8\u5DF2\u8BFB","notification.clear":"\u6E05\u7A7A","notification.clearConfirm":"\u786E\u8BA4\u6E05\u7A7A","notification.empty":"\u6682\u65E0\u901A\u77E5","dateTimePicker.placeholder":"\u9009\u62E9\u65E5\u671F\u65F6\u95F4","dateTimePicker.now":"\u6B64\u523B","dateTimePicker.clear":"\u6E05\u7A7A","dateTimePicker.prevMonth":"\u4E0A\u4E2A\u6708","dateTimePicker.nextMonth":"\u4E0B\u4E2A\u6708","virtualList.empty":"\u6682\u65E0\u6570\u636E","batchBar.selected":"\u5DF2\u9009 {count} \u9879","batchBar.selectAll":"\u5168\u9009 {total} \u9879","batchBar.clear":"\u53D6\u6D88\u9009\u62E9","importWizard.stepFile":"\u9009\u62E9\u6587\u4EF6","importWizard.stepMapping":"\u5B57\u6BB5\u6620\u5C04","importWizard.stepResult":"\u5BFC\u5165\u7ED3\u679C","importWizard.pick":"\u9009\u62E9\u6587\u4EF6","importWizard.dragTip":"\u628A\u6587\u4EF6\u62D6\u5230\u8FD9\u91CC\uFF0C\u6216\u70B9\u51FB\u9009\u62E9\uFF08{accept}\uFF09","importWizard.acceptError":"\u4EC5\u652F\u6301 {accept} \u683C\u5F0F","importWizard.sizeError":"\u6587\u4EF6\u4E0D\u80FD\u8D85\u8FC7 {size} MB","importWizard.reselect":"\u91CD\u65B0\u9009\u62E9","importWizard.sourcePlaceholder":"\u8BF7\u9009\u62E9\u5BF9\u5E94\u7684\u6587\u4EF6\u5B57\u6BB5","importWizard.missingRequired":"\u5FC5\u586B\u5B57\u6BB5\u672A\u6620\u5C04\uFF1A{fields}","importWizard.prev":"\u4E0A\u4E00\u6B65","importWizard.submit":"\u5F00\u59CB\u5BFC\u5165","importWizard.importing":"\u5BFC\u5165\u4E2D\u2026","importWizard.statTotal":"\u603B\u6761\u6570","importWizard.statSuccess":"\u6210\u529F","importWizard.statFailed":"\u5931\u8D25","importWizard.rowNo":"\u7B2C {row} \u884C","importWizard.retry":"\u8FD4\u56DE\u4FEE\u6539","importWizard.restart":"\u91CD\u65B0\u5BFC\u5165","diff.before":"\u4FEE\u6539\u524D","diff.after":"\u4FEE\u6539\u540E","diff.same":"\u5185\u5BB9\u4E00\u81F4","diff.expand":"\u5C55\u5F00 {count} \u884C\u672A\u53D8\u66F4\u5185\u5BB9","treeTable.empty":"\u6682\u65E0\u6570\u636E","treeTable.loading":"\u6B63\u5728\u52A0\u8F7D\u2026","treeTable.selectAll":"\u5168\u9009","treeTable.expand":"\u5C55\u5F00","treeTable.collapse":"\u6536\u8D77","schedule.title":"\u65E5\u7A0B","schedule.weekdays":"\u5468\u4E00,\u5468\u4E8C,\u5468\u4E09,\u5468\u56DB,\u5468\u4E94,\u5468\u516D,\u5468\u65E5","schedule.prevWeek":"\u4E0A\u4E00\u5468","schedule.nextWeek":"\u4E0B\u4E00\u5468","schedule.today":"\u672C\u5468","comment.placeholder":"\u8BF4\u70B9\u4EC0\u4E48\u2026","comment.replyPlaceholder":"\u56DE\u590D {name}","comment.replyingTo":"\u6B63\u5728\u56DE\u590D {name}","comment.cancelReply":"\u53D6\u6D88\u56DE\u590D","comment.submit":"\u53D1\u5E03","comment.submitting":"\u53D1\u5E03\u4E2D\u2026","comment.reply":"\u56DE\u590D","comment.remove":"\u5220\u9664","comment.empty":"\u8FD8\u6CA1\u6709\u8BC4\u8BBA","signature.label":"\u624B\u5199\u7B7E\u540D","signature.hint":"\u8BF7\u5728\u6B64\u5904\u7B7E\u540D","signature.clear":"\u6E05\u7A7A","print.button":"\u6253\u5370","gantt.task":"\u4EFB\u52A1","gantt.empty":"\u6682\u65E0\u4EFB\u52A1","fieldList.add":"\u6DFB\u52A0\u4E00\u884C","fieldList.remove":"\u5220\u9664\u8FD9\u4E00\u884C","fieldList.empty":"\u6682\u65E0\u6570\u636E","fieldList.select":"\u8BF7\u9009\u62E9","fieldList.required":"{label}\u4E0D\u80FD\u4E3A\u7A7A","chat.label":"\u6D88\u606F\u5217\u8868","chat.placeholder":"\u8F93\u5165\u6D88\u606F\uFF0CEnter \u53D1\u9001","chat.send":"\u53D1\u9001","chat.sending":"\u53D1\u9001\u4E2D\u2026","chat.failed":"\u53D1\u9001\u5931\u8D25","chat.empty":"\u6682\u65E0\u6D88\u606F","chat.image":"\u56FE\u7247\u6D88\u606F","chat.me":"\u6211","orgChart.empty":"\u6682\u65E0\u7EC4\u7EC7\u6570\u636E","orgChart.toggle":"\u5C55\u5F00\u6216\u6536\u8D77","pageTabs.label":"\u9875\u9762\u6807\u7B7E","pageTabs.close":"\u5173\u95ED"};var ba={"common.close":"Close","common.cancel":"Cancel","common.confirm":"OK","common.selected":"{count} selected","common.dialog":"Dialog","common.noOptions":"No options","common.removeTag":"Remove tag","pagination.total":"{total} items","pagination.pageSize":"{size} / page","pagination.jump":"Go to","pagination.pageUnit":"","pagination.first":"First","pagination.prev":"Previous","pagination.next":"Next","pagination.last":"Last","pagination.page":"Page {page}","pagination.pageSizeLabel":"Rows per page","pagination.jumpLabel":"Go to page","table.loading":"Loading\u2026","table.empty":"No data","table.selectAll":"Select all rows","table.selectRow":"Select row","table.scrollRegion":"Table data","empty.title":"No data","datePicker.placeholder":"Select date","datePicker.rangePlaceholder":"Select date range","datePicker.rangeEnd":"End date","datePicker.today":"Today","datePicker.clear":"Clear","datePicker.title":"{month}/{year}","datePicker.weeks":"Mo,Tu,We,Th,Fr,Sa,Su","calendar.title":"{month}/{year}","calendar.prevMonth":"Previous month","calendar.nextMonth":"Next month","calendar.grid":"Dates","treeSelect.placeholder":"Please select","treeSelect.search":"Search","treeSelect.empty":"No matching nodes","treeSelect.clear":"Clear","treeSelect.clearSearch":"Clear search","treeSelect.remove":"Remove {label}","treeSelect.expand":"Expand","treeSelect.collapse":"Collapse","cascader.empty":"No options","steps.order":"Step {index}","password.aria":"Password","password.show":"Show password","password.hide":"Hide password","password.weak":"Weak","password.medium":"Medium","password.strong":"Strong","password.hint":"At least 8 characters, mix upper and lower case with symbols","password.strength":"Password strength: {level}","contextMenu.empty":"No actions available","tree.empty":"No nodes","confirm.title":"Confirm","confirm.confirm":"OK","confirm.cancel":"Cancel","upload.dropText":"Drop files here, or click to select","upload.dropHint":"Multiple files supported","upload.select":"Select files","upload.count":"{count} files added","upload.clear":"Remove all","upload.empty":"No files selected","upload.uploading":"Uploading {percent}%","upload.done":"Uploaded","upload.ready":"Pending","upload.failed":"Upload failed","upload.retry":"Retry","upload.start":"Upload","upload.remove":"Remove","upload.limitHint":"Up to {count} files","upload.sizeHint":"Max {size} each","select.placeholder":"Please select","select.empty":"No matches","select.clear":"Clear","orgPicker.placeholder":"Select people","orgPicker.title":"Select people","orgPicker.search":"Search name or title","orgPicker.deptTree":"Departments","orgPicker.allStaff":"All people","orgPicker.expand":"Expand or collapse department","orgPicker.selected":"{count} selected","orgPicker.clearSelected":"Clear","orgPicker.clear":"Clear","orgPicker.empty":"No matching people","queryFilter.search":"Search","queryFilter.reset":"Reset","queryFilter.expand":"More","queryFilter.collapse":"Less","mediaPicker.select":"Choose asset","mediaPicker.title":"Media library","mediaPicker.search":"Search assets","mediaPicker.empty":"No matching assets","mediaPicker.total":"{total} assets","mediaPicker.limit":"up to {limit}","image.preview":"Preview image","image.close":"Close preview","image.dialog":"Image preview","image.failed":"Failed to load image","tour.label":"Guided tour","tour.close":"Close tour","tour.prev":"Previous","tour.next":"Next","tour.finish":"Done","richEditor.aria":"Rich text editor","richEditor.placeholder":"Type something\u2026","richEditor.bold":"Bold","richEditor.italic":"Italic","richEditor.underline":"Underline","richEditor.strike":"Strikethrough","richEditor.heading":"Heading 2","richEditor.paragraph":"Paragraph","richEditor.bulletList":"Bullet list","richEditor.numberList":"Numbered list","richEditor.link":"Insert link","richEditor.linkPrompt":"Enter link URL","richEditor.clearFormat":"Clear","richEditor.undo":"Undo","richEditor.redo":"Redo","richEditor.source":"Source","richEditor.visual":"Visual","approval.start":"Started","approval.cc":"CC","approval.approved":"Approved","approval.rejected":"Rejected","approval.pending":"In review","approval.waiting":"Waiting","approval.empty":"No approval records","kanban.board":"Kanban board","kanban.empty":"No cards","kanban.addCard":"Add card","attachment.empty":"No attachments","attachment.preview":"Preview","attachment.download":"Download","attachment.remove":"Remove","notification.unread":"{count} unread","notification.readAll":"Mark all read","notification.clear":"Clear all","notification.clearConfirm":"Confirm clear","notification.empty":"No notifications","dateTimePicker.placeholder":"Select date and time","dateTimePicker.now":"Now","dateTimePicker.clear":"Clear","dateTimePicker.prevMonth":"Previous month","dateTimePicker.nextMonth":"Next month","virtualList.empty":"No data","batchBar.selected":"{count} selected","batchBar.selectAll":"Select all {total}","batchBar.clear":"Clear selection","importWizard.stepFile":"Choose file","importWizard.stepMapping":"Map fields","importWizard.stepResult":"Result","importWizard.pick":"Choose a file","importWizard.dragTip":"Drop a file here or click to choose ({accept})","importWizard.acceptError":"Only {accept} files are allowed","importWizard.sizeError":"File must be under {size} MB","importWizard.reselect":"Choose another","importWizard.sourcePlaceholder":"Select a source column","importWizard.missingRequired":"Required fields not mapped: {fields}","importWizard.prev":"Back","importWizard.submit":"Start import","importWizard.importing":"Importing\u2026","importWizard.statTotal":"Total","importWizard.statSuccess":"Succeeded","importWizard.statFailed":"Failed","importWizard.rowNo":"Row {row}","importWizard.retry":"Back to edit","importWizard.restart":"Import again","diff.before":"Before","diff.after":"After","diff.same":"No changes","diff.expand":"Show {count} unchanged lines","treeTable.empty":"No data","treeTable.loading":"Loading\u2026","treeTable.selectAll":"Select all","treeTable.expand":"Expand","treeTable.collapse":"Collapse","schedule.title":"Schedule","schedule.weekdays":"Mon,Tue,Wed,Thu,Fri,Sat,Sun","schedule.prevWeek":"Previous week","schedule.nextWeek":"Next week","schedule.today":"This week","comment.placeholder":"Write a comment\u2026","comment.replyPlaceholder":"Reply to {name}","comment.replyingTo":"Replying to {name}","comment.cancelReply":"Cancel reply","comment.submit":"Post","comment.submitting":"Posting\u2026","comment.reply":"Reply","comment.remove":"Delete","comment.empty":"No comments yet","signature.label":"Signature","signature.hint":"Sign here","signature.clear":"Clear","print.button":"Print","gantt.task":"Task","gantt.empty":"No tasks","fieldList.add":"Add row","fieldList.remove":"Remove row","fieldList.empty":"No rows","fieldList.select":"Select","fieldList.required":"{label} is required","chat.label":"Messages","chat.placeholder":"Type a message, Enter to send","chat.send":"Send","chat.sending":"Sending\u2026","chat.failed":"Failed","chat.empty":"No messages","chat.image":"Image message","chat.me":"Me","orgChart.empty":"No organization data","orgChart.toggle":"Expand or collapse","pageTabs.label":"Page tabs","pageTabs.close":"Close"};var Ve=il({code:"zh-CN",messages:{"zh-CN":Qe,"en-US":ba}});function He(e){Ve.messages[e]&&(Ve.code=e)}function ll(){return Ve.code}function C(e,t){let a=Ve.messages[Ve.code]||Qe,n=e in a?a[e]:e in Qe?Qe[e]:e;return t&&Object.keys(t).forEach(i=>{n=n.split("{"+i+"}").join(t[i])}),n}var Z={position:"fixed",left:"0px",top:"0px",visibility:"hidden"};function G({root:e,panel:t,onClose:a,onReposition:n,esc:i=!0}){let l=s=>typeof s=="function"?s():s;function o(s){let d=l(e),f=l(t);d&&d.contains(s.target)||f&&f.contains(s.target)||a()}function r(s){s.key==="Escape"&&a()}return document.addEventListener("mousedown",o,!0),i&&document.addEventListener("keydown",r),n&&(window.addEventListener("resize",n),window.addEventListener("scroll",n,!0)),function(){document.removeEventListener("mousedown",o,!0),i&&document.removeEventListener("keydown",r),n&&(window.removeEventListener("resize",n),window.removeEventListener("scroll",n,!0))}}function se(e,t){return window.innerHeight-e.bottom<t+8&&e.top>t}function de({rect:e,flip:t,gap:a=4,width:n,clampWidth:i,maxHeight:l}){let o={position:"fixed",visibility:"visible"},r=e.left;return i!=null&&(r=Math.max(8,Math.min(e.left,window.innerWidth-i-8))),o.left=r+"px",n!=null&&(o.width=n+"px"),t?(o.bottom=window.innerHeight-e.top+a+"px",o.top="auto"):(o.top=e.bottom+a+"px",o.bottom="auto"),l!=null&&(o.maxHeight=l+"px"),o}var sl=0,Te={name:"DjmSelect",components:{DjmIcon:L},props:{modelValue:{type:[String,Number,Boolean,Array],default:""},options:{type:Array,default:()=>[]},placeholder:{type:String,default:""},disabled:{type:Boolean,default:!1},invalid:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},filterable:{type:Boolean,default:!1},maxTagCount:{type:Number,default:0},emptyText:{type:String,default:""},virtual:{type:Boolean,default:!1},optionHeight:{type:Number,default:30},overscan:{type:Number,default:5}},emits:["update:modelValue","change","clear","visible-change","focus","blur"],setup(e,{emit:t}){let a="djm-select-"+ ++sl,n=be(null),i=be(null),l=be(null),o=be(!1),r=be(""),s=be(-1),d=be({}),f=be(0),c=be(0),p=null;function g(N){return N&&typeof N=="object"?{label:N.label,value:N.value,disabled:!!N.disabled}:{label:N,value:N,disabled:!1}}let m=re(()=>e.options.some(N=>N&&typeof N=="object"&&Array.isArray(N.options))),h=re(()=>{let N=[];return e.options.forEach(K=>{K&&typeof K=="object"&&Array.isArray(K.options)?K.options.forEach(_=>N.push(g(_))):N.push(g(K))}),N}),b=re(()=>{let N=r.value.trim().toLowerCase();return N?h.value.filter(K=>String(K.label).toLowerCase().includes(N)):h.value}),j=re(()=>{let N=r.value.trim().toLowerCase(),K=oe=>!N||String(oe.label).toLowerCase().includes(N),_=[],ae=0;return e.options.forEach(oe=>{if(oe&&typeof oe=="object"&&Array.isArray(oe.options)){let ce=[];oe.options.forEach(fe=>{let ue=g(fe);K(ue)&&ce.push({option:ue,index:ae++})}),ce.length&&_.push({label:oe.label,items:ce})}else{let ce=g(oe);K(ce)&&_.push({label:null,items:[{option:ce,index:ae++}]})}}),_}),w=re(()=>e.multiple?Array.isArray(e.modelValue)?e.modelValue:[]:e.modelValue===""||e.modelValue===null||e.modelValue===void 0?[]:[e.modelValue]),y=re(()=>w.value.length>0),u=re(()=>w.value.map(N=>h.value.find(K=>K.value===N)||{label:String(N),value:N})),v=re(()=>!e.maxTagCount||e.maxTagCount<=0?u.value:u.value.slice(0,e.maxTagCount)),T=re(()=>Math.max(0,u.value.length-v.value.length)),D=re(()=>u.value.length?e.multiple?u.value.map(N=>N.label).join("\u3001"):u.value[0].label:""),x=re(()=>e.placeholder||C("select.placeholder")),z=re(()=>e.emptyText||C("select.empty")),S=re(()=>e.virtual&&!m.value&&b.value.length>0),M=re(()=>Math.max(16,e.optionHeight)),I=re(()=>{let N=b.value;if(!S.value)return N.map((ce,fe)=>({option:ce,index:fe}));let K=M.value,_=c.value||220,ae=Math.max(0,Math.floor(f.value/K)-e.overscan),oe=Math.min(N.length,Math.ceil((f.value+_)/K)+e.overscan);return N.slice(ae,oe).map((ce,fe)=>({option:ce,index:ae+fe}))}),A=re(()=>!S.value||!I.value.length?0:I.value[0].index*M.value),V=re(()=>{if(!S.value||!I.value.length)return 0;let N=I.value[I.value.length-1].index;return Math.max(0,(b.value.length-N-1)*M.value)});function H(N){if(!S.value)return;let K=N.target;f.value=K.scrollTop,c.value=K.clientHeight}let Y=re(()=>{if(!(!o.value||s.value<0))return a+"-opt-"+s.value});function X(N){return w.value.includes(N.value)}function R(){let N=b.value;if(!N.length)return-1;let K=N.findIndex(_=>X(_)&&!_.disabled);return K!==-1?K:N.findIndex(_=>!_.disabled)}function F(){e.disabled||o.value||(o.value=!0,s.value=R(),t("visible-change",!0),p=G({root:()=>n.value,panel:()=>i.value,onClose:()=>U(),onReposition:te,esc:!1}),nt(()=>{e.filterable&&l.value&&l.value.focus(),te(),i.value&&(i.value.scrollTop=0,c.value=i.value.clientHeight,f.value=0),k()}))}function U(N=!0){o.value&&(o.value=!1,N&&(r.value=""),d.value={},p&&(p(),p=null),t("visible-change",!1))}function te(){if(!o.value||!n.value)return;let N=n.value.getBoundingClientRect(),K=i.value?i.value.offsetHeight:220,_=window.innerHeight-N.bottom-8,ae=_<Math.min(K,160)&&N.top>_,oe=Math.max(120,ae?N.top-12:_);d.value={position:"fixed",left:N.left+"px",width:N.width+"px",top:ae?"auto":N.bottom+4+"px",bottom:ae?window.innerHeight-N.top+4+"px":"auto",maxHeight:Math.min(220,oe)+"px"}}function Q(){e.disabled||(o.value?U():F())}function le(N){e.disabled||N.target.closest(".djm-select-clear")||N.target.closest(".djm-select-tag-close")||e.filterable&&o.value&&N.target.tagName==="INPUT"||(e.filterable||N.preventDefault(),Q())}function P(N){t("update:modelValue",N),t("change",N)}function O(N){if(!(!N||N.disabled))if(e.multiple){let K=w.value.slice(),_=K.indexOf(N.value);_===-1?K.push(N.value):K.splice(_,1),P(K),nt(k)}else P(N.value),U(),e.filterable&&l.value&&l.value.blur()}function W(N){e.disabled||P(w.value.filter(K=>K!==N))}function ne(){e.disabled||(P(e.multiple?[]:""),t("clear"),U())}function k(){if(!i.value||s.value<0)return;if(S.value){let ae=M.value,oe=s.value*ae,ce=i.value.clientHeight;oe<i.value.scrollTop?i.value.scrollTop=oe:oe+ae>i.value.scrollTop+ce&&(i.value.scrollTop=oe+ae-ce),f.value=i.value.scrollTop;return}let N=i.value.querySelector('[data-index="'+s.value+'"]');if(!N)return;let K=N.offsetTop,_=K+N.offsetHeight;K<i.value.scrollTop?i.value.scrollTop=K:_>i.value.scrollTop+i.value.clientHeight&&(i.value.scrollTop=_-i.value.clientHeight)}function E(N){let K=b.value;if(!K.length||e.disabled)return;if(!o.value){F();return}let _=s.value;for(let ae=0;ae<K.length&&(_=(_+N+K.length)%K.length,!!K[_].disabled);ae++);s.value=_,nt(k)}function B(N){r.value=N.target.value,o.value||F(),i.value&&(i.value.scrollTop=0,f.value=0),s.value=R(),nt(k)}function $(N){if(!e.disabled)switch(N.key){case"ArrowDown":N.preventDefault(),E(1);break;case"ArrowUp":N.preventDefault(),E(-1);break;case"Enter":N.preventDefault(),o.value?O(b.value[s.value]):F();break;case"Escape":o.value&&(N.preventDefault(),U());break;case"Tab":U();break;case"Backspace":e.multiple&&e.filterable&&!r.value&&w.value.length&&(N.preventDefault(),W(w.value[w.value.length-1]));break;default:break}}function q(N){if(e.disabled)return;let K=N.relatedTarget;K&&n.value&&n.value.contains(K)||K&&i.value&&i.value.contains(K)||t("focus",N)}function ie(N){let K=N.relatedTarget;K&&n.value&&n.value.contains(K)||K&&i.value&&i.value.contains(K)||t("blur",N)}return rl(()=>e.modelValue,()=>{o.value||(s.value=-1)}),ol(()=>{p&&(p(),p=null)}),{instanceId:a,root:n,panel:i,panelStyle:d,searchRef:l,open:o,query:r,activeIndex:s,isGrouped:m,visibleOptions:b,visibleGroups:j,virtualEnabled:S,renderedOptions:I,optionPadTop:A,optionPadBottom:V,onPanelScroll:H,selectedOptions:u,visibleTags:v,restTagCount:T,displayText:D,placeholderText:x,emptyLabel:z,activeDescendant:Y,hasValue:y,isSelected:X,toggle:Q,openPanel:F,closePanel:U,onTriggerMousedown:le,selectOption:O,removeTag:W,clear:ne,onInput:B,onKeydown:$,onFocusIn:q,onFocusOut:ie,t:C}},template:`
|
|
85
|
+
<div
|
|
86
|
+
ref="root"
|
|
87
|
+
class="djm-select djm-select-custom"
|
|
88
|
+
:class="{
|
|
89
|
+
'djm-is-open': open,
|
|
90
|
+
'djm-is-invalid': invalid,
|
|
91
|
+
'djm-is-disabled': disabled,
|
|
92
|
+
'djm-is-multiple': multiple
|
|
93
|
+
}"
|
|
94
|
+
>
|
|
95
|
+
<div
|
|
96
|
+
class="djm-select-trigger"
|
|
97
|
+
role="combobox"
|
|
98
|
+
:tabindex="disabled ? -1 : 0"
|
|
99
|
+
:aria-expanded="open"
|
|
100
|
+
:aria-controls="instanceId + '-panel'"
|
|
101
|
+
:aria-activedescendant="activeDescendant"
|
|
102
|
+
:aria-label="displayText || placeholderText"
|
|
103
|
+
aria-haspopup="listbox"
|
|
104
|
+
:aria-disabled="disabled"
|
|
105
|
+
@mousedown="onTriggerMousedown"
|
|
106
|
+
@keydown="onKeydown"
|
|
107
|
+
@focusin="onFocusIn"
|
|
108
|
+
@focusout="onFocusOut"
|
|
109
|
+
>
|
|
110
|
+
<span class="djm-select-tags" v-if="multiple && visibleTags.length">
|
|
111
|
+
<span class="djm-select-tag" v-for="item in visibleTags" :key="item.value">
|
|
112
|
+
{{ item.label }}
|
|
113
|
+
<button class="djm-select-tag-close" type="button" :disabled="disabled" :aria-label="'\u79FB\u9664 ' + item.label" @click.stop="removeTag(item.value)">
|
|
114
|
+
<DjmIcon name="x" :size="10" />
|
|
115
|
+
</button>
|
|
116
|
+
</span>
|
|
117
|
+
<span class="djm-select-tag djm-select-tag-more" v-if="restTagCount">+{{ restTagCount }}</span>
|
|
118
|
+
</span>
|
|
119
|
+
|
|
120
|
+
<input
|
|
121
|
+
v-if="filterable"
|
|
122
|
+
ref="searchRef"
|
|
123
|
+
class="djm-select-input"
|
|
124
|
+
type="text"
|
|
125
|
+
autocomplete="off"
|
|
126
|
+
:id="instanceId + '-input'"
|
|
127
|
+
:name="instanceId"
|
|
128
|
+
:aria-label="placeholderText"
|
|
129
|
+
aria-autocomplete="list"
|
|
130
|
+
:value="open ? query : (multiple ? '' : displayText)"
|
|
131
|
+
:placeholder="visibleTags.length ? '' : placeholderText"
|
|
132
|
+
:disabled="disabled"
|
|
133
|
+
:readonly="!open"
|
|
134
|
+
autocomplete="off"
|
|
135
|
+
@input="onInput"
|
|
136
|
+
@focus="openPanel"
|
|
137
|
+
/>
|
|
138
|
+
<span
|
|
139
|
+
v-else-if="!multiple"
|
|
140
|
+
class="djm-select-text"
|
|
141
|
+
:class="{ 'djm-select-placeholder': !displayText }"
|
|
142
|
+
>{{ displayText || placeholderText }}</span>
|
|
143
|
+
<span
|
|
144
|
+
v-else-if="!visibleTags.length"
|
|
145
|
+
class="djm-select-text djm-select-placeholder"
|
|
146
|
+
>{{ placeholderText }}</span>
|
|
147
|
+
|
|
148
|
+
<button
|
|
149
|
+
v-if="hasValue && clearable && !disabled && !open"
|
|
150
|
+
class="djm-select-clear"
|
|
151
|
+
type="button"
|
|
152
|
+
:title="t('select.clear')"
|
|
153
|
+
:aria-label="t('select.clear')"
|
|
154
|
+
@click.stop="clear"
|
|
155
|
+
>
|
|
156
|
+
<DjmIcon name="x" :size="11" />
|
|
157
|
+
</button>
|
|
158
|
+
<DjmIcon v-else class="djm-select-arrow" name="chevron-down" :size="12" />
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
<Teleport to="body">
|
|
162
|
+
<div
|
|
163
|
+
v-if="open"
|
|
164
|
+
:id="instanceId + '-panel'"
|
|
165
|
+
ref="panel"
|
|
166
|
+
class="djm-select-panel"
|
|
167
|
+
:class="{ 'djm-is-virtual': virtualEnabled }"
|
|
168
|
+
:style="panelStyle"
|
|
169
|
+
role="listbox"
|
|
170
|
+
:aria-multiselectable="multiple || undefined"
|
|
171
|
+
@scroll="onPanelScroll"
|
|
172
|
+
>
|
|
173
|
+
<!-- \u865A\u62DF\u6EDA\u52A8\u5360\u4F4D\uFF1A\u6491\u8D77\u603B\u9AD8\u5EA6\uFF0C\u8BA9\u6EDA\u52A8\u6761\u6BD4\u4F8B\u6B63\u786E -->
|
|
174
|
+
<div v-if="optionPadTop > 0" class="djm-select-pad" :style="{ height: optionPadTop + 'px' }" aria-hidden="true"></div>
|
|
175
|
+
|
|
176
|
+
<!-- \u5E73\u94FA\u6A21\u5F0F\uFF1A\u4FDD\u6301\u539F\u7ED3\u6784 -->
|
|
177
|
+
<template v-if="!isGrouped">
|
|
178
|
+
<div
|
|
179
|
+
v-for="item in renderedOptions"
|
|
180
|
+
:key="item.option.value"
|
|
181
|
+
class="djm-select-option"
|
|
182
|
+
:class="{
|
|
183
|
+
'djm-is-active': item.index === activeIndex,
|
|
184
|
+
'djm-is-selected': isSelected(item.option),
|
|
185
|
+
'djm-is-disabled': item.option.disabled
|
|
186
|
+
}"
|
|
187
|
+
:id="instanceId + '-opt-' + item.index"
|
|
188
|
+
:data-index="item.index"
|
|
189
|
+
role="option"
|
|
190
|
+
:aria-selected="isSelected(item.option)"
|
|
191
|
+
:aria-disabled="item.option.disabled || undefined"
|
|
192
|
+
@click.stop="selectOption(item.option)"
|
|
193
|
+
@mouseenter="activeIndex = item.index"
|
|
194
|
+
>
|
|
195
|
+
<slot name="option" :option="item.option" :selected="isSelected(item.option)" :active="item.index === activeIndex">
|
|
196
|
+
<span class="djm-select-option-label">{{ item.option.label }}</span>
|
|
197
|
+
<DjmIcon v-if="isSelected(item.option)" class="djm-select-option-check" name="check" :size="12" />
|
|
198
|
+
</slot>
|
|
199
|
+
</div>
|
|
200
|
+
</template>
|
|
201
|
+
|
|
202
|
+
<!-- \u5206\u7EC4\u6A21\u5F0F\uFF1A\u7EC4\u5934\u4E0D\u53C2\u4E0E\u952E\u76D8\u5BFC\u822A\uFF0Cindex \u4ECD\u6309\u5E73\u94FA\u9009\u9879\u5BF9\u9F50 -->
|
|
203
|
+
<template v-else>
|
|
204
|
+
<div v-for="(group, groupIndex) in visibleGroups" :key="group.label === null ? groupIndex : group.label" class="djm-select-group">
|
|
205
|
+
<div v-if="group.label !== null" class="djm-select-group-label">{{ group.label }}</div>
|
|
206
|
+
<div
|
|
207
|
+
v-for="item in group.items"
|
|
208
|
+
:key="item.option.value"
|
|
209
|
+
class="djm-select-option"
|
|
210
|
+
:class="{
|
|
211
|
+
'djm-is-active': item.index === activeIndex,
|
|
212
|
+
'djm-is-selected': isSelected(item.option),
|
|
213
|
+
'djm-is-disabled': item.option.disabled
|
|
214
|
+
}"
|
|
215
|
+
:id="instanceId + '-opt-' + item.index"
|
|
216
|
+
:data-index="item.index"
|
|
217
|
+
role="option"
|
|
218
|
+
:aria-selected="isSelected(item.option)"
|
|
219
|
+
:aria-disabled="item.option.disabled || undefined"
|
|
220
|
+
@click.stop="selectOption(item.option)"
|
|
221
|
+
@mouseenter="activeIndex = item.index"
|
|
222
|
+
>
|
|
223
|
+
<slot name="option" :option="item.option" :selected="isSelected(item.option)" :active="item.index === activeIndex">
|
|
224
|
+
<span class="djm-select-option-label">{{ item.option.label }}</span>
|
|
225
|
+
<DjmIcon v-if="isSelected(item.option)" class="djm-select-option-check" name="check" :size="12" />
|
|
226
|
+
</slot>
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
</template>
|
|
230
|
+
|
|
231
|
+
<div v-if="optionPadBottom > 0" class="djm-select-pad" :style="{ height: optionPadBottom + 'px' }" aria-hidden="true"></div>
|
|
232
|
+
|
|
233
|
+
<div v-if="!visibleOptions.length" class="djm-select-empty">{{ emptyLabel }}</div>
|
|
234
|
+
</div>
|
|
235
|
+
</Teleport>
|
|
236
|
+
</div>
|
|
237
|
+
`};var it={name:"DjmCheckbox",props:{modelValue:{type:[Boolean,Array],default:!1},value:{type:[String,Number,Boolean],default:void 0},label:{type:String,default:""},disabled:{type:Boolean,default:!1},options:{type:Array,default:()=>[]},direction:{type:String,default:"horizontal"},min:{type:Number,default:0},max:{type:Number,default:0}},emits:["update:modelValue","change","exceed"],computed:{isGroup(){return Array.isArray(this.modelValue)},current(){return this.isGroup?this.modelValue:[]},checked(){return this.isGroup?this.modelValue.includes(this.value):this.modelValue},normalizedOptions(){return this.options.map(e=>e&&typeof e=="object"?{label:e.label,value:e.value,disabled:!!e.disabled}:{label:e,value:e,disabled:!1})}},methods:{update(e){this.$emit("update:modelValue",e),this.$emit("change",e)},onChange(e){if(this.isGroup){let t=e.target.checked?[...this.modelValue,this.value]:this.modelValue.filter(a=>a!==this.value);this.update(t)}else this.update(e.target.checked)},isChecked(e){return this.current.includes(e)},toggleOption(e,t){let a=t.target.checked?[...this.current,e.value]:this.current.filter(n=>n!==e.value);if(t.target.checked&&this.max>0&&a.length>this.max){t.target.checked=!1,this.$emit("exceed",{type:"max",max:this.max,value:e.value});return}if(!t.target.checked&&this.min>0&&a.length<this.min){t.target.checked=!0,this.$emit("exceed",{type:"min",min:this.min,value:e.value});return}this.update(a)}},template:`
|
|
238
|
+
<div v-if="options.length" class="djm-check-group" :class="'djm-is-' + direction" role="group">
|
|
239
|
+
<label
|
|
240
|
+
v-for="option in normalizedOptions"
|
|
241
|
+
:key="option.value"
|
|
242
|
+
class="djm-check"
|
|
243
|
+
:class="{ 'djm-is-disabled': disabled || option.disabled }"
|
|
244
|
+
>
|
|
245
|
+
<input
|
|
246
|
+
type="checkbox"
|
|
247
|
+
:checked="isChecked(option.value)"
|
|
248
|
+
:disabled="disabled || option.disabled"
|
|
249
|
+
@change="toggleOption(option, $event)"
|
|
250
|
+
/>
|
|
251
|
+
<span>{{ option.label }}</span>
|
|
252
|
+
</label>
|
|
253
|
+
</div>
|
|
254
|
+
|
|
255
|
+
<label v-else class="djm-check">
|
|
256
|
+
<input
|
|
257
|
+
type="checkbox"
|
|
258
|
+
:checked="checked"
|
|
259
|
+
:disabled="disabled"
|
|
260
|
+
@change="onChange"
|
|
261
|
+
/>
|
|
262
|
+
<span><slot>{{ label }}</slot></span>
|
|
263
|
+
</label>
|
|
264
|
+
`};var wa=0,lt={name:"DjmRadio",props:{modelValue:{type:[String,Number,Boolean],default:""},value:{type:[String,Number,Boolean],default:void 0},label:{type:String,default:""},disabled:{type:Boolean,default:!1},options:{type:Array,default:()=>[]},direction:{type:String,default:"horizontal"},name:{type:String,default:""}},emits:["update:modelValue","change"],data(){return wa+=1,{radioUid:wa}},computed:{groupName(){return this.name||"djm-radio-"+this.radioUid},normalizedOptions(){return this.options.map(e=>e&&typeof e=="object"?{label:e.label,value:e.value,disabled:!!e.disabled}:{label:e,value:e,disabled:!1})}},methods:{select(e,t){this.$emit("update:modelValue",e),this.$emit("change",t)},onChange(e){this.select(this.value,e)}},template:`
|
|
265
|
+
<div v-if="options.length" class="djm-radio-group" :class="'djm-is-' + direction" role="radiogroup">
|
|
266
|
+
<label
|
|
267
|
+
v-for="option in normalizedOptions"
|
|
268
|
+
:key="option.value"
|
|
269
|
+
class="djm-radio"
|
|
270
|
+
:class="{ 'djm-is-disabled': disabled || option.disabled }"
|
|
271
|
+
>
|
|
272
|
+
<input
|
|
273
|
+
type="radio"
|
|
274
|
+
:name="groupName"
|
|
275
|
+
:value="option.value"
|
|
276
|
+
:checked="modelValue === option.value"
|
|
277
|
+
:disabled="disabled || option.disabled"
|
|
278
|
+
@change="select(option.value, $event)"
|
|
279
|
+
/>
|
|
280
|
+
<span>{{ option.label }}</span>
|
|
281
|
+
</label>
|
|
282
|
+
</div>
|
|
283
|
+
|
|
284
|
+
<label v-else class="djm-radio">
|
|
285
|
+
<input
|
|
286
|
+
type="radio"
|
|
287
|
+
:name="groupName"
|
|
288
|
+
:value="value"
|
|
289
|
+
:checked="modelValue === value"
|
|
290
|
+
:disabled="disabled"
|
|
291
|
+
@change="onChange"
|
|
292
|
+
/>
|
|
293
|
+
<span><slot>{{ label }}</slot></span>
|
|
294
|
+
</label>
|
|
295
|
+
`};var Oe={name:"DjmSwitch",props:{modelValue:{type:Boolean,default:!1},label:{type:String,default:""},ariaLabel:{type:String,default:""},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","change"],methods:{onChange(e){this.$emit("update:modelValue",e.target.checked),this.$emit("change",e)}},computed:{hasLabel(){return!!this.label||!!this.$slots.default}},template:`
|
|
296
|
+
<label class="djm-switch" :class="{ 'djm-is-disabled': disabled }">
|
|
297
|
+
<input
|
|
298
|
+
type="checkbox"
|
|
299
|
+
:checked="modelValue"
|
|
300
|
+
:disabled="disabled"
|
|
301
|
+
:aria-label="hasLabel ? undefined : (ariaLabel || undefined)"
|
|
302
|
+
@change="onChange"
|
|
303
|
+
/>
|
|
304
|
+
<span class="djm-switch-track"><i></i></span>
|
|
305
|
+
<em v-if="hasLabel"><slot>{{ label }}</slot></em>
|
|
306
|
+
</label>
|
|
307
|
+
`};import{computed as ja,reactive as dl,provide as cl}from"vue";var ot={name:"DjmForm",props:{model:{type:Object,default:()=>({})},rules:{type:Object,default:()=>({})},labelWidth:{type:[String,Number],default:""},inline:{type:Boolean,default:!1}},emits:["submit"],setup(e,{emit:t}){let a=dl({}),n=new Map,i={};function l(){try{i=JSON.parse(JSON.stringify(e.model||{}))}catch{i={...e.model}}}l();function o(m,h){m&&n.set(m,h)}function r(m){n.delete(m)}async function s(m){let h=n.get(m),b=h?await h():"";return b?a[m]=b:delete a[m],!b}async function d(){let m=[...n.keys()];return(await Promise.all(m.map(b=>s(b)))).every(Boolean)}function f(m){(m?[].concat(m):[...n.keys()]).forEach(b=>{delete a[b]})}function c(){Object.keys(e.model||{}).forEach(m=>{m in i||delete e.model[m]}),Object.keys(i).forEach(m=>{let h=i[m];e.model[m]=h&&typeof h=="object"?JSON.parse(JSON.stringify(h)):h}),f()}function p(){l()}async function g(m){let h=await d();t("submit",m,h)}return cl("djmForm",{get model(){return e.model},get rules(){return e.rules},get horizontal(){return!!e.labelWidth||e.inline},errors:a,register:o,unregister:r}),{onSubmit:g,validate:d,validateField:s,clearValidate:f,resetFields:c,setInitial:p,errors:a,formClass:ja(()=>({"djm-is-inline":e.inline,"djm-is-horizontal":!!e.labelWidth})),formStyle:ja(()=>{let m=e.labelWidth;return m?{"--djm-form-label-width":typeof m=="number"||/^\d+(\.\d+)?$/.test(m)?m+"px":m}:{}})}},template:`
|
|
308
|
+
<form class="djm-form-grid" :class="formClass" :style="formStyle" @submit.prevent="onSubmit">
|
|
309
|
+
<slot></slot>
|
|
310
|
+
</form>
|
|
311
|
+
`};import{computed as ul,inject as ml,onMounted as fl,onBeforeUnmount as pl}from"vue";var rt={name:"DjmFormItem",props:{label:{type:String,default:""},prop:{type:String,default:""},required:{type:Boolean,default:!1},error:{type:String,default:""},hint:{type:String,default:""},full:{type:Boolean,default:!1},tag:{type:String,default:"label"}},setup(e){let t=ml("djmForm",null);async function a(){if(!t||!e.prop)return"";let i=t.rules&&t.rules[e.prop]||[],l=t.model?t.model[e.prop]:void 0,o=l==null?"":String(l);for(let r of i){if(r.required&&o.trim()==="")return r.message||`${e.label||e.prop} \u4E3A\u5FC5\u586B\u9879`;if(r.pattern&&o!==""&&!r.pattern.test(o))return r.message||"\u683C\u5F0F\u4E0D\u6B63\u786E";if(typeof r.validator=="function"){let s=await r.validator(l,t.model);if(s===!1)return r.message||"\u6821\u9A8C\u672A\u901A\u8FC7";if(typeof s=="string"&&s)return s}}return""}return fl(()=>{t&&e.prop&&t.register(e.prop,a)}),pl(()=>{t&&e.prop&&t.unregister(e.prop)}),{errorText:ul(()=>e.error?e.error:t&&e.prop&&t.errors[e.prop]||"")}},template:`
|
|
312
|
+
<component :is="tag" class="djm-form-item" :class="{ 'djm-full': full, 'djm-has-label': !!label }">
|
|
313
|
+
<span v-if="label" class="djm-form-label">{{ label }} <i v-if="required">*</i></span>
|
|
314
|
+
<slot></slot>
|
|
315
|
+
<em v-if="errorText" class="djm-form-error" role="alert">{{ errorText }}</em>
|
|
316
|
+
<span v-else-if="hint" class="djm-form-hint">{{ hint }}</span>
|
|
317
|
+
</component>
|
|
318
|
+
`};var st={name:"DjmEmpty",components:{DjmIcon:L},props:{icon:{type:String,default:"clipboard"},title:{type:String,default:""},description:{type:String,default:""}},computed:{label(){return this.title||C("empty.title")}},template:`
|
|
319
|
+
<div class="djm-empty">
|
|
320
|
+
<span class="djm-empty-icon"><DjmIcon :name="icon" :size="22" /></span>
|
|
321
|
+
<strong>{{ label }}</strong>
|
|
322
|
+
<span v-if="description">{{ description }}</span>
|
|
323
|
+
<slot></slot>
|
|
324
|
+
</div>
|
|
325
|
+
`};function $e(e){return Array.isArray(e.children)&&e.children.length>0}function ka(e){return $e(e)?e.children.reduce((t,a)=>t+ka(a),0):1}var dt={name:"DjmTable",components:{DjmEmpty:st,DjmIcon:L},props:{columns:{type:Array,required:!0},rows:{type:Array,default:()=>[]},rowKey:{type:String,default:"id"},selected:{type:Array,default:()=>[]},selectable:{type:Boolean,default:!1},showIndex:{type:Boolean,default:!1},indexOffset:{type:Number,default:0},loading:{type:Boolean,default:!1},loadingText:{type:String,default:""},striped:{type:Boolean,default:!1},compact:{type:Boolean,default:!1},emptyText:{type:String,default:""},emptyHint:{type:String,default:""},emptyIcon:{type:String,default:"clipboard"},sortKey:{type:String,default:""},sortDir:{type:String,default:""},expandable:{type:[Boolean,Function],default:!1},expanded:{type:Array,default:()=>[]},rowClass:{type:[String,Function],default:""},maxHeight:{type:[Number,String],default:""},columnSetting:{type:Boolean,default:!1},exportable:{type:Boolean,default:!1},exportName:{type:String,default:"export"},resizable:{type:Boolean,default:!1},minColumnWidth:{type:Number,default:60},minWidth:{type:[Number,String],default:""},rowDraggable:{type:Boolean,default:!1},allowRowDrag:{type:Function,default:null},virtual:{type:Boolean,default:!1},rowHeight:{type:Number,default:44},overscan:{type:Number,default:6}},emits:["update:selected","row-click","row-dblclick","update:sortKey","update:sortDir","sort-change","update:expanded","export","column-resize","column-resize-end","row-drop"],data(){return{hiddenColumns:[],settingOpen:!1,colWidths:{},resizeState:null,rowDragState:null,rowDropState:null,scrollTop:0,viewportHeight:0}},computed:{leafColumns(){let e=[],t=(a,n)=>{a.forEach(i=>{if($e(i)){t(i.children,i);return}e.push(n?{...i,groupKey:n.key,groupLabel:n.label}:i)})};return t(this.columns,null),e},visibleColumns(){return this.leafColumns.filter(e=>!this.hiddenColumns.includes(e.key))},headerTree(){let e=t=>t.map(a=>$e(a)?{...a,children:e(a.children)}:{...a}).filter(a=>$e(a)?a.children.length>0:!this.hiddenColumns.includes(a.key));return e(this.columns)},headerRows(){let e=[],t=i=>$e(i)?1+Math.max(...i.children.map(t)):1,a=this.headerTree.reduce((i,l)=>Math.max(i,t(l)),1),n=(i,l)=>{e[l]||(e[l]=[]),i.forEach(o=>{$e(o)?(e[l].push({node:o,colspan:ka(o),rowspan:1,group:!0}),n(o.children,l+1)):e[l].push({node:o,colspan:1,rowspan:a-l,group:!1})})};return n(this.headerTree,0),e},colSpan(){return this.visibleColumns.length+(this.selectable?1:0)+(this.showIndex?1:0)+(this.expandable?1:0)+(this.rowDraggable?1:0)},hasFixed(){return this.visibleColumns.some(e=>e.fixed==="left"||e.fixed==="right")},prependOffsets(){if(!this.hasFixed)return null;let e={drag:null,expand:null,select:null,index:null,base:0},t=0;return this.rowDraggable&&(e.drag=t,t+=36),this.expandable&&(e.expand=t,t+=38),this.selectable&&(e.select=t,t+=42),this.showIndex&&(e.index=t,t+=52),e.base=t,e},stickyMap(){if(!this.hasFixed)return{};let e=this.visibleColumns,t={},a=this.prependOffsets?this.prependOffsets.base:0;e.forEach(o=>{o.fixed==="left"&&(t[o.key]={side:"left",offset:a,edge:!1},a+=this.columnWidth(o))});let n=0;for(let o=e.length-1;o>=0;o--){let r=e[o];r.fixed==="right"&&(t[r.key]={side:"right",offset:n,edge:!1},n+=this.columnWidth(r))}let i=e.filter(o=>o.fixed==="left").map(o=>o.key),l=e.filter(o=>o.fixed==="right").map(o=>o.key);return i.length&&(t[i[i.length-1]].edge=!0),l.length&&(t[l[0]].edge=!0),t},scrollStyle(){if(!this.maxHeight)return{};let e=this.maxHeight;return typeof e=="number"||/^\d+(\.\d+)?$/.test(e)?{maxHeight:e+"px"}:{maxHeight:e}},tableStyle(){let e=this.minWidth;return e===""||e===null||e===void 0?{}:typeof e=="number"||/^\d+(\.\d+)?$/.test(e)?{minWidth:e+"px"}:{minWidth:e}},loadingLabel(){return this.loadingText||C("table.loading")},emptyLabel(){return this.emptyText||C("table.empty")},selectAllLabel(){return C("table.selectAll")},selectRowLabel(){return C("table.selectRow")},scrollRegionLabel(){return C("table.scrollRegion")},allChecked(){return this.rows.length>0&&this.rows.every(e=>this.isSelected(e))},someChecked(){return!this.allChecked&&this.rows.some(e=>this.isSelected(e))},displayRows(){if(!this.sortKey||!this.sortDir)return this.rows;let e=this.leafColumns.find(n=>n.key===this.sortKey);if(!e)return this.rows;let t=this.sortDir==="asc"?1:-1,a=this.rows.slice();return typeof e.sorter=="function"?a.sort((n,i)=>e.sorter(n,i)*t):a.sort((n,i)=>{let l=n[this.sortKey],o=i[this.sortKey];return typeof l=="number"&&typeof o=="number"?(l-o)*t:String(l??"").localeCompare(String(o??""),"zh-Hans-CN")*t})},virtualEnabled(){return!!(this.virtual&&this.maxHeight&&!this.expandable)},effectiveRowHeight(){return Math.max(16,this.rowHeight)},visibleRange(){let e=this.displayRows.length;if(!this.virtualEnabled||!e)return{start:0,end:e};let t=this.effectiveRowHeight,a=this.viewportHeight||t*10,n=Math.max(0,Math.floor(this.scrollTop/t)-this.overscan),i=Math.min(e,Math.ceil((this.scrollTop+a)/t)+this.overscan);return{start:n,end:i}},bodyRows(){let{start:e,end:t}=this.visibleRange;return this.displayRows.slice(e,t).map((a,n)=>({row:a,index:e+n}))},topPad(){return this.virtualEnabled?this.visibleRange.start*this.effectiveRowHeight:0},bottomPad(){if(!this.virtualEnabled)return 0;let e=this.displayRows.length;return Math.max(0,(e-this.visibleRange.end)*this.effectiveRowHeight)}},mounted(){document.addEventListener("mousedown",this.onDocumentMousedown,!0),this.measureViewport()},beforeUnmount(){document.removeEventListener("mousedown",this.onDocumentMousedown,!0),document.removeEventListener("mousemove",this.onResizeMove),document.removeEventListener("mouseup",this.onResizeEnd)},methods:{measureViewport(){let e=this.$refs.wrap;!e||!this.virtualEnabled||(this.viewportHeight=e.clientHeight,this.scrollTop=e.scrollTop)},onScroll(e){if(!this.virtualEnabled)return;let t=e.target;this.scrollTop=t.scrollTop,this.viewportHeight=t.clientHeight},toggleColumn(e){if(this.hiddenColumns.includes(e)){this.hiddenColumns=this.hiddenColumns.filter(t=>t!==e);return}this.visibleColumns.length<=1||(this.hiddenColumns=[...this.hiddenColumns,e])},resetColumns(){this.hiddenColumns=[]},onDocumentMousedown(e){!this.$refs.root||this.$refs.root.contains(e.target)||(this.settingOpen=!1)},exportCsv(){let e=this.visibleColumns.filter(i=>i.exportable!==!1);if(!e.length)return;let t=e.map(i=>i.label||i.key),a=this.displayRows.map(i=>e.map(l=>{let o=typeof l.exportValue=="function"?l.exportValue(i):i[l.key];return String(o??"").replace(/"/g,'""')})),n="\uFEFF"+[t,...a].map(i=>i.map(l=>`"${l}"`).join(",")).join(`
|
|
326
|
+
`);this.$emit("export",{rows:this.displayRows.slice(),csv:n}),this.downloadCsv(n)},downloadCsv(e){let t=new Date,a=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`,n=URL.createObjectURL(new Blob([e],{type:"text/csv;charset=utf-8"})),i=document.createElement("a");i.href=n,i.download=`${this.exportName}-${a}.csv`,i.click(),URL.revokeObjectURL(n)},isSelected(e){return this.selected.includes(e[this.rowKey])},canExpand(e){return typeof this.expandable=="function"?!!this.expandable(e):!!this.expandable},isExpanded(e){return this.expanded.includes(e[this.rowKey])},toggleExpand(e){let t=e[this.rowKey],a=this.expanded.includes(t)?this.expanded.filter(n=>n!==t):[...this.expanded,t];this.$emit("update:expanded",a)},rowClassOf(e,t){return typeof this.rowClass=="function"?this.rowClass(e,t):this.rowClass},columnWidth(e){let t=this.colWidths[e.key];return typeof t=="number"?t:typeof e.width=="number"?e.width:120},stickyClassOf(e){let t=this.stickyMap[e.key];return t?[t.side==="left"?"djm-sticky-left":"djm-sticky-right",t.edge?"djm-sticky-edge":""]:""},stickyStyleOf(e){let t=this.stickyMap[e.key];return t?t.side==="left"?{left:t.offset+"px"}:{right:t.offset+"px"}:{}},stickyTop(e){return this.headerRows.length<=1?{}:{top:e*(this.compact?32:38)+"px"}},prependClass(e){if(!this.prependOffsets)return"";let t=this.prependOffsets[e];if(t==null)return"";let a=["drag","expand","select","index"].filter(l=>this.prependOffsets[l]!==null),n=a[a.length-1]===e,i=this.visibleColumns.some(l=>l.fixed==="left");return["djm-sticky-left",n&&!i?"djm-sticky-edge":""]},prependStyle(e){if(!this.prependOffsets)return{};let t=this.prependOffsets[e];return t==null?{}:{left:t+"px"}},ariaSort(e){if(e.sortable)return this.sortKey!==e.key?"none":this.sortDir==="asc"?"ascending":"descending"},toggleSort(e){if(!e.sortable)return;let t=e.key,a="asc";this.sortKey===e.key&&this.sortDir==="asc"?a="desc":this.sortKey===e.key&&this.sortDir==="desc"&&(t="",a=""),this.$emit("update:sortKey",t),this.$emit("update:sortDir",a),this.$emit("sort-change",{key:t,dir:a})},toggleAll(e){let t=this.rows.map(a=>a[this.rowKey]);if(e.target.checked){let a=new Set(this.selected);t.forEach(n=>a.add(n)),this.$emit("update:selected",[...a])}else{let a=new Set(t);this.$emit("update:selected",this.selected.filter(n=>!a.has(n)))}},toggleRow(e){let t=e[this.rowKey],a=this.selected.includes(t)?this.selected.filter(n=>n!==t):[...this.selected,t];this.$emit("update:selected",a)},cellStyle(e){let t=this.colWidths[e.key],a="";return typeof t=="number"?a=t+"px":typeof e.width=="number"?a=e.width+"px":e.width&&(a=String(e.width)),{width:a,minWidth:a,maxWidth:e.fixed?a:"",textAlign:e.align||""}},startResize(e,t){if(!this.resizable||t.resizable===!1)return;let a=e.currentTarget.parentNode;this.resizeState={key:t.key,startX:e.clientX,startWidth:a.getBoundingClientRect().width},document.addEventListener("mousemove",this.onResizeMove),document.addEventListener("mouseup",this.onResizeEnd)},onResizeMove(e){let t=this.resizeState;if(!t)return;let a=Math.max(40,this.minColumnWidth),n=Math.round(Math.max(a,t.startWidth+e.clientX-t.startX));this.colWidths={...this.colWidths,[t.key]:n},this.$emit("column-resize",{key:t.key,width:n})},onResizeEnd(){if(!this.resizeState)return;let{key:e}=this.resizeState;this.resizeState=null,document.removeEventListener("mousemove",this.onResizeMove),document.removeEventListener("mouseup",this.onResizeEnd),this.$emit("column-resize-end",{key:e,width:this.colWidths[e]})},resetColumnWidth(e){if(!this.colWidths[e])return;let t={...this.colWidths};delete t[e],this.colWidths=t},canDragRow(e,t){return this.rowDraggable?typeof this.allowRowDrag=="function"?this.allowRowDrag(e,t)!==!1:!0:!1},isRowDragging(e){return!!(this.rowDragState&&this.rowDragState.key===e.row[this.rowKey])},rowDropClassOf(e){let t=this.rowDropState;return!t||t.key!==e.row[this.rowKey]?"":"djm-is-row-drop-"+t.position},onRowDragStart(e,t){if(!this.canDragRow(e.row,e.index)){t.preventDefault();return}this.rowDragState={key:e.row[this.rowKey],index:e.index},t.dataTransfer&&(t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",String(e.index)))},dropPositionOf(e){let t=e.currentTarget.getBoundingClientRect();return(t.height?(e.clientY-t.top)/t.height:.5)<.5?"before":"after"},onRowDragOver(e,t){this.rowDragState&&(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move"),this.rowDropState={key:e.row[this.rowKey],index:e.index,position:this.dropPositionOf(t)})},onRowDragLeave(e,t){let a=t.currentTarget;a&&t.relatedTarget&&a.contains(t.relatedTarget)||this.rowDropState&&this.rowDropState.key===e.row[this.rowKey]&&(this.rowDropState=null)},onRowDrop(e,t){let a=this.rowDragState;if(!a)return;t.preventDefault();let n=this.rowDropState,i=n&&n.key===e.row[this.rowKey]?n.position:this.dropPositionOf(t);this.resetRowDrag(),!this.isNoopDrop(a.index,e.index,i)&&this.$emit("row-drop",{dragIndex:a.index,dropIndex:e.index,position:i,dragKey:a.key,dropKey:e.row[this.rowKey]})},isNoopDrop(e,t,a){return e===t||a==="after"&&t===e-1||a==="before"&&t===e+1},onRowDragEnd(){this.resetRowDrag()},resetRowDrag(){this.rowDragState=null,this.rowDropState=null}},template:`
|
|
327
|
+
<div class="djm-table-root" :class="{ 'djm-is-resizing': !!resizeState }" ref="root">
|
|
328
|
+
<div
|
|
329
|
+
v-if="columnSetting || exportable || $slots.toolbar || $slots['toolbar-extra']"
|
|
330
|
+
class="djm-table-tools"
|
|
331
|
+
>
|
|
332
|
+
<div class="djm-table-tools-left">
|
|
333
|
+
<slot name="toolbar" :rows="displayRows"></slot>
|
|
334
|
+
</div>
|
|
335
|
+
<div class="djm-table-tools-right">
|
|
336
|
+
<slot name="toolbar-extra"></slot>
|
|
337
|
+
<button v-if="exportable" class="djm-btn djm-btn-sm" type="button" @click="exportCsv">
|
|
338
|
+
<DjmIcon name="download" :size="13" />\u5BFC\u51FA
|
|
339
|
+
</button>
|
|
340
|
+
<div v-if="columnSetting" class="djm-table-col-setting">
|
|
341
|
+
<button class="djm-btn djm-btn-sm" type="button" @click.stop="settingOpen = !settingOpen">
|
|
342
|
+
<DjmIcon name="sliders" :size="13" />\u5217\u8BBE\u7F6E
|
|
343
|
+
</button>
|
|
344
|
+
<div v-if="settingOpen" class="djm-table-col-panel">
|
|
345
|
+
<div class="djm-table-col-head">
|
|
346
|
+
<span>\u663E\u793A\u5217</span>
|
|
347
|
+
<button class="djm-link-btn" type="button" @click="resetColumns">\u91CD\u7F6E</button>
|
|
348
|
+
</div>
|
|
349
|
+
<!-- \u591A\u7EA7\u8868\u5934\u6309\u53F6\u5B50\u5217\u52FE\u9009\uFF0C\u5E26\u4E0A\u5206\u7EC4\u540D\u4FBF\u4E8E\u8BC6\u522B -->
|
|
350
|
+
<label v-for="column in leafColumns" :key="column.key" class="djm-table-col-item">
|
|
351
|
+
<input
|
|
352
|
+
type="checkbox"
|
|
353
|
+
:checked="!hiddenColumns.includes(column.key)"
|
|
354
|
+
:disabled="visibleColumns.length <= 1 && !hiddenColumns.includes(column.key)"
|
|
355
|
+
@change="toggleColumn(column.key)"
|
|
356
|
+
/>
|
|
357
|
+
<span>{{ column.groupLabel ? column.groupLabel + ' / ' + (column.label || column.key) : (column.label || column.key) }}</span>
|
|
358
|
+
</label>
|
|
359
|
+
</div>
|
|
360
|
+
</div>
|
|
361
|
+
</div>
|
|
362
|
+
</div>
|
|
363
|
+
|
|
364
|
+
<div
|
|
365
|
+
class="djm-table-wrap"
|
|
366
|
+
ref="wrap"
|
|
367
|
+
:class="{ 'djm-is-scrollable': !!maxHeight, 'djm-has-fixed': hasFixed, 'djm-is-virtual': virtualEnabled }"
|
|
368
|
+
:style="scrollStyle"
|
|
369
|
+
role="region"
|
|
370
|
+
:aria-label="scrollRegionLabel"
|
|
371
|
+
tabindex="0"
|
|
372
|
+
@scroll="onScroll"
|
|
373
|
+
>
|
|
374
|
+
<table class="djm-data-table" :class="{ 'djm-is-striped': striped, 'djm-is-compact': compact, 'djm-is-resizable': resizable }" :style="tableStyle">
|
|
375
|
+
<thead>
|
|
376
|
+
<tr v-for="(row, rowIndex) in headerRows" :key="rowIndex">
|
|
377
|
+
<!-- \u524D\u7F6E\u5217\u53EA\u5728\u7B2C\u4E00\u884C\u6E32\u67D3\uFF0C\u5E76\u8DE8\u5168\u90E8\u8868\u5934\u884C -->
|
|
378
|
+
<th
|
|
379
|
+
v-if="rowDraggable && rowIndex === 0"
|
|
380
|
+
:class="['djm-col-drag', prependClass('drag')]"
|
|
381
|
+
:style="[prependStyle('drag'), stickyTop(rowIndex)]"
|
|
382
|
+
:rowspan="headerRows.length > 1 ? headerRows.length : undefined"
|
|
383
|
+
scope="col"
|
|
384
|
+
aria-label="\u62D6\u52A8\u6392\u5E8F"
|
|
385
|
+
></th>
|
|
386
|
+
<th
|
|
387
|
+
v-if="expandable && rowIndex === 0"
|
|
388
|
+
:class="['djm-col-expand', prependClass('expand')]"
|
|
389
|
+
:style="[prependStyle('expand'), stickyTop(rowIndex)]"
|
|
390
|
+
:rowspan="headerRows.length > 1 ? headerRows.length : undefined"
|
|
391
|
+
scope="col"
|
|
392
|
+
></th>
|
|
393
|
+
<th
|
|
394
|
+
v-if="selectable && rowIndex === 0"
|
|
395
|
+
:class="['djm-col-check', prependClass('select')]"
|
|
396
|
+
:style="[prependStyle('select'), stickyTop(rowIndex)]"
|
|
397
|
+
:rowspan="headerRows.length > 1 ? headerRows.length : undefined"
|
|
398
|
+
scope="col"
|
|
399
|
+
>
|
|
400
|
+
<input type="checkbox" :checked="allChecked" :indeterminate="someChecked" :aria-label="selectAllLabel" @change="toggleAll" />
|
|
401
|
+
</th>
|
|
402
|
+
<th
|
|
403
|
+
v-if="showIndex && rowIndex === 0"
|
|
404
|
+
:class="['djm-col-index', prependClass('index')]"
|
|
405
|
+
:style="[prependStyle('index'), stickyTop(rowIndex)]"
|
|
406
|
+
:rowspan="headerRows.length > 1 ? headerRows.length : undefined"
|
|
407
|
+
scope="col"
|
|
408
|
+
>#</th>
|
|
409
|
+
|
|
410
|
+
<th
|
|
411
|
+
v-for="cell in row"
|
|
412
|
+
:key="cell.node.key"
|
|
413
|
+
:colspan="cell.colspan > 1 ? cell.colspan : undefined"
|
|
414
|
+
:rowspan="cell.rowspan > 1 ? cell.rowspan : undefined"
|
|
415
|
+
:class="[
|
|
416
|
+
cell.node.class,
|
|
417
|
+
cell.node.headerClass,
|
|
418
|
+
cell.group ? 'djm-col-group' : stickyClassOf(cell.node),
|
|
419
|
+
{
|
|
420
|
+
'djm-is-sortable': !cell.group && cell.node.sortable,
|
|
421
|
+
'djm-has-resizer': !cell.group && resizable && cell.node.resizable !== false
|
|
422
|
+
}
|
|
423
|
+
]"
|
|
424
|
+
:style="[cell.group ? {} : cellStyle(cell.node), cell.group ? {} : stickyStyleOf(cell.node), stickyTop(rowIndex)]"
|
|
425
|
+
:aria-sort="cell.group ? undefined : ariaSort(cell.node)"
|
|
426
|
+
:scope="cell.group ? 'colgroup' : 'col'"
|
|
427
|
+
:tabindex="!cell.group && cell.node.sortable ? 0 : undefined"
|
|
428
|
+
@click="!cell.group && toggleSort(cell.node)"
|
|
429
|
+
@keydown.enter.prevent="!cell.group && toggleSort(cell.node)"
|
|
430
|
+
@keydown.space.prevent="!cell.group && toggleSort(cell.node)"
|
|
431
|
+
>
|
|
432
|
+
<span class="djm-table-sort">
|
|
433
|
+
<slot :name="'header-' + cell.node.key" :column="cell.node">{{ cell.node.label }}</slot>
|
|
434
|
+
<span v-if="!cell.group && cell.node.sortable" class="djm-table-sorter">
|
|
435
|
+
<i class="djm-table-sort-up" :class="{ 'djm-is-on': sortKey === cell.node.key && sortDir === 'asc' }"></i>
|
|
436
|
+
<i class="djm-table-sort-down" :class="{ 'djm-is-on': sortKey === cell.node.key && sortDir === 'desc' }"></i>
|
|
437
|
+
</span>
|
|
438
|
+
</span>
|
|
439
|
+
<!-- \u5217\u5BBD\u62D6\u62FD\u5206\u5272\u7EBF\uFF1A\u53EA\u6302\u5728\u53F6\u5B50\u5217\uFF0C\u963B\u6B62\u5192\u6CE1\u907F\u514D\u89E6\u53D1\u6392\u5E8F -->
|
|
440
|
+
<span
|
|
441
|
+
v-if="!cell.group && resizable && cell.node.resizable !== false"
|
|
442
|
+
class="djm-table-resizer"
|
|
443
|
+
:class="{ 'djm-is-active': resizeState && resizeState.key === cell.node.key }"
|
|
444
|
+
aria-hidden="true"
|
|
445
|
+
@mousedown.prevent.stop="startResize($event, cell.node)"
|
|
446
|
+
@click.stop
|
|
447
|
+
@dblclick.stop="resetColumnWidth(cell.node.key)"
|
|
448
|
+
></span>
|
|
449
|
+
</th>
|
|
450
|
+
</tr>
|
|
451
|
+
</thead>
|
|
452
|
+
<tbody>
|
|
453
|
+
<!-- \u865A\u62DF\u6EDA\u52A8\uFF1A\u4E0A\u65B9\u5360\u4F4D\u884C\uFF0C\u4FDD\u8BC1\u6EDA\u52A8\u6761\u957F\u5EA6\u4E0E\u771F\u5B9E\u884C\u6570\u4E00\u81F4 -->
|
|
454
|
+
<tr v-if="topPad > 0" class="djm-table-spacer" aria-hidden="true">
|
|
455
|
+
<td :colspan="colSpan" :style="{ height: topPad + 'px' }"></td>
|
|
456
|
+
</tr>
|
|
457
|
+
|
|
458
|
+
<template v-for="item in bodyRows" :key="item.row[rowKey]">
|
|
459
|
+
<tr
|
|
460
|
+
:class="[
|
|
461
|
+
rowClassOf(item.row, item.index),
|
|
462
|
+
rowDropClassOf(item),
|
|
463
|
+
{ 'djm-is-selected': isSelected(item.row), 'djm-is-row-dragging': isRowDragging(item) }
|
|
464
|
+
]"
|
|
465
|
+
:style="virtualEnabled ? { height: effectiveRowHeight + 'px' } : null"
|
|
466
|
+
@click="$emit('row-click', item.row, item.index)"
|
|
467
|
+
@dblclick="$emit('row-dblclick', item.row, item.index)"
|
|
468
|
+
@dragover="onRowDragOver(item, $event)"
|
|
469
|
+
@dragleave="onRowDragLeave(item, $event)"
|
|
470
|
+
@drop="onRowDrop(item, $event)"
|
|
471
|
+
>
|
|
472
|
+
<!-- \u62D6\u62FD\u624B\u67C4\uFF1A\u53EA\u6709\u624B\u67C4\u53EF\u62D6\uFF0C\u907F\u514D\u548C\u9009\u4E2D\u6587\u672C\u3001\u884C\u70B9\u51FB\u51B2\u7A81 -->
|
|
473
|
+
<td
|
|
474
|
+
v-if="rowDraggable"
|
|
475
|
+
:class="['djm-col-drag', prependClass('drag')]"
|
|
476
|
+
:style="prependStyle('drag')"
|
|
477
|
+
>
|
|
478
|
+
<span
|
|
479
|
+
class="djm-row-handle"
|
|
480
|
+
:class="{ 'djm-is-disabled': !canDragRow(item.row, item.index) }"
|
|
481
|
+
:draggable="canDragRow(item.row, item.index) ? 'true' : 'false'"
|
|
482
|
+
:title="canDragRow(item.row, item.index) ? '\u62D6\u52A8\u6392\u5E8F' : '\u8BE5\u884C\u4E0D\u53EF\u62D6\u52A8'"
|
|
483
|
+
aria-hidden="true"
|
|
484
|
+
@dragstart.stop="onRowDragStart(item, $event)"
|
|
485
|
+
@dragend.stop="onRowDragEnd"
|
|
486
|
+
@click.stop
|
|
487
|
+
>
|
|
488
|
+
<DjmIcon name="grip" :size="13" />
|
|
489
|
+
</span>
|
|
490
|
+
</td>
|
|
491
|
+
<td
|
|
492
|
+
v-if="expandable"
|
|
493
|
+
:class="['djm-col-expand', prependClass('expand')]"
|
|
494
|
+
:style="prependStyle('expand')"
|
|
495
|
+
>
|
|
496
|
+
<button
|
|
497
|
+
v-if="canExpand(item.row)"
|
|
498
|
+
class="djm-table-expand-btn"
|
|
499
|
+
type="button"
|
|
500
|
+
:aria-expanded="isExpanded(item.row)"
|
|
501
|
+
:aria-label="isExpanded(item.row) ? '\u6536\u8D77' : '\u5C55\u5F00'"
|
|
502
|
+
@click.stop="toggleExpand(item.row)"
|
|
503
|
+
>
|
|
504
|
+
<DjmIcon :name="isExpanded(item.row) ? 'chevron-down' : 'chevron-right'" :size="12" />
|
|
505
|
+
</button>
|
|
506
|
+
</td>
|
|
507
|
+
<td
|
|
508
|
+
v-if="selectable"
|
|
509
|
+
:class="['djm-col-check', prependClass('select')]"
|
|
510
|
+
:style="prependStyle('select')"
|
|
511
|
+
>
|
|
512
|
+
<input type="checkbox" :checked="isSelected(item.row)" :aria-label="selectRowLabel" @change="toggleRow(item.row)" @click.stop />
|
|
513
|
+
</td>
|
|
514
|
+
<td
|
|
515
|
+
v-if="showIndex"
|
|
516
|
+
:class="['djm-col-index', prependClass('index')]"
|
|
517
|
+
:style="prependStyle('index')"
|
|
518
|
+
>{{ indexOffset + item.index + 1 }}</td>
|
|
519
|
+
<td
|
|
520
|
+
v-for="column in visibleColumns"
|
|
521
|
+
:key="column.key"
|
|
522
|
+
:class="[column.class, column.cellClass, stickyClassOf(column)]"
|
|
523
|
+
:style="[cellStyle(column), stickyStyleOf(column)]"
|
|
524
|
+
>
|
|
525
|
+
<slot
|
|
526
|
+
:name="'cell-' + column.key"
|
|
527
|
+
:row="item.row"
|
|
528
|
+
:value="item.row[column.key]"
|
|
529
|
+
:index="item.index"
|
|
530
|
+
:column="column"
|
|
531
|
+
>{{ item.row[column.key] }}</slot>
|
|
532
|
+
</td>
|
|
533
|
+
</tr>
|
|
534
|
+
|
|
535
|
+
<tr v-if="isExpanded(item.row)" class="djm-table-expand-row">
|
|
536
|
+
<td :colspan="colSpan">
|
|
537
|
+
<div class="djm-table-expand-body">
|
|
538
|
+
<slot name="expand" :row="item.row" :index="item.index"></slot>
|
|
539
|
+
</div>
|
|
540
|
+
</td>
|
|
541
|
+
</tr>
|
|
542
|
+
</template>
|
|
543
|
+
|
|
544
|
+
<!-- \u865A\u62DF\u6EDA\u52A8\uFF1A\u4E0B\u65B9\u5360\u4F4D\u884C -->
|
|
545
|
+
<tr v-if="bottomPad > 0" class="djm-table-spacer" aria-hidden="true">
|
|
546
|
+
<td :colspan="colSpan" :style="{ height: bottomPad + 'px' }"></td>
|
|
547
|
+
</tr>
|
|
548
|
+
|
|
549
|
+
<tr v-if="!displayRows.length">
|
|
550
|
+
<td :colspan="colSpan">
|
|
551
|
+
<slot name="empty">
|
|
552
|
+
<DjmEmpty :icon="emptyIcon" :title="emptyLabel" :description="emptyHint" />
|
|
553
|
+
</slot>
|
|
554
|
+
</td>
|
|
555
|
+
</tr>
|
|
556
|
+
</tbody>
|
|
557
|
+
</table>
|
|
558
|
+
|
|
559
|
+
<div v-if="loading" class="djm-table-loading">
|
|
560
|
+
<span class="djm-spinner"></span>{{ loadingLabel }}
|
|
561
|
+
</div>
|
|
562
|
+
</div>
|
|
563
|
+
</div>
|
|
564
|
+
`};var xa={name:"DjmPageHeader",props:{title:{type:String,required:!0},description:{type:String,default:""}},template:`
|
|
565
|
+
<header class="djm-page-head">
|
|
566
|
+
<div>
|
|
567
|
+
<h1>{{ title }}</h1>
|
|
568
|
+
<p v-if="description">{{ description }}</p>
|
|
569
|
+
</div>
|
|
570
|
+
<div v-if="$slots.actions" class="djm-page-actions">
|
|
571
|
+
<slot name="actions"></slot>
|
|
572
|
+
</div>
|
|
573
|
+
</header>
|
|
574
|
+
`};var Sa={name:"DjmBreadcrumb",components:{Icon:L},props:{items:{type:Array,required:!0},separator:{type:String,default:"/"},separatorIcon:{type:String,default:""},ariaLabel:{type:String,default:"\u9762\u5305\u5C51"}},emits:["navigate"],methods:{isLast(e){return e===this.items.length-1}},template:`
|
|
575
|
+
<nav class="djm-breadcrumb" :aria-label="ariaLabel">
|
|
576
|
+
<ol class="djm-breadcrumb-list">
|
|
577
|
+
<li v-for="(item, index) in items" :key="item.key || item.label" class="djm-breadcrumb-item">
|
|
578
|
+
<span v-if="index > 0" class="djm-breadcrumb-sep" aria-hidden="true">
|
|
579
|
+
<Icon v-if="separatorIcon" :name="separatorIcon" :size="12" />
|
|
580
|
+
<template v-else>{{ separator }}</template>
|
|
581
|
+
</span>
|
|
582
|
+
<span v-if="isLast(index)" class="djm-breadcrumb-text djm-is-current" aria-current="page">{{ item.label }}</span>
|
|
583
|
+
<a v-else-if="item.href" class="djm-breadcrumb-text djm-breadcrumb-link" :href="item.href">{{ item.label }}</a>
|
|
584
|
+
<button
|
|
585
|
+
v-else
|
|
586
|
+
class="djm-breadcrumb-text djm-breadcrumb-link"
|
|
587
|
+
type="button"
|
|
588
|
+
@click="$emit('navigate', item)"
|
|
589
|
+
>{{ item.label }}</button>
|
|
590
|
+
</li>
|
|
591
|
+
</ol>
|
|
592
|
+
</nav>
|
|
593
|
+
`};var me={name:"DjmAvatar",props:{src:{type:String,default:""},alt:{type:String,default:""},text:{type:String,default:""},size:{type:String,default:"md"},shape:{type:String,default:"circle"},tone:{type:String,default:""}},data(){return{failed:!1}},computed:{initial(){let e=(this.text||this.alt||"").trim();return e?/^[+\d]/.test(e)?e:e.slice(0,1):""},showImage(){return!!this.src&&!this.failed}},watch:{src(){this.failed=!1}},template:`
|
|
594
|
+
<span
|
|
595
|
+
class="djm-avatar"
|
|
596
|
+
:class="['djm-avatar-' + size, { 'djm-is-square': shape === 'square' }]"
|
|
597
|
+
:style="tone ? { background: tone } : null"
|
|
598
|
+
>
|
|
599
|
+
<img v-if="showImage" :src="src" :alt="alt || text" @error="failed = true" />
|
|
600
|
+
<template v-else>{{ initial }}</template>
|
|
601
|
+
</span>
|
|
602
|
+
`};var Da={name:"DjmAvatarGroup",props:{gap:{type:[Number,String],default:-8}},computed:{groupStyle(){return{"--djm-avatar-gap":typeof this.gap=="number"?this.gap+"px":this.gap}}},template:`
|
|
603
|
+
<div class="djm-avatar-group" :style="groupStyle">
|
|
604
|
+
<slot></slot>
|
|
605
|
+
</div>
|
|
606
|
+
`};var Ta={name:"DjmBadge",props:{count:{type:[Number,String],default:0},max:{type:Number,default:99},dot:{type:Boolean,default:!1},tone:{type:String,default:"danger"},hidden:{type:Boolean,default:!1}},computed:{display(){let e=Number(this.count);return Number.isFinite(e)?e>this.max?this.max+"+":String(e):String(this.count)},show(){if(this.hidden)return!1;if(this.dot)return!0;let e=String(this.count===null||this.count===void 0?"":this.count).trim();return e===""?!1:Number.isFinite(Number(e))?Number(e)!==0:!0}},template:`
|
|
607
|
+
<span class="djm-badge-anchor">
|
|
608
|
+
<slot></slot>
|
|
609
|
+
<i
|
|
610
|
+
v-if="show"
|
|
611
|
+
class="djm-badge-mark"
|
|
612
|
+
:class="[dot ? 'djm-is-dot' : 'djm-badge-count', 'djm-' + tone]"
|
|
613
|
+
>{{ dot ? '' : display }}</i>
|
|
614
|
+
</span>
|
|
615
|
+
`};import{nextTick as Ma,onBeforeUnmount as hl,onMounted as vl,ref as ct,watch as gl}from"vue";var Ca={name:"DjmPopover",props:{placement:{type:String,default:"bottom-end"},width:{type:[Number,String],default:""},trigger:{type:String,default:"click"},disabled:{type:Boolean,default:!1}},emits:["visible-change"],setup(e,{emit:t}){let a=ct(!1),n=ct(null),i=ct(null),l=ct({}),o=null;function r(){let h=n.value&&n.value.querySelector(".djm-popover-trigger");if(!h)return;let b=h.querySelector('button, a[href], [role="button"]'),j=b||h;b||(j.setAttribute("role","button"),j.setAttribute("tabindex","0")),j.setAttribute("aria-haspopup","dialog"),j.setAttribute("aria-expanded",String(a.value))}vl(()=>Ma(r)),gl(a,()=>Ma(r));function s(){if(!a.value||!n.value)return;let h=n.value.getBoundingClientRect(),b={position:"fixed"};e.width&&(b.width=typeof e.width=="number"?e.width+"px":e.width);let j=window.innerHeight-h.bottom;e.placement.indexOf("top")===0||j<220&&h.top>j?b.bottom=window.innerHeight-h.top+8+"px":b.top=h.bottom+8+"px",e.placement.indexOf("end")>-1?b.right=window.innerWidth-h.right+"px":b.left=h.left+"px",l.value=b}function d(){e.disabled||a.value||(a.value=!0,t("visible-change",!0),o=G({root:()=>n.value,panel:()=>i.value,onClose:f,onReposition:s}),requestAnimationFrame(s))}function f(){a.value&&(a.value=!1,l.value={},t("visible-change",!1),o&&(o(),o=null))}function c(){e.disabled||(a.value?f():d())}let p=null;function g(){e.trigger==="hover"&&(window.clearTimeout(p),d())}function m(){e.trigger==="hover"&&(window.clearTimeout(p),p=window.setTimeout(f,120))}return hl(()=>{window.clearTimeout(p),f()}),{open:a,root:n,panelEl:i,panelStyle:l,toggle:c,close:f,onHoverIn:g,onHoverOut:m}},template:`
|
|
616
|
+
<span class="djm-popover" ref="root" @mouseenter="onHoverIn" @mouseleave="onHoverOut">
|
|
617
|
+
<span
|
|
618
|
+
class="djm-popover-trigger"
|
|
619
|
+
@click="toggle"
|
|
620
|
+
@keydown.enter.self.prevent="toggle"
|
|
621
|
+
@keydown.space.self.prevent="toggle"
|
|
622
|
+
>
|
|
623
|
+
<slot :open="open"></slot>
|
|
624
|
+
</span>
|
|
625
|
+
<Teleport to="body">
|
|
626
|
+
<Transition name="djm-pop">
|
|
627
|
+
<div
|
|
628
|
+
v-if="open"
|
|
629
|
+
ref="panelEl"
|
|
630
|
+
class="djm-popover-panel"
|
|
631
|
+
:style="panelStyle"
|
|
632
|
+
@mouseenter="onHoverIn"
|
|
633
|
+
@mouseleave="onHoverOut"
|
|
634
|
+
>
|
|
635
|
+
<slot name="panel" :close="close"></slot>
|
|
636
|
+
</div>
|
|
637
|
+
</Transition>
|
|
638
|
+
</Teleport>
|
|
639
|
+
</span>
|
|
640
|
+
`};import{reactive as yl}from"vue";var bl={name:"DjmMenuSubList",components:{DjmIcon:L},props:{items:{type:Array,default:()=>[]},activeKey:{type:String,default:""},level:{type:Number,default:1}},emits:["pick"],setup(e,{emit:t}){let a=yl({key:null,top:0,left:0});function n(d){return Array.isArray(d.children)&&d.children.length>0}function i(d,f){if(!n(d))return;let c=f.currentTarget.getBoundingClientRect(),p=Math.min(d.children.length*34+10,420);a.key=d.key,a.top=Math.max(8,Math.min(c.top-5,window.innerHeight-p-8)),a.left=c.right}function l(){a.key=null}function o(d){d.currentTarget.contains(d.relatedTarget)||l()}function r(d){d.disabled||n(d)||t("pick",d)}function s(d){return d.key===e.activeKey?!0:n(d)&&d.children.some(f=>f.key===e.activeKey)}return{nested:a,hasChildren:n,place:i,clear:l,onFocusOut:o,onClick:r,isActive:s}},template:`
|
|
641
|
+
<ul class="djm-menu-sub djm-menu-pop" @scroll="clear">
|
|
642
|
+
<li
|
|
643
|
+
v-for="item in items"
|
|
644
|
+
:key="item.key"
|
|
645
|
+
class="djm-menu-sub-item"
|
|
646
|
+
:class="{ 'djm-has-sub': hasChildren(item) }"
|
|
647
|
+
@mouseenter="place(item, $event)"
|
|
648
|
+
@mouseleave="clear"
|
|
649
|
+
@focusout="onFocusOut"
|
|
650
|
+
>
|
|
651
|
+
<button
|
|
652
|
+
class="djm-menu-sub-link"
|
|
653
|
+
type="button"
|
|
654
|
+
:class="{ 'djm-is-active': isActive(item), 'djm-is-parent': hasChildren(item) }"
|
|
655
|
+
:aria-current="item.key === activeKey ? 'page' : null"
|
|
656
|
+
:disabled="item.disabled"
|
|
657
|
+
@click="onClick(item)"
|
|
658
|
+
@focus="place(item, $event)"
|
|
659
|
+
>
|
|
660
|
+
<DjmIcon v-if="item.icon" :name="item.icon" :size="14" class="djm-menu-icon" />
|
|
661
|
+
<span class="djm-menu-label">{{ item.label }}</span>
|
|
662
|
+
<i v-if="item.badge" class="djm-menu-count">{{ item.badge }}</i>
|
|
663
|
+
<DjmIcon v-if="hasChildren(item)" name="chevron-right" :size="12" class="djm-menu-arrow" />
|
|
664
|
+
</button>
|
|
665
|
+
|
|
666
|
+
<DjmMenuSubList
|
|
667
|
+
v-if="hasChildren(item) && nested.key === item.key"
|
|
668
|
+
class="djm-menu-pop-nested"
|
|
669
|
+
:items="item.children"
|
|
670
|
+
:active-key="activeKey"
|
|
671
|
+
:level="level + 1"
|
|
672
|
+
:style="{ position: 'fixed', top: nested.top + 'px', left: nested.left + 'px' }"
|
|
673
|
+
@pick="$emit('pick', $event)"
|
|
674
|
+
/>
|
|
675
|
+
</li>
|
|
676
|
+
</ul>
|
|
677
|
+
`},Ea={name:"DjmMenu",components:{DjmIcon:L,MenuSubList:bl},props:{items:{type:Array,default:()=>[]},mode:{type:String,default:"vertical"},activeKey:{type:String,default:""},collapsed:{type:Boolean,default:!1},defaultOpenKeys:{type:Array,default:()=>[]},accordion:{type:Boolean,default:!1},highlightGroup:{type:Boolean,default:!1}},emits:["select","update:activeKey"],data(){return{openKeys:this.defaultOpenKeys.slice()}},computed:{isHorizontal(){return this.mode==="horizontal"},isPopMode(){return this.isHorizontal||this.collapsed},menuClass(){return["djm-menu",this.isHorizontal?"djm-menu-horizontal":"djm-menu-vertical",{"djm-is-collapsed":this.collapsed&&!this.isHorizontal}]}},methods:{hasChildren(e){return Array.isArray(e.children)&&e.children.length>0},isOpen(e){return this.openKeys.indexOf(e.key)>-1},open(e){this.isOpen(e)||(this.accordion&&!this.isPopMode&&(this.openKeys=[]),this.openKeys.push(e.key))},close(e){let t=this.openKeys.indexOf(e.key);t>-1&&this.openKeys.splice(t,1)},toggle(e){this.isOpen(e)?this.close(e):this.open(e)},onItemClick(e){if(!e.disabled){if(this.hasChildren(e)){this.toggle(e);return}this.pick(e)}},pick(e){e.disabled||(this.$emit("update:activeKey",e.key),this.$emit("select",e),this.isHorizontal&&(this.openKeys=[]))},isActive(e){return e.key===this.activeKey?!0:this.highlightGroup?this.hasChildren(e)&&e.children.some(t=>t.key===this.activeKey):!1},itemTitle(e){return this.collapsed&&!this.isHorizontal?e.label:null}},template:`
|
|
678
|
+
<nav :class="menuClass">
|
|
679
|
+
<ul class="djm-menu-list">
|
|
680
|
+
<li
|
|
681
|
+
v-for="item in items"
|
|
682
|
+
:key="item.key"
|
|
683
|
+
class="djm-menu-item"
|
|
684
|
+
:class="{ 'djm-is-active': isActive(item), 'djm-is-open': isOpen(item), 'djm-is-disabled': item.disabled }"
|
|
685
|
+
@mouseenter="isHorizontal && hasChildren(item) && open(item)"
|
|
686
|
+
@mouseleave="isHorizontal && hasChildren(item) && close(item)"
|
|
687
|
+
>
|
|
688
|
+
<button
|
|
689
|
+
class="djm-menu-link"
|
|
690
|
+
type="button"
|
|
691
|
+
:title="itemTitle(item)"
|
|
692
|
+
:aria-current="isActive(item) ? 'page' : null"
|
|
693
|
+
:aria-expanded="hasChildren(item) ? String(isOpen(item)) : null"
|
|
694
|
+
:disabled="item.disabled"
|
|
695
|
+
@click="onItemClick(item)"
|
|
696
|
+
>
|
|
697
|
+
<DjmIcon v-if="item.icon" :name="item.icon" :size="15" class="djm-menu-icon" />
|
|
698
|
+
<span class="djm-menu-label">{{ item.label }}</span>
|
|
699
|
+
<i v-if="item.badge" class="djm-menu-count">{{ item.badge }}</i>
|
|
700
|
+
<DjmIcon
|
|
701
|
+
v-if="hasChildren(item)"
|
|
702
|
+
name="chevron-down"
|
|
703
|
+
:size="13"
|
|
704
|
+
class="djm-menu-arrow"
|
|
705
|
+
/>
|
|
706
|
+
</button>
|
|
707
|
+
|
|
708
|
+
<!-- \u5B50\u9879\uFF1A\u7AD6\u5411\u7528\u5185\u5D4C\u5C55\u5F00\uFF0C\u6A2A\u5411\u4E0E\u6536\u8D77\u6001\u7528\u6D6E\u51FA\u9762\u677F -->
|
|
709
|
+
<ul
|
|
710
|
+
v-if="hasChildren(item) && !isPopMode"
|
|
711
|
+
v-show="isOpen(item)"
|
|
712
|
+
class="djm-menu-sub"
|
|
713
|
+
>
|
|
714
|
+
<li v-for="child in item.children" :key="child.key" class="djm-menu-sub-item">
|
|
715
|
+
<button
|
|
716
|
+
class="djm-menu-sub-link"
|
|
717
|
+
type="button"
|
|
718
|
+
:class="{ 'djm-is-active': isActive(child) }"
|
|
719
|
+
:aria-current="isActive(child) ? 'page' : null"
|
|
720
|
+
:disabled="child.disabled"
|
|
721
|
+
@click="pick(child)"
|
|
722
|
+
>
|
|
723
|
+
<DjmIcon v-if="child.icon" :name="child.icon" :size="14" class="djm-menu-icon" />
|
|
724
|
+
<span class="djm-menu-label">{{ child.label }}</span>
|
|
725
|
+
<i v-if="child.badge" class="djm-menu-count">{{ child.badge }}</i>
|
|
726
|
+
</button>
|
|
727
|
+
</li>
|
|
728
|
+
</ul>
|
|
729
|
+
|
|
730
|
+
<MenuSubList
|
|
731
|
+
v-if="hasChildren(item) && isPopMode"
|
|
732
|
+
:items="item.children"
|
|
733
|
+
:active-key="activeKey"
|
|
734
|
+
@pick="pick"
|
|
735
|
+
/>
|
|
736
|
+
</li>
|
|
737
|
+
</ul>
|
|
738
|
+
</nav>
|
|
739
|
+
`};var wl={success:"green",warning:"amber",warn:"amber",danger:"red",error:"red",info:"brand",ok:"green",off:"default"},Ia={name:"DjmTag",props:{tone:{type:String,default:""},type:{type:String,default:""},size:{type:String,default:"md"},closable:{type:Boolean,default:!1}},emits:["close"],computed:{toneClass(){let e=this.tone||this.type||"default";return"djm-tag-"+(wl[e]||e)}},methods:{onClose(){this.$emit("close")},t:C},template:`
|
|
740
|
+
<span class="djm-tag" :class="[toneClass, size === 'sm' ? 'djm-tag-sm' : '']">
|
|
741
|
+
<slot></slot>
|
|
742
|
+
<button
|
|
743
|
+
v-if="closable"
|
|
744
|
+
class="djm-tag-close"
|
|
745
|
+
type="button"
|
|
746
|
+
:aria-label="t('common.removeTag')"
|
|
747
|
+
@click.stop="onClose"
|
|
748
|
+
>\xD7</button>
|
|
749
|
+
</span>
|
|
750
|
+
`};var La={name:"DjmCard",props:{title:{type:String,default:""},hoverable:{type:Boolean,default:!1},flush:{type:Boolean,default:!1}},template:`
|
|
751
|
+
<section class="djm-card" :class="{ 'djm-is-hoverable': hoverable, 'djm-is-flush': flush }">
|
|
752
|
+
<header v-if="title || $slots.extra" class="djm-card-head">
|
|
753
|
+
<div class="djm-card-title">{{ title }}<slot name="title"></slot></div>
|
|
754
|
+
<div v-if="$slots.extra" class="djm-card-extra"><slot name="extra"></slot></div>
|
|
755
|
+
</header>
|
|
756
|
+
<div class="djm-card-body"><slot></slot></div>
|
|
757
|
+
<footer v-if="$slots.footer" class="djm-card-foot"><slot name="footer"></slot></footer>
|
|
758
|
+
</section>
|
|
759
|
+
`};var Aa={name:"DjmProgress",props:{percent:{type:Number,default:0},status:{type:String,default:""},showText:{type:Boolean,default:!0},strokeWidth:{type:Number,default:6},color:{type:String,default:""}},computed:{safePercent(){return Math.min(100,Math.max(0,Number(this.percent)||0))},barStyle(){let e={width:this.safePercent+"%"};return this.color&&(e.background=this.color),e},trackStyle(){return{height:this.strokeWidth+"px"}}},template:`
|
|
760
|
+
<div class="djm-progress-line" :class="status ? 'djm-is-' + status : ''">
|
|
761
|
+
<div class="djm-progress" :style="trackStyle">
|
|
762
|
+
<div class="djm-progress-bar" :style="barStyle"></div>
|
|
763
|
+
</div>
|
|
764
|
+
<span v-if="showText" class="djm-progress-label">{{ safePercent }}%</span>
|
|
765
|
+
</div>
|
|
766
|
+
`};var Pa={name:"DjmSkeleton",props:{loading:{type:Boolean,default:!0},rows:{type:Number,default:3},title:{type:Boolean,default:!0},avatar:{type:Boolean,default:!1},animated:{type:Boolean,default:!0}},computed:{rowStyle(){return e=>({width:e===this.rows?"60%":"100%"})}},template:`
|
|
767
|
+
<div v-if="loading" class="djm-skeleton-block" :class="{ 'djm-is-static': !animated }" aria-busy="true">
|
|
768
|
+
<div v-if="avatar" class="djm-skeleton-avatar"></div>
|
|
769
|
+
<div class="djm-skeleton-main">
|
|
770
|
+
<div v-if="title" class="djm-skeleton djm-skeleton-title"></div>
|
|
771
|
+
<div
|
|
772
|
+
v-for="index in rows"
|
|
773
|
+
:key="index"
|
|
774
|
+
class="djm-skeleton"
|
|
775
|
+
:style="rowStyle(index)"
|
|
776
|
+
></div>
|
|
777
|
+
</div>
|
|
778
|
+
</div>
|
|
779
|
+
<slot v-else></slot>
|
|
780
|
+
`};var za={success:"check",warning:"alert",error:"x",info:"info"},jl={danger:"error"},Ba={name:"DjmResult",components:{DjmIcon:L},props:{status:{type:String,default:""},type:{type:String,default:""},title:{type:String,default:""},description:{type:String,default:""}},computed:{actualStatus(){let e=this.status||this.type||"info";return jl[e]||e},iconName(){return za[this.actualStatus]||za.info}},template:`
|
|
781
|
+
<div class="djm-result" :class="'djm-result-' + actualStatus" role="status">
|
|
782
|
+
<div class="djm-result-icon">
|
|
783
|
+
<slot name="icon">
|
|
784
|
+
<DjmIcon :name="iconName" :size="26" />
|
|
785
|
+
</slot>
|
|
786
|
+
</div>
|
|
787
|
+
<div class="djm-result-title">{{ title }}</div>
|
|
788
|
+
<div v-if="description" class="djm-result-desc">{{ description }}</div>
|
|
789
|
+
<div v-if="$slots.default" class="djm-result-extra"><slot></slot></div>
|
|
790
|
+
</div>
|
|
791
|
+
`};var Na={name:"DjmTimeline",props:{items:{type:Array,default:()=>[]}},template:`
|
|
792
|
+
<ul class="djm-timeline">
|
|
793
|
+
<li v-for="(item, index) in items" :key="item.key || index">
|
|
794
|
+
<i class="djm-timeline-dot" :class="item.tone ? 'djm-tone-' + item.tone : ''"></i>
|
|
795
|
+
<div class="djm-timeline-head">
|
|
796
|
+
<strong>{{ item.title }}</strong>
|
|
797
|
+
<span v-if="item.time">{{ item.time }}</span>
|
|
798
|
+
</div>
|
|
799
|
+
<p v-if="item.description">{{ item.description }}</p>
|
|
800
|
+
<slot name="item" :item="item"></slot>
|
|
801
|
+
</li>
|
|
802
|
+
</ul>
|
|
803
|
+
`};var Ra={name:"DjmCollapse",components:{DjmIcon:L},props:{items:{type:Array,default:()=>[]},modelValue:{type:Array,default:()=>[]},accordion:{type:Boolean,default:!1}},emits:["update:modelValue","change"],methods:{isOpen(e){return this.modelValue.indexOf(e.key)>-1},toggle(e){if(e.disabled)return;let t;this.accordion?t=this.isOpen(e)?[]:[e.key]:this.isOpen(e)?t=this.modelValue.filter(a=>a!==e.key):t=this.modelValue.concat(e.key),this.$emit("update:modelValue",t),this.$emit("change",t)}},template:`
|
|
804
|
+
<div class="djm-accordion">
|
|
805
|
+
<div v-for="item in items" :key="item.key" class="djm-accordion-item">
|
|
806
|
+
<button
|
|
807
|
+
class="djm-accordion-head"
|
|
808
|
+
type="button"
|
|
809
|
+
:aria-expanded="String(isOpen(item))"
|
|
810
|
+
:disabled="item.disabled"
|
|
811
|
+
@click="toggle(item)"
|
|
812
|
+
>
|
|
813
|
+
<span>{{ item.title }}</span>
|
|
814
|
+
<DjmIcon :name="isOpen(item) ? 'chevron-up' : 'chevron-down'" :size="14" />
|
|
815
|
+
</button>
|
|
816
|
+
<div v-show="isOpen(item)" class="djm-accordion-body">
|
|
817
|
+
<slot name="item" :item="item">{{ item.content }}</slot>
|
|
818
|
+
</div>
|
|
819
|
+
</div>
|
|
820
|
+
</div>
|
|
821
|
+
`};var Va={name:"DjmStatistic",props:{title:{type:String,default:""},value:{type:[Number,String],default:0},precision:{type:Number,default:0},prefix:{type:String,default:""},suffix:{type:String,default:""},trend:{type:Number,default:0},trendLabel:{type:String,default:"\u8F83\u4E0A\u671F"}},computed:{display(){let e=Number(this.value);if(!Number.isFinite(e))return this.value;let t=Math.min(100,Math.max(0,Math.floor(Number(this.precision))||0));return e.toFixed(t)}},template:`
|
|
822
|
+
<div class="djm-stat">
|
|
823
|
+
<div class="djm-stat-title">{{ title }}</div>
|
|
824
|
+
<div class="djm-stat-value">
|
|
825
|
+
<span v-if="prefix" class="djm-stat-affix">{{ prefix }}</span>
|
|
826
|
+
<strong>{{ display }}</strong>
|
|
827
|
+
<span v-if="suffix" class="djm-stat-affix">{{ suffix }}</span>
|
|
828
|
+
</div>
|
|
829
|
+
<div v-if="trend" class="djm-stat-trend" :class="trend > 0 ? 'djm-is-up' : 'djm-is-down'">
|
|
830
|
+
<span class="djm-stat-trend-label">{{ trendLabel }}</span>
|
|
831
|
+
{{ trend > 0 ? '+' : '' }}{{ trend }}%
|
|
832
|
+
</div>
|
|
833
|
+
</div>
|
|
834
|
+
`};var Ha={name:"DjmSteps",components:{DjmIcon:L},props:{items:{type:Array,default:()=>[]},current:{type:Number,default:0},direction:{type:String,default:"horizontal"},status:{type:String,default:""}},methods:{stepState(e){return e<this.current?"finish":e===this.current?this.status==="error"?"error":"process":"wait"},t:C},template:`
|
|
835
|
+
<div class="djm-steps" :class="'djm-steps-' + direction">
|
|
836
|
+
<div
|
|
837
|
+
v-for="(item, index) in items"
|
|
838
|
+
:key="item.key || index"
|
|
839
|
+
class="djm-step"
|
|
840
|
+
:class="'djm-is-' + stepState(index)"
|
|
841
|
+
:aria-current="index === current ? 'step' : undefined"
|
|
842
|
+
>
|
|
843
|
+
<div class="djm-step-head">
|
|
844
|
+
<span class="djm-step-icon" aria-hidden="true">
|
|
845
|
+
<DjmIcon v-if="index < current" name="check" :size="12" />
|
|
846
|
+
<template v-else>{{ index + 1 }}</template>
|
|
847
|
+
</span>
|
|
848
|
+
<span class="djm-sr-only">{{ t('steps.order', { index: index + 1 }) }}</span>
|
|
849
|
+
<span class="djm-step-title">{{ item.title }}</span>
|
|
850
|
+
<span v-if="index < items.length - 1" class="djm-step-line" aria-hidden="true"></span>
|
|
851
|
+
</div>
|
|
852
|
+
<div v-if="item.description" class="djm-step-desc">{{ item.description }}</div>
|
|
853
|
+
</div>
|
|
854
|
+
</div>
|
|
855
|
+
`};var Fe={name:"DjmInputNumber",props:{modelValue:{type:Number,default:null},min:{type:Number,default:-1/0},max:{type:Number,default:1/0},step:{type:Number,default:1},precision:{type:Number,default:0},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:""},ariaLabel:{type:String,default:"\u6570\u5B57\u8F93\u5165"}},emits:["update:modelValue","change","focus","blur"],data(){return{draft:this.displayOf(this.modelValue)}},watch:{modelValue(e){this.draft=this.displayOf(e)}},computed:{canDecrease(){return!this.disabled&&Number(this.modelValue)>this.min},canIncrease(){return!this.disabled&&Number(this.modelValue)<this.max}},methods:{displayOf(e){if(e==null||e==="")return"";let t=Number(e);return Number.isFinite(t)?t.toFixed(this.precision):""},normalize(e){if(e==null||e==="")return null;let t=Number(e);return Number.isFinite(t)?(t=Math.min(this.max,Math.max(this.min,t)),Number(t.toFixed(this.precision))):null},commit(e){let t=this.normalize(e);this.draft=this.displayOf(t),t!==this.modelValue&&(this.$emit("update:modelValue",t),this.$emit("change",t))},stepBy(e){if(this.disabled)return;let t=Number(this.modelValue);this.commit((Number.isFinite(t)?t:0)+e)},onInput(e){this.draft=e.target.value},onBlur(e){this.draft===""?this.commit(null):this.commit(this.draft),this.$emit("blur",e)},onKeydown(e){e.key==="ArrowUp"?(e.preventDefault(),this.stepBy(this.step)):e.key==="ArrowDown"&&(e.preventDefault(),this.stepBy(-this.step))}},template:`
|
|
856
|
+
<div class="djm-input-number" :class="{ 'djm-is-disabled': disabled }">
|
|
857
|
+
<input
|
|
858
|
+
class="djm-input"
|
|
859
|
+
type="text"
|
|
860
|
+
autocomplete="off"
|
|
861
|
+
inputmode="decimal"
|
|
862
|
+
:value="draft"
|
|
863
|
+
:placeholder="placeholder"
|
|
864
|
+
:disabled="disabled"
|
|
865
|
+
:aria-label="ariaLabel"
|
|
866
|
+
@input="onInput"
|
|
867
|
+
@blur="onBlur"
|
|
868
|
+
@focus="$emit('focus', $event)"
|
|
869
|
+
@keydown="onKeydown"
|
|
870
|
+
@keyup.enter="$event.target.blur()"
|
|
871
|
+
/>
|
|
872
|
+
<span class="djm-input-number-step">
|
|
873
|
+
<button type="button" tabindex="-1" aria-label="\u589E\u52A0" :disabled="!canIncrease" @click="stepBy(step)">
|
|
874
|
+
<svg viewBox="0 0 12 8" width="9" height="6" fill="none" stroke="currentColor" stroke-width="1.6"><path d="M1 6l5-4 5 4" /></svg>
|
|
875
|
+
</button>
|
|
876
|
+
<button type="button" tabindex="-1" aria-label="\u51CF\u5C11" :disabled="!canDecrease" @click="stepBy(-step)">
|
|
877
|
+
<svg viewBox="0 0 12 8" width="9" height="6" fill="none" stroke="currentColor" stroke-width="1.6"><path d="M1 2l5 4 5-4" /></svg>
|
|
878
|
+
</button>
|
|
879
|
+
</span>
|
|
880
|
+
</div>
|
|
881
|
+
`};var ut={name:"DjmRate",props:{modelValue:{type:Number,default:0},count:{type:Number,default:5},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0}},emits:["update:modelValue","change"],data(){return{hovered:0}},computed:{activeCount(){return this.hovered||this.modelValue}},methods:{pick(e){if(this.disabled||this.readonly)return;let t=this.clearable&&this.modelValue===e?0:e;this.$emit("update:modelValue",t),this.$emit("change",t)},onKey(e,t){if(this.disabled||this.readonly)return;let a=t.key==="ArrowRight"||t.key==="ArrowUp"?1:t.key==="ArrowLeft"||t.key==="ArrowDown"?-1:0,n=0;a?n=Math.min(this.count,Math.max(1,e+a)):t.key==="Home"?n=1:t.key==="End"&&(n=this.count),n&&(t.preventDefault(),this.pick(n),this.$nextTick(()=>{let l=(this.$refs.stars||[])[n-1];l&&l.focus()}))}},template:`
|
|
882
|
+
<div
|
|
883
|
+
class="djm-rate"
|
|
884
|
+
:class="{ 'djm-is-disabled': disabled || readonly }"
|
|
885
|
+
role="radiogroup"
|
|
886
|
+
:aria-label="'\u8BC4\u5206 ' + modelValue + ' \u5206'"
|
|
887
|
+
@mouseleave="hovered = 0"
|
|
888
|
+
>
|
|
889
|
+
<button
|
|
890
|
+
v-for="index in count"
|
|
891
|
+
ref="stars"
|
|
892
|
+
:key="index"
|
|
893
|
+
class="djm-rate-star"
|
|
894
|
+
:class="{ 'djm-is-on': index <= activeCount }"
|
|
895
|
+
type="button"
|
|
896
|
+
role="radio"
|
|
897
|
+
:aria-checked="String(index === modelValue)"
|
|
898
|
+
:aria-label="index + ' \u5206'"
|
|
899
|
+
:tabindex="index === (modelValue || 1) ? 0 : -1"
|
|
900
|
+
:disabled="disabled || readonly"
|
|
901
|
+
@mouseenter="hovered = index"
|
|
902
|
+
@focus="hovered = index"
|
|
903
|
+
@blur="hovered = 0"
|
|
904
|
+
@click="pick(index)"
|
|
905
|
+
@keydown="onKey(index, $event)"
|
|
906
|
+
>
|
|
907
|
+
<svg viewBox="0 0 24 24" width="17" height="17" fill="currentColor" aria-hidden="true">
|
|
908
|
+
<path d="M12 2.6l2.9 5.9 6.5.9-4.7 4.6 1.1 6.4L12 17.4l-5.8 3 1.1-6.4L2.6 9.4l6.5-.9z" />
|
|
909
|
+
</svg>
|
|
910
|
+
</button>
|
|
911
|
+
</div>
|
|
912
|
+
`};var mt={name:"DjmSlider",props:{modelValue:{type:[Number,Array],default:0},min:{type:Number,default:0},max:{type:Number,default:100},step:{type:Number,default:1},disabled:{type:Boolean,default:!1},marks:{type:Object,default:()=>({})}},emits:["update:modelValue","change"],data(){return{dragging:-1}},computed:{stepSize(){return Math.abs(Number(this.step))||1},isRange(){return Array.isArray(this.modelValue)},values(){return(this.isRange?this.modelValue:[this.modelValue]).map(t=>this.clamp(Number(t)||0))},barStyle(){let e=this.percentOf(this.values[0]),t=this.percentOf(this.values[this.values.length-1]);return{left:e+"%",width:t-e+"%"}},markList(){return Object.keys(this.marks).map(e=>({value:Number(e),label:this.marks[e],percent:this.percentOf(Number(e))}))}},methods:{clamp(e){let t=this.isRange?this.min:this.min;return Math.min(this.max,Math.max(t,e))},percentOf(e){return this.max===this.min?0:(e-this.min)/(this.max-this.min)*100},quantize(e){let t=Math.round((e-this.min)/this.stepSize);return Number((this.min+t*this.stepSize).toFixed(6))},valueAt(e){let t=this.$refs.track.getBoundingClientRect();if(!t.width)return this.min;let a=Math.min(1,Math.max(0,(e-t.left)/t.width));return this.quantize(this.min+a*(this.max-this.min))},emitValue(e){let t=this.isRange?e:e[0];this.$emit("update:modelValue",t)},startDrag(e,t){this.disabled||(t.preventDefault(),t.stopPropagation(),this.dragging=e,window.addEventListener("pointermove",this.onMove),window.addEventListener("pointerup",this.onUp),this.$refs.track.setPointerCapture&&this.$refs.track.setPointerCapture(t.pointerId))},onTrackDown(e){if(this.disabled)return;let t=this.valueAt(e.clientX),a=this.values.slice();if(!this.isRange){this.emitValue([t]),this.startDrag(0,e);return}let n=Math.abs(t-a[0])<=Math.abs(t-a[1])?0:1;a[n]=t,a.sort((i,l)=>i-l),this.emitValue(a),this.startDrag(n,e)},onMove(e){if(this.dragging<0)return;let t=this.valueAt(e.clientX),a=this.values.slice();if(this.isRange){let n=a[1-this.dragging];a[this.dragging]=this.dragging===0?Math.min(t,n):Math.max(t,n)}else a[0]=t;this.emitValue(a)},onUp(){this.dragging<0||(this.dragging=-1,window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onUp),this.$emit("change",this.isRange?this.values.slice():this.values[0]))},onKey(e,t){if(this.disabled)return;let a=t.key==="ArrowRight"||t.key==="ArrowUp"?this.stepSize:t.key==="ArrowLeft"||t.key==="ArrowDown"?-this.stepSize:0;if(!a)return;t.preventDefault();let n=this.values.slice();n[e]=Math.min(this.max,Math.max(this.min,n[e]+a)),this.isRange&&e===0&&n[0]>n[1]&&(n[0]=n[1]),this.isRange&&e===1&&n[1]<n[0]&&(n[1]=n[0]),this.emitValue(n),this.$emit("change",this.isRange?n:n[0])}},beforeUnmount(){window.removeEventListener("pointermove",this.onMove),window.removeEventListener("pointerup",this.onUp)},template:`
|
|
913
|
+
<div class="djm-slider" :class="{ 'djm-is-disabled': disabled, 'djm-has-marks': markList.length }">
|
|
914
|
+
<div class="djm-slider-track" ref="track" @pointerdown="onTrackDown">
|
|
915
|
+
<div class="djm-slider-rail"></div>
|
|
916
|
+
<div class="djm-slider-bar" :style="barStyle"></div>
|
|
917
|
+
<button
|
|
918
|
+
v-for="(value, index) in values"
|
|
919
|
+
:key="index"
|
|
920
|
+
class="djm-slider-thumb"
|
|
921
|
+
type="button"
|
|
922
|
+
role="slider"
|
|
923
|
+
:aria-valuemin="min"
|
|
924
|
+
:aria-valuemax="max"
|
|
925
|
+
:aria-valuenow="value"
|
|
926
|
+
:aria-label="isRange ? (index === 0 ? '\u8D77\u59CB\u503C' : '\u7ED3\u675F\u503C') : '\u5F53\u524D\u503C'"
|
|
927
|
+
:style="{ left: percentOf(value) + '%' }"
|
|
928
|
+
:disabled="disabled"
|
|
929
|
+
@pointerdown="startDrag(index, $event)"
|
|
930
|
+
@keydown="onKey(index, $event)"
|
|
931
|
+
></button>
|
|
932
|
+
</div>
|
|
933
|
+
<div v-if="markList.length" class="djm-slider-marks">
|
|
934
|
+
<span
|
|
935
|
+
v-for="mark in markList"
|
|
936
|
+
:key="mark.value"
|
|
937
|
+
class="djm-slider-mark"
|
|
938
|
+
:style="{ left: mark.percent + '%' }"
|
|
939
|
+
>{{ mark.label }}</span>
|
|
940
|
+
</div>
|
|
941
|
+
</div>
|
|
942
|
+
`};var Wt=e=>String(e).padStart(2,"0"),ft={name:"DjmTimePicker",components:{DjmIcon:L},props:{modelValue:{type:String,default:""},format:{type:String,default:"HH:mm"},minuteStep:{type:Number,default:1},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:"\u9009\u62E9\u65F6\u95F4"},clearable:{type:Boolean,default:!0}},emits:["update:modelValue","change","visible-change"],watch:{open(e){this.$emit("visible-change",e)}},data(){return{open:!1,draft:{h:"00",m:"00",s:"00"},panelStyle:{...Z}}},computed:{hasSeconds(){return this.format.indexOf("ss")>-1},hours(){return Array.from({length:24},(e,t)=>Wt(t))},minutes(){let e=Math.max(1,Math.floor(Number(this.minuteStep))||1),t=[];for(let a=0;a<60;a+=e)t.push(Wt(a));return t},seconds(){return Array.from({length:60},(e,t)=>Wt(t))},columnDefs(){let e=[{key:"h",list:this.hours},{key:"m",list:this.minutes}];return this.hasSeconds&&e.push({key:"s",list:this.seconds}),e}},methods:{openPanel(){if(this.disabled)return;let e=(this.modelValue||"00:00:00").split(":");this.draft={h:e[0]||"00",m:e[1]||"00",s:e[2]||"00"},this.open=!0,this._detachPanel=G({root:()=>this.$refs.root,panel:()=>this.$refs.panel,onClose:this.closePanel,onReposition:this.updatePosition}),requestAnimationFrame(this.updatePosition)},updatePosition(){if(!this.open||!this.$refs.root)return;let e=this.$refs.root.getBoundingClientRect(),t=this.$refs.panel;this.panelStyle=de({rect:e,flip:se(e,t?t.offsetHeight:240),clampWidth:t?t.offsetWidth:180})},closePanel(){this.open&&(this.open=!1,this.panelStyle={...Z},this._detachPanel&&(this._detachPanel(),this._detachPanel=null))},pick(e,t){this.draft={...this.draft,[e]:t};let a=this.hasSeconds?this.draft.h+":"+this.draft.m+":"+this.draft.s:this.draft.h+":"+this.draft.m;this.$emit("update:modelValue",a),this.$emit("change",a)},clear(){this.$emit("update:modelValue",""),this.$emit("change","")}},beforeUnmount(){this.closePanel()},template:`
|
|
943
|
+
<div class="djm-time-picker" ref="root" :class="{ 'djm-is-disabled': disabled }">
|
|
944
|
+
<!-- \u7528 div \u627F\u8F7D combobox\uFF0C\u6E05\u7A7A\u6309\u94AE\u4F5C\u4E3A\u5176\u5B50\u5143\u7D20\uFF0C\u907F\u514D\u6309\u94AE\u5D4C\u5957\u6309\u94AE -->
|
|
945
|
+
<div
|
|
946
|
+
class="djm-input djm-time-trigger"
|
|
947
|
+
role="combobox"
|
|
948
|
+
:tabindex="disabled ? -1 : 0"
|
|
949
|
+
:aria-expanded="String(open)"
|
|
950
|
+
:aria-disabled="String(disabled)"
|
|
951
|
+
:aria-label="modelValue || placeholder"
|
|
952
|
+
aria-haspopup="dialog"
|
|
953
|
+
@click="open ? closePanel() : openPanel()"
|
|
954
|
+
@keydown.enter.prevent="open ? closePanel() : openPanel()"
|
|
955
|
+
@keydown.space.prevent="open ? closePanel() : openPanel()"
|
|
956
|
+
>
|
|
957
|
+
<span :class="{ 'djm-muted': !modelValue }">{{ modelValue || placeholder }}</span>
|
|
958
|
+
<button
|
|
959
|
+
v-if="clearable && modelValue && !disabled"
|
|
960
|
+
class="djm-time-clear"
|
|
961
|
+
type="button"
|
|
962
|
+
aria-label="\u6E05\u7A7A\u65F6\u95F4"
|
|
963
|
+
@click.stop="clear"
|
|
964
|
+
>\xD7</button>
|
|
965
|
+
<DjmIcon v-else name="clock" :size="13" class="djm-time-icon" />
|
|
966
|
+
</div>
|
|
967
|
+
|
|
968
|
+
<Teleport to="body">
|
|
969
|
+
<div
|
|
970
|
+
v-if="open"
|
|
971
|
+
ref="panel"
|
|
972
|
+
class="djm-time-panel"
|
|
973
|
+
:style="panelStyle"
|
|
974
|
+
role="dialog"
|
|
975
|
+
aria-label="\u9009\u62E9\u65F6\u95F4"
|
|
976
|
+
>
|
|
977
|
+
<div
|
|
978
|
+
v-for="col in columnDefs"
|
|
979
|
+
:key="col.key"
|
|
980
|
+
class="djm-time-col"
|
|
981
|
+
>
|
|
982
|
+
<div class="djm-time-scroll">
|
|
983
|
+
<button
|
|
984
|
+
v-for="item in col.list"
|
|
985
|
+
:key="item"
|
|
986
|
+
class="djm-time-cell"
|
|
987
|
+
:class="{ 'djm-is-active': draft[col.key] === item }"
|
|
988
|
+
type="button"
|
|
989
|
+
@click="pick(col.key, item)"
|
|
990
|
+
>{{ item }}</button>
|
|
991
|
+
</div>
|
|
992
|
+
</div>
|
|
993
|
+
</div>
|
|
994
|
+
</Teleport>
|
|
995
|
+
</div>
|
|
996
|
+
`};var pt={name:"DjmColorPicker",props:{modelValue:{type:String,default:""},presets:{type:Array,default:()=>["#145a9f","#2b86d9","#4ec98d","#178050","#e3b45f","#966215","#ef8071","#c0392b","#805ad5","#4a5568","#1e2b3a","#f1f4f9"]},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","change","visible-change"],data(){return{open:!1,draft:this.modelValue,panelStyle:{...Z}}},watch:{modelValue(e){this.draft=e},open(e){this.$emit("visible-change",e)}},methods:{openPanel(){this.disabled||(this.draft=this.modelValue,this.open=!0,this._detachPanel=G({root:()=>this.$refs.root,panel:()=>this.$refs.panel,onClose:this.closePanel,onReposition:this.updatePosition}),requestAnimationFrame(this.updatePosition))},updatePosition(){if(!this.open||!this.$refs.root)return;let e=this.$refs.root.getBoundingClientRect(),t=this.$refs.panel;this.panelStyle=de({rect:e,flip:se(e,t?t.offsetHeight:220),clampWidth:t?t.offsetWidth:220})},closePanel(){this.open&&(this.open=!1,this.panelStyle={...Z},this._detachPanel&&(this._detachPanel(),this._detachPanel=null))},emitColor(e){this.$emit("update:modelValue",e),this.$emit("change",e)},pick(e){this.draft=e,this.emitColor(e)},commitInput(){let e=this.draft.trim();if(!/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e)){this.draft=this.modelValue;return}this.emitColor(e.toLowerCase())}},beforeUnmount(){this.closePanel()},template:`
|
|
997
|
+
<div class="djm-color-picker" ref="root" :class="{ 'djm-is-disabled': disabled }">
|
|
998
|
+
<button
|
|
999
|
+
class="djm-input djm-color-trigger"
|
|
1000
|
+
type="button"
|
|
1001
|
+
:disabled="disabled"
|
|
1002
|
+
:aria-expanded="String(open)"
|
|
1003
|
+
aria-haspopup="dialog"
|
|
1004
|
+
aria-label="\u9009\u62E9\u989C\u8272"
|
|
1005
|
+
@click="open ? closePanel() : openPanel()"
|
|
1006
|
+
>
|
|
1007
|
+
<span class="djm-color-swatch" :style="{ background: modelValue || 'transparent' }"></span>
|
|
1008
|
+
<span class="djm-color-text" :class="{ 'djm-muted': !modelValue }">{{ modelValue || '\u9009\u62E9\u989C\u8272' }}</span>
|
|
1009
|
+
</button>
|
|
1010
|
+
|
|
1011
|
+
<Teleport to="body">
|
|
1012
|
+
<div v-if="open" ref="panel" class="djm-color-panel" :style="panelStyle" role="dialog" aria-label="\u989C\u8272\u9762\u677F">
|
|
1013
|
+
<div class="djm-color-grid">
|
|
1014
|
+
<button
|
|
1015
|
+
v-for="color in presets"
|
|
1016
|
+
:key="color"
|
|
1017
|
+
class="djm-color-cell"
|
|
1018
|
+
:class="{ 'djm-is-active': color.toLowerCase() === (modelValue || '').toLowerCase() }"
|
|
1019
|
+
type="button"
|
|
1020
|
+
:style="{ background: color }"
|
|
1021
|
+
:aria-label="color"
|
|
1022
|
+
@click="pick(color)"
|
|
1023
|
+
></button>
|
|
1024
|
+
</div>
|
|
1025
|
+
<div class="djm-color-input-row">
|
|
1026
|
+
<span class="djm-color-preview" :style="{ background: draft || 'transparent' }"></span>
|
|
1027
|
+
<input
|
|
1028
|
+
v-model="draft"
|
|
1029
|
+
class="djm-input"
|
|
1030
|
+
autocomplete="off"
|
|
1031
|
+
placeholder="#145a9f"
|
|
1032
|
+
aria-label="\u989C\u8272\u503C"
|
|
1033
|
+
@keyup.enter="commitInput"
|
|
1034
|
+
@blur="commitInput"
|
|
1035
|
+
/>
|
|
1036
|
+
</div>
|
|
1037
|
+
</div>
|
|
1038
|
+
</Teleport>
|
|
1039
|
+
</div>
|
|
1040
|
+
`};var Ke={name:"DjmCascader",components:{DjmIcon:L},props:{modelValue:{type:Array,default:()=>[]},options:{type:Array,default:()=>[]},placeholder:{type:String,default:"\u8BF7\u9009\u62E9"},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0}},emits:["update:modelValue","change","visible-change"],watch:{open(e){this.$emit("visible-change",e)}},data(){return{open:!1,activePath:[],panelStyle:{...Z}}},computed:{selectedLabels(){let e=[],t=this.options;for(let a of this.modelValue){let n=(t||[]).find(i=>i.value===a);if(!n)break;e.push(n.label),t=n.children}return e},columns(){let e=[this.options],t=this.options;for(let a=0;a<this.activePath.length;a++){let n=(t||[]).find(i=>i.value===this.activePath[a]);if(!n||!n.children||!n.children.length)break;e.push(n.children),t=n.children}return e}},methods:{t:C,openPanel(){this.disabled||(this.activePath=this.modelValue.slice(),this.open=!0,this._detachPanel=G({root:()=>this.$refs.root,panel:()=>this.$refs.panel,onClose:this.closePanel,onReposition:this.updatePosition}),requestAnimationFrame(this.updatePosition))},updatePosition(){if(!this.open||!this.$refs.root)return;let e=this.$refs.root.getBoundingClientRect(),t=this.$refs.panel;this.panelStyle=de({rect:e,flip:se(e,t?t.offsetHeight:240),clampWidth:t?t.offsetWidth:320})},closePanel(){this.open&&(this.open=!1,this.panelStyle={...Z},this._detachPanel&&(this._detachPanel(),this._detachPanel=null))},pick(e,t){this.activePath=this.activePath.slice(0,t).concat(e.value),(!e.children||!e.children.length)&&(this.$emit("update:modelValue",this.activePath.slice()),this.$emit("change",this.activePath.slice()),this.closePanel())},isActive(e,t){return this.activePath[t]===e.value},clear(){this.$emit("update:modelValue",[]),this.$emit("change",[])}},beforeUnmount(){this.closePanel()},template:`
|
|
1041
|
+
<div class="djm-cascader" ref="root" :class="{ 'djm-is-disabled': disabled }">
|
|
1042
|
+
<!-- \u7528 div \u627F\u8F7D combobox\uFF0C\u6E05\u7A7A\u6309\u94AE\u4F5C\u4E3A\u5176\u5B50\u5143\u7D20\uFF0C\u907F\u514D\u6309\u94AE\u5D4C\u5957\u6309\u94AE -->
|
|
1043
|
+
<div
|
|
1044
|
+
class="djm-input djm-cascader-trigger"
|
|
1045
|
+
role="combobox"
|
|
1046
|
+
:tabindex="disabled ? -1 : 0"
|
|
1047
|
+
:aria-expanded="String(open)"
|
|
1048
|
+
:aria-disabled="String(disabled)"
|
|
1049
|
+
:aria-label="selectedLabels.length ? selectedLabels.join(' / ') : placeholder"
|
|
1050
|
+
aria-haspopup="dialog"
|
|
1051
|
+
@click="open ? closePanel() : openPanel()"
|
|
1052
|
+
@keydown.enter.prevent="open ? closePanel() : openPanel()"
|
|
1053
|
+
@keydown.space.prevent="open ? closePanel() : openPanel()"
|
|
1054
|
+
>
|
|
1055
|
+
<span v-if="selectedLabels.length" class="djm-cascader-text">{{ selectedLabels.join(' / ') }}</span>
|
|
1056
|
+
<span v-else class="djm-cascader-text djm-muted">{{ placeholder }}</span>
|
|
1057
|
+
<button
|
|
1058
|
+
v-if="clearable && selectedLabels.length && !disabled"
|
|
1059
|
+
class="djm-cascader-clear"
|
|
1060
|
+
type="button"
|
|
1061
|
+
aria-label="\u6E05\u7A7A\u9009\u62E9"
|
|
1062
|
+
@click.stop="clear"
|
|
1063
|
+
>\xD7</button>
|
|
1064
|
+
<DjmIcon v-else name="chevron-down" :size="13" class="djm-cascader-arrow" />
|
|
1065
|
+
</div>
|
|
1066
|
+
|
|
1067
|
+
<Teleport to="body">
|
|
1068
|
+
<div v-if="open" ref="panel" class="djm-cascader-panel" :style="panelStyle" role="dialog" aria-label="\u7EA7\u8054\u9009\u62E9">
|
|
1069
|
+
<div v-if="!options.length" class="djm-cascader-empty">{{ t('cascader.empty') }}</div>
|
|
1070
|
+
<div v-for="(column, depth) in columns" :key="depth" class="djm-cascader-col">
|
|
1071
|
+
<button
|
|
1072
|
+
v-for="node in column"
|
|
1073
|
+
:key="node.value"
|
|
1074
|
+
class="djm-cascader-cell"
|
|
1075
|
+
:class="{ 'djm-is-active': isActive(node, depth) }"
|
|
1076
|
+
type="button"
|
|
1077
|
+
@click="pick(node, depth)"
|
|
1078
|
+
>
|
|
1079
|
+
<span>{{ node.label }}</span>
|
|
1080
|
+
<DjmIcon v-if="node.children && node.children.length" name="chevron-right" :size="12" />
|
|
1081
|
+
</button>
|
|
1082
|
+
</div>
|
|
1083
|
+
</div>
|
|
1084
|
+
</Teleport>
|
|
1085
|
+
</div>
|
|
1086
|
+
`};var Oa={name:"DjmTransfer",props:{modelValue:{type:Array,default:()=>[]},data:{type:Array,default:()=>[]},titles:{type:Array,default:()=>["\u5F85\u9009","\u5DF2\u9009"]},searchable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","change"],data(){return{checkedLeft:[],checkedRight:[],leftKeyword:"",rightKeyword:""}},watch:{leftKeyword(){this.checkedLeft=this.checkedLeft.filter(e=>this.leftList.some(t=>t.value===e))},rightKeyword(){this.checkedRight=this.checkedRight.filter(e=>this.rightList.some(t=>t.value===e))}},computed:{leftList(){return this.filtered(this.data.filter(e=>this.modelValue.indexOf(e.value)===-1),this.leftKeyword)},rightList(){return this.filtered(this.data.filter(e=>this.modelValue.indexOf(e.value)>-1),this.rightKeyword)},leftAllChecked(){return this.leftList.length>0&&this.leftList.every(e=>this.checkedLeft.indexOf(e.value)>-1)},rightAllChecked(){return this.rightList.length>0&&this.rightList.every(e=>this.checkedRight.indexOf(e.value)>-1)}},methods:{filtered(e,t){let a=t.trim().toLowerCase();return a?e.filter(n=>n.label.toLowerCase().indexOf(a)>-1):e},toggleLeft(e){e.disabled||this.disabled||(this.checkedLeft=this.toggleValue(this.checkedLeft,e.value))},toggleRight(e){e.disabled||this.disabled||(this.checkedRight=this.toggleValue(this.checkedRight,e.value))},toggleValue(e,t){return e.indexOf(t)>-1?e.filter(a=>a!==t):e.concat(t)},toggleAll(e){if(!this.disabled)if(e==="left"){let t=this.leftList.filter(a=>!a.disabled).map(a=>a.value);this.checkedLeft=this.leftAllChecked?[]:t}else{let t=this.rightList.filter(a=>!a.disabled).map(a=>a.value);this.checkedRight=this.rightAllChecked?[]:t}},move(e){if(this.disabled)return;let t;if(e==="right"){let a=this.checkedLeft.filter(n=>{let i=this.data.find(l=>l.value===n);return i&&!i.disabled});t=this.modelValue.concat(a),this.checkedLeft=[]}else t=this.modelValue.filter(a=>this.checkedRight.indexOf(a)===-1),this.checkedRight=[];this.$emit("update:modelValue",t),this.$emit("change",t)}},template:`
|
|
1087
|
+
<div class="djm-transfer" :class="{ 'djm-is-disabled': disabled }">
|
|
1088
|
+
<div class="djm-transfer-panel">
|
|
1089
|
+
<div class="djm-transfer-head">
|
|
1090
|
+
<label class="djm-transfer-all">
|
|
1091
|
+
<input type="checkbox" :checked="leftAllChecked" :aria-label="'\u5168\u9009' + titles[0]" @change="toggleAll('left')" />
|
|
1092
|
+
<span>{{ titles[0] }}</span>
|
|
1093
|
+
</label>
|
|
1094
|
+
<span class="djm-transfer-count">{{ checkedLeft.length }}/{{ leftList.length }}</span>
|
|
1095
|
+
</div>
|
|
1096
|
+
<div v-if="searchable" class="djm-transfer-search">
|
|
1097
|
+
<input v-model="leftKeyword" class="djm-input" autocomplete="off" :aria-label="'\u641C\u7D22' + titles[0]" placeholder="\u641C\u7D22" />
|
|
1098
|
+
</div>
|
|
1099
|
+
<div class="djm-transfer-list">
|
|
1100
|
+
<label v-for="item in leftList" :key="item.value" class="djm-transfer-item" :class="{ 'djm-is-disabled': item.disabled }">
|
|
1101
|
+
<input
|
|
1102
|
+
type="checkbox"
|
|
1103
|
+
:checked="checkedLeft.indexOf(item.value) > -1"
|
|
1104
|
+
:disabled="item.disabled || disabled"
|
|
1105
|
+
@change="toggleLeft(item)"
|
|
1106
|
+
/>
|
|
1107
|
+
<span>{{ item.label }}</span>
|
|
1108
|
+
</label>
|
|
1109
|
+
<div v-if="!leftList.length" class="djm-transfer-empty">\u6CA1\u6709\u5339\u914D\u9879</div>
|
|
1110
|
+
</div>
|
|
1111
|
+
</div>
|
|
1112
|
+
|
|
1113
|
+
<div class="djm-transfer-actions">
|
|
1114
|
+
<button class="djm-btn djm-btn-sm" type="button" :disabled="!checkedLeft.length || disabled" @click="move('right')">\u2192</button>
|
|
1115
|
+
<button class="djm-btn djm-btn-sm" type="button" :disabled="!checkedRight.length || disabled" @click="move('left')">\u2190</button>
|
|
1116
|
+
</div>
|
|
1117
|
+
|
|
1118
|
+
<div class="djm-transfer-panel">
|
|
1119
|
+
<div class="djm-transfer-head">
|
|
1120
|
+
<label class="djm-transfer-all">
|
|
1121
|
+
<input type="checkbox" :checked="rightAllChecked" :aria-label="'\u5168\u9009' + titles[1]" @change="toggleAll('right')" />
|
|
1122
|
+
<span>{{ titles[1] }}</span>
|
|
1123
|
+
</label>
|
|
1124
|
+
<span class="djm-transfer-count">{{ checkedRight.length }}/{{ rightList.length }}</span>
|
|
1125
|
+
</div>
|
|
1126
|
+
<div v-if="searchable" class="djm-transfer-search">
|
|
1127
|
+
<input v-model="rightKeyword" class="djm-input" autocomplete="off" :aria-label="'\u641C\u7D22' + titles[1]" placeholder="\u641C\u7D22" />
|
|
1128
|
+
</div>
|
|
1129
|
+
<div class="djm-transfer-list">
|
|
1130
|
+
<label v-for="item in rightList" :key="item.value" class="djm-transfer-item" :class="{ 'djm-is-disabled': item.disabled }">
|
|
1131
|
+
<input
|
|
1132
|
+
type="checkbox"
|
|
1133
|
+
:checked="checkedRight.indexOf(item.value) > -1"
|
|
1134
|
+
:disabled="item.disabled || disabled"
|
|
1135
|
+
@change="toggleRight(item)"
|
|
1136
|
+
/>
|
|
1137
|
+
<span>{{ item.label }}</span>
|
|
1138
|
+
</label>
|
|
1139
|
+
<div v-if="!rightList.length" class="djm-transfer-empty">\u8FD8\u6CA1\u6709\u9009\u62E9</div>
|
|
1140
|
+
</div>
|
|
1141
|
+
</div>
|
|
1142
|
+
</div>
|
|
1143
|
+
`};var kl={info:"info",success:"check",warning:"alert",danger:"alert"},$a={name:"DjmAlert",components:{DjmIcon:L},props:{tone:{type:String,default:"info"},title:{type:String,default:""},closable:{type:Boolean,default:!1},showIcon:{type:Boolean,default:!0}},emits:["close"],computed:{iconName(){return kl[this.tone]||"info"}},template:`
|
|
1144
|
+
<div class="djm-alert" :class="'djm-alert-' + tone" role="alert">
|
|
1145
|
+
<DjmIcon v-if="showIcon" :name="iconName" :size="14" />
|
|
1146
|
+
<div class="djm-alert-body">
|
|
1147
|
+
<strong v-if="title || $slots.title"><slot name="title">{{ title }}</slot></strong>
|
|
1148
|
+
<p v-if="$slots.default"><slot /></p>
|
|
1149
|
+
</div>
|
|
1150
|
+
<button
|
|
1151
|
+
v-if="closable"
|
|
1152
|
+
class="djm-alert-close"
|
|
1153
|
+
type="button"
|
|
1154
|
+
aria-label="\u5173\u95ED\u63D0\u793A"
|
|
1155
|
+
@click="$emit('close')"
|
|
1156
|
+
>
|
|
1157
|
+
<DjmIcon name="x" :size="12" />
|
|
1158
|
+
</button>
|
|
1159
|
+
</div>
|
|
1160
|
+
`};var Fa={name:"DjmSpin",props:{spinning:{type:Boolean,default:!0},size:{type:String,default:"md"},tip:{type:String,default:""}},computed:{wrapped(){return!!this.$slots.default}},template:`
|
|
1161
|
+
<div
|
|
1162
|
+
v-if="wrapped"
|
|
1163
|
+
class="djm-spin-wrap"
|
|
1164
|
+
:class="'djm-spin-' + size"
|
|
1165
|
+
:aria-busy="String(spinning)"
|
|
1166
|
+
>
|
|
1167
|
+
<slot />
|
|
1168
|
+
<div v-if="spinning" class="djm-spin-mask" role="status">
|
|
1169
|
+
<span class="djm-spinner"></span>
|
|
1170
|
+
<span v-if="tip" class="djm-spin-tip">{{ tip }}</span>
|
|
1171
|
+
</div>
|
|
1172
|
+
</div>
|
|
1173
|
+
<span
|
|
1174
|
+
v-else
|
|
1175
|
+
class="djm-spin-inline"
|
|
1176
|
+
:class="'djm-spin-' + size"
|
|
1177
|
+
role="status"
|
|
1178
|
+
:aria-label="tip ? undefined : '\u52A0\u8F7D\u4E2D'"
|
|
1179
|
+
>
|
|
1180
|
+
<span class="djm-spinner"></span>
|
|
1181
|
+
<span v-if="tip" class="djm-spin-tip">{{ tip }}</span>
|
|
1182
|
+
</span>
|
|
1183
|
+
`};import{nextTick as ht,onBeforeUnmount as xl,onMounted as Sl,ref as vt,watch as Dl}from"vue";var Ka={name:"DjmPopconfirm",components:{DjmIcon:L},props:{content:{type:String,default:""},confirmText:{type:String,default:"\u786E\u5B9A"},cancelText:{type:String,default:"\u53D6\u6D88"},tone:{type:String,default:"danger"},placement:{type:String,default:"top"},disabled:{type:Boolean,default:!1}},emits:["confirm","cancel","visible-change"],setup(e,{emit:t}){let a=vt(!1),n=vt(null),i=vt(null),l=vt({}),o=244,r=null;function s(){let h=n.value&&n.value.querySelector(".djm-popconfirm-trigger");if(!h)return;let b=h.querySelector('button, a[href], [role="button"]'),j=b||h;b||(j.setAttribute("role","button"),j.setAttribute("tabindex","0")),j.setAttribute("aria-haspopup","dialog"),j.setAttribute("aria-expanded",String(a.value))}Sl(()=>ht(s)),Dl(a,()=>ht(s));function d(){if(!a.value||!n.value)return;let h=n.value.getBoundingClientRect(),b={position:"fixed",width:o+"px"};(e.placement==="top"||window.innerHeight-h.bottom<120)&&h.top>120?b.bottom=window.innerHeight-h.top+8+"px":b.top=h.bottom+8+"px",b.left=Math.max(8,Math.min(h.left,window.innerWidth-o-8))+"px",l.value=b}function f(){e.disabled||a.value||(a.value=!0,t("visible-change",!0),r=G({root:()=>n.value,panel:()=>i.value,onClose:c,onReposition:d}),requestAnimationFrame(d),ht(()=>{let h=i.value&&i.value.querySelector("button");h&&h.focus()}))}function c(){if(!a.value)return;let h=i.value&&i.value.contains(document.activeElement);a.value=!1,l.value={},t("visible-change",!1),r&&(r(),r=null),h&&ht(()=>{let b=n.value&&n.value.querySelector(".djm-popconfirm-trigger"),j=b&&(b.querySelector('button, a[href], [role="button"]')||b);j&&j.focus()})}function p(){e.disabled||(a.value?c():f())}function g(){t("confirm"),c()}function m(){t("cancel"),c()}return xl(c),{open:a,root:n,panelEl:i,panelStyle:l,toggle:p,close:c,confirm:g,cancel:m}},template:`
|
|
1184
|
+
<span class="djm-popconfirm" ref="root">
|
|
1185
|
+
<span
|
|
1186
|
+
class="djm-popconfirm-trigger"
|
|
1187
|
+
@click="toggle"
|
|
1188
|
+
@keydown.enter.self.prevent="toggle"
|
|
1189
|
+
@keydown.space.self.prevent="toggle"
|
|
1190
|
+
>
|
|
1191
|
+
<slot :open="open"></slot>
|
|
1192
|
+
</span>
|
|
1193
|
+
<Teleport to="body">
|
|
1194
|
+
<Transition name="djm-pop">
|
|
1195
|
+
<div
|
|
1196
|
+
v-if="open"
|
|
1197
|
+
ref="panelEl"
|
|
1198
|
+
class="djm-popconfirm-panel"
|
|
1199
|
+
:style="panelStyle"
|
|
1200
|
+
role="dialog"
|
|
1201
|
+
aria-label="\u64CD\u4F5C\u786E\u8BA4"
|
|
1202
|
+
>
|
|
1203
|
+
<div class="djm-popconfirm-body">
|
|
1204
|
+
<DjmIcon name="alert" :size="14" class="djm-popconfirm-icon" />
|
|
1205
|
+
<span class="djm-popconfirm-text"><slot name="content">{{ content }}</slot></span>
|
|
1206
|
+
</div>
|
|
1207
|
+
<div class="djm-popconfirm-actions">
|
|
1208
|
+
<button class="djm-btn djm-btn-sm" type="button" @click="cancel">{{ cancelText }}</button>
|
|
1209
|
+
<button
|
|
1210
|
+
class="djm-btn djm-btn-sm"
|
|
1211
|
+
:class="tone === 'danger' ? 'djm-btn-danger' : 'djm-btn-primary'"
|
|
1212
|
+
type="button"
|
|
1213
|
+
@click="confirm"
|
|
1214
|
+
>{{ confirmText }}</button>
|
|
1215
|
+
</div>
|
|
1216
|
+
</div>
|
|
1217
|
+
</Transition>
|
|
1218
|
+
</Teleport>
|
|
1219
|
+
</span>
|
|
1220
|
+
`};import{onBeforeUnmount as Tl,onMounted as Ml,ref as Wa,watch as Cl}from"vue";var Ua={name:"DjmAnchor",props:{items:{type:Array,default:()=>[]},offset:{type:Number,default:12},container:{type:String,default:""},title:{type:String,default:""},smooth:{type:Boolean,default:!0}},emits:["change"],setup(e,{emit:t}){let a=Wa(null),n=Wa(""),i=null,l=null;function o(){return e.container?document.querySelector(e.container):a.value&&a.value.closest(".djm-content")||window}function r(g){return g===window?window.scrollY:g.scrollTop}function s(g){return g===window?0:g.getBoundingClientRect().top}function d(){if(!l)return;let g=r(l)+e.offset,m=e.items.length?e.items[0].href:"";for(let h of e.items){let b=document.querySelector(h.href);if(!b)continue;b.getBoundingClientRect().top-s(l)+r(l)<=g&&(m=h.href)}m&&m!==n.value&&(n.value=m,t("change",m))}function f(){c(),l=o(),l&&(i=l===window?window:l,i.addEventListener("scroll",d,{passive:!0}),window.addEventListener("resize",d),d())}function c(){i&&(i.removeEventListener("scroll",d),window.removeEventListener("resize",d),i=null,l=null)}function p(g){let m=document.querySelector(g.href);if(!m||!l)return;let h=m.getBoundingClientRect().top-s(l)+r(l)-e.offset,b=e.smooth?"smooth":"auto";l===window?window.scrollTo({top:Math.max(0,h),behavior:b}):l.scrollTo({top:Math.max(0,h),behavior:b}),n.value=g.href,t("change",g.href)}return Ml(f),Cl(()=>e.container,f),Tl(c),{root:a,activeKey:n,go:p}},template:`
|
|
1221
|
+
<nav ref="root" class="djm-anchor" aria-label="\u9875\u5185\u5BFC\u822A">
|
|
1222
|
+
<div v-if="title" class="djm-anchor-title">{{ title }}</div>
|
|
1223
|
+
<ul class="djm-anchor-list">
|
|
1224
|
+
<li v-for="item in items" :key="item.href">
|
|
1225
|
+
<a
|
|
1226
|
+
class="djm-anchor-link"
|
|
1227
|
+
:href="item.href"
|
|
1228
|
+
:class="{ 'djm-is-active': activeKey === item.href }"
|
|
1229
|
+
:aria-current="activeKey === item.href ? 'location' : undefined"
|
|
1230
|
+
@click.prevent="go(item)"
|
|
1231
|
+
>{{ item.label }}</a>
|
|
1232
|
+
</li>
|
|
1233
|
+
</ul>
|
|
1234
|
+
</nav>
|
|
1235
|
+
`};import{onBeforeUnmount as El,onMounted as Il,ref as qa}from"vue";var _a={name:"DjmBacktop",components:{DjmIcon:L},props:{visibilityHeight:{type:Number,default:320},container:{type:String,default:""},right:{type:Number,default:24},bottom:{type:Number,default:24},smooth:{type:Boolean,default:!0}},emits:["click"],setup(e,{emit:t}){let a=qa(!1),n=qa(null),i=null,l=null;function o(){return e.container?document.querySelector(e.container):n.value&&n.value.closest(".djm-content")||window}function r(){if(!i)return;let c=i===window?window.scrollY:i.scrollTop;a.value=c>e.visibilityHeight}function s(){d(),i=o(),i&&(l=i===window?window:i,l.addEventListener("scroll",r,{passive:!0}),r())}function d(){l&&(l.removeEventListener("scroll",r),l=null,i=null)}function f(){if(!i)return;let c=e.smooth?"smooth":"auto";i===window?window.scrollTo({top:0,behavior:c}):i.scrollTo({top:0,behavior:c}),t("click")}return Il(s),El(d),{visible:a,root:n,toTop:f}},template:`
|
|
1236
|
+
<span ref="root" class="djm-backtop-host">
|
|
1237
|
+
<Transition name="djm-fade">
|
|
1238
|
+
<button
|
|
1239
|
+
v-if="visible"
|
|
1240
|
+
class="djm-backtop"
|
|
1241
|
+
type="button"
|
|
1242
|
+
aria-label="\u56DE\u5230\u9876\u90E8"
|
|
1243
|
+
:style="{ right: right + 'px', bottom: bottom + 'px' }"
|
|
1244
|
+
@click="toTop"
|
|
1245
|
+
>
|
|
1246
|
+
<DjmIcon name="arrow-up" :size="15" />
|
|
1247
|
+
</button>
|
|
1248
|
+
</Transition>
|
|
1249
|
+
</span>
|
|
1250
|
+
`};var Ya={name:"DjmDivider",props:{vertical:{type:Boolean,default:!1}},computed:{withText(){return!this.vertical&&!!this.$slots.default}},template:`
|
|
1251
|
+
<div
|
|
1252
|
+
class="djm-divider"
|
|
1253
|
+
:class="vertical ? 'djm-is-vertical' : ['djm-is-horizontal', { 'djm-is-text': withText }]"
|
|
1254
|
+
role="separator"
|
|
1255
|
+
:aria-orientation="vertical ? 'vertical' : 'horizontal'"
|
|
1256
|
+
>
|
|
1257
|
+
<span v-if="withText" class="djm-divider-text"><slot /></span>
|
|
1258
|
+
</div>
|
|
1259
|
+
`};var Ga={name:"DjmSpace",props:{size:{type:[Number,String],default:8},direction:{type:String,default:"horizontal"},align:{type:String,default:"center"},wrap:{type:Boolean,default:!1}},computed:{gap(){return typeof this.size=="number"?this.size+"px":this.size}},template:`
|
|
1260
|
+
<div
|
|
1261
|
+
class="djm-space"
|
|
1262
|
+
:class="[
|
|
1263
|
+
'djm-space-' + direction,
|
|
1264
|
+
'djm-is-align-' + align,
|
|
1265
|
+
{ 'djm-is-wrap': wrap }
|
|
1266
|
+
]"
|
|
1267
|
+
:style="{ gap }"
|
|
1268
|
+
>
|
|
1269
|
+
<slot />
|
|
1270
|
+
</div>
|
|
1271
|
+
`};import{onBeforeUnmount as Ll,onMounted as Al,ref as gt}from"vue";var Ja={name:"DjmAffix",props:{offsetTop:{type:Number,default:0},offsetBottom:{type:Number,default:null},container:{type:String,default:""},zIndex:{type:Number,default:900}},setup(e){let t=gt(null),a=gt(!1),n=gt({}),i=gt({}),l=null,o=null;function r(){return e.container?document.querySelector(e.container):t.value&&t.value.closest(".djm-content")||window}function s(g,m){a.value||(i.value={height:m.height+"px"},a.value=!0),n.value={position:"fixed",left:m.left+"px",width:m.width+"px",zIndex:e.zIndex,...g}}function d(){a.value&&(a.value=!1,n.value={},i.value={})}function f(){if(!l||!t.value)return;let g=t.value.getBoundingClientRect(),m=l===window?0:l.getBoundingClientRect().top;if(typeof e.offsetBottom=="number"){let h=window.innerHeight-e.offsetBottom;g.bottom>=h?s({bottom:e.offsetBottom+"px"},g):d();return}g.top<m+e.offsetTop?s({top:e.offsetTop+"px"},g):d()}function c(){p(),l=r(),l&&(o=l===window?window:l,o.addEventListener("scroll",f,{passive:!0}),window.addEventListener("resize",f),f())}function p(){o&&(o.removeEventListener("scroll",f),window.removeEventListener("resize",f),o=null,l=null)}return Al(c),Ll(p),{root:t,fixed:a,affixStyle:n,holderStyle:i}},template:`
|
|
1272
|
+
<div ref="root" class="djm-affix" :style="holderStyle">
|
|
1273
|
+
<div class="djm-affix-inner" :class="{ 'djm-is-fixed': fixed }" :style="affixStyle">
|
|
1274
|
+
<slot />
|
|
1275
|
+
</div>
|
|
1276
|
+
</div>
|
|
1277
|
+
`};var Xa={name:"DjmSegmented",props:{modelValue:{type:[String,Number],default:""},options:{type:Array,default:()=>[]},ariaLabel:{type:String,default:"\u5206\u6BB5\u5207\u6362"}},emits:["update:modelValue","change"],methods:{isActive(e){return e.value===this.modelValue},select(e){e.disabled||this.isActive(e)||(this.$emit("update:modelValue",e.value),this.$emit("change",e.value))}},template:`
|
|
1278
|
+
<div class="djm-segmented" role="group" :aria-label="ariaLabel">
|
|
1279
|
+
<button
|
|
1280
|
+
v-for="item in options"
|
|
1281
|
+
:key="item.value"
|
|
1282
|
+
class="djm-segmented-item"
|
|
1283
|
+
type="button"
|
|
1284
|
+
:class="{ 'djm-is-active': isActive(item) }"
|
|
1285
|
+
:disabled="item.disabled"
|
|
1286
|
+
:aria-pressed="String(isActive(item))"
|
|
1287
|
+
@click="select(item)"
|
|
1288
|
+
>
|
|
1289
|
+
{{ item.label }}
|
|
1290
|
+
<span v-if="item.badge !== undefined && item.badge !== null" class="djm-segmented-badge">{{ item.badge }}</span>
|
|
1291
|
+
</button>
|
|
1292
|
+
</div>
|
|
1293
|
+
`};import{nextTick as zl,onBeforeUnmount as Bl,ref as yt,watch as Nl}from"vue";var Ze=0,Qa="",Ut=!1;function Pl(){return Math.max(0,window.innerWidth-document.documentElement.clientWidth)}function Me(){if(Ze===0){let e=Pl();if(e>0){Qa=document.body.style.paddingRight;let t=parseFloat(window.getComputedStyle(document.body).paddingRight)||0;document.body.style.paddingRight=t+e+"px",Ut=!0}document.body.classList.add("djm-no-scroll")}Ze+=1}function he(){Ze!==0&&(Ze-=1,!(Ze>0)&&(document.body.classList.remove("djm-no-scroll"),Ut&&(document.body.style.paddingRight=Qa,Ut=!1)))}var Za={name:"DjmImage",components:{DjmIcon:L},props:{src:{type:String,default:""},alt:{type:String,default:""},width:{type:[Number,String],default:""},height:{type:[Number,String],default:""},fit:{type:String,default:"cover"},preview:{type:Boolean,default:!0}},setup(e){let t=yt(!1),a=yt(!1),n=yt(null),i=yt(null);Nl(()=>e.src,()=>{t.value=!1});function l(d){return typeof d=="number"?d+"px":d}function o(d){d.key==="Escape"&&s()}async function r(){t.value||!e.src||(a.value=!0,Me(),document.addEventListener("keydown",o),await zl(),i.value&&i.value.focus())}function s(){a.value&&(a.value=!1,he(),document.removeEventListener("keydown",o),n.value&&n.value.focus())}return Bl(s),{failed:t,open:a,zoomRef:n,closeRef:i,toSize:l,openPreview:r,closePreview:s,t:C}},template:`
|
|
1294
|
+
<div
|
|
1295
|
+
class="djm-image"
|
|
1296
|
+
:style="{ width: toSize(width), height: toSize(height) }"
|
|
1297
|
+
>
|
|
1298
|
+
<img
|
|
1299
|
+
v-if="!failed"
|
|
1300
|
+
class="djm-image-img"
|
|
1301
|
+
:src="src"
|
|
1302
|
+
:alt="alt"
|
|
1303
|
+
:style="{ objectFit: fit }"
|
|
1304
|
+
@error="failed = true"
|
|
1305
|
+
/>
|
|
1306
|
+
<div v-else class="djm-image-fallback">{{ alt || t('image.failed') }}</div>
|
|
1307
|
+
|
|
1308
|
+
<button
|
|
1309
|
+
v-if="preview && !failed && src"
|
|
1310
|
+
ref="zoomRef"
|
|
1311
|
+
class="djm-image-zoom"
|
|
1312
|
+
type="button"
|
|
1313
|
+
:aria-label="t('image.preview')"
|
|
1314
|
+
@click="openPreview"
|
|
1315
|
+
>
|
|
1316
|
+
<DjmIcon name="eye" :size="14" />
|
|
1317
|
+
</button>
|
|
1318
|
+
|
|
1319
|
+
<Teleport to="body">
|
|
1320
|
+
<div
|
|
1321
|
+
v-if="open"
|
|
1322
|
+
class="djm-image-viewer"
|
|
1323
|
+
role="dialog"
|
|
1324
|
+
aria-modal="true"
|
|
1325
|
+
:aria-label="t('image.dialog')"
|
|
1326
|
+
@click.self="closePreview"
|
|
1327
|
+
>
|
|
1328
|
+
<button
|
|
1329
|
+
ref="closeRef"
|
|
1330
|
+
class="djm-image-viewer-close"
|
|
1331
|
+
type="button"
|
|
1332
|
+
:aria-label="t('image.close')"
|
|
1333
|
+
@click="closePreview"
|
|
1334
|
+
>
|
|
1335
|
+
<DjmIcon name="x" :size="16" />
|
|
1336
|
+
</button>
|
|
1337
|
+
<img class="djm-image-viewer-img" :src="src" :alt="alt" />
|
|
1338
|
+
</div>
|
|
1339
|
+
</Teleport>
|
|
1340
|
+
</div>
|
|
1341
|
+
`};import{computed as Wl,onBeforeUnmount as Ul,onMounted as ql,ref as _l,watch as Yl}from"vue";import{ref as en}from"vue";var tn="djm-theme",qt="djm-primary",Ce=en("light"),Rl=[{name:"\u9ED8\u8BA4\u84DD",value:"#1a6fc4"},{name:"\u79D1\u6280\u84DD",value:"#2563eb"},{name:"\u9752\u78A7",value:"#0f8b8d"},{name:"\u7FE1\u7FE0\u7EFF",value:"#12855a"},{name:"\u5178\u96C5\u7D2B",value:"#6d4ad8"},{name:"\u7425\u73C0\u6A59",value:"#b8620f"},{name:"\u6731\u7802\u7EA2",value:"#c0392b"},{name:"\u77F3\u58A8\u7070",value:"#4b5b6b"}],bt=en(""),Vl=["--djm-brand-50","--djm-brand-100","--djm-brand-200","--djm-brand-500","--djm-brand-600","--djm-brand-700","--djm-brand-800","--djm-brand-solid","--djm-brand-solid-hover","--djm-brand-soft","--djm-info","--djm-info-bg","--djm-info-border"];function Hl(e){let t=String(e||"").replace("#",""),a=t.length===3?t.split("").map(p=>p+p).join(""):t;if(!/^[0-9a-fA-F]{6}$/.test(a))return{h:206,s:76,l:44};let n=parseInt(a.slice(0,2),16)/255,i=parseInt(a.slice(2,4),16)/255,l=parseInt(a.slice(4,6),16)/255,o=Math.max(n,i,l),r=Math.min(n,i,l),s=(o+r)/2;if(o===r)return{h:0,s:0,l:Math.round(s*100)};let d=o-r,f=s>.5?d/(2-o-r):d/(o+r),c;return o===n?c=((i-l)/d+(i<l?6:0))*60:o===i?c=((l-n)/d+2)*60:c=((n-i)/d+4)*60,{h:Math.round(c),s:Math.round(f*100),l:Math.round(s*100)}}function ee(e,t,a){let n=Math.min(100,Math.max(0,t))/100,i=Math.min(100,Math.max(0,a))/100,l=(1-Math.abs(2*i-1))*n,o=l*(1-Math.abs(e/60%2-1)),r=i-l/2,s;return e<60?s=[l,o,0]:e<120?s=[o,l,0]:e<180?s=[0,l,o]:e<240?s=[0,o,l]:e<300?s=[o,0,l]:s=[l,0,o],"#"+s.map(d=>Math.round((d+r)*255).toString(16).padStart(2,"0")).join("")}function Ol(e,t){let{h:a,s:n,l:i}=Hl(e),l=Math.min(Math.max(n,20),92),o=r=>Math.min(97,Math.max(8,r));if(t){let r=Math.min(36,i);return{"--djm-brand-50":ee(a,Math.min(40,l*.5),14),"--djm-brand-100":ee(a,Math.min(42,l*.55),19),"--djm-brand-200":ee(a,Math.min(46,l*.6),27),"--djm-brand-500":ee(a,l,o(i+18)),"--djm-brand-600":ee(a,l,o(i+12)),"--djm-brand-700":ee(a,l*.95,o(i+30)),"--djm-brand-800":ee(a,l*.9,o(i+40)),"--djm-brand-solid":ee(a,l,r),"--djm-brand-solid-hover":ee(a,l,Math.max(10,r-6)),"--djm-brand-soft":ee(a,Math.min(40,l*.5),18),"--djm-info":ee(a,l*.95,o(i+34)),"--djm-info-bg":ee(a,Math.min(38,l*.48),16),"--djm-info-border":ee(a,Math.min(44,l*.58),26)}}return{"--djm-brand-50":ee(a,Math.min(95,l*1.05),96),"--djm-brand-100":ee(a,Math.min(92,l),92),"--djm-brand-200":ee(a,Math.min(88,l*.95),84),"--djm-brand-500":ee(a,l,o(i+7)),"--djm-brand-600":ee(a,l,o(i)),"--djm-brand-700":ee(a,l,o(i-7)),"--djm-brand-800":ee(a,l,o(i-14)),"--djm-brand-solid":ee(a,l,o(i)),"--djm-brand-solid-hover":ee(a,l,o(i-7)),"--djm-brand-soft":ee(a,Math.min(90,l*1.05),96),"--djm-info":ee(a,l,o(i-7)),"--djm-info-bg":ee(a,Math.min(90,l*1.05),96),"--djm-info-border":ee(a,Math.min(85,l*.9),86)}}function an(e){let t=document.documentElement;if(!e){Vl.forEach(n=>t.style.removeProperty(n));return}let a=Ol(e,Ce.value==="dark");Object.keys(a).forEach(n=>t.style.setProperty(n,a[n]))}function nn(e){bt.value=e||"",an(e||"");try{e?localStorage.setItem(qt,e):localStorage.removeItem(qt)}catch{}}function $l(){nn("")}function _t(e){Ce.value=e==="dark"?"dark":"light",document.documentElement.dataset.djmTheme=Ce.value,an(bt.value);try{localStorage.setItem(tn,Ce.value)}catch{}}function Fl(){_t(Ce.value==="dark"?"light":"dark")}function Kl(){let e="";try{e=localStorage.getItem(tn)||""}catch{e=""}let t="";try{t=new URLSearchParams(window.location.search).get("theme")||""}catch{t=""}let a="";try{a=localStorage.getItem(qt)||""}catch{a=""}a&&(bt.value=a),_t(t==="dark"||t==="light"?t:e||"light")}var ln={name:"DjmWatermark",props:{content:{type:[String,Array],default:"\u5185\u90E8\u8D44\u6599"},gap:{type:Number,default:80},fontSize:{type:Number,default:14},color:{type:String,default:""},rotate:{type:Number,default:-20},zIndex:{type:Number,default:10}},setup(e){let t=_l(""),a=null;function n(){let l=(Array.isArray(e.content)?e.content:[e.content]).filter(Boolean);if(!l.length){t.value="";return}a||(a=document.createElement("canvas"));let o=a.getContext("2d"),r=window.devicePixelRatio||1,s=Math.round(e.fontSize*1.6),d=e.fontSize+'px -apple-system, "PingFang SC", sans-serif';o.font=d;let f=Math.max(...l.map(j=>o.measureText(j).width)),c=s*l.length,p=e.rotate*Math.PI/180,g=Math.abs(Math.cos(p)),m=Math.abs(Math.sin(p)),h=Math.ceil(f*g+c*m+e.gap),b=Math.ceil(f*m+c*g+e.gap);a.width=h*r,a.height=b*r,o.scale(r,r),o.clearRect(0,0,h,b),o.translate(h/2,b/2),o.rotate(e.rotate*Math.PI/180),o.fillStyle=e.color||getComputedStyle(document.documentElement).getPropertyValue("--djm-watermark").trim()||"rgba(0, 0, 0, 0.08)",o.font=d,o.textAlign="center",o.textBaseline="middle",l.forEach((j,w)=>{let y=(w-(l.length-1)/2)*s;o.fillText(j,0,y)}),t.value=a.toDataURL("image/png")}let i=Wl(()=>({backgroundImage:t.value?"url("+t.value+")":"none",zIndex:e.zIndex}));return ql(n),Yl(()=>[e.content,e.gap,e.fontSize,e.color,e.rotate,Ce.value],n,{deep:!0}),Ul(()=>{a=null}),{layerStyle:i}},template:`
|
|
1342
|
+
<div class="djm-watermark">
|
|
1343
|
+
<slot />
|
|
1344
|
+
<div class="djm-watermark-layer" :style="layerStyle" aria-hidden="true"></div>
|
|
1345
|
+
</div>
|
|
1346
|
+
`};var Gl=0,on={name:"DjmAutoComplete",props:{modelValue:{type:String,default:""},options:{type:Array,default:()=>[]},placeholder:{type:String,default:""},disabled:{type:Boolean,default:!1},minChars:{type:Number,default:1},ariaLabel:{type:String,default:"\u81EA\u52A8\u5B8C\u6210"}},emits:["update:modelValue","input","select","focus","blur"],data(){return{query:this.modelValue,open:!1,activeIndex:-1,listId:"djm-autocomplete-"+ ++Gl,panelStyle:{...Z}}},watch:{modelValue(e){this.query=e}},computed:{normalized(){return this.options.map(e=>typeof e=="string"?{value:e,label:e}:e)},filtered(){let e=(this.query||"").trim().toLowerCase();return e.length<this.minChars?[]:(e?this.normalized.filter(a=>String(a.label).toLowerCase().indexOf(e)>-1):this.normalized).slice(0,8)},activeId(){return this.activeIndex>-1?this.listId+"-"+this.activeIndex:void 0}},methods:{onInput(e){this.query=e.target.value,this.$emit("update:modelValue",e.target.value),this.$emit("input",e),this.activeIndex=-1,this.filtered.length?this.openPanel():this.closePanel()},onFocus(e){this.activeIndex=-1,this.filtered.length&&this.openPanel(),this.$emit("focus",e)},onBlur(e){this.closePanel(),this.$emit("blur",e)},onKeydown(e){if(e.key==="ArrowDown"||e.key==="ArrowUp"){if(!this.open){if(!this.filtered.length)return;this.openPanel()}e.preventDefault();let t=e.key==="ArrowDown"?1:-1,a=this.filtered.length;this.activeIndex=(this.activeIndex+t+a)%a;return}if(e.key==="Enter"){let t=this.filtered[this.activeIndex]||this.filtered[0];this.open&&t&&(e.preventDefault(),this.choose(t));return}e.key==="Escape"&&this.closePanel()},choose(e){this.query=e.value,this.$emit("update:modelValue",e.value),this.$emit("select",e),this.closePanel()},openPanel(){if(this.open){this.$nextTick(this.updatePosition);return}this.open=!0,this._detachPanel=G({root:()=>this.$refs.root,panel:()=>this.$refs.panel,onClose:this.closePanel,onReposition:this.updatePosition,esc:!1}),this.$nextTick(this.updatePosition)},closePanel(){this.open&&(this.open=!1,this.activeIndex=-1,this.panelStyle={...Z},this._detachPanel&&(this._detachPanel(),this._detachPanel=null))},updatePosition(){if(!this.open||!this.$refs.root)return;let e=this.$refs.root.getBoundingClientRect(),t=this.$refs.panel;this.panelStyle=de({rect:e,flip:se(e,t?t.offsetHeight:240),width:e.width,clampWidth:e.width})}},beforeUnmount(){this.closePanel()},template:`
|
|
1347
|
+
<div class="djm-autocomplete" ref="root" :class="{ 'djm-is-disabled': disabled }">
|
|
1348
|
+
<input
|
|
1349
|
+
class="djm-input djm-autocomplete-input"
|
|
1350
|
+
type="text"
|
|
1351
|
+
role="combobox"
|
|
1352
|
+
autocomplete="off"
|
|
1353
|
+
:value="query"
|
|
1354
|
+
:placeholder="placeholder"
|
|
1355
|
+
:disabled="disabled"
|
|
1356
|
+
:aria-label="ariaLabel"
|
|
1357
|
+
:aria-expanded="String(open)"
|
|
1358
|
+
:aria-controls="listId"
|
|
1359
|
+
:aria-activedescendant="activeId"
|
|
1360
|
+
aria-autocomplete="list"
|
|
1361
|
+
@input="onInput"
|
|
1362
|
+
@focus="onFocus"
|
|
1363
|
+
@keydown="onKeydown"
|
|
1364
|
+
@blur="onBlur"
|
|
1365
|
+
/>
|
|
1366
|
+
<Teleport to="body">
|
|
1367
|
+
<div
|
|
1368
|
+
v-if="open"
|
|
1369
|
+
ref="panel"
|
|
1370
|
+
:id="listId"
|
|
1371
|
+
class="djm-autocomplete-panel"
|
|
1372
|
+
:style="panelStyle"
|
|
1373
|
+
role="listbox"
|
|
1374
|
+
>
|
|
1375
|
+
<div
|
|
1376
|
+
v-for="(item, index) in filtered"
|
|
1377
|
+
:id="listId + '-' + index"
|
|
1378
|
+
:key="item.value"
|
|
1379
|
+
class="djm-autocomplete-option"
|
|
1380
|
+
:class="{ 'djm-is-active': index === activeIndex }"
|
|
1381
|
+
role="option"
|
|
1382
|
+
:aria-selected="String(index === activeIndex)"
|
|
1383
|
+
@mousedown.prevent="choose(item)"
|
|
1384
|
+
@mousemove="activeIndex = index"
|
|
1385
|
+
>{{ item.label }}</div>
|
|
1386
|
+
</div>
|
|
1387
|
+
</Teleport>
|
|
1388
|
+
</div>
|
|
1389
|
+
`};import{computed as Jl,onBeforeUnmount as Xl,ref as rn}from"vue";var sn={name:"DjmSplitter",props:{modelValue:{type:Number,default:50},direction:{type:String,default:"horizontal"},min:{type:Number,default:15},max:{type:Number,default:85}},emits:["update:modelValue","change"],setup(e,{emit:t}){let a=rn(null),n=rn(!1),i=Jl(()=>{let f=Number(e.modelValue),c=Number.isFinite(f)?f:50;return Math.min(e.max,Math.max(e.min,c))});function l(f){let c=Math.min(e.max,Math.max(e.min,Math.round(f*10)/10));c!==i.value&&(t("update:modelValue",c),t("change",c))}function o(f){if(!a.value)return;let c=a.value.getBoundingClientRect(),p=e.direction==="vertical",g=p?f.clientY-c.top:f.clientX-c.left,m=p?c.height:c.width;m&&l(g/m*100)}function r(){n.value&&(n.value=!1,window.removeEventListener("pointermove",o),window.removeEventListener("pointerup",r))}function s(){n.value=!0,window.addEventListener("pointermove",o),window.addEventListener("pointerup",r)}function d(f){let c=e.direction==="vertical",p=c?"ArrowUp":"ArrowLeft",g=c?"ArrowDown":"ArrowRight",m=f.shiftKey?10:2;f.key===p?(f.preventDefault(),l(i.value-m)):f.key===g&&(f.preventDefault(),l(i.value+m))}return Xl(r),{root:a,dragging:n,ratio:i,startDrag:s,onKeydown:d}},template:`
|
|
1390
|
+
<div
|
|
1391
|
+
ref="root"
|
|
1392
|
+
class="djm-splitter"
|
|
1393
|
+
:class="['djm-splitter-' + direction, { 'djm-is-dragging': dragging }]"
|
|
1394
|
+
>
|
|
1395
|
+
<div
|
|
1396
|
+
class="djm-splitter-pane"
|
|
1397
|
+
:style="direction === 'vertical' ? { height: ratio + '%' } : { width: ratio + '%' }"
|
|
1398
|
+
>
|
|
1399
|
+
<slot name="first" />
|
|
1400
|
+
</div>
|
|
1401
|
+
<div
|
|
1402
|
+
class="djm-splitter-bar"
|
|
1403
|
+
role="separator"
|
|
1404
|
+
tabindex="0"
|
|
1405
|
+
aria-label="\u62D6\u52A8\u8C03\u6574\u5927\u5C0F"
|
|
1406
|
+
:aria-orientation="direction === 'vertical' ? 'horizontal' : 'vertical'"
|
|
1407
|
+
:aria-valuemin="min"
|
|
1408
|
+
:aria-valuemax="max"
|
|
1409
|
+
:aria-valuenow="Math.round(ratio)"
|
|
1410
|
+
@pointerdown.prevent="startDrag"
|
|
1411
|
+
@keydown="onKeydown"
|
|
1412
|
+
>
|
|
1413
|
+
<span class="djm-splitter-grip"></span>
|
|
1414
|
+
</div>
|
|
1415
|
+
<div class="djm-splitter-pane">
|
|
1416
|
+
<slot name="second" />
|
|
1417
|
+
</div>
|
|
1418
|
+
</div>
|
|
1419
|
+
`};import{onBeforeUnmount as Ql,onMounted as Zl,ref as eo,watch as to}from"vue";var dn={name:"DjmCarousel",components:{DjmIcon:L},props:{items:{type:Array,default:()=>[]},height:{type:[Number,String],default:180},autoplay:{type:Boolean,default:!1},interval:{type:Number,default:4e3},arrows:{type:Boolean,default:!0},dots:{type:Boolean,default:!0}},emits:["change"],setup(e,{emit:t}){let a=eo(0),n=null,i=()=>({height:typeof e.height=="number"?e.height+"px":e.height});function l(g){let m=e.items.length;if(!m)return;let h=(g+m)%m;h!==a.value&&(a.value=h,t("change",h))}function o(){l(a.value+1)}function r(){l(a.value-1)}function s(){window.clearInterval(n),n=null}function d(){s(),!(!e.autoplay||e.items.length<2)&&(n=window.setInterval(o,Math.max(1200,e.interval)))}function f(g){g.key==="ArrowLeft"?(g.preventDefault(),r()):g.key==="ArrowRight"&&(g.preventDefault(),o())}Zl(d),to(()=>[e.autoplay,e.interval,e.items.length],d);function c(){e.autoplay&&s()}function p(){e.autoplay&&d()}return Ql(s),{index:a,boxStyle:i,go:l,next:o,prev:r,onKeydown:f,pause:c,resume:p}},template:`
|
|
1420
|
+
<div
|
|
1421
|
+
class="djm-carousel"
|
|
1422
|
+
role="region"
|
|
1423
|
+
aria-roledescription="\u8F6E\u64AD"
|
|
1424
|
+
aria-label="\u8F6E\u64AD"
|
|
1425
|
+
tabindex="0"
|
|
1426
|
+
:style="boxStyle()"
|
|
1427
|
+
@mouseenter="pause"
|
|
1428
|
+
@mouseleave="resume"
|
|
1429
|
+
@focusin="pause"
|
|
1430
|
+
@focusout="resume"
|
|
1431
|
+
@keydown="onKeydown"
|
|
1432
|
+
>
|
|
1433
|
+
<div class="djm-carousel-track" :style="{ transform: 'translateX(-' + index * 100 + '%)' }">
|
|
1434
|
+
<div
|
|
1435
|
+
v-for="(item, i) in items"
|
|
1436
|
+
:key="i"
|
|
1437
|
+
class="djm-carousel-slide"
|
|
1438
|
+
role="group"
|
|
1439
|
+
:aria-roledescription="'\u5E7B\u706F\u7247 ' + (i + 1) + ' / ' + items.length"
|
|
1440
|
+
:aria-hidden="String(i !== index)"
|
|
1441
|
+
>
|
|
1442
|
+
<slot name="slide" :item="item" :index="i">
|
|
1443
|
+
<img v-if="item.image" class="djm-carousel-img" :src="item.image" :alt="item.title || ''" />
|
|
1444
|
+
<div v-if="item.title || item.desc" class="djm-carousel-caption">
|
|
1445
|
+
<strong v-if="item.title">{{ item.title }}</strong>
|
|
1446
|
+
<span v-if="item.desc">{{ item.desc }}</span>
|
|
1447
|
+
</div>
|
|
1448
|
+
</slot>
|
|
1449
|
+
</div>
|
|
1450
|
+
</div>
|
|
1451
|
+
|
|
1452
|
+
<button v-if="arrows && items.length > 1" class="djm-carousel-arrow djm-is-prev" type="button" aria-label="\u4E0A\u4E00\u5F20" @click.stop="prev">
|
|
1453
|
+
<DjmIcon name="chevron-left" :size="16" />
|
|
1454
|
+
</button>
|
|
1455
|
+
<button v-if="arrows && items.length > 1" class="djm-carousel-arrow djm-is-next" type="button" aria-label="\u4E0B\u4E00\u5F20" @click.stop="next">
|
|
1456
|
+
<DjmIcon name="chevron-right" :size="16" />
|
|
1457
|
+
</button>
|
|
1458
|
+
|
|
1459
|
+
<div v-if="dots && items.length > 1" class="djm-carousel-dots">
|
|
1460
|
+
<button
|
|
1461
|
+
v-for="(item, i) in items"
|
|
1462
|
+
:key="i"
|
|
1463
|
+
class="djm-carousel-dot"
|
|
1464
|
+
type="button"
|
|
1465
|
+
:class="{ 'djm-is-active': i === index }"
|
|
1466
|
+
:aria-label="'\u7B2C ' + (i + 1) + ' \u5F20'"
|
|
1467
|
+
:aria-current="i === index ? 'true' : undefined"
|
|
1468
|
+
@click.stop="go(i)"
|
|
1469
|
+
></button>
|
|
1470
|
+
</div>
|
|
1471
|
+
</div>
|
|
1472
|
+
`};import{computed as ao,nextTick as Yt,onBeforeUnmount as no,onMounted as io,ref as wt,watch as lo}from"vue";var cn={name:"DjmTour",components:{DjmIcon:L},props:{modelValue:{type:Boolean,default:!1},steps:{type:Array,default:()=>[]},offset:{type:Number,default:10}},emits:["update:modelValue","change","finish"],setup(e,{emit:t}){let a=wt(0),n=wt({top:"0px",left:"0px",width:"0px",height:"0px"}),i=wt({position:"fixed",left:"0px",top:"0px",visibility:"hidden"}),l=wt(null),o=ao(()=>e.steps[a.value]||null);function r(){let m=o.value;if(!m)return;let h=m.target?document.querySelector(m.target):null,b=h?h.getBoundingClientRect():{top:80,left:80,width:220,height:40,bottom:120};n.value={top:b.top-4+"px",left:b.left-4+"px",width:b.width+8+"px",height:b.height+8+"px"};let j=l.value?l.value.offsetHeight:160,w=l.value?l.value.offsetWidth:280,u=window.innerHeight-b.bottom>j+e.offset+12?b.bottom+e.offset:Math.max(12,b.top-j-e.offset),v=Math.max(12,Math.min(b.left,window.innerWidth-w-12));i.value={position:"fixed",top:u+"px",left:v+"px",visibility:"visible"}}function s(m){m.key==="Escape"?c():m.key==="ArrowRight"&&l.value&&l.value.contains(document.activeElement)?p():m.key==="ArrowLeft"&&l.value&&l.value.contains(document.activeElement)&&g()}function d(){a.value=0,t("change",0),document.addEventListener("keydown",s),window.addEventListener("resize",r),window.addEventListener("scroll",r,!0),Yt(()=>{r(),l.value&&l.value.focus({preventScroll:!0})})}function f(){document.removeEventListener("keydown",s),window.removeEventListener("resize",r),window.removeEventListener("scroll",r,!0)}function c(){e.modelValue&&t("update:modelValue",!1)}function p(){if(a.value>=e.steps.length-1){t("finish"),c();return}a.value+=1,t("change",a.value),Yt(r)}function g(){a.value!==0&&(a.value-=1,t("change",a.value),Yt(r))}return lo(()=>e.modelValue,m=>{m?d():f()}),io(()=>{e.modelValue&&d()}),no(f),{current:a,step:o,highlight:n,cardStyle:i,card:l,close:c,next:p,prev:g,t:C}},template:`
|
|
1473
|
+
<Teleport to="body">
|
|
1474
|
+
<div v-if="modelValue && step" class="djm-tour">
|
|
1475
|
+
<div class="djm-tour-highlight" :style="highlight"></div>
|
|
1476
|
+
<div
|
|
1477
|
+
ref="card"
|
|
1478
|
+
class="djm-tour-card"
|
|
1479
|
+
:style="cardStyle"
|
|
1480
|
+
role="dialog"
|
|
1481
|
+
:aria-label="t('tour.label')"
|
|
1482
|
+
tabindex="-1"
|
|
1483
|
+
>
|
|
1484
|
+
<div class="djm-tour-head">
|
|
1485
|
+
<strong>{{ step.title }}</strong>
|
|
1486
|
+
<button class="djm-tour-close" type="button" :aria-label="t('tour.close')" @click="close">
|
|
1487
|
+
<DjmIcon name="x" :size="12" />
|
|
1488
|
+
</button>
|
|
1489
|
+
</div>
|
|
1490
|
+
<p class="djm-tour-desc">{{ step.desc }}</p>
|
|
1491
|
+
<div class="djm-tour-foot">
|
|
1492
|
+
<span class="djm-tour-count">{{ current + 1 }} / {{ steps.length }}</span>
|
|
1493
|
+
<div class="djm-tour-actions">
|
|
1494
|
+
<button v-if="current > 0" class="djm-btn djm-btn-sm" type="button" @click="prev">{{ t('tour.prev') }}</button>
|
|
1495
|
+
<button class="djm-btn djm-btn-sm djm-btn-primary" type="button" @click="next">
|
|
1496
|
+
{{ current === steps.length - 1 ? t('tour.finish') : t('tour.next') }}
|
|
1497
|
+
</button>
|
|
1498
|
+
</div>
|
|
1499
|
+
</div>
|
|
1500
|
+
</div>
|
|
1501
|
+
</div>
|
|
1502
|
+
</Teleport>
|
|
1503
|
+
`};import{computed as jt,ref as un,watch as oo}from"vue";function mn(e){return String(e).padStart(2,"0")}function kt(e,t,a){return`${e}-${mn(t+1)}-${mn(a)}`}function Gt(e){if(!e)return null;let t=String(e).split("-").map(Number);if(t.length!==3||t.some(o=>!Number.isFinite(o)))return null;let[a,n,i]=t,l=new Date(a,n-1,i);return n<1||n>12||i<1||l.getFullYear()!==a||l.getMonth()!==n-1||l.getDate()!==i?null:{year:a,month:n-1,day:i}}var fn={name:"DjmCalendar",components:{DjmIcon:L},props:{modelValue:{type:String,default:""},marks:{type:Array,default:()=>[]},firstDay:{type:Number,default:1}},emits:["update:modelValue","change","month-change"],setup(e,{emit:t}){let a=new Date,n=kt(a.getFullYear(),a.getMonth(),a.getDate()),i=Gt(e.modelValue),l=un(i?i.year:a.getFullYear()),o=un(i?i.month:a.getMonth()),r=jt(()=>{let h=["\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"];return h.slice(e.firstDay).concat(h.slice(0,e.firstDay))}),s=jt(()=>new Set(e.marks.map(h=>typeof h=="string"?h:h.date).filter(Boolean))),d=jt(()=>{let b=(new Date(l.value,o.value,1).getDay()-e.firstDay+7)%7,j=new Date(l.value,o.value,1-b),w=[];for(let y=0;y<42;y++){let u=new Date(j.getFullYear(),j.getMonth(),j.getDate()+y);w.push({key:kt(u.getFullYear(),u.getMonth(),u.getDate()),day:u.getDate(),outside:u.getMonth()!==o.value})}return w}),f=jt(()=>{let h=d.value;return Array.from({length:6},(b,j)=>h.slice(j*7,j*7+7))});function c(h){let b=new Date(l.value,o.value+h,1);l.value=b.getFullYear(),o.value=b.getMonth(),t("month-change",kt(l.value,o.value,1))}function p(h){t("update:modelValue",h.key),t("change",h.key);let b=Gt(h.key);b&&(b.year!==l.value||b.month!==o.value)&&(l.value=b.year,o.value=b.month,t("month-change",kt(b.year,b.month,1)))}function g(){l.value=a.getFullYear(),o.value=a.getMonth(),p({key:n})}function m(h){let b={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7},j=[...h.currentTarget.querySelectorAll(".djm-date-picker-day")],w=j.indexOf(document.activeElement);if(w<0)return;let y=b[h.key];if(h.key==="Home"||h.key==="End"){h.preventDefault();let v=w-w%7;j[h.key==="Home"?v:Math.min(v+6,j.length-1)].focus();return}if(!y)return;let u=w+y;u<0||u>=j.length||(h.preventDefault(),j[u].focus())}return oo(()=>e.modelValue,h=>{let b=Gt(h);b&&(b.year!==l.value||b.month!==o.value)&&(l.value=b.year,o.value=b.month)}),{todayKey:n,viewYear:l,viewMonth:o,weekNames:r,markSet:s,cells:d,weeks:f,shift:c,select:p,goToday:g,onGridKey:m,t:C}},template:`
|
|
1504
|
+
<div class="djm-calendar">
|
|
1505
|
+
<div class="djm-calendar-head">
|
|
1506
|
+
<div class="djm-calendar-title" aria-live="polite">{{ t('calendar.title', { year: viewYear, month: viewMonth + 1 }) }}</div>
|
|
1507
|
+
<div class="djm-calendar-navs">
|
|
1508
|
+
<button class="djm-calendar-nav" type="button" :aria-label="t('calendar.prevMonth')" @click="shift(-1)">
|
|
1509
|
+
<DjmIcon name="chevron-left" :size="14" />
|
|
1510
|
+
</button>
|
|
1511
|
+
<button class="djm-calendar-today" type="button" @click="goToday">{{ t('datePicker.today') }}</button>
|
|
1512
|
+
<button class="djm-calendar-nav" type="button" :aria-label="t('calendar.nextMonth')" @click="shift(1)">
|
|
1513
|
+
<DjmIcon name="chevron-right" :size="14" />
|
|
1514
|
+
</button>
|
|
1515
|
+
</div>
|
|
1516
|
+
</div>
|
|
1517
|
+
|
|
1518
|
+
<div class="djm-date-picker-grid" role="grid" :aria-label="t('calendar.grid')" @keydown="onGridKey">
|
|
1519
|
+
<div class="djm-date-picker-weekrow" role="row">
|
|
1520
|
+
<div v-for="name in weekNames" :key="name" class="djm-date-picker-week" role="columnheader">{{ name }}</div>
|
|
1521
|
+
</div>
|
|
1522
|
+
<div v-for="(week, wi) in weeks" :key="wi" class="djm-date-picker-weekrow" role="row">
|
|
1523
|
+
<div v-for="cell in week" :key="cell.key" class="djm-date-picker-cell" role="gridcell">
|
|
1524
|
+
<button
|
|
1525
|
+
class="djm-date-picker-day"
|
|
1526
|
+
:class="{
|
|
1527
|
+
'djm-is-outside': cell.outside,
|
|
1528
|
+
'djm-is-today': cell.key === todayKey,
|
|
1529
|
+
'djm-is-selected': cell.key === modelValue
|
|
1530
|
+
}"
|
|
1531
|
+
type="button"
|
|
1532
|
+
:aria-label="cell.key"
|
|
1533
|
+
:aria-pressed="cell.key === modelValue ? 'true' : 'false'"
|
|
1534
|
+
:aria-current="cell.key === todayKey ? 'date' : undefined"
|
|
1535
|
+
@click="select(cell)"
|
|
1536
|
+
>
|
|
1537
|
+
{{ cell.day }}
|
|
1538
|
+
<span v-if="markSet.has(cell.key)" class="djm-calendar-dot"></span>
|
|
1539
|
+
</button>
|
|
1540
|
+
</div>
|
|
1541
|
+
</div>
|
|
1542
|
+
</div>
|
|
1543
|
+
</div>
|
|
1544
|
+
`};import{onBeforeUnmount as ro,ref as so}from"vue";var pn={name:"DjmFloatButton",components:{DjmIcon:L},props:{icon:{type:String,default:"plus"},label:{type:String,default:"\u5FEB\u6377\u64CD\u4F5C"},items:{type:Array,default:()=>[]},type:{type:String,default:"primary"},right:{type:Number,default:24},bottom:{type:Number,default:24}},emits:["click","select"],setup(e,{emit:t}){let a=so(!1);function n(d){d.key==="Escape"&&l()}function i(d){d.target.closest(".djm-float-button")||l()}function l(){a.value&&(a.value=!1,document.removeEventListener("mousedown",i,!0),document.removeEventListener("keydown",n))}function o(){a.value=!a.value,a.value?(document.addEventListener("mousedown",i,!0),document.addEventListener("keydown",n)):l()}function r(){if(!e.items.length){t("click");return}o()}function s(d){l(),t("select",d),typeof d.onClick=="function"&&d.onClick(d)}return ro(l),{open:a,onMainClick:r,choose:s}},template:`
|
|
1545
|
+
<div class="djm-float-button" :style="{ right: right + 'px', bottom: bottom + 'px' }">
|
|
1546
|
+
<Transition name="djm-fade">
|
|
1547
|
+
<div v-if="open && items.length" class="djm-float-list">
|
|
1548
|
+
<button
|
|
1549
|
+
v-for="item in items"
|
|
1550
|
+
:key="item.label"
|
|
1551
|
+
class="djm-float-item"
|
|
1552
|
+
type="button"
|
|
1553
|
+
@click="choose(item)"
|
|
1554
|
+
>
|
|
1555
|
+
<DjmIcon :name="item.icon || 'plus'" :size="14" />
|
|
1556
|
+
<span>{{ item.label }}</span>
|
|
1557
|
+
</button>
|
|
1558
|
+
</div>
|
|
1559
|
+
</Transition>
|
|
1560
|
+
|
|
1561
|
+
<button
|
|
1562
|
+
class="djm-float-main"
|
|
1563
|
+
:class="{ 'djm-is-primary': type === 'primary' }"
|
|
1564
|
+
type="button"
|
|
1565
|
+
:aria-label="open ? '\u6536\u8D77\u64CD\u4F5C' : label"
|
|
1566
|
+
:aria-expanded="items.length ? String(open) : undefined"
|
|
1567
|
+
@click="onMainClick"
|
|
1568
|
+
>
|
|
1569
|
+
<DjmIcon :name="open ? 'x' : icon" :size="18" />
|
|
1570
|
+
</button>
|
|
1571
|
+
</div>
|
|
1572
|
+
`};import{computed as Jt,nextTick as Xt,onBeforeUnmount as co,ref as Ae,watch as uo}from"vue";var mo=0,hn={name:"DjmMentions",props:{modelValue:{type:String,default:""},options:{type:Array,default:()=>[]},placeholder:{type:String,default:""},rows:{type:Number,default:3},disabled:{type:Boolean,default:!1},ariaLabel:{type:String,default:"\u5185\u5BB9\u8F93\u5165"}},emits:["update:modelValue","input","select"],setup(e,{emit:t}){let a=Ae(null),n=Ae(null),i=Ae(e.modelValue),l=Ae(!1),o=Ae(""),r=Ae(-1),s="djm-mentions-"+ ++mo,d=Ae({...Z}),f=-1,c=null;uo(()=>e.modelValue,v=>{i.value=v});let p=Jt(()=>e.options.map(v=>typeof v=="string"?{value:v,label:v}:v)),g=Jt(()=>{let v=o.value.trim().toLowerCase();return(v?p.value.filter(D=>String(D.label).toLowerCase().indexOf(v)>-1):p.value).slice(0,6)}),m=Jt(()=>r.value>-1?s+"-"+r.value:void 0);function h(){if(!l.value||!a.value)return;let v=a.value.getBoundingClientRect(),T=document.getElementById(s);d.value=de({rect:v,flip:se(v,T?T.offsetHeight:200),width:v.width})}function b(){l.value=!0,c=G({root:()=>a.value,panel:()=>document.getElementById(s),onClose:j,onReposition:h,esc:!1}),Xt(h)}function j(){l.value&&(l.value=!1,r.value=-1,d.value={...Z},c&&(c(),c=null))}function w(v){let T=v.target.value;i.value=T,t("update:modelValue",T),t("input",v);let D=v.target.selectionStart||0,x=/@([^\s@]*)$/.exec(T.slice(0,D));if(!x){j();return}f=D-x[0].length,o.value=x[1],r.value=-1,l.value?Xt(h):b()}function y(v){if(l.value){if(v.key==="ArrowDown"||v.key==="ArrowUp"){v.preventDefault();let T=v.key==="ArrowDown"?1:-1,D=g.value.length;if(!D)return;r.value=(r.value+T+D)%D;return}if(v.key==="Enter"){let T=g.value[r.value]||g.value[0];T&&(v.preventDefault(),u(T));return}v.key==="Escape"&&j()}}function u(v){let T=i.value||"",D=f+1+o.value.length,x=T.slice(0,f)+"@"+v.label+" "+T.slice(D);i.value=x,t("update:modelValue",x),t("select",v),j(),Xt(()=>{if(!n.value)return;let z=f+v.label.length+2;n.value.focus(),n.value.setSelectionRange(z,z)})}return co(j),{root:a,input:n,text:i,open:l,activeIndex:r,listId:s,panelStyle:d,filtered:g,activeId:m,onInput:w,onKeydown:y,choose:u}},template:`
|
|
1573
|
+
<div ref="root" class="djm-mentions">
|
|
1574
|
+
<textarea
|
|
1575
|
+
ref="input"
|
|
1576
|
+
class="djm-input djm-mentions-input"
|
|
1577
|
+
role="combobox"
|
|
1578
|
+
aria-autocomplete="list"
|
|
1579
|
+
:value="text"
|
|
1580
|
+
:rows="rows"
|
|
1581
|
+
:placeholder="placeholder"
|
|
1582
|
+
:disabled="disabled"
|
|
1583
|
+
:aria-label="ariaLabel"
|
|
1584
|
+
:aria-expanded="String(open)"
|
|
1585
|
+
:aria-controls="listId"
|
|
1586
|
+
:aria-activedescendant="activeId"
|
|
1587
|
+
@input="onInput"
|
|
1588
|
+
@keydown="onKeydown"
|
|
1589
|
+
></textarea>
|
|
1590
|
+
|
|
1591
|
+
<Teleport to="body">
|
|
1592
|
+
<div v-if="open" :id="listId" class="djm-mentions-panel" :style="panelStyle" role="listbox">
|
|
1593
|
+
<div
|
|
1594
|
+
v-for="(item, index) in filtered"
|
|
1595
|
+
:id="listId + '-' + index"
|
|
1596
|
+
:key="item.value"
|
|
1597
|
+
class="djm-mentions-option"
|
|
1598
|
+
:class="{ 'djm-is-active': index === activeIndex }"
|
|
1599
|
+
role="option"
|
|
1600
|
+
:aria-selected="String(index === activeIndex)"
|
|
1601
|
+
@mousedown.prevent="choose(item)"
|
|
1602
|
+
@mousemove="activeIndex = index"
|
|
1603
|
+
>{{ item.label }}</div>
|
|
1604
|
+
<div v-if="!filtered.length" class="djm-mentions-empty">\u6CA1\u6709\u5339\u914D\u7684\u6210\u5458</div>
|
|
1605
|
+
</div>
|
|
1606
|
+
</Teleport>
|
|
1607
|
+
</div>
|
|
1608
|
+
`};var xt={name:"DjmRow",props:{gap:{type:[Number,String],default:10}},computed:{style(){return{gap:typeof this.gap=="number"?this.gap+"px":this.gap}}},template:'<div class="djm-grid-row" :style="style"><slot /></div>'};var St={name:"DjmCol",props:{span:{type:Number,default:12},offset:{type:Number,default:0}},computed:{classes(){return"djm-col-"+Math.min(12,Math.max(1,this.span))},style(){return this.offset?{gridColumnStart:this.offset+1}:null}},template:'<div :class="classes" :style="style"><slot /></div>'};var vn={name:"DjmLayout",props:{direction:{type:String,default:"vertical"}},template:`
|
|
1609
|
+
<div class="djm-layout" :class="'djm-layout-' + direction">
|
|
1610
|
+
<slot />
|
|
1611
|
+
</div>
|
|
1612
|
+
`};var gn={name:"DjmLayoutHeader",template:'<header class="djm-layout-header"><slot /></header>'};var yn={name:"DjmLayoutSider",props:{width:{type:[Number,String],default:200}},computed:{style(){return{width:typeof this.width=="number"?this.width+"px":this.width}}},template:'<aside class="djm-layout-sider" :style="style"><slot /></aside>'};var bn={name:"DjmLayoutContent",template:'<main class="djm-layout-content"><slot /></main>'};var wn={name:"DjmLayoutFooter",template:'<footer class="djm-layout-footer"><slot /></footer>'};var jn={name:"DjmList",props:{items:{type:Array,default:()=>[]},bordered:{type:Boolean,default:!0},emptyText:{type:String,default:"\u6682\u65E0\u6570\u636E"}},template:`
|
|
1613
|
+
<div class="djm-list" :class="{ 'djm-is-bordered': bordered }">
|
|
1614
|
+
<div v-if="$slots.header" class="djm-list-header"><slot name="header" /></div>
|
|
1615
|
+
<ul v-if="items.length" class="djm-list-body">
|
|
1616
|
+
<li v-for="(item, index) in items" :key="item.id !== undefined ? item.id : index" class="djm-list-item">
|
|
1617
|
+
<slot name="item" :item="item" :index="index">
|
|
1618
|
+
<div class="djm-list-main">
|
|
1619
|
+
<div class="djm-list-title">{{ item.title }}</div>
|
|
1620
|
+
<div v-if="item.desc" class="djm-list-desc">{{ item.desc }}</div>
|
|
1621
|
+
</div>
|
|
1622
|
+
<div v-if="item.extra" class="djm-list-extra">{{ item.extra }}</div>
|
|
1623
|
+
</slot>
|
|
1624
|
+
</li>
|
|
1625
|
+
</ul>
|
|
1626
|
+
<div v-else class="djm-list-empty">{{ emptyText }}</div>
|
|
1627
|
+
<div v-if="$slots.footer" class="djm-list-footer"><slot name="footer" /></div>
|
|
1628
|
+
</div>
|
|
1629
|
+
`};var kn={name:"DjmInputTag",components:{DjmIcon:L},props:{modelValue:{type:Array,default:()=>[]},placeholder:{type:String,default:""},max:{type:Number,default:0},disabled:{type:Boolean,default:!1},allowDuplicate:{type:Boolean,default:!1},ariaLabel:{type:String,default:"\u6807\u7B7E\u8F93\u5165"}},emits:["update:modelValue","change","add","remove","focus","blur"],data(){return{draft:""}},computed:{reachedMax(){return this.max>0&&this.modelValue.length>=this.max},placeholderText(){return this.modelValue.length?"":this.placeholder}},methods:{focusInput(){this.disabled||!this.$refs.input||this.$refs.input.focus()},commit(){let e=this.draft.trim();if(!e){this.draft="";return}if(this.reachedMax||!this.allowDuplicate&&this.modelValue.indexOf(e)>-1){this.draft="";return}let t=this.modelValue.concat(e);this.draft="",this.$emit("update:modelValue",t),this.$emit("change",t),this.$emit("add",e)},remove(e){if(this.disabled)return;let t=this.modelValue[e],a=this.modelValue.slice();a.splice(e,1),this.$emit("update:modelValue",a),this.$emit("change",a),this.$emit("remove",t)},onKeydown(e){if(e.key==="Enter"||e.key===","){e.preventDefault(),this.commit();return}e.key==="Backspace"&&!this.draft&&this.modelValue.length&&(e.preventDefault(),this.remove(this.modelValue.length-1))},onInput(e){this.draft=e.target.value},onBlur(e){this.commit(),this.$el.contains(e.relatedTarget)||this.$emit("blur",e)}},template:`
|
|
1630
|
+
<div
|
|
1631
|
+
class="djm-input djm-input-tag"
|
|
1632
|
+
:class="{ 'djm-is-disabled': disabled, 'djm-is-full': reachedMax }"
|
|
1633
|
+
@click="focusInput"
|
|
1634
|
+
>
|
|
1635
|
+
<span v-for="(tag, index) in modelValue" :key="tag" class="djm-input-tag-item">
|
|
1636
|
+
{{ tag }}
|
|
1637
|
+
<button
|
|
1638
|
+
class="djm-input-tag-close"
|
|
1639
|
+
type="button"
|
|
1640
|
+
:aria-label="'\u79FB\u9664 ' + tag"
|
|
1641
|
+
:disabled="disabled"
|
|
1642
|
+
@click.stop="remove(index)"
|
|
1643
|
+
>
|
|
1644
|
+
<DjmIcon name="x" :size="10" />
|
|
1645
|
+
</button>
|
|
1646
|
+
</span>
|
|
1647
|
+
<input
|
|
1648
|
+
ref="input"
|
|
1649
|
+
class="djm-input-tag-field"
|
|
1650
|
+
type="text"
|
|
1651
|
+
autocomplete="off"
|
|
1652
|
+
:value="draft"
|
|
1653
|
+
:placeholder="placeholderText"
|
|
1654
|
+
:disabled="disabled || reachedMax"
|
|
1655
|
+
:aria-label="ariaLabel"
|
|
1656
|
+
@input="onInput"
|
|
1657
|
+
@keydown="onKeydown"
|
|
1658
|
+
@blur="onBlur"
|
|
1659
|
+
@focus="$emit('focus', $event)"
|
|
1660
|
+
/>
|
|
1661
|
+
</div>
|
|
1662
|
+
`};import{computed as Qt,ref as fo}from"vue";var xn={name:"DjmPassword",components:{DjmIcon:L},props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},disabled:{type:Boolean,default:!1},showStrength:{type:Boolean,default:!0},ariaLabel:{type:String,default:""}},emits:["update:modelValue","input","change","enter","focus","blur"],setup(e,{emit:t}){let a=fo(!1),n=Qt(()=>{let r=e.modelValue||"";if(!r)return 0;let s=0;return r.length>=8&&(s+=1),/[a-z]/.test(r)&&/[A-Z]/.test(r)&&(s+=1),/\d/.test(r)&&(s+=1),/[^a-zA-Z\d]/.test(r)&&(s+=1),s}),i=Qt(()=>n.value<=1?1:n.value<=3?2:3),l=Qt(()=>{let r=["","password.weak","password.medium","password.strong"][i.value];return C(r)});function o(r){t("update:modelValue",r.target.value),t("input",r)}return{visible:a,score:n,level:i,label:l,onInput:o,t:C}},template:`
|
|
1663
|
+
<div class="djm-password">
|
|
1664
|
+
<div class="djm-password-field">
|
|
1665
|
+
<input
|
|
1666
|
+
class="djm-input djm-password-input"
|
|
1667
|
+
:type="visible ? 'text' : 'password'"
|
|
1668
|
+
:value="modelValue"
|
|
1669
|
+
:placeholder="placeholder"
|
|
1670
|
+
:disabled="disabled"
|
|
1671
|
+
:aria-label="ariaLabel || t('password.aria')"
|
|
1672
|
+
autocomplete="off"
|
|
1673
|
+
@input="onInput"
|
|
1674
|
+
@change="$emit('change', $event)"
|
|
1675
|
+
@keyup.enter="$emit('enter', $event)"
|
|
1676
|
+
@focus="$emit('focus', $event)"
|
|
1677
|
+
@blur="$emit('blur', $event)"
|
|
1678
|
+
/>
|
|
1679
|
+
<button
|
|
1680
|
+
class="djm-password-toggle"
|
|
1681
|
+
type="button"
|
|
1682
|
+
:aria-label="visible ? t('password.hide') : t('password.show')"
|
|
1683
|
+
:aria-pressed="String(visible)"
|
|
1684
|
+
:disabled="disabled"
|
|
1685
|
+
@click="visible = !visible"
|
|
1686
|
+
>
|
|
1687
|
+
<DjmIcon :name="visible ? 'eye-off' : 'eye'" :size="14" />
|
|
1688
|
+
</button>
|
|
1689
|
+
</div>
|
|
1690
|
+
|
|
1691
|
+
<div v-if="showStrength" class="djm-password-strength" aria-live="polite">
|
|
1692
|
+
<span class="djm-password-meter" :aria-label="modelValue ? t('password.strength', { level: label }) : undefined">
|
|
1693
|
+
<i v-for="step in 3" :key="step" :class="{ 'djm-is-on': level >= step, 'djm-is-strong': level >= 3 }"></i>
|
|
1694
|
+
</span>
|
|
1695
|
+
<span class="djm-password-label">{{ modelValue ? label : t('password.hint') }}</span>
|
|
1696
|
+
</div>
|
|
1697
|
+
</div>
|
|
1698
|
+
`};import{computed as Sn,nextTick as ho,onBeforeUnmount as vo,onMounted as go,ref as et,watch as yo}from"vue";var po=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");function We(e){if(!e)return()=>{};let t=document.activeElement,a=()=>[...e.querySelectorAll(po)].filter(l=>l.getClientRects().length>0),n=a()[0];n&&n.focus();function i(l){if(l.key!=="Tab")return;let o=a();if(!o.length)return;let r=o[0],s=o[o.length-1];l.shiftKey&&(document.activeElement===r||!e.contains(document.activeElement))?(l.preventDefault(),s.focus()):!l.shiftKey&&document.activeElement===s&&(l.preventDefault(),r.focus())}return e.addEventListener("keydown",i),()=>{e.removeEventListener("keydown",i),t&&typeof t.focus=="function"&&t.focus()}}var bo=0,Dn={name:"DjmCommandPalette",props:{modelValue:{type:Boolean,default:!1},commands:{type:Array,default:()=>[]},placeholder:{type:String,default:"\u641C\u7D22\u547D\u4EE4"},shortcut:{type:Boolean,default:!0}},emits:["update:modelValue","run"],setup(e,{emit:t}){let a=et(!1),n=et(""),i=et(-1),l=et(null),o=et(null),r="djm-command-list-"+ ++bo,s=null,d=Sn(()=>{let u=n.value.trim().toLowerCase();return u?e.commands.filter(v=>[v.label,v.group,v.hint].filter(Boolean).join(" ").toLowerCase().indexOf(u)>-1):e.commands}),f=Sn(()=>i.value>-1?r+"-"+i.value:void 0);function c(){a.value||(a.value=!0,n.value="",i.value=-1,t("update:modelValue",!0),Me(),document.addEventListener("keydown",m),ho(()=>{s=We(o.value),l.value&&l.value.focus()}))}function p(){a.value&&(a.value=!1,t("update:modelValue",!1),he(),document.removeEventListener("keydown",m),s&&(s(),s=null))}function g(){a.value?p():c()}function m(u){u.key==="Escape"&&p()}function h(u){e.shortcut&&(u.metaKey||u.ctrlKey)&&String(u.key).toLowerCase()==="k"&&(u.preventDefault(),g())}function b(u){let v=d.value.length;v&&(i.value=(i.value+u+v)%v)}function j(u){n.value=u.target.value,i.value=d.value.length?0:-1}function w(u){if(u.key==="ArrowDown"){u.preventDefault(),b(1);return}if(u.key==="ArrowUp"){u.preventDefault(),b(-1);return}if(u.key==="Enter"){let v=d.value[i.value]||d.value[0];v&&(u.preventDefault(),y(v))}}function y(u){t("run",u),typeof u.run=="function"&&u.run(u),p()}return yo(()=>e.modelValue,u=>{u?c():p()}),go(()=>window.addEventListener("keydown",h)),vo(()=>{window.removeEventListener("keydown",h),p()}),{open:a,keyword:n,activeIndex:i,searchInput:l,panelEl:o,listId:r,filtered:d,activeId:f,hide:p,move:b,onInput:j,onKeydown:w,run:y}},template:`
|
|
1699
|
+
<Teleport to="body">
|
|
1700
|
+
<div v-if="open" class="djm-command-mask" @mousedown.self="hide">
|
|
1701
|
+
<div class="djm-command-panel" ref="panelEl" role="dialog" aria-modal="true" aria-label="\u547D\u4EE4\u9762\u677F">
|
|
1702
|
+
<input
|
|
1703
|
+
ref="searchInput"
|
|
1704
|
+
class="djm-command-search"
|
|
1705
|
+
type="text"
|
|
1706
|
+
autocomplete="off"
|
|
1707
|
+
role="combobox"
|
|
1708
|
+
aria-autocomplete="list"
|
|
1709
|
+
:aria-label="placeholder"
|
|
1710
|
+
:aria-controls="listId"
|
|
1711
|
+
:aria-expanded="String(open)"
|
|
1712
|
+
:aria-activedescendant="activeId"
|
|
1713
|
+
:placeholder="placeholder"
|
|
1714
|
+
:value="keyword"
|
|
1715
|
+
autocomplete="off"
|
|
1716
|
+
@input="onInput"
|
|
1717
|
+
@keydown="onKeydown"
|
|
1718
|
+
/>
|
|
1719
|
+
<div :id="listId" class="djm-command-list" role="listbox">
|
|
1720
|
+
<div
|
|
1721
|
+
v-for="(item, index) in filtered"
|
|
1722
|
+
:id="listId + '-' + index"
|
|
1723
|
+
:key="item.key || item.label"
|
|
1724
|
+
class="djm-command-item"
|
|
1725
|
+
:class="{ 'djm-is-active': index === activeIndex }"
|
|
1726
|
+
role="option"
|
|
1727
|
+
:aria-selected="String(index === activeIndex)"
|
|
1728
|
+
@mousedown.prevent="run(item)"
|
|
1729
|
+
@mousemove="activeIndex = index"
|
|
1730
|
+
>
|
|
1731
|
+
<span class="djm-command-label">{{ item.label }}</span>
|
|
1732
|
+
<span v-if="item.group" class="djm-command-group">{{ item.group }}</span>
|
|
1733
|
+
</div>
|
|
1734
|
+
<div v-if="!filtered.length" class="djm-command-empty">\u6CA1\u6709\u5339\u914D\u7684\u547D\u4EE4</div>
|
|
1735
|
+
</div>
|
|
1736
|
+
<div class="djm-command-foot">\u2191\u2193 \u9009\u62E9 \xB7 Enter \u6267\u884C \xB7 Esc \u5173\u95ED</div>
|
|
1737
|
+
</div>
|
|
1738
|
+
</div>
|
|
1739
|
+
</Teleport>
|
|
1740
|
+
`};import{onMounted as Fo,ref as An,watch as Ko}from"vue";var Pn={name:"DjmQRCode",props:{value:{type:String,default:""},size:{type:Number,default:120},level:{type:String,default:"M"},margin:{type:Number,default:2},dark:{type:String,default:"#000000"},light:{type:String,default:"#ffffff"},alt:{type:String,default:"\u4E8C\u7EF4\u7801"}},setup(e){let t=An(""),a=An(""),n=null,i=0;async function l(){if(!n){let r=await Promise.resolve().then(()=>(Ln(),In));n=r.default||r}return n}async function o(){let r=e.value,s=++i;if(!r){t.value="",a.value="";return}try{let f=await(await l()).toString(r,{type:"svg",margin:e.margin,width:e.size,errorCorrectionLevel:e.level,color:{dark:e.dark,light:e.light}});if(s!==i)return;t.value="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(f),a.value=""}catch{if(s!==i)return;t.value="",a.value="\u4E8C\u7EF4\u7801\u751F\u6210\u5931\u8D25"}}return Fo(o),Ko(()=>[e.value,e.size,e.level,e.margin,e.dark,e.light],o),{src:t,error:a}},template:`
|
|
1741
|
+
<div class="djm-qrcode" :style="{ width: size + 'px', height: size + 'px' }">
|
|
1742
|
+
<img v-if="src" class="djm-qrcode-img" :src="src" :alt="alt" :width="size" :height="size" />
|
|
1743
|
+
<span v-else-if="error" class="djm-qrcode-tip">{{ error }}</span>
|
|
1744
|
+
<span v-else class="djm-qrcode-tip">\u6682\u65E0\u5185\u5BB9</span>
|
|
1745
|
+
</div>
|
|
1746
|
+
`};var Wo={success:"ok",warning:"warn",error:"danger",info:"brand",default:"off"},zn={name:"DjmStatus",props:{tone:{type:String,default:""},type:{type:String,default:""},label:{type:String,default:""}},computed:{classes(){let e=(this.tone||this.type||"off").replace(/^djm-/,"");return["djm-status","djm-"+(Wo[e]||e)]}},template:`
|
|
1747
|
+
<span :class="classes"><i></i><slot>{{ label }}</slot></span>
|
|
1748
|
+
`};import{ref as tt,nextTick as Uo,onBeforeUnmount as qo}from"vue";var _o=0,Bn={name:"DjmTooltip",props:{content:{type:String,default:""},placement:{type:String,default:"top"},disabled:{type:Boolean,default:!1},delay:{type:Number,default:80}},setup(e){let t=tt(!1),a=tt(null),n=tt(null),i=tt(e.placement),l=tt({}),o="djm-tooltip-"+ ++_o,r=null;function s(){let m=a.value;return m&&(m.firstElementChild||m)}function d(m){let h=s();h&&(m?h.setAttribute("aria-describedby",o):h.removeAttribute("aria-describedby"))}function f(){let m=s(),h=n.value;if(!m||!h)return;let b=m.getBoundingClientRect(),j=h.offsetWidth,w=h.offsetHeight,y=8,u=e.placement;u==="top"&&b.top-w-y<8?u="bottom":u==="bottom"&&b.bottom+w+y>window.innerHeight-8?u="top":u==="left"&&b.left-j-y<8?u="right":u==="right"&&b.right+j+y>window.innerWidth-8&&(u="left"),i.value=u;let v,T;u==="top"?(v=b.top-w-y,T=b.left+b.width/2-j/2):u==="bottom"?(v=b.bottom+y,T=b.left+b.width/2-j/2):u==="left"?(v=b.top+b.height/2-w/2,T=b.left-j-y):(v=b.top+b.height/2-w/2,T=b.right+y),l.value={position:"fixed",top:Math.max(8,Math.min(v,window.innerHeight-w-8))+"px",left:Math.max(8,Math.min(T,window.innerWidth-j-8))+"px"}}function c(m){let h=m?"addEventListener":"removeEventListener";window[h]("scroll",f,!0),window[h]("resize",f)}function p(){e.disabled||!e.content||(window.clearTimeout(r),r=window.setTimeout(async()=>{t.value=!0,await Uo(),f(),d(!0),c(!0)},e.delay))}function g(){window.clearTimeout(r),t.value=!1,l.value={},d(!1),c(!1)}return qo(()=>{window.clearTimeout(r),c(!1)}),{visible:t,rootRef:a,contentRef:n,actualPlacement:i,panelStyle:l,tipId:o,show:p,hide:g}},template:`
|
|
1749
|
+
<span ref="rootRef" class="djm-tooltip" @mouseenter="show" @mouseleave="hide" @focusin="show" @focusout="hide" @keydown.esc="hide">
|
|
1750
|
+
<slot></slot>
|
|
1751
|
+
<Transition name="djm-fade">
|
|
1752
|
+
<span
|
|
1753
|
+
v-if="visible && content"
|
|
1754
|
+
:id="tipId"
|
|
1755
|
+
ref="contentRef"
|
|
1756
|
+
class="djm-tooltip-content"
|
|
1757
|
+
:class="'djm-tooltip-' + actualPlacement"
|
|
1758
|
+
:style="panelStyle"
|
|
1759
|
+
role="tooltip"
|
|
1760
|
+
>{{ content }}</span>
|
|
1761
|
+
</Transition>
|
|
1762
|
+
</span>
|
|
1763
|
+
`};import{nextTick as ea,onBeforeUnmount as Yo,onMounted as Go,ref as Dt,watch as Jo}from"vue";var Nn={name:"DjmDropdown",components:{DjmIcon:L},props:{items:{type:Array,default:()=>[]},placement:{type:String,default:"bottom-start"},width:{type:[Number,String],default:""},maxHeight:{type:[Number,String],default:""},disabled:{type:Boolean,default:!1},trigger:{type:String,default:"click"},closeOnSelect:{type:Boolean,default:!0}},emits:["select","visible-change"],setup(e,{emit:t}){let a=Dt(!1),n=Dt(null),i=Dt(null),l=Dt({}),o=null;function r(){let u=n.value&&n.value.querySelector(".djm-dropdown-trigger");if(!u)return;let v=u.querySelector('button, a[href], input, [role="button"]'),T=v||u;v||T.setAttribute("role","button"),T.setAttribute("aria-haspopup","menu"),T.setAttribute("aria-expanded",String(a.value)),e.disabled?T.setAttribute("aria-disabled","true"):T.removeAttribute("aria-disabled")}Go(()=>ea(r)),Jo(a,()=>ea(r));function s(){if(!a.value||!n.value)return;let u=n.value.getBoundingClientRect(),v={position:"fixed"};e.width&&(v.minWidth=typeof e.width=="number"?e.width+"px":e.width),e.maxHeight&&(v.maxHeight=typeof e.maxHeight=="number"?e.maxHeight+"px":e.maxHeight,v.overflowY="auto");let T=window.innerHeight-u.bottom;e.placement.indexOf("top")===0||T<160&&u.top>T?v.bottom=window.innerHeight-u.top+6+"px":v.top=u.bottom+6+"px",e.placement.indexOf("end")>-1?v.right=window.innerWidth-u.right+"px":v.left=u.left+"px",l.value=v}function d(){e.disabled||a.value||(a.value=!0,t("visible-change",!0),o=G({root:()=>n.value,panel:()=>i.value,onClose:f,onReposition:s}),requestAnimationFrame(s))}function f(){a.value&&(a.value=!1,l.value={},t("visible-change",!1),o&&(o(),o=null),p())}function c(){ea(()=>{let u=i.value&&i.value.querySelector(".djm-dropdown-item:not(:disabled)");u&&u.focus()})}function p(){let u=n.value&&n.value.querySelector(".djm-dropdown-trigger");if(!u||!i.value||!i.value.contains(document.activeElement))return;(u.querySelector('button, a[href], input, [role="button"]')||u).focus()}function g(u){if(u.key==="Escape"){u.stopPropagation(),f();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(u.key))return;u.preventDefault();let v=[...i.value?i.value.querySelectorAll(".djm-dropdown-item:not(:disabled)"):[]];if(!v.length)return;let T=v.indexOf(document.activeElement),D=0;u.key==="End"?D=v.length-1:u.key==="ArrowDown"?D=T<0?0:(T+1)%v.length:u.key==="ArrowUp"&&(D=T<0?v.length-1:(T-1+v.length)%v.length),v[D].focus()}function m(u){if(!e.disabled){if(a.value){f();return}d(),u&&u.detail===0&&c()}}function h(){e.disabled||a.value||(d(),c())}let b=null;function j(){e.trigger==="hover"&&(window.clearTimeout(b),d())}function w(){e.trigger==="hover"&&(window.clearTimeout(b),b=window.setTimeout(f,120))}function y(u){u.disabled||u.divider||(t("select",u),e.closeOnSelect&&f())}return Yo(()=>{window.clearTimeout(b),f()}),{open:a,root:n,menuEl:i,panelStyle:l,toggle:m,close:f,pick:y,openMenu:d,onHoverIn:j,onHoverOut:w,onMenuKeydown:g,onTriggerDown:h,t:C}},template:`
|
|
1764
|
+
<div
|
|
1765
|
+
class="djm-dropdown"
|
|
1766
|
+
:class="{ 'djm-is-disabled': disabled }"
|
|
1767
|
+
ref="root"
|
|
1768
|
+
@mouseenter="onHoverIn"
|
|
1769
|
+
@mouseleave="onHoverOut"
|
|
1770
|
+
>
|
|
1771
|
+
<!-- \u89E6\u53D1\u5668\u8BED\u4E49\u7531 syncTriggerA11y \u5199\u5230\u63D2\u69FD\u91CC\u7684\u771F\u5B9E\u63A7\u4EF6\u4E0A -->
|
|
1772
|
+
<span
|
|
1773
|
+
class="djm-dropdown-trigger"
|
|
1774
|
+
@click="toggle"
|
|
1775
|
+
@keydown.down.prevent="onTriggerDown"
|
|
1776
|
+
>
|
|
1777
|
+
<slot :open="open"></slot>
|
|
1778
|
+
</span>
|
|
1779
|
+
|
|
1780
|
+
<Teleport to="body">
|
|
1781
|
+
<Transition name="djm-pop">
|
|
1782
|
+
<div
|
|
1783
|
+
v-if="open"
|
|
1784
|
+
ref="menuEl"
|
|
1785
|
+
class="djm-dropdown-menu"
|
|
1786
|
+
:class="'djm-dropdown-' + placement"
|
|
1787
|
+
:style="panelStyle"
|
|
1788
|
+
role="menu"
|
|
1789
|
+
@mouseenter="onHoverIn"
|
|
1790
|
+
@mouseleave="onHoverOut"
|
|
1791
|
+
@keydown="onMenuKeydown"
|
|
1792
|
+
>
|
|
1793
|
+
<template v-for="(item, index) in items" :key="index">
|
|
1794
|
+
<div v-if="item.divider" class="djm-dropdown-divider"></div>
|
|
1795
|
+
<button
|
|
1796
|
+
v-else
|
|
1797
|
+
class="djm-dropdown-item"
|
|
1798
|
+
:class="{ 'djm-is-danger': item.danger, 'djm-is-active': item.active }"
|
|
1799
|
+
type="button"
|
|
1800
|
+
role="menuitem"
|
|
1801
|
+
:disabled="item.disabled"
|
|
1802
|
+
@click="pick(item)"
|
|
1803
|
+
>
|
|
1804
|
+
<slot name="item" :item="item">
|
|
1805
|
+
<DjmIcon v-if="item.icon" :name="item.icon" :size="14" />
|
|
1806
|
+
<span class="djm-dropdown-item-main">
|
|
1807
|
+
<span>{{ item.label }}</span>
|
|
1808
|
+
<em v-if="item.description" class="djm-dropdown-item-desc">{{ item.description }}</em>
|
|
1809
|
+
</span>
|
|
1810
|
+
</slot>
|
|
1811
|
+
</button>
|
|
1812
|
+
</template>
|
|
1813
|
+
<div v-if="!items.length" class="djm-dropdown-empty">{{ t('common.noOptions') }}</div>
|
|
1814
|
+
</div>
|
|
1815
|
+
</Transition>
|
|
1816
|
+
</Teleport>
|
|
1817
|
+
</div>
|
|
1818
|
+
`};import{ref as Xo,nextTick as Qo,watch as Zo,onMounted as er,onBeforeUnmount as tr}from"vue";var ar=0,Rn={name:"DjmDrawer",components:{DjmIcon:L},props:{modelValue:{type:Boolean,default:!1},title:{type:String,default:""},placement:{type:String,default:"right"},width:{type:[Number,String],default:420},maskClosable:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},closeOnEsc:{type:Boolean,default:!0}},emits:["update:modelValue","open","close"],setup(e,{emit:t}){let a=Xo(null),n=`djm-drawer-title-${++ar}`,i=!1,l=null;function o(){t("update:modelValue",!1)}function r(c){e.closeOnEsc&&c.key==="Escape"&&o()}function s(){l&&(l(),l=null)}async function d(){document.addEventListener("keydown",r),Me(),i=!0,t("open"),await Qo(),l=We(a.value)}function f(){document.removeEventListener("keydown",r),s(),i&&(he(),i=!1),t("close")}return Zo(()=>e.modelValue,c=>{c?d():f()}),er(()=>{e.modelValue&&d()}),tr(()=>{document.removeEventListener("keydown",r),s(),i&&he()}),{close:o,panelRef:a,titleId:n,t:C}},computed:{panelStyle(){return{width:typeof this.width=="number"?this.width+"px":this.width}}},template:`
|
|
1819
|
+
<Teleport to="body">
|
|
1820
|
+
<Transition name="djm-drawer">
|
|
1821
|
+
<div v-if="modelValue" class="djm-drawer-mask" @mousedown.self="maskClosable && close()">
|
|
1822
|
+
<aside
|
|
1823
|
+
ref="panelRef"
|
|
1824
|
+
class="djm-drawer"
|
|
1825
|
+
:class="'djm-drawer-' + placement"
|
|
1826
|
+
:style="panelStyle"
|
|
1827
|
+
role="dialog"
|
|
1828
|
+
aria-modal="true"
|
|
1829
|
+
:aria-labelledby="title ? titleId : undefined"
|
|
1830
|
+
:aria-label="title ? undefined : t('common.dialog')"
|
|
1831
|
+
>
|
|
1832
|
+
<header class="djm-drawer-head">
|
|
1833
|
+
<slot name="header">
|
|
1834
|
+
<h3 :id="titleId">{{ title }}</h3>
|
|
1835
|
+
</slot>
|
|
1836
|
+
<button
|
|
1837
|
+
v-if="showClose"
|
|
1838
|
+
class="djm-icon-btn"
|
|
1839
|
+
type="button"
|
|
1840
|
+
:aria-label="t('common.close')"
|
|
1841
|
+
@click="close"
|
|
1842
|
+
>
|
|
1843
|
+
<DjmIcon name="x" />
|
|
1844
|
+
</button>
|
|
1845
|
+
</header>
|
|
1846
|
+
<div class="djm-drawer-body">
|
|
1847
|
+
<slot></slot>
|
|
1848
|
+
</div>
|
|
1849
|
+
<footer v-if="$slots.footer" class="djm-drawer-foot">
|
|
1850
|
+
<slot name="footer"></slot>
|
|
1851
|
+
</footer>
|
|
1852
|
+
</aside>
|
|
1853
|
+
</div>
|
|
1854
|
+
</Transition>
|
|
1855
|
+
</Teleport>
|
|
1856
|
+
`};import{ref as nr,nextTick as ir,watch as lr,computed as or,onMounted as rr,onBeforeUnmount as sr}from"vue";var dr=0,Ue={name:"DjmModal",components:{Icon:L},props:{modelValue:{type:Boolean,default:!1},title:{type:String,default:""},width:{type:String,default:"640px"},maskClosable:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},closeOnEsc:{type:Boolean,default:!0},fullscreen:{type:Boolean,default:!1}},emits:["update:modelValue","open","close"],setup(e,{emit:t}){let a=nr(null),n=`djm-modal-title-${++dr}`,i=!1,l=null;function o(){t("update:modelValue",!1)}function r(c){e.closeOnEsc&&c.key==="Escape"&&o()}function s(){l&&(l(),l=null)}async function d(){document.addEventListener("keydown",r),Me(),i=!0,t("open"),await ir(),l=We(a.value)}function f(){document.removeEventListener("keydown",r),s(),i&&(he(),i=!1),t("close")}return lr(()=>e.modelValue,c=>{c?d():f()}),rr(()=>{e.modelValue&&d()}),sr(()=>{document.removeEventListener("keydown",r),s(),i&&he()}),{close:o,dialogRef:a,titleId:n,t:C,dialogStyle:or(()=>e.fullscreen?{width:"calc(100vw - 32px)",height:"calc(100vh - 48px)"}:{width:e.width})}},template:`
|
|
1857
|
+
<Teleport to="body">
|
|
1858
|
+
<Transition name="djm-modal">
|
|
1859
|
+
<div v-if="modelValue" class="djm-modal-mask" @mousedown.self="maskClosable && close()">
|
|
1860
|
+
<div
|
|
1861
|
+
ref="dialogRef"
|
|
1862
|
+
class="djm-modal"
|
|
1863
|
+
:class="{ 'djm-is-fullscreen': fullscreen }"
|
|
1864
|
+
:style="dialogStyle"
|
|
1865
|
+
role="dialog"
|
|
1866
|
+
aria-modal="true"
|
|
1867
|
+
:aria-labelledby="title ? titleId : undefined"
|
|
1868
|
+
:aria-label="title ? undefined : t('common.dialog')"
|
|
1869
|
+
>
|
|
1870
|
+
<div class="djm-modal-head">
|
|
1871
|
+
<slot name="header">
|
|
1872
|
+
<h3 :id="titleId">{{ title }}</h3>
|
|
1873
|
+
</slot>
|
|
1874
|
+
<button
|
|
1875
|
+
v-if="showClose"
|
|
1876
|
+
class="djm-icon-btn"
|
|
1877
|
+
type="button"
|
|
1878
|
+
:aria-label="t('common.close')"
|
|
1879
|
+
@click="close"
|
|
1880
|
+
>
|
|
1881
|
+
<Icon name="x" />
|
|
1882
|
+
</button>
|
|
1883
|
+
</div>
|
|
1884
|
+
<div class="djm-modal-body">
|
|
1885
|
+
<slot></slot>
|
|
1886
|
+
</div>
|
|
1887
|
+
<div class="djm-modal-foot" v-if="$slots.footer">
|
|
1888
|
+
<slot name="footer"></slot>
|
|
1889
|
+
</div>
|
|
1890
|
+
</div>
|
|
1891
|
+
</div>
|
|
1892
|
+
</Transition>
|
|
1893
|
+
</Teleport>
|
|
1894
|
+
`};var Vn={name:"DjmConfirmDialog",components:{AppModal:Ue},props:{modelValue:{type:Boolean,default:!1},title:{type:String,default:""},message:{type:String,default:""},confirmText:{type:String,default:""},cancelText:{type:String,default:""},danger:{type:Boolean,default:!1}},emits:["update:modelValue","confirm"],computed:{titleText(){return this.title||C("confirm.title")},confirmLabel(){return this.confirmText||C("confirm.confirm")},cancelLabel(){return this.cancelText||C("confirm.cancel")}},setup(e,{emit:t}){function a(){t("update:modelValue",!1)}function n(){t("confirm"),a()}return{close:a,confirm:n}},template:`
|
|
1895
|
+
<AppModal
|
|
1896
|
+
:model-value="modelValue"
|
|
1897
|
+
:title="titleText"
|
|
1898
|
+
width="440px"
|
|
1899
|
+
@update:model-value="close"
|
|
1900
|
+
>
|
|
1901
|
+
<div class="djm-confirm-body">
|
|
1902
|
+
<div class="djm-confirm-icon" :class="{ 'djm-danger': danger }">
|
|
1903
|
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">
|
|
1904
|
+
<path d="M12 9v4M12 17h.01M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" />
|
|
1905
|
+
</svg>
|
|
1906
|
+
</div>
|
|
1907
|
+
<p>{{ message }}</p>
|
|
1908
|
+
</div>
|
|
1909
|
+
|
|
1910
|
+
<template #footer>
|
|
1911
|
+
<button class="djm-btn" type="button" @click="close">{{ cancelLabel }}</button>
|
|
1912
|
+
<button
|
|
1913
|
+
class="djm-btn"
|
|
1914
|
+
:class="danger ? 'djm-btn-danger' : 'djm-btn-primary'"
|
|
1915
|
+
type="button"
|
|
1916
|
+
@click="confirm"
|
|
1917
|
+
>{{ confirmLabel }}</button>
|
|
1918
|
+
</template>
|
|
1919
|
+
</AppModal>
|
|
1920
|
+
`};import{computed as ta,ref as cr}from"vue";var Tt={name:"DjmPagination",components:{Icon:L},props:{total:{type:Number,default:0},page:{type:Number,default:1},pageSize:{type:Number,default:10},pageSizes:{type:Array,default:()=>[10,20,50]}},emits:["update:page","update:pageSize","change"],setup(e,{emit:t}){let a=cr(""),n=ta(()=>Math.max(1,Math.ceil(e.total/Math.max(1,e.pageSize)))),i=ta(()=>Math.min(Math.max(1,e.page),n.value)),l=ta(()=>{let d=n.value,f=i.value;if(d<=7)return Array.from({length:d},(m,h)=>h+1);let c=Math.max(2,f-1),p=Math.min(d-1,f+1);f<=3&&(c=2,p=4),f>=d-2&&(c=d-3,p=d-1);let g=[1];c>2&&g.push("...");for(let m=c;m<=p;m++)g.push(m);return p<d-1&&g.push("..."),g.push(d),g});function o(d){let f=Math.min(Math.max(1,d),n.value);f!==e.page&&(t("update:page",f),t("change",{page:f,pageSize:e.pageSize})),a.value=""}function r(d){let f=Number(d.target.value);t("update:pageSize",f),t("update:page",1),t("change",{page:1,pageSize:f})}function s(){let d=Number(a.value);if(!Number.isFinite(d)||d<1){a.value="";return}o(Math.floor(d))}return{jumpText:a,pageCount:n,current:i,pages:l,go:o,changeSize:r,doJump:s,t:C}},template:`
|
|
1921
|
+
<div class="djm-pagination">
|
|
1922
|
+
<div class="djm-pagination-info">
|
|
1923
|
+
{{ t('pagination.total', { total }) }}
|
|
1924
|
+
</div>
|
|
1925
|
+
<div class="djm-pagination-main">
|
|
1926
|
+
<select class="djm-select djm-page-size" :value="pageSize" :aria-label="t('pagination.pageSizeLabel')" @change="changeSize">
|
|
1927
|
+
<option v-for="size in pageSizes" :key="size" :value="size">{{ t('pagination.pageSize', { size }) }}</option>
|
|
1928
|
+
</select>
|
|
1929
|
+
|
|
1930
|
+
<div class="djm-pager" role="navigation" aria-label="pagination">
|
|
1931
|
+
<button class="djm-page-btn" type="button" :disabled="current <= 1" :title="t('pagination.first')" :aria-label="t('pagination.first')" @click="go(1)">
|
|
1932
|
+
<Icon name="chevrons-left" :size="13" />
|
|
1933
|
+
</button>
|
|
1934
|
+
<button class="djm-page-btn" type="button" :disabled="current <= 1" :title="t('pagination.prev')" :aria-label="t('pagination.prev')" @click="go(current - 1)">
|
|
1935
|
+
<Icon name="chevron-left" :size="13" />
|
|
1936
|
+
</button>
|
|
1937
|
+
|
|
1938
|
+
<template v-for="(item, index) in pages" :key="index">
|
|
1939
|
+
<span v-if="item === '...'" class="djm-page-ellipsis">\u2026</span>
|
|
1940
|
+
<button
|
|
1941
|
+
v-else
|
|
1942
|
+
class="djm-page-btn"
|
|
1943
|
+
type="button"
|
|
1944
|
+
:class="{ 'djm-is-active': item === current }"
|
|
1945
|
+
:aria-label="t('pagination.page', { page: item })"
|
|
1946
|
+
:aria-current="item === current ? 'page' : undefined"
|
|
1947
|
+
@click="go(item)"
|
|
1948
|
+
>{{ item }}</button>
|
|
1949
|
+
</template>
|
|
1950
|
+
|
|
1951
|
+
<button class="djm-page-btn" type="button" :disabled="current >= pageCount" :title="t('pagination.next')" :aria-label="t('pagination.next')" @click="go(current + 1)">
|
|
1952
|
+
<Icon name="chevron-right" :size="13" />
|
|
1953
|
+
</button>
|
|
1954
|
+
<button class="djm-page-btn" type="button" :disabled="current >= pageCount" :title="t('pagination.last')" :aria-label="t('pagination.last')" @click="go(pageCount)">
|
|
1955
|
+
<Icon name="chevrons-right" :size="13" />
|
|
1956
|
+
</button>
|
|
1957
|
+
</div>
|
|
1958
|
+
|
|
1959
|
+
<div class="djm-page-jump">
|
|
1960
|
+
{{ t('pagination.jump') }}
|
|
1961
|
+
<input v-model="jumpText" class="djm-input djm-jump-input" autocomplete="off" inputmode="numeric" :aria-label="t('pagination.jumpLabel')" @keyup.enter="doJump" />
|
|
1962
|
+
{{ t('pagination.pageUnit') }}
|
|
1963
|
+
</div>
|
|
1964
|
+
</div>
|
|
1965
|
+
</div>
|
|
1966
|
+
`};import{computed as ur}from"vue";var mr=0,Hn={name:"DjmTabs",components:{Icon:L},props:{modelValue:{type:[String,Number],required:!0},items:{type:Array,default:()=>[]},variant:{type:String,default:"line"},flush:{type:Boolean,default:!1},persist:{type:Boolean,default:!1}},emits:["update:modelValue","close"],setup(e,{emit:t}){let a=`djm-tabs-panel-${++mr}`,n=ur(()=>e.items.find(c=>c.key===e.modelValue)||{label:String(e.modelValue)});function i(c){return`${a}-${c.key}`}function l(c){c.disabled||c.key===e.modelValue||t("update:modelValue",c.key)}function o(c){t("close",c)}function r(c){return e.persist?`${a}-${c.key}`:a}function s(c){let p=String(c.badge===null||c.badge===void 0?"":c.badge).trim();return p===""?!1:Number.isFinite(Number(p))?Number(p)!==0:!0}function d(c){!c.closable||c.disabled||o(c.key)}function f(c){let p=c.key==="ArrowLeft"?-1:c.key==="ArrowRight"?1:0,g=c.key==="Home",m=c.key==="End";if(!p&&!g&&!m)return;let h=c.currentTarget.closest(".djm-tabs-head");if(!h)return;let j=[...h.querySelectorAll('[role="tab"]')].filter(u=>u.getAttribute("aria-disabled")!=="true");if(!j.length)return;c.preventDefault();let w=j.indexOf(c.currentTarget);g?w=0:m?w=j.length-1:w=(w+p+j.length)%j.length;let y=j[w];y.focus(),y.click()}return{panelId:a,activeItem:n,tabId:i,panelOf:r,activate:l,close:o,onDelete:d,onKeydown:f,hasBadge:s}},template:`
|
|
1967
|
+
<div class="djm-tabs" :class="[variant === 'line' ? '' : 'djm-tabs-' + variant, { 'djm-is-flush': flush }]">
|
|
1968
|
+
<div class="djm-tabs-head" role="tablist">
|
|
1969
|
+
<div
|
|
1970
|
+
v-for="item in items"
|
|
1971
|
+
:key="item.key"
|
|
1972
|
+
class="djm-tabs-item"
|
|
1973
|
+
:class="{ 'djm-is-active': item.key === modelValue, 'djm-is-disabled': item.disabled, 'djm-has-close': item.closable }"
|
|
1974
|
+
role="tab"
|
|
1975
|
+
:id="tabId(item)"
|
|
1976
|
+
:aria-controls="panelOf(item)"
|
|
1977
|
+
:aria-selected="item.key === modelValue"
|
|
1978
|
+
:aria-disabled="item.disabled || undefined"
|
|
1979
|
+
:tabindex="item.disabled ? -1 : (item.key === modelValue ? 0 : -1)"
|
|
1980
|
+
@click="activate(item)"
|
|
1981
|
+
@keydown="onKeydown"
|
|
1982
|
+
@keydown.enter.prevent="activate(item)"
|
|
1983
|
+
@keydown.space.prevent="activate(item)"
|
|
1984
|
+
@keydown.delete.prevent="onDelete(item)"
|
|
1985
|
+
>
|
|
1986
|
+
<Icon v-if="item.icon" :name="item.icon" :size="14" />
|
|
1987
|
+
<span>{{ item.label }}</span>
|
|
1988
|
+
<span v-if="hasBadge(item)" class="djm-tabs-item-badge">{{ item.badge }}</span>
|
|
1989
|
+
<!-- \u5173\u95ED\u56FE\u6807\u53EA\u54CD\u5E94\u9F20\u6807\uFF0C\u952E\u76D8\u7528 Delete\uFF0C\u907F\u514D role=tab \u5185\u5D4C\u53EF\u4EA4\u4E92\u5143\u7D20 -->
|
|
1990
|
+
<span
|
|
1991
|
+
v-if="item.closable"
|
|
1992
|
+
class="djm-tabs-item-close"
|
|
1993
|
+
aria-hidden="true"
|
|
1994
|
+
:title="'\u5173\u95ED\u6807\u7B7E\uFF08Delete\uFF09'"
|
|
1995
|
+
@click.stop="close(item.key)"
|
|
1996
|
+
>
|
|
1997
|
+
<Icon name="x" :size="11" />
|
|
1998
|
+
</span>
|
|
1999
|
+
</div>
|
|
2000
|
+
</div>
|
|
2001
|
+
<div v-if="persist" class="djm-tabs-body">
|
|
2002
|
+
<div
|
|
2003
|
+
v-for="item in items"
|
|
2004
|
+
:key="item.key"
|
|
2005
|
+
class="djm-tabs-pane"
|
|
2006
|
+
role="tabpanel"
|
|
2007
|
+
:id="panelOf(item)"
|
|
2008
|
+
:aria-labelledby="tabId(item)"
|
|
2009
|
+
:hidden="item.key !== modelValue"
|
|
2010
|
+
>
|
|
2011
|
+
<slot :name="'panel-' + item.key" />
|
|
2012
|
+
</div>
|
|
2013
|
+
</div>
|
|
2014
|
+
<div v-else class="djm-tabs-body" :id="panelId" role="tabpanel" :aria-labelledby="tabId(activeItem)">
|
|
2015
|
+
<slot :name="'panel-' + modelValue">
|
|
2016
|
+
<slot :active="modelValue" :item="activeItem"></slot>
|
|
2017
|
+
</slot>
|
|
2018
|
+
</div>
|
|
2019
|
+
</div>
|
|
2020
|
+
`};import{ref as On,watch as $n,nextTick as fr,onBeforeUnmount as pr}from"vue";var Fn={name:"DjmContextMenu",components:{Icon:L},props:{modelValue:{type:Boolean,default:!1},x:{type:Number,default:0},y:{type:Number,default:0},items:{type:Array,default:()=>[]}},emits:["update:modelValue","select"],setup(e,{emit:t}){let a=On(null),n=On({left:0,top:0}),i=8;function l(){t("update:modelValue",!1)}function o(){let g=a.value?a.value.offsetWidth:180,m=a.value?a.value.offsetHeight:220,h=e.x,b=e.y;h+g+i>window.innerWidth&&(h=Math.max(i,window.innerWidth-g-i)),b+m+i>window.innerHeight&&(b=Math.max(i,b-m)),n.value={left:h,top:b}}async function r(){n.value={left:e.x,top:e.y},await fr(),o();let g=a.value&&a.value.querySelector(".djm-context-menu-item:not(:disabled)");g&&g.focus()}function s(g){g.disabled||g.divider||(t("select",g),l())}function d(g){if(g.key==="Escape"){g.stopPropagation(),l();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(g.key))return;g.preventDefault();let m=[...a.value?a.value.querySelectorAll(".djm-context-menu-item:not(:disabled)"):[]];if(!m.length)return;let h=m.indexOf(document.activeElement),b=0;g.key==="End"?b=m.length-1:g.key==="ArrowDown"?b=h<0?0:(h+1)%m.length:g.key==="ArrowUp"&&(b=h<0?m.length-1:(h-1+m.length)%m.length),m[b].focus()}let f=null;function c(){f=G({root:()=>null,panel:()=>a.value,onClose:l,onReposition:l})}function p(){f&&(f(),f=null)}return $n(()=>e.modelValue,g=>{g?(r(),c()):p()}),$n([()=>e.x,()=>e.y],()=>{e.modelValue&&r()}),pr(p),{menuRef:a,pos:n,close:l,onSelect:s,onKeydown:d,t:C}},template:`
|
|
2021
|
+
<Teleport to="body">
|
|
2022
|
+
<Transition name="djm-context-menu">
|
|
2023
|
+
<div
|
|
2024
|
+
v-if="modelValue"
|
|
2025
|
+
ref="menuRef"
|
|
2026
|
+
class="djm-context-menu"
|
|
2027
|
+
role="menu"
|
|
2028
|
+
:style="{ left: pos.left + 'px', top: pos.top + 'px' }"
|
|
2029
|
+
@mousedown.stop
|
|
2030
|
+
@contextmenu.prevent
|
|
2031
|
+
@keydown="onKeydown"
|
|
2032
|
+
>
|
|
2033
|
+
<p v-if="!items.length" class="djm-context-menu-empty">{{ t('contextMenu.empty') }}</p>
|
|
2034
|
+
<template v-for="(item, index) in items" :key="index">
|
|
2035
|
+
<div v-if="item.divider" class="djm-context-menu-divider" role="separator"></div>
|
|
2036
|
+
<button
|
|
2037
|
+
v-else
|
|
2038
|
+
class="djm-context-menu-item"
|
|
2039
|
+
type="button"
|
|
2040
|
+
role="menuitem"
|
|
2041
|
+
:class="{ 'djm-danger': item.danger }"
|
|
2042
|
+
:disabled="item.disabled"
|
|
2043
|
+
@click="onSelect(item)"
|
|
2044
|
+
>
|
|
2045
|
+
<Icon :name="item.icon" :size="14" />
|
|
2046
|
+
<span class="djm-context-menu-label">{{ item.label }}</span>
|
|
2047
|
+
</button>
|
|
2048
|
+
</template>
|
|
2049
|
+
</div>
|
|
2050
|
+
</Transition>
|
|
2051
|
+
</Teleport>
|
|
2052
|
+
`};import{ref as ve,computed as Ee,onBeforeUnmount as Kn,watch as hr}from"vue";var vr=0;function Wn(e){return String(e).padStart(2,"0")}function Un(e,t,a){return`${e}-${Wn(t+1)}-${Wn(a)}`}function qn(e){if(!e)return null;let t=String(e).split("-").map(Number);return t.length!==3||t.some(a=>!Number.isFinite(a))?null:{year:t[0],month:t[1]-1,day:t[2]}}var we={name:"DjmDatePicker",components:{Icon:L},props:{modelValue:{type:[String,Array],default:""},placeholder:{type:String,default:""},min:{type:String,default:""},max:{type:String,default:""},clearable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},range:{type:Boolean,default:!1},presets:{type:Array,default:()=>[]},disabledDate:{type:Function,default:null},panels:{type:Number,default:2}},emits:["update:modelValue","change","visible-change"],setup(e,{emit:t}){let a=ve(!1);hr(a,k=>t("visible-change",k));let n=ve(null),i=ve(null),l="djm-date-panel-"+ ++vr,o=ve({...Z}),r=null,s=new Date,d=Un(s.getFullYear(),s.getMonth(),s.getDate()),f=Ee(()=>e.range?Array.isArray(e.modelValue)?e.modelValue:[]:e.modelValue?[e.modelValue]:[]),c=Ee(()=>{if(!e.range)return f.value[0]||"";let[k,E]=f.value;return k?E?`${k} ~ ${E}`:`${k} ~ ${C("datePicker.rangeEnd")}`:""}),p=qn(f.value[0]),g=ve(p?p.year:s.getFullYear()),m=ve(p?p.month:s.getMonth()),h=ve(f.value[0]||""),b=ve(f.value[1]||""),j=Ee(()=>e.placeholder?e.placeholder:C(e.range?"datePicker.rangePlaceholder":"datePicker.placeholder")),w=Ee(()=>C("datePicker.weeks").split(",")),y=ve(!1),u=null,v=k=>{y.value=k.matches};typeof window<"u"&&window.matchMedia&&(u=window.matchMedia("(max-width: 760px)"),y.value=u.matches,u.addEventListener?u.addEventListener("change",v):u.addListener(v)),Kn(()=>{u&&(u.removeEventListener?u.removeEventListener("change",v):u.removeListener(v))});let T=Ee(()=>e.range?Math.min(y.value?1:2,Math.max(1,e.panels)):1),D=ve(""),x=Ee(()=>{if(!e.range||!h.value||b.value||!D.value)return null;let k=h.value,E=D.value;return k<=E?[k,E]:[E,k]});function z(k){let E=new Date(g.value,m.value+k,1);return{year:E.getFullYear(),month:E.getMonth()}}function S(k,E){let $=(new Date(k,E,1).getDay()+6)%7,q=new Date(k,E,1-$),ie=e.range?h.value:f.value[0],N=e.range?b.value:"",K=x.value,_=K?K[0]:N?ie:"",ae=K?K[1]:N;return Array.from({length:42},(oe,ce)=>{let fe=new Date(q.getFullYear(),q.getMonth(),q.getDate()+ce),ue=Un(fe.getFullYear(),fe.getMonth(),fe.getDate());return{key:ue,day:fe.getDate(),outside:fe.getMonth()!==E,today:ue===d,selected:ue===ie||ue===N||ae!==""&&(ue===_||ue===ae),inRange:!!(_&&ae&&ue>_&&ue<ae),edgeStart:!!(_&&ae&&ue===_),edgeEnd:!!(ae&&ue===ae),disabled:I(ue)}})}let M=Ee(()=>Array.from({length:T.value},(k,E)=>{let{year:B,month:$}=z(E);return{key:B*100+$,label:C("datePicker.title",{year:B,month:$+1}),cells:S(B,$)}}));function I(k){return e.min&&k<e.min||e.max&&k>e.max?!0:typeof e.disabledDate=="function"?!!e.disabledDate(k):!1}let A=Ee(()=>e.range?(e.presets||[]).map(k=>{let E=typeof k.value=="function"?k.value():k.value,B=Array.isArray(E)&&E.length===2&&E.every($=>!I($));return{...k,value:E,invalid:!B}}):[]);function V(k){t("update:modelValue",k),t("change",k)}function H(){let k=qn(f.value[0]);k&&(g.value=k.year,m.value=k.month)}function Y(){e.disabled||(H(),h.value=f.value[0]||"",b.value=f.value[1]||"",D.value="",a.value=!0,r=G({root:()=>n.value,panel:()=>i.value,onClose:R,onReposition:X}),requestAnimationFrame(X))}function X(){if(!a.value||!n.value)return;let k=n.value.getBoundingClientRect(),E=i.value?i.value.offsetHeight:320,B=i.value?i.value.offsetWidth:300,$=Math.max(8,Math.min(k.left,window.innerWidth-B-8)),ie=window.innerHeight-k.bottom-8>=E?k.bottom+4:k.top-E-4;ie=Math.max(8,Math.min(ie,window.innerHeight-E-8)),o.value={position:"fixed",visibility:"visible",left:$+"px",top:ie+"px",bottom:"auto"}}function R(){a.value=!1,D.value="",o.value={...Z},r&&(r(),r=null)}function F(){a.value?R():Y()}function U(){m.value===0?(m.value=11,g.value-=1):m.value-=1}function te(){m.value===11?(m.value=0,g.value+=1):m.value+=1}function Q(){g.value-=1}function le(){g.value+=1}function P(k){if(k.disabled)return;if(!e.range){V(k.key),R();return}if(!h.value||b.value){h.value=k.key,b.value="",D.value="";return}let E=h.value,B=k.key;if(B<E){let $=E;E=B,B=$}h.value=E,b.value=B,V([E,B]),R()}function O(){I(d)||(e.range?V([d,d]):V(d),R())}function W(k){if(k.invalid)return;let E=k.value;h.value=E[0],b.value=E[1],V([E[0],E[1]]),R()}function ne(){V(e.range?[]:""),h.value="",b.value="",R()}return Kn(()=>{r&&(r(),r=null)}),{open:a,root:n,panel:i,panelId:l,panelStyle:o,viewYear:g,viewMonth:m,placeholderText:j,weeks:w,t:C,panels:M,panelCount:T,hoverKey:D,presetList:A,displayText:c,values:f,toggle:F,closePanel:R,prevMonth:U,nextMonth:te,prevYear:Q,nextYear:le,pick:P,pickToday:O,pickPreset:W,clear:ne}},template:`
|
|
2053
|
+
<div class="djm-date-picker" ref="root" :class="{ 'djm-is-disabled': disabled }">
|
|
2054
|
+
<button
|
|
2055
|
+
class="djm-input djm-date-trigger"
|
|
2056
|
+
type="button"
|
|
2057
|
+
:disabled="disabled"
|
|
2058
|
+
aria-haspopup="dialog"
|
|
2059
|
+
:aria-expanded="open"
|
|
2060
|
+
:aria-controls="panelId"
|
|
2061
|
+
@click="toggle"
|
|
2062
|
+
>
|
|
2063
|
+
<Icon name="calendar" :size="14" />
|
|
2064
|
+
<span :class="{ 'djm-date-placeholder': !displayText }">{{ displayText || placeholderText }}</span>
|
|
2065
|
+
<Icon name="chevron-down" :size="12" class="djm-date-caret" />
|
|
2066
|
+
</button>
|
|
2067
|
+
|
|
2068
|
+
<Teleport to="body">
|
|
2069
|
+
<Transition name="djm-pop">
|
|
2070
|
+
<div class="djm-date-picker-panel" :id="panelId" ref="panel" :style="panelStyle" v-if="open" role="dialog">
|
|
2071
|
+
<!-- \u5FEB\u6377\u533A\u95F4\uFF1A\u53EA\u5728\u8303\u56F4\u6A21\u5F0F\u4E0B\u51FA\u73B0 -->
|
|
2072
|
+
<div v-if="presetList.length" class="djm-date-presets">
|
|
2073
|
+
<button
|
|
2074
|
+
v-for="preset in presetList"
|
|
2075
|
+
:key="preset.label"
|
|
2076
|
+
class="djm-date-preset"
|
|
2077
|
+
type="button"
|
|
2078
|
+
:disabled="preset.invalid"
|
|
2079
|
+
@click="pickPreset(preset)"
|
|
2080
|
+
>{{ preset.label }}</button>
|
|
2081
|
+
</div>
|
|
2082
|
+
|
|
2083
|
+
<div class="djm-date-picker-content">
|
|
2084
|
+
<div class="djm-date-picker-panels">
|
|
2085
|
+
<div class="djm-date-picker-main" v-for="(item, index) in panels" :key="item.key">
|
|
2086
|
+
<div class="djm-date-picker-head">
|
|
2087
|
+
<div class="djm-date-picker-navs">
|
|
2088
|
+
<template v-if="index === 0">
|
|
2089
|
+
<button class="djm-date-picker-nav" type="button" title="\u4E0A\u4E00\u5E74" @click="prevYear">
|
|
2090
|
+
<Icon name="chevrons-left" :size="13" />
|
|
2091
|
+
</button>
|
|
2092
|
+
<button class="djm-date-picker-nav" type="button" title="\u4E0A\u4E2A\u6708" @click="prevMonth">
|
|
2093
|
+
<Icon name="chevron-left" :size="13" />
|
|
2094
|
+
</button>
|
|
2095
|
+
</template>
|
|
2096
|
+
</div>
|
|
2097
|
+
<span class="djm-date-picker-title">{{ item.label }}</span>
|
|
2098
|
+
<div class="djm-date-picker-navs djm-date-picker-navs-end">
|
|
2099
|
+
<template v-if="index === panels.length - 1">
|
|
2100
|
+
<button class="djm-date-picker-nav" type="button" title="\u4E0B\u4E2A\u6708" @click="nextMonth">
|
|
2101
|
+
<Icon name="chevron-right" :size="13" />
|
|
2102
|
+
</button>
|
|
2103
|
+
<button class="djm-date-picker-nav" type="button" title="\u4E0B\u4E00\u5E74" @click="nextYear">
|
|
2104
|
+
<Icon name="chevrons-right" :size="13" />
|
|
2105
|
+
</button>
|
|
2106
|
+
</template>
|
|
2107
|
+
</div>
|
|
2108
|
+
</div>
|
|
2109
|
+
|
|
2110
|
+
<div class="djm-date-picker-grid" @mouseleave="hoverKey = ''">
|
|
2111
|
+
<span v-for="week in weeks" :key="week" class="djm-date-picker-week">{{ week }}</span>
|
|
2112
|
+
<button
|
|
2113
|
+
v-for="cell in item.cells"
|
|
2114
|
+
:key="cell.key"
|
|
2115
|
+
class="djm-date-picker-day"
|
|
2116
|
+
type="button"
|
|
2117
|
+
:class="{
|
|
2118
|
+
'djm-is-outside': cell.outside,
|
|
2119
|
+
'djm-is-today': cell.today,
|
|
2120
|
+
'djm-is-selected': cell.selected,
|
|
2121
|
+
'djm-is-in-range': cell.inRange,
|
|
2122
|
+
'djm-is-range-start': cell.edgeStart,
|
|
2123
|
+
'djm-is-range-end': cell.edgeEnd
|
|
2124
|
+
}"
|
|
2125
|
+
:disabled="cell.disabled"
|
|
2126
|
+
@mouseenter="hoverKey = cell.key"
|
|
2127
|
+
@click="pick(cell)"
|
|
2128
|
+
>{{ cell.day }}</button>
|
|
2129
|
+
</div>
|
|
2130
|
+
</div>
|
|
2131
|
+
</div>
|
|
2132
|
+
|
|
2133
|
+
<div class="djm-date-picker-foot">
|
|
2134
|
+
<button class="djm-link-btn" type="button" @click="pickToday">{{ t('datePicker.today') }}</button>
|
|
2135
|
+
<button v-if="clearable" class="djm-link-btn djm-danger" type="button" @click="clear">{{ t('datePicker.clear') }}</button>
|
|
2136
|
+
</div>
|
|
2137
|
+
</div>
|
|
2138
|
+
</div>
|
|
2139
|
+
</Transition>
|
|
2140
|
+
</Teleport>
|
|
2141
|
+
</div>
|
|
2142
|
+
`};import{ref as Ie,computed as Mt,nextTick as gr,onBeforeUnmount as yr,watch as br}from"vue";function _n(e,t,a=[]){return e.children&&e.children.length?e.children.forEach(n=>_n(n,t,a)):a.push(t(e)),a}function Ct(e,t=[]){return e.forEach(a=>{t.push(a),a.children&&a.children.length&&Ct(a.children,t)}),t}var qe={name:"DjmTreeSelect",components:{Icon:L},props:{modelValue:{type:Array,default:()=>[]},options:{type:Array,default:()=>[]},nodeKey:{type:String,default:"id"},labelKey:{type:String,default:"label"},placeholder:{type:String,default:""},searchPlaceholder:{type:String,default:""},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},maxTagCount:{type:Number,default:2},showFooter:{type:Boolean,default:!0}},emits:["update:modelValue","change","visible-change"],setup(e,{emit:t}){let a=Ie(!1),n=Ie(null),i=Ie(null),l=Ie(null),o=Ie(""),r=Ie([]),s=Ie({...Z}),d=null;function f(R){return R?R[e.nodeKey]:void 0}function c(R){let F=R?R[e.labelKey]:"";return F==null?"":String(F)}let p=Ie(new Set(Ct(e.options).filter(R=>R.children&&R.children.length).map(R=>f(R)))),g=Mt(()=>{let R=new Map;return Ct(e.options).forEach(F=>R.set(f(F),F)),R});br(()=>e.options,R=>{!R||!R.length||p.value.size||(p.value=new Set(Ct(R).filter(F=>F.children&&F.children.length).map(F=>f(F))))});let m=Mt(()=>e.modelValue.map(R=>g.value.get(R)).filter(Boolean).map(R=>({key:f(R),label:c(R)}))),h=Mt(()=>{let R=o.value.trim().toLowerCase();if(!R)return null;let F=new Set,U=te=>{let Q=!1;return te.forEach(le=>{let P=le.children&&le.children.length?U(le.children):!1;(c(le).toLowerCase().includes(R)||P)&&(F.add(f(le)),Q=!0)}),Q};return U(e.options),F}),b=Mt(()=>{let R=[],F=(U,te)=>{U.forEach(Q=>{if(h.value&&!h.value.has(f(Q)))return;R.push({node:Q,depth:te,key:f(Q),label:c(Q)});let le=Q.children&&Q.children.length,P=h.value?!0:p.value.has(f(Q));le&&P&&F(Q.children,te+1)})};return F(e.options,0),R});function j(R){return!!(R.children&&R.children.length)}function w(R){return h.value?!0:p.value.has(f(R))}function y(R){let F=v(R);return F.length>0&&F.every(U=>r.value.includes(U))}function u(R){let F=v(R),U=F.filter(te=>r.value.includes(te)).length;return U>0&&U<F.length}function v(R){return _n(R,f).filter(F=>{let U=g.value.get(F);return U&&!U.disabled})}function T(R){if(R.disabled)return;let F=v(R);if(!F.length)return;F.every(te=>r.value.includes(te))?r.value=r.value.filter(te=>!F.includes(te)):r.value=[...new Set([...r.value,...F])],e.showFooter||(t("update:modelValue",[...r.value]),t("change",[...r.value]))}function D(R){if(!j(R))return;let F=f(R),U=new Set(p.value);U.has(F)?U.delete(F):U.add(F),p.value=U}function x(R){j(R)?D(R):T(R)}function z(){a.value||e.disabled||(r.value=[...e.modelValue],o.value="",a.value=!0,t("visible-change",!0),d=G({root:()=>n.value,panel:()=>i.value,onClose:M,onReposition:S}),gr(()=>{S(),l.value&&l.value.focus()}))}function S(){if(!a.value||!n.value)return;let R=n.value.getBoundingClientRect(),F=i.value?i.value.offsetHeight:320,U=Math.min(300,window.innerWidth-16);s.value=de({rect:R,flip:se(R,F),gap:4,width:U,clampWidth:U})}function M(){a.value&&(a.value=!1,s.value={...Z},t("visible-change",!1),d&&(d(),d=null))}function I(){e.disabled||(a.value?M():z())}function A(){t("update:modelValue",[...r.value]),t("change",[...r.value]),M()}function V(){M()}function H(){r.value=[]}function Y(R){let F=e.modelValue.filter(U=>U!==R);t("update:modelValue",F),t("change",F),r.value=r.value.filter(U=>U!==R)}function X(){e.disabled||(t("update:modelValue",[]),t("change",[]),r.value=[])}return yr(()=>{d&&(d(),d=null)}),{open:a,root:n,panel:i,panelStyle:s,searchInput:l,search:o,temp:r,rows:b,selectedNodes:m,hasChildren:j,isExpanded:w,isChecked:y,isIndeterminate:u,toggleNode:T,onRowClick:x,toggle:I,confirm:A,cancel:V,clearTemp:H,clearAll:X,removeTag:Y,t:C}},template:`
|
|
2143
|
+
<div class="djm-tree-select" :class="{ 'djm-is-disabled': disabled }" ref="root">
|
|
2144
|
+
<div
|
|
2145
|
+
class="djm-tree-select-trigger djm-input"
|
|
2146
|
+
:class="{ 'djm-is-open': open }"
|
|
2147
|
+
role="combobox"
|
|
2148
|
+
:tabindex="disabled ? -1 : 0"
|
|
2149
|
+
:aria-expanded="open"
|
|
2150
|
+
aria-haspopup="tree"
|
|
2151
|
+
:aria-label="placeholder || t('treeSelect.placeholder')"
|
|
2152
|
+
:aria-disabled="disabled || undefined"
|
|
2153
|
+
@click="toggle"
|
|
2154
|
+
@keydown.enter.prevent="toggle"
|
|
2155
|
+
@keydown.space.prevent="toggle"
|
|
2156
|
+
>
|
|
2157
|
+
<template v-if="selectedNodes.length">
|
|
2158
|
+
<span v-for="node in selectedNodes.slice(0, maxTagCount)" :key="node.key" class="djm-tree-select-tag">
|
|
2159
|
+
{{ node.label }}
|
|
2160
|
+
<button
|
|
2161
|
+
v-if="!disabled"
|
|
2162
|
+
class="djm-tree-select-tag-close"
|
|
2163
|
+
type="button"
|
|
2164
|
+
:aria-label="t('treeSelect.remove', { label: node.label })"
|
|
2165
|
+
@click.stop="removeTag(node.key)"
|
|
2166
|
+
>\xD7</button>
|
|
2167
|
+
</span>
|
|
2168
|
+
<span v-if="selectedNodes.length > maxTagCount" class="djm-tree-select-more">+{{ selectedNodes.length - maxTagCount }}</span>
|
|
2169
|
+
</template>
|
|
2170
|
+
<span v-else class="djm-date-placeholder">{{ placeholder || t('treeSelect.placeholder') }}</span>
|
|
2171
|
+
<button
|
|
2172
|
+
v-if="clearable && selectedNodes.length && !disabled"
|
|
2173
|
+
class="djm-tree-select-clear-btn"
|
|
2174
|
+
type="button"
|
|
2175
|
+
:title="t('treeSelect.clear')"
|
|
2176
|
+
@click.stop="clearAll"
|
|
2177
|
+
>
|
|
2178
|
+
<Icon name="x" :size="11" />
|
|
2179
|
+
</button>
|
|
2180
|
+
<Icon v-else name="chevron-down" :size="12" class="djm-tree-select-caret" />
|
|
2181
|
+
</div>
|
|
2182
|
+
|
|
2183
|
+
<Transition name="djm-pop">
|
|
2184
|
+
<div class="djm-tree-select-panel" ref="panel" :style="panelStyle" v-if="open">
|
|
2185
|
+
<div class="djm-tree-select-search">
|
|
2186
|
+
<Icon name="search" :size="13" />
|
|
2187
|
+
<input
|
|
2188
|
+
ref="searchInput"
|
|
2189
|
+
v-model="search"
|
|
2190
|
+
autocomplete="off"
|
|
2191
|
+
:placeholder="searchPlaceholder || t('treeSelect.search')"
|
|
2192
|
+
:aria-label="searchPlaceholder || t('treeSelect.search')"
|
|
2193
|
+
/>
|
|
2194
|
+
<button v-if="search" class="djm-tree-select-clear" type="button" :aria-label="t('treeSelect.clearSearch')" @click="search = ''">
|
|
2195
|
+
<Icon name="x" :size="11" />
|
|
2196
|
+
</button>
|
|
2197
|
+
</div>
|
|
2198
|
+
|
|
2199
|
+
<div class="djm-tree-select-body">
|
|
2200
|
+
<div
|
|
2201
|
+
v-for="row in rows"
|
|
2202
|
+
:key="row.key"
|
|
2203
|
+
class="djm-tree-select-row"
|
|
2204
|
+
:class="{ 'djm-is-disabled': row.node.disabled }"
|
|
2205
|
+
:style="{ paddingLeft: (8 + row.depth * 14) + 'px' }"
|
|
2206
|
+
@click="onRowClick(row.node)"
|
|
2207
|
+
>
|
|
2208
|
+
<button
|
|
2209
|
+
v-if="hasChildren(row.node)"
|
|
2210
|
+
class="djm-tree-select-arrow"
|
|
2211
|
+
type="button"
|
|
2212
|
+
:aria-label="isExpanded(row.node) ? t('treeSelect.collapse') : t('treeSelect.expand')"
|
|
2213
|
+
@click.stop="toggleExpand(row.node)"
|
|
2214
|
+
>
|
|
2215
|
+
<Icon :name="isExpanded(row.node) ? 'chevron-down' : 'chevron-right'" :size="11" />
|
|
2216
|
+
</button>
|
|
2217
|
+
<span v-else class="djm-tree-select-arrow-placeholder"></span>
|
|
2218
|
+
|
|
2219
|
+
<input
|
|
2220
|
+
type="checkbox"
|
|
2221
|
+
:checked="isChecked(row.node)"
|
|
2222
|
+
:indeterminate="isIndeterminate(row.node)"
|
|
2223
|
+
:disabled="row.node.disabled"
|
|
2224
|
+
@click.stop
|
|
2225
|
+
@change="toggleNode(row.node)"
|
|
2226
|
+
/>
|
|
2227
|
+
|
|
2228
|
+
<Icon :name="hasChildren(row.node) ? 'folder' : 'file'" :size="13" class="djm-tree-select-icon" />
|
|
2229
|
+
<span class="djm-tree-select-label">{{ row.label }}</span>
|
|
2230
|
+
</div>
|
|
2231
|
+
|
|
2232
|
+
<div v-if="!rows.length" class="djm-tree-select-empty">{{ t('treeSelect.empty') }}</div>
|
|
2233
|
+
</div>
|
|
2234
|
+
|
|
2235
|
+
<div class="djm-tree-select-foot" v-if="showFooter">
|
|
2236
|
+
<span>{{ t('common.selected', { count: temp.length }) }}</span>
|
|
2237
|
+
<div class="djm-tree-select-foot-actions">
|
|
2238
|
+
<button class="djm-link-btn" type="button" @click="clearTemp">{{ t('treeSelect.clear') }}</button>
|
|
2239
|
+
<button class="djm-btn djm-btn-sm" type="button" @click="cancel">{{ t('common.cancel') }}</button>
|
|
2240
|
+
<button class="djm-btn djm-btn-sm djm-btn-primary" type="button" @click="confirm">{{ t('common.confirm') }}</button>
|
|
2241
|
+
</div>
|
|
2242
|
+
</div>
|
|
2243
|
+
</div>
|
|
2244
|
+
</Transition>
|
|
2245
|
+
</div>
|
|
2246
|
+
`};import{ref as It,watch as Sr,onMounted as Dr,onBeforeUnmount as Tr}from"vue";var wr=new Set(["p","br","div","span","strong","b","em","i","u","s","del","sub","sup","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","pre","code","hr","a","img","table","thead","tbody","tfoot","tr","th","td"]),jr=new Set(["class","title"]),kr={a:new Set(["href","target","rel"]),img:new Set(["src","alt","width","height"]),ol:new Set(["start"]),th:new Set(["colspan","rowspan","scope"]),td:new Set(["colspan","rowspan"])};function xr(e,t){let a=String(e||"").replace(/[\u0000-\u0020]+/g,"").toLowerCase();return a.startsWith("javascript:")||a.startsWith("vbscript:")?!1:a.startsWith("data:")?t==="img"&&a.startsWith("data:image/"):!0}function Yn(e){[...e.childNodes].forEach(a=>{if(a.nodeType===8){a.remove();return}if(a.nodeType!==1)return;let n=a.tagName.toLowerCase();if(!wr.has(n)){a.remove();return}let i=kr[n];[...a.attributes].forEach(l=>{let o=l.name.toLowerCase();if(!(jr.has(o)||i&&i.has(o))){a.removeAttribute(l.name);return}(o==="href"||o==="src")&&!xr(l.value,n)&&a.removeAttribute(l.name)}),n==="a"&&a.getAttribute("target")==="_blank"&&a.setAttribute("rel","noopener noreferrer"),Yn(a)})}function Et(e){if(!e)return"";let a=new DOMParser().parseFromString('<div id="djm-sanitize-root">'+e+"</div>","text/html").getElementById("djm-sanitize-root");return a?(Yn(a),a.innerHTML):""}var Gn={name:"DjmRichEditor",components:{Icon:L},props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},minHeight:{type:Number,default:200},sanitize:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(e,{emit:t}){let a=It(null),n=It(!1),i=It(e.modelValue),l=It({bold:!1,italic:!1,underline:!1,strike:!1});function o(h){return e.sanitize?Et(h):h}function r(){a.value&&t("update:modelValue",o(a.value.innerHTML))}function s(h){let b=h.clipboardData,j=b&&b.getData("text/html");j&&(h.preventDefault(),document.execCommand("insertHTML",!1,Et(j)),r())}function d(h,b=null){e.disabled||n.value||(document.execCommand(h,!1,b),a.value&&a.value.focus(),r(),p())}function f(h){d("formatBlock",h)}function c(){let h=window.prompt(C("richEditor.linkPrompt"),"https://");h&&d("createLink",h)}function p(){e.disabled||n.value||!a.value||!a.value.contains(document.activeElement)||(l.value={bold:document.queryCommandState("bold"),italic:document.queryCommandState("italic"),underline:document.queryCommandState("underline"),strike:document.queryCommandState("strikeThrough")})}function g(){t("update:modelValue",o(i.value))}function m(){e.disabled||(n.value?(t("update:modelValue",o(i.value)),n.value=!1,requestAnimationFrame(()=>{a.value&&(a.value.innerHTML=o(i.value))})):(i.value=a.value?a.value.innerHTML:e.modelValue,n.value=!0))}return Sr(()=>e.modelValue,h=>{if(n.value){i.value=h;return}let b=o(h);a.value&&a.value.innerHTML!==b&&(a.value.innerHTML=b)}),Dr(()=>{a.value&&(a.value.innerHTML=o(e.modelValue)),document.addEventListener("selectionchange",p)}),Tr(()=>document.removeEventListener("selectionchange",p)),{editor:a,sourceMode:n,source:i,formats:l,exec:d,formatBlock:f,addLink:c,onSourceInput:g,onPaste:s,toggleSource:m,syncFromDom:r,syncFormats:p,t:C}},template:`
|
|
2247
|
+
<div class="djm-rich-editor" :class="{ 'djm-is-disabled': disabled }">
|
|
2248
|
+
<div class="djm-rich-editor-toolbar">
|
|
2249
|
+
<div class="djm-rich-editor-group">
|
|
2250
|
+
<button
|
|
2251
|
+
class="djm-rich-editor-btn djm-rich-editor-btn-bold"
|
|
2252
|
+
type="button"
|
|
2253
|
+
:title="t('richEditor.bold')"
|
|
2254
|
+
:aria-label="t('richEditor.bold')"
|
|
2255
|
+
:aria-pressed="String(formats.bold)"
|
|
2256
|
+
:disabled="disabled"
|
|
2257
|
+
@mousedown.prevent
|
|
2258
|
+
@click="exec('bold')"
|
|
2259
|
+
>B</button>
|
|
2260
|
+
<button
|
|
2261
|
+
class="djm-rich-editor-btn djm-rich-editor-btn-italic"
|
|
2262
|
+
type="button"
|
|
2263
|
+
:title="t('richEditor.italic')"
|
|
2264
|
+
:aria-label="t('richEditor.italic')"
|
|
2265
|
+
:aria-pressed="String(formats.italic)"
|
|
2266
|
+
:disabled="disabled"
|
|
2267
|
+
@mousedown.prevent
|
|
2268
|
+
@click="exec('italic')"
|
|
2269
|
+
>I</button>
|
|
2270
|
+
<button
|
|
2271
|
+
class="djm-rich-editor-btn djm-rich-editor-btn-underline"
|
|
2272
|
+
type="button"
|
|
2273
|
+
:title="t('richEditor.underline')"
|
|
2274
|
+
:aria-label="t('richEditor.underline')"
|
|
2275
|
+
:aria-pressed="String(formats.underline)"
|
|
2276
|
+
:disabled="disabled"
|
|
2277
|
+
@mousedown.prevent
|
|
2278
|
+
@click="exec('underline')"
|
|
2279
|
+
>U</button>
|
|
2280
|
+
<button
|
|
2281
|
+
class="djm-rich-editor-btn djm-rich-editor-btn-strike"
|
|
2282
|
+
type="button"
|
|
2283
|
+
:title="t('richEditor.strike')"
|
|
2284
|
+
:aria-label="t('richEditor.strike')"
|
|
2285
|
+
:aria-pressed="String(formats.strike)"
|
|
2286
|
+
:disabled="disabled"
|
|
2287
|
+
@mousedown.prevent
|
|
2288
|
+
@click="exec('strikeThrough')"
|
|
2289
|
+
>S</button>
|
|
2290
|
+
</div>
|
|
2291
|
+
|
|
2292
|
+
<div class="djm-rich-editor-group">
|
|
2293
|
+
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.heading')" :disabled="disabled" @mousedown.prevent @click="formatBlock('h2')">H2</button>
|
|
2294
|
+
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.paragraph')" :disabled="disabled" @mousedown.prevent @click="formatBlock('p')">{{ t('richEditor.paragraph') }}</button>
|
|
2295
|
+
</div>
|
|
2296
|
+
|
|
2297
|
+
<div class="djm-rich-editor-group">
|
|
2298
|
+
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.bulletList')" :disabled="disabled" @mousedown.prevent @click="exec('insertUnorderedList')">
|
|
2299
|
+
<span class="djm-rich-editor-glyph">\u2022 \u2261</span>
|
|
2300
|
+
</button>
|
|
2301
|
+
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.numberList')" :disabled="disabled" @mousedown.prevent @click="exec('insertOrderedList')">
|
|
2302
|
+
<span class="djm-rich-editor-glyph">1. \u2261</span>
|
|
2303
|
+
</button>
|
|
2304
|
+
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.link')" :aria-label="t('richEditor.link')" :disabled="disabled" @mousedown.prevent @click="addLink">
|
|
2305
|
+
<Icon name="link" :size="13" />
|
|
2306
|
+
</button>
|
|
2307
|
+
</div>
|
|
2308
|
+
|
|
2309
|
+
<div class="djm-rich-editor-group">
|
|
2310
|
+
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.clearFormat')" :disabled="disabled" @mousedown.prevent @click="exec('removeFormat')">{{ t('richEditor.clearFormat') }}</button>
|
|
2311
|
+
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.undo')" :aria-label="t('richEditor.undo')" :disabled="disabled" @mousedown.prevent @click="exec('undo')">\u21B6</button>
|
|
2312
|
+
<button class="djm-rich-editor-btn" type="button" :title="t('richEditor.redo')" :aria-label="t('richEditor.redo')" :disabled="disabled" @mousedown.prevent @click="exec('redo')">\u21B7</button>
|
|
2313
|
+
</div>
|
|
2314
|
+
|
|
2315
|
+
<div class="djm-rich-editor-spacer"></div>
|
|
2316
|
+
<button
|
|
2317
|
+
class="djm-rich-editor-btn"
|
|
2318
|
+
:class="{ 'djm-is-active': sourceMode }"
|
|
2319
|
+
type="button"
|
|
2320
|
+
:aria-pressed="String(sourceMode)"
|
|
2321
|
+
:disabled="disabled"
|
|
2322
|
+
@click="toggleSource"
|
|
2323
|
+
>
|
|
2324
|
+
<Icon name="code" :size="13" />{{ sourceMode ? t('richEditor.visual') : t('richEditor.source') }}
|
|
2325
|
+
</button>
|
|
2326
|
+
</div>
|
|
2327
|
+
|
|
2328
|
+
<div
|
|
2329
|
+
v-show="!sourceMode"
|
|
2330
|
+
ref="editor"
|
|
2331
|
+
class="djm-rich-editor-content"
|
|
2332
|
+
role="textbox"
|
|
2333
|
+
aria-multiline="true"
|
|
2334
|
+
:aria-label="t('richEditor.aria')"
|
|
2335
|
+
:aria-disabled="disabled ? 'true' : undefined"
|
|
2336
|
+
:contenteditable="disabled ? 'false' : 'true'"
|
|
2337
|
+
:data-placeholder="placeholder || t('richEditor.placeholder')"
|
|
2338
|
+
:style="{ minHeight: minHeight + 'px' }"
|
|
2339
|
+
@input="syncFromDom"
|
|
2340
|
+
@paste="onPaste"
|
|
2341
|
+
></div>
|
|
2342
|
+
|
|
2343
|
+
<textarea
|
|
2344
|
+
v-show="sourceMode"
|
|
2345
|
+
v-model="source"
|
|
2346
|
+
class="djm-rich-editor-source"
|
|
2347
|
+
:style="{ minHeight: minHeight + 'px' }"
|
|
2348
|
+
:disabled="disabled"
|
|
2349
|
+
:aria-label="t('richEditor.source')"
|
|
2350
|
+
spellcheck="false"
|
|
2351
|
+
@input="onSourceInput"
|
|
2352
|
+
></textarea>
|
|
2353
|
+
</div>
|
|
2354
|
+
`};import{ref as _e,onBeforeUnmount as Mr}from"vue";function Lt(e,t,a){return Math.min(Math.max(e,t),Math.max(t,a))}var Jn={name:"DjmFloatingWindow",components:{Icon:L},props:{title:{type:String,default:"\u7A97\u53E3"},icon:{type:String,default:"monitor"},initialX:{type:Number,default:24},initialY:{type:Number,default:24},width:{type:Number,default:420},height:{type:Number,default:280},zIndex:{type:Number,default:1}},emits:["close","focus"],setup(e,{emit:t}){let a=_e(null),n=_e({x:e.initialX,y:e.initialY}),i=_e({w:e.width,h:e.height}),l=_e(!1),o=_e(!1),r=_e(null),s=null,d=null;function f(){return a.value?a.value.parentElement:null}function c(y){if(y.button!==0||l.value||o.value)return;t("focus");let u=f();u&&(s={sx:y.clientX,sy:y.clientY,x:n.value.x,y:n.value.y,maxX:u.clientWidth-i.value.w,maxY:u.clientHeight-i.value.h},window.addEventListener("pointermove",p),window.addEventListener("pointerup",g),y.preventDefault())}function p(y){s&&(n.value={x:Lt(s.x+y.clientX-s.sx,0,s.maxX),y:Lt(s.y+y.clientY-s.sy,0,s.maxY)})}function g(){s=null,window.removeEventListener("pointermove",p),window.removeEventListener("pointerup",g)}function m(y){if(l.value||o.value)return;y.stopPropagation(),t("focus");let u=f();u&&(d={sx:y.clientX,sy:y.clientY,w:i.value.w,h:i.value.h,maxW:u.clientWidth-n.value.x,maxH:u.clientHeight-n.value.y},window.addEventListener("pointermove",h),window.addEventListener("pointerup",b),y.preventDefault())}function h(y){if(!d)return;let u=Math.min(280,d.maxW),v=Math.min(170,d.maxH);i.value={w:Lt(d.w+y.clientX-d.sx,u,d.maxW),h:Lt(d.h+y.clientY-d.sy,v,d.maxH)}}function b(){d=null,window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",b)}function j(){l.value=!l.value,t("focus")}function w(){if(o.value)r.value&&(n.value={...r.value.pos},i.value={...r.value.size},o.value=!1);else{r.value={pos:{...n.value},size:{...i.value}};let y=f();y&&(n.value={x:0,y:0},i.value={w:y.clientWidth-2,h:y.clientHeight-2}),o.value=!0,l.value=!1}t("focus")}return Mr(()=>{window.removeEventListener("pointermove",p),window.removeEventListener("pointerup",g),window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",b)}),{root:a,pos:n,size:i,minimized:l,maximized:o,startDrag:c,startResize:m,toggleMin:j,toggleMax:w}},template:`
|
|
2355
|
+
<div
|
|
2356
|
+
ref="root"
|
|
2357
|
+
class="djm-float-window"
|
|
2358
|
+
:class="{ 'djm-is-minimized': minimized, 'djm-is-maximized': maximized }"
|
|
2359
|
+
:style="{
|
|
2360
|
+
left: pos.x + 'px',
|
|
2361
|
+
top: pos.y + 'px',
|
|
2362
|
+
width: size.w + 'px',
|
|
2363
|
+
height: (minimized ? 38 : size.h) + 'px',
|
|
2364
|
+
zIndex: zIndex
|
|
2365
|
+
}"
|
|
2366
|
+
@pointerdown="$emit('focus')"
|
|
2367
|
+
>
|
|
2368
|
+
<div class="djm-float-head" @pointerdown="startDrag" @dblclick="toggleMax">
|
|
2369
|
+
<Icon :name="icon" :size="14" class="djm-float-icon" />
|
|
2370
|
+
<span class="djm-float-title">{{ title }}</span>
|
|
2371
|
+
<div class="djm-float-actions" @pointerdown.stop>
|
|
2372
|
+
<button class="djm-float-btn" type="button" :title="minimized ? '\u8FD8\u539F' : '\u6700\u5C0F\u5316'" @click="toggleMin">
|
|
2373
|
+
<Icon :name="minimized ? 'maximize' : 'minimize'" :size="12" />
|
|
2374
|
+
</button>
|
|
2375
|
+
<button class="djm-float-btn" type="button" :title="maximized ? '\u8FD8\u539F' : '\u6700\u5927\u5316'" @click="toggleMax">
|
|
2376
|
+
<Icon :name="maximized ? 'minimize' : 'maximize'" :size="12" />
|
|
2377
|
+
</button>
|
|
2378
|
+
<button class="djm-float-btn djm-close" type="button" title="\u5173\u95ED" @click="$emit('close')">
|
|
2379
|
+
<Icon name="x" :size="12" />
|
|
2380
|
+
</button>
|
|
2381
|
+
</div>
|
|
2382
|
+
</div>
|
|
2383
|
+
|
|
2384
|
+
<div class="djm-float-body" v-show="!minimized">
|
|
2385
|
+
<slot></slot>
|
|
2386
|
+
</div>
|
|
2387
|
+
|
|
2388
|
+
<span class="djm-float-resize" v-if="!minimized && !maximized" @pointerdown="startResize"></span>
|
|
2389
|
+
</div>
|
|
2390
|
+
`};import{reactive as Cr,ref as aa,watch as Er,onBeforeUnmount as Ir}from"vue";var Xn=0;function Lr(e){let t=e.lastIndexOf(".");return t===-1?"":e.slice(t+1).toLowerCase()}function Ye(e){return!e&&e!==0?"":e<1024?e+" B":e<1024*1024?(e/1024).toFixed(1)+" KB":(e/1024/1024).toFixed(1)+" MB"}function Ar(e,t){if(!t)return!0;let a=(e.name||"").toLowerCase(),n=(e.type||"").toLowerCase();return t.split(",").map(i=>i.trim().toLowerCase()).filter(Boolean).some(i=>i.startsWith(".")?a.endsWith(i):i.endsWith("/*")?n.startsWith(i.slice(0,-1)):n===i)}var Qn={name:"DjmUpload",components:{DjmIcon:L},props:{modelValue:{type:Array,default:()=>[]},accept:{type:String,default:""},maxSize:{type:Number,default:10*1024*1024},limit:{type:Number,default:6},multiple:{type:Boolean,default:!0},drag:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},listType:{type:String,default:"text"},autoUpload:{type:Boolean,default:!0},request:{type:Function,default:null},beforeUpload:{type:Function,default:null},hint:{type:String,default:""},showList:{type:Boolean,default:!0}},emits:["update:modelValue","change","success","error","remove","exceed"],setup(e,{emit:t}){let a=aa([]),n=aa(!1),i=aa(null),l=new Map;Er(()=>e.modelValue,y=>{let u=y||[],v=a.value;u.length===v.length&&u.every((D,x)=>D===v[x])||(a.value=u.slice())});function o(){t("update:modelValue",a.value.slice()),t("change",a.value.slice())}function r(y,u){return C(y,u)}function s(){e.disabled||i.value&&i.value.click()}function d(y,u,v){a.value.includes(y)&&(l.delete(y.uid),u==="done"?(y.status="done",y.progress=100,y.response=v,y.message="",t("success",y,v)):(y.status="error",y.message=v&&v.message?v.message:r("upload.failed"),t("error",y,v)),o())}function f(y){if(!e.request){y.status="ready";return}y.status="uploading",y.progress=0,y.message="";let u=e.request(y.raw,{onProgress(v){y.progress=Math.max(0,Math.min(100,Math.round(v)))},onSuccess(v){d(y,"done",v)},onError(v){d(y,"error",v)}});u&&typeof u.then=="function"&&u.then(v=>d(y,"done",v),v=>d(y,"error",v)),typeof u=="function"&&l.set(y.uid,u)}async function c(y){if(e.disabled)return[];let u=Array.from(y||[]);if(!u.length)return[];let v=e.limit>0?e.limit-a.value.length:u.length;if(v<=0)return t("exceed",u),[];let T=u.slice(0,v);u.length>v&&t("exceed",u.slice(v));let D=[];for(let x of T){if(!Ar(x,e.accept)){t("error",{file:x,reason:"accept"});continue}if(e.maxSize>0&&x.size>e.maxSize){t("error",{file:x,reason:"size"});continue}if(typeof e.beforeUpload=="function"){let S=!0;try{S=await e.beforeUpload(x)}catch{S=!1}if(S===!1)continue}Xn+=1;let z=Cr({uid:Xn,name:x.name,size:x.size,ext:Lr(x.name),type:x.type,raw:x,url:x.type&&x.type.startsWith("image/")?URL.createObjectURL(x):"",progress:0,status:e.autoUpload?"uploading":"ready",response:null,message:""});a.value.push(z),D.push(z)}return D.length&&(o(),D.forEach(f)),D}function p(y){c(y.target.files),y.target.value=""}function g(){e.disabled||(n.value=!0)}function m(y){n.value=!1,c(y.dataTransfer.files)}function h(y){let u=l.get(y.uid);typeof u=="function"&&u(),l.delete(y.uid),y.url&&URL.revokeObjectURL(y.url),a.value=a.value.filter(v=>v.uid!==y.uid),t("remove",y),o()}function b(y){e.disabled||f(y)}function j(){a.value.filter(y=>y.status==="ready"||y.status==="error").forEach(f)}function w(){a.value.forEach(y=>{let u=l.get(y.uid);typeof u=="function"&&u(),y.url&&URL.revokeObjectURL(y.url)}),l.clear(),a.value=[],o()}return Ir(()=>{a.value.forEach(y=>{y.url&&URL.revokeObjectURL(y.url)}),l.clear()}),{files:a,dragActive:n,inputRef:i,pick:s,addFiles:c,onChange:p,onDragOver:g,onDrop:m,remove:h,retry:b,submit:j,clear:w,formatFileSize:Ye,statusLabel(y){return y.status==="uploading"?r("upload.uploading",{percent:y.progress}):y.status==="done"?r("upload.done"):y.status==="error"?y.message||r("upload.failed"):r("upload.ready")},hintText(){if(e.hint)return e.hint;let y=[];return e.limit>0&&y.push(r("upload.limitHint",{count:e.limit})),e.maxSize>0&&y.push(r("upload.sizeHint",{size:Ye(e.maxSize)})),y.join(" \xB7 ")||r("upload.dropHint")},t:r}},template:`
|
|
2391
|
+
<div class="djm-upload" :class="{ 'djm-is-disabled': disabled }">
|
|
2392
|
+
<div
|
|
2393
|
+
v-if="drag"
|
|
2394
|
+
class="djm-upload-zone"
|
|
2395
|
+
:class="{ 'djm-is-active': dragActive }"
|
|
2396
|
+
@click="pick"
|
|
2397
|
+
@dragover.prevent="onDragOver"
|
|
2398
|
+
@dragleave.prevent="dragActive = false"
|
|
2399
|
+
@drop.prevent="onDrop"
|
|
2400
|
+
>
|
|
2401
|
+
<slot :pick="pick">
|
|
2402
|
+
<span class="djm-upload-icon"><DjmIcon name="upload" :size="22" /></span>
|
|
2403
|
+
<strong>{{ t('upload.dropText') }}</strong>
|
|
2404
|
+
<span>{{ hintText() }}</span>
|
|
2405
|
+
<button class="djm-btn djm-btn-primary djm-btn-sm" type="button" :disabled="disabled" @click.stop="pick">
|
|
2406
|
+
<DjmIcon name="plus" />{{ t('upload.select') }}
|
|
2407
|
+
</button>
|
|
2408
|
+
</slot>
|
|
2409
|
+
<input
|
|
2410
|
+
ref="inputRef"
|
|
2411
|
+
class="djm-hidden-input"
|
|
2412
|
+
type="file"
|
|
2413
|
+
:accept="accept"
|
|
2414
|
+
:multiple="multiple"
|
|
2415
|
+
:disabled="disabled"
|
|
2416
|
+
@change="onChange"
|
|
2417
|
+
/>
|
|
2418
|
+
</div>
|
|
2419
|
+
|
|
2420
|
+
<input
|
|
2421
|
+
v-else
|
|
2422
|
+
ref="inputRef"
|
|
2423
|
+
class="djm-hidden-input"
|
|
2424
|
+
type="file"
|
|
2425
|
+
:accept="accept"
|
|
2426
|
+
:multiple="multiple"
|
|
2427
|
+
:disabled="disabled"
|
|
2428
|
+
@change="onChange"
|
|
2429
|
+
/>
|
|
2430
|
+
|
|
2431
|
+
<template v-if="showList">
|
|
2432
|
+
<div class="djm-upload-head" v-if="files.length">
|
|
2433
|
+
<span>{{ t('upload.count', { count: files.length }) }}</span>
|
|
2434
|
+
<button class="djm-link-btn djm-danger" type="button" @click="clear">{{ t('upload.clear') }}</button>
|
|
2435
|
+
</div>
|
|
2436
|
+
|
|
2437
|
+
<ul class="djm-upload-list" v-if="files.length && listType === 'text'">
|
|
2438
|
+
<li v-for="(file, index) in files" :key="file.uid">
|
|
2439
|
+
<slot name="file" :file="file" :index="index">
|
|
2440
|
+
<span class="djm-file-thumb" :class="{ image: file.url }">
|
|
2441
|
+
<img v-if="file.url" :src="file.url" alt="" />
|
|
2442
|
+
<DjmIcon v-else name="file" :size="18" />
|
|
2443
|
+
</span>
|
|
2444
|
+
|
|
2445
|
+
<div class="djm-file-main">
|
|
2446
|
+
<div class="djm-file-top">
|
|
2447
|
+
<strong :title="file.name">{{ file.name }}</strong>
|
|
2448
|
+
<span class="djm-file-size">{{ formatFileSize(file.size) }}</span>
|
|
2449
|
+
</div>
|
|
2450
|
+
<div class="djm-progress djm-file-progress">
|
|
2451
|
+
<div
|
|
2452
|
+
class="djm-progress-bar"
|
|
2453
|
+
:class="{ 'djm-danger': file.status === 'error' }"
|
|
2454
|
+
:style="{ width: file.progress + '%' }"
|
|
2455
|
+
></div>
|
|
2456
|
+
</div>
|
|
2457
|
+
<div class="djm-file-meta">
|
|
2458
|
+
<span v-if="file.status === 'uploading'">{{ statusLabel(file) }}</span>
|
|
2459
|
+
<span v-else-if="file.status === 'done'" class="djm-status djm-ok"><i></i>{{ statusLabel(file) }}</span>
|
|
2460
|
+
<span v-else-if="file.status === 'error'" class="djm-status djm-danger"><i></i>{{ statusLabel(file) }}</span>
|
|
2461
|
+
<span v-else>{{ statusLabel(file) }}</span>
|
|
2462
|
+
</div>
|
|
2463
|
+
</div>
|
|
2464
|
+
|
|
2465
|
+
<div class="djm-file-actions">
|
|
2466
|
+
<slot name="actions" :file="file" :index="index">
|
|
2467
|
+
<button v-if="file.status === 'error'" class="djm-link-btn" type="button" @click="retry(file)">
|
|
2468
|
+
{{ t('upload.retry') }}
|
|
2469
|
+
</button>
|
|
2470
|
+
<button v-if="file.status === 'ready'" class="djm-link-btn" type="button" @click="retry(file)">
|
|
2471
|
+
{{ t('upload.start') }}
|
|
2472
|
+
</button>
|
|
2473
|
+
<button class="djm-link-btn djm-danger" type="button" @click="remove(file)">
|
|
2474
|
+
{{ t('upload.remove') }}
|
|
2475
|
+
</button>
|
|
2476
|
+
</slot>
|
|
2477
|
+
</div>
|
|
2478
|
+
</slot>
|
|
2479
|
+
</li>
|
|
2480
|
+
</ul>
|
|
2481
|
+
|
|
2482
|
+
<div class="djm-upload-picture" v-else-if="files.length">
|
|
2483
|
+
<div class="djm-upload-picture-item" v-for="(file, index) in files" :key="file.uid">
|
|
2484
|
+
<img v-if="file.url" :src="file.url" :alt="file.name" :title="file.name" />
|
|
2485
|
+
<DjmIcon v-else name="file" :size="20" />
|
|
2486
|
+
<div class="djm-upload-picture-mask">
|
|
2487
|
+
<span>{{ file.status === 'uploading' ? file.progress + '%' : statusLabel(file) }}</span>
|
|
2488
|
+
</div>
|
|
2489
|
+
<button class="djm-upload-picture-remove" type="button" :title="t('upload.remove')" @click="remove(file)">
|
|
2490
|
+
<DjmIcon name="x" :size="11" />
|
|
2491
|
+
</button>
|
|
2492
|
+
</div>
|
|
2493
|
+
</div>
|
|
2494
|
+
|
|
2495
|
+
<div class="djm-upload-empty" v-else>{{ t('upload.empty') }}</div>
|
|
2496
|
+
</template>
|
|
2497
|
+
</div>
|
|
2498
|
+
`};import{computed as Zn,ref as je,watch as na}from"vue";var ei={name:"DjmTree",components:{Icon:L},props:{data:{type:Array,default:()=>[]},nodeKey:{type:String,default:"id"},labelKey:{type:String,default:"label"},checkable:{type:Boolean,default:!1},checked:{type:Array,default:()=>[]},checkStrictly:{type:Boolean,default:!1},expanded:{type:Array,default:()=>[]},defaultExpandAll:{type:Boolean,default:!1},lazy:{type:Boolean,default:!1},load:{type:Function,default:null},keyword:{type:String,default:""},activeKey:{type:[String,Number],default:""},rowClass:{type:[String,Function],default:""},draggable:{type:Boolean,default:!1},allowDrop:{type:Function,default:null},emptyText:{type:String,default:""}},emits:["update:checked","update:expanded","node-click","check","node-drop","load-error"],setup(e,{emit:t}){let a=je({}),n=je([]),i=je([...e.expanded]),l=je([...e.checked]);na(()=>e.expanded,k=>{Array.isArray(k)&&(i.value=k)}),na(()=>e.checked,k=>{Array.isArray(k)&&(l.value=k)});function o(k){let E=k[e.nodeKey];return a.value[E]?a.value[E]:k.children||null}function r(k){let E=o(k);return E&&E.length?!0:s(k)}function s(k){let E=k[e.nodeKey];return a.value[E]?!1:e.lazy&&typeof e.load=="function"&&!k.children&&k.isLeaf!==!0}function d(k){return e.keyword.trim()?!0:i.value.includes(k[e.nodeKey])}function f(k){return n.value.includes(k[e.nodeKey])}function c(k,E=[]){return k.forEach(B=>{let $=o(B);$&&$.length&&(E.push(B[e.nodeKey]),c($,E))}),E}na(()=>e.data,()=>{e.defaultExpandAll&&(i.value=c(e.data))},{immediate:!0});function p(k){return String(k[e.labelKey]||"").toLowerCase().includes(e.keyword.trim().toLowerCase())}function g(k){if(!e.keyword.trim()||p(k))return!0;let E=o(k);return!!(E&&E.some(B=>g(B)))}let m=Zn(()=>{let k=[],E=(B,$)=>{B.forEach(q=>{if(!g(q))return;k.push({node:q,level:$,index:k.length});let ie=o(q);ie&&ie.length&&d(q)&&E(ie,$+1)})};return E(e.data,0),k});function h(k,E=[]){let B=o(k);return B&&B.length?B.forEach($=>h($,E)):E.push(k[e.nodeKey]),E}function b(k){let E=e.checkStrictly?[k[e.nodeKey]]:h(k);return E.length>0&&E.every(B=>l.value.includes(B))}function j(k){if(e.checkStrictly)return!1;let E=h(k),B=E.filter($=>l.value.includes($)).length;return B>0&&B<E.length}function w(k,E){if(k.disabled){E&&(E.target.checked=b(k));return}let B=e.checkStrictly?[k[e.nodeKey]]:h(k),$=B.every(ie=>l.value.includes(ie)),q=$?l.value.filter(ie=>!B.includes(ie)):[...new Set([...l.value,...B])];l.value=q,t("update:checked",q),t("check",{node:k,checked:!$,keys:q})}async function y(k){let E=k[e.nodeKey];if(!r(k))return;if(s(k)&&!a.value[E]){n.value=[...n.value,E];try{let q=await e.load(k);a.value={...a.value,[E]:q||[]}}catch(q){t("load-error",k,q);return}finally{n.value=n.value.filter(q=>q!==E)}}let $=i.value.includes(E)?i.value.filter(q=>q!==E):[...i.value,E];i.value=$,t("update:expanded",$)}function u(k){k.disabled||t("node-click",k)}function v(k){return e.activeKey!==""&&k[e.nodeKey]===e.activeKey}let T=je(null),D=je(-1);function x(k){return(D.value===-1?0:D.value)===k?0:-1}function z(k){let B=(T.value?T.value.querySelectorAll(".djm-tree-node"):[])[k];B&&(D.value=k,B.focus())}function S(k){let E=m.value.length;if(!E)return;let B=D.value===-1?0:D.value,$=m.value[B],q=k.key;if(q==="ArrowDown"||q==="ArrowUp"){k.preventDefault(),z(Math.min(E-1,Math.max(0,B+(q==="ArrowDown"?1:-1))));return}if(q==="Home"||q==="End"){k.preventDefault(),z(q==="Home"?0:E-1);return}if(q==="ArrowRight"){k.preventDefault(),$&&r($.node)&&!d($.node)?y($.node):z(Math.min(E-1,B+1));return}if(q==="ArrowLeft"){if(k.preventDefault(),$&&r($.node)&&d($.node)){y($.node);return}for(let ie=B-1;ie>=0;ie--)if(m.value[ie].level===$.level-1){z(ie);break}return}if(q==="Enter"||q===" "){if(!$)return;k.preventDefault(),q===" "&&e.checkable?w($.node):u($.node)}}function M(k,E){return typeof e.rowClass=="function"?e.rowClass(k,E):e.rowClass}let I=je(""),A=je(""),V=je("");function H(k,E=e.data){for(let B of E){if(B[e.nodeKey]===k)return B;let $=o(B);if($&&$.length){let q=H(k,$);if(q)return q}}return null}function Y(k,E){if(k[e.nodeKey]===E)return!0;let B=o(k);return!!(B&&B.some($=>Y($,E)))}function X(k,E){let B=k.currentTarget.getBoundingClientRect(),$=B.height?(k.clientY-B.top)/B.height:.5;return $<.28?"before":$>.72?"after":r(E)?"inside":"after"}function R(k,E){if(!e.draggable||!I.value||k.disabled)return!1;let B=H(I.value);return!(!B||B===k||Y(B,k[e.nodeKey])||typeof e.allowDrop=="function"&&e.allowDrop(B,k,E)===!1)}function F(){I.value="",A.value="",V.value=""}function U(k,E){!e.draggable||k.disabled||(I.value=k[e.nodeKey],A.value="",E.dataTransfer&&(E.dataTransfer.setData("text/plain",String(I.value)),E.dataTransfer.effectAllowed="move"))}function te(k,E){if(!e.draggable||!I.value)return;let B=X(E,k);if(!R(k,B)){A.value===k[e.nodeKey]&&F();return}E.preventDefault(),E.dataTransfer&&(E.dataTransfer.dropEffect="move"),A.value=k[e.nodeKey],V.value=B}function Q(k){A.value===k[e.nodeKey]&&(A.value="",V.value="")}function le(k,E){if(!e.draggable||!I.value)return;E.preventDefault();let B=V.value||X(E,k),$=H(I.value);A.value===k[e.nodeKey]&&R(k,B)&&$&&t("node-drop",{dragNode:$,dropNode:k,position:B}),F()}function P(){F()}function O(k){return A.value!==k[e.nodeKey]?"":"djm-is-drop-"+V.value}function W(k){return I.value!==""&&k[e.nodeKey]===I.value}function ne(k){return k[e.labelKey]}return{rows:m,rootEl:T,focusIndex:D,tabIndexOf:x,onKeydown:S,childrenOf:o,hasChildren:r,isExpanded:d,isActive:v,isLoading:f,isChecked:b,isIndeterminate:j,toggleCheck:w,toggleExpand:y,onNodeClick:u,rowClassOf:M,dropClassOf:O,isDragging:W,onDragStart:U,onDragOver:te,onDragLeave:Q,onDrop:le,onDragEnd:P,labelOf:ne,emptyLabel:Zn(()=>e.emptyText||C("tree.empty")),t:C}},template:`
|
|
2499
|
+
<div class="djm-tree" role="tree" ref="rootEl" @keydown="onKeydown">
|
|
2500
|
+
<div
|
|
2501
|
+
v-for="row in rows"
|
|
2502
|
+
:key="row.node[nodeKey]"
|
|
2503
|
+
class="djm-tree-node"
|
|
2504
|
+
:class="[rowClassOf(row.node, row.level), dropClassOf(row.node), {
|
|
2505
|
+
'djm-is-disabled': row.node.disabled,
|
|
2506
|
+
'djm-is-active': isActive(row.node),
|
|
2507
|
+
'djm-is-draggable': draggable,
|
|
2508
|
+
'djm-is-dragging': isDragging(row.node)
|
|
2509
|
+
}]"
|
|
2510
|
+
:style="{ paddingLeft: 6 + row.level * 16 + 'px' }"
|
|
2511
|
+
role="treeitem"
|
|
2512
|
+
:tabindex="tabIndexOf(row.index)"
|
|
2513
|
+
:aria-level="row.level + 1"
|
|
2514
|
+
:aria-expanded="hasChildren(row.node) ? isExpanded(row.node) : undefined"
|
|
2515
|
+
:aria-selected="activeKey !== '' ? isActive(row.node) : undefined"
|
|
2516
|
+
:draggable="draggable ? 'true' : undefined"
|
|
2517
|
+
@focus="focusIndex = row.index"
|
|
2518
|
+
@click="onNodeClick(row.node)"
|
|
2519
|
+
@dragstart="onDragStart(row.node, $event)"
|
|
2520
|
+
@dragover="onDragOver(row.node, $event)"
|
|
2521
|
+
@dragleave="onDragLeave(row.node)"
|
|
2522
|
+
@drop="onDrop(row.node, $event)"
|
|
2523
|
+
@dragend="onDragEnd"
|
|
2524
|
+
>
|
|
2525
|
+
<button
|
|
2526
|
+
v-if="hasChildren(row.node)"
|
|
2527
|
+
class="djm-tree-arrow"
|
|
2528
|
+
:class="{ 'djm-is-loading': isLoading(row.node) }"
|
|
2529
|
+
type="button"
|
|
2530
|
+
tabindex="-1"
|
|
2531
|
+
:aria-label="isExpanded(row.node) ? '\u6536\u8D77' : '\u5C55\u5F00'"
|
|
2532
|
+
@click.stop="toggleExpand(row.node)"
|
|
2533
|
+
>
|
|
2534
|
+
<span v-if="isLoading(row.node)" class="djm-spinner"></span>
|
|
2535
|
+
<Icon v-else :name="isExpanded(row.node) ? 'chevron-down' : 'chevron-right'" :size="11" />
|
|
2536
|
+
</button>
|
|
2537
|
+
<span v-else class="djm-tree-arrow-placeholder"></span>
|
|
2538
|
+
|
|
2539
|
+
<input
|
|
2540
|
+
v-if="checkable"
|
|
2541
|
+
type="checkbox"
|
|
2542
|
+
tabindex="-1"
|
|
2543
|
+
:aria-label="labelOf(row.node)"
|
|
2544
|
+
:checked="isChecked(row.node)"
|
|
2545
|
+
:indeterminate="isIndeterminate(row.node)"
|
|
2546
|
+
:disabled="row.node.disabled"
|
|
2547
|
+
@click.stop
|
|
2548
|
+
@change="toggleCheck(row.node, $event)"
|
|
2549
|
+
/>
|
|
2550
|
+
|
|
2551
|
+
<Icon v-if="row.node.icon" :name="row.node.icon" :size="13" class="djm-tree-icon" />
|
|
2552
|
+
<span class="djm-tree-label">
|
|
2553
|
+
<slot name="node" :node="row.node" :level="row.level" :active="isActive(row.node)">{{ labelOf(row.node) }}</slot>
|
|
2554
|
+
</span>
|
|
2555
|
+
</div>
|
|
2556
|
+
|
|
2557
|
+
<div v-if="!rows.length" class="djm-tree-empty">{{ emptyLabel }}</div>
|
|
2558
|
+
</div>
|
|
2559
|
+
`};import{computed as ia,nextTick as Pr,reactive as ti,ref as ai,useSlots as zr,watch as Br}from"vue";var la="__editable_actions";function oa(e){return e===""||e===null||e===void 0?!0:Array.isArray(e)&&e.length===0}var ni={name:"DjmEditableTable",components:{DjmTable:dt,DjmInput:pe,DjmSelect:Te,DjmSwitch:Oe,DjmDatePicker:we},inheritAttrs:!1,props:{columns:{type:Array,required:!0},rows:{type:Array,default:()=>[]},rowKey:{type:String,default:"id"},showActions:{type:Boolean,default:!0},actionLabel:{type:String,default:"\u64CD\u4F5C"},actionWidth:{type:Number,default:120},editable:{type:Function,default:null}},emits:["edit","save","cancel"],setup(e,{emit:t}){let a=zr(),n=ai(""),i=ti({}),l=ti({}),o=ai(null),r=ia(()=>e.columns.filter(u=>u.editor)),s=ia(()=>e.showActions?e.columns.concat({key:la,label:e.actionLabel,width:e.actionWidth,class:"djm-col-actions",fixed:"right",exportable:!1}):e.columns),d=ia(()=>{let u=new Set(r.value.map(v=>"cell-"+v.key));return u.add("cell-"+la),Object.keys(a).filter(v=>!u.has(v))});function f(u){return"cell-"+u.key}let c="cell-"+la;function p(){Object.keys(l).forEach(u=>delete l[u])}function g(u){return n.value!==""&&u[e.rowKey]===n.value}function m(u){return typeof e.editable=="function"?!!e.editable(u):!0}function h(u){return m(u)?(n.value=u[e.rowKey],r.value.forEach(v=>{i[v.key]=u[v.key]}),p(),t("edit",u),!0):!1}function b(){let u=j(n.value);n.value="",p(),u&&t("cancel",u)}function j(u){return u===""?null:e.rows.find(v=>v[e.rowKey]===u)||null}function w(){return p(),r.value.forEach(u=>{let v=i[u.key],T=u.rules||[];for(let D of T){if(D.required&&oa(v)){l[u.key]=D.message||"\u8BE5\u9879\u4E3A\u5FC5\u586B";break}if(D.pattern&&!oa(v)&&!D.pattern.test(String(v))){l[u.key]=D.message||"\u683C\u5F0F\u4E0D\u6B63\u786E";break}if(typeof D.validator=="function"){let x=D.validator(v,i);if(x===!1){l[u.key]=D.message||"\u6821\u9A8C\u672A\u901A\u8FC7";break}if(typeof x=="string"){l[u.key]=x;break}}}}),Object.keys(l).length===0}function y(){let u=j(n.value);if(!u)return n.value="",!1;if(!w())return Pr(()=>{let T=o.value&&o.value.$el?o.value.$el.querySelector(".djm-cell-error"):null;T&&T.scrollIntoView({block:"nearest"})}),!1;let v={};return r.value.forEach(T=>{let D=i[T.key];T.editor==="number"?v[T.key]=oa(D)?null:Number(D):v[T.key]=typeof D=="string"?D.trim():D}),t("save",{row:u,changes:v}),n.value="",p(),!0}return Br(()=>e.rows,()=>{n.value&&!j(n.value)&&(n.value="",p())}),{tableRef:o,editingKey:n,draft:i,errors:l,editableColumns:r,renderColumns:s,forwardedSlotNames:d,cellSlot:f,actionsSlot:c,isEditing:g,rowEditable:m,startEdit:h,cancelEdit:b,saveEdit:y}},template:`
|
|
2560
|
+
<DjmTable
|
|
2561
|
+
ref="tableRef"
|
|
2562
|
+
v-bind="$attrs"
|
|
2563
|
+
:columns="renderColumns"
|
|
2564
|
+
:rows="rows"
|
|
2565
|
+
:row-key="rowKey"
|
|
2566
|
+
>
|
|
2567
|
+
<!-- \u53EF\u7F16\u8F91\u5217\uFF1A\u7F16\u8F91\u6001\u6E32\u67D3\u63A7\u4EF6\uFF0C\u975E\u7F16\u8F91\u6001\u4ECD\u8D70\u4F7F\u7528\u65B9\u63D2\u69FD\u6216\u9ED8\u8BA4\u6587\u672C -->
|
|
2568
|
+
<template v-for="column in editableColumns" :key="'edit-' + column.key" #[cellSlot(column)]="scope">
|
|
2569
|
+
<div v-if="isEditing(scope.row)" class="djm-cell-editor" @keydown.esc="cancelEdit">
|
|
2570
|
+
<DjmSelect
|
|
2571
|
+
v-if="column.editor === 'select'"
|
|
2572
|
+
v-model="draft[column.key]"
|
|
2573
|
+
:options="column.options || []"
|
|
2574
|
+
:aria-label="column.label"
|
|
2575
|
+
/>
|
|
2576
|
+
<DjmSwitch
|
|
2577
|
+
v-else-if="column.editor === 'switch'"
|
|
2578
|
+
v-model="draft[column.key]"
|
|
2579
|
+
:label="column.label"
|
|
2580
|
+
/>
|
|
2581
|
+
<DjmDatePicker
|
|
2582
|
+
v-else-if="column.editor === 'date'"
|
|
2583
|
+
v-model="draft[column.key]"
|
|
2584
|
+
:placeholder="column.label"
|
|
2585
|
+
/>
|
|
2586
|
+
<textarea
|
|
2587
|
+
v-else-if="column.editor === 'textarea'"
|
|
2588
|
+
class="djm-input djm-textarea"
|
|
2589
|
+
rows="2"
|
|
2590
|
+
:aria-label="column.label"
|
|
2591
|
+
v-model="draft[column.key]"
|
|
2592
|
+
></textarea>
|
|
2593
|
+
<DjmInput
|
|
2594
|
+
v-else
|
|
2595
|
+
v-model="draft[column.key]"
|
|
2596
|
+
:type="column.editor === 'number' ? 'number' : 'text'"
|
|
2597
|
+
:aria-label="column.label"
|
|
2598
|
+
@enter="saveEdit"
|
|
2599
|
+
/>
|
|
2600
|
+
<em v-if="errors[column.key]" class="djm-cell-error">{{ errors[column.key] }}</em>
|
|
2601
|
+
</div>
|
|
2602
|
+
<slot v-else :name="cellSlot(column)" v-bind="scope">{{ scope.value }}</slot>
|
|
2603
|
+
</template>
|
|
2604
|
+
|
|
2605
|
+
<!-- \u64CD\u4F5C\u5217\uFF1A\u7F16\u8F91 / \u4FDD\u5B58 / \u53D6\u6D88\uFF0C\u989D\u5916\u64CD\u4F5C\u7528 row-actions \u63D2\u69FD -->
|
|
2606
|
+
<template v-if="showActions" #[actionsSlot]="{ row }">
|
|
2607
|
+
<div v-if="isEditing(row)" class="djm-row-actions">
|
|
2608
|
+
<button class="djm-link-btn" type="button" @click="saveEdit">\u4FDD\u5B58</button>
|
|
2609
|
+
<button class="djm-link-btn djm-muted" type="button" @click="cancelEdit">\u53D6\u6D88</button>
|
|
2610
|
+
</div>
|
|
2611
|
+
<div v-else class="djm-row-actions">
|
|
2612
|
+
<button class="djm-link-btn" type="button" :disabled="!rowEditable(row)" @click="startEdit(row)">\u7F16\u8F91</button>
|
|
2613
|
+
<slot name="row-actions" :row="row"></slot>
|
|
2614
|
+
</div>
|
|
2615
|
+
</template>
|
|
2616
|
+
|
|
2617
|
+
<template v-for="name in forwardedSlotNames" :key="'slot-' + name" #[name]="scope">
|
|
2618
|
+
<slot :name="name" v-bind="scope || {}"></slot>
|
|
2619
|
+
</template>
|
|
2620
|
+
</DjmTable>
|
|
2621
|
+
`};var ii={name:"DjmDescriptions",props:{items:{type:Array,default:()=>[]},columns:{type:[Number,String],default:2},labelWidth:{type:[Number,String],default:72}},computed:{descStyle(){let e=Math.max(1,Number(this.columns)||1),t=this.labelWidth,a=typeof t=="number"||/^\d+(\.\d+)?$/.test(t)?t+"px":t;return{"--djm-desc-columns":e,"--djm-desc-label-w":a}}},methods:{slotOf(e){return"value-"+(e.key||e.label)}},template:`
|
|
2622
|
+
<dl class="djm-descriptions" :style="descStyle">
|
|
2623
|
+
<div
|
|
2624
|
+
v-for="item in items"
|
|
2625
|
+
:key="item.key || item.label"
|
|
2626
|
+
class="djm-desc-item"
|
|
2627
|
+
:style="{ gridColumn: item.span ? 'span ' + item.span : undefined }"
|
|
2628
|
+
>
|
|
2629
|
+
<dt class="djm-desc-label">{{ item.label }}</dt>
|
|
2630
|
+
<dd class="djm-desc-value">
|
|
2631
|
+
<slot :name="slotOf(item)" :item="item">{{ item.value }}</slot>
|
|
2632
|
+
</dd>
|
|
2633
|
+
</div>
|
|
2634
|
+
</dl>
|
|
2635
|
+
`};import{reactive as Nr}from"vue";var Be=Nr([]),Rr=0;function li(e){let t=Be.findIndex(a=>a.id===e);t>-1&&Be.splice(t,1)}function At(e,t="success",a=2600){let n=++Rr;return Be.push({id:n,text:e,type:t}),a>0&&window.setTimeout(()=>li(n),a),n}function Ge(e,t="success",a){return At(e,t,a)}Ge.success=(e,t)=>At(e,"success",t);Ge.info=(e,t)=>At(e,"info",t);Ge.error=(e,t)=>At(e,"error",t);Ge.close=li;Ge.clear=()=>Be.splice(0,Be.length);var oi={name:"DjmMessageHost",components:{DjmIcon:L},setup(){return{messages:Be}},template:`
|
|
2636
|
+
<Teleport to="body">
|
|
2637
|
+
<TransitionGroup name="djm-toast" tag="div" class="djm-toast-stack" role="status" aria-live="polite">
|
|
2638
|
+
<div
|
|
2639
|
+
v-for="item in messages"
|
|
2640
|
+
:key="item.id"
|
|
2641
|
+
class="djm-toast"
|
|
2642
|
+
:class="'djm-toast-' + item.type"
|
|
2643
|
+
:role="item.type === 'error' ? 'alert' : undefined"
|
|
2644
|
+
>
|
|
2645
|
+
<DjmIcon :name="item.type === 'success' ? 'check' : 'alert'" :size="14" />
|
|
2646
|
+
<span>{{ item.text }}</span>
|
|
2647
|
+
</div>
|
|
2648
|
+
</TransitionGroup>
|
|
2649
|
+
</Teleport>
|
|
2650
|
+
`};import{computed as ke,onBeforeUnmount as Vr,ref as xe,watch as Hr}from"vue";var ri={name:"DjmOrgPicker",components:{DjmIcon:L},props:{modelValue:{type:Array,default:()=>[]},departments:{type:Array,default:()=>[]},staff:{type:Array,default:()=>[]},placeholder:{type:String,default:""},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},maxTagCount:{type:Number,default:3},showFooter:{type:Boolean,default:!0},emptyText:{type:String,default:""}},emits:["update:modelValue","change","visible-change"],setup(e,{emit:t}){let a=xe(!1),n=xe(null),i=xe(null),l=xe(""),o=xe(""),r=xe([]),s=xe(new Set),d=null;function f(P,O=[]){return P.forEach(W=>{O.push(W.id),W.children&&W.children.length&&f(W.children,O)}),O}function c(P){let O=E=>{for(let B of E){if(B.id===P)return B;if(B.children){let $=O(B.children);if($)return $}}return null},W=O(e.departments);if(!W)return new Set([P]);let ne=new Set,k=E=>E.forEach(B=>{ne.add(B.id),B.children&&k(B.children)});return k([W]),ne}let p=ke(()=>{let P=new Map;return e.staff.forEach(O=>P.set(O.id,O)),P}),g=ke(()=>e.modelValue.map(P=>p.value.get(P)).filter(Boolean)),m=ke(()=>e.maxTagCount<=0?g.value:g.value.slice(0,e.maxTagCount)),h=ke(()=>Math.max(0,g.value.length-m.value.length)),b=ke(()=>{let P=l.value.trim().toLowerCase();if(P)return e.staff.filter(W=>(W.name+" "+(W.title||"")).toLowerCase().includes(P));if(!o.value)return e.staff;let O=c(o.value);return e.staff.filter(W=>O.has(W.deptId))}),j=ke(()=>{let P=[],O=(W,ne)=>{W.forEach(k=>{let E=Array.isArray(k.children)&&k.children.length>0;P.push({node:k,depth:ne,hasChildren:E}),E&&s.value.has(k.id)&&O(k.children,ne+1)})};return O(e.departments,0),P}),w=ke(()=>r.value.length),y=ke(()=>e.placeholder||C("orgPicker.placeholder")),u=ke(()=>e.emptyText||C("orgPicker.empty")),v=xe(null),T=xe({...Z}),D=342;function x(){if(!a.value||!n.value)return;let P=n.value.getBoundingClientRect(),O=Math.min(520,window.innerWidth-16);T.value=de({rect:P,flip:se(P,D),width:O,clampWidth:O})}function z(){s.value=new Set(f(e.departments))}z(),Hr(()=>e.departments,()=>{s.value=new Set([...s.value,...f(e.departments)])});function S(P){return(P.name||"").slice(0,1)}function M(P){return r.value.includes(P)}function I(P){r.value.includes(P.id)?r.value=r.value.filter(O=>O!==P.id):r.value=[...r.value,P.id],e.showFooter||R()}function A(P){o.value=P,l.value=""}function V(P){let O=new Set(s.value);O.has(P.id)?O.delete(P.id):O.add(P.id),s.value=O}function H(){let P=b.value.find(O=>!r.value.includes(O.id));P&&I(P)}function Y(){e.disabled||a.value||(r.value=[...e.modelValue],l.value="",o.value="",a.value=!0,t("visible-change",!0),d=G({root:()=>n.value,panel:()=>v.value,onClose:X,onReposition:x}),requestAnimationFrame(()=>{x(),i.value&&i.value.focus()}))}function X(){a.value&&(a.value=!1,T.value={...Z},t("visible-change",!1),d&&(d(),d=null))}function R(){let P=[...r.value];t("update:modelValue",P),t("change",P),e.showFooter&&X()}function F(){r.value=[...e.modelValue],X()}function U(){e.disabled||(a.value?F():Y())}function te(P){let O=e.modelValue.filter(W=>W!==P);t("update:modelValue",O),t("change",O),r.value=r.value.filter(W=>W!==P)}function Q(){e.disabled||(t("update:modelValue",[]),t("change",[]),r.value=[])}function le(){r.value=[]}return Vr(()=>{d&&(d(),d=null)}),{open:a,root:n,panel:v,panelStyle:T,searchRef:i,keyword:l,activeDept:o,temp:r,expandedIds:s,appliedStaff:g,visibleTags:m,restTagCount:h,visibleStaff:b,deptRows:j,selectedCount:w,placeholderText:y,emptyLabel:u,initialOf:S,isSelected:M,toggleStaff:I,pickDept:A,toggleExpand:V,onSearchEnter:H,openPanel:Y,closePanel:X,commit:R,cancel:F,toggle:U,removeTag:te,clearAll:Q,clearTemp:le,t:C}},template:`
|
|
2651
|
+
<div class="djm-org-picker" ref="root" :class="{ 'djm-is-open': open, 'djm-is-disabled': disabled }">
|
|
2652
|
+
<div
|
|
2653
|
+
class="djm-input djm-org-trigger"
|
|
2654
|
+
role="combobox"
|
|
2655
|
+
:tabindex="disabled ? -1 : 0"
|
|
2656
|
+
:aria-expanded="String(open)"
|
|
2657
|
+
:aria-disabled="String(disabled)"
|
|
2658
|
+
:aria-label="appliedStaff.length ? appliedStaff.map((item) => item.name).join('\u3001') : placeholderText"
|
|
2659
|
+
aria-haspopup="dialog"
|
|
2660
|
+
@click="toggle"
|
|
2661
|
+
@keydown.enter.prevent="toggle"
|
|
2662
|
+
@keydown.space.prevent="toggle"
|
|
2663
|
+
>
|
|
2664
|
+
<span v-if="visibleTags.length" class="djm-org-tags">
|
|
2665
|
+
<span v-for="item in visibleTags" :key="item.id" class="djm-org-tag">
|
|
2666
|
+
{{ item.name }}
|
|
2667
|
+
<button
|
|
2668
|
+
v-if="!disabled"
|
|
2669
|
+
class="djm-org-tag-close"
|
|
2670
|
+
type="button"
|
|
2671
|
+
:aria-label="'\u79FB\u9664 ' + item.name"
|
|
2672
|
+
@click.stop="removeTag(item.id)"
|
|
2673
|
+
>\xD7</button>
|
|
2674
|
+
</span>
|
|
2675
|
+
<span v-if="restTagCount" class="djm-org-tag djm-org-tag-more">+{{ restTagCount }}</span>
|
|
2676
|
+
</span>
|
|
2677
|
+
<span v-else class="djm-org-placeholder">{{ placeholderText }}</span>
|
|
2678
|
+
<span class="djm-org-suffix">
|
|
2679
|
+
<DjmIcon name="users" :size="13" class="djm-org-icon" />
|
|
2680
|
+
<button
|
|
2681
|
+
v-if="clearable && appliedStaff.length && !disabled"
|
|
2682
|
+
class="djm-org-clear"
|
|
2683
|
+
type="button"
|
|
2684
|
+
:aria-label="t('orgPicker.clear')"
|
|
2685
|
+
@click.stop="clearAll"
|
|
2686
|
+
>\xD7</button>
|
|
2687
|
+
</span>
|
|
2688
|
+
</div>
|
|
2689
|
+
|
|
2690
|
+
<Teleport to="body">
|
|
2691
|
+
<div
|
|
2692
|
+
v-if="open"
|
|
2693
|
+
ref="panel"
|
|
2694
|
+
class="djm-org-panel"
|
|
2695
|
+
:style="panelStyle"
|
|
2696
|
+
role="dialog"
|
|
2697
|
+
:aria-label="t('orgPicker.title')"
|
|
2698
|
+
>
|
|
2699
|
+
<div class="djm-org-search">
|
|
2700
|
+
<DjmIcon name="search" :size="13" />
|
|
2701
|
+
<input
|
|
2702
|
+
ref="searchRef"
|
|
2703
|
+
v-model="keyword"
|
|
2704
|
+
class="djm-org-search-input"
|
|
2705
|
+
type="text"
|
|
2706
|
+
autocomplete="off"
|
|
2707
|
+
:placeholder="t('orgPicker.search')"
|
|
2708
|
+
:aria-label="t('orgPicker.search')"
|
|
2709
|
+
@keydown.enter.prevent="onSearchEnter"
|
|
2710
|
+
/>
|
|
2711
|
+
</div>
|
|
2712
|
+
|
|
2713
|
+
<div class="djm-org-body">
|
|
2714
|
+
<div class="djm-org-depts" :aria-label="t('orgPicker.deptTree')">
|
|
2715
|
+
<button
|
|
2716
|
+
class="djm-org-dept"
|
|
2717
|
+
:class="{ 'djm-is-active': !activeDept }"
|
|
2718
|
+
type="button"
|
|
2719
|
+
@click="pickDept('')"
|
|
2720
|
+
>{{ t('orgPicker.allStaff') }}</button>
|
|
2721
|
+
<div v-for="row in deptRows" :key="row.node.id" class="djm-org-dept-row">
|
|
2722
|
+
<button
|
|
2723
|
+
class="djm-org-dept-toggle"
|
|
2724
|
+
type="button"
|
|
2725
|
+
:aria-label="row.hasChildren ? t('orgPicker.expand') : ''"
|
|
2726
|
+
:tabindex="row.hasChildren ? 0 : -1"
|
|
2727
|
+
@click.stop="row.hasChildren && toggleExpand(row.node)"
|
|
2728
|
+
>
|
|
2729
|
+
<DjmIcon
|
|
2730
|
+
v-if="row.hasChildren"
|
|
2731
|
+
name="chevron-right"
|
|
2732
|
+
:size="11"
|
|
2733
|
+
class="djm-org-dept-arrow"
|
|
2734
|
+
:class="{ 'djm-is-expanded': expandedIds.has(row.node.id) }"
|
|
2735
|
+
/>
|
|
2736
|
+
</button>
|
|
2737
|
+
<button
|
|
2738
|
+
class="djm-org-dept-name"
|
|
2739
|
+
:class="{ 'djm-is-active': activeDept === row.node.id }"
|
|
2740
|
+
type="button"
|
|
2741
|
+
:aria-pressed="String(activeDept === row.node.id)"
|
|
2742
|
+
:style="{ paddingLeft: 4 + row.depth * 14 + 'px' }"
|
|
2743
|
+
@click="pickDept(row.node.id)"
|
|
2744
|
+
>{{ row.node.label }}</button>
|
|
2745
|
+
</div>
|
|
2746
|
+
</div>
|
|
2747
|
+
|
|
2748
|
+
<div class="djm-org-staff" role="listbox" aria-multiselectable="true">
|
|
2749
|
+
<div
|
|
2750
|
+
v-for="item in visibleStaff"
|
|
2751
|
+
:key="item.id"
|
|
2752
|
+
class="djm-org-staff-item"
|
|
2753
|
+
:class="{ 'djm-is-selected': isSelected(item.id) }"
|
|
2754
|
+
role="option"
|
|
2755
|
+
tabindex="0"
|
|
2756
|
+
:aria-selected="String(isSelected(item.id))"
|
|
2757
|
+
@click="toggleStaff(item)"
|
|
2758
|
+
@keydown.enter.prevent="toggleStaff(item)"
|
|
2759
|
+
@keydown.space.prevent="toggleStaff(item)"
|
|
2760
|
+
>
|
|
2761
|
+
<span class="djm-org-avatar">
|
|
2762
|
+
<img v-if="item.avatar" :src="item.avatar" :alt="item.name" />
|
|
2763
|
+
<span v-else>{{ initialOf(item) }}</span>
|
|
2764
|
+
</span>
|
|
2765
|
+
<span class="djm-org-staff-main">
|
|
2766
|
+
<span class="djm-org-staff-name">{{ item.name }}</span>
|
|
2767
|
+
<em v-if="item.title" class="djm-org-staff-title">{{ item.title }}</em>
|
|
2768
|
+
</span>
|
|
2769
|
+
<DjmIcon v-if="isSelected(item.id)" name="check" :size="13" class="djm-org-check" />
|
|
2770
|
+
</div>
|
|
2771
|
+
<div v-if="!visibleStaff.length" class="djm-org-empty">{{ emptyLabel }}</div>
|
|
2772
|
+
</div>
|
|
2773
|
+
</div>
|
|
2774
|
+
|
|
2775
|
+
<div class="djm-org-foot">
|
|
2776
|
+
<span class="djm-org-count">{{ t('orgPicker.selected', { count: selectedCount }) }}</span>
|
|
2777
|
+
<div class="djm-org-actions">
|
|
2778
|
+
<button class="djm-btn djm-btn-sm" type="button" @click="clearTemp">{{ t('orgPicker.clearSelected') }}</button>
|
|
2779
|
+
<button class="djm-btn djm-btn-sm" type="button" @click="cancel">{{ t('common.cancel') }}</button>
|
|
2780
|
+
<button
|
|
2781
|
+
v-if="showFooter"
|
|
2782
|
+
class="djm-btn djm-btn-sm djm-btn-primary"
|
|
2783
|
+
type="button"
|
|
2784
|
+
@click="commit"
|
|
2785
|
+
>{{ t('common.confirm') }}</button>
|
|
2786
|
+
</div>
|
|
2787
|
+
</div>
|
|
2788
|
+
</div>
|
|
2789
|
+
</Teleport>
|
|
2790
|
+
</div>
|
|
2791
|
+
`};import{computed as si,reactive as Or,ref as $r,watch as ra}from"vue";var Fr={input:pe,number:Fe,select:Te,radio:lt,checkbox:it,switch:Oe,date:we,time:ft,cascader:Ke,treeSelect:qe,rate:ut,slider:mt,color:pt},di={name:"DjmSchemaForm",components:{DjmForm:ot,DjmFormItem:rt,DjmRow:xt,DjmCol:St},props:{modelValue:{type:Object,default:()=>({})},fields:{type:Array,default:()=>[]},rules:{type:Object,default:()=>({})},labelWidth:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},gap:{type:[Number,String],default:12}},emits:["update:modelValue","change"],setup(e,{emit:t}){let a=$r(null),n=Or({...e.modelValue});ra(()=>e.fields,m=>{m.forEach(h=>{n[h.key]===void 0&&h.default!==void 0&&(n[h.key]=typeof h.default=="function"?h.default():h.default)})},{immediate:!0,deep:!0}),ra(()=>e.modelValue,m=>{m&&Object.keys(m).forEach(h=>{n[h]!==m[h]&&(n[h]=m[h])})},{deep:!0}),ra(n,()=>{t("update:modelValue",{...n}),t("change",{...n})},{deep:!0});let i=si(()=>{let m={...e.rules};return e.fields.forEach(h=>{if(!h.required&&!h.rules)return;let b=[...m[h.key]||[]];h.required&&!b.some(j=>j.required)&&b.unshift({required:!0,message:h.requiredMessage||(h.label||h.key)+" \u4E3A\u5FC5\u586B\u9879"}),h.rules&&b.push(...h.rules),m[h.key]=b}),m}),l=si(()=>e.fields.filter(m=>typeof m.visibleWhen!="function"?!0:!!m.visibleWhen(n)));function o(m){return Fr[m.type]||pe}function r(m){let h={...m.props||{}};return{...h,options:m.options!==void 0?m.options:h.options,placeholder:m.placeholder!==void 0?m.placeholder:h.placeholder,disabled:e.disabled||!!m.disabled}}function s(m,h){n[m]=h}function d(){return{...n}}function f(){return a.value?a.value.validate():Promise.resolve(!0)}function c(m){return a.value?a.value.validateField(m):Promise.resolve(!0)}function p(){a.value&&a.value.clearValidate()}function g(){a.value&&a.value.resetFields()}return{innerForm:a,model:n,formRules:i,visibleFields:l,controlOf:o,controlProps:r,setValue:s,getModel:d,validate:f,validateField:c,clearValidate:p,resetFields:g}},template:`
|
|
2792
|
+
<DjmForm ref="innerForm" :model="model" :rules="formRules" :label-width="labelWidth">
|
|
2793
|
+
<DjmRow :gap="gap">
|
|
2794
|
+
<DjmCol v-for="field in visibleFields" :key="field.key" :span="field.span || 12">
|
|
2795
|
+
<DjmFormItem
|
|
2796
|
+
:label="field.label"
|
|
2797
|
+
:prop="field.key"
|
|
2798
|
+
:required="Boolean(field.required)"
|
|
2799
|
+
:hint="field.hint"
|
|
2800
|
+
:tag="(field.type === 'radio' || field.type === 'checkbox') ? 'div' : 'label'"
|
|
2801
|
+
>
|
|
2802
|
+
<slot
|
|
2803
|
+
v-if="field.type === 'custom'"
|
|
2804
|
+
:name="'field-' + field.key"
|
|
2805
|
+
:field="field"
|
|
2806
|
+
:model="model"
|
|
2807
|
+
:value="model[field.key]"
|
|
2808
|
+
:set-value="setValue"
|
|
2809
|
+
>
|
|
2810
|
+
<span class="djm-schema-empty">\u672A\u63D0\u4F9B\u81EA\u5B9A\u4E49\u63D2\u69FD</span>
|
|
2811
|
+
</slot>
|
|
2812
|
+
|
|
2813
|
+
<textarea
|
|
2814
|
+
v-else-if="field.type === 'textarea'"
|
|
2815
|
+
class="djm-input djm-schema-textarea"
|
|
2816
|
+
:rows="field.rows || 3"
|
|
2817
|
+
:value="model[field.key]"
|
|
2818
|
+
v-bind="controlProps(field)"
|
|
2819
|
+
@input="setValue(field.key, $event.target.value)"
|
|
2820
|
+
></textarea>
|
|
2821
|
+
|
|
2822
|
+
<input
|
|
2823
|
+
v-else-if="field.type === 'password'"
|
|
2824
|
+
class="djm-input"
|
|
2825
|
+
type="password"
|
|
2826
|
+
autocomplete="new-password"
|
|
2827
|
+
:value="model[field.key]"
|
|
2828
|
+
v-bind="controlProps(field)"
|
|
2829
|
+
@input="setValue(field.key, $event.target.value)"
|
|
2830
|
+
/>
|
|
2831
|
+
|
|
2832
|
+
<span v-else-if="field.type === 'static'" class="djm-schema-static">
|
|
2833
|
+
{{ model[field.key] === undefined || model[field.key] === '' ? '\u2014' : model[field.key] }}
|
|
2834
|
+
</span>
|
|
2835
|
+
|
|
2836
|
+
<component
|
|
2837
|
+
v-else
|
|
2838
|
+
:is="controlOf(field)"
|
|
2839
|
+
v-model="model[field.key]"
|
|
2840
|
+
v-bind="controlProps(field)"
|
|
2841
|
+
/>
|
|
2842
|
+
</DjmFormItem>
|
|
2843
|
+
</DjmCol>
|
|
2844
|
+
</DjmRow>
|
|
2845
|
+
</DjmForm>
|
|
2846
|
+
`};var ci={name:"DjmApprovalFlow",components:{DjmIcon:L},props:{nodes:{type:Array,default:()=>[]},compact:{type:Boolean,default:!1}},emits:["node-click"],computed:{list(){return this.nodes.map((e,t)=>({...e,index:t}))}},methods:{statusText(e){return C("approval."+(e||"waiting"))},iconOf(e){return e.status==="approved"?"check":e.status==="rejected"?"x":e.status==="pending"?"clock":""},initialOf(e){return(e.name||"").slice(0,1)},t:C},template:`
|
|
2847
|
+
<div class="djm-approval" :class="{ 'djm-is-compact': compact }">
|
|
2848
|
+
<div
|
|
2849
|
+
v-for="node in list"
|
|
2850
|
+
:key="node.index"
|
|
2851
|
+
class="djm-approval-node"
|
|
2852
|
+
:class="'djm-is-' + (node.status || 'waiting')"
|
|
2853
|
+
@click="$emit('node-click', node)"
|
|
2854
|
+
>
|
|
2855
|
+
<div class="djm-approval-axis">
|
|
2856
|
+
<span class="djm-approval-dot">
|
|
2857
|
+
<DjmIcon v-if="iconOf(node)" :name="iconOf(node)" :size="11" />
|
|
2858
|
+
</span>
|
|
2859
|
+
<span v-if="node.index < list.length - 1" class="djm-approval-line"></span>
|
|
2860
|
+
</div>
|
|
2861
|
+
|
|
2862
|
+
<div class="djm-approval-main">
|
|
2863
|
+
<div class="djm-approval-head">
|
|
2864
|
+
<span class="djm-approval-title">{{ node.title }}</span>
|
|
2865
|
+
<span v-if="node.type === 'start'" class="djm-approval-type">{{ t('approval.start') }}</span>
|
|
2866
|
+
<span v-else-if="node.type === 'cc'" class="djm-approval-type">{{ t('approval.cc') }}</span>
|
|
2867
|
+
<span class="djm-approval-status">{{ statusText(node.status) }}</span>
|
|
2868
|
+
<span v-if="node.time" class="djm-approval-time">{{ node.time }}</span>
|
|
2869
|
+
</div>
|
|
2870
|
+
|
|
2871
|
+
<div v-if="node.approvers && node.approvers.length" class="djm-approval-people">
|
|
2872
|
+
<span v-for="person in node.approvers" :key="person.name" class="djm-approval-person">
|
|
2873
|
+
<span class="djm-approval-avatar">
|
|
2874
|
+
<img v-if="person.avatar" :src="person.avatar" :alt="person.name" />
|
|
2875
|
+
<span v-else>{{ initialOf(person) }}</span>
|
|
2876
|
+
</span>
|
|
2877
|
+
<span class="djm-approval-name">{{ person.name }}</span>
|
|
2878
|
+
<em v-if="person.title" class="djm-approval-role">{{ person.title }}</em>
|
|
2879
|
+
<span
|
|
2880
|
+
v-if="person.status"
|
|
2881
|
+
class="djm-approval-person-status"
|
|
2882
|
+
:class="'djm-is-' + person.status"
|
|
2883
|
+
>{{ statusText(person.status) }}</span>
|
|
2884
|
+
</span>
|
|
2885
|
+
</div>
|
|
2886
|
+
|
|
2887
|
+
<div v-if="node.comment" class="djm-approval-comment">{{ node.comment }}</div>
|
|
2888
|
+
|
|
2889
|
+
<slot name="node-extra" :node="node" :index="node.index"></slot>
|
|
2890
|
+
</div>
|
|
2891
|
+
</div>
|
|
2892
|
+
|
|
2893
|
+
<div v-if="!nodes.length" class="djm-approval-empty">{{ t('approval.empty') }}</div>
|
|
2894
|
+
</div>
|
|
2895
|
+
`};import{computed as ui,reactive as Kr,ref as Wr,watch as sa}from"vue";var Ur={input:pe,number:Fe,select:Te,date:we,dateRange:we,cascader:Ke,treeSelect:qe},mi={name:"DjmQueryFilter",components:{DjmIcon:L},props:{modelValue:{type:Object,default:()=>({})},fields:{type:Array,default:()=>[]},visibleCount:{type:Number,default:3},showActions:{type:Boolean,default:!0},searchText:{type:String,default:""},resetText:{type:String,default:""}},emits:["update:modelValue","search","reset"],setup(e,{emit:t}){let a=Wr(!1),n=Kr({...e.modelValue});sa(()=>e.fields,p=>{p.forEach(g=>{n[g.key]===void 0&&g.default!==void 0&&(n[g.key]=typeof g.default=="function"?g.default():g.default)})},{immediate:!0,deep:!0}),sa(()=>e.modelValue,p=>{p&&Object.keys(p).forEach(g=>{n[g]!==p[g]&&(n[g]=p[g])})},{deep:!0}),sa(n,()=>{t("update:modelValue",{...n})},{deep:!0});let i=ui(()=>e.fields.length>e.visibleCount),l=ui(()=>!i.value||a.value?e.fields:e.fields.slice(0,e.visibleCount));function o(p){return Ur[p.type]||pe}function r(p){let g={...p.props||{}};return p.type==="dateRange"&&(g.range=!0,g.panels=1),{...g,options:p.options!==void 0?p.options:g.options,placeholder:p.placeholder!==void 0?p.placeholder:g.placeholder}}function s(p,g){n[p]=g}function d(){t("search",{...n})}function f(p){let g=p.target&&p.target.tagName;g!=="INPUT"&&g!=="TEXTAREA"||p.target.closest(".djm-select-panel, .djm-date-picker-panel, .djm-cascader-panel, .djm-tree-select-panel")||d()}function c(){e.fields.forEach(p=>{n[p.key]=p.default!==void 0?typeof p.default=="function"?p.default():p.default:p.type==="dateRange"?[]:""}),t("reset"),t("search",{...n})}return{expanded:a,model:n,collapsible:i,visibleFields:l,controlOf:o,controlProps:r,setValue:s,search:d,reset:c,onEnter:f,t:C}},template:`
|
|
2896
|
+
<div class="djm-query-filter" @keydown.enter="onEnter">
|
|
2897
|
+
<div class="djm-query-fields">
|
|
2898
|
+
<div v-for="field in visibleFields" :key="field.key" class="djm-query-field">
|
|
2899
|
+
<label class="djm-query-label" :for="'djm-query-' + field.key">{{ field.label }}</label>
|
|
2900
|
+
<div class="djm-query-control">
|
|
2901
|
+
<slot
|
|
2902
|
+
v-if="field.type === 'custom'"
|
|
2903
|
+
:name="'field-' + field.key"
|
|
2904
|
+
:field="field"
|
|
2905
|
+
:model="model"
|
|
2906
|
+
:value="model[field.key]"
|
|
2907
|
+
:set-value="setValue"
|
|
2908
|
+
></slot>
|
|
2909
|
+
<component
|
|
2910
|
+
v-else
|
|
2911
|
+
:is="controlOf(field)"
|
|
2912
|
+
:id="'djm-query-' + field.key"
|
|
2913
|
+
v-model="model[field.key]"
|
|
2914
|
+
v-bind="controlProps(field)"
|
|
2915
|
+
/>
|
|
2916
|
+
</div>
|
|
2917
|
+
</div>
|
|
2918
|
+
</div>
|
|
2919
|
+
|
|
2920
|
+
<div class="djm-query-actions">
|
|
2921
|
+
<button v-if="showActions" class="djm-btn djm-btn-primary" type="button" @click="search">
|
|
2922
|
+
{{ searchText || t('queryFilter.search') }}
|
|
2923
|
+
</button>
|
|
2924
|
+
<button v-if="showActions" class="djm-btn" type="button" @click="reset">
|
|
2925
|
+
{{ resetText || t('queryFilter.reset') }}
|
|
2926
|
+
</button>
|
|
2927
|
+
<button
|
|
2928
|
+
v-if="collapsible"
|
|
2929
|
+
class="djm-query-more"
|
|
2930
|
+
type="button"
|
|
2931
|
+
:aria-expanded="String(expanded)"
|
|
2932
|
+
@click="expanded = !expanded"
|
|
2933
|
+
>
|
|
2934
|
+
{{ expanded ? t('queryFilter.collapse') : t('queryFilter.expand') }}
|
|
2935
|
+
<DjmIcon :name="expanded ? 'chevron-up' : 'chevron-down'" :size="12" />
|
|
2936
|
+
</button>
|
|
2937
|
+
</div>
|
|
2938
|
+
</div>
|
|
2939
|
+
`};var fi={name:"DjmFilterTags",props:{items:{type:Array,default:()=>[]},clearable:{type:Boolean,default:!0},clearText:{type:String,default:"\u6E05\u7A7A\u7B5B\u9009"}},emits:["remove","clear"],template:`
|
|
2940
|
+
<div v-if="items.length" class="djm-filter-tags">
|
|
2941
|
+
<span v-for="item in items" :key="item.key" class="djm-filter-tag">
|
|
2942
|
+
<span class="djm-filter-tag-label">{{ item.label }}</span>
|
|
2943
|
+
<span class="djm-filter-tag-value">{{ item.text }}</span>
|
|
2944
|
+
<button
|
|
2945
|
+
class="djm-filter-tag-close"
|
|
2946
|
+
type="button"
|
|
2947
|
+
:aria-label="'\u79FB\u9664\u7B5B\u9009 ' + item.label"
|
|
2948
|
+
@click="$emit('remove', item.key)"
|
|
2949
|
+
>\xD7</button>
|
|
2950
|
+
</span>
|
|
2951
|
+
<button v-if="clearable" class="djm-filter-clear" type="button" @click="$emit('clear')">
|
|
2952
|
+
{{ clearText }}
|
|
2953
|
+
</button>
|
|
2954
|
+
</div>
|
|
2955
|
+
`};import{computed as da,ref as Pt,watch as pi}from"vue";var hi={name:"DjmMediaPicker",components:{DjmModal:Ue,DjmPagination:Tt,DjmIcon:L},props:{modelValue:{type:[Array,String,Number],default:""},items:{type:Array,default:()=>[]},multiple:{type:Boolean,default:!1},limit:{type:Number,default:0},accept:{type:String,default:""},title:{type:String,default:""},triggerText:{type:String,default:""},pageSize:{type:Number,default:12},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){let a=Pt(!1),n=Pt(""),i=Pt(1),l=Pt([]),o=da(()=>e.multiple?Array.isArray(e.modelValue)?e.modelValue:[]:e.modelValue===""||e.modelValue===null||e.modelValue===void 0?[]:[e.modelValue]);function r(b){return b.type?b.type==="image":/\.(png|jpe?g|gif|webp|svg|avif)$/i.test(b.url||"")}let s=da(()=>{let b=n.value.trim().toLowerCase();return e.items.filter(j=>!(e.accept==="image"&&!r(j)||e.accept==="file"&&r(j)||b&&!String(j.name||"").toLowerCase().includes(b)))}),d=da(()=>{let b=(i.value-1)*e.pageSize;return s.value.slice(b,b+e.pageSize)});pi(n,()=>{i.value=1}),pi(()=>s.value.length,()=>{let b=Math.max(1,Math.ceil(s.value.length/e.pageSize));i.value>b&&(i.value=b)});function f(b){return l.value.includes(b)}function c(){return e.limit>0&&l.value.length>=e.limit}function p(b){if(e.multiple){if(f(b.id)){l.value=l.value.filter(j=>j!==b.id);return}if(c())return;l.value=[...l.value,b.id];return}l.value=[b.id]}function g(){e.disabled||(l.value=[...o.value],n.value="",i.value=1,a.value=!0)}function m(){let b=e.multiple?[...l.value]:l.value[0]!==void 0?l.value[0]:"";t("update:modelValue",b),t("change",b),a.value=!1}function h(){l.value=[...o.value],a.value=!1}return{open:a,keyword:n,page:i,temp:l,selectedIds:o,filtered:s,paged:d,isImage:r,isChecked:f,atLimit:c,toggle:p,openPanel:g,commit:m,cancel:h,t:C}},template:`
|
|
2956
|
+
<span class="djm-media-picker">
|
|
2957
|
+
<slot name="trigger" :open="openPanel" :count="selectedIds.length">
|
|
2958
|
+
<button
|
|
2959
|
+
class="djm-btn"
|
|
2960
|
+
type="button"
|
|
2961
|
+
:disabled="disabled"
|
|
2962
|
+
@click="openPanel"
|
|
2963
|
+
>{{ triggerText || t('mediaPicker.select') }}<span v-if="selectedIds.length" class="djm-media-picker-count">{{ selectedIds.length }}</span></button>
|
|
2964
|
+
</slot>
|
|
2965
|
+
|
|
2966
|
+
<DjmModal
|
|
2967
|
+
:model-value="open"
|
|
2968
|
+
:title="title || t('mediaPicker.title')"
|
|
2969
|
+
width="760px"
|
|
2970
|
+
@update:model-value="cancel"
|
|
2971
|
+
>
|
|
2972
|
+
<div class="djm-media-toolbar">
|
|
2973
|
+
<label class="djm-media-search">
|
|
2974
|
+
<DjmIcon name="search" :size="13" />
|
|
2975
|
+
<input
|
|
2976
|
+
v-model="keyword"
|
|
2977
|
+
class="djm-media-search-input"
|
|
2978
|
+
type="text"
|
|
2979
|
+
:placeholder="t('mediaPicker.search')"
|
|
2980
|
+
:aria-label="t('mediaPicker.search')"
|
|
2981
|
+
/>
|
|
2982
|
+
</label>
|
|
2983
|
+
<span class="djm-media-toolbar-slot">
|
|
2984
|
+
<slot name="toolbar"></slot>
|
|
2985
|
+
</span>
|
|
2986
|
+
</div>
|
|
2987
|
+
|
|
2988
|
+
<div class="djm-media-grid" role="listbox" :aria-multiselectable="multiple ? 'true' : 'false'">
|
|
2989
|
+
<div
|
|
2990
|
+
v-for="item in paged"
|
|
2991
|
+
:key="item.id"
|
|
2992
|
+
class="djm-media-item"
|
|
2993
|
+
:class="{
|
|
2994
|
+
'djm-is-checked': isChecked(item.id),
|
|
2995
|
+
'djm-is-disabled': multiple && atLimit() && !isChecked(item.id)
|
|
2996
|
+
}"
|
|
2997
|
+
role="option"
|
|
2998
|
+
tabindex="0"
|
|
2999
|
+
:aria-selected="String(isChecked(item.id))"
|
|
3000
|
+
@click="toggle(item)"
|
|
3001
|
+
@keydown.enter.prevent="toggle(item)"
|
|
3002
|
+
@keydown.space.prevent="toggle(item)"
|
|
3003
|
+
>
|
|
3004
|
+
<div class="djm-media-thumb">
|
|
3005
|
+
<img v-if="isImage(item)" :src="item.url" :alt="item.name" loading="lazy" />
|
|
3006
|
+
<DjmIcon v-else name="folder" :size="26" />
|
|
3007
|
+
<span v-if="isChecked(item.id)" class="djm-media-check">
|
|
3008
|
+
<DjmIcon name="check" :size="11" />
|
|
3009
|
+
</span>
|
|
3010
|
+
</div>
|
|
3011
|
+
<div class="djm-media-name" :title="item.name">{{ item.name }}</div>
|
|
3012
|
+
</div>
|
|
3013
|
+
<div v-if="!paged.length" class="djm-media-empty">{{ t('mediaPicker.empty') }}</div>
|
|
3014
|
+
</div>
|
|
3015
|
+
|
|
3016
|
+
<div class="djm-media-foot">
|
|
3017
|
+
<span class="djm-media-total">
|
|
3018
|
+
{{ t('mediaPicker.total', { total: filtered.length }) }}
|
|
3019
|
+
<em v-if="multiple && limit > 0">{{ t('mediaPicker.limit', { limit }) }}</em>
|
|
3020
|
+
</span>
|
|
3021
|
+
<DjmPagination
|
|
3022
|
+
v-if="filtered.length > pageSize"
|
|
3023
|
+
v-model:page="page"
|
|
3024
|
+
:page-size="pageSize"
|
|
3025
|
+
:total="filtered.length"
|
|
3026
|
+
/>
|
|
3027
|
+
</div>
|
|
3028
|
+
|
|
3029
|
+
<template #footer>
|
|
3030
|
+
<button class="djm-btn" type="button" @click="cancel">{{ t('common.cancel') }}</button>
|
|
3031
|
+
<button class="djm-btn djm-btn-primary" type="button" @click="commit">{{ t('common.confirm') }}</button>
|
|
3032
|
+
</template>
|
|
3033
|
+
</DjmModal>
|
|
3034
|
+
</span>
|
|
3035
|
+
`};import{ref as ca,watch as qr}from"vue";function vi(e){return(e||[]).map(t=>({...t,cards:(t.cards||[]).slice()}))}var gi={name:"DjmKanban",components:{DjmIcon:L,DjmAvatar:me},props:{columns:{type:Array,default:()=>[]},draggable:{type:Boolean,default:!0},showAddCard:{type:Boolean,default:!0},addCardText:{type:String,default:""}},emits:["update:columns","change","card-move","card-click","card-add"],setup(e,{emit:t}){let a=ca(vi(e.columns));qr(()=>e.columns,j=>{a.value=vi(j)});let n=ca(null),i=ca(null);function l(j){return a.value.find(w=>w.key===j)}function o(j,w,y){e.draggable&&(n.value={card:j,fromKey:w},y.dataTransfer&&(y.dataTransfer.effectAllowed="move",y.dataTransfer.setData("text/plain",String(j.id))))}function r(j,w,y){n.value&&(y.preventDefault(),y.stopPropagation(),y.dataTransfer&&(y.dataTransfer.dropEffect="move"),i.value={columnKey:j,index:w})}function s(j,w){if(!n.value)return;w.preventDefault(),w.dataTransfer&&(w.dataTransfer.dropEffect="move");let y=l(j);i.value={columnKey:j,index:y?y.cards.length:0}}function d(j){if(!n.value||!i.value)return;j.preventDefault();let{card:w,fromKey:y}=n.value,{columnKey:u,index:v}=i.value,T=l(y),D=l(u);if(!T||!D){f();return}let x=T.cards.findIndex(M=>M===w||M.id===w.id);if(x===-1){f();return}let z=v;y===u&&x<v&&(z=v-1),T.cards.splice(x,1),D.cards.splice(z,0,w);let S=a.value.slice();t("update:columns",S),t("change",S),t("card-move",{card:w,fromKey:y,toKey:u,toIndex:z}),f()}function f(){n.value=null,i.value=null}function c(j,w){let y=i.value;return!!(y&&y.columnKey===j&&y.index===w)}function p(j){let w=i.value;return!!(w&&w.columnKey===j.key&&w.index===j.cards.length)}function g(j){return!!(n.value&&n.value.card===j)}function m(j){return j.wipLimit>0&&j.cards.length>j.wipLimit}function h(j,w){t("card-click",j,w)}function b(j){t("card-add",j)}return{inner:a,dragCard:n,dropTarget:i,onDragStart:o,onCardDragOver:r,onColumnDragOver:s,onDrop:d,resetDrag:f,isDropBefore:c,isDropEnd:p,isDragging:g,wipOver:m,onCardClick:h,onCardAdd:b,t:C}},template:`
|
|
3036
|
+
<div class="djm-kanban" role="list" :aria-label="t('kanban.board')">
|
|
3037
|
+
<section
|
|
3038
|
+
v-for="column in inner"
|
|
3039
|
+
:key="column.key"
|
|
3040
|
+
class="djm-kanban-col"
|
|
3041
|
+
role="listitem"
|
|
3042
|
+
@dragover="onColumnDragOver(column.key, $event)"
|
|
3043
|
+
@drop="onDrop"
|
|
3044
|
+
>
|
|
3045
|
+
<header class="djm-kanban-col-head">
|
|
3046
|
+
<slot name="column-header" :column="column">
|
|
3047
|
+
<span class="djm-kanban-col-title">{{ column.title }}</span>
|
|
3048
|
+
<span class="djm-kanban-col-count" :class="{ 'djm-is-over': wipOver(column) }">
|
|
3049
|
+
{{ column.cards.length }}<template v-if="column.wipLimit > 0">/{{ column.wipLimit }}</template>
|
|
3050
|
+
</span>
|
|
3051
|
+
</slot>
|
|
3052
|
+
</header>
|
|
3053
|
+
|
|
3054
|
+
<div class="djm-kanban-col-body" :class="{ 'djm-is-drop-end': isDropEnd(column) }">
|
|
3055
|
+
<template v-for="(card, index) in column.cards" :key="card.id">
|
|
3056
|
+
<div v-if="isDropBefore(column.key, index)" class="djm-kanban-drop-line"></div>
|
|
3057
|
+
<article
|
|
3058
|
+
class="djm-kanban-card"
|
|
3059
|
+
:class="{ 'djm-is-dragging': isDragging(card) }"
|
|
3060
|
+
:draggable="draggable ? 'true' : 'false'"
|
|
3061
|
+
tabindex="0"
|
|
3062
|
+
role="button"
|
|
3063
|
+
@dragstart="onDragStart(card, column.key, $event)"
|
|
3064
|
+
@dragover="onCardDragOver(column.key, index, $event)"
|
|
3065
|
+
@drop="onDrop"
|
|
3066
|
+
@dragend="resetDrag"
|
|
3067
|
+
@click="onCardClick(card, column)"
|
|
3068
|
+
@keydown.enter.prevent="onCardClick(card, column)"
|
|
3069
|
+
@keydown.space.prevent="onCardClick(card, column)"
|
|
3070
|
+
>
|
|
3071
|
+
<slot name="card" :card="card" :column="column">
|
|
3072
|
+
<strong class="djm-kanban-card-title">{{ card.title }}</strong>
|
|
3073
|
+
<p v-if="card.desc" class="djm-kanban-card-desc">{{ card.desc }}</p>
|
|
3074
|
+
<div v-if="(card.tags && card.tags.length) || card.assignee" class="djm-kanban-card-foot">
|
|
3075
|
+
<span v-if="card.tags && card.tags.length" class="djm-kanban-card-tags">
|
|
3076
|
+
<span v-for="tag in card.tags" :key="tag" class="djm-kanban-tag">{{ tag }}</span>
|
|
3077
|
+
</span>
|
|
3078
|
+
<span v-if="card.assignee" class="djm-kanban-card-user">
|
|
3079
|
+
<DjmAvatar :src="card.avatar || ''" :text="card.assignee" size="sm" />
|
|
3080
|
+
<span>{{ card.assignee }}</span>
|
|
3081
|
+
</span>
|
|
3082
|
+
</div>
|
|
3083
|
+
</slot>
|
|
3084
|
+
</article>
|
|
3085
|
+
</template>
|
|
3086
|
+
|
|
3087
|
+
<div v-if="!column.cards.length" class="djm-kanban-empty">{{ t('kanban.empty') }}</div>
|
|
3088
|
+
<div v-if="isDropEnd(column)" class="djm-kanban-drop-line"></div>
|
|
3089
|
+
</div>
|
|
3090
|
+
|
|
3091
|
+
<footer v-if="showAddCard" class="djm-kanban-col-foot">
|
|
3092
|
+
<slot name="column-footer" :column="column">
|
|
3093
|
+
<button class="djm-kanban-add" type="button" @click="onCardAdd(column)">
|
|
3094
|
+
<DjmIcon name="plus" :size="14" />{{ addCardText || t('kanban.addCard') }}
|
|
3095
|
+
</button>
|
|
3096
|
+
</slot>
|
|
3097
|
+
</footer>
|
|
3098
|
+
</section>
|
|
3099
|
+
</div>
|
|
3100
|
+
`};import{computed as yi}from"vue";var _r=["png","jpg","jpeg","gif","webp","bmp","svg"];function Yr(e){if(e.ext)return String(e.ext).toLowerCase();let t=e.name||"",a=t.lastIndexOf(".");return a===-1?"":t.slice(a+1).toLowerCase()}var bi={name:"DjmAttachmentList",components:{DjmIcon:L},props:{files:{type:Array,default:()=>[]},mode:{type:String,default:"list"},removable:{type:Boolean,default:!0},downloadable:{type:Boolean,default:!0},previewable:{type:Boolean,default:!0},autoDownload:{type:Boolean,default:!0},emptyText:{type:String,default:""}},emits:["preview","download","remove"],setup(e,{emit:t}){let a=yi(()=>e.files.map((r,s)=>{let d=Yr(r),f=r.type==="image"||_r.includes(d);return{...r,_key:r.uid!==void 0?r.uid:s,_ext:d,_isImage:f}})),n=yi(()=>e.emptyText||C("attachment.empty"));function i(r){t("preview",r)}function l(r){if(t("download",r),e.autoDownload&&r.url){let s=document.createElement("a");s.href=r.url,s.download=r.name||"",s.rel="noopener",document.body.appendChild(s),s.click(),s.remove()}}function o(r){t("remove",r)}return{list:a,emptyLabel:n,onPreview:i,onDownload:l,onRemove:o,formatFileSize:Ye,t:C}},template:`
|
|
3101
|
+
<div class="djm-attachment" :class="'djm-attachment-' + mode">
|
|
3102
|
+
<p v-if="!list.length" class="djm-attachment-empty">{{ emptyLabel }}</p>
|
|
3103
|
+
|
|
3104
|
+
<ul v-else-if="mode === 'list'" class="djm-attachment-list">
|
|
3105
|
+
<li v-for="file in list" :key="file._key" class="djm-attachment-item">
|
|
3106
|
+
<span class="djm-attachment-thumb" :class="{ 'djm-is-image': file._isImage && file.url }">
|
|
3107
|
+
<img v-if="file._isImage && file.url" :src="file.url" :alt="file.name" />
|
|
3108
|
+
<DjmIcon v-else name="file" :size="18" />
|
|
3109
|
+
</span>
|
|
3110
|
+
|
|
3111
|
+
<div class="djm-attachment-main">
|
|
3112
|
+
<strong class="djm-attachment-name" :title="file.name">{{ file.name }}</strong>
|
|
3113
|
+
<span class="djm-attachment-meta">
|
|
3114
|
+
{{ formatFileSize(file.size) }}<template v-if="file.uploader"> \xB7 {{ file.uploader }}</template><template v-if="file.time"> \xB7 {{ file.time }}</template>
|
|
3115
|
+
</span>
|
|
3116
|
+
</div>
|
|
3117
|
+
|
|
3118
|
+
<div class="djm-attachment-actions">
|
|
3119
|
+
<slot name="actions" :file="file">
|
|
3120
|
+
<button
|
|
3121
|
+
v-if="previewable && file._isImage"
|
|
3122
|
+
class="djm-link-btn"
|
|
3123
|
+
type="button"
|
|
3124
|
+
@click="onPreview(file)"
|
|
3125
|
+
>{{ t('attachment.preview') }}</button>
|
|
3126
|
+
<button
|
|
3127
|
+
v-if="downloadable"
|
|
3128
|
+
class="djm-link-btn"
|
|
3129
|
+
type="button"
|
|
3130
|
+
@click="onDownload(file)"
|
|
3131
|
+
>{{ t('attachment.download') }}</button>
|
|
3132
|
+
<button
|
|
3133
|
+
v-if="removable"
|
|
3134
|
+
class="djm-link-btn djm-danger"
|
|
3135
|
+
type="button"
|
|
3136
|
+
@click="onRemove(file)"
|
|
3137
|
+
>{{ t('attachment.remove') }}</button>
|
|
3138
|
+
</slot>
|
|
3139
|
+
</div>
|
|
3140
|
+
</li>
|
|
3141
|
+
</ul>
|
|
3142
|
+
|
|
3143
|
+
<div v-else class="djm-attachment-grid">
|
|
3144
|
+
<figure v-for="file in list" :key="file._key" class="djm-attachment-cell">
|
|
3145
|
+
<span class="djm-attachment-cell-thumb" :class="{ 'djm-is-image': file._isImage && file.url }">
|
|
3146
|
+
<img v-if="file._isImage && file.url" :src="file.url" :alt="file.name" />
|
|
3147
|
+
<DjmIcon v-else name="file" :size="24" />
|
|
3148
|
+
</span>
|
|
3149
|
+
<figcaption :title="file.name">{{ file.name }}</figcaption>
|
|
3150
|
+
<span class="djm-attachment-cell-mask">
|
|
3151
|
+
<button
|
|
3152
|
+
v-if="previewable && file._isImage"
|
|
3153
|
+
type="button"
|
|
3154
|
+
:aria-label="t('attachment.preview')"
|
|
3155
|
+
@click="onPreview(file)"
|
|
3156
|
+
><DjmIcon name="eye" :size="14" /></button>
|
|
3157
|
+
<button
|
|
3158
|
+
v-if="downloadable"
|
|
3159
|
+
type="button"
|
|
3160
|
+
:aria-label="t('attachment.download')"
|
|
3161
|
+
@click="onDownload(file)"
|
|
3162
|
+
><DjmIcon name="download" :size="14" /></button>
|
|
3163
|
+
<button
|
|
3164
|
+
v-if="removable"
|
|
3165
|
+
type="button"
|
|
3166
|
+
:aria-label="t('attachment.remove')"
|
|
3167
|
+
@click="onRemove(file)"
|
|
3168
|
+
><DjmIcon name="trash" :size="14" /></button>
|
|
3169
|
+
</span>
|
|
3170
|
+
</figure>
|
|
3171
|
+
</div>
|
|
3172
|
+
</div>
|
|
3173
|
+
`};import{computed as wi,onBeforeUnmount as Gr,ref as Jr}from"vue";var ji={info:{icon:"info",cls:"djm-is-info"},success:{icon:"check",cls:"djm-is-success"},warning:{icon:"alert",cls:"djm-is-warning"},error:{icon:"alert",cls:"djm-is-error"}},ki={name:"DjmNotification",components:{DjmIcon:L,DjmAvatar:me},props:{items:{type:Array,default:()=>[]},showToolbar:{type:Boolean,default:!0},removable:{type:Boolean,default:!0},emptyText:{type:String,default:""}},emits:["click","read","read-all","remove","clear"],setup(e,{emit:t}){let a=wi(()=>e.items.filter(c=>!c.read).length),n=wi(()=>e.emptyText||C("notification.empty"));function i(c){return ji[c.type]||ji.info}function l(c){t("click",c),c.read||t("read",c)}function o(){t("read-all")}let r=Jr(!1),s=null;function d(){if(!r.value){r.value=!0,s=window.setTimeout(()=>{r.value=!1},3e3);return}window.clearTimeout(s),r.value=!1,t("clear")}Gr(()=>window.clearTimeout(s));function f(c){t("remove",c)}return{unreadCount:a,emptyLabel:n,clearing:r,typeOf:i,onClick:l,onReadAll:o,onClear:d,onRemove:f,t:C}},template:`
|
|
3174
|
+
<div class="djm-notification">
|
|
3175
|
+
<header v-if="showToolbar" class="djm-notification-bar">
|
|
3176
|
+
<span class="djm-notification-count">
|
|
3177
|
+
<DjmIcon name="bell" :size="14" />
|
|
3178
|
+
{{ t('notification.unread', { count: unreadCount }) }}
|
|
3179
|
+
</span>
|
|
3180
|
+
<span class="djm-notification-tools">
|
|
3181
|
+
<button class="djm-link-btn" type="button" :disabled="!unreadCount" @click="onReadAll">
|
|
3182
|
+
{{ t('notification.readAll') }}
|
|
3183
|
+
</button>
|
|
3184
|
+
<button class="djm-link-btn djm-danger" type="button" :disabled="!items.length" @click="onClear">
|
|
3185
|
+
{{ clearing ? t('notification.clearConfirm') : t('notification.clear') }}
|
|
3186
|
+
</button>
|
|
3187
|
+
</span>
|
|
3188
|
+
</header>
|
|
3189
|
+
|
|
3190
|
+
<p v-if="!items.length" class="djm-notification-empty">{{ emptyLabel }}</p>
|
|
3191
|
+
|
|
3192
|
+
<ul v-else class="djm-notification-list">
|
|
3193
|
+
<li
|
|
3194
|
+
v-for="item in items"
|
|
3195
|
+
:key="item.id"
|
|
3196
|
+
class="djm-notification-item"
|
|
3197
|
+
:class="{ 'djm-is-unread': !item.read }"
|
|
3198
|
+
tabindex="0"
|
|
3199
|
+
@click="onClick(item)"
|
|
3200
|
+
@keydown.enter="onClick(item)"
|
|
3201
|
+
>
|
|
3202
|
+
<slot name="icon" :item="item">
|
|
3203
|
+
<DjmAvatar v-if="item.avatar" :src="item.avatar" size="sm" />
|
|
3204
|
+
<span v-else class="djm-notification-badge" :class="typeOf(item).cls">
|
|
3205
|
+
<DjmIcon :name="typeOf(item).icon" :size="14" />
|
|
3206
|
+
</span>
|
|
3207
|
+
</slot>
|
|
3208
|
+
|
|
3209
|
+
<div class="djm-notification-main">
|
|
3210
|
+
<div class="djm-notification-top">
|
|
3211
|
+
<strong class="djm-notification-title">{{ item.title }}</strong>
|
|
3212
|
+
<time v-if="item.time" class="djm-notification-time">{{ item.time }}</time>
|
|
3213
|
+
</div>
|
|
3214
|
+
<p v-if="item.content" class="djm-notification-content">{{ item.content }}</p>
|
|
3215
|
+
</div>
|
|
3216
|
+
|
|
3217
|
+
<span v-if="!item.read" class="djm-notification-dot" aria-hidden="true"></span>
|
|
3218
|
+
<button
|
|
3219
|
+
v-if="removable"
|
|
3220
|
+
class="djm-notification-remove"
|
|
3221
|
+
type="button"
|
|
3222
|
+
:aria-label="t('common.close')"
|
|
3223
|
+
@click.stop="onRemove(item)"
|
|
3224
|
+
><DjmIcon name="x" :size="12" /></button>
|
|
3225
|
+
</li>
|
|
3226
|
+
</ul>
|
|
3227
|
+
</div>
|
|
3228
|
+
`};import{watch as Xr}from"vue";var Qr={xs:"24px",sm:"28px",md:"30px",lg:"34px"},xi={name:"DjmConfigProvider",props:{locale:{type:String,default:""},size:{type:String,default:""}},setup(e){return e.locale&&He(e.locale),Xr(()=>e.locale,t=>{t&&He(t)}),{providerStyle(){let t=Qr[e.size];return t?{"--djm-control-h":t}:{}}}},template:`
|
|
3229
|
+
<div class="djm-config-provider" :style="providerStyle()">
|
|
3230
|
+
<slot></slot>
|
|
3231
|
+
</div>
|
|
3232
|
+
`};import{ref as Ne,computed as ge,watch as Zr,onBeforeUnmount as es}from"vue";var ts=0,Le=e=>String(e).padStart(2,"0");function zt(e,t,a){return`${e}-${Le(t+1)}-${Le(a)}`}function Si(e){if(!e)return{date:"",time:""};let[t="",a=""]=String(e).split(" ");return{date:t,time:a}}function Bt(e){let t=String(e||"").split("-").map(Number);return t.length!==3||t.some(a=>!Number.isFinite(a))?null:{year:t[0],month:t[1]-1,day:t[2]}}var Di={name:"DjmDateTimePicker",components:{DjmIcon:L},props:{modelValue:{type:String,default:""},format:{type:String,default:"YYYY-MM-DD HH:mm"},placeholder:{type:String,default:""},min:{type:String,default:""},max:{type:String,default:""},minuteStep:{type:Number,default:1},clearable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},disabledDate:{type:Function,default:null}},emits:["update:modelValue","change","visible-change"],setup(e,{emit:t}){let a=Ne(!1);Zr(a,P=>t("visible-change",P));let n=Ne(null),i=Ne(null),l="djm-datetime-panel-"+ ++ts,o=Ne({...Z}),r=null,s=new Date,d=zt(s.getFullYear(),s.getMonth(),s.getDate()),f=ge(()=>e.format.indexOf("ss")>-1),c=Ne({date:"",h:"00",m:"00",s:"00"}),p=Bt(Si(e.modelValue).date),g=Ne(p?p.year:s.getFullYear()),m=Ne(p?p.month:s.getMonth()),h=ge(()=>e.modelValue||""),b=ge(()=>e.placeholder||C("dateTimePicker.placeholder")),j=ge(()=>C("datePicker.weeks").split(",")),w=ge(()=>Array.from({length:24},(P,O)=>Le(O))),y=ge(()=>{let P=[];for(let O=0;O<60;O+=Math.max(1,e.minuteStep))P.push(Le(O));return P}),u=ge(()=>Array.from({length:60},(P,O)=>Le(O))),v=ge(()=>{let P=[{key:"h",list:w.value},{key:"m",list:y.value}];return f.value&&P.push({key:"s",list:u.value}),P}),T=ge(()=>C("datePicker.title",{year:g.value,month:m.value+1})),D=ge(()=>{let O=(new Date(g.value,m.value,1).getDay()+6)%7,W=new Date(g.value,m.value,1-O);return Array.from({length:42},(ne,k)=>{let E=new Date(W.getFullYear(),W.getMonth(),W.getDate()+k),B=zt(E.getFullYear(),E.getMonth(),E.getDate());return{key:B,day:E.getDate(),outside:E.getMonth()!==m.value,today:B===d,selected:B===c.value.date,disabled:x(B)}})});function x(P){return e.min&&P<e.min.slice(0,10)||e.max&&P>e.max.slice(0,10)?!0:typeof e.disabledDate=="function"?!!e.disabledDate(P):!1}function z(){let{date:P,time:O}=Si(e.modelValue),W=S(P||d),[ne="00",k="00",E="00"]=(O||"00:00:00").split(":");c.value={date:W,h:ne,m:k,s:E};let B=Bt(W);B&&(g.value=B.year,m.value=B.month)}function S(P){if(!x(P))return P;for(let O=1;O<=366;O++){let W=M(P,O);if(!x(W))return W}return P}function M(P,O){let W=Bt(P);if(!W)return P;let ne=new Date(W.year,W.month,W.day+O);return zt(ne.getFullYear(),ne.getMonth(),ne.getDate())}function I(){e.disabled||(z(),a.value=!0,r=G({root:()=>n.value,panel:()=>i.value,onClose:V,onReposition:A}),requestAnimationFrame(A))}function A(){if(!a.value||!n.value)return;let P=n.value.getBoundingClientRect(),O=i.value?i.value.offsetHeight:360,W=i.value?i.value.offsetWidth:480;o.value=de({rect:P,flip:se(P,O),clampWidth:W})}function V(){a.value&&(a.value=!1,o.value={...Z},r&&(r(),r=null))}function H(){a.value?V():I()}function Y(){m.value===0?(m.value=11,g.value-=1):m.value-=1}function X(){m.value===11?(m.value=0,g.value+=1):m.value+=1}function R(P){P.disabled||(c.value={...c.value,date:P.key})}function F(P,O){c.value={...c.value,[P]:O}}function U(){let P=f.value?`${c.value.h}:${c.value.m}:${c.value.s}`:`${c.value.h}:${c.value.m}`;return`${c.value.date} ${P}`}function te(){if(x(c.value.date))return;let P=U();t("update:modelValue",P),t("change",P),V()}function Q(){let P=new Date,O=zt(P.getFullYear(),P.getMonth(),P.getDate());if(x(O))return;c.value={date:O,h:Le(P.getHours()),m:Le(P.getMinutes()),s:Le(P.getSeconds())};let W=Bt(c.value.date);g.value=W.year,m.value=W.month}function le(){t("update:modelValue",""),t("change",""),V()}return es(()=>{r&&(r(),r=null)}),{open:a,root:n,panel:i,panelId:l,panelStyle:o,draft:c,hasSeconds:f,displayText:h,placeholderText:b,weeks:j,monthLabel:T,cells:D,timeCols:v,toggle:H,closePanel:V,prevMonth:Y,nextMonth:X,pickDate:R,pickTime:F,confirm:te,pickNow:Q,clear:le,t:C}},template:`
|
|
3233
|
+
<div class="djm-datetime" ref="root">
|
|
3234
|
+
<div
|
|
3235
|
+
class="djm-input djm-datetime-trigger"
|
|
3236
|
+
:class="{ 'djm-is-disabled': disabled }"
|
|
3237
|
+
role="combobox"
|
|
3238
|
+
:tabindex="disabled ? -1 : 0"
|
|
3239
|
+
aria-haspopup="dialog"
|
|
3240
|
+
:aria-expanded="String(open)"
|
|
3241
|
+
:aria-controls="panelId"
|
|
3242
|
+
:aria-label="displayText || placeholderText"
|
|
3243
|
+
@click="toggle"
|
|
3244
|
+
@keydown.enter.prevent="toggle"
|
|
3245
|
+
@keydown.space.prevent="toggle"
|
|
3246
|
+
>
|
|
3247
|
+
<DjmIcon name="calendar" :size="14" />
|
|
3248
|
+
<span :class="{ 'djm-is-placeholder': !displayText }">{{ displayText || placeholderText }}</span>
|
|
3249
|
+
<button
|
|
3250
|
+
v-if="clearable && displayText && !disabled"
|
|
3251
|
+
class="djm-datetime-clear"
|
|
3252
|
+
type="button"
|
|
3253
|
+
:aria-label="t('dateTimePicker.clear')"
|
|
3254
|
+
@click.stop="clear"
|
|
3255
|
+
><DjmIcon name="x" :size="12" /></button>
|
|
3256
|
+
<DjmIcon v-else name="chevron-down" :size="12" class="djm-datetime-caret" />
|
|
3257
|
+
</div>
|
|
3258
|
+
|
|
3259
|
+
<Teleport to="body">
|
|
3260
|
+
<div
|
|
3261
|
+
v-if="open"
|
|
3262
|
+
ref="panel"
|
|
3263
|
+
class="djm-datetime-panel"
|
|
3264
|
+
:id="panelId"
|
|
3265
|
+
:style="panelStyle"
|
|
3266
|
+
role="dialog"
|
|
3267
|
+
:aria-label="placeholderText"
|
|
3268
|
+
>
|
|
3269
|
+
<div class="djm-datetime-body">
|
|
3270
|
+
<div class="djm-datetime-calendar">
|
|
3271
|
+
<div class="djm-datetime-head">
|
|
3272
|
+
<button class="djm-datetime-nav" type="button" :aria-label="t('dateTimePicker.prevMonth')" @click="prevMonth">
|
|
3273
|
+
<DjmIcon name="chevron-left" :size="13" />
|
|
3274
|
+
</button>
|
|
3275
|
+
<span class="djm-datetime-title">{{ monthLabel }}</span>
|
|
3276
|
+
<button class="djm-datetime-nav" type="button" :aria-label="t('dateTimePicker.nextMonth')" @click="nextMonth">
|
|
3277
|
+
<DjmIcon name="chevron-right" :size="13" />
|
|
3278
|
+
</button>
|
|
3279
|
+
</div>
|
|
3280
|
+
<div class="djm-datetime-grid">
|
|
3281
|
+
<span v-for="week in weeks" :key="week" class="djm-datetime-week">{{ week }}</span>
|
|
3282
|
+
<button
|
|
3283
|
+
v-for="cell in cells"
|
|
3284
|
+
:key="cell.key"
|
|
3285
|
+
class="djm-datetime-day"
|
|
3286
|
+
type="button"
|
|
3287
|
+
:class="{
|
|
3288
|
+
'djm-is-outside': cell.outside,
|
|
3289
|
+
'djm-is-today': cell.today,
|
|
3290
|
+
'djm-is-selected': cell.selected
|
|
3291
|
+
}"
|
|
3292
|
+
:disabled="cell.disabled"
|
|
3293
|
+
@click="pickDate(cell)"
|
|
3294
|
+
>{{ cell.day }}</button>
|
|
3295
|
+
</div>
|
|
3296
|
+
</div>
|
|
3297
|
+
|
|
3298
|
+
<div class="djm-datetime-times">
|
|
3299
|
+
<div v-for="col in timeCols" :key="col.key" class="djm-datetime-col">
|
|
3300
|
+
<button
|
|
3301
|
+
v-for="item in col.list"
|
|
3302
|
+
:key="item"
|
|
3303
|
+
class="djm-datetime-time"
|
|
3304
|
+
type="button"
|
|
3305
|
+
:class="{ 'djm-is-selected': draft[col.key] === item }"
|
|
3306
|
+
@click="pickTime(col.key, item)"
|
|
3307
|
+
>{{ item }}</button>
|
|
3308
|
+
</div>
|
|
3309
|
+
</div>
|
|
3310
|
+
</div>
|
|
3311
|
+
|
|
3312
|
+
<div class="djm-datetime-foot">
|
|
3313
|
+
<button class="djm-link-btn" type="button" @click="pickNow">{{ t('dateTimePicker.now') }}</button>
|
|
3314
|
+
<span class="djm-datetime-preview">{{ draft.date }} {{ draft.h }}:{{ draft.m }}<template v-if="hasSeconds">:{{ draft.s }}</template></span>
|
|
3315
|
+
<button class="djm-link-btn djm-danger" v-if="clearable" type="button" @click="clear">{{ t('dateTimePicker.clear') }}</button>
|
|
3316
|
+
<button class="djm-btn djm-btn-primary djm-btn-sm" type="button" @click="confirm">{{ t('common.confirm') }}</button>
|
|
3317
|
+
</div>
|
|
3318
|
+
</div>
|
|
3319
|
+
</Teleport>
|
|
3320
|
+
</div>
|
|
3321
|
+
`};import{ref as ua,computed as Nt,watch as as,onMounted as ns,onBeforeUnmount as is}from"vue";var Ti={name:"DjmVirtualList",props:{items:{type:Array,default:()=>[]},itemHeight:{type:[Number,Function],default:40},height:{type:[Number,String],default:320},overscan:{type:Number,default:4},bottomThreshold:{type:Number,default:40},keyField:{type:String,default:"id"}},emits:["scroll","reach-bottom","item-click"],setup(e,{emit:t,expose:a}){let n=ua(null),i=ua(0),l=ua(typeof e.height=="number"?e.height:320),o=!1;function r(w,y){return typeof e.itemHeight=="function"?Math.max(1,Number(e.itemHeight(w,y))||1):Math.max(1,e.itemHeight)}let s=Nt(()=>{let w=[0],y=0;return e.items.forEach((u,v)=>{y+=r(u,v),w.push(y)}),w}),d=Nt(()=>s.value[s.value.length-1]);function f(w){let y=s.value,u=0,v=y.length-1;for(;u<v;){let T=u+v>>1;y[T]<w?u=T+1:v=T}return Math.max(0,u-1)}let c=Nt(()=>{let w=e.items.length;if(!w)return{start:0,end:0};let y=Math.max(0,f(i.value)-e.overscan),u=y,v=i.value+l.value+e.overscan*40;for(;u<w&&s.value[u]<v;)u+=1;return{start:y,end:Math.min(w,u+e.overscan)}}),p=Nt(()=>{let{start:w,end:y}=c.value;return e.items.slice(w,y).map((u,v)=>{let T=w+v;return{item:u,index:T,key:u&&u[e.keyField]!==void 0?u[e.keyField]:T,top:s.value[T],height:r(u,T)}})});function g(w){let y=w.target;i.value=y.scrollTop,t("scroll",{scrollTop:y.scrollTop});let u=y.scrollTop+y.clientHeight>=d.value-e.bottomThreshold;u&&!o?(o=!0,t("reach-bottom")):u||(o=!1)}function m(w,y="auto"){let u=n.value;if(!u)return;let v=s.value[Math.max(0,Math.min(w,e.items.length-1))],T=s.value[Math.min(w+1,e.items.length)];y==="top"?u.scrollTop=v:y==="bottom"?u.scrollTop=T-u.clientHeight:v<u.scrollTop?u.scrollTop=v:T>u.scrollTop+u.clientHeight&&(u.scrollTop=T-u.clientHeight)}as(()=>e.height,()=>{n.value&&(l.value=n.value.clientHeight)});function h(){n.value&&(l.value=n.value.clientHeight)}let b=null;ns(()=>{h(),window.ResizeObserver&&n.value&&(b=new ResizeObserver(()=>h()),b.observe(n.value))}),is(()=>{b&&b.disconnect()});function j(w){t("item-click",w.item,w.index)}return a({scrollToIndex:m,measure:h}),{viewport:n,totalHeight:d,visibleRows:p,onScroll:g,onItemClick:j,scrollToIndex:m,measure:h,t:C}},template:`
|
|
3322
|
+
<div
|
|
3323
|
+
class="djm-vlist"
|
|
3324
|
+
ref="viewport"
|
|
3325
|
+
:style="{ height: typeof height === 'number' ? height + 'px' : height }"
|
|
3326
|
+
tabindex="0"
|
|
3327
|
+
@scroll.passive="onScroll"
|
|
3328
|
+
>
|
|
3329
|
+
<div class="djm-vlist-spacer" :style="{ height: totalHeight + 'px' }">
|
|
3330
|
+
<div
|
|
3331
|
+
v-for="row in visibleRows"
|
|
3332
|
+
:key="row.key"
|
|
3333
|
+
class="djm-vlist-row"
|
|
3334
|
+
:style="{ transform: 'translateY(' + row.top + 'px)', height: row.height + 'px' }"
|
|
3335
|
+
@click="onItemClick(row)"
|
|
3336
|
+
>
|
|
3337
|
+
<slot :item="row.item" :index="row.index">{{ row.item }}</slot>
|
|
3338
|
+
</div>
|
|
3339
|
+
</div>
|
|
3340
|
+
<div v-if="!items.length" class="djm-vlist-empty">
|
|
3341
|
+
<slot name="empty">{{ t('virtualList.empty') }}</slot>
|
|
3342
|
+
</div>
|
|
3343
|
+
</div>
|
|
3344
|
+
`};import{computed as Mi}from"vue";var Ci={name:"DjmBatchBar",props:{count:{type:Number,default:0},total:{type:Number,default:0},label:{type:String,default:""},clearable:{type:Boolean,default:!0},fixed:{type:Boolean,default:!1}},emits:["clear","select-all"],setup(e,{emit:t}){let a=Mi(()=>e.label||C("batchBar.selected",{count:e.count})),n=Mi(()=>e.total>e.count);return{text:a,canSelectAll:n,onClear:()=>t("clear"),onSelectAll:()=>t("select-all"),t:C}},template:`
|
|
3345
|
+
<div v-if="count > 0" class="djm-batch-bar" :class="{ 'djm-is-fixed': fixed }" role="region" :aria-label="text">
|
|
3346
|
+
<span class="djm-batch-info">
|
|
3347
|
+
<strong class="djm-batch-count">{{ text }}</strong>
|
|
3348
|
+
<button v-if="canSelectAll" class="djm-link-btn" type="button" @click="onSelectAll">
|
|
3349
|
+
{{ t('batchBar.selectAll', { total }) }}
|
|
3350
|
+
</button>
|
|
3351
|
+
</span>
|
|
3352
|
+
<span class="djm-batch-actions">
|
|
3353
|
+
<slot></slot>
|
|
3354
|
+
</span>
|
|
3355
|
+
<button v-if="clearable" class="djm-link-btn djm-batch-clear" type="button" @click="onClear">
|
|
3356
|
+
{{ t('batchBar.clear') }}
|
|
3357
|
+
</button>
|
|
3358
|
+
</div>
|
|
3359
|
+
`};import{ref as Je,computed as ma,watch as fa}from"vue";function ls(e,t){if(!t)return!0;let a="."+String(e).split(".").pop().toLowerCase();return t.split(",").map(n=>n.trim().toLowerCase()).some(n=>n===a||n==="*")}var Ei={name:"DjmImportWizard",components:{DjmIcon:L},props:{step:{type:Number,default:1},accept:{type:String,default:".csv,.xlsx,.xls"},maxSize:{type:Number,default:10},columns:{type:Array,default:()=>[]},fields:{type:Array,default:()=>[]},mapping:{type:Object,default:()=>({})},result:{type:Object,default:()=>({})},loading:{type:Boolean,default:!1}},emits:["update:step","update:mapping","file-change","submit","retry"],setup(e,{emit:t}){let a=Je(e.step||1);fa(()=>e.step,v=>{v&&(a.value=v)});let n=Je(null),i=Je(""),l=Je(""),o=Je(null),r=Je({...e.mapping});fa(()=>e.mapping,v=>{r.value={...v}},{deep:!0});function s(v){a.value=v,t("update:step",v)}let d=ma(()=>[{index:1,title:C("importWizard.stepFile")},{index:2,title:C("importWizard.stepMapping")},{index:3,title:C("importWizard.stepResult")}]);function f(){o.value&&o.value.click()}function c(v){return v?ls(v.name,e.accept)?e.maxSize>0&&v.size>e.maxSize*1024*1024?(i.value=C("importWizard.sizeError",{size:e.maxSize}),!1):(i.value="",!0):(i.value=C("importWizard.acceptError",{accept:e.accept}),!1):!1}function p(v){c(v)&&(n.value=v,t("file-change",v),s(2))}function g(v){p(v.target.files&&v.target.files[0]),v.target.value=""}function m(v){let T=v.dataTransfer&&v.dataTransfer.files&&v.dataTransfer.files[0];p(T)}function h(v,T){let D={...r.value,[v]:T};T||delete D[v],r.value=D,l.value="",t("update:mapping",D)}let b=ma(()=>e.columns.filter(v=>v.required&&!r.value[v.key]));function j(){if(b.value.length){l.value=C("importWizard.missingRequired",{fields:b.value.map(v=>v.label||v.key).join("\u3001")});return}t("submit",{...r.value})}fa(()=>e.result,v=>{v&&(v.total||v.success||v.failed||v.errors&&v.errors.length)&&s(3)});function w(){n.value=null,i.value="",l.value="",r.value={},t("update:mapping",{}),o.value&&(o.value.value=""),s(1)}function y(){t("retry"),s(2)}let u=ma(()=>{let v=e.result||{};return{total:v.total||0,success:v.success||0,failed:v.failed||0,errors:v.errors||[]}});return{innerStep:a,steps:d,file:n,fileError:i,mappingError:l,fileInput:o,innerMapping:r,missingRequired:b,stats:u,pickFile:f,onFileChange:g,onDrop:m,setMapping:h,submit:j,reset:w,retry:y,goStep:s,formatFileSize:Ye,t:C}},template:`
|
|
3360
|
+
<div class="djm-import-wizard">
|
|
3361
|
+
<ol class="djm-import-steps">
|
|
3362
|
+
<li
|
|
3363
|
+
v-for="item in steps"
|
|
3364
|
+
:key="item.index"
|
|
3365
|
+
class="djm-import-step"
|
|
3366
|
+
:class="{ 'djm-is-active': innerStep === item.index, 'djm-is-done': innerStep > item.index }"
|
|
3367
|
+
:aria-current="innerStep === item.index ? 'step' : null"
|
|
3368
|
+
>
|
|
3369
|
+
<span class="djm-import-step-no">{{ item.index }}</span>
|
|
3370
|
+
<span class="djm-import-step-title">{{ item.title }}</span>
|
|
3371
|
+
</li>
|
|
3372
|
+
</ol>
|
|
3373
|
+
|
|
3374
|
+
<!-- \u7B2C\u4E00\u6B65\uFF1A\u9009\u6587\u4EF6 -->
|
|
3375
|
+
<div v-if="innerStep === 1" class="djm-import-body">
|
|
3376
|
+
<div
|
|
3377
|
+
class="djm-import-drop"
|
|
3378
|
+
role="button"
|
|
3379
|
+
tabindex="0"
|
|
3380
|
+
@click="pickFile"
|
|
3381
|
+
@keydown.enter.prevent="pickFile"
|
|
3382
|
+
@keydown.space.prevent="pickFile"
|
|
3383
|
+
@dragover.prevent
|
|
3384
|
+
@drop.prevent="onDrop"
|
|
3385
|
+
>
|
|
3386
|
+
<DjmIcon name="upload" :size="26" />
|
|
3387
|
+
<p class="djm-import-drop-title">{{ t('importWizard.pick') }}</p>
|
|
3388
|
+
<p class="djm-import-drop-tip">{{ t('importWizard.dragTip', { accept }) }}</p>
|
|
3389
|
+
</div>
|
|
3390
|
+
<input
|
|
3391
|
+
ref="fileInput"
|
|
3392
|
+
class="djm-import-file"
|
|
3393
|
+
type="file"
|
|
3394
|
+
:accept="accept"
|
|
3395
|
+
tabindex="-1"
|
|
3396
|
+
aria-hidden="true"
|
|
3397
|
+
@change="onFileChange"
|
|
3398
|
+
/>
|
|
3399
|
+
<p v-if="fileError" class="djm-import-error" role="alert">{{ fileError }}</p>
|
|
3400
|
+
</div>
|
|
3401
|
+
|
|
3402
|
+
<!-- \u7B2C\u4E8C\u6B65\uFF1A\u5B57\u6BB5\u6620\u5C04 -->
|
|
3403
|
+
<div v-else-if="innerStep === 2" class="djm-import-body">
|
|
3404
|
+
<div v-if="file" class="djm-import-file-info">
|
|
3405
|
+
<DjmIcon name="file" :size="14" />
|
|
3406
|
+
<span class="djm-import-file-name">{{ file.name }}</span>
|
|
3407
|
+
<span class="djm-import-file-size">{{ formatFileSize(file.size) }}</span>
|
|
3408
|
+
<button class="djm-link-btn" type="button" @click="reset">{{ t('importWizard.reselect') }}</button>
|
|
3409
|
+
</div>
|
|
3410
|
+
|
|
3411
|
+
<div class="djm-import-mapping">
|
|
3412
|
+
<div v-for="col in columns" :key="col.key" class="djm-import-map-row">
|
|
3413
|
+
<label class="djm-import-map-label" :for="'djm-import-map-' + col.key">
|
|
3414
|
+
{{ col.label || col.key }}
|
|
3415
|
+
<span v-if="col.required" class="djm-import-required" aria-hidden="true">*</span>
|
|
3416
|
+
</label>
|
|
3417
|
+
<span class="djm-import-map-arrow" aria-hidden="true">\u2190</span>
|
|
3418
|
+
<select
|
|
3419
|
+
class="djm-import-map-select"
|
|
3420
|
+
:id="'djm-import-map-' + col.key"
|
|
3421
|
+
:value="innerMapping[col.key] || ''"
|
|
3422
|
+
@change="setMapping(col.key, $event.target.value)"
|
|
3423
|
+
>
|
|
3424
|
+
<option value="">{{ t('importWizard.sourcePlaceholder') }}</option>
|
|
3425
|
+
<option v-for="field in fields" :key="field" :value="field">{{ field }}</option>
|
|
3426
|
+
</select>
|
|
3427
|
+
</div>
|
|
3428
|
+
</div>
|
|
3429
|
+
|
|
3430
|
+
<p v-if="mappingError" class="djm-import-error" role="alert">{{ mappingError }}</p>
|
|
3431
|
+
|
|
3432
|
+
<div class="djm-import-actions">
|
|
3433
|
+
<button class="djm-btn" type="button" @click="goStep(1)">{{ t('importWizard.prev') }}</button>
|
|
3434
|
+
<button class="djm-btn djm-btn-primary" type="button" :disabled="loading" @click="submit">
|
|
3435
|
+
{{ loading ? t('importWizard.importing') : t('importWizard.submit') }}
|
|
3436
|
+
</button>
|
|
3437
|
+
</div>
|
|
3438
|
+
</div>
|
|
3439
|
+
|
|
3440
|
+
<!-- \u7B2C\u4E09\u6B65\uFF1A\u7ED3\u679C -->
|
|
3441
|
+
<div v-else class="djm-import-body">
|
|
3442
|
+
<div class="djm-import-stats">
|
|
3443
|
+
<div class="djm-import-stat">
|
|
3444
|
+
<span class="djm-import-stat-value">{{ stats.total }}</span>
|
|
3445
|
+
<span class="djm-import-stat-label">{{ t('importWizard.statTotal') }}</span>
|
|
3446
|
+
</div>
|
|
3447
|
+
<div class="djm-import-stat djm-is-success">
|
|
3448
|
+
<span class="djm-import-stat-value">{{ stats.success }}</span>
|
|
3449
|
+
<span class="djm-import-stat-label">{{ t('importWizard.statSuccess') }}</span>
|
|
3450
|
+
</div>
|
|
3451
|
+
<div class="djm-import-stat" :class="{ 'djm-is-danger': stats.failed > 0 }">
|
|
3452
|
+
<span class="djm-import-stat-value">{{ stats.failed }}</span>
|
|
3453
|
+
<span class="djm-import-stat-label">{{ t('importWizard.statFailed') }}</span>
|
|
3454
|
+
</div>
|
|
3455
|
+
</div>
|
|
3456
|
+
|
|
3457
|
+
<ul v-if="stats.errors.length" class="djm-import-errors">
|
|
3458
|
+
<li v-for="item in stats.errors" :key="item.row" class="djm-import-error-row">
|
|
3459
|
+
<span class="djm-import-error-row-no">{{ t('importWizard.rowNo', { row: item.row }) }}</span>
|
|
3460
|
+
<span>{{ item.message }}</span>
|
|
3461
|
+
</li>
|
|
3462
|
+
</ul>
|
|
3463
|
+
|
|
3464
|
+
<div class="djm-import-actions">
|
|
3465
|
+
<button class="djm-btn" type="button" @click="retry">{{ t('importWizard.retry') }}</button>
|
|
3466
|
+
<button class="djm-btn djm-btn-primary" type="button" @click="reset">{{ t('importWizard.restart') }}</button>
|
|
3467
|
+
</div>
|
|
3468
|
+
</div>
|
|
3469
|
+
</div>
|
|
3470
|
+
`};import{ref as os,computed as Xe}from"vue";function Ii(e,t){let a=e?String(e).split(`
|
|
3471
|
+
`):[],n=t?String(t).split(`
|
|
3472
|
+
`):[],i=[],l=0,o=0;if(a.length*n.length>1e6)return a.forEach(g=>i.push({type:"remove",text:g,oldLine:++l,newLine:0})),n.forEach(g=>i.push({type:"add",text:g,oldLine:0,newLine:++o})),i;let r=a.length,s=n.length,d=s+1,f=new Int32Array((r+1)*d);for(let g=r-1;g>=0;g--)for(let m=s-1;m>=0;m--)f[g*d+m]=a[g]===n[m]?f[(g+1)*d+m+1]+1:Math.max(f[(g+1)*d+m],f[g*d+m+1]);let c=0,p=0;for(;c<r&&p<s;)a[c]===n[p]?(i.push({type:"equal",text:a[c],oldLine:++l,newLine:++o}),c+=1,p+=1):f[(c+1)*d+p]>=f[c*d+p+1]?(i.push({type:"remove",text:a[c],oldLine:++l,newLine:0}),c+=1):(i.push({type:"add",text:n[p],oldLine:0,newLine:++o}),p+=1);for(;c<r;)i.push({type:"remove",text:a[c],oldLine:++l,newLine:0}),c+=1;for(;p<s;)i.push({type:"add",text:n[p],oldLine:0,newLine:++o}),p+=1;return i}var Li={name:"DjmDiff",props:{before:{type:String,default:""},after:{type:String,default:""},mode:{type:String,default:"unified"},context:{type:Number,default:3},showLineNumbers:{type:Boolean,default:!0},beforeLabel:{type:String,default:""},afterLabel:{type:String,default:""}},setup(e){let t=Xe(()=>Ii(e.before,e.after)),a=Xe(()=>{let d=0,f=0;return t.value.forEach(c=>{c.type==="add"&&(d+=1),c.type==="remove"&&(f+=1)}),{add:d,remove:f}}),n=os([]);function i(d){n.value=n.value.concat(d)}let l=Xe(()=>{let d=Math.max(0,e.context),f=t.value;if(!d)return f;let c=[],p=0;for(;p<f.length;){if(f[p].type!=="equal"){c.push(f[p]),p+=1;continue}let g=p;for(;g<f.length&&f[g].type==="equal";)g+=1;let m=f.slice(p,g),h=p===0,b=g===f.length,j=h?0:d,w=b?0:d,y=j+w;m.length<=y+1||n.value.indexOf(p)>-1?c.push(...m):(j&&c.push(...m.slice(0,j)),c.push({type:"skip",count:m.length-y,blockIndex:p}),w&&c.push(...m.slice(m.length-w))),p=g}return c}),o=Xe(()=>{let d=l.value,f=[],c=0;for(;c<d.length;){let p=d[c];if(p.type==="equal"||p.type==="skip"){f.push({left:p,right:p}),c+=1;continue}let g=[],m=[];for(;c<d.length&&(d[c].type==="remove"||d[c].type==="add");)d[c].type==="remove"?g.push(d[c]):m.push(d[c]),c+=1;let h=Math.max(g.length,m.length);for(let b=0;b<h;b++)f.push({left:g[b]||null,right:m[b]||null})}return f}),r=Xe(()=>e.beforeLabel||C("diff.before")),s=Xe(()=>e.afterLabel||C("diff.after"));return{stats:a,displayRows:l,splitRows:o,expand:i,beforeLabelText:r,afterLabelText:s,t:C}},template:`
|
|
3473
|
+
<div class="djm-diff" :class="'djm-diff-' + mode">
|
|
3474
|
+
<header class="djm-diff-bar">
|
|
3475
|
+
<span class="djm-diff-stat djm-is-add">+{{ stats.add }}</span>
|
|
3476
|
+
<span class="djm-diff-stat djm-is-remove">\u2212{{ stats.remove }}</span>
|
|
3477
|
+
<span v-if="!stats.add && !stats.remove" class="djm-diff-same">{{ t('diff.same') }}</span>
|
|
3478
|
+
</header>
|
|
3479
|
+
|
|
3480
|
+
<!-- \u7EDF\u4E00\u89C6\u56FE -->
|
|
3481
|
+
<div v-if="mode !== 'split'" class="djm-diff-body">
|
|
3482
|
+
<template v-for="(row, index) in displayRows" :key="index">
|
|
3483
|
+
<button
|
|
3484
|
+
v-if="row.type === 'skip'"
|
|
3485
|
+
class="djm-diff-skip"
|
|
3486
|
+
type="button"
|
|
3487
|
+
@click="expand(row.blockIndex)"
|
|
3488
|
+
>{{ t('diff.expand', { count: row.count }) }}</button>
|
|
3489
|
+
<div v-else class="djm-diff-line" :class="'djm-is-' + row.type">
|
|
3490
|
+
<span v-if="showLineNumbers" class="djm-diff-no">{{ row.oldLine || '' }}</span>
|
|
3491
|
+
<span v-if="showLineNumbers" class="djm-diff-no">{{ row.newLine || '' }}</span>
|
|
3492
|
+
<span class="djm-diff-sign" aria-hidden="true">{{ row.type === 'add' ? '+' : (row.type === 'remove' ? '\u2212' : ' ') }}</span>
|
|
3493
|
+
<code class="djm-diff-text">{{ row.text }}</code>
|
|
3494
|
+
</div>
|
|
3495
|
+
</template>
|
|
3496
|
+
</div>
|
|
3497
|
+
|
|
3498
|
+
<!-- \u5E76\u6392\u89C6\u56FE -->
|
|
3499
|
+
<div v-else class="djm-diff-split">
|
|
3500
|
+
<div class="djm-diff-split-head">
|
|
3501
|
+
<span>{{ beforeLabelText }}</span>
|
|
3502
|
+
<span>{{ afterLabelText }}</span>
|
|
3503
|
+
</div>
|
|
3504
|
+
<div v-for="(row, index) in splitRows" :key="index" class="djm-diff-split-row">
|
|
3505
|
+
<template v-if="row.left && row.left.type === 'skip'">
|
|
3506
|
+
<button class="djm-diff-skip djm-diff-split-skip" type="button" @click="expand(row.left.blockIndex)">
|
|
3507
|
+
{{ t('diff.expand', { count: row.left.count }) }}
|
|
3508
|
+
</button>
|
|
3509
|
+
</template>
|
|
3510
|
+
<template v-else>
|
|
3511
|
+
<div class="djm-diff-side" :class="row.left ? 'djm-is-' + row.left.type : 'djm-is-empty'">
|
|
3512
|
+
<span v-if="showLineNumbers" class="djm-diff-no">{{ row.left ? (row.left.oldLine || '') : '' }}</span>
|
|
3513
|
+
<code class="djm-diff-text">{{ row.left ? row.left.text : '' }}</code>
|
|
3514
|
+
</div>
|
|
3515
|
+
<div class="djm-diff-side" :class="row.right ? 'djm-is-' + row.right.type : 'djm-is-empty'">
|
|
3516
|
+
<span v-if="showLineNumbers" class="djm-diff-no">{{ row.right ? (row.right.newLine || '') : '' }}</span>
|
|
3517
|
+
<code class="djm-diff-text">{{ row.right ? row.right.text : '' }}</code>
|
|
3518
|
+
</div>
|
|
3519
|
+
</template>
|
|
3520
|
+
</div>
|
|
3521
|
+
</div>
|
|
3522
|
+
</div>
|
|
3523
|
+
`};import{ref as Ai,computed as Se,watch as Pi}from"vue";function ye(e,t){return e&&e[t]!==void 0?e[t]:e&&e.id}var zi={name:"DjmTreeTable",components:{DjmIcon:L},props:{data:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},rowKey:{type:String,default:"id"},expandedKeys:{type:Array,default:null},defaultExpandAll:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},checkedKeys:{type:Array,default:null},checkStrictly:{type:Boolean,default:!1},showHeader:{type:Boolean,default:!0},maxHeight:{type:[Number,String],default:""},striped:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},emptyText:{type:String,default:""}},emits:["update:expandedKeys","update:checkedKeys","expand-change","check-change","row-click"],setup(e,{emit:t}){function a(S,M,I=1,A=null){(S||[]).forEach(V=>{M(V,I,A),V.children&&V.children.length&&a(V.children,M,I+1,ye(V,e.rowKey))})}function n(){let S=[];return a(e.data,M=>S.push(ye(M,e.rowKey))),S}let i=Ai(e.expandedKeys?e.expandedKeys.slice():e.defaultExpandAll?n():[]);Pi(()=>e.expandedKeys,S=>{S&&(i.value=S.slice())});let l=Ai(e.checkedKeys?e.checkedKeys.slice():[]);Pi(()=>e.checkedKeys,S=>{S&&(l.value=S.slice())});let o=Se(()=>{let S=[];function M(I,A,V){(I||[]).forEach(H=>{let Y=ye(H,e.rowKey),X=!!(H.children&&H.children.length),R=i.value.indexOf(Y)>-1;S.push({row:H,key:Y,level:A,parentKey:V,hasChildren:X,expanded:R}),X&&R&&M(H.children,A+1,Y)})}return M(e.data,1,null),S}),r=Se(()=>{let S={};function M(I){let A=ye(I,e.rowKey),V=[];return(I.children||[]).forEach(H=>{V.push(ye(H,e.rowKey),...M(H))}),S[A]=V,V}return(e.data||[]).forEach(M),S}),s=Se(()=>{let S=[];return a(e.data,M=>{(!M.children||!M.children.length)&&S.push(ye(M,e.rowKey))}),S}),d=Se(()=>new Set(l.value)),f=Se(()=>s.value.length>0&&s.value.every(S=>d.value.has(S))),c=Se(()=>!f.value&&s.value.some(S=>d.value.has(S)));function p(S){if(!e.selectable||e.checkStrictly)return!1;let M=r.value[ye(S,e.rowKey)]||[];if(!M.length)return!1;let I=M.filter(A=>d.value.has(A)).length;return I>0&&I<M.length}function g(S){l.value=S,t("update:checkedKeys",S),t("check-change",S)}function m(S){let M=ye(S,e.rowKey),I=!d.value.has(M),A=new Set(l.value);if(e.checkStrictly)I?A.add(M):A.delete(M);else{[M,...r.value[M]||[]].forEach(Y=>I?A.add(Y):A.delete(Y));let H=b(M);for(;H!=null;){let Y=j(H);Y.length>0&&Y.every(R=>A.has(R))?A.add(H):A.delete(H),H=b(H)}}g(Array.from(A))}let h=Se(()=>{let S={};return a(e.data,(M,I,A)=>{S[ye(M,e.rowKey)]={row:M,parentKey:A}}),S});function b(S){let M=h.value[S];return M?M.parentKey:null}function j(S){let M=h.value[S];return M?(M.row.children||[]).map(I=>ye(I,e.rowKey)):[]}function w(){g(f.value||c.value?[]:s.value.slice())}function y(S){let M=S.key,I=i.value.indexOf(M),A=i.value.slice();I>-1?A.splice(I,1):A.push(M),i.value=A,t("update:expandedKeys",A),t("expand-change",M,I===-1)}function u(){let S=n();i.value=S,t("update:expandedKeys",S),t("expand-change",null,!0)}function v(){i.value=[],t("update:expandedKeys",[]),t("expand-change",null,!1)}function T(S,M){let I=S[M.key];return I??""}function D(S){t("row-click",S.row,S)}let x=Se(()=>e.maxHeight?{maxHeight:typeof e.maxHeight=="number"?e.maxHeight+"px":e.maxHeight}:null),z=Se(()=>e.emptyText||C("treeTable.empty"));return{rows:o,innerExpanded:i,checkedSet:d,allChecked:f,someChecked:c,isIndeterminate:p,toggleRowCheck:m,toggleAll:w,toggleExpand:y,expandAll:u,collapseAll:v,valueOf:T,onRowClick:D,scrollStyle:x,emptyLabel:z,t:C}},template:`
|
|
3524
|
+
<div class="djm-tree-table">
|
|
3525
|
+
<div
|
|
3526
|
+
class="djm-tree-table-wrap"
|
|
3527
|
+
:class="{ 'djm-is-scrollable': !!maxHeight }"
|
|
3528
|
+
:style="scrollStyle"
|
|
3529
|
+
:tabindex="scrollStyle ? 0 : -1"
|
|
3530
|
+
>
|
|
3531
|
+
<table class="djm-data-table djm-tree-table-inner" :class="{ 'djm-is-striped': striped }">
|
|
3532
|
+
<thead v-if="showHeader">
|
|
3533
|
+
<tr>
|
|
3534
|
+
<th v-if="selectable" class="djm-col-check" scope="col">
|
|
3535
|
+
<input
|
|
3536
|
+
type="checkbox"
|
|
3537
|
+
:checked="allChecked"
|
|
3538
|
+
:indeterminate="someChecked"
|
|
3539
|
+
:aria-label="t('treeTable.selectAll')"
|
|
3540
|
+
@change="toggleAll"
|
|
3541
|
+
/>
|
|
3542
|
+
</th>
|
|
3543
|
+
<th
|
|
3544
|
+
v-for="column in columns"
|
|
3545
|
+
:key="column.key"
|
|
3546
|
+
scope="col"
|
|
3547
|
+
:style="{ width: column.width ? column.width + 'px' : undefined, textAlign: column.align || 'left' }"
|
|
3548
|
+
>{{ column.label || column.key }}</th>
|
|
3549
|
+
</tr>
|
|
3550
|
+
</thead>
|
|
3551
|
+
<tbody>
|
|
3552
|
+
<tr
|
|
3553
|
+
v-for="item in rows"
|
|
3554
|
+
:key="item.key"
|
|
3555
|
+
:class="{ 'djm-is-selected': selectable && checkedSet.has(item.key) }"
|
|
3556
|
+
@click="onRowClick(item)"
|
|
3557
|
+
>
|
|
3558
|
+
<td v-if="selectable" class="djm-col-check" @click.stop>
|
|
3559
|
+
<input
|
|
3560
|
+
type="checkbox"
|
|
3561
|
+
:checked="checkedSet.has(item.key)"
|
|
3562
|
+
:indeterminate="isIndeterminate(item.row)"
|
|
3563
|
+
:aria-label="String(valueOf(item.row, columns[0] || {}))"
|
|
3564
|
+
@change="toggleRowCheck(item.row)"
|
|
3565
|
+
/>
|
|
3566
|
+
</td>
|
|
3567
|
+
<td
|
|
3568
|
+
v-for="(column, index) in columns"
|
|
3569
|
+
:key="column.key"
|
|
3570
|
+
:style="{ textAlign: column.align || 'left' }"
|
|
3571
|
+
>
|
|
3572
|
+
<span v-if="index === 0" class="djm-tree-table-cell">
|
|
3573
|
+
<span class="djm-tree-table-indent" :style="{ width: (item.level - 1) * 18 + 'px' }"></span>
|
|
3574
|
+
<button
|
|
3575
|
+
v-if="item.hasChildren"
|
|
3576
|
+
class="djm-tree-table-toggle"
|
|
3577
|
+
type="button"
|
|
3578
|
+
:aria-expanded="String(item.expanded)"
|
|
3579
|
+
:aria-label="item.expanded ? t('treeTable.collapse') : t('treeTable.expand')"
|
|
3580
|
+
@click.stop="toggleExpand(item)"
|
|
3581
|
+
>
|
|
3582
|
+
<DjmIcon :name="item.expanded ? 'chevron-down' : 'chevron-right'" :size="13" />
|
|
3583
|
+
</button>
|
|
3584
|
+
<span v-else class="djm-tree-table-toggle djm-is-empty"></span>
|
|
3585
|
+
<slot :name="'cell-' + column.key" :row="item.row" :column="column" :value="valueOf(item.row, column)" :level="item.level">
|
|
3586
|
+
{{ valueOf(item.row, column) }}
|
|
3587
|
+
</slot>
|
|
3588
|
+
</span>
|
|
3589
|
+
<slot v-else :name="'cell-' + column.key" :row="item.row" :column="column" :value="valueOf(item.row, column)" :level="item.level">
|
|
3590
|
+
{{ valueOf(item.row, column) }}
|
|
3591
|
+
</slot>
|
|
3592
|
+
</td>
|
|
3593
|
+
</tr>
|
|
3594
|
+
</tbody>
|
|
3595
|
+
</table>
|
|
3596
|
+
|
|
3597
|
+
<p v-if="loading && !rows.length" class="djm-tree-table-empty" role="status">{{ t('treeTable.loading') }}</p>
|
|
3598
|
+
<p v-else-if="!rows.length" class="djm-tree-table-empty">{{ emptyLabel }}</p>
|
|
3599
|
+
</div>
|
|
3600
|
+
</div>
|
|
3601
|
+
`};import{ref as Bi,computed as De,watch as rs,onBeforeUnmount as ss}from"vue";var Rt=e=>String(e).padStart(2,"0");function pa(e){return`${e.getFullYear()}-${Rt(e.getMonth()+1)}-${Rt(e.getDate())}`}function ds(e){let t=String(e||"").split("-").map(Number);return t.length!==3||t.some(a=>!Number.isFinite(a))?null:new Date(t[0],t[1]-1,t[2])}function Ni(e,t){let a=String(e||"").split(":").map(Number);return a.length!==2||a.some(n=>!Number.isFinite(n))?t:a[0]*60+a[1]}var Ri={name:"DjmSchedule",components:{DjmIcon:L},props:{modelValue:{type:String,default:""},items:{type:Array,default:()=>[]},startHour:{type:Number,default:8},endHour:{type:Number,default:20},hourHeight:{type:Number,default:48},showWeekend:{type:Boolean,default:!0},title:{type:String,default:""}},emits:["update:modelValue","event-click","slot-click","week-change"],setup(e,{emit:t}){let a=pa(new Date),n=Bi(new Date().getHours()*60+new Date().getMinutes()),i=window.setInterval(()=>{let v=new Date;n.value=v.getHours()*60+v.getMinutes()},6e4),l=Bi(e.modelValue||a);rs(()=>e.modelValue,v=>{v&&(l.value=v)});function o(v){let T=ds(v)||new Date,x=(T.getDay()+6)%7;return new Date(T.getFullYear(),T.getMonth(),T.getDate()-x)}let r=De(()=>o(l.value)),s=De(()=>C("schedule.weekdays").split(","));function d(v){let T=v.map(M=>{let I=Ni(M.start,e.startHour*60),A=Math.max(I+30,Ni(M.end,I+60));return{item:M,startMin:I,endMin:A}}).sort((M,I)=>M.startMin-I.startMin),D=[],x=T.map(M=>{let I=D.findIndex(A=>A<=M.startMin);return I===-1?(D.push(M.endMin),I=D.length-1):D[I]=M.endMin,{...M,lane:I}}),z=Math.max(1,D.length),S=e.startHour*60;return x.map(M=>{let I=(M.startMin-S)/60*e.hourHeight,A=(M.endMin-M.startMin)/60*e.hourHeight;return{key:M.item.id!==void 0?M.item.id:M.item.title+M.startMin,item:M.item,top:Math.max(0,I),height:Math.max(18,A-2),left:M.lane*100/z,width:100/z}})}let f=De(()=>{let v=r.value,T=Array.from({length:7},(D,x)=>{let z=new Date(v.getFullYear(),v.getMonth(),v.getDate()+x),S=pa(z);return{key:S,date:z,day:z.getDate(),month:z.getMonth()+1,weekday:s.value[x]||"",today:S===a,weekend:x>=5,blocks:d(e.items.filter(M=>M.date===S))}});return e.showWeekend?T:T.slice(0,5)}),c=De(()=>{let v=[];for(let T=e.startHour;T<e.endHour;T++)v.push(T);return v}),p=De(()=>(e.endHour-e.startHour)*e.hourHeight),g=De(()=>({gridTemplateColumns:"56px repeat("+Math.max(1,f.value.length)+", minmax(0, 1fr))"})),m=De(()=>(n.value-e.startHour*60)/60*e.hourHeight),h=De(()=>n.value>=e.startHour*60&&n.value<=e.endHour*60&&f.value.some(v=>v.today)),b=De(()=>{let v=f.value;if(!v.length)return"";let T=v[0],D=v[v.length-1];return`${T.month}\u6708${T.day}\u65E5 - ${D.month}\u6708${D.day}\u65E5`});function j(v){let T=r.value,D=new Date(T.getFullYear(),T.getMonth(),T.getDate()+v*7);l.value=pa(D),t("update:modelValue",l.value),t("week-change",l.value)}function w(){l.value=a,t("update:modelValue",a),t("week-change",a)}function y(v,T){t("event-click",v.item,T.key)}function u(v,T){let D=v.currentTarget.getBoundingClientRect(),x=(v.clientY-D.top)/D.height,z=e.startHour*60+Math.round(x*(e.endHour-e.startHour)*60/30)*30,S=Math.floor(z/60),M=z%60;t("slot-click",{date:T.key,time:`${Rt(S)}:${Rt(M)}`})}return ss(()=>window.clearInterval(i)),{days:f,hours:c,bodyHeight:p,gridStyle:g,nowTop:m,showNowLine:h,rangeLabel:b,shiftWeek:j,goToday:w,onBlockClick:y,onSlotClick:u,t:C}},template:`
|
|
3602
|
+
<div class="djm-schedule">
|
|
3603
|
+
<header class="djm-schedule-bar">
|
|
3604
|
+
<span class="djm-schedule-title">{{ title || t('schedule.title') }}</span>
|
|
3605
|
+
<span class="djm-schedule-range">{{ rangeLabel }}</span>
|
|
3606
|
+
<span class="djm-schedule-navs">
|
|
3607
|
+
<button class="djm-schedule-nav" type="button" :aria-label="t('schedule.prevWeek')" @click="shiftWeek(-1)">
|
|
3608
|
+
<DjmIcon name="chevron-left" :size="14" />
|
|
3609
|
+
</button>
|
|
3610
|
+
<button class="djm-link-btn" type="button" @click="goToday">{{ t('schedule.today') }}</button>
|
|
3611
|
+
<button class="djm-schedule-nav" type="button" :aria-label="t('schedule.nextWeek')" @click="shiftWeek(1)">
|
|
3612
|
+
<DjmIcon name="chevron-right" :size="14" />
|
|
3613
|
+
</button>
|
|
3614
|
+
</span>
|
|
3615
|
+
</header>
|
|
3616
|
+
|
|
3617
|
+
<div class="djm-schedule-scroll">
|
|
3618
|
+
<div class="djm-schedule-head" :style="gridStyle">
|
|
3619
|
+
<span class="djm-schedule-gutter"></span>
|
|
3620
|
+
<div
|
|
3621
|
+
v-for="day in days"
|
|
3622
|
+
:key="day.key"
|
|
3623
|
+
class="djm-schedule-day"
|
|
3624
|
+
:class="{ 'djm-is-today': day.today }"
|
|
3625
|
+
>
|
|
3626
|
+
<span class="djm-schedule-weekday">{{ day.weekday }}</span>
|
|
3627
|
+
<span class="djm-schedule-date">{{ day.day }}</span>
|
|
3628
|
+
</div>
|
|
3629
|
+
</div>
|
|
3630
|
+
|
|
3631
|
+
<div class="djm-schedule-body" :style="[gridStyle, { height: bodyHeight + 'px' }]">
|
|
3632
|
+
<div class="djm-schedule-gutter">
|
|
3633
|
+
<span
|
|
3634
|
+
v-for="hour in hours"
|
|
3635
|
+
:key="hour"
|
|
3636
|
+
class="djm-schedule-hour"
|
|
3637
|
+
:style="{ height: hourHeight + 'px' }"
|
|
3638
|
+
>{{ String(hour).padStart(2, '0') }}:00</span>
|
|
3639
|
+
</div>
|
|
3640
|
+
|
|
3641
|
+
<div
|
|
3642
|
+
v-for="day in days"
|
|
3643
|
+
:key="day.key"
|
|
3644
|
+
class="djm-schedule-col"
|
|
3645
|
+
:class="{ 'djm-is-today': day.today, 'djm-is-weekend': day.weekend }"
|
|
3646
|
+
@click="onSlotClick($event, day)"
|
|
3647
|
+
>
|
|
3648
|
+
<span
|
|
3649
|
+
v-for="hour in hours"
|
|
3650
|
+
:key="hour"
|
|
3651
|
+
class="djm-schedule-line"
|
|
3652
|
+
:style="{ height: hourHeight + 'px' }"
|
|
3653
|
+
></span>
|
|
3654
|
+
|
|
3655
|
+
<button
|
|
3656
|
+
v-for="block in day.blocks"
|
|
3657
|
+
:key="block.key"
|
|
3658
|
+
class="djm-schedule-event"
|
|
3659
|
+
:class="block.item.color ? 'djm-schedule-event-' + block.item.color : ''"
|
|
3660
|
+
type="button"
|
|
3661
|
+
:style="{ top: block.top + 'px', height: block.height + 'px', left: block.left + '%', width: 'calc(' + block.width + '% - 4px)' }"
|
|
3662
|
+
:title="block.item.title"
|
|
3663
|
+
@click.stop="onBlockClick(block, day)"
|
|
3664
|
+
>
|
|
3665
|
+
<span class="djm-schedule-event-title">{{ block.item.title }}</span>
|
|
3666
|
+
<span v-if="block.height > 40" class="djm-schedule-event-time">
|
|
3667
|
+
{{ block.item.start }}<template v-if="block.item.end"> - {{ block.item.end }}</template>
|
|
3668
|
+
</span>
|
|
3669
|
+
</button>
|
|
3670
|
+
|
|
3671
|
+
<span
|
|
3672
|
+
v-if="day.today && showNowLine"
|
|
3673
|
+
class="djm-schedule-now"
|
|
3674
|
+
:style="{ top: nowTop + 'px' }"
|
|
3675
|
+
aria-hidden="true"
|
|
3676
|
+
></span>
|
|
3677
|
+
</div>
|
|
3678
|
+
</div>
|
|
3679
|
+
</div>
|
|
3680
|
+
</div>
|
|
3681
|
+
`};import{ref as Vi,computed as at}from"vue";var Hi={name:"DjmComment",components:{DjmAvatar:me,DjmIcon:L},props:{list:{type:Array,default:()=>[]},maxLength:{type:Number,default:500},placeholder:{type:String,default:""},submitText:{type:String,default:""},removable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},emptyText:{type:String,default:""}},emits:["submit","reply","remove"],setup(e,{emit:t}){let a=Vi(""),n=Vi(null),i=at(()=>n.value?C("comment.replyPlaceholder",{name:n.value.author}):e.placeholder||C("comment.placeholder")),l=at(()=>e.submitText||C("comment.submit")),o=at(()=>e.emptyText||C("comment.empty")),r=at(()=>a.value.length>e.maxLength),s=at(()=>a.value.trim().length>0&&!r.value&&!e.disabled&&!e.loading);function d(m){a.value=m.target.value}function f(){s.value&&(t("submit",a.value.trim(),n.value),a.value="",n.value=null)}function c(m){n.value=m,t("reply",m)}function p(){n.value=null}function g(m){t("remove",m)}return{content:a,replyTarget:n,placeholderText:i,submitLabel:l,emptyLabel:o,overLimit:r,canSubmit:s,onInput:d,submit:f,startReply:c,cancelReply:p,remove:g,t:C}},template:`
|
|
3682
|
+
<div class="djm-comment">
|
|
3683
|
+
<div v-if="!list.length" class="djm-comment-empty">{{ emptyLabel }}</div>
|
|
3684
|
+
|
|
3685
|
+
<ul v-else class="djm-comment-list">
|
|
3686
|
+
<li v-for="item in list" :key="item.id" class="djm-comment-item">
|
|
3687
|
+
<DjmAvatar :src="item.avatar || ''" :text="item.author" size="sm" />
|
|
3688
|
+
<div class="djm-comment-main">
|
|
3689
|
+
<div class="djm-comment-head">
|
|
3690
|
+
<strong class="djm-comment-author">{{ item.author }}</strong>
|
|
3691
|
+
<time v-if="item.time" class="djm-comment-time">{{ item.time }}</time>
|
|
3692
|
+
</div>
|
|
3693
|
+
<p class="djm-comment-content">{{ item.content }}</p>
|
|
3694
|
+
<div class="djm-comment-actions">
|
|
3695
|
+
<button class="djm-link-btn" type="button" :disabled="disabled" @click="startReply(item)">
|
|
3696
|
+
{{ t('comment.reply') }}
|
|
3697
|
+
</button>
|
|
3698
|
+
<button v-if="removable" class="djm-link-btn djm-danger" type="button" :disabled="disabled" @click="remove(item)">
|
|
3699
|
+
{{ t('comment.remove') }}
|
|
3700
|
+
</button>
|
|
3701
|
+
</div>
|
|
3702
|
+
|
|
3703
|
+
<!-- \u4E00\u7EA7\u56DE\u590D\uFF1A\u7F29\u8FDB\u5C55\u793A\uFF0C\u4E0D\u518D\u7EE7\u7EED\u5D4C\u5957 -->
|
|
3704
|
+
<ul v-if="item.children && item.children.length" class="djm-comment-replies">
|
|
3705
|
+
<li v-for="child in item.children" :key="child.id" class="djm-comment-reply">
|
|
3706
|
+
<DjmAvatar :src="child.avatar || ''" :text="child.author" size="sm" />
|
|
3707
|
+
<div class="djm-comment-main">
|
|
3708
|
+
<div class="djm-comment-head">
|
|
3709
|
+
<strong class="djm-comment-author">{{ child.author }}</strong>
|
|
3710
|
+
<time v-if="child.time" class="djm-comment-time">{{ child.time }}</time>
|
|
3711
|
+
</div>
|
|
3712
|
+
<p class="djm-comment-content">{{ child.content }}</p>
|
|
3713
|
+
</div>
|
|
3714
|
+
</li>
|
|
3715
|
+
</ul>
|
|
3716
|
+
</div>
|
|
3717
|
+
</li>
|
|
3718
|
+
</ul>
|
|
3719
|
+
|
|
3720
|
+
<div class="djm-comment-editor">
|
|
3721
|
+
<div v-if="replyTarget" class="djm-comment-replying">
|
|
3722
|
+
<span>{{ t('comment.replyingTo', { name: replyTarget.author }) }}</span>
|
|
3723
|
+
<button class="djm-comment-cancel" type="button" :aria-label="t('comment.cancelReply')" @click="cancelReply">
|
|
3724
|
+
<DjmIcon name="x" :size="12" />
|
|
3725
|
+
</button>
|
|
3726
|
+
</div>
|
|
3727
|
+
<textarea
|
|
3728
|
+
class="djm-comment-input"
|
|
3729
|
+
rows="3"
|
|
3730
|
+
:value="content"
|
|
3731
|
+
:placeholder="placeholderText"
|
|
3732
|
+
:disabled="disabled"
|
|
3733
|
+
:aria-label="placeholderText"
|
|
3734
|
+
@input="onInput"
|
|
3735
|
+
></textarea>
|
|
3736
|
+
<div class="djm-comment-foot">
|
|
3737
|
+
<span class="djm-comment-count" :class="{ 'djm-is-over': overLimit }">
|
|
3738
|
+
{{ content.length }}/{{ maxLength }}
|
|
3739
|
+
</span>
|
|
3740
|
+
<button class="djm-btn djm-btn-primary" type="button" :disabled="!canSubmit" @click="submit">
|
|
3741
|
+
{{ loading ? t('comment.submitting') : submitLabel }}
|
|
3742
|
+
</button>
|
|
3743
|
+
</div>
|
|
3744
|
+
</div>
|
|
3745
|
+
</div>
|
|
3746
|
+
`};import{ref as Vt,onMounted as cs,onBeforeUnmount as us,watch as ms}from"vue";var Oi={name:"DjmSignature",props:{modelValue:{type:String,default:""},height:{type:Number,default:180},lineWidth:{type:Number,default:2.4},color:{type:String,default:""},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:""}},emits:["update:modelValue","change","start","end","clear"],setup(e,{emit:t}){let a=Vt(null),n=Vt(null),i=Vt([]),l=Vt(!1),o=null,r=!1,s=null,d=e.modelValue,f=null;function c(){return a.value?a.value.getContext("2d"):null}function p(){return e.color?e.color:getComputedStyle(document.documentElement).getPropertyValue("--djm-text").trim()||"#1e2b3a"}function g(x){x.lineWidth=e.lineWidth,x.lineCap="round",x.lineJoin="round",x.strokeStyle=p()}function m(){let x=a.value;if(!x)return;let z=x.parentElement?x.parentElement.clientWidth:x.clientWidth,S=window.devicePixelRatio||1;x.width=Math.max(1,Math.round(z*S)),x.height=Math.max(1,Math.round(e.height*S)),x.style.width="100%",x.style.height=e.height+"px";let M=c();M.setTransform(S,0,0,S,0,0),g(M),h()}function h(){let x=c();if(!x)return;let z=a.value.width/(window.devicePixelRatio||1);x.clearRect(0,0,z,e.height),o&&x.drawImage(o,0,0,z,e.height),g(x),i.value.forEach(S=>{if(S.length<2){x.beginPath(),x.arc(S[0].x,S[0].y,e.lineWidth/2,0,Math.PI*2),x.fillStyle=p(),x.fill();return}x.beginPath(),x.moveTo(S[0].x,S[0].y);for(let M=1;M<S.length;M++)x.lineTo(S[M].x,S[M].y);x.stroke()})}function b(x){let z=a.value.getBoundingClientRect();return{x:x.clientX-z.left,y:x.clientY-z.top}}function j(x){if(!e.disabled){x.preventDefault(),r=!0,o=null,l.value=!1,s=[b(x)],i.value=i.value.concat([s]);try{a.value.setPointerCapture&&a.value.setPointerCapture(x.pointerId)}catch{}t("start")}}function w(x){if(!r||!s)return;x.preventDefault();let z=b(x),S=c(),M=s[s.length-1];S.beginPath(),S.moveTo(M.x,M.y),S.lineTo(z.x,z.y),S.stroke(),s.push(z)}function y(){r&&(r=!1,s=null,u(),t("end"))}function u(){if(!a.value)return;let x=i.value.length?a.value.toDataURL("image/png"):"";d=x,t("update:modelValue",x),t("change",x)}function v(){i.value=[],o=null,l.value=!1;let x=c(),z=a.value.width/(window.devicePixelRatio||1);x&&x.clearRect(0,0,z,e.height),d="",t("update:modelValue",""),t("change",""),t("clear")}function T(){return a.value?a.value.toDataURL("image/png"):""}let D=()=>i.value.length===0&&!l.value;return ms(()=>e.modelValue,x=>{if(x===d)return;if(d=x||"",!x){i.value=[],o=null,l.value=!1,h();return}let z=new Image;z.onload=()=>{o=z,l.value=!0,i.value=[],h()},z.src=x}),cs(()=>{if(m(),e.modelValue){let x=new Image;x.onload=()=>{o=x,l.value=!0,h()},x.src=e.modelValue}window.ResizeObserver&&(f=new ResizeObserver(()=>m()),n.value&&f.observe(n.value))}),us(()=>{f&&f.disconnect()}),{canvas:a,root:n,isEmpty:D,clear:v,onPointerDown:j,onPointerMove:w,onPointerUp:y,t:C}},expose:["clear","toDataURL","isEmpty"],template:`
|
|
3747
|
+
<div class="djm-signature" ref="root" :class="{ 'djm-is-disabled': disabled }">
|
|
3748
|
+
<div class="djm-signature-canvas-wrap">
|
|
3749
|
+
<canvas
|
|
3750
|
+
class="djm-signature-canvas"
|
|
3751
|
+
ref="canvas"
|
|
3752
|
+
role="img"
|
|
3753
|
+
:aria-label="t('signature.label')"
|
|
3754
|
+
@pointerdown="onPointerDown"
|
|
3755
|
+
@pointermove="onPointerMove"
|
|
3756
|
+
@pointerup="onPointerUp"
|
|
3757
|
+
@pointerleave="onPointerUp"
|
|
3758
|
+
></canvas>
|
|
3759
|
+
<span v-if="isEmpty()" class="djm-signature-hint">{{ placeholder || t('signature.hint') }}</span>
|
|
3760
|
+
</div>
|
|
3761
|
+
<div class="djm-signature-foot">
|
|
3762
|
+
<button class="djm-btn djm-btn-sm" type="button" :disabled="disabled" @click="clear">
|
|
3763
|
+
{{ t('signature.clear') }}
|
|
3764
|
+
</button>
|
|
3765
|
+
</div>
|
|
3766
|
+
</div>
|
|
3767
|
+
`};import{ref as fs,computed as ps}from"vue";function $i(e){return String(e).replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t])}var Fi={name:"DjmPrint",components:{DjmIcon:L},props:{title:{type:String,default:""},showButton:{type:Boolean,default:!0},buttonText:{type:String,default:""},landscape:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["before-print","after-print"],setup(e,{emit:t}){let a=fs(null),n=ps(()=>e.buttonText||C("print.button"));function i(){return Array.from(document.querySelectorAll('link[rel="stylesheet"], style')).map(o=>o.outerHTML).join("")}function l(){if(e.disabled||!a.value)return;t("before-print");let o=document.createElement("iframe");o.setAttribute("aria-hidden","true"),o.style.cssText="position:fixed;right:0;bottom:0;width:0;height:0;border:0;",document.body.appendChild(o);let r=o.contentWindow.document,s=e.title?`<h1 class="djm-print-heading">${$i(e.title)}</h1>`:"";r.open(),r.write(`<!doctype html><html><head><meta charset="utf-8"><title>${$i(e.title||document.title)}</title>`+i()+`<style>@page { size: ${e.landscape?"A4 landscape":"A4 portrait"}; margin: 12mm; }html, body { background: #fff; margin: 0; padding: 0; }body { color: #000; font-size: 12px; }.djm-print-toolbar, .djm-no-print { display: none !important; }.djm-print-heading { margin: 0 0 12px; font-size: 17px; font-weight: 600; text-align: center; }table { page-break-inside: auto; } tr, img { page-break-inside: avoid; } thead { display: table-header-group; }</style></head><body><div class="djm-print-stage">`+s+a.value.innerHTML+"</div></body></html>"),r.close(),window.setTimeout(()=>{try{o.contentWindow.focus(),o.contentWindow.print()}finally{window.setTimeout(()=>{o.remove(),t("after-print")},300)}},120)}return{content:a,label:n,print:l,t:C}},expose:["print"],template:`
|
|
3768
|
+
<div class="djm-print">
|
|
3769
|
+
<div v-if="showButton" class="djm-print-actions djm-print-toolbar">
|
|
3770
|
+
<button class="djm-btn" type="button" :disabled="disabled" @click="print">
|
|
3771
|
+
<DjmIcon name="printer" :size="14" />{{ label }}
|
|
3772
|
+
</button>
|
|
3773
|
+
<slot name="actions"></slot>
|
|
3774
|
+
</div>
|
|
3775
|
+
<div class="djm-print-content" ref="content">
|
|
3776
|
+
<slot></slot>
|
|
3777
|
+
</div>
|
|
3778
|
+
</div>
|
|
3779
|
+
`};import{computed as Re}from"vue";var hs=864e5,Ki=e=>String(e).padStart(2,"0");function Ot(e){let t=String(e||"").split("-").map(Number);return t.length!==3||t.some(a=>!Number.isFinite(a))?null:new Date(t[0],t[1]-1,t[2])}function ha(e){return`${e.getFullYear()}-${Ki(e.getMonth()+1)}-${Ki(e.getDate())}`}function Ht(e,t){let a=Ot(e),n=Ot(t);return!a||!n?0:Math.round((a.getTime()-n.getTime())/hs)}var Wi={name:"DjmGantt",props:{tasks:{type:Array,default:()=>[]},nameWidth:{type:Number,default:168},dayWidth:{type:Number,default:36},rowHeight:{type:Number,default:40},startDate:{type:String,default:""},endDate:{type:String,default:""},minDays:{type:Number,default:14},showToday:{type:Boolean,default:!0},emptyText:{type:String,default:""}},emits:["task-click"],setup(e,{emit:t}){let a=ha(new Date),n=Re(()=>{let c=e.tasks.map(b=>b.start).filter(Boolean).sort(),p=e.tasks.map(b=>b.end||b.start).filter(Boolean).sort(),g=e.startDate||c[0]||a,m=e.endDate||p[p.length-1]||g;if(m<g&&(m=g),Ht(m,g)+1<e.minDays){let b=Ot(g);m=ha(new Date(b.getFullYear(),b.getMonth(),b.getDate()+e.minDays-1))}return{start:g,end:m}}),i=Re(()=>{let c=Ht(n.value.end,n.value.start)+1,p=Ot(n.value.start);return Array.from({length:c},(g,m)=>{let h=new Date(p.getFullYear(),p.getMonth(),p.getDate()+m),b=ha(h);return{key:b,day:h.getDate(),month:h.getMonth()+1,monthStart:m===0||h.getDate()===1,today:b===a,weekend:h.getDay()===0||h.getDay()===6}})}),l=Re(()=>i.value.length*e.dayWidth),o=Re(()=>e.nameWidth+l.value),r=Re(()=>e.tasks.map((c,p)=>{let g=c.start||n.value.start,m=c.end||g,h=Math.max(0,Ht(g,n.value.start)),b=Math.max(1,Ht(m,g)+1),j=Math.min(100,Math.max(0,Number(c.progress)||0));return{task:c,key:c.id!==void 0?c.id:p,left:h*e.dayWidth,width:b*e.dayWidth,progress:j}})),s=Re(()=>{let c=i.value.findIndex(p=>p.today);return c===-1?null:e.nameWidth+c*e.dayWidth+e.dayWidth/2}),d=Re(()=>e.emptyText||C("gantt.empty"));function f(c){t("task-click",c.task)}return{days:i,bars:r,trackWidth:l,innerWidth:o,todayLeft:s,emptyLabel:d,onClick:f,t:C}},template:`
|
|
3780
|
+
<div class="djm-gantt">
|
|
3781
|
+
<div class="djm-gantt-scroll">
|
|
3782
|
+
<div class="djm-gantt-inner" :style="{ width: innerWidth + 'px' }">
|
|
3783
|
+
<div class="djm-gantt-head">
|
|
3784
|
+
<div class="djm-gantt-th-name" :style="{ width: nameWidth + 'px' }">{{ t('gantt.task') }}</div>
|
|
3785
|
+
<div
|
|
3786
|
+
v-for="day in days"
|
|
3787
|
+
:key="day.key"
|
|
3788
|
+
class="djm-gantt-th-day"
|
|
3789
|
+
:class="{ 'djm-is-today': day.today, 'djm-is-weekend': day.weekend }"
|
|
3790
|
+
:style="{ width: dayWidth + 'px' }"
|
|
3791
|
+
>
|
|
3792
|
+
<span v-if="day.monthStart" class="djm-gantt-month">{{ day.month }}\u6708</span>
|
|
3793
|
+
<span class="djm-gantt-date">{{ day.day }}</span>
|
|
3794
|
+
</div>
|
|
3795
|
+
</div>
|
|
3796
|
+
|
|
3797
|
+
<div v-if="!tasks.length" class="djm-gantt-empty">{{ emptyLabel }}</div>
|
|
3798
|
+
|
|
3799
|
+
<div
|
|
3800
|
+
v-for="bar in bars"
|
|
3801
|
+
:key="bar.key"
|
|
3802
|
+
class="djm-gantt-row"
|
|
3803
|
+
:style="{ height: rowHeight + 'px' }"
|
|
3804
|
+
>
|
|
3805
|
+
<div class="djm-gantt-td-name" :style="{ width: nameWidth + 'px' }" :title="bar.task.title">
|
|
3806
|
+
{{ bar.task.title }}
|
|
3807
|
+
</div>
|
|
3808
|
+
<div class="djm-gantt-track" :style="{ width: trackWidth + 'px' }">
|
|
3809
|
+
<span
|
|
3810
|
+
v-for="day in days"
|
|
3811
|
+
:key="day.key"
|
|
3812
|
+
class="djm-gantt-cell"
|
|
3813
|
+
:class="{ 'djm-is-today': day.today, 'djm-is-weekend': day.weekend }"
|
|
3814
|
+
:style="{ width: dayWidth + 'px' }"
|
|
3815
|
+
></span>
|
|
3816
|
+
<button
|
|
3817
|
+
class="djm-gantt-bar"
|
|
3818
|
+
:class="bar.task.color ? 'djm-gantt-bar-' + bar.task.color : ''"
|
|
3819
|
+
type="button"
|
|
3820
|
+
:style="{ left: bar.left + 'px', width: bar.width + 'px', top: (rowHeight - 22) / 2 + 'px' }"
|
|
3821
|
+
:title="bar.task.title + ' ' + bar.progress + '%'"
|
|
3822
|
+
@click="onClick(bar)"
|
|
3823
|
+
>
|
|
3824
|
+
<span class="djm-gantt-bar-progress" :style="{ width: bar.progress + '%' }"></span>
|
|
3825
|
+
<span class="djm-gantt-bar-text">
|
|
3826
|
+
<span class="djm-gantt-bar-title">{{ bar.task.title }}</span>
|
|
3827
|
+
<span v-if="bar.width >= 90" class="djm-gantt-bar-pct">{{ bar.progress }}%</span>
|
|
3828
|
+
</span>
|
|
3829
|
+
</button>
|
|
3830
|
+
</div>
|
|
3831
|
+
</div>
|
|
3832
|
+
|
|
3833
|
+
<span
|
|
3834
|
+
v-if="showToday && todayLeft !== null && tasks.length"
|
|
3835
|
+
class="djm-gantt-today"
|
|
3836
|
+
:style="{ left: todayLeft + 'px' }"
|
|
3837
|
+
aria-hidden="true"
|
|
3838
|
+
></span>
|
|
3839
|
+
</div>
|
|
3840
|
+
</div>
|
|
3841
|
+
</div>
|
|
3842
|
+
`};import{ref as Ui,computed as $t,watch as vs}from"vue";var gs=0,qi={name:"DjmFieldList",components:{DjmIcon:L},props:{modelValue:{type:Array,default:()=>[]},fields:{type:Array,default:()=>[]},addText:{type:String,default:""},min:{type:Number,default:0},max:{type:Number,default:0},defaultItem:{type:Object,default:null},showIndex:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},emptyText:{type:String,default:""}},emits:["update:modelValue","add","remove","change"],setup(e,{emit:t}){let a=Ui([]);function n(){let w=e.modelValue.length;if(a.value.length===w)return;let y=a.value.slice(0,w);for(;y.length<w;)y.push(++gs);a.value=y}n(),vs(()=>e.modelValue.length,n);let i=Ui({}),l=$t(()=>e.addText||C("fieldList.add")),o=$t(()=>e.emptyText||C("fieldList.empty")),r=$t(()=>!e.disabled&&(!e.max||e.modelValue.length<e.max)),s=$t(()=>!e.disabled&&e.modelValue.length>e.min);function d(w){t("update:modelValue",w),t("change",w)}function f(w,y,u){let v=e.modelValue.map((D,x)=>x===w?{...D,[y]:u}:D);d(v);let T=a.value[w];if(i.value[T]&&i.value[T][y]){let D={...i.value[T]};delete D[y],i.value={...i.value,[T]:D}}}function c(w,y,u){let v=u.target.value;if(y.type!=="number"){f(w,y.key,v);return}let T=Number(v);f(w,y.key,v===""||!Number.isFinite(T)?v:T)}function p(){if(!r.value)return;let w=e.defaultItem?{...e.defaultItem}:{};d(e.modelValue.concat([w])),t("add",w)}function g(w){if(!s.value)return;let y=e.modelValue.slice(),[u]=y.splice(w,1);d(y),t("remove",u,w)}function m(w,y){if(!y.required)return;let v=(e.modelValue[w]||{})[y.key];if(!(v===""||v===void 0||v===null))return;let D=a.value[w];i.value={...i.value,[D]:{...i.value[D]||{},[y.key]:C("fieldList.required",{label:y.label||y.key})}}}function h(w,y){let u=a.value[w];return i.value[u]&&i.value[u][y.key]||""}function b(){let w={};return e.modelValue.forEach((y,u)=>{let v=a.value[u],T={};e.fields.forEach(D=>{if(!D.required)return;let x=y[D.key];(x===""||x===void 0||x===null)&&(T[D.key]=C("fieldList.required",{label:D.label||D.key}))}),Object.keys(T).length&&(w[v]=T)}),i.value=w,Object.keys(w).length===0}function j(w,y){let u=w[y];return u??""}return{uids:a,errors:i,addLabel:l,emptyLabel:o,canAdd:r,canRemove:s,add:p,remove:g,onInput:c,onBlur:m,errorOf:h,validate:b,valueOf:j,t:C}},expose:["validate"],template:`
|
|
3843
|
+
<div class="djm-field-list">
|
|
3844
|
+
<div v-if="!modelValue.length" class="djm-field-list-empty">{{ emptyLabel }}</div>
|
|
3845
|
+
|
|
3846
|
+
<div v-for="(row, index) in modelValue" :key="uids[index]" class="djm-field-list-row">
|
|
3847
|
+
<span v-if="showIndex" class="djm-field-list-index">{{ index + 1 }}</span>
|
|
3848
|
+
|
|
3849
|
+
<div
|
|
3850
|
+
v-for="field in fields"
|
|
3851
|
+
:key="field.key"
|
|
3852
|
+
class="djm-field-list-item"
|
|
3853
|
+
:style="{ width: field.width ? field.width + 'px' : undefined, flex: field.width ? 'none' : '1 1 0' }"
|
|
3854
|
+
>
|
|
3855
|
+
<label class="djm-field-list-label" :for="'djm-fl-' + uids[index] + '-' + field.key">
|
|
3856
|
+
{{ field.label || field.key }}
|
|
3857
|
+
<span v-if="field.required" class="djm-field-list-required" aria-hidden="true">*</span>
|
|
3858
|
+
</label>
|
|
3859
|
+
|
|
3860
|
+
<select
|
|
3861
|
+
v-if="field.type === 'select'"
|
|
3862
|
+
class="djm-field-list-control"
|
|
3863
|
+
:class="{ 'djm-is-error': !!errorOf(index, field) }"
|
|
3864
|
+
:id="'djm-fl-' + uids[index] + '-' + field.key"
|
|
3865
|
+
:value="valueOf(row, field.key)"
|
|
3866
|
+
:disabled="disabled"
|
|
3867
|
+
@change="onInput(index, field, $event)"
|
|
3868
|
+
@blur="onBlur(index, field)"
|
|
3869
|
+
>
|
|
3870
|
+
<option value="">{{ field.placeholder || t('fieldList.select') }}</option>
|
|
3871
|
+
<option v-for="opt in (field.options || [])" :key="opt.value !== undefined ? opt.value : opt" :value="opt.value !== undefined ? opt.value : opt">
|
|
3872
|
+
{{ opt.label !== undefined ? opt.label : opt }}
|
|
3873
|
+
</option>
|
|
3874
|
+
</select>
|
|
3875
|
+
|
|
3876
|
+
<input
|
|
3877
|
+
v-else
|
|
3878
|
+
class="djm-field-list-control"
|
|
3879
|
+
autocomplete="off"
|
|
3880
|
+
:class="{ 'djm-is-error': !!errorOf(index, field) }"
|
|
3881
|
+
:id="'djm-fl-' + uids[index] + '-' + field.key"
|
|
3882
|
+
:type="field.type === 'number' ? 'number' : (field.type === 'date' ? 'date' : 'text')"
|
|
3883
|
+
:value="valueOf(row, field.key)"
|
|
3884
|
+
:placeholder="field.placeholder || ''"
|
|
3885
|
+
:disabled="disabled"
|
|
3886
|
+
@input="onInput(index, field, $event)"
|
|
3887
|
+
@blur="onBlur(index, field)"
|
|
3888
|
+
/>
|
|
3889
|
+
|
|
3890
|
+
<span v-if="errorOf(index, field)" class="djm-field-list-error">{{ errorOf(index, field) }}</span>
|
|
3891
|
+
</div>
|
|
3892
|
+
|
|
3893
|
+
<button
|
|
3894
|
+
class="djm-field-list-remove"
|
|
3895
|
+
type="button"
|
|
3896
|
+
:disabled="!canRemove"
|
|
3897
|
+
:aria-label="t('fieldList.remove')"
|
|
3898
|
+
@click="remove(index)"
|
|
3899
|
+
>
|
|
3900
|
+
<DjmIcon name="trash" :size="14" />
|
|
3901
|
+
</button>
|
|
3902
|
+
</div>
|
|
3903
|
+
|
|
3904
|
+
<button v-if="canAdd" class="djm-field-list-add" type="button" @click="add">
|
|
3905
|
+
<DjmIcon name="plus" :size="14" />{{ addLabel }}
|
|
3906
|
+
</button>
|
|
3907
|
+
</div>
|
|
3908
|
+
`};import{ref as _i,computed as Ft,watch as ys,nextTick as bs}from"vue";var Yi={name:"DjmChat",components:{DjmAvatar:me},props:{messages:{type:Array,default:()=>[]},placeholder:{type:String,default:""},sendText:{type:String,default:""},readonly:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},height:{type:[Number,String],default:360},emptyText:{type:String,default:""}},emits:["submit"],setup(e,{emit:t}){let a=_i(""),n=_i(null),i=Ft(()=>e.placeholder||C("chat.placeholder")),l=Ft(()=>e.sendText||C("chat.send")),o=Ft(()=>e.emptyText||C("chat.empty")),r=Ft(()=>a.value.trim().length>0&&!e.disabled&&!e.loading);function s(){let g=n.value;g&&(g.scrollTop=g.scrollHeight)}ys(()=>e.messages.length,()=>bs(s));function d(g){a.value=g.target.value}function f(){r.value&&(t("submit",a.value.trim()),a.value="")}function c(g){g.key!=="Enter"||g.shiftKey||(g.preventDefault(),f())}function p(g){return g.from==="me"}return{content:a,listRef:n,placeholderText:i,sendLabel:l,emptyLabel:o,canSend:r,onInput:d,onKeydown:c,submit:f,isSelf:p,t:C}},mounted(){this.listRef.scrollTop=this.listRef.scrollHeight},template:`
|
|
3909
|
+
<div class="djm-chat">
|
|
3910
|
+
<div
|
|
3911
|
+
class="djm-chat-list"
|
|
3912
|
+
ref="listRef"
|
|
3913
|
+
:style="{ height: typeof height === 'number' ? height + 'px' : height }"
|
|
3914
|
+
tabindex="0"
|
|
3915
|
+
role="log"
|
|
3916
|
+
:aria-label="t('chat.label')"
|
|
3917
|
+
>
|
|
3918
|
+
<p v-if="!messages.length" class="djm-chat-empty">{{ emptyLabel }}</p>
|
|
3919
|
+
|
|
3920
|
+
<div
|
|
3921
|
+
v-for="message in messages"
|
|
3922
|
+
:key="message.id"
|
|
3923
|
+
class="djm-chat-line"
|
|
3924
|
+
:class="{
|
|
3925
|
+
'djm-is-self': isSelf(message) && message.type !== 'system',
|
|
3926
|
+
'djm-is-system': message.type === 'system'
|
|
3927
|
+
}"
|
|
3928
|
+
>
|
|
3929
|
+
<template v-if="message.type === 'system'">
|
|
3930
|
+
<span class="djm-chat-system">{{ message.content }}</span>
|
|
3931
|
+
</template>
|
|
3932
|
+
|
|
3933
|
+
<template v-else>
|
|
3934
|
+
<DjmAvatar
|
|
3935
|
+
v-if="!isSelf(message)"
|
|
3936
|
+
class="djm-chat-avatar"
|
|
3937
|
+
:src="message.avatar || ''"
|
|
3938
|
+
:text="message.name || ''"
|
|
3939
|
+
size="sm"
|
|
3940
|
+
/>
|
|
3941
|
+
<div class="djm-chat-body">
|
|
3942
|
+
<div v-if="!isSelf(message) && message.name" class="djm-chat-name">{{ message.name }}</div>
|
|
3943
|
+
<div class="djm-chat-bubble" :class="{ 'djm-is-image': message.type === 'image' }">
|
|
3944
|
+
<img v-if="message.type === 'image'" :src="message.content" :alt="t('chat.image')" />
|
|
3945
|
+
<template v-else>{{ message.content }}</template>
|
|
3946
|
+
</div>
|
|
3947
|
+
<div class="djm-chat-meta">
|
|
3948
|
+
<span v-if="message.time" class="djm-chat-time">{{ message.time }}</span>
|
|
3949
|
+
<span v-if="message.status === 'sending'" class="djm-chat-status">{{ t('chat.sending') }}</span>
|
|
3950
|
+
<span v-else-if="message.status === 'failed'" class="djm-chat-status djm-is-failed">{{ t('chat.failed') }}</span>
|
|
3951
|
+
</div>
|
|
3952
|
+
</div>
|
|
3953
|
+
<DjmAvatar
|
|
3954
|
+
v-if="isSelf(message)"
|
|
3955
|
+
class="djm-chat-avatar"
|
|
3956
|
+
:src="message.avatar || ''"
|
|
3957
|
+
:text="message.name || t('chat.me')"
|
|
3958
|
+
size="sm"
|
|
3959
|
+
/>
|
|
3960
|
+
</template>
|
|
3961
|
+
</div>
|
|
3962
|
+
</div>
|
|
3963
|
+
|
|
3964
|
+
<div v-if="!readonly" class="djm-chat-editor">
|
|
3965
|
+
<textarea
|
|
3966
|
+
class="djm-chat-input"
|
|
3967
|
+
rows="2"
|
|
3968
|
+
:value="content"
|
|
3969
|
+
:placeholder="placeholderText"
|
|
3970
|
+
:disabled="disabled"
|
|
3971
|
+
:aria-label="placeholderText"
|
|
3972
|
+
@input="onInput"
|
|
3973
|
+
@keydown="onKeydown"
|
|
3974
|
+
></textarea>
|
|
3975
|
+
<button class="djm-btn djm-btn-primary" type="button" :disabled="!canSend" @click="submit">
|
|
3976
|
+
{{ loading ? t('chat.sending') : sendLabel }}
|
|
3977
|
+
</button>
|
|
3978
|
+
</div>
|
|
3979
|
+
</div>
|
|
3980
|
+
`};import{ref as ws,computed as Gi,watch as js}from"vue";var Ji={name:"DjmOrgChart",components:{DjmAvatar:me,DjmIcon:L},props:{data:{type:Object,default:null},nodeWidth:{type:Number,default:168},nodeHeight:{type:Number,default:68},gap:{type:Number,default:20},verticalGap:{type:Number,default:40},collapsible:{type:Boolean,default:!0},defaultExpandAll:{type:Boolean,default:!0},emptyText:{type:String,default:""}},emits:["node-click"],setup(e,{emit:t}){function a(f){return f&&f.id!==void 0?f.id:f?f.name:""}function n(f){let c=[];function p(g){let m=g&&g.children||[];m.length&&(c.push(a(g)),m.forEach(p))}return p(f),c}let i=ws(e.defaultExpandAll?[]:n(e.data));js(()=>e.data,f=>{i.value=e.defaultExpandAll?[]:n(f)});let l=Gi(()=>{if(!e.data)return{nodes:[],links:[],width:0,height:0};let f=e.nodeHeight+e.verticalGap,c=0;function p(w,y){let u=a(w),v=w.children||[],T=e.collapsible&&i.value.indexOf(u)>-1,x=(T?[]:v).map(S=>p(S,y+1)),z;return x.length?z=(x[0].x+x[x.length-1].x)/2:(z=c,c+=e.nodeWidth+e.gap),{key:u,node:w,depth:y,x:z,y:y*f,collapsed:T,hasChildren:v.length>0,childrenItems:x}}let g=[],m=[];function h(w,y){g.push(w),y&&m.push({from:y,to:w}),w.childrenItems.forEach(u=>h(u,w))}let b=p(e.data,0);h(b,null);let j=g.reduce((w,y)=>Math.max(w,y.depth),0);return{nodes:g,links:m,width:Math.max(c,e.nodeWidth),height:(j+1)*e.nodeHeight+j*e.verticalGap,root:b}});function o(f){if(!e.collapsible||!f.hasChildren)return;let c=i.value.indexOf(f.key),p=i.value.slice();c>-1?p.splice(c,1):p.push(f.key),i.value=p}function r(f){let c=f.from.x+e.nodeWidth/2,p=f.from.y+e.nodeHeight,g=f.to.x+e.nodeWidth/2,m=f.to.y,h=p+(m-p)/2;return`M${c} ${p} V${h} H${g} V${m}`}function s(f){t("node-click",f.node)}let d=Gi(()=>e.emptyText||C("orgChart.empty"));return{layout:l,toggle:o,linkPath:r,onClick:s,emptyLabel:d,t:C}},template:`
|
|
3981
|
+
<div class="djm-org-chart">
|
|
3982
|
+
<p v-if="!data" class="djm-org-chart-empty">{{ emptyLabel }}</p>
|
|
3983
|
+
|
|
3984
|
+
<div v-else class="djm-org-chart-scroll" tabindex="0">
|
|
3985
|
+
<div
|
|
3986
|
+
class="djm-org-chart-canvas"
|
|
3987
|
+
:style="{ width: layout.width + 'px', height: layout.height + 'px' }"
|
|
3988
|
+
>
|
|
3989
|
+
<svg class="djm-org-chart-lines" :width="layout.width" :height="layout.height" aria-hidden="true">
|
|
3990
|
+
<path
|
|
3991
|
+
v-for="(link, index) in layout.links"
|
|
3992
|
+
:key="index"
|
|
3993
|
+
:d="linkPath(link)"
|
|
3994
|
+
fill="none"
|
|
3995
|
+
/>
|
|
3996
|
+
</svg>
|
|
3997
|
+
|
|
3998
|
+
<div
|
|
3999
|
+
v-for="item in layout.nodes"
|
|
4000
|
+
:key="item.key"
|
|
4001
|
+
class="djm-org-chart-node"
|
|
4002
|
+
:class="{ 'djm-is-leaf': !item.hasChildren }"
|
|
4003
|
+
:style="{ left: item.x + 'px', top: item.y + 'px', width: nodeWidth + 'px', height: nodeHeight + 'px' }"
|
|
4004
|
+
>
|
|
4005
|
+
<button type="button" class="djm-org-chart-hit" @click="onClick(item)">
|
|
4006
|
+
<DjmAvatar :src="item.node.avatar || ''" :text="item.node.name" size="sm" />
|
|
4007
|
+
<span class="djm-org-chart-main">
|
|
4008
|
+
<strong class="djm-org-chart-name">{{ item.node.name }}</strong>
|
|
4009
|
+
<span v-if="item.node.title" class="djm-org-chart-title">{{ item.node.title }}</span>
|
|
4010
|
+
</span>
|
|
4011
|
+
</button>
|
|
4012
|
+
|
|
4013
|
+
<button
|
|
4014
|
+
v-if="item.hasChildren && collapsible"
|
|
4015
|
+
class="djm-org-chart-toggle"
|
|
4016
|
+
type="button"
|
|
4017
|
+
:aria-expanded="String(!item.collapsed)"
|
|
4018
|
+
:aria-label="t('orgChart.toggle')"
|
|
4019
|
+
@click="toggle(item)"
|
|
4020
|
+
>
|
|
4021
|
+
<DjmIcon :name="item.collapsed ? 'plus' : 'minus'" :size="10" />
|
|
4022
|
+
</button>
|
|
4023
|
+
</div>
|
|
4024
|
+
</div>
|
|
4025
|
+
</div>
|
|
4026
|
+
</div>
|
|
4027
|
+
`};import{computed as ks}from"vue";var Xi={name:"DjmPageTabs",components:{DjmIcon:L},props:{modelValue:{type:String,default:""},tabs:{type:Array,default:()=>[]},closable:{type:Boolean,default:!0}},emits:["update:modelValue","change","close"],setup(e,{emit:t}){let a=ks(()=>C("pageTabs.label"));function n(r){return r.closable===void 0?e.closable:r.closable}function i(r){r.key!==e.modelValue&&(t("update:modelValue",r.key),t("change",r.key,r))}function l(r){t("close",r.key,r)}function o(r,s){s.button!==1||!n(r)||(s.preventDefault(),l(r))}return{label:a,canClose:n,select:i,close:l,onAuxClick:o,t:C}},template:`
|
|
4028
|
+
<div class="djm-page-tabs">
|
|
4029
|
+
<nav class="djm-page-tabs-list" :aria-label="label">
|
|
4030
|
+
<div
|
|
4031
|
+
v-for="tab in tabs"
|
|
4032
|
+
:key="tab.key"
|
|
4033
|
+
class="djm-page-tabs-item"
|
|
4034
|
+
:class="{ 'djm-is-active': tab.key === modelValue }"
|
|
4035
|
+
>
|
|
4036
|
+
<button
|
|
4037
|
+
class="djm-page-tabs-title"
|
|
4038
|
+
type="button"
|
|
4039
|
+
:title="tab.title"
|
|
4040
|
+
:aria-current="tab.key === modelValue ? 'page' : null"
|
|
4041
|
+
@click="select(tab)"
|
|
4042
|
+
@auxclick="onAuxClick(tab, $event)"
|
|
4043
|
+
>{{ tab.title }}</button>
|
|
4044
|
+
<button
|
|
4045
|
+
v-if="canClose(tab)"
|
|
4046
|
+
class="djm-page-tabs-close"
|
|
4047
|
+
type="button"
|
|
4048
|
+
:aria-label="t('pageTabs.close') + ' ' + tab.title"
|
|
4049
|
+
@click="close(tab)"
|
|
4050
|
+
>
|
|
4051
|
+
<DjmIcon name="x" :size="11" />
|
|
4052
|
+
</button>
|
|
4053
|
+
</div>
|
|
4054
|
+
</nav>
|
|
4055
|
+
<div v-if="$slots.extra" class="djm-page-tabs-extra">
|
|
4056
|
+
<slot name="extra"></slot>
|
|
4057
|
+
</div>
|
|
4058
|
+
</div>
|
|
4059
|
+
`};function va(e,t,a,n=null){for(let i=0;i<e.length;i++){let l=e[i];if(l[a]===t)return{node:l,list:e,index:i,parent:n};let o=l.children;if(o&&o.length){let r=va(o,t,a,l);if(r)return r}}return null}function Qi(e,t,a){return e[a]===t?!0:(e.children||[]).some(i=>Qi(i,t,a))}function xs(e,t,a,n="before",i="id"){if(!Array.isArray(e)||t===a)return!1;let l=va(e,t,i);if(!l||Qi(l.node,a,i))return!1;l.list.splice(l.index,1);let o=va(e,a,i);if(!o)return l.list.splice(l.index,0,l.node),!1;if(n==="inside")return Array.isArray(o.node.children)||(o.node.children=[]),o.node.children.push(l.node),!0;let r=n==="after"?o.index+1:o.index;return o.list.splice(r,0,l.node),!0}function Ss(e,t,a,n="before"){if(!Array.isArray(e)||!Number.isInteger(t)||!Number.isInteger(a)||t<0||t>=e.length||a<0||a>=e.length||t===a)return null;let i=e.slice(),[l]=i.splice(t,1),o=n==="after"?a+1:a;return t<o&&(o-=1),o===t?null:(i.splice(o,0,l),i)}import{reactive as Ds}from"vue";var Kt=Ds({codes:new Set});function Ts(e){Kt.codes=new Set(e||[])}function Ms(e){(e||[]).forEach(t=>Kt.codes.add(t))}function Cs(){Kt.codes=new Set}function Zi(e){return!e||Array.isArray(e)&&!e.length?!0:(Array.isArray(e)?e:[e]).some(a=>Kt.codes.has(a))}var ga={mounted(e,t){if(!Zi(t.value)){if(t.modifiers.disable){e.setAttribute("disabled","disabled"),e.classList.add("djm-is-no-permission");return}e.parentNode&&e.parentNode.replaceChild(document.createComment("v-permission"),e)}}};var Es=[ya,pe,Te,it,lt,Oe,ot,rt,dt,st,xa,Sa,me,Da,Ta,Ca,Ea,Ia,La,Aa,Pa,Ba,Na,Ra,Va,Ha,Fe,ut,mt,ft,pt,Ke,Oa,$a,Fa,Ka,Ua,_a,Ya,Ga,Ja,Xa,Za,ln,on,sn,dn,cn,fn,pn,hn,xt,St,vn,gn,yn,bn,wn,jn,kn,xn,Dn,Pn,zn,Bn,Nn,Rn,L,Ue,Vn,Tt,Hn,Fn,we,qe,Gn,Jn,Qn,ei,ni,ii,oi,ri,di,ci,mi,fi,hi,gi,bi,ki,xi,Di,Ti,Ci,Ei,Li,zi,Ri,Hi,Oi,Fi,Wi,qi,Yi,Ji,Xi],Is="0.67.2";function Ls(e,t={}){t.locale&&He(t.locale),Es.forEach(a=>e.component(a.name,a)),e.directive("permission",ga)}var Xv={install:Ls,version:Is};export{Ja as DjmAffix,$a as DjmAlert,Ua as DjmAnchor,ci as DjmApprovalFlow,bi as DjmAttachmentList,on as DjmAutoComplete,me as DjmAvatar,Da as DjmAvatarGroup,_a as DjmBacktop,Ta as DjmBadge,Ci as DjmBatchBar,Sa as DjmBreadcrumb,ya as DjmButton,fn as DjmCalendar,La as DjmCard,dn as DjmCarousel,Ke as DjmCascader,Yi as DjmChat,it as DjmCheckbox,St as DjmCol,Ra as DjmCollapse,pt as DjmColorPicker,Dn as DjmCommandPalette,Hi as DjmComment,xi as DjmConfigProvider,Vn as DjmConfirmDialog,Fn as DjmContextMenu,we as DjmDatePicker,Di as DjmDateTimePicker,ii as DjmDescriptions,Li as DjmDiff,Ya as DjmDivider,Rn as DjmDrawer,Nn as DjmDropdown,ni as DjmEditableTable,st as DjmEmpty,qi as DjmFieldList,fi as DjmFilterTags,pn as DjmFloatButton,Jn as DjmFloatingWindow,ot as DjmForm,rt as DjmFormItem,Wi as DjmGantt,L as DjmIcon,Za as DjmImage,Ei as DjmImportWizard,pe as DjmInput,Fe as DjmInputNumber,kn as DjmInputTag,gi as DjmKanban,vn as DjmLayout,bn as DjmLayoutContent,wn as DjmLayoutFooter,gn as DjmLayoutHeader,yn as DjmLayoutSider,jn as DjmList,hi as DjmMediaPicker,hn as DjmMentions,Ea as DjmMenu,oi as DjmMessageHost,Ue as DjmModal,ki as DjmNotification,Ji as DjmOrgChart,ri as DjmOrgPicker,xa as DjmPageHeader,Xi as DjmPageTabs,Tt as DjmPagination,xn as DjmPassword,Ka as DjmPopconfirm,Ca as DjmPopover,Fi as DjmPrint,Aa as DjmProgress,Pn as DjmQRCode,mi as DjmQueryFilter,lt as DjmRadio,ut as DjmRate,Ba as DjmResult,Gn as DjmRichEditor,xt as DjmRow,Ri as DjmSchedule,di as DjmSchemaForm,Xa as DjmSegmented,Te as DjmSelect,Oi as DjmSignature,Pa as DjmSkeleton,mt as DjmSlider,Ga as DjmSpace,Fa as DjmSpin,sn as DjmSplitter,Va as DjmStatistic,zn as DjmStatus,Ha as DjmSteps,Oe as DjmSwitch,dt as DjmTable,Hn as DjmTabs,Ia as DjmTag,ft as DjmTimePicker,Na as DjmTimeline,Bn as DjmTooltip,cn as DjmTour,Oa as DjmTransfer,ei as DjmTree,qe as DjmTreeSelect,zi as DjmTreeTable,Qn as DjmUpload,Ti as DjmVirtualList,ln as DjmWatermark,Rl as PRESET_COLORS,Ms as addPermissions,Cs as clearPermissions,Xv as default,Ge as djmMessage,Be as djmMessages,ll as getLocale,Zi as hasPermission,Kl as initTheme,Ls as install,Ve as localeState,Ss as moveRows,xs as moveTreeNode,bt as primaryColor,$l as resetPrimaryColor,Et as sanitizeHtml,He as setLocale,Ts as setPermissions,nn as setPrimaryColor,_t as setTheme,C as t,Ce as theme,Fl as toggleTheme,ga as vPermission,Is as version};
|