Skip to content

Commit 1c32308

Browse files
committed
refactor(global): remove some unnecessary imports like defineProps
1 parent f1c94a6 commit 1c32308

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+86
-71
lines changed

src/components/AdvancedSettingsBtn.vue

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
<script setup lang="ts">
1616
import useI18nTl from '@/hooks/useI18nTl'
1717
import { ArrowRight } from '@element-plus/icons-vue'
18-
import { defineEmits, defineProps } from 'vue'
1918
2019
const props = defineProps({
2120
modelValue: {

src/components/ArrayEditor.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default defineComponent({
2828

2929
<script setup lang="ts">
3030
import type { PropType, WritableComputedRef } from 'vue'
31-
import { computed, defineEmits, defineProps } from 'vue'
31+
import { computed } from 'vue'
3232
3333
const props = defineProps({
3434
modelValue: {

src/components/ArrayEditorInput.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
</template>
44

55
<script setup lang="ts">
6-
import { computed, defineProps, PropType, defineEmits } from 'vue'
6+
import type { PropType } from 'vue'
7+
import { computed } from 'vue'
78
89
const SEPARATOR = ','
910

src/components/ArrayEditorTable.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
</template>
2222

2323
<script setup lang="ts">
24-
import { computed, defineProps, PropType, defineEmits } from 'vue'
24+
import { computed } from 'vue'
25+
import type { PropType } from 'vue'
2526
2627
const props = defineProps({
2728
modelValue: {

src/components/BooleanSelect.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export default defineComponent({
1414
</script>
1515

1616
<script setup lang="ts">
17-
import { defineProps, computed, defineEmits, WritableComputedRef } from 'vue'
17+
import type { WritableComputedRef } from 'vue'
18+
import { computed } from 'vue'
1819
1920
const props = defineProps({
2021
modelValue: {

src/components/CustomInputNumber.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
</template>
1212

1313
<script setup lang="ts">
14-
import { ref, defineProps, defineEmits, computed, PropType } from 'vue'
14+
import type { PropType } from 'vue'
15+
import { computed, ref } from 'vue'
1516
1617
const props = defineProps({
1718
modelValue: {

src/components/InputWithPlaceholderSelect.vue

+15-9
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@
2424
<script setup lang="ts">
2525
import useSQLAvailablePlaceholder from '@/hooks/Rule/useSQLAvailablePlaceholder'
2626
import { escapeRegExp } from 'lodash'
27-
import { computed, defineEmits, defineProps, ref, watch } from 'vue'
27+
import { computed, ref, watch } from 'vue'
2828
29-
const props =
30-
defineProps<{ modelValue?: string; [key: string]: any; customPlaceholders?: Array<string> }>()
29+
const props = defineProps<{
30+
modelValue?: string
31+
[key: string]: any
32+
customPlaceholders?: Array<string>
33+
}>()
3134
const emit = defineEmits<{
3235
(e: 'update:modelValue', v: string): void
3336
(e: 'input', v: any): void
@@ -52,12 +55,15 @@ const fetchSuggestions = (queryString: string, cb: any) => {
5255
if (matchPart) {
5356
const filterReg = new RegExp(escapeRegExp(matchPart), 'i')
5457
const availableList = props.customPlaceholders || availablePlaceholders.value
55-
ret = availableList.reduce((arr: Array<{ value: string }>, value: string) => {
56-
if (filterReg.test(value)) {
57-
arr.push({ value })
58-
}
59-
return arr
60-
}, [] as Array<{ value: string }>)
58+
ret = availableList.reduce(
59+
(arr: Array<{ value: string }>, value: string) => {
60+
if (filterReg.test(value)) {
61+
arr.push({ value })
62+
}
63+
return arr
64+
},
65+
[] as Array<{ value: string }>,
66+
)
6167
}
6268
cb(ret)
6369
}

src/components/InputWithUnit.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default defineComponent({
3939
<script setup lang="ts">
4040
import { escapeRegExp } from 'lodash'
4141
import type { PropType, WritableComputedRef } from 'vue'
42-
import { computed, defineEmits, defineProps, ref } from 'vue'
42+
import { computed, ref } from 'vue'
4343
4444
const props = defineProps({
4545
modelValue: {
@@ -143,7 +143,7 @@ const numPart: WritableComputedRef<string> = computed({
143143
/**
144144
* handle the situation that does not input num but selected unit
145145
*/
146-
let selectedUnit = ref('')
146+
const selectedUnit = ref('')
147147
const unit: WritableComputedRef<string> = computed({
148148
get() {
149149
const { disabledOpt } = props

src/components/KeyAndValueEditor.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ import { splitOnComma, splitOnSymbol } from '@/common/tools'
105105
import { Delete, Plus } from '@element-plus/icons-vue'
106106
import { cloneDeep, isEqual, isPlainObject } from 'lodash'
107107
import type { PropType } from 'vue'
108-
import { computed, defineEmits, defineProps, ref, watch } from 'vue'
108+
import { computed, ref, watch } from 'vue'
109109
import { useI18n } from 'vue-i18n'
110110
import InputWithPlaceholderSelect from './InputWithPlaceholderSelect.vue'
111111

src/components/ListenerDrawer/CustomConfigs.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</template>
1515

1616
<script lang="ts" setup>
17-
import { PropType, defineEmits, defineProps, ref, watch, defineExpose } from 'vue'
17+
import { PropType, ref, watch } from 'vue'
1818
import useI18nTl from '@/hooks/useI18nTl'
1919
import { Listener } from '@/types/listener'
2020
import { unexposedConfigs } from '@/common/constants'

src/components/ListenerDrawer/DTLSVersionSelect.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default defineComponent({
1414

1515
<script setup lang="ts">
1616
import type { PropType, WritableComputedRef } from 'vue'
17-
import { computed, defineEmits, defineProps } from 'vue'
17+
import { computed } from 'vue'
1818
1919
const props = defineProps({
2020
modelValue: {

src/components/ListenerDrawer/ListenerDrawer.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ import useListenerDrawer from '@/hooks/Config/useListenerDrawer'
429429
import useI18nTl from '@/hooks/useI18nTl'
430430
import { GatewayName, ListenerType, ListenerTypeForGateway } from '@/types/enum'
431431
import { Listener } from '@/types/listener'
432-
import { PropType, computed, defineEmits, defineProps } from 'vue'
432+
import { PropType, computed } from 'vue'
433433
import ArrayEditorInput from '../ArrayEditorInput.vue'
434434
import CustomInputNumber from '../CustomInputNumber.vue'
435435
import DTLSVersionSelect from './DTLSVersionSelect.vue'

src/components/ListenerDrawer/SSLVersionSelect.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default defineComponent({
1414

1515
<script setup lang="ts">
1616
import type { PropType, WritableComputedRef } from 'vue'
17-
import { computed, defineEmits, defineProps } from 'vue'
17+
import { computed } from 'vue'
1818
1919
const props = defineProps({
2020
modelValue: {

src/components/MiniPagination.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</template>
1111

1212
<script setup lang="ts">
13-
import { defineProps, computed, defineEmits } from 'vue'
13+
import { computed } from 'vue'
1414

1515
const props = defineProps({
1616
currentPage: {

src/components/Monaco.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default defineComponent({
1414
import * as monaco from 'monaco-editor'
1515
import { conf as sqlConf, language as sql } from 'monaco-editor/esm/vs/basic-languages/sql/sql'
1616
import { debounce } from 'lodash'
17-
import { defineProps, defineEmits, onMounted, onUnmounted, watch, nextTick, computed } from 'vue'
17+
import { onMounted, onUnmounted, watch, nextTick, computed } from 'vue'
1818
import { useStore } from 'vuex'
1919
import EditorDark from '@/assets/theme/editor-dark.json'
2020
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'

src/components/Oneof.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<div class="switch-container">
1616
<el-switch
1717
v-model="switchProxy"
18-
:inactive-value="(oneOfInfo.valueDisabled as string)"
18+
:inactive-value="oneOfInfo.valueDisabled as string"
1919
:disabled="disabled"
2020
/>
2121
<span class="tip" v-if="valueProxy === oneOfInfo.valueDisabled">
@@ -91,7 +91,7 @@ import { Properties, Property } from '@/types/schemaForm'
9191
import { ElFormItem } from 'element-plus'
9292
import { isFunction } from 'lodash'
9393
import type { ComputedRef, PropType, WritableComputedRef } from 'vue'
94-
import { computed, defineEmits, defineProps, getCurrentInstance, nextTick, watch } from 'vue'
94+
import { computed, getCurrentInstance, nextTick, watch } from 'vue'
9595
import CustomInputNumber from './CustomInputNumber.vue'
9696
import InputWithUnit from './InputWithUnit.vue'
9797
import TimeInputWithUnitSelect from './TimeInputWithUnitSelect.vue'
@@ -172,7 +172,7 @@ const valueProxy: WritableComputedRef<any> = computed({
172172
set(val) {
173173
const { valueDisabled, propEnabled } = oneOfInfo.value
174174
if (valueDisabled !== undefined) {
175-
const value = val === valueDisabled ? valueDisabled : val ?? propEnabled?.default
175+
const value = val === valueDisabled ? valueDisabled : (val ?? propEnabled?.default)
176176
emit('update:modelValue', value)
177177
} else {
178178
emit('update:modelValue', val)

src/components/OneofRefs.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
</template>
4040
<SchemaFormItem
4141
v-model="(fieldValue as any)[$key]"
42-
:type="(item.type as any)"
42+
:type="(item as any).type"
4343
:symbols="item.symbols"
4444
:format="item.format"
4545
:customProps="item.componentProps"
@@ -57,7 +57,7 @@ import { useSymbolLabel } from '@/hooks/Schema/useItemLabelAndDesc'
5757
import { Properties, Property } from '@/types/schemaForm'
5858
import { cloneDeep, isEqual, isFunction, snakeCase } from 'lodash'
5959
import type { PropType } from 'vue'
60-
import { computed, defineEmits, defineProps, ref, watch } from 'vue'
60+
import { computed, ref, watch } from 'vue'
6161
import CustomFormItem from './CustomFormItem.vue'
6262
import FormItemLabel from './FormItemLabel.vue'
6363
import SchemaFormItem from './SchemaFormItem'

src/components/OneofRefsSelect.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { getLabelFromValueInOptionList } from '@/common/tools'
2727
import { useSymbolLabel } from '@/hooks/Schema/useItemLabelAndDesc'
2828
import { Properties, Property } from '@/types/schemaForm'
2929
import { isEqual, isFunction, snakeCase } from 'lodash'
30-
import { computed, defineEmits, defineProps, ref, watch } from 'vue'
30+
import { computed, ref, watch } from 'vue'
3131
import type { PropType } from 'vue'
3232
import CustomFormItem from './CustomFormItem.vue'
3333

src/components/PayloadDialog.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import useI18nTl from '@/hooks/useI18nTl'
4545
import useShowTextByDifferent from '@/hooks/useShowTextByDifferent'
4646
import { PayloadShowByType } from '@/types/enum'
4747
import { ElDialog } from 'element-plus'
48-
import { computed, defineEmits, defineProps, watch, withDefaults } from 'vue'
48+
import { computed, watch, withDefaults } from 'vue'
4949
5050
const props = withDefaults(
5151
defineProps<{

src/components/PluginsForm/PluginFormKit.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
v-for="(configs, name) in layouts.$form"
1212
v-model="configsForm[name]"
1313
:key="name"
14-
:name="(name as string)"
14+
:name="name as string"
1515
:form-configs="configs"
1616
/>
1717
</el-row>
@@ -26,7 +26,8 @@
2626
</template>
2727

2828
<script lang="ts" setup>
29-
import { PropType, defineProps, defineEmits, ref, watch, nextTick } from 'vue'
29+
import type { PropType } from 'vue'
30+
import { ref, watch, nextTick } from 'vue'
3031
import { PluginUIConfigs } from '@/types/plugin'
3132
import PluginFormKitItem from './PluginFormKitItem.vue'
3233
import _ from 'lodash'

src/components/PluginsForm/PluginFormKitItem.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ export default {
7676

7777
<script lang="ts" setup>
7878
import { ConfigField } from '@/types/plugin'
79-
import { PropType, defineProps, ref, watch, defineEmits } from 'vue'
79+
import type { PropType } from 'vue'
80+
import { ref, watch } from 'vue'
8081
import PluginFormKitItem from './PluginFormKitItem.vue'
8182
import FormItemLabel from '@/components/FormItemLabel.vue'
8283
import KeyValueEditor from '@/components/KeyAndValueEditor.vue'

src/components/SelectAllowInput.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<script setup lang="ts">
1212
import { escapeRegExp, isObject, isUndefined } from 'lodash'
13-
import { computed, defineEmits, defineProps, withDefaults } from 'vue'
13+
import { computed, withDefaults } from 'vue'
1414

1515
const props = withDefaults(
1616
defineProps<{

src/components/TLSConfig/CertFileInput.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
<script setup lang="ts">
1313
import { CER_FILE_ACCEPTS } from '@/common/constants'
1414
import TextareaWithUploader from '@/components/TextareaWithUploader.vue'
15-
import { PropType, computed, defineEmits, defineProps, ref } from 'vue'
15+
import type { PropType } from 'vue'
16+
import { computed, ref } from 'vue'
1617
import ConfigItemDataLook from './ConfigItemDataLook.vue'
1718
1819
const props = defineProps({

src/components/TLSConfig/CommonTLSConfig.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ export default defineComponent({
2424
</script>
2525

2626
<script setup lang="ts">
27-
import { defineProps, defineEmits, computed, PropType, WritableComputedRef } from 'vue'
27+
import type { PropType, WritableComputedRef } from 'vue'
28+
import { computed } from 'vue'
2829
import TLSBaseConfig from './TLSBaseConfig.vue'
2930
import TLSEnableConfig from './TLSEnableConfig.vue'
3031
import { SSL } from '@/types/common'

src/components/TLSConfig/ConfigItemDataLook.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default defineComponent({
2626
</script>
2727

2828
<script setup lang="ts">
29-
import { defineEmits, defineProps, computed } from 'vue'
29+
import { computed } from 'vue'
3030
import { DocumentCopy } from '@element-plus/icons-vue'
3131
import { useI18n } from 'vue-i18n'
3232
import useCopy from '@/hooks/useCopy'

src/components/TLSConfig/TLSBaseConfig.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ export default defineComponent({
1717
</script>
1818

1919
<script setup lang="ts">
20-
import { defineProps, defineEmits, computed, PropType, WritableComputedRef } from 'vue'
20+
import type { PropType, WritableComputedRef } from 'vue'
21+
import { computed } from 'vue'
2122
import { SSL } from '@/types/common'
2223
2324
const props = defineProps({

src/components/TLSConfig/TLSEnableConfig.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ import InfoTooltip from '@/components/InfoTooltip.vue'
108108
import useI18nTl from '@/hooks/useI18nTl'
109109
import { SSL } from '@/types/common'
110110
import type { PropType } from 'vue'
111-
import { computed, defineEmits, defineProps, ref } from 'vue'
111+
import { computed, ref } from 'vue'
112112
import CustomFormItem from '../CustomFormItem.vue'
113113
import TextareaWithUploader from '../TextareaWithUploader.vue'
114114
import ConfigItemDataLook from './ConfigItemDataLook.vue'

src/components/TextareaWithUploader.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ export default defineComponent({
2828
</script>
2929

3030
<script setup lang="ts">
31-
import { defineProps, computed, defineEmits, PropType } from 'vue'
31+
import type { PropType } from 'vue'
32+
import { computed } from 'vue'
3233
import { UploadFile, ElMessageBox, ElMessage } from 'element-plus'
3334
import useI18nTl from '@/hooks/useI18nTl'
3435
import { findExtensionByName } from '@/common/tools'

src/components/ZoneSelect.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default defineComponent({
1414

1515
<script setup lang="ts">
1616
import type { WritableComputedRef } from 'vue'
17-
import { computed, defineEmits, defineProps, ref } from 'vue'
17+
import { computed, ref } from 'vue'
1818
import { getZoneConfigs } from '@/api/config'
1919
import { DEFAULT_ZONE } from '@/common/constants'
2020

src/components/commonPagination.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@
1717
<MiniPagination
1818
v-else-if="meta.count === -1"
1919
:current-page="meta.page"
20-
:hasnext="(meta.hasnext as boolean)"
20+
:hasnext="!!meta.hasnext"
2121
@current-change="handleCurrentChanged"
2222
/>
2323
</div>
2424
</template>
2525

2626
<script setup lang="ts">
27-
import { computed, watch, PropType, defineProps, defineEmits } from 'vue'
27+
import { computed, watch } from 'vue'
28+
import type { PropType } from 'vue'
2829
import MiniPagination from './MiniPagination.vue'
2930
import { PageData } from '@/types/common'
3031

src/views/Auth/components/AuthnUsersImport.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
</template>
7272

7373
<script setup lang="ts">
74-
import { ref, defineEmits } from 'vue'
74+
import { ref } from 'vue'
7575
import { Upload } from '@element-plus/icons-vue'
7676
import { downloadByURL } from '@/common/tools'
7777
import useI18nTl from '@/hooks/useI18nTl'

src/views/Auth/components/AuthzSettingDrawer.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ import InputWithUnit from '@/components/InputWithUnit.vue'
7878
import { AuthzSetting } from '@/types/auth'
7979
import { ElMessage, ElMessageBox } from 'element-plus'
8080
import type { Ref, WritableComputedRef } from 'vue'
81-
import { computed, defineEmits, defineProps, ref, watch } from 'vue'
81+
import { computed, ref, watch } from 'vue'
8282
import { useI18n } from 'vue-i18n'
8383
import FormItemLabel from '@/components/FormItemLabel.vue'
8484
import ArrayEditor from '@/components/ArrayEditor.vue'

src/views/Auth/components/LdapConfig.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@
142142
</template>
143143

144144
<script lang="ts" setup>
145-
import { PropType, ref, defineProps, watch, defineEmits, defineExpose } from 'vue'
145+
import type { PropType } from 'vue'
146+
import { ref, watch } from 'vue'
146147
import CommonTLSConfig from '@/components/TLSConfig/CommonTLSConfig.vue'
147148
import useLdapConfigFrom from '@/hooks/Auth/useLdapConfigForm'
148149
import TimeInputWithUnitSelect from '@/components/TimeInputWithUnitSelect.vue'

0 commit comments

Comments
 (0)