@robot-admin/naive-ui-components 0.29.2 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +3 -1
- package/README_EN.md +3 -1
- package/dist/C_ActionBar.css +52 -49
- package/dist/C_ActionBar2.cjs +1 -1
- package/dist/C_ActionBar2.js +1 -1
- package/dist/C_DataPicker.cjs +1 -1
- package/dist/C_DataPicker.css +29 -28
- package/dist/C_DataPicker.d.cts +2 -2
- package/dist/C_DataPicker.d.ts +3 -2
- package/dist/C_DataPicker.js +1 -1
- package/dist/C_Density.d.cts +1 -1
- package/dist/C_Density.d.ts +1 -1
- package/dist/C_Editor.d.cts +1 -1
- package/dist/C_Editor.d.ts +1 -1
- package/dist/C_ErrorSummary.d.cts +1 -1
- package/dist/C_ErrorSummary.d.ts +1 -1
- package/dist/C_FilePreview2.js +1 -1
- package/dist/C_Form.d.cts +2 -1
- package/dist/C_Form.d.ts +2 -1
- package/dist/C_FormModal.css +52 -49
- package/dist/C_FormModal.d.cts +1 -1
- package/dist/C_FormModal.d.ts +2 -1
- package/dist/C_FormSearch.css +66 -66
- package/dist/C_Guide.d.cts +1 -1
- package/dist/C_Guide.d.ts +1 -1
- package/dist/C_Icon.d.cts +1 -1
- package/dist/C_Icon.d.ts +1 -1
- package/dist/C_Language.d.cts +1 -1
- package/dist/C_Language.d.ts +1 -1
- package/dist/C_Loading.d.cts +1 -1
- package/dist/C_Loading.d.ts +1 -1
- package/dist/C_Login.d.cts +1 -1
- package/dist/C_Login.d.ts +1 -1
- package/dist/C_Markdown.d.cts +1 -1
- package/dist/C_Markdown.d.ts +1 -1
- package/dist/C_Menu.d.ts +1 -1
- package/dist/C_OrgChart.d.cts +1 -1
- package/dist/C_OrgChart.d.ts +1 -1
- package/dist/C_Progress.d.cts +1 -1
- package/dist/C_Progress.d.ts +1 -1
- package/dist/C_SectionNav.d.cts +1 -1
- package/dist/C_SectionNav.d.ts +1 -1
- package/dist/C_Skeleton.d.cts +1 -1
- package/dist/C_Skeleton.d.ts +1 -1
- package/dist/C_Steps.d.cts +1 -1
- package/dist/C_Steps.d.ts +1 -1
- package/dist/C_Table.base.css +161 -158
- package/dist/C_Table.cjs +1 -1
- package/dist/C_Table.css +161 -158
- package/dist/C_Table.d.cts +2 -2
- package/dist/C_Table.d.ts +7 -6
- package/dist/C_Table.js +1 -1
- package/dist/C_Table2.cjs +3 -3
- package/dist/C_Table2.js +3 -3
- package/dist/C_TagsView.d.cts +1 -1
- package/dist/C_TagsView.d.ts +1 -1
- package/dist/C_Theme.d.cts +1 -1
- package/dist/C_Theme.d.ts +1 -1
- package/dist/C_Timeline.d.cts +1 -1
- package/dist/C_Timeline.d.ts +1 -1
- package/dist/C_Transfer.d.cts +1 -1
- package/dist/C_Transfer.d.ts +1 -1
- package/dist/C_Tree.d.ts +6 -5
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants3.d.cts +1 -1
- package/dist/constants3.d.ts +1 -1
- package/dist/constants4.d.cts +4 -4
- package/dist/constants4.d.ts +4 -4
- package/dist/data2.d.cts +9 -9
- package/dist/data2.d.ts +9 -9
- package/dist/dateRange.d.cts +10 -2
- package/dist/dateRange.d.ts +10 -2
- package/dist/formField.cjs +1 -0
- package/dist/formField.d.cts +1179 -0
- package/dist/formField.d.ts +1179 -0
- package/dist/formField.js +1 -0
- package/dist/helpers2.cjs +1 -0
- package/dist/helpers2.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +23 -22
- package/dist/index.d.ts +24 -23
- package/dist/index.js +1 -1
- package/dist/index.vue.d.cts +5 -5
- package/dist/index.vue.d.ts +5 -5
- package/dist/index10.vue.d.cts +3 -3
- package/dist/index10.vue.d.ts +3 -3
- package/dist/index11.vue.d.cts +3 -3
- package/dist/index11.vue.d.ts +13 -1157
- package/dist/index12.vue.d.cts +13 -1157
- package/dist/index12.vue.d.ts +59 -16
- package/dist/index13.vue.d.cts +59 -16
- package/dist/index13.vue.d.ts +17 -57
- package/dist/index14.vue.d.cts +17 -57
- package/dist/index14.vue.d.ts +55 -18
- package/dist/index15.vue.d.cts +55 -18
- package/dist/index15.vue.d.ts +124 -53
- package/dist/index16.vue.d.cts +124 -53
- package/dist/index16.vue.d.ts +51 -123
- package/dist/index17.vue.d.cts +51 -123
- package/dist/index17.vue.d.ts +25 -52
- package/dist/index18.vue.d.cts +25 -52
- package/dist/index18.vue.d.ts +12 -25
- package/dist/index19.vue.d.cts +12 -25
- package/dist/index19.vue.d.ts +129 -13
- package/dist/index2.vue.d.cts +2 -2
- package/dist/index2.vue.d.ts +2 -2
- package/dist/index20.vue.d.cts +129 -13
- package/dist/index20.vue.d.ts +76 -129
- package/dist/index21.vue.d.cts +76 -129
- package/dist/index21.vue.d.ts +72 -78
- package/dist/index22.vue.d.cts +97 -75
- package/dist/index22.vue.d.ts +96 -68
- package/dist/index23.vue.d.cts +40 -91
- package/dist/index23.vue.d.ts +40 -91
- package/dist/index24.vue.d.cts +23 -49
- package/dist/index24.vue.d.ts +23 -49
- package/dist/index25.vue.d.cts +96 -21
- package/dist/index25.vue.d.ts +96 -21
- package/dist/index26.vue.d.cts +37 -95
- package/dist/index26.vue.d.ts +37 -95
- package/dist/index27.vue.d.cts +8 -34
- package/dist/index27.vue.d.ts +8 -34
- package/dist/index28.vue.d.cts +86 -9
- package/dist/index28.vue.d.ts +86 -9
- package/dist/index29.vue.d.cts +99 -85
- package/dist/index29.vue.d.ts +99 -85
- package/dist/index3.vue.d.cts +6 -6
- package/dist/index3.vue.d.ts +6 -6
- package/dist/index30.vue.d.cts +59 -94
- package/dist/index30.vue.d.ts +59 -94
- package/dist/index9.vue.d.ts +3 -3
- package/dist/mapUtils.d.cts +2 -2
- package/dist/mapUtils.d.ts +2 -2
- package/dist/presets.d.cts +4 -1
- package/dist/presets.d.ts +4 -1
- package/dist/rolldown-runtime.js +1 -0
- package/dist/serializeSearch.cjs +1 -1
- package/dist/serializeSearch.js +1 -1
- package/dist/style.css +256 -252
- package/dist/useCalendarEvents.d.cts +1 -1
- package/dist/useCalendarEvents.d.ts +1 -1
- package/dist/useCollapsePanel.d.cts +3 -3
- package/dist/useCollapsePanel.d.ts +3 -3
- package/dist/useCropperCore.d.cts +4 -4
- package/dist/useCropperCore.d.ts +4 -4
- package/dist/useDynamicFormState.d.cts +5 -67
- package/dist/useDynamicFormState.d.ts +5 -67
- package/dist/useEdgeInteraction.d.cts +2 -2
- package/dist/useEdgeInteraction.d.ts +2 -2
- package/dist/useFormRenderer.d.cts +69 -0
- package/dist/useFormRenderer.d.ts +69 -0
- package/dist/useFullscreen.d.cts +3 -3
- package/dist/useFullscreen.d.ts +3 -3
- package/dist/useGlobalSearch.d.cts +1 -1
- package/dist/useGlobalSearch.d.ts +1 -1
- package/dist/useInfiniteScroll.d.cts +2 -2
- package/dist/useInfiniteScroll.d.ts +2 -2
- package/dist/useQRCode.d.cts +3 -3
- package/dist/useQRCode.d.ts +3 -3
- package/dist/useSignatureHistory.d.cts +4 -4
- package/dist/useSignatureHistory.d.ts +4 -4
- package/dist/useSplitResize.d.cts +9 -9
- package/dist/useSplitResize.d.ts +9 -9
- package/dist/useTableQuery.d.cts +9 -9
- package/dist/useTableQuery.d.ts +9 -9
- package/dist/useWorkflowValidation.d.cts +36 -36
- package/dist/useWorkflowValidation.d.ts +36 -36
- package/dist/verification.d.cts +4 -4
- package/dist/verification.d.ts +4 -4
- package/dist/{xlsx.js → xlsx2.js} +1 -1
- package/docs/guides/data-picker.md +30 -11
- package/docs/guides/data-workflows.md +22 -1
- package/docs/guides/search-workflows.md +3 -1
- package/docs/guides/usage.en.md +15 -15
- package/docs/guides/usage.md +15 -15
- package/package.json +1 -1
- package/dist/C_DataPicker2.cjs +0 -1
- package/dist/C_DataPicker2.js +0 -1
- package/dist/index31.vue.d.cts +0 -75
- package/dist/index31.vue.d.ts +0 -75
package/dist/C_FilePreview2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./xlsx.js";import{t as n}from"./C_Icon2.js";import{t as r}from"./export-helper.js";import{t as i}from"./html.js";import{Fragment as a,computed as o,createBlock as s,createCommentVNode as c,createElementBlock as l,createElementVNode as u,createTextVNode as d,createVNode as f,defineComponent as p,isRef as m,normalizeClass as h,normalizeStyle as g,onMounted as _,onUnmounted as v,openBlock as y,ref as b,renderList as x,resolveComponent as S,toDisplayString as C,toRefs as w,unref as T,vShow as E,watch as D,withCtx as O,withDirectives as k}from"vue";import{NButton as A,NDivider as j,NEllipsis as M,NEmpty as N,NModal as P,NPagination as F,NResult as I,NSpin as L,NTabPane as R,NTabs as z,NTag as B,NText as V}from"naive-ui";import H from"mammoth";const U={pdf:`pdf`,doc:`word`,docx:`word`,xls:`excel`,xlsx:`excel`},W={pdf:{tagType:`error`,icon:`ic:outline-picture-as-pdf`,color:`#dc2626`},word:{tagType:`info`,icon:`ic:outline-description`,color:`#2563eb`},excel:{tagType:`success`,icon:`ic:outline-grid-on`,color:`#16a34a`},unknown:{tagType:`default`,icon:`ic:outline-insert-drive-file`,color:`#6b7280`}},G={pdf:{min:.5,max:3,step:.25,default:1},word:{min:50,max:200,step:10,default:100}},K=[20,50,100,200],q=[`fullscreenchange`,`webkitfullscreenchange`,`mozfullscreenchange`,`MSFullscreenChange`],J=e=>{try{let t=e.split(`/`).pop()||e.split(`\\`).pop();if(t?.includes(`.`)){let n=decodeURIComponent(t.split(`?`)[0]);if(n&&n!==e)return n}}catch(e){console.warn(`解析URL文件名失败:`,e)}return`未知文件`},Y=e=>{if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/t**+r).toFixed(1))+` `+n[r]},X=e=>{if(!e||e===`未知文件`)return`unknown`;let t=e.toLowerCase().split(`.`).pop();return t&&U[t]||`unknown`},Z=e=>W[e]||W.unknown,ee=(e,t)=>n=>{let{min:r,max:i,step:a,default:o}=t;switch(n){case`reset`:e.value=o;break;case`in`:e.value<i&&(e.value+=a);break;case`out`:e.value>r&&(e.value-=a);break}},te=e=>{let t=``;for(;e>=0;)t=String.fromCharCode(65+e%26)+t,e=Math.floor(e/26)-1;return t},ne=e=>e==null?``:String(e),Q=1e5,re=e=>{if(e==null||e===``)return`cell-empty`;let t=String(e).trim();return!isNaN(Number(t))&&t!==``?`cell-number`:t.match(/[■▬▪▫─━]/)?`cell-gantt`:t.match(/^\d{4}[-/]\d{2}[-/]\d{2}/)||t.match(/^\d{2}[-/]\d{2}[-/]\d{4}/)?`cell-date`:[`true`,`false`].includes(t.toLowerCase())?`cell-boolean`:t.length>20?`cell-text cell-long`:`cell-text`};function $(e,t,n){if(e===void 0)return t;if(!Number.isSafeInteger(e)||e<=0)throw Error(`previewLimits.${n} 必须为有限正整数`);return e}function ie(t,n){let r=n?.isMain?n:{rowspan:1,colspan:1};return{value:t?.v??``,displayValue:t?t.w??e.format_cell(t):``,type:t?.t,merged:!!n,hidden:!!(n&&!n.isMain),rowspan:r.rowspan,colspan:r.colspan}}function ae(e,t,n){let{s:r,e:i}=e;return[r.r,r.c,i.r,i.c].every(Number.isSafeInteger)&&r.r>=0&&r.c>=0&&i.r<=t&&i.c<=n&&i.r>=r.r&&i.c>=r.c}const oe=(t,n,r=Q)=>{let{c:i,r:a}=e.decode_range(t[`!ref`]||`A1:A1`).e,o=(i+1)*(a+1);if(!Number.isSafeInteger(o)||o<1||o>$(r,Q,`maxCells`))throw Error(`工作表范围超过 ${r.toLocaleString()} 个单元格的预览上限,请下载文件查看`);let s=Array.from({length:i+1},(n,r)=>{let i=t[e.encode_cell({r:0,c:r})],a=i?String(i.v??``).trim():`列${r+1}`;return{title:a||`列${r+1}`,key:`col_${r}`,width:Math.min(Math.max(a.length*12,80),200)}}),c=new Map,l=0;return n.forEach(e=>{if(!ae(e,a,i))return;let{s:{r:t,c:n},e:{r,c:s}}=e;if(l+=(r-t+1)*(s-n+1),!Number.isSafeInteger(l)||l>o)throw Error(`合并单元格累计范围超过预览上限,请下载文件查看`);for(let e=t;e<=r;e++)for(let i=n;i<=s;i++)c.set(`${e}-${i}`,{isMain:e===t&&i===n,rowspan:r-t+1,colspan:s-n+1})}),{data:Array.from({length:a+1},(n,r)=>{let a={};for(let n=0;n<=i;n++){let i=t[e.encode_cell({r,c:n})],o=c.get(`${r}-${n}`);a[`col_${n}`]=ie(i,o)}return a}),columns:s}};async function se(e){return{url:URL.createObjectURL(e)+`#toolbar=1&navpanes=1&scrollbar=1&view=FitH`,totalPages:1}}async function ce(e){let t=await e.arrayBuffer(),n=await H.convertToHtml({arrayBuffer:t,styleMap:[`p[style-name='Heading 1'] => h1:fresh`,`p[style-name='Heading 2'] => h2:fresh`,`p[style-name='Heading 3'] => h3:fresh`,`p[style-name='Title'] => h1.title:fresh`]}),r=[],a=document.createElement(`div`);a.innerHTML=i(n.value);let o=a.querySelectorAll(`h1, h2, h3, h4, h5, h6`);return Array.from(o).forEach((e,t)=>{let n=`heading-${t}`,i=parseInt(e.tagName.charAt(1)),a=e.textContent||``;e.id=n,r.push({id:n,text:a,level:i})}),{content:a.innerHTML,headings:r}}async function le(e,n={}){let r=$(n.maxBytes,33554432,`maxBytes`),i=$(n.maxCells,Q,`maxCells`);if(e.size>r)throw Error(`Excel 文件超过 ${Y(r)} 的预览上限,请下载文件查看`);let a=t(await e.arrayBuffer(),{type:`array`,cellStyles:!0,cellFormula:!0,cellDates:!0});if(!a.SheetNames.length)throw Error(`Excel文件中没有找到工作表`);let o=a.SheetNames.map(e=>{let t=a.Sheets[e],n=t[`!merges`]||[];return{name:e,data:[],merges:n,columns:[],load:()=>oe(t,n,i)}});return Object.assign(o[0],o[0].load?.()),{sheets:o}}const ue={class:`file-container pdf-container`},de={class:`file-toolbar`},fe={class:`file-viewer`},pe=[`src`];var me=r(p({name:`FilePreviewPdfViewer`,__name:`index`,props:{pdfUrl:{},totalPages:{}},setup(e){return(t,n)=>(y(),l(`div`,ue,[u(`div`,de,[n[1]||=u(`span`,null,`PDF 阅读器 · 翻页、缩放与打印由浏览器提供`,-1),e.pdfUrl?(y(),s(T(A),{key:0,tag:`a`,href:e.pdfUrl,target:`_blank`,rel:`noopener noreferrer`,size:`small`},{default:O(()=>[...n[0]||=[d(`在新标签页打开`,-1)]]),_:1},8,[`href`])):c(`v-if`,!0)]),u(`div`,fe,[e.pdfUrl?(y(),l(`iframe`,{key:0,src:e.pdfUrl,title:`PDF预览`,class:`pdf-frame`},null,8,pe)):c(`v-if`,!0)])]))}}),[[`__scopeId`,`data-v-db027bb4`]]);const he={class:`file-container word-container`},ge={class:`file-toolbar`},_e={class:`flex gap-2 items-center`},ve={class:`text-sm text-gray-600 min-w-12 text-center`},ye={class:`word-layout`},be={class:`word-main`},xe={key:0,class:`word-outline`},Se={class:`outline-content`},Ce=[`onClick`],we={class:`word-content`},Te=[`innerHTML`];var Ee=r(p({__name:`index`,props:{content:{},headings:{}},setup(e){let t=b(!0),r=b(100),i=ee(r,G.word),o=e=>{document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`})};return(s,p)=>{let m=n;return y(),l(`div`,he,[u(`div`,ge,[u(`div`,_e,[f(T(A),{size:`small`,onClick:p[0]||=e=>t.value=!t.value},{icon:O(()=>[f(m,{name:`ic:outline-list`})]),default:O(()=>[d(` `+C(t.value?`隐藏`:`显示`)+`目录 `,1)]),_:1}),f(T(j),{vertical:``}),f(T(A),{size:`small`,disabled:r.value<=50,onClick:p[1]||=e=>T(i)(`out`)},{icon:O(()=>[f(m,{name:`ic:outline-zoom-out`})]),_:1},8,[`disabled`]),u(`span`,ve,C(r.value)+`% `,1),f(T(A),{size:`small`,disabled:r.value>=200,onClick:p[2]||=e=>T(i)(`in`)},{icon:O(()=>[f(m,{name:`ic:outline-zoom-in`})]),_:1},8,[`disabled`]),f(T(A),{size:`small`,onClick:p[3]||=e=>T(i)(`reset`)},{icon:O(()=>[f(m,{name:`ic:outline-fit-screen`})]),default:O(()=>[p[4]||=d(` 重置 `,-1)]),_:1})])]),u(`div`,ye,[u(`div`,be,[c(` 侧边栏目录 `),t.value?(y(),l(`div`,xe,[p[5]||=u(`div`,{class:`outline-header`},[u(`h3`,{class:`text-sm font-semibold`},`文档目录`)],-1),u(`div`,Se,[(y(!0),l(a,null,x(e.headings,(e,t)=>(y(),l(`div`,{key:t,class:h([`outline-item`,`level-${e.level}`]),onClick:t=>o(e.id)},C(e.text),11,Ce))),128))])])):c(`v-if`,!0),c(` 主要内容区域 `),u(`div`,we,[u(`div`,{class:`word-document`,style:g({transform:`scale(${r.value/100})`,transformOrigin:`top center`}),innerHTML:e.content},null,12,Te)])])])])}}}),[[`__scopeId`,`data-v-dae08a5f`]]);const De={class:`file-container excel-container`},Oe={class:`file-toolbar`},ke={class:`flex justify-between items-center`},Ae={class:`flex gap-2 items-center`},je={key:1,class:`text-sm text-gray-600`},Me={class:`flex gap-2 items-center`},Ne={class:`excel-viewer`},Pe={key:0,class:`excel-info`},Fe={class:`excel-table-container`},Ie={key:0,class:`excel-table`},Le={class:`header-content`},Re={class:`column-letter`},ze={class:`column-title`},Be={class:`row-number`},Ve=[`rowspan`,`colspan`,`title`],He={key:1,class:`excel-empty`},Ue={key:0,class:`excel-pagination`};var We=r(p({__name:`index`,props:{sheets:{}},emits:[`reload`],setup(e){let t=e,r=b(``),i=b(``),p=b(!1),m=b(1),_=b(50),v=b([]),S=b([]),w=o(()=>Math.ceil(v.value.length/_.value)),j=o(()=>{let e=(m.value-1)*_.value;return v.value.slice(e,e+_.value)}),M=e=>{_.value=e,m.value=1},P=e=>{i.value=``,v.value=[],S.value=[],m.value=1;let n=t.sheets.find(t=>t.name===e);if(n)try{let e=n.data.length>0?n:n.load?.()??n;v.value=e.data,S.value=e.columns}catch(e){i.value=e instanceof Error?e.message:`工作表解析失败`}};return D(r,e=>{P(e)}),D(()=>t.sheets,e=>{r.value=e[0]?.name??``,P(r.value)},{immediate:!0}),(t,o)=>{let b=n;return y(),l(`div`,De,[c(` 工具栏 `),u(`div`,Oe,[u(`div`,ke,[u(`div`,Ae,[e.sheets.length>1?(y(),s(T(z),{key:0,value:r.value,"onUpdate:value":o[0]||=e=>r.value=e,type:`card`,size:`small`},{default:O(()=>[(y(!0),l(a,null,x(e.sheets,e=>(y(),s(T(R),{key:e.name,name:e.name},{tab:O(()=>[d(C(e.name),1)]),_:2},1032,[`name`]))),128))]),_:1},8,[`value`])):(y(),l(`span`,je,` 工作表: `+C(r.value),1))]),u(`div`,Me,[f(T(A),{size:`small`,onClick:o[1]||=e=>p.value=!p.value},{icon:O(()=>[f(b,{name:`ic:outline-format-paint`})]),default:O(()=>[d(` `+C(p.value?`紧凑视图`:`完整格式`),1)]),_:1})])])]),u(`div`,Ne,[c(` 信息面板 `),v.value.length>0?(y(),l(`div`,Pe,[f(T(V),{depth:`3`,class:`text-sm`},{default:O(()=>[d(` 当前工作表: `+C(r.value)+` | 总行数: `+C(v.value.length)+` | 总列数: `+C(S.value.length)+` | 当前页: `+C(m.value)+`/`+C(w.value),1)]),_:1})])):c(`v-if`,!0),c(` 表格 `),u(`div`,Fe,[u(`div`,{class:h([`excel-table-wrapper`,{"simple-mode":!p.value}])},[v.value.length>0?(y(),l(`table`,Ie,[u(`thead`,null,[u(`tr`,null,[o[4]||=u(`th`,{class:`row-number`},`行号`,-1),(y(!0),l(a,null,x(S.value,(e,t)=>(y(),l(`th`,{key:e.key,class:`excel-header`,style:g({minWidth:e.width+`px`})},[u(`div`,Le,[u(`span`,Re,C(T(te)(t)),1),u(`span`,ze,C(e.title),1)])],4))),128))])]),u(`tbody`,null,[(y(!0),l(a,null,x(j.value,(e,t)=>(y(),l(`tr`,{key:t,class:`excel-row`},[u(`td`,Be,C((m.value-1)*_.value+t+1),1),(y(!0),l(a,null,x(S.value,t=>k((y(),l(`td`,{key:t.key,class:h([`excel-cell`,[T(re)(e[t.key]?.value),e[t.key]?.merged?`merged-cell`:``,p.value?``:`compact-cell`]]),rowspan:e[t.key]?.rowspan||1,colspan:e[t.key]?.colspan||1,title:e[t.key]?.displayValue??T(ne)(e[t.key]?.value)},C(e[t.key]?.displayValue??T(ne)(e[t.key]?.value)),11,Ve)),[[E,!e[t.key]?.hidden]])),128))]))),128))])])):(y(),l(`div`,He,[f(T(N),{description:i.value||`该工作表没有数据或解析失败`},{extra:O(()=>[f(T(A),{size:`small`,onClick:o[2]||=e=>t.$emit(`reload`)},{default:O(()=>[...o[5]||=[d(` 重新解析 `,-1)]]),_:1})]),_:1},8,[`description`])]))],2),c(` 分页 `),w.value>1?(y(),l(`div`,Ue,[f(T(F),{page:m.value,"onUpdate:page":o[3]||=e=>m.value=e,"page-count":w.value,"page-size":_.value,"show-size-picker":``,"page-sizes":T(K),"onUpdate:pageSize":M},null,8,[`page`,`page-count`,`page-size`,`page-sizes`])])):c(`v-if`,!0)])])])}}}),[[`__scopeId`,`data-v-5a0226ce`]]);function Ge(e,t){if(!e.trim())return null;try{let n=new URL(t),r=new URL(e,n);if(r.username||r.password)return null;if(r.protocol===`https:`||r.protocol===`http:`&&r.origin===n.origin)return r.href}catch{}return null}function Ke(e,t){let{file:n,url:r,fileName:i,previewLimits:a}=e,s=b(!1),c=b(``),l=b(0),u=b(!1),d=b(``),f=b(0),p=b(``),m=b([]),h=b([]),g=0,_=null,y=!1,x=(e,t)=>e===g&&!y&&!t.signal.aborted,S=o(()=>i.value&&i.value!==`未知文件`?i.value:n.value?.name?n.value.name:r.value?J(r.value):`未知文件`),C=o(()=>X(S.value)),w=o(()=>Z(C.value)),T=o(()=>!!(n.value||r.value)),E=()=>{let e=d.value;d.value=``,e.startsWith(`blob:`)&&URL.revokeObjectURL(e.split(`#`)[0])},O=()=>{c.value=``,s.value=!1,l.value=0,E(),f.value=0,p.value=``,m.value=[],h.value=[]},k=e=>{c.value=e,s.value=!1},A=()=>{g+=1,_?.abort(),_=null,O()},j=async e=>{let t=n.value,i=r.value;if(t)return t;if(i){let t=Ge(i,window.location.href);if(!t)throw Error(`不支持此文件地址`);let n=await fetch(t,{signal:e});if(!n.ok)throw Error(`HTTP ${n.status}: ${n.statusText}`);let r=await n.blob();return new File([r],S.value,{type:r.type})}throw Error(`未提供文件或URL`)},M=async(e,t,n)=>{switch(t){case`pdf`:{let t=await se(e);if(n!==g){URL.revokeObjectURL(t.url.split(`#`)[0]);return}d.value=t.url,f.value=t.totalPages;break}case`word`:{let t=await ce(e);if(n!==g)return;p.value=t.content,m.value=t.headings;break}case`excel`:{let t=await le(e,a?.value);if(n!==g)return;h.value=t.sheets;break}default:throw Error(`不支持的文件格式`)}},N=async()=>{if(y)return!1;let e=++g;_?.abort();let t=new AbortController;if(_=t,O(),!T.value)return _=null,!1;s.value=!0;try{let n=C.value,r=await j(t.signal);return e===g?(l.value=r.size,await M(r,n,e),x(e,t)):!1}catch(n){if(!x(e,t))return!1;let r=n instanceof Error?n.message:`未知错误`;return k(`${C.value.toUpperCase()}文件加载失败: ${r}`),!1}finally{e===g&&(s.value=!1,_=null)}};return D([n,r],([e,t])=>{!e&&!t&&A()},{flush:`sync`}),D(()=>n.value?.size,e=>{l.value=e||0},{immediate:!0}),v(()=>{y=!0,A()}),{loading:s,error:c,fileSize:l,showModal:u,hasSource:T,pdfUrl:d,pdfTotalPages:f,wordContent:p,wordHeadings:m,excelSheets:h,displayFileName:S,fileType:C,fileConfig:w,loadFile:N,openPreview:async()=>{if(y)return;let e=n.value||r.value;u.value=!0,await N()&&e&&e===(n.value||r.value)&&!y&&t(`preview`,e)},downloadFile:()=>{let e=n.value||r.value;if(!(y||!e)){if(n.value){let e=URL.createObjectURL(n.value);Object.assign(document.createElement(`a`),{href:e,download:S.value}).click(),URL.revokeObjectURL(e)}else if(r.value){let e=Ge(r.value,window.location.href);if(!e){k(`不支持此文件地址`);return}window.open(e,`_blank`,`noopener,noreferrer`)}t(`download`,e)}},clearPreview:A}}function qe(e){let t=b(!1),n=()=>{t.value=!!document.fullscreenElement},r=(e,t=0)=>t>=e.length?(console.warn(`无法切换全屏状态`),Promise.resolve()):e[t]().catch(()=>r(e,t+1));return _(()=>{q.forEach(e=>document.addEventListener(e,n))}),v(()=>{q.forEach(e=>document.removeEventListener(e,n))}),{isFullscreen:t,toggleFullscreen:async()=>{let t=e.value;t&&await r(document.fullscreenElement?[()=>document.exitFullscreen(),()=>document.webkitExitFullscreen(),()=>document.mozCancelFullScreen(),()=>document.msExitFullscreen()]:[()=>t.requestFullscreen(),()=>t.webkitRequestFullscreen(),()=>t.mozRequestFullScreen(),()=>t.msRequestFullscreen()])},exitFullscreen:async()=>{if(document.fullscreenElement)try{await document.exitFullscreen()}catch{}t.value=!1}}}const Je={class:`c-file-preview-wrapper`},Ye={key:0,class:`file-info-card`},Xe={class:`file-info`},Ze={class:`file-icon`},Qe={class:`file-details`},$e={class:`file-name`},et={class:`file-meta`},tt={class:`file-size`},nt={class:`file-actions`},rt={key:1,class:`c-file-preview-inline`},it={key:1,class:`status-container`,role:`status`},at={class:`modal-header`},ot={class:`modal-title`},st={class:`modal-actions`},ct={class:`modal-content`},lt={class:`preview-header`},ut={class:`flex justify-between items-center`},dt={class:`flex items-center gap-3`},ft={class:`text-sm text-gray-500`},pt={class:`flex gap-2`},mt={class:`preview-content`},ht={key:1,class:`status-container`};var gt=r(p({name:`C_FilePreview`,__name:`index`,props:{previewLimits:{},file:{},url:{},fileName:{default:`未知文件`},autoPreview:{type:Boolean,default:!1},inline:{type:Boolean,default:!1}},emits:[`preview`,`download`],setup(e,{emit:t}){let r=e,{file:i,url:o,fileName:p,autoPreview:h,inline:g,previewLimits:_}=w(r),{loading:v,error:x,fileSize:S,showModal:E,hasSource:k,pdfUrl:j,pdfTotalPages:N,wordContent:F,wordHeadings:R,excelSheets:z,displayFileName:V,fileType:H,fileConfig:U,loadFile:W,openPreview:G,downloadFile:K}=Ke({file:i,url:o,fileName:p,previewLimits:_},t),q=b(),{isFullscreen:J,toggleFullscreen:X,exitFullscreen:Z}=qe(q);return D(E,e=>{e||Z()}),D([i,o,h,g,p,()=>r.previewLimits?.maxBytes,()=>r.previewLimits?.maxCells],(e,t)=>{if(!(typeof window>`u`||!k.value)){if(g.value){W();return}if(E.value){[0,1,4,5,6].some(n=>e[n]!==t?.[n])&&W();return}h.value&&G()}},{immediate:!0}),(e,t)=>{let r=n;return y(),l(`div`,Je,[c(` 文件信息卡片模式 `),!T(h)&&!T(g)?(y(),l(`div`,Ye,[u(`div`,Xe,[u(`div`,Ze,[f(r,{name:T(U).icon,size:40,color:T(U).color},null,8,[`name`,`color`])]),u(`div`,Qe,[u(`div`,$e,[f(T(M),{style:{"max-width":`250px`}},{default:O(()=>[d(C(T(V)),1)]),_:1}),f(T(B),{type:T(U).tagType,size:`small`},{default:O(()=>[d(C(T(H).toUpperCase()),1)]),_:1},8,[`type`])]),u(`div`,et,[u(`span`,tt,C(T(Y)(T(S))),1)])]),u(`div`,nt,[f(T(A),{type:`primary`,onClick:T(G)},{icon:O(()=>[f(r,{name:`ic:outline-visibility`})]),default:O(()=>[t[2]||=d(` 预览 `,-1)]),_:1},8,[`onClick`]),f(T(A),{type:`tertiary`,onClick:T(K)},{icon:O(()=>[f(r,{name:`ic:outline-download`})]),default:O(()=>[t[3]||=d(` 下载 `,-1)]),_:1},8,[`onClick`])])])])):c(`v-if`,!0),T(g)?(y(),l(`div`,rt,[T(k)?T(v)||T(x)?(y(),l(`div`,it,[T(v)?(y(),s(T(L),{key:0,size:`large`},{description:O(()=>[...t[4]||=[d(`正在加载文档…`,-1)]]),_:1})):(y(),s(T(I),{key:1,status:`error`,title:`预览失败`,description:T(x)},{footer:O(()=>[f(T(A),{size:`small`,onClick:T(W)},{default:O(()=>[...t[5]||=[d(`重试`,-1)]]),_:1},8,[`onClick`])]),_:1},8,[`description`]))])):T(H)===`pdf`?(y(),s(me,{key:2,"pdf-url":T(j),"total-pages":T(N)},null,8,[`pdf-url`,`total-pages`])):T(H)===`word`?(y(),s(Ee,{key:3,content:T(F),headings:T(R)},null,8,[`content`,`headings`])):T(H)===`excel`?(y(),s(We,{key:4,sheets:T(z),onReload:T(W)},null,8,[`sheets`,`onReload`])):(y(),s(T(I),{key:5,status:`warning`,title:`不支持的文件格式`,description:`支持 PDF、DOCX、XLSX 和 XLS 文件`})):(y(),s(T(I),{key:0,status:`info`,title:`暂无预览文件`,description:`选择文件后即可预览`}))])):c(`v-if`,!0),c(` 模态框预览 `),T(g)?c(`v-if`,!0):(y(),s(T(P),{key:2,show:T(E),"onUpdate:show":t[1]||=e=>m(E)?E.value=e:null,"mask-closable":!1,closable:!1,"auto-focus":!1,"transform-origin":`center`,style:{width:`85vw`,"max-width":`1200px`,"min-width":`800px`,height:`75vh`,"max-height":`700px`,"min-height":`500px`}},{default:O(()=>[u(`div`,{ref_key:`modalContainer`,ref:q,class:`modal-container`},[c(` 自定义头部 `),u(`div`,at,[u(`div`,ot,[f(r,{name:T(U).icon,size:20,color:T(U).color},null,8,[`name`,`color`]),u(`span`,null,C(T(V)),1)]),u(`div`,st,[f(T(A),{size:`small`,type:`tertiary`,onClick:T(K)},{icon:O(()=>[f(r,{name:`ic:outline-download`})]),default:O(()=>[t[6]||=d(` 下载 `,-1)]),_:1},8,[`onClick`]),f(T(A),{size:`small`,type:`tertiary`,onClick:t[0]||=e=>E.value=!1},{icon:O(()=>[f(r,{name:`ic:outline-close`})]),_:1})])]),c(` 预览内容 `),u(`div`,ct,[c(` 文件信息头部 `),u(`div`,lt,[u(`div`,ut,[u(`div`,dt,[f(T(B),{type:T(U).tagType,size:`small`},{icon:O(()=>[f(r,{name:T(U).icon},null,8,[`name`])]),default:O(()=>[d(` `+C(T(H).toUpperCase()),1)]),_:1},8,[`type`]),f(T(M),{style:{"max-width":`300px`}},{default:O(()=>[d(C(T(V)),1)]),_:1}),u(`span`,ft,C(T(Y)(T(S))),1)]),u(`div`,pt,[f(T(A),{size:`small`,type:`tertiary`,disabled:T(v),onClick:T(W)},{icon:O(()=>[f(r,{name:`ic:outline-refresh`})]),default:O(()=>[t[7]||=d(` 刷新 `,-1)]),_:1},8,[`disabled`,`onClick`]),f(T(A),{size:`small`,type:`primary`,onClick:T(X)},{icon:O(()=>[f(r,{name:T(J)?`ic:outline-fullscreen-exit`:`ic:outline-fullscreen`},null,8,[`name`])]),default:O(()=>[d(` `+C(T(J)?`退出全屏`:`全屏`),1)]),_:1},8,[`onClick`])])])]),c(` 预览内容区域 `),u(`div`,mt,[c(` 加载和错误状态 `),T(k)?T(v)||T(x)?(y(),l(`div`,ht,[T(v)?(y(),s(T(L),{key:0,size:`large`},{description:O(()=>[d(` 正在加载`+C(T(H).toUpperCase())+`文件... `,1)]),_:1})):(y(),s(T(I),{key:1,status:`error`,title:`预览失败`,description:T(x)},{footer:O(()=>[f(T(A),{onClick:T(W)},{default:O(()=>[...t[8]||=[d(`重试`,-1)]]),_:1},8,[`onClick`])]),_:1},8,[`description`]))])):(y(),l(a,{key:2},[c(` 文件预览 — 委托给子组件 `),T(H)===`pdf`?(y(),s(me,{key:0,"pdf-url":T(j),"total-pages":T(N)},null,8,[`pdf-url`,`total-pages`])):T(H)===`word`?(y(),s(Ee,{key:1,content:T(F),headings:T(R)},null,8,[`content`,`headings`])):T(H)===`excel`?(y(),s(We,{key:2,sheets:T(z),onReload:T(W)},null,8,[`sheets`,`onReload`])):(y(),l(a,{key:3},[c(` 不支持的文件类型 `),f(T(I),{status:`warning`,title:`不支持的文件格式`,description:`暂不支持预览 ${T(H).toUpperCase()} 格式文件`},null,8,[`description`])],2112))],64)):(y(),s(T(I),{key:0,status:`info`,title:`暂无预览文件`,description:`选择文件后即可预览`}))])])],512)]),_:1},8,[`show`]))])}}}),[[`__scopeId`,`data-v-3988cd59`]]);export{qe as n,Ke as r,gt as t};
|
|
1
|
+
import{t as e}from"./C_Icon2.js";import{t}from"./export-helper.js";import{t as n}from"./html.js";import{n as r,t as i}from"./xlsx2.js";import{Fragment as a,computed as o,createBlock as s,createCommentVNode as c,createElementBlock as l,createElementVNode as u,createTextVNode as d,createVNode as f,defineComponent as p,isRef as m,normalizeClass as h,normalizeStyle as g,onMounted as _,onUnmounted as v,openBlock as y,ref as b,renderList as x,resolveComponent as S,toDisplayString as C,toRefs as w,unref as T,vShow as E,watch as D,withCtx as O,withDirectives as k}from"vue";import{NButton as A,NDivider as j,NEllipsis as M,NEmpty as N,NModal as P,NPagination as F,NResult as I,NSpin as L,NTabPane as R,NTabs as z,NTag as B,NText as V}from"naive-ui";import H from"mammoth";const U={pdf:`pdf`,doc:`word`,docx:`word`,xls:`excel`,xlsx:`excel`},W={pdf:{tagType:`error`,icon:`ic:outline-picture-as-pdf`,color:`#dc2626`},word:{tagType:`info`,icon:`ic:outline-description`,color:`#2563eb`},excel:{tagType:`success`,icon:`ic:outline-grid-on`,color:`#16a34a`},unknown:{tagType:`default`,icon:`ic:outline-insert-drive-file`,color:`#6b7280`}},G={pdf:{min:.5,max:3,step:.25,default:1},word:{min:50,max:200,step:10,default:100}},K=[20,50,100,200],q=[`fullscreenchange`,`webkitfullscreenchange`,`mozfullscreenchange`,`MSFullscreenChange`],J=e=>{try{let t=e.split(`/`).pop()||e.split(`\\`).pop();if(t?.includes(`.`)){let n=decodeURIComponent(t.split(`?`)[0]);if(n&&n!==e)return n}}catch(e){console.warn(`解析URL文件名失败:`,e)}return`未知文件`},Y=e=>{if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/t**+r).toFixed(1))+` `+n[r]},X=e=>{if(!e||e===`未知文件`)return`unknown`;let t=e.toLowerCase().split(`.`).pop();return t&&U[t]||`unknown`},Z=e=>W[e]||W.unknown,ee=(e,t)=>n=>{let{min:r,max:i,step:a,default:o}=t;switch(n){case`reset`:e.value=o;break;case`in`:e.value<i&&(e.value+=a);break;case`out`:e.value>r&&(e.value-=a);break}},te=e=>{let t=``;for(;e>=0;)t=String.fromCharCode(65+e%26)+t,e=Math.floor(e/26)-1;return t},ne=e=>e==null?``:String(e),Q=1e5,re=e=>{if(e==null||e===``)return`cell-empty`;let t=String(e).trim();return!isNaN(Number(t))&&t!==``?`cell-number`:t.match(/[■▬▪▫─━]/)?`cell-gantt`:t.match(/^\d{4}[-/]\d{2}[-/]\d{2}/)||t.match(/^\d{2}[-/]\d{2}[-/]\d{4}/)?`cell-date`:[`true`,`false`].includes(t.toLowerCase())?`cell-boolean`:t.length>20?`cell-text cell-long`:`cell-text`};function $(e,t,n){if(e===void 0)return t;if(!Number.isSafeInteger(e)||e<=0)throw Error(`previewLimits.${n} 必须为有限正整数`);return e}function ie(e,t){let n=t?.isMain?t:{rowspan:1,colspan:1};return{value:e?.v??``,displayValue:e?e.w??r.format_cell(e):``,type:e?.t,merged:!!t,hidden:!!(t&&!t.isMain),rowspan:n.rowspan,colspan:n.colspan}}function ae(e,t,n){let{s:r,e:i}=e;return[r.r,r.c,i.r,i.c].every(Number.isSafeInteger)&&r.r>=0&&r.c>=0&&i.r<=t&&i.c<=n&&i.r>=r.r&&i.c>=r.c}const oe=(e,t,n=Q)=>{let{c:i,r:a}=r.decode_range(e[`!ref`]||`A1:A1`).e,o=(i+1)*(a+1);if(!Number.isSafeInteger(o)||o<1||o>$(n,Q,`maxCells`))throw Error(`工作表范围超过 ${n.toLocaleString()} 个单元格的预览上限,请下载文件查看`);let s=Array.from({length:i+1},(t,n)=>{let i=e[r.encode_cell({r:0,c:n})],a=i?String(i.v??``).trim():`列${n+1}`;return{title:a||`列${n+1}`,key:`col_${n}`,width:Math.min(Math.max(a.length*12,80),200)}}),c=new Map,l=0;return t.forEach(e=>{if(!ae(e,a,i))return;let{s:{r:t,c:n},e:{r,c:s}}=e;if(l+=(r-t+1)*(s-n+1),!Number.isSafeInteger(l)||l>o)throw Error(`合并单元格累计范围超过预览上限,请下载文件查看`);for(let e=t;e<=r;e++)for(let i=n;i<=s;i++)c.set(`${e}-${i}`,{isMain:e===t&&i===n,rowspan:r-t+1,colspan:s-n+1})}),{data:Array.from({length:a+1},(t,n)=>{let a={};for(let t=0;t<=i;t++){let i=e[r.encode_cell({r:n,c:t})],o=c.get(`${n}-${t}`);a[`col_${t}`]=ie(i,o)}return a}),columns:s}};async function se(e){return{url:URL.createObjectURL(e)+`#toolbar=1&navpanes=1&scrollbar=1&view=FitH`,totalPages:1}}async function ce(e){let t=await e.arrayBuffer(),r=await H.convertToHtml({arrayBuffer:t,styleMap:[`p[style-name='Heading 1'] => h1:fresh`,`p[style-name='Heading 2'] => h2:fresh`,`p[style-name='Heading 3'] => h3:fresh`,`p[style-name='Title'] => h1.title:fresh`]}),i=[],a=document.createElement(`div`);a.innerHTML=n(r.value);let o=a.querySelectorAll(`h1, h2, h3, h4, h5, h6`);return Array.from(o).forEach((e,t)=>{let n=`heading-${t}`,r=parseInt(e.tagName.charAt(1)),a=e.textContent||``;e.id=n,i.push({id:n,text:a,level:r})}),{content:a.innerHTML,headings:i}}async function le(e,t={}){let n=$(t.maxBytes,33554432,`maxBytes`),r=$(t.maxCells,Q,`maxCells`);if(e.size>n)throw Error(`Excel 文件超过 ${Y(n)} 的预览上限,请下载文件查看`);let a=i(await e.arrayBuffer(),{type:`array`,cellStyles:!0,cellFormula:!0,cellDates:!0});if(!a.SheetNames.length)throw Error(`Excel文件中没有找到工作表`);let o=a.SheetNames.map(e=>{let t=a.Sheets[e],n=t[`!merges`]||[];return{name:e,data:[],merges:n,columns:[],load:()=>oe(t,n,r)}});return Object.assign(o[0],o[0].load?.()),{sheets:o}}const ue={class:`file-container pdf-container`},de={class:`file-toolbar`},fe={class:`file-viewer`},pe=[`src`];var me=t(p({name:`FilePreviewPdfViewer`,__name:`index`,props:{pdfUrl:{},totalPages:{}},setup(e){return(t,n)=>(y(),l(`div`,ue,[u(`div`,de,[n[1]||=u(`span`,null,`PDF 阅读器 · 翻页、缩放与打印由浏览器提供`,-1),e.pdfUrl?(y(),s(T(A),{key:0,tag:`a`,href:e.pdfUrl,target:`_blank`,rel:`noopener noreferrer`,size:`small`},{default:O(()=>[...n[0]||=[d(`在新标签页打开`,-1)]]),_:1},8,[`href`])):c(`v-if`,!0)]),u(`div`,fe,[e.pdfUrl?(y(),l(`iframe`,{key:0,src:e.pdfUrl,title:`PDF预览`,class:`pdf-frame`},null,8,pe)):c(`v-if`,!0)])]))}}),[[`__scopeId`,`data-v-db027bb4`]]);const he={class:`file-container word-container`},ge={class:`file-toolbar`},_e={class:`flex gap-2 items-center`},ve={class:`text-sm text-gray-600 min-w-12 text-center`},ye={class:`word-layout`},be={class:`word-main`},xe={key:0,class:`word-outline`},Se={class:`outline-content`},Ce=[`onClick`],we={class:`word-content`},Te=[`innerHTML`];var Ee=t(p({__name:`index`,props:{content:{},headings:{}},setup(t){let n=b(!0),r=b(100),i=ee(r,G.word),o=e=>{document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`})};return(s,p)=>{let m=e;return y(),l(`div`,he,[u(`div`,ge,[u(`div`,_e,[f(T(A),{size:`small`,onClick:p[0]||=e=>n.value=!n.value},{icon:O(()=>[f(m,{name:`ic:outline-list`})]),default:O(()=>[d(` `+C(n.value?`隐藏`:`显示`)+`目录 `,1)]),_:1}),f(T(j),{vertical:``}),f(T(A),{size:`small`,disabled:r.value<=50,onClick:p[1]||=e=>T(i)(`out`)},{icon:O(()=>[f(m,{name:`ic:outline-zoom-out`})]),_:1},8,[`disabled`]),u(`span`,ve,C(r.value)+`% `,1),f(T(A),{size:`small`,disabled:r.value>=200,onClick:p[2]||=e=>T(i)(`in`)},{icon:O(()=>[f(m,{name:`ic:outline-zoom-in`})]),_:1},8,[`disabled`]),f(T(A),{size:`small`,onClick:p[3]||=e=>T(i)(`reset`)},{icon:O(()=>[f(m,{name:`ic:outline-fit-screen`})]),default:O(()=>[p[4]||=d(` 重置 `,-1)]),_:1})])]),u(`div`,ye,[u(`div`,be,[c(` 侧边栏目录 `),n.value?(y(),l(`div`,xe,[p[5]||=u(`div`,{class:`outline-header`},[u(`h3`,{class:`text-sm font-semibold`},`文档目录`)],-1),u(`div`,Se,[(y(!0),l(a,null,x(t.headings,(e,t)=>(y(),l(`div`,{key:t,class:h([`outline-item`,`level-${e.level}`]),onClick:t=>o(e.id)},C(e.text),11,Ce))),128))])])):c(`v-if`,!0),c(` 主要内容区域 `),u(`div`,we,[u(`div`,{class:`word-document`,style:g({transform:`scale(${r.value/100})`,transformOrigin:`top center`}),innerHTML:t.content},null,12,Te)])])])])}}}),[[`__scopeId`,`data-v-dae08a5f`]]);const De={class:`file-container excel-container`},Oe={class:`file-toolbar`},ke={class:`flex justify-between items-center`},Ae={class:`flex gap-2 items-center`},je={key:1,class:`text-sm text-gray-600`},Me={class:`flex gap-2 items-center`},Ne={class:`excel-viewer`},Pe={key:0,class:`excel-info`},Fe={class:`excel-table-container`},Ie={key:0,class:`excel-table`},Le={class:`header-content`},Re={class:`column-letter`},ze={class:`column-title`},Be={class:`row-number`},Ve=[`rowspan`,`colspan`,`title`],He={key:1,class:`excel-empty`},Ue={key:0,class:`excel-pagination`};var We=t(p({__name:`index`,props:{sheets:{}},emits:[`reload`],setup(t){let n=t,r=b(``),i=b(``),p=b(!1),m=b(1),_=b(50),v=b([]),S=b([]),w=o(()=>Math.ceil(v.value.length/_.value)),j=o(()=>{let e=(m.value-1)*_.value;return v.value.slice(e,e+_.value)}),M=e=>{_.value=e,m.value=1},P=e=>{i.value=``,v.value=[],S.value=[],m.value=1;let t=n.sheets.find(t=>t.name===e);if(t)try{let e=t.data.length>0?t:t.load?.()??t;v.value=e.data,S.value=e.columns}catch(e){i.value=e instanceof Error?e.message:`工作表解析失败`}};return D(r,e=>{P(e)}),D(()=>n.sheets,e=>{r.value=e[0]?.name??``,P(r.value)},{immediate:!0}),(n,o)=>{let b=e;return y(),l(`div`,De,[c(` 工具栏 `),u(`div`,Oe,[u(`div`,ke,[u(`div`,Ae,[t.sheets.length>1?(y(),s(T(z),{key:0,value:r.value,"onUpdate:value":o[0]||=e=>r.value=e,type:`card`,size:`small`},{default:O(()=>[(y(!0),l(a,null,x(t.sheets,e=>(y(),s(T(R),{key:e.name,name:e.name},{tab:O(()=>[d(C(e.name),1)]),_:2},1032,[`name`]))),128))]),_:1},8,[`value`])):(y(),l(`span`,je,` 工作表: `+C(r.value),1))]),u(`div`,Me,[f(T(A),{size:`small`,onClick:o[1]||=e=>p.value=!p.value},{icon:O(()=>[f(b,{name:`ic:outline-format-paint`})]),default:O(()=>[d(` `+C(p.value?`紧凑视图`:`完整格式`),1)]),_:1})])])]),u(`div`,Ne,[c(` 信息面板 `),v.value.length>0?(y(),l(`div`,Pe,[f(T(V),{depth:`3`,class:`text-sm`},{default:O(()=>[d(` 当前工作表: `+C(r.value)+` | 总行数: `+C(v.value.length)+` | 总列数: `+C(S.value.length)+` | 当前页: `+C(m.value)+`/`+C(w.value),1)]),_:1})])):c(`v-if`,!0),c(` 表格 `),u(`div`,Fe,[u(`div`,{class:h([`excel-table-wrapper`,{"simple-mode":!p.value}])},[v.value.length>0?(y(),l(`table`,Ie,[u(`thead`,null,[u(`tr`,null,[o[4]||=u(`th`,{class:`row-number`},`行号`,-1),(y(!0),l(a,null,x(S.value,(e,t)=>(y(),l(`th`,{key:e.key,class:`excel-header`,style:g({minWidth:e.width+`px`})},[u(`div`,Le,[u(`span`,Re,C(T(te)(t)),1),u(`span`,ze,C(e.title),1)])],4))),128))])]),u(`tbody`,null,[(y(!0),l(a,null,x(j.value,(e,t)=>(y(),l(`tr`,{key:t,class:`excel-row`},[u(`td`,Be,C((m.value-1)*_.value+t+1),1),(y(!0),l(a,null,x(S.value,t=>k((y(),l(`td`,{key:t.key,class:h([`excel-cell`,[T(re)(e[t.key]?.value),e[t.key]?.merged?`merged-cell`:``,p.value?``:`compact-cell`]]),rowspan:e[t.key]?.rowspan||1,colspan:e[t.key]?.colspan||1,title:e[t.key]?.displayValue??T(ne)(e[t.key]?.value)},C(e[t.key]?.displayValue??T(ne)(e[t.key]?.value)),11,Ve)),[[E,!e[t.key]?.hidden]])),128))]))),128))])])):(y(),l(`div`,He,[f(T(N),{description:i.value||`该工作表没有数据或解析失败`},{extra:O(()=>[f(T(A),{size:`small`,onClick:o[2]||=e=>n.$emit(`reload`)},{default:O(()=>[...o[5]||=[d(` 重新解析 `,-1)]]),_:1})]),_:1},8,[`description`])]))],2),c(` 分页 `),w.value>1?(y(),l(`div`,Ue,[f(T(F),{page:m.value,"onUpdate:page":o[3]||=e=>m.value=e,"page-count":w.value,"page-size":_.value,"show-size-picker":``,"page-sizes":T(K),"onUpdate:pageSize":M},null,8,[`page`,`page-count`,`page-size`,`page-sizes`])])):c(`v-if`,!0)])])])}}}),[[`__scopeId`,`data-v-5a0226ce`]]);function Ge(e,t){if(!e.trim())return null;try{let n=new URL(t),r=new URL(e,n);if(r.username||r.password)return null;if(r.protocol===`https:`||r.protocol===`http:`&&r.origin===n.origin)return r.href}catch{}return null}function Ke(e,t){let{file:n,url:r,fileName:i,previewLimits:a}=e,s=b(!1),c=b(``),l=b(0),u=b(!1),d=b(``),f=b(0),p=b(``),m=b([]),h=b([]),g=0,_=null,y=!1,x=(e,t)=>e===g&&!y&&!t.signal.aborted,S=o(()=>i.value&&i.value!==`未知文件`?i.value:n.value?.name?n.value.name:r.value?J(r.value):`未知文件`),C=o(()=>X(S.value)),w=o(()=>Z(C.value)),T=o(()=>!!(n.value||r.value)),E=()=>{let e=d.value;d.value=``,e.startsWith(`blob:`)&&URL.revokeObjectURL(e.split(`#`)[0])},O=()=>{c.value=``,s.value=!1,l.value=0,E(),f.value=0,p.value=``,m.value=[],h.value=[]},k=e=>{c.value=e,s.value=!1},A=()=>{g+=1,_?.abort(),_=null,O()},j=async e=>{let t=n.value,i=r.value;if(t)return t;if(i){let t=Ge(i,window.location.href);if(!t)throw Error(`不支持此文件地址`);let n=await fetch(t,{signal:e});if(!n.ok)throw Error(`HTTP ${n.status}: ${n.statusText}`);let r=await n.blob();return new File([r],S.value,{type:r.type})}throw Error(`未提供文件或URL`)},M=async(e,t,n)=>{switch(t){case`pdf`:{let t=await se(e);if(n!==g){URL.revokeObjectURL(t.url.split(`#`)[0]);return}d.value=t.url,f.value=t.totalPages;break}case`word`:{let t=await ce(e);if(n!==g)return;p.value=t.content,m.value=t.headings;break}case`excel`:{let t=await le(e,a?.value);if(n!==g)return;h.value=t.sheets;break}default:throw Error(`不支持的文件格式`)}},N=async()=>{if(y)return!1;let e=++g;_?.abort();let t=new AbortController;if(_=t,O(),!T.value)return _=null,!1;s.value=!0;try{let n=C.value,r=await j(t.signal);return e===g?(l.value=r.size,await M(r,n,e),x(e,t)):!1}catch(n){if(!x(e,t))return!1;let r=n instanceof Error?n.message:`未知错误`;return k(`${C.value.toUpperCase()}文件加载失败: ${r}`),!1}finally{e===g&&(s.value=!1,_=null)}};return D([n,r],([e,t])=>{!e&&!t&&A()},{flush:`sync`}),D(()=>n.value?.size,e=>{l.value=e||0},{immediate:!0}),v(()=>{y=!0,A()}),{loading:s,error:c,fileSize:l,showModal:u,hasSource:T,pdfUrl:d,pdfTotalPages:f,wordContent:p,wordHeadings:m,excelSheets:h,displayFileName:S,fileType:C,fileConfig:w,loadFile:N,openPreview:async()=>{if(y)return;let e=n.value||r.value;u.value=!0,await N()&&e&&e===(n.value||r.value)&&!y&&t(`preview`,e)},downloadFile:()=>{let e=n.value||r.value;if(!(y||!e)){if(n.value){let e=URL.createObjectURL(n.value);Object.assign(document.createElement(`a`),{href:e,download:S.value}).click(),URL.revokeObjectURL(e)}else if(r.value){let e=Ge(r.value,window.location.href);if(!e){k(`不支持此文件地址`);return}window.open(e,`_blank`,`noopener,noreferrer`)}t(`download`,e)}},clearPreview:A}}function qe(e){let t=b(!1),n=()=>{t.value=!!document.fullscreenElement},r=(e,t=0)=>t>=e.length?(console.warn(`无法切换全屏状态`),Promise.resolve()):e[t]().catch(()=>r(e,t+1));return _(()=>{q.forEach(e=>document.addEventListener(e,n))}),v(()=>{q.forEach(e=>document.removeEventListener(e,n))}),{isFullscreen:t,toggleFullscreen:async()=>{let t=e.value;t&&await r(document.fullscreenElement?[()=>document.exitFullscreen(),()=>document.webkitExitFullscreen(),()=>document.mozCancelFullScreen(),()=>document.msExitFullscreen()]:[()=>t.requestFullscreen(),()=>t.webkitRequestFullscreen(),()=>t.mozRequestFullScreen(),()=>t.msRequestFullscreen()])},exitFullscreen:async()=>{if(document.fullscreenElement)try{await document.exitFullscreen()}catch{}t.value=!1}}}const Je={class:`c-file-preview-wrapper`},Ye={key:0,class:`file-info-card`},Xe={class:`file-info`},Ze={class:`file-icon`},Qe={class:`file-details`},$e={class:`file-name`},et={class:`file-meta`},tt={class:`file-size`},nt={class:`file-actions`},rt={key:1,class:`c-file-preview-inline`},it={key:1,class:`status-container`,role:`status`},at={class:`modal-header`},ot={class:`modal-title`},st={class:`modal-actions`},ct={class:`modal-content`},lt={class:`preview-header`},ut={class:`flex justify-between items-center`},dt={class:`flex items-center gap-3`},ft={class:`text-sm text-gray-500`},pt={class:`flex gap-2`},mt={class:`preview-content`},ht={key:1,class:`status-container`};var gt=t(p({name:`C_FilePreview`,__name:`index`,props:{previewLimits:{},file:{},url:{},fileName:{default:`未知文件`},autoPreview:{type:Boolean,default:!1},inline:{type:Boolean,default:!1}},emits:[`preview`,`download`],setup(t,{emit:n}){let r=t,{file:i,url:o,fileName:p,autoPreview:h,inline:g,previewLimits:_}=w(r),{loading:v,error:x,fileSize:S,showModal:E,hasSource:k,pdfUrl:j,pdfTotalPages:N,wordContent:F,wordHeadings:R,excelSheets:z,displayFileName:V,fileType:H,fileConfig:U,loadFile:W,openPreview:G,downloadFile:K}=Ke({file:i,url:o,fileName:p,previewLimits:_},n),q=b(),{isFullscreen:J,toggleFullscreen:X,exitFullscreen:Z}=qe(q);return D(E,e=>{e||Z()}),D([i,o,h,g,p,()=>r.previewLimits?.maxBytes,()=>r.previewLimits?.maxCells],(e,t)=>{if(!(typeof window>`u`||!k.value)){if(g.value){W();return}if(E.value){[0,1,4,5,6].some(n=>e[n]!==t?.[n])&&W();return}h.value&&G()}},{immediate:!0}),(t,n)=>{let r=e;return y(),l(`div`,Je,[c(` 文件信息卡片模式 `),!T(h)&&!T(g)?(y(),l(`div`,Ye,[u(`div`,Xe,[u(`div`,Ze,[f(r,{name:T(U).icon,size:40,color:T(U).color},null,8,[`name`,`color`])]),u(`div`,Qe,[u(`div`,$e,[f(T(M),{style:{"max-width":`250px`}},{default:O(()=>[d(C(T(V)),1)]),_:1}),f(T(B),{type:T(U).tagType,size:`small`},{default:O(()=>[d(C(T(H).toUpperCase()),1)]),_:1},8,[`type`])]),u(`div`,et,[u(`span`,tt,C(T(Y)(T(S))),1)])]),u(`div`,nt,[f(T(A),{type:`primary`,onClick:T(G)},{icon:O(()=>[f(r,{name:`ic:outline-visibility`})]),default:O(()=>[n[2]||=d(` 预览 `,-1)]),_:1},8,[`onClick`]),f(T(A),{type:`tertiary`,onClick:T(K)},{icon:O(()=>[f(r,{name:`ic:outline-download`})]),default:O(()=>[n[3]||=d(` 下载 `,-1)]),_:1},8,[`onClick`])])])])):c(`v-if`,!0),T(g)?(y(),l(`div`,rt,[T(k)?T(v)||T(x)?(y(),l(`div`,it,[T(v)?(y(),s(T(L),{key:0,size:`large`},{description:O(()=>[...n[4]||=[d(`正在加载文档…`,-1)]]),_:1})):(y(),s(T(I),{key:1,status:`error`,title:`预览失败`,description:T(x)},{footer:O(()=>[f(T(A),{size:`small`,onClick:T(W)},{default:O(()=>[...n[5]||=[d(`重试`,-1)]]),_:1},8,[`onClick`])]),_:1},8,[`description`]))])):T(H)===`pdf`?(y(),s(me,{key:2,"pdf-url":T(j),"total-pages":T(N)},null,8,[`pdf-url`,`total-pages`])):T(H)===`word`?(y(),s(Ee,{key:3,content:T(F),headings:T(R)},null,8,[`content`,`headings`])):T(H)===`excel`?(y(),s(We,{key:4,sheets:T(z),onReload:T(W)},null,8,[`sheets`,`onReload`])):(y(),s(T(I),{key:5,status:`warning`,title:`不支持的文件格式`,description:`支持 PDF、DOCX、XLSX 和 XLS 文件`})):(y(),s(T(I),{key:0,status:`info`,title:`暂无预览文件`,description:`选择文件后即可预览`}))])):c(`v-if`,!0),c(` 模态框预览 `),T(g)?c(`v-if`,!0):(y(),s(T(P),{key:2,show:T(E),"onUpdate:show":n[1]||=e=>m(E)?E.value=e:null,"mask-closable":!1,closable:!1,"auto-focus":!1,"transform-origin":`center`,style:{width:`85vw`,"max-width":`1200px`,"min-width":`800px`,height:`75vh`,"max-height":`700px`,"min-height":`500px`}},{default:O(()=>[u(`div`,{ref_key:`modalContainer`,ref:q,class:`modal-container`},[c(` 自定义头部 `),u(`div`,at,[u(`div`,ot,[f(r,{name:T(U).icon,size:20,color:T(U).color},null,8,[`name`,`color`]),u(`span`,null,C(T(V)),1)]),u(`div`,st,[f(T(A),{size:`small`,type:`tertiary`,onClick:T(K)},{icon:O(()=>[f(r,{name:`ic:outline-download`})]),default:O(()=>[n[6]||=d(` 下载 `,-1)]),_:1},8,[`onClick`]),f(T(A),{size:`small`,type:`tertiary`,onClick:n[0]||=e=>E.value=!1},{icon:O(()=>[f(r,{name:`ic:outline-close`})]),_:1})])]),c(` 预览内容 `),u(`div`,ct,[c(` 文件信息头部 `),u(`div`,lt,[u(`div`,ut,[u(`div`,dt,[f(T(B),{type:T(U).tagType,size:`small`},{icon:O(()=>[f(r,{name:T(U).icon},null,8,[`name`])]),default:O(()=>[d(` `+C(T(H).toUpperCase()),1)]),_:1},8,[`type`]),f(T(M),{style:{"max-width":`300px`}},{default:O(()=>[d(C(T(V)),1)]),_:1}),u(`span`,ft,C(T(Y)(T(S))),1)]),u(`div`,pt,[f(T(A),{size:`small`,type:`tertiary`,disabled:T(v),onClick:T(W)},{icon:O(()=>[f(r,{name:`ic:outline-refresh`})]),default:O(()=>[n[7]||=d(` 刷新 `,-1)]),_:1},8,[`disabled`,`onClick`]),f(T(A),{size:`small`,type:`primary`,onClick:T(X)},{icon:O(()=>[f(r,{name:T(J)?`ic:outline-fullscreen-exit`:`ic:outline-fullscreen`},null,8,[`name`])]),default:O(()=>[d(` `+C(T(J)?`退出全屏`:`全屏`),1)]),_:1},8,[`onClick`])])])]),c(` 预览内容区域 `),u(`div`,mt,[c(` 加载和错误状态 `),T(k)?T(v)||T(x)?(y(),l(`div`,ht,[T(v)?(y(),s(T(L),{key:0,size:`large`},{description:O(()=>[d(` 正在加载`+C(T(H).toUpperCase())+`文件... `,1)]),_:1})):(y(),s(T(I),{key:1,status:`error`,title:`预览失败`,description:T(x)},{footer:O(()=>[f(T(A),{onClick:T(W)},{default:O(()=>[...n[8]||=[d(`重试`,-1)]]),_:1},8,[`onClick`])]),_:1},8,[`description`]))])):(y(),l(a,{key:2},[c(` 文件预览 — 委托给子组件 `),T(H)===`pdf`?(y(),s(me,{key:0,"pdf-url":T(j),"total-pages":T(N)},null,8,[`pdf-url`,`total-pages`])):T(H)===`word`?(y(),s(Ee,{key:1,content:T(F),headings:T(R)},null,8,[`content`,`headings`])):T(H)===`excel`?(y(),s(We,{key:2,sheets:T(z),onReload:T(W)},null,8,[`sheets`,`onReload`])):(y(),l(a,{key:3},[c(` 不支持的文件类型 `),f(T(I),{status:`warning`,title:`不支持的文件格式`,description:`暂不支持预览 ${T(H).toUpperCase()} 格式文件`},null,8,[`description`])],2112))],64)):(y(),s(T(I),{key:0,status:`info`,title:`暂无预览文件`,description:`选择文件后即可预览`}))])])],512)]),_:1},8,[`show`]))])}}}),[[`__scopeId`,`data-v-3988cd59`]]);export{qe as n,Ke as r,gt as t};
|
package/dist/C_Form.d.cts
CHANGED
|
@@ -2,5 +2,6 @@ import { t as OptionsState } from "./options.cjs";
|
|
|
2
2
|
import { A as FormTabActionsSlotProps, B as TabsLayoutConfig, C as FormMode, D as FormSlots, E as FormRecord, F as LayoutType, G as SPEC_RULES, H as NAIVE_COMBOS, I as MaybePromise, L as OptionItem, M as InlineLayoutConfig, N as LabelPlacement, O as FormStepActionsSlotProps, P as LayoutConfig, R as StepsLayoutConfig, S as FormInstance, T as FormOption, U as PRESET_RULES, V as FormValidationRule, W as RuleSpec, _ as DynamicFormState, a as ResolvedFormConfig, b as FormActionSlotProps, c as shouldShowActions, d as CardLayoutConfig, f as ComponentType, g as DynamicFormController, h as DynamicFormConfig, i as LayoutCallbacks, j as GridLayoutConfig, k as FormSubmitContext, l as useFormGlobalConfig, m as DynamicFieldConfig, n as FormConfig, o as mergeFormConfig, p as CustomLayoutConfig, r as LAYOUTS_WITH_OWN_CONTROLS, s as resolveFormConfig, t as FORM_DEFAULTS, u as AsyncOptionsContext, v as FieldPath, w as FormModel, x as FormErrorContext, y as FieldPathValue, z as SubmitEventPayload } from "./useFormConfig.cjs";
|
|
3
3
|
import { t as ComponentDensity } from "./density.cjs";
|
|
4
4
|
import { FORM_GLOBAL_CONFIG_KEY } from "./config.cjs";
|
|
5
|
-
import {
|
|
5
|
+
import { a as FormRendererRegistry, c as createFormRendererRegistry, d as useFormRenderer, i as FormRendererContext, l as registerRenderer, n as FORM_RENDERER_REGISTRY_KEY, o as RendererProps, r as FormRenderer, s as UseFormRendererOptions, t as ComponentMap, u as unregisterRenderer } from "./useFormRenderer.cjs";
|
|
6
|
+
import { a as UseFormDirtyReturn, c as UseCFormOptions, d as defineFormOptions, f as useCForm, i as useDynamicFormState, l as UseCFormReturn, n as DynamicFormStateType, o as useFormDirty, p as _default, r as FIELD_TYPE_OPTIONS, s as useFormState, t as DYNAMIC_FORM_STATE_KEY, u as defineFormConfig } from "./useDynamicFormState.cjs";
|
|
6
7
|
export { type AsyncOptionsContext, _default as C_Form, type CardLayoutConfig, type ComponentDensity, type ComponentMap, type ComponentType, type CustomLayoutConfig, DYNAMIC_FORM_STATE_KEY, type DynamicFieldConfig, type DynamicFormConfig, type DynamicFormController, type DynamicFormState, type DynamicFormStateType, FIELD_TYPE_OPTIONS, FORM_DEFAULTS, FORM_GLOBAL_CONFIG_KEY, FORM_RENDERER_REGISTRY_KEY, type FieldPath, type FieldPathValue, type FormActionSlotProps, type FormConfig, type FormErrorContext, type FormInstance, type FormMode, type FormModel, type FormOption, type FormRecord, type FormRenderer, type FormRendererContext, type FormRendererRegistry, type FormSlots, type FormStepActionsSlotProps, type FormSubmitContext, type FormTabActionsSlotProps, type FormValidationRule, type GridLayoutConfig, type InlineLayoutConfig, LAYOUTS_WITH_OWN_CONTROLS, type LabelPlacement, type LayoutCallbacks, type LayoutConfig, type LayoutType, type MaybePromise, NAIVE_COMBOS, type OptionItem, type OptionsState, PRESET_RULES, type RendererProps, type ResolvedFormConfig, type RuleSpec, SPEC_RULES, type StepsLayoutConfig, type SubmitEventPayload, type TabsLayoutConfig, type UseCFormOptions, type UseCFormReturn, type UseFormDirtyReturn, type UseFormRendererOptions, createFormRendererRegistry, defineFormConfig, defineFormOptions, mergeFormConfig, registerRenderer, resolveFormConfig, shouldShowActions, unregisterRenderer, useCForm, useDynamicFormState, useFormDirty, useFormGlobalConfig, useFormRenderer, useFormState };
|
package/dist/C_Form.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { A as FormTabActionsSlotProps, B as TabsLayoutConfig, C as FormMode, D as FormSlots, E as FormRecord, F as LayoutType, G as SPEC_RULES, H as NAIVE_COMBOS, I as MaybePromise, K as OptionsState, L as OptionItem, M as InlineLayoutConfig, N as LabelPlacement, O as FormStepActionsSlotProps, P as LayoutConfig, R as StepsLayoutConfig, S as FormInstance, T as FormOption, U as PRESET_RULES, V as FormValidationRule, W as RuleSpec, _ as DynamicFormState, a as ResolvedFormConfig, b as FormActionSlotProps, c as shouldShowActions, d as CardLayoutConfig, f as ComponentType, g as DynamicFormController, h as DynamicFormConfig, i as LayoutCallbacks, j as GridLayoutConfig, k as FormSubmitContext, l as useFormGlobalConfig, m as DynamicFieldConfig, n as FormConfig, o as mergeFormConfig, p as CustomLayoutConfig, r as LAYOUTS_WITH_OWN_CONTROLS, s as resolveFormConfig, t as FORM_DEFAULTS, u as AsyncOptionsContext, v as FieldPath, w as FormModel, x as FormErrorContext, y as FieldPathValue, z as SubmitEventPayload } from "./useFormConfig.js";
|
|
2
2
|
import { t as ComponentDensity } from "./density.js";
|
|
3
3
|
import { FORM_GLOBAL_CONFIG_KEY } from "./config.js";
|
|
4
|
-
import {
|
|
4
|
+
import { a as FormRendererRegistry, c as createFormRendererRegistry, d as useFormRenderer, i as FormRendererContext, l as registerRenderer, n as FORM_RENDERER_REGISTRY_KEY, o as RendererProps, r as FormRenderer, s as UseFormRendererOptions, t as ComponentMap, u as unregisterRenderer } from "./useFormRenderer.js";
|
|
5
|
+
import { a as UseFormDirtyReturn, c as UseCFormOptions, d as defineFormOptions, f as useCForm, i as useDynamicFormState, l as UseCFormReturn, n as DynamicFormStateType, o as useFormDirty, p as _default, r as FIELD_TYPE_OPTIONS, s as useFormState, t as DYNAMIC_FORM_STATE_KEY, u as defineFormConfig } from "./useDynamicFormState.js";
|
|
5
6
|
export { type AsyncOptionsContext, _default as C_Form, type CardLayoutConfig, type ComponentDensity, type ComponentMap, type ComponentType, type CustomLayoutConfig, DYNAMIC_FORM_STATE_KEY, type DynamicFieldConfig, type DynamicFormConfig, type DynamicFormController, type DynamicFormState, type DynamicFormStateType, FIELD_TYPE_OPTIONS, FORM_DEFAULTS, FORM_GLOBAL_CONFIG_KEY, FORM_RENDERER_REGISTRY_KEY, type FieldPath, type FieldPathValue, type FormActionSlotProps, type FormConfig, type FormErrorContext, type FormInstance, type FormMode, type FormModel, type FormOption, type FormRecord, type FormRenderer, type FormRendererContext, type FormRendererRegistry, type FormSlots, type FormStepActionsSlotProps, type FormSubmitContext, type FormTabActionsSlotProps, type FormValidationRule, type GridLayoutConfig, type InlineLayoutConfig, LAYOUTS_WITH_OWN_CONTROLS, type LabelPlacement, type LayoutCallbacks, type LayoutConfig, type LayoutType, type MaybePromise, NAIVE_COMBOS, type OptionItem, type OptionsState, PRESET_RULES, type RendererProps, type ResolvedFormConfig, type RuleSpec, SPEC_RULES, type StepsLayoutConfig, type SubmitEventPayload, type TabsLayoutConfig, type UseCFormOptions, type UseCFormReturn, type UseFormDirtyReturn, type UseFormRendererOptions, createFormRendererRegistry, defineFormConfig, defineFormOptions, mergeFormConfig, registerRenderer, resolveFormConfig, shouldShowActions, unregisterRenderer, useCForm, useDynamicFormState, useFormDirty, useFormGlobalConfig, useFormRenderer, useFormState };
|
package/dist/C_FormModal.css
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
|
|
67
67
|
/* 通用操作按钮组件样式 */
|
|
68
68
|
/* ================= 主容器 ================= */
|
|
69
|
-
.c-action-bar[data-v-
|
|
69
|
+
.c-action-bar[data-v-57d463a1] {
|
|
70
70
|
display: flex;
|
|
71
71
|
min-width: 0;
|
|
72
72
|
align-items: center;
|
|
@@ -78,26 +78,26 @@
|
|
|
78
78
|
border: 1px solid var(--c-border);
|
|
79
79
|
transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
|
|
80
80
|
}
|
|
81
|
-
.c-action-bar.is-align-left[data-v-
|
|
81
|
+
.c-action-bar.is-align-left[data-v-57d463a1] {
|
|
82
82
|
justify-content: flex-start;
|
|
83
83
|
}
|
|
84
|
-
.c-action-bar.is-align-center[data-v-
|
|
84
|
+
.c-action-bar.is-align-center[data-v-57d463a1] {
|
|
85
85
|
justify-content: center;
|
|
86
86
|
}
|
|
87
|
-
.c-action-bar.is-align-right[data-v-
|
|
87
|
+
.c-action-bar.is-align-right[data-v-57d463a1] {
|
|
88
88
|
justify-content: flex-end;
|
|
89
89
|
}
|
|
90
|
-
.c-action-bar.is-align-space-between[data-v-
|
|
90
|
+
.c-action-bar.is-align-space-between[data-v-57d463a1] {
|
|
91
91
|
justify-content: space-between;
|
|
92
92
|
}
|
|
93
|
-
.c-action-bar.is-align-space-around[data-v-
|
|
93
|
+
.c-action-bar.is-align-space-around[data-v-57d463a1] {
|
|
94
94
|
justify-content: space-around;
|
|
95
95
|
}
|
|
96
|
-
.c-action-bar.is-compact[data-v-
|
|
96
|
+
.c-action-bar.is-compact[data-v-57d463a1] {
|
|
97
97
|
padding: 8px;
|
|
98
98
|
margin-bottom: 8px;
|
|
99
99
|
}
|
|
100
|
-
.c-action-bar.is-inline[data-v-
|
|
100
|
+
.c-action-bar.is-inline[data-v-57d463a1] {
|
|
101
101
|
padding: 0;
|
|
102
102
|
margin-bottom: 0;
|
|
103
103
|
background: transparent;
|
|
@@ -105,104 +105,104 @@
|
|
|
105
105
|
border-radius: 0;
|
|
106
106
|
box-shadow: none;
|
|
107
107
|
}
|
|
108
|
-
.c-action-bar.is-wrap[data-v-
|
|
108
|
+
.c-action-bar.is-wrap[data-v-57d463a1] {
|
|
109
109
|
flex-wrap: wrap;
|
|
110
110
|
gap: 8px;
|
|
111
111
|
}
|
|
112
|
-
.c-action-bar.is-wrap .actions-group[data-v-
|
|
112
|
+
.c-action-bar.is-wrap .actions-group[data-v-57d463a1] {
|
|
113
113
|
flex-wrap: wrap;
|
|
114
114
|
min-width: 0;
|
|
115
115
|
max-width: 100%;
|
|
116
116
|
}
|
|
117
117
|
@media (max-width: 768px) {
|
|
118
|
-
.c-action-bar[data-v-
|
|
118
|
+
.c-action-bar[data-v-57d463a1] {
|
|
119
119
|
flex-direction: column;
|
|
120
120
|
gap: 12px;
|
|
121
121
|
}
|
|
122
|
-
.c-action-bar .actions-group[data-v-
|
|
122
|
+
.c-action-bar .actions-group[data-v-57d463a1] {
|
|
123
123
|
width: 100%;
|
|
124
124
|
justify-content: center;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/* ================= 按钮组 ================= */
|
|
129
|
-
.actions-group[data-v-
|
|
129
|
+
.actions-group[data-v-57d463a1] {
|
|
130
130
|
display: flex;
|
|
131
131
|
align-items: center;
|
|
132
132
|
gap: 12px;
|
|
133
133
|
flex-wrap: nowrap;
|
|
134
134
|
flex-shrink: 0;
|
|
135
135
|
}
|
|
136
|
-
.actions-group.actions-left[data-v-
|
|
136
|
+
.actions-group.actions-left[data-v-57d463a1] {
|
|
137
137
|
justify-content: flex-start;
|
|
138
138
|
}
|
|
139
|
-
.actions-group.actions-right[data-v-
|
|
139
|
+
.actions-group.actions-right[data-v-57d463a1] {
|
|
140
140
|
justify-content: flex-end;
|
|
141
141
|
}
|
|
142
|
-
.c-action-bar.has-only-left.is-align-center .actions-group.actions-left[data-v-
|
|
142
|
+
.c-action-bar.has-only-left.is-align-center .actions-group.actions-left[data-v-57d463a1], .c-action-bar.has-only-right.is-align-center .actions-group.actions-right[data-v-57d463a1] {
|
|
143
143
|
width: 100%;
|
|
144
144
|
justify-content: center;
|
|
145
145
|
}
|
|
146
|
-
.c-action-bar.has-only-left.is-align-space-between .actions-group.actions-left[data-v-
|
|
146
|
+
.c-action-bar.has-only-left.is-align-space-between .actions-group.actions-left[data-v-57d463a1], .c-action-bar.has-only-right.is-align-space-between .actions-group.actions-right[data-v-57d463a1] {
|
|
147
147
|
width: 100%;
|
|
148
148
|
justify-content: space-between;
|
|
149
149
|
}
|
|
150
|
-
.c-action-bar.has-only-left.is-align-space-around .actions-group.actions-left[data-v-
|
|
150
|
+
.c-action-bar.has-only-left.is-align-space-around .actions-group.actions-left[data-v-57d463a1], .c-action-bar.has-only-right.is-align-space-around .actions-group.actions-right[data-v-57d463a1] {
|
|
151
151
|
width: 100%;
|
|
152
152
|
justify-content: space-around;
|
|
153
153
|
}
|
|
154
|
-
.c-action-bar.has-only-left.is-align-right .actions-group.actions-left[data-v-
|
|
154
|
+
.c-action-bar.has-only-left.is-align-right .actions-group.actions-left[data-v-57d463a1] {
|
|
155
155
|
width: 100%;
|
|
156
156
|
justify-content: flex-end;
|
|
157
157
|
}
|
|
158
|
-
.c-action-bar.has-only-right.is-align-left .actions-group.actions-right[data-v-
|
|
158
|
+
.c-action-bar.has-only-right.is-align-left .actions-group.actions-right[data-v-57d463a1] {
|
|
159
159
|
width: 100%;
|
|
160
160
|
justify-content: flex-start;
|
|
161
161
|
}
|
|
162
|
-
.actions-group[data-v-
|
|
162
|
+
.actions-group[data-v-57d463a1] .n-button {
|
|
163
163
|
flex-shrink: 0;
|
|
164
164
|
transition: color 0.16s ease, background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
|
|
165
165
|
font-weight: 500;
|
|
166
166
|
}
|
|
167
|
-
.actions-group[data-v-
|
|
167
|
+
.actions-group[data-v-57d463a1] .n-button .n-icon {
|
|
168
168
|
transition: transform 0.3s ease;
|
|
169
169
|
}
|
|
170
|
-
.actions-group[data-v-
|
|
170
|
+
.actions-group[data-v-57d463a1] .n-button:hover:not(:disabled) {
|
|
171
171
|
transform: translateY(-1px);
|
|
172
172
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
|
|
173
173
|
}
|
|
174
|
-
.actions-group[data-v-
|
|
174
|
+
.actions-group[data-v-57d463a1] .n-button:hover:not(:disabled) .n-icon {
|
|
175
175
|
transform: scale(1.1);
|
|
176
176
|
}
|
|
177
|
-
.actions-group[data-v-
|
|
177
|
+
.actions-group[data-v-57d463a1] .n-button:active:not(:disabled) {
|
|
178
178
|
transform: translateY(0);
|
|
179
179
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
180
180
|
}
|
|
181
|
-
.actions-group[data-v-
|
|
181
|
+
.actions-group[data-v-57d463a1] .n-button:disabled {
|
|
182
182
|
cursor: not-allowed;
|
|
183
183
|
opacity: 0.5;
|
|
184
184
|
}
|
|
185
|
-
.actions-group[data-v-
|
|
185
|
+
.actions-group[data-v-57d463a1] .n-button.n-button--loading {
|
|
186
186
|
pointer-events: none;
|
|
187
187
|
}
|
|
188
|
-
.actions-group[data-v-
|
|
188
|
+
.actions-group[data-v-57d463a1] .n-button--primary-type:hover:not(:disabled) {
|
|
189
189
|
box-shadow: 0 4px 12px rgba(24, 160, 88, 0.3);
|
|
190
190
|
}
|
|
191
|
-
.actions-group[data-v-
|
|
191
|
+
.actions-group[data-v-57d463a1] .n-button--info-type:hover:not(:disabled) {
|
|
192
192
|
box-shadow: 0 4px 12px rgba(42, 148, 125, 0.3);
|
|
193
193
|
}
|
|
194
|
-
.actions-group[data-v-
|
|
194
|
+
.actions-group[data-v-57d463a1] .n-button--success-type:hover:not(:disabled) {
|
|
195
195
|
box-shadow: 0 4px 12px rgba(99, 226, 183, 0.3);
|
|
196
196
|
}
|
|
197
|
-
.actions-group[data-v-
|
|
197
|
+
.actions-group[data-v-57d463a1] .n-button--warning-type:hover:not(:disabled) {
|
|
198
198
|
box-shadow: 0 4px 12px rgba(240, 138, 0, 0.3);
|
|
199
199
|
}
|
|
200
|
-
.actions-group[data-v-
|
|
200
|
+
.actions-group[data-v-57d463a1] .n-button--error-type:hover:not(:disabled) {
|
|
201
201
|
box-shadow: 0 4px 12px rgba(208, 48, 80, 0.3);
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
/* ================= 中间插槽区域 ================= */
|
|
205
|
-
.actions-center[data-v-
|
|
205
|
+
.actions-center[data-v-57d463a1] {
|
|
206
206
|
display: flex;
|
|
207
207
|
align-items: center;
|
|
208
208
|
justify-content: center;
|
|
@@ -212,32 +212,32 @@
|
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
/* ================= 分隔线 ================= */
|
|
215
|
-
.action-divider[data-v-
|
|
215
|
+
.action-divider[data-v-57d463a1] {
|
|
216
216
|
margin: 0 8px !important;
|
|
217
217
|
height: 20px;
|
|
218
218
|
opacity: 0.3;
|
|
219
219
|
transition: opacity 0.3s ease;
|
|
220
220
|
}
|
|
221
|
-
.action-divider[data-v-
|
|
221
|
+
.action-divider[data-v-57d463a1]:hover {
|
|
222
222
|
opacity: 0.6;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
/* ================= 下拉菜单优化 ================= */
|
|
226
|
-
[data-v-
|
|
226
|
+
[data-v-57d463a1] .n-dropdown-option {
|
|
227
227
|
transition: all 0.2s ease;
|
|
228
228
|
}
|
|
229
|
-
[data-v-
|
|
229
|
+
[data-v-57d463a1] .n-dropdown-option:hover {
|
|
230
230
|
transform: translateX(4px);
|
|
231
231
|
}
|
|
232
|
-
[data-v-
|
|
232
|
+
[data-v-57d463a1] .n-dropdown-option .n-icon {
|
|
233
233
|
transition: transform 0.2s ease;
|
|
234
234
|
}
|
|
235
|
-
[data-v-
|
|
235
|
+
[data-v-57d463a1] .n-dropdown-option:hover .n-icon {
|
|
236
236
|
transform: scale(1.15);
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
/* ================= 加载动画 ================= */
|
|
240
|
-
@keyframes button-loading-
|
|
240
|
+
@keyframes button-loading-57d463a1 {
|
|
241
241
|
0% {
|
|
242
242
|
opacity: 0.6;
|
|
243
243
|
}
|
|
@@ -248,12 +248,12 @@
|
|
|
248
248
|
opacity: 0.6;
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
-
[data-v-
|
|
252
|
-
animation: button-loading-
|
|
251
|
+
[data-v-57d463a1] .n-button--loading {
|
|
252
|
+
animation: button-loading-57d463a1 1.5s ease-in-out infinite;
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
/* ================= Tooltip 样式 ================= */
|
|
256
|
-
[data-v-
|
|
256
|
+
[data-v-57d463a1] .n-tooltip .n-tooltip__content {
|
|
257
257
|
font-size: 12px;
|
|
258
258
|
padding: 6px 10px;
|
|
259
259
|
border-radius: 4px;
|
|
@@ -262,23 +262,26 @@
|
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
/* ================= 暗黑模式适配 ================= */
|
|
265
|
-
html.dark .c-action-bar[data-v-
|
|
265
|
+
html.dark .c-action-bar[data-v-57d463a1] {
|
|
266
266
|
border-color: rgba(255, 255, 255, 0.09);
|
|
267
267
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
|
268
268
|
}
|
|
269
|
-
html.dark .actions-group[data-v-
|
|
269
|
+
html.dark .actions-group[data-v-57d463a1] .n-button:hover:not(:disabled) {
|
|
270
270
|
box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
|
|
271
271
|
}
|
|
272
|
-
html.dark .action-divider[data-v-
|
|
272
|
+
html.dark .action-divider[data-v-57d463a1] {
|
|
273
273
|
opacity: 0.15;
|
|
274
274
|
}
|
|
275
|
-
html.dark .action-divider[data-v-
|
|
275
|
+
html.dark .action-divider[data-v-57d463a1]:hover {
|
|
276
276
|
opacity: 0.4;
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
/* layer: default */
|
|
280
|
-
.
|
|
281
|
-
.
|
|
280
|
+
.m4[data-v-57d463a1]{margin:1rem;}
|
|
281
|
+
.m5[data-v-57d463a1]{margin:1.25rem;}
|
|
282
|
+
.m6[data-v-57d463a1]{margin:1.5rem;}
|
|
283
|
+
.inline[data-v-57d463a1]{display:inline;}
|
|
284
|
+
.px[data-v-57d463a1]{padding-left:1rem;padding-right:1rem;}
|
|
282
285
|
|
|
283
286
|
|
|
284
287
|
/* layer: default */
|
package/dist/C_FormModal.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as FormModalProps, i as FormModalMode, n as FormModalEditor, r as FormModalEmits, t as _default } from "./
|
|
1
|
+
import { a as FormModalProps, i as FormModalMode, n as FormModalEditor, r as FormModalEmits, t as _default } from "./index15.vue.cjs";
|
|
2
2
|
export { _default as C_FormModal, type FormModalEditor, type FormModalEmits, type FormModalMode, type FormModalProps };
|
package/dist/C_FormModal.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "./useFormConfig.js";
|
|
2
|
+
import "./useFormRenderer.js";
|
|
2
3
|
import "./useDynamicFormState.js";
|
|
3
|
-
import { a as FormModalProps, i as FormModalMode, n as FormModalEditor, r as FormModalEmits, t as _default } from "./
|
|
4
|
+
import { a as FormModalProps, i as FormModalMode, n as FormModalEditor, r as FormModalEmits, t as _default } from "./index14.vue.js";
|
|
4
5
|
export { _default as C_FormModal, type FormModalEditor, type FormModalEmits, type FormModalMode, type FormModalProps };
|