From f5339844c377876f5eb0e08678d6e0ddb376e64e Mon Sep 17 00:00:00 2001 From: bqy_fe <1743369777@qq.com> Date: Sun, 4 Jul 2021 17:04:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20:sparkles:=E6=B7=BB=E5=8A=A0=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 3 + .env.production | 3 + README.EN.md | 30 +- README.md | 46 ++- components.d.ts | 33 +- index.html | 2 +- package.json | 34 +- preview/views/preview.vue | 6 +- preview/views/slot-item.vue | 52 ++- src/packages/base-widgets/button/index.tsx | 4 + src/packages/base-widgets/checkbox/index.tsx | 50 ++- .../base-widgets/datetimePicker/index.tsx | 12 +- src/packages/base-widgets/image/index.tsx | 9 +- .../base-widgets/input/createFieldProps.ts | 7 +- src/packages/base-widgets/input/index.tsx | 13 +- src/packages/base-widgets/nav-bar/index.tsx | 6 +- .../base-widgets/notice-bar/index.tsx | 7 +- src/packages/base-widgets/picker/index.tsx | 64 ++-- src/packages/base-widgets/process/index.tsx | 2 +- src/packages/base-widgets/radio/index.tsx | 34 +- src/packages/base-widgets/rate/index.tsx | 6 +- src/packages/base-widgets/slider/index.tsx | 6 +- src/packages/base-widgets/stepper/index.tsx | 8 +- src/packages/base-widgets/swipe/index.tsx | 3 +- src/packages/base-widgets/switch/index.tsx | 12 +- .../container-component/form/compProps.ts | 32 +- .../container-component/form/index.tsx | 12 + src/style/common.scss | 9 + .../components/base-widgets/index.module.scss | 31 +- .../components/data-source/data-fetch.vue | 19 +- .../components/data-source/data-model.vue | 1 - .../components/data-source/utils.tsx | 4 +- .../left-aside/components/page-tree/index.vue | 50 ++- .../components/left-aside/tabs.ts | 2 +- .../components/attr-editor/AttrEditor.tsx | 55 ++- .../cross-sortable-options-editor.tsx | 135 +++++-- .../components/event-action/index.tsx | 307 ++++++++++++++- .../right-attribute-panel/index.tsx | 2 +- .../simulator-editor/simulator-editor.vue | 4 +- src/visual-editor/hooks/useVisualData.ts | 8 +- src/visual-editor/types/index.d.ts | 20 +- src/visual-editor/visual-editor.props.tsx | 30 +- src/visual-editor/visual-editor.utils.ts | 29 +- vite.config.ts | 22 +- yarn.lock | 352 ++++++++++++------ 45 files changed, 1164 insertions(+), 412 deletions(-) diff --git a/.env.development b/.env.development index cfe99b3..d61b120 100644 --- a/.env.development +++ b/.env.development @@ -1,5 +1,8 @@ # 只在开发模式中被载入 +# 网站标题 +VITE_APP_TITLE = H5低代码 + # 网站前缀 VITE_BASE_URL = / diff --git a/.env.production b/.env.production index beb3671..a8c4045 100644 --- a/.env.production +++ b/.env.production @@ -1,5 +1,8 @@ # 只在生产模式中被载入 +# 网站标题 +VITE_APP_TITLE = H5低代码 + # 网站前缀 VITE_BASE_URL = /vite-vue3-lowcode/ diff --git a/README.EN.md b/README.EN.md index d4b9649..93ee768 100644 --- a/README.EN.md +++ b/README.EN.md @@ -49,20 +49,22 @@ let propObj = { boolean: (config) => `createEditorSwitchProp(${JSON.stringify(config)})` } -$$('#props + table tr').reduce((prev, curr) => { - const children = curr.children - const key = children[0].textContent.replace(/-([a-z])/g, (all, i) => i.toUpperCase()) - const child3Text = children[3].textContent - const defaultValue = ['true', 'false'].includes(child3Text) - ? child3Text - : `'${child3Text == '-' ? '' : child3Text}'` - const value = (propObj[children[2].textContent] ?? propObj['string'])({ - label: `'${children[1].textContent}'`, - defaultValue - }).replaceAll('"', '') - prev[key] = value - return prev -}, {}) +JSON.stringify( + $$('#props + table tbody tr').reduce((prev, curr) => { + const children = curr.children + const key = children[0].textContent.replace(/-([a-z])/g, (all, i) => i.toUpperCase()) + const child3Text = children[3].textContent + const defaultValue = ['true', 'false'].includes(child3Text) + ? child3Text + : `'${child3Text == '-' ? '' : child3Text}'` + const value = (propObj[children[2].textContent] ?? propObj['string'])({ + label: `'${children[1].textContent}'`, + defaultValue + }).replaceAll('"', '') + prev[key] = value + return prev + }, {}) +).replaceAll('"', '') ``` ## Browser support diff --git a/README.md b/README.md index 323409e..959c6ba 100644 --- a/README.md +++ b/README.md @@ -56,20 +56,38 @@ let propObj = { boolean: (config) => `createEditorSwitchProp(${JSON.stringify(config)})` } -$$('#props + table tr').reduce((prev, curr) => { - const children = curr.children - const key = children[0].textContent.replace(/-([a-z])/g, (all, i) => i.toUpperCase()) - const child3Text = children[3].textContent - const defaultValue = ['true', 'false'].includes(child3Text) - ? child3Text - : `'${child3Text == '-' ? '' : child3Text}'` - const value = (propObj[children[2].textContent] ?? propObj['string'])({ - label: `'${children[1].textContent}'`, - defaultValue - }).replaceAll('"', '') - prev[key] = value - return prev -}, {}) +JSON.stringify( + $$('#props + table tbody tr').reduce((prev, curr) => { + const children = curr.children + const key = children[0].textContent.replace(/-([a-z])/g, (all, i) => i.toUpperCase()) + const child3Text = children[3].textContent + const defaultValue = ['true', 'false'].includes(child3Text) + ? child3Text + : `'${child3Text == '-' ? '' : child3Text}'` + const value = (propObj[children[2].textContent] ?? propObj['string'])({ + label: `'${children[1].textContent}'`, + defaultValue + }).replaceAll('"', '') + prev[key] = value + return prev + }, {}) +).replaceAll('"', '') +``` + +```javascript +// 在vant文档中 chrome控制台输入以下代码,快速生成组件事件 +JSON.stringify( + $$('#events + table tbody tr').reduce((prev, curr) => { + const children = curr.children + const event = { + label: children[1].textContent, + value: children[0].textContent + } + return prev.concat([event]) + }, []) +) + .replaceAll(/(? - Vite App + H5低代码
diff --git a/package.json b/package.json index b710ff0..acb29d5 100644 --- a/package.json +++ b/package.json @@ -27,15 +27,15 @@ "axios": "^0.21.1", "dayjs": "^1.10.5", "dexie": "^3.0.3", - "element-plus": "1.0.2-beta.52", + "element-plus": "1.0.2-beta.54", "lodash": "^4.17.21", "monaco-editor": "^0.25.2", "normalize.css": "^8.0.1", "nprogress": "^1.0.0-1", "qrcode": "^1.4.4", "qs": "^6.10.1", - "vant": "^3.1.0", - "vue": "3.1.2", + "vant": "^3.1.2", + "vue": "3.1.4", "vue-router": "^4.0.10", "vuedraggable": "^4.0.3", "vuex": "^4.0.2" @@ -43,24 +43,24 @@ "devDependencies": { "@commitlint/cli": "^12.1.4", "@commitlint/config-conventional": "^12.1.4", - "@types/node": "^15.12.4", - "@typescript-eslint/eslint-plugin": "^4.28.0", - "@typescript-eslint/parser": "^4.28.0", - "@vitejs/plugin-legacy": "^1.4.2", - "@vitejs/plugin-vue": "^1.2.3", - "@vitejs/plugin-vue-jsx": "^1.1.5", - "@vue/compiler-sfc": "3.1.2", + "@types/node": "^16.0.0", + "@typescript-eslint/eslint-plugin": "^4.28.1", + "@typescript-eslint/parser": "^4.28.1", + "@vitejs/plugin-legacy": "^1.4.3", + "@vitejs/plugin-vue": "^1.2.4", + "@vitejs/plugin-vue-jsx": "^1.1.6", + "@vue/compiler-sfc": "3.1.4", "commitizen": "^4.2.4", "cross-env": "^7.0.3", "cz-conventional-changelog": "^3.3.0", "cz-customizable": "^6.3.0", - "eslint": "^7.29.0", + "eslint": "^7.30.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-import": "^2.23.4", "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-vue": "^7.12.1", "gh-pages": "^3.2.3", - "husky": "^6.0.0", + "husky": "^7.0.0", "lint-staged": "^11.0.0", "prettier": "^2.3.2", "pretty-quick": "^3.1.1", @@ -69,14 +69,14 @@ "stylelint-config-prettier": "^8.0.2", "stylelint-config-standard": "^22.0.0", "stylelint-order": "^4.1.0", - "typescript": "^4.3.4", + "typescript": "^4.3.5", "vite": "2.3.8", - "vite-plugin-components": "^0.11.2", + "vite-plugin-components": "^0.12.0", "vite-plugin-style-import": "^1.0.1", - "vite-plugin-windicss": "^1.1.1", - "vue-eslint-parser": "^7.6.0", + "vite-plugin-windicss": "^1.2.0", + "vue-eslint-parser": "^7.7.2", "vue-tsc": "^0.2.0", - "windicss": "^3.1.3" + "windicss": "^3.1.4" }, "repository": { "type": "git", diff --git a/preview/views/preview.vue b/preview/views/preview.vue index 2203e32..f5fd4d1 100644 --- a/preview/views/preview.vue +++ b/preview/views/preview.vue @@ -1,14 +1,14 @@ @@ -69,6 +69,8 @@ export default defineComponent({ return { ...toRefs(state), + actions: jsonData.actions, + models: jsonData.models, visualConfig } } diff --git a/preview/views/slot-item.vue b/preview/views/slot-item.vue index e583951..33b3cfd 100644 --- a/preview/views/slot-item.vue +++ b/preview/views/slot-item.vue @@ -1,17 +1,17 @@