@peng_kai/kit 0.2.46 → 0.2.48

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/package.json CHANGED
@@ -1,95 +1,95 @@
1
- {
2
- "name": "@peng_kai/kit",
3
- "type": "module",
4
- "version": "0.2.46",
5
- "description": "",
6
- "author": "",
7
- "license": "ISC",
8
- "keywords": [],
9
- "main": "index.js",
10
- "scripts": {
11
- "dev:js": "tsx ./admin/scripts/deploy.ts",
12
- "lint": "eslint .",
13
- "lint:fix": "eslint . --fix"
14
- },
15
- "peerDependencies": {
16
- "ant-design-vue": "4.2.3",
17
- "vue": "3.4.31",
18
- "vue-router": "4.4.0"
19
- },
20
- "dependencies": {
21
- "@aws-sdk/client-s3": "^3.609.0",
22
- "@aws-sdk/lib-storage": "^3.609.0",
23
- "@babel/generator": "^7.24.7",
24
- "@babel/parser": "^7.24.7",
25
- "@babel/traverse": "^7.24.7",
26
- "@babel/types": "^7.24.7",
27
- "@ckeditor/ckeditor5-vue": "^5.1.0",
28
- "@fingerprintjs/fingerprintjs": "^4.4.1",
29
- "@tanstack/vue-query": "^5.49.1",
30
- "@vueuse/components": "^10.11.0",
31
- "@vueuse/core": "^10.11.0",
32
- "@vueuse/router": "^10.11.0",
33
- "a-calc": "^1.3.12",
34
- "archiver": "^7.0.1",
35
- "axios": "^1.7.2",
36
- "bignumber.js": "^9.1.2",
37
- "chokidar": "^3.6.0",
38
- "crypto-es": "^2.1.0",
39
- "dayjs": "^1.11.11",
40
- "echarts": "^5.4.3",
41
- "execa": "^9.3.0",
42
- "fast-glob": "^3.3.2",
43
- "localstorage-slim": "^2.7.1",
44
- "lodash-es": "^4.17.21",
45
- "nprogress": "^0.2.0",
46
- "pinia": "^2.1.7",
47
- "tsx": "^4.16.00",
48
- "vue": "^3.4.31",
49
- "vue-i18n": "^9.13.1",
50
- "vue-router": "^4.4.0"
51
- },
52
- "devDependencies": {
53
- "@ckeditor/ckeditor5-adapter-ckfinder": "^41.1.0",
54
- "@ckeditor/ckeditor5-alignment": "^41.1.0",
55
- "@ckeditor/ckeditor5-autoformat": "^41.1.0",
56
- "@ckeditor/ckeditor5-basic-styles": "^41.1.0",
57
- "@ckeditor/ckeditor5-block-quote": "^41.1.0",
58
- "@ckeditor/ckeditor5-build-classic": "^41.1.0",
59
- "@ckeditor/ckeditor5-code-block": "^41.1.0",
60
- "@ckeditor/ckeditor5-document-outline": "^41.1.0",
61
- "@ckeditor/ckeditor5-editor-classic": "^41.1.0",
62
- "@ckeditor/ckeditor5-essentials": "^41.1.0",
63
- "@ckeditor/ckeditor5-font": "^41.1.0",
64
- "@ckeditor/ckeditor5-heading": "^41.1.0",
65
- "@ckeditor/ckeditor5-highlight": "^41.1.0",
66
- "@ckeditor/ckeditor5-horizontal-line": "^41.1.0",
67
- "@ckeditor/ckeditor5-html-embed": "^41.1.0",
68
- "@ckeditor/ckeditor5-html-support": "^41.1.0",
69
- "@ckeditor/ckeditor5-image": "^41.1.0",
70
- "@ckeditor/ckeditor5-import-word": "^41.1.0",
71
- "@ckeditor/ckeditor5-indent": "^41.1.0",
72
- "@ckeditor/ckeditor5-link": "^41.1.0",
73
- "@ckeditor/ckeditor5-list": "^41.1.0",
74
- "@ckeditor/ckeditor5-media-embed": "^41.1.0",
75
- "@ckeditor/ckeditor5-paragraph": "^41.1.0",
76
- "@ckeditor/ckeditor5-remove-format": "^41.1.0",
77
- "@ckeditor/ckeditor5-show-blocks": "^41.1.0",
78
- "@ckeditor/ckeditor5-source-editing": "^41.1.0",
79
- "@ckeditor/ckeditor5-table": "^41.1.0",
80
- "@ckeditor/ckeditor5-theme-lark": "^41.1.0",
81
- "@ckeditor/ckeditor5-typing": "^41.1.0",
82
- "@ckeditor/ckeditor5-upload": "^41.1.0",
83
- "@ckeditor/ckeditor5-word-count": "^41.1.0",
84
- "@peng_kai/lint": "^0.1.0",
85
- "@types/archiver": "^6.0.2",
86
- "@types/crypto-js": "^4.2.2",
87
- "@types/lodash-es": "^4.17.12",
88
- "@types/node": "^18.19.39",
89
- "@types/nprogress": "^0.2.3",
90
- "ant-design-vue": "^4.2.3",
91
- "type-fest": "^4.21.0",
92
- "typescript": "^5.5.3",
93
- "vue-component-type-helpers": "^2.0.24"
94
- }
95
- }
1
+ {
2
+ "name": "@peng_kai/kit",
3
+ "type": "module",
4
+ "version": "0.2.48",
5
+ "description": "",
6
+ "author": "",
7
+ "license": "ISC",
8
+ "keywords": [],
9
+ "main": "index.js",
10
+ "scripts": {
11
+ "dev:js": "tsx ./admin/scripts/deploy.ts",
12
+ "lint": "eslint .",
13
+ "lint:fix": "eslint . --fix"
14
+ },
15
+ "peerDependencies": {
16
+ "ant-design-vue": "4.2.3",
17
+ "vue": "3.4.31",
18
+ "vue-router": "4.4.0"
19
+ },
20
+ "dependencies": {
21
+ "@aws-sdk/client-s3": "^3.609.0",
22
+ "@aws-sdk/lib-storage": "^3.609.0",
23
+ "@babel/generator": "^7.24.7",
24
+ "@babel/parser": "^7.24.7",
25
+ "@babel/traverse": "^7.24.7",
26
+ "@babel/types": "^7.24.7",
27
+ "@ckeditor/ckeditor5-vue": "^5.1.0",
28
+ "@fingerprintjs/fingerprintjs": "^4.4.1",
29
+ "@tanstack/vue-query": "^5.49.1",
30
+ "@vueuse/components": "^10.11.0",
31
+ "@vueuse/core": "^10.11.0",
32
+ "@vueuse/router": "^10.11.0",
33
+ "a-calc": "^1.3.12",
34
+ "archiver": "^7.0.1",
35
+ "axios": "^1.7.2",
36
+ "bignumber.js": "^9.1.2",
37
+ "chokidar": "^3.6.0",
38
+ "crypto-es": "^2.1.0",
39
+ "dayjs": "^1.11.11",
40
+ "echarts": "^5.4.3",
41
+ "execa": "^9.3.0",
42
+ "fast-glob": "^3.3.2",
43
+ "localstorage-slim": "^2.7.1",
44
+ "lodash-es": "^4.17.21",
45
+ "nprogress": "^0.2.0",
46
+ "pinia": "^2.1.7",
47
+ "tsx": "^4.16.00",
48
+ "vue": "^3.4.31",
49
+ "vue-i18n": "^9.13.1",
50
+ "vue-router": "^4.4.0"
51
+ },
52
+ "devDependencies": {
53
+ "@ckeditor/ckeditor5-adapter-ckfinder": "^41.1.0",
54
+ "@ckeditor/ckeditor5-alignment": "^41.1.0",
55
+ "@ckeditor/ckeditor5-autoformat": "^41.1.0",
56
+ "@ckeditor/ckeditor5-basic-styles": "^41.1.0",
57
+ "@ckeditor/ckeditor5-block-quote": "^41.1.0",
58
+ "@ckeditor/ckeditor5-build-classic": "^41.1.0",
59
+ "@ckeditor/ckeditor5-code-block": "^41.1.0",
60
+ "@ckeditor/ckeditor5-document-outline": "^41.1.0",
61
+ "@ckeditor/ckeditor5-editor-classic": "^41.1.0",
62
+ "@ckeditor/ckeditor5-essentials": "^41.1.0",
63
+ "@ckeditor/ckeditor5-font": "^41.1.0",
64
+ "@ckeditor/ckeditor5-heading": "^41.1.0",
65
+ "@ckeditor/ckeditor5-highlight": "^41.1.0",
66
+ "@ckeditor/ckeditor5-horizontal-line": "^41.1.0",
67
+ "@ckeditor/ckeditor5-html-embed": "^41.1.0",
68
+ "@ckeditor/ckeditor5-html-support": "^41.1.0",
69
+ "@ckeditor/ckeditor5-image": "^41.1.0",
70
+ "@ckeditor/ckeditor5-import-word": "^41.1.0",
71
+ "@ckeditor/ckeditor5-indent": "^41.1.0",
72
+ "@ckeditor/ckeditor5-link": "^41.1.0",
73
+ "@ckeditor/ckeditor5-list": "^41.1.0",
74
+ "@ckeditor/ckeditor5-media-embed": "^41.1.0",
75
+ "@ckeditor/ckeditor5-paragraph": "^41.1.0",
76
+ "@ckeditor/ckeditor5-remove-format": "^41.1.0",
77
+ "@ckeditor/ckeditor5-show-blocks": "^41.1.0",
78
+ "@ckeditor/ckeditor5-source-editing": "^41.1.0",
79
+ "@ckeditor/ckeditor5-table": "^41.1.0",
80
+ "@ckeditor/ckeditor5-theme-lark": "^41.1.0",
81
+ "@ckeditor/ckeditor5-typing": "^41.1.0",
82
+ "@ckeditor/ckeditor5-upload": "^41.1.0",
83
+ "@ckeditor/ckeditor5-word-count": "^41.1.0",
84
+ "@peng_kai/lint": "^0.1.0",
85
+ "@types/archiver": "^6.0.2",
86
+ "@types/crypto-js": "^4.2.2",
87
+ "@types/lodash-es": "^4.17.12",
88
+ "@types/node": "^18.19.39",
89
+ "@types/nprogress": "^0.2.3",
90
+ "ant-design-vue": "^4.2.3",
91
+ "type-fest": "^4.21.0",
92
+ "typescript": "^5.5.3",
93
+ "vue-component-type-helpers": "^2.0.24"
94
+ }
95
+ }
@@ -43,7 +43,7 @@ export function popupMessage(popup: (type: 'error' | 'success', message: string)
43
43
  errorMsg = error.message;
44
44
  }
45
45
 
46
- if (typeof errorMsg === 'string' && errorMsg !== '')
46
+ if (typeof errorMsg === 'string' && (errorMsg !== '' && errorMsg !== 'canceled'))
47
47
  popup('error', errorMsg);
48
48
 
49
49
  throw error;
@@ -1,31 +1,75 @@
1
1
  <script lang="ts">
2
2
  import { useEventListener, useResizeObserver } from '@vueuse/core';
3
3
  import * as echarts from 'echarts';
4
- import { ref, shallowRef, toRef, watchEffect } from 'vue';
4
+ import { onBeforeMount, onMounted, ref, shallowRef, toRef, watch } from 'vue';
5
5
  import { useIsDark } from '../../../hooks/useIsDark';
6
6
  </script>
7
7
 
8
8
  <script setup lang="ts">
9
- const props = defineProps<{
9
+ const props = withDefaults(defineProps<{
10
10
  echartOption: any
11
- }>();
11
+ theme?: 'light' | 'dark' | 'auto'
12
+ updateMode?: 'all' | 'data'
13
+ }>(), {
14
+ theme: 'auto',
15
+ updateMode: 'all',
16
+ });
12
17
 
13
18
  const $chartEle = ref<HTMLElement>();
14
- const echartInst = shallowRef<echarts.ECharts>();
19
+ const echartInst = shallowRef<echarts.ECharts | null>(null);
15
20
  const isDark = useIsDark();
16
21
 
17
- watchEffect(() => {
18
- const _$chartEle = $chartEle.value;
22
+ // watchEffect(() => {
23
+ // const _$chartEle = $chartEle.value;
19
24
 
20
- if (!_$chartEle) {
21
- echartInst.value = undefined;
22
- return;
23
- }
25
+ // if (!_$chartEle) {
26
+ // echartInst.value = undefined;
27
+ // return;
28
+ // }
29
+
30
+ // // TODO: [ECharts] Can't get DOM width or height. Please check dom.clientWidth and dom.clientHeight. They should not be 0.For example, you may need to call this in the callback of window.onload.
31
+ // echartInst.value = echarts.init(_$chartEle, isDark.value ? 'dark' : 'light');
32
+ // echartInst.value.setOption(props.echartOption ?? {});
33
+ // // echartInst.value
34
+ // });
35
+
36
+ function getTheme() {
37
+ if (props.theme === 'auto')
38
+ return isDark.value ? 'dark' : 'light';
39
+
40
+ return props.theme;
41
+ }
42
+
43
+ function updateAll(option: any) {
44
+ echartInst.value?.dispose();
45
+ echartInst.value = null;
46
+ echartInst.value = echarts.init($chartEle.value, getTheme());
47
+ echartInst.value.setOption(option ?? {});
48
+ }
49
+
50
+ function updateData(option: any) {
51
+ echartInst.value?.setOption(option ?? {});
52
+ }
53
+
54
+ watch(toRef(props, 'echartOption'), (option) => {
55
+ if (props.updateMode === 'all')
56
+ updateAll(option);
57
+ else
58
+ updateData(option);
59
+ });
60
+
61
+ watch(isDark, () => {
62
+ if (props.theme === 'auto')
63
+ updateAll(props.echartOption);
64
+ });
65
+
66
+ onMounted(() => {
67
+ updateAll(props.echartOption ?? {});
68
+ });
24
69
 
25
- // TODO: [ECharts] Can't get DOM width or height. Please check dom.clientWidth and dom.clientHeight. They should not be 0.For example, you may need to call this in the callback of window.onload.
70
+ onBeforeMount(() => {
26
71
  echartInst.value?.dispose();
27
- echartInst.value = echarts.init(_$chartEle, isDark.value ? 'dark' : 'light');
28
- echartInst.value.setOption(props.echartOption ?? {});
72
+ echartInst.value = null;
29
73
  });
30
74
 
31
75
  /**
@@ -29,7 +29,7 @@ export function parseModalParams<T = any>(modalName?: string, hash?: string) {
29
29
  * @param modalParams 弹窗参数
30
30
  */
31
31
  export function useSyncModalParamsToHash(modalName: string, modalParams: Record<string, any>) {
32
- const hashStr = useRouteHash(undefined, { route: useRoute(), router: useRouter() });
32
+ const hashStr = useRouteHash(undefined, { route: useRoute(), router: useRouter(), mode: 'replace' });
33
33
 
34
34
  function syncParamsToHash() {
35
35
  const _hashStr = hashStr.value ?? '';
@@ -55,7 +55,7 @@ export function useSyncModalParamsToHash(modalName: string, modalParams: Record<
55
55
  if (!hashParams.get(MODAL_NAME_KEY) || hashParams.get(MODAL_NAME_KEY) === modalName) {
56
56
  hashParams.delete(MODAL_NAME_KEY);
57
57
  Object.keys(modalParams).forEach(k => hashParams.delete(k));
58
- hashStr.value = `#${hashParams.toString()}`;
58
+ location.hash = `#${hashParams.toString()}`;
59
59
  }
60
60
  }
61
61