advanced-ele-ui 0.1.1 → 0.1.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/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -682,5 +682,5 @@ ${se("ai-append")}</button>
|
|
|
682
682
|
`}},uo.tableSection={filter:["thead","tbody","tfoot"],replacement:function(e){return e}};function B6(e){var t=e.parentNode;return t.nodeName==="THEAD"||t.firstChild===e&&(t.nodeName==="TABLE"||U6(t))&&F6.call(e.childNodes,function(n){return n.nodeName==="TH"})}function U6(e){var t=e.previousSibling;return e.nodeName==="TBODY"&&(!t||t.nodeName==="THEAD"&&/^\s*$/i.test(t.textContent))}function om(e,t=null,n=null){n===null&&(n=P6.call(t.parentNode.childNodes,t));var r=" ";n===0&&(r="| ");let i=e.trim().replace(/\n\r/g,"<br>").replace(/\n/g,"<br>");for(i=i.replace(/\|+/g,"\\|");i.length<3;)i+=" ";return t&&(i=H6(i,t," ")),r+i+" |"}function gC(e){if(!e.childNodes)return!1;for(let t=0;t<e.childNodes.length;t++){const n=e.childNodes[t];if(n.nodeName==="TABLE"||gC(n))return!0}return!1}function am(e){return!!(!e||!e.rows||e.rows.length===1&&e.rows[0].childNodes.length<=1||gC(e))}function EC(e){let t=e.parentNode;for(;t.nodeName!=="TABLE";)if(t=t.parentNode,!t)return null;return t}function H6(e,t,n){const r=t.getAttribute("colspan")||1;for(let i=1;i<r;i++)e+=" | "+n.repeat(3);return e}function bC(e){let t=0;for(let n=0;n<e.rows.length;n++){const r=e.rows[n].childNodes.length;r>t&&(t=r)}return t}function SC(e){e.keep(function(n){return n.nodeName==="TABLE"});for(var t in uo)e.addRule(t,uo[t])}function V6(e){e.addRule("taskListItems",{filter:function(t){return t.type==="checkbox"&&t.parentNode.nodeName==="LI"},replacement:function(t,n){return(n.checked?"[x]":"[ ]")+" "}})}function G6(e){e.use([M6,L6,SC,V6])}const sm=ln({html:!0,linkify:!0,typographer:!0});sm.use(KG,"container-wrapper",{validate:function(e){return!0},render:function(e,t){return e[t].nesting===1?`<div class="container-wrapper ${e[t].info.trim().split(" ")[0]}">`:"</div>"}}),sm.use(l6,{enabled:!0,label:!0});const ui=new fc({headingStyle:"atx",hr:"---",bulletListMarker:"-",codeBlockStyle:"fenced",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",preformattedCode:!1});ui.use(G6),ui.use(SC),ui.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(e){return"~~"+e+"~~"}}),ui.keep(e=>!(e&&e.nodeName==="DIV")),ui.addRule("checkbox",{filter:e=>{var t,n;if(e.tagName==="INPUT"&&e.getAttribute("type")==="checkbox"||e.tagName==="LABEL"&&((t=e.firstElementChild)==null?void 0:t.tagName)==="INPUT"&&((n=e.firstElementChild)==null?void 0:n.getAttribute("type"))==="checkbox")return!0},replacement:function(e,t){var n;return t.type==="checkbox"?t.checked?"[x]":"[ ]":t.tagName==="LABEL"&&((n=t.firstElementChild)==null?void 0:n.type)==="checkbox"?t.firstElementChild.checked?"[x]":"[ ]":null}}),ui.addRule("container",{filter:e=>e.tagName==="DIV"&&e.classList.contains("container-wrapper"),replacement:function(e,t){let n="";for(let r of t.classList)if(r!="container-wrapper"){n=r;break}return`:::${n}
|
|
683
683
|
`+e.trim()+`
|
|
684
684
|
:::
|
|
685
|
-
`}});const hc=e=>{if(!e)return e;const t=sm.render(e).trim();return t?la(t.includes("<pre")?t:t.replace(/\n/g,"")):e},z6=e=>{if(!e)return e;const t=new DOMParser().parseFromString(e,"text/html");t.querySelectorAll("colgroup").forEach(r=>r.remove()),t.querySelectorAll("li").forEach(r=>{const i=r.querySelector("div");if(i&&!i.querySelector("img")&&i.firstElementChild){const o=document.createDocumentFragment();o.append(" "),i.firstElementChild.childNodes.forEach(a=>{o.append(a.cloneNode(!0))}),i.replaceWith(o)}});const n=t.body.innerHTML;return ui.turndown(n)};de("aie-header",VE),de("aie-footer",GE);const $6={theme:"light",lang:"zh",contentRetentionKey:"ai-editor-content",editable:!0,draggable:!0,placeholder:"",toolbarSize:"small"};class Y6 extends Dx{constructor(t,n={}){super(n),G(this,"aiEditor"),this.aiEditor=t}parseHtml(t){function n(r){return new window.DOMParser().parseFromString(`<body>${r}</body>`,"text/html").body}return Ti.fromSchema(this.schema).parse(n(t),{}).content}parseMarkdown(t){const n=hc(t);return this.parseHtml(n)}insertMarkdown(t){this.commands.insertContent(hc(t))}}class q6{constructor(t){G(this,"customLayout",!1),G(this,"innerEditor"),G(this,"container"),G(this,"header"),G(this,"mainEl"),G(this,"footer"),G(this,"options"),G(this,"eventComponents",[]),this.options=T(T({},$6),t),this.initI18nAndInnerEditor()}initI18nAndInnerEditor(){const t=this.options.i18n||{},n={de:{translation:T(T({},tV),t.de)},en:{translation:T(T({},eV),t.en)},pt:{translation:T(T({},nV),t.pt)},zh:{translation:T(T({},JH),t.zh)},es:{translation:T(T({},rV),t.es)},hi:{translation:T(T({},iV),t.hi)},id:{translation:T(T({},oV),t.id)},ja:{translation:T(T({},aV),t.ja)},ko:{translation:T(T({},sV),t.ko)},th:{translation:T(T({},lV),t.th)},vi:{translation:T(T({},cV),t.vi)}};for(let r of Object.keys(t))r!="de"&&r!="en"&&r!="pt"&&r!="zh"&&(n[r]={translation:T({},t[r])});ct.init({lng:this.options.lang,resources:n},(r,i)=>{this.initInnerEditor()})}initInnerEditor(){const t=typeof this.options.element=="string"?document.querySelector(this.options.element):this.options.element;t.classList.add(`aie-theme-${this.options.theme}`),this.container=t.querySelector(".aie-container"),this.container?this.customLayout=!0:(this.container=document.createElement("div"),this.container.classList.add("aie-container")),t.appendChild(this.container),this.mainEl=document.createElement("div"),this.mainEl.style.flexGrow="1",this.mainEl.style.overflow="auto",this.header=new VE,this.eventComponents.push(this.header),this.footer=new GE,this.footer.initDraggable(this.options.draggable),this.eventComponents.push(this.footer);let n=this.options.content;if(typeof n=="string"&&(this.options.contentIsMarkdown?n=hc(n):n=la(n)),this.options.contentRetention&&this.options.contentRetentionKey){const r=localStorage.getItem(this.options.contentRetentionKey);if(r)try{n=JSON.parse(r)}catch(i){console.error(i,"Can not parse the cache content from localStorage.")}}this.innerEditor=new Y6(this,V(T({},this.options),{element:this.mainEl,content:n,editable:this.options.editable,extensions:this.getExtensions(),onCreate:r=>this.onCreate(r),onTransaction:r=>this.onTransaction(r),onFocus:()=>{var r,i;return(i=(r=this.options)==null?void 0:r.onFocus)==null?void 0:i.call(r,this)},onBlur:()=>{var r,i;return(i=(r=this.options)==null?void 0:r.onBlur)==null?void 0:i.call(r,this)},onDestroy:()=>{var r,i;return(i=(r=this.options)==null?void 0:r.onDestroy)==null?void 0:i.call(r,this)},editorProps:{attributes:{class:"aie-content"}}}))}getExtensions(){let t=XH(this,this.options);if(this.options.onCreateBefore){const n=this.options.onCreateBefore(this,t);n&&(t=n)}return t}onCreate(t){this.innerEditor.view.dom.style.height="calc(100% - 20px)",this.eventComponents.forEach(n=>{n.onCreate&&n.onCreate(t,this.options)}),(this.container.querySelector(".aie-container-header")||this.container).appendChild(this.header),(this.container.querySelector(".aie-container-main")||this.container).appendChild(this.mainEl),(this.container.querySelector(".aie-container-footer")||this.container).appendChild(this.footer),this.options.ai&&Cr.init(this.innerEditor,this.options.ai),this.options.onCreated&&this.options.onCreated(this)}onTransaction(t){var n,r;if(this.eventComponents.forEach(i=>{i.onTransaction&&i.onTransaction(t)}),!t.transaction.getMeta("ignoreChanged")&&((r=(n=this.options).onTransaction)==null||r.call(n,this,t.transaction),t.transaction.docChanged&&this.options.onChange&&this.options.onChange(this),t.transaction.docChanged&&this.options.contentRetention&&this.options.contentRetentionKey)){const i=t.editor.getHTML();if(i==="<p></p>"||i==="")localStorage.removeItem(this.options.contentRetentionKey);else{const o=t.editor.getJSON();localStorage.setItem(this.options.contentRetentionKey,JSON.stringify(o))}}}getHtml(){return this.innerEditor.getHTML()}getJson(){return this.innerEditor.getJSON()}getText(){return this.innerEditor.getText()}getSelectedText(){const t=this.innerEditor.state.selection;return t.empty?"":Ms(this.innerEditor.state.doc,{from:t.from,to:t.to})}getMarkdown(){return z6(this.getHtml())}getOptions(){return this.options}getAttributes(t){return this.innerEditor.getAttributes(t)}setAttributes(t,n){this.innerEditor.commands.updateAttributes(t,n)}isActive(t,n){return typeof t=="object"||!n?this.innerEditor.isActive(t):this.innerEditor.isActive(t,n)}commands(){return this.innerEditor.commands}commandsChain(){return this.innerEditor.chain()}getOutline(){const t=this.innerEditor.state.doc,n=[];return t.descendants((r,i)=>{if(r.type.name==="heading"){const o=`aie-heading-${n.length+1}`;if(r.attrs.id!==o){const{state:{tr:s},view:{dispatch:l}}=this.innerEditor;l(s.setNodeMarkup(i,void 0,V(T({},r.attrs),{id:o})).setMeta("ignoreChanged",!0))}let a="";r.descendants(s=>{s.text&&(a+=s.text)}),n.push({id:o,text:a,level:r.attrs.level,pos:i,size:r.nodeSize})}}),n}focus(){return this.innerEditor.commands.focus(),this}focusPos(t){return this.innerEditor.commands.focus(t),this}focusStart(){return this.innerEditor.commands.focus("start"),this}focusEnd(){return this.innerEditor.commands.focus("end"),this}isFocused(){return this.innerEditor.isFocused}blur(){return this.innerEditor.commands.blur(),this}insert(t){return typeof t=="string"&&(t=la(t)),this.innerEditor.commands.insertContent(t),this}insertMarkdown(t){return this.innerEditor.insertMarkdown(t),this}setEditable(t){return this.options.editable=t,this.innerEditor.setEditable(t,!0),this.eventComponents.forEach(n=>{n.onEditableChange(t)}),this}setContent(t,n){return typeof t=="string"&&(t=la(t)),n===!1?this.clear().insert(t):this.focus().clear().insert(t),this}setMarkdownContent(t){const n=hc(t);return this.setContent(n)}clear(){return this.innerEditor.commands.clearContent(!0),this}isEmpty(){return this.innerEditor.isEmpty}changeLang(t){return this.destroy(),this.options.lang=t,ct.changeLanguage(t),this.initInnerEditor(),this}changeTheme(t){const n=typeof this.options.element=="string"?document.querySelector(this.options.element):this.options.element;t||(t=this.options.theme==="dark"?"light":"dark"),n.classList.remove(`aie-theme-${this.options.theme}`),n.classList.add(`aie-theme-${t}`),this.options.theme=t}removeRetention(){return this.options.contentRetentionKey&&localStorage.removeItem(this.options.contentRetentionKey),this}destroy(){var t,n,r,i;(n=(t=this.options).onDestroy)==null||n.call(t,this),this.innerEditor.destroy(),this.eventComponents=[],this.customLayout?((r=this.header)==null||r.remove(),this.mainEl.remove(),(i=this.footer)==null||i.remove()):this.container.remove()}isDestroyed(){return this.innerEditor.isDestroyed}}const yC=["undo","redo","brush","eraser","|","heading","font-family","font-size","highlight","font-color","|","bold","italic","underline","strike","link","hr","|","align","line-height","|","bullet-list","ordered-list","indent-decrease","indent-increase","break","|","container","table","|","fullscreen"],CC=["undo","redo","brush","eraser","|","heading","font-family","font-size","|","bold","italic","underline","strike","link","code","subscript","superscript","hr","todo","emoji","|","highlight","font-color","|","align","line-height","|","bullet-list","ordered-list","indent-decrease","indent-increase","break","|","image","video","attachment","quote","container","code-block","table","|","source-code","printer","fullscreen","ai"],lm=vi(m.defineComponent({name:"Editor",props:{modelValue:{type:String,default:""},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:""},editorHeight:{type:[Number,String],default:350},viewHeight:{type:[Number,String],default:"fit-content"},mode:{type:String,default:"simple"},size:{type:String,default:"medium"},toolbarKeys:{type:Array,default:()=>[]},toolbarExcludeKeys:{type:Array,default:()=>[]},addToolbarKeys:{type:Array,default:()=>[]},theme:{type:String,default:"light"},contentIsMarkdown:{type:Boolean,default:!1},contentRetention:{type:Boolean,default:!1},contentRetentionKey:{type:String,default:"ae-ai-editor-content"},resizable:{type:Boolean,default:!0},toolbarTipEnable:{type:Boolean,default:!0},lang:{type:String,default:"zh"},editorOptions:{type:Object,default:()=>({})}},emits:["change","update:modelValue","focus","blur","created","destroy"],setup(e,{emit:t}){let n=!1,r="";const i=m.ref();function o(h){i.value=h}let a=null;function s(){var g;let h;const _=e.toolbarExcludeKeys||[];if(e.mode==="custom")h=e.toolbarKeys||[];else if(e.mode==="simple"){if(h=yC,(g=e.addToolbarKeys)!=null&&g.length){const S=[...h],y=[];e.addToolbarKeys.forEach(C=>{if(Array.isArray(C)&&C.length===2){const[E,b]=C;let v=-1;if(typeof E=="number")v=E;else if(typeof E=="string"){const N=S.findIndex(O=>O===E);N>-1&&(v=N+1)}v>-1&&y.push({position:v,key:b})}}),y.sort((C,E)=>E.position-C.position).forEach(({position:C,key:E})=>{S.splice(C,0,E)}),h=S}}else h=CC;return V(T({},e.editorOptions),{lang:e.lang||"zh",toolbarSize:e.size||"small",toolbarKeys:h,toolbarExcludeKeys:_,editable:!e.disabled,placeholder:e.placeholder||"",theme:e.theme||"light",content:e.modelValue,contentIsMarkdown:e.contentIsMarkdown||!1,contentRetention:e.contentRetention||!1,contentRetentionKey:e.contentRetentionKey||"ae-ai-editor-content",draggable:e.resizable,toolbarTipEnable:e.toolbarTipEnable||!0})}function l(h){return h?e.contentIsMarkdown?h.getMarkdown():h.getHtml():""}function c(h){a&&(e.contentIsMarkdown?a.setMarkdownContent(h):a.setContent(h))}const d=Pe.useDebounceFn(h=>{t("change",h),t("update:modelValue",h)},500);function u(){const h=s();a&&(a.destroy(),a=null),a=new q6(V(T({},h),{element:i.value,onChange:_=>{if(n)return;const g=l(_);g!==r&&(r=g,d(g))},onFocus:()=>{t("focus")},onBlur:()=>{t("blur")},onCreated:()=>{t("created")},onDestroy:()=>{t("destroy")}}))}m.watch(()=>e.modelValue,h=>{if(a){if(l(a)===h)return;n=!0,c(h),m.nextTick(()=>{n=!1})}},{immediate:!1}),m.watch(()=>e.disabled,h=>{h?a&&a.destroy():m.nextTick(()=>{u()})},{immediate:!1}),m.watch(()=>e.mode,()=>{u()},{immediate:!1}),m.onMounted(()=>Wt(this,null,function*(){yield m.nextTick(),u()})),m.onUnmounted(()=>{a&&a.destroy()});const p=m.computed(()=>({height:vc(e.editorHeight)||"350px"})),f=m.computed(()=>({height:vc(e.viewHeight)||"fit-content"}));return()=>e.disabled?m.createVNode("div",{class:"ae-ai-editor-view",style:f.value},[m.createVNode("div",{innerHTML:e.modelValue},null)]):m.createVNode("div",{ref:h=>o(h),style:p.value,class:"ae-ai-editor"},null)}}),[["__scopeId","data-v-f14d35f4"]]),j6={Group:PO,Blank:HO,Alert:F.ElAlert,Divider:F.ElDivider,Image:F.ElImage,Result:F.ElResult,Autocomplete:F.ElAutocomplete,Cascader:F.ElCascader,Checkbox:F.ElCheckboxGroup,CheckboxButton:F.ElCheckboxGroup,ColorPicker:F.ElColorPicker,DatePicker:F.ElDatePicker,Editor:lm,Input:F.ElInput,InputNumber:F.ElInputNumber,InputTag:F.ElInputTag,Mention:F.ElMention,Radio:F.ElRadioGroup,RadioButton:F.ElRadioGroup,Rate:F.ElRate,Segmented:F.ElSegmented,Select:F.ElSelect,Slider:F.ElSlider,Switch:F.ElSwitch,Table:od,TimePicker:F.ElTimePicker,TimeSelect:F.ElTimeSelect,Transfer:F.ElTransfer,TreeSelect:F.ElTreeSelect,Upload:es},W6={Checkbox:()=>!0,CheckboxButton:()=>!0,Table:()=>!0,InputTag:()=>!0,Transfer:()=>!0,Select:e=>!!e.multiple,TreeSelect:e=>!!e.multiple,TimePicker:e=>!!e.isRange,DatePicker:e=>["years","months","dates","datetimerange","daterange","monthrange","yearrange"].includes(e.type),Cascader:e=>{const t=T({multiple:!1,emitPath:!0},e.props);return!(t.multiple===!1&&t.emitPath===!1)}};function K6(e=[]){const t=m.shallowReactive(T(T({},j6),ts.components)),n=m.shallowReactive(T({},ts.componentConfigs)),r=m.shallowReactive(T(T({},W6),ts.arrayStrategies));return e.forEach(i=>{t[i.name]&&he.warn("console.form.componentExists",{name:i.name}),t[i.name]=i.component,i.config&&(n[i.name]=i.config),i.isArrayFn&&(r[i.name]=i.isArrayFn),he.success("console.form.componentRegistered",{name:i.name})}),{components:t,arrayStrategies:r,componentConfigs:n}}const vC=m.defineComponent({name:"AeForm",props:{model:{type:Object,default:()=>({})},schemas:{type:Array,default:()=>[]},stepValue:{type:[Number,null],default:null},disabled:{type:Boolean,default:!1},type:{type:String,default:"form"},size:{type:String,default:"default"},designable:{type:Boolean,default:!1},excontext:{type:Object,default:()=>({})},schemaProps:{type:Object,default:()=>({})},labelWidth:{type:[String,Number],default:"120px"},showErrorNotice:{type:Boolean,default:!0},scrollRef:{type:Object,default:null},autoInitField:{type:Boolean,default:!0},imports:{type:Array,default:()=>[]}},emits:["register","update:stepValue"],setup:(e,{emit:t,attrs:n,slots:r,expose:i})=>{const{components:o,arrayStrategies:a,componentConfigs:s}=K6(e.imports),{isValidating:l,formModel:c,elFormRef:d,baseElRowRef:u,componentRefs:p,schemasKeys:f,initValues:h,getDefaultModel:_,getFormModel:g,getElFormRef:S,setValues:y,clearValues:C,setValue:E,delValue:b,resetValidate:v,validate:N}=av(e,e.schemas,o,a);m.onMounted(()=>{t("register",m.unref(d)),m.unref(e).autoInitField?h(e.model):y(e.model)}),m.onBeforeUnmount(()=>{c.value={},d.value=null});const O=m.computed(()=>{const w=m.toRaw(m.unref(e).schemas),I=k=>{const{key:M,field:P,type:H,component:x,value:R,children:D}=k;let L=`${P||M}:${H||"Inputer"}:${x||""}:${R!==void 0?"hasValue":"noValue"}`;return D&&Array.isArray(D)&&(L+=`:children[${D.length}:${D.map($=>$.key||$.field).join(",")}]`),L};return w.map(I).join("|")});m.watch(O,()=>{l.value||(m.unref(e).autoInitField&&h(m.unref(c)),v())},{immediate:!1}),i({initValues:h,getDefaultModel:_,getFormModel:g,getElFormRef:S,setValues:y,clearValues:C,setValue:E,delValue:b,validate:N,resetValidate:v});const{renderForm:A}=ov(e,t,n,r,c,d,p,u,f,o,s);return()=>m.createVNode("div",{class:"ae-form"},[A()])}}),Q6={class:"flex justify-between items-center h-54px pl-15px pr-15px relative"},Z6={class:"flex items-center"},X6={class:"dialog-actions"},J6={key:1,class:"dialog-body-no-scroll"},TC=m.defineComponent({__name:"Dialog",props:{modelValue:{type:Boolean,default:!1},title:{type:String,default:""},fullscreen:{type:Boolean,default:!1},isFullscreen:{type:Boolean,default:!1},maxHeight:{type:[String,Number],default:"400px"},draggable:{type:Boolean,default:!1},scrollable:{type:Boolean,default:!0},beforeClose:{type:Function}},emits:["update:modelValue"],setup(e,{emit:t}){const n=m.useSlots(),r=e,i=t,o=m.computed(()=>{const u=["fullscreen","title","maxHeight","draggable","scrollable","beforeClose"],p=m.useAttrs(),f=T(T({},p),r);for(const h in f)u.indexOf(h)!==-1&&delete f[h];return f}),a=m.ref(r.isFullscreen),s=()=>{a.value=!m.unref(a)},l=m.ref(At(r.maxHeight)?`${r.maxHeight}px`:r.maxHeight);m.watch(()=>r.maxHeight,u=>{l.value=At(u)?`${u}px`:u});const c=m.computed(()=>({height:m.unref(l),padding:"15px"}));function d(){r.beforeClose!==void 0?r.beforeClose(()=>{i("update:modelValue",!1)}):i("update:modelValue",!1)}return(u,p)=>(m.openBlock(),m.createBlock(m.unref(F.ElDialog),m.mergeProps(o.value,{fullscreen:e.isFullscreen,"destroy-on-close":"","lock-scroll":"",draggable:e.draggable,top:"0","close-on-click-modal":!1,"show-close":!1,class:"ae-dialog"}),m.createSlots({header:m.withCtx(()=>[m.createElementVNode("div",Q6,[m.createElementVNode("div",Z6,[e.draggable?(m.openBlock(),m.createBlock(m.unref(Ut),{key:0,icon:"mdi:drag",class:"draggable-indicator",size:30})):m.createCommentVNode("",!0),m.renderSlot(u.$slots,"title",{},()=>[m.createTextVNode(m.toDisplayString(e.title),1)])]),m.createElementVNode("div",X6,[m.renderSlot(u.$slots,"header-actions"),e.fullscreen?(m.openBlock(),m.createElementBlock("div",{key:0,class:"dialog-action-btn",onClick:s},[m.createVNode(m.unref(Ut),{icon:a.value?"radix-icons:exit-full-screen":"radix-icons:enter-full-screen"},null,8,["icon"])])):m.createCommentVNode("",!0),m.createElementVNode("div",{class:"dialog-action-btn",onClick:p[0]||(p[0]=f=>d())},[m.createVNode(m.unref(Ut),{icon:"ep:close"})])])])]),default:m.withCtx(()=>[e.scrollable?(m.openBlock(),m.createBlock(m.unref(F.ElScrollbar),{key:0,style:m.normalizeStyle(c.value)},{default:m.withCtx(()=>[m.renderSlot(u.$slots,"default")]),_:3},8,["style"])):(m.openBlock(),m.createElementBlock("div",J6,[m.renderSlot(u.$slots,"default")]))]),_:2},[m.unref(n).footer?{name:"footer",fn:m.withCtx(()=>[m.renderSlot(u.$slots,"footer")]),key:"0"}:void 0]),1040,["fullscreen","draggable"]))}}),ez={class:"flex justify-between items-center h-54px pl-15px pr-15px"},tz={class:"flex items-center gap-8px"},nz={class:"drawer-actions"},rz=["onClick"],iz={class:"drawer-content"},oz={key:1,class:"drawer-body-no-scroll"},NC=m.defineComponent({__name:"Drawer",props:{modelValue:{type:Boolean,default:!1},title:{type:String,default:""},direction:{type:String,default:"rtl"},size:{type:[String,Number],default:"30%"},scrollable:{type:Boolean,default:!0}},setup(e){const t=m.useSlots(),n=e,r=m.computed(()=>{const i=["title","direction","size","scrollable"],o=m.useAttrs(),a=T(T({},o),n);for(const s in a)i.indexOf(s)!==-1&&delete a[s];return a});return(i,o)=>(m.openBlock(),m.createBlock(m.unref(F.ElDrawer),m.mergeProps(r.value,{direction:e.direction,size:e.size,"destroy-on-close":"","close-on-click-modal":!1,"show-close":!1,class:"ae-drawer"}),m.createSlots({header:m.withCtx(({close:a})=>[m.createElementVNode("div",ez,[m.createElementVNode("div",tz,[m.renderSlot(i.$slots,"title",{},()=>[m.createTextVNode(m.toDisplayString(e.title),1)])]),m.createElementVNode("div",nz,[m.renderSlot(i.$slots,"header-actions"),m.createElementVNode("div",{class:"drawer-action-btn",onClick:a},[m.createVNode(m.unref(Ut),{icon:"ep:close"})],8,rz)])])]),default:m.withCtx(()=>[e.scrollable?(m.openBlock(),m.createBlock(m.unref(F.ElScrollbar),{key:0,class:"drawer-scrollbar"},{default:m.withCtx(()=>[m.createElementVNode("div",iz,[m.renderSlot(i.$slots,"default")])]),_:3})):(m.openBlock(),m.createElementBlock("div",oz,[m.renderSlot(i.$slots,"default")]))]),_:2},[m.unref(t).footer?{name:"footer",fn:m.withCtx(()=>[m.renderSlot(i.$slots,"footer")]),key:"0"}:void 0]),1040,["direction","size"]))}}),OC=m.defineComponent({__name:"Tabs",props:{modelValue:{type:[String,Number],default:""},fillHeight:{type:Boolean,default:!1},lazy:{type:Boolean,default:!1},keepAlive:{type:Boolean,default:!0}},emits:["update:modelValue","tab-click","tab-change","tab-remove","tab-add","edit"],setup(e,{expose:t,emit:n}){const r=e,i=n,o=m.computed(()=>{const f=["fillHeight","lazy","keepAlive"],h=m.useAttrs(),_=T(T({},h),r);for(const g in _)f.indexOf(g)!==-1&&delete _[g];return _}),a=f=>r.modelValue===f,s=m.ref(new Set);m.watch(()=>r.modelValue,f=>{f&&s.value.add(f)},{immediate:!0});const l=(f,h)=>{i("tab-click",f,h)},c=f=>{i("update:modelValue",f),i("tab-change",f)},d=f=>{i("tab-remove",f)},u=()=>{i("tab-add")},p=(f,h)=>{i("edit",f,h)};return m.provide("shouldShowTab",a),m.provide("parentLazy",m.computed(()=>r.lazy)),m.provide("parentKeepAlive",m.computed(()=>r.keepAlive)),t({shouldShowTab:a,loadedTabs:s}),(f,h)=>(m.openBlock(),m.createBlock(m.unref(F.ElTabs),m.mergeProps(o.value,{"model-value":e.modelValue,class:[{"ae-tabs-fill-height":e.fillHeight},"ae-tabs"],onTabClick:l,onTabChange:c,onTabRemove:d,onTabAdd:u,onEdit:p}),{default:m.withCtx(()=>[m.renderSlot(f.$slots,"default")]),_:3},16,["model-value","class"]))}}),az={key:0,class:"ae-tab-pane-content"},AC=m.defineComponent({__name:"TabPane",props:{label:{type:String,default:""},name:{type:[String,Number],required:!0},disabled:{type:Boolean,default:!1},closable:{type:Boolean,default:!1},lazy:{type:Boolean,default:void 0}},setup(e){const t=e,n=m.computed(()=>{const u=["lazy"],p=m.useAttrs(),f=T(T({},p),t);for(const h in f)u.indexOf(h)!==-1&&delete f[h];return f}),r=m.inject("shouldShowTab",()=>!0),i=m.inject("parentLazy",!1),o=m.inject("parentKeepAlive",!0),a=m.computed(()=>t.lazy!==void 0?t.lazy:i),s=m.ref(!1),l=m.computed(()=>r(t.name));m.watch(l,u=>{u&&a.value&&(s.value=!0)},{immediate:!0}),m.watch(l,u=>{!u&&!o&&a.value&&(s.value=!1)});const c=m.computed(()=>a.value?s.value:!0),d=m.computed(()=>a.value?l.value:!0);return(u,p)=>(m.openBlock(),m.createBlock(m.unref(F.ElTabPane),m.normalizeProps(m.guardReactiveProps(n.value)),{default:m.withCtx(()=>[c.value?m.withDirectives((m.openBlock(),m.createElementBlock("div",az,[m.renderSlot(u.$slots,"default")],512)),[[m.vShow,d.value]]):m.createCommentVNode("",!0)]),_:3},16))}}),sz={install:(e,t)=>{e.component("AeForm",vC),e.component("AeTable",od),e.component("AeIcon",Ut),e.component("AeEditor",lm),e.component("AeUpload",es),e.component("AeDialog",TC),e.component("AeDrawer",NC),e.component("AeTabs",OC),e.component("AeTabPane",AC),t!=null&&t.locale&&Cm(t.locale),t!=null&&t.customLocale&&Object.entries(t.customLocale).forEach(([n,r])=>{vm(n,r)}),t!=null&&t.formImports&&ts.registerComponents(t.formImports),t!=null&&t.tableImports&&ns.registerComponents(t.tableImports)},version:"0.1.1"};Q.AeDialog=TC,Q.AeDrawer=NC,Q.AeEditor=lm,Q.AeForm=vC,Q.AeIcon=Ut,Q.AeTabPane=AC,Q.AeTable=od,Q.AeTabs=OC,Q.AeUpload=es,Q.FULL_TOOLBAR_KEYS=CC,Q.SIMPLE_TOOLBAR_KEYS=yC,Q.default=sz,Q.enUS=Ua,Q.findNode=Nc,Q.findNodes=Oc,Q.formatAmount=nd,Q.formatDate=Pf,Q.formatSensitive=td,Q.getAutoRulesMap=Tc,Q.getCurrentLocale=FC,Q.locale=UC,Q.setCustomLocale=vm,Q.setLocale=Cm,Q.supportedLocales=HC,Q.useDict=Ff,Q.zhCN=fo,Object.defineProperties(Q,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
685
|
+
`}});const hc=e=>{if(!e)return e;const t=sm.render(e).trim();return t?la(t.includes("<pre")?t:t.replace(/\n/g,"")):e},z6=e=>{if(!e)return e;const t=new DOMParser().parseFromString(e,"text/html");t.querySelectorAll("colgroup").forEach(r=>r.remove()),t.querySelectorAll("li").forEach(r=>{const i=r.querySelector("div");if(i&&!i.querySelector("img")&&i.firstElementChild){const o=document.createDocumentFragment();o.append(" "),i.firstElementChild.childNodes.forEach(a=>{o.append(a.cloneNode(!0))}),i.replaceWith(o)}});const n=t.body.innerHTML;return ui.turndown(n)};de("aie-header",VE),de("aie-footer",GE);const $6={theme:"light",lang:"zh",contentRetentionKey:"ai-editor-content",editable:!0,draggable:!0,placeholder:"",toolbarSize:"small"};class Y6 extends Dx{constructor(t,n={}){super(n),G(this,"aiEditor"),this.aiEditor=t}parseHtml(t){function n(r){return new window.DOMParser().parseFromString(`<body>${r}</body>`,"text/html").body}return Ti.fromSchema(this.schema).parse(n(t),{}).content}parseMarkdown(t){const n=hc(t);return this.parseHtml(n)}insertMarkdown(t){this.commands.insertContent(hc(t))}}class q6{constructor(t){G(this,"customLayout",!1),G(this,"innerEditor"),G(this,"container"),G(this,"header"),G(this,"mainEl"),G(this,"footer"),G(this,"options"),G(this,"eventComponents",[]),this.options=T(T({},$6),t),this.initI18nAndInnerEditor()}initI18nAndInnerEditor(){const t=this.options.i18n||{},n={de:{translation:T(T({},tV),t.de)},en:{translation:T(T({},eV),t.en)},pt:{translation:T(T({},nV),t.pt)},zh:{translation:T(T({},JH),t.zh)},es:{translation:T(T({},rV),t.es)},hi:{translation:T(T({},iV),t.hi)},id:{translation:T(T({},oV),t.id)},ja:{translation:T(T({},aV),t.ja)},ko:{translation:T(T({},sV),t.ko)},th:{translation:T(T({},lV),t.th)},vi:{translation:T(T({},cV),t.vi)}};for(let r of Object.keys(t))r!="de"&&r!="en"&&r!="pt"&&r!="zh"&&(n[r]={translation:T({},t[r])});ct.init({lng:this.options.lang,resources:n},(r,i)=>{this.initInnerEditor()})}initInnerEditor(){const t=typeof this.options.element=="string"?document.querySelector(this.options.element):this.options.element;t.classList.add(`aie-theme-${this.options.theme}`),this.container=t.querySelector(".aie-container"),this.container?this.customLayout=!0:(this.container=document.createElement("div"),this.container.classList.add("aie-container")),t.appendChild(this.container),this.mainEl=document.createElement("div"),this.mainEl.style.flexGrow="1",this.mainEl.style.overflow="auto",this.header=new VE,this.eventComponents.push(this.header),this.footer=new GE,this.footer.initDraggable(this.options.draggable),this.eventComponents.push(this.footer);let n=this.options.content;if(typeof n=="string"&&(this.options.contentIsMarkdown?n=hc(n):n=la(n)),this.options.contentRetention&&this.options.contentRetentionKey){const r=localStorage.getItem(this.options.contentRetentionKey);if(r)try{n=JSON.parse(r)}catch(i){console.error(i,"Can not parse the cache content from localStorage.")}}this.innerEditor=new Y6(this,V(T({},this.options),{element:this.mainEl,content:n,editable:this.options.editable,extensions:this.getExtensions(),onCreate:r=>this.onCreate(r),onTransaction:r=>this.onTransaction(r),onFocus:()=>{var r,i;return(i=(r=this.options)==null?void 0:r.onFocus)==null?void 0:i.call(r,this)},onBlur:()=>{var r,i;return(i=(r=this.options)==null?void 0:r.onBlur)==null?void 0:i.call(r,this)},onDestroy:()=>{var r,i;return(i=(r=this.options)==null?void 0:r.onDestroy)==null?void 0:i.call(r,this)},editorProps:{attributes:{class:"aie-content"}}}))}getExtensions(){let t=XH(this,this.options);if(this.options.onCreateBefore){const n=this.options.onCreateBefore(this,t);n&&(t=n)}return t}onCreate(t){this.innerEditor.view.dom.style.height="calc(100% - 20px)",this.eventComponents.forEach(n=>{n.onCreate&&n.onCreate(t,this.options)}),(this.container.querySelector(".aie-container-header")||this.container).appendChild(this.header),(this.container.querySelector(".aie-container-main")||this.container).appendChild(this.mainEl),(this.container.querySelector(".aie-container-footer")||this.container).appendChild(this.footer),this.options.ai&&Cr.init(this.innerEditor,this.options.ai),this.options.onCreated&&this.options.onCreated(this)}onTransaction(t){var n,r;if(this.eventComponents.forEach(i=>{i.onTransaction&&i.onTransaction(t)}),!t.transaction.getMeta("ignoreChanged")&&((r=(n=this.options).onTransaction)==null||r.call(n,this,t.transaction),t.transaction.docChanged&&this.options.onChange&&this.options.onChange(this),t.transaction.docChanged&&this.options.contentRetention&&this.options.contentRetentionKey)){const i=t.editor.getHTML();if(i==="<p></p>"||i==="")localStorage.removeItem(this.options.contentRetentionKey);else{const o=t.editor.getJSON();localStorage.setItem(this.options.contentRetentionKey,JSON.stringify(o))}}}getHtml(){return this.innerEditor.getHTML()}getJson(){return this.innerEditor.getJSON()}getText(){return this.innerEditor.getText()}getSelectedText(){const t=this.innerEditor.state.selection;return t.empty?"":Ms(this.innerEditor.state.doc,{from:t.from,to:t.to})}getMarkdown(){return z6(this.getHtml())}getOptions(){return this.options}getAttributes(t){return this.innerEditor.getAttributes(t)}setAttributes(t,n){this.innerEditor.commands.updateAttributes(t,n)}isActive(t,n){return typeof t=="object"||!n?this.innerEditor.isActive(t):this.innerEditor.isActive(t,n)}commands(){return this.innerEditor.commands}commandsChain(){return this.innerEditor.chain()}getOutline(){const t=this.innerEditor.state.doc,n=[];return t.descendants((r,i)=>{if(r.type.name==="heading"){const o=`aie-heading-${n.length+1}`;if(r.attrs.id!==o){const{state:{tr:s},view:{dispatch:l}}=this.innerEditor;l(s.setNodeMarkup(i,void 0,V(T({},r.attrs),{id:o})).setMeta("ignoreChanged",!0))}let a="";r.descendants(s=>{s.text&&(a+=s.text)}),n.push({id:o,text:a,level:r.attrs.level,pos:i,size:r.nodeSize})}}),n}focus(){return this.innerEditor.commands.focus(),this}focusPos(t){return this.innerEditor.commands.focus(t),this}focusStart(){return this.innerEditor.commands.focus("start"),this}focusEnd(){return this.innerEditor.commands.focus("end"),this}isFocused(){return this.innerEditor.isFocused}blur(){return this.innerEditor.commands.blur(),this}insert(t){return typeof t=="string"&&(t=la(t)),this.innerEditor.commands.insertContent(t),this}insertMarkdown(t){return this.innerEditor.insertMarkdown(t),this}setEditable(t){return this.options.editable=t,this.innerEditor.setEditable(t,!0),this.eventComponents.forEach(n=>{n.onEditableChange(t)}),this}setContent(t,n){return typeof t=="string"&&(t=la(t)),n===!1?this.clear().insert(t):this.focus().clear().insert(t),this}setMarkdownContent(t){const n=hc(t);return this.setContent(n)}clear(){return this.innerEditor.commands.clearContent(!0),this}isEmpty(){return this.innerEditor.isEmpty}changeLang(t){return this.destroy(),this.options.lang=t,ct.changeLanguage(t),this.initInnerEditor(),this}changeTheme(t){const n=typeof this.options.element=="string"?document.querySelector(this.options.element):this.options.element;t||(t=this.options.theme==="dark"?"light":"dark"),n.classList.remove(`aie-theme-${this.options.theme}`),n.classList.add(`aie-theme-${t}`),this.options.theme=t}removeRetention(){return this.options.contentRetentionKey&&localStorage.removeItem(this.options.contentRetentionKey),this}destroy(){var t,n,r,i;(n=(t=this.options).onDestroy)==null||n.call(t,this),this.innerEditor.destroy(),this.eventComponents=[],this.customLayout?((r=this.header)==null||r.remove(),this.mainEl.remove(),(i=this.footer)==null||i.remove()):this.container.remove()}isDestroyed(){return this.innerEditor.isDestroyed}}const yC=["undo","redo","brush","eraser","|","heading","font-family","font-size","highlight","font-color","|","bold","italic","underline","strike","link","hr","|","align","line-height","|","bullet-list","ordered-list","indent-decrease","indent-increase","break","|","container","table","|","fullscreen"],CC=["undo","redo","brush","eraser","|","heading","font-family","font-size","|","bold","italic","underline","strike","link","code","subscript","superscript","hr","todo","emoji","|","highlight","font-color","|","align","line-height","|","bullet-list","ordered-list","indent-decrease","indent-increase","break","|","image","video","attachment","quote","container","code-block","table","|","source-code","printer","fullscreen","ai"],lm=vi(m.defineComponent({name:"Editor",props:{modelValue:{type:String,default:""},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:""},editorHeight:{type:[Number,String],default:350},viewHeight:{type:[Number,String],default:"fit-content"},mode:{type:String,default:"simple"},size:{type:String,default:"medium"},toolbarKeys:{type:Array,default:()=>[]},toolbarExcludeKeys:{type:Array,default:()=>[]},addToolbarKeys:{type:Array,default:()=>[]},theme:{type:String,default:"light"},contentIsMarkdown:{type:Boolean,default:!1},contentRetention:{type:Boolean,default:!1},contentRetentionKey:{type:String,default:"ae-ai-editor-content"},resizable:{type:Boolean,default:!0},toolbarTipEnable:{type:Boolean,default:!0},lang:{type:String,default:"zh"},editorOptions:{type:Object,default:()=>({})}},emits:["change","update:modelValue","focus","blur","created","destroy"],setup(e,{emit:t}){let n=!1,r="";const i=m.ref();function o(h){i.value=h}let a=null;function s(){var g;let h;const _=e.toolbarExcludeKeys||[];if(e.mode==="custom")h=e.toolbarKeys||[];else if(e.mode==="simple"){if(h=yC,(g=e.addToolbarKeys)!=null&&g.length){const S=[...h],y=[];e.addToolbarKeys.forEach(C=>{if(Array.isArray(C)&&C.length===2){const[E,b]=C;let v=-1;if(typeof E=="number")v=E;else if(typeof E=="string"){const N=S.findIndex(O=>O===E);N>-1&&(v=N+1)}v>-1&&y.push({position:v,key:b})}}),y.sort((C,E)=>E.position-C.position).forEach(({position:C,key:E})=>{S.splice(C,0,E)}),h=S}}else h=CC;return V(T({},e.editorOptions),{lang:e.lang||"zh",toolbarSize:e.size||"small",toolbarKeys:h,toolbarExcludeKeys:_,editable:!e.disabled,placeholder:e.placeholder||"",theme:e.theme||"light",content:e.modelValue,contentIsMarkdown:e.contentIsMarkdown||!1,contentRetention:e.contentRetention||!1,contentRetentionKey:e.contentRetentionKey||"ae-ai-editor-content",draggable:e.resizable,toolbarTipEnable:e.toolbarTipEnable||!0})}function l(h){return h?e.contentIsMarkdown?h.getMarkdown():h.getHtml():""}function c(h){a&&(e.contentIsMarkdown?a.setMarkdownContent(h):a.setContent(h))}const d=Pe.useDebounceFn(h=>{t("change",h),t("update:modelValue",h)},500);function u(){const h=s();a&&(a.destroy(),a=null),a=new q6(V(T({},h),{element:i.value,onChange:_=>{if(n)return;const g=l(_);g!==r&&(r=g,d(g))},onFocus:()=>{t("focus")},onBlur:()=>{t("blur")},onCreated:()=>{t("created")},onDestroy:()=>{t("destroy")}}))}m.watch(()=>e.modelValue,h=>{if(a){if(l(a)===h)return;n=!0,c(h),m.nextTick(()=>{n=!1})}},{immediate:!1}),m.watch(()=>e.disabled,h=>{h?a&&a.destroy():m.nextTick(()=>{u()})},{immediate:!1}),m.watch(()=>e.mode,()=>{u()},{immediate:!1}),m.onMounted(()=>Wt(this,null,function*(){yield m.nextTick(),u()})),m.onUnmounted(()=>{a&&a.destroy()});const p=m.computed(()=>({height:vc(e.editorHeight)||"350px"})),f=m.computed(()=>({height:vc(e.viewHeight)||"fit-content"}));return()=>e.disabled?m.createVNode("div",{class:"ae-ai-editor-view",style:f.value},[m.createVNode("div",{innerHTML:e.modelValue},null)]):m.createVNode("div",{ref:h=>o(h),style:p.value,class:"ae-ai-editor"},null)}}),[["__scopeId","data-v-f14d35f4"]]),j6={Group:PO,Blank:HO,Alert:F.ElAlert,Divider:F.ElDivider,Image:F.ElImage,Result:F.ElResult,Autocomplete:F.ElAutocomplete,Cascader:F.ElCascader,Checkbox:F.ElCheckboxGroup,CheckboxButton:F.ElCheckboxGroup,ColorPicker:F.ElColorPicker,DatePicker:F.ElDatePicker,Editor:lm,Input:F.ElInput,InputNumber:F.ElInputNumber,InputTag:F.ElInputTag,Mention:F.ElMention,Radio:F.ElRadioGroup,RadioButton:F.ElRadioGroup,Rate:F.ElRate,Segmented:F.ElSegmented,Select:F.ElSelect,Slider:F.ElSlider,Switch:F.ElSwitch,Table:od,TimePicker:F.ElTimePicker,TimeSelect:F.ElTimeSelect,Transfer:F.ElTransfer,TreeSelect:F.ElTreeSelect,Upload:es},W6={Checkbox:()=>!0,CheckboxButton:()=>!0,Table:()=>!0,InputTag:()=>!0,Transfer:()=>!0,Select:e=>!!e.multiple,TreeSelect:e=>!!e.multiple,TimePicker:e=>!!e.isRange,DatePicker:e=>["years","months","dates","datetimerange","daterange","monthrange","yearrange"].includes(e.type),Cascader:e=>{const t=T({multiple:!1,emitPath:!0},e.props);return!(t.multiple===!1&&t.emitPath===!1)}};function K6(e=[]){const t=m.shallowReactive(T(T({},j6),ts.components)),n=m.shallowReactive(T({},ts.componentConfigs)),r=m.shallowReactive(T(T({},W6),ts.arrayStrategies));return e.forEach(i=>{t[i.name]&&he.warn("console.form.componentExists",{name:i.name}),t[i.name]=i.component,i.config&&(n[i.name]=i.config),i.isArrayFn&&(r[i.name]=i.isArrayFn),he.success("console.form.componentRegistered",{name:i.name})}),{components:t,arrayStrategies:r,componentConfigs:n}}const vC=m.defineComponent({name:"AeForm",props:{model:{type:Object,default:()=>({})},schemas:{type:Array,default:()=>[]},stepValue:{type:[Number,null],default:null},disabled:{type:Boolean,default:!1},type:{type:String,default:"form"},size:{type:String,default:"default"},designable:{type:Boolean,default:!1},excontext:{type:Object,default:()=>({})},schemaProps:{type:Object,default:()=>({})},labelWidth:{type:[String,Number],default:"120px"},showErrorNotice:{type:Boolean,default:!0},scrollRef:{type:Object,default:null},autoInitField:{type:Boolean,default:!0},imports:{type:Array,default:()=>[]}},emits:["register","update:stepValue"],setup:(e,{emit:t,attrs:n,slots:r,expose:i})=>{const{components:o,arrayStrategies:a,componentConfigs:s}=K6(e.imports),{isValidating:l,formModel:c,elFormRef:d,baseElRowRef:u,componentRefs:p,schemasKeys:f,initValues:h,getDefaultModel:_,getFormModel:g,getElFormRef:S,setValues:y,clearValues:C,setValue:E,delValue:b,resetValidate:v,validate:N}=av(e,e.schemas,o,a);m.onMounted(()=>{t("register",m.unref(d)),m.unref(e).autoInitField?h(e.model):y(e.model)}),m.onBeforeUnmount(()=>{c.value={},d.value=null});const O=m.computed(()=>{const w=m.toRaw(m.unref(e).schemas),I=k=>{const{key:M,field:P,type:H,component:x,value:R,children:D}=k;let L=`${P||M}:${H||"Inputer"}:${x||""}:${R!==void 0?"hasValue":"noValue"}`;return D&&Array.isArray(D)&&(L+=`:children[${D.length}:${D.map($=>$.key||$.field).join(",")}]`),L};return w.map(I).join("|")});m.watch(O,()=>{l.value||(m.unref(e).autoInitField&&h(m.unref(c)),v())},{immediate:!1}),i({initValues:h,getDefaultModel:_,getFormModel:g,getElFormRef:S,setValues:y,clearValues:C,setValue:E,delValue:b,validate:N,resetValidate:v});const{renderForm:A}=ov(e,t,n,r,c,d,p,u,f,o,s);return()=>m.createVNode("div",{class:"ae-form"},[A()])}}),Q6={class:"flex justify-between items-center h-54px pl-15px pr-15px relative"},Z6={class:"flex items-center"},X6={class:"dialog-actions"},J6={key:1,class:"dialog-body-no-scroll"},TC=m.defineComponent({__name:"Dialog",props:{modelValue:{type:Boolean,default:!1},title:{type:String,default:""},fullscreen:{type:Boolean,default:!1},isFullscreen:{type:Boolean,default:!1},maxHeight:{type:[String,Number],default:"400px"},draggable:{type:Boolean,default:!1},scrollable:{type:Boolean,default:!0},beforeClose:{type:Function}},emits:["update:modelValue"],setup(e,{emit:t}){const n=m.useSlots(),r=e,i=t,o=m.computed(()=>{const u=["fullscreen","title","maxHeight","draggable","scrollable","beforeClose"],p=m.useAttrs(),f=T(T({},p),r);for(const h in f)u.indexOf(h)!==-1&&delete f[h];return f}),a=m.ref(r.isFullscreen),s=()=>{a.value=!m.unref(a)},l=m.ref(At(r.maxHeight)?`${r.maxHeight}px`:r.maxHeight);m.watch(()=>r.maxHeight,u=>{l.value=At(u)?`${u}px`:u});const c=m.computed(()=>({height:m.unref(l),padding:"15px"}));function d(){r.beforeClose!==void 0?r.beforeClose(()=>{i("update:modelValue",!1)}):i("update:modelValue",!1)}return(u,p)=>(m.openBlock(),m.createBlock(m.unref(F.ElDialog),m.mergeProps(o.value,{fullscreen:a.value,"destroy-on-close":"","lock-scroll":"",draggable:e.draggable,top:"0","close-on-click-modal":!1,"show-close":!1,class:"ae-dialog"}),m.createSlots({header:m.withCtx(()=>[m.createElementVNode("div",Q6,[m.createElementVNode("div",Z6,[e.draggable?(m.openBlock(),m.createBlock(m.unref(Ut),{key:0,icon:"mdi:drag",class:"draggable-indicator",size:30})):m.createCommentVNode("",!0),m.renderSlot(u.$slots,"title",{},()=>[m.createTextVNode(m.toDisplayString(e.title),1)])]),m.createElementVNode("div",X6,[m.renderSlot(u.$slots,"header-actions"),e.fullscreen?(m.openBlock(),m.createElementBlock("div",{key:0,class:"dialog-action-btn",onClick:s},[m.createVNode(m.unref(Ut),{icon:a.value?"radix-icons:exit-full-screen":"radix-icons:enter-full-screen"},null,8,["icon"])])):m.createCommentVNode("",!0),m.createElementVNode("div",{class:"dialog-action-btn",onClick:p[0]||(p[0]=f=>d())},[m.createVNode(m.unref(Ut),{icon:"ep:close"})])])])]),default:m.withCtx(()=>[e.scrollable?(m.openBlock(),m.createBlock(m.unref(F.ElScrollbar),{key:0,style:m.normalizeStyle(c.value)},{default:m.withCtx(()=>[m.renderSlot(u.$slots,"default")]),_:3},8,["style"])):(m.openBlock(),m.createElementBlock("div",J6,[m.renderSlot(u.$slots,"default")]))]),_:2},[m.unref(n).footer?{name:"footer",fn:m.withCtx(()=>[m.renderSlot(u.$slots,"footer")]),key:"0"}:void 0]),1040,["fullscreen","draggable"]))}}),ez={class:"flex justify-between items-center h-54px pl-15px pr-15px"},tz={class:"flex items-center gap-8px"},nz={class:"drawer-actions"},rz=["onClick"],iz={class:"drawer-content"},oz={key:1,class:"drawer-body-no-scroll"},NC=m.defineComponent({__name:"Drawer",props:{modelValue:{type:Boolean,default:!1},title:{type:String,default:""},direction:{type:String,default:"rtl"},size:{type:[String,Number],default:"30%"},scrollable:{type:Boolean,default:!0}},setup(e){const t=m.useSlots(),n=e,r=m.computed(()=>{const i=["title","direction","size","scrollable"],o=m.useAttrs(),a=T(T({},o),n);for(const s in a)i.indexOf(s)!==-1&&delete a[s];return a});return(i,o)=>(m.openBlock(),m.createBlock(m.unref(F.ElDrawer),m.mergeProps(r.value,{direction:e.direction,size:e.size,"destroy-on-close":"","close-on-click-modal":!1,"show-close":!1,class:"ae-drawer"}),m.createSlots({header:m.withCtx(({close:a})=>[m.createElementVNode("div",ez,[m.createElementVNode("div",tz,[m.renderSlot(i.$slots,"title",{},()=>[m.createTextVNode(m.toDisplayString(e.title),1)])]),m.createElementVNode("div",nz,[m.renderSlot(i.$slots,"header-actions"),m.createElementVNode("div",{class:"drawer-action-btn",onClick:a},[m.createVNode(m.unref(Ut),{icon:"ep:close"})],8,rz)])])]),default:m.withCtx(()=>[e.scrollable?(m.openBlock(),m.createBlock(m.unref(F.ElScrollbar),{key:0,class:"drawer-scrollbar"},{default:m.withCtx(()=>[m.createElementVNode("div",iz,[m.renderSlot(i.$slots,"default")])]),_:3})):(m.openBlock(),m.createElementBlock("div",oz,[m.renderSlot(i.$slots,"default")]))]),_:2},[m.unref(t).footer?{name:"footer",fn:m.withCtx(()=>[m.renderSlot(i.$slots,"footer")]),key:"0"}:void 0]),1040,["direction","size"]))}}),OC=m.defineComponent({__name:"Tabs",props:{modelValue:{type:[String,Number],default:""},fillHeight:{type:Boolean,default:!1},lazy:{type:Boolean,default:!1},keepAlive:{type:Boolean,default:!0}},emits:["update:modelValue","tab-click","tab-change","tab-remove","tab-add","edit"],setup(e,{expose:t,emit:n}){const r=e,i=n,o=m.computed(()=>{const f=["fillHeight","lazy","keepAlive"],h=m.useAttrs(),_=T(T({},h),r);for(const g in _)f.indexOf(g)!==-1&&delete _[g];return _}),a=f=>r.modelValue===f,s=m.ref(new Set);m.watch(()=>r.modelValue,f=>{f&&s.value.add(f)},{immediate:!0});const l=(f,h)=>{i("tab-click",f,h)},c=f=>{i("update:modelValue",f),i("tab-change",f)},d=f=>{i("tab-remove",f)},u=()=>{i("tab-add")},p=(f,h)=>{i("edit",f,h)};return m.provide("shouldShowTab",a),m.provide("parentLazy",m.computed(()=>r.lazy)),m.provide("parentKeepAlive",m.computed(()=>r.keepAlive)),t({shouldShowTab:a,loadedTabs:s}),(f,h)=>(m.openBlock(),m.createBlock(m.unref(F.ElTabs),m.mergeProps(o.value,{"model-value":e.modelValue,class:[{"ae-tabs-fill-height":e.fillHeight},"ae-tabs"],onTabClick:l,onTabChange:c,onTabRemove:d,onTabAdd:u,onEdit:p}),{default:m.withCtx(()=>[m.renderSlot(f.$slots,"default")]),_:3},16,["model-value","class"]))}}),az={key:0,class:"ae-tab-pane-content"},AC=m.defineComponent({__name:"TabPane",props:{label:{type:String,default:""},name:{type:[String,Number],required:!0},disabled:{type:Boolean,default:!1},closable:{type:Boolean,default:!1},lazy:{type:Boolean,default:void 0}},setup(e){const t=e,n=m.computed(()=>{const u=["lazy"],p=m.useAttrs(),f=T(T({},p),t);for(const h in f)u.indexOf(h)!==-1&&delete f[h];return f}),r=m.inject("shouldShowTab",()=>!0),i=m.inject("parentLazy",!1),o=m.inject("parentKeepAlive",!0),a=m.computed(()=>t.lazy!==void 0?t.lazy:i),s=m.ref(!1),l=m.computed(()=>r(t.name));m.watch(l,u=>{u&&a.value&&(s.value=!0)},{immediate:!0}),m.watch(l,u=>{!u&&!o&&a.value&&(s.value=!1)});const c=m.computed(()=>a.value?s.value:!0),d=m.computed(()=>a.value?l.value:!0);return(u,p)=>(m.openBlock(),m.createBlock(m.unref(F.ElTabPane),m.normalizeProps(m.guardReactiveProps(n.value)),{default:m.withCtx(()=>[c.value?m.withDirectives((m.openBlock(),m.createElementBlock("div",az,[m.renderSlot(u.$slots,"default")],512)),[[m.vShow,d.value]]):m.createCommentVNode("",!0)]),_:3},16))}}),sz={install:(e,t)=>{e.component("AeForm",vC),e.component("AeTable",od),e.component("AeIcon",Ut),e.component("AeEditor",lm),e.component("AeUpload",es),e.component("AeDialog",TC),e.component("AeDrawer",NC),e.component("AeTabs",OC),e.component("AeTabPane",AC),t!=null&&t.locale&&Cm(t.locale),t!=null&&t.customLocale&&Object.entries(t.customLocale).forEach(([n,r])=>{vm(n,r)}),t!=null&&t.formImports&&ts.registerComponents(t.formImports),t!=null&&t.tableImports&&ns.registerComponents(t.tableImports)},version:"0.1.2"};Q.AeDialog=TC,Q.AeDrawer=NC,Q.AeEditor=lm,Q.AeForm=vC,Q.AeIcon=Ut,Q.AeTabPane=AC,Q.AeTable=od,Q.AeTabs=OC,Q.AeUpload=es,Q.FULL_TOOLBAR_KEYS=CC,Q.SIMPLE_TOOLBAR_KEYS=yC,Q.default=sz,Q.enUS=Ua,Q.findNode=Nc,Q.findNodes=Oc,Q.formatAmount=nd,Q.formatDate=Pf,Q.formatSensitive=td,Q.getAutoRulesMap=Tc,Q.getCurrentLocale=FC,Q.locale=UC,Q.setCustomLocale=vm,Q.setLocale=Cm,Q.supportedLocales=HC,Q.useDict=Ff,Q.zhCN=fo,Object.defineProperties(Q,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
686
686
|
//# sourceMappingURL=index.umd.js.map
|