From c4ff0d24b7634f96ded37e715ad69a1d182b5ea8 Mon Sep 17 00:00:00 2001 From: MTrun <1262327911@qq.com> Date: Fri, 18 Mar 2022 20:36:05 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E6=96=B0=E5=A2=9E=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E6=8E=A5=E5=8F=A3=E9=85=8D=E7=BD=AE=EF=BC=8C=E5=8D=95?= =?UTF-8?q?=E4=B8=AA=E5=9B=BE=E8=A1=A8=E6=98=A0=E5=B0=84=E8=A1=A8=EF=BC=8C?= =?UTF-8?q?=E6=8A=BD=E7=A6=BB=E6=9F=B1=E7=8A=B6=E5=9B=BE=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + pnpm-lock.yaml | 18 ++-- src/App.vue | 16 ++-- src/hooks/code.hook.ts | 9 ++ src/hooks/index.ts | 3 +- src/hooks/theme.hook.ts | 8 +- .../Charts/Bars/BarCommon/config.ts | 15 ++-- .../Charts/Bars/BarCommon/data.json | 40 +++++++++ .../Charts/Bars/BarCommon/index.vue | 7 +- src/packages/index.d.ts | 5 ++ src/packages/public/chart.ts | 18 +++- src/packages/public/publicConfig.ts | 1 + src/plugins/naive.ts | 4 + src/settings/chartThemes/global.theme.json | 4 + .../chartEditStore/chartEditStore.d.ts | 10 +-- .../components/ChartDataSetting/index.vue | 4 +- .../components/ChartAnimation/index.vue | 12 +-- .../components/ChartData/index.vue | 89 ++++++++++++++++++- .../components/ChartSetting/index.vue | 12 +-- .../components/hooks/useTargetData.hook.ts | 14 +++ 20 files changed, 226 insertions(+), 64 deletions(-) create mode 100644 src/hooks/code.hook.ts create mode 100644 src/packages/components/Charts/Bars/BarCommon/data.json create mode 100644 src/views/chart/ContentConfigurations/components/hooks/useTargetData.hook.ts diff --git a/package.json b/package.json index 9f11668d..5587098e 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "animate.css": "^4.1.1", "axios": "^0.23.0", "crypto-ts": "^1.0.2", + "highlight.js": "^11.5.0", "naive-ui": "^2.25.2", "pinia": "^2.0.6", "screenfull": "^6.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 006de1b7..93bb0d8b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,7 @@ specifiers: eslint-plugin-import: ^2.25.3 eslint-plugin-prettier: ^4.0.0 eslint-plugin-vue: ^8.2.0 + highlight.js: ^11.5.0 lodash: ~4.17.21 mockjs: ^1.1.0 naive-ui: ^2.25.2 @@ -47,6 +48,7 @@ dependencies: animate.css: r2.cnpmjs.org/animate.css/4.1.1 axios: rg.cnpmjs.org/axios/0.23.0 crypto-ts: r2.cnpmjs.org/crypto-ts/1.0.2 + highlight.js: registry.npmjs.org/highlight.js/11.5.0 naive-ui: registry.npmjs.org/naive-ui/2.25.2_vue@3.2.24 pinia: rg.cnpmjs.org/pinia/2.0.6_typescript@4.5.2+vue@3.2.24 screenfull: rg.cnpmjs.org/screenfull/6.0.0 @@ -2147,6 +2149,13 @@ packages: version: 4.0.0 engines: {node: '>=8'} + registry.npmjs.org/highlight.js/11.5.0: + resolution: {integrity: sha512-SM6WDj5/C+VfIY8pZ6yW6Xa0Fm1tniYVYWYW1Q/DcMnISZFrC3aQAZZZFAAZtybKNrGId3p/DNbFTtcTXXgYBw==, registry: https://skimdb.npmjs.com/registry/, tarball: https://registry.npmjs.org/highlight.js/-/highlight.js-11.5.0.tgz} + name: highlight.js + version: 11.5.0 + engines: {node: '>=12.0.0'} + dev: false + registry.npmjs.org/jest-diff/27.5.1: resolution: {integrity: sha512-m0NvkX55LDt9T4mctTEgnZk3fmEg3NRYutvMPWM/0iPnkFj2wIeF45O1718cMSOFO1vINkqmxqD8vE37uTEbqw==, registry: https://skimdb.npmjs.com/registry/, tarball: https://registry.npmjs.org/jest-diff/-/jest-diff-27.5.1.tgz} name: jest-diff @@ -2205,7 +2214,7 @@ packages: date-fns: rg.cnpmjs.org/date-fns/2.27.0 date-fns-tz: rg.cnpmjs.org/date-fns-tz/1.1.6_date-fns@2.27.0 evtd: rg.cnpmjs.org/evtd/0.2.3 - highlight.js: rg.cnpmjs.org/highlight.js/11.3.1 + highlight.js: registry.npmjs.org/highlight.js/11.5.0 lodash: rg.cnpmjs.org/lodash/4.17.21 lodash-es: rg.cnpmjs.org/lodash-es/4.17.21 seemly: rg.cnpmjs.org/seemly/0.3.3 @@ -4596,13 +4605,6 @@ packages: tslib: registry.npmjs.org/tslib/2.3.1 dev: true - rg.cnpmjs.org/highlight.js/11.3.1: - resolution: {integrity: sha1-gTB47zqlGcYXAPhP6QRyMcXcMpE=, registry: http://r.cnpmjs.org/, tarball: https://rg.cnpmjs.org/highlight.js/download/highlight.js-11.3.1.tgz} - name: highlight.js - version: 11.3.1 - engines: {node: '>=12.0.0'} - dev: false - rg.cnpmjs.org/html-tags/3.1.0: resolution: {integrity: sha1-e15vfmZen7QfMAB+2eDUHpf7IUA=, registry: http://r.cnpmjs.org/, tarball: https://rg.cnpmjs.org/html-tags/download/html-tags-3.1.0.tgz} name: html-tags diff --git a/src/App.vue b/src/App.vue index 7f644b1b..4de0dd1a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,9 +1,10 @@ diff --git a/src/views/chart/ContentConfigurations/components/hooks/useTargetData.hook.ts b/src/views/chart/ContentConfigurations/components/hooks/useTargetData.hook.ts new file mode 100644 index 00000000..7347a78c --- /dev/null +++ b/src/views/chart/ContentConfigurations/components/hooks/useTargetData.hook.ts @@ -0,0 +1,14 @@ +import { computed, Ref } from 'vue' +import { CreateComponentType } from '@/packages/index.d' +import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' + +// 获取当前对象数据 +export const useTargetData = () => { + const chartEditStore = useChartEditStore() + const targetData: Ref = computed(() => { + const list = chartEditStore.getComponentList + const targetIndex = chartEditStore.fetchTargetIndex() + return list[targetIndex] + }) + return { targetData, chartEditStore } +}