@gct-paas/design-web 0.1.4-dev.11 → 0.1.4-dev.13

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.
Files changed (40) hide show
  1. package/dist/index.min.css +2 -1
  2. package/dist/loader.esm.min.js +778 -0
  3. package/es/_virtual/_plugin-vue_export-helper.mjs +7 -8
  4. package/es/components/I18nSelect/index.mjs +7 -0
  5. package/es/components/I18nSelect/src/i18n-modal.vue.mjs +5 -151
  6. package/es/components/I18nSelect/src/i18n-modal.vue_vue_type_script_setup_true_lang.mjs +128 -0
  7. package/es/components/I18nSelect/src/i18n-select-btn.vue.mjs +7 -7
  8. package/es/components/I18nSelect/src/i18n-select-btn.vue_vue_type_script_setup_true_name_i18n-select-btn_lang.mjs +116 -0
  9. package/es/components/I18nSelect/src/i18n-select-container.vue.mjs +7 -7
  10. package/es/components/I18nSelect/src/i18n-select-container.vue_vue_type_script_setup_true_name_i18n-select-container_lang.mjs +217 -0
  11. package/es/components/I18nSelect/src/i18n-select-input-form.vue.mjs +5 -57
  12. package/es/components/I18nSelect/src/i18n-select-input-form.vue_vue_type_script_setup_true_name_i18n-select-input-form_lang.mjs +56 -0
  13. package/es/components/I18nSelect/src/i18n-select-input.vue.mjs +7 -7
  14. package/es/components/I18nSelect/src/i18n-select-input.vue_vue_type_script_setup_true_name_i18n-select-input_lang.mjs +125 -0
  15. package/es/components/I18nSelect/src/i18n-select-modal.vue.mjs +5 -21
  16. package/es/components/I18nSelect/src/i18n-select-modal.vue_vue_type_script_setup_true_lang.mjs +19 -0
  17. package/es/components/I18nSelect/src/i18n-select-textarea-form.vue.mjs +5 -57
  18. package/es/components/I18nSelect/src/i18n-select-textarea-form.vue_vue_type_script_setup_true_name_i18n-select-input-form_lang.mjs +56 -0
  19. package/es/components/I18nSelect/src/i18n-select-textarea.vue.mjs +7 -7
  20. package/es/components/I18nSelect/src/i18n-select-textarea.vue_vue_type_script_setup_true_name_i18n-select-input_lang.mjs +86 -0
  21. package/es/components/I18nSelect/src/useI18nSelect.mjs +43 -48
  22. package/es/components/index.mjs +8 -0
  23. package/es/index.mjs +14 -15
  24. package/es/loader.d.ts +1 -0
  25. package/package.json +9 -9
  26. package/dist/index.esm.min.mjs +0 -836
  27. package/dist/index.min.cjs +0 -1
  28. package/dist/index.system.min.js +0 -1
  29. package/es/components/I18nSelect/src/i18n-modal.vue2.mjs +0 -5
  30. package/es/components/I18nSelect/src/i18n-select-btn.vue2.mjs +0 -138
  31. package/es/components/I18nSelect/src/i18n-select-container.vue2.mjs +0 -250
  32. package/es/components/I18nSelect/src/i18n-select-input-form.vue2.mjs +0 -5
  33. package/es/components/I18nSelect/src/i18n-select-input.vue2.mjs +0 -129
  34. package/es/components/I18nSelect/src/i18n-select-modal.vue2.mjs +0 -5
  35. package/es/components/I18nSelect/src/i18n-select-textarea-form.vue2.mjs +0 -5
  36. package/es/components/I18nSelect/src/i18n-select-textarea.vue2.mjs +0 -93
  37. /package/es/components/I18nSelect/src/{i18n-select-btn.css → i18n-select-btn.vue_vue_type_style_index_0_scoped_dc8ffb2c_lang.css} +0 -0
  38. /package/es/components/I18nSelect/src/{i18n-select-container.css → i18n-select-container.vue_vue_type_style_index_0_scoped_0160ed5e_lang.css} +0 -0
  39. /package/es/components/I18nSelect/src/{i18n-select-input.css → i18n-select-input.vue_vue_type_style_index_0_scoped_412e1309_lang.css} +0 -0
  40. /package/es/components/I18nSelect/src/{i18n-select-textarea.css → i18n-select-textarea.vue_vue_type_style_index_0_scoped_cd95c416_lang.css} +0 -0
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),I=require("lodash-es"),R=require("@gct-paas/core-web"),Z=require("@ant-design/icons-vue"),k=require("@gct-paas/core"),F=e.defineComponent({__name:"i18n-modal",props:{lang:{},getContainer:{type:Function}},emits:["ok","register"],setup(t,{emit:u}){const l=t,o=u,a=e.ref(),n=e.reactive({id:""}),r=e.ref(!1),p=g=>{g&&(r.value=!1)},[f,{closeModal:d}]=R.useModalInner(g=>{g&&m(g)}),m=g=>{r.value=!0,n.id=g.key;const{lang:i}=l;console.log(i,"lang========");for(const s of i){const h=s.dataIndex;n[h]=g[h]}},y=(g,i,s)=>{/^[a-zA-Z_.]*$/.test(i)||s(k.t("sys.i18n.validated18nKeyErrorMsg")),s()},v=async(g,i)=>/^\s*$/g.test(i)?Promise.reject(k.t("sys.notEmptySth",{sth:k.t("sys.i18n")})):Promise.resolve(),c=()=>{a.value?.validate().then(()=>{o("ok",{...e.toRaw(n)},r.value),d()})},x=()=>{a.value?.resetFields()};return(g,i)=>{const s=e.resolveComponent("a-input"),h=e.resolveComponent("a-form-item"),_=e.resolveComponent("a-form"),V=e.resolveComponent("BasicModal");return e.openBlock(),e.createBlock(V,e.mergeProps(g.$attrs,{title:r.value?e.unref(k.t)("sys.edit"):e.unref(k.t)("sys.new"),centered:"",width:"640px","min-height":100,"mask-closable":!1,"after-close":x,"get-container":t.getContainer,onRegister:e.unref(f),onOk:c,onVisibleChange:p}),{default:e.withCtx(()=>[e.createVNode(_,{ref_key:"formRef",ref:a,model:n,"label-col":{span:6},"wrapper-col":{span:16},autocomplete:"off",layout:"horizontal"},{default:e.withCtx(()=>[e.createVNode(h,{label:e.unref(k.t)("sys.i18n.resourceIdentification"),name:"id",rules:[{required:!0,message:e.unref(k.t)("sys.pleaseInputSth",{sth:e.unref(k.t)("sys.i18n.resourceIdentification")})},{validator:y}]},{default:e.withCtx(()=>[e.createVNode(s,{value:n.id,"onUpdate:value":i[0]||(i[0]=N=>n.id=N),"show-count":"",maxlength:128,disabled:r.value},null,8,["value","disabled"])]),_:1},8,["label","rules"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.lang,N=>(e.openBlock(),e.createBlock(h,{key:N.dataIndex,label:N.title,name:N.dataIndex,rules:[{required:!0,message:e.unref(k.t)("sys.pleaseInputSth",{sth:N.title})},{validator:v}]},{default:e.withCtx(()=>[e.createVNode(s,{value:n[N.dataIndex],"onUpdate:value":$=>n[N.dataIndex]=$,"show-count":"",maxlength:300},null,8,["value","onUpdate:value"])]),_:2},1032,["label","name","rules"]))),128))]),_:1},8,["model"])]),_:1},16,["title","get-container","onRegister"])}}}),Q={class:"i18n-select-container"},X={class:"table-wrap"},Y=e.defineComponent({__name:"i18n-select-container",props:{i18nModalKey:{},destroyCallback:{type:Function},saveCallback:{type:Function}},setup(t){const[u,{closeModal:l}]=R.useModalInner(),[o,{openModal:a}]=R.useModal(),n=t,r=()=>document.querySelector(`#${n.i18nModalKey}`),p=e.ref(),f=e.reactive({keywords:""}),d=e.reactive({current:1,pageSize:5,total:0,size:"small",showTotal:C=>k.t("sys.component.table.total",{total:C})}),m=e.ref([]),y=e.ref(),v=e.ref({type:"radio",hideSelectAll:!0,selectedRowKeys:[],onChange:V}),c=e.ref(!1),x=e.computed(()=>[]),g=async(C,b)=>{c.value=!0;const w=await _api.apaas.i18NInfo.getPageList({pageNo:b??d.current,pageSize:d.pageSize,searchKey:C});if(c.value=!1,w&&w.data){const S=w.data.map(E=>{const B=JSON.parse(E?.info);return{key:E.key,type:E.type,...Object.fromEntries(B.map(P=>[P.locale,P.info]))}});d.total=w.totalCount,m.value=S}};e.onMounted(g);const i=()=>{p.value?.validate().then(async()=>{await g(f.keywords,1)})},s=C=>{const{current:b,total:w,pageSize:S}=C;d.current=b,d.total=w,d.pageSize=S,g()},h=()=>{a()},_=async(C,b)=>{const w=x.value.map(S=>({locale:S.dataIndex,info:C[S.dataIndex]}));c.value=!0;try{b?await _api.apaas.i18NInfo.putKey({key:C.id},{info:JSON.stringify(w)}):await _api.apaas.i18NInfo.post({info:JSON.stringify(w),key:C.id}),g(),V([C.id],[e.reactive(C)])}catch{c.value=!1}};function V(C,b){v.value.selectedRowKeys=C,y.value=b}const N=()=>{n.destroyCallback&&typeof n.destroyCallback=="function"&&n.destroyCallback()},$=async()=>{if(n.saveCallback&&typeof n.saveCallback=="function"){const C=v.value.selectedRowKeys,b={};if(C&&C[0]){const w=y.value?.[0];console.log("selectRow",w),Object.assign(b,{i18nKey:C[0]})}n.saveCallback(b)}l()};return(C,b)=>{const w=e.resolveComponent("a-input"),S=e.resolveComponent("a-form-item"),E=e.resolveComponent("a-col"),B=e.resolveComponent("a-button"),P=e.resolveComponent("plus-outlined"),q=e.resolveComponent("a-row"),U=e.resolveComponent("a-form"),H=e.resolveComponent("a-table"),J=e.resolveComponent("basic-modal");return e.openBlock(),e.createBlock(J,e.mergeProps(C.$attrs,{"min-height":40,title:e.unref(k.t)("sys.i18n.i18nConfig"),centered:"",width:"640px","can-fullscreen":!1,"mask-closable":!1,"after-close":N,"get-container":r,onRegister:e.unref(u),onOk:$}),{default:e.withCtx(()=>[e.createElementVNode("div",Q,[e.createVNode(U,{ref_key:"formRef",ref:p,model:f,autocomplete:"off",layout:"horizontal"},{default:e.withCtx(()=>[e.createVNode(q,null,{default:e.withCtx(()=>[e.createVNode(E,{span:12},{default:e.withCtx(()=>[e.createVNode(S,{name:"keywords",label:e.unref(k.t)("sys.keywords")},{default:e.withCtx(()=>[e.createVNode(w,{value:f.keywords,"onUpdate:value":b[0]||(b[0]=G=>f.keywords=G),placeholder:e.unref(k.t)("sys.keywordsPlaceholder"),style:{display:"inline-flex"}},null,8,["value","placeholder"])]),_:1},8,["label"])]),_:1}),e.createVNode(E,{span:12,style:{"text-align":"right"}},{default:e.withCtx(()=>[e.createVNode(B,{type:"primary",onClick:i},{icon:e.withCtx(()=>[e.createVNode(e.unref(Z.SearchOutlined))]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(k.t)("sys.queryText")),1)]),_:1}),e.createVNode(B,{style:{margin:"0 8px"},type:"primary",onClick:h},{icon:e.withCtx(()=>[e.createVNode(P)]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(k.t)("sys.new")),1)]),_:1})]),_:1})]),_:1})]),_:1},8,["model"]),e.createElementVNode("div",X,[e.createVNode(H,{ref:"tableRef","data-source":m.value,columns:x.value,"show-index-column":!1,pagination:d,striped:!1,bordered:!0,"row-selection":v.value,loading:c.value,onChange:s},null,8,["data-source","columns","pagination","row-selection","loading"]),e.createVNode(F,{lang:x.value,"get-container":r,onRegister:e.unref(o),onOk:_},null,8,["lang","onRegister"])])])]),_:1},16,["title","onRegister"])}}}),O=(t,u)=>{const l=t.__vccOpts||t;for(const[o,a]of u)l[o]=a;return l},ee=O(Y,[["__scopeId","data-v-0160ed5e"]]),te=e.defineComponent({__name:"i18n-select-modal",setup(t,{expose:u}){const[l,{openModal:o}]=R.useModal();return u({open:()=>{o()}}),(n,r)=>(e.openBlock(),e.createBlock(ee,{onRegister:e.unref(l)},null,8,["onRegister"]))}});function L(){let t=null,u=null;const l=e.ref("");function o(n){let r,p=document.body;if(I.has(n,"target")||I.has(n,"props")){const d=n;r=d.props||{},p=d.target||document.body}else r=n;l.value=r.i18nModalKey||`i18n-select-modal-${Math.random().toString(16).substring(8)}`;const f={...r,destroyCallback:()=>a(r?.destroyCallback),i18nModalKey:e.unref(l)};if(!t){const d=document.createElement("div");d.id=e.unref(l),e.unref(p)?.appendChild(d),t=e.createApp(te,f),u=t.mount(d)}u?.open()}function a(n){typeof n=="function"&&n(),document.querySelector(`#${e.unref(l)}`).remove(),t&&(t.unmount(),t=null)}return{open:o,close:a}}const ne={class:"i18n-tooltip-title"},oe={style:{"margin-left":"4px"}},ae=e.defineComponent({__name:"i18n-select-btn",props:{i18nValue:{},buttonExtraProps:{},size:{},i18nModalKey:{},simpleBtn:{type:Boolean},btnHeight:{},btnWidth:{}},emits:["on-select-i18n","closed"],setup(t,{emit:u}){const l=e.ref(),o=L(),a=t,n=u,r=e.reactive({}),p=e.computed(()=>!I.isEmpty(a.i18nValue)),f=async m=>{const y=await _api.apaas.i18NInfo.getPageList({pageNo:1,pageSize:20,searchKey:m});if(y&&y.data){const v=y.data.find(c=>c.key===a.i18nValue);v&&Object.assign(r,Object.fromEntries(Object.entries(JSON.parse(v.info)).map(([c,x])=>[x.locale,x.info])))}};e.watch(()=>a.i18nValue,()=>{I.isEmpty(a.i18nValue)||f(a.i18nValue)},{immediate:!0});const d=()=>{o.open({i18nModalKey:a.i18nModalKey,saveCallback:m=>{n("on-select-i18n",{...m})},destroyCallback:()=>{n("closed")}})};return(m,y)=>{const v=e.resolveComponent("Icon"),c=e.resolveComponent("a-button"),x=e.resolveComponent("a-tooltip");return t.simpleBtn?(e.openBlock(),e.createBlock(v,{key:0,class:e.normalizeClass(["i18n-icon simple-btn",{"is-highlight":p.value}]),icon:"ion:language",onClick:d},null,8,["class"])):p.value?(e.openBlock(),e.createBlock(x,{key:1,color:"#fff",placement:"topRight"},{title:e.withCtx(()=>[e.createElementVNode("div",ne,"语言标识:"+e.toDisplayString(t.i18nValue),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,g=>(e.openBlock(),e.createElementBlock("div",{key:g.id,class:"i18n-tooltip-item"},[e.createElementVNode("strong",null,e.toDisplayString(g.language)+": ",1),e.createElementVNode("span",oe,e.toDisplayString(r[g.languageTag]),1)]))),128))]),default:e.withCtx(()=>[e.createVNode(c,e.mergeProps(t.buttonExtraProps,{class:{"is-highlight":p.value},style:{"--btn-width":t.btnWidth,"--btn-height":t.btnHeight},size:t.size,onClick:d}),{icon:e.withCtx(()=>[e.createVNode(v,{class:"i18n-icon",icon:"ion:language"})]),_:1},16,["class","style","size"])]),_:1})):(e.openBlock(),e.createBlock(c,e.mergeProps({key:2},t.buttonExtraProps,{class:{"is-highlight":p.value},style:{"--btn-width":t.btnWidth,"--btn-height":t.btnHeight},size:t.size,onClick:d}),{icon:e.withCtx(()=>[e.createVNode(v,{class:"i18n-icon",icon:"ion:language"})]),_:1},16,["class","style","size"]))}}}),A=O(ae,[["__scopeId","data-v-dc8ffb2c"]]),le=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const ie=Object.prototype.toString,re=t=>ie.call(t)==="[object Object]",M=()=>{};function z(t){return Array.isArray(t)?t:[t]}function se(t,u,l){return e.watch(t,u,{...l,immediate:!0})}const j=le?window:void 0;function T(t){var u;const l=e.toValue(t);return(u=l?.$el)!==null&&u!==void 0?u:l}function K(...t){const u=(o,a,n,r)=>(o.addEventListener(a,n,r),()=>o.removeEventListener(a,n,r)),l=e.computed(()=>{const o=z(e.toValue(t[0])).filter(a=>a!=null);return o.every(a=>typeof a!="string")?o:void 0});return se(()=>{var o,a;return[(o=(a=l.value)===null||a===void 0?void 0:a.map(n=>T(n)))!==null&&o!==void 0?o:[j].filter(n=>n!=null),z(e.toValue(l.value?t[1]:t[0])),z(e.unref(l.value?t[2]:t[1])),e.toValue(l.value?t[3]:t[2])]},([o,a,n,r],p,f)=>{if(!o?.length||!a?.length||!n?.length)return;const d=re(r)?{...r}:r,m=o.flatMap(y=>a.flatMap(v=>n.map(c=>u(y,v,c,d))));f(()=>{m.forEach(y=>y())})},{flush:"post"})}function ce(t,u,l={}){const{window:o=j,ignore:a=[],capture:n=!0,detectIframe:r=!1,controls:p=!1}=l;if(!o)return p?{stop:M,cancel:M,trigger:M}:M;let f=!0;const d=i=>e.toValue(a).some(s=>{if(typeof s=="string")return Array.from(o.document.querySelectorAll(s)).some(h=>h===i.target||i.composedPath().includes(h));{const h=T(s);return h&&(i.target===h||i.composedPath().includes(h))}});function m(i){const s=e.toValue(i);return s&&s.$.subTree.shapeFlag===16}function y(i,s){const h=e.toValue(i),_=h.$.subTree&&h.$.subTree.children;return _==null||!Array.isArray(_)?!1:_.some(V=>V.el===s.target||s.composedPath().includes(V.el))}const v=i=>{const s=T(t);if(i.target!=null&&!(!(s instanceof Element)&&m(t)&&y(t,i))&&!(!s||s===i.target||i.composedPath().includes(s))){if("detail"in i&&i.detail===0&&(f=!d(i)),!f){f=!0;return}u(i)}};let c=!1;const x=[K(o,"click",i=>{c||(c=!0,setTimeout(()=>{c=!1},0),v(i))},{passive:!0,capture:n}),K(o,"pointerdown",i=>{const s=T(t);f=!d(i)&&!!(s&&!i.composedPath().includes(s))},{passive:!0}),r&&K(o,"blur",i=>{setTimeout(()=>{var s;const h=T(t);((s=o.document.activeElement)===null||s===void 0?void 0:s.tagName)==="IFRAME"&&!h?.contains(o.document.activeElement)&&u(i)},0)},{passive:!0})].filter(Boolean),g=()=>x.forEach(i=>i());return p?{stop:g,cancel:()=>{f=!1},trigger:i=>{f=!0,v(i),f=!1}}:g}const ue=e.defineComponent({__name:"i18n-select-input",props:{attr:{},inputExtraProps:{},i18nConfig:{},i18nText:{},placeholderText:{},size:{},i18nModalKey:{},forceUpdate:{type:Boolean},btnHeight:{},btnWidth:{}},emits:["update:i18nText","update:i18nConfig","on-i18n-select","clickOutside","focus","blur"],setup(t,{emit:u}){const l=e.computed(()=>!!_gct.store.appInfo.id),o=t,a=u,n=e.computed({get(){return o.i18nText??""},set(c){c!==o.i18nText&&a("update:i18nText",c)}}),r=e.computed(()=>I.isEmpty(o.i18nConfig)?{}:typeof o.i18nConfig=="string"?JSON.parse(o.i18nConfig)??{}:o.i18nConfig??{}),p=e.computed(()=>r.value?.[o.attr]),f=c=>{console.log("emit",c),c&&((I.isEmpty(n.value)||o.forceUpdate===!0)&&a("update:i18nText",c.i18nTitle),a("update:i18nConfig",JSON.stringify(I.isEmpty(c)?I.omit(r.value,o.attr):{...r.value,[o.attr]:c.i18nKey})),a("on-i18n-select",c))},d=e.ref(),m=()=>{a("focus",d.value)},y=()=>{a("blur",d.value)},v=e.ref();return ce(v,()=>{a("clickOutside")}),(c,x)=>{const g=e.resolveComponent("a-input"),i=e.resolveComponent("a-input-group");return e.openBlock(),e.createBlock(i,{id:"i18nInputGroup",ref_key:"i18nInputGroup",ref:v,compact:""},{default:e.withCtx(()=>[e.renderSlot(c.$slots,"i18n-input",{},()=>[e.createVNode(g,e.mergeProps({ref_key:"inputRef",ref:d},t.inputExtraProps,{value:n.value,"onUpdate:value":x[0]||(x[0]=s=>n.value=s),valueModifiers:{trim:!0},style:{height:t.btnHeight?t.btnHeight:t.size===e.unref(k.ButtonSize).SMALL?"26px":"32px",width:l.value?`calc(100% - ${t.btnWidth?t.btnWidth:t.size===e.unref(k.ButtonSize).SMALL?"26px":"32px"}`:"100%"},placeholder:t.placeholderText,size:t.size,"allow-clear":"",onFocus:m,onBlur:y}),null,16,["value","style","placeholder","size"])],!0),l.value?(e.openBlock(),e.createBlock(A,{key:0,"btn-height":t.btnHeight,"btn-width":t.btnWidth,"i18n-value":p.value,size:t.size,"i18n-modal-key":t.i18nModalKey,onOnSelectI18n:f,onClosed:x[1]||(x[1]=s=>a("clickOutside"))},null,8,["btn-height","btn-width","i18n-value","size","i18n-modal-key"])):e.createCommentVNode("",!0)]),_:3},512)}}}),D=O(ue,[["__scopeId","data-v-412e1309"]]),de=e.defineComponent({__name:"i18n-select-input-form",props:{formItemName:{},fromItemExtraProps:{},inputExtraProps:{},i18nConfig:{},text:{},formRef:{}},emits:["update:text"],setup(t,{emit:u}){const l=t,o=u,a=e.computed({get(){return l.text??""},set(n){o("update:text",n),l.formRef?.validateFields([l.formItemName])}});return(n,r)=>{const p=e.resolveComponent("a-form-item");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(p,e.mergeProps({name:t.formItemName},t.fromItemExtraProps),{default:e.withCtx(()=>[e.createVNode(D,e.mergeProps(n.$attrs,{"i18n-text":a.value,"onUpdate:i18nText":r[0]||(r[0]=f=>a.value=f),"input-extra-props":t.inputExtraProps,"i18n-config":t.i18nConfig,attr:Array.isArray(t.formItemName)?t.formItemName.join("."):t.formItemName,"placeholder-text":n.$t("sys.inputText")}),null,16,["i18n-text","input-extra-props","i18n-config","attr","placeholder-text"])]),_:1},16,["name"]),e.createVNode(p,{name:"i18nConfig",hidden:""},{default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(t.i18nConfig),1)]),_:1})],64)}}}),fe={class:"inline-block w100% relative"},pe=e.defineComponent({__name:"i18n-select-textarea",props:{attr:{},inputExtraProps:{},i18nConfig:{},i18nText:{},placeholderText:{},rows:{},style:{}},emits:["update:i18nText","update:i18nConfig","on-i18n-select","clickOutside","focus"],setup(t,{emit:u}){const l=t,o=u,a=e.computed({get(){return l.i18nText??""},set(m){o("update:i18nText",m)}}),n=e.computed(()=>I.isEmpty(l.i18nConfig)?{}:typeof l.i18nConfig=="string"?JSON.parse(l.i18nConfig)??{}:l.i18nConfig??{}),r=e.computed(()=>n.value?.[l.attr]),p=m=>{m&&(I.isEmpty(a.value)&&o("update:i18nText",m.i18nTitle),o("update:i18nConfig",JSON.stringify(I.isEmpty(m)?I.omit(n.value,l.attr):{...n.value,[l.attr]:m.i18nKey})),o("on-i18n-select",m))},f=e.ref(),d=()=>{o("focus",f.value)};return(m,y)=>{const v=e.resolveComponent("a-textarea");return e.openBlock(),e.createElementBlock("div",fe,[e.createVNode(v,e.mergeProps({ref_key:"inputRef",ref:f,value:a.value,"onUpdate:value":y[0]||(y[0]=c=>a.value=c),placeholder:t.placeholderText},t.inputExtraProps,{style:{resize:"none",...t.style},onFocus:d}),null,16,["value","placeholder","style"]),e.createVNode(A,{"i18n-value":r.value,"simple-btn":!0,type:"text",onOnSelectI18n:p,onClosed:y[1]||(y[1]=c=>o("clickOutside"))},null,8,["i18n-value"])])}}}),W=O(pe,[["__scopeId","data-v-cd95c416"]]),me=e.defineComponent({__name:"i18n-select-textarea-form",props:{formItemName:{},fromItemExtraProps:{},inputExtraProps:{},i18nConfig:{},text:{},formRef:{}},emits:["update:text"],setup(t,{emit:u}){const l=t,o=u,a=e.computed({get(){return l.text??""},set(n){o("update:text",n),l.formRef?.validateFields([l.formItemName])}});return(n,r)=>{const p=e.resolveComponent("a-form-item");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(p,e.mergeProps({name:t.formItemName},t.fromItemExtraProps),{default:e.withCtx(()=>[e.createVNode(W,e.mergeProps(n.$attrs,{"i18n-text":a.value,"onUpdate:i18nText":r[0]||(r[0]=f=>a.value=f),"placeholder-text":n.$t("sys.inputText"),"input-extra-props":t.inputExtraProps,"i18n-config":t.i18nConfig,attr:Array.isArray(t.formItemName)?t.formItemName.join("."):t.formItemName}),null,16,["i18n-text","placeholder-text","input-extra-props","i18n-config","attr"])]),_:1},16,["name"]),e.createVNode(p,{name:"i18nConfig",hidden:""},{default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(t.i18nConfig),1)]),_:1})],64)}}}),ge={install(t){console.log("Design Web install",t)}};exports.I18Modal=F;exports.I18nSelectBtn=A;exports.I18nSelectInput=D;exports.I18nSelectInputForm=de;exports.I18nSelectTextarea=W;exports.I18nSelectTextareaForm=me;exports.default=ge;exports.useI18nSelect=L;
@@ -1 +0,0 @@
1
- System.register(["vue","lodash-es","@gct-paas/core-web","@ant-design/icons-vue","@gct-paas/core"],(function(K,Be){"use strict";var z,T,U,b,S,N,$,h,v,f,L,H,X,ce,E,ue,A,Y,B,de,ee,fe,F,pe,me,te,P,ne,oe,ae,ge,w,ie;return{setters:[l=>{z=l.defineComponent,T=l.ref,U=l.reactive,b=l.resolveComponent,S=l.openBlock,N=l.createBlock,$=l.mergeProps,h=l.unref,v=l.withCtx,f=l.createVNode,L=l.createElementBlock,H=l.Fragment,X=l.renderList,ce=l.toRaw,E=l.computed,ue=l.onMounted,A=l.createElementVNode,Y=l.createTextVNode,B=l.toDisplayString,de=l.createApp,ee=l.watch,fe=l.normalizeClass,F=l.toValue,pe=l.renderSlot,me=l.createCommentVNode},l=>{te=l.has,P=l.isEmpty,ne=l.omit},l=>{oe=l.useModalInner,ae=l.useModal},l=>{ge=l.SearchOutlined},l=>{w=l.t,ie=l.ButtonSize}],execute:(function(){K("useI18nSelect",ye);const l=K("I18Modal",z({__name:"i18n-modal",props:{lang:{},getContainer:{type:Function}},emits:["ok","register"],setup(e,{emit:u}){const a=e,n=u,o=T(),t=U({id:""}),s=T(!1),m=y=>{y&&(s.value=!1)},[p,{closeModal:d}]=oe(y=>{y&&g(y)}),g=y=>{s.value=!0,t.id=y.key;const{lang:i}=a;console.log(i,"lang========");for(const r of i){const I=r.dataIndex;t[I]=y[I]}},x=(y,i,r)=>{/^[a-zA-Z_.]*$/.test(i)||r(w("sys.i18n.validated18nKeyErrorMsg")),r()},C=async(y,i)=>/^\s*$/g.test(i)?Promise.reject(w("sys.notEmptySth",{sth:w("sys.i18n")})):Promise.resolve(),c=()=>{o.value?.validate().then(()=>{n("ok",{...ce(t)},s.value),d()})},_=()=>{o.value?.resetFields()};return(y,i)=>{const r=b("a-input"),I=b("a-form-item"),j=b("a-form"),W=b("BasicModal");return S(),N(W,$(y.$attrs,{title:s.value?h(w)("sys.edit"):h(w)("sys.new"),centered:"",width:"640px","min-height":100,"mask-closable":!1,"after-close":_,"get-container":e.getContainer,onRegister:h(p),onOk:c,onVisibleChange:m}),{default:v(()=>[f(j,{ref_key:"formRef",ref:o,model:t,"label-col":{span:6},"wrapper-col":{span:16},autocomplete:"off",layout:"horizontal"},{default:v(()=>[f(I,{label:h(w)("sys.i18n.resourceIdentification"),name:"id",rules:[{required:!0,message:h(w)("sys.pleaseInputSth",{sth:h(w)("sys.i18n.resourceIdentification")})},{validator:x}]},{default:v(()=>[f(r,{value:t.id,"onUpdate:value":i[0]||(i[0]=O=>t.id=O),"show-count":"",maxlength:128,disabled:s.value},null,8,["value","disabled"])]),_:1},8,["label","rules"]),(S(!0),L(H,null,X(a.lang,O=>(S(),N(I,{key:O.dataIndex,label:O.title,name:O.dataIndex,rules:[{required:!0,message:h(w)("sys.pleaseInputSth",{sth:O.title})},{validator:C}]},{default:v(()=>[f(r,{value:t[O.dataIndex],"onUpdate:value":re=>t[O.dataIndex]=re,"show-count":"",maxlength:300},null,8,["value","onUpdate:value"])]),_:2},1032,["label","name","rules"]))),128))]),_:1},8,["model"])]),_:1},16,["title","get-container","onRegister"])}}})),be={class:"i18n-select-container"},xe={class:"table-wrap"},Ce=z({__name:"i18n-select-container",props:{i18nModalKey:{},destroyCallback:{type:Function},saveCallback:{type:Function}},setup(e){const[u,{closeModal:a}]=oe(),[n,{openModal:o}]=ae(),t=e,s=()=>document.querySelector(`#${t.i18nModalKey}`),m=T(),p=U({keywords:""}),d=U({current:1,pageSize:5,total:0,size:"small",showTotal:k=>w("sys.component.table.total",{total:k})}),g=T([]),x=T(),C=T({type:"radio",hideSelectAll:!0,selectedRowKeys:[],onChange:W}),c=T(!1),_=E(()=>[]),y=async(k,R)=>{c.value=!0;const M=await _api.apaas.i18NInfo.getPageList({pageNo:R??d.current,pageSize:d.pageSize,searchKey:k});if(c.value=!1,M&&M.data){const V=M.data.map(D=>{const Z=JSON.parse(D?.info);return{key:D.key,type:D.type,...Object.fromEntries(Z.map(Q=>[Q.locale,Q.info]))}});d.total=M.totalCount,g.value=V}};ue(y);const i=()=>{m.value?.validate().then(async()=>{await y(p.keywords,1)})},r=k=>{const{current:R,total:M,pageSize:V}=k;d.current=R,d.total=M,d.pageSize=V,y()},I=()=>{o()},j=async(k,R)=>{const M=_.value.map(V=>({locale:V.dataIndex,info:k[V.dataIndex]}));c.value=!0;try{R?await _api.apaas.i18NInfo.putKey({key:k.id},{info:JSON.stringify(M)}):await _api.apaas.i18NInfo.post({info:JSON.stringify(M),key:k.id}),y(),W([k.id],[U(k)])}catch{c.value=!1}};function W(k,R){C.value.selectedRowKeys=k,x.value=R}const O=()=>{t.destroyCallback&&typeof t.destroyCallback=="function"&&t.destroyCallback()},re=async()=>{if(t.saveCallback&&typeof t.saveCallback=="function"){const k=C.value.selectedRowKeys,R={};if(k&&k[0]){const M=x.value?.[0];console.log("selectRow",M),Object.assign(R,{i18nKey:k[0]})}t.saveCallback(R)}a()};return(k,R)=>{const M=b("a-input"),V=b("a-form-item"),D=b("a-col"),Z=b("a-button"),Q=b("plus-outlined"),ze=b("a-row"),Pe=b("a-form"),Ve=b("a-table"),Ke=b("basic-modal");return S(),N(Ke,$(k.$attrs,{"min-height":40,title:h(w)("sys.i18n.i18nConfig"),centered:"",width:"640px","can-fullscreen":!1,"mask-closable":!1,"after-close":O,"get-container":s,onRegister:h(u),onOk:re}),{default:v(()=>[A("div",be,[f(Pe,{ref_key:"formRef",ref:m,model:p,autocomplete:"off",layout:"horizontal"},{default:v(()=>[f(ze,null,{default:v(()=>[f(D,{span:12},{default:v(()=>[f(V,{name:"keywords",label:h(w)("sys.keywords")},{default:v(()=>[f(M,{value:p.keywords,"onUpdate:value":R[0]||(R[0]=Ae=>p.keywords=Ae),placeholder:h(w)("sys.keywordsPlaceholder"),style:{display:"inline-flex"}},null,8,["value","placeholder"])]),_:1},8,["label"])]),_:1}),f(D,{span:12,style:{"text-align":"right"}},{default:v(()=>[f(Z,{type:"primary",onClick:i},{icon:v(()=>[f(h(ge))]),default:v(()=>[Y(" "+B(h(w)("sys.queryText")),1)]),_:1}),f(Z,{style:{margin:"0 8px"},type:"primary",onClick:I},{icon:v(()=>[f(Q)]),default:v(()=>[Y(" "+B(h(w)("sys.new")),1)]),_:1})]),_:1})]),_:1})]),_:1},8,["model"]),A("div",xe,[f(Ve,{ref:"tableRef","data-source":g.value,columns:_.value,"show-index-column":!1,pagination:d,striped:!1,bordered:!0,"row-selection":C.value,loading:c.value,onChange:r},null,8,["data-source","columns","pagination","row-selection","loading"]),f(l,{lang:_.value,"get-container":s,onRegister:h(n),onOk:j},null,8,["lang","onRegister"])])])]),_:1},16,["title","onRegister"])}}}),q=(e,u)=>{const a=e.__vccOpts||e;for(const[n,o]of u)a[n]=o;return a},Ie=q(Ce,[["__scopeId","data-v-0160ed5e"]]),ke=z({__name:"i18n-select-modal",setup(e,{expose:u}){const[a,{openModal:n}]=ae();return u({open:()=>{n()}}),(t,s)=>(S(),N(Ie,{onRegister:h(a)},null,8,["onRegister"]))}});function ye(){let e=null,u=null;const a=T("");function n(t){let s,m=document.body;if(te(t,"target")||te(t,"props")){const d=t;s=d.props||{},m=d.target||document.body}else s=t;a.value=s.i18nModalKey||`i18n-select-modal-${Math.random().toString(16).substring(8)}`;const p={...s,destroyCallback:()=>o(s?.destroyCallback),i18nModalKey:h(a)};if(!e){const d=document.createElement("div");d.id=h(a),h(m)?.appendChild(d),e=de(ke,p),u=e.mount(d)}u?.open()}function o(t){typeof t=="function"&&t(),document.querySelector(`#${h(a)}`).remove(),e&&(e.unmount(),e=null)}return{open:n,close:o}}const _e={class:"i18n-tooltip-title"},Se={style:{"margin-left":"4px"}},he=K("I18nSelectBtn",q(z({__name:"i18n-select-btn",props:{i18nValue:{},buttonExtraProps:{},size:{},i18nModalKey:{},simpleBtn:{type:Boolean},btnHeight:{},btnWidth:{}},emits:["on-select-i18n","closed"],setup(e,{emit:u}){const a=T(),n=ye(),o=e,t=u,s=U({}),m=E(()=>!P(o.i18nValue)),p=async g=>{const x=await _api.apaas.i18NInfo.getPageList({pageNo:1,pageSize:20,searchKey:g});if(x&&x.data){const C=x.data.find(c=>c.key===o.i18nValue);C&&Object.assign(s,Object.fromEntries(Object.entries(JSON.parse(C.info)).map(([c,_])=>[_.locale,_.info])))}};ee(()=>o.i18nValue,()=>{P(o.i18nValue)||p(o.i18nValue)},{immediate:!0});const d=()=>{n.open({i18nModalKey:o.i18nModalKey,saveCallback:g=>{t("on-select-i18n",{...g})},destroyCallback:()=>{t("closed")}})};return(g,x)=>{const C=b("Icon"),c=b("a-button"),_=b("a-tooltip");return e.simpleBtn?(S(),N(C,{key:0,class:fe(["i18n-icon simple-btn",{"is-highlight":m.value}]),icon:"ion:language",onClick:d},null,8,["class"])):m.value?(S(),N(_,{key:1,color:"#fff",placement:"topRight"},{title:v(()=>[A("div",_e,"语言标识:"+B(e.i18nValue),1),(S(!0),L(H,null,X(a.value,y=>(S(),L("div",{key:y.id,class:"i18n-tooltip-item"},[A("strong",null,B(y.language)+": ",1),A("span",Se,B(s[y.languageTag]),1)]))),128))]),default:v(()=>[f(c,$(e.buttonExtraProps,{class:{"is-highlight":m.value},style:{"--btn-width":e.btnWidth,"--btn-height":e.btnHeight},size:e.size,onClick:d}),{icon:v(()=>[f(C,{class:"i18n-icon",icon:"ion:language"})]),_:1},16,["class","style","size"])]),_:1})):(S(),N(c,$({key:2},e.buttonExtraProps,{class:{"is-highlight":m.value},style:{"--btn-width":e.btnWidth,"--btn-height":e.btnHeight},size:e.size,onClick:d}),{icon:v(()=>[f(C,{class:"i18n-icon",icon:"ion:language"})]),_:1},16,["class","style","size"]))}}}),[["__scopeId","data-v-dc8ffb2c"]])),we=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Te=Object.prototype.toString,Ee=e=>Te.call(e)==="[object Object]",G=()=>{};function le(e){return Array.isArray(e)?e:[e]}function Re(e,u,a){return ee(e,u,{...a,immediate:!0})}const ve=we?window:void 0;function J(e){var u;const a=F(e);return(u=a?.$el)!==null&&u!==void 0?u:a}function se(...e){const u=(n,o,t,s)=>(n.addEventListener(o,t,s),()=>n.removeEventListener(o,t,s)),a=E(()=>{const n=le(F(e[0])).filter(o=>o!=null);return n.every(o=>typeof o!="string")?n:void 0});return Re(()=>{var n,o;return[(n=(o=a.value)===null||o===void 0?void 0:o.map(t=>J(t)))!==null&&n!==void 0?n:[ve].filter(t=>t!=null),le(F(a.value?e[1]:e[0])),le(h(a.value?e[2]:e[1])),F(a.value?e[3]:e[2])]},([n,o,t,s],m,p)=>{if(!n?.length||!o?.length||!t?.length)return;const d=Ee(s)?{...s}:s,g=n.flatMap(x=>o.flatMap(C=>t.map(c=>u(x,C,c,d))));p(()=>{g.forEach(x=>x())})},{flush:"post"})}function Me(e,u,a={}){const{window:n=ve,ignore:o=[],capture:t=!0,detectIframe:s=!1,controls:m=!1}=a;if(!n)return m?{stop:G,cancel:G,trigger:G}:G;let p=!0;const d=i=>F(o).some(r=>{if(typeof r=="string")return Array.from(n.document.querySelectorAll(r)).some(I=>I===i.target||i.composedPath().includes(I));{const I=J(r);return I&&(i.target===I||i.composedPath().includes(I))}});function g(i){const r=F(i);return r&&r.$.subTree.shapeFlag===16}function x(i,r){const I=F(i),j=I.$.subTree&&I.$.subTree.children;return j==null||!Array.isArray(j)?!1:j.some(W=>W.el===r.target||r.composedPath().includes(W.el))}const C=i=>{const r=J(e);if(i.target!=null&&!(!(r instanceof Element)&&g(e)&&x(e,i))&&!(!r||r===i.target||i.composedPath().includes(r))){if("detail"in i&&i.detail===0&&(p=!d(i)),!p){p=!0;return}u(i)}};let c=!1;const _=[se(n,"click",i=>{c||(c=!0,setTimeout(()=>{c=!1},0),C(i))},{passive:!0,capture:t}),se(n,"pointerdown",i=>{const r=J(e);p=!d(i)&&!!(r&&!i.composedPath().includes(r))},{passive:!0}),s&&se(n,"blur",i=>{setTimeout(()=>{var r;const I=J(e);((r=n.document.activeElement)===null||r===void 0?void 0:r.tagName)==="IFRAME"&&!I?.contains(n.document.activeElement)&&u(i)},0)},{passive:!0})].filter(Boolean),y=()=>_.forEach(i=>i());return m?{stop:y,cancel:()=>{p=!1},trigger:i=>{p=!0,C(i),p=!1}}:y}const $e=K("I18nSelectInput",q(z({__name:"i18n-select-input",props:{attr:{},inputExtraProps:{},i18nConfig:{},i18nText:{},placeholderText:{},size:{},i18nModalKey:{},forceUpdate:{type:Boolean},btnHeight:{},btnWidth:{}},emits:["update:i18nText","update:i18nConfig","on-i18n-select","clickOutside","focus","blur"],setup(e,{emit:u}){const a=E(()=>!!_gct.store.appInfo.id),n=e,o=u,t=E({get(){return n.i18nText??""},set(c){c!==n.i18nText&&o("update:i18nText",c)}}),s=E(()=>P(n.i18nConfig)?{}:typeof n.i18nConfig=="string"?JSON.parse(n.i18nConfig)??{}:n.i18nConfig??{}),m=E(()=>s.value?.[n.attr]),p=c=>{console.log("emit",c),c&&((P(t.value)||n.forceUpdate===!0)&&o("update:i18nText",c.i18nTitle),o("update:i18nConfig",JSON.stringify(P(c)?ne(s.value,n.attr):{...s.value,[n.attr]:c.i18nKey})),o("on-i18n-select",c))},d=T(),g=()=>{o("focus",d.value)},x=()=>{o("blur",d.value)},C=T();return Me(C,()=>{o("clickOutside")}),(c,_)=>{const y=b("a-input"),i=b("a-input-group");return S(),N(i,{id:"i18nInputGroup",ref_key:"i18nInputGroup",ref:C,compact:""},{default:v(()=>[pe(c.$slots,"i18n-input",{},()=>[f(y,$({ref_key:"inputRef",ref:d},e.inputExtraProps,{value:t.value,"onUpdate:value":_[0]||(_[0]=r=>t.value=r),valueModifiers:{trim:!0},style:{height:e.btnHeight?e.btnHeight:e.size===h(ie).SMALL?"26px":"32px",width:a.value?`calc(100% - ${e.btnWidth?e.btnWidth:e.size===h(ie).SMALL?"26px":"32px"}`:"100%"},placeholder:e.placeholderText,size:e.size,"allow-clear":"",onFocus:g,onBlur:x}),null,16,["value","style","placeholder","size"])],!0),a.value?(S(),N(he,{key:0,"btn-height":e.btnHeight,"btn-width":e.btnWidth,"i18n-value":m.value,size:e.size,"i18n-modal-key":e.i18nModalKey,onOnSelectI18n:p,onClosed:_[1]||(_[1]=r=>o("clickOutside"))},null,8,["btn-height","btn-width","i18n-value","size","i18n-modal-key"])):me("",!0)]),_:3},512)}}}),[["__scopeId","data-v-412e1309"]])),je=K("I18nSelectInputForm",z({__name:"i18n-select-input-form",props:{formItemName:{},fromItemExtraProps:{},inputExtraProps:{},i18nConfig:{},text:{},formRef:{}},emits:["update:text"],setup(e,{emit:u}){const a=e,n=u,o=E({get(){return a.text??""},set(t){n("update:text",t),a.formRef?.validateFields([a.formItemName])}});return(t,s)=>{const m=b("a-form-item");return S(),L(H,null,[f(m,$({name:e.formItemName},e.fromItemExtraProps),{default:v(()=>[f($e,$(t.$attrs,{"i18n-text":o.value,"onUpdate:i18nText":s[0]||(s[0]=p=>o.value=p),"input-extra-props":e.inputExtraProps,"i18n-config":e.i18nConfig,attr:Array.isArray(e.formItemName)?e.formItemName.join("."):e.formItemName,"placeholder-text":t.$t("sys.inputText")}),null,16,["i18n-text","input-extra-props","i18n-config","attr","placeholder-text"])]),_:1},16,["name"]),f(m,{name:"i18nConfig",hidden:""},{default:v(()=>[A("span",null,B(e.i18nConfig),1)]),_:1})],64)}}})),Ne={class:"inline-block w100% relative"},Oe=K("I18nSelectTextarea",q(z({__name:"i18n-select-textarea",props:{attr:{},inputExtraProps:{},i18nConfig:{},i18nText:{},placeholderText:{},rows:{},style:{}},emits:["update:i18nText","update:i18nConfig","on-i18n-select","clickOutside","focus"],setup(e,{emit:u}){const a=e,n=u,o=E({get(){return a.i18nText??""},set(g){n("update:i18nText",g)}}),t=E(()=>P(a.i18nConfig)?{}:typeof a.i18nConfig=="string"?JSON.parse(a.i18nConfig)??{}:a.i18nConfig??{}),s=E(()=>t.value?.[a.attr]),m=g=>{g&&(P(o.value)&&n("update:i18nText",g.i18nTitle),n("update:i18nConfig",JSON.stringify(P(g)?ne(t.value,a.attr):{...t.value,[a.attr]:g.i18nKey})),n("on-i18n-select",g))},p=T(),d=()=>{n("focus",p.value)};return(g,x)=>{const C=b("a-textarea");return S(),L("div",Ne,[f(C,$({ref_key:"inputRef",ref:p,value:o.value,"onUpdate:value":x[0]||(x[0]=c=>o.value=c),placeholder:e.placeholderText},e.inputExtraProps,{style:{resize:"none",...e.style},onFocus:d}),null,16,["value","placeholder","style"]),f(he,{"i18n-value":s.value,"simple-btn":!0,type:"text",onOnSelectI18n:m,onClosed:x[1]||(x[1]=c=>n("clickOutside"))},null,8,["i18n-value"])])}}}),[["__scopeId","data-v-cd95c416"]])),Ue=K("I18nSelectTextareaForm",z({__name:"i18n-select-textarea-form",props:{formItemName:{},fromItemExtraProps:{},inputExtraProps:{},i18nConfig:{},text:{},formRef:{}},emits:["update:text"],setup(e,{emit:u}){const a=e,n=u,o=E({get(){return a.text??""},set(t){n("update:text",t),a.formRef?.validateFields([a.formItemName])}});return(t,s)=>{const m=b("a-form-item");return S(),L(H,null,[f(m,$({name:e.formItemName},e.fromItemExtraProps),{default:v(()=>[f(Oe,$(t.$attrs,{"i18n-text":o.value,"onUpdate:i18nText":s[0]||(s[0]=p=>o.value=p),"placeholder-text":t.$t("sys.inputText"),"input-extra-props":e.inputExtraProps,"i18n-config":e.i18nConfig,attr:Array.isArray(e.formItemName)?e.formItemName.join("."):e.formItemName}),null,16,["i18n-text","placeholder-text","input-extra-props","i18n-config","attr"])]),_:1},16,["name"]),f(m,{name:"i18nConfig",hidden:""},{default:v(()=>[A("span",null,B(e.i18nConfig),1)]),_:1})],64)}}})),De=K("default",{install(e){console.log("Design Web install",e)}})})}}));
@@ -1,5 +0,0 @@
1
- import _sfc_main from './i18n-modal.vue.mjs';
2
-
3
-
4
-
5
- export { _sfc_main as default };
@@ -1,138 +0,0 @@
1
- import { defineComponent, ref, reactive, computed, watch, resolveComponent, openBlock, createBlock, normalizeClass, withCtx, createVNode, mergeProps, createElementVNode, toDisplayString, createElementBlock, Fragment, renderList } from 'vue';
2
- import { isEmpty } from 'lodash-es';
3
- import { useI18nSelect } from './useI18nSelect.mjs';
4
-
5
- const _hoisted_1 = { class: "i18n-tooltip-title" };
6
- const _hoisted_2 = { style: { "margin-left": "4px" } };
7
- const _sfc_main = /* @__PURE__ */ defineComponent({
8
- __name: "i18n-select-btn",
9
- props: {
10
- i18nValue: {},
11
- buttonExtraProps: {},
12
- size: {},
13
- i18nModalKey: {},
14
- simpleBtn: { type: Boolean },
15
- btnHeight: {},
16
- btnWidth: {}
17
- },
18
- emits: ["on-select-i18n", "closed"],
19
- setup(__props, { emit: __emit }) {
20
- const getEnableLocaleList = ref();
21
- const i18nInstance = useI18nSelect();
22
- const props = __props;
23
- const emit = __emit;
24
- const i18nMap = reactive({});
25
- const isHighlight = computed(() => {
26
- return !isEmpty(props.i18nValue);
27
- });
28
- const getTableData = async (keyword) => {
29
- const result = await _api.apaas.i18NInfo.getPageList({
30
- pageNo: 1,
31
- pageSize: 20,
32
- searchKey: keyword
33
- });
34
- if (result && result.data) {
35
- const row = result.data.find((item) => item.key === props.i18nValue);
36
- if (row) {
37
- Object.assign(
38
- i18nMap,
39
- Object.fromEntries(
40
- Object.entries(JSON.parse(row.info)).map(([_, item]) => [
41
- item.locale,
42
- item.info
43
- ])
44
- )
45
- );
46
- }
47
- }
48
- };
49
- watch(
50
- () => props.i18nValue,
51
- () => {
52
- if (!isEmpty(props.i18nValue)) {
53
- getTableData(props.i18nValue);
54
- }
55
- },
56
- {
57
- immediate: true
58
- }
59
- );
60
- const handleOpenI18nSelectModal = () => {
61
- i18nInstance.open({
62
- i18nModalKey: props.i18nModalKey,
63
- saveCallback: (params) => {
64
- emit("on-select-i18n", { ...params });
65
- },
66
- destroyCallback: () => {
67
- emit("closed");
68
- }
69
- });
70
- };
71
- return (_ctx, _cache) => {
72
- const _component_Icon = resolveComponent("Icon");
73
- const _component_a_button = resolveComponent("a-button");
74
- const _component_a_tooltip = resolveComponent("a-tooltip");
75
- return __props.simpleBtn ? (openBlock(), createBlock(_component_Icon, {
76
- key: 0,
77
- class: normalizeClass(["i18n-icon simple-btn", { "is-highlight": isHighlight.value }]),
78
- icon: "ion:language",
79
- onClick: handleOpenI18nSelectModal
80
- }, null, 8, ["class"])) : isHighlight.value ? (openBlock(), createBlock(_component_a_tooltip, {
81
- key: 1,
82
- color: "#fff",
83
- placement: "topRight"
84
- }, {
85
- title: withCtx(() => [
86
- createElementVNode("div", _hoisted_1, "语言标识:" + toDisplayString(__props.i18nValue), 1),
87
- (openBlock(true), createElementBlock(Fragment, null, renderList(getEnableLocaleList.value, (item) => {
88
- return openBlock(), createElementBlock("div", {
89
- key: item.id,
90
- class: "i18n-tooltip-item"
91
- }, [
92
- createElementVNode("strong", null, toDisplayString(item.language) + ": ", 1),
93
- createElementVNode("span", _hoisted_2, toDisplayString(i18nMap[item.languageTag]), 1)
94
- ]);
95
- }), 128))
96
- ]),
97
- default: withCtx(() => [
98
- createVNode(_component_a_button, mergeProps(__props.buttonExtraProps, {
99
- class: { "is-highlight": isHighlight.value },
100
- style: {
101
- "--btn-width": __props.btnWidth,
102
- "--btn-height": __props.btnHeight
103
- },
104
- size: __props.size,
105
- onClick: handleOpenI18nSelectModal
106
- }), {
107
- icon: withCtx(() => [
108
- createVNode(_component_Icon, {
109
- class: "i18n-icon",
110
- icon: "ion:language"
111
- })
112
- ]),
113
- _: 1
114
- }, 16, ["class", "style", "size"])
115
- ]),
116
- _: 1
117
- })) : (openBlock(), createBlock(_component_a_button, mergeProps({ key: 2 }, __props.buttonExtraProps, {
118
- class: { "is-highlight": isHighlight.value },
119
- style: {
120
- "--btn-width": __props.btnWidth,
121
- "--btn-height": __props.btnHeight
122
- },
123
- size: __props.size,
124
- onClick: handleOpenI18nSelectModal
125
- }), {
126
- icon: withCtx(() => [
127
- createVNode(_component_Icon, {
128
- class: "i18n-icon",
129
- icon: "ion:language"
130
- })
131
- ]),
132
- _: 1
133
- }, 16, ["class", "style", "size"]));
134
- };
135
- }
136
- });
137
-
138
- export { _sfc_main as default };
@@ -1,250 +0,0 @@
1
- import { defineComponent, ref, reactive, computed, onMounted, resolveComponent, openBlock, createBlock, mergeProps, unref, withCtx, createElementVNode, createVNode, createTextVNode, toDisplayString } from 'vue';
2
- import { SearchOutlined } from '@ant-design/icons-vue';
3
- import _sfc_main$1 from './i18n-modal.vue.mjs';
4
- import { t } from '@gct-paas/core';
5
- import { useModalInner, useModal } from '@gct-paas/core-web';
6
-
7
- const _hoisted_1 = { class: "i18n-select-container" };
8
- const _hoisted_2 = { class: "table-wrap" };
9
- const _sfc_main = /* @__PURE__ */ defineComponent({
10
- __name: "i18n-select-container",
11
- props: {
12
- i18nModalKey: {},
13
- destroyCallback: { type: Function },
14
- saveCallback: { type: Function }
15
- },
16
- setup(__props) {
17
- const [registerInner, { closeModal }] = useModalInner();
18
- const [userRegister, { openModal }] = useModal();
19
- const props = __props;
20
- const getContainer = () => document.querySelector(`#${props.i18nModalKey}`);
21
- const formRef = ref();
22
- const formState = reactive({ keywords: "" });
23
- const pagination = reactive({
24
- current: 1,
25
- pageSize: 5,
26
- total: 0,
27
- size: "small",
28
- showTotal: (total) => t("sys.component.table.total", { total })
29
- });
30
- const tableData = ref([]);
31
- const selectRows = ref();
32
- const rowSelection = ref({
33
- type: "radio",
34
- hideSelectAll: true,
35
- selectedRowKeys: [],
36
- onChange: handleRowChange
37
- });
38
- const loading = ref(false);
39
- const columns = computed(() => {
40
- return [];
41
- });
42
- const getTableData = async (keyword, current) => {
43
- loading.value = true;
44
- const result = await _api.apaas.i18NInfo.getPageList({
45
- pageNo: current ?? pagination.current,
46
- pageSize: pagination.pageSize,
47
- searchKey: keyword
48
- });
49
- loading.value = false;
50
- if (result && result.data) {
51
- const rows = result.data.map((item) => {
52
- const infos = JSON.parse(item?.info);
53
- return {
54
- key: item.key,
55
- type: item.type,
56
- ...Object.fromEntries(infos.map((i) => [i.locale, i.info]))
57
- };
58
- });
59
- pagination.total = result.totalCount;
60
- tableData.value = rows;
61
- }
62
- };
63
- onMounted(getTableData);
64
- const handleSearch = () => {
65
- formRef.value?.validate().then(async () => {
66
- await getTableData(formState.keywords, 1);
67
- });
68
- };
69
- const handleTableChange = (paginationInfo) => {
70
- const { current, total, pageSize } = paginationInfo;
71
- pagination.current = current;
72
- pagination.total = total;
73
- pagination.pageSize = pageSize;
74
- getTableData();
75
- };
76
- const handleAddI18n = () => {
77
- openModal();
78
- };
79
- const handleModalOk = async (data, isEdit) => {
80
- const langInfos = columns.value.map((item) => {
81
- return {
82
- locale: item.dataIndex,
83
- info: data[item.dataIndex]
84
- };
85
- });
86
- loading.value = true;
87
- try {
88
- if (isEdit) {
89
- await _api.apaas.i18NInfo.putKey(
90
- { key: data.id },
91
- { info: JSON.stringify(langInfos) }
92
- );
93
- } else {
94
- await _api.apaas.i18NInfo.post({
95
- info: JSON.stringify(langInfos),
96
- key: data.id
97
- });
98
- }
99
- getTableData();
100
- handleRowChange([data.id], [reactive(data)]);
101
- } catch (error) {
102
- loading.value = false;
103
- }
104
- };
105
- function handleRowChange(selectedRowKeys, selectedRows) {
106
- rowSelection.value.selectedRowKeys = selectedRowKeys;
107
- selectRows.value = selectedRows;
108
- }
109
- const handleClose = () => {
110
- if (props.destroyCallback && typeof props.destroyCallback === "function") {
111
- props.destroyCallback();
112
- }
113
- };
114
- const handleOk = async () => {
115
- if (props.saveCallback && typeof props.saveCallback === "function") {
116
- const selectRowKey = rowSelection.value.selectedRowKeys;
117
- const params = {};
118
- if (selectRowKey && selectRowKey[0]) {
119
- const selectRow = selectRows.value?.[0];
120
- console.log("selectRow", selectRow);
121
- Object.assign(params, {
122
- i18nKey: selectRowKey[0]
123
- // i18nTitle: selectRow[getLocale],
124
- });
125
- }
126
- props.saveCallback(params);
127
- }
128
- closeModal();
129
- };
130
- return (_ctx, _cache) => {
131
- const _component_a_input = resolveComponent("a-input");
132
- const _component_a_form_item = resolveComponent("a-form-item");
133
- const _component_a_col = resolveComponent("a-col");
134
- const _component_a_button = resolveComponent("a-button");
135
- const _component_plus_outlined = resolveComponent("plus-outlined");
136
- const _component_a_row = resolveComponent("a-row");
137
- const _component_a_form = resolveComponent("a-form");
138
- const _component_a_table = resolveComponent("a-table");
139
- const _component_basic_modal = resolveComponent("basic-modal");
140
- return openBlock(), createBlock(_component_basic_modal, mergeProps(_ctx.$attrs, {
141
- "min-height": 40,
142
- title: unref(t)("sys.i18n.i18nConfig"),
143
- centered: "",
144
- width: "640px",
145
- "can-fullscreen": false,
146
- "mask-closable": false,
147
- "after-close": handleClose,
148
- "get-container": getContainer,
149
- onRegister: unref(registerInner),
150
- onOk: handleOk
151
- }), {
152
- default: withCtx(() => [
153
- createElementVNode("div", _hoisted_1, [
154
- createVNode(_component_a_form, {
155
- ref_key: "formRef",
156
- ref: formRef,
157
- model: formState,
158
- autocomplete: "off",
159
- layout: "horizontal"
160
- }, {
161
- default: withCtx(() => [
162
- createVNode(_component_a_row, null, {
163
- default: withCtx(() => [
164
- createVNode(_component_a_col, { span: 12 }, {
165
- default: withCtx(() => [
166
- createVNode(_component_a_form_item, {
167
- name: "keywords",
168
- label: unref(t)("sys.keywords")
169
- }, {
170
- default: withCtx(() => [
171
- createVNode(_component_a_input, {
172
- value: formState.keywords,
173
- "onUpdate:value": _cache[0] || (_cache[0] = ($event) => formState.keywords = $event),
174
- placeholder: unref(t)("sys.keywordsPlaceholder"),
175
- style: { "display": "inline-flex" }
176
- }, null, 8, ["value", "placeholder"])
177
- ]),
178
- _: 1
179
- }, 8, ["label"])
180
- ]),
181
- _: 1
182
- }),
183
- createVNode(_component_a_col, {
184
- span: 12,
185
- style: { "text-align": "right" }
186
- }, {
187
- default: withCtx(() => [
188
- createVNode(_component_a_button, {
189
- type: "primary",
190
- onClick: handleSearch
191
- }, {
192
- icon: withCtx(() => [
193
- createVNode(unref(SearchOutlined))
194
- ]),
195
- default: withCtx(() => [
196
- createTextVNode(" " + toDisplayString(unref(t)("sys.queryText")), 1)
197
- ]),
198
- _: 1
199
- }),
200
- createVNode(_component_a_button, {
201
- style: { "margin": "0 8px" },
202
- type: "primary",
203
- onClick: handleAddI18n
204
- }, {
205
- icon: withCtx(() => [
206
- createVNode(_component_plus_outlined)
207
- ]),
208
- default: withCtx(() => [
209
- createTextVNode(" " + toDisplayString(unref(t)("sys.new")), 1)
210
- ]),
211
- _: 1
212
- })
213
- ]),
214
- _: 1
215
- })
216
- ]),
217
- _: 1
218
- })
219
- ]),
220
- _: 1
221
- }, 8, ["model"]),
222
- createElementVNode("div", _hoisted_2, [
223
- createVNode(_component_a_table, {
224
- ref: "tableRef",
225
- "data-source": tableData.value,
226
- columns: columns.value,
227
- "show-index-column": false,
228
- pagination,
229
- striped: false,
230
- bordered: true,
231
- "row-selection": rowSelection.value,
232
- loading: loading.value,
233
- onChange: handleTableChange
234
- }, null, 8, ["data-source", "columns", "pagination", "row-selection", "loading"]),
235
- createVNode(_sfc_main$1, {
236
- lang: columns.value,
237
- "get-container": getContainer,
238
- onRegister: unref(userRegister),
239
- onOk: handleModalOk
240
- }, null, 8, ["lang", "onRegister"])
241
- ])
242
- ])
243
- ]),
244
- _: 1
245
- }, 16, ["title", "onRegister"]);
246
- };
247
- }
248
- });
249
-
250
- export { _sfc_main as default };
@@ -1,5 +0,0 @@
1
- import _sfc_main from './i18n-select-input-form.vue.mjs';
2
-
3
-
4
-
5
- export { _sfc_main as default };
@@ -1,129 +0,0 @@
1
- import { defineComponent, computed, ref, resolveComponent, openBlock, createBlock, withCtx, renderSlot, createVNode, mergeProps, unref, createCommentVNode } from 'vue';
2
- import I18nSelectBtn from './i18n-select-btn.vue.mjs';
3
- import { isEmpty, omit } from 'lodash-es';
4
- import { onClickOutside } from '@vueuse/core';
5
- import { ButtonSize } from '@gct-paas/core';
6
-
7
- const _sfc_main = /* @__PURE__ */ defineComponent({
8
- __name: "i18n-select-input",
9
- props: {
10
- attr: {},
11
- inputExtraProps: {},
12
- i18nConfig: {},
13
- i18nText: {},
14
- placeholderText: {},
15
- size: {},
16
- i18nModalKey: {},
17
- forceUpdate: { type: Boolean },
18
- btnHeight: {},
19
- btnWidth: {}
20
- },
21
- emits: [
22
- "update:i18nText",
23
- "update:i18nConfig",
24
- "on-i18n-select",
25
- "clickOutside",
26
- "focus",
27
- "blur"
28
- ],
29
- setup(__props, { emit: __emit }) {
30
- const isApp = computed(() => {
31
- return !!_gct.store.appInfo.id;
32
- });
33
- const props = __props;
34
- const emit = __emit;
35
- const inputValue = computed({
36
- get() {
37
- return props.i18nText ?? "";
38
- },
39
- set(value) {
40
- if (value !== props.i18nText) {
41
- emit("update:i18nText", value);
42
- }
43
- }
44
- });
45
- const i18nConfigState = computed(() => {
46
- if (isEmpty(props.i18nConfig)) {
47
- return {};
48
- }
49
- if (typeof props.i18nConfig === "string") {
50
- return JSON.parse(props.i18nConfig) ?? {};
51
- }
52
- return props.i18nConfig ?? {};
53
- });
54
- const i18nValue = computed(() => {
55
- return i18nConfigState.value?.[props.attr];
56
- });
57
- const handleSelectI18n = (params) => {
58
- console.log("emit", params);
59
- if (params) {
60
- if (isEmpty(inputValue.value) || props.forceUpdate === true) {
61
- emit("update:i18nText", params.i18nTitle);
62
- }
63
- emit(
64
- "update:i18nConfig",
65
- JSON.stringify(
66
- isEmpty(params) ? omit(i18nConfigState.value, props.attr) : { ...i18nConfigState.value, [props.attr]: params.i18nKey }
67
- )
68
- );
69
- emit("on-i18n-select", params);
70
- }
71
- };
72
- const inputRef = ref();
73
- const handleFocus = () => {
74
- emit("focus", inputRef.value);
75
- };
76
- const handleBlur = () => {
77
- emit("blur", inputRef.value);
78
- };
79
- const i18nInputGroup = ref();
80
- onClickOutside(i18nInputGroup, () => {
81
- emit("clickOutside");
82
- });
83
- return (_ctx, _cache) => {
84
- const _component_a_input = resolveComponent("a-input");
85
- const _component_a_input_group = resolveComponent("a-input-group");
86
- return openBlock(), createBlock(_component_a_input_group, {
87
- id: "i18nInputGroup",
88
- ref_key: "i18nInputGroup",
89
- ref: i18nInputGroup,
90
- compact: ""
91
- }, {
92
- default: withCtx(() => [
93
- renderSlot(_ctx.$slots, "i18n-input", {}, () => [
94
- createVNode(_component_a_input, mergeProps({
95
- ref_key: "inputRef",
96
- ref: inputRef
97
- }, __props.inputExtraProps, {
98
- value: inputValue.value,
99
- "onUpdate:value": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event),
100
- valueModifiers: { trim: true },
101
- style: {
102
- height: __props.btnHeight ? __props.btnHeight : __props.size === unref(ButtonSize).SMALL ? "26px" : "32px",
103
- width: !isApp.value ? "100%" : `calc(100% - ${__props.btnWidth ? __props.btnWidth : __props.size === unref(ButtonSize).SMALL ? "26px" : "32px"}`
104
- },
105
- placeholder: __props.placeholderText,
106
- size: __props.size,
107
- "allow-clear": "",
108
- onFocus: handleFocus,
109
- onBlur: handleBlur
110
- }), null, 16, ["value", "style", "placeholder", "size"])
111
- ], true),
112
- isApp.value ? (openBlock(), createBlock(I18nSelectBtn, {
113
- key: 0,
114
- "btn-height": __props.btnHeight,
115
- "btn-width": __props.btnWidth,
116
- "i18n-value": i18nValue.value,
117
- size: __props.size,
118
- "i18n-modal-key": __props.i18nModalKey,
119
- onOnSelectI18n: handleSelectI18n,
120
- onClosed: _cache[1] || (_cache[1] = ($event) => emit("clickOutside"))
121
- }, null, 8, ["btn-height", "btn-width", "i18n-value", "size", "i18n-modal-key"])) : createCommentVNode("", true)
122
- ]),
123
- _: 3
124
- }, 512);
125
- };
126
- }
127
- });
128
-
129
- export { _sfc_main as default };
@@ -1,5 +0,0 @@
1
- import _sfc_main from './i18n-select-modal.vue.mjs';
2
-
3
-
4
-
5
- export { _sfc_main as default };
@@ -1,5 +0,0 @@
1
- import _sfc_main from './i18n-select-textarea-form.vue.mjs';
2
-
3
-
4
-
5
- export { _sfc_main as default };