vite-uni-dev-tool 0.0.48 → 1.0.0
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/README.md +20 -0
- package/dist/const.cjs +1 -0
- package/dist/const.d.ts +78 -161
- package/dist/const.d.ts.map +1 -1
- package/dist/const.js +1 -47
- package/dist/core-shared.d.ts +44 -0
- package/dist/core-shared.d.ts.map +1 -0
- package/dist/core-shared.js +1 -0
- package/dist/core.d.ts +2 -40
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +4 -159
- package/dist/i18n/index.cjs +1 -0
- package/dist/i18n/index.d.ts +9 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +1 -0
- package/dist/i18n/instance.cjs +1 -0
- package/dist/i18n/instance.d.ts +15 -0
- package/dist/i18n/instance.d.ts.map +1 -0
- package/dist/i18n/instance.js +1 -0
- package/dist/i18n/locales/en.cjs +1 -0
- package/dist/i18n/locales/en.d.ts +470 -0
- package/dist/i18n/locales/en.d.ts.map +1 -0
- package/dist/i18n/locales/en.js +1 -0
- package/dist/i18n/locales/zh-Hans.cjs +1 -0
- package/dist/i18n/locales/zh-Hans.d.ts +476 -0
- package/dist/i18n/locales/zh-Hans.d.ts.map +1 -0
- package/dist/i18n/locales/zh-Hans.js +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/modules/devConsole/index.cjs +4 -0
- package/dist/{devConsole → modules/devConsole}/index.d.ts +1 -1
- package/dist/modules/devConsole/index.d.ts.map +1 -0
- package/dist/modules/devConsole/index.js +4 -0
- package/dist/modules/devEvent/index.cjs +5 -0
- package/dist/modules/devEvent/index.d.ts +115 -0
- package/dist/modules/devEvent/index.d.ts.map +1 -0
- package/dist/modules/devEvent/index.js +5 -0
- package/dist/modules/devIntercept/index.cjs +13 -0
- package/dist/modules/devIntercept/index.d.ts +71 -0
- package/dist/modules/devIntercept/index.d.ts.map +1 -0
- package/dist/modules/devIntercept/index.js +13 -0
- package/dist/modules/devStore/index.cjs +1 -0
- package/dist/modules/devStore/index.d.ts +159 -0
- package/dist/modules/devStore/index.d.ts.map +1 -0
- package/dist/modules/devStore/index.js +1 -0
- package/dist/modules/devToolInfo/index.cjs +1 -0
- package/dist/modules/devToolInfo/index.d.ts +27 -0
- package/dist/modules/devToolInfo/index.d.ts.map +1 -0
- package/dist/modules/devToolInfo/index.js +1 -0
- package/dist/plugins/uniDevTool/transform/transformApp.cjs +44 -0
- package/dist/plugins/uniDevTool/transform/transformApp.d.ts.map +1 -1
- package/dist/plugins/uniDevTool/transform/transformApp.js +17 -17
- package/dist/plugins/uniDevTool/transform/transformMain.cjs +3 -0
- package/dist/plugins/uniDevTool/transform/transformMain.d.ts.map +1 -1
- package/dist/plugins/uniDevTool/transform/transformMain.js +3 -3
- package/dist/plugins/uniDevTool/transform/transformVue.cjs +41 -0
- package/dist/plugins/uniDevTool/transform/transformVue.d.ts +1 -2
- package/dist/plugins/uniDevTool/transform/transformVue.d.ts.map +1 -1
- package/dist/plugins/uniDevTool/transform/transformVue.js +32 -19
- package/dist/plugins/uniDevTool/uniDevTool.cjs +5 -0
- package/dist/plugins/uniDevTool/uniDevTool.d.ts +3 -11
- package/dist/plugins/uniDevTool/uniDevTool.d.ts.map +1 -1
- package/dist/plugins/uniDevTool/uniDevTool.js +3 -3
- package/dist/plugins/uniGlobalComponents/uniGlobalComponents.cjs +19 -0
- package/dist/plugins/uniGlobalComponents/uniGlobalComponents.d.ts.map +1 -1
- package/dist/plugins/uniGlobalComponents/uniGlobalComponents.js +11 -19
- package/dist/plugins/uniParseStock/index.d.ts +10 -0
- package/dist/plugins/uniParseStock/index.d.ts.map +1 -0
- package/dist/plugins/utils/index.cjs +2 -0
- package/dist/plugins/utils/index.d.ts +1 -3
- package/dist/plugins/utils/index.d.ts.map +1 -1
- package/dist/plugins/utils/index.js +2 -2
- package/dist/shims-uni.d.ts +140 -0
- package/dist/type.d.ts +174 -16
- package/dist/type.d.ts.map +1 -1
- package/dist/utils/array.cjs +1 -0
- package/dist/utils/array.d.ts.map +1 -1
- package/dist/utils/array.js +1 -12
- package/dist/utils/date.cjs +1 -0
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/date.js +1 -59
- package/dist/utils/file.cjs +1 -0
- package/dist/utils/file.d.ts.map +1 -1
- package/dist/utils/file.js +1 -85
- package/dist/utils/function.cjs +1 -0
- package/dist/utils/function.d.ts +13 -0
- package/dist/utils/function.d.ts.map +1 -1
- package/dist/utils/function.js +1 -68
- package/dist/utils/index.cjs +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -63
- package/dist/utils/ip.cjs +1 -0
- package/dist/utils/ip.d.ts +1 -1
- package/dist/utils/ip.d.ts.map +1 -1
- package/dist/utils/ip.js +1 -45
- package/dist/utils/language.cjs +1 -0
- package/dist/utils/language.d.ts +2 -1
- package/dist/utils/language.d.ts.map +1 -1
- package/dist/utils/language.js +1 -63
- package/dist/utils/object.cjs +1 -0
- package/dist/utils/object.d.ts +4 -5
- package/dist/utils/object.d.ts.map +1 -1
- package/dist/utils/object.js +1 -136
- package/dist/utils/openLink.cjs +1 -0
- package/dist/utils/openLink.d.ts.map +1 -1
- package/dist/utils/openLink.js +1 -28
- package/dist/utils/page.cjs +1 -0
- package/dist/utils/page.d.ts.map +1 -1
- package/dist/utils/page.js +1 -7
- package/dist/utils/platform.cjs +1 -0
- package/dist/utils/platform.d.ts.map +1 -1
- package/dist/utils/platform.js +1 -17
- package/dist/utils/string.cjs +1 -0
- package/dist/utils/string.d.ts.map +1 -1
- package/dist/utils/string.js +1 -114
- package/dist/utils/utils.cjs +1 -0
- package/dist/utils/utils.d.ts +1 -1
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +1 -126
- package/dist/v3/AppTransition/index.vue +170 -0
- package/dist/v3/AutoSizer/index.vue +4 -5
- package/dist/v3/AutoSizer/index1.vue +4 -6
- package/dist/v3/AutoSizer/utils.ts +1 -1
- package/dist/v3/CaptureScreen/index.vue +19 -8
- package/dist/v3/CircularButton/index.vue +64 -13
- package/dist/v3/ConsoleList/ConsoleItem.vue +56 -5
- package/dist/v3/ConsoleList/RunJSInput.vue +10 -6
- package/dist/v3/ConsoleList/index.vue +51 -35
- package/dist/v3/CustomSwiper/CustomSwiperItem.vue +49 -0
- package/dist/v3/CustomSwiper/index.vue +104 -0
- package/dist/v3/DevTool/fps-collector.render.ts +148 -0
- package/dist/v3/DevTool/index.vue +209 -102
- package/dist/v3/DevToolButton/index.vue +40 -59
- package/dist/v3/DevToolTitle/index.vue +4 -1
- package/dist/v3/DevToolWindow/DevToolOverlay.vue +182 -0
- package/dist/v3/DevToolWindow/const.ts +47 -69
- package/dist/v3/DevToolWindow/hooks/dataUtils.ts +48 -0
- package/dist/v3/DevToolWindow/hooks/useDevToolData.ts +338 -0
- package/dist/v3/DevToolWindow/hooks/useDevToolHandlers.ts +549 -0
- package/dist/v3/DevToolWindow/hooks/useDevToolOverlay.ts +184 -0
- package/dist/v3/DevToolWindow/index.css +89 -0
- package/dist/v3/DevToolWindow/index.vue +800 -1450
- package/dist/v3/DraggableContainer/index.vue +456 -0
- package/dist/v3/ElEvent/ElEventItem.vue +4 -3
- package/dist/v3/ElEvent/index.vue +26 -9
- package/dist/v3/Empty/index.vue +1 -0
- package/dist/v3/FilterInput/index.vue +8 -22
- package/dist/v3/FilterSelect/index.vue +37 -24
- package/dist/v3/Instance/components/InstanceTreeNode.vue +265 -0
- package/dist/v3/Instance/flatten.ts +226 -0
- package/dist/v3/Instance/index.vue +94 -0
- package/dist/v3/Instance/registry.ts +49 -0
- package/dist/v3/Instance/transformTree.ts +375 -0
- package/dist/v3/Instance/transformTreeCtx.ts +268 -0
- package/dist/v3/{InstanceTree → Instance}/typing.d.ts +15 -2
- package/dist/v3/InstanceDetail/index.vue +433 -44
- package/dist/v3/JsonDetail/index.vue +12 -8
- package/dist/v3/JsonPretty/components/Brackets/index.vue +1 -0
- package/dist/v3/JsonPretty/components/Carets/index.vue +2 -1
- package/dist/v3/JsonPretty/components/CheckController/index.vue +26 -15
- package/dist/v3/JsonPretty/components/TreeNode/index.vue +42 -20
- package/dist/v3/JsonPretty/index.vue +60 -37
- package/dist/v3/JsonPretty/utils/index.ts +41 -44
- package/dist/v3/MovableContainer/index.vue +89 -0
- package/dist/v3/NFCList/NFCItem.vue +14 -14
- package/dist/v3/NFCList/NFCTool.vue +99 -81
- package/dist/v3/NFCList/index.vue +14 -10
- package/dist/v3/NetworkList/InterceptConfig.vue +154 -364
- package/dist/v3/NetworkList/InterceptItem.vue +14 -6
- package/dist/v3/NetworkList/NetworkDetail.vue +34 -29
- package/dist/v3/NetworkList/NetworkIntercept.vue +11 -8
- package/dist/v3/NetworkList/NetworkItem.vue +27 -11
- package/dist/v3/NetworkList/NetworkSend.vue +132 -290
- package/dist/v3/NetworkList/hooks/useNetworkForm.ts +86 -0
- package/dist/v3/NetworkList/index.vue +32 -24
- package/dist/v3/NetworkList/utils.ts +101 -0
- package/dist/v3/Performance/index.vue +495 -0
- package/dist/v3/Performance/modules/PerformanceMetrics.vue +153 -0
- package/dist/v3/Performance/modules/PerformanceWidget.vue +249 -0
- package/dist/v3/Performance/modules/usePerformanceChart.ts +460 -0
- package/dist/v3/Performance/modules/usePerformanceData.ts +258 -0
- package/dist/v3/Pick/index.vue +322 -0
- package/dist/v3/PiniaList/index.vue +38 -17
- package/dist/v3/RouteList/index.vue +32 -15
- package/dist/v3/RunJS/index.vue +30 -10
- package/dist/v3/ScanCodeList/ScanCodeItem.vue +2 -9
- package/dist/v3/ScanCodeList/index.vue +12 -9
- package/dist/v3/SettingButton/index.vue +45 -0
- package/dist/v3/SettingList/index.css +120 -0
- package/dist/v3/SettingList/index.vue +96 -537
- package/dist/v3/SettingList/modules/SettingDevTool.vue +208 -0
- package/dist/v3/SettingList/modules/SettingInfo.vue +119 -0
- package/dist/v3/SettingList/modules/SettingLanguage.vue +74 -0
- package/dist/v3/SettingList/modules/SettingLog.vue +230 -0
- package/dist/v3/SettingList/modules/SettingNetwork.vue +120 -0
- package/dist/v3/SettingList/modules/SettingTheme.vue +312 -0
- package/dist/v3/SourceCode/Line.vue +15 -2
- package/dist/v3/SourceCode/index.vue +25 -24
- package/dist/v3/SourceCode/parseCode.ts +114 -56
- package/dist/v3/StorageList/index.vue +33 -33
- package/dist/v3/Tabs/index.vue +31 -28
- package/dist/v3/Tag/index.vue +39 -20
- package/dist/v3/TransferList/TransferDetail.vue +268 -0
- package/dist/v3/TransferList/TransferItem.vue +125 -0
- package/dist/v3/TransferList/index.vue +181 -0
- package/dist/v3/UniEvent/UniEventItem.vue +1 -0
- package/dist/v3/UniEvent/index.vue +28 -29
- package/dist/v3/{VirtualListPro → VirtualList}/AutoSize.vue +1 -1
- package/dist/v3/VirtualList/index.vue +382 -82
- package/dist/v3/VuexList/index.vue +38 -17
- package/dist/v3/WebSocket/WebSocketDetail.vue +142 -80
- package/dist/v3/WebSocket/WebSocketItem.vue +10 -4
- package/dist/v3/WebSocket/index.vue +44 -30
- package/dist/v3/hooks/useNFC/index.ts +6 -6
- package/dist/v3/hooks/useNFC/typing.d.ts +2 -2
- package/dist/v3/hooks/useNFC/useNFCAndroid.ts +215 -626
- package/dist/v3/hooks/useNFC/useNFCMpWeiXin.ts +54 -85
- package/dist/v3/hooks/useNFC/utils.ts +3 -3
- package/dist/v3/hooks/useRequest/index.ts +2 -2
- package/dist/v3/hooks/useScanCode/index.ts +10 -8
- package/dist/v3/styles/theme.css +290 -0
- package/dist/v3/styles/theme.ts +12 -0
- package/package.json +25 -5
- package/dist/devConsole/index.d.ts.map +0 -1
- package/dist/devConsole/index.js +0 -273
- package/dist/devEvent/index.d.ts +0 -328
- package/dist/devEvent/index.d.ts.map +0 -1
- package/dist/devEvent/index.js +0 -697
- package/dist/devEventBus/index.d.ts +0 -42
- package/dist/devEventBus/index.d.ts.map +0 -1
- package/dist/devEventBus/index.js +0 -70
- package/dist/devIntercept/index.d.ts +0 -281
- package/dist/devIntercept/index.d.ts.map +0 -1
- package/dist/devIntercept/index.js +0 -949
- package/dist/devRunJS/index.d.ts +0 -67
- package/dist/devRunJS/index.d.ts.map +0 -1
- package/dist/devStore/index.d.ts +0 -199
- package/dist/devStore/index.d.ts.map +0 -1
- package/dist/devStore/index.js +0 -562
- package/dist/devToolInfo/index.d.ts +0 -17
- package/dist/devToolInfo/index.d.ts.map +0 -1
- package/dist/devToolInfo/index.js +0 -15
- package/dist/v3/AutoSizer/utils.d.ts +0 -5
- package/dist/v3/AutoSizer/utils.d.ts.map +0 -1
- package/dist/v3/ConsoleList/staticTips.d.ts +0 -13
- package/dist/v3/ConsoleList/staticTips.d.ts.map +0 -1
- package/dist/v3/DevToolWindow/const.d.ts +0 -46
- package/dist/v3/DevToolWindow/const.d.ts.map +0 -1
- package/dist/v3/InstanceTree/components/InstanceTreeNode.vue +0 -81
- package/dist/v3/InstanceTree/flatten.d.ts +0 -10
- package/dist/v3/InstanceTree/flatten.d.ts.map +0 -1
- package/dist/v3/InstanceTree/flatten.ts +0 -75
- package/dist/v3/InstanceTree/index.vue +0 -51
- package/dist/v3/InstanceTree/transformTree.d.ts +0 -17
- package/dist/v3/InstanceTree/transformTree.d.ts.map +0 -1
- package/dist/v3/InstanceTree/transformTree.ts +0 -237
- package/dist/v3/JsonPretty/hooks/useClipboard.d.ts +0 -4
- package/dist/v3/JsonPretty/hooks/useClipboard.d.ts.map +0 -1
- package/dist/v3/JsonPretty/hooks/useError.d.ts +0 -8
- package/dist/v3/JsonPretty/hooks/useError.d.ts.map +0 -1
- package/dist/v3/JsonPretty/type.d.ts +0 -94
- package/dist/v3/JsonPretty/type.d.ts.map +0 -1
- package/dist/v3/JsonPretty/utils/index.d.ts +0 -10
- package/dist/v3/JsonPretty/utils/index.d.ts.map +0 -1
- package/dist/v3/NFCList/const.d.ts +0 -13
- package/dist/v3/NFCList/const.d.ts.map +0 -1
- package/dist/v3/NetworkList/const.d.ts +0 -5
- package/dist/v3/NetworkList/const.d.ts.map +0 -1
- package/dist/v3/SourceCode/parseCode.d.ts +0 -27
- package/dist/v3/SourceCode/parseCode.d.ts.map +0 -1
- package/dist/v3/UploadList/UploadDetail.vue +0 -255
- package/dist/v3/UploadList/UploadItem.vue +0 -122
- package/dist/v3/UploadList/index.vue +0 -125
- package/dist/v3/VirtualListPro/index.vue +0 -229
- package/dist/v3/hooks/useContainerStyle.d.ts +0 -15
- package/dist/v3/hooks/useContainerStyle.d.ts.map +0 -1
- package/dist/v3/hooks/useNFC/index.d.ts +0 -5
- package/dist/v3/hooks/useNFC/index.d.ts.map +0 -1
- package/dist/v3/hooks/useNFC/useNFCAndroid.d.ts +0 -2
- package/dist/v3/hooks/useNFC/useNFCAndroid.d.ts.map +0 -1
- package/dist/v3/hooks/useNFC/useNFCMpWeiXin.d.ts +0 -2
- package/dist/v3/hooks/useNFC/useNFCMpWeiXin.d.ts.map +0 -1
- package/dist/v3/hooks/useNFC/utils.d.ts +0 -95
- package/dist/v3/hooks/useNFC/utils.d.ts.map +0 -1
- package/dist/v3/hooks/useRequest/index.d.ts +0 -126
- package/dist/v3/hooks/useRequest/index.d.ts.map +0 -1
- package/dist/v3/hooks/useRequest/utils.d.ts +0 -35
- package/dist/v3/hooks/useRequest/utils.d.ts.map +0 -1
- package/dist/v3/hooks/useScanCode/index.d.ts +0 -36
- package/dist/v3/hooks/useScanCode/index.d.ts.map +0 -1
- /package/dist/v3/{VirtualListPro → VirtualList}/readme.md +0 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="transfer-detail" :style="customStyle">
|
|
3
|
+
<view class="transfer-detail-control">
|
|
4
|
+
<DevToolTitle style="margin-right: 16px">
|
|
5
|
+
{{ t('transfer.detailTitle') }}
|
|
6
|
+
</DevToolTitle>
|
|
7
|
+
|
|
8
|
+
<Tag
|
|
9
|
+
v-for="item in translatedSelectItems"
|
|
10
|
+
:active="currentSelect === item.value"
|
|
11
|
+
:mode="item.mode"
|
|
12
|
+
:key="item.value"
|
|
13
|
+
@click="onSelect(item)">
|
|
14
|
+
{{ item.label }}
|
|
15
|
+
</Tag>
|
|
16
|
+
|
|
17
|
+
<CircularButton style="margin-left: auto" text="×" @click="onClose" />
|
|
18
|
+
</view>
|
|
19
|
+
|
|
20
|
+
<view
|
|
21
|
+
class="transfer-detail-header"
|
|
22
|
+
:style="{ height: contentHeight - 32 + 'px' }"
|
|
23
|
+
v-if="currentSelect === 'header'">
|
|
24
|
+
<DevToolTitle>{{ t('network.general') }}</DevToolTitle>
|
|
25
|
+
<view class="transfer-detail-item">
|
|
26
|
+
<view class="transfer-detail-item-key">
|
|
27
|
+
{{ t('network.requestUrl') }}:
|
|
28
|
+
</view>
|
|
29
|
+
<view class="transfer-detail-url" @click="onClickUrl">
|
|
30
|
+
{{ item.url }}
|
|
31
|
+
</view>
|
|
32
|
+
</view>
|
|
33
|
+
<view class="transfer-detail-item">
|
|
34
|
+
<view class="transfer-detail-item-key">{{ t('network.method') }}:</view>
|
|
35
|
+
<Tag mode="info">
|
|
36
|
+
{{ type === 'upload' ? ((item as any).method ?? 'POST') : 'GET' }}
|
|
37
|
+
</Tag>
|
|
38
|
+
</view>
|
|
39
|
+
<view class="transfer-detail-item">
|
|
40
|
+
<view class="transfer-detail-item-key">{{ t('common.status') }}:</view>
|
|
41
|
+
<Tag mode="info">{{ t(`common.${item.status}`) }}</Tag>
|
|
42
|
+
</view>
|
|
43
|
+
<view
|
|
44
|
+
class="transfer-detail-item"
|
|
45
|
+
v-if="type === 'download' && (item as any).filePath">
|
|
46
|
+
<view class="transfer-detail-item-key">
|
|
47
|
+
{{ t('download.filePath') }}:
|
|
48
|
+
</view>
|
|
49
|
+
<view>{{ (item as any).filePath }}</view>
|
|
50
|
+
</view>
|
|
51
|
+
|
|
52
|
+
<DevToolTitle>{{ t('network.requestHeaders') }}</DevToolTitle>
|
|
53
|
+
<template
|
|
54
|
+
v-if="
|
|
55
|
+
item?.headers &&
|
|
56
|
+
item?.headers?.requestHeader &&
|
|
57
|
+
item?.headers?.requestHeader?.length > 0
|
|
58
|
+
">
|
|
59
|
+
<view
|
|
60
|
+
class="transfer-detail-item"
|
|
61
|
+
v-for="h in item?.headers?.requestHeader"
|
|
62
|
+
:key="h.key">
|
|
63
|
+
<view class="transfer-detail-item-key">{{ h.key }}:</view>
|
|
64
|
+
{{ h.value }}
|
|
65
|
+
</view>
|
|
66
|
+
</template>
|
|
67
|
+
<Empty v-else />
|
|
68
|
+
</view>
|
|
69
|
+
|
|
70
|
+
<template v-if="currentSelect === 'formdata'">
|
|
71
|
+
<template v-if="formData?.type === 'object'">
|
|
72
|
+
<JsonPretty
|
|
73
|
+
virtual
|
|
74
|
+
:data="formData.value"
|
|
75
|
+
:nodeSelectable="() => false"
|
|
76
|
+
:pathCollapsible="() => false"
|
|
77
|
+
:height="contentHeight - 32" />
|
|
78
|
+
</template>
|
|
79
|
+
<view
|
|
80
|
+
v-else-if="formData?.type === 'string'"
|
|
81
|
+
class="transfer-detail-payload">
|
|
82
|
+
{{ formData.value }}
|
|
83
|
+
</view>
|
|
84
|
+
<Empty v-else />
|
|
85
|
+
</template>
|
|
86
|
+
|
|
87
|
+
<template v-if="currentSelect === 'response'">
|
|
88
|
+
<template v-if="response?.type === 'object'">
|
|
89
|
+
<JsonPretty
|
|
90
|
+
virtual
|
|
91
|
+
:data="response.value"
|
|
92
|
+
:nodeSelectable="() => false"
|
|
93
|
+
:pathCollapsible="() => false"
|
|
94
|
+
:height="contentHeight - 32" />
|
|
95
|
+
</template>
|
|
96
|
+
<view
|
|
97
|
+
v-else-if="response?.type === 'string'"
|
|
98
|
+
class="transfer-detail-payload">
|
|
99
|
+
{{ response.value }}
|
|
100
|
+
</view>
|
|
101
|
+
<Empty v-else />
|
|
102
|
+
</template>
|
|
103
|
+
</view>
|
|
104
|
+
</template>
|
|
105
|
+
<script lang="ts" setup>
|
|
106
|
+
import { ref, computed } from 'vue';
|
|
107
|
+
import JsonPretty from '../JsonPretty/index.vue';
|
|
108
|
+
import Tag from '../Tag/index.vue';
|
|
109
|
+
import Empty from '../Empty/index.vue';
|
|
110
|
+
import CircularButton from '../CircularButton/index.vue';
|
|
111
|
+
import DevToolTitle from '../DevToolTitle/index.vue';
|
|
112
|
+
import type { DevTool } from '../../type';
|
|
113
|
+
import { useI18n } from '../../i18n';
|
|
114
|
+
|
|
115
|
+
const { t } = useI18n();
|
|
116
|
+
const props = defineProps<{
|
|
117
|
+
item: DevTool.TransferItem;
|
|
118
|
+
type: 'upload' | 'download';
|
|
119
|
+
zIndex?: number;
|
|
120
|
+
contentHeight: number;
|
|
121
|
+
customStyle?: Record<string, any>;
|
|
122
|
+
}>();
|
|
123
|
+
const emit = defineEmits<{ (e: 'close'): void }>();
|
|
124
|
+
const translatedSelectItems = computed(() => {
|
|
125
|
+
const items = [
|
|
126
|
+
{
|
|
127
|
+
label: t('common.header'),
|
|
128
|
+
value: 'header',
|
|
129
|
+
mode: 'info',
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
label: t('common.response'),
|
|
133
|
+
value: 'response',
|
|
134
|
+
mode: 'info',
|
|
135
|
+
},
|
|
136
|
+
];
|
|
137
|
+
|
|
138
|
+
if (props.type === 'upload') {
|
|
139
|
+
items.splice(1, 0, {
|
|
140
|
+
label: t('common.formData'),
|
|
141
|
+
value: 'formdata',
|
|
142
|
+
mode: 'info',
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
return items;
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
const currentSelect = ref('header');
|
|
149
|
+
|
|
150
|
+
const formData = computed(() => {
|
|
151
|
+
if (props.type !== 'upload') return { value: {}, type: 'empty' };
|
|
152
|
+
const uploadItem = props.item as DevTool.TransferItem;
|
|
153
|
+
try {
|
|
154
|
+
if (uploadItem.formData) {
|
|
155
|
+
return {
|
|
156
|
+
value: JSON.parse(JSON.stringify(uploadItem.formData)),
|
|
157
|
+
type: 'object',
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
value: {},
|
|
162
|
+
type: 'empty',
|
|
163
|
+
};
|
|
164
|
+
} catch (_error) {
|
|
165
|
+
return {
|
|
166
|
+
value: JSON.parse(JSON.stringify(uploadItem.formData)),
|
|
167
|
+
type: 'object',
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
const response = computed(() => {
|
|
173
|
+
try {
|
|
174
|
+
if (props.item.response) {
|
|
175
|
+
return {
|
|
176
|
+
value: JSON.parse(JSON.stringify(props.item.response)),
|
|
177
|
+
type: 'object',
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
return {
|
|
181
|
+
value: {},
|
|
182
|
+
type: 'empty',
|
|
183
|
+
};
|
|
184
|
+
} catch (_error) {
|
|
185
|
+
return {
|
|
186
|
+
value: props.item.response,
|
|
187
|
+
type: props.item.response ? 'string' : 'empty',
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
function onSelect(item: { label: string; value: string }) {
|
|
193
|
+
currentSelect.value = item.value;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function onClose() {
|
|
197
|
+
emit('close');
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function onClickUrl() {
|
|
201
|
+
uni.setClipboardData({
|
|
202
|
+
data: props.item.url ?? '',
|
|
203
|
+
success() {
|
|
204
|
+
uni.showToast({
|
|
205
|
+
title: t('common.copySuccess'),
|
|
206
|
+
icon: 'none',
|
|
207
|
+
});
|
|
208
|
+
},
|
|
209
|
+
fail() {
|
|
210
|
+
uni.showToast({
|
|
211
|
+
title: t('common.copyFail'),
|
|
212
|
+
icon: 'none',
|
|
213
|
+
});
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
</script>
|
|
218
|
+
<style>
|
|
219
|
+
.transfer-detail {
|
|
220
|
+
position: fixed;
|
|
221
|
+
width: 100vw;
|
|
222
|
+
height: 100vh;
|
|
223
|
+
z-index: 1001;
|
|
224
|
+
top: 0;
|
|
225
|
+
left: 0;
|
|
226
|
+
padding: 0 16px;
|
|
227
|
+
|
|
228
|
+
/* #ifdef H5 || APP-PLUS */
|
|
229
|
+
padding: 50px 16px;
|
|
230
|
+
|
|
231
|
+
/* #endif */
|
|
232
|
+
background-color: var(--dev-tool-bg3-color);
|
|
233
|
+
box-sizing: border-box;
|
|
234
|
+
transition: background-color 0.3s;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.transfer-detail-control {
|
|
238
|
+
display: flex;
|
|
239
|
+
align-items: center;
|
|
240
|
+
margin-bottom: 4px;
|
|
241
|
+
gap: 12px;
|
|
242
|
+
height: 32px;
|
|
243
|
+
border-bottom: 1px solid transparent;
|
|
244
|
+
box-sizing: border-box;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.transfer-detail-item {
|
|
248
|
+
display: flex;
|
|
249
|
+
align-items: center;
|
|
250
|
+
min-height: 28px;
|
|
251
|
+
word-break: break-all;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.transfer-detail-url {
|
|
255
|
+
text-decoration: underline;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.transfer-detail-item-key {
|
|
259
|
+
white-space: nowrap;
|
|
260
|
+
margin-right: 8px;
|
|
261
|
+
color: var(--dev-tool-info-color);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.transfer-detail-payload {
|
|
265
|
+
word-break: break-all;
|
|
266
|
+
max-width: 100%;
|
|
267
|
+
}
|
|
268
|
+
</style>
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- eslint-disable vue/no-v-html, vue/no-v-text-v-html-on-component -->
|
|
3
|
+
<view class="transfer-item">
|
|
4
|
+
<view class="transfer-url-row" @click="emit('openDetail', item)">
|
|
5
|
+
<Tag mode="info">{{ type === 'upload' ? 'POST' : 'GET' }}</Tag>
|
|
6
|
+
<view class="transfer-url" v-html="item.url" />
|
|
7
|
+
</view>
|
|
8
|
+
<view class="transfer-info">
|
|
9
|
+
<view>
|
|
10
|
+
<Tag
|
|
11
|
+
v-if="
|
|
12
|
+
['pending', 'downloading', 'uploading'].includes(
|
|
13
|
+
item.status as string,
|
|
14
|
+
)
|
|
15
|
+
"
|
|
16
|
+
:mode="item.status === 'pending' ? 'info' : 'warn'">
|
|
17
|
+
{{ t(`common.${item.status}`) }}
|
|
18
|
+
</Tag>
|
|
19
|
+
<Tag v-if="item.status === 'success'" mode="success">
|
|
20
|
+
{{ t(`common.${item.status}`) }}
|
|
21
|
+
</Tag>
|
|
22
|
+
<Tag v-if="item.status === 'error'" mode="error">
|
|
23
|
+
{{ t(`common.${item.status}`) }}
|
|
24
|
+
</Tag>
|
|
25
|
+
</view>
|
|
26
|
+
<view class="transfer-progress">
|
|
27
|
+
{{ item.type === 'upload' ? '↑' : '↓' }}
|
|
28
|
+
{{ t('common.progress') }}: {{ item.progress }}%
|
|
29
|
+
</view>
|
|
30
|
+
<view>
|
|
31
|
+
{{ t('common.startTime') }}:
|
|
32
|
+
{{
|
|
33
|
+
item.startTime
|
|
34
|
+
? formatDate(item.startTime, ' HH:mm:ss:SS')
|
|
35
|
+
: '--:--:--:---'
|
|
36
|
+
}}
|
|
37
|
+
</view>
|
|
38
|
+
<view>
|
|
39
|
+
{{ t('common.endTime') }}:
|
|
40
|
+
{{
|
|
41
|
+
item.endTime
|
|
42
|
+
? formatDate(item.endTime, ' HH:mm:ss:SS')
|
|
43
|
+
: '--:--:--:---'
|
|
44
|
+
}}
|
|
45
|
+
</view>
|
|
46
|
+
</view>
|
|
47
|
+
<view
|
|
48
|
+
:class="['transfer-stock', isUseDevSource ? 'transfer-stock-link' : '']"
|
|
49
|
+
@click.stop="emit('openCode', item.stack)">
|
|
50
|
+
{{ item?.stack }}
|
|
51
|
+
</view>
|
|
52
|
+
</view>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script lang="ts" setup>
|
|
56
|
+
import { computed } from 'vue';
|
|
57
|
+
import Tag from '../Tag/index.vue';
|
|
58
|
+
import { formatDate, isMockWX } from '../../utils';
|
|
59
|
+
import type { DevTool } from '../../type';
|
|
60
|
+
import { useI18n } from '../../i18n';
|
|
61
|
+
|
|
62
|
+
const { t } = useI18n();
|
|
63
|
+
const props = defineProps<{
|
|
64
|
+
item: DevTool.TransferItem;
|
|
65
|
+
type: 'upload' | 'download';
|
|
66
|
+
zIndex?: number;
|
|
67
|
+
mode?: string;
|
|
68
|
+
useDevSource?: boolean;
|
|
69
|
+
}>();
|
|
70
|
+
const emit = defineEmits<{
|
|
71
|
+
(e: 'openDetail', value: DevTool.TransferItem): void;
|
|
72
|
+
(e: 'openCode', value?: string): void;
|
|
73
|
+
}>();
|
|
74
|
+
|
|
75
|
+
const isUseDevSource = computed(() => {
|
|
76
|
+
return (
|
|
77
|
+
!isMockWX(props?.item?.stack ?? '') &&
|
|
78
|
+
props.mode === 'development' &&
|
|
79
|
+
props.useDevSource
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
</script>
|
|
83
|
+
<style scoped>
|
|
84
|
+
.transfer-item {
|
|
85
|
+
padding: 16px;
|
|
86
|
+
border-bottom: 1px solid var(--dev-tool-border-color);
|
|
87
|
+
font-size: var(--dev-tool-base-font-size);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.transfer-url-row {
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
word-break: break-all;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.transfer-url {
|
|
97
|
+
margin-left: 4px;
|
|
98
|
+
flex: 1;
|
|
99
|
+
white-space: nowrap;
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
text-overflow: ellipsis;
|
|
102
|
+
text-decoration: underline;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.transfer-info {
|
|
106
|
+
display: flex;
|
|
107
|
+
align-items: center;
|
|
108
|
+
justify-content: space-between;
|
|
109
|
+
margin-top: 4px;
|
|
110
|
+
color: var(--dev-tool-text-color);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.transfer-progress {
|
|
114
|
+
width: 110px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.transfer-stock {
|
|
118
|
+
text-align: right;
|
|
119
|
+
overflow-wrap: break-word;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.transfer-stock-link {
|
|
123
|
+
text-decoration: underline;
|
|
124
|
+
}
|
|
125
|
+
</style>
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="transfer-content">
|
|
3
|
+
<view class="transfer-control">
|
|
4
|
+
<DevToolTitle customStyle="flex-shrink: 0">
|
|
5
|
+
{{ t('transfer.title') }}
|
|
6
|
+
</DevToolTitle>
|
|
7
|
+
<FilterInput
|
|
8
|
+
v-model="modelValue"
|
|
9
|
+
:placeholder="t('transfer.searchUrl')"
|
|
10
|
+
customStyle="flex: 1; width: auto;"
|
|
11
|
+
@search="emit('search', $event)" />
|
|
12
|
+
<Pick
|
|
13
|
+
:modelValue="currentType"
|
|
14
|
+
:options="filterOptions"
|
|
15
|
+
:readonly="true"
|
|
16
|
+
:placeholder="t('common.selectStatus')"
|
|
17
|
+
customStyle="flex: 1; width: auto; "
|
|
18
|
+
@change="onFilterChange" />
|
|
19
|
+
<Pick
|
|
20
|
+
:modelValue="currentCategory"
|
|
21
|
+
:options="categoryOptions"
|
|
22
|
+
:readonly="true"
|
|
23
|
+
:placeholder="t('common.selectType')"
|
|
24
|
+
customStyle="flex: 1; width: auto;"
|
|
25
|
+
@change="onCategoryChange" />
|
|
26
|
+
|
|
27
|
+
<Tag mode="clear" @click="onChoose('clear')" style="flex-shrink: 0">
|
|
28
|
+
{{ t('common.clear') }}
|
|
29
|
+
</Tag>
|
|
30
|
+
</view>
|
|
31
|
+
<VirtualList
|
|
32
|
+
:data="list"
|
|
33
|
+
:pageSize="15"
|
|
34
|
+
:height="contentHeight - 32 - 32"
|
|
35
|
+
className="transfer-list">
|
|
36
|
+
<template v-slot="{ list: vList, start, itemsHeight, onSizeChange }">
|
|
37
|
+
<AutoSize
|
|
38
|
+
v-for="(item, index) in vList"
|
|
39
|
+
:index="start + index"
|
|
40
|
+
:key="start + index"
|
|
41
|
+
:itemsHeight="itemsHeight"
|
|
42
|
+
:onSizeChange="onSizeChange">
|
|
43
|
+
<TransferItem
|
|
44
|
+
:item="item"
|
|
45
|
+
:type="type"
|
|
46
|
+
:zIndex="zIndex"
|
|
47
|
+
:mode="mode"
|
|
48
|
+
:useDevSource="useDevSource"
|
|
49
|
+
@openDetail="emit('openDetail', $event)"
|
|
50
|
+
@openCode="emit('openCode', $event)" />
|
|
51
|
+
</AutoSize>
|
|
52
|
+
<Empty v-if="!list || list.length === 0" />
|
|
53
|
+
</template>
|
|
54
|
+
</VirtualList>
|
|
55
|
+
</view>
|
|
56
|
+
</template>
|
|
57
|
+
<script lang="ts" setup>
|
|
58
|
+
import { computed } from 'vue';
|
|
59
|
+
import Tag from '../Tag/index.vue';
|
|
60
|
+
import TransferItem from './TransferItem.vue';
|
|
61
|
+
import Empty from '../Empty/index.vue';
|
|
62
|
+
import FilterInput from '../FilterInput/index.vue';
|
|
63
|
+
import Pick from '../Pick/index.vue';
|
|
64
|
+
import type { DevTool } from '../../type';
|
|
65
|
+
import VirtualList from '../VirtualList/index.vue';
|
|
66
|
+
import AutoSize from '../VirtualList/AutoSize.vue';
|
|
67
|
+
import DevToolTitle from '../DevToolTitle/index.vue';
|
|
68
|
+
import { useI18n } from '../../i18n';
|
|
69
|
+
|
|
70
|
+
const { t } = useI18n();
|
|
71
|
+
|
|
72
|
+
const _props = defineProps<{
|
|
73
|
+
currentType: string;
|
|
74
|
+
currentCategory?: string;
|
|
75
|
+
list: DevTool.TransferItem[];
|
|
76
|
+
type: 'upload' | 'download';
|
|
77
|
+
mode?: string;
|
|
78
|
+
zIndex: number;
|
|
79
|
+
useDevSource?: boolean;
|
|
80
|
+
contentHeight: number;
|
|
81
|
+
}>();
|
|
82
|
+
|
|
83
|
+
const modelValue = defineModel<string>('modelValue', { required: true });
|
|
84
|
+
|
|
85
|
+
const emit = defineEmits<{
|
|
86
|
+
(e: 'choose', type: string): void;
|
|
87
|
+
(e: 'chooseCategory', type: string): void;
|
|
88
|
+
(e: 'search', value: string): void;
|
|
89
|
+
(e: 'openDetail', value: DevTool.TransferItem): void;
|
|
90
|
+
(e: 'openCode', value?: string): void;
|
|
91
|
+
}>();
|
|
92
|
+
|
|
93
|
+
const categoryOptions = computed(() => {
|
|
94
|
+
return [
|
|
95
|
+
{
|
|
96
|
+
label: t('common.all'),
|
|
97
|
+
value: 'all',
|
|
98
|
+
mode: 'all',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
label: t('common.upload'),
|
|
102
|
+
value: 'upload',
|
|
103
|
+
mode: 'warn',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
label: t('common.download'),
|
|
107
|
+
value: 'download',
|
|
108
|
+
mode: 'warn',
|
|
109
|
+
},
|
|
110
|
+
];
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
const filterItems = computed(() => {
|
|
114
|
+
const items = [
|
|
115
|
+
{
|
|
116
|
+
label: t('common.all'),
|
|
117
|
+
value: 'all',
|
|
118
|
+
mode: 'all',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
label: t('common.pending'),
|
|
122
|
+
value: 'pending',
|
|
123
|
+
mode: 'info',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
label: t('common.success'),
|
|
127
|
+
value: 'success',
|
|
128
|
+
mode: 'success',
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
label: t('common.error'),
|
|
132
|
+
value: 'error',
|
|
133
|
+
mode: 'error',
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
label: t('common.clear'),
|
|
137
|
+
value: 'clear',
|
|
138
|
+
mode: 'clear',
|
|
139
|
+
},
|
|
140
|
+
];
|
|
141
|
+
|
|
142
|
+
return items;
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
function onChoose(type: string) {
|
|
146
|
+
emit('choose', type);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const filterOptions = computed(() => {
|
|
150
|
+
return filterItems.value.filter((item) => item.value !== 'clear');
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
function onFilterChange(item: { label: string; value: any }) {
|
|
154
|
+
emit('choose', item.value);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function onCategoryChange(item: { label: string; value: any }) {
|
|
158
|
+
emit('chooseCategory', item.value);
|
|
159
|
+
}
|
|
160
|
+
</script>
|
|
161
|
+
<style scoped>
|
|
162
|
+
.transfer-content {
|
|
163
|
+
height: 100%;
|
|
164
|
+
font-size: var(--dev-tool-base-font-size);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.transfer-list {
|
|
168
|
+
height: calc(100% - 32px);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.transfer-control {
|
|
172
|
+
display: flex;
|
|
173
|
+
align-items: center;
|
|
174
|
+
justify-content: space-between;
|
|
175
|
+
gap: 4px;
|
|
176
|
+
padding: 0 16px;
|
|
177
|
+
height: 32px;
|
|
178
|
+
border-bottom: 1px solid var(--dev-tool-border-color);
|
|
179
|
+
box-sizing: border-box;
|
|
180
|
+
}
|
|
181
|
+
</style>
|