uni-oaview 1.0.22 → 1.0.24
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/components/oa-page/nextwork-error.vue +32 -0
- package/components/oa-page/oa-page.vue +22 -4
- package/components/oa-single-select/oa-single-select.vue +3 -1
- package/components/oa-vconsole/awesome-display-info.vue +14 -3
- package/components/oa-vconsole/console.vue +1 -1
- package/components/oa-vconsole/native-event.vue +19 -12
- package/components/oa-vconsole/network.vue +28 -21
- package/components/oa-vconsole/oa-vconsole.vue +17 -24
- package/components/oa-vconsole/storage.vue +17 -10
- package/components/oa-vconsole/utils.ts +53 -35
- package/imgs/warn.svg +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="network-error" v-if="isNetworkError">
|
|
3
|
+
<image style="width: 13px; height: 13px" src="../../imgs/warn.svg" />
|
|
4
|
+
<span style="margin-left: 5px; line-height: 10px">网络错误,请检查本地连接</span>
|
|
5
|
+
</view>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script lang="ts" setup>
|
|
9
|
+
import { ref } from 'vue';
|
|
10
|
+
const isNetworkError = ref(false);
|
|
11
|
+
/** 监听网络状态 */
|
|
12
|
+
uni.onNativeEventReceive(function (event: string, data: boolean) {
|
|
13
|
+
if (event === 'networkStatus') {
|
|
14
|
+
isNetworkError.value = !data;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
</script>
|
|
18
|
+
<style scoped lang="scss">
|
|
19
|
+
.network-error {
|
|
20
|
+
position: absolute;
|
|
21
|
+
z-index: 1000;
|
|
22
|
+
top: 0;
|
|
23
|
+
width: 100vw;
|
|
24
|
+
background-color: rgba(255, 0, 0, 0.1);
|
|
25
|
+
font-size: 10px;
|
|
26
|
+
display: flex;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
align-items: center;
|
|
29
|
+
height: 25px;
|
|
30
|
+
color: #3c3c3c;
|
|
31
|
+
}
|
|
32
|
+
</style>
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<view @click="clickHandler">
|
|
2
|
+
<oa-vconsole v-if="showLog" />
|
|
3
|
+
<view class="oa-page" @click="clickHandler">
|
|
4
|
+
<NetworkError />
|
|
4
5
|
<slot />
|
|
5
6
|
</view>
|
|
6
7
|
</template>
|
|
7
8
|
<script lang="ts" setup>
|
|
8
|
-
import
|
|
9
|
+
import { ref } from 'vue';
|
|
10
|
+
import OaVconsole from '../oa-vconsole/oa-vconsole.vue';
|
|
11
|
+
import NetworkError from './nextwork-error.vue';
|
|
12
|
+
const whiteUrls = [
|
|
13
|
+
'http://192.168.11.231:6174',
|
|
14
|
+
'http://192.168.10.11:6174',
|
|
15
|
+
'http://dev-oa.ge.cn:6174',
|
|
16
|
+
'http://test-oa.ge.cn:6174',
|
|
17
|
+
];
|
|
18
|
+
const baseUrl = uni.getStorageSync('baseUrl');
|
|
19
|
+
/** 如果在debug状态,或者是在白名单里面,则展示vconsole */
|
|
20
|
+
const showLog = ref(whiteUrls.some((url) => url.includes(baseUrl)) || !!uni.getStorageSync('isDebug'));
|
|
9
21
|
let isLock = false;
|
|
10
22
|
setTimeout(function () {
|
|
11
23
|
isLock = true;
|
|
@@ -22,7 +34,7 @@
|
|
|
22
34
|
if (clickCount === count) {
|
|
23
35
|
secretArray.push(count);
|
|
24
36
|
if (secretArray.join('') === secret) {
|
|
25
|
-
|
|
37
|
+
showLog.value = true;
|
|
26
38
|
}
|
|
27
39
|
} else {
|
|
28
40
|
clickCount = 0;
|
|
@@ -40,3 +52,9 @@
|
|
|
40
52
|
});
|
|
41
53
|
};
|
|
42
54
|
</script>
|
|
55
|
+
|
|
56
|
+
<style lang="scss" scoped>
|
|
57
|
+
.oa-page {
|
|
58
|
+
position: relative;
|
|
59
|
+
}
|
|
60
|
+
</style>
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
<view class="search-box-item">
|
|
11
11
|
<picker-view :indicator-style="indicatorStyle" :value="indexList" @change="bindChange" class="picker-view">
|
|
12
12
|
<picker-view-column>
|
|
13
|
-
<
|
|
13
|
+
<slot :columns="columns">
|
|
14
|
+
<view class="item" v-for="(item, index) in columns" :key="index">{{ item[labelKey ?? 'label'] }}</view>
|
|
15
|
+
</slot>
|
|
14
16
|
</picker-view-column>
|
|
15
17
|
</picker-view>
|
|
16
18
|
</view>
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<rich-text
|
|
3
|
+
:nodes="formatJson(log)"
|
|
4
|
+
:selectable="true"
|
|
5
|
+
style="font-size: 10px; word-break: break-all; white-space: pre-wrap"
|
|
6
|
+
></rich-text>
|
|
3
7
|
</template>
|
|
4
8
|
|
|
5
|
-
<script lang="ts" setup
|
|
6
|
-
|
|
9
|
+
<script lang="ts" setup>
|
|
10
|
+
import { formatJson } from './utils';
|
|
11
|
+
defineProps({
|
|
12
|
+
log: {
|
|
13
|
+
type: [Object, String, Boolean, Number, Array],
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
</script>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<script lang="ts" setup>
|
|
11
11
|
import { onBeforeUnmount, ref } from 'vue';
|
|
12
12
|
import { consoleSubject, getConsoleLogs } from 'uniapp-log-sdk';
|
|
13
|
-
const logConvert = (items) =>
|
|
13
|
+
const logConvert = (items: any[]) =>
|
|
14
14
|
items.reduce((prev, current, index) => {
|
|
15
15
|
try {
|
|
16
16
|
prev +=
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
2
|
+
<uni-collapse>
|
|
3
|
+
<uni-collapse-item v-for="log in nativeEventLogs" :title="getTitle(log)" :key="log.key">
|
|
4
4
|
<view style="font-size: 10px">
|
|
5
|
-
<view style="word-break: break-all">
|
|
6
|
-
<text style="font-weight: bolder">发送数据:</text>
|
|
7
|
-
|
|
5
|
+
<view style="word-break: break-all; padding: 0 15px">
|
|
6
|
+
<text :selectable="true" style="font-weight: bolder">发送数据:</text>
|
|
7
|
+
<awesome-display-info :log="log.params" />
|
|
8
8
|
</view>
|
|
9
|
-
<view style="word-break: break-all">
|
|
10
|
-
<text style="font-weight: bolder">接收数据:</text>
|
|
11
|
-
|
|
9
|
+
<view style="word-break: break-all; padding: 0 15px">
|
|
10
|
+
<text :selectable="true" style="font-weight: bolder">接收数据:</text>
|
|
11
|
+
<awesome-display-info :log="log.response" />
|
|
12
12
|
</view>
|
|
13
13
|
</view>
|
|
14
|
-
</
|
|
15
|
-
</
|
|
14
|
+
</uni-collapse-item>
|
|
15
|
+
</uni-collapse>
|
|
16
16
|
</template>
|
|
17
17
|
<script lang="ts" setup>
|
|
18
18
|
import { ref, onBeforeUnmount } from 'vue';
|
|
19
|
+
import awesomeDisplayInfo from './awesome-display-info.vue';
|
|
19
20
|
import { nativeEventSubject, getNativeEventLogs } from 'uniapp-log-sdk';
|
|
20
21
|
const nativeEventLogs = ref<Record<string, any>[]>(getNativeEventLogs());
|
|
21
22
|
const stop = nativeEventSubject.subscribe((data) => {
|
|
@@ -34,12 +35,18 @@
|
|
|
34
35
|
</script>
|
|
35
36
|
|
|
36
37
|
<style lang="scss" scoped>
|
|
37
|
-
.
|
|
38
|
+
.uni-collapse-content {
|
|
38
39
|
font-size: 12px;
|
|
39
40
|
}
|
|
40
41
|
::v-deep {
|
|
41
|
-
.
|
|
42
|
+
.uni-collapse-item__title-text {
|
|
43
|
+
white-space: normal !important; /* 允许文本换行 */
|
|
44
|
+
overflow: visible !important; /* 显示溢出的文本 */
|
|
45
|
+
text-overflow: clip !important; /* 不显示省略标记(...) */
|
|
46
|
+
line-height: normal !important; /* 重置行高 */
|
|
47
|
+
word-break: break-all !important; /* 允许单词内换行 */
|
|
42
48
|
font-size: 10px;
|
|
49
|
+
font-weight: normal;
|
|
43
50
|
}
|
|
44
51
|
}
|
|
45
52
|
</style>
|
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
2
|
+
<uni-collapse>
|
|
3
|
+
<uni-collapse-item
|
|
4
4
|
v-for="log in networkLogs"
|
|
5
5
|
:title="getTitle(log)"
|
|
6
6
|
:key="log.request.url + log.response?.data?.errno"
|
|
7
|
-
:class="{ '
|
|
7
|
+
:class="{ 'uni-collapse-item-failed': log.response?.statusCode !== 200 || log.response?.data?.errno !== 0 }"
|
|
8
8
|
>
|
|
9
9
|
<view style="font-size: 10px">
|
|
10
|
-
<view style="word-break: break-all">
|
|
11
|
-
<text style="font-weight: bolder">状态码:</text>
|
|
10
|
+
<view style="word-break: break-all; padding: 0 15px">
|
|
11
|
+
<text :selectable="true" style="font-weight: bolder">状态码:</text>
|
|
12
12
|
{{ log.request.method }} {{ log.response?.statusCode }}
|
|
13
13
|
</view>
|
|
14
|
-
<view style="word-break: break-all">
|
|
15
|
-
<text style="font-weight: bolder">请求头:</text>
|
|
16
|
-
|
|
14
|
+
<view style="word-break: break-all; padding: 0 15px">
|
|
15
|
+
<text :selectable="true" style="font-weight: bolder">请求头:</text>
|
|
16
|
+
<awesome-display-info :log="log.request.header" />
|
|
17
17
|
</view>
|
|
18
|
-
<view style="word-break: break-all">
|
|
19
|
-
<text style="font-weight: bolder">请求参数:</text>
|
|
20
|
-
|
|
18
|
+
<view style="word-break: break-all; padding: 0 15px">
|
|
19
|
+
<text :selectable="true" style="font-weight: bolder">请求参数:</text>
|
|
20
|
+
<awesome-display-info :log="log.request.data" />
|
|
21
21
|
</view>
|
|
22
|
-
<view style="word-break: break-all">
|
|
23
|
-
<text style="font-weight: bolder">响应数据:</text>
|
|
24
|
-
|
|
22
|
+
<view style="word-break: break-all; padding: 0 15px">
|
|
23
|
+
<text :selectable="true" style="font-weight: bolder">响应数据:</text>
|
|
24
|
+
<awesome-display-info :log="log.response" />
|
|
25
25
|
</view>
|
|
26
26
|
</view>
|
|
27
|
-
</
|
|
28
|
-
</
|
|
27
|
+
</uni-collapse-item>
|
|
28
|
+
</uni-collapse>
|
|
29
29
|
</template>
|
|
30
30
|
|
|
31
31
|
<script lang="ts" setup>
|
|
32
32
|
import { ref, onBeforeUnmount } from 'vue';
|
|
33
|
+
import awesomeDisplayInfo from './awesome-display-info.vue';
|
|
33
34
|
import { networkSubject, getNetworkLogs } from 'uniapp-log-sdk';
|
|
34
|
-
const networkLogs = ref<{ request: any; response: any; startTime; endTime }[]>(getNetworkLogs());
|
|
35
|
+
const networkLogs = ref<{ request: any; response: any; startTime: number; endTime: number }[]>(getNetworkLogs());
|
|
35
36
|
const stop = networkSubject.subscribe((data) => {
|
|
36
37
|
networkLogs.value = data;
|
|
37
38
|
});
|
|
@@ -48,15 +49,21 @@
|
|
|
48
49
|
</script>
|
|
49
50
|
|
|
50
51
|
<style lang="scss" scoped>
|
|
51
|
-
.
|
|
52
|
+
.uni-collapse-content {
|
|
52
53
|
font-size: 12px;
|
|
53
54
|
}
|
|
54
55
|
::v-deep {
|
|
55
|
-
.
|
|
56
|
+
.uni-collapse-item__title-text {
|
|
57
|
+
white-space: normal !important; /* 允许文本换行 */
|
|
58
|
+
overflow: visible !important; /* 显示溢出的文本 */
|
|
59
|
+
text-overflow: clip !important; /* 不显示省略标记(...) */
|
|
60
|
+
line-height: normal !important; /* 重置行高 */
|
|
61
|
+
word-break: break-all !important; /* 允许单词内换行 */
|
|
56
62
|
font-size: 10px;
|
|
63
|
+
font-weight: normal;
|
|
57
64
|
}
|
|
58
|
-
.
|
|
59
|
-
.
|
|
65
|
+
.uni-collapse-item-failed {
|
|
66
|
+
.uni-collapse-item__title-text {
|
|
60
67
|
color: red !important;
|
|
61
68
|
}
|
|
62
69
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<view style="height:
|
|
4
|
-
<
|
|
2
|
+
<uni-popup ref="popupRef" background-color="#fff">
|
|
3
|
+
<view style="height: 500px; background-color: white; width: 100vw">
|
|
4
|
+
<uni-segmented-control
|
|
5
|
+
styleType="text"
|
|
6
|
+
:values="list"
|
|
7
|
+
:current="current"
|
|
8
|
+
@clickItem="(e:any) => (current = e.currentIndex)"
|
|
9
|
+
></uni-segmented-control>
|
|
5
10
|
<view style="height: calc(100% - 48px); overflow-y: auto; padding: 8px">
|
|
6
11
|
<template v-if="current === 0">
|
|
7
12
|
<Console />
|
|
@@ -23,9 +28,8 @@
|
|
|
23
28
|
</template>
|
|
24
29
|
</view>
|
|
25
30
|
</view>
|
|
26
|
-
</
|
|
31
|
+
</uni-popup>
|
|
27
32
|
<view
|
|
28
|
-
v-if="isShowDebugButton"
|
|
29
33
|
@click="openDebug"
|
|
30
34
|
class="debug-button"
|
|
31
35
|
:style="{
|
|
@@ -35,7 +39,7 @@
|
|
|
35
39
|
@touchstart="start"
|
|
36
40
|
@touchmove="move"
|
|
37
41
|
>
|
|
38
|
-
<image style="width:
|
|
42
|
+
<image style="width: 20px; height: 20px" src="../../imgs/debug.svg" />
|
|
39
43
|
</view>
|
|
40
44
|
</template>
|
|
41
45
|
|
|
@@ -47,32 +51,21 @@
|
|
|
47
51
|
import Storage from './storage.vue';
|
|
48
52
|
import Console from './console.vue';
|
|
49
53
|
import System from './system.vue';
|
|
50
|
-
const
|
|
51
|
-
'http://192.168.11.231:6174',
|
|
52
|
-
'http://192.168.10.11:6174',
|
|
53
|
-
'http://dev-oa.ge.cn:6174',
|
|
54
|
-
'http://test-oa.ge.cn:6174',
|
|
55
|
-
];
|
|
56
|
-
const show = ref(false);
|
|
57
|
-
const baseUrl = uni.getStorageSync('baseUrl');
|
|
58
|
-
const isShowDebugButton = ref(whiteUrls.some((url) => url.includes(baseUrl)) || !!uni.getStorageSync('isDebug'));
|
|
54
|
+
const popupRef = ref();
|
|
59
55
|
const list = ref(['console', 'network', 'event', 'error', 'storage', 'system']);
|
|
60
56
|
const current = ref(0);
|
|
61
57
|
const openDebug = () => {
|
|
62
|
-
|
|
58
|
+
popupRef.value?.open('bottom');
|
|
63
59
|
};
|
|
64
|
-
uni.$once('show-debug-button', () => {
|
|
65
|
-
isShowDebugButton.value = true;
|
|
66
|
-
});
|
|
67
60
|
const bottom = ref(200);
|
|
68
61
|
const right = ref(10);
|
|
69
|
-
let pageX, pageY;
|
|
70
|
-
const start = (e) => {
|
|
62
|
+
let pageX: number, pageY: number;
|
|
63
|
+
const start = (e: any) => {
|
|
71
64
|
let page = e.changedTouches[0];
|
|
72
65
|
pageX = page.pageX;
|
|
73
66
|
pageY = page.pageY;
|
|
74
67
|
};
|
|
75
|
-
const move = (e) => {
|
|
68
|
+
const move = (e: any) => {
|
|
76
69
|
let page = e.changedTouches[0];
|
|
77
70
|
let x = page.pageX - pageX;
|
|
78
71
|
let y = page.pageY - pageY;
|
|
@@ -85,8 +78,8 @@
|
|
|
85
78
|
|
|
86
79
|
<style lang="scss" scoped>
|
|
87
80
|
.debug-button {
|
|
88
|
-
width:
|
|
89
|
-
height:
|
|
81
|
+
width: 40px;
|
|
82
|
+
height: 40px;
|
|
90
83
|
position: fixed;
|
|
91
84
|
z-index: 1000;
|
|
92
85
|
border-radius: 50%;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
</
|
|
7
|
-
</
|
|
8
|
-
</
|
|
2
|
+
<uni-collapse>
|
|
3
|
+
<uni-collapse-item v-for="log in storageLogs" :title="log.key" :key="log.key">
|
|
4
|
+
<view style="padding: 5px 15px">
|
|
5
|
+
<awesome-display-info :log="log.data" />
|
|
6
|
+
</view>
|
|
7
|
+
</uni-collapse-item>
|
|
8
|
+
</uni-collapse>
|
|
9
9
|
</template>
|
|
10
10
|
<script lang="ts" setup>
|
|
11
11
|
import { ref } from 'vue';
|
|
12
|
+
import awesomeDisplayInfo from './awesome-display-info.vue';
|
|
12
13
|
const storageLogs = ref<Record<string, any>[]>([]);
|
|
13
14
|
uni.getStorageInfo({
|
|
14
15
|
success: function (res) {
|
|
15
16
|
res.keys?.forEach((key) => {
|
|
16
17
|
storageLogs.value.push({
|
|
17
18
|
key,
|
|
18
|
-
data:
|
|
19
|
+
data: uni.getStorageSync(key),
|
|
19
20
|
});
|
|
20
21
|
});
|
|
21
22
|
},
|
|
@@ -23,12 +24,18 @@
|
|
|
23
24
|
</script>
|
|
24
25
|
|
|
25
26
|
<style lang="scss" scoped>
|
|
26
|
-
.
|
|
27
|
+
.uni-collapse-content {
|
|
27
28
|
font-size: 12px;
|
|
28
29
|
}
|
|
29
30
|
::v-deep {
|
|
30
|
-
.
|
|
31
|
+
.uni-collapse-item__title-text {
|
|
32
|
+
white-space: normal !important; /* 允许文本换行 */
|
|
33
|
+
overflow: visible !important; /* 显示溢出的文本 */
|
|
34
|
+
text-overflow: clip !important; /* 不显示省略标记(...) */
|
|
35
|
+
line-height: normal !important; /* 重置行高 */
|
|
36
|
+
word-break: break-all !important; /* 允许单词内换行 */
|
|
31
37
|
font-size: 10px;
|
|
38
|
+
font-weight: normal;
|
|
32
39
|
}
|
|
33
40
|
}
|
|
34
41
|
</style>
|
|
@@ -1,41 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
1
|
+
export const formatJson = (data: any, indent = 0) => {
|
|
2
|
+
const indentStr = ' '.repeat(indent);
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
type
|
|
8
|
-
|
|
9
|
-
export function formatJson(obj: JsonValue, indent: string = ''): string {
|
|
10
|
-
let output = '';
|
|
11
|
-
|
|
12
|
-
if (Array.isArray(obj)) {
|
|
13
|
-
output += '[\n';
|
|
14
|
-
const lastIndex = obj.length - 1;
|
|
15
|
-
|
|
16
|
-
obj.forEach((value, index) => {
|
|
17
|
-
const isLast = index === lastIndex;
|
|
18
|
-
const formattedValue = formatJson(value, indent + ' ');
|
|
19
|
-
output += `${indent} ${formattedValue}${isLast ? '' : ','}\n`;
|
|
20
|
-
});
|
|
4
|
+
// 防止死循环,限制最大递归深度
|
|
5
|
+
if (indent > 100) {
|
|
6
|
+
return [{ type: 'text', text: 'Error: Maximum recursion depth exceeded.' }];
|
|
7
|
+
}
|
|
21
8
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
9
|
+
if (Array.isArray(data)) {
|
|
10
|
+
return formatArray(data, indent, indentStr);
|
|
11
|
+
} else if (typeof data === 'object' && data !== null) {
|
|
12
|
+
return formatObject(data, indent, indentStr);
|
|
13
|
+
} else {
|
|
14
|
+
return formatPrimitive(data);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
27
17
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
output += `${indent} "${key}": ${formattedValue}${isLast ? '' : ','}\n`;
|
|
33
|
-
});
|
|
18
|
+
const formatArray = (data: any[], indent: number, indentStr: string) => {
|
|
19
|
+
if (data.length === 0) {
|
|
20
|
+
return [{ type: 'text', text: '[]' }];
|
|
21
|
+
}
|
|
34
22
|
|
|
35
|
-
|
|
23
|
+
let formatted = [{ type: 'text', text: '[\n' }];
|
|
24
|
+
data.forEach((item, index) => {
|
|
25
|
+
formatted.push({ type: 'text', text: indentStr + ' '.repeat(2) });
|
|
26
|
+
formatted.push(...formatJson(item, indent + 2));
|
|
27
|
+
if (index < data.length - 1) {
|
|
28
|
+
formatted.push({ type: 'text', text: ',\n' });
|
|
29
|
+
} else {
|
|
30
|
+
formatted.push({ type: 'text', text: '\n' });
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
formatted.push({ type: 'text', text: indentStr + ']' });
|
|
34
|
+
|
|
35
|
+
return formatted;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const formatObject = (data: Record<string, any>, indent: number, indentStr: string) => {
|
|
39
|
+
let formatted = [{ type: 'text', text: '{\n' }];
|
|
40
|
+
const keys = Object.keys(data);
|
|
41
|
+
keys.forEach((key, index) => {
|
|
42
|
+
formatted.push({ type: 'text', text: indentStr + ' '.repeat(2) + key + ': ' });
|
|
43
|
+
formatted.push(...formatJson(data[key], indent + 2));
|
|
44
|
+
if (index < keys.length - 1) {
|
|
45
|
+
formatted.push({ type: 'text', text: ',\n' });
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
formatted.push({ type: 'text', text: '\n' + indentStr + '}' });
|
|
49
|
+
|
|
50
|
+
return formatted;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const formatPrimitive = (data: any) => {
|
|
54
|
+
if (typeof data === 'string') {
|
|
55
|
+
return [{ type: 'text', text: `"${data}"` }];
|
|
36
56
|
} else {
|
|
37
|
-
|
|
57
|
+
return [{ type: 'text', text: String(data) }];
|
|
38
58
|
}
|
|
39
|
-
|
|
40
|
-
return output;
|
|
41
|
-
}
|
|
59
|
+
};
|
package/imgs/warn.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1686388435978" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2392" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 992C246.912 992 32 777.088 32 512 32 246.912 246.912 32 512 32c265.088 0 480 214.912 480 480 0 265.088-214.912 480-480 480zM480 256v352a32 32 0 0 0 64 0V256a32 32 0 0 0-64 0z m-16 528a48 48 0 1 0 96 0 48 48 0 0 0-96 0z" p-id="2393" fill="red"></path></svg>
|