From e00c1e8116c0a32e15657b2a60b7346571aefb37 Mon Sep 17 00:00:00 2001 From: liberty Date: Thu, 23 Mar 2023 07:50:46 +0800 Subject: [PATCH] feat: add i18n --- .eslintrc.cjs | 3 +- examples/main.js | 4 +- examples/router.js | 6 + examples/uri.js | 5 +- examples/views/formEditor/objAction.vue | 61 +++++ examples/views/formEditor/objEdit.vue | 4 + .../components/FormTypes/Date/mobile.vue | 7 +- .../components/FormTypes/Html/mobile.vue | 11 +- .../components/FormTypes/Number/pc.vue | 2 + .../components/FormTypes/Signature/mobile.vue | 11 +- .../components/FormTypes/Signature/pc.vue | 11 +- .../FormTypes/Uploadfile/mobile.vue | 7 +- .../components/FormTypes/Uploadfile/pc.vue | 6 +- .../components/Layout/CollapseLayout.jsx | 1 + .../components/Layout/GridLayout.jsx | 1 + .../components/Layout/TableLayout.jsx | 5 +- .../components/Layout/TabsLayout.jsx | 3 +- .../components/Panels/Blocks/index.jsx | 8 +- .../Config/components/AllsidesComponent.vue | 7 +- .../Config/components/BackgroundComponent.vue | 13 +- .../Config/components/BorderComponent.vue | 16 +- .../Config/components/DataComponent1.jsx | 19 +- .../Config/components/DataComponent2.jsx | 8 +- .../Config/components/DataComponent3.vue | 7 +- .../Config/components/GlobalConfigPanel.vue | 35 +-- .../Config/components/GridLayoutComponent.vue | 52 ++-- .../Config/components/LimitComponent.vue | 7 +- .../Panels/Config/components/PropsPanel.vue | 136 +++++----- .../Panels/Config/components/TabsLayout.vue | 83 +++--- .../{TableLayout.vue => __TableLayout.vue} | 10 +- .../components/Panels/Config/index.vue | 44 ++-- .../components/Sector/selectElement.jsx | 41 +-- packages/formEditor/componentsConfig.js | 8 +- packages/formEditor/defaultProps.js | 7 +- packages/formEditor/index.vue | 17 +- packages/formEditor/locale/en.js | 241 ++++++++++++++++++ packages/formEditor/locale/index.js | 9 + packages/formEditor/locale/zh-cn.js | 241 ++++++++++++++++++ packages/formEditor/preview.vue | 5 +- packages/hooks/use-i18n/index.js | 24 +- packages/hooks/use-props/index.js | 27 +- packages/region/index.vue | 5 +- packages/theme/formEditor/Blocks.scss | 3 + packages/theme/formEditor/CollapseLayout.scss | 5 + packages/theme/formEditor/Config.scss | 9 + packages/theme/formEditor/DeviceSwitch.scss | 1 - .../theme/formEditor/DragGableLayout.scss | 6 +- .../theme/formEditor/FormTypes/Number.scss | 3 + packages/theme/formEditor/GridLayout.scss | 3 + packages/theme/formEditor/SelectElement.scss | 7 +- packages/theme/formEditor/TableLayout.scss | 12 +- packages/theme/formEditor/TabsLayout.scss | 8 + packages/theme/formEditor/index.scss | 3 + packages/utils/field.js | 20 +- server/index.js | 2 +- 55 files changed, 1019 insertions(+), 281 deletions(-) create mode 100644 examples/views/formEditor/objAction.vue rename packages/formEditor/components/Panels/Config/components/{TableLayout.vue => __TableLayout.vue} (81%) create mode 100644 packages/formEditor/locale/en.js create mode 100644 packages/formEditor/locale/index.js create mode 100644 packages/formEditor/locale/zh-cn.js create mode 100644 packages/theme/formEditor/CollapseLayout.scss create mode 100644 packages/theme/formEditor/FormTypes/Number.scss create mode 100644 packages/theme/formEditor/TabsLayout.scss diff --git a/.eslintrc.cjs b/.eslintrc.cjs index ad72f12..75dd609 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -29,7 +29,8 @@ module.exports = { 'no-case-declarations': 'off', 'no-useless-escape': 'off', 'no-mixed-operators': 'off', - 'no-async-promise-executor': 'off' + 'no-async-promise-executor': 'off', + 'quotes': 'off' }, overrides: [ // { diff --git a/examples/main.js b/examples/main.js index 943c7a1..88079c9 100644 --- a/examples/main.js +++ b/examples/main.js @@ -1,13 +1,15 @@ import { createApp } from 'vue' import ElementPlus from 'element-plus' import * as ElementPlusIconsVue from '@element-plus/icons-vue' -import Vant from 'vant' +import Vant, { Locale } from 'vant' +import enUS from 'vant/es/locale/lang/en-US' // import '@vant/touch-emulator' import 'element-plus/dist/index.css' import 'vant/lib/index.css' import router from './router' import App from './App.vue' const app = createApp(App) +Locale.use('en-US', enUS) app.use(router) app.use(ElementPlus) app.use(Vant) diff --git a/examples/router.js b/examples/router.js index 33e6622..862bf85 100644 --- a/examples/router.js +++ b/examples/router.js @@ -2,6 +2,7 @@ import * as VueRouter from 'vue-router' import FormEditorView from './views/formEditor.vue' import FormEditorObjListView from './views/formEditor/objList.vue' import FormEditorObjEditView from './views/formEditor/objEdit.vue' +import FormEditorObjActionView from './views/formEditor/objAction.vue' const routes = [ { path: '/', @@ -26,6 +27,11 @@ const routes = [ name: 'objEdit', path: 'objEdit/:objid?', component: FormEditorObjEditView + }, + { + name: 'objAction', + path: 'objAction/:objid?', + component: FormEditorObjActionView } ] } diff --git a/examples/uri.js b/examples/uri.js index 85c1619..d0e7985 100644 --- a/examples/uri.js +++ b/examples/uri.js @@ -1,4 +1,5 @@ -const host = 'http://192.168.31.181:8000' +const host = 'http://192.168.31.181:8001' export default { - obj: `${host}/Everright-api/lowCode/obj` + obj: `${host}/Everright-api/lowCode/obj`, + uploadFile: `${host}/Everright-api/lowCode/uploads` } diff --git a/examples/views/formEditor/objAction.vue b/examples/views/formEditor/objAction.vue new file mode 100644 index 0000000..4bcdb85 --- /dev/null +++ b/examples/views/formEditor/objAction.vue @@ -0,0 +1,61 @@ + + diff --git a/examples/views/formEditor/objEdit.vue b/examples/views/formEditor/objEdit.vue index 8d144ac..792601a 100644 --- a/examples/views/formEditor/objEdit.vue +++ b/examples/views/formEditor/objEdit.vue @@ -6,10 +6,12 @@ import { EverrightEditor } from '@ER/formEditor' import uri from '@ER-examples/uri.js' const route = useRoute() const loading = ref(true) +const lang = ref('zh-cn') const EReditorRef = ref(null) const state = reactive({ name: '' }) +window.lang = lang const getObjData = async () => { try { const { @@ -51,7 +53,9 @@ onMounted(() => { diff --git a/packages/formEditor/components/FormTypes/Date/mobile.vue b/packages/formEditor/components/FormTypes/Date/mobile.vue index 67a6c45..a313cee 100644 --- a/packages/formEditor/components/FormTypes/Date/mobile.vue +++ b/packages/formEditor/components/FormTypes/Date/mobile.vue @@ -11,6 +11,9 @@ export default { }