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.cjs
CHANGED
|
@@ -682,5 +682,5 @@ ${ae("ai-append")}</button>
|
|
|
682
682
|
`}};to.tableSection={filter:["thead","tbody","tfoot"],replacement:function(e){return e}};function lz(e){var t=e.parentNode;return t.nodeName==="THEAD"||t.firstChild===e&&(t.nodeName==="TABLE"||cz(t))&&sz.call(e.childNodes,function(n){return n.nodeName==="TH"})}function cz(e){var t=e.previousSibling;return e.nodeName==="TBODY"&&(!t||t.nodeName==="THEAD"&&/^\s*$/i.test(t.textContent))}function Au(e,t=null,n=null){n===null&&(n=az.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=dz(i,t," ")),r+i+" |"}function yy(e){if(!e.childNodes)return!1;for(let t=0;t<e.childNodes.length;t++){const n=e.childNodes[t];if(n.nodeName==="TABLE"||yy(n))return!0}return!1}function cm(e){return!!(!e||!e.rows||e.rows.length===1&&e.rows[0].childNodes.length<=1||yy(e))}function Cy(e){let t=e.parentNode;for(;t.nodeName!=="TABLE";)if(t=t.parentNode,!t)return null;return t}function dz(e,t,n){const r=t.getAttribute("colspan")||1;for(let i=1;i<r;i++)e+=" | "+n.repeat(3);return e}function Ty(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 Ny(e){e.keep(function(n){return n.nodeName==="TABLE"});for(var t in to)e.addRule(t,to[t])}function uz(e){e.addRule("taskListItems",{filter:function(t){return t.type==="checkbox"&&t.parentNode.nodeName==="LI"},replacement:function(t,n){return(n.checked?"[x]":"[ ]")+" "}})}function pz(e){e.use([iz,oz,Ny,uz])}const dm=rn({html:!0,linkify:!0,typographer:!0});dm.use(b6,"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>"}});dm.use(D6,{enabled:!0,label:!0});const si=new Il({headingStyle:"atx",hr:"---",bulletListMarker:"-",codeBlockStyle:"fenced",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",preformattedCode:!1});si.use(pz);si.use(Ny);si.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(e){return"~~"+e+"~~"}});si.keep(e=>!(e&&e.nodeName==="DIV"));si.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}});si.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 Dl=e=>{if(!e)return e;const t=dm.render(e).trim();return t?Fo(t.includes("<pre")?t:t.replace(/\n/g,"")):e},mz=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 si.turndown(n)};ue("aie-header",gS);ue("aie-footer",ES);const fz={theme:"light",lang:"zh",contentRetentionKey:"ai-editor-content",editable:!0,draggable:!0,placeholder:"",toolbarSize:"small"};class hz extends eI{constructor(t,n={}){super(n),V(this,"aiEditor"),this.aiEditor=t}parseHtml(t){function n(r){return new window.DOMParser().parseFromString(`<body>${r}</body>`,"text/html").body}return xi.fromSchema(this.schema).parse(n(t),{}).content}parseMarkdown(t){const n=Dl(t);return this.parseHtml(n)}insertMarkdown(t){this.commands.insertContent(Dl(t))}}class _z{constructor(t){V(this,"customLayout",!1),V(this,"innerEditor"),V(this,"container"),V(this,"header"),V(this,"mainEl"),V(this,"footer"),V(this,"options"),V(this,"eventComponents",[]),this.options=T(T({},fz),t),this.initI18nAndInnerEditor()}initI18nAndInnerEditor(){const t=this.options.i18n||{},n={de:{translation:T(T({},NV),t.de)},en:{translation:T(T({},TV),t.en)},pt:{translation:T(T({},OV),t.pt)},zh:{translation:T(T({},CV),t.zh)},es:{translation:T(T({},AV),t.es)},hi:{translation:T(T({},RV),t.hi)},id:{translation:T(T({},wV),t.id)},ja:{translation:T(T({},xV),t.ja)},ko:{translation:T(T({},IV),t.ko)},th:{translation:T(T({},DV),t.th)},vi:{translation:T(T({},kV),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 gS,this.eventComponents.push(this.header),this.footer=new ES,this.footer.initDraggable(this.options.draggable),this.eventComponents.push(this.footer);let n=this.options.content;if(typeof n=="string"&&(this.options.contentIsMarkdown?n=Dl(n):n=Fo(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 hz(this,H(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=yV(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&&Sr.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?"":Kl(this.innerEditor.state.doc,{from:t.from,to:t.to})}getMarkdown(){return mz(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,H(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=Fo(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=Fo(t)),n===!1?this.clear().insert(t):this.focus().clear().insert(t),this}setMarkdownContent(t){const n=Dl(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 Oy=["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"],Ay=["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"],gz=h.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=h.ref();function o(f){i.value=f}let a=null;function s(){var g;let f;const _=e.toolbarExcludeKeys||[];if(e.mode==="custom")f=e.toolbarKeys||[];else if(e.mode==="simple"){if(f=Oy,(g=e.addToolbarKeys)!=null&&g.length){const S=[...f],v=[];e.addToolbarKeys.forEach(y=>{if(Array.isArray(y)&&y.length===2){const[E,b]=y;let C=-1;if(typeof E=="number")C=E;else if(typeof E=="string"){const N=S.findIndex(O=>O===E);N>-1&&(C=N+1)}C>-1&&v.push({position:C,key:b})}}),v.sort((y,E)=>E.position-y.position).forEach(({position:y,key:E})=>{S.splice(y,0,E)}),f=S}}else f=Ay;return H(T({},e.editorOptions),{lang:e.lang||"zh",toolbarSize:e.size||"small",toolbarKeys:f,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(f){return f?e.contentIsMarkdown?f.getMarkdown():f.getHtml():""}function c(f){a&&(e.contentIsMarkdown?a.setMarkdownContent(f):a.setContent(f))}const d=lt.useDebounceFn(f=>{t("change",f),t("update:modelValue",f)},500);function u(){const f=s();a&&(a.destroy(),a=null),a=new _z(H(T({},f),{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")}}))}h.watch(()=>e.modelValue,f=>{if(a){if(l(a)===f)return;n=!0,c(f),h.nextTick(()=>{n=!1})}},{immediate:!1}),h.watch(()=>e.disabled,f=>{f?a&&a.destroy():h.nextTick(()=>{u()})},{immediate:!1}),h.watch(()=>e.mode,()=>{u()},{immediate:!1}),h.onMounted(()=>Mt(this,null,function*(){yield h.nextTick(),u()})),h.onUnmounted(()=>{a&&a.destroy()});const p=h.computed(()=>({height:Cd(e.editorHeight)||"350px"})),m=h.computed(()=>({height:Cd(e.viewHeight)||"fit-content"}));return()=>e.disabled?h.createVNode("div",{class:"ae-ai-editor-view",style:m.value},[h.createVNode("div",{innerHTML:e.modelValue},null)]):h.createVNode("div",{ref:f=>o(f),style:p.value,class:"ae-ai-editor"},null)}}),um=no(gz,[["__scopeId","data-v-f14d35f4"]]),Ez={Group:WO,Blank:XO,Alert:G.ElAlert,Divider:G.ElDivider,Image:G.ElImage,Result:G.ElResult,Autocomplete:G.ElAutocomplete,Cascader:G.ElCascader,Checkbox:G.ElCheckboxGroup,CheckboxButton:G.ElCheckboxGroup,ColorPicker:G.ElColorPicker,DatePicker:G.ElDatePicker,Editor:um,Input:G.ElInput,InputNumber:G.ElInputNumber,InputTag:G.ElInputTag,Mention:G.ElMention,Radio:G.ElRadioGroup,RadioButton:G.ElRadioGroup,Rate:G.ElRate,Segmented:G.ElSegmented,Select:G.ElSelect,Slider:G.ElSlider,Switch:G.ElSwitch,Table:Qu,TimePicker:G.ElTimePicker,TimeSelect:G.ElTimeSelect,Transfer:G.ElTransfer,TreeSelect:G.ElTreeSelect,Upload:Fl},bz={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 Sz(e=[]){const t=h.shallowReactive(T(T({},Ez),bs.components)),n=h.shallowReactive(T({},bs.componentConfigs)),r=h.shallowReactive(T(T({},bz),bs.arrayStrategies));return e.forEach(i=>{t[i.name]&&fe.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),fe.success("console.form.componentRegistered",{name:i.name})}),{components:t,arrayStrategies:r,componentConfigs:n}}const Ry=h.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}=Sz(e.imports),{isValidating:l,formModel:c,elFormRef:d,baseElRowRef:u,componentRefs:p,schemasKeys:m,initValues:f,getDefaultModel:_,getFormModel:g,getElFormRef:S,setValues:v,clearValues:y,setValue:E,delValue:b,resetValidate:C,validate:N}=cC(e,e.schemas,o,a);h.onMounted(()=>{t("register",h.unref(d)),h.unref(e).autoInitField?f(e.model):v(e.model)}),h.onBeforeUnmount(()=>{c.value={},d.value=null});const O=h.computed(()=>{const w=h.toRaw(h.unref(e).schemas),I=k=>{const{key:M,field:P,type:U,component:x,value:R,children:D}=k;let L=`${P||M}:${U||"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("|")});h.watch(O,()=>{l.value||(h.unref(e).autoInitField&&f(h.unref(c)),C())},{immediate:!1}),i({initValues:f,getDefaultModel:_,getFormModel:g,getElFormRef:S,setValues:v,clearValues:y,setValue:E,delValue:b,validate:N,resetValidate:C});const{renderForm:A}=lC(e,t,n,r,c,d,p,u,m,o,s);return()=>h.createVNode("div",{class:"ae-form"},[A()])}}),vz={class:"flex justify-between items-center h-54px pl-15px pr-15px relative"},yz={class:"flex items-center"},Cz={class:"dialog-actions"},Tz={key:1,class:"dialog-body-no-scroll"},wy=h.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=h.useSlots(),r=e,i=t,o=h.computed(()=>{const u=["fullscreen","title","maxHeight","draggable","scrollable","beforeClose"],p=h.useAttrs(),m=T(T({},p),r);for(const f in m)u.indexOf(f)!==-1&&delete m[f];return m}),a=h.ref(r.isFullscreen),s=()=>{a.value=!h.unref(a)},l=h.ref(_m(r.maxHeight)?`${r.maxHeight}px`:r.maxHeight);h.watch(()=>r.maxHeight,u=>{l.value=_m(u)?`${u}px`:u});const c=h.computed(()=>({height:h.unref(l),padding:"15px"}));function d(){r.beforeClose!==void 0?r.beforeClose(()=>{i("update:modelValue",!1)}):i("update:modelValue",!1)}return(u,p)=>(h.openBlock(),h.createBlock(h.unref(G.ElDialog),h.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"}),h.createSlots({header:h.withCtx(()=>[h.createElementVNode("div",vz,[h.createElementVNode("div",yz,[e.draggable?(h.openBlock(),h.createBlock(h.unref(Bt),{key:0,icon:"mdi:drag",class:"draggable-indicator",size:30})):h.createCommentVNode("",!0),h.renderSlot(u.$slots,"title",{},()=>[h.createTextVNode(h.toDisplayString(e.title),1)])]),h.createElementVNode("div",Cz,[h.renderSlot(u.$slots,"header-actions"),e.fullscreen?(h.openBlock(),h.createElementBlock("div",{key:0,class:"dialog-action-btn",onClick:s},[h.createVNode(h.unref(Bt),{icon:a.value?"radix-icons:exit-full-screen":"radix-icons:enter-full-screen"},null,8,["icon"])])):h.createCommentVNode("",!0),h.createElementVNode("div",{class:"dialog-action-btn",onClick:p[0]||(p[0]=m=>d())},[h.createVNode(h.unref(Bt),{icon:"ep:close"})])])])]),default:h.withCtx(()=>[e.scrollable?(h.openBlock(),h.createBlock(h.unref(G.ElScrollbar),{key:0,style:h.normalizeStyle(c.value)},{default:h.withCtx(()=>[h.renderSlot(u.$slots,"default")]),_:3},8,["style"])):(h.openBlock(),h.createElementBlock("div",Tz,[h.renderSlot(u.$slots,"default")]))]),_:2},[h.unref(n).footer?{name:"footer",fn:h.withCtx(()=>[h.renderSlot(u.$slots,"footer")]),key:"0"}:void 0]),1040,["fullscreen","draggable"]))}}),Nz={class:"flex justify-between items-center h-54px pl-15px pr-15px"},Oz={class:"flex items-center gap-8px"},Az={class:"drawer-actions"},Rz=["onClick"],wz={class:"drawer-content"},xz={key:1,class:"drawer-body-no-scroll"},xy=h.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=h.useSlots(),n=e,r=h.computed(()=>{const i=["title","direction","size","scrollable"],o=h.useAttrs(),a=T(T({},o),n);for(const s in a)i.indexOf(s)!==-1&&delete a[s];return a});return(i,o)=>(h.openBlock(),h.createBlock(h.unref(G.ElDrawer),h.mergeProps(r.value,{direction:e.direction,size:e.size,"destroy-on-close":"","close-on-click-modal":!1,"show-close":!1,class:"ae-drawer"}),h.createSlots({header:h.withCtx(({close:a})=>[h.createElementVNode("div",Nz,[h.createElementVNode("div",Oz,[h.renderSlot(i.$slots,"title",{},()=>[h.createTextVNode(h.toDisplayString(e.title),1)])]),h.createElementVNode("div",Az,[h.renderSlot(i.$slots,"header-actions"),h.createElementVNode("div",{class:"drawer-action-btn",onClick:a},[h.createVNode(h.unref(Bt),{icon:"ep:close"})],8,Rz)])])]),default:h.withCtx(()=>[e.scrollable?(h.openBlock(),h.createBlock(h.unref(G.ElScrollbar),{key:0,class:"drawer-scrollbar"},{default:h.withCtx(()=>[h.createElementVNode("div",wz,[h.renderSlot(i.$slots,"default")])]),_:3})):(h.openBlock(),h.createElementBlock("div",xz,[h.renderSlot(i.$slots,"default")]))]),_:2},[h.unref(t).footer?{name:"footer",fn:h.withCtx(()=>[h.renderSlot(i.$slots,"footer")]),key:"0"}:void 0]),1040,["direction","size"]))}}),Iy=h.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=h.computed(()=>{const m=["fillHeight","lazy","keepAlive"],f=h.useAttrs(),_=T(T({},f),r);for(const g in _)m.indexOf(g)!==-1&&delete _[g];return _}),a=m=>r.modelValue===m,s=h.ref(new Set);h.watch(()=>r.modelValue,m=>{m&&s.value.add(m)},{immediate:!0});const l=(m,f)=>{i("tab-click",m,f)},c=m=>{i("update:modelValue",m),i("tab-change",m)},d=m=>{i("tab-remove",m)},u=()=>{i("tab-add")},p=(m,f)=>{i("edit",m,f)};return h.provide("shouldShowTab",a),h.provide("parentLazy",h.computed(()=>r.lazy)),h.provide("parentKeepAlive",h.computed(()=>r.keepAlive)),t({shouldShowTab:a,loadedTabs:s}),(m,f)=>(h.openBlock(),h.createBlock(h.unref(G.ElTabs),h.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:h.withCtx(()=>[h.renderSlot(m.$slots,"default")]),_:3},16,["model-value","class"]))}}),Iz={key:0,class:"ae-tab-pane-content"},Dy=h.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=h.computed(()=>{const u=["lazy"],p=h.useAttrs(),m=T(T({},p),t);for(const f in m)u.indexOf(f)!==-1&&delete m[f];return m}),r=h.inject("shouldShowTab",()=>!0),i=h.inject("parentLazy",!1),o=h.inject("parentKeepAlive",!0),a=h.computed(()=>t.lazy!==void 0?t.lazy:i),s=h.ref(!1),l=h.computed(()=>r(t.name));h.watch(l,u=>{u&&a.value&&(s.value=!0)},{immediate:!0}),h.watch(l,u=>{!u&&!o&&a.value&&(s.value=!1)});const c=h.computed(()=>a.value?s.value:!0),d=h.computed(()=>a.value?l.value:!0);return(u,p)=>(h.openBlock(),h.createBlock(h.unref(G.ElTabPane),h.normalizeProps(h.guardReactiveProps(n.value)),{default:h.withCtx(()=>[c.value?h.withDirectives((h.openBlock(),h.createElementBlock("div",Iz,[h.renderSlot(u.$slots,"default")],512)),[[h.vShow,d.value]]):h.createCommentVNode("",!0)]),_:3},16))}}),Dz=(e,t)=>{e.component("AeForm",Ry),e.component("AeTable",Qu),e.component("AeIcon",Bt),e.component("AeEditor",um),e.component("AeUpload",Fl),e.component("AeDialog",wy),e.component("AeDrawer",xy),e.component("AeTabs",Iy),e.component("AeTabPane",Dy),t!=null&&t.locale&&vg(t.locale),t!=null&&t.customLocale&&Object.entries(t.customLocale).forEach(([n,r])=>{yg(n,r)}),t!=null&&t.formImports&&bs.registerComponents(t.formImports),t!=null&&t.tableImports&&Ss.registerComponents(t.tableImports)},kz={install:Dz,version:"0.1.1"};exports.AeDialog=wy;exports.AeDrawer=xy;exports.AeEditor=um;exports.AeForm=Ry;exports.AeIcon=Bt;exports.AeTabPane=Dy;exports.AeTable=Qu;exports.AeTabs=Iy;exports.AeUpload=Fl;exports.FULL_TOOLBAR_KEYS=Ay;exports.SIMPLE_TOOLBAR_KEYS=Oy;exports.default=kz;exports.enUS=gg;exports.findNode=xu;exports.findNodes=Td;exports.formatAmount=Ku;exports.formatDate=rE;exports.formatSensitive=Wu;exports.getAutoRulesMap=wu;exports.getCurrentLocale=Hy;exports.locale=Gy;exports.setCustomLocale=yg;exports.setLocale=vg;exports.supportedLocales=zy;exports.useDict=iE;exports.zhCN=_g;
|
|
685
|
+
`}});const Dl=e=>{if(!e)return e;const t=dm.render(e).trim();return t?Fo(t.includes("<pre")?t:t.replace(/\n/g,"")):e},mz=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 si.turndown(n)};ue("aie-header",gS);ue("aie-footer",ES);const fz={theme:"light",lang:"zh",contentRetentionKey:"ai-editor-content",editable:!0,draggable:!0,placeholder:"",toolbarSize:"small"};class hz extends eI{constructor(t,n={}){super(n),V(this,"aiEditor"),this.aiEditor=t}parseHtml(t){function n(r){return new window.DOMParser().parseFromString(`<body>${r}</body>`,"text/html").body}return xi.fromSchema(this.schema).parse(n(t),{}).content}parseMarkdown(t){const n=Dl(t);return this.parseHtml(n)}insertMarkdown(t){this.commands.insertContent(Dl(t))}}class _z{constructor(t){V(this,"customLayout",!1),V(this,"innerEditor"),V(this,"container"),V(this,"header"),V(this,"mainEl"),V(this,"footer"),V(this,"options"),V(this,"eventComponents",[]),this.options=T(T({},fz),t),this.initI18nAndInnerEditor()}initI18nAndInnerEditor(){const t=this.options.i18n||{},n={de:{translation:T(T({},NV),t.de)},en:{translation:T(T({},TV),t.en)},pt:{translation:T(T({},OV),t.pt)},zh:{translation:T(T({},CV),t.zh)},es:{translation:T(T({},AV),t.es)},hi:{translation:T(T({},RV),t.hi)},id:{translation:T(T({},wV),t.id)},ja:{translation:T(T({},xV),t.ja)},ko:{translation:T(T({},IV),t.ko)},th:{translation:T(T({},DV),t.th)},vi:{translation:T(T({},kV),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 gS,this.eventComponents.push(this.header),this.footer=new ES,this.footer.initDraggable(this.options.draggable),this.eventComponents.push(this.footer);let n=this.options.content;if(typeof n=="string"&&(this.options.contentIsMarkdown?n=Dl(n):n=Fo(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 hz(this,H(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=yV(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&&Sr.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?"":Kl(this.innerEditor.state.doc,{from:t.from,to:t.to})}getMarkdown(){return mz(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,H(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=Fo(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=Fo(t)),n===!1?this.clear().insert(t):this.focus().clear().insert(t),this}setMarkdownContent(t){const n=Dl(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 Oy=["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"],Ay=["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"],gz=h.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=h.ref();function o(f){i.value=f}let a=null;function s(){var g;let f;const _=e.toolbarExcludeKeys||[];if(e.mode==="custom")f=e.toolbarKeys||[];else if(e.mode==="simple"){if(f=Oy,(g=e.addToolbarKeys)!=null&&g.length){const S=[...f],v=[];e.addToolbarKeys.forEach(y=>{if(Array.isArray(y)&&y.length===2){const[E,b]=y;let C=-1;if(typeof E=="number")C=E;else if(typeof E=="string"){const N=S.findIndex(O=>O===E);N>-1&&(C=N+1)}C>-1&&v.push({position:C,key:b})}}),v.sort((y,E)=>E.position-y.position).forEach(({position:y,key:E})=>{S.splice(y,0,E)}),f=S}}else f=Ay;return H(T({},e.editorOptions),{lang:e.lang||"zh",toolbarSize:e.size||"small",toolbarKeys:f,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(f){return f?e.contentIsMarkdown?f.getMarkdown():f.getHtml():""}function c(f){a&&(e.contentIsMarkdown?a.setMarkdownContent(f):a.setContent(f))}const d=lt.useDebounceFn(f=>{t("change",f),t("update:modelValue",f)},500);function u(){const f=s();a&&(a.destroy(),a=null),a=new _z(H(T({},f),{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")}}))}h.watch(()=>e.modelValue,f=>{if(a){if(l(a)===f)return;n=!0,c(f),h.nextTick(()=>{n=!1})}},{immediate:!1}),h.watch(()=>e.disabled,f=>{f?a&&a.destroy():h.nextTick(()=>{u()})},{immediate:!1}),h.watch(()=>e.mode,()=>{u()},{immediate:!1}),h.onMounted(()=>Mt(this,null,function*(){yield h.nextTick(),u()})),h.onUnmounted(()=>{a&&a.destroy()});const p=h.computed(()=>({height:Cd(e.editorHeight)||"350px"})),m=h.computed(()=>({height:Cd(e.viewHeight)||"fit-content"}));return()=>e.disabled?h.createVNode("div",{class:"ae-ai-editor-view",style:m.value},[h.createVNode("div",{innerHTML:e.modelValue},null)]):h.createVNode("div",{ref:f=>o(f),style:p.value,class:"ae-ai-editor"},null)}}),um=no(gz,[["__scopeId","data-v-f14d35f4"]]),Ez={Group:WO,Blank:XO,Alert:G.ElAlert,Divider:G.ElDivider,Image:G.ElImage,Result:G.ElResult,Autocomplete:G.ElAutocomplete,Cascader:G.ElCascader,Checkbox:G.ElCheckboxGroup,CheckboxButton:G.ElCheckboxGroup,ColorPicker:G.ElColorPicker,DatePicker:G.ElDatePicker,Editor:um,Input:G.ElInput,InputNumber:G.ElInputNumber,InputTag:G.ElInputTag,Mention:G.ElMention,Radio:G.ElRadioGroup,RadioButton:G.ElRadioGroup,Rate:G.ElRate,Segmented:G.ElSegmented,Select:G.ElSelect,Slider:G.ElSlider,Switch:G.ElSwitch,Table:Qu,TimePicker:G.ElTimePicker,TimeSelect:G.ElTimeSelect,Transfer:G.ElTransfer,TreeSelect:G.ElTreeSelect,Upload:Fl},bz={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 Sz(e=[]){const t=h.shallowReactive(T(T({},Ez),bs.components)),n=h.shallowReactive(T({},bs.componentConfigs)),r=h.shallowReactive(T(T({},bz),bs.arrayStrategies));return e.forEach(i=>{t[i.name]&&fe.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),fe.success("console.form.componentRegistered",{name:i.name})}),{components:t,arrayStrategies:r,componentConfigs:n}}const Ry=h.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}=Sz(e.imports),{isValidating:l,formModel:c,elFormRef:d,baseElRowRef:u,componentRefs:p,schemasKeys:m,initValues:f,getDefaultModel:_,getFormModel:g,getElFormRef:S,setValues:v,clearValues:y,setValue:E,delValue:b,resetValidate:C,validate:N}=cC(e,e.schemas,o,a);h.onMounted(()=>{t("register",h.unref(d)),h.unref(e).autoInitField?f(e.model):v(e.model)}),h.onBeforeUnmount(()=>{c.value={},d.value=null});const O=h.computed(()=>{const w=h.toRaw(h.unref(e).schemas),I=k=>{const{key:M,field:P,type:U,component:x,value:R,children:D}=k;let L=`${P||M}:${U||"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("|")});h.watch(O,()=>{l.value||(h.unref(e).autoInitField&&f(h.unref(c)),C())},{immediate:!1}),i({initValues:f,getDefaultModel:_,getFormModel:g,getElFormRef:S,setValues:v,clearValues:y,setValue:E,delValue:b,validate:N,resetValidate:C});const{renderForm:A}=lC(e,t,n,r,c,d,p,u,m,o,s);return()=>h.createVNode("div",{class:"ae-form"},[A()])}}),vz={class:"flex justify-between items-center h-54px pl-15px pr-15px relative"},yz={class:"flex items-center"},Cz={class:"dialog-actions"},Tz={key:1,class:"dialog-body-no-scroll"},wy=h.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=h.useSlots(),r=e,i=t,o=h.computed(()=>{const u=["fullscreen","title","maxHeight","draggable","scrollable","beforeClose"],p=h.useAttrs(),m=T(T({},p),r);for(const f in m)u.indexOf(f)!==-1&&delete m[f];return m}),a=h.ref(r.isFullscreen),s=()=>{a.value=!h.unref(a)},l=h.ref(_m(r.maxHeight)?`${r.maxHeight}px`:r.maxHeight);h.watch(()=>r.maxHeight,u=>{l.value=_m(u)?`${u}px`:u});const c=h.computed(()=>({height:h.unref(l),padding:"15px"}));function d(){r.beforeClose!==void 0?r.beforeClose(()=>{i("update:modelValue",!1)}):i("update:modelValue",!1)}return(u,p)=>(h.openBlock(),h.createBlock(h.unref(G.ElDialog),h.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"}),h.createSlots({header:h.withCtx(()=>[h.createElementVNode("div",vz,[h.createElementVNode("div",yz,[e.draggable?(h.openBlock(),h.createBlock(h.unref(Bt),{key:0,icon:"mdi:drag",class:"draggable-indicator",size:30})):h.createCommentVNode("",!0),h.renderSlot(u.$slots,"title",{},()=>[h.createTextVNode(h.toDisplayString(e.title),1)])]),h.createElementVNode("div",Cz,[h.renderSlot(u.$slots,"header-actions"),e.fullscreen?(h.openBlock(),h.createElementBlock("div",{key:0,class:"dialog-action-btn",onClick:s},[h.createVNode(h.unref(Bt),{icon:a.value?"radix-icons:exit-full-screen":"radix-icons:enter-full-screen"},null,8,["icon"])])):h.createCommentVNode("",!0),h.createElementVNode("div",{class:"dialog-action-btn",onClick:p[0]||(p[0]=m=>d())},[h.createVNode(h.unref(Bt),{icon:"ep:close"})])])])]),default:h.withCtx(()=>[e.scrollable?(h.openBlock(),h.createBlock(h.unref(G.ElScrollbar),{key:0,style:h.normalizeStyle(c.value)},{default:h.withCtx(()=>[h.renderSlot(u.$slots,"default")]),_:3},8,["style"])):(h.openBlock(),h.createElementBlock("div",Tz,[h.renderSlot(u.$slots,"default")]))]),_:2},[h.unref(n).footer?{name:"footer",fn:h.withCtx(()=>[h.renderSlot(u.$slots,"footer")]),key:"0"}:void 0]),1040,["fullscreen","draggable"]))}}),Nz={class:"flex justify-between items-center h-54px pl-15px pr-15px"},Oz={class:"flex items-center gap-8px"},Az={class:"drawer-actions"},Rz=["onClick"],wz={class:"drawer-content"},xz={key:1,class:"drawer-body-no-scroll"},xy=h.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=h.useSlots(),n=e,r=h.computed(()=>{const i=["title","direction","size","scrollable"],o=h.useAttrs(),a=T(T({},o),n);for(const s in a)i.indexOf(s)!==-1&&delete a[s];return a});return(i,o)=>(h.openBlock(),h.createBlock(h.unref(G.ElDrawer),h.mergeProps(r.value,{direction:e.direction,size:e.size,"destroy-on-close":"","close-on-click-modal":!1,"show-close":!1,class:"ae-drawer"}),h.createSlots({header:h.withCtx(({close:a})=>[h.createElementVNode("div",Nz,[h.createElementVNode("div",Oz,[h.renderSlot(i.$slots,"title",{},()=>[h.createTextVNode(h.toDisplayString(e.title),1)])]),h.createElementVNode("div",Az,[h.renderSlot(i.$slots,"header-actions"),h.createElementVNode("div",{class:"drawer-action-btn",onClick:a},[h.createVNode(h.unref(Bt),{icon:"ep:close"})],8,Rz)])])]),default:h.withCtx(()=>[e.scrollable?(h.openBlock(),h.createBlock(h.unref(G.ElScrollbar),{key:0,class:"drawer-scrollbar"},{default:h.withCtx(()=>[h.createElementVNode("div",wz,[h.renderSlot(i.$slots,"default")])]),_:3})):(h.openBlock(),h.createElementBlock("div",xz,[h.renderSlot(i.$slots,"default")]))]),_:2},[h.unref(t).footer?{name:"footer",fn:h.withCtx(()=>[h.renderSlot(i.$slots,"footer")]),key:"0"}:void 0]),1040,["direction","size"]))}}),Iy=h.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=h.computed(()=>{const m=["fillHeight","lazy","keepAlive"],f=h.useAttrs(),_=T(T({},f),r);for(const g in _)m.indexOf(g)!==-1&&delete _[g];return _}),a=m=>r.modelValue===m,s=h.ref(new Set);h.watch(()=>r.modelValue,m=>{m&&s.value.add(m)},{immediate:!0});const l=(m,f)=>{i("tab-click",m,f)},c=m=>{i("update:modelValue",m),i("tab-change",m)},d=m=>{i("tab-remove",m)},u=()=>{i("tab-add")},p=(m,f)=>{i("edit",m,f)};return h.provide("shouldShowTab",a),h.provide("parentLazy",h.computed(()=>r.lazy)),h.provide("parentKeepAlive",h.computed(()=>r.keepAlive)),t({shouldShowTab:a,loadedTabs:s}),(m,f)=>(h.openBlock(),h.createBlock(h.unref(G.ElTabs),h.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:h.withCtx(()=>[h.renderSlot(m.$slots,"default")]),_:3},16,["model-value","class"]))}}),Iz={key:0,class:"ae-tab-pane-content"},Dy=h.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=h.computed(()=>{const u=["lazy"],p=h.useAttrs(),m=T(T({},p),t);for(const f in m)u.indexOf(f)!==-1&&delete m[f];return m}),r=h.inject("shouldShowTab",()=>!0),i=h.inject("parentLazy",!1),o=h.inject("parentKeepAlive",!0),a=h.computed(()=>t.lazy!==void 0?t.lazy:i),s=h.ref(!1),l=h.computed(()=>r(t.name));h.watch(l,u=>{u&&a.value&&(s.value=!0)},{immediate:!0}),h.watch(l,u=>{!u&&!o&&a.value&&(s.value=!1)});const c=h.computed(()=>a.value?s.value:!0),d=h.computed(()=>a.value?l.value:!0);return(u,p)=>(h.openBlock(),h.createBlock(h.unref(G.ElTabPane),h.normalizeProps(h.guardReactiveProps(n.value)),{default:h.withCtx(()=>[c.value?h.withDirectives((h.openBlock(),h.createElementBlock("div",Iz,[h.renderSlot(u.$slots,"default")],512)),[[h.vShow,d.value]]):h.createCommentVNode("",!0)]),_:3},16))}}),Dz=(e,t)=>{e.component("AeForm",Ry),e.component("AeTable",Qu),e.component("AeIcon",Bt),e.component("AeEditor",um),e.component("AeUpload",Fl),e.component("AeDialog",wy),e.component("AeDrawer",xy),e.component("AeTabs",Iy),e.component("AeTabPane",Dy),t!=null&&t.locale&&vg(t.locale),t!=null&&t.customLocale&&Object.entries(t.customLocale).forEach(([n,r])=>{yg(n,r)}),t!=null&&t.formImports&&bs.registerComponents(t.formImports),t!=null&&t.tableImports&&Ss.registerComponents(t.tableImports)},kz={install:Dz,version:"0.1.2"};exports.AeDialog=wy;exports.AeDrawer=xy;exports.AeEditor=um;exports.AeForm=Ry;exports.AeIcon=Bt;exports.AeTabPane=Dy;exports.AeTable=Qu;exports.AeTabs=Iy;exports.AeUpload=Fl;exports.FULL_TOOLBAR_KEYS=Ay;exports.SIMPLE_TOOLBAR_KEYS=Oy;exports.default=kz;exports.enUS=gg;exports.findNode=xu;exports.findNodes=Td;exports.formatAmount=Ku;exports.formatDate=rE;exports.formatSensitive=Wu;exports.getAutoRulesMap=wu;exports.getCurrentLocale=Hy;exports.locale=Gy;exports.setCustomLocale=yg;exports.setLocale=vg;exports.supportedLocales=zy;exports.useDict=iE;exports.zhCN=_g;
|
|
686
686
|
//# sourceMappingURL=index.cjs.map
|